Documentation ¶
Index ¶
- type Downstream
- func (d *Downstream) Contains(addr ma.Multiaddr) bool
- func (d *Downstream) ContainsPeer(id peer.ID) bool
- func (d *Downstream) Current() peer.ID
- func (d *Downstream) Next() peer.ID
- func (d *Downstream) PeerAddrs() []ma.Multiaddr
- func (d *Downstream) Peers() []peer.ID
- func (d *Downstream) String() string
- type IdResponse
- type Notifiee
- func (n *Notifiee) ClosedStream(net network.Network, s network.Stream)
- func (n *Notifiee) Connected(net network.Network, conn network.Conn)
- func (n *Notifiee) Disconnected(net network.Network, conn network.Conn)
- func (n *Notifiee) Listen(net network.Network, addr ma.Multiaddr)
- func (n *Notifiee) ListenClose(net network.Network, addr ma.Multiaddr)
- func (n *Notifiee) OpenedStream(net network.Network, s network.Stream)
- type PeerInfo
- type PeerManager
- func (pm *PeerManager) AddRefCid(ip net.IP, c cid.Cid)
- func (pm *PeerManager) AddUpstreamPeerIP(addr ma.Multiaddr) error
- func (pm *PeerManager) CidsForRefIp(ip net.IP) []cid.Cid
- func (pm *PeerManager) ConnectAllDown()
- func (pm *PeerManager) CurrentDownPeer() peer.ID
- func (pm *PeerManager) DeleteRefCid(ip net.IP, c cid.Cid)
- func (pm *PeerManager) DeleteUpstreamPeerIP(id peer.ID)
- func (pm *PeerManager) DownPeerInfo(id peer.ID) (PeerInfo, bool)
- func (pm *PeerManager) DownPeers() []ma.Multiaddr
- func (pm *PeerManager) DownstreamForPeer(upPeer peer.ID) []peer.ID
- func (pm *PeerManager) IpFromMultiaddr(addr ma.Multiaddr) (net.IP, error)
- func (pm *PeerManager) IsDownstream(id peer.ID) bool
- func (pm *PeerManager) RefsForCid(c cid.Cid) []net.IP
- func (pm *PeerManager) UpPeers() []peer.ID
- func (pm *PeerManager) UpstreamForPeer(id peer.ID) []peer.ID
- func (pm *PeerManager) UpstreamIPForPeer(id peer.ID) (net.IP, bool)
- func (pm *PeerManager) UpstreamPeersForIP(ip net.IP) []peer.ID
- type WantMap
- func (wm *WantMap) Add(p peer.ID, c cid.Cid)
- func (wm *WantMap) AllCids() []cid.Cid
- func (wm *WantMap) AllPeers() []peer.ID
- func (wm *WantMap) CidsForPeer(id peer.ID) []cid.Cid
- func (wm *WantMap) Clear()
- func (wm *WantMap) Delete(p peer.ID, c cid.Cid)
- func (wm *WantMap) DeleteCid(c cid.Cid)
- func (wm *WantMap) DeletePeer(p peer.ID)
- func (wm *WantMap) Merge(other *WantMap) *WantMap
- func (wm *WantMap) PeersForCid(c cid.Cid) []peer.ID
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Downstream ¶
type Downstream struct {
// contains filtered or unexported fields
}
Downstream holds the downstream peers that are behind the proxy
func (*Downstream) Contains ¶
func (d *Downstream) Contains(addr ma.Multiaddr) bool
Contains returns true if the given multiaddr is one of the downstream peers
func (*Downstream) ContainsPeer ¶
func (d *Downstream) ContainsPeer(id peer.ID) bool
ContainsPeer returns true if the given peer ID is one of the downstream peers
func (*Downstream) Current ¶
func (d *Downstream) Current() peer.ID
Current returns the current downstream peer in the list
func (*Downstream) Next ¶
func (d *Downstream) Next() peer.ID
Next gets the next peer to connect to. At the moment it does round-robin
func (*Downstream) PeerAddrs ¶
func (d *Downstream) PeerAddrs() []ma.Multiaddr
PeerAddrs returns a slice containing all the downstream peer bitswap multiaddrs
func (*Downstream) Peers ¶
func (d *Downstream) Peers() []peer.ID
Peers returns a slice containing all the downstream peer IDs
func (*Downstream) String ¶
func (d *Downstream) String() string
String gives a string representation of all the peers
type IdResponse ¶
type Notifiee ¶
type Notifiee struct {
// contains filtered or unexported fields
}
func (*Notifiee) ClosedStream ¶
func (*Notifiee) Disconnected ¶
func (*Notifiee) ListenClose ¶
type PeerInfo ¶
type PeerManager ¶
type PeerManager struct { UpWants *WantMap // Wants by upstream peers DownWants *WantMap // Wants by downstream peers (in response to /api/v0/refs from upstream) SentWants *WantMap // All wants that have been sent, and the peer that they were sent to // contains filtered or unexported fields }
func (*PeerManager) AddRefCid ¶
func (pm *PeerManager) AddRefCid(ip net.IP, c cid.Cid)
AddRef adds an IP <-> CID mapping
func (*PeerManager) AddUpstreamPeerIP ¶
func (pm *PeerManager) AddUpstreamPeerIP(addr ma.Multiaddr) error
AddUpstreamPeerIP adds a mapping between an upstream peer ID and its IP address
func (*PeerManager) CidsForRefIp ¶
func (pm *PeerManager) CidsForRefIp(ip net.IP) []cid.Cid
CidsForRefIp returns all the CIDs that have been requested by the IP via /api/v0/refs
func (*PeerManager) ConnectAllDown ¶
func (pm *PeerManager) ConnectAllDown()
ConnectAllDown connects to all downstream peers
func (*PeerManager) CurrentDownPeer ¶
func (pm *PeerManager) CurrentDownPeer() peer.ID
CurrentDownPeer returns the last-selected downstream peer
func (*PeerManager) DeleteRefCid ¶
func (pm *PeerManager) DeleteRefCid(ip net.IP, c cid.Cid)
DeleteRefCid removes an IP <-> CID mapping
func (*PeerManager) DeleteUpstreamPeerIP ¶
func (pm *PeerManager) DeleteUpstreamPeerIP(id peer.ID)
DeleteUpstreamPeerIP deletes one peerID <-> IP address association
func (*PeerManager) DownPeerInfo ¶
func (pm *PeerManager) DownPeerInfo(id peer.ID) (PeerInfo, bool)
DownPeerInfo returns the info of a downstream peer
func (*PeerManager) DownPeers ¶
func (pm *PeerManager) DownPeers() []ma.Multiaddr
DownPeers returns the multiaddrs of all downstream peers
func (*PeerManager) DownstreamForPeer ¶
func (pm *PeerManager) DownstreamForPeer(upPeer peer.ID) []peer.ID
DownstreamForPeer returns the downstream peer associated with an upstream peer. It returns a one-element array for symmetry with UpstreamForPeer.
func (*PeerManager) IpFromMultiaddr ¶
IpFromMultiaddr extracts the IP address from a multiaddr
func (*PeerManager) IsDownstream ¶
func (pm *PeerManager) IsDownstream(id peer.ID) bool
IsDownstream returns true if a peer is a downstream peer
func (*PeerManager) RefsForCid ¶
func (pm *PeerManager) RefsForCid(c cid.Cid) []net.IP
RefsForCid returns all the IPs that have requested the CID via /api/v0/refs
func (*PeerManager) UpPeers ¶
func (pm *PeerManager) UpPeers() []peer.ID
UpPeers returns the peer IDs of all connected upstream peers
func (*PeerManager) UpstreamForPeer ¶
func (pm *PeerManager) UpstreamForPeer(id peer.ID) []peer.ID
UpstreamForPeer returns all the upstream peers associated with a downstream peer
func (*PeerManager) UpstreamIPForPeer ¶
UpstreamIPForPeer returns the upstream IP associated with a given peer.
func (*PeerManager) UpstreamPeersForIP ¶
func (pm *PeerManager) UpstreamPeersForIP(ip net.IP) []peer.ID
UpstreamPeersForIP returns the upstream peers associated with a given IP. Note that there can be several in the case of peers behind a NAT.
type WantMap ¶
type WantMap struct {
// contains filtered or unexported fields
}
WantMap is a wrapper around a peerId <-> CID BiMultiMap
func NewWantMap ¶
func NewWantMap() *WantMap