types

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: May 24, 2021 License: Apache-2.0 Imports: 10 Imported by: 11

Documentation

Index

Constants

View Source
const SignatureWithHopMinSize = ed25519.PublicKeySize + ed25519.SignatureSize + 1

Variables

View Source
var FrameMagicBytes = []byte{0x70, 0x69, 0x6e, 0x65}

Functions

This section is empty.

Types

type DHTNode

type DHTNode struct {
	PublicKey   PublicKey
	Coordinates SwitchPorts
}

func (*DHTNode) MarshalBinary

func (n *DHTNode) MarshalBinary(buffer []byte) (int, error)

func (*DHTNode) UnmarshalBinary

func (n *DHTNode) UnmarshalBinary(buffer []byte) (int, error)

type DHTQueryRequest

type DHTQueryRequest struct {
	RequestID [8]byte
	PublicKey [ed25519.PublicKeySize]byte
}

func (*DHTQueryRequest) MarshalBinary

func (r *DHTQueryRequest) MarshalBinary(buffer []byte) (int, error)

func (*DHTQueryRequest) UnmarshalBinary

func (r *DHTQueryRequest) UnmarshalBinary(buffer []byte) (int, error)

type DHTQueryResponse

type DHTQueryResponse struct {
	RequestID [8]byte
	Results   []DHTNode
	PublicKey [ed25519.PublicKeySize]byte
}

func (*DHTQueryResponse) MarshalBinary

func (r *DHTQueryResponse) MarshalBinary(buffer []byte, private ed25519.PrivateKey) (int, error)

func (*DHTQueryResponse) UnmarshalBinary

func (r *DHTQueryResponse) UnmarshalBinary(buffer []byte) (int, error)

type Frame

type Frame struct {
	Version        FrameVersion
	Type           FrameType
	Destination    SwitchPorts
	DestinationKey PublicKey
	Source         SwitchPorts
	SourceKey      PublicKey
	Payload        []byte
	// contains filtered or unexported fields
}

func GetFrame

func GetFrame() *Frame

func (*Frame) Borrow

func (f *Frame) Borrow() *Frame

func (*Frame) Copy

func (f *Frame) Copy() *Frame

func (*Frame) Done

func (f *Frame) Done() bool

func (*Frame) MarshalBinary

func (f *Frame) MarshalBinary(buffer []byte) (int, error)

func (*Frame) Reset

func (f *Frame) Reset()

func (*Frame) UnmarshalBinary

func (f *Frame) UnmarshalBinary(data []byte) (int, error)

func (*Frame) UpdateSourceRoutedPath

func (f *Frame) UpdateSourceRoutedPath(from SwitchPortID)

type FrameType

type FrameType uint8
const (
	TypeSTP                      FrameType = iota // root announcements, signed before forwarding to all peers
	TypeSource                                    // traffic frame, forwarded using source routing
	TypeGreedy                                    // traffic frame, forwarded using greedy routing
	TypePathfind                                  // protocol frame, sign the update before forwarding it greedily
	TypeSwitchUpdate                              // sent from the switch to the router to update about peers
	TypeDHTRequest                                // protocol frame, forwarded using greedy routing
	TypeDHTResponse                               // protocol frame, forwarded using greedy routing
	TypeVirtualSnakeBootstrap                     // protocol frame, forwarded using SNEK predecessor ordering
	TypeVirtualSnakeBootstrapACK                  // protocol frame, forwarded using greedy routing
	TypeVirtualSnakeSetup                         // protocol frame, forwarded using greedy routing
	TypeVirtualSnake                              // traffic frame, forwarded using SNEK successor ordering
	TypeVirtualSnakePathfind                      // protocol frame, forwarded using SNEK successor ordering
	TypeVirtualSnakeTeardown                      // protocol frame
)

func (FrameType) String

func (t FrameType) String() string

type FrameVersion

type FrameVersion uint8
const (
	Version0 FrameVersion = iota
)

func (FrameVersion) String

func (v FrameVersion) String() string

type Pathfind

type Pathfind struct {
	Boundary   uint8
	VsetPath   bool
	Signatures []SignatureWithHop
}

func (Pathfind) MarshalBinary

func (p Pathfind) MarshalBinary(buf []byte) (int, error)

func (*Pathfind) ReturnPath

func (p *Pathfind) ReturnPath(reverse bool) SwitchPorts

func (Pathfind) Sign

func (p Pathfind) Sign(privKey ed25519.PrivateKey, forPort SwitchPortID) (*Pathfind, error)

func (*Pathfind) UnmarshalBinary

func (p *Pathfind) UnmarshalBinary(b []byte) (int, error)

type PrivateKey

type PrivateKey [ed25519.PrivateKeySize]byte

type PublicKey

type PublicKey [ed25519.PublicKeySize]byte

func (PublicKey) CompareTo

func (a PublicKey) CompareTo(b PublicKey) int

func (PublicKey) EqualTo

func (a PublicKey) EqualTo(b PublicKey) bool

func (PublicKey) Network

func (a PublicKey) Network() string

func (PublicKey) String

func (a PublicKey) String() string

type Signature

type Signature [ed25519.SignatureSize]byte

type SignatureWithHop

type SignatureWithHop struct {
	Hop       Varu64
	PublicKey PublicKey
	Signature Signature
}

func (*SignatureWithHop) MarshalBinary

func (a *SignatureWithHop) MarshalBinary(data []byte) (int, error)

func (*SignatureWithHop) UnmarshalBinary

func (a *SignatureWithHop) UnmarshalBinary(data []byte) (int, error)

type SwitchAnnouncement

type SwitchAnnouncement struct {
	RootPublicKey PublicKey
	Sequence      Varu64
	Signatures    []SignatureWithHop
}

func (*SwitchAnnouncement) Coords

func (a *SwitchAnnouncement) Coords() SwitchPorts

func (*SwitchAnnouncement) MarshalBinary

func (a *SwitchAnnouncement) MarshalBinary(buffer []byte) (int, error)

func (*SwitchAnnouncement) PeerCoords added in v0.2.0

func (a *SwitchAnnouncement) PeerCoords() SwitchPorts

func (*SwitchAnnouncement) Sign

func (a *SwitchAnnouncement) Sign(privKey ed25519.PrivateKey, forPort SwitchPortID) error

func (*SwitchAnnouncement) UnmarshalBinary

func (a *SwitchAnnouncement) UnmarshalBinary(data []byte) (int, error)

type SwitchPortID

type SwitchPortID Varu64

type SwitchPorts

type SwitchPorts []SwitchPortID

func (*SwitchPorts) Copy

func (a *SwitchPorts) Copy() SwitchPorts

func (SwitchPorts) DistanceTo

func (a SwitchPorts) DistanceTo(b SwitchPorts) int

func (SwitchPorts) EqualTo

func (p SwitchPorts) EqualTo(o SwitchPorts) bool

func (SwitchPorts) Len

func (s SwitchPorts) Len() int

func (SwitchPorts) Less

func (s SwitchPorts) Less(i, j int) bool

func (SwitchPorts) MarshalBinary

func (p SwitchPorts) MarshalBinary() ([]byte, error)

func (SwitchPorts) String

func (s SwitchPorts) String() string

func (SwitchPorts) Swap

func (s SwitchPorts) Swap(i, j int)

func (*SwitchPorts) UnmarshalBinary

func (p *SwitchPorts) UnmarshalBinary(b []byte) (int, error)

type Varu64

type Varu64 uint64

func (Varu64) Length

func (n Varu64) Length() int

func (Varu64) MarshalBinary

func (n Varu64) MarshalBinary() ([]byte, error)

func (*Varu64) UnmarshalBinary

func (n *Varu64) UnmarshalBinary(buf []byte) error

Jump to

Keyboard shortcuts

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