Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func IsKnownMsgType ¶
Types ¶
type DHTMessage ¶
type DHTMessage struct {
Type MessageType
ClusterLevel int32
Key string
Record *DHTRecord
CloserPeers []peer.AddrInfo
ProviderPeers []peer.AddrInfo
// contains filtered or unexported fields
}
DHTMessage is what peers use to communicate This is a human-readable wrapper around dht.pb.Message
func NewDHTMsg ¶
func NewDHTMsg(raw []byte) (*DHTMessage, error)
Converts a raw byte message to a DHTMessage
func (*DHTMessage) Marshal ¶
func (msg *DHTMessage) Marshal() ([]byte, error)
type IDMap ¶
type IDMap struct {
// contains filtered or unexported fields
}
type MessageType ¶
type MessageType int32
const ( PUT_VALUE MessageType = iota GET_VALUE ADD_PROVIDER GET_PROVIDERS FIND_NODE PING )
type Peer ¶
type Peer struct {
*events.Emitter
ID peer.ID
Addrs []ma.Multiaddr
// contains filtered or unexported fields
}
Peer represents a connection with a peer
func (*Peer) Disconnect ¶
func (p *Peer) Disconnect()
type PeerList ¶
func NewPeerList ¶
func (*PeerList) Add ¶
Add adds the peer to the list, doing nothing if the peer is already in the list.
Returns true if the peer was successfully added
func (*PeerList) ForEach ¶
ForEach iterates over all peers, calling the callback for each peer. If the callback returns true, the peer will be removed after iteration. ForEach returns the number of peers removed
NOTE: This method may hold pl.mu.Lock for a long time
Click to show internal directories.
Click to hide internal directories.