def test_env_log(self): packet_encoding.init_all() assert packet_encoding.get_packet_encoding_caps() assert packet_encoding.get_enabled_encoders() for x in packet_encoding.get_enabled_encoders(): e = packet_encoding.get_encoder(x) for packet_data in (["hello", { "foo": 1, "bar": True }], #b"foo", ): assert e v, flag = e(packet_data) assert v if x == "none": #'none' cannot decode back continue try: r = packet_encoding.decode(v, flag) assert r except Exception: print("error calling decode(%s, %s) for encoder %s" % (v, flag, x)) raise #one-shot function: assert packet_encoding.pack_one_packet(["hello", {}])
def get_network_caps(): try: from xpra.net.mmap_pipe import can_use_mmap mmap = can_use_mmap() except: mmap = False caps = { "digest": ("hmac", "xor"), "compressors": compression.get_enabled_compressors(), "encoders": packet_encoding.get_enabled_encoders(), "mmap": mmap, } caps.update(get_crypto_caps()) caps.update(get_compression_caps()) caps.update(get_packet_encoding_caps()) return caps
def get_network_caps(): try: from xpra.net.mmap_pipe import can_use_mmap mmap = can_use_mmap() except: mmap = False caps = { "digest" : ("hmac", "xor"), "compressors" : compression.get_enabled_compressors(), "encoders" : packet_encoding.get_enabled_encoders(), "mmap" : mmap, } caps.update(get_crypto_caps()) caps.update(get_compression_caps()) caps.update(get_packet_encoding_caps()) return caps
def get_network_caps() -> dict: from xpra.net.digest import get_digests from xpra.net.crypto import get_crypto_caps from xpra.net.compression import get_enabled_compressors, get_compression_caps from xpra.net.packet_encoding import get_enabled_encoders, get_packet_encoding_caps digests = get_digests() #"hmac" is the legacy name, "xor" and "des" should not be used for salt: salt_digests = tuple(x for x in digests if x not in ("hmac", "xor", "des")) caps = { "digest": digests, "salt-digest": salt_digests, "compressors": get_enabled_compressors(), "encoders": get_enabled_encoders(), } caps.update(get_crypto_caps()) caps.update(get_compression_caps()) caps.update(get_packet_encoding_caps()) return caps
def get_network_caps(legacy=True): try: from xpra.net.mmap_pipe import can_use_mmap mmap = can_use_mmap() except: mmap = False caps = { "digest": ("hmac", "xor"), "compressors": compression.get_enabled_compressors(), "encoders": packet_encoding.get_enabled_encoders(), "mmap": mmap, } if legacy: #for backwards compatibility only: caps.update({"raw_packets": True, "chunked_compression": True}) caps.update(get_crypto_caps()) caps.update(get_compression_caps()) caps.update(get_packet_encoding_caps()) return caps
def get_network_caps(): try: from xpra.net.mmap_pipe import can_use_mmap mmap = can_use_mmap() except: mmap = False digests = get_digests() #"hmac" is the legacy name, "xor" should not be used for salt: salt_digests = [x for x in digests if x not in ("hmac", "xor")] caps = { "digest": digests, "salt-digest": salt_digests, "compressors": compression.get_enabled_compressors(), "encoders": packet_encoding.get_enabled_encoders(), "mmap": mmap, } caps.update(get_crypto_caps()) caps.update(get_compression_caps()) caps.update(get_packet_encoding_caps()) return caps
def get_network_caps(legacy=True): try: from xpra.net.mmap_pipe import can_use_mmap mmap = can_use_mmap() except: mmap = False caps = { "digest": ("hmac", "xor"), "compressors": compression.get_enabled_compressors(), "encoders": packet_encoding.get_enabled_encoders(), "mmap": mmap, } if legacy: # for backwards compatibility only: caps.update({"raw_packets": True, "chunked_compression": True}) caps.update(get_crypto_caps()) caps.update(get_compression_caps()) caps.update(get_packet_encoding_caps()) return caps
def get_network_caps(): try: from xpra.platform.features import MMAP_SUPPORTED except: MMAP_SUPPORTED = False from xpra.net.crypto import get_digests, get_crypto_caps from xpra.net.compression import get_enabled_compressors, get_compression_caps from xpra.net.packet_encoding import get_enabled_encoders, get_packet_encoding_caps digests = get_digests() #"hmac" is the legacy name, "xor" and "des" should not be used for salt: salt_digests = [x for x in digests if x not in ("hmac", "xor", "des")] caps = { "digest": digests, "salt-digest": salt_digests, "compressors": get_enabled_compressors(), "encoders": get_enabled_encoders(), "mmap": MMAP_SUPPORTED, } caps.update(get_crypto_caps()) caps.update(get_compression_caps()) caps.update(get_packet_encoding_caps()) return caps