4 "github.com/pion/webrtc/v2"
7 type AnnounceRequest struct {
8 Numwant int `json:"numwant"`
9 Uploaded int64 `json:"uploaded"`
10 Downloaded int64 `json:"downloaded"`
11 Left int64 `json:"left"`
12 Event string `json:"event"`
13 Action string `json:"action"`
14 InfoHash string `json:"info_hash"`
15 PeerID string `json:"peer_id"`
16 Offers []Offer `json:"offers"`
20 OfferID string `json:"offer_id"`
21 Offer webrtc.SessionDescription `json:"offer"`
24 type AnnounceResponse struct {
25 InfoHash string `json:"info_hash"`
26 Action string `json:"action"`
27 Interval *int `json:"interval,omitempty"`
28 Complete *int `json:"complete,omitempty"`
29 Incomplete *int `json:"incomplete,omitempty"`
30 PeerID string `json:"peer_id,omitempty"`
31 ToPeerID string `json:"to_peer_id,omitempty"`
32 Answer *webrtc.SessionDescription `json:"answer,omitempty"`
33 Offer *webrtc.SessionDescription `json:"offer,omitempty"`
34 OfferID string `json:"offer_id,omitempty"`
37 // I wonder if this is a defacto standard way to decode bytes to JSON for webtorrent. I don't really
39 func binaryToJsonString(b []byte) string {
42 seq = append(seq, rune(v))