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.
23 lines
566 B
23 lines
566 B
6 years ago
|
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())
|
||
|
}
|