From 86dce72ae0c719207b11b2623159ce2bd47ba566 Mon Sep 17 00:00:00 2001 From: Winter-Soren Date: Thu, 1 May 2025 13:22:17 +0530 Subject: [PATCH] fix: regenerate protobuf files to match runtime version --- Makefile | 3 +- docs/conf.py | 31 ++- docs/libp2p.host.autonat.pb.rst | 37 ++++ docs/libp2p.host.autonat.rst | 29 +++ docs/libp2p.host.rst | 8 + libp2p/crypto/pb/crypto_pb2.py | 35 ++-- libp2p/host/autonat/__init__.py | 5 +- libp2p/host/autonat/autonat.py | 116 ++++++----- libp2p/host/autonat/pb/autonat_pb2.py | 51 ++--- libp2p/host/autonat/pb/autonat_pb2.pyi | 193 ++++++++++++++----- libp2p/identity/identify/pb/identify_pb2.py | 27 +-- libp2p/pubsub/pb/rpc_pb2.py | 75 +++---- libp2p/security/insecure/pb/plaintext_pb2.py | 27 +-- libp2p/security/noise/pb/noise_pb2.py | 27 +-- libp2p/security/secio/pb/spipe_pb2.py | 31 +-- 15 files changed, 404 insertions(+), 291 deletions(-) create mode 100644 docs/libp2p.host.autonat.pb.rst create mode 100644 docs/libp2p.host.autonat.rst diff --git a/Makefile b/Makefile index 0d9995a5..e1064eb2 100644 --- a/Makefile +++ b/Makefile @@ -47,7 +47,8 @@ PB = libp2p/crypto/pb/crypto.proto \ libp2p/security/insecure/pb/plaintext.proto \ libp2p/security/secio/pb/spipe.proto \ libp2p/security/noise/pb/noise.proto \ - libp2p/identity/identify/pb/identify.proto + libp2p/identity/identify/pb/identify.proto \ + libp2p/host/autonat/pb/autonat.proto PY = $(PB:.proto=_pb2.py) PYI = $(PB:.proto=_pb2.pyi) diff --git a/docs/conf.py b/docs/conf.py index 9bd69c11..b482014a 100644 --- a/docs/conf.py +++ b/docs/conf.py @@ -13,9 +13,10 @@ # If extensions (or modules to document with autodoc) are in another directory, # add these directories to sys.path here. If the directory is relative to the # documentation root, use os.path.abspath to make it absolute, like shown here. -# sys.path.insert(0, os.path.abspath('.')) - import os +import sys + +sys.path.insert(0, os.path.abspath("..")) DIR = os.path.dirname(__file__) with open(os.path.join(DIR, "../setup.py"), "r") as f: @@ -36,7 +37,13 @@ extensions = [ "sphinx.ext.autodoc", "sphinx.ext.doctest", "sphinx.ext.intersphinx", - "sphinx_rtd_theme", + "sphinx.ext.todo", + "sphinx.ext.coverage", + "sphinx.ext.mathjax", + "sphinx.ext.ifconfig", + "sphinx.ext.viewcode", + "sphinx.ext.githubpages", + "sphinx.ext.napoleon", ] # Add any paths that contain templates here, relative to this directory. @@ -53,7 +60,8 @@ master_doc = "index" # General information about the project. project = "py-libp2p" -copyright = '2019, The Ethereum Foundation' +copyright = "2019, The libp2p team" +author = "The libp2p team" __version__ = setup_version # The version info for the project you're documenting, acts as replacement for @@ -316,7 +324,6 @@ doctest_default_flags = ( # Mock out dependencies that are unbuildable on readthedocs, as recommended here: # https://docs.readthedocs.io/en/rel/faq.html#i-get-import-errors-on-libraries-that-depend-on-c-modules -import sys from unittest.mock import MagicMock # Add new modules to mock here (it should be the same list as those excluded in setup.py) @@ -326,3 +333,17 @@ MOCK_MODULES = [ "fastecdsa.encoding.sec1", ] sys.modules.update((mod_name, MagicMock()) for mod_name in MOCK_MODULES) + +# -- Extension configuration ------------------------------------------------- + +# -- Options for todo extension ---------------------------------------------- + +# If true, `todo` and `todoList` produce output, else they produce nothing. +todo_include_todos = True + +# -- Options for autodoc extension ------------------------------------------ + +# Allow duplicate object descriptions +nitpicky = False +nitpick_ignore = [("py:class", "type")] +suppress_warnings = ["app.add_directive"] diff --git a/docs/libp2p.host.autonat.pb.rst b/docs/libp2p.host.autonat.pb.rst new file mode 100644 index 00000000..6f95460e --- /dev/null +++ b/docs/libp2p.host.autonat.pb.rst @@ -0,0 +1,37 @@ +libp2p.host.autonat.pb package +============================== + +Submodules +---------- + +libp2p.host.autonat.pb.autonat\_pb2 module +------------------------------------------ + +.. automodule:: libp2p.host.autonat.pb.autonat_pb2 + :members: + :show-inheritance: + :undoc-members: + +libp2p.host.autonat.pb.autonat\_pb2\_grpc module +------------------------------------------------ + +.. automodule:: libp2p.host.autonat.pb.autonat_pb2_grpc + :members: + :show-inheritance: + :undoc-members: + +libp2p.host.autonat.pb.generate\_proto module +--------------------------------------------- + +.. automodule:: libp2p.host.autonat.pb.generate_proto + :members: + :show-inheritance: + :undoc-members: + +Module contents +--------------- + +.. automodule:: libp2p.host.autonat.pb + :members: + :show-inheritance: + :undoc-members: diff --git a/docs/libp2p.host.autonat.rst b/docs/libp2p.host.autonat.rst new file mode 100644 index 00000000..9db39509 --- /dev/null +++ b/docs/libp2p.host.autonat.rst @@ -0,0 +1,29 @@ +libp2p.host.autonat package +=========================== + +Subpackages +----------- + +.. toctree:: + :maxdepth: 4 + + libp2p.host.autonat.pb + +Submodules +---------- + +libp2p.host.autonat.autonat module +---------------------------------- + +.. automodule:: libp2p.host.autonat.autonat + :members: + :show-inheritance: + :undoc-members: + +Module contents +--------------- + +.. automodule:: libp2p.host.autonat + :members: + :show-inheritance: + :undoc-members: diff --git a/docs/libp2p.host.rst b/docs/libp2p.host.rst index 3f43e49e..f5af6837 100644 --- a/docs/libp2p.host.rst +++ b/docs/libp2p.host.rst @@ -4,6 +4,14 @@ libp2p.host package Submodules ---------- +libp2p.host.autonat module +-------------------------- + +.. automodule:: libp2p.host.autonat + :members: + :undoc-members: + :show-inheritance: + libp2p.host.basic\_host module ------------------------------ diff --git a/libp2p/crypto/pb/crypto_pb2.py b/libp2p/crypto/pb/crypto_pb2.py index 7958108d..3ca19591 100644 --- a/libp2p/crypto/pb/crypto_pb2.py +++ b/libp2p/crypto/pb/crypto_pb2.py @@ -1,22 +1,11 @@ # -*- coding: utf-8 -*- # Generated by the protocol buffer compiler. DO NOT EDIT! -# NO CHECKED-IN PROTOBUF GENCODE # source: libp2p/crypto/pb/crypto.proto -# Protobuf Python Version: 6.30.1 """Generated protocol buffer code.""" +from google.protobuf.internal import builder as _builder from google.protobuf import descriptor as _descriptor from google.protobuf import descriptor_pool as _descriptor_pool -from google.protobuf import runtime_version as _runtime_version from google.protobuf import symbol_database as _symbol_database -from google.protobuf.internal import builder as _builder -_runtime_version.ValidateProtobufRuntimeVersion( - _runtime_version.Domain.PUBLIC, - 6, - 30, - 1, - '', - 'libp2p/crypto/pb/crypto.proto' -) # @@protoc_insertion_point(imports) _sym_db = _symbol_database.Default() @@ -26,15 +15,15 @@ _sym_db = _symbol_database.Default() 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*G\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\x12\x0c\n\x08\x45\x43\x43_P256\x10\x04') -_globals = globals() -_builder.BuildMessageAndEnumDescriptors(DESCRIPTOR, _globals) -_builder.BuildTopDescriptorsAndMessages(DESCRIPTOR, 'libp2p.crypto.pb.crypto_pb2', _globals) -if not _descriptor._USE_C_DESCRIPTORS: - DESCRIPTOR._loaded_options = None - _globals['_KEYTYPE']._serialized_start=175 - _globals['_KEYTYPE']._serialized_end=246 - _globals['_PUBLICKEY']._serialized_start=44 - _globals['_PUBLICKEY']._serialized_end=107 - _globals['_PRIVATEKEY']._serialized_start=109 - _globals['_PRIVATEKEY']._serialized_end=173 +_builder.BuildMessageAndEnumDescriptors(DESCRIPTOR, globals()) +_builder.BuildTopDescriptorsAndMessages(DESCRIPTOR, 'libp2p.crypto.pb.crypto_pb2', globals()) +if _descriptor._USE_C_DESCRIPTORS == False: + + DESCRIPTOR._options = None + _KEYTYPE._serialized_start=175 + _KEYTYPE._serialized_end=246 + _PUBLICKEY._serialized_start=44 + _PUBLICKEY._serialized_end=107 + _PRIVATEKEY._serialized_start=109 + _PRIVATEKEY._serialized_end=173 # @@protoc_insertion_point(module_scope) diff --git a/libp2p/host/autonat/__init__.py b/libp2p/host/autonat/__init__.py index 56ed5aab..bae80db5 100644 --- a/libp2p/host/autonat/__init__.py +++ b/libp2p/host/autonat/__init__.py @@ -1,5 +1,8 @@ +"""AutoNAT module for libp2p.""" + from .autonat import ( AutoNATService, + AutoNATStatus, ) -__all__ = ["AutoNATService"] +__all__ = ["AutoNATService", "AutoNATStatus"] diff --git a/libp2p/host/autonat/autonat.py b/libp2p/host/autonat/autonat.py index 93d80f12..8b483c56 100644 --- a/libp2p/host/autonat/autonat.py +++ b/libp2p/host/autonat/autonat.py @@ -1,4 +1,7 @@ import logging +from typing import ( + Union, +) from libp2p.custom_types import ( TProtocol, @@ -30,12 +33,12 @@ logger = logging.getLogger("libp2p.host.autonat") class AutoNATStatus: """ - Status enumeration for the AutoNAT service. + AutoNAT Status Enumeration. - This class defines the possible states of NAT traversal for a node: - - UNKNOWN (0): The node's NAT status has not been determined yet - - PUBLIC (1): The node is publicly reachable - - PRIVATE (2): The node is behind NAT and not directly reachable + Defines the possible states of NAT traversal for a libp2p node: + - UNKNOWN (0): Initial state, NAT status not yet determined + - PUBLIC (1): Node is publicly reachable from the internet + - PRIVATE (2): Node is behind NAT, not directly reachable """ UNKNOWN = 0 @@ -45,23 +48,24 @@ class AutoNATStatus: class AutoNATService: """ - Service for determining if a node is publicly reachable. + AutoNAT Service Implementation. - The AutoNAT service helps nodes determine their NAT status by attempting - to establish connections with other peers. It maintains a record of dial - attempts and their results to classify the node as public or private. + A service that helps libp2p nodes determine their NAT status by + attempting to establish connections with other peers. The service + maintains a record of dial attempts and their results to classify + the node as either public or private. """ def __init__(self, host: BasicHost) -> None: """ - Initialize the AutoNAT service. - - Args: - ---- - host (BasicHost): The libp2p host instance that provides networking - capabilities for the AutoNAT service, including peer discovery - and connection management. + Create a new AutoNAT service instance. + Parameters + ---------- + host : BasicHost + The libp2p host instance that provides networking capabilities + for the AutoNAT service, including peer discovery and connection + management. """ self.host = host self.peerstore: IPeerStore = host.get_peerstore() @@ -70,9 +74,12 @@ class AutoNATService: async def handle_stream(self, stream: NetStream) -> None: """ - Handle an incoming stream. + Process an incoming AutoNAT stream. - :param stream: The stream to handle + Parameters + ---------- + stream : NetStream + The network stream to handle for AutoNAT protocol communication. """ try: request_bytes = await stream.read() @@ -85,23 +92,22 @@ class AutoNATService: finally: await stream.close() - async def _handle_request(self, request: bytes | Message) -> Message: + async def _handle_request(self, request: Union[bytes, Message]) -> Message: """ - Handle an AutoNAT request. + Process an AutoNAT protocol request. - Parses and processes incoming AutoNAT requests, routing them to - appropriate handlers based on the message type. - - Args: - ---- - request (bytes | Message): The request bytes that need to be parsed - and handled by the AutoNAT service, or a Message object directly. + Parameters + ---------- + request : Union[bytes, Message] + The request data to be processed, either as raw bytes or a + pre-parsed Message object. Returns ------- - Message: The response message containing the result of the request. - Returns an error response if the request type is not recognized. - + Message + The response message containing the result of processing the + request. Returns an error response if the request type is not + recognized. """ if isinstance(request, bytes): message = Message() @@ -123,21 +129,19 @@ class AutoNATService: async def _handle_dial(self, message: Message) -> Message: """ - Handle a DIAL request. + Process an AutoNAT dial request. - Processes dial requests by attempting to connect to specified peers - and recording the results of these connection attempts. - - Args: - ---- - message (Message): The request message containing the dial request - parameters and peer information. + Parameters + ---------- + message : Message + The dial request message containing peer information to test + connectivity. Returns ------- - Message: The response message containing the dial results, including - success/failure status for each attempted peer connection. - + Message + The response message containing the results of the dial + attempts, including success/failure status for each peer. """ response = Message() response.type = Type.Value("DIAL_RESPONSE") @@ -166,21 +170,18 @@ class AutoNATService: async def _try_dial(self, peer_id: ID) -> bool: """ - Try to dial a peer. + Attempt to establish a connection with a peer. - Attempts to establish a connection with a specified peer to test - NAT traversal capabilities. - - Args: - ---- - peer_id (ID): The identifier of the peer to attempt to dial for - NAT traversal testing. + Parameters + ---------- + peer_id : ID + The identifier of the peer to attempt to dial. Returns ------- - bool: True if the dial was successful and a connection could be - established, False if the connection attempt failed. - + bool + True if the connection was successfully established, + False if the connection attempt failed. """ try: stream = await self.host.new_stream(peer_id, [AUTONAT_PROTOCOL_ID]) @@ -191,18 +192,15 @@ class AutoNATService: def get_status(self) -> int: """ - Get the current AutoNAT status. - - Retrieves the current NAT status of the node based on previous - dial attempts and their results. + Retrieve the current AutoNAT status. Returns ------- - int: The current status as an integer: + int + The current NAT status: - AutoNATStatus.UNKNOWN (0): Status not yet determined - AutoNATStatus.PUBLIC (1): Node is publicly reachable - AutoNATStatus.PRIVATE (2): Node is behind NAT - """ return self.status @@ -210,7 +208,7 @@ class AutoNATService: """ Update the AutoNAT status based on dial results. - Analyzes the results of previous dial attempts to determine if the + Analyzes the accumulated dial attempt results to determine if the node is publicly reachable. The node is considered public if at least two successful dial attempts have been recorded. """ diff --git a/libp2p/host/autonat/pb/autonat_pb2.py b/libp2p/host/autonat/pb/autonat_pb2.py index b359edf2..983a89c6 100644 --- a/libp2p/host/autonat/pb/autonat_pb2.py +++ b/libp2p/host/autonat/pb/autonat_pb2.py @@ -1,22 +1,11 @@ # -*- coding: utf-8 -*- # Generated by the protocol buffer compiler. DO NOT EDIT! -# NO CHECKED-IN PROTOBUF GENCODE # source: libp2p/host/autonat/pb/autonat.proto -# Protobuf Python Version: 5.29.0 """Generated protocol buffer code.""" +from google.protobuf.internal import builder as _builder from google.protobuf import descriptor as _descriptor from google.protobuf import descriptor_pool as _descriptor_pool -from google.protobuf import runtime_version as _runtime_version from google.protobuf import symbol_database as _symbol_database -from google.protobuf.internal import builder as _builder -_runtime_version.ValidateProtobufRuntimeVersion( - _runtime_version.Domain.PUBLIC, - 5, - 29, - 0, - '', - 'libp2p/host/autonat/pb/autonat.proto' -) # @@protoc_insertion_point(imports) _sym_db = _symbol_database.Default() @@ -26,23 +15,23 @@ _sym_db = _symbol_database.Default() DESCRIPTOR = _descriptor_pool.Default().AddSerializedFile(b'\n$libp2p/host/autonat/pb/autonat.proto\x12\nautonat.pb\"\x81\x01\n\x07Message\x12\x1e\n\x04type\x18\x01 \x01(\x0e\x32\x10.autonat.pb.Type\x12%\n\x04\x64ial\x18\x02 \x01(\x0b\x32\x17.autonat.pb.DialRequest\x12/\n\rdial_response\x18\x03 \x01(\x0b\x32\x18.autonat.pb.DialResponse\"2\n\x0b\x44ialRequest\x12#\n\x05peers\x18\x01 \x03(\x0b\x32\x14.autonat.pb.PeerInfo\"W\n\x0c\x44ialResponse\x12\"\n\x06status\x18\x01 \x01(\x0e\x32\x12.autonat.pb.Status\x12#\n\x05peers\x18\x02 \x03(\x0b\x32\x14.autonat.pb.PeerInfo\"6\n\x08PeerInfo\x12\n\n\x02id\x18\x01 \x01(\x0c\x12\r\n\x05\x61\x64\x64rs\x18\x02 \x03(\x0c\x12\x0f\n\x07success\x18\x03 \x01(\x08*0\n\x04Type\x12\x0b\n\x07UNKNOWN\x10\x00\x12\x08\n\x04\x44IAL\x10\x01\x12\x11\n\rDIAL_RESPONSE\x10\x02*_\n\x06Status\x12\x06\n\x02OK\x10\x00\x12\x10\n\x0c\x45_DIAL_ERROR\x10\x01\x12\x12\n\x0e\x45_DIAL_REFUSED\x10\x02\x12\x11\n\rE_DIAL_FAILED\x10\x03\x12\x14\n\x10\x45_INTERNAL_ERROR\x10\x64\x32=\n\x07\x41utoNAT\x12\x32\n\x04\x44ial\x12\x13.autonat.pb.Message\x1a\x13.autonat.pb.Message\"\x00\x62\x06proto3') -_globals = globals() -_builder.BuildMessageAndEnumDescriptors(DESCRIPTOR, _globals) -_builder.BuildTopDescriptorsAndMessages(DESCRIPTOR, 'libp2p.host.autonat.pb.autonat_pb2', _globals) -if not _descriptor._USE_C_DESCRIPTORS: - DESCRIPTOR._loaded_options = None - _globals['_TYPE']._serialized_start=381 - _globals['_TYPE']._serialized_end=429 - _globals['_STATUS']._serialized_start=431 - _globals['_STATUS']._serialized_end=526 - _globals['_MESSAGE']._serialized_start=53 - _globals['_MESSAGE']._serialized_end=182 - _globals['_DIALREQUEST']._serialized_start=184 - _globals['_DIALREQUEST']._serialized_end=234 - _globals['_DIALRESPONSE']._serialized_start=236 - _globals['_DIALRESPONSE']._serialized_end=323 - _globals['_PEERINFO']._serialized_start=325 - _globals['_PEERINFO']._serialized_end=379 - _globals['_AUTONAT']._serialized_start=528 - _globals['_AUTONAT']._serialized_end=589 +_builder.BuildMessageAndEnumDescriptors(DESCRIPTOR, globals()) +_builder.BuildTopDescriptorsAndMessages(DESCRIPTOR, 'libp2p.host.autonat.pb.autonat_pb2', globals()) +if _descriptor._USE_C_DESCRIPTORS == False: + + DESCRIPTOR._options = None + _TYPE._serialized_start=381 + _TYPE._serialized_end=429 + _STATUS._serialized_start=431 + _STATUS._serialized_end=526 + _MESSAGE._serialized_start=53 + _MESSAGE._serialized_end=182 + _DIALREQUEST._serialized_start=184 + _DIALREQUEST._serialized_end=234 + _DIALRESPONSE._serialized_start=236 + _DIALRESPONSE._serialized_end=323 + _PEERINFO._serialized_start=325 + _PEERINFO._serialized_end=379 + _AUTONAT._serialized_start=528 + _AUTONAT._serialized_end=589 # @@protoc_insertion_point(module_scope) diff --git a/libp2p/host/autonat/pb/autonat_pb2.pyi b/libp2p/host/autonat/pb/autonat_pb2.pyi index 9053b735..b44f7bb2 100644 --- a/libp2p/host/autonat/pb/autonat_pb2.pyi +++ b/libp2p/host/autonat/pb/autonat_pb2.pyi @@ -1,56 +1,149 @@ -from typing import Any, List, Optional, Union +""" +@generated by mypy-protobuf. Do not edit manually! +isort:skip_file +""" -class Message: - type: int - dial: Any - dial_response: Any - - def ParseFromString(self, data: bytes) -> None: ... - def SerializeToString(self) -> bytes: ... - @staticmethod - def FromString(data: bytes) -> 'Message': ... +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 +import typing -class DialRequest: - peers: List[Any] - - def ParseFromString(self, data: bytes) -> None: ... - def SerializeToString(self) -> bytes: ... - @staticmethod - def FromString(data: bytes) -> 'DialRequest': ... +if sys.version_info >= (3, 10): + import typing as typing_extensions +else: + import typing_extensions -class DialResponse: - status: int - peers: List[Any] - - def ParseFromString(self, data: bytes) -> None: ... - def SerializeToString(self) -> bytes: ... - @staticmethod - def FromString(data: bytes) -> 'DialResponse': ... +DESCRIPTOR: google.protobuf.descriptor.FileDescriptor -class PeerInfo: - id: bytes - addrs: List[bytes] - success: bool - - def ParseFromString(self, data: bytes) -> None: ... - def SerializeToString(self) -> bytes: ... - @staticmethod - def FromString(data: bytes) -> 'PeerInfo': ... +class _Type: + ValueType = typing.NewType("ValueType", builtins.int) + V: typing_extensions.TypeAlias = ValueType -class Type: - UNKNOWN: int - DIAL: int - DIAL_RESPONSE: int - - @staticmethod - def Value(name: str) -> int: ... +class _TypeEnumTypeWrapper(google.protobuf.internal.enum_type_wrapper._EnumTypeWrapper[_Type.ValueType], builtins.type): + DESCRIPTOR: google.protobuf.descriptor.EnumDescriptor + UNKNOWN: _Type.ValueType # 0 + DIAL: _Type.ValueType # 1 + DIAL_RESPONSE: _Type.ValueType # 2 -class Status: - OK: int - E_DIAL_ERROR: int - E_DIAL_REFUSED: int - E_DIAL_FAILED: int - E_INTERNAL_ERROR: int - - @staticmethod - def Value(name: str) -> int: ... \ No newline at end of file +class Type(_Type, metaclass=_TypeEnumTypeWrapper): + """Message types""" + +UNKNOWN: Type.ValueType # 0 +DIAL: Type.ValueType # 1 +DIAL_RESPONSE: Type.ValueType # 2 +global___Type = Type + +class _Status: + ValueType = typing.NewType("ValueType", builtins.int) + V: typing_extensions.TypeAlias = ValueType + +class _StatusEnumTypeWrapper(google.protobuf.internal.enum_type_wrapper._EnumTypeWrapper[_Status.ValueType], builtins.type): + DESCRIPTOR: google.protobuf.descriptor.EnumDescriptor + OK: _Status.ValueType # 0 + E_DIAL_ERROR: _Status.ValueType # 1 + E_DIAL_REFUSED: _Status.ValueType # 2 + E_DIAL_FAILED: _Status.ValueType # 3 + E_INTERNAL_ERROR: _Status.ValueType # 100 + +class Status(_Status, metaclass=_StatusEnumTypeWrapper): + """Status codes""" + +OK: Status.ValueType # 0 +E_DIAL_ERROR: Status.ValueType # 1 +E_DIAL_REFUSED: Status.ValueType # 2 +E_DIAL_FAILED: Status.ValueType # 3 +E_INTERNAL_ERROR: Status.ValueType # 100 +global___Status = Status + +@typing.final +class Message(google.protobuf.message.Message): + """Main message""" + + DESCRIPTOR: google.protobuf.descriptor.Descriptor + + TYPE_FIELD_NUMBER: builtins.int + DIAL_FIELD_NUMBER: builtins.int + DIAL_RESPONSE_FIELD_NUMBER: builtins.int + type: global___Type.ValueType + @property + def dial(self) -> global___DialRequest: ... + @property + def dial_response(self) -> global___DialResponse: ... + def __init__( + self, + *, + type: global___Type.ValueType = ..., + dial: global___DialRequest | None = ..., + dial_response: global___DialResponse | None = ..., + ) -> None: ... + def HasField(self, field_name: typing.Literal["dial", b"dial", "dial_response", b"dial_response"]) -> builtins.bool: ... + def ClearField(self, field_name: typing.Literal["dial", b"dial", "dial_response", b"dial_response", "type", b"type"]) -> None: ... + +global___Message = Message + +@typing.final +class DialRequest(google.protobuf.message.Message): + """Dial request""" + + DESCRIPTOR: google.protobuf.descriptor.Descriptor + + PEERS_FIELD_NUMBER: builtins.int + @property + def peers(self) -> google.protobuf.internal.containers.RepeatedCompositeFieldContainer[global___PeerInfo]: ... + def __init__( + self, + *, + peers: collections.abc.Iterable[global___PeerInfo] | None = ..., + ) -> None: ... + def ClearField(self, field_name: typing.Literal["peers", b"peers"]) -> None: ... + +global___DialRequest = DialRequest + +@typing.final +class DialResponse(google.protobuf.message.Message): + """Dial response""" + + DESCRIPTOR: google.protobuf.descriptor.Descriptor + + STATUS_FIELD_NUMBER: builtins.int + PEERS_FIELD_NUMBER: builtins.int + status: global___Status.ValueType + @property + def peers(self) -> google.protobuf.internal.containers.RepeatedCompositeFieldContainer[global___PeerInfo]: ... + def __init__( + self, + *, + status: global___Status.ValueType = ..., + peers: collections.abc.Iterable[global___PeerInfo] | None = ..., + ) -> None: ... + def ClearField(self, field_name: typing.Literal["peers", b"peers", "status", b"status"]) -> None: ... + +global___DialResponse = DialResponse + +@typing.final +class PeerInfo(google.protobuf.message.Message): + """Peer information""" + + DESCRIPTOR: google.protobuf.descriptor.Descriptor + + ID_FIELD_NUMBER: builtins.int + ADDRS_FIELD_NUMBER: builtins.int + SUCCESS_FIELD_NUMBER: builtins.int + id: builtins.bytes + success: builtins.bool + @property + def addrs(self) -> google.protobuf.internal.containers.RepeatedScalarFieldContainer[builtins.bytes]: ... + def __init__( + self, + *, + id: builtins.bytes = ..., + addrs: collections.abc.Iterable[builtins.bytes] | None = ..., + success: builtins.bool = ..., + ) -> None: ... + def ClearField(self, field_name: typing.Literal["addrs", b"addrs", "id", b"id", "success", b"success"]) -> None: ... + +global___PeerInfo = PeerInfo diff --git a/libp2p/identity/identify/pb/identify_pb2.py b/libp2p/identity/identify/pb/identify_pb2.py index 8bffb185..4c89157e 100644 --- a/libp2p/identity/identify/pb/identify_pb2.py +++ b/libp2p/identity/identify/pb/identify_pb2.py @@ -1,22 +1,11 @@ # -*- coding: utf-8 -*- # Generated by the protocol buffer compiler. DO NOT EDIT! -# NO CHECKED-IN PROTOBUF GENCODE # source: libp2p/identity/identify/pb/identify.proto -# Protobuf Python Version: 6.30.1 """Generated protocol buffer code.""" +from google.protobuf.internal import builder as _builder from google.protobuf import descriptor as _descriptor from google.protobuf import descriptor_pool as _descriptor_pool -from google.protobuf import runtime_version as _runtime_version from google.protobuf import symbol_database as _symbol_database -from google.protobuf.internal import builder as _builder -_runtime_version.ValidateProtobufRuntimeVersion( - _runtime_version.Domain.PUBLIC, - 6, - 30, - 1, - '', - 'libp2p/identity/identify/pb/identify.proto' -) # @@protoc_insertion_point(imports) _sym_db = _symbol_database.Default() @@ -26,11 +15,11 @@ _sym_db = _symbol_database.Default() 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 not _descriptor._USE_C_DESCRIPTORS: - DESCRIPTOR._loaded_options = None - _globals['_IDENTIFY']._serialized_start=60 - _globals['_IDENTIFY']._serialized_end=203 +_builder.BuildMessageAndEnumDescriptors(DESCRIPTOR, globals()) +_builder.BuildTopDescriptorsAndMessages(DESCRIPTOR, 'libp2p.identity.identify.pb.identify_pb2', globals()) +if _descriptor._USE_C_DESCRIPTORS == False: + + DESCRIPTOR._options = None + _IDENTIFY._serialized_start=60 + _IDENTIFY._serialized_end=203 # @@protoc_insertion_point(module_scope) diff --git a/libp2p/pubsub/pb/rpc_pb2.py b/libp2p/pubsub/pb/rpc_pb2.py index 49a9568f..2f010fa3 100644 --- a/libp2p/pubsub/pb/rpc_pb2.py +++ b/libp2p/pubsub/pb/rpc_pb2.py @@ -1,22 +1,11 @@ # -*- coding: utf-8 -*- # Generated by the protocol buffer compiler. DO NOT EDIT! -# NO CHECKED-IN PROTOBUF GENCODE # source: libp2p/pubsub/pb/rpc.proto -# Protobuf Python Version: 6.30.1 """Generated protocol buffer code.""" +from google.protobuf.internal import builder as _builder from google.protobuf import descriptor as _descriptor from google.protobuf import descriptor_pool as _descriptor_pool -from google.protobuf import runtime_version as _runtime_version from google.protobuf import symbol_database as _symbol_database -from google.protobuf.internal import builder as _builder -_runtime_version.ValidateProtobufRuntimeVersion( - _runtime_version.Domain.PUBLIC, - 6, - 30, - 1, - '', - 'libp2p/pubsub/pb/rpc.proto' -) # @@protoc_insertion_point(imports) _sym_db = _symbol_database.Default() @@ -26,35 +15,35 @@ _sym_db = _symbol_database.Default() 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 not _descriptor._USE_C_DESCRIPTORS: - DESCRIPTOR._loaded_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 +_builder.BuildMessageAndEnumDescriptors(DESCRIPTOR, globals()) +_builder.BuildTopDescriptorsAndMessages(DESCRIPTOR, 'libp2p.pubsub.pb.rpc_pb2', globals()) +if _descriptor._USE_C_DESCRIPTORS == False: + + DESCRIPTOR._options = None + _RPC._serialized_start=42 + _RPC._serialized_end=222 + _RPC_SUBOPTS._serialized_start=177 + _RPC_SUBOPTS._serialized_end=222 + _MESSAGE._serialized_start=224 + _MESSAGE._serialized_end=329 + _CONTROLMESSAGE._serialized_start=332 + _CONTROLMESSAGE._serialized_end=508 + _CONTROLIHAVE._serialized_start=510 + _CONTROLIHAVE._serialized_end=561 + _CONTROLIWANT._serialized_start=563 + _CONTROLIWANT._serialized_end=597 + _CONTROLGRAFT._serialized_start=599 + _CONTROLGRAFT._serialized_end=630 + _CONTROLPRUNE._serialized_start=632 + _CONTROLPRUNE._serialized_end=663 + _TOPICDESCRIPTOR._serialized_start=666 + _TOPICDESCRIPTOR._serialized_end=1057 + _TOPICDESCRIPTOR_AUTHOPTS._serialized_start=799 + _TOPICDESCRIPTOR_AUTHOPTS._serialized_end=923 + _TOPICDESCRIPTOR_AUTHOPTS_AUTHMODE._serialized_start=885 + _TOPICDESCRIPTOR_AUTHOPTS_AUTHMODE._serialized_end=923 + _TOPICDESCRIPTOR_ENCOPTS._serialized_start=926 + _TOPICDESCRIPTOR_ENCOPTS._serialized_end=1057 + _TOPICDESCRIPTOR_ENCOPTS_ENCMODE._serialized_start=1014 + _TOPICDESCRIPTOR_ENCOPTS_ENCMODE._serialized_end=1057 # @@protoc_insertion_point(module_scope) diff --git a/libp2p/security/insecure/pb/plaintext_pb2.py b/libp2p/security/insecure/pb/plaintext_pb2.py index ebc99c82..005a3d60 100644 --- a/libp2p/security/insecure/pb/plaintext_pb2.py +++ b/libp2p/security/insecure/pb/plaintext_pb2.py @@ -1,22 +1,11 @@ # -*- coding: utf-8 -*- # Generated by the protocol buffer compiler. DO NOT EDIT! -# NO CHECKED-IN PROTOBUF GENCODE # source: libp2p/security/insecure/pb/plaintext.proto -# Protobuf Python Version: 6.30.1 """Generated protocol buffer code.""" +from google.protobuf.internal import builder as _builder from google.protobuf import descriptor as _descriptor from google.protobuf import descriptor_pool as _descriptor_pool -from google.protobuf import runtime_version as _runtime_version from google.protobuf import symbol_database as _symbol_database -from google.protobuf.internal import builder as _builder -_runtime_version.ValidateProtobufRuntimeVersion( - _runtime_version.Domain.PUBLIC, - 6, - 30, - 1, - '', - 'libp2p/security/insecure/pb/plaintext.proto' -) # @@protoc_insertion_point(imports) _sym_db = _symbol_database.Default() @@ -27,11 +16,11 @@ from libp2p.crypto.pb import crypto_pb2 as libp2p_dot_crypto_dot_pb_dot_crypto__ 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 not _descriptor._USE_C_DESCRIPTORS: - DESCRIPTOR._loaded_options = None - _globals['_EXCHANGE']._serialized_start=92 - _globals['_EXCHANGE']._serialized_end=152 +_builder.BuildMessageAndEnumDescriptors(DESCRIPTOR, globals()) +_builder.BuildTopDescriptorsAndMessages(DESCRIPTOR, 'libp2p.security.insecure.pb.plaintext_pb2', globals()) +if _descriptor._USE_C_DESCRIPTORS == False: + + DESCRIPTOR._options = None + _EXCHANGE._serialized_start=92 + _EXCHANGE._serialized_end=152 # @@protoc_insertion_point(module_scope) diff --git a/libp2p/security/noise/pb/noise_pb2.py b/libp2p/security/noise/pb/noise_pb2.py index 5c8294b2..dd078b0f 100644 --- a/libp2p/security/noise/pb/noise_pb2.py +++ b/libp2p/security/noise/pb/noise_pb2.py @@ -1,22 +1,11 @@ # -*- coding: utf-8 -*- # Generated by the protocol buffer compiler. DO NOT EDIT! -# NO CHECKED-IN PROTOBUF GENCODE # source: libp2p/security/noise/pb/noise.proto -# Protobuf Python Version: 6.30.1 """Generated protocol buffer code.""" +from google.protobuf.internal import builder as _builder from google.protobuf import descriptor as _descriptor from google.protobuf import descriptor_pool as _descriptor_pool -from google.protobuf import runtime_version as _runtime_version from google.protobuf import symbol_database as _symbol_database -from google.protobuf.internal import builder as _builder -_runtime_version.ValidateProtobufRuntimeVersion( - _runtime_version.Domain.PUBLIC, - 6, - 30, - 1, - '', - 'libp2p/security/noise/pb/noise.proto' -) # @@protoc_insertion_point(imports) _sym_db = _symbol_database.Default() @@ -26,11 +15,11 @@ _sym_db = _symbol_database.Default() 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 not _descriptor._USE_C_DESCRIPTORS: - DESCRIPTOR._loaded_options = None - _globals['_NOISEHANDSHAKEPAYLOAD']._serialized_start=44 - _globals['_NOISEHANDSHAKEPAYLOAD']._serialized_end=125 +_builder.BuildMessageAndEnumDescriptors(DESCRIPTOR, globals()) +_builder.BuildTopDescriptorsAndMessages(DESCRIPTOR, 'libp2p.security.noise.pb.noise_pb2', globals()) +if _descriptor._USE_C_DESCRIPTORS == False: + + DESCRIPTOR._options = None + _NOISEHANDSHAKEPAYLOAD._serialized_start=44 + _NOISEHANDSHAKEPAYLOAD._serialized_end=125 # @@protoc_insertion_point(module_scope) diff --git a/libp2p/security/secio/pb/spipe_pb2.py b/libp2p/security/secio/pb/spipe_pb2.py index fa2d931d..01de258b 100644 --- a/libp2p/security/secio/pb/spipe_pb2.py +++ b/libp2p/security/secio/pb/spipe_pb2.py @@ -1,22 +1,11 @@ # -*- coding: utf-8 -*- # Generated by the protocol buffer compiler. DO NOT EDIT! -# NO CHECKED-IN PROTOBUF GENCODE # source: libp2p/security/secio/pb/spipe.proto -# Protobuf Python Version: 6.30.1 """Generated protocol buffer code.""" +from google.protobuf.internal import builder as _builder from google.protobuf import descriptor as _descriptor from google.protobuf import descriptor_pool as _descriptor_pool -from google.protobuf import runtime_version as _runtime_version from google.protobuf import symbol_database as _symbol_database -from google.protobuf.internal import builder as _builder -_runtime_version.ValidateProtobufRuntimeVersion( - _runtime_version.Domain.PUBLIC, - 6, - 30, - 1, - '', - 'libp2p/security/secio/pb/spipe.proto' -) # @@protoc_insertion_point(imports) _sym_db = _symbol_database.Default() @@ -26,13 +15,13 @@ _sym_db = _symbol_database.Default() 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 not _descriptor._USE_C_DESCRIPTORS: - DESCRIPTOR._loaded_options = None - _globals['_PROPOSE']._serialized_start=50 - _globals['_PROPOSE']._serialized_end=145 - _globals['_EXCHANGE']._serialized_start=147 - _globals['_EXCHANGE']._serialized_end=206 +_builder.BuildMessageAndEnumDescriptors(DESCRIPTOR, globals()) +_builder.BuildTopDescriptorsAndMessages(DESCRIPTOR, 'libp2p.security.secio.pb.spipe_pb2', globals()) +if _descriptor._USE_C_DESCRIPTORS == False: + + DESCRIPTOR._options = None + _PROPOSE._serialized_start=50 + _PROPOSE._serialized_end=145 + _EXCHANGE._serialized_start=147 + _EXCHANGE._serialized_end=206 # @@protoc_insertion_point(module_scope)