Debug bool `help:"enable debugging"`
Logger log.Logger
+ // Used for torrent sources and webseeding if set.
+ WebTransport http.RoundTripper
// Defines proxy for HTTP requests, such as for trackers. It's commonly set from the result of
// "net/http".ProxyURL(HTTPProxy).
HTTPProxy func(*http.Request) (*url.URL, error)
// HttpRequestDirector modifies the request before it's sent.
// Useful for adding authentication headers, for example
HttpRequestDirector func(*http.Request) error
+ // WebsocketTrackerHttpHeader returns a custom header to be used when dialing a websocket connection
+ // to the tracker. Useful for adding authentication headers
+ WebsocketTrackerHttpHeader func() http.Header
// Updated occasionally to when there's been some changes to client
// behaviour in case other clients are assuming anything of us. See also
// `bep20`.
// How long between writes before sending a keep alive message on a peer connection that we want
// to maintain.
KeepAliveTimeout time.Duration
+ // Maximum bytes to buffer per peer connection for peer request data before it is sent.
+ MaxAllocPeerRequestDataPerConn int64
// The IP addresses as our peers should see them. May differ from the
// local interfaces due to NAT or other network configurations.
DisableWebseeds bool
Callbacks Callbacks
+
+ // ICEServers defines a slice describing servers available to be used by
+ // ICE, such as STUN and TURN servers.
+ ICEServers []string
+
+ DialRateLimiter *rate.Limiter
}
func (cfg *ClientConfig) SetListenAddr(addr string) *ClientConfig {
TorrentPeersLowWater: 50,
HandshakesTimeout: 4 * time.Second,
KeepAliveTimeout: time.Minute,
+ MaxAllocPeerRequestDataPerConn: 1 << 20,
ListenHost: func(string) string { return "" },
UploadRateLimiter: unlimited,
DownloadRateLimiter: unlimited,
Extensions: defaultPeerExtensionBytes(),
AcceptPeerConnections: true,
MaxUnverifiedBytes: 64 << 20,
+ DialRateLimiter: rate.NewLimiter(10, 10),
}
cc.DhtStartingNodes = func(network string) dht.StartingNodesGetter {
return func() ([]dht.Addr, error) { return dht.GlobalBootstrapAddrs(network) }