Documentation ¶
Index ¶
- func Identity(sk crypto.PrivKey) (libp2p.Option, error)
- func ListenAddress(addr string) (libp2p.Option, error)
- func RandomIdentity() libp2p.Option
- func XORDistance(a, b peer.ID) big.Int
- type BoostrappingRoutine
- func (br *BoostrappingRoutine) AddConnections() error
- func (br *BoostrappingRoutine) Permissionize()
- func (br *BoostrappingRoutine) PruneConnections() error
- func (br *BoostrappingRoutine) RunBootstrap() (err error)
- func (br *BoostrappingRoutine) SetNewWhiteList(newPeers [][]byte) error
- func (br *BoostrappingRoutine) Start() error
- func (br *BoostrappingRoutine) TrimUnlistedPeers()
- type Server
- type Topic
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type BoostrappingRoutine ¶
type BoostrappingRoutine struct { Host host.Host Wlp bnetwork.WhiteListProvider // contains filtered or unexported fields }
BoostrappingRoutine embedded all the bootstrapping logic
func NewBoostrappingRoutine ¶
func NewBoostrappingRoutine( ctx context.Context, host host.Host, Wlp bnetwork.WhiteListProvider, minConns int, maxConns int, bootstrappingPeriod time.Duration, ) *BoostrappingRoutine
NewBoostrappingRoutine construct a new BootstrappingRoutine object
func (*BoostrappingRoutine) AddConnections ¶
func (br *BoostrappingRoutine) AddConnections() error
AddConnections add peers until the target is reached
func (*BoostrappingRoutine) Permissionize ¶
func (br *BoostrappingRoutine) Permissionize()
Permissionize blocks remote connexions from unauthorized peers
func (*BoostrappingRoutine) PruneConnections ¶
func (br *BoostrappingRoutine) PruneConnections() error
PruneConnections remove peers until the target is reached
func (*BoostrappingRoutine) RunBootstrap ¶
func (br *BoostrappingRoutine) RunBootstrap() (err error)
RunBootstrap will adjust the number of connected peers
func (*BoostrappingRoutine) SetNewWhiteList ¶
func (br *BoostrappingRoutine) SetNewWhiteList(newPeers [][]byte) error
SetNewWhiteList replace the old whitelist with the new one
func (*BoostrappingRoutine) Start ¶
func (br *BoostrappingRoutine) Start() error
Start the bootsrapping routine
func (*BoostrappingRoutine) TrimUnlistedPeers ¶
func (br *BoostrappingRoutine) TrimUnlistedPeers()
TrimUnlistedPeers remove peers that are not listed anymore
type Server ¶
type Server struct { Host host.Host PubSub *pubsub.PubSub Bootstrap *BoostrappingRoutine }
Server ...
func DefaultServer ¶
func DefaultServer(addr string, wlp network.WhiteListProvider) (*Server, error)
DefaultServer ...
func NewServerWithID ¶
func NewServerWithID(wlp network.WhiteListProvider, priv *identity.PrivKey, addr string) (*Server, error)
NewServerWithID returns a server object with
func (*Server) GetPeerInfo ¶
GetPeerInfo returns the marshalled peer info of the server
Click to show internal directories.
Click to hide internal directories.