Documentation ¶
Index ¶
- Variables
- func ReqBeaconMetadata(ctx context.Context, wg *sync.WaitGroup, h host.Host, peerID peer.ID, ...)
- func ReqBeaconStatus(ctx context.Context, wg *sync.WaitGroup, h host.Host, peerID peer.ID, ...)
- func ReqHostInfo(ctx context.Context, wg *sync.WaitGroup, h host.Host, ...)
- type BasicLibp2pHost
- func (b *BasicLibp2pHost) ConnEventNotChannel() chan ConnectionEvent
- func (b *BasicLibp2pHost) Ctx() context.Context
- func (b *BasicLibp2pHost) Host() host.Host
- func (b *BasicLibp2pHost) IdentEventNotChannel() chan IdentificationEvent
- func (b *BasicLibp2pHost) RecConnEvent(connEvent ConnectionEvent)
- func (b *BasicLibp2pHost) RecIdentEvent(identEvent IdentificationEvent)
- func (c *BasicLibp2pHost) SetCustomNotifications() error
- func (b *BasicLibp2pHost) Start()
- type ConnectionEvent
- type HostWithIDService
- type IdentificationEvent
Constants ¶
This section is empty.
Variables ¶
var ( DefaultIP string = "0.0.0.0" DefaultTCP string = "12345" DefaultUDP string = "12345" DefaultUserAgent string = "BSC-Armiarma-Crawler" )
Include all the host default configurations
var ( ModuleName = "LIBP2P-HOST" ConnNotChannSize = 200 )
Functions ¶
func ReqBeaconMetadata ¶
func ReqBeaconMetadata(ctx context.Context, wg *sync.WaitGroup, h host.Host, peerID peer.ID, meta *common.MetaData, finErr chan error)
ReqBeaconMetadata: Function that opens a new Stream from the given host to send a RPC requesting the BeaconStatus of the given peer.ID. Returns the BeaconStatus of the given peer if succeed, error if failed. @param ctx: parent context. @param wg: wait group to notify when function has been done. @param h: host to use to connect. @param peerID: who to connect to. @param meta: where to deserialize the content of the beacon metadata: output. @param finErr: error channel.
func ReqBeaconStatus ¶
func ReqBeaconStatus(ctx context.Context, wg *sync.WaitGroup, h host.Host, peerID peer.ID, stat *common.Status, finErr chan error)
ReqBeaconStatus: Function that opens a new Stream from the given host to send a RPC requesting the BeaconStatus of the given peer.ID. Returns the BeaconStatus of the given peer if succeed, error if failed. @param ctx: parent context. @param wg: wait group to notify when function has been done. @param h: host to use to connect. @param peerID: who to connect to. @param stat: where to deserialize the content of the beacon status: output. @param finErr: error channel.
Types ¶
type BasicLibp2pHost ¶
type BasicLibp2pHost struct { Network string PeerStore *db.PeerStore IpLocator *apis.PeerLocalizer // contains filtered or unexported fields }
Struct that defines the Basic Struct asociated to the Libtp2p host
func NewBasicLibp2pEth2Host ¶ added in v1.1.0
func NewBasicLibp2pEth2Host(ctx context.Context, infObj info.Eth2InfoData, ipLocator *apis.PeerLocalizer, ps *db.PeerStore) (*BasicLibp2pHost, error)
NewBasicLibp2pEth2Host: Generate a new Libp2p host from the given context and Options, for Eth2 network (or similar). @param ctx: the parent context @param infoObj: the info object containig our source of information (user parameters). @param ipLocator: object to get ip information. @param ps: peerstore where to store information.
func NewBasicLibp2pIpfsHost ¶ added in v1.1.0
func NewBasicLibp2pIpfsHost(ctx context.Context, infObj info.IpfsInfoData, ipLocator *apis.PeerLocalizer, ps *db.PeerStore) (*BasicLibp2pHost, error)
NewBasicLibp2pFilecoinHost: Generate a new Libp2p host from the given context and Options, for Filecoin network. @param ctx: the parent context @param infoObj: the info object containig our source of information (user parameters). @param ipLocator: object to get ip information. @param ps: peerstore where to store information.
func (*BasicLibp2pHost) ConnEventNotChannel ¶
func (b *BasicLibp2pHost) ConnEventNotChannel() chan ConnectionEvent
func (*BasicLibp2pHost) Ctx ¶
func (b *BasicLibp2pHost) Ctx() context.Context
func (*BasicLibp2pHost) Host ¶
func (b *BasicLibp2pHost) Host() host.Host
func (*BasicLibp2pHost) IdentEventNotChannel ¶
func (b *BasicLibp2pHost) IdentEventNotChannel() chan IdentificationEvent
func (*BasicLibp2pHost) RecConnEvent ¶
func (b *BasicLibp2pHost) RecConnEvent(connEvent ConnectionEvent)
RecConnEvent Record Connection Event @param connEvent: the event to insert in the notification channel
func (*BasicLibp2pHost) RecIdentEvent ¶
func (b *BasicLibp2pHost) RecIdentEvent(identEvent IdentificationEvent)
RecIdentEvent Record Identification Event @param identEvent: the event to insert in the notification channel
func (*BasicLibp2pHost) SetCustomNotifications ¶
func (c *BasicLibp2pHost) SetCustomNotifications() error
SetCustomNotifications: Set all notification handlers
func (*BasicLibp2pHost) Start ¶
func (b *BasicLibp2pHost) Start()
Start: Start the libp2pHost module (perhaps NOT NECESSARY). So far, start listening on the fullMultiAddrs.
type ConnectionEvent ¶
type ConnectionEvent struct { ConnType int8 // (0)-Empty (1)-Connection (2)-Disconnection Peer models.Peer // TODO: right now just sending the entire info about the peer, (recheck after Peer struct subdivision) Timestamp time.Time // Timestamp of when was the attempt done }
ConnectionEvent It is the struct that compiles the data of a received a connection from the host The struct will be shared between peering and strategy.