diff --git a/libp2p/__init__.py b/libp2p/__init__.py index 9afbf6a2..73912d4f 100644 --- a/libp2p/__init__.py +++ b/libp2p/__init__.py @@ -1,3 +1,5 @@ +from importlib.metadata import version as __version + from libp2p.crypto.keys import ( KeyPair, ) @@ -132,3 +134,6 @@ def new_host( else: host = BasicHost(swarm) return host + + +__version__ = __version("libp2p") diff --git a/libp2p/crypto/pb/crypto_pb2.py b/libp2p/crypto/pb/crypto_pb2.py index fda8fa41..04435d4a 100644 --- a/libp2p/crypto/pb/crypto_pb2.py +++ b/libp2p/crypto/pb/crypto_pb2.py @@ -1,204 +1,30 @@ +# -*- coding: utf-8 -*- # Generated by the protocol buffer compiler. DO NOT EDIT! # source: libp2p/crypto/pb/crypto.proto - -import sys - -_b = sys.version_info[0] < 3 and (lambda x: x) or (lambda x: x.encode("latin1")) -from google.protobuf.internal import enum_type_wrapper +# Protobuf Python Version: 4.25.3 +"""Generated protocol buffer code.""" from google.protobuf import descriptor as _descriptor -from google.protobuf import message as _message -from google.protobuf import reflection as _reflection +from google.protobuf import descriptor_pool as _descriptor_pool from google.protobuf import symbol_database as _symbol_database - +from google.protobuf.internal import builder as _builder # @@protoc_insertion_point(imports) _sym_db = _symbol_database.Default() -DESCRIPTOR = _descriptor.FileDescriptor( - name="libp2p/crypto/pb/crypto.proto", - package="crypto.pb", - syntax="proto2", - serialized_options=None, - serialized_pb=_b( - '\n\x1dlibp2p/crypto/pb/crypto.proto\x12\tcrypto.pb"?\n\tPublicKey\x12$\n\x08key_type\x18\x01 \x02(\x0e\x32\x12.crypto.pb.KeyType\x12\x0c\n\x04\x64\x61ta\x18\x02 \x02(\x0c"@\n\nPrivateKey\x12$\n\x08key_type\x18\x01 \x02(\x0e\x32\x12.crypto.pb.KeyType\x12\x0c\n\x04\x64\x61ta\x18\x02 \x02(\x0c*9\n\x07KeyType\x12\x07\n\x03RSA\x10\x00\x12\x0b\n\x07\x45\x64\x32\x35\x35\x31\x39\x10\x01\x12\r\n\tSecp256k1\x10\x02\x12\t\n\x05\x45\x43\x44SA\x10\x03' - ), -) - -_KEYTYPE = _descriptor.EnumDescriptor( - name="KeyType", - full_name="crypto.pb.KeyType", - filename=None, - file=DESCRIPTOR, - values=[ - _descriptor.EnumValueDescriptor( - name="RSA", index=0, number=0, serialized_options=None, type=None - ), - _descriptor.EnumValueDescriptor( - name="Ed25519", index=1, number=1, serialized_options=None, type=None - ), - _descriptor.EnumValueDescriptor( - name="Secp256k1", index=2, number=2, serialized_options=None, type=None - ), - _descriptor.EnumValueDescriptor( - name="ECDSA", index=3, number=3, serialized_options=None, type=None - ), - ], - containing_type=None, - serialized_options=None, - serialized_start=175, - serialized_end=232, -) -_sym_db.RegisterEnumDescriptor(_KEYTYPE) - -KeyType = enum_type_wrapper.EnumTypeWrapper(_KEYTYPE) -RSA = 0 -Ed25519 = 1 -Secp256k1 = 2 -ECDSA = 3 -_PUBLICKEY = _descriptor.Descriptor( - name="PublicKey", - full_name="crypto.pb.PublicKey", - filename=None, - file=DESCRIPTOR, - containing_type=None, - fields=[ - _descriptor.FieldDescriptor( - name="key_type", - full_name="crypto.pb.PublicKey.key_type", - index=0, - number=1, - type=14, - cpp_type=8, - label=2, - has_default_value=False, - default_value=0, - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=None, - file=DESCRIPTOR, - ), - _descriptor.FieldDescriptor( - name="data", - full_name="crypto.pb.PublicKey.data", - index=1, - number=2, - type=12, - cpp_type=9, - label=2, - has_default_value=False, - default_value=_b(""), - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=None, - file=DESCRIPTOR, - ), - ], - extensions=[], - nested_types=[], - enum_types=[], - serialized_options=None, - is_extendable=False, - syntax="proto2", - extension_ranges=[], - oneofs=[], - serialized_start=44, - serialized_end=107, -) - - -_PRIVATEKEY = _descriptor.Descriptor( - name="PrivateKey", - full_name="crypto.pb.PrivateKey", - filename=None, - file=DESCRIPTOR, - containing_type=None, - fields=[ - _descriptor.FieldDescriptor( - name="key_type", - full_name="crypto.pb.PrivateKey.key_type", - index=0, - number=1, - type=14, - cpp_type=8, - label=2, - has_default_value=False, - default_value=0, - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=None, - file=DESCRIPTOR, - ), - _descriptor.FieldDescriptor( - name="data", - full_name="crypto.pb.PrivateKey.data", - index=1, - number=2, - type=12, - cpp_type=9, - label=2, - has_default_value=False, - default_value=_b(""), - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=None, - file=DESCRIPTOR, - ), - ], - extensions=[], - nested_types=[], - enum_types=[], - serialized_options=None, - is_extendable=False, - syntax="proto2", - extension_ranges=[], - oneofs=[], - serialized_start=109, - serialized_end=173, -) - -_PUBLICKEY.fields_by_name["key_type"].enum_type = _KEYTYPE -_PRIVATEKEY.fields_by_name["key_type"].enum_type = _KEYTYPE -DESCRIPTOR.message_types_by_name["PublicKey"] = _PUBLICKEY -DESCRIPTOR.message_types_by_name["PrivateKey"] = _PRIVATEKEY -DESCRIPTOR.enum_types_by_name["KeyType"] = _KEYTYPE -_sym_db.RegisterFileDescriptor(DESCRIPTOR) - -PublicKey = _reflection.GeneratedProtocolMessageType( - "PublicKey", - (_message.Message,), - { - "DESCRIPTOR": _PUBLICKEY, - "__module__": "libp2p.crypto.pb.crypto_pb2" - # @@protoc_insertion_point(class_scope:crypto.pb.PublicKey) - }, -) -_sym_db.RegisterMessage(PublicKey) - -PrivateKey = _reflection.GeneratedProtocolMessageType( - "PrivateKey", - (_message.Message,), - { - "DESCRIPTOR": _PRIVATEKEY, - "__module__": "libp2p.crypto.pb.crypto_pb2" - # @@protoc_insertion_point(class_scope:crypto.pb.PrivateKey) - }, -) -_sym_db.RegisterMessage(PrivateKey) - +DESCRIPTOR = _descriptor_pool.Default().AddSerializedFile(b'\n\x1dlibp2p/crypto/pb/crypto.proto\x12\tcrypto.pb\"?\n\tPublicKey\x12$\n\x08key_type\x18\x01 \x02(\x0e\x32\x12.crypto.pb.KeyType\x12\x0c\n\x04\x64\x61ta\x18\x02 \x02(\x0c\"@\n\nPrivateKey\x12$\n\x08key_type\x18\x01 \x02(\x0e\x32\x12.crypto.pb.KeyType\x12\x0c\n\x04\x64\x61ta\x18\x02 \x02(\x0c*9\n\x07KeyType\x12\x07\n\x03RSA\x10\x00\x12\x0b\n\x07\x45\x64\x32\x35\x35\x31\x39\x10\x01\x12\r\n\tSecp256k1\x10\x02\x12\t\n\x05\x45\x43\x44SA\x10\x03') +_globals = globals() +_builder.BuildMessageAndEnumDescriptors(DESCRIPTOR, _globals) +_builder.BuildTopDescriptorsAndMessages(DESCRIPTOR, 'libp2p.crypto.pb.crypto_pb2', _globals) +if _descriptor._USE_C_DESCRIPTORS == False: + DESCRIPTOR._options = None + _globals['_KEYTYPE']._serialized_start=175 + _globals['_KEYTYPE']._serialized_end=232 + _globals['_PUBLICKEY']._serialized_start=44 + _globals['_PUBLICKEY']._serialized_end=107 + _globals['_PRIVATEKEY']._serialized_start=109 + _globals['_PRIVATEKEY']._serialized_end=173 # @@protoc_insertion_point(module_scope) diff --git a/libp2p/crypto/pb/crypto_pb2.pyi b/libp2p/crypto/pb/crypto_pb2.pyi index 08656f0a..777fcbd2 100644 --- a/libp2p/crypto/pb/crypto_pb2.pyi +++ b/libp2p/crypto/pb/crypto_pb2.pyi @@ -1,114 +1,74 @@ -# @generated by generate_proto_mypy_stubs.py. Do not edit! +""" +@generated by mypy-protobuf. Do not edit manually! +isort:skip_file +""" +import builtins +import google.protobuf.descriptor +import google.protobuf.internal.enum_type_wrapper +import google.protobuf.message import sys -from google.protobuf.descriptor import ( - Descriptor as google___protobuf___descriptor___Descriptor, - EnumDescriptor as google___protobuf___descriptor___EnumDescriptor, -) +import typing -from google.protobuf.message import ( - Message as google___protobuf___message___Message, -) +if sys.version_info >= (3, 10): + import typing as typing_extensions +else: + import typing_extensions -from typing import ( - List as typing___List, - Tuple as typing___Tuple, - cast as typing___cast, -) +DESCRIPTOR: google.protobuf.descriptor.FileDescriptor -from typing_extensions import ( - Literal as typing_extensions___Literal, -) +class _KeyType: + ValueType = typing.NewType("ValueType", builtins.int) + V: typing_extensions.TypeAlias = ValueType -class KeyType(int): - DESCRIPTOR: google___protobuf___descriptor___EnumDescriptor = ... - @classmethod - def Name(cls, number: int) -> str: ... - @classmethod - def Value(cls, name: str) -> KeyType: ... - @classmethod - def keys(cls) -> typing___List[str]: ... - @classmethod - def values(cls) -> typing___List[KeyType]: ... - @classmethod - def items(cls) -> typing___List[typing___Tuple[str, KeyType]]: ... - RSA = typing___cast(KeyType, 0) - Ed25519 = typing___cast(KeyType, 1) - Secp256k1 = typing___cast(KeyType, 2) - ECDSA = typing___cast(KeyType, 3) +class _KeyTypeEnumTypeWrapper(google.protobuf.internal.enum_type_wrapper._EnumTypeWrapper[_KeyType.ValueType], builtins.type): + DESCRIPTOR: google.protobuf.descriptor.EnumDescriptor + RSA: _KeyType.ValueType # 0 + Ed25519: _KeyType.ValueType # 1 + Secp256k1: _KeyType.ValueType # 2 + ECDSA: _KeyType.ValueType # 3 -RSA = typing___cast(KeyType, 0) -Ed25519 = typing___cast(KeyType, 1) -Secp256k1 = typing___cast(KeyType, 2) -ECDSA = typing___cast(KeyType, 3) +class KeyType(_KeyType, metaclass=_KeyTypeEnumTypeWrapper): ... -class PublicKey(google___protobuf___message___Message): - DESCRIPTOR: google___protobuf___descriptor___Descriptor = ... - key_type = ... # type: KeyType - data = ... # type: bytes +RSA: KeyType.ValueType # 0 +Ed25519: KeyType.ValueType # 1 +Secp256k1: KeyType.ValueType # 2 +ECDSA: KeyType.ValueType # 3 +global___KeyType = KeyType +@typing_extensions.final +class PublicKey(google.protobuf.message.Message): + DESCRIPTOR: google.protobuf.descriptor.Descriptor + + KEY_TYPE_FIELD_NUMBER: builtins.int + DATA_FIELD_NUMBER: builtins.int + key_type: global___KeyType.ValueType + data: builtins.bytes def __init__( self, *, - key_type: KeyType, - data: bytes, + key_type: global___KeyType.ValueType | None = ..., + data: builtins.bytes | None = ..., ) -> None: ... - @classmethod - def FromString(cls, s: bytes) -> PublicKey: ... - def MergeFrom(self, other_msg: google___protobuf___message___Message) -> None: ... - def CopyFrom(self, other_msg: google___protobuf___message___Message) -> None: ... - if sys.version_info >= (3,): - def HasField( - self, field_name: typing_extensions___Literal["data", "key_type"] - ) -> bool: ... - def ClearField( - self, field_name: typing_extensions___Literal["data", "key_type"] - ) -> None: ... - else: - def HasField( - self, - field_name: typing_extensions___Literal[ - "data", b"data", "key_type", b"key_type" - ], - ) -> bool: ... - def ClearField( - self, - field_name: typing_extensions___Literal[ - "data", b"data", "key_type", b"key_type" - ], - ) -> None: ... + def HasField(self, field_name: typing_extensions.Literal["data", b"data", "key_type", b"key_type"]) -> builtins.bool: ... + def ClearField(self, field_name: typing_extensions.Literal["data", b"data", "key_type", b"key_type"]) -> None: ... -class PrivateKey(google___protobuf___message___Message): - DESCRIPTOR: google___protobuf___descriptor___Descriptor = ... - key_type = ... # type: KeyType - data = ... # type: bytes +global___PublicKey = PublicKey +@typing_extensions.final +class PrivateKey(google.protobuf.message.Message): + DESCRIPTOR: google.protobuf.descriptor.Descriptor + + KEY_TYPE_FIELD_NUMBER: builtins.int + DATA_FIELD_NUMBER: builtins.int + key_type: global___KeyType.ValueType + data: builtins.bytes def __init__( self, *, - key_type: KeyType, - data: bytes, + key_type: global___KeyType.ValueType | None = ..., + data: builtins.bytes | None = ..., ) -> None: ... - @classmethod - def FromString(cls, s: bytes) -> PrivateKey: ... - def MergeFrom(self, other_msg: google___protobuf___message___Message) -> None: ... - def CopyFrom(self, other_msg: google___protobuf___message___Message) -> None: ... - if sys.version_info >= (3,): - def HasField( - self, field_name: typing_extensions___Literal["data", "key_type"] - ) -> bool: ... - def ClearField( - self, field_name: typing_extensions___Literal["data", "key_type"] - ) -> None: ... - else: - def HasField( - self, - field_name: typing_extensions___Literal[ - "data", b"data", "key_type", b"key_type" - ], - ) -> bool: ... - def ClearField( - self, - field_name: typing_extensions___Literal[ - "data", b"data", "key_type", b"key_type" - ], - ) -> None: ... + def HasField(self, field_name: typing_extensions.Literal["data", b"data", "key_type", b"key_type"]) -> builtins.bool: ... + def ClearField(self, field_name: typing_extensions.Literal["data", b"data", "key_type", b"key_type"]) -> None: ... + +global___PrivateKey = PrivateKey diff --git a/libp2p/identity/identify/pb/identify_pb2.py b/libp2p/identity/identify/pb/identify_pb2.py index 87ff9ccf..67248619 100644 --- a/libp2p/identity/identify/pb/identify_pb2.py +++ b/libp2p/identity/identify/pb/identify_pb2.py @@ -1,171 +1,26 @@ +# -*- coding: utf-8 -*- # Generated by the protocol buffer compiler. DO NOT EDIT! # source: libp2p/identity/identify/pb/identify.proto - -import sys - -_b = sys.version_info[0] < 3 and (lambda x: x) or (lambda x: x.encode("latin1")) +# Protobuf Python Version: 4.25.3 +"""Generated protocol buffer code.""" from google.protobuf import descriptor as _descriptor -from google.protobuf import message as _message -from google.protobuf import reflection as _reflection +from google.protobuf import descriptor_pool as _descriptor_pool from google.protobuf import symbol_database as _symbol_database - +from google.protobuf.internal import builder as _builder # @@protoc_insertion_point(imports) _sym_db = _symbol_database.Default() -DESCRIPTOR = _descriptor.FileDescriptor( - name="libp2p/identity/identify/pb/identify.proto", - package="identify.pb", - syntax="proto2", - serialized_options=None, - serialized_pb=_b( - '\n*libp2p/identity/identify/pb/identify.proto\x12\x0bidentify.pb"\x8f\x01\n\x08Identify\x12\x18\n\x10protocol_version\x18\x05 \x01(\t\x12\x15\n\ragent_version\x18\x06 \x01(\t\x12\x12\n\npublic_key\x18\x01 \x01(\x0c\x12\x14\n\x0clisten_addrs\x18\x02 \x03(\x0c\x12\x15\n\robserved_addr\x18\x04 \x01(\x0c\x12\x11\n\tprotocols\x18\x03 \x03(\t' - ), -) -_IDENTIFY = _descriptor.Descriptor( - name="Identify", - full_name="identify.pb.Identify", - filename=None, - file=DESCRIPTOR, - containing_type=None, - fields=[ - _descriptor.FieldDescriptor( - name="protocol_version", - full_name="identify.pb.Identify.protocol_version", - index=0, - number=5, - type=9, - cpp_type=9, - label=1, - has_default_value=False, - default_value=_b("").decode("utf-8"), - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=None, - file=DESCRIPTOR, - ), - _descriptor.FieldDescriptor( - name="agent_version", - full_name="identify.pb.Identify.agent_version", - index=1, - number=6, - type=9, - cpp_type=9, - label=1, - has_default_value=False, - default_value=_b("").decode("utf-8"), - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=None, - file=DESCRIPTOR, - ), - _descriptor.FieldDescriptor( - name="public_key", - full_name="identify.pb.Identify.public_key", - index=2, - number=1, - type=12, - cpp_type=9, - label=1, - has_default_value=False, - default_value=_b(""), - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=None, - file=DESCRIPTOR, - ), - _descriptor.FieldDescriptor( - name="listen_addrs", - full_name="identify.pb.Identify.listen_addrs", - index=3, - number=2, - type=12, - cpp_type=9, - label=3, - has_default_value=False, - default_value=[], - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=None, - file=DESCRIPTOR, - ), - _descriptor.FieldDescriptor( - name="observed_addr", - full_name="identify.pb.Identify.observed_addr", - index=4, - number=4, - type=12, - cpp_type=9, - label=1, - has_default_value=False, - default_value=_b(""), - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=None, - file=DESCRIPTOR, - ), - _descriptor.FieldDescriptor( - name="protocols", - full_name="identify.pb.Identify.protocols", - index=5, - number=3, - type=9, - cpp_type=9, - label=3, - has_default_value=False, - default_value=[], - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=None, - file=DESCRIPTOR, - ), - ], - extensions=[], - nested_types=[], - enum_types=[], - serialized_options=None, - is_extendable=False, - syntax="proto2", - extension_ranges=[], - oneofs=[], - serialized_start=60, - serialized_end=203, -) - -DESCRIPTOR.message_types_by_name["Identify"] = _IDENTIFY -_sym_db.RegisterFileDescriptor(DESCRIPTOR) - -Identify = _reflection.GeneratedProtocolMessageType( - "Identify", - (_message.Message,), - { - "DESCRIPTOR": _IDENTIFY, - "__module__": "libp2p.identity.identify.pb.identify_pb2" - # @@protoc_insertion_point(class_scope:identify.pb.Identify) - }, -) -_sym_db.RegisterMessage(Identify) - +DESCRIPTOR = _descriptor_pool.Default().AddSerializedFile(b'\n*libp2p/identity/identify/pb/identify.proto\x12\x0bidentify.pb\"\x8f\x01\n\x08Identify\x12\x18\n\x10protocol_version\x18\x05 \x01(\t\x12\x15\n\ragent_version\x18\x06 \x01(\t\x12\x12\n\npublic_key\x18\x01 \x01(\x0c\x12\x14\n\x0clisten_addrs\x18\x02 \x03(\x0c\x12\x15\n\robserved_addr\x18\x04 \x01(\x0c\x12\x11\n\tprotocols\x18\x03 \x03(\t') +_globals = globals() +_builder.BuildMessageAndEnumDescriptors(DESCRIPTOR, _globals) +_builder.BuildTopDescriptorsAndMessages(DESCRIPTOR, 'libp2p.identity.identify.pb.identify_pb2', _globals) +if _descriptor._USE_C_DESCRIPTORS == False: + DESCRIPTOR._options = None + _globals['_IDENTIFY']._serialized_start=60 + _globals['_IDENTIFY']._serialized_end=203 # @@protoc_insertion_point(module_scope) diff --git a/libp2p/identity/identify/pb/identify_pb2.pyi b/libp2p/identity/identify/pb/identify_pb2.pyi index d548a3a7..aa9668f4 100644 --- a/libp2p/identity/identify/pb/identify_pb2.pyi +++ b/libp2p/identity/identify/pb/identify_pb2.pyi @@ -1,100 +1,50 @@ -# @generated by generate_proto_mypy_stubs.py. Do not edit! +""" +@generated by mypy-protobuf. Do not edit manually! +isort:skip_file +""" +import builtins +import collections.abc +import google.protobuf.descriptor +import google.protobuf.internal.containers +import google.protobuf.message import sys -from google.protobuf.descriptor import ( - Descriptor as google___protobuf___descriptor___Descriptor, -) -from google.protobuf.internal.containers import ( - RepeatedScalarFieldContainer as google___protobuf___internal___containers___RepeatedScalarFieldContainer, -) +if sys.version_info >= (3, 8): + import typing as typing_extensions +else: + import typing_extensions -from google.protobuf.message import ( - Message as google___protobuf___message___Message, -) +DESCRIPTOR: google.protobuf.descriptor.FileDescriptor -from typing import ( - Iterable as typing___Iterable, - Optional as typing___Optional, - Text as typing___Text, -) - -from typing_extensions import ( - Literal as typing_extensions___Literal, -) - -class Identify(google___protobuf___message___Message): - DESCRIPTOR: google___protobuf___descriptor___Descriptor = ... - protocol_version = ... # type: typing___Text - agent_version = ... # type: typing___Text - public_key = ... # type: bytes - listen_addrs = ( - ... - ) # type: google___protobuf___internal___containers___RepeatedScalarFieldContainer[bytes] - observed_addr = ... # type: bytes - protocols = ( - ... - ) # type: google___protobuf___internal___containers___RepeatedScalarFieldContainer[typing___Text] +@typing_extensions.final +class Identify(google.protobuf.message.Message): + DESCRIPTOR: google.protobuf.descriptor.Descriptor + PROTOCOL_VERSION_FIELD_NUMBER: builtins.int + AGENT_VERSION_FIELD_NUMBER: builtins.int + PUBLIC_KEY_FIELD_NUMBER: builtins.int + LISTEN_ADDRS_FIELD_NUMBER: builtins.int + OBSERVED_ADDR_FIELD_NUMBER: builtins.int + PROTOCOLS_FIELD_NUMBER: builtins.int + protocol_version: builtins.str + agent_version: builtins.str + public_key: builtins.bytes + @property + def listen_addrs(self) -> google.protobuf.internal.containers.RepeatedScalarFieldContainer[builtins.bytes]: ... + observed_addr: builtins.bytes + @property + def protocols(self) -> google.protobuf.internal.containers.RepeatedScalarFieldContainer[builtins.str]: ... def __init__( self, *, - protocol_version: typing___Optional[typing___Text] = None, - agent_version: typing___Optional[typing___Text] = None, - public_key: typing___Optional[bytes] = None, - listen_addrs: typing___Optional[typing___Iterable[bytes]] = None, - observed_addr: typing___Optional[bytes] = None, - protocols: typing___Optional[typing___Iterable[typing___Text]] = None, + protocol_version: builtins.str | None = ..., + agent_version: builtins.str | None = ..., + public_key: builtins.bytes | None = ..., + listen_addrs: collections.abc.Iterable[builtins.bytes] | None = ..., + observed_addr: builtins.bytes | None = ..., + protocols: collections.abc.Iterable[builtins.str] | None = ..., ) -> None: ... - @classmethod - def FromString(cls, s: bytes) -> Identify: ... - def MergeFrom(self, other_msg: google___protobuf___message___Message) -> None: ... - def CopyFrom(self, other_msg: google___protobuf___message___Message) -> None: ... - if sys.version_info >= (3,): - def HasField( - self, - field_name: typing_extensions___Literal[ - "agent_version", "observed_addr", "protocol_version", "public_key" - ], - ) -> bool: ... - def ClearField( - self, - field_name: typing_extensions___Literal[ - "agent_version", - "listen_addrs", - "observed_addr", - "protocol_version", - "protocols", - "public_key", - ], - ) -> None: ... - else: - def HasField( - self, - field_name: typing_extensions___Literal[ - "agent_version", - b"agent_version", - "observed_addr", - b"observed_addr", - "protocol_version", - b"protocol_version", - "public_key", - b"public_key", - ], - ) -> bool: ... - def ClearField( - self, - field_name: typing_extensions___Literal[ - "agent_version", - b"agent_version", - "listen_addrs", - b"listen_addrs", - "observed_addr", - b"observed_addr", - "protocol_version", - b"protocol_version", - "protocols", - b"protocols", - "public_key", - b"public_key", - ], - ) -> None: ... + def HasField(self, field_name: typing_extensions.Literal["agent_version", b"agent_version", "observed_addr", b"observed_addr", "protocol_version", b"protocol_version", "public_key", b"public_key"]) -> builtins.bool: ... + def ClearField(self, field_name: typing_extensions.Literal["agent_version", b"agent_version", "listen_addrs", b"listen_addrs", "observed_addr", b"observed_addr", "protocol_version", b"protocol_version", "protocols", b"protocols", "public_key", b"public_key"]) -> None: ... + +global___Identify = Identify diff --git a/libp2p/pubsub/pb/rpc_pb2.py b/libp2p/pubsub/pb/rpc_pb2.py index d51f9f5d..397edf87 100644 --- a/libp2p/pubsub/pb/rpc_pb2.py +++ b/libp2p/pubsub/pb/rpc_pb2.py @@ -1,946 +1,50 @@ +# -*- coding: utf-8 -*- # Generated by the protocol buffer compiler. DO NOT EDIT! # source: libp2p/pubsub/pb/rpc.proto - -import sys - -_b = sys.version_info[0] < 3 and (lambda x: x) or (lambda x: x.encode("latin1")) +# Protobuf Python Version: 4.25.3 +"""Generated protocol buffer code.""" from google.protobuf import descriptor as _descriptor -from google.protobuf import message as _message -from google.protobuf import reflection as _reflection +from google.protobuf import descriptor_pool as _descriptor_pool from google.protobuf import symbol_database as _symbol_database - +from google.protobuf.internal import builder as _builder # @@protoc_insertion_point(imports) _sym_db = _symbol_database.Default() -DESCRIPTOR = _descriptor.FileDescriptor( - name="libp2p/pubsub/pb/rpc.proto", - package="pubsub.pb", - syntax="proto2", - serialized_options=None, - serialized_pb=_b( - '\n\x1alibp2p/pubsub/pb/rpc.proto\x12\tpubsub.pb"\xb4\x01\n\x03RPC\x12-\n\rsubscriptions\x18\x01 \x03(\x0b\x32\x16.pubsub.pb.RPC.SubOpts\x12#\n\x07publish\x18\x02 \x03(\x0b\x32\x12.pubsub.pb.Message\x12*\n\x07\x63ontrol\x18\x03 \x01(\x0b\x32\x19.pubsub.pb.ControlMessage\x1a-\n\x07SubOpts\x12\x11\n\tsubscribe\x18\x01 \x01(\x08\x12\x0f\n\x07topicid\x18\x02 \x01(\t"i\n\x07Message\x12\x0f\n\x07\x66rom_id\x18\x01 \x01(\x0c\x12\x0c\n\x04\x64\x61ta\x18\x02 \x01(\x0c\x12\r\n\x05seqno\x18\x03 \x01(\x0c\x12\x10\n\x08topicIDs\x18\x04 \x03(\t\x12\x11\n\tsignature\x18\x05 \x01(\x0c\x12\x0b\n\x03key\x18\x06 \x01(\x0c"\xb0\x01\n\x0e\x43ontrolMessage\x12&\n\x05ihave\x18\x01 \x03(\x0b\x32\x17.pubsub.pb.ControlIHave\x12&\n\x05iwant\x18\x02 \x03(\x0b\x32\x17.pubsub.pb.ControlIWant\x12&\n\x05graft\x18\x03 \x03(\x0b\x32\x17.pubsub.pb.ControlGraft\x12&\n\x05prune\x18\x04 \x03(\x0b\x32\x17.pubsub.pb.ControlPrune"3\n\x0c\x43ontrolIHave\x12\x0f\n\x07topicID\x18\x01 \x01(\t\x12\x12\n\nmessageIDs\x18\x02 \x03(\t""\n\x0c\x43ontrolIWant\x12\x12\n\nmessageIDs\x18\x01 \x03(\t"\x1f\n\x0c\x43ontrolGraft\x12\x0f\n\x07topicID\x18\x01 \x01(\t"\x1f\n\x0c\x43ontrolPrune\x12\x0f\n\x07topicID\x18\x01 \x01(\t"\x87\x03\n\x0fTopicDescriptor\x12\x0c\n\x04name\x18\x01 \x01(\t\x12\x31\n\x04\x61uth\x18\x02 \x01(\x0b\x32#.pubsub.pb.TopicDescriptor.AuthOpts\x12/\n\x03\x65nc\x18\x03 \x01(\x0b\x32".pubsub.pb.TopicDescriptor.EncOpts\x1a|\n\x08\x41uthOpts\x12:\n\x04mode\x18\x01 \x01(\x0e\x32,.pubsub.pb.TopicDescriptor.AuthOpts.AuthMode\x12\x0c\n\x04keys\x18\x02 \x03(\x0c"&\n\x08\x41uthMode\x12\x08\n\x04NONE\x10\x00\x12\x07\n\x03KEY\x10\x01\x12\x07\n\x03WOT\x10\x02\x1a\x83\x01\n\x07\x45ncOpts\x12\x38\n\x04mode\x18\x01 \x01(\x0e\x32*.pubsub.pb.TopicDescriptor.EncOpts.EncMode\x12\x11\n\tkeyHashes\x18\x02 \x03(\x0c"+\n\x07\x45ncMode\x12\x08\n\x04NONE\x10\x00\x12\r\n\tSHAREDKEY\x10\x01\x12\x07\n\x03WOT\x10\x02' - ), -) -_TOPICDESCRIPTOR_AUTHOPTS_AUTHMODE = _descriptor.EnumDescriptor( - name="AuthMode", - full_name="pubsub.pb.TopicDescriptor.AuthOpts.AuthMode", - filename=None, - file=DESCRIPTOR, - values=[ - _descriptor.EnumValueDescriptor( - name="NONE", index=0, number=0, serialized_options=None, type=None - ), - _descriptor.EnumValueDescriptor( - name="KEY", index=1, number=1, serialized_options=None, type=None - ), - _descriptor.EnumValueDescriptor( - name="WOT", index=2, number=2, serialized_options=None, type=None - ), - ], - containing_type=None, - serialized_options=None, - serialized_start=885, - serialized_end=923, -) -_sym_db.RegisterEnumDescriptor(_TOPICDESCRIPTOR_AUTHOPTS_AUTHMODE) - -_TOPICDESCRIPTOR_ENCOPTS_ENCMODE = _descriptor.EnumDescriptor( - name="EncMode", - full_name="pubsub.pb.TopicDescriptor.EncOpts.EncMode", - filename=None, - file=DESCRIPTOR, - values=[ - _descriptor.EnumValueDescriptor( - name="NONE", index=0, number=0, serialized_options=None, type=None - ), - _descriptor.EnumValueDescriptor( - name="SHAREDKEY", index=1, number=1, serialized_options=None, type=None - ), - _descriptor.EnumValueDescriptor( - name="WOT", index=2, number=2, serialized_options=None, type=None - ), - ], - containing_type=None, - serialized_options=None, - serialized_start=1014, - serialized_end=1057, -) -_sym_db.RegisterEnumDescriptor(_TOPICDESCRIPTOR_ENCOPTS_ENCMODE) - - -_RPC_SUBOPTS = _descriptor.Descriptor( - name="SubOpts", - full_name="pubsub.pb.RPC.SubOpts", - filename=None, - file=DESCRIPTOR, - containing_type=None, - fields=[ - _descriptor.FieldDescriptor( - name="subscribe", - full_name="pubsub.pb.RPC.SubOpts.subscribe", - index=0, - number=1, - type=8, - cpp_type=7, - label=1, - has_default_value=False, - default_value=False, - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=None, - file=DESCRIPTOR, - ), - _descriptor.FieldDescriptor( - name="topicid", - full_name="pubsub.pb.RPC.SubOpts.topicid", - index=1, - number=2, - type=9, - cpp_type=9, - label=1, - has_default_value=False, - default_value=_b("").decode("utf-8"), - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=None, - file=DESCRIPTOR, - ), - ], - extensions=[], - nested_types=[], - enum_types=[], - serialized_options=None, - is_extendable=False, - syntax="proto2", - extension_ranges=[], - oneofs=[], - serialized_start=177, - serialized_end=222, -) - -_RPC = _descriptor.Descriptor( - name="RPC", - full_name="pubsub.pb.RPC", - filename=None, - file=DESCRIPTOR, - containing_type=None, - fields=[ - _descriptor.FieldDescriptor( - name="subscriptions", - full_name="pubsub.pb.RPC.subscriptions", - index=0, - number=1, - type=11, - cpp_type=10, - label=3, - has_default_value=False, - default_value=[], - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=None, - file=DESCRIPTOR, - ), - _descriptor.FieldDescriptor( - name="publish", - full_name="pubsub.pb.RPC.publish", - index=1, - number=2, - type=11, - cpp_type=10, - label=3, - has_default_value=False, - default_value=[], - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=None, - file=DESCRIPTOR, - ), - _descriptor.FieldDescriptor( - name="control", - full_name="pubsub.pb.RPC.control", - index=2, - number=3, - type=11, - cpp_type=10, - label=1, - has_default_value=False, - default_value=None, - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=None, - file=DESCRIPTOR, - ), - ], - extensions=[], - nested_types=[ - _RPC_SUBOPTS, - ], - enum_types=[], - serialized_options=None, - is_extendable=False, - syntax="proto2", - extension_ranges=[], - oneofs=[], - serialized_start=42, - serialized_end=222, -) - - -_MESSAGE = _descriptor.Descriptor( - name="Message", - full_name="pubsub.pb.Message", - filename=None, - file=DESCRIPTOR, - containing_type=None, - fields=[ - _descriptor.FieldDescriptor( - name="from_id", - full_name="pubsub.pb.Message.from_id", - index=0, - number=1, - type=12, - cpp_type=9, - label=1, - has_default_value=False, - default_value=_b(""), - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=None, - file=DESCRIPTOR, - ), - _descriptor.FieldDescriptor( - name="data", - full_name="pubsub.pb.Message.data", - index=1, - number=2, - type=12, - cpp_type=9, - label=1, - has_default_value=False, - default_value=_b(""), - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=None, - file=DESCRIPTOR, - ), - _descriptor.FieldDescriptor( - name="seqno", - full_name="pubsub.pb.Message.seqno", - index=2, - number=3, - type=12, - cpp_type=9, - label=1, - has_default_value=False, - default_value=_b(""), - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=None, - file=DESCRIPTOR, - ), - _descriptor.FieldDescriptor( - name="topicIDs", - full_name="pubsub.pb.Message.topicIDs", - index=3, - number=4, - type=9, - cpp_type=9, - label=3, - has_default_value=False, - default_value=[], - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=None, - file=DESCRIPTOR, - ), - _descriptor.FieldDescriptor( - name="signature", - full_name="pubsub.pb.Message.signature", - index=4, - number=5, - type=12, - cpp_type=9, - label=1, - has_default_value=False, - default_value=_b(""), - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=None, - file=DESCRIPTOR, - ), - _descriptor.FieldDescriptor( - name="key", - full_name="pubsub.pb.Message.key", - index=5, - number=6, - type=12, - cpp_type=9, - label=1, - has_default_value=False, - default_value=_b(""), - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=None, - file=DESCRIPTOR, - ), - ], - extensions=[], - nested_types=[], - enum_types=[], - serialized_options=None, - is_extendable=False, - syntax="proto2", - extension_ranges=[], - oneofs=[], - serialized_start=224, - serialized_end=329, -) - - -_CONTROLMESSAGE = _descriptor.Descriptor( - name="ControlMessage", - full_name="pubsub.pb.ControlMessage", - filename=None, - file=DESCRIPTOR, - containing_type=None, - fields=[ - _descriptor.FieldDescriptor( - name="ihave", - full_name="pubsub.pb.ControlMessage.ihave", - index=0, - number=1, - type=11, - cpp_type=10, - label=3, - has_default_value=False, - default_value=[], - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=None, - file=DESCRIPTOR, - ), - _descriptor.FieldDescriptor( - name="iwant", - full_name="pubsub.pb.ControlMessage.iwant", - index=1, - number=2, - type=11, - cpp_type=10, - label=3, - has_default_value=False, - default_value=[], - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=None, - file=DESCRIPTOR, - ), - _descriptor.FieldDescriptor( - name="graft", - full_name="pubsub.pb.ControlMessage.graft", - index=2, - number=3, - type=11, - cpp_type=10, - label=3, - has_default_value=False, - default_value=[], - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=None, - file=DESCRIPTOR, - ), - _descriptor.FieldDescriptor( - name="prune", - full_name="pubsub.pb.ControlMessage.prune", - index=3, - number=4, - type=11, - cpp_type=10, - label=3, - has_default_value=False, - default_value=[], - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=None, - file=DESCRIPTOR, - ), - ], - extensions=[], - nested_types=[], - enum_types=[], - serialized_options=None, - is_extendable=False, - syntax="proto2", - extension_ranges=[], - oneofs=[], - serialized_start=332, - serialized_end=508, -) - - -_CONTROLIHAVE = _descriptor.Descriptor( - name="ControlIHave", - full_name="pubsub.pb.ControlIHave", - filename=None, - file=DESCRIPTOR, - containing_type=None, - fields=[ - _descriptor.FieldDescriptor( - name="topicID", - full_name="pubsub.pb.ControlIHave.topicID", - index=0, - number=1, - type=9, - cpp_type=9, - label=1, - has_default_value=False, - default_value=_b("").decode("utf-8"), - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=None, - file=DESCRIPTOR, - ), - _descriptor.FieldDescriptor( - name="messageIDs", - full_name="pubsub.pb.ControlIHave.messageIDs", - index=1, - number=2, - type=9, - cpp_type=9, - label=3, - has_default_value=False, - default_value=[], - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=None, - file=DESCRIPTOR, - ), - ], - extensions=[], - nested_types=[], - enum_types=[], - serialized_options=None, - is_extendable=False, - syntax="proto2", - extension_ranges=[], - oneofs=[], - serialized_start=510, - serialized_end=561, -) - - -_CONTROLIWANT = _descriptor.Descriptor( - name="ControlIWant", - full_name="pubsub.pb.ControlIWant", - filename=None, - file=DESCRIPTOR, - containing_type=None, - fields=[ - _descriptor.FieldDescriptor( - name="messageIDs", - full_name="pubsub.pb.ControlIWant.messageIDs", - index=0, - number=1, - type=9, - cpp_type=9, - label=3, - has_default_value=False, - default_value=[], - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=None, - file=DESCRIPTOR, - ), - ], - extensions=[], - nested_types=[], - enum_types=[], - serialized_options=None, - is_extendable=False, - syntax="proto2", - extension_ranges=[], - oneofs=[], - serialized_start=563, - serialized_end=597, -) - - -_CONTROLGRAFT = _descriptor.Descriptor( - name="ControlGraft", - full_name="pubsub.pb.ControlGraft", - filename=None, - file=DESCRIPTOR, - containing_type=None, - fields=[ - _descriptor.FieldDescriptor( - name="topicID", - full_name="pubsub.pb.ControlGraft.topicID", - index=0, - number=1, - type=9, - cpp_type=9, - label=1, - has_default_value=False, - default_value=_b("").decode("utf-8"), - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=None, - file=DESCRIPTOR, - ), - ], - extensions=[], - nested_types=[], - enum_types=[], - serialized_options=None, - is_extendable=False, - syntax="proto2", - extension_ranges=[], - oneofs=[], - serialized_start=599, - serialized_end=630, -) - - -_CONTROLPRUNE = _descriptor.Descriptor( - name="ControlPrune", - full_name="pubsub.pb.ControlPrune", - filename=None, - file=DESCRIPTOR, - containing_type=None, - fields=[ - _descriptor.FieldDescriptor( - name="topicID", - full_name="pubsub.pb.ControlPrune.topicID", - index=0, - number=1, - type=9, - cpp_type=9, - label=1, - has_default_value=False, - default_value=_b("").decode("utf-8"), - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=None, - file=DESCRIPTOR, - ), - ], - extensions=[], - nested_types=[], - enum_types=[], - serialized_options=None, - is_extendable=False, - syntax="proto2", - extension_ranges=[], - oneofs=[], - serialized_start=632, - serialized_end=663, -) - - -_TOPICDESCRIPTOR_AUTHOPTS = _descriptor.Descriptor( - name="AuthOpts", - full_name="pubsub.pb.TopicDescriptor.AuthOpts", - filename=None, - file=DESCRIPTOR, - containing_type=None, - fields=[ - _descriptor.FieldDescriptor( - name="mode", - full_name="pubsub.pb.TopicDescriptor.AuthOpts.mode", - index=0, - number=1, - type=14, - cpp_type=8, - label=1, - has_default_value=False, - default_value=0, - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=None, - file=DESCRIPTOR, - ), - _descriptor.FieldDescriptor( - name="keys", - full_name="pubsub.pb.TopicDescriptor.AuthOpts.keys", - index=1, - number=2, - type=12, - cpp_type=9, - label=3, - has_default_value=False, - default_value=[], - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=None, - file=DESCRIPTOR, - ), - ], - extensions=[], - nested_types=[], - enum_types=[ - _TOPICDESCRIPTOR_AUTHOPTS_AUTHMODE, - ], - serialized_options=None, - is_extendable=False, - syntax="proto2", - extension_ranges=[], - oneofs=[], - serialized_start=799, - serialized_end=923, -) - -_TOPICDESCRIPTOR_ENCOPTS = _descriptor.Descriptor( - name="EncOpts", - full_name="pubsub.pb.TopicDescriptor.EncOpts", - filename=None, - file=DESCRIPTOR, - containing_type=None, - fields=[ - _descriptor.FieldDescriptor( - name="mode", - full_name="pubsub.pb.TopicDescriptor.EncOpts.mode", - index=0, - number=1, - type=14, - cpp_type=8, - label=1, - has_default_value=False, - default_value=0, - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=None, - file=DESCRIPTOR, - ), - _descriptor.FieldDescriptor( - name="keyHashes", - full_name="pubsub.pb.TopicDescriptor.EncOpts.keyHashes", - index=1, - number=2, - type=12, - cpp_type=9, - label=3, - has_default_value=False, - default_value=[], - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=None, - file=DESCRIPTOR, - ), - ], - extensions=[], - nested_types=[], - enum_types=[ - _TOPICDESCRIPTOR_ENCOPTS_ENCMODE, - ], - serialized_options=None, - is_extendable=False, - syntax="proto2", - extension_ranges=[], - oneofs=[], - serialized_start=926, - serialized_end=1057, -) - -_TOPICDESCRIPTOR = _descriptor.Descriptor( - name="TopicDescriptor", - full_name="pubsub.pb.TopicDescriptor", - filename=None, - file=DESCRIPTOR, - containing_type=None, - fields=[ - _descriptor.FieldDescriptor( - name="name", - full_name="pubsub.pb.TopicDescriptor.name", - index=0, - number=1, - type=9, - cpp_type=9, - label=1, - has_default_value=False, - default_value=_b("").decode("utf-8"), - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=None, - file=DESCRIPTOR, - ), - _descriptor.FieldDescriptor( - name="auth", - full_name="pubsub.pb.TopicDescriptor.auth", - index=1, - number=2, - type=11, - cpp_type=10, - label=1, - has_default_value=False, - default_value=None, - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=None, - file=DESCRIPTOR, - ), - _descriptor.FieldDescriptor( - name="enc", - full_name="pubsub.pb.TopicDescriptor.enc", - index=2, - number=3, - type=11, - cpp_type=10, - label=1, - has_default_value=False, - default_value=None, - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=None, - file=DESCRIPTOR, - ), - ], - extensions=[], - nested_types=[ - _TOPICDESCRIPTOR_AUTHOPTS, - _TOPICDESCRIPTOR_ENCOPTS, - ], - enum_types=[], - serialized_options=None, - is_extendable=False, - syntax="proto2", - extension_ranges=[], - oneofs=[], - serialized_start=666, - serialized_end=1057, -) - -_RPC_SUBOPTS.containing_type = _RPC -_RPC.fields_by_name["subscriptions"].message_type = _RPC_SUBOPTS -_RPC.fields_by_name["publish"].message_type = _MESSAGE -_RPC.fields_by_name["control"].message_type = _CONTROLMESSAGE -_CONTROLMESSAGE.fields_by_name["ihave"].message_type = _CONTROLIHAVE -_CONTROLMESSAGE.fields_by_name["iwant"].message_type = _CONTROLIWANT -_CONTROLMESSAGE.fields_by_name["graft"].message_type = _CONTROLGRAFT -_CONTROLMESSAGE.fields_by_name["prune"].message_type = _CONTROLPRUNE -_TOPICDESCRIPTOR_AUTHOPTS.fields_by_name[ - "mode" -].enum_type = _TOPICDESCRIPTOR_AUTHOPTS_AUTHMODE -_TOPICDESCRIPTOR_AUTHOPTS.containing_type = _TOPICDESCRIPTOR -_TOPICDESCRIPTOR_AUTHOPTS_AUTHMODE.containing_type = _TOPICDESCRIPTOR_AUTHOPTS -_TOPICDESCRIPTOR_ENCOPTS.fields_by_name[ - "mode" -].enum_type = _TOPICDESCRIPTOR_ENCOPTS_ENCMODE -_TOPICDESCRIPTOR_ENCOPTS.containing_type = _TOPICDESCRIPTOR -_TOPICDESCRIPTOR_ENCOPTS_ENCMODE.containing_type = _TOPICDESCRIPTOR_ENCOPTS -_TOPICDESCRIPTOR.fields_by_name["auth"].message_type = _TOPICDESCRIPTOR_AUTHOPTS -_TOPICDESCRIPTOR.fields_by_name["enc"].message_type = _TOPICDESCRIPTOR_ENCOPTS -DESCRIPTOR.message_types_by_name["RPC"] = _RPC -DESCRIPTOR.message_types_by_name["Message"] = _MESSAGE -DESCRIPTOR.message_types_by_name["ControlMessage"] = _CONTROLMESSAGE -DESCRIPTOR.message_types_by_name["ControlIHave"] = _CONTROLIHAVE -DESCRIPTOR.message_types_by_name["ControlIWant"] = _CONTROLIWANT -DESCRIPTOR.message_types_by_name["ControlGraft"] = _CONTROLGRAFT -DESCRIPTOR.message_types_by_name["ControlPrune"] = _CONTROLPRUNE -DESCRIPTOR.message_types_by_name["TopicDescriptor"] = _TOPICDESCRIPTOR -_sym_db.RegisterFileDescriptor(DESCRIPTOR) - -RPC = _reflection.GeneratedProtocolMessageType( - "RPC", - (_message.Message,), - { - "SubOpts": _reflection.GeneratedProtocolMessageType( - "SubOpts", - (_message.Message,), - { - "DESCRIPTOR": _RPC_SUBOPTS, - "__module__": "libp2p.pubsub.pb.rpc_pb2" - # @@protoc_insertion_point(class_scope:pubsub.pb.RPC.SubOpts) - }, - ), - "DESCRIPTOR": _RPC, - "__module__": "libp2p.pubsub.pb.rpc_pb2" - # @@protoc_insertion_point(class_scope:pubsub.pb.RPC) - }, -) -_sym_db.RegisterMessage(RPC) -_sym_db.RegisterMessage(RPC.SubOpts) - -Message = _reflection.GeneratedProtocolMessageType( - "Message", - (_message.Message,), - { - "DESCRIPTOR": _MESSAGE, - "__module__": "libp2p.pubsub.pb.rpc_pb2" - # @@protoc_insertion_point(class_scope:pubsub.pb.Message) - }, -) -_sym_db.RegisterMessage(Message) - -ControlMessage = _reflection.GeneratedProtocolMessageType( - "ControlMessage", - (_message.Message,), - { - "DESCRIPTOR": _CONTROLMESSAGE, - "__module__": "libp2p.pubsub.pb.rpc_pb2" - # @@protoc_insertion_point(class_scope:pubsub.pb.ControlMessage) - }, -) -_sym_db.RegisterMessage(ControlMessage) - -ControlIHave = _reflection.GeneratedProtocolMessageType( - "ControlIHave", - (_message.Message,), - { - "DESCRIPTOR": _CONTROLIHAVE, - "__module__": "libp2p.pubsub.pb.rpc_pb2" - # @@protoc_insertion_point(class_scope:pubsub.pb.ControlIHave) - }, -) -_sym_db.RegisterMessage(ControlIHave) - -ControlIWant = _reflection.GeneratedProtocolMessageType( - "ControlIWant", - (_message.Message,), - { - "DESCRIPTOR": _CONTROLIWANT, - "__module__": "libp2p.pubsub.pb.rpc_pb2" - # @@protoc_insertion_point(class_scope:pubsub.pb.ControlIWant) - }, -) -_sym_db.RegisterMessage(ControlIWant) - -ControlGraft = _reflection.GeneratedProtocolMessageType( - "ControlGraft", - (_message.Message,), - { - "DESCRIPTOR": _CONTROLGRAFT, - "__module__": "libp2p.pubsub.pb.rpc_pb2" - # @@protoc_insertion_point(class_scope:pubsub.pb.ControlGraft) - }, -) -_sym_db.RegisterMessage(ControlGraft) - -ControlPrune = _reflection.GeneratedProtocolMessageType( - "ControlPrune", - (_message.Message,), - { - "DESCRIPTOR": _CONTROLPRUNE, - "__module__": "libp2p.pubsub.pb.rpc_pb2" - # @@protoc_insertion_point(class_scope:pubsub.pb.ControlPrune) - }, -) -_sym_db.RegisterMessage(ControlPrune) - -TopicDescriptor = _reflection.GeneratedProtocolMessageType( - "TopicDescriptor", - (_message.Message,), - { - "AuthOpts": _reflection.GeneratedProtocolMessageType( - "AuthOpts", - (_message.Message,), - { - "DESCRIPTOR": _TOPICDESCRIPTOR_AUTHOPTS, - "__module__": "libp2p.pubsub.pb.rpc_pb2" - # @@protoc_insertion_point(class_scope:pubsub.pb.TopicDescriptor.AuthOpts) - }, - ), - "EncOpts": _reflection.GeneratedProtocolMessageType( - "EncOpts", - (_message.Message,), - { - "DESCRIPTOR": _TOPICDESCRIPTOR_ENCOPTS, - "__module__": "libp2p.pubsub.pb.rpc_pb2" - # @@protoc_insertion_point(class_scope:pubsub.pb.TopicDescriptor.EncOpts) - }, - ), - "DESCRIPTOR": _TOPICDESCRIPTOR, - "__module__": "libp2p.pubsub.pb.rpc_pb2" - # @@protoc_insertion_point(class_scope:pubsub.pb.TopicDescriptor) - }, -) -_sym_db.RegisterMessage(TopicDescriptor) -_sym_db.RegisterMessage(TopicDescriptor.AuthOpts) -_sym_db.RegisterMessage(TopicDescriptor.EncOpts) - +DESCRIPTOR = _descriptor_pool.Default().AddSerializedFile(b'\n\x1alibp2p/pubsub/pb/rpc.proto\x12\tpubsub.pb\"\xb4\x01\n\x03RPC\x12-\n\rsubscriptions\x18\x01 \x03(\x0b\x32\x16.pubsub.pb.RPC.SubOpts\x12#\n\x07publish\x18\x02 \x03(\x0b\x32\x12.pubsub.pb.Message\x12*\n\x07\x63ontrol\x18\x03 \x01(\x0b\x32\x19.pubsub.pb.ControlMessage\x1a-\n\x07SubOpts\x12\x11\n\tsubscribe\x18\x01 \x01(\x08\x12\x0f\n\x07topicid\x18\x02 \x01(\t\"i\n\x07Message\x12\x0f\n\x07\x66rom_id\x18\x01 \x01(\x0c\x12\x0c\n\x04\x64\x61ta\x18\x02 \x01(\x0c\x12\r\n\x05seqno\x18\x03 \x01(\x0c\x12\x10\n\x08topicIDs\x18\x04 \x03(\t\x12\x11\n\tsignature\x18\x05 \x01(\x0c\x12\x0b\n\x03key\x18\x06 \x01(\x0c\"\xb0\x01\n\x0e\x43ontrolMessage\x12&\n\x05ihave\x18\x01 \x03(\x0b\x32\x17.pubsub.pb.ControlIHave\x12&\n\x05iwant\x18\x02 \x03(\x0b\x32\x17.pubsub.pb.ControlIWant\x12&\n\x05graft\x18\x03 \x03(\x0b\x32\x17.pubsub.pb.ControlGraft\x12&\n\x05prune\x18\x04 \x03(\x0b\x32\x17.pubsub.pb.ControlPrune\"3\n\x0c\x43ontrolIHave\x12\x0f\n\x07topicID\x18\x01 \x01(\t\x12\x12\n\nmessageIDs\x18\x02 \x03(\t\"\"\n\x0c\x43ontrolIWant\x12\x12\n\nmessageIDs\x18\x01 \x03(\t\"\x1f\n\x0c\x43ontrolGraft\x12\x0f\n\x07topicID\x18\x01 \x01(\t\"\x1f\n\x0c\x43ontrolPrune\x12\x0f\n\x07topicID\x18\x01 \x01(\t\"\x87\x03\n\x0fTopicDescriptor\x12\x0c\n\x04name\x18\x01 \x01(\t\x12\x31\n\x04\x61uth\x18\x02 \x01(\x0b\x32#.pubsub.pb.TopicDescriptor.AuthOpts\x12/\n\x03\x65nc\x18\x03 \x01(\x0b\x32\".pubsub.pb.TopicDescriptor.EncOpts\x1a|\n\x08\x41uthOpts\x12:\n\x04mode\x18\x01 \x01(\x0e\x32,.pubsub.pb.TopicDescriptor.AuthOpts.AuthMode\x12\x0c\n\x04keys\x18\x02 \x03(\x0c\"&\n\x08\x41uthMode\x12\x08\n\x04NONE\x10\x00\x12\x07\n\x03KEY\x10\x01\x12\x07\n\x03WOT\x10\x02\x1a\x83\x01\n\x07\x45ncOpts\x12\x38\n\x04mode\x18\x01 \x01(\x0e\x32*.pubsub.pb.TopicDescriptor.EncOpts.EncMode\x12\x11\n\tkeyHashes\x18\x02 \x03(\x0c\"+\n\x07\x45ncMode\x12\x08\n\x04NONE\x10\x00\x12\r\n\tSHAREDKEY\x10\x01\x12\x07\n\x03WOT\x10\x02') +_globals = globals() +_builder.BuildMessageAndEnumDescriptors(DESCRIPTOR, _globals) +_builder.BuildTopDescriptorsAndMessages(DESCRIPTOR, 'libp2p.pubsub.pb.rpc_pb2', _globals) +if _descriptor._USE_C_DESCRIPTORS == False: + DESCRIPTOR._options = None + _globals['_RPC']._serialized_start=42 + _globals['_RPC']._serialized_end=222 + _globals['_RPC_SUBOPTS']._serialized_start=177 + _globals['_RPC_SUBOPTS']._serialized_end=222 + _globals['_MESSAGE']._serialized_start=224 + _globals['_MESSAGE']._serialized_end=329 + _globals['_CONTROLMESSAGE']._serialized_start=332 + _globals['_CONTROLMESSAGE']._serialized_end=508 + _globals['_CONTROLIHAVE']._serialized_start=510 + _globals['_CONTROLIHAVE']._serialized_end=561 + _globals['_CONTROLIWANT']._serialized_start=563 + _globals['_CONTROLIWANT']._serialized_end=597 + _globals['_CONTROLGRAFT']._serialized_start=599 + _globals['_CONTROLGRAFT']._serialized_end=630 + _globals['_CONTROLPRUNE']._serialized_start=632 + _globals['_CONTROLPRUNE']._serialized_end=663 + _globals['_TOPICDESCRIPTOR']._serialized_start=666 + _globals['_TOPICDESCRIPTOR']._serialized_end=1057 + _globals['_TOPICDESCRIPTOR_AUTHOPTS']._serialized_start=799 + _globals['_TOPICDESCRIPTOR_AUTHOPTS']._serialized_end=923 + _globals['_TOPICDESCRIPTOR_AUTHOPTS_AUTHMODE']._serialized_start=885 + _globals['_TOPICDESCRIPTOR_AUTHOPTS_AUTHMODE']._serialized_end=923 + _globals['_TOPICDESCRIPTOR_ENCOPTS']._serialized_start=926 + _globals['_TOPICDESCRIPTOR_ENCOPTS']._serialized_end=1057 + _globals['_TOPICDESCRIPTOR_ENCOPTS_ENCMODE']._serialized_start=1014 + _globals['_TOPICDESCRIPTOR_ENCOPTS_ENCMODE']._serialized_end=1057 # @@protoc_insertion_point(module_scope) diff --git a/libp2p/pubsub/pb/rpc_pb2.pyi b/libp2p/pubsub/pb/rpc_pb2.pyi index e19179dc..bc4db367 100644 --- a/libp2p/pubsub/pb/rpc_pb2.pyi +++ b/libp2p/pubsub/pb/rpc_pb2.pyi @@ -1,535 +1,294 @@ -# @generated by generate_proto_mypy_stubs.py. Do not edit! +""" +@generated by mypy-protobuf. Do not edit manually! +isort:skip_file +Modified from https://github.com/libp2p/go-libp2p-pubsub/blob/master/pb/rpc.proto""" +import builtins +import collections.abc +import google.protobuf.descriptor +import google.protobuf.internal.containers +import google.protobuf.internal.enum_type_wrapper +import google.protobuf.message import sys -from google.protobuf.descriptor import ( - Descriptor as google___protobuf___descriptor___Descriptor, - EnumDescriptor as google___protobuf___descriptor___EnumDescriptor, -) +import typing -from google.protobuf.internal.containers import ( - RepeatedCompositeFieldContainer as google___protobuf___internal___containers___RepeatedCompositeFieldContainer, - RepeatedScalarFieldContainer as google___protobuf___internal___containers___RepeatedScalarFieldContainer, -) +if sys.version_info >= (3, 10): + import typing as typing_extensions +else: + import typing_extensions -from google.protobuf.message import ( - Message as google___protobuf___message___Message, -) +DESCRIPTOR: google.protobuf.descriptor.FileDescriptor -from typing import ( - Iterable as typing___Iterable, - List as typing___List, - Optional as typing___Optional, - Text as typing___Text, - Tuple as typing___Tuple, - cast as typing___cast, -) +@typing_extensions.final +class RPC(google.protobuf.message.Message): + DESCRIPTOR: google.protobuf.descriptor.Descriptor -from typing_extensions import ( - Literal as typing_extensions___Literal, -) - -class RPC(google___protobuf___message___Message): - DESCRIPTOR: google___protobuf___descriptor___Descriptor = ... - - class SubOpts(google___protobuf___message___Message): - DESCRIPTOR: google___protobuf___descriptor___Descriptor = ... - subscribe = ... # type: bool - topicid = ... # type: typing___Text + @typing_extensions.final + class SubOpts(google.protobuf.message.Message): + DESCRIPTOR: google.protobuf.descriptor.Descriptor + SUBSCRIBE_FIELD_NUMBER: builtins.int + TOPICID_FIELD_NUMBER: builtins.int + subscribe: builtins.bool + """subscribe or unsubscribe""" + topicid: builtins.str def __init__( self, *, - subscribe: typing___Optional[bool] = None, - topicid: typing___Optional[typing___Text] = None, + subscribe: builtins.bool | None = ..., + topicid: builtins.str | None = ..., ) -> None: ... - @classmethod - def FromString(cls, s: bytes) -> RPC.SubOpts: ... - def MergeFrom( - self, other_msg: google___protobuf___message___Message - ) -> None: ... - def CopyFrom( - self, other_msg: google___protobuf___message___Message - ) -> None: ... - if sys.version_info >= (3,): - def HasField( - self, field_name: typing_extensions___Literal["subscribe", "topicid"] - ) -> bool: ... - def ClearField( - self, field_name: typing_extensions___Literal["subscribe", "topicid"] - ) -> None: ... - else: - def HasField( - self, - field_name: typing_extensions___Literal[ - "subscribe", b"subscribe", "topicid", b"topicid" - ], - ) -> bool: ... - def ClearField( - self, - field_name: typing_extensions___Literal[ - "subscribe", b"subscribe", "topicid", b"topicid" - ], - ) -> None: ... + def HasField(self, field_name: typing_extensions.Literal["subscribe", b"subscribe", "topicid", b"topicid"]) -> builtins.bool: ... + def ClearField(self, field_name: typing_extensions.Literal["subscribe", b"subscribe", "topicid", b"topicid"]) -> None: ... + SUBSCRIPTIONS_FIELD_NUMBER: builtins.int + PUBLISH_FIELD_NUMBER: builtins.int + CONTROL_FIELD_NUMBER: builtins.int @property - def subscriptions( - self, - ) -> google___protobuf___internal___containers___RepeatedCompositeFieldContainer[ - RPC.SubOpts - ]: ... + def subscriptions(self) -> google.protobuf.internal.containers.RepeatedCompositeFieldContainer[global___RPC.SubOpts]: ... @property - def publish( - self, - ) -> google___protobuf___internal___containers___RepeatedCompositeFieldContainer[ - Message - ]: ... + def publish(self) -> google.protobuf.internal.containers.RepeatedCompositeFieldContainer[global___Message]: ... @property - def control(self) -> ControlMessage: ... + def control(self) -> global___ControlMessage: ... def __init__( self, *, - subscriptions: typing___Optional[typing___Iterable[RPC.SubOpts]] = None, - publish: typing___Optional[typing___Iterable[Message]] = None, - control: typing___Optional[ControlMessage] = None, + subscriptions: collections.abc.Iterable[global___RPC.SubOpts] | None = ..., + publish: collections.abc.Iterable[global___Message] | None = ..., + control: global___ControlMessage | None = ..., ) -> None: ... - @classmethod - def FromString(cls, s: bytes) -> RPC: ... - def MergeFrom(self, other_msg: google___protobuf___message___Message) -> None: ... - def CopyFrom(self, other_msg: google___protobuf___message___Message) -> None: ... - if sys.version_info >= (3,): - def HasField( - self, field_name: typing_extensions___Literal["control"] - ) -> bool: ... - def ClearField( - self, - field_name: typing_extensions___Literal[ - "control", "publish", "subscriptions" - ], - ) -> None: ... - else: - def HasField( - self, field_name: typing_extensions___Literal["control", b"control"] - ) -> bool: ... - def ClearField( - self, - field_name: typing_extensions___Literal[ - "control", - b"control", - "publish", - b"publish", - "subscriptions", - b"subscriptions", - ], - ) -> None: ... + def HasField(self, field_name: typing_extensions.Literal["control", b"control"]) -> builtins.bool: ... + def ClearField(self, field_name: typing_extensions.Literal["control", b"control", "publish", b"publish", "subscriptions", b"subscriptions"]) -> None: ... -class Message(google___protobuf___message___Message): - DESCRIPTOR: google___protobuf___descriptor___Descriptor = ... - from_id = ... # type: bytes - data = ... # type: bytes - seqno = ... # type: bytes - topicIDs = ( - ... - ) # type: google___protobuf___internal___containers___RepeatedScalarFieldContainer[typing___Text] - signature = ... # type: bytes - key = ... # type: bytes +global___RPC = RPC - def __init__( - self, - *, - from_id: typing___Optional[bytes] = None, - data: typing___Optional[bytes] = None, - seqno: typing___Optional[bytes] = None, - topicIDs: typing___Optional[typing___Iterable[typing___Text]] = None, - signature: typing___Optional[bytes] = None, - key: typing___Optional[bytes] = None, - ) -> None: ... - @classmethod - def FromString(cls, s: bytes) -> Message: ... - def MergeFrom(self, other_msg: google___protobuf___message___Message) -> None: ... - def CopyFrom(self, other_msg: google___protobuf___message___Message) -> None: ... - if sys.version_info >= (3,): - def HasField( - self, - field_name: typing_extensions___Literal[ - "data", "from_id", "key", "seqno", "signature" - ], - ) -> bool: ... - def ClearField( - self, - field_name: typing_extensions___Literal[ - "data", "from_id", "key", "seqno", "signature", "topicIDs" - ], - ) -> None: ... - else: - def HasField( - self, - field_name: typing_extensions___Literal[ - "data", - b"data", - "from_id", - b"from_id", - "key", - b"key", - "seqno", - b"seqno", - "signature", - b"signature", - ], - ) -> bool: ... - def ClearField( - self, - field_name: typing_extensions___Literal[ - "data", - b"data", - "from_id", - b"from_id", - "key", - b"key", - "seqno", - b"seqno", - "signature", - b"signature", - "topicIDs", - b"topicIDs", - ], - ) -> None: ... - -class ControlMessage(google___protobuf___message___Message): - DESCRIPTOR: google___protobuf___descriptor___Descriptor = ... +@typing_extensions.final +class Message(google.protobuf.message.Message): + DESCRIPTOR: google.protobuf.descriptor.Descriptor + FROM_ID_FIELD_NUMBER: builtins.int + DATA_FIELD_NUMBER: builtins.int + SEQNO_FIELD_NUMBER: builtins.int + TOPICIDS_FIELD_NUMBER: builtins.int + SIGNATURE_FIELD_NUMBER: builtins.int + KEY_FIELD_NUMBER: builtins.int + from_id: builtins.bytes + data: builtins.bytes + seqno: builtins.bytes @property - def ihave( + def topicIDs(self) -> google.protobuf.internal.containers.RepeatedScalarFieldContainer[builtins.str]: ... + signature: builtins.bytes + key: builtins.bytes + def __init__( self, - ) -> google___protobuf___internal___containers___RepeatedCompositeFieldContainer[ - ControlIHave - ]: ... + *, + from_id: builtins.bytes | None = ..., + data: builtins.bytes | None = ..., + seqno: builtins.bytes | None = ..., + topicIDs: collections.abc.Iterable[builtins.str] | None = ..., + signature: builtins.bytes | None = ..., + key: builtins.bytes | None = ..., + ) -> None: ... + def HasField(self, field_name: typing_extensions.Literal["data", b"data", "from_id", b"from_id", "key", b"key", "seqno", b"seqno", "signature", b"signature"]) -> builtins.bool: ... + def ClearField(self, field_name: typing_extensions.Literal["data", b"data", "from_id", b"from_id", "key", b"key", "seqno", b"seqno", "signature", b"signature", "topicIDs", b"topicIDs"]) -> None: ... + +global___Message = Message + +@typing_extensions.final +class ControlMessage(google.protobuf.message.Message): + DESCRIPTOR: google.protobuf.descriptor.Descriptor + + IHAVE_FIELD_NUMBER: builtins.int + IWANT_FIELD_NUMBER: builtins.int + GRAFT_FIELD_NUMBER: builtins.int + PRUNE_FIELD_NUMBER: builtins.int @property - def iwant( - self, - ) -> google___protobuf___internal___containers___RepeatedCompositeFieldContainer[ - ControlIWant - ]: ... + def ihave(self) -> google.protobuf.internal.containers.RepeatedCompositeFieldContainer[global___ControlIHave]: ... @property - def graft( - self, - ) -> google___protobuf___internal___containers___RepeatedCompositeFieldContainer[ - ControlGraft - ]: ... + def iwant(self) -> google.protobuf.internal.containers.RepeatedCompositeFieldContainer[global___ControlIWant]: ... @property - def prune( - self, - ) -> google___protobuf___internal___containers___RepeatedCompositeFieldContainer[ - ControlPrune - ]: ... + def graft(self) -> google.protobuf.internal.containers.RepeatedCompositeFieldContainer[global___ControlGraft]: ... + @property + def prune(self) -> google.protobuf.internal.containers.RepeatedCompositeFieldContainer[global___ControlPrune]: ... def __init__( self, *, - ihave: typing___Optional[typing___Iterable[ControlIHave]] = None, - iwant: typing___Optional[typing___Iterable[ControlIWant]] = None, - graft: typing___Optional[typing___Iterable[ControlGraft]] = None, - prune: typing___Optional[typing___Iterable[ControlPrune]] = None, + ihave: collections.abc.Iterable[global___ControlIHave] | None = ..., + iwant: collections.abc.Iterable[global___ControlIWant] | None = ..., + graft: collections.abc.Iterable[global___ControlGraft] | None = ..., + prune: collections.abc.Iterable[global___ControlPrune] | None = ..., ) -> None: ... - @classmethod - def FromString(cls, s: bytes) -> ControlMessage: ... - def MergeFrom(self, other_msg: google___protobuf___message___Message) -> None: ... - def CopyFrom(self, other_msg: google___protobuf___message___Message) -> None: ... - if sys.version_info >= (3,): - def ClearField( - self, - field_name: typing_extensions___Literal["graft", "ihave", "iwant", "prune"], - ) -> None: ... - else: - def ClearField( - self, - field_name: typing_extensions___Literal[ - "graft", - b"graft", - "ihave", - b"ihave", - "iwant", - b"iwant", - "prune", - b"prune", - ], - ) -> None: ... + def ClearField(self, field_name: typing_extensions.Literal["graft", b"graft", "ihave", b"ihave", "iwant", b"iwant", "prune", b"prune"]) -> None: ... -class ControlIHave(google___protobuf___message___Message): - DESCRIPTOR: google___protobuf___descriptor___Descriptor = ... - topicID = ... # type: typing___Text - messageIDs = ( - ... - ) # type: google___protobuf___internal___containers___RepeatedScalarFieldContainer[typing___Text] +global___ControlMessage = ControlMessage +@typing_extensions.final +class ControlIHave(google.protobuf.message.Message): + DESCRIPTOR: google.protobuf.descriptor.Descriptor + + TOPICID_FIELD_NUMBER: builtins.int + MESSAGEIDS_FIELD_NUMBER: builtins.int + topicID: builtins.str + @property + def messageIDs(self) -> google.protobuf.internal.containers.RepeatedScalarFieldContainer[builtins.str]: ... def __init__( self, *, - topicID: typing___Optional[typing___Text] = None, - messageIDs: typing___Optional[typing___Iterable[typing___Text]] = None, + topicID: builtins.str | None = ..., + messageIDs: collections.abc.Iterable[builtins.str] | None = ..., ) -> None: ... - @classmethod - def FromString(cls, s: bytes) -> ControlIHave: ... - def MergeFrom(self, other_msg: google___protobuf___message___Message) -> None: ... - def CopyFrom(self, other_msg: google___protobuf___message___Message) -> None: ... - if sys.version_info >= (3,): - def HasField( - self, field_name: typing_extensions___Literal["topicID"] - ) -> bool: ... - def ClearField( - self, field_name: typing_extensions___Literal["messageIDs", "topicID"] - ) -> None: ... - else: - def HasField( - self, field_name: typing_extensions___Literal["topicID", b"topicID"] - ) -> bool: ... - def ClearField( - self, - field_name: typing_extensions___Literal[ - "messageIDs", b"messageIDs", "topicID", b"topicID" - ], - ) -> None: ... + def HasField(self, field_name: typing_extensions.Literal["topicID", b"topicID"]) -> builtins.bool: ... + def ClearField(self, field_name: typing_extensions.Literal["messageIDs", b"messageIDs", "topicID", b"topicID"]) -> None: ... -class ControlIWant(google___protobuf___message___Message): - DESCRIPTOR: google___protobuf___descriptor___Descriptor = ... - messageIDs = ( - ... - ) # type: google___protobuf___internal___containers___RepeatedScalarFieldContainer[typing___Text] +global___ControlIHave = ControlIHave +@typing_extensions.final +class ControlIWant(google.protobuf.message.Message): + DESCRIPTOR: google.protobuf.descriptor.Descriptor + + MESSAGEIDS_FIELD_NUMBER: builtins.int + @property + def messageIDs(self) -> google.protobuf.internal.containers.RepeatedScalarFieldContainer[builtins.str]: ... def __init__( self, *, - messageIDs: typing___Optional[typing___Iterable[typing___Text]] = None, + messageIDs: collections.abc.Iterable[builtins.str] | None = ..., ) -> None: ... - @classmethod - def FromString(cls, s: bytes) -> ControlIWant: ... - def MergeFrom(self, other_msg: google___protobuf___message___Message) -> None: ... - def CopyFrom(self, other_msg: google___protobuf___message___Message) -> None: ... - if sys.version_info >= (3,): - def ClearField( - self, field_name: typing_extensions___Literal["messageIDs"] - ) -> None: ... - else: - def ClearField( - self, field_name: typing_extensions___Literal["messageIDs", b"messageIDs"] - ) -> None: ... + def ClearField(self, field_name: typing_extensions.Literal["messageIDs", b"messageIDs"]) -> None: ... -class ControlGraft(google___protobuf___message___Message): - DESCRIPTOR: google___protobuf___descriptor___Descriptor = ... - topicID = ... # type: typing___Text +global___ControlIWant = ControlIWant +@typing_extensions.final +class ControlGraft(google.protobuf.message.Message): + DESCRIPTOR: google.protobuf.descriptor.Descriptor + + TOPICID_FIELD_NUMBER: builtins.int + topicID: builtins.str def __init__( self, *, - topicID: typing___Optional[typing___Text] = None, + topicID: builtins.str | None = ..., ) -> None: ... - @classmethod - def FromString(cls, s: bytes) -> ControlGraft: ... - def MergeFrom(self, other_msg: google___protobuf___message___Message) -> None: ... - def CopyFrom(self, other_msg: google___protobuf___message___Message) -> None: ... - if sys.version_info >= (3,): - def HasField( - self, field_name: typing_extensions___Literal["topicID"] - ) -> bool: ... - def ClearField( - self, field_name: typing_extensions___Literal["topicID"] - ) -> None: ... - else: - def HasField( - self, field_name: typing_extensions___Literal["topicID", b"topicID"] - ) -> bool: ... - def ClearField( - self, field_name: typing_extensions___Literal["topicID", b"topicID"] - ) -> None: ... + def HasField(self, field_name: typing_extensions.Literal["topicID", b"topicID"]) -> builtins.bool: ... + def ClearField(self, field_name: typing_extensions.Literal["topicID", b"topicID"]) -> None: ... -class ControlPrune(google___protobuf___message___Message): - DESCRIPTOR: google___protobuf___descriptor___Descriptor = ... - topicID = ... # type: typing___Text +global___ControlGraft = ControlGraft +@typing_extensions.final +class ControlPrune(google.protobuf.message.Message): + DESCRIPTOR: google.protobuf.descriptor.Descriptor + + TOPICID_FIELD_NUMBER: builtins.int + topicID: builtins.str def __init__( self, *, - topicID: typing___Optional[typing___Text] = None, + topicID: builtins.str | None = ..., ) -> None: ... - @classmethod - def FromString(cls, s: bytes) -> ControlPrune: ... - def MergeFrom(self, other_msg: google___protobuf___message___Message) -> None: ... - def CopyFrom(self, other_msg: google___protobuf___message___Message) -> None: ... - if sys.version_info >= (3,): - def HasField( - self, field_name: typing_extensions___Literal["topicID"] - ) -> bool: ... - def ClearField( - self, field_name: typing_extensions___Literal["topicID"] - ) -> None: ... - else: - def HasField( - self, field_name: typing_extensions___Literal["topicID", b"topicID"] - ) -> bool: ... - def ClearField( - self, field_name: typing_extensions___Literal["topicID", b"topicID"] - ) -> None: ... + def HasField(self, field_name: typing_extensions.Literal["topicID", b"topicID"]) -> builtins.bool: ... + def ClearField(self, field_name: typing_extensions.Literal["topicID", b"topicID"]) -> None: ... -class TopicDescriptor(google___protobuf___message___Message): - DESCRIPTOR: google___protobuf___descriptor___Descriptor = ... +global___ControlPrune = ControlPrune - class AuthOpts(google___protobuf___message___Message): - DESCRIPTOR: google___protobuf___descriptor___Descriptor = ... +@typing_extensions.final +class TopicDescriptor(google.protobuf.message.Message): + DESCRIPTOR: google.protobuf.descriptor.Descriptor - class AuthMode(int): - DESCRIPTOR: google___protobuf___descriptor___EnumDescriptor = ... - @classmethod - def Name(cls, number: int) -> str: ... - @classmethod - def Value(cls, name: str) -> TopicDescriptor.AuthOpts.AuthMode: ... - @classmethod - def keys(cls) -> typing___List[str]: ... - @classmethod - def values(cls) -> typing___List[TopicDescriptor.AuthOpts.AuthMode]: ... - @classmethod - def items( - cls, - ) -> typing___List[ - typing___Tuple[str, TopicDescriptor.AuthOpts.AuthMode] - ]: ... - NONE = typing___cast(TopicDescriptor.AuthOpts.AuthMode, 0) - KEY = typing___cast(TopicDescriptor.AuthOpts.AuthMode, 1) - WOT = typing___cast(TopicDescriptor.AuthOpts.AuthMode, 2) - NONE = typing___cast(TopicDescriptor.AuthOpts.AuthMode, 0) - KEY = typing___cast(TopicDescriptor.AuthOpts.AuthMode, 1) - WOT = typing___cast(TopicDescriptor.AuthOpts.AuthMode, 2) + @typing_extensions.final + class AuthOpts(google.protobuf.message.Message): + DESCRIPTOR: google.protobuf.descriptor.Descriptor - mode = ... # type: TopicDescriptor.AuthOpts.AuthMode - keys = ( - ... - ) # type: google___protobuf___internal___containers___RepeatedScalarFieldContainer[bytes] + class _AuthMode: + ValueType = typing.NewType("ValueType", builtins.int) + V: typing_extensions.TypeAlias = ValueType + class _AuthModeEnumTypeWrapper(google.protobuf.internal.enum_type_wrapper._EnumTypeWrapper[TopicDescriptor.AuthOpts._AuthMode.ValueType], builtins.type): + DESCRIPTOR: google.protobuf.descriptor.EnumDescriptor + NONE: TopicDescriptor.AuthOpts._AuthMode.ValueType # 0 + """no authentication, anyone can publish""" + KEY: TopicDescriptor.AuthOpts._AuthMode.ValueType # 1 + """only messages signed by keys in the topic descriptor are accepted""" + WOT: TopicDescriptor.AuthOpts._AuthMode.ValueType # 2 + """web of trust, certificates can allow publisher set to grow""" + + class AuthMode(_AuthMode, metaclass=_AuthModeEnumTypeWrapper): ... + NONE: TopicDescriptor.AuthOpts.AuthMode.ValueType # 0 + """no authentication, anyone can publish""" + KEY: TopicDescriptor.AuthOpts.AuthMode.ValueType # 1 + """only messages signed by keys in the topic descriptor are accepted""" + WOT: TopicDescriptor.AuthOpts.AuthMode.ValueType # 2 + """web of trust, certificates can allow publisher set to grow""" + + MODE_FIELD_NUMBER: builtins.int + KEYS_FIELD_NUMBER: builtins.int + mode: global___TopicDescriptor.AuthOpts.AuthMode.ValueType + @property + def keys(self) -> google.protobuf.internal.containers.RepeatedScalarFieldContainer[builtins.bytes]: + """root keys to trust""" def __init__( self, *, - mode: typing___Optional[TopicDescriptor.AuthOpts.AuthMode] = None, - keys: typing___Optional[typing___Iterable[bytes]] = None, + mode: global___TopicDescriptor.AuthOpts.AuthMode.ValueType | None = ..., + keys: collections.abc.Iterable[builtins.bytes] | None = ..., ) -> None: ... - @classmethod - def FromString(cls, s: bytes) -> TopicDescriptor.AuthOpts: ... - def MergeFrom( - self, other_msg: google___protobuf___message___Message - ) -> None: ... - def CopyFrom( - self, other_msg: google___protobuf___message___Message - ) -> None: ... - if sys.version_info >= (3,): - def HasField( - self, field_name: typing_extensions___Literal["mode"] - ) -> bool: ... - def ClearField( - self, field_name: typing_extensions___Literal["keys", "mode"] - ) -> None: ... - else: - def HasField( - self, field_name: typing_extensions___Literal["mode", b"mode"] - ) -> bool: ... - def ClearField( - self, - field_name: typing_extensions___Literal[ - "keys", b"keys", "mode", b"mode" - ], - ) -> None: ... + def HasField(self, field_name: typing_extensions.Literal["mode", b"mode"]) -> builtins.bool: ... + def ClearField(self, field_name: typing_extensions.Literal["keys", b"keys", "mode", b"mode"]) -> None: ... - class EncOpts(google___protobuf___message___Message): - DESCRIPTOR: google___protobuf___descriptor___Descriptor = ... + @typing_extensions.final + class EncOpts(google.protobuf.message.Message): + DESCRIPTOR: google.protobuf.descriptor.Descriptor - class EncMode(int): - DESCRIPTOR: google___protobuf___descriptor___EnumDescriptor = ... - @classmethod - def Name(cls, number: int) -> str: ... - @classmethod - def Value(cls, name: str) -> TopicDescriptor.EncOpts.EncMode: ... - @classmethod - def keys(cls) -> typing___List[str]: ... - @classmethod - def values(cls) -> typing___List[TopicDescriptor.EncOpts.EncMode]: ... - @classmethod - def items( - cls, - ) -> typing___List[ - typing___Tuple[str, TopicDescriptor.EncOpts.EncMode] - ]: ... - NONE = typing___cast(TopicDescriptor.EncOpts.EncMode, 0) - SHAREDKEY = typing___cast(TopicDescriptor.EncOpts.EncMode, 1) - WOT = typing___cast(TopicDescriptor.EncOpts.EncMode, 2) - NONE = typing___cast(TopicDescriptor.EncOpts.EncMode, 0) - SHAREDKEY = typing___cast(TopicDescriptor.EncOpts.EncMode, 1) - WOT = typing___cast(TopicDescriptor.EncOpts.EncMode, 2) + class _EncMode: + ValueType = typing.NewType("ValueType", builtins.int) + V: typing_extensions.TypeAlias = ValueType - mode = ... # type: TopicDescriptor.EncOpts.EncMode - keyHashes = ( - ... - ) # type: google___protobuf___internal___containers___RepeatedScalarFieldContainer[bytes] + class _EncModeEnumTypeWrapper(google.protobuf.internal.enum_type_wrapper._EnumTypeWrapper[TopicDescriptor.EncOpts._EncMode.ValueType], builtins.type): + DESCRIPTOR: google.protobuf.descriptor.EnumDescriptor + NONE: TopicDescriptor.EncOpts._EncMode.ValueType # 0 + """no encryption, anyone can read""" + SHAREDKEY: TopicDescriptor.EncOpts._EncMode.ValueType # 1 + """messages are encrypted with shared key""" + WOT: TopicDescriptor.EncOpts._EncMode.ValueType # 2 + """web of trust, certificates can allow publisher set to grow""" + class EncMode(_EncMode, metaclass=_EncModeEnumTypeWrapper): ... + NONE: TopicDescriptor.EncOpts.EncMode.ValueType # 0 + """no encryption, anyone can read""" + SHAREDKEY: TopicDescriptor.EncOpts.EncMode.ValueType # 1 + """messages are encrypted with shared key""" + WOT: TopicDescriptor.EncOpts.EncMode.ValueType # 2 + """web of trust, certificates can allow publisher set to grow""" + + MODE_FIELD_NUMBER: builtins.int + KEYHASHES_FIELD_NUMBER: builtins.int + mode: global___TopicDescriptor.EncOpts.EncMode.ValueType + @property + def keyHashes(self) -> google.protobuf.internal.containers.RepeatedScalarFieldContainer[builtins.bytes]: + """the hashes of the shared keys used (salted)""" def __init__( self, *, - mode: typing___Optional[TopicDescriptor.EncOpts.EncMode] = None, - keyHashes: typing___Optional[typing___Iterable[bytes]] = None, + mode: global___TopicDescriptor.EncOpts.EncMode.ValueType | None = ..., + keyHashes: collections.abc.Iterable[builtins.bytes] | None = ..., ) -> None: ... - @classmethod - def FromString(cls, s: bytes) -> TopicDescriptor.EncOpts: ... - def MergeFrom( - self, other_msg: google___protobuf___message___Message - ) -> None: ... - def CopyFrom( - self, other_msg: google___protobuf___message___Message - ) -> None: ... - if sys.version_info >= (3,): - def HasField( - self, field_name: typing_extensions___Literal["mode"] - ) -> bool: ... - def ClearField( - self, field_name: typing_extensions___Literal["keyHashes", "mode"] - ) -> None: ... - else: - def HasField( - self, field_name: typing_extensions___Literal["mode", b"mode"] - ) -> bool: ... - def ClearField( - self, - field_name: typing_extensions___Literal[ - "keyHashes", b"keyHashes", "mode", b"mode" - ], - ) -> None: ... - - name = ... # type: typing___Text + def HasField(self, field_name: typing_extensions.Literal["mode", b"mode"]) -> builtins.bool: ... + def ClearField(self, field_name: typing_extensions.Literal["keyHashes", b"keyHashes", "mode", b"mode"]) -> None: ... + NAME_FIELD_NUMBER: builtins.int + AUTH_FIELD_NUMBER: builtins.int + ENC_FIELD_NUMBER: builtins.int + name: builtins.str @property - def auth(self) -> TopicDescriptor.AuthOpts: ... + def auth(self) -> global___TopicDescriptor.AuthOpts: ... @property - def enc(self) -> TopicDescriptor.EncOpts: ... + def enc(self) -> global___TopicDescriptor.EncOpts: ... def __init__( self, *, - name: typing___Optional[typing___Text] = None, - auth: typing___Optional[TopicDescriptor.AuthOpts] = None, - enc: typing___Optional[TopicDescriptor.EncOpts] = None, + name: builtins.str | None = ..., + auth: global___TopicDescriptor.AuthOpts | None = ..., + enc: global___TopicDescriptor.EncOpts | None = ..., ) -> None: ... - @classmethod - def FromString(cls, s: bytes) -> TopicDescriptor: ... - def MergeFrom(self, other_msg: google___protobuf___message___Message) -> None: ... - def CopyFrom(self, other_msg: google___protobuf___message___Message) -> None: ... - if sys.version_info >= (3,): - def HasField( - self, field_name: typing_extensions___Literal["auth", "enc", "name"] - ) -> bool: ... - def ClearField( - self, field_name: typing_extensions___Literal["auth", "enc", "name"] - ) -> None: ... - else: - def HasField( - self, - field_name: typing_extensions___Literal[ - "auth", b"auth", "enc", b"enc", "name", b"name" - ], - ) -> bool: ... - def ClearField( - self, - field_name: typing_extensions___Literal[ - "auth", b"auth", "enc", b"enc", "name", b"name" - ], - ) -> None: ... + def HasField(self, field_name: typing_extensions.Literal["auth", b"auth", "enc", b"enc", "name", b"name"]) -> builtins.bool: ... + def ClearField(self, field_name: typing_extensions.Literal["auth", b"auth", "enc", b"enc", "name", b"name"]) -> None: ... + +global___TopicDescriptor = TopicDescriptor diff --git a/libp2p/security/insecure/pb/plaintext_pb2.py b/libp2p/security/insecure/pb/plaintext_pb2.py index eabb6e49..c04fc603 100644 --- a/libp2p/security/insecure/pb/plaintext_pb2.py +++ b/libp2p/security/insecure/pb/plaintext_pb2.py @@ -1,14 +1,12 @@ +# -*- coding: utf-8 -*- # Generated by the protocol buffer compiler. DO NOT EDIT! # source: libp2p/security/insecure/pb/plaintext.proto - -import sys - -_b = sys.version_info[0] < 3 and (lambda x: x) or (lambda x: x.encode("latin1")) +# Protobuf Python Version: 4.25.3 +"""Generated protocol buffer code.""" from google.protobuf import descriptor as _descriptor -from google.protobuf import message as _message -from google.protobuf import reflection as _reflection +from google.protobuf import descriptor_pool as _descriptor_pool from google.protobuf import symbol_database as _symbol_database - +from google.protobuf.internal import builder as _builder # @@protoc_insertion_point(imports) _sym_db = _symbol_database.Default() @@ -17,91 +15,13 @@ _sym_db = _symbol_database.Default() from libp2p.crypto.pb import crypto_pb2 as libp2p_dot_crypto_dot_pb_dot_crypto__pb2 -DESCRIPTOR = _descriptor.FileDescriptor( - name="libp2p/security/insecure/pb/plaintext.proto", - package="plaintext.pb", - syntax="proto2", - serialized_pb=_b( - '\n+libp2p/security/insecure/pb/plaintext.proto\x12\x0cplaintext.pb\x1a\x1dlibp2p/crypto/pb/crypto.proto"<\n\x08\x45xchange\x12\n\n\x02id\x18\x01 \x01(\x0c\x12$\n\x06pubkey\x18\x02 \x01(\x0b\x32\x14.crypto.pb.PublicKey' - ), - dependencies=[ - libp2p_dot_crypto_dot_pb_dot_crypto__pb2.DESCRIPTOR, - ], -) - - -_EXCHANGE = _descriptor.Descriptor( - name="Exchange", - full_name="plaintext.pb.Exchange", - filename=None, - file=DESCRIPTOR, - containing_type=None, - fields=[ - _descriptor.FieldDescriptor( - name="id", - full_name="plaintext.pb.Exchange.id", - index=0, - number=1, - type=12, - cpp_type=9, - label=1, - has_default_value=False, - default_value=_b(""), - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - options=None, - file=DESCRIPTOR, - ), - _descriptor.FieldDescriptor( - name="pubkey", - full_name="plaintext.pb.Exchange.pubkey", - index=1, - number=2, - type=11, - cpp_type=10, - label=1, - has_default_value=False, - default_value=None, - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - options=None, - file=DESCRIPTOR, - ), - ], - extensions=[], - nested_types=[], - enum_types=[], - options=None, - is_extendable=False, - syntax="proto2", - extension_ranges=[], - oneofs=[], - serialized_start=92, - serialized_end=152, -) - -_EXCHANGE.fields_by_name[ - "pubkey" -].message_type = libp2p_dot_crypto_dot_pb_dot_crypto__pb2._PUBLICKEY -DESCRIPTOR.message_types_by_name["Exchange"] = _EXCHANGE -_sym_db.RegisterFileDescriptor(DESCRIPTOR) - -Exchange = _reflection.GeneratedProtocolMessageType( - "Exchange", - (_message.Message,), - dict( - DESCRIPTOR=_EXCHANGE, - __module__="libp2p.security.insecure.pb.plaintext_pb2" - # @@protoc_insertion_point(class_scope:plaintext.pb.Exchange) - ), -) -_sym_db.RegisterMessage(Exchange) - +DESCRIPTOR = _descriptor_pool.Default().AddSerializedFile(b'\n+libp2p/security/insecure/pb/plaintext.proto\x12\x0cplaintext.pb\x1a\x1dlibp2p/crypto/pb/crypto.proto\"<\n\x08\x45xchange\x12\n\n\x02id\x18\x01 \x01(\x0c\x12$\n\x06pubkey\x18\x02 \x01(\x0b\x32\x14.crypto.pb.PublicKey') +_globals = globals() +_builder.BuildMessageAndEnumDescriptors(DESCRIPTOR, _globals) +_builder.BuildTopDescriptorsAndMessages(DESCRIPTOR, 'libp2p.security.insecure.pb.plaintext_pb2', _globals) +if _descriptor._USE_C_DESCRIPTORS == False: + DESCRIPTOR._options = None + _globals['_EXCHANGE']._serialized_start=92 + _globals['_EXCHANGE']._serialized_end=152 # @@protoc_insertion_point(module_scope) diff --git a/libp2p/security/insecure/pb/plaintext_pb2.pyi b/libp2p/security/insecure/pb/plaintext_pb2.pyi index d5f7a3d6..e97aa0d9 100644 --- a/libp2p/security/insecure/pb/plaintext_pb2.pyi +++ b/libp2p/security/insecure/pb/plaintext_pb2.pyi @@ -1,54 +1,36 @@ -# @generated by generate_proto_mypy_stubs.py. Do not edit! +""" +@generated by mypy-protobuf. Do not edit manually! +isort:skip_file +""" +import builtins +import google.protobuf.descriptor +import google.protobuf.message +import libp2p.crypto.pb.crypto_pb2 import sys -from google.protobuf.descriptor import ( - Descriptor as google___protobuf___descriptor___Descriptor, -) -from google.protobuf.message import ( - Message as google___protobuf___message___Message, -) +if sys.version_info >= (3, 8): + import typing as typing_extensions +else: + import typing_extensions -from libp2p.crypto.pb.crypto_pb2 import ( - PublicKey as libp2p___crypto___pb___crypto_pb2___PublicKey, -) +DESCRIPTOR: google.protobuf.descriptor.FileDescriptor -from typing import ( - Optional as typing___Optional, -) - -from typing_extensions import ( - Literal as typing_extensions___Literal, -) - -class Exchange(google___protobuf___message___Message): - DESCRIPTOR: google___protobuf___descriptor___Descriptor = ... - id = ... # type: bytes +@typing_extensions.final +class Exchange(google.protobuf.message.Message): + DESCRIPTOR: google.protobuf.descriptor.Descriptor + ID_FIELD_NUMBER: builtins.int + PUBKEY_FIELD_NUMBER: builtins.int + id: builtins.bytes @property - def pubkey(self) -> libp2p___crypto___pb___crypto_pb2___PublicKey: ... + def pubkey(self) -> libp2p.crypto.pb.crypto_pb2.PublicKey: ... def __init__( self, *, - id: typing___Optional[bytes] = None, - pubkey: typing___Optional[libp2p___crypto___pb___crypto_pb2___PublicKey] = None, + id: builtins.bytes | None = ..., + pubkey: libp2p.crypto.pb.crypto_pb2.PublicKey | None = ..., ) -> None: ... - @classmethod - def FromString(cls, s: bytes) -> Exchange: ... - def MergeFrom(self, other_msg: google___protobuf___message___Message) -> None: ... - def CopyFrom(self, other_msg: google___protobuf___message___Message) -> None: ... - if sys.version_info >= (3,): - def HasField( - self, field_name: typing_extensions___Literal["id", "pubkey"] - ) -> bool: ... - def ClearField( - self, field_name: typing_extensions___Literal["id", "pubkey"] - ) -> None: ... - else: - def HasField( - self, - field_name: typing_extensions___Literal["id", b"id", "pubkey", b"pubkey"], - ) -> bool: ... - def ClearField( - self, - field_name: typing_extensions___Literal["id", b"id", "pubkey", b"pubkey"], - ) -> None: ... + def HasField(self, field_name: typing_extensions.Literal["id", b"id", "pubkey", b"pubkey"]) -> builtins.bool: ... + def ClearField(self, field_name: typing_extensions.Literal["id", b"id", "pubkey", b"pubkey"]) -> None: ... + +global___Exchange = Exchange diff --git a/libp2p/security/noise/pb/noise_pb2.py b/libp2p/security/noise/pb/noise_pb2.py index 273d3d32..45e3d6c0 100644 --- a/libp2p/security/noise/pb/noise_pb2.py +++ b/libp2p/security/noise/pb/noise_pb2.py @@ -1,116 +1,26 @@ +# -*- coding: utf-8 -*- # Generated by the protocol buffer compiler. DO NOT EDIT! # source: libp2p/security/noise/pb/noise.proto - -import sys - -_b = sys.version_info[0] < 3 and (lambda x: x) or (lambda x: x.encode("latin1")) +# Protobuf Python Version: 4.25.3 +"""Generated protocol buffer code.""" from google.protobuf import descriptor as _descriptor -from google.protobuf import message as _message -from google.protobuf import reflection as _reflection +from google.protobuf import descriptor_pool as _descriptor_pool from google.protobuf import symbol_database as _symbol_database - +from google.protobuf.internal import builder as _builder # @@protoc_insertion_point(imports) _sym_db = _symbol_database.Default() -DESCRIPTOR = _descriptor.FileDescriptor( - name="libp2p/security/noise/pb/noise.proto", - package="pb", - syntax="proto3", - serialized_pb=_b( - '\n$libp2p/security/noise/pb/noise.proto\x12\x02pb"Q\n\x15NoiseHandshakePayload\x12\x14\n\x0cidentity_key\x18\x01 \x01(\x0c\x12\x14\n\x0cidentity_sig\x18\x02 \x01(\x0c\x12\x0c\n\x04\x64\x61ta\x18\x03 \x01(\x0c\x62\x06proto3' - ), -) -_NOISEHANDSHAKEPAYLOAD = _descriptor.Descriptor( - name="NoiseHandshakePayload", - full_name="pb.NoiseHandshakePayload", - filename=None, - file=DESCRIPTOR, - containing_type=None, - fields=[ - _descriptor.FieldDescriptor( - name="identity_key", - full_name="pb.NoiseHandshakePayload.identity_key", - index=0, - number=1, - type=12, - cpp_type=9, - label=1, - has_default_value=False, - default_value=_b(""), - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - options=None, - file=DESCRIPTOR, - ), - _descriptor.FieldDescriptor( - name="identity_sig", - full_name="pb.NoiseHandshakePayload.identity_sig", - index=1, - number=2, - type=12, - cpp_type=9, - label=1, - has_default_value=False, - default_value=_b(""), - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - options=None, - file=DESCRIPTOR, - ), - _descriptor.FieldDescriptor( - name="data", - full_name="pb.NoiseHandshakePayload.data", - index=2, - number=3, - type=12, - cpp_type=9, - label=1, - has_default_value=False, - default_value=_b(""), - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - options=None, - file=DESCRIPTOR, - ), - ], - extensions=[], - nested_types=[], - enum_types=[], - options=None, - is_extendable=False, - syntax="proto3", - extension_ranges=[], - oneofs=[], - serialized_start=44, - serialized_end=125, -) - -DESCRIPTOR.message_types_by_name["NoiseHandshakePayload"] = _NOISEHANDSHAKEPAYLOAD -_sym_db.RegisterFileDescriptor(DESCRIPTOR) - -NoiseHandshakePayload = _reflection.GeneratedProtocolMessageType( - "NoiseHandshakePayload", - (_message.Message,), - dict( - DESCRIPTOR=_NOISEHANDSHAKEPAYLOAD, - __module__="libp2p.security.noise.pb.noise_pb2" - # @@protoc_insertion_point(class_scope:pb.NoiseHandshakePayload) - ), -) -_sym_db.RegisterMessage(NoiseHandshakePayload) - +DESCRIPTOR = _descriptor_pool.Default().AddSerializedFile(b'\n$libp2p/security/noise/pb/noise.proto\x12\x02pb\"Q\n\x15NoiseHandshakePayload\x12\x14\n\x0cidentity_key\x18\x01 \x01(\x0c\x12\x14\n\x0cidentity_sig\x18\x02 \x01(\x0c\x12\x0c\n\x04\x64\x61ta\x18\x03 \x01(\x0c\x62\x06proto3') +_globals = globals() +_builder.BuildMessageAndEnumDescriptors(DESCRIPTOR, _globals) +_builder.BuildTopDescriptorsAndMessages(DESCRIPTOR, 'libp2p.security.noise.pb.noise_pb2', _globals) +if _descriptor._USE_C_DESCRIPTORS == False: + DESCRIPTOR._options = None + _globals['_NOISEHANDSHAKEPAYLOAD']._serialized_start=44 + _globals['_NOISEHANDSHAKEPAYLOAD']._serialized_end=125 # @@protoc_insertion_point(module_scope) diff --git a/libp2p/security/noise/pb/noise_pb2.pyi b/libp2p/security/noise/pb/noise_pb2.pyi index 16b6772a..d3cd4d24 100644 --- a/libp2p/security/noise/pb/noise_pb2.pyi +++ b/libp2p/security/noise/pb/noise_pb2.pyi @@ -1,54 +1,36 @@ -# @generated by generate_proto_mypy_stubs.py. Do not edit! +""" +@generated by mypy-protobuf. Do not edit manually! +isort:skip_file +""" +import builtins +import google.protobuf.descriptor +import google.protobuf.message import sys -from google.protobuf.descriptor import ( - Descriptor as google___protobuf___descriptor___Descriptor, -) -from google.protobuf.message import ( - Message as google___protobuf___message___Message, -) +if sys.version_info >= (3, 8): + import typing as typing_extensions +else: + import typing_extensions -from typing import ( - Optional as typing___Optional, -) +DESCRIPTOR: google.protobuf.descriptor.FileDescriptor -from typing_extensions import ( - Literal as typing_extensions___Literal, -) - -class NoiseHandshakePayload(google___protobuf___message___Message): - DESCRIPTOR: google___protobuf___descriptor___Descriptor = ... - identity_key = ... # type: bytes - identity_sig = ... # type: bytes - data = ... # type: bytes +@typing_extensions.final +class NoiseHandshakePayload(google.protobuf.message.Message): + DESCRIPTOR: google.protobuf.descriptor.Descriptor + IDENTITY_KEY_FIELD_NUMBER: builtins.int + IDENTITY_SIG_FIELD_NUMBER: builtins.int + DATA_FIELD_NUMBER: builtins.int + identity_key: builtins.bytes + identity_sig: builtins.bytes + data: builtins.bytes def __init__( self, *, - identity_key: typing___Optional[bytes] = None, - identity_sig: typing___Optional[bytes] = None, - data: typing___Optional[bytes] = None, + identity_key: builtins.bytes = ..., + identity_sig: builtins.bytes = ..., + data: builtins.bytes = ..., ) -> None: ... - @classmethod - def FromString(cls, s: bytes) -> NoiseHandshakePayload: ... - def MergeFrom(self, other_msg: google___protobuf___message___Message) -> None: ... - def CopyFrom(self, other_msg: google___protobuf___message___Message) -> None: ... - if sys.version_info >= (3,): - def ClearField( - self, - field_name: typing_extensions___Literal[ - "data", "identity_key", "identity_sig" - ], - ) -> None: ... - else: - def ClearField( - self, - field_name: typing_extensions___Literal[ - "data", - b"data", - "identity_key", - b"identity_key", - "identity_sig", - b"identity_sig", - ], - ) -> None: ... + def ClearField(self, field_name: typing_extensions.Literal["data", b"data", "identity_key", b"identity_key", "identity_sig", b"identity_sig"]) -> None: ... + +global___NoiseHandshakePayload = NoiseHandshakePayload diff --git a/libp2p/security/secio/pb/spipe_pb2.py b/libp2p/security/secio/pb/spipe_pb2.py index f0ad7872..32636112 100644 --- a/libp2p/security/secio/pb/spipe_pb2.py +++ b/libp2p/security/secio/pb/spipe_pb2.py @@ -1,222 +1,28 @@ +# -*- coding: utf-8 -*- # Generated by the protocol buffer compiler. DO NOT EDIT! # source: libp2p/security/secio/pb/spipe.proto - -import sys - -_b = sys.version_info[0] < 3 and (lambda x: x) or (lambda x: x.encode("latin1")) +# Protobuf Python Version: 4.25.3 +"""Generated protocol buffer code.""" from google.protobuf import descriptor as _descriptor -from google.protobuf import message as _message -from google.protobuf import reflection as _reflection +from google.protobuf import descriptor_pool as _descriptor_pool from google.protobuf import symbol_database as _symbol_database - +from google.protobuf.internal import builder as _builder # @@protoc_insertion_point(imports) _sym_db = _symbol_database.Default() -DESCRIPTOR = _descriptor.FileDescriptor( - name="libp2p/security/secio/pb/spipe.proto", - package="spipe.pb", - syntax="proto2", - serialized_options=None, - serialized_pb=_b( - '\n$libp2p/security/secio/pb/spipe.proto\x12\x08spipe.pb"_\n\x07Propose\x12\x0c\n\x04rand\x18\x01 \x01(\x0c\x12\x12\n\npublic_key\x18\x02 \x01(\x0c\x12\x11\n\texchanges\x18\x03 \x01(\t\x12\x0f\n\x07\x63iphers\x18\x04 \x01(\t\x12\x0e\n\x06hashes\x18\x05 \x01(\t";\n\x08\x45xchange\x12\x1c\n\x14\x65phemeral_public_key\x18\x01 \x01(\x0c\x12\x11\n\tsignature\x18\x02 \x01(\x0c' - ), -) -_PROPOSE = _descriptor.Descriptor( - name="Propose", - full_name="spipe.pb.Propose", - filename=None, - file=DESCRIPTOR, - containing_type=None, - fields=[ - _descriptor.FieldDescriptor( - name="rand", - full_name="spipe.pb.Propose.rand", - index=0, - number=1, - type=12, - cpp_type=9, - label=1, - has_default_value=False, - default_value=_b(""), - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=None, - file=DESCRIPTOR, - ), - _descriptor.FieldDescriptor( - name="public_key", - full_name="spipe.pb.Propose.public_key", - index=1, - number=2, - type=12, - cpp_type=9, - label=1, - has_default_value=False, - default_value=_b(""), - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=None, - file=DESCRIPTOR, - ), - _descriptor.FieldDescriptor( - name="exchanges", - full_name="spipe.pb.Propose.exchanges", - index=2, - number=3, - type=9, - cpp_type=9, - label=1, - has_default_value=False, - default_value=_b("").decode("utf-8"), - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=None, - file=DESCRIPTOR, - ), - _descriptor.FieldDescriptor( - name="ciphers", - full_name="spipe.pb.Propose.ciphers", - index=3, - number=4, - type=9, - cpp_type=9, - label=1, - has_default_value=False, - default_value=_b("").decode("utf-8"), - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=None, - file=DESCRIPTOR, - ), - _descriptor.FieldDescriptor( - name="hashes", - full_name="spipe.pb.Propose.hashes", - index=4, - number=5, - type=9, - cpp_type=9, - label=1, - has_default_value=False, - default_value=_b("").decode("utf-8"), - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=None, - file=DESCRIPTOR, - ), - ], - extensions=[], - nested_types=[], - enum_types=[], - serialized_options=None, - is_extendable=False, - syntax="proto2", - extension_ranges=[], - oneofs=[], - serialized_start=50, - serialized_end=145, -) - - -_EXCHANGE = _descriptor.Descriptor( - name="Exchange", - full_name="spipe.pb.Exchange", - filename=None, - file=DESCRIPTOR, - containing_type=None, - fields=[ - _descriptor.FieldDescriptor( - name="ephemeral_public_key", - full_name="spipe.pb.Exchange.ephemeral_public_key", - index=0, - number=1, - type=12, - cpp_type=9, - label=1, - has_default_value=False, - default_value=_b(""), - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=None, - file=DESCRIPTOR, - ), - _descriptor.FieldDescriptor( - name="signature", - full_name="spipe.pb.Exchange.signature", - index=1, - number=2, - type=12, - cpp_type=9, - label=1, - has_default_value=False, - default_value=_b(""), - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=None, - file=DESCRIPTOR, - ), - ], - extensions=[], - nested_types=[], - enum_types=[], - serialized_options=None, - is_extendable=False, - syntax="proto2", - extension_ranges=[], - oneofs=[], - serialized_start=147, - serialized_end=206, -) - -DESCRIPTOR.message_types_by_name["Propose"] = _PROPOSE -DESCRIPTOR.message_types_by_name["Exchange"] = _EXCHANGE -_sym_db.RegisterFileDescriptor(DESCRIPTOR) - -Propose = _reflection.GeneratedProtocolMessageType( - "Propose", - (_message.Message,), - { - "DESCRIPTOR": _PROPOSE, - "__module__": "libp2p.security.secio.pb.spipe_pb2" - # @@protoc_insertion_point(class_scope:spipe.pb.Propose) - }, -) -_sym_db.RegisterMessage(Propose) - -Exchange = _reflection.GeneratedProtocolMessageType( - "Exchange", - (_message.Message,), - { - "DESCRIPTOR": _EXCHANGE, - "__module__": "libp2p.security.secio.pb.spipe_pb2" - # @@protoc_insertion_point(class_scope:spipe.pb.Exchange) - }, -) -_sym_db.RegisterMessage(Exchange) - +DESCRIPTOR = _descriptor_pool.Default().AddSerializedFile(b'\n$libp2p/security/secio/pb/spipe.proto\x12\x08spipe.pb\"_\n\x07Propose\x12\x0c\n\x04rand\x18\x01 \x01(\x0c\x12\x12\n\npublic_key\x18\x02 \x01(\x0c\x12\x11\n\texchanges\x18\x03 \x01(\t\x12\x0f\n\x07\x63iphers\x18\x04 \x01(\t\x12\x0e\n\x06hashes\x18\x05 \x01(\t\";\n\x08\x45xchange\x12\x1c\n\x14\x65phemeral_public_key\x18\x01 \x01(\x0c\x12\x11\n\tsignature\x18\x02 \x01(\x0c') +_globals = globals() +_builder.BuildMessageAndEnumDescriptors(DESCRIPTOR, _globals) +_builder.BuildTopDescriptorsAndMessages(DESCRIPTOR, 'libp2p.security.secio.pb.spipe_pb2', _globals) +if _descriptor._USE_C_DESCRIPTORS == False: + DESCRIPTOR._options = None + _globals['_PROPOSE']._serialized_start=50 + _globals['_PROPOSE']._serialized_end=145 + _globals['_EXCHANGE']._serialized_start=147 + _globals['_EXCHANGE']._serialized_end=206 # @@protoc_insertion_point(module_scope) diff --git a/libp2p/security/secio/pb/spipe_pb2.pyi b/libp2p/security/secio/pb/spipe_pb2.pyi index 5319942e..afb44b7a 100644 --- a/libp2p/security/secio/pb/spipe_pb2.pyi +++ b/libp2p/security/secio/pb/spipe_pb2.pyi @@ -1,132 +1,62 @@ -# @generated by generate_proto_mypy_stubs.py. Do not edit! +""" +@generated by mypy-protobuf. Do not edit manually! +isort:skip_file +""" +import builtins +import google.protobuf.descriptor +import google.protobuf.message import sys -from google.protobuf.descriptor import ( - Descriptor as google___protobuf___descriptor___Descriptor, -) -from google.protobuf.message import ( - Message as google___protobuf___message___Message, -) +if sys.version_info >= (3, 8): + import typing as typing_extensions +else: + import typing_extensions -from typing import ( - Optional as typing___Optional, - Text as typing___Text, -) +DESCRIPTOR: google.protobuf.descriptor.FileDescriptor -from typing_extensions import ( - Literal as typing_extensions___Literal, -) - -class Propose(google___protobuf___message___Message): - DESCRIPTOR: google___protobuf___descriptor___Descriptor = ... - rand = ... # type: bytes - public_key = ... # type: bytes - exchanges = ... # type: typing___Text - ciphers = ... # type: typing___Text - hashes = ... # type: typing___Text +@typing_extensions.final +class Propose(google.protobuf.message.Message): + DESCRIPTOR: google.protobuf.descriptor.Descriptor + RAND_FIELD_NUMBER: builtins.int + PUBLIC_KEY_FIELD_NUMBER: builtins.int + EXCHANGES_FIELD_NUMBER: builtins.int + CIPHERS_FIELD_NUMBER: builtins.int + HASHES_FIELD_NUMBER: builtins.int + rand: builtins.bytes + public_key: builtins.bytes + exchanges: builtins.str + ciphers: builtins.str + hashes: builtins.str def __init__( self, *, - rand: typing___Optional[bytes] = None, - public_key: typing___Optional[bytes] = None, - exchanges: typing___Optional[typing___Text] = None, - ciphers: typing___Optional[typing___Text] = None, - hashes: typing___Optional[typing___Text] = None, + rand: builtins.bytes | None = ..., + public_key: builtins.bytes | None = ..., + exchanges: builtins.str | None = ..., + ciphers: builtins.str | None = ..., + hashes: builtins.str | None = ..., ) -> None: ... - @classmethod - def FromString(cls, s: bytes) -> Propose: ... - def MergeFrom(self, other_msg: google___protobuf___message___Message) -> None: ... - def CopyFrom(self, other_msg: google___protobuf___message___Message) -> None: ... - if sys.version_info >= (3,): - def HasField( - self, - field_name: typing_extensions___Literal[ - "ciphers", "exchanges", "hashes", "public_key", "rand" - ], - ) -> bool: ... - def ClearField( - self, - field_name: typing_extensions___Literal[ - "ciphers", "exchanges", "hashes", "public_key", "rand" - ], - ) -> None: ... - else: - def HasField( - self, - field_name: typing_extensions___Literal[ - "ciphers", - b"ciphers", - "exchanges", - b"exchanges", - "hashes", - b"hashes", - "public_key", - b"public_key", - "rand", - b"rand", - ], - ) -> bool: ... - def ClearField( - self, - field_name: typing_extensions___Literal[ - "ciphers", - b"ciphers", - "exchanges", - b"exchanges", - "hashes", - b"hashes", - "public_key", - b"public_key", - "rand", - b"rand", - ], - ) -> None: ... + def HasField(self, field_name: typing_extensions.Literal["ciphers", b"ciphers", "exchanges", b"exchanges", "hashes", b"hashes", "public_key", b"public_key", "rand", b"rand"]) -> builtins.bool: ... + def ClearField(self, field_name: typing_extensions.Literal["ciphers", b"ciphers", "exchanges", b"exchanges", "hashes", b"hashes", "public_key", b"public_key", "rand", b"rand"]) -> None: ... -class Exchange(google___protobuf___message___Message): - DESCRIPTOR: google___protobuf___descriptor___Descriptor = ... - ephemeral_public_key = ... # type: bytes - signature = ... # type: bytes +global___Propose = Propose +@typing_extensions.final +class Exchange(google.protobuf.message.Message): + DESCRIPTOR: google.protobuf.descriptor.Descriptor + + EPHEMERAL_PUBLIC_KEY_FIELD_NUMBER: builtins.int + SIGNATURE_FIELD_NUMBER: builtins.int + ephemeral_public_key: builtins.bytes + signature: builtins.bytes def __init__( self, *, - ephemeral_public_key: typing___Optional[bytes] = None, - signature: typing___Optional[bytes] = None, + ephemeral_public_key: builtins.bytes | None = ..., + signature: builtins.bytes | None = ..., ) -> None: ... - @classmethod - def FromString(cls, s: bytes) -> Exchange: ... - def MergeFrom(self, other_msg: google___protobuf___message___Message) -> None: ... - def CopyFrom(self, other_msg: google___protobuf___message___Message) -> None: ... - if sys.version_info >= (3,): - def HasField( - self, - field_name: typing_extensions___Literal[ - "ephemeral_public_key", "signature" - ], - ) -> bool: ... - def ClearField( - self, - field_name: typing_extensions___Literal[ - "ephemeral_public_key", "signature" - ], - ) -> None: ... - else: - def HasField( - self, - field_name: typing_extensions___Literal[ - "ephemeral_public_key", - b"ephemeral_public_key", - "signature", - b"signature", - ], - ) -> bool: ... - def ClearField( - self, - field_name: typing_extensions___Literal[ - "ephemeral_public_key", - b"ephemeral_public_key", - "signature", - b"signature", - ], - ) -> None: ... + def HasField(self, field_name: typing_extensions.Literal["ephemeral_public_key", b"ephemeral_public_key", "signature", b"signature"]) -> builtins.bool: ... + def ClearField(self, field_name: typing_extensions.Literal["ephemeral_public_key", b"ephemeral_public_key", "signature", b"signature"]) -> None: ... + +global___Exchange = Exchange diff --git a/tests/libp2p/test_libp2p.py b/tests/test_libp2p/test_libp2p.py similarity index 100% rename from tests/libp2p/test_libp2p.py rename to tests/test_libp2p/test_libp2p.py