Documentation ¶
Index ¶
- Constants
- func AreEqualContacts(a *Contact, b *Contact) bool
- type Contact
- type FindNodeArgs
- type FindNodeReply
- type FindValueArgs
- type FindValueReply
- type KBucket
- type KV
- type KVStore
- type Node
- func (node *Node) FindNode(args FindNodeArgs, reply *FindNodeReply) error
- func (node *Node) FindValue(args FindValueArgs, reply *FindValueReply) error
- func (node *Node) GetKBucketFromAddr(destAddr net.TCPAddr) int
- func (node *Node) GetKBucketFromID(destID *big.Int) int
- func (node *Node) Ping(args PingArgs, reply *PingReply) error
- func (node *Node) Run(toPing string)
- func (node *Node) Store(args StoreArgs, reply *StoreReply) error
- func (node *Node) String() string
- type NodeRPC
- func (fakeNode *NodeRPC) FindNode(args FindNodeArgs, reply *FindNodeReply) error
- func (fakeNode *NodeRPC) FindValue(args FindValueArgs, reply *FindValueReply) error
- func (fakeNode *NodeRPC) Ping(args PingArgs, reply *PingReply) error
- func (fakeNode *NodeRPC) Store(args StoreArgs, reply *StoreReply) error
- type PingArgs
- type PingReply
- type RoutingTable
- type StoreArgs
- type StoreReply
Constants ¶
const Bootstrap_node_path = "/home/pdelong/go/src/github.com/peterdelong/kademlia/cmd/kademlia_node/bootstrap_nodes"
Variables ¶
This section is empty.
Functions ¶
func AreEqualContacts ¶
AreEqualContacts returns true if contact Id and Addr are equivalent structs can be compared, but structs containing big.Int cannot
Types ¶
type Contact ¶
Contact is an entry in the k-bucket
func NewContact ¶
NewContact creates a new Contact struct based on addr by taking the hash
type FindNodeArgs ¶
FindNodeArgs contains the arguments for the FINDNODE RPC
type FindNodeReply ¶
type FindNodeReply struct {
Contacts []Contact
}
FindNodeReply contains the results for the FINDNODE RPC
type FindValueArgs ¶
FindValueArgs contains the arguments for the FINDVALUE RPC
type FindValueReply ¶
FindValueReply contains the results for the FINDVALUE RPC
type KV ¶
type KV struct {
// contains filtered or unexported fields
}
KV contains all the information we have for a key
type KVStore ¶
type KVStore struct {
// contains filtered or unexported fields
}
KVStore holds mappings from keys to values and keeps track if a given node is the owner of the value
type Node ¶
type Node struct {
// contains filtered or unexported fields
}
Node is an individual Kademlia node
func (*Node) FindNode ¶
func (node *Node) FindNode(args FindNodeArgs, reply *FindNodeReply) error
FindNode is the handler for the FINDNODE RPC
func (*Node) FindValue ¶
func (node *Node) FindValue(args FindValueArgs, reply *FindValueReply) error
FindValue is the handler for the FINDVALUE RPC
func (*Node) GetKBucketFromAddr ¶
GetKBucketFromAddr returns the KBucket that would contain destAddr
func (*Node) GetKBucketFromID ¶
GetKBucketFromID returns the KBucket that would contain destID
type NodeRPC ¶
type NodeRPC struct {
// contains filtered or unexported fields
}
NodeRPC is a wrapper struct that is used to control which RPCs are exposed
func (*NodeRPC) FindNode ¶
func (fakeNode *NodeRPC) FindNode(args FindNodeArgs, reply *FindNodeReply) error
FindNode is a stub function that exposes the FINDNODE RPC
func (*NodeRPC) FindValue ¶
func (fakeNode *NodeRPC) FindValue(args FindValueArgs, reply *FindValueReply) error
FindValue is a stub function that exposes the FINDVALUE RPC
type RoutingTable ¶
type RoutingTable struct {
// contains filtered or unexported fields
}
extra struct because we will want to implement split bucket
func NewRoutingTable ¶
func NewRoutingTable(owner *Node) *RoutingTable
func (*RoutingTable) ContactFromID ¶
func (table *RoutingTable) ContactFromID(id big.Int) *Contact
ContactFromID returns the contact that belongs to id if it exists and nil if it doesn't