]> Sergey Matveev's repositories - btrtrc.git/blobdiff - webtorrent/tracker-client.go
Drop support for go 1.20
[btrtrc.git] / webtorrent / tracker-client.go
index 60cd852773e524c8d9d130b16c9fc5005e43c32c..bc9dab312e2d64acf843f46d423b424e1514ebad 100644 (file)
@@ -9,7 +9,7 @@ import (
        "sync"
        "time"
 
-       "github.com/anacrolix/generics"
+       "github.com/anacrolix/generics"
        "github.com/anacrolix/log"
        "github.com/gorilla/websocket"
        "github.com/pion/datachannel"
@@ -43,6 +43,7 @@ type TrackerClient struct {
        pingTicker     *time.Ticker
 
        WebsocketTrackerHttpHeader func() http.Header
+       ICEServers                 []string
 }
 
 func (me *TrackerClient) Stats() TrackerClientStats {
@@ -233,14 +234,16 @@ func (tc *TrackerClient) Announce(event tracker.AnnounceEvent, infoHash [20]byte
                return fmt.Errorf("creating offer: %w", err)
        }
 
-       err = tc.announce(event, infoHash, []outboundOffer{{
-               offerId: offerIDBinary,
-               outboundOfferValue: outboundOfferValue{
-                       originalOffer:  offer,
-                       peerConnection: pc,
-                       infoHash:       infoHash,
-                       dataChannel:    dc,
-               }},
+       err = tc.announce(event, infoHash, []outboundOffer{
+               {
+                       offerId: offerIDBinary,
+                       outboundOfferValue: outboundOfferValue{
+                               originalOffer:  offer,
+                               peerConnection: pc,
+                               infoHash:       infoHash,
+                               dataChannel:    dc,
+                       },
+               },
        })
        if err != nil {
                dc.Close()
@@ -284,7 +287,7 @@ func (tc *TrackerClient) announce(event tracker.AnnounceEvent, infoHash [20]byte
                return fmt.Errorf("write AnnounceRequest: %w", err)
        }
        for _, offer := range offers {
-               generics.MakeMapIfNilAndSet(&tc.outboundOffers, offer.offerId, offer.outboundOfferValue)
+               g.MakeMapIfNilAndSet(&tc.outboundOffers, offer.offerId, offer.outboundOfferValue)
        }
        return nil
 }