From 0855da80b25220e5fb1ede6cef6d557358b585a1 Mon Sep 17 00:00:00 2001 From: Jeremy Rand Date: Tue, 9 Nov 2021 08:44:56 +0000 Subject: [PATCH] Support multiple initial IP's --- seeder.go | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/seeder.go b/seeder.go index a578974..2517622 100644 --- a/seeder.go +++ b/seeder.go @@ -5,6 +5,7 @@ import ( "log" "net" "strconv" + "strings" "sync" "time" @@ -105,12 +106,14 @@ func (s *dnsseeder) initSeeder() { } } - // load one ip address into system and start crawling from it + // load ip addresses into system and start crawling from them if len(s.theList) == 0 && s.initialIP != "" { - if newIP := net.ParseIP(s.initialIP); newIP != nil { - // 1 at the end is the services flag - if x := s.addNa(wire.NewNetAddressIPPort(newIP, s.port, 1)); x == true { - log.Printf("%s: crawling with initial IP %s \n", s.name, s.initialIP) + for _, initialIP := range strings.Split(s.initialIP, ",") { + if newIP := net.ParseIP(initialIP); newIP != nil { + // 1 at the end is the services flag + if x := s.addNa(wire.NewNetAddressIPPort(newIP, s.port, 1)); x == true { + log.Printf("%s: crawling with initial IP %s \n", s.name, s.initialIP) + } } } }