aboutsummaryrefslogtreecommitdiff
path: root/meta/tracker.go
blob: 111f4b74a9a7cacee1e24bc242aa2306833bcb39 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
package meta

import "net"

type Event string

const (
	NoEvent   Event = ""
	Started   Event = "started"
	Stopped   Event = "stopped"
	Completed Event = "completed"
)

type TrackerRequest struct {
	InfoHash   []byte // info_hash
	PeerID     []byte // peer_id
	Port       int
	Uploaded   int
	Downloaded int
	Left       int
	Compact    bool // always true
	NoPeerID   bool
	Event      Event
	IP         net.IPAddr
	NumWant    int
	Key        []byte
	TrackerID  []byte
}

// we support only compact mode
type TrackerResponse struct {
	Complete       int    `bencode:"complete"`
	FalureReason   string `bencode:"failure reason"`
	Incomplete     int    `bencode:"incomplete"`
	Interval       int    `bencode:"interval"`
	MinInterval    int    `bencode:"min interval"`
	Peers          []byte `bencode:"peers"`
	TrackerId      string `bencode:"tracker id"`
	WarningMessage string `bencode:"warning message"`
}