identify

package
v0.0.0-...-34879f3 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Dec 15, 2022 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type CallBack

type CallBack interface {
	// Received custom message
	ReceivedIdentify(*tentacle.ProtocolContextRef, []byte) *MisbehaveResult
	// Get custom identify message
	Identify() []byte
	// Get local listen addresses
	LocalListenAddrs() []multiaddr.Multiaddr
	// Add remote peer's listen addresses
	AddRemoteListenAddrs(secio.PeerID, []multiaddr.Multiaddr)
	// Add our address observed by remote peer
	AddObservedAddr(secio.PeerID, multiaddr.Multiaddr, tentacle.SessionType) *MisbehaveResult
	// Report misbehavior
	Misbehave(secio.PeerID, Misbehavior) *MisbehaveResult
}

CallBack to communicate with underlying peer storage

type MisbehaveResult

type MisbehaveResult struct {
	// contains filtered or unexported fields
}

MisbehaveResult report result

func Continue

func Continue() *MisbehaveResult

Continue to run

func Disconnect

func Disconnect() *MisbehaveResult

Disconnect this peer

type Misbehavior

type Misbehavior struct {
	// contains filtered or unexported fields
}

Misbehavior to report to underlying peer storage

func (*Misbehavior) String

func (m *Misbehavior) String() string

type Protocol

type Protocol struct {
	// contains filtered or unexported fields
}

Protocol identify protocol stuct

func NewProtocol

func NewProtocol(callback CallBack) *Protocol

NewProtocol create a identify protocol

func (*Protocol) Connected

func (p *Protocol) Connected(ctx *tentacle.ProtocolContextRef, version string)

Connected ..

func (*Protocol) Disconnected

func (p *Protocol) Disconnected(ctx *tentacle.ProtocolContextRef)

Disconnected ..

func (*Protocol) GlobalIPOnly

func (p *Protocol) GlobalIPOnly(globalIPOnly bool) *Protocol

GlobalIPOnly turning off global ip only mode will allow any ip to be broadcast, default is true

func (*Protocol) Init

func (p *Protocol) Init(ctx *tentacle.ProtocolContext)

Init ..

func (*Protocol) Notify

func (p *Protocol) Notify(ctx *tentacle.ProtocolContext, token uint64)

Notify ..

func (*Protocol) Received

func (p *Protocol) Received(ctx *tentacle.ProtocolContextRef, data []byte)

Received ..

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL