Documentation ¶
Index ¶
- Constants
- func AddressEqual(a *net.UDPAddr, b *net.UDPAddr) bool
- func AdvancedPacketFilter(data []byte, magic []byte, fromAddress []byte, fromPort uint16, ...) bool
- func BasicPacketFilter(packetData []byte, packetLength int) bool
- func Debug(s string, params ...interface{})
- func Decrypt_Box(senderPublicKey []byte, receiverPrivateKey []byte, nonce []byte, buffer []byte, ...) error
- func Decrypt_SecretBox(privateKey []byte, nonce []byte, buffer []byte, bytes int) error
- func Encrypt_Box(senderPrivateKey []byte, receiverPublicKey []byte, nonce []byte, buffer []byte, ...) int
- func Encrypt_SecretBox(privateKey []byte, nonce []byte, buffer []byte, bytes int) int
- func Error(s string, params ...interface{})
- func GenerateChonkle(output []byte, magic []byte, fromAddressData []byte, fromPort uint16, ...)
- func GenerateConnectToken(userId []byte, envelopeUpKbps uint32, envelopeDownKbps uint32, ...) []byte
- func GeneratePittle(output []byte, fromAddress []byte, fromPort uint16, toAddress []byte, ...)
- func GetAckBits(latestReceivedSequence uint64, receivedPackets []uint64, ack_bits []byte)
- func GetAddressData(address *net.UDPAddr, addressData []byte, addressPort *uint16)
- func IdEqual(a []byte, b []byte) bool
- func IdString(id []byte) string
- func Info(s string, params ...interface{})
- func Keygen_Box() ([]byte, []byte)
- func Keygen_SecretBox() []byte
- func PacketBytesFromPayload(payloadBytes int) int
- func ParseAddress(input string) *net.UDPAddr
- func ProcessAcks(ackSequence uint64, ack_bits []byte, ackedPackets []uint64, ackBuffer []uint64) []uint64
- func RandomBytes(bytes int) []byte
- func RandomBytes_InPlace(buffer []byte)
- func ReadAddress(buffer []byte, index *int, address *net.UDPAddr) bool
- func ReadBool(data []byte, index *int, value *bool) bool
- func ReadBytes(data []byte, index *int, value []byte, bytes uint32) bool
- func ReadChallengeToken(buffer []byte, index *int, token *ChallengeToken) bool
- func ReadConnectData(buffer []byte, index *int, connectData *ConnectData) bool
- func ReadEncryptedChallengeToken(buffer []byte, index *int, token *ChallengeToken, privateKey []byte) bool
- func ReadEncryptedSessionToken(buffer []byte, index *int, token *SessionToken, senderPublicKey []byte, ...) bool
- func ReadFloat32(data []byte, index *int, value *float32) bool
- func ReadFloat64(data []byte, index *int, value *float64) bool
- func ReadSessionToken(buffer []byte, index *int, token *SessionToken) bool
- func ReadString(data []byte, index *int, value *string, maxStringLength uint32) bool
- func ReadUint16(data []byte, index *int, value *uint16) bool
- func ReadUint32(data []byte, index *int, value *uint32) bool
- func ReadUint64(data []byte, index *int, value *uint64) bool
- func ReadUint8(data []byte, index *int, value *uint8) bool
- func WirePacketBits(packetBytes int) int
- func WriteAddress(buffer []byte, index *int, address *net.UDPAddr)
- func WriteBool(data []byte, index *int, value bool)
- func WriteBytes(data []byte, index *int, value []byte, numBytes int)
- func WriteChallengeToken(buffer []byte, index *int, token *ChallengeToken)
- func WriteConnectData(buffer []byte, index *int, connectData *ConnectData)
- func WriteEncryptedChallengeToken(buffer []byte, index *int, token *ChallengeToken, privateKey []byte)
- func WriteEncryptedSessionToken(buffer []byte, index *int, token *SessionToken, senderPrivateKey []byte, ...)
- func WriteFloat32(data []byte, index *int, value float32)
- func WriteFloat64(data []byte, index *int, value float64)
- func WriteSessionToken(buffer []byte, index *int, token *SessionToken)
- func WriteString(data []byte, index *int, value string, maxStringLength uint32)
- func WriteUint16(data []byte, index *int, value uint16)
- func WriteUint32(data []byte, index *int, value uint32)
- func WriteUint64(data []byte, index *int, value uint64)
- func WriteUint8(data []byte, index *int, value uint8)
- type ChallengeToken
- type ConnectData
- type SessionToken
Constants ¶
View Source
const ( IPAddressNone = 0 IPAddressIPv4 = 1 IPAddressIPv6 = 2 AddressSize = 19 )
View Source
const AckBitsBytes = 32
View Source
const AckBytes = 8
View Source
const AddressBytes = 19
View Source
const ChallengePacket = byte(1)
View Source
const ChallengePacketBytes = PrefixBytes + NonceBytes_Box + EncryptedChallengeTokenBytes + SequenceBytes + GatewayIdBytes + PostfixBytes
View Source
const ChallengeTokenBytes = 8 + AddressBytes + 8
View Source
const ChonkleBytes = 15
View Source
const ConnectDataBytes = PublicKeyBytes_Box + PrivateKeyBytes_Box + AddressBytes + PublicKeyBytes_Box + EnvelopeBytes + PacketsPerSecondBytes
View Source
const ConnectTokenBytes = ConnectDataBytes + EncryptedSessionTokenBytes
View Source
const ConnectTokenExpireSeconds = 20
View Source
const EncryptedChallengeTokenBytes = NonceBytes_SecretBox + ChallengeTokenBytes + HMACBytes_SecretBox
View Source
const EncryptedSessionTokenBytes = NonceBytes_SecretBox + SessionTokenBytes + HMACBytes_SecretBox
View Source
const EnvelopeBytes = 8
View Source
const EthernetHeaderBytes = 18
View Source
const FlagsBytes = 1
View Source
const Flags_ChallengeToken = (1 << 0)
View Source
const GatewayIdBytes = 32
View Source
const HMACBytes_Box = 16
View Source
const HMACBytes_SecretBox = 16
View Source
const HeaderBytes = SessionIdBytes + SequenceBytes + AckBytes + AckBitsBytes + GatewayIdBytes + ServerIdBytes + PacketTypeBytes + FlagsBytes
View Source
const IPv4HeaderBytes = 18
View Source
const MagicBytes = 8
View Source
const MinPacketSize = PrefixBytes + HeaderBytes + MinPayloadBytes + PostfixBytes
View Source
const MinPayloadBytes = 1000
View Source
const NonceBytes_Box = 24
View Source
const NonceBytes_SecretBox = 24
View Source
const PacketTypeBytes = 1
View Source
const PacketsPerSecondBytes = 1
View Source
const PayloadPacket = byte(0)
View Source
const PittleBytes = 2
View Source
const PostfixBytes = HMACBytes_Box + PittleBytes
View Source
const PrefixBytes = VersionBytes + PacketTypeBytes + ChonkleBytes + EncryptedSessionTokenBytes + SequenceBytes
View Source
const PrivateKeyBytes_Box = 32
View Source
const PrivateKeyBytes_SecretBox = 32
View Source
const PublicKeyBytes_Box = 32
View Source
const SequenceBytes = 8
View Source
const ServerIdBytes = 32
View Source
const SessionIdBytes = 32
View Source
const SessionTokenBytes = 8 + SessionIdBytes + UserIdBytes + EnvelopeBytes + PacketsPerSecondBytes
View Source
const SessionTokenExtensionSeconds = 10
View Source
const UDPHeaderBytes = 8
View Source
const UserIdBytes = 32
View Source
const VersionBytes = 1
Variables ¶
This section is empty.
Functions ¶
func AdvancedPacketFilter ¶
func BasicPacketFilter ¶
func Decrypt_Box ¶
func Decrypt_SecretBox ¶
func Encrypt_Box ¶
func Encrypt_SecretBox ¶
func GenerateChonkle ¶
func GenerateConnectToken ¶
func GeneratePittle ¶
func GetAckBits ¶
func GetAddressData ¶
func Keygen_Box ¶
func Keygen_SecretBox ¶
func Keygen_SecretBox() []byte
func PacketBytesFromPayload ¶
func ParseAddress ¶
func ProcessAcks ¶
func RandomBytes ¶
func RandomBytes_InPlace ¶
func RandomBytes_InPlace(buffer []byte)
func ReadChallengeToken ¶
func ReadChallengeToken(buffer []byte, index *int, token *ChallengeToken) bool
func ReadConnectData ¶
func ReadConnectData(buffer []byte, index *int, connectData *ConnectData) bool
func ReadEncryptedChallengeToken ¶
func ReadEncryptedChallengeToken(buffer []byte, index *int, token *ChallengeToken, privateKey []byte) bool
func ReadSessionToken ¶
func ReadSessionToken(buffer []byte, index *int, token *SessionToken) bool
func ReadString ¶
func WirePacketBits ¶
func WriteChallengeToken ¶
func WriteChallengeToken(buffer []byte, index *int, token *ChallengeToken)
func WriteConnectData ¶
func WriteConnectData(buffer []byte, index *int, connectData *ConnectData)
func WriteEncryptedChallengeToken ¶
func WriteEncryptedChallengeToken(buffer []byte, index *int, token *ChallengeToken, privateKey []byte)
func WriteEncryptedSessionToken ¶
func WriteEncryptedSessionToken(buffer []byte, index *int, token *SessionToken, senderPrivateKey []byte, receiverPublicKey []byte)
func WriteFloat32 ¶
func WriteFloat64 ¶
func WriteSessionToken ¶
func WriteSessionToken(buffer []byte, index *int, token *SessionToken)
func WriteUint16 ¶
func WriteUint32 ¶
func WriteUint64 ¶
func WriteUint8 ¶
Types ¶
type ChallengeToken ¶
type ConnectData ¶
type ConnectData struct { ClientPublicKey [PublicKeyBytes_Box]byte ClientPrivateKey [PrivateKeyBytes_Box]byte GatewayAddress net.UDPAddr GatewayPublicKey [PublicKeyBytes_Box]byte EnvelopeUpKbps uint32 EnvelopeDownKbps uint32 PacketsPerSecond uint8 }
type SessionToken ¶
type SessionToken struct { ExpireTimestamp uint64 SessionId [SessionIdBytes]byte UserId [UserIdBytes]byte EnvelopeUpKbps uint32 EnvelopeDownKbps uint32 PacketsPerSecond uint8 }
Click to show internal directories.
Click to hide internal directories.