6 "github.com/davecgh/go-spew/spew"
8 "github.com/anacrolix/torrent"
9 "github.com/anacrolix/torrent/tracker"
10 "github.com/anacrolix/torrent/tracker/udp"
13 type AnnounceCmd struct {
14 Event udp.AnnounceEvent
16 Tracker string `arg:"positional"`
17 InfoHash torrent.InfoHash `arg:"positional"`
20 func announceErr(flags AnnounceCmd) error {
21 req := tracker.AnnounceRequest{
22 InfoHash: flags.InfoHash,
23 Port: uint16(torrent.NewDefaultClientConfig().ListenPort),
28 if flags.Port != nil {
29 req.Port = *flags.Port
31 response, err := tracker.Announce{
32 TrackerUrl: flags.Tracker,
36 return fmt.Errorf("doing announce: %w", err)