aurora

package
v1.2.2 Latest Latest
Warning

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

Go to latest
Published: Jan 18, 2022 License: BSD-3-Clause Imports: 10 Imported by: 16

Documentation

Overview

Package aurora exposes the data structure and operations necessary on the aurora.Address type which used in the handshake protocol, address-book and hive protocol.

Index

Constants

View Source
const (
	FullNode = iota
	BootNode
)

Variables

View Source
var ErrInvalidAddress = errors.New("invalid address")
View Source
var ErrInvalidNodeMode = errors.New("invalid node mode")

Functions

This section is empty.

Types

type Address

type Address struct {
	Underlay  ma.Multiaddr
	Overlay   boson.Address
	Signature []byte
}

Address represents the aurora address in boson. It consists of a peers underlay (physical) address, overlay (topology) address and signature. Signature is used to verify the `Overlay/Underlay` pair, as it is based on `underlay|networkID`, signed with the public key of Overlay address

func NewAddress

func NewAddress(signer crypto.Signer, underlay ma.Multiaddr, overlay boson.Address, networkID uint64) (*Address, error)

func ParseAddress

func ParseAddress(underlay, overlay, signature []byte, networkID uint64) (*Address, error)

func (*Address) Equal

func (a *Address) Equal(b *Address) bool

func (*Address) MarshalJSON

func (a *Address) MarshalJSON() ([]byte, error)

func (*Address) ShortString

func (a *Address) ShortString() string

ShortString returns shortened versions of aurora address in a format: [Overlay, Underlay] It can be used for logging

func (*Address) String

func (a *Address) String() string

func (*Address) UnmarshalJSON

func (a *Address) UnmarshalJSON(b []byte) error

type AddressInfo added in v1.1.0

type AddressInfo struct {
	Address  *Address
	NodeMode Model
}

AddressInfo contains the information received from the handshake.

func (*AddressInfo) LightString added in v1.1.0

func (i *AddressInfo) LightString() string

type BitVectorApi

type BitVectorApi struct {
	Len int    `json:"len"`
	B   []byte `json:"b"`
}

type ChunkInfoOverlay

type ChunkInfoOverlay struct {
	Overlay string       `json:"overlay"`
	Bit     BitVectorApi `json:"bit"`
}

type ChunkInfoSourceApi added in v1.1.6

type ChunkInfoSourceApi struct {
	PyramidSource string           `json:"pyramidSource"`
	ChunkSource   []ChunkSourceApi `json:"chunkSource"`
}

type ChunkSourceApi added in v1.1.6

type ChunkSourceApi struct {
	Overlay  string       `json:"overlay"`
	ChunkBit BitVectorApi `json:"chunkBit"`
}

type FileInfo

type FileInfo struct {
	TreeSize  int          `json:"treeSize"`
	FileSize  int          `json:"fileSize"`
	Bitvector BitVectorApi `json:"bitvector"`
	PinState  bool         `json:"pinState"`
}

type Model added in v1.1.0

type Model struct {
	Bv *bitvector.BitVector
}

func NewModel added in v1.1.3

func NewModel() Model

func NewModelFromBytes added in v1.1.3

func NewModelFromBytes(m []byte) (Model, error)

func (Model) IsBootNode added in v1.1.0

func (m Model) IsBootNode() bool

func (Model) IsFull added in v1.1.0

func (m Model) IsFull() bool

func (Model) SetMode added in v1.1.3

func (m Model) SetMode(md int) Model

func (Model) String added in v1.1.3

func (m Model) String() string

Jump to

Keyboard shortcuts

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