Documentation ¶
Overview ¶
Package tracker provides a generic interface for manipulating a BitTorrent tracker's fast-moving data.
Index ¶
- type Storage
- func (s *Storage) ClientApproved(peerID string) error
- func (s *Storage) DeleteClient(peerID string)
- func (s *Storage) DeleteLeecher(infohash string, p *models.Peer) error
- func (s *Storage) DeleteSeeder(infohash string, p *models.Peer) error
- func (s *Storage) DeleteTorrent(infohash string)
- func (s *Storage) FindTorrent(infohash string) (*models.Torrent, error)
- func (s *Storage) IncrementTorrentSnatches(infohash string) error
- func (s *Storage) Len() int
- func (s *Storage) PurgeInactivePeers(purgeEmptyTorrents bool, before time.Time) error
- func (s *Storage) PurgeInactiveTorrent(infohash string) error
- func (s *Storage) PutClient(peerID string)
- func (s *Storage) PutLeecher(infohash string, p *models.Peer) error
- func (s *Storage) PutSeeder(infohash string, p *models.Peer) error
- func (s *Storage) PutTorrent(torrent *models.Torrent)
- func (s *Storage) TouchTorrent(infohash string) error
- type Torrents
- type Tracker
- type Writer
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Storage ¶
type Storage struct {
// contains filtered or unexported fields
}
func NewStorage ¶
func (*Storage) ClientApproved ¶
func (*Storage) DeleteClient ¶
func (*Storage) DeleteLeecher ¶
func (*Storage) DeleteSeeder ¶
func (*Storage) DeleteTorrent ¶
func (*Storage) FindTorrent ¶
func (*Storage) IncrementTorrentSnatches ¶
func (*Storage) PurgeInactivePeers ¶
func (*Storage) PurgeInactiveTorrent ¶
func (*Storage) PutTorrent ¶
func (*Storage) TouchTorrent ¶
type Tracker ¶
Tracker represents the logic necessary to service BitTorrent announces, independently of the underlying data transports used.
func New ¶
New creates a new Tracker, and opens any necessary connections. Maintenance routines are automatically spawned in the background.
func (*Tracker) HandleAnnounce ¶
HandleAnnounce encapsulates all of the logic of handling a BitTorrent client's Announce without being coupled to any transport protocol.
func (*Tracker) HandleScrape ¶
HandleScrape encapsulates all the logic of handling a BitTorrent client's scrape without being coupled to any transport protocol.
func (*Tracker) LoadApprovedClients ¶
LoadApprovedClients loads a list of client IDs into the tracker's storage.
type Writer ¶
type Writer interface { WriteError(err error) error WriteAnnounce(*models.AnnounceResponse) error WriteScrape(*models.ScrapeResponse) error }
Writer serializes a tracker's responses, and is implemented for each response transport used by the tracker. Only one of these may be called per request, and only once.
Note, data passed into any of these functions will not contain sensitive information, so it may be passed back the client freely.