Documentation ¶
Index ¶
Constants ¶
const ( RATIOLESS = iota SEMIRATIOLESS NORMALRATIO )
Variables ¶
This section is empty.
Functions ¶
func ParseInfoHash ¶
ParseInfoHash parses the encoded info hash. Such a simple solution for a problem I hate more than koalas.
Types ¶
type AnnounceData ¶
type AnnounceData struct { InfoHash string //20 byte sha1 hash PeerID string //max len 20 IP string //optional Event string // TorrentEvent Port uint64 // port number the peer is listening Uploaded uint64 // base10 ascii amount uploaded so far Downloaded uint64 // base10 ascii amount downloaded so Left uint64 // # of bytes left to download Numwant uint64 // Number of peers requested by client. Compact bool // Bep23 peer list compression RequestContext requestAppContext // The request-specific connections }
func (*AnnounceData) CompletedEventHandler ¶
func (a *AnnounceData) CompletedEventHandler()
CompletedEventHandler Called upon announce when a client finishes a download. Removes the client from incomplete in redis and places their peer info into complete.
func (*AnnounceData) ParseAnnounceData ¶
func (a *AnnounceData) ParseAnnounceData(req *http.Request) (err error)
ParseAnnounceData handles getting the annunce data from a remote client and parses it into an acceptable data structure.
func (*AnnounceData) StartedEventHandler ¶
func (a *AnnounceData) StartedEventHandler() (err error)
StartedEventHandler handles whenever a peer sends the STARTED event to the tracker.
func (*AnnounceData) StoppedEventHandler ¶
func (a *AnnounceData) StoppedEventHandler()
StoppedEventHandler Called upon announce whenever a client attempts to shut-down gracefully. Ensures that the client is removed from complete/incomplete lists. TODO(ian): This is what happened whenever the torrent client shuts down gracefully, so we need to call the mysql backend and store the info and remove the ipport from completed/incomplete redis kvs
type AnnouncerNotifier ¶
type AnnouncerNotifier interface { // SpawnNotifier handles creating a new notifier. The notifier will live by // itself and not need any SpawnNotifier() *interface{} // KillNotifier will handle cleanup and closing of the notifier. Necessary // for a clean exit for Notorious. KillNotifier() error // contains filtered or unexported methods }
AnnouncerNotifier handles declaring the API for notifying different channels of new torrent additions.
type NewTorrentCatcher ¶
type NewTorrentCatcher interface { // HandleNewTorrent catches new torrents being added and then calls the // `serviceNewTorrent` function. HandleNewTorrent ought to be able to `go // catcherImpl.HandleNewTorrent()` and not be worried about ever again. HandleNewTorrent() NewCatcher() *interface{} // contains filtered or unexported methods }