package core
|
|
|
|
import (
|
|
ctypes "github.com/tendermint/tendermint/rpc/core/types"
|
|
)
|
|
|
|
//-----------------------------------------------------------------------------
|
|
|
|
func NetInfo() (*ctypes.ResultNetInfo, error) {
|
|
listening := p2pSwitch.IsListening()
|
|
listeners := []string{}
|
|
for _, listener := range p2pSwitch.Listeners() {
|
|
listeners = append(listeners, listener.String())
|
|
}
|
|
peers := []ctypes.Peer{}
|
|
for _, peer := range p2pSwitch.Peers().List() {
|
|
peers = append(peers, ctypes.Peer{
|
|
NodeInfo: *peer.NodeInfo,
|
|
IsOutbound: peer.IsOutbound(),
|
|
})
|
|
}
|
|
return &ctypes.ResultNetInfo{
|
|
Listening: listening,
|
|
Listeners: listeners,
|
|
Peers: peers,
|
|
}, nil
|
|
}
|
|
|
|
//-----------------------------------------------------------------------------
|
|
|
|
func Genesis() (*ctypes.ResultGenesis, error) {
|
|
return &ctypes.ResultGenesis{genDoc}, nil
|
|
}
|