Documentation ¶
Index ¶
- Constants
- Variables
- func ConvertByteStream(nodes []*KNode) []byte
- func Monitor()
- func Neightor(id, tableID string) string
- type AnnounceData
- type DhtNode
- type ID
- type KNode
- type KRPC
- func (krpc *KRPC) Decode(data []byte, val map[string]interface{}, raddr *net.UDPAddr) error
- func (krpc *KRPC) EncodingNodeResult(tid string, token string, nodes []byte) ([]byte, error)
- func (krpc *KRPC) EncodingNormalResult(tid string, id string) ([]byte, error)
- func (krpc *KRPC) GenTID() uint32
- func (krpc *KRPC) Query(msg *KRPCMessage)
- func (krpc *KRPC) Response(msg *KRPCMessage)
- type KRPCMessage
- type KTable
- type Network
- type Query
- type Response
Constants ¶
View Source
const ( TableSize = 1024 HasFoundSize = 100000 )
define const
Variables ¶
View Source
var BOOTSTRAP = []string{
"router.bittorrent.com:6881",
"router.utorrent.com:6881",
"dht.transmissionbt.com:6881",
}
BOOTSTRAP define
View Source
var RateLimit int64 = 100
RateLimit limit speed
Functions ¶
func ConvertByteStream ¶
ConvertByteStream convert node to bytes
Types ¶
type AnnounceData ¶
AnnounceData define data to storage
type DhtNode ¶
type DhtNode struct {
// contains filtered or unexported fields
}
DhtNode define
func NewDhtNode ¶
func NewDhtNode(id *ID, outHashIDChan chan AnnounceData, address string) *DhtNode
NewDhtNode create node
type KRPC ¶
KRPC define
func (*KRPC) EncodingNodeResult ¶
EncodingNodeResult message
func (*KRPC) EncodingNormalResult ¶
EncodingNormalResult ping
type KRPCMessage ¶
KRPCMessage define
type KTable ¶
type KTable struct { Nodes []*KNode //用于响应find_node请求 Snodes []*KNode // contains filtered or unexported fields }
KTable define table
Click to show internal directories.
Click to hide internal directories.