Versions in this module Expand all Collapse all v0 v0.2.6 May 19, 2021 v0.2.5 May 13, 2021 Changes in this version type DHT + func (dht *DHT) SetDhiId(id uint8) v0.2.4 May 13, 2021 Changes in this version + func GetBuff() []byte + func PutBuff(buff interface{}) type Request + DhtId uint8 v0.2.3 May 12, 2021 v0.2.2 May 12, 2021 v0.2.1 May 12, 2021 Changes in this version + const BLOCK + const CrawlMode + const DATA + const EXTENDED + const HANDSHAKE + const MaxMetadataSize + const REJECT + const REQUEST + const StandardMode + var ErrNotReady = errors.New("dht is not ready") + var ErrOnGetPeersResponseNotSet = errors.New("OnGetPeersResponse is not set") + func Decode(data []byte) (result interface{}, err error) + func DecodeDict(data []byte, start int) (result interface{}, index int, err error) + func DecodeInt(data []byte, start int) (result interface{}, index int, err error) + func DecodeList(data []byte, start int) (result interface{}, index int, err error) + func DecodeString(data []byte, start int) (result interface{}, index int, err error) + func Encode(data interface{}) string + func EncodeDict(data map[string]interface{}) string + func EncodeInt(data int) string + func EncodeList(data []interface{}) string + func EncodeString(data string) string + func ParseKey(data map[string]interface{}, key string, t string) error + func ParseKeys(data map[string]interface{}, pairs [][]string) error + type Config struct + Address string + BlackListMaxSize int + BlockedIPs []string + CheckKBucketPeriod time.Duration + K int + KBucketExpiredAfter time.Duration + KBucketSize int + MaxNodes int + MaxTransactionCursor uint64 + Mode int + Network string + NodeExpriedAfter time.Duration + OnAnnouncePeer func(string, string, int) + OnGetPeers func(string, string, int) + OnGetPeersResponse func(string, *Peer) + PacketJobLimit int + PacketWorkerLimit int + PrimeNodes []string + RefreshNodeNum int + TokenExpiredAfter time.Duration + Try int + func NewCrawlConfig() *Config + func NewStandardConfig() *Config + type DHT struct + Ready bool + func New(config *Config) *DHT + func (dht *DHT) BlackList() *map[interface{}]interface{} + func (dht *DHT) GetPeers(infoHash string) error + func (dht *DHT) IsCrawlMode() bool + func (dht *DHT) IsStandardMode() bool + func (dht *DHT) Run() + type Peer struct + IP net.IP + Port int + func (p *Peer) CompactIPPortInfo() string + type Request struct + IP string + InfoHash []byte + Port int + type Response struct + MetadataInfo []byte + type Status struct + BlackList *blackList + Queue *syncedMap + Requests int + Responses int + Tokens int + type Wire struct + func NewWire(blackListSize, requestQueueSize, workerQueueSize int) *Wire + func (w *Wire) Status() *Status + func (wire *Wire) Request(infoHash []byte, ip string, port int) + func (wire *Wire) Response() <-chan Response + func (wire *Wire) Run()