protocol

package
v1.0.23 Latest Latest
Warning

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

Go to latest
Published: Jun 16, 2023 License: ISC Imports: 4 Imported by: 1

Documentation

Index

Constants

View Source
const (
	// InitialProcotolVersion is the initial protocol version for the
	// network.
	InitialProcotolVersion uint32 = 42

	// ProtocolVersion is the latest protocol version this package supports.
	ProtocolVersion uint32 = 43
)

Variables

This section is empty.

Functions

func HasServices

func HasServices(advertised, desired ServiceFlag) bool

hasServices returns whether or not the provided advertised service flags have all of the provided desired service flags set.

Types

type HashOrNumber added in v1.0.21

type HashOrNumber struct {
	Hash   *hash.Hash
	Number uint64
}

func NewHashOrNumber added in v1.0.21

func NewHashOrNumber(data string) (*HashOrNumber, error)

func (*HashOrNumber) IsHash added in v1.0.21

func (hn *HashOrNumber) IsHash() bool

func (*HashOrNumber) String added in v1.0.21

func (hn *HashOrNumber) String() string

type Network

type Network uint32

Network represents which qitmeer network a message belongs to.

const (
	// MainNet represents the main network.
	MainNet Network = 0xb4c3dce8

	// TestNet2 represents the test network.
	TestNet Network = 0x35e0c424

	// PrivNet represents the private test network.
	PrivNet Network = 0xf1eb0001

	// MixNet represents the Mix Pow network.
	MixNet Network = 0xc459b247
)

Constants used to indicate the message of network. They can also be used to seek to the next message when a stream's state is unknown, but this package does not provide that functionality since it's generally a better idea to simply disconnect clients that are misbehaving over TCP.

func (Network) String

func (n Network) String() string

String returns the CurrencyNet in human-readable form.

type ServiceFlag

type ServiceFlag uint64

ServiceFlag identifies services supported by a peer node.

const (
	//  full node.
	Full ServiceFlag = 1 << iota

	// light node
	Light

	// a peer supports bloom filtering.
	Bloom

	// a peer supports committed filters (CFs).
	CF

	// Relay
	Relay

	// Observer
	Observer

	// None
	Unknown
)

func MissingServices

func MissingServices(advertised, desired ServiceFlag) ServiceFlag

MissingServices returns what missing service flags from the advertised flags to the desired flags set

func (ServiceFlag) String

func (f ServiceFlag) String() string

String returns the ServiceFlag in human-readable form.

Jump to

Keyboard shortcuts

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