Documentation ¶
Index ¶
- Constants
- func DisableLog()
- func GetHostIp() (net.IP, error)
- func SetLogLevelDebug()
- func SetLogLevelInfo()
- type KadID
- type Kademlia
- func (kad *Kademlia) Bootstrap(entryNodeAddr string, entryNodePort int) error
- func (kad *Kademlia) FindValue(key string)
- func (kad *Kademlia) GetRoutingTable() [KadIdLen]list.List
- func (kad *Kademlia) Leave()
- func (kad *Kademlia) SendFindNodeQuery(ip net.IP, port int, target KadID) error
- func (kad *Kademlia) SetFindValueCallback(fn func(string, []byte))
- func (kad *Kademlia) Store(key string, value []byte)
- type Node
Constants ¶
View Source
const BucketSize = 20
View Source
const KadIdLen = 160 // bits
View Source
const KadIdLenByte = KadIdLen / 8 // bytes
Variables ¶
This section is empty.
Functions ¶
func DisableLog ¶
func DisableLog()
func SetLogLevelDebug ¶
func SetLogLevelDebug()
func SetLogLevelInfo ¶
func SetLogLevelInfo()
Types ¶
type KadID ¶
type KadID [KadIdLenByte]byte
func GenerateRandomKadId ¶
func GenerateRandomKadId() KadID
type Kademlia ¶
type Kademlia struct {
// contains filtered or unexported fields
}
func NewKademlia ¶
func (*Kademlia) GetRoutingTable ¶
For debug purpose
func (*Kademlia) SendFindNodeQuery ¶
func (*Kademlia) SetFindValueCallback ¶
Source Files ¶
Click to show internal directories.
Click to hide internal directories.