Documentation ¶
Index ¶
- type Client
- type Config
- type Option
- type Peer
- type PeerID
- type Server
- func (m *Server) Info(ctx context.Context, request *sonm.Empty) (*sonm.RendezvousState, error)
- func (m *Server) Publish(ctx context.Context, request *sonm.PublishRequest) (*sonm.RendezvousReply, error)
- func (m *Server) Resolve(ctx context.Context, request *sonm.ConnectRequest) (*sonm.RendezvousReply, error)
- func (m *Server) ResolveAll(ctx context.Context, request *sonm.ID) (*sonm.ResolveMetaReply, error)
- func (m *Server) Run(ctx context.Context) error
- func (m *Server) Stop()
- type ServerConfig
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Client ¶
type Client interface { sonm.RendezvousClient // Close closes this client freeing the associated resources. // // All pending operations will be terminated with error. Close() error }
Client extends the generated gRPC client allowing to close the underlying connection. Users should call Client.Close to terminate all the pending operations.
func NewRendezvousClient ¶
func NewRendezvousClient(ctx context.Context, addr string, credentials credentials.TransportCredentials, opts ...grpc.DialOption) (Client, error)
NewRendezvousClient constructs a new rendezvous client.
The address provided will be used for establishing a TCP connection while optional credentials - for authentication. Additionally other dial options can be specified.
type Option ¶
type Option func(options *options)
Option is a function that configures the server.
func WithCredentials ¶
WithCredentials is an option that specifies transport credentials used for establishing secure connections between peer and the server. Nil value is also supported, but discouraged, because it disables the authentication. Clients that require TLS will fail the handshake process and disconnect from such server. Note that we use ETH based TLS credentials.
func WithLogger ¶
WithLogger is an option that specifies provided logger used for the internal logging. Nil value is supported and can be passed to deactivate the logging system entirely.
func WithQUIC ¶ added in v0.4.17
func WithQUIC() Option
WithQUIC activates QUIC support in the Rendezvous server, allowing to penetrate NAT for UDP. When using this option it is REQUIRED to specify transport credentials by passing "WithCredentials" option, because QUIC provides security protection equivalent to TLS.
type PeerID ¶
type PeerID string
PeerID represents an unique peer id generated at the time of either publishing or resolving another peer.
This id is used for cleaning resources when a request is finished. Note, that we cannot use peer's Ethereum address as an id, because it can be shared across multiple servers/clients.
type Server ¶
type Server struct {
// contains filtered or unexported fields
}
Server represents a rendezvous server.
This server is responsible for tracking servers and clients to make them meet each other.
func NewServer ¶
func NewServer(cfg *ServerConfig, options ...Option) (*Server, error)
NewServer constructs a new rendezvous server using specified config and options.
The server supports TLS by passing transport credentials using WithCredentials option. Also it is possible to activate logging system by passing a logger using WithLogger function as an option.
func (*Server) ResolveAll ¶
type ServerConfig ¶
type ServerConfig struct { // Listening address. Addr net.Addr PrivateKey *ecdsa.PrivateKey Logging logging.Config Debug *debug.Config }
ServerConfig represents a Rendezvous server configuration.
func NewServerConfig ¶
func NewServerConfig(path string) (*ServerConfig, error)
NewServerConfig loads a new Rendezvous server config from a file.