Documentation
¶
Index ¶
- Constants
- Variables
- type DHTNode
- type DHTQueryRequest
- type DHTQueryResponse
- type Frame
- type FrameType
- type FrameVersion
- type Pathfind
- type PrivateKey
- type PublicKey
- type Signature
- type SignatureWithHop
- type SwitchAnnouncement
- func (a *SwitchAnnouncement) AncestorParent() PublicKey
- func (a *SwitchAnnouncement) Coords() SwitchPorts
- func (a *SwitchAnnouncement) IsLoopOrChildOf(pk PublicKey) bool
- func (a *SwitchAnnouncement) MarshalBinary(buffer []byte) (int, error)
- func (a *SwitchAnnouncement) PeerCoords() SwitchPorts
- func (a *SwitchAnnouncement) Sign(privKey ed25519.PrivateKey, forPort SwitchPortID) error
- func (a *SwitchAnnouncement) UnmarshalBinary(data []byte) (int, error)
- type SwitchPortID
- type SwitchPorts
- func (a *SwitchPorts) Copy() SwitchPorts
- func (a SwitchPorts) DistanceTo(b SwitchPorts) int
- func (p SwitchPorts) EqualTo(o SwitchPorts) bool
- func (s SwitchPorts) Len() int
- func (s SwitchPorts) Less(i, j int) bool
- func (p SwitchPorts) MarshalBinary() ([]byte, error)
- func (s SwitchPorts) String() string
- func (s SwitchPorts) Swap(i, j int)
- func (p *SwitchPorts) UnmarshalBinary(b []byte) (int, error)
- type Varu64
- type VirtualSnakeBootstrap
- type VirtualSnakeBootstrapACK
- type VirtualSnakePathID
- type VirtualSnakeSetup
- type VirtualSnakeTeardown
Constants ¶
View Source
const FrameHeaderLength = 10
4 magic bytes, 1 byte version, 1 byte type, 2 bytes extra, 2 bytes frame length
View Source
const MaxFrameSize = 65535*3 + 16
MaxFrameSize is the maximum size that a single frame can be, including all headers.
View Source
const MaxPayloadSize = 65535
MaxPayloadSize is the maximum size that a single frame can contain as a payload, not including headers.
View Source
const SignatureWithHopMinSize = ed25519.PublicKeySize + ed25519.SignatureSize + 1
Variables ¶
View Source
var FrameMagicBytes = []byte{0x70, 0x69, 0x6e, 0x65}
View Source
var FullMask = PublicKey{
0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
}
Functions ¶
This section is empty.
Types ¶
type DHTNode ¶
type DHTNode struct {
PublicKey PublicKey
Coordinates SwitchPorts
}
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
Extra [2]byte
Destination SwitchPorts
DestinationKey PublicKey
Source SwitchPorts
SourceKey PublicKey
Payload []byte
}
func (*Frame) UpdateSourceRoutedPath ¶
func (f *Frame) UpdateSourceRoutedPath(from SwitchPortID)
type FrameType ¶
type FrameType uint8
const ( TypeSTP FrameType = iota // protocol frame, bypasses queues TypeSource // traffic frame, forwarded using source routing TypeGreedy // traffic frame, forwarded using tree routing TypeVirtualSnakeBootstrap // protocol frame, forwarded using SNEK TypeVirtualSnakeBootstrapACK // protocol frame, forwarded using tree routing TypeVirtualSnakeSetup // protocol frame, forwarded using tree routing TypeVirtualSnake // traffic frame, forwarded using SNEK TypeVirtualSnakeTeardown // protocol frame, forwarded using special rules TypeKeepalive // protocol frame, direct to peers only TypeSNEKPing FrameType = iota + 200 // traffic frame, forwarded using SNEK TypeSNEKPong // traffic frame, forwarded using SNEK TypeTreePing // traffic frame, forwarded using tree TypeTreePong // traffic frame, forwarded using tree )
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) ReturnPath ¶
func (p *Pathfind) ReturnPath(reverse bool) SwitchPorts
func (Pathfind) Sign ¶
func (p Pathfind) Sign(privKey ed25519.PrivateKey, forPort SwitchPortID) (*Pathfind, error)
type PrivateKey ¶
type PrivateKey [ed25519.PrivateKeySize]byte
func (PrivateKey) Public ¶ added in v0.4.0
func (a PrivateKey) Public() PublicKey
type PublicKey ¶
type PublicKey [ed25519.PublicKeySize]byte
func (PublicKey) EqualMaskTo ¶ added in v0.4.0
type Signature ¶
type Signature [ed25519.SignatureSize]byte
type SignatureWithHop ¶
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) AncestorParent ¶ added in v0.4.0
func (a *SwitchAnnouncement) AncestorParent() PublicKey
func (*SwitchAnnouncement) Coords ¶
func (a *SwitchAnnouncement) Coords() SwitchPorts
func (*SwitchAnnouncement) IsLoopOrChildOf ¶ added in v0.4.0
func (a *SwitchAnnouncement) IsLoopOrChildOf(pk PublicKey) bool
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 VirtualSnakeBootstrap ¶ added in v0.3.0
type VirtualSnakeBootstrap struct {
PathID VirtualSnakePathID
RootPublicKey PublicKey
RootSequence Varu64
}
func (*VirtualSnakeBootstrap) MarshalBinary ¶ added in v0.3.0
func (v *VirtualSnakeBootstrap) MarshalBinary(buf []byte) (int, error)
func (*VirtualSnakeBootstrap) UnmarshalBinary ¶ added in v0.3.0
func (v *VirtualSnakeBootstrap) UnmarshalBinary(buf []byte) (int, error)
type VirtualSnakeBootstrapACK ¶ added in v0.3.0
type VirtualSnakeBootstrapACK struct {
PathID VirtualSnakePathID
RootPublicKey PublicKey
RootSequence Varu64
}
func (*VirtualSnakeBootstrapACK) MarshalBinary ¶ added in v0.3.0
func (v *VirtualSnakeBootstrapACK) MarshalBinary(buf []byte) (int, error)
func (*VirtualSnakeBootstrapACK) UnmarshalBinary ¶ added in v0.3.0
func (v *VirtualSnakeBootstrapACK) UnmarshalBinary(buf []byte) (int, error)
type VirtualSnakePathID ¶ added in v0.3.0
type VirtualSnakePathID [8]byte
func (VirtualSnakePathID) MarshalJSON ¶ added in v0.4.0
func (p VirtualSnakePathID) MarshalJSON() ([]byte, error)
type VirtualSnakeSetup ¶ added in v0.3.0
type VirtualSnakeSetup struct {
PathID VirtualSnakePathID
RootPublicKey PublicKey
RootSequence Varu64
}
func (*VirtualSnakeSetup) MarshalBinary ¶ added in v0.3.0
func (v *VirtualSnakeSetup) MarshalBinary(buf []byte) (int, error)
func (*VirtualSnakeSetup) UnmarshalBinary ¶ added in v0.3.0
func (v *VirtualSnakeSetup) UnmarshalBinary(buf []byte) (int, error)
type VirtualSnakeTeardown ¶ added in v0.3.0
type VirtualSnakeTeardown struct {
PathID VirtualSnakePathID
}
func (*VirtualSnakeTeardown) MarshalBinary ¶ added in v0.3.0
func (v *VirtualSnakeTeardown) MarshalBinary(buf []byte) (int, error)
func (*VirtualSnakeTeardown) UnmarshalBinary ¶ added in v0.3.0
func (v *VirtualSnakeTeardown) UnmarshalBinary(buf []byte) (int, error)
Click to show internal directories.
Click to hide internal directories.