protocol

package
v0.9.2 Latest Latest
Warning

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

Go to latest
Published: Jun 14, 2024 License: MIT Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ID

type ID [20]byte

func MustNewIDFromByteSlice

func MustNewIDFromByteSlice(b []byte) ID

func MustParseID

func MustParseID(str string) ID

func NewIDFromByteSlice

func NewIDFromByteSlice(b []byte) (id ID, _ error)

func NewIDFromRawString

func NewIDFromRawString(s string) (id ID)

func ParseID

func ParseID(str string) (ID, error)

func RandomNodeID

func RandomNodeID() (id ID)

func RandomNodeIDWithClientSuffix added in v0.3.0

func RandomNodeIDWithClientSuffix() (id ID)

RandomNodeIDWithClientSuffix generates a node ID for the DHT client. We use a random byte string with the client ID encoded at the end, to allow identifying other bitmagnet instances in the wild. A suffix is used instead of a prefix, which would be incompatible with DHT, where ID prefixes are used for computing the distance metric).

func RandomPeerID

func RandomPeerID() ID

func (ID) Bytes

func (id ID) Bytes() []byte

func (ID) GetBit

func (id ID) GetBit(i int) bool

func (ID) Int160

func (id ID) Int160() Int160

func (ID) IsZero

func (id ID) IsZero() bool

func (ID) MarshalBencode

func (id ID) MarshalBencode() ([]byte, error)

func (ID) MarshalBinary

func (b ID) MarshalBinary() ([]byte, error)

func (ID) MarshalGQL

func (b ID) MarshalGQL(w io.Writer)

func (ID) MarshalJSON

func (b ID) MarshalJSON() ([]byte, error)

func (*ID) Scan

func (b *ID) Scan(value interface{}) error

func (ID) String

func (id ID) String() string

func (*ID) UnmarshalBencode

func (id *ID) UnmarshalBencode(b []byte) error

func (*ID) UnmarshalBinary

func (b *ID) UnmarshalBinary(data []byte) error

func (*ID) UnmarshalGQL

func (b *ID) UnmarshalGQL(input interface{}) error

func (*ID) UnmarshalJSON

func (b *ID) UnmarshalJSON(data []byte) error

func (ID) Value

func (b ID) Value() (driver.Value, error)

type Int160

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

func NewInt160FromByteArray

func NewInt160FromByteArray(b [20]byte) (ret Int160)

func (Int160) AsByteArray

func (i Int160) AsByteArray() [20]byte

func (Int160) BitLen

func (i Int160) BitLen() int

func (Int160) ByteString

func (i Int160) ByteString() string

func (Int160) Bytes

func (i Int160) Bytes() []byte

func (Int160) Cmp

func (i Int160) Cmp(r Int160) int

func (Int160) Distance

func (i Int160) Distance(b Int160) (ret Int160)

func (Int160) GetBit

func (i Int160) GetBit(index int) bool

func (Int160) IsZero

func (i Int160) IsZero() bool

func (Int160) String

func (i Int160) String() string

func (Int160) WithBit

func (i Int160) WithBit(index int, val bool) Int160

func (Int160) WithMax

func (i Int160) WithMax() Int160

func (Int160) Xor

func (i Int160) Xor(b1, b2 Int160) Int160

type MutableID

type MutableID ID

func (*MutableID) SetBit

func (id *MutableID) SetBit(i int, v bool)

Jump to

Keyboard shortcuts

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