Browse Source

Support multiple initial IP's

master^2
Jeremy Rand 3 years ago
parent
commit
0855da80b2
No known key found for this signature in database
GPG Key ID: EB03139A459DD06E
  1. 7
      seeder.go

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