Documentation
¶
Index ¶
Constants ¶
View Source
const ( ProtocolID = 0x41727101980 ConnectAction = 0x00 AnnounceAction = 0x01 ScrapeAction = 0x02 ErrorAction = 0x03 // Connection ID timeout (2 minutes as per BEP 15) ConnectionTimeout = 2 * time.Minute // Default announce interval DefaultInterval = 1800 // 30 minutes )
BEP 15 protocol constants
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type AnnounceRequest ¶
type AnnounceRequest struct {
ConnectionID uint64
Action uint32
TransactionID uint32
InfoHash dht.Key
PeerID dht.Key
Downloaded uint64
Left uint64
Uploaded uint64
Event uint32
IP uint32
Key uint32
NumWant int32
Port uint16
}
AnnounceRequest represents a UDP announce request according to BEP 15
type Client ¶
type Client struct {
// Timeout for each round-trip (connect + announce/scrape). Default: 15s.
Timeout time.Duration
}
Client is a UDP BitTorrent tracker client (BEP 15).
type PeerInfo ¶
type PeerInfo struct {
IP net.IP
Port uint16
Left uint64 // Bytes left to download (0 = seeder)
LastSeen time.Time
}
PeerInfo stores information about a peer for UDP tracker
type ScrapeFileInfo ¶
ScrapeFileInfo represents file information in scrape response
type ScrapeRequest ¶
type ScrapeRequest struct {
ConnectionID uint64
Action uint32
TransactionID uint32
InfoHashes []string
}
ScrapeRequest represents a UDP scrape request according to BEP 15
type Server ¶
type Server struct {
// contains filtered or unexported fields
}
Server represents a UDP BitTorrent tracker server (BEP 15)
func NewServer ¶
func NewServer(config *ServerConfig) *Server
NewServer creates a new UDP tracker server
func (*Server) GetStats ¶
func (s *Server) GetStats() *ServerStats
GetStats returns current server statistics
type ServerConfig ¶
type ServerConfig struct {
Port int
Storage string
AnnounceInterval int
MaxPeers int
EnableStats bool
}
ServerConfig holds configuration for UDP tracker server
Click to show internal directories.
Click to hide internal directories.