forked from cerc-io/plugeth
Fix Whitespace
This commit is contained in:
parent
8162aff8cf
commit
e2e338929f
74
ethereum.go
74
ethereum.go
@ -262,46 +262,46 @@ func (s *Ethereum) Start() {
|
|||||||
go s.ReapDeadPeerHandler()
|
go s.ReapDeadPeerHandler()
|
||||||
|
|
||||||
if ethutil.Config.Seed {
|
if ethutil.Config.Seed {
|
||||||
ethutil.Config.Log.Debugln("Seeding")
|
ethutil.Config.Log.Debugln("Seeding")
|
||||||
// DNS Bootstrapping
|
// DNS Bootstrapping
|
||||||
_, nodes, err := net.LookupSRV("eth", "tcp", "ethereum.org")
|
_, nodes, err := net.LookupSRV("eth", "tcp", "ethereum.org")
|
||||||
if(err == nil) {
|
if(err == nil) {
|
||||||
peers := []string{}
|
peers := []string{}
|
||||||
// Iterate SRV nodes
|
// Iterate SRV nodes
|
||||||
for _, n := range nodes {
|
for _, n := range nodes {
|
||||||
target := n.Target
|
target := n.Target
|
||||||
port := n.Port
|
port := n.Port
|
||||||
// Resolve target to ip (Go returns list, so may resolve to multiple ips?)
|
// Resolve target to ip (Go returns list, so may resolve to multiple ips?)
|
||||||
addr, err := net.LookupHost(target)
|
addr, err := net.LookupHost(target)
|
||||||
if(err == nil) {
|
if(err == nil) {
|
||||||
for _, a := range addr {
|
for _, a := range addr {
|
||||||
// Build string out of SRV port and Resolved IP
|
// Build string out of SRV port and Resolved IP
|
||||||
peer := net.JoinHostPort(a, strconv.Itoa(int(port)))
|
peer := net.JoinHostPort(a, strconv.Itoa(int(port)))
|
||||||
log.Println("Found DNS Bootstrap Peer:", peer)
|
log.Println("Found DNS Bootstrap Peer:", peer)
|
||||||
peers = append(peers, peer)
|
peers = append(peers, peer)
|
||||||
}
|
|
||||||
} else {
|
|
||||||
log.Println("Couldn't resolve :", target)
|
|
||||||
}
|
}
|
||||||
|
} else {
|
||||||
|
log.Println("Couldn't resolve :", target)
|
||||||
}
|
}
|
||||||
// Connect to Peer list
|
|
||||||
s.ProcessPeerList(peers)
|
|
||||||
} else {
|
|
||||||
// Fallback to servers.poc3.txt
|
|
||||||
resp, err := http.Get("http://www.ethereum.org/servers.poc3.txt")
|
|
||||||
if err != nil {
|
|
||||||
log.Println("Fetching seed failed:", err)
|
|
||||||
return
|
|
||||||
}
|
|
||||||
defer resp.Body.Close()
|
|
||||||
body, err := ioutil.ReadAll(resp.Body)
|
|
||||||
if err != nil {
|
|
||||||
log.Println("Reading seed failed:", err)
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
s.ConnectToPeer(string(body))
|
|
||||||
}
|
}
|
||||||
|
// Connect to Peer list
|
||||||
|
s.ProcessPeerList(peers)
|
||||||
|
} else {
|
||||||
|
// Fallback to servers.poc3.txt
|
||||||
|
resp, err := http.Get("http://www.ethereum.org/servers.poc3.txt")
|
||||||
|
if err != nil {
|
||||||
|
log.Println("Fetching seed failed:", err)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
defer resp.Body.Close()
|
||||||
|
body, err := ioutil.ReadAll(resp.Body)
|
||||||
|
if err != nil {
|
||||||
|
log.Println("Reading seed failed:", err)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
s.ConnectToPeer(string(body))
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user