Documentation ¶
Index ¶
- type Nodes
- type Options
- type Server
- func (s *Server) AddStatic(node *discover.Node)
- func (s *Server) KnownNodes() Nodes
- func (s *Server) NodeInfo() *p2p.NodeInfo
- func (s *Server) RemoveStatic(node *discover.Node)
- func (s *Server) Self() *discover.Node
- func (s *Server) Start(protocols []*p2p.Protocol, topic discv5.Topic) error
- func (s *Server) Stop()
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Options ¶
type Options struct { // Name sets the node name of this server. // Use common.MakeName to create a name that follows existing conventions. Name string // This field must be set to a valid secp256k1 private key. PrivateKey *ecdsa.PrivateKey // MaxPeers is the maximum number of peers that can be // connected. It must be greater than zero. MaxPeers int // NoDiscovery can be used to disable the peer discovery mechanism. // Disabling is useful for protocol debugging (manual topology). NoDiscovery bool // If ListenAddr is set to a non-nil address, the server // will listen for incoming connections. // // If the port is zero, the operating system will pick a port. The // ListenAddr field will be updated with the actual address when // the server is started. ListenAddr string KnownNodes Nodes // BootstrapNodes are used to establish connectivity // with the rest of the network using the V5 discovery // protocol. BootstrapNodes Nodes // RemoteBootstrap is the url of remote dynamic bootstrap list. RemoteBootstrap string // Connectivity can be restricted to certain IP networks. // If this option is set to a non-nil value, only hosts which match one of the // IP networks contained in the list are considered. NetRestrict *netutil.Netlist // If set to a non-nil value, the given NAT port mapper // is used to make the listening port available to the // Internet. NAT nat.Interface // If NoDial is true, the server will not dial any peers. NoDial bool }
Options options for creating p2p server. Partially copied from ethereum p2p.Config.
type Server ¶
type Server struct {
// contains filtered or unexported fields
}
Server p2p server wraps ethereum's p2p.Server, and handles discovery v5 stuff.
func (*Server) AddStatic ¶
AddStatic connects to the given node and maintains the connection until the server is shut down. If the connection fails for any reason, the server will attempt to reconnect the peer.
func (*Server) KnownNodes ¶
KnownNodes returns known nodes that can be saved for fast connecting next time.
func (*Server) NodeInfo ¶
NodeInfo gathers and returns a collection of metadata known about the host.
func (*Server) RemoveStatic ¶
RemoveStatic disconnects from the given node
Click to show internal directories.
Click to hide internal directories.