relay

package
v0.4.0-alpha2 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jun 4, 2018 License: Apache-2.0 Imports: 32 Imported by: 0

Documentation

Index

Constants

View Source
const (
	ErrInvalidHandshake int32 = iota
	ErrUnknownPeerType
	ErrTimeout
)

Variables

This section is empty.

Functions

func Dial

func Dial(addr net.Addr, targetAddr common.Address, uuid string) (net.Conn, error)

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 Listen

func Listen(addr net.Addr, publishAddr SignedETHAddr) (net.Conn, error)

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 NewServer

func NewServer(cfg ServerConfig, options ...Option) (*server, error)

NewServer constructs a new relay server using specified config with options.

Types

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

type Config struct {
	Endpoints []netutil.TCPAddr
}

Config represents a client-side relay configuration.

Used as a basic building block for high-level configurations.

type ConnID

type ConnID string

func (ConnID) String

func (m ConnID) String() string

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

func WithLogger(log *zap.Logger) Option

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
}

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.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL