package hmyapi import ( "github.com/ethereum/go-ethereum/common/hexutil" "github.com/ethereum/go-ethereum/p2p" ) // PublicNetAPI offers network related RPC methods type PublicNetAPI struct { net *p2p.Server networkVersion uint64 } // NewPublicNetAPI creates a new net API instance. func NewPublicNetAPI(net *p2p.Server, networkVersion uint64) *PublicNetAPI { return &PublicNetAPI{net, networkVersion} } // PeerCount returns the number of connected peers func (s *PublicNetAPI) PeerCount() hexutil.Uint { return hexutil.Uint(s.net.PeerCount()) }