Update to latest anacrolix/dht
This commit is contained in:
parent
4a5b891a34
commit
c83738f3f4
|
@ -315,7 +315,7 @@ func (cl *Client) newAnacrolixDhtServer(conn net.PacketConn) (s *dht.Server, err
|
|||
}
|
||||
return cl.config.PublicIp4
|
||||
}(),
|
||||
StartingNodes: cl.config.DhtStartingNodes,
|
||||
StartingNodes: cl.config.DhtStartingNodes(conn.LocalAddr().Network()),
|
||||
ConnectionTracking: cl.config.ConnTracker,
|
||||
OnQuery: cl.config.DHTOnQuery,
|
||||
Logger: cl.logger.WithValues("dht", conn.LocalAddr().String()),
|
||||
|
|
|
@ -424,10 +424,9 @@ func TestAddMetainfoWithNodes(t *testing.T) {
|
|||
cfg := TestingConfig()
|
||||
cfg.ListenHost = func(string) string { return "" }
|
||||
cfg.NoDHT = false
|
||||
cfg.DhtStartingNodes = func() ([]dht.Addr, error) { return nil, nil }
|
||||
// For now, we want to just jam the nodes into the table, without
|
||||
// verifying them first. Also the DHT code doesn't support mixing secure
|
||||
// and insecure nodes if security is enabled (yet).
|
||||
cfg.DhtStartingNodes = func(string) dht.StartingNodesGetter { return func() ([]dht.Addr, error) { return nil, nil } }
|
||||
// For now, we want to just jam the nodes into the table, without verifying them first. Also the
|
||||
// DHT code doesn't support mixing secure and insecure nodes if security is enabled (yet).
|
||||
// cfg.DHTConfig.NoSecurity = true
|
||||
cl, err := NewClient(cfg)
|
||||
require.NoError(t, err)
|
||||
|
|
16
config.go
16
config.go
|
@ -36,7 +36,7 @@ type ClientConfig struct {
|
|||
|
||||
// Don't create a DHT.
|
||||
NoDHT bool `long:"disable-dht"`
|
||||
DhtStartingNodes dht.StartingNodesGetter
|
||||
DhtStartingNodes func(network string) dht.StartingNodesGetter
|
||||
// Never send chunks to peers.
|
||||
NoUpload bool `long:"no-upload"`
|
||||
// Disable uploading even when it isn't fair.
|
||||
|
@ -151,12 +151,14 @@ func NewDefaultClientConfig() *ClientConfig {
|
|||
TorrentPeersHighWater: 500,
|
||||
TorrentPeersLowWater: 50,
|
||||
HandshakesTimeout: 4 * time.Second,
|
||||
DhtStartingNodes: dht.GlobalBootstrapAddrs,
|
||||
ListenHost: func(string) string { return "" },
|
||||
UploadRateLimiter: unlimited,
|
||||
DownloadRateLimiter: unlimited,
|
||||
ConnTracker: conntrack.NewInstance(),
|
||||
DisableAcceptRateLimiting: true,
|
||||
DhtStartingNodes: func(network string) dht.StartingNodesGetter {
|
||||
return func() ([]dht.Addr, error) { return dht.GlobalBootstrapAddrs(network) }
|
||||
},
|
||||
ListenHost: func(string) string { return "" },
|
||||
UploadRateLimiter: unlimited,
|
||||
DownloadRateLimiter: unlimited,
|
||||
ConnTracker: conntrack.NewInstance(),
|
||||
DisableAcceptRateLimiting: true,
|
||||
HeaderObfuscationPolicy: HeaderObfuscationPolicy{
|
||||
Preferred: true,
|
||||
RequirePreferred: false,
|
||||
|
|
2
go.mod
2
go.mod
|
@ -3,7 +3,7 @@ module github.com/anacrolix/torrent
|
|||
require (
|
||||
bazil.org/fuse v0.0.0-20180421153158-65cc252bf669
|
||||
github.com/alexflint/go-arg v1.2.0
|
||||
github.com/anacrolix/dht/v2 v2.5.0
|
||||
github.com/anacrolix/dht/v2 v2.5.1-0.20200317023935-129f05e9b752
|
||||
github.com/anacrolix/envpprof v1.1.0
|
||||
github.com/anacrolix/go-libutp v1.0.2
|
||||
github.com/anacrolix/log v0.6.0
|
||||
|
|
2
go.sum
2
go.sum
|
@ -29,6 +29,8 @@ github.com/anacrolix/dht/v2 v2.2.1-0.20191103020011-1dba080fb358/go.mod h1:d7ARx
|
|||
github.com/anacrolix/dht/v2 v2.3.2-0.20200103043204-8dce00767ebd/go.mod h1:cgjKyErDnKS6Mej5D1fEqBKg3KwFF2kpFZJp3L6/fGI=
|
||||
github.com/anacrolix/dht/v2 v2.5.0 h1:AYoGu41z2fellHU9zdFZOQFr8E3epyAGWk6RfOz5UVE=
|
||||
github.com/anacrolix/dht/v2 v2.5.0/go.mod h1:7RLvyOjm+ZPA7vgFRP+1eRjFzrh27p/nF0VCk5LcjoU=
|
||||
github.com/anacrolix/dht/v2 v2.5.1-0.20200317023935-129f05e9b752 h1:Cg9KyjeymlTOYY+SQ2FeIij9eaZI/eUFprAXYWL0AA8=
|
||||
github.com/anacrolix/dht/v2 v2.5.1-0.20200317023935-129f05e9b752/go.mod h1:7RLvyOjm+ZPA7vgFRP+1eRjFzrh27p/nF0VCk5LcjoU=
|
||||
github.com/anacrolix/envpprof v0.0.0-20180404065416-323002cec2fa h1:xCaATLKmn39QqLs3tUZYr6eKvezJV+FYvVOLTklxK6U=
|
||||
github.com/anacrolix/envpprof v0.0.0-20180404065416-323002cec2fa/go.mod h1:KgHhUaQMc8cC0+cEflSgCFNFbKwi5h54gqtVn8yhP7c=
|
||||
github.com/anacrolix/envpprof v1.0.0 h1:AwZ+mBP4rQ5f7JSsrsN3h7M2xDW/xSE66IPVOqlnuUc=
|
||||
|
|
Loading…
Reference in New Issue