btlet

package module
v0.0.0-...-38ae272 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Mar 16, 2023 License: MIT Imports: 8 Imported by: 0

README

btlet

通过实现BT协议族中的部分协议来完成一些toolkit

Install

$ go get -v github.com/alxcer/btlet

Dependences

Modules

DHT-Spider

示例代码

运行截图

License

MIT, read more here.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Pipeline

type Pipeline interface {
	Has(string) bool
	DisposeMeta(string, bt.RawMeta)
}

Pipeline is used for handle meta

type PipelineX

type PipelineX interface {
	Pipeline
	DisposeMetaAndTracker(string, bt.RawMeta, []string)
	PullTrackerList(string) ([]string, bool)
	AppendTracker(string, []string)
}

PipelineX used for spider.RunAndFetchTracker

type Spider

type Spider struct {
	// contains filtered or unexported fields
}

Spider can crawl Meta from dht.

func NewSpider

func NewSpider() *Spider

NewSpider returns a Sniffer

func (*Spider) LimitSybilCrawler

func (spi *Spider) LimitSybilCrawler(limit int)

LimitSybilCrawler will use a dht.SybilCrawler

func (*Spider) Run

func (spi *Spider) Run(ctx context.Context, pipeline Pipeline) error

Run starts sniff meta

func (*Spider) RunAndFetchTracker

func (spi *Spider) RunAndFetchTracker(ctx context.Context, pipeline PipelineX) error

RunAndFetchTracker run and fetch tracker use tex protocal

func (*Spider) Stimulate

func (spi *Spider) Stimulate() bool

Stimulate will Stimulate the spider when Crawler is Stimulater and returns true. else do nothing and returns false.

func (*Spider) Use

func (spi *Spider) Use(crawler dht.Crawler)

Use set which crawler will use.

func (*Spider) UseSybilCrawler

func (spi *Spider) UseSybilCrawler()

UseSybilCrawler will use dht.SybilCrawler

Directories

Path Synopsis
example

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL