Documentation ¶
Index ¶
- Constants
- Variables
- type P2P
- func (p *P2P) Config() clienttypes.ConfigClient
- func (p *P2P) GetNumPeers() (uint, error)
- func (p *P2P) GetSyncer() (clienttypes.InterfaceSync, error)
- func (p *P2P) IsStarted() bool
- func (p *P2P) On(event p2ptypes.EventEnum, cb clienttypes.EventCallback)
- func (p *P2P) Start() error
- func (p *P2P) Stop() error
Constants ¶
View Source
const ( // Version is the semvar version of the build. Version string = "0.0.0" )
Variables ¶
View Source
var ( // ErrNoPeersService ... ErrNoPeersService = errors.New("the p2p service has no peers service") // ErrUninitializedService ... ErrUninitializedService = errors.New("the p2p service has not been initialized") // ErrNoConfig ... ErrNoConfig = errors.New("a config is required") // ErrNoChainService ... ErrNoChainService = errors.New("a chain service is required") // ErrNoHost ... ErrNoHost = errors.New("the p2p service has no host") // ErrNoPublicKey ... ErrNoPublicKey = errors.New("the p2p service has no public key associated with it") )
View Source
var DefaultAddress = fmt.Sprintf("/ip4/0.0.0.0/tcp/%v", DefaultPort)
DefaultAddress ...
View Source
var DefaultClientID = "golkadot/0.0.0"
DefaultClientID ...
View Source
var DefaultMaxPeers uint = 25
DefaultMaxPeers ...
View Source
var DefaultMaxQueuedBlocks = DefaultMaxRequestBlocks * 8
DefaultMaxQueuedBlocks ...
View Source
var DefaultMaxRequestBlocks uint = 64
DefaultMaxRequestBlocks ...
View Source
var DefaultMinIdleBlocks = 16
DefaultMinIdleBlocks ...
View Source
var DefaultPort uint = 30333
DefaultPort ...
View Source
var DefaultProtocolBase = "/substrate"
DefaultProtocolBase ... TODO: change...
View Source
var DefaultProtocolDot = fmt.Sprintf("%s%s/%d", DefaultProtocolBase, DefaultProtocolType, DefaultProtocolVersion)
DefaultProtocolDot ...
View Source
var DefaultProtocolPing = "/ipfs/ping/1.0.0"
DefaultProtocolPing ...
View Source
var DefaultProtocolType = "/sup"
DefaultProtocolType ...
View Source
var DefaultProtocolVersion = 1
DefaultProtocolVersion ...
View Source
var DefaultRole = "full"
DefaultRole ...
Functions ¶
This section is empty.
Types ¶
type P2P ¶
type P2P struct {
// contains filtered or unexported fields
}
P2P implements the p2p interface
func NewP2P ¶
func NewP2P(ctx context.Context, cancel context.CancelFunc, ch chan interface{}, cfg *clienttypes.ConfigClient, c clienttypes.InterfaceChains) (*P2P, error)
NewP2P builds a new p2p service
func (*P2P) On ¶
func (p *P2P) On(event p2ptypes.EventEnum, cb clienttypes.EventCallback)
On handles messages
Click to show internal directories.
Click to hide internal directories.