]> Sergey Matveev's repositories - btrtrc.git/blobdiff - config.go
gorond test files
[btrtrc.git] / config.go
index 09f9bc1eb07ad099e9f4a63eb608421e4b42c8c0..1764168972e59fb4e6adad67d33cf23d2566245e 100644 (file)
--- a/config.go
+++ b/config.go
@@ -117,6 +117,9 @@ type ClientConfig struct {
        // 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`.
@@ -145,6 +148,8 @@ type ClientConfig struct {
        // 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.
@@ -202,6 +207,7 @@ func NewDefaultClientConfig() *ClientConfig {
                TorrentPeersLowWater:           50,
                HandshakesTimeout:              4 * time.Second,
                KeepAliveTimeout:               time.Minute,
+               MaxAllocPeerRequestDataPerConn: 1 << 20,
                ListenHost:                     func(string) string { return "" },
                UploadRateLimiter:              unlimited,
                DownloadRateLimiter:            unlimited,