Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Peer ¶
Peer represents a remote node in the network its an interface the may be backed by any concrete transport.
type Server ¶
type Server struct {
// Configuration of the server.
ServerConfig
// contains filtered or unexported fields
}
Server represents a remote node in the p2p network.
func NewServer ¶
func NewServer(cfg ServerConfig, engine consensus.Engine) *Server
NewServer returns a new Server object.
type ServerConfig ¶
type ServerConfig struct {
// The listen address of the server.
ListenAddr int
// A list of seed nodes to bootstrap the initial network.
BootstrapNodes []string
// The number of seconds it may take for dialing outbound connections.
// Note that you need to pass N * time.Second to get the time.Duration
// in seconds.
DialTimeout time.Duration
// When set to true this node will act as a faulty node in the network.
Faulty bool
// Whether this node will act as a consensus node (block producer).
Consensus bool
// PrivateKey of the server. This can be left empty if consensus is set
// to false.
PrivateKey *ecdsa.PrivateKey
}
ServerConfig holds the server configuration.
type TCPPeer ¶
type TCPPeer struct {
// contains filtered or unexported fields
}
TCPPeer represents a remote node backed by TCP transport.
func (*TCPPeer) Disconnect ¶
Disconnect implements the Peer interface.
type TCPTransport ¶
type TCPTransport struct {
// contains filtered or unexported fields
}
TCPTransport represents network transportation backed by plain TCP.
func NewTCPTransport ¶
func NewTCPTransport(s *Server) *TCPTransport
NewTCPTransport return a new TCPTransport.
func (*TCPTransport) Close ¶
func (t *TCPTransport) Close()
Close implements the Transport interface.
func (*TCPTransport) Dial ¶
func (t *TCPTransport) Dial(addr string, d time.Duration) error
Dial implements the Transport interface.
func (*TCPTransport) Listen ¶
func (t *TCPTransport) Listen(addr string) error
Listen implements the Transport inteface.
Click to show internal directories.
Click to hide internal directories.