"github.com/dustin/go-humanize"
gbtree "github.com/google/btree"
"github.com/pion/datachannel"
+ "github.com/pion/webrtc/v3"
"github.com/anacrolix/torrent/bencode"
"github.com/anacrolix/torrent/internal/check"
}
}
+ var ICEServers []webrtc.ICEServer
+ if cl.config.ICEServerList != nil {
+ ICEServers = cl.config.ICEServerList
+ } else if cl.config.ICEServers != nil {
+ ICEServers = []webrtc.ICEServer{{URLs: cl.config.ICEServers}}
+ }
+
cl.websocketTrackers = websocketTrackers{
PeerId: cl.peerID,
Logger: cl.logger,
},
Proxy: cl.config.HTTPProxy,
WebsocketTrackerHttpHeader: cl.config.WebsocketTrackerHttpHeader,
- ICEServers: cl.config.ICEServers,
+ ICEServers: ICEServers,
DialContext: cl.config.TrackerDialContext,
OnConn: func(dc datachannel.ReadWriteCloser, dcc webtorrent.DataChannelContext) {
cl.lock()
return fmt.Sprintf("<%[1]T %[1]p>", cl)
}
+func (cl *Client) ICEServers() []webrtc.ICEServer {
+ var ICEServers []webrtc.ICEServer
+ if cl.config.ICEServerList != nil {
+ ICEServers = cl.config.ICEServerList
+ } else if cl.config.ICEServers != nil {
+ ICEServers = []webrtc.ICEServer{{URLs: cl.config.ICEServers}}
+ }
+ return ICEServers
+}
+
// Returns connection-level aggregate connStats at the Client level. See the comment on
// TorrentStats.ConnStats.
func (cl *Client) ConnStats() ConnStats {
"github.com/anacrolix/dht/v2/krpc"
"github.com/anacrolix/log"
"github.com/anacrolix/missinggo/v2"
+ "github.com/pion/webrtc/v3"
"golang.org/x/time/rate"
"github.com/anacrolix/torrent/iplist"
Callbacks Callbacks
- // ICEServers defines a slice describing servers available to be used by
+ // ICEServerList defines a slice describing servers available to be used by
// ICE, such as STUN and TURN servers.
+ ICEServerList []webrtc.ICEServer
+
+ // Deprecated. ICEServers does not support server authentication and therefore
+ // it cannot be used with most TURN servers. Use ICEServerList instead.
+ // ICEServers is kept for legacy support.
ICEServers []string
DialRateLimiter *rate.Limiter
github.com/anacrolix/multiless v0.3.0/go.mod h1:TrCLEZfIDbMVfLoQt5tOoiBS/uq4y8+ojuEVVvTNPX4=
github.com/anacrolix/possum/go v0.1.1-0.20240309232535-7d660fa365f8 h1:XDKUI9RHyhyfGXVXb/4N+l5kGo5jQITrrbF7EZPLuak=
github.com/anacrolix/possum/go v0.1.1-0.20240309232535-7d660fa365f8/go.mod h1:pw5HEMBSiL+otYzHe4q5jGaVuy5unl+Mt4Bx6SDemW8=
-github.com/anacrolix/squirrel v0.6.0 h1:ovfWW42wcGzrVYYI9s56pEYzfeTwtXxCCvSd+KwvUEA=
-github.com/anacrolix/squirrel v0.6.0/go.mod h1:60vdNPUbK1jYWePp39Wqn9whHm12Yb9JEuwOXzLMDuY=
github.com/anacrolix/squirrel v0.6.4 h1:K6ABRMCms0xwpEIdY3kAaDBUqiUeUYCKLKI0yHTr9IQ=
github.com/anacrolix/squirrel v0.6.4/go.mod h1:0kFVjOLMOKVOet6ja2ac1vTOrqVbLj2zy2Fjp7+dkE8=
github.com/anacrolix/stm v0.2.0/go.mod h1:zoVQRvSiGjGoTmbM0vSLIiaKjWtNPeTvXUSdJQA4hsg=
pingTicker *time.Ticker
WebsocketTrackerHttpHeader func() http.Header
- ICEServers []string
+ ICEServers []webrtc.ICEServer
}
func (me *TrackerClient) Stats() TrackerClientStats {
return err
}
-func newPeerConnection(logger log.Logger, iceServers []string) (*wrappedPeerConnection, error) {
+func newPeerConnection(logger log.Logger, iceServers []webrtc.ICEServer) (*wrappedPeerConnection, error) {
newPeerConnectionMu.Lock()
defer newPeerConnectionMu.Unlock()
ctx, span := otel.Tracer(tracerName).Start(context.Background(), "PeerConnection")
- pcConfig := webrtc.Configuration{ICEServers: []webrtc.ICEServer{{URLs: iceServers}}}
+ pcConfig := webrtc.Configuration{ICEServers: iceServers}
pc, err := api.NewPeerConnection(pcConfig)
if err != nil {
"github.com/anacrolix/log"
"github.com/gorilla/websocket"
"github.com/pion/datachannel"
+ "github.com/pion/webrtc/v3"
"github.com/anacrolix/torrent/tracker"
httpTracker "github.com/anacrolix/torrent/tracker/http"
Proxy httpTracker.ProxyFunc
DialContext func(ctx context.Context, network, addr string) (net.Conn, error)
WebsocketTrackerHttpHeader func() netHttp.Header
- ICEServers []string
+ ICEServers []webrtc.ICEServer
}
func (me *websocketTrackers) Get(url string, infoHash [20]byte) (*webtorrent.TrackerClient, func()) {