Documentation ¶
Index ¶
- Constants
- func Dial(addr net.Addr, targetAddr common.Address, uuid string) (net.Conn, error)
- func DialWithLog(addr net.Addr, targetAddr common.Address, uuid string, log *zap.Logger) (net.Conn, error)
- func Listen(addr net.Addr, publishAddr SignedETHAddr) (net.Conn, error)
- func ListenWithLog(addr net.Addr, publishAddr SignedETHAddr, log *zap.Logger) (net.Conn, error)
- func NewServer(cfg ServerConfig, options ...Option) (*server, error)
- type BackPressureListener
- type ClusterConfig
- type Config
- type ConnID
- type Dialer
- type Listener
- type MonitorConfig
- type Node
- type Option
- type ServerConfig
- type SignedETHAddr
Constants ¶
const ( ErrInvalidHandshake int32 = iota ErrUnknownPeerType ErrTimeout ErrNoPeer ErrWrongNode ErrEmptyContinuum )
Variables ¶
This section is empty.
Functions ¶
func Dial ¶
Dial communicates with the relay server waiting for other server peer to establish a relayed TCP connection.
All network traffic will be transported through that server.
func DialWithLog ¶
func DialWithLog(addr net.Addr, targetAddr common.Address, uuid string, log *zap.Logger) (net.Conn, error)
DialWithLog does the same as Dial, but with logging.
func Listen ¶
Listen publishes itself to the relay server waiting for other client peer to establish a relayed TCP connection.
All network traffic will be transported through that server.
func ListenWithLog ¶
ListenWithLog does the same as Listen, but with logging.
func NewServer ¶
func NewServer(cfg ServerConfig, options ...Option) (*server, error)
NewServer constructs a new relay server using specified config with options.
Types ¶
type BackPressureListener ¶ added in v0.4.3
type ClusterConfig ¶
type ClusterConfig struct { Name string Endpoint string Announce string SecretKey string `yaml:"secret_key" json:"-"` Members []string }
ClusterConfig represents a cluster membership config.
type Config ¶
Config represents a client-side relay configuration.
Used as a basic building block for high-level configurations.
type Dialer ¶
Dialer is a thing that constructs a new TCP connection using remote Relay server. One or more Relay TCP addresses must be specified in "Addrs" field. Hostname resolution is performed for each of them for environments with dynamic DNS addition/removal. Thus, a single Relay endpoint as a hostname should fit the best.
type Listener ¶
type Listener struct { Addrs []string SignedAddr SignedETHAddr Log *zap.Logger }
Listener represents client-side TCP listener that will route traffic through Relay server. One or more Relay TCP addresses must be specified in "Addrs" field. Hostname resolution is performed for each of them for environments with dynamic DNS addition/removal.
func NewListener ¶
func (*Listener) Accept ¶
Accept accepts a new TCP connection that is relayed through the Relay server specified in the configuration.
This is done by establishing a TCP connection to a Relay server and waiting until a remote peer decides to communicate with us.
This method can be called multiple times, even concurrently to announce the server multiple times, which is useful for reducing the time window between the next announce after the remote peer appearing. However, this increases resource usage, such as fd, on both this server and the Relay. Use wisely.
type MonitorConfig ¶
type MonitorConfig struct { Endpoint string PrivateKey *ecdsa.PrivateKey `json:"-"` }
type Option ¶
type Option func(options *options) error
Option is a function that configures the server.
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.
type ServerConfig ¶
type ServerConfig struct { Addr netutil.TCPAddr Cluster ClusterConfig Logging logging.Config Monitor MonitorConfig Debug *debug.Config }
ServerConfig describes the complete relay server configuration.
func NewServerConfig ¶
func NewServerConfig(path string) (*ServerConfig, error)
NewServerConfig loads a new Relay server config from a file.
type SignedETHAddr ¶
type SignedETHAddr struct {
// contains filtered or unexported fields
}
SignedETHAddr represents self-signed ETH address.
func NewSignedAddr ¶
func NewSignedAddr(key *ecdsa.PrivateKey) (SignedETHAddr, error)
NewSignedAddr constructs a new self-signed Ethereum address using the specified private key.
func (*SignedETHAddr) Addr ¶
func (m *SignedETHAddr) Addr() common.Address