Documentation ¶
Index ¶
- Constants
- type Contact
- type ContactList
- type Contacts
- type FindNodeRequest
- type FindNodeResponse
- type FindValueRequest
- type FindValueResponse
- type KBucket
- type Kademlia
- func (k *Kademlia) Bootstrap(target, self Contact) ([]Contact, error)
- func (k *Kademlia) FindNode(contact Contact, target NodeID, done chan Contacts)
- func (k *Kademlia) FindValue(contact Contact, target NodeID) ([]Contact, string, error)
- func (k *Kademlia) HandleRPC(request RPCHeader, response *RPCHeader) error
- func (k *Kademlia) IterativeFindNode(target NodeID, delta int, final chan Contacts)
- func (k *Kademlia) NewFindNodeRequest(target NodeID) FindNodeRequest
- func (k *Kademlia) NewFindValueRequest(target NodeID) FindValueRequest
- func (k *Kademlia) NewPingRequest() PingRequest
- func (k *Kademlia) Ping(target Contact) error
- func (k *Kademlia) Serve() error
- type KademliaCore
- type NodeID
- type PingRequest
- type PingResponse
- type RPCHeader
- type RoutingTable
Constants ¶
View Source
const ( Delta = 3 IDLength = 20 IDBytesLength = 8 * IDLength BucketSize = 20 )
View Source
const (
VALUES_DB_PATH = "db/values-"
)
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Contact ¶
func NewContact ¶
type ContactList ¶
type FindNodeRequest ¶
type FindNodeResponse ¶
type FindValueRequest ¶
type FindValueResponse ¶
type KBucket ¶
func NewKBucket ¶
func NewKBucket() *KBucket
type Kademlia ¶
type Kademlia struct { NetworkID string // contains filtered or unexported fields }
func NewKademlia ¶
func (*Kademlia) IterativeFindNode ¶
func (*Kademlia) NewFindNodeRequest ¶
func (k *Kademlia) NewFindNodeRequest(target NodeID) FindNodeRequest
func (*Kademlia) NewFindValueRequest ¶
func (k *Kademlia) NewFindValueRequest(target NodeID) FindValueRequest
func (*Kademlia) NewPingRequest ¶
func (k *Kademlia) NewPingRequest() PingRequest
type KademliaCore ¶
type KademliaCore struct {
// contains filtered or unexported fields
}
func (*KademliaCore) FindNodeRPC ¶
func (kc *KademliaCore) FindNodeRPC(req FindNodeRequest, res *FindNodeResponse) error
func (*KademliaCore) FindValueRPC ¶
func (kc *KademliaCore) FindValueRPC(req FindValueRequest, res *FindValueResponse) error
func (*KademliaCore) PingRPC ¶
func (kc *KademliaCore) PingRPC(req PingRequest, res *PingResponse) error
type NodeID ¶
func NewRandomNodeID ¶
func NewRandomNodeID() (ret NodeID)
type PingRequest ¶
type PingRequest struct {
RPCHeader
}
type PingResponse ¶
type PingResponse struct {
RPCHeader
}
type RoutingTable ¶
type RoutingTable struct {
// contains filtered or unexported fields
}
func NewRoutingTable ¶
func NewRoutingTable(self Contact) *RoutingTable
func (*RoutingTable) FindClosest ¶
func (rt *RoutingTable) FindClosest(target NodeID, delta int) Contacts
func (RoutingTable) Self ¶
func (rt RoutingTable) Self() Contact
func (*RoutingTable) Update ¶
func (rt *RoutingTable) Update(contact Contact)
Source Files ¶
Click to show internal directories.
Click to hide internal directories.