Documentation ¶
Index ¶
- Constants
- func FilecoinDHT(network string) protocol.ID
- func NewGossipSub(ctx context.Context, h host.Host, sk *ScoreKeeper, networkName string, ...) (*pubsub.PubSub, error)
- func ParseAddresses(ctx context.Context, addrs []string) ([]peer.AddrInfo, error)
- type Network
- func (network *Network) AgentVersion(ctx context.Context, p peer.ID) (string, error)
- func (network *Network) AutoNatStatus() (types.NatInfo, error)
- func (network *Network) Connect(ctx context.Context, p peer.AddrInfo) error
- func (network *Network) Connectedness(p peer.ID) (network2.Connectedness, error)
- func (network *Network) Disconnect(p peer.ID) error
- func (network *Network) GetBandwidthStats() metrics.Stats
- func (network *Network) GetBandwidthStatsByPeer() (map[string]metrics.Stats, error)
- func (network *Network) GetBandwidthStatsByProtocol() (map[protocol.ID]metrics.Stats, error)
- func (network *Network) GetPeerAddresses() []ma.Multiaddr
- func (network *Network) GetPeerID() peer.ID
- func (network *Network) PeerInfo(ctx context.Context, p peer.ID) (*types.ExtendedPeerInfo, error)
- func (network *Network) Peers(ctx context.Context) ([]peer.AddrInfo, error)
- func (network *Network) ProtectAdd(peers []peer.ID) error
- func (network *Network) ProtectList() ([]peer.ID, error)
- func (network *Network) ProtectRemove(peers []peer.ID) error
- type Router
- type ScoreKeeper
Constants ¶
const ( GossipScoreThreshold = -500 PublishScoreThreshold = -1000 GraylistScoreThreshold = -2500 AcceptPXScoreThreshold = 1000 OpportunisticGraftScoreThreshold = 3.5 )
Variables ¶
This section is empty.
Functions ¶
func FilecoinDHT ¶
FilecoinDHT is creates a protocol for the filecoin DHT.
func NewGossipSub ¶ added in v1.8.0
Types ¶
type Network ¶
Network is a unified interface for dealing with libp2p
func New ¶
func New( host host.Host, rawHost types.RawHost, router *Router, reporter metrics.Reporter, ) *Network
New returns a new Network
func (*Network) AgentVersion ¶ added in v1.6.1
AgentVersion returns agent version for a given peer id
func (*Network) AutoNatStatus ¶ added in v1.6.1
AutoNatStatus return a struct with current NAT status and public dial address
func (*Network) Connectedness ¶ added in v1.6.1
Connectedness returns a state signaling connection capabilities
func (*Network) Disconnect ¶ added in v1.6.1
Disconnect disconnect to peer at the given address
func (*Network) GetBandwidthStats ¶
GetBandwidthStats gets stats on the current bandwidth usage of the network
func (*Network) GetBandwidthStatsByPeer ¶ added in v1.6.1
GetBandwidthStatsByPeer returns statistics about the nodes bandwidth usage and current rate per peer
func (*Network) GetBandwidthStatsByProtocol ¶ added in v1.6.1
GetBandwidthStatsByProtocol returns statistics about the nodes bandwidth usage and current rate per protocol
func (*Network) GetPeerAddresses ¶
GetPeerAddresses gets the current addresses of the node
func (*Network) ProtectAdd ¶ added in v1.6.1
ProtectAdd protect peer at the given peers id
func (*Network) ProtectList ¶ added in v1.6.1
ProtectList returns the peers that are protected
type Router ¶
type Router struct {
// contains filtered or unexported fields
}
Router exposes the methods on the internal filecoin router that are needed by the system plumbing API.
type ScoreKeeper ¶ added in v1.8.0
type ScoreKeeper struct {
// contains filtered or unexported fields
}
func NewScoreKeeper ¶ added in v1.8.0
func NewScoreKeeper() *ScoreKeeper
func (*ScoreKeeper) Get ¶ added in v1.8.0
func (sk *ScoreKeeper) Get() map[peer.ID]*pubsub.PeerScoreSnapshot
func (*ScoreKeeper) Update ¶ added in v1.8.0
func (sk *ScoreKeeper) Update(scores map[peer.ID]*pubsub.PeerScoreSnapshot)