Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Option ¶ added in v0.2.0
func WithDeclaredAddr ¶ added in v0.2.0
func WithGenesis ¶ added in v0.2.0
func WithLevelDBPath ¶ added in v0.2.0
func WithRestAddr ¶ added in v0.2.0
type Peer ¶ added in v0.2.0
type Peer struct {
// contains filtered or unexported fields
}
Peer manages all the connection logic with a single peer
It may be used in a two ways: as a client connection and as a server connection
When using as a client connection it should be created with a remote peer addr specified. In that case it will attempt to dial this addr and then continue processing with a dialed connection
When using as a server connection, it is created with an existing *p2p.Conn that was previously accepted on a listening server
type PeerOption ¶ added in v0.2.0
PeerOption is a creating option for creating Peer
func WithAddr ¶ added in v0.2.0
func WithAddr(addr string) PeerOption
WithAddr configures peer to have an addr
func WithConn ¶ added in v0.2.0
func WithConn(conn net.Conn) PeerOption
WithConn configures peer with an existing connection
func WithDeclAddr ¶ added in v0.2.0
func WithDeclAddr(addr string) PeerOption
func WithPeersChan ¶ added in v0.2.0
func WithPeersChan(c chan proto.PeerInfo) PeerOption
WithPeersChan configures peer with a channel to send peer infos to