beaconnet

package
v0.0.7 Latest Latest
Warning

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

Go to latest
Published: Dec 12, 2022 License: GPL-3.0 Imports: 12 Imported by: 1

Documentation

Index

Constants

View Source
const (
	TypeData   = uint8(0)
	TypeBeacon = uint8(1)
)
View Source
const (
	HeaderSize = 1 + 32 + 32
)

Variables

This section is empty.

Functions

func Factory

func Factory(params mesh256.NetworkParams) mesh256.Network

func NewRouter added in v0.0.4

func NewRouter(log *slog.Logger) neteng.Router

Types

type Beacon

type Beacon struct {
	PublicKey []byte `json:"public_key"`
	Counter   uint64 `json:"counter"`
	Sig       []byte `json:"sig"`
}
type Header [HeaderSize]byte

func ParseMessage

func ParseMessage(data []byte) (Header, []byte, error)

func (*Header) GetDst

func (h *Header) GetDst() inet256.Addr

func (*Header) GetSrc

func (h *Header) GetSrc() inet256.Addr

func (*Header) GetType

func (h *Header) GetType() uint8

func (*Header) SetDst

func (h *Header) SetDst(x inet256.Addr)

func (*Header) SetSrc

func (h *Header) SetSrc(x inet256.Addr)

func (*Header) SetType

func (h *Header) SetType(x uint8)

func (*Header) String

func (h *Header) String() string

type Network

type Network struct {
	*neteng.Network
	// contains filtered or unexported fields
}

func New

func New(params mesh256.NetworkParams) *Network

type Router added in v0.0.4

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

func (*Router) FindAddr added in v0.0.4

func (r *Router) FindAddr(send neteng.SendFunc, info neteng.InfoFunc, prefix []byte, nbits int)

func (*Router) HandleAbove added in v0.0.4

func (r *Router) HandleAbove(dst inet256.Addr, data p2p.IOVec, send neteng.SendFunc) bool

func (*Router) HandleBelow added in v0.0.4

func (r *Router) HandleBelow(from inet256.Addr, data []byte, send neteng.SendFunc, deliver neteng.DeliverFunc, info neteng.InfoFunc)

func (*Router) Heartbeat added in v0.0.4

func (r *Router) Heartbeat(now time.Time, send neteng.SendFunc)

func (*Router) LookupPublicKey added in v0.0.4

func (r *Router) LookupPublicKey(send neteng.SendFunc, info neteng.InfoFunc, target inet256.Addr)

func (*Router) Reset added in v0.0.4

func (r *Router) Reset(privateKey inet256.PrivateKey, peers mesh256.PeerSet, getPublicKey neteng.PublicKeyFunc, now time.Time)

Jump to

Keyboard shortcuts

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