mirror of
https://github.com/varun-r-mallya/py-libp2p.git
synced 2026-03-22 21:21:27 +00:00
Feat/587-circuit-relay (#611)
* feat: implemented setup of circuit relay and test cases * chore: remove test files to be rewritten * added 1 test suite for protocol * added 1 test suite for discovery * fixed protocol timeouts and message types to handle reservations and stream operations. * Resolved merge conflict in libp2p/tools/utils.py by combining timeout approach with retry mechanism * fix: linting issues * docs: updated documentation with circuit-relay * chore: added enums, improved typing, security and examples * fix: created proper __init__ file to ensure importability * fix: replace transport_opt with listen_addrs in examples, fixed typing and improved code * fix type checking issues across relay module and test suite * regenerated circuit_pb2 file protobuf version 3 * fixed circuit relay example and moved imports to top in test_security_multistream * chore: moved imports to the top * chore: fixed linting of test_circuit_v2_transport.py --------- Co-authored-by: Manu Sheel Gupta <manusheel.edu@gmail.com>
This commit is contained in:
184
libp2p/relay/circuit_v2/pb/circuit_pb2.pyi
Normal file
184
libp2p/relay/circuit_v2/pb/circuit_pb2.pyi
Normal file
@ -0,0 +1,184 @@
|
||||
"""
|
||||
@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
|
||||
import typing
|
||||
|
||||
if sys.version_info >= (3, 10):
|
||||
import typing as typing_extensions
|
||||
else:
|
||||
import typing_extensions
|
||||
|
||||
DESCRIPTOR: google.protobuf.descriptor.FileDescriptor
|
||||
|
||||
@typing.final
|
||||
class HopMessage(google.protobuf.message.Message):
|
||||
"""Circuit v2 message types"""
|
||||
|
||||
DESCRIPTOR: google.protobuf.descriptor.Descriptor
|
||||
|
||||
class _Type:
|
||||
ValueType = typing.NewType("ValueType", builtins.int)
|
||||
V: typing_extensions.TypeAlias = ValueType
|
||||
|
||||
class _TypeEnumTypeWrapper(google.protobuf.internal.enum_type_wrapper._EnumTypeWrapper[HopMessage._Type.ValueType], builtins.type):
|
||||
DESCRIPTOR: google.protobuf.descriptor.EnumDescriptor
|
||||
RESERVE: HopMessage._Type.ValueType # 0
|
||||
CONNECT: HopMessage._Type.ValueType # 1
|
||||
STATUS: HopMessage._Type.ValueType # 2
|
||||
|
||||
class Type(_Type, metaclass=_TypeEnumTypeWrapper): ...
|
||||
RESERVE: HopMessage.Type.ValueType # 0
|
||||
CONNECT: HopMessage.Type.ValueType # 1
|
||||
STATUS: HopMessage.Type.ValueType # 2
|
||||
|
||||
TYPE_FIELD_NUMBER: builtins.int
|
||||
PEER_FIELD_NUMBER: builtins.int
|
||||
RESERVATION_FIELD_NUMBER: builtins.int
|
||||
LIMIT_FIELD_NUMBER: builtins.int
|
||||
STATUS_FIELD_NUMBER: builtins.int
|
||||
type: global___HopMessage.Type.ValueType
|
||||
peer: builtins.bytes
|
||||
@property
|
||||
def reservation(self) -> global___Reservation: ...
|
||||
@property
|
||||
def limit(self) -> global___Limit: ...
|
||||
@property
|
||||
def status(self) -> global___Status: ...
|
||||
def __init__(
|
||||
self,
|
||||
*,
|
||||
type: global___HopMessage.Type.ValueType = ...,
|
||||
peer: builtins.bytes = ...,
|
||||
reservation: global___Reservation | None = ...,
|
||||
limit: global___Limit | None = ...,
|
||||
status: global___Status | None = ...,
|
||||
) -> None: ...
|
||||
def HasField(self, field_name: typing.Literal["limit", b"limit", "reservation", b"reservation", "status", b"status"]) -> builtins.bool: ...
|
||||
def ClearField(self, field_name: typing.Literal["limit", b"limit", "peer", b"peer", "reservation", b"reservation", "status", b"status", "type", b"type"]) -> None: ...
|
||||
|
||||
global___HopMessage = HopMessage
|
||||
|
||||
@typing.final
|
||||
class StopMessage(google.protobuf.message.Message):
|
||||
DESCRIPTOR: google.protobuf.descriptor.Descriptor
|
||||
|
||||
class _Type:
|
||||
ValueType = typing.NewType("ValueType", builtins.int)
|
||||
V: typing_extensions.TypeAlias = ValueType
|
||||
|
||||
class _TypeEnumTypeWrapper(google.protobuf.internal.enum_type_wrapper._EnumTypeWrapper[StopMessage._Type.ValueType], builtins.type):
|
||||
DESCRIPTOR: google.protobuf.descriptor.EnumDescriptor
|
||||
CONNECT: StopMessage._Type.ValueType # 0
|
||||
STATUS: StopMessage._Type.ValueType # 1
|
||||
|
||||
class Type(_Type, metaclass=_TypeEnumTypeWrapper): ...
|
||||
CONNECT: StopMessage.Type.ValueType # 0
|
||||
STATUS: StopMessage.Type.ValueType # 1
|
||||
|
||||
TYPE_FIELD_NUMBER: builtins.int
|
||||
PEER_FIELD_NUMBER: builtins.int
|
||||
STATUS_FIELD_NUMBER: builtins.int
|
||||
type: global___StopMessage.Type.ValueType
|
||||
peer: builtins.bytes
|
||||
@property
|
||||
def status(self) -> global___Status: ...
|
||||
def __init__(
|
||||
self,
|
||||
*,
|
||||
type: global___StopMessage.Type.ValueType = ...,
|
||||
peer: builtins.bytes = ...,
|
||||
status: global___Status | None = ...,
|
||||
) -> None: ...
|
||||
def HasField(self, field_name: typing.Literal["status", b"status"]) -> builtins.bool: ...
|
||||
def ClearField(self, field_name: typing.Literal["peer", b"peer", "status", b"status", "type", b"type"]) -> None: ...
|
||||
|
||||
global___StopMessage = StopMessage
|
||||
|
||||
@typing.final
|
||||
class Reservation(google.protobuf.message.Message):
|
||||
DESCRIPTOR: google.protobuf.descriptor.Descriptor
|
||||
|
||||
VOUCHER_FIELD_NUMBER: builtins.int
|
||||
SIGNATURE_FIELD_NUMBER: builtins.int
|
||||
EXPIRE_FIELD_NUMBER: builtins.int
|
||||
voucher: builtins.bytes
|
||||
signature: builtins.bytes
|
||||
expire: builtins.int
|
||||
def __init__(
|
||||
self,
|
||||
*,
|
||||
voucher: builtins.bytes = ...,
|
||||
signature: builtins.bytes = ...,
|
||||
expire: builtins.int = ...,
|
||||
) -> None: ...
|
||||
def ClearField(self, field_name: typing.Literal["expire", b"expire", "signature", b"signature", "voucher", b"voucher"]) -> None: ...
|
||||
|
||||
global___Reservation = Reservation
|
||||
|
||||
@typing.final
|
||||
class Limit(google.protobuf.message.Message):
|
||||
DESCRIPTOR: google.protobuf.descriptor.Descriptor
|
||||
|
||||
DURATION_FIELD_NUMBER: builtins.int
|
||||
DATA_FIELD_NUMBER: builtins.int
|
||||
duration: builtins.int
|
||||
data: builtins.int
|
||||
def __init__(
|
||||
self,
|
||||
*,
|
||||
duration: builtins.int = ...,
|
||||
data: builtins.int = ...,
|
||||
) -> None: ...
|
||||
def ClearField(self, field_name: typing.Literal["data", b"data", "duration", b"duration"]) -> None: ...
|
||||
|
||||
global___Limit = Limit
|
||||
|
||||
@typing.final
|
||||
class Status(google.protobuf.message.Message):
|
||||
DESCRIPTOR: google.protobuf.descriptor.Descriptor
|
||||
|
||||
class _Code:
|
||||
ValueType = typing.NewType("ValueType", builtins.int)
|
||||
V: typing_extensions.TypeAlias = ValueType
|
||||
|
||||
class _CodeEnumTypeWrapper(google.protobuf.internal.enum_type_wrapper._EnumTypeWrapper[Status._Code.ValueType], builtins.type):
|
||||
DESCRIPTOR: google.protobuf.descriptor.EnumDescriptor
|
||||
OK: Status._Code.ValueType # 0
|
||||
RESERVATION_REFUSED: Status._Code.ValueType # 100
|
||||
RESOURCE_LIMIT_EXCEEDED: Status._Code.ValueType # 101
|
||||
PERMISSION_DENIED: Status._Code.ValueType # 102
|
||||
CONNECTION_FAILED: Status._Code.ValueType # 200
|
||||
DIAL_REFUSED: Status._Code.ValueType # 201
|
||||
STOP_FAILED: Status._Code.ValueType # 300
|
||||
MALFORMED_MESSAGE: Status._Code.ValueType # 400
|
||||
|
||||
class Code(_Code, metaclass=_CodeEnumTypeWrapper): ...
|
||||
OK: Status.Code.ValueType # 0
|
||||
RESERVATION_REFUSED: Status.Code.ValueType # 100
|
||||
RESOURCE_LIMIT_EXCEEDED: Status.Code.ValueType # 101
|
||||
PERMISSION_DENIED: Status.Code.ValueType # 102
|
||||
CONNECTION_FAILED: Status.Code.ValueType # 200
|
||||
DIAL_REFUSED: Status.Code.ValueType # 201
|
||||
STOP_FAILED: Status.Code.ValueType # 300
|
||||
MALFORMED_MESSAGE: Status.Code.ValueType # 400
|
||||
|
||||
CODE_FIELD_NUMBER: builtins.int
|
||||
MESSAGE_FIELD_NUMBER: builtins.int
|
||||
code: global___Status.Code.ValueType
|
||||
message: builtins.str
|
||||
def __init__(
|
||||
self,
|
||||
*,
|
||||
code: global___Status.Code.ValueType = ...,
|
||||
message: builtins.str = ...,
|
||||
) -> None: ...
|
||||
def ClearField(self, field_name: typing.Literal["code", b"code", "message", b"message"]) -> None: ...
|
||||
|
||||
global___Status = Status
|
||||
Reference in New Issue
Block a user