mirror of
https://github.com/varun-r-mallya/py-libp2p.git
synced 2026-02-12 16:10:57 +00:00
feat/561-added autonat service
This commit is contained in:
committed by
Paul Robinson
parent
fd893afba6
commit
9655c88788
108
libp2p/host/autonat/pb/autonat_pb2_grpc.py
Normal file
108
libp2p/host/autonat/pb/autonat_pb2_grpc.py
Normal file
@ -0,0 +1,108 @@
|
||||
# Generated by the gRPC Python protocol compiler plugin. DO NOT EDIT!
|
||||
"""Client and server classes corresponding to protobuf-defined services."""
|
||||
import grpc
|
||||
from typing import Any, Optional
|
||||
|
||||
from . import autonat_pb2 as autonat__pb2
|
||||
|
||||
GRPC_GENERATED_VERSION = "1.71.0"
|
||||
GRPC_VERSION = grpc.__version__
|
||||
_version_not_supported = False
|
||||
|
||||
try:
|
||||
from grpc._utilities import first_version_is_lower
|
||||
|
||||
_version_not_supported = first_version_is_lower(
|
||||
GRPC_VERSION, GRPC_GENERATED_VERSION
|
||||
)
|
||||
except ImportError:
|
||||
_version_not_supported = True
|
||||
|
||||
if _version_not_supported:
|
||||
raise RuntimeError(
|
||||
f"The grpc package installed is at version {GRPC_VERSION},"
|
||||
+ f" but the generated code in autonat_pb2_grpc.py depends on"
|
||||
+ f" grpcio>={GRPC_GENERATED_VERSION}."
|
||||
+ f" Please upgrade your grpc module to grpcio>={GRPC_GENERATED_VERSION}"
|
||||
+ f" or downgrade your generated code using grpcio-tools<={GRPC_VERSION}."
|
||||
)
|
||||
|
||||
|
||||
class AutoNATStub:
|
||||
"""AutoNAT service definition"""
|
||||
|
||||
def __init__(self, channel: grpc.Channel) -> None:
|
||||
"""Initialize the AutoNAT stub.
|
||||
|
||||
Args:
|
||||
----
|
||||
channel (grpc.Channel): The gRPC channel instance that facilitates
|
||||
communication for the AutoNAT service, providing the underlying
|
||||
transport mechanism for RPC calls.
|
||||
|
||||
"""
|
||||
self.Dial = channel.unary_unary(
|
||||
"/autonat.pb.AutoNAT/Dial",
|
||||
request_serializer=autonat__pb2.Message.SerializeToString,
|
||||
response_deserializer=autonat__pb2.Message.FromString,
|
||||
_registered_method=True,
|
||||
)
|
||||
|
||||
|
||||
class AutoNATServicer:
|
||||
"""AutoNAT service definition"""
|
||||
|
||||
def Dial(self, request: Any, context: Any) -> Any:
|
||||
"""Missing associated documentation comment in .proto file."""
|
||||
context.set_code(grpc.StatusCode.UNIMPLEMENTED)
|
||||
context.set_details("Method not implemented!")
|
||||
raise NotImplementedError("Method not implemented!")
|
||||
|
||||
|
||||
def add_AutoNATServicer_to_server(servicer: AutoNATServicer, server: Any) -> None:
|
||||
rpc_method_handlers = {
|
||||
"Dial": grpc.unary_unary_rpc_method_handler(
|
||||
servicer.Dial,
|
||||
request_deserializer=autonat__pb2.Message.FromString,
|
||||
response_serializer=autonat__pb2.Message.SerializeToString,
|
||||
),
|
||||
}
|
||||
generic_handler = grpc.method_handlers_generic_handler(
|
||||
"autonat.pb.AutoNAT", rpc_method_handlers
|
||||
)
|
||||
server.add_generic_rpc_handlers((generic_handler,))
|
||||
server.add_registered_method_handlers("autonat.pb.AutoNAT", rpc_method_handlers)
|
||||
|
||||
|
||||
# This class is part of an EXPERIMENTAL API.
|
||||
class AutoNAT:
|
||||
"""AutoNAT service definition"""
|
||||
|
||||
@staticmethod
|
||||
def Dial(
|
||||
request: Any,
|
||||
target: str,
|
||||
options: tuple[Any, ...] = (),
|
||||
channel_credentials: Optional[Any] = None,
|
||||
call_credentials: Optional[Any] = None,
|
||||
insecure: bool = False,
|
||||
compression: Optional[Any] = None,
|
||||
wait_for_ready: Optional[bool] = None,
|
||||
timeout: Optional[float] = None,
|
||||
metadata: Optional[list[tuple[str, str]]] = None,
|
||||
) -> Any:
|
||||
return grpc.experimental.unary_unary(
|
||||
request,
|
||||
target,
|
||||
"/autonat.pb.AutoNAT/Dial",
|
||||
autonat__pb2.Message.SerializeToString,
|
||||
autonat__pb2.Message.FromString,
|
||||
options,
|
||||
channel_credentials,
|
||||
insecure,
|
||||
call_credentials,
|
||||
compression,
|
||||
wait_for_ready,
|
||||
timeout,
|
||||
metadata,
|
||||
)
|
||||
Reference in New Issue
Block a user