Expose AnacrolixDhtServerWrapper

This commit is contained in:
Matt Joiner 2021-05-24 17:37:04 +10:00
parent 7d9e2b18d6
commit bc186ac211
2 changed files with 6 additions and 6 deletions

View File

@ -322,7 +322,7 @@ func TestDhtInheritBlocklist(t *testing.T) {
numServers := 0
cl.eachDhtServer(func(s DhtServer) {
t.Log(s)
assert.Equal(t, ipl, s.(anacrolixDhtServerWrapper).Server.IPBlocklist())
assert.Equal(t, ipl, s.(AnacrolixDhtServerWrapper).Server.IPBlocklist())
numServers++
})
assert.EqualValues(t, 2, numServers)

10
dht.go
View File

@ -29,11 +29,11 @@ type DhtAnnounce interface {
Peers() <-chan dht.PeersValues
}
type anacrolixDhtServerWrapper struct {
type AnacrolixDhtServerWrapper struct {
*dht.Server
}
func (me anacrolixDhtServerWrapper) Stats() interface{} {
func (me AnacrolixDhtServerWrapper) Stats() interface{} {
return me.Server.Stats()
}
@ -45,13 +45,13 @@ func (me anacrolixDhtAnnounceWrapper) Peers() <-chan dht.PeersValues {
return me.Announce.Peers
}
func (me anacrolixDhtServerWrapper) Announce(hash [20]byte, port int, impliedPort bool) (DhtAnnounce, error) {
func (me AnacrolixDhtServerWrapper) Announce(hash [20]byte, port int, impliedPort bool) (DhtAnnounce, error) {
ann, err := me.Server.Announce(hash, port, impliedPort)
return anacrolixDhtAnnounceWrapper{ann}, err
}
func (me anacrolixDhtServerWrapper) Ping(addr *net.UDPAddr) {
func (me AnacrolixDhtServerWrapper) Ping(addr *net.UDPAddr) {
me.Server.Ping(addr)
}
var _ DhtServer = anacrolixDhtServerWrapper{}
var _ DhtServer = AnacrolixDhtServerWrapper{}