From 0855da80b25220e5fb1ede6cef6d557358b585a1 Mon Sep 17 00:00:00 2001 From: Jeremy Rand Date: Tue, 9 Nov 2021 08:44:56 +0000 Subject: [PATCH 1/2] 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) + } } } } From a491a1f223cf0c63456ba799779efa853c45f569 Mon Sep 17 00:00:00 2001 From: Jeremy Rand Date: Tue, 9 Nov 2021 12:19:53 +0000 Subject: [PATCH 2/2] Add "InitialIP" field to example configs It was too well-hidden otherwise. --- configs/bitcoin-test.json | 1 + configs/bitcoin.json | 1 + configs/dnsseeder.json | 3 ++- configs/namecoin.json | 1 + configs/twister.json | 1 + 5 files changed, 6 insertions(+), 1 deletion(-) diff --git a/configs/bitcoin-test.json b/configs/bitcoin-test.json index 3bde5e0..a7639ce 100644 --- a/configs/bitcoin-test.json +++ b/configs/bitcoin-test.json @@ -6,6 +6,7 @@ "Pver": 70001, "DNSName": "btctseed.zagbot.com", "TTL": 300, + "InitialIP": "0.0.0.0,0.0.0.0", "Seeder1": "testnet-seed.alexykot.me", "Seeder2": "testnet-seed.bitcoin.petertodd.org", "Seeder3": "testnet-seed.bluematt.me" diff --git a/configs/bitcoin.json b/configs/bitcoin.json index 9102659..c67a1d4 100644 --- a/configs/bitcoin.json +++ b/configs/bitcoin.json @@ -6,6 +6,7 @@ "Pver": 70001, "DNSName": "btcseed.zagbot.com", "TTL": 600, + "InitialIP": "0.0.0.0,0.0.0.0", "Seeder1": "dnsseed.bluematt.me", "Seeder2": "bitseed.xf2.org", "Seeder3": "dnsseed.bitcoin.dashjr.org" diff --git a/configs/dnsseeder.json b/configs/dnsseeder.json index ec9609e..c6703af 100644 --- a/configs/dnsseeder.json +++ b/configs/dnsseeder.json @@ -6,7 +6,8 @@ "Pver": 70001, "DNSName": "seeder.example.com", "TTL": 600, + "InitialIP": "0.0.0.0,0.0.0.0", "Seeder1": "seeder1.example.com", "Seeder2": "seed1.bob.com", "Seeder3": "seed2.example.com" -} \ No newline at end of file +} diff --git a/configs/namecoin.json b/configs/namecoin.json index f5d6d14..6ffe47e 100644 --- a/configs/namecoin.json +++ b/configs/namecoin.json @@ -6,6 +6,7 @@ "Pver": 70001, "DNSName": "dnsseed.nmctest.net", "TTL": 600, + "InitialIP": "0.0.0.0,0.0.0.0", "Seeder1": "nmc.seed.quisquis.de", "Seeder2": "seed.nmc.markasoftware.com" } diff --git a/configs/twister.json b/configs/twister.json index 0c72997..2aba9c9 100644 --- a/configs/twister.json +++ b/configs/twister.json @@ -6,6 +6,7 @@ "Pver": 60000, "DNSName": "dnsseed.zagbot.com", "TTL": 600, + "InitialIP": "0.0.0.0,0.0.0.0", "Seeder1": "seed2.twister.net.co", "Seeder2": "seed.twister.net.co", "Seeder3": "seed3.twister.net.co"