Browse Source

Merge pull request #10 from JeremyRand/multiple-initial

Support multiple initial IP's
master
Lyndsay Roger 3 years ago committed by GitHub
parent
commit
b78cb421a9
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 1
      configs/bitcoin-test.json
  2. 1
      configs/bitcoin.json
  3. 1
      configs/dnsseeder.json
  4. 1
      configs/namecoin.json
  5. 1
      configs/twister.json
  6. 7
      seeder.go

1
configs/bitcoin-test.json

@ -6,6 +6,7 @@
"Pver": 70001, "Pver": 70001,
"DNSName": "btctseed.zagbot.com", "DNSName": "btctseed.zagbot.com",
"TTL": 300, "TTL": 300,
"InitialIP": "0.0.0.0,0.0.0.0",
"Seeder1": "testnet-seed.alexykot.me", "Seeder1": "testnet-seed.alexykot.me",
"Seeder2": "testnet-seed.bitcoin.petertodd.org", "Seeder2": "testnet-seed.bitcoin.petertodd.org",
"Seeder3": "testnet-seed.bluematt.me" "Seeder3": "testnet-seed.bluematt.me"

1
configs/bitcoin.json

@ -6,6 +6,7 @@
"Pver": 70001, "Pver": 70001,
"DNSName": "btcseed.zagbot.com", "DNSName": "btcseed.zagbot.com",
"TTL": 600, "TTL": 600,
"InitialIP": "0.0.0.0,0.0.0.0",
"Seeder1": "dnsseed.bluematt.me", "Seeder1": "dnsseed.bluematt.me",
"Seeder2": "bitseed.xf2.org", "Seeder2": "bitseed.xf2.org",
"Seeder3": "dnsseed.bitcoin.dashjr.org" "Seeder3": "dnsseed.bitcoin.dashjr.org"

1
configs/dnsseeder.json

@ -6,6 +6,7 @@
"Pver": 70001, "Pver": 70001,
"DNSName": "seeder.example.com", "DNSName": "seeder.example.com",
"TTL": 600, "TTL": 600,
"InitialIP": "0.0.0.0,0.0.0.0",
"Seeder1": "seeder1.example.com", "Seeder1": "seeder1.example.com",
"Seeder2": "seed1.bob.com", "Seeder2": "seed1.bob.com",
"Seeder3": "seed2.example.com" "Seeder3": "seed2.example.com"

1
configs/namecoin.json

@ -6,6 +6,7 @@
"Pver": 70001, "Pver": 70001,
"DNSName": "dnsseed.nmctest.net", "DNSName": "dnsseed.nmctest.net",
"TTL": 600, "TTL": 600,
"InitialIP": "0.0.0.0,0.0.0.0",
"Seeder1": "nmc.seed.quisquis.de", "Seeder1": "nmc.seed.quisquis.de",
"Seeder2": "seed.nmc.markasoftware.com" "Seeder2": "seed.nmc.markasoftware.com"
} }

1
configs/twister.json

@ -6,6 +6,7 @@
"Pver": 60000, "Pver": 60000,
"DNSName": "dnsseed.zagbot.com", "DNSName": "dnsseed.zagbot.com",
"TTL": 600, "TTL": 600,
"InitialIP": "0.0.0.0,0.0.0.0",
"Seeder1": "seed2.twister.net.co", "Seeder1": "seed2.twister.net.co",
"Seeder2": "seed.twister.net.co", "Seeder2": "seed.twister.net.co",
"Seeder3": "seed3.twister.net.co" "Seeder3": "seed3.twister.net.co"

7
seeder.go

@ -5,6 +5,7 @@ import (
"log" "log"
"net" "net"
"strconv" "strconv"
"strings"
"sync" "sync"
"time" "time"
@ -105,15 +106,17 @@ 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 len(s.theList) == 0 && s.initialIP != "" {
if newIP := net.ParseIP(s.initialIP); newIP != nil { for _, initialIP := range strings.Split(s.initialIP, ",") {
if newIP := net.ParseIP(initialIP); newIP != nil {
// 1 at the end is the services flag // 1 at the end is the services flag
if x := s.addNa(wire.NewNetAddressIPPort(newIP, s.port, 1)); x == true { 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) log.Printf("%s: crawling with initial IP %s \n", s.name, s.initialIP)
} }
} }
} }
}
if len(s.theList) == 0 { if len(s.theList) == 0 {
log.Printf("%s: Error: No ip addresses from seeders so I have nothing to crawl.\n", s.name) log.Printf("%s: Error: No ip addresses from seeders so I have nothing to crawl.\n", s.name)

Loading…
Cancel
Save