diff --git a/dht.go b/dht.go index 464090f9..77975a2f 100644 --- a/dht.go +++ b/dht.go @@ -9,11 +9,14 @@ import ( peer_store "github.com/anacrolix/dht/v2/peer-store" ) +// DHT server interface for use by a Torrent or Client. It's reasonable for this to make assumptions +// for torrent-use that might not be the default behaviour for the DHT server. type DhtServer interface { Stats() interface{} ID() [20]byte Addr() net.Addr AddNode(ni krpc.NodeInfo) error + // This is called asynchronously when receiving PORT messages. Ping(addr *net.UDPAddr) Announce(hash [20]byte, port int, impliedPort bool) (DhtAnnounce, error) WriteStatus(io.Writer) @@ -51,7 +54,9 @@ func (me AnacrolixDhtServerWrapper) Announce(hash [20]byte, port int, impliedPor } func (me AnacrolixDhtServerWrapper) Ping(addr *net.UDPAddr) { - me.Server.Ping(addr) + me.Server.PingQueryInput(addr, dht.QueryInput{ + RateLimiting: dht.QueryRateLimiting{NoWaitFirst: true}, + }) } var _ DhtServer = AnacrolixDhtServerWrapper{} diff --git a/go.mod b/go.mod index 01789e96..c30582ef 100644 --- a/go.mod +++ b/go.mod @@ -8,7 +8,7 @@ require ( github.com/anacrolix/args v0.4.1-0.20211104085705-59f0fe94eb8f github.com/anacrolix/chansync v0.3.0 github.com/anacrolix/confluence v1.9.0 // indirect - github.com/anacrolix/dht/v2 v2.13.1-0.20211209181115-6ae2bd446b12 + github.com/anacrolix/dht/v2 v2.14.1-0.20211220010335-4062f7927abf github.com/anacrolix/envpprof v1.1.1 github.com/anacrolix/fuse v0.2.0 github.com/anacrolix/go-libutp v1.1.0 diff --git a/go.sum b/go.sum index bbd4694a..1e44a009 100644 --- a/go.sum +++ b/go.sum @@ -91,21 +91,8 @@ github.com/anacrolix/confluence v1.7.1-0.20210311004351-d642adb8546c/go.mod h1:K github.com/anacrolix/confluence v1.8.0/go.mod h1:GsPP6ikA8h/CU7ExbuMOswpzZpPdf1efDPu4rVXL43g= github.com/anacrolix/confluence v1.9.0 h1:7WrWktoDw7P4uo1bzgaA8FFesvc7NsTp37sAsG54XlE= github.com/anacrolix/confluence v1.9.0/go.mod h1:O5uS+WVgip+3SOcV1K7E/jE3m4DtK7Jk6QJTnU2VS5s= -github.com/anacrolix/dht v0.0.0-20180412060941-24cbf25b72a4 h1:0yHJvFiGQhJ1gSHJOR8xzmnx45orEt7uiIB6guf0+zc= -github.com/anacrolix/dht v0.0.0-20180412060941-24cbf25b72a4/go.mod h1:hQfX2BrtuQsLQMYQwsypFAab/GvHg8qxwVi4OJdR1WI= -github.com/anacrolix/dht/v2 v2.0.1/go.mod h1:GbTT8BaEtfqab/LPd5tY41f3GvYeii3mmDUK300Ycyo= -github.com/anacrolix/dht/v2 v2.2.1-0.20191103020011-1dba080fb358/go.mod h1:d7ARx3WpELh9uOEEr0+8wvQeVTOkPse4UU6dKpv4q0E= -github.com/anacrolix/dht/v2 v2.3.2-0.20200103043204-8dce00767ebd/go.mod h1:cgjKyErDnKS6Mej5D1fEqBKg3KwFF2kpFZJp3L6/fGI= -github.com/anacrolix/dht/v2 v2.5.1-0.20200317023935-129f05e9b752/go.mod h1:7RLvyOjm+ZPA7vgFRP+1eRjFzrh27p/nF0VCk5LcjoU= -github.com/anacrolix/dht/v2 v2.8.0/go.mod h1:RjeKbveVwjnaVj5os4y/NQwqEoDWHigo5rdge9MP52k= -github.com/anacrolix/dht/v2 v2.8.1-0.20210221225335-7a6713a749f9/go.mod h1:p7fLHxqc1mtrFGXfJ226Fo2akG3Pv8ngCTnYAzVJXa4= -github.com/anacrolix/dht/v2 v2.8.1-0.20210311003418-13622df072ae/go.mod h1:wLmYr78fBu4KfUUkFZyGFFwDPDw9EHL5x8c632XCZzs= -github.com/anacrolix/dht/v2 v2.9.1/go.mod h1:ZyYcIQinN/TE3oKONCchQOLjhYR786Jaxz3jsBtih4A= -github.com/anacrolix/dht/v2 v2.10.0/go.mod h1:KC51tqylRYBu82RM5pEYf+g1n7db+F0tOJqSbCjjZWc= -github.com/anacrolix/dht/v2 v2.10.5-0.20210902001729-06cc4fe90e53/go.mod h1:zHjijcebN+L7JbzxW0mOraHis+I81EIgsJAAtiw8bQ8= -github.com/anacrolix/dht/v2 v2.10.6-0.20211007004332-99263ec9c1c8/go.mod h1:WID4DexLrucfnwzv1OV8REzgoCpyVDwEczxIOrUeFrY= -github.com/anacrolix/dht/v2 v2.13.1-0.20211209181115-6ae2bd446b12 h1:W0gso1vLz1b1G9HjxsSFAWZjLZwwlPZQD20BGhwz5YU= -github.com/anacrolix/dht/v2 v2.13.1-0.20211209181115-6ae2bd446b12/go.mod h1:zJgaiAU2yhzmchZE2mY8WyZ64LK/F/D9MAeN0ct73qQ= +github.com/anacrolix/dht/v2 v2.14.1-0.20211220010335-4062f7927abf h1:gPdUT2QIlVX37CCRoKzyx5263AqQJIMyDM0b9DiZyR8= +github.com/anacrolix/dht/v2 v2.14.1-0.20211220010335-4062f7927abf/go.mod h1:zJgaiAU2yhzmchZE2mY8WyZ64LK/F/D9MAeN0ct73qQ= github.com/anacrolix/envpprof v0.0.0-20180404065416-323002cec2fa/go.mod h1:KgHhUaQMc8cC0+cEflSgCFNFbKwi5h54gqtVn8yhP7c= github.com/anacrolix/envpprof v1.0.0/go.mod h1:KgHhUaQMc8cC0+cEflSgCFNFbKwi5h54gqtVn8yhP7c= github.com/anacrolix/envpprof v1.0.1/go.mod h1:My7T5oSqVfEn4MD4Meczkw/f5lSIndGAKu/0SM/rkf4=