Documentation
¶
Index ¶
- Constants
- type Candidates
- type RPCFindNode
- type RPCFindNodeResponse
- type RPCFindValue
- type RPCFindValueResponse
- type RPCHeader
- type RPCPing
- type RPCPingResponse
- type RPCStore
- type T
- func (t *T) Cat(id kademliaid.T) []byte
- func (nw *T) FindNode(c *contact.T, findID *kademliaid.T) ([]contact.T, error)
- func (nw *T) FindValue(c *contact.T, findID *kademliaid.T) (kvstore.Value, []contact.T, bool, error)
- func (t *T) Join(address string) error
- func (t *T) KademliaStore(data []byte) kademliaid.T
- func (nw *T) Listen(address string)
- func (t *T) LookupContact(target *kademliaid.T) []contact.T
- func (t *T) LookupData(target *kademliaid.T) (kvstore.Value, error)
- func (t *T) Pin(id kademliaid.T)
- func (nw *T) Ping(c *contact.T) error
- func (nw *T) Store(c *contact.T, val *kvstore.Value) error
- func (t *T) Unpin(id kademliaid.T)
Constants ¶
View Source
const ( PING = 0 PING_RESPONSE = 1 FIND_NODE = 2 FIND_NODE_RESPONSE = 3 FIND_VALUE = 4 FIND_VALUE_RESPONSE = 5 STORE = 6 )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Candidates ¶
type Candidates struct {
// contains filtered or unexported fields
}
func (*Candidates) CalcDistances ¶
func (candidates *Candidates) CalcDistances(target *kademliaid.T)
type RPCFindNode ¶
type RPCFindNode struct {
RPCType int
Sender contact.T
FindID kademliaid.T
}
type RPCFindNodeResponse ¶
type RPCFindValue ¶
type RPCFindValue struct {
RPCType int
Sender contact.T
FindID kademliaid.T
}
type RPCFindValueResponse ¶
type RPCPingResponse ¶
type T ¶
type T struct {
// contains filtered or unexported fields
}
func (*T) FindValue ¶
func (nw *T) FindValue(c *contact.T, findID *kademliaid.T) (kvstore.Value, []contact.T, bool, error)
FindValue returns the value if it was found or some []contacts if it wasn't. The third return value is a bool that is true if the value was found.
func (*T) Join ¶
A kademlia node t can join the network as long as they know the address of a node already on the network This method connects t to the rest of the network
func (*T) KademliaStore ¶
func (t *T) KademliaStore(data []byte) kademliaid.T
func (*T) LookupContact ¶
func (t *T) LookupContact(target *kademliaid.T) []contact.T
func (*T) LookupData ¶
func (*T) Pin ¶
func (t *T) Pin(id kademliaid.T)
Updates the timestamp and sets the Pin field to true
func (*T) Unpin ¶
func (t *T) Unpin(id kademliaid.T)
Similar to Pin with the exception that the Pin field is set to false
Click to show internal directories.
Click to hide internal directories.