Documentation
¶
Index ¶
- func Dinstance(node1, node2 *Node) (*big.Int, error)
- func GenerateAddressFromNode(node *Node) (net.Addr, error)
- func ReadIntoStream(conn io.Reader) ([]byte, error)
- type Codec
- type CodecImp
- type LocalNode
- func (node *LocalNode) FindNode(cid [20]byte) ([]Node, error)
- func (node *LocalNode) FindValue(cid [20]byte) ([]byte, error)
- func (node *LocalNode) GenerateRpcReply(stream []byte) (*message, error)
- func (node *LocalNode) GenerateRpcRequest(RpcType int) (*message, error)
- func (node *LocalNode) Ping(n *Node) (bool, error)
- func (node *LocalNode) Send(msg *message, connection net.PacketConn) error
- func (node *LocalNode) Server(ErrChan chan error)
- func (node *LocalNode) Store(cid [20]byte, value []byte) error
- type Node
- type RoutingTable
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Codec ¶
type CodecImp ¶
type CodecImp struct{} //Possibly add some state later
func (*CodecImp) Deserialize ¶
type LocalNode ¶
type LocalNode struct {
*Node
*RoutingTable
Codec
RpcChan chan *message
// contains filtered or unexported fields
}
This is the representation of the local node on the network
func NewLocalNode ¶
func (*LocalNode) GenerateRpcReply ¶
func (*LocalNode) GenerateRpcRequest ¶
type RoutingTable ¶
type RoutingTable struct {
// contains filtered or unexported fields
}
func NewRoutingTable ¶
func NewRoutingTable(localnode *LocalNode) (*RoutingTable, error)
Creates a new routing table
func (*RoutingTable) Dinstance ¶
func (r *RoutingTable) Dinstance(node *Node) (*big.Int, error)
Returns the dinstance between the input node and the node that owns the routing table
func (*RoutingTable) InsertNode ¶
func (r *RoutingTable) InsertNode(node *Node) (int, error)
Inserts a node to the routing table according to kademlia specifications
Click to show internal directories.
Click to hide internal directories.