]> Sergey Matveev's repositories - btrtrc.git/blob - tracker/server.go
077d32445534eb2f9053a8d19bed816106a22fea
[btrtrc.git] / tracker / server.go
1 package tracker
2
3 import (
4         "context"
5         "net/netip"
6
7         "github.com/anacrolix/torrent/tracker/udp"
8 )
9
10 // This is reserved for stuff like filtering by IP version, avoiding an announcer's IP or key,
11 // limiting return count, etc.
12 type GetPeersOpts struct{}
13
14 type InfoHash = [20]byte
15
16 type PeerInfo struct {
17         AnnounceAddr
18 }
19
20 type AnnounceAddr = netip.AddrPort
21
22 type AnnounceTracker interface {
23         TrackAnnounce(ctx context.Context, req udp.AnnounceRequest, addr AnnounceAddr) error
24         Scrape(ctx context.Context, infoHashes []InfoHash) ([]udp.ScrapeInfohashResult, error)
25         GetPeers(ctx context.Context, infoHash InfoHash, opts GetPeersOpts) ([]PeerInfo, error)
26 }
27
28 //
29 //type Server struct {
30 //      AnnounceTracker AnnounceTracker
31 //}
32 //
33 //func (me Server) HandleAnnounce(req udp.AnnounceRequest, sourceAddr AnnounceAddr) error {
34 //
35 //}