From 319b24e5e75e8a44d6babdf20e30d2d2f46e3810 Mon Sep 17 00:00:00 2001 From: xgfone Date: Sun, 24 Jul 2022 14:34:54 +0800 Subject: [PATCH] dht bootstrap ignores the unsupported addresses --- dht/dht_server.go | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/dht/dht_server.go b/dht/dht_server.go index 478e129..eebd289 100644 --- a/dht/dht_server.go +++ b/dht/dht_server.go @@ -299,6 +299,14 @@ func (s *Server) Bootstrap(addrs []string) { } for _, a := range as { + if isIPv6(a.IP) { + if !s.ipv6 { + continue + } + } else if !s.ipv4 { + continue + } + if err = s.FindNode(a.UDPAddr(), s.conf.ID); err != nil { s.conf.ErrorLog(`fail to bootstrap '%s': %s`, a.String(), err) }