common

package
v1.0.24 Latest Latest
Warning

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

Go to latest
Published: Jun 20, 2023 License: ISC Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func FastSum256

func FastSum256(data []byte) [32]byte

FastSum256 returns a hash sum of the input data using highwayhash. This method is not secure, but may be used as a quick identifier for objects where collisions are acceptable.

func FastSum64

func FastSum64(data []byte) uint64

FastSum64 returns a hash sum of the input data using highwayhash. This method is not secure, but may be used as a quick identifier for objects where collisions are acceptable.

Types

type Config

type Config struct {
	NoDiscovery          bool
	EnableUPnP           bool
	StaticPeers          []string
	BootstrapNodeAddr    []string
	Discv5BootStrapAddr  []string
	DataDir              string
	MaxPeers             uint
	MaxInbound           int
	MetaDataDir          string
	ReadWritePermissions os.FileMode
	AllowListCIDR        string
	DenyListCIDR         []string
	TCPPort              uint
	UDPPort              uint
	EnableNoise          bool
	RelayNodeAddr        string
	LocalIP              string
	HostAddress          string
	HostDNS              string
	PrivateKey           string
	Encoding             string
	// ProtocolVersion specifies the maximum protocol version to use and
	// advertise.
	ProtocolVersion uint32
	Services        protocol.ServiceFlag
	UserAgent       string
	// DisableRelayTx specifies if the remote peer should be informed to
	// not send inv messages for transactions.
	DisableRelayTx bool
	MaxOrphanTxs   int
	Params         *params.Params
	Banning        bool // Open or not ban module
	DisableListen  bool
	LANPeers       []string
	IsCircuit      bool
	Consistency    bool
}

Config for the p2p service. to initialize the p2p service.

type Error

type Error struct {
	Code  ErrorCode
	Error error
}

func NewError

func NewError(code ErrorCode, e error) *Error

func NewErrorStr added in v1.0.21

func NewErrorStr(code ErrorCode, e string) *Error

func NewSuccess added in v1.0.21

func NewSuccess() *Error

func (*Error) Add added in v1.0.21

func (e *Error) Add(err string)

func (*Error) AddError added in v1.0.21

func (e *Error) AddError(err error)

func (*Error) String added in v1.0.21

func (e *Error) String() string

func (*Error) ToError added in v1.0.21

func (e *Error) ToError() error

type ErrorCode

type ErrorCode int

ErrorCode identifies a kind of error.

const (
	// There are no errors by default
	ErrNone ErrorCode = iota

	// p2p stream write error
	ErrStreamWrite

	// p2p stream read error
	ErrStreamRead

	// p2p stream base error
	ErrStreamBase

	// p2p peer unknown error
	ErrPeerUnknown

	// p2p peer bad error
	ErrBadPeer

	// p2p DAG consensus error
	ErrDAGConsensus

	// p2p message error
	ErrMessage

	// Generic rule error
	ErrGeneric

	// peer connect frequent
	ErrConnectFrequent

	// Sequence error
	ErrSequence

	// revalidate error
	ErrRevalidate

	// libp2p connect
	ErrLibp2pConnect
)

func (ErrorCode) IsDAGConsensus added in v1.0.21

func (e ErrorCode) IsDAGConsensus() bool

func (ErrorCode) IsStream added in v1.0.21

func (e ErrorCode) IsStream() bool

func (ErrorCode) IsSuccess

func (e ErrorCode) IsSuccess() bool

func (ErrorCode) String

func (e ErrorCode) String() string

type QMultiaddr

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

func QMultiAddrFromString

func QMultiAddrFromString(address string) (*QMultiaddr, error)

func (*QMultiaddr) String

func (qm *QMultiaddr) String() string

Jump to

Keyboard shortcuts

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