scraperService

package
v0.0.0-...-5607d3c Latest Latest
Warning

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

Go to latest
Published: May 13, 2017 License: MIT Imports: 12 Imported by: 0

Documentation

Index

Constants

View Source
const InitialConnectionID = 0x41727101980
View Source
const MTU = 1500

MTU yes this is the ipv6 mtu

View Source
const ScrapesPerPacket = 74

max number of scrapes per packet

View Source
const TransactionTimeout = time.Second * 30

TransactionTimeout 30 second timeout for transactions

Variables

View Source
var ErrShortPacket = errors.New("short udp packet")

Functions

This section is empty.

Types

type Bucket

type Bucket struct {
	Addr net.Addr
	// contains filtered or unexported fields
}

func NewBucket

func NewBucket(a net.Addr) *Bucket

func (*Bucket) ForEachTransaction

func (b *Bucket) ForEachTransaction(v func(uint32, *Transaction))

func (*Bucket) Forget

func (b *Bucket) Forget(tid uint32)

func (*Bucket) NewTransaction

func (b *Bucket) NewTransaction(swarms []model.Torrent) (t *Transaction)

func (*Bucket) VisitTransaction

func (b *Bucket) VisitTransaction(tid uint32, v func(*Transaction))

type RecvEvent

type RecvEvent struct {
	From net.Addr
	Data []byte
}

func (*RecvEvent) Action

func (ev *RecvEvent) Action() (action uint32, err error)

Action extract action

func (*RecvEvent) TID

func (ev *RecvEvent) TID() (id uint32, err error)

TID extract transaction id

type Scraper

type Scraper struct {
	PacketsPerSecond uint
	// contains filtered or unexported fields
}

bittorrent scraper

func New

func New(conf *config.ScraperConfig) (sc *Scraper, err error)

func (*Scraper) AddTracker

func (sc *Scraper) AddTracker(conf *config.ScrapeConfig) (err error)

func (*Scraper) Close

func (sc *Scraper) Close() (err error)

func (*Scraper) Run

func (sc *Scraper) Run()

func (*Scraper) RunWorker

func (sc *Scraper) RunWorker(pc net.PacketConn) (err error)

func (*Scraper) Scrape

func (sc *Scraper) Scrape(packets uint)

func (*Scraper) Wait

func (sc *Scraper) Wait()

type SendEvent

type SendEvent struct {
	To   net.Addr
	Data []byte
}

type Transaction

type Transaction struct {
	TransactionID uint32
	ConnectionID  uint64
	// contains filtered or unexported fields
}

Transaction a scrape transaction on a udp tracker

func (*Transaction) Done

func (t *Transaction) Done()

Done marks this transaction as done and removes it from parent

func (*Transaction) GotData

func (t *Transaction) GotData(data []byte) (done bool)

handle data for transaction

func (*Transaction) IsTimedOut

func (t *Transaction) IsTimedOut() bool

func (*Transaction) SendEvent

func (t *Transaction) SendEvent(to net.Addr) (ev *SendEvent)

create send event

func (*Transaction) Sync

func (t *Transaction) Sync() (err error)

Sync syncs models with database

Jump to

Keyboard shortcuts

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