types

package
v1.1.0 Latest Latest
Warning

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

Go to latest
Published: May 15, 2022 License: GPL-3.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// PingSignal represents a ping signal to a peer
	PingSignal = byte(0x0)

	// PongSignal represents a pong respond to a peer
	PongSignal = byte(0x1)
)

Variables

This section is empty.

Functions

func GetTestListener

func GetTestListener(port int) net.Listener

GetTestListener returns a net.Listener instance

func GetTestNetconn

func GetTestNetconn(port int) net.Conn

GetTestNetconn returns a net.Conn instance

func GetTestRandPubKey

func GetTestRandPubKey() *crypto.PublicKey

GetTestRandPubKey returns a randomly generated public key

Types

type Message

type Message struct {
	PeerID    string
	ChannelID common.ChannelIDEnum
	Content   interface{}
}

Message models the message sent/received through the P2P network

type NodeInfo

type NodeInfo struct {
	PrivKey     *crypto.PrivateKey `rlp:"-"`
	PubKey      *crypto.PublicKey  `rlp:"-"`
	PubKeyBytes common.Bytes       // needed for RLP serialization
	Port        uint16
}

NodeInfo provides the information of the corresponding blockchain node of the peer

func CreateLocalNodeInfo

func CreateLocalNodeInfo(privateKey *crypto.PrivateKey, port uint16) NodeInfo

CreateLocalNodeInfo creates an instance of NodeInfo

func CreateNodeInfo

func CreateNodeInfo(pubKey *crypto.PublicKey, port uint16) NodeInfo

CreateNodeInfo creates an instance of NodeInfo

type StackError

type StackError struct {
	Err   interface{}
	Stack []byte
}

func (StackError) Error

func (se StackError) Error() string

func (StackError) String

func (se StackError) String() string

Jump to

Keyboard shortcuts

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