aboutsummaryrefslogtreecommitdiffstats
path: root/eth/backend.go
diff options
context:
space:
mode:
Diffstat (limited to 'eth/backend.go')
-rw-r--r--eth/backend.go60
1 files changed, 4 insertions, 56 deletions
diff --git a/eth/backend.go b/eth/backend.go
index 0683705df..9eb211e31 100644
--- a/eth/backend.go
+++ b/eth/backend.go
@@ -467,62 +467,10 @@ func New(config *Config) (*Ethereum, error) {
return eth, nil
}
-type NodeInfo struct {
- Name string
- NodeUrl string
- NodeID string
- IP string
- DiscPort int // UDP listening port for discovery protocol
- TCPPort int // TCP listening port for RLPx
- Td string
- ListenAddr string
-}
-
-func (s *Ethereum) NodeInfo() *NodeInfo {
- node := s.net.Self()
-
- return &NodeInfo{
- Name: s.Name(),
- NodeUrl: node.String(),
- NodeID: node.ID.String(),
- IP: node.IP.String(),
- DiscPort: int(node.UDP),
- TCPPort: int(node.TCP),
- ListenAddr: s.net.ListenAddr,
- Td: s.BlockChain().GetTd(s.BlockChain().CurrentBlock().Hash()).String(),
- }
-}
-
-type PeerInfo struct {
- ID string
- Name string
- Caps string
- RemoteAddress string
- LocalAddress string
-}
-
-func newPeerInfo(peer *p2p.Peer) *PeerInfo {
- var caps []string
- for _, cap := range peer.Caps() {
- caps = append(caps, cap.String())
- }
- return &PeerInfo{
- ID: peer.ID().String(),
- Name: peer.Name(),
- Caps: strings.Join(caps, ", "),
- RemoteAddress: peer.RemoteAddr().String(),
- LocalAddress: peer.LocalAddr().String(),
- }
-}
-
-// PeersInfo returns an array of PeerInfo objects describing connected peers
-func (s *Ethereum) PeersInfo() (peersinfo []*PeerInfo) {
- for _, peer := range s.net.Peers() {
- if peer != nil {
- peersinfo = append(peersinfo, newPeerInfo(peer))
- }
- }
- return
+// Network retrieves the underlying P2P network server. This should eventually
+// be moved out into a protocol independent package, but for now use an accessor.
+func (s *Ethereum) Network() *p2p.Server {
+ return s.net
}
func (s *Ethereum) ResetWithGenesisBlock(gb *types.Block) {