You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

34 lines
910 B

  1. package core
  2. import (
  3. ctypes "github.com/tendermint/tendermint/rpc/core/types"
  4. )
  5. //-----------------------------------------------------------------------------
  6. func NetInfo() (*ctypes.ResultNetInfo, error) {
  7. listening := p2pSwitch.IsListening()
  8. listeners := []string{}
  9. for _, listener := range p2pSwitch.Listeners() {
  10. listeners = append(listeners, listener.String())
  11. }
  12. peers := []ctypes.Peer{}
  13. for _, peer := range p2pSwitch.Peers().List() {
  14. peers = append(peers, ctypes.Peer{
  15. NodeInfo: *peer.NodeInfo,
  16. IsOutbound: peer.IsOutbound(),
  17. ConnectionStatus: peer.Connection().Status(),
  18. })
  19. }
  20. return &ctypes.ResultNetInfo{
  21. Listening: listening,
  22. Listeners: listeners,
  23. Peers: peers,
  24. }, nil
  25. }
  26. //-----------------------------------------------------------------------------
  27. func Genesis() (*ctypes.ResultGenesis, error) {
  28. return &ctypes.ResultGenesis{genDoc}, nil
  29. }