wire

package
v0.10.2 Latest Latest
Warning

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

Go to latest
Published: Jul 15, 2022 License: Apache-2.0 Imports: 4 Imported by: 0

Documentation

Overview

Package wire contains the implementation of the wire interfaces.

Index

Constants

View Source
const AddrLen = 32

AddrLen is the length of an address in byte.

Variables

This section is empty.

Functions

This section is empty.

Types

type Account

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

Account is a wire account.

func NewRandomAccount

func NewRandomAccount(rng *rand.Rand) *Account

NewRandomAccount generates a new random account.

func (*Account) Address

func (acc *Account) Address() wire.Address

Address returns the account's address.

type Address

type Address [AddrLen]byte

Address is a wire address.

func NewAddress

func NewAddress() *Address

NewAddress returns a new address.

func NewRandomAddress

func NewRandomAddress(rng *rand.Rand) *Address

NewRandomAddress returns a new random peer address.

func (Address) Cmp

func (a Address) Cmp(b wire.Address) int

Cmp compares the byte representation of two addresses. For `a.Cmp(b)` returns -1 if a < b, 0 if a == b, 1 if a > b.

func (Address) Equal

func (a Address) Equal(b wire.Address) bool

Equal returns whether the two addresses are equal.

func (Address) MarshalBinary

func (a Address) MarshalBinary() (data []byte, err error)

MarshalBinary marshals the address to binary.

func (*Address) UnmarshalBinary

func (a *Address) UnmarshalBinary(data []byte) error

UnmarshalBinary unmarshals an address from binary.

Jump to

Keyboard shortcuts

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