Documentation ¶
Index ¶
- Constants
- Variables
- type Coordinates
- func (a *Coordinates) Copy() Coordinates
- func (a Coordinates) DistanceTo(b Coordinates) int
- func (p Coordinates) EqualTo(o Coordinates) bool
- func (s Coordinates) Len() int
- func (s Coordinates) Less(i, j int) bool
- func (p Coordinates) MarshalBinary(buf []byte) (int, error)
- func (p Coordinates) MarshalJSON() ([]byte, error)
- func (s Coordinates) Network() string
- func (s Coordinates) String() string
- func (s Coordinates) Swap(i, j int)
- func (p *Coordinates) UnmarshalBinary(b []byte) (int, error)
- type Frame
- type FrameType
- type FrameVersion
- type Logger
- type PrivateKey
- type PublicKey
- type Root
- type Signature
- type SignatureWithHop
- type SwitchAnnouncement
- func (a *SwitchAnnouncement) AncestorParent() PublicKey
- func (a *SwitchAnnouncement) Coords() Coordinates
- func (a *SwitchAnnouncement) IsLoopOrChildOf(pk PublicKey) bool
- func (a *SwitchAnnouncement) MarshalBinary(buffer []byte) (int, error)
- func (a *SwitchAnnouncement) PeerCoords() Coordinates
- func (a *SwitchAnnouncement) SanityCheck(from PublicKey) error
- func (a *SwitchAnnouncement) Sign(privKey ed25519.PrivateKey, forPort SwitchPortID) error
- func (a *SwitchAnnouncement) UnmarshalBinary(data []byte) (int, error)
- type SwitchPortID
- type Varu64
- type VirtualSnakeBootstrap
- type VirtualSnakeWatermark
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 Coordinates ¶ added in v0.5.0
type Coordinates []SwitchPortID
func (*Coordinates) Copy ¶ added in v0.5.0
func (a *Coordinates) Copy() Coordinates
func (Coordinates) DistanceTo ¶ added in v0.5.0
func (a Coordinates) DistanceTo(b Coordinates) int
func (Coordinates) EqualTo ¶ added in v0.5.0
func (p Coordinates) EqualTo(o Coordinates) bool
func (Coordinates) Len ¶ added in v0.5.0
func (s Coordinates) Len() int
func (Coordinates) Less ¶ added in v0.5.0
func (s Coordinates) Less(i, j int) bool
func (Coordinates) MarshalBinary ¶ added in v0.5.0
func (p Coordinates) MarshalBinary(buf []byte) (int, error)
func (Coordinates) MarshalJSON ¶ added in v0.7.0
func (p Coordinates) MarshalJSON() ([]byte, error)
func (Coordinates) Network ¶ added in v0.5.0
func (s Coordinates) Network() string
func (Coordinates) String ¶ added in v0.5.0
func (s Coordinates) String() string
func (Coordinates) Swap ¶ added in v0.5.0
func (s Coordinates) Swap(i, j int)
func (*Coordinates) UnmarshalBinary ¶ added in v0.5.0
func (p *Coordinates) UnmarshalBinary(b []byte) (int, error)
type Frame ¶
type Frame struct { Version FrameVersion Type FrameType Extra [2]byte Destination Coordinates DestinationKey PublicKey Source Coordinates SourceKey PublicKey Watermark VirtualSnakeWatermark Payload []byte }
type FrameVersion ¶
type FrameVersion uint8
const (
Version0 FrameVersion = iota
)
func (FrameVersion) String ¶
func (v FrameVersion) String() string
type Logger ¶ added in v0.8.0
type Logger interface { Println(...interface{}) Printf(string, ...interface{}) }
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
func (PublicKey) MarshalJSON ¶ added in v0.7.0
type Root ¶ added in v0.5.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 { Root Signatures []SignatureWithHop }
func (*SwitchAnnouncement) AncestorParent ¶ added in v0.4.0
func (a *SwitchAnnouncement) AncestorParent() PublicKey
func (*SwitchAnnouncement) Coords ¶
func (a *SwitchAnnouncement) Coords() Coordinates
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() Coordinates
func (*SwitchAnnouncement) SanityCheck ¶ added in v0.5.0
func (a *SwitchAnnouncement) SanityCheck(from PublicKey) error
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 VirtualSnakeBootstrap ¶ added in v0.3.0
type VirtualSnakeBootstrap struct { Sequence Varu64 Root Signature [ed25519.SignatureSize]byte }
func (*VirtualSnakeBootstrap) MarshalBinary ¶ added in v0.3.0
func (v *VirtualSnakeBootstrap) MarshalBinary(buf []byte) (int, error)
func (*VirtualSnakeBootstrap) ProtectedPayload ¶ added in v0.9.0
func (v *VirtualSnakeBootstrap) ProtectedPayload() ([]byte, error)
func (*VirtualSnakeBootstrap) UnmarshalBinary ¶ added in v0.3.0
func (v *VirtualSnakeBootstrap) UnmarshalBinary(buf []byte) (int, error)
type VirtualSnakeWatermark ¶ added in v0.9.0
type VirtualSnakeWatermark struct { PublicKey PublicKey `json:"public_key"` Sequence Varu64 `json:"sequence"` }
func (VirtualSnakeWatermark) WorseThan ¶ added in v0.9.0
func (a VirtualSnakeWatermark) WorseThan(b VirtualSnakeWatermark) bool
Click to show internal directories.
Click to hide internal directories.