Documentation
¶
Index ¶
Constants ¶
View Source
const DefaultInterval = 60 //in seconds
View Source
const DisconnectInterval = time.Minute //in seconds
View Source
const SoftLimit = 5 //in seconds
Variables ¶
This section is empty.
Functions ¶
func ValidateReq ¶
func ValidateReq(req AnnounceReq) error
func WriteResp ¶
func WriteResp(w http.ResponseWriter, res interface{}, compact bool)
Types ¶
type AnnounceReq ¶
type AnnounceReq struct { InfoHash []byte PeerID []byte RemoteAddr net.IP Port int Event string Uploaded int64 Downloaded int64 SupportCrypto bool Left int64 Compact bool }
func ParseRequest ¶
func ParseRequest(r *http.Request) (AnnounceReq, error)
type AnnounceReqWithTime ¶
type AnnounceReqWithTime struct { AnnounceReq UpdatedAt time.Time }
/announce?compact=1 &downloaded=0 &event="started" &info_hash=D%22%5C%80%F7%FD%12Z%EA%9B%F0%A5z%DA%AF%1F%A4%E1je &left=0 &peer_id=-GT0002-9%EA%FB+%BF%B3%AD%DE%8Ae%D0%B7 &port=53631 &supportcrypto=1 &uploaded=0"
type ErrResponse ¶
type ErrResponse struct {
FailureReason string `bencode:"failure reason" json:"failure_reason"`
}
type HttpResponse ¶
type HttpResponse struct { Interval int32 `bencode:"interval" json:"interval"` TrackerId string `bencode:"tracker id" json:"tracker_id"` Complete int32 `bencode:"complete" json:"complete"` Incomplete int32 `bencode:"incomplete" json:"incomplete"` Peers []map[string]interface{} `bencode:"peers" json:"peers"` }
type ScrapeData ¶
type ScrapeResponse ¶
type ScrapeResponse struct {
Files map[string]*ScrapeData `json:"files" bencode:"files"`
}
Click to show internal directories.
Click to hide internal directories.