Documentation ¶
Overview ¶
- Copyright (C) 2018 The ontology Authors
- This file is part of The ontology library. *
- The ontology is free software: you can redistribute it and/or modify
- it under the terms of the GNU Lesser General Public License as published by
- the Free Software Foundation, either version 3 of the License, or
- (at your option) any later version. *
- The ontology is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU Lesser General Public License for more details. *
- You should have received a copy of the GNU Lesser General Public License
- along with The ontology. If not, see <http://www.gnu.org/licenses/>.
Package p2p provides an network interface
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type AddressFilter ¶ added in v1.11.0
func AllAddrFilter ¶ added in v1.11.0
func AllAddrFilter() AddressFilter
func CombineAddrFilter ¶ added in v1.11.0
func CombineAddrFilter(filter1, filter2 AddressFilter) AddressFilter
func NoneAddrFilter ¶ added in v1.11.0
func NoneAddrFilter() AddressFilter
type Context ¶ added in v1.10.0
type Context struct { MsgSize uint32 // contains filtered or unexported fields }
func NewContext ¶ added in v1.10.0
type HostAddrDetected ¶ added in v1.11.0
type HostAddrDetected struct { ListenAddr string // contains filtered or unexported fields }
type NetworkStart ¶ added in v1.10.0
type NetworkStart struct {
// contains filtered or unexported fields
}
type NetworkStop ¶ added in v1.10.0
type NetworkStop struct {
// contains filtered or unexported fields
}
type P2P ¶
type P2P interface { Connect(addr string) GetHostInfo() *peer.PeerInfo GetID() common.PeerId GetNeighbors() []*peer.Peer GetNeighborAddrs() []common.PeerAddr GetConnectionCnt() uint32 GetMaxPeerBlockHeight() uint64 GetPeer(id common.PeerId) *peer.Peer SetHeight(uint64) Send(p *peer.Peer, msg types.Message) error SendTo(p common.PeerId, msg types.Message) GetOutConnRecordLen() uint Broadcast(msg types.Message) IsOwnAddress(addr string) bool }
P2P represent the net interface of p2p package
type PeerConnected ¶ added in v1.10.0
type PeerDisConnected ¶ added in v1.10.0
type Protocol ¶ added in v1.10.0
type Protocol interface { HandlePeerMessage(ctx *Context, msg types.Message) HandleSystemMessage(net P2P, msg SystemMessage) }
type SystemMessage ¶ added in v1.10.0
type SystemMessage interface {
// contains filtered or unexported methods
}
Click to show internal directories.
Click to hide internal directories.