forked from cerc-io/plugeth
Merge branch 'develop' of github.com-obscure:ethereum/eth-go into develop
This commit is contained in:
commit
8ec1bb382a
21
ethereum.go
21
ethereum.go
@ -325,8 +325,21 @@ func (s *Ethereum) Start(seed bool) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (s *Ethereum) Seed() {
|
func (s *Ethereum) Seed() {
|
||||||
ethutil.Config.Log.Debugln("Seeding")
|
ethutil.Config.Log.Debugln("[SERV] Retrieving seed nodes")
|
||||||
// DNS Bootstrapping
|
|
||||||
|
// Eth-Go Bootstrapping
|
||||||
|
ips, er := net.LookupIP("seed.bysh.me")
|
||||||
|
if er == nil {
|
||||||
|
peers := []string{}
|
||||||
|
for _, ip := range ips {
|
||||||
|
node := fmt.Sprintf("%s:%d", ip.String(), 30303)
|
||||||
|
ethutil.Config.Log.Debugln("[SERV] Found DNS Go Peer:", node)
|
||||||
|
peers = append(peers, node)
|
||||||
|
}
|
||||||
|
s.ProcessPeerList(peers)
|
||||||
|
}
|
||||||
|
|
||||||
|
// Official 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{}
|
||||||
@ -340,11 +353,11 @@ func (s *Ethereum) Seed() {
|
|||||||
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, port)
|
peer := net.JoinHostPort(a, port)
|
||||||
log.Println("Found DNS Bootstrap Peer:", peer)
|
ethutil.Config.Log.Debugln("[SERV] Found DNS Bootstrap Peer:", peer)
|
||||||
peers = append(peers, peer)
|
peers = append(peers, peer)
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
log.Println("Couldn't resolve :", target)
|
ethutil.Config.Log.Debugln("[SERV} Couldn't resolve :", target)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// Connect to Peer list
|
// Connect to Peer list
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
package ethrpc
|
package ethrpc
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
"fmt"
|
||||||
"github.com/ethereum/eth-go/ethpub"
|
"github.com/ethereum/eth-go/ethpub"
|
||||||
"github.com/ethereum/eth-go/ethutil"
|
"github.com/ethereum/eth-go/ethutil"
|
||||||
"net"
|
"net"
|
||||||
@ -48,15 +49,16 @@ func (s *JsonRpcServer) Start() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func NewJsonRpcServer(ethp *ethpub.PEthereum) *JsonRpcServer {
|
func NewJsonRpcServer(ethp *ethpub.PEthereum, port int) (*JsonRpcServer, error) {
|
||||||
l, err := net.Listen("tcp", ":30304")
|
sport := fmt.Sprintf(":%d", port)
|
||||||
|
l, err := net.Listen("tcp", sport)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
ethutil.Config.Log.Infoln("Error starting JSON-RPC")
|
return nil, err
|
||||||
}
|
}
|
||||||
|
|
||||||
return &JsonRpcServer{
|
return &JsonRpcServer{
|
||||||
listener: l,
|
listener: l,
|
||||||
quit: make(chan bool),
|
quit: make(chan bool),
|
||||||
ethp: ethp,
|
ethp: ethp,
|
||||||
}
|
}, nil
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user