nex

package module
v1.0.41 Latest Latest
Warning

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

Go to latest
Published: Sep 26, 2023 License: AGPL-3.0 Imports: 22 Imported by: 143

README

NEX Go

Barebones PRUDP/NEX server library written in Go

GoDoc

Other NEX libraries

nex-protocols-go - NEX protocol definitions

nex-protocols-common-go - NEX protocols used by many games with premade handlers and a high level API

Install

go get github.com/PretendoNetwork/nex-go

Usage note

This module provides a barebones PRUDP server for use with titles using the Nintendo NEX library. It does not provide any support for titles using the original Rendez-Vous library developed by Quazal. This library only provides the low level packet data, as such it is recommended to use NEX Protocols Go to develop servers.

Usage
package main

import (
	"fmt"

	nex "github.com/PretendoNetwork/nex-go"
)

func main() {
	nexServer := nex.NewServer()
	nexServer.SetPrudpVersion(0)
	nexServer.SetSignatureVersion(1)
	nexServer.SetKerberosKeySize(16)
	nexServer.SetAccessKey("ridfebb9")

	nexServer.On("Data", func(packet *nex.PacketV0) {
		request := packet.RMCRequest()

		fmt.Println("==Friends - Auth==")
		fmt.Printf("Protocol ID: %#v\n", request.ProtocolID())
		fmt.Printf("Method ID: %#v\n", request.MethodID())
		fmt.Println("==================")
	})

	nexServer.Listen(":60000")
}

Documentation

Overview

Package nex implements an API for creating bare-bones NEX servers and clients and provides the underlying PRUDP implementation

No NEX protocols are implemented in this package. For NEX protocols see https://github.com/PretendoNetwork/nex-protocols-go

No PIA code is implemented in this package

Index

Constants

View Source
const (
	// FlagAck is the ID for the PRUDP Ack Flag
	FlagAck uint16 = 0x1

	// FlagReliable is the ID for the PRUDP Reliable Flag
	FlagReliable uint16 = 0x2

	// FlagNeedsAck is the ID for the PRUDP NeedsAck Flag
	FlagNeedsAck uint16 = 0x4

	// FlagHasSize is the ID for the PRUDP HasSize Flag
	FlagHasSize uint16 = 0x8

	// FlagMultiAck is the ID for the PRUDP MultiAck Flag
	FlagMultiAck uint16 = 0x200
)
View Source
const (
	// SynPacket is the ID for the PRUDP Syn Packet type
	SynPacket uint16 = 0x0

	// ConnectPacket is the ID for the PRUDP Connect Packet type
	ConnectPacket uint16 = 0x1

	// DataPacket is the ID for the PRUDP Data Packet type
	DataPacket uint16 = 0x2

	// DisconnectPacket is the ID for the PRUDP Disconnect Packet type
	DisconnectPacket uint16 = 0x3

	// PingPacket is the ID for the PRUDP Ping Packet type
	PingPacket uint16 = 0x4
)

Variables

View Source
var ErrorNames = map[uint32]string{}

ErrorNames contains a map of all the error string names, indexed by the error ID

View Source
var Errors nexerrors

Errors provides a struct containing error codes using dot-notation

View Source
var Magic = []byte{0xEA, 0xD0}

Magic is the expected PRUDPv1 magic number

View Source
var OptionAllFunctions = 0xFFFFFFFF

OptionAllFunctions is used with OptionSupportedFunctions to support all methods

View Source
var OptionConnectionSignature uint8 = 1

OptionConnectionSignature is the ID for the Connection Signature option in PRUDP v1 packets

View Source
var OptionFragmentID uint8 = 2

OptionFragmentID is the ID for the Fragment ID option in PRUDP v1 packets

View Source
var OptionInitialSequenceID uint8 = 3

OptionInitialSequenceID is the ID for the initial sequence ID option in PRUDP v1 packets

View Source
var OptionMaxSubstreamID uint8 = 4

OptionMaxSubstreamID is the ID for the max substream ID option in PRUDP v1 packets

View Source
var OptionSupportedFunctions uint8 = 0

OptionSupportedFunctions is the ID for the Supported Functions option in PRUDP v1 packets

Functions

func DeriveKerberosKey added in v1.0.6

func DeriveKerberosKey(pid uint32, password []byte) []byte

DeriveKerberosKey derives a users kerberos encryption key based on their PID and password

func ErrorNameFromCode added in v1.0.5

func ErrorNameFromCode(errorCode uint32) string

ErrorNameFromCode returns an error code string for the provided error code

func MD5Hash

func MD5Hash(text []byte) []byte

MD5Hash returns the MD5 hash of the input

func RegisterDataHolderType added in v1.0.7

func RegisterDataHolderType(name string, structure StructureInterface)

RegisterDataHolderType registers a structure to be a valid type in the DataHolder structure

Types

type Client

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

Client represents a connected or non-connected PRUDP client

func NewClient

func NewClient(address *net.UDPAddr, server *Server) *Client

NewClient returns a new PRUDP client

func (*Client) AddStationURL added in v1.0.36

func (client *Client) AddStationURL(stationURL *StationURL)

AddStationURL adds the StationURL to the clients StationURLs

func (*Client) Address

func (client *Client) Address() *net.UDPAddr

Address returns the clients UDP address

func (*Client) Cipher

func (client *Client) Cipher() *rc4.Cipher

Cipher returns the RC4 cipher stream for out-bound packets

func (*Client) ClientConnectionSignature

func (client *Client) ClientConnectionSignature() []byte

ClientConnectionSignature returns the clients client-side connection signature

func (*Client) ConnectionID

func (client *Client) ConnectionID() uint32

ConnectionID returns the clients Connection ID

func (*Client) Decipher

func (client *Client) Decipher() *rc4.Cipher

Decipher returns the RC4 cipher stream for in-bound packets

func (*Client) IncreasePingTimeoutTime

func (client *Client) IncreasePingTimeoutTime(seconds int)

IncreasePingTimeoutTime adds a number of seconds to the check timer

func (*Client) PID

func (client *Client) PID() uint32

PID returns the clients NEX PID

func (*Client) PRUDPProtocolMinorVersion added in v1.0.9

func (client *Client) PRUDPProtocolMinorVersion() int

PRUDPProtocolMinorVersion returns the client PRUDP minor version

func (*Client) Reset

func (client *Client) Reset() error

Reset resets the Client to default values

func (*Client) SequenceIDCounterIn

func (client *Client) SequenceIDCounterIn() *Counter

SequenceIDCounterIn returns the clients packet SequenceID counter for incoming packets

func (*Client) SequenceIDOutManager added in v1.0.41

func (client *Client) SequenceIDOutManager() *SequenceIDManager

SequenceIDOutManager returns the clients packet SequenceID manager for out-going packets

func (*Client) Server

func (client *Client) Server() *Server

Server returns the server the client is currently connected to

func (*Client) ServerConnectionSignature

func (client *Client) ServerConnectionSignature() []byte

ServerConnectionSignature returns the clients server-side connection signature

func (*Client) SessionKey

func (client *Client) SessionKey() []byte

SessionKey returns the clients session key

func (*Client) SetClientConnectionSignature

func (client *Client) SetClientConnectionSignature(clientConnectionSignature []byte)

SetClientConnectionSignature sets the clients client-side connection signature

func (*Client) SetConnected

func (client *Client) SetConnected(connected bool)

SetConnected sets the clients connection status

func (*Client) SetConnectionID

func (client *Client) SetConnectionID(connectionID uint32)

SetConnectionID sets the clients Connection ID

func (*Client) SetPID

func (client *Client) SetPID(pid uint32)

SetPID sets the clients NEX PID

func (*Client) SetPRUDPProtocolMinorVersion added in v1.0.9

func (client *Client) SetPRUDPProtocolMinorVersion(prudpProtocolMinorVersion int)

SetPRUDPProtocolMinorVersion sets the client PRUDP minor

func (*Client) SetServerConnectionSignature

func (client *Client) SetServerConnectionSignature(serverConnectionSignature []byte)

SetServerConnectionSignature sets the clients server-side connection signature

func (*Client) SetSessionKey

func (client *Client) SetSessionKey(sessionKey []byte)

SetSessionKey sets the clients session key

func (*Client) SetStationURLs added in v1.0.21

func (client *Client) SetStationURLs(stationURLs []*StationURL)

SetStationURLs sets the clients Station URLs

func (*Client) SetSupportedFunctions added in v1.0.9

func (client *Client) SetSupportedFunctions(supportedFunctions int)

SetSupportedFunctions sets the supported PRUDP functions by the client

func (*Client) SignatureBase

func (client *Client) SignatureBase() int

SignatureBase returns the v0 checksum signature base

func (*Client) SignatureKey

func (client *Client) SignatureKey() []byte

SignatureKey returns signature key

func (*Client) StartTimeoutTimer

func (client *Client) StartTimeoutTimer()

StartTimeoutTimer begins the packet timeout timer

func (*Client) StationURLs added in v1.0.21

func (client *Client) StationURLs() []*StationURL

StationURLs returns the clients Station URLs

func (*Client) StopTimeoutTimer added in v1.0.41

func (client *Client) StopTimeoutTimer()

StopTimeoutTimer stops the packet timeout timer

func (*Client) SupportedFunctions added in v1.0.9

func (client *Client) SupportedFunctions() int

SupportedFunctions returns the supported PRUDP functions by the client

func (*Client) UpdateAccessKey

func (client *Client) UpdateAccessKey(accessKey string)

UpdateAccessKey sets the client signature base and signature key

func (*Client) UpdateRC4Key

func (client *Client) UpdateRC4Key(key []byte) error

UpdateRC4Key sets the client RC4 stream key

type Counter

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

Counter represents an incremental counter

func NewCounter

func NewCounter(start uint32) *Counter

NewCounter returns a new Counter, with a starting number

func (*Counter) Increment

func (counter *Counter) Increment() uint32

Increment increments the counter by 1 and returns the value

func (Counter) Value

func (counter Counter) Value() uint32

Value returns the counters current value

type Data added in v1.0.7

type Data struct {
	Structure
}

Data represents a structure with no data

func NewData added in v1.0.7

func NewData() *Data

NewData returns a new Data Structure

func (*Data) Bytes added in v1.0.7

func (data *Data) Bytes(stream *StreamOut) []byte

Bytes does nothing for Data

func (*Data) Copy added in v1.0.23

func (data *Data) Copy() StructureInterface

Copy returns a new copied instance of Data

func (*Data) Equals added in v1.0.23

func (data *Data) Equals(structure StructureInterface) bool

Equals checks if the passed Structure contains the same data as the current instance

func (*Data) ExtractFromStream added in v1.0.7

func (data *Data) ExtractFromStream(stream *StreamIn) error

ExtractFromStream does nothing for Data

func (*Data) FormatToString added in v1.0.28

func (data *Data) FormatToString(indentationLevel int) string

FormatToString pretty-prints the struct data using the provided indentation level

func (*Data) String added in v1.0.28

func (data *Data) String() string

String returns a string representation of the struct

type DataHolder

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

DataHolder represents a structure which can hold any other structure

func NewDataHolder

func NewDataHolder() *DataHolder

NewDataHolder returns a new DataHolder

func (*DataHolder) Bytes

func (dataHolder *DataHolder) Bytes(stream *StreamOut) []byte

Bytes encodes the DataHolder and returns a byte array

func (*DataHolder) Copy added in v1.0.24

func (dataHolder *DataHolder) Copy() *DataHolder

Copy returns a new copied instance of DataHolder

func (*DataHolder) Equals added in v1.0.24

func (dataHolder *DataHolder) Equals(other *DataHolder) bool

Equals checks if the passed Structure contains the same data as the current instance

func (*DataHolder) ExtractFromStream added in v1.0.7

func (dataHolder *DataHolder) ExtractFromStream(stream *StreamIn) error

ExtractFromStream extracts a DataHolder structure from a stream

func (*DataHolder) FormatToString added in v1.0.28

func (dataHolder *DataHolder) FormatToString(indentationLevel int) string

FormatToString pretty-prints the struct data using the provided indentation level

func (*DataHolder) ObjectData added in v1.0.7

func (dataHolder *DataHolder) ObjectData() StructureInterface

ObjectData returns the DataHolder internal object data

func (*DataHolder) SetObjectData added in v1.0.7

func (dataHolder *DataHolder) SetObjectData(objectData StructureInterface)

SetObjectData sets the DataHolder internal object data

func (*DataHolder) SetTypeName added in v1.0.7

func (dataHolder *DataHolder) SetTypeName(typeName string)

SetTypeName sets the DataHolder type name

func (*DataHolder) String added in v1.0.28

func (dataHolder *DataHolder) String() string

String returns a string representation of the struct

func (*DataHolder) TypeName added in v1.0.7

func (dataHolder *DataHolder) TypeName() string

TypeName returns the DataHolder type name

type DateTime

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

DateTime represents a NEX DateTime type

func NewDateTime

func NewDateTime(value uint64) *DateTime

NewDateTime returns a new DateTime instance

func (*DateTime) Copy added in v1.0.24

func (datetime *DateTime) Copy() *DateTime

Copy returns a new copied instance of DateTime

func (*DateTime) Day added in v1.0.19

func (datetime *DateTime) Day() int

Day returns the day value stored in the DateTime

func (*DateTime) Equals added in v1.0.24

func (datetime *DateTime) Equals(other *DateTime) bool

Equals checks if the passed Structure contains the same data as the current instance

func (*DateTime) FormatToString added in v1.0.28

func (datetime *DateTime) FormatToString(indentationLevel int) string

FormatToString pretty-prints the struct data using the provided indentation level

func (*DateTime) FromTimestamp

func (datetime *DateTime) FromTimestamp(timestamp time.Time) uint64

FromTimestamp converts a Time timestamp into a NEX DateTime

func (*DateTime) Hour added in v1.0.19

func (datetime *DateTime) Hour() int

Hour returns the hours value stored in the DateTime

func (*DateTime) Make

func (datetime *DateTime) Make(year, month, day, hour, minute, second int) uint64

Make initilizes a DateTime with the input data

func (*DateTime) Minute added in v1.0.19

func (datetime *DateTime) Minute() int

Minute returns the minutes value stored in the DateTime

func (*DateTime) Month added in v1.0.19

func (datetime *DateTime) Month() time.Month

Month returns the month value stored in the DateTime

func (*DateTime) Now

func (datetime *DateTime) Now() uint64

Now converts the current Time timestamp to a NEX DateTime

func (*DateTime) Second added in v1.0.19

func (datetime *DateTime) Second() int

Second returns the seconds value stored in the DateTime

func (*DateTime) Standard added in v1.0.19

func (datetime *DateTime) Standard() time.Time

Standard returns the DateTime as a standard time.Time

func (*DateTime) String added in v1.0.28

func (datetime *DateTime) String() string

String returns a string representation of the struct

func (*DateTime) UTC added in v1.0.11

func (datetime *DateTime) UTC() uint64

UTC returns a NEX DateTime value of the current UTC time

func (*DateTime) Value

func (datetime *DateTime) Value() uint64

Value returns the stored DateTime time

func (*DateTime) Year added in v1.0.19

func (datetime *DateTime) Year() int

Year returns the year value stored in the DateTime

type DummyCompression

type DummyCompression struct{}

DummyCompression represents no compression

func (*DummyCompression) Compress

func (compression *DummyCompression) Compress(data []byte) []byte

Compress returns the data as-is

func (*DummyCompression) Decompress

func (compression *DummyCompression) Decompress(data []byte) []byte

Decompress returns the data as-is

type HPPPacket added in v1.0.20

type HPPPacket struct {
	Packet
	// contains filtered or unexported fields
}

HPPPacket represents an HPP packet

func NewHPPPacket added in v1.0.20

func NewHPPPacket(client *Client, data []byte) (*HPPPacket, error)

NewHPPPacket returns a new HPP packet

func (*HPPPacket) AccessKeySignature added in v1.0.20

func (packet *HPPPacket) AccessKeySignature() []byte

AccessKeySignature returns the packet access key signature

func (*HPPPacket) PasswordSignature added in v1.0.20

func (packet *HPPPacket) PasswordSignature() []byte

PasswordSignature returns the packet password signature

func (*HPPPacket) SetAccessKeySignature added in v1.0.20

func (packet *HPPPacket) SetAccessKeySignature(accessKeySignature string)

SetAccessKeySignature sets the packet access key signature

func (*HPPPacket) SetPasswordSignature added in v1.0.20

func (packet *HPPPacket) SetPasswordSignature(passwordSignature string)

SetPasswordSignature sets the packet password signature

func (*HPPPacket) ValidateAccessKey added in v1.0.20

func (packet *HPPPacket) ValidateAccessKey() error

ValidateAccessKey checks if the access key signature is valid

func (*HPPPacket) ValidatePassword added in v1.0.20

func (packet *HPPPacket) ValidatePassword() error

ValidatePassword checks if the password signature is valid

type KerberosEncryption

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

KerberosEncryption is used to encrypt/decrypt using Kerberos

func NewKerberosEncryption

func NewKerberosEncryption(key []byte) (*KerberosEncryption, error)

NewKerberosEncryption returns a new KerberosEncryption instance

func (*KerberosEncryption) Decrypt

func (encryption *KerberosEncryption) Decrypt(buffer []byte) []byte

Decrypt will decrypt the given data using Kerberos

func (*KerberosEncryption) Encrypt

func (encryption *KerberosEncryption) Encrypt(buffer []byte) []byte

Encrypt will encrypt the given data using Kerberos

func (*KerberosEncryption) Validate

func (encryption *KerberosEncryption) Validate(buffer []byte) bool

Validate will check the HMAC of the encrypted data

type MutexMap added in v1.0.41

type MutexMap[K comparable, V any] struct {
	*sync.RWMutex
	// contains filtered or unexported fields
}

MutexMap implements a map type with go routine safe accessors through mutex locks. Embeds sync.RWMutex

func NewMutexMap added in v1.0.41

func NewMutexMap[K comparable, V any]() *MutexMap[K, V]

NewMutexMap returns a new instance of MutexMap with the provided key/value types

func (*MutexMap[K, V]) Clear added in v1.0.41

func (m *MutexMap[K, V]) Clear(callback func(key K, value V))

Clear removes all items from the `real` map Accepts an optional callback function ran for every item before it is deleted

func (*MutexMap[K, V]) Delete added in v1.0.41

func (m *MutexMap[K, V]) Delete(key K)

Delete removes a key from the internal map

func (*MutexMap[K, V]) Each added in v1.0.41

func (m *MutexMap[K, V]) Each(callback func(key K, value V))

Each runs a callback function for every item in the map The map should not be modified inside the callback function

func (*MutexMap[K, V]) Get added in v1.0.41

func (m *MutexMap[K, V]) Get(key K) (V, bool)

Get returns the given key value and a bool if found

func (*MutexMap[K, V]) Set added in v1.0.41

func (m *MutexMap[K, V]) Set(key K, value V)

Set sets a key to a given value

func (*MutexMap[K, V]) Size added in v1.0.41

func (m *MutexMap[K, V]) Size() int

Size returns the length of the internal map

type NEXVersion added in v1.0.15

type NEXVersion struct {
	Major             int
	Minor             int
	Patch             int
	GameSpecificPatch string
	// contains filtered or unexported fields
}

NEXVersion represents a NEX library version

func NewNEXVersion added in v1.0.29

func NewNEXVersion(major, minor, patch int) *NEXVersion

NewNEXVersion returns a new NEXVersion

func NewPatchedNEXVersion added in v1.0.29

func NewPatchedNEXVersion(major, minor, patch int, gameSpecificPatch string) *NEXVersion

NewPatchedNEXVersion returns a new NEXVersion with a game specific patch

func (*NEXVersion) Copy added in v1.0.29

func (nexVersion *NEXVersion) Copy() *NEXVersion

Copy returns a new copied instance of NEXVersion

func (*NEXVersion) GreaterOrEqual added in v1.0.38

func (nexVersion *NEXVersion) GreaterOrEqual(compare string) bool

GreaterOrEqual compares if the given semver is greater than or equal to the current version

func (*NEXVersion) LessOrEqual added in v1.0.38

func (nexVersion *NEXVersion) LessOrEqual(compare string) bool

LessOrEqual compares if the given semver is lesser than or equal to the current version

type Packet

type Packet struct {
	PacketInterface
	// contains filtered or unexported fields
}

Packet represents a generic PRUDP packet

func NewPacket

func NewPacket(client *Client, data []byte) Packet

NewPacket returns a new PRUDP packet generic

func (*Packet) AddFlag

func (packet *Packet) AddFlag(flag uint16)

AddFlag adds the given flag to the packet flag bitmask

func (*Packet) ClearFlag

func (packet *Packet) ClearFlag(flag uint16)

ClearFlag removes the given flag from the packet bitmask

func (*Packet) ConnectionSignature

func (packet *Packet) ConnectionSignature() []byte

ConnectionSignature returns the packet connection signature

func (*Packet) Data

func (packet *Packet) Data() []byte

Data returns bytes used to create the packet (this is not the same as Bytes())

func (*Packet) Destination

func (packet *Packet) Destination() uint8

Destination returns the packet destination

func (*Packet) Flags

func (packet *Packet) Flags() uint16

Flags returns the packet flag bitmask

func (*Packet) FragmentID

func (packet *Packet) FragmentID() uint8

FragmentID returns the packet fragmentID

func (*Packet) HasFlag

func (packet *Packet) HasFlag(flag uint16) bool

HasFlag checks if the packet has the given flag

func (*Packet) Payload

func (packet *Packet) Payload() []byte

Payload returns the packet payload

func (*Packet) RMCRequest

func (packet *Packet) RMCRequest() RMCRequest

RMCRequest returns the packet RMC request

func (*Packet) Sender

func (packet *Packet) Sender() *Client

Sender returns the packet sender

func (*Packet) SequenceID

func (packet *Packet) SequenceID() uint16

SequenceID returns the packet sequenceID

func (*Packet) SessionID

func (packet *Packet) SessionID() uint8

SessionID returns the packet sessionID

func (*Packet) SetConnectionSignature

func (packet *Packet) SetConnectionSignature(connectionSignature []byte)

SetConnectionSignature sets the packet connection signature

func (*Packet) SetDestination

func (packet *Packet) SetDestination(destination uint8)

SetDestination sets the packet destination

func (*Packet) SetFlags

func (packet *Packet) SetFlags(bitmask uint16)

SetFlags sets the packet flag bitmask

func (*Packet) SetFragmentID

func (packet *Packet) SetFragmentID(fragmentID uint8)

SetFragmentID sets the packet fragmentID

func (*Packet) SetPayload

func (packet *Packet) SetPayload(payload []byte)

SetPayload sets the packet payload

func (*Packet) SetSequenceID

func (packet *Packet) SetSequenceID(sequenceID uint16)

SetSequenceID sets the packet sequenceID

func (*Packet) SetSessionID

func (packet *Packet) SetSessionID(sessionID uint8)

SetSessionID sets the packet sessionID

func (*Packet) SetSignature

func (packet *Packet) SetSignature(signature []byte)

SetSignature sets the packet signature

func (*Packet) SetSource

func (packet *Packet) SetSource(source uint8)

SetSource sets the packet source

func (*Packet) SetType

func (packet *Packet) SetType(packetType uint16)

SetType sets the packet type

func (*Packet) SetVersion

func (packet *Packet) SetVersion(version uint8)

SetVersion sets the packet PRUDP version

func (*Packet) Signature

func (packet *Packet) Signature() []byte

Signature returns the packet signature

func (*Packet) Source

func (packet *Packet) Source() uint8

Source returns the packet source

func (*Packet) Type

func (packet *Packet) Type() uint16

Type returns the packet type

func (*Packet) Version

func (packet *Packet) Version() uint8

Version gets the packet PRUDP version

type PacketInterface

type PacketInterface interface {
	Data() []byte
	Sender() *Client
	SetVersion(version uint8)
	Version() uint8
	SetSource(source uint8)
	Source() uint8
	SetDestination(destination uint8)
	Destination() uint8
	SetType(packetType uint16)
	Type() uint16
	SetFlags(bitmask uint16)
	Flags() uint16
	HasFlag(flag uint16) bool
	AddFlag(flag uint16)
	ClearFlag(flag uint16)
	SetSessionID(sessionID uint8)
	SessionID() uint8
	SetSignature(signature []byte)
	Signature() []byte
	SetSequenceID(sequenceID uint16)
	SequenceID() uint16
	SetConnectionSignature(connectionSignature []byte)
	ConnectionSignature() []byte
	SetFragmentID(fragmentID uint8)
	FragmentID() uint8
	SetPayload(payload []byte)
	Payload() []byte
	DecryptPayload() error
	RMCRequest() RMCRequest
	Bytes() []byte
}

PacketInterface implements all Packet methods

type PacketManager added in v1.0.41

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

PacketManager implements an API for pushing/popping packets in the correct order

func NewPacketManager added in v1.0.41

func NewPacketManager() *PacketManager

NewPacketManager returns a new PacketManager

func (*PacketManager) Next added in v1.0.41

func (p *PacketManager) Next() PacketInterface

Next gets the next packet in the sequence. Returns nil if the next packet has not been sent yet

func (*PacketManager) Push added in v1.0.41

func (p *PacketManager) Push(packet PacketInterface)

Push adds a packet to the pool to choose from in Next

func (*PacketManager) RemoveByIndex added in v1.0.41

func (p *PacketManager) RemoveByIndex(i int)

RemoveByIndex removes a packet from the pool using it's index in the slice

type PacketResendManager added in v1.0.41

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

PacketResendManager manages all the pending packets sent the client waiting to be ACKed

func NewPacketResendManager added in v1.0.41

func NewPacketResendManager(timeoutTime time.Duration, timeoutIncrement time.Duration, maxIterations int) *PacketResendManager

NewPacketResendManager returns a new PacketResendManager

func (*PacketResendManager) Add added in v1.0.41

func (p *PacketResendManager) Add(packet PacketInterface)

Add creates a PendingPacket, adds it to the pool, and begins it's timeout timer

func (*PacketResendManager) Clear added in v1.0.41

func (p *PacketResendManager) Clear()

Clear removes all packets from pool and stops their timers

func (*PacketResendManager) Remove added in v1.0.41

func (p *PacketResendManager) Remove(sequenceID uint16)

Remove removes a packet from pool and stops it's timer

type PacketV0

type PacketV0 struct {
	Packet
	// contains filtered or unexported fields
}

PacketV0 reresents a PRUDPv0 packet

func NewPacketV0

func NewPacketV0(client *Client, data []byte) (*PacketV0, error)

NewPacketV0 returns a new PRUDPv0 packet

func (*PacketV0) Bytes

func (packet *PacketV0) Bytes() []byte

Bytes encodes the packet and returns a byte array

func (*PacketV0) Checksum

func (packet *PacketV0) Checksum() uint8

Checksum returns the packet checksum

func (*PacketV0) Decode

func (packet *PacketV0) Decode() error

Decode decodes the packet

func (*PacketV0) DecryptPayload added in v1.0.41

func (packet *PacketV0) DecryptPayload() error

DecryptPayload decrypts the packets payload and sets the RMC request data

func (*PacketV0) SetChecksum

func (packet *PacketV0) SetChecksum(checksum uint8)

SetChecksum sets the packet checksum

type PacketV1

type PacketV1 struct {
	Packet
	// contains filtered or unexported fields
}

PacketV1 reresents a PRUDPv1 packet

func NewPacketV1

func NewPacketV1(client *Client, data []byte) (*PacketV1, error)

NewPacketV1 returns a new PRUDPv1 packet

func (*PacketV1) Bytes

func (packet *PacketV1) Bytes() []byte

Bytes encodes the packet and returns a byte array

func (*PacketV1) Decode

func (packet *PacketV1) Decode() error

Decode decodes the packet

func (*PacketV1) DecryptPayload added in v1.0.41

func (packet *PacketV1) DecryptPayload() error

DecryptPayload decrypts the packets payload and sets the RMC request data

func (*PacketV1) InitialSequenceID

func (packet *PacketV1) InitialSequenceID() uint16

InitialSequenceID returns the packet initial sequence ID for unreliable packets

func (*PacketV1) MaximumSubstreamID

func (packet *PacketV1) MaximumSubstreamID() uint8

MaximumSubstreamID returns the packet maximum substream ID

func (*PacketV1) PRUDPProtocolMinorVersion added in v1.0.9

func (packet *PacketV1) PRUDPProtocolMinorVersion() int

PRUDPProtocolMinorVersion returns the packet PRUDP minor version

func (*PacketV1) SetInitialSequenceID

func (packet *PacketV1) SetInitialSequenceID(initialSequenceID uint16)

SetInitialSequenceID sets the packet initial sequence ID for unreliable packets

func (*PacketV1) SetMaximumSubstreamID

func (packet *PacketV1) SetMaximumSubstreamID(maximumSubstreamID uint8)

SetMaximumSubstreamID sets the packet maximum substream ID

func (*PacketV1) SetPRUDPProtocolMinorVersion added in v1.0.9

func (packet *PacketV1) SetPRUDPProtocolMinorVersion(prudpProtocolMinorVersion int)

SetPRUDPProtocolMinorVersion sets the packet PRUDP minor version

func (*PacketV1) SetSubstreamID

func (packet *PacketV1) SetSubstreamID(substreamID uint8)

SetSubstreamID sets the packet substream ID

func (*PacketV1) SetSupportedFunctions

func (packet *PacketV1) SetSupportedFunctions(supportedFunctions int)

SetSupportedFunctions sets the packet supported functions flags

func (*PacketV1) SubstreamID

func (packet *PacketV1) SubstreamID() uint8

SubstreamID returns the packet substream ID

func (*PacketV1) SupportedFunctions

func (packet *PacketV1) SupportedFunctions() int

SupportedFunctions returns the packet supported functions flags

type PendingPacket added in v1.0.41

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

PendingPacket represents a packet which the server has sent but not received an ACK for it handles it's own retransmission on a per-packet timer

func NewPendingPacket added in v1.0.41

func NewPendingPacket(packet PacketInterface, timeoutTime time.Duration, timeoutIncrement time.Duration, maxIterations int) *PendingPacket

NewPendingPacket returns a new PendingPacket

func (*PendingPacket) BeginTimeoutTimer added in v1.0.41

func (p *PendingPacket) BeginTimeoutTimer()

BeginTimeoutTimer starts the pending packets timeout timer until it is either stopped or maxIterations is hit

func (*PendingPacket) StopTimeoutTimer added in v1.0.41

func (p *PendingPacket) StopTimeoutTimer()

StopTimeoutTimer stops the packet retransmission timer

type RMCRequest

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

RMCRequest represets a RMC request

func NewRMCRequest

func NewRMCRequest() RMCRequest

NewRMCRequest returns a new blank RMCRequest

func (*RMCRequest) Bytes

func (request *RMCRequest) Bytes() []byte

Bytes converts a RMCRequest struct into a usable byte array

func (*RMCRequest) CallID

func (request *RMCRequest) CallID() uint32

CallID sets the RMC request callID

func (*RMCRequest) CustomID

func (request *RMCRequest) CustomID() uint16

CustomID returns the RMC request custom ID

func (*RMCRequest) FromBytes

func (request *RMCRequest) FromBytes(data []byte) error

FromBytes converts a byte slice into a RMCRequest

func (*RMCRequest) MethodID

func (request *RMCRequest) MethodID() uint32

MethodID sets the RMC request methodID

func (*RMCRequest) Parameters

func (request *RMCRequest) Parameters() []byte

Parameters sets the RMC request parameters

func (*RMCRequest) ProtocolID

func (request *RMCRequest) ProtocolID() uint8

ProtocolID sets the RMC request protocolID

func (*RMCRequest) SetCallID

func (request *RMCRequest) SetCallID(callID uint32)

SetCallID sets the RMC request call ID

func (*RMCRequest) SetCustomID

func (request *RMCRequest) SetCustomID(customID uint16)

SetCustomID sets the RMC request custom ID

func (*RMCRequest) SetMethodID

func (request *RMCRequest) SetMethodID(methodID uint32)

SetMethodID sets the RMC request method ID

func (*RMCRequest) SetParameters

func (request *RMCRequest) SetParameters(parameters []byte)

SetParameters sets the RMC request parameters

func (*RMCRequest) SetProtocolID

func (request *RMCRequest) SetProtocolID(protocolID uint8)

SetProtocolID sets the RMC request protocol ID

type RMCResponse

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

RMCResponse represents a RMC response

func NewRMCResponse

func NewRMCResponse(protocolID uint8, callID uint32) RMCResponse

NewRMCResponse returns a new RMCResponse

func (*RMCResponse) Bytes

func (response *RMCResponse) Bytes() []byte

Bytes converts a RMCResponse struct into a usable byte array

func (*RMCResponse) CustomID added in v1.0.11

func (response *RMCResponse) CustomID() uint16

CustomID returns the RMC response customID

func (*RMCResponse) SetCustomID added in v1.0.11

func (response *RMCResponse) SetCustomID(customID uint16)

SetCustomID sets the RMC response customID

func (*RMCResponse) SetError

func (response *RMCResponse) SetError(errorCode uint32)

SetError sets the RMCResponse payload to an instance of RMCError

func (*RMCResponse) SetSuccess

func (response *RMCResponse) SetSuccess(methodID uint32, data []byte)

SetSuccess sets the RMCResponse payload to an instance of RMCSuccess

type RVConnectionData

type RVConnectionData struct {
	Structure
	// contains filtered or unexported fields
}

RVConnectionData represents a nex RVConnectionData type

func NewRVConnectionData

func NewRVConnectionData() *RVConnectionData

NewRVConnectionData returns a new RVConnectionData

func (*RVConnectionData) Bytes

func (rvConnectionData *RVConnectionData) Bytes(stream *StreamOut) []byte

Bytes encodes the RVConnectionData and returns a byte array

func (*RVConnectionData) Copy added in v1.0.23

func (rvConnectionData *RVConnectionData) Copy() StructureInterface

Copy returns a new copied instance of RVConnectionData

func (*RVConnectionData) Equals added in v1.0.23

func (rvConnectionData *RVConnectionData) Equals(structure StructureInterface) bool

Equals checks if the passed Structure contains the same data as the current instance

func (*RVConnectionData) FormatToString added in v1.0.28

func (rvConnectionData *RVConnectionData) FormatToString(indentationLevel int) string

FormatToString pretty-prints the struct data using the provided indentation level

func (*RVConnectionData) SetSpecialProtocols

func (rvConnectionData *RVConnectionData) SetSpecialProtocols(specialProtocols []byte)

SetSpecialProtocols sets the RVConnectionData special protocol list (unused by Nintendo)

func (*RVConnectionData) SetStationURL

func (rvConnectionData *RVConnectionData) SetStationURL(stationURL string)

SetStationURL sets the RVConnectionData station URL

func (*RVConnectionData) SetStationURLSpecialProtocols

func (rvConnectionData *RVConnectionData) SetStationURLSpecialProtocols(stationURLSpecialProtocols string)

SetStationURLSpecialProtocols sets the RVConnectionData special station URL (unused by Nintendo)

func (*RVConnectionData) SetTime

func (rvConnectionData *RVConnectionData) SetTime(time *DateTime)

SetTime sets the RVConnectionData time

func (*RVConnectionData) String added in v1.0.28

func (rvConnectionData *RVConnectionData) String() string

String returns a string representation of the struct

type Result

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

Result is sent in methods which query large objects

func NewResult

func NewResult(code uint32) *Result

NewResult returns a new Result

func NewResultError added in v1.0.6

func NewResultError(code uint32) *Result

NewResultError returns a new Result set as an error

func NewResultSuccess added in v1.0.6

func NewResultSuccess(code uint32) *Result

NewResultSuccess returns a new Result set as a success

func (*Result) Bytes

func (result *Result) Bytes(stream *StreamOut) []byte

Bytes encodes the Result and returns a byte array

func (*Result) Copy added in v1.0.24

func (result *Result) Copy() *Result

Copy returns a new copied instance of Result

func (*Result) Equals added in v1.0.24

func (result *Result) Equals(other *Result) bool

Equals checks if the passed Structure contains the same data as the current instance

func (*Result) ExtractFromStream

func (result *Result) ExtractFromStream(stream *StreamIn) error

ExtractFromStream extracts a Result structure from a stream

func (*Result) FormatToString added in v1.0.28

func (result *Result) FormatToString(indentationLevel int) string

FormatToString pretty-prints the struct data using the provided indentation level

func (*Result) IsError added in v1.0.6

func (result *Result) IsError() bool

IsError returns true if the Result is a error

func (*Result) IsSuccess added in v1.0.6

func (result *Result) IsSuccess() bool

IsSuccess returns true if the Result is a success

func (*Result) String added in v1.0.28

func (result *Result) String() string

String returns a string representation of the struct

type ResultRange

type ResultRange struct {
	Structure
	Offset uint32
	Length uint32
}

ResultRange is sent in methods which query large objects

func NewResultRange

func NewResultRange() *ResultRange

NewResultRange returns a new ResultRange

func (*ResultRange) Copy added in v1.0.23

func (resultRange *ResultRange) Copy() StructureInterface

Copy returns a new copied instance of ResultRange

func (*ResultRange) Equals added in v1.0.23

func (resultRange *ResultRange) Equals(structure StructureInterface) bool

Equals checks if the passed Structure contains the same data as the current instance

func (*ResultRange) ExtractFromStream

func (resultRange *ResultRange) ExtractFromStream(stream *StreamIn) error

ExtractFromStream extracts a ResultRange structure from a stream

func (*ResultRange) FormatToString added in v1.0.28

func (resultRange *ResultRange) FormatToString(indentationLevel int) string

FormatToString pretty-prints the struct data using the provided indentation level

func (*ResultRange) String added in v1.0.28

func (resultRange *ResultRange) String() string

String returns a string representation of the struct

type SequenceIDManager added in v1.0.41

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

SequenceIDManager implements an API for managing the sequence IDs of different packet streams on a client

func NewSequenceIDManager added in v1.0.41

func NewSequenceIDManager() *SequenceIDManager

NewSequenceIDManager returns a new SequenceIDManager

func (*SequenceIDManager) Next added in v1.0.41

func (s *SequenceIDManager) Next(packet PacketInterface) uint32

Next gets the next sequence ID for the packet. Returns 0 for an unsupported packet

type Server

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

Server represents a PRUDP server

func NewServer

func NewServer() *Server

NewServer returns a new NEX server

func (*Server) AccessKey

func (server *Server) AccessKey() string

AccessKey returns the server access key

func (*Server) AcknowledgePacket

func (server *Server) AcknowledgePacket(packet PacketInterface, payload []byte)

AcknowledgePacket acknowledges that the given packet was recieved

func (*Server) ClientConnected

func (server *Server) ClientConnected(client *Client) bool

ClientConnected checks if a given client is stored on the server

func (*Server) ConnectionIDCounter

func (server *Server) ConnectionIDCounter() *Counter

ConnectionIDCounter gets the server connection ID counter

func (*Server) DataStoreProtocolVersion added in v1.0.15

func (server *Server) DataStoreProtocolVersion() *NEXVersion

DataStoreProtocolVersion returns the servers DataStore protocol version

func (*Server) Emit

func (server *Server) Emit(event string, packet interface{})

Emit runs the given event handle

func (*Server) FindClientFromConnectionID

func (server *Server) FindClientFromConnectionID(rvcid uint32) *Client

FindClientFromConnectionID finds a client by their Connection ID

func (*Server) FindClientFromPID

func (server *Server) FindClientFromPID(pid uint32) *Client

FindClientFromPID finds a client by their PID

func (*Server) GracefulKick added in v1.0.20

func (server *Server) GracefulKick(client *Client)

GracefulKick removes an active client from the server

func (*Server) GracefulKickAll added in v1.0.20

func (server *Server) GracefulKickAll()

GracefulKickAll removes all clients from the server

func (*Server) HPPListen added in v1.0.20

func (server *Server) HPPListen(address string)

HPPListen starts a NEX HPP server on a given address

func (*Server) KerberosKeySize

func (server *Server) KerberosKeySize() int

KerberosKeySize returns the server kerberos key size

func (*Server) KerberosPassword added in v1.0.6

func (server *Server) KerberosPassword() string

KerberosPassword returns the server kerberos password

func (*Server) KerberosTicketVersion added in v1.0.5

func (server *Server) KerberosTicketVersion() int

KerberosTicketVersion returns the server kerberos ticket contents version

func (*Server) Listen

func (server *Server) Listen(address string)

Listen starts a NEX server on a given address

func (*Server) MatchMakingProtocolVersion added in v1.0.15

func (server *Server) MatchMakingProtocolVersion() *NEXVersion

MatchMakingProtocolVersion returns the servers MatchMaking protocol version

func (*Server) MessagingProtocolVersion added in v1.0.15

func (server *Server) MessagingProtocolVersion() *NEXVersion

MessagingProtocolVersion returns the servers Messaging protocol version

func (*Server) NATTraversalProtocolVersion added in v1.0.29

func (server *Server) NATTraversalProtocolVersion() *NEXVersion

NATTraversalProtocolVersion returns the servers NAT Traversal protocol version

func (*Server) NEXVersion added in v1.0.15

func (server *Server) NEXVersion() *NEXVersion

NEXVersion returns the server NEX version

func (*Server) On

func (server *Server) On(event string, handler interface{})

On sets the data event handler

func (*Server) PRUDPProtocolMinorVersion added in v1.0.9

func (server *Server) PRUDPProtocolMinorVersion() int

PRUDPProtocolMinorVersion returns the server PRUDP minor version

func (*Server) PRUDPVersion added in v1.0.15

func (server *Server) PRUDPVersion() int

PRUDPVersion returns the server PRUDP version

func (*Server) PasswordFromPIDFunction added in v1.0.20

func (server *Server) PasswordFromPIDFunction() func(pid uint32) (string, uint32)

PasswordFromPIDFunction returns the function for HPP or the auth server to get a NEX password using the PID

func (*Server) PingTimeout

func (server *Server) PingTimeout() int

PingTimeout returns the server ping timeout time in seconds

func (*Server) Ranking2ProtocolVersion added in v1.0.15

func (server *Server) Ranking2ProtocolVersion() *NEXVersion

Ranking2ProtocolVersion returns the servers Ranking2 protocol version

func (*Server) RankingProtocolVersion added in v1.0.15

func (server *Server) RankingProtocolVersion() *NEXVersion

RankingProtocolVersion returns the servers Ranking protocol version

func (*Server) Send

func (server *Server) Send(packet PacketInterface)

Send writes data to client

func (*Server) SendFragment

func (server *Server) SendFragment(packet PacketInterface, fragmentID uint8)

SendFragment sends a packet fragment to the client

func (*Server) SendPing

func (server *Server) SendPing(client *Client)

SendPing sends a ping packet to the given client

func (*Server) SendRaw

func (server *Server) SendRaw(conn *net.UDPAddr, data []byte)

SendRaw writes raw packet data to the client socket

func (*Server) SetAccessKey

func (server *Server) SetAccessKey(accessKey string)

SetAccessKey sets the server access key

func (*Server) SetDataStoreProtocolVersion added in v1.0.15

func (server *Server) SetDataStoreProtocolVersion(nexVersion *NEXVersion)

SetDataStoreProtocolVersion sets the servers DataStore protocol version

func (*Server) SetDefaultNEXVersion added in v1.0.15

func (server *Server) SetDefaultNEXVersion(nexVersion *NEXVersion)

SetDefaultNEXVersion sets the default NEX protocol versions

func (*Server) SetEmulatedPacketDropPercent added in v1.0.41

func (server *Server) SetEmulatedPacketDropPercent(forRecv bool, percent int)

SetEmulatedPacketDropPercent sets the percentage of emulated sent and received dropped packets

func (*Server) SetFragmentSize

func (server *Server) SetFragmentSize(fragmentSize int16)

SetFragmentSize sets the packet fragment size

func (*Server) SetKerberosKeySize

func (server *Server) SetKerberosKeySize(kerberosKeySize int)

SetKerberosKeySize sets the server kerberos key size

func (*Server) SetKerberosPassword added in v1.0.6

func (server *Server) SetKerberosPassword(kerberosPassword string)

SetKerberosPassword sets the server kerberos password

func (*Server) SetKerberosTicketVersion added in v1.0.5

func (server *Server) SetKerberosTicketVersion(ticketVersion int)

SetKerberosTicketVersion sets the server kerberos ticket contents version

func (*Server) SetMatchMakingProtocolVersion added in v1.0.15

func (server *Server) SetMatchMakingProtocolVersion(nexVersion *NEXVersion)

SetMatchMakingProtocolVersion sets the servers MatchMaking protocol version

func (*Server) SetMessagingProtocolVersion added in v1.0.15

func (server *Server) SetMessagingProtocolVersion(nexVersion *NEXVersion)

SetMessagingProtocolVersion sets the servers Messaging protocol version

func (*Server) SetNATTraversalProtocolVersion added in v1.0.29

func (server *Server) SetNATTraversalProtocolVersion(nexVersion *NEXVersion)

SetNATTraversalProtocolVersion sets the servers NAT Traversal protocol version

func (*Server) SetPRUDPProtocolMinorVersion added in v1.0.9

func (server *Server) SetPRUDPProtocolMinorVersion(prudpProtocolMinorVersion int)

SetPRUDPProtocolMinorVersion sets the server PRUDP minor

func (*Server) SetPRUDPVersion added in v1.0.15

func (server *Server) SetPRUDPVersion(prudpVersion int)

SetPRUDPVersion sets the server PRUDP version

func (*Server) SetPasswordFromPIDFunction added in v1.0.20

func (server *Server) SetPasswordFromPIDFunction(handler func(pid uint32) (string, uint32))

SetPasswordFromPIDFunction sets the function for HPP or the auth server to get a NEX password using the PID

func (*Server) SetPingTimeout

func (server *Server) SetPingTimeout(pingTimeout int)

SetPingTimeout sets the server ping timeout time in seconds

func (*Server) SetRanking2ProtocolVersion added in v1.0.15

func (server *Server) SetRanking2ProtocolVersion(nexVersion *NEXVersion)

SetRanking2ProtocolVersion sets the servers Ranking2 protocol version

func (*Server) SetRankingProtocolVersion added in v1.0.15

func (server *Server) SetRankingProtocolVersion(nexVersion *NEXVersion)

SetRankingProtocolVersion sets the servers Ranking protocol version

func (*Server) SetResendMaxIterations added in v1.0.41

func (server *Server) SetResendMaxIterations(resendMaxIterations int)

SetResendMaxIterations sets the max number of times a packet can try to resend before assuming the client is dead

func (*Server) SetResendTimeout added in v1.0.41

func (server *Server) SetResendTimeout(resendTimeout time.Duration)

SetResendTimeout sets the time that a packet should wait before resending to the client

func (*Server) SetResendTimeoutIncrement added in v1.0.41

func (server *Server) SetResendTimeoutIncrement(resendTimeoutIncrement time.Duration)

SetResendTimeoutIncrement sets how much to increment the resendTimeout every time a packet is resent to the client

func (*Server) SetSocket

func (server *Server) SetSocket(socket *net.UDPConn)

SetSocket sets the underlying UDP socket

func (*Server) SetSupportedFunctions added in v1.0.9

func (server *Server) SetSupportedFunctions(supportedFunctions int)

SetSupportedFunctions sets the supported PRUDP functions by the server

func (*Server) SetUtilityProtocolVersion added in v1.0.15

func (server *Server) SetUtilityProtocolVersion(nexVersion *NEXVersion)

SetUtilityProtocolVersion sets the servers Utility protocol version

func (*Server) Socket

func (server *Server) Socket() *net.UDPConn

Socket returns the underlying server UDP socket

func (*Server) SupportedFunctions added in v1.0.9

func (server *Server) SupportedFunctions() int

SupportedFunctions returns the supported PRUDP functions by the server

func (*Server) TimeoutKick added in v1.0.20

func (server *Server) TimeoutKick(client *Client)

TimeoutKick removes a client from the server for inactivity

func (*Server) UtilityProtocolVersion added in v1.0.15

func (server *Server) UtilityProtocolVersion() *NEXVersion

UtilityProtocolVersion returns the servers Utility protocol version

type StationURL

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

StationURL contains the data for a NEX station URL. Uses uint32 pointers to check for nil, 0 is valid

func NewStationURL

func NewStationURL(str string) *StationURL

NewStationURL returns a new StationURL

func (*StationURL) Address

func (stationURL *StationURL) Address() string

Address returns the StationURL address

func (*StationURL) CID

func (stationURL *StationURL) CID() uint32

CID returns the StationURL CID value

func (*StationURL) Copy added in v1.0.24

func (stationURL *StationURL) Copy() *StationURL

Copy returns a new copied instance of StationURL

func (*StationURL) EncodeToString

func (stationURL *StationURL) EncodeToString() string

EncodeToString encodes the StationURL into a string

func (*StationURL) Equals added in v1.0.24

func (stationURL *StationURL) Equals(other *StationURL) bool

Equals checks if the passed Structure contains the same data as the current instance

func (*StationURL) FormatToString added in v1.0.28

func (stationURL *StationURL) FormatToString(indentationLevel int) string

FormatToString pretty-prints the struct data using the provided indentation level

func (*StationURL) FromString

func (stationURL *StationURL) FromString(str string)

FromString parses the StationURL data from a string

func (*StationURL) IsLocal added in v1.0.36

func (stationURL *StationURL) IsLocal() bool

IsLocal checks if the StationURL is a local URL

func (*StationURL) IsPublic added in v1.0.36

func (stationURL *StationURL) IsPublic() bool

IsPublic checks if the StationURL is a public URL

func (*StationURL) Natf

func (stationURL *StationURL) Natf() uint32

Natf returns the StationURL Natf value

func (*StationURL) Natm

func (stationURL *StationURL) Natm() uint32

Natm returns the StationURL Natm value

func (*StationURL) PID

func (stationURL *StationURL) PID() uint32

PID returns the StationURL PID value

func (*StationURL) PL added in v1.0.37

func (stationURL *StationURL) PL() uint32

PL returns the StationURL Pl

func (*StationURL) PRID

func (stationURL *StationURL) PRID() uint32

PRID returns the StationURL PRID value

func (*StationURL) Pmp

func (stationURL *StationURL) Pmp() uint32

Pmp returns the StationURL Pmp value

func (*StationURL) Port

func (stationURL *StationURL) Port() uint32

Port returns the StationURL port

func (*StationURL) ProbeInit

func (stationURL *StationURL) ProbeInit() uint32

ProbeInit returns the StationURL ProbeInit value

func (*StationURL) RVCID

func (stationURL *StationURL) RVCID() uint32

RVCID returns the StationURL RVCID

func (*StationURL) SID

func (stationURL *StationURL) SID() uint32

SID returns the StationURL SID value

func (*StationURL) Scheme

func (stationURL *StationURL) Scheme() string

Scheme returns the StationURL scheme type

func (*StationURL) SetAddress

func (stationURL *StationURL) SetAddress(address string)

SetAddress sets the StationURL address

func (*StationURL) SetCID

func (stationURL *StationURL) SetCID(cid uint32)

SetCID sets the StationURL CID

func (*StationURL) SetLocal added in v1.0.36

func (stationURL *StationURL) SetLocal()

SetLocal marks the StationURL as an local URL

func (*StationURL) SetNatf

func (stationURL *StationURL) SetNatf(natf uint32)

SetNatf sets the StationURL Natf

func (*StationURL) SetNatm

func (stationURL *StationURL) SetNatm(natm uint32)

SetNatm sets the StationURL Natm

func (*StationURL) SetPID added in v1.0.5

func (stationURL *StationURL) SetPID(pid uint32)

SetPID sets the StationURL PID

func (*StationURL) SetPL added in v1.0.37

func (stationURL *StationURL) SetPL(pl uint32)

SetPL sets the StationURL Pl

func (*StationURL) SetPRID

func (stationURL *StationURL) SetPRID(prid uint32)

SetPRID sets the StationURL PRID

func (*StationURL) SetPmp

func (stationURL *StationURL) SetPmp(pmp uint32)

SetPmp sets the StationURL Pmp

func (*StationURL) SetPort

func (stationURL *StationURL) SetPort(port uint32)

SetPort sets the StationURL port

func (*StationURL) SetProbeInit

func (stationURL *StationURL) SetProbeInit(probeinit uint32)

SetProbeInit sets the StationURL ProbeInit

func (*StationURL) SetPublic added in v1.0.36

func (stationURL *StationURL) SetPublic()

SetPublic marks the StationURL as an public URL

func (*StationURL) SetRVCID

func (stationURL *StationURL) SetRVCID(rvcid uint32)

SetRVCID sets the StationURL RVCID

func (*StationURL) SetSID

func (stationURL *StationURL) SetSID(sid uint32)

SetSID sets the StationURL SID

func (*StationURL) SetScheme

func (stationURL *StationURL) SetScheme(scheme string)

SetScheme sets the StationURL scheme

func (*StationURL) SetStream

func (stationURL *StationURL) SetStream(stream uint32)

SetStream sets the StationURL stream

func (*StationURL) SetType

func (stationURL *StationURL) SetType(transportType uint32)

SetType sets the StationURL transportType

func (*StationURL) SetUpnp

func (stationURL *StationURL) SetUpnp(upnp uint32)

SetUpnp sets the StationURL Upnp

func (*StationURL) Stream

func (stationURL *StationURL) Stream() uint32

Stream returns the StationURL stream value

func (*StationURL) String added in v1.0.28

func (stationURL *StationURL) String() string

String returns a string representation of the struct

func (*StationURL) Type

func (stationURL *StationURL) Type() uint32

Type returns the StationURL type

func (*StationURL) Upnp

func (stationURL *StationURL) Upnp() uint32

Upnp returns the StationURL Upnp value

type StreamIn

type StreamIn struct {
	*crunch.Buffer
	Server *Server
}

StreamIn is an input stream abstraction of github.com/superwhiskers/crunch with nex type support

func NewStreamIn

func NewStreamIn(data []byte, server *Server) *StreamIn

NewStreamIn returns a new NEX input stream

func (*StreamIn) ReadBool

func (stream *StreamIn) ReadBool() (bool, error)

ReadBool reads a bool

func (*StreamIn) ReadBuffer

func (stream *StreamIn) ReadBuffer() ([]byte, error)

ReadBuffer reads a nex Buffer type

func (*StreamIn) ReadDataHolder added in v1.0.7

func (stream *StreamIn) ReadDataHolder() (*DataHolder, error)

ReadDataHolder reads a DataHolder type

func (*StreamIn) ReadDateTime added in v1.0.6

func (stream *StreamIn) ReadDateTime() (*DateTime, error)

ReadDateTime reads a DateTime type

func (*StreamIn) ReadFloat32BE added in v1.0.26

func (stream *StreamIn) ReadFloat32BE() (float32, error)

ReadFloat32BE reads a Big-Endian encoded float32

func (*StreamIn) ReadFloat32LE added in v1.0.26

func (stream *StreamIn) ReadFloat32LE() (float32, error)

ReadFloat32LE reads a Little-Endian encoded float32

func (*StreamIn) ReadFloat64BE added in v1.0.26

func (stream *StreamIn) ReadFloat64BE() (float64, error)

ReadFloat64BE reads a Big-Endian encoded float64

func (*StreamIn) ReadFloat64LE added in v1.0.25

func (stream *StreamIn) ReadFloat64LE() (float64, error)

ReadFloat64LE reads a Little-Endian encoded float64

func (*StreamIn) ReadInt16BE added in v1.0.26

func (stream *StreamIn) ReadInt16BE() (int16, error)

ReadInt16BE reads a Big-Endian encoded int16

func (*StreamIn) ReadInt16LE added in v1.0.26

func (stream *StreamIn) ReadInt16LE() (int16, error)

ReadInt16LE reads a Little-Endian encoded int16

func (*StreamIn) ReadInt32BE added in v1.0.26

func (stream *StreamIn) ReadInt32BE() (int32, error)

ReadInt32BE reads a Big-Endian encoded int32

func (*StreamIn) ReadInt32LE

func (stream *StreamIn) ReadInt32LE() (int32, error)

ReadInt32LE reads a Little-Endian encoded int32

func (*StreamIn) ReadInt64BE added in v1.0.26

func (stream *StreamIn) ReadInt64BE() (int64, error)

ReadInt64BE reads a Big-Endian encoded int64

func (*StreamIn) ReadInt64LE added in v1.0.25

func (stream *StreamIn) ReadInt64LE() (int64, error)

ReadInt64LE reads a Little-Endian encoded int64

func (*StreamIn) ReadInt8 added in v1.0.26

func (stream *StreamIn) ReadInt8() (int8, error)

ReadInt8 reads a uint8

func (*StreamIn) ReadListBuffer added in v1.0.31

func (stream *StreamIn) ReadListBuffer() ([][]byte, error)

ReadListBuffer reads a list of NEX Buffer types

func (*StreamIn) ReadListDataHolder added in v1.0.39

func (stream *StreamIn) ReadListDataHolder() ([]*DataHolder, error)

ReadListDataHolder reads a list of NEX DataHolder types

func (*StreamIn) ReadListFloat32BE added in v1.0.26

func (stream *StreamIn) ReadListFloat32BE() ([]float32, error)

ReadListFloat32BE reads a list of Big-Endian encoded float32 types

func (*StreamIn) ReadListFloat32LE added in v1.0.26

func (stream *StreamIn) ReadListFloat32LE() ([]float32, error)

ReadListFloat32LE reads a list of Little-Endian encoded float32 types

func (*StreamIn) ReadListFloat64BE added in v1.0.26

func (stream *StreamIn) ReadListFloat64BE() ([]float64, error)

ReadListFloat64BE reads a list of Big-Endian encoded float64 types

func (*StreamIn) ReadListFloat64LE added in v1.0.26

func (stream *StreamIn) ReadListFloat64LE() ([]float64, error)

ReadListFloat64LE reads a list of Little-Endian encoded float64 types

func (*StreamIn) ReadListInt16BE added in v1.0.26

func (stream *StreamIn) ReadListInt16BE() ([]int16, error)

ReadListInt16BE reads a list of Big-Endian encoded uint16 types

func (*StreamIn) ReadListInt16LE added in v1.0.26

func (stream *StreamIn) ReadListInt16LE() ([]int16, error)

ReadListInt16LE reads a list of Little-Endian encoded int16 types

func (*StreamIn) ReadListInt32BE added in v1.0.26

func (stream *StreamIn) ReadListInt32BE() ([]int32, error)

ReadListInt32BE reads a list of Big-Endian encoded int32 types

func (*StreamIn) ReadListInt32LE

func (stream *StreamIn) ReadListInt32LE() ([]int32, error)

ReadListInt32LE reads a list of Little-Endian encoded int32 types

func (*StreamIn) ReadListInt64BE added in v1.0.26

func (stream *StreamIn) ReadListInt64BE() ([]int64, error)

ReadListInt64BE reads a list of Big-Endian encoded int64 types

func (*StreamIn) ReadListInt64LE added in v1.0.26

func (stream *StreamIn) ReadListInt64LE() ([]int64, error)

ReadListInt64LE reads a list of Little-Endian encoded int64 types

func (*StreamIn) ReadListInt8 added in v1.0.26

func (stream *StreamIn) ReadListInt8() ([]int8, error)

ReadListInt8 reads a list of int8 types

func (*StreamIn) ReadListQBuffer

func (stream *StreamIn) ReadListQBuffer() ([][]byte, error)

ReadListQBuffer reads a list of NEX qBuffer types

func (*StreamIn) ReadListStationURL added in v1.0.16

func (stream *StreamIn) ReadListStationURL() ([]*StationURL, error)

ReadListStationURL reads a list of NEX Station URL types

func (*StreamIn) ReadListString

func (stream *StreamIn) ReadListString() ([]string, error)

ReadListString reads a list of NEX String types

func (*StreamIn) ReadListStructure added in v1.0.16

func (stream *StreamIn) ReadListStructure(structure StructureInterface) (interface{}, error)

ReadListStructure reads and returns a list structure types

func (*StreamIn) ReadListUInt16BE added in v1.0.26

func (stream *StreamIn) ReadListUInt16BE() ([]uint16, error)

ReadListUInt16BE reads a list of Big-Endian encoded uint16 types

func (*StreamIn) ReadListUInt16LE

func (stream *StreamIn) ReadListUInt16LE() ([]uint16, error)

ReadListUInt16LE reads a list of Little-Endian encoded uint16 types

func (*StreamIn) ReadListUInt32BE added in v1.0.26

func (stream *StreamIn) ReadListUInt32BE() ([]uint32, error)

ReadListUInt32BE reads a list of Big-Endian encoded uint32 types

func (*StreamIn) ReadListUInt32LE

func (stream *StreamIn) ReadListUInt32LE() ([]uint32, error)

ReadListUInt32LE reads a list of Little-Endian encoded uint32 types

func (*StreamIn) ReadListUInt64BE added in v1.0.26

func (stream *StreamIn) ReadListUInt64BE() ([]uint64, error)

ReadListUInt64BE reads a list of Big-Endian encoded uint64 types

func (*StreamIn) ReadListUInt64LE

func (stream *StreamIn) ReadListUInt64LE() ([]uint64, error)

ReadListUInt64LE reads a list of Little-Endian encoded uint64 types

func (*StreamIn) ReadListUInt8

func (stream *StreamIn) ReadListUInt8() ([]uint8, error)

ReadListUInt8 reads a list of uint8 types

func (*StreamIn) ReadMap

func (stream *StreamIn) ReadMap(keyFunction interface{}, valueFunction interface{}) (map[interface{}]interface{}, error)

ReadMap reads a Map type with the given key and value types

func (*StreamIn) ReadQBuffer

func (stream *StreamIn) ReadQBuffer() ([]byte, error)

ReadQBuffer reads a nex qBuffer type

func (*StreamIn) ReadRemaining added in v1.0.41

func (stream *StreamIn) ReadRemaining() []byte

ReadRemaining reads all the data left to be read in the buffer

func (*StreamIn) ReadStationURL added in v1.0.16

func (stream *StreamIn) ReadStationURL() (*StationURL, error)

ReadStationURL reads a StationURL type

func (*StreamIn) ReadString

func (stream *StreamIn) ReadString() (string, error)

ReadString reads and returns a nex string type

func (*StreamIn) ReadStructure

func (stream *StreamIn) ReadStructure(structure StructureInterface) (StructureInterface, error)

ReadStructure reads a nex Structure type

func (*StreamIn) ReadUInt16BE added in v1.0.26

func (stream *StreamIn) ReadUInt16BE() (uint16, error)

ReadUInt16BE reads a Big-Endian encoded uint16

func (*StreamIn) ReadUInt16LE

func (stream *StreamIn) ReadUInt16LE() (uint16, error)

ReadUInt16LE reads a Little-Endian encoded uint16

func (*StreamIn) ReadUInt32BE added in v1.0.13

func (stream *StreamIn) ReadUInt32BE() (uint32, error)

ReadUInt32BE reads a Big-Endian encoded uint32

func (*StreamIn) ReadUInt32LE

func (stream *StreamIn) ReadUInt32LE() (uint32, error)

ReadUInt32LE reads a Little-Endian encoded uint32

func (*StreamIn) ReadUInt64BE added in v1.0.13

func (stream *StreamIn) ReadUInt64BE() (uint64, error)

ReadUInt64BE reads a Big-Endian encoded uint64

func (*StreamIn) ReadUInt64LE

func (stream *StreamIn) ReadUInt64LE() (uint64, error)

ReadUInt64LE reads a Little-Endian encoded uint64

func (*StreamIn) ReadUInt8

func (stream *StreamIn) ReadUInt8() (uint8, error)

ReadUInt8 reads a uint8

func (*StreamIn) ReadVariant

func (stream *StreamIn) ReadVariant() (*Variant, error)

ReadVariant reads a Variant type. This type can hold 7 different types

func (*StreamIn) Remaining added in v1.0.41

func (stream *StreamIn) Remaining() int

Remaining returns the amount of data left to be read in the buffer

type StreamOut

type StreamOut struct {
	*crunch.Buffer
	Server *Server
}

StreamOut is an abstraction of github.com/superwhiskers/crunch with nex type support

func NewStreamOut

func NewStreamOut(server *Server) *StreamOut

NewStreamOut returns a new nex output stream

func (*StreamOut) WriteBool

func (stream *StreamOut) WriteBool(b bool)

WriteBool writes a bool

func (*StreamOut) WriteBuffer

func (stream *StreamOut) WriteBuffer(data []byte)

WriteBuffer writes a NEX Buffer type

func (*StreamOut) WriteDataHolder

func (stream *StreamOut) WriteDataHolder(dataholder *DataHolder)

WriteDataHolder writes a NEX DataHolder type

func (*StreamOut) WriteDateTime added in v1.0.14

func (stream *StreamOut) WriteDateTime(datetime *DateTime)

WriteDateTime writes a NEX DateTime type

func (*StreamOut) WriteFloat32BE added in v1.0.26

func (stream *StreamOut) WriteFloat32BE(f32 float32)

WriteFloat32BE writes a float32 as BE

func (*StreamOut) WriteFloat32LE added in v1.0.26

func (stream *StreamOut) WriteFloat32LE(f32 float32)

WriteFloat32LE writes a float32 as LE

func (*StreamOut) WriteFloat64BE added in v1.0.26

func (stream *StreamOut) WriteFloat64BE(f64 float64)

WriteFloat64BE writes a float64 as BE

func (*StreamOut) WriteFloat64LE added in v1.0.25

func (stream *StreamOut) WriteFloat64LE(f64 float64)

WriteFloat64LE writes a float64 as LE

func (*StreamOut) WriteInt16BE added in v1.0.26

func (stream *StreamOut) WriteInt16BE(s16 int16)

WriteInt16BE writes a uint16 as BE

func (*StreamOut) WriteInt16LE added in v1.0.26

func (stream *StreamOut) WriteInt16LE(s16 int16)

WriteInt16LE writes a uint16 as LE

func (*StreamOut) WriteInt32BE added in v1.0.26

func (stream *StreamOut) WriteInt32BE(s32 int32)

WriteInt32BE writes a int32 as BE

func (*StreamOut) WriteInt32LE

func (stream *StreamOut) WriteInt32LE(s32 int32)

WriteInt32LE writes a int32 as LE

func (*StreamOut) WriteInt64BE added in v1.0.26

func (stream *StreamOut) WriteInt64BE(s64 int64)

WriteInt64BE writes a int64 as BE

func (*StreamOut) WriteInt64LE

func (stream *StreamOut) WriteInt64LE(s64 int64)

WriteInt64LE writes a int64 as LE

func (*StreamOut) WriteInt8 added in v1.0.26

func (stream *StreamOut) WriteInt8(s8 int8)

WriteInt8 writes a int8

func (*StreamOut) WriteListBuffer added in v1.0.31

func (stream *StreamOut) WriteListBuffer(buffers [][]byte)

WriteListBuffer writes a list of NEX Buffer types

func (*StreamOut) WriteListDataHolder added in v1.0.39

func (stream *StreamOut) WriteListDataHolder(dataholders []*DataHolder)

WriteListDataHolder writes a NEX DataHolder type

func (*StreamOut) WriteListFloat32BE added in v1.0.26

func (stream *StreamOut) WriteListFloat32BE(list []float32)

WriteListFloat32BE writes a list of Big-Endian encoded float32 types

func (*StreamOut) WriteListFloat32LE added in v1.0.26

func (stream *StreamOut) WriteListFloat32LE(list []float32)

WriteListFloat32LE writes a list of Little-Endian encoded float32 types

func (*StreamOut) WriteListFloat64BE added in v1.0.26

func (stream *StreamOut) WriteListFloat64BE(list []float64)

WriteListFloat64BE writes a list of Big-Endian encoded float64 types

func (*StreamOut) WriteListFloat64LE added in v1.0.26

func (stream *StreamOut) WriteListFloat64LE(list []float64)

WriteListFloat64LE writes a list of Little-Endian encoded float64 types

func (*StreamOut) WriteListInt16BE added in v1.0.26

func (stream *StreamOut) WriteListInt16BE(list []int16)

WriteListInt16BE writes a list of Big-Endian encoded int16 types

func (*StreamOut) WriteListInt16LE added in v1.0.26

func (stream *StreamOut) WriteListInt16LE(list []int16)

WriteListInt16LE writes a list of Little-Endian encoded int16 types

func (*StreamOut) WriteListInt32BE added in v1.0.26

func (stream *StreamOut) WriteListInt32BE(list []int32)

WriteListInt32BE writes a list of Big-Endian encoded int32 types

func (*StreamOut) WriteListInt32LE added in v1.0.26

func (stream *StreamOut) WriteListInt32LE(list []int32)

WriteListInt32LE writes a list of Little-Endian encoded int32 types

func (*StreamOut) WriteListInt64BE added in v1.0.26

func (stream *StreamOut) WriteListInt64BE(list []int64)

WriteListInt64BE writes a list of Big-Endian encoded int64 types

func (*StreamOut) WriteListInt64LE

func (stream *StreamOut) WriteListInt64LE(list []int64)

WriteListInt64LE writes a list of Little-Endian encoded int64 types

func (*StreamOut) WriteListInt8 added in v1.0.26

func (stream *StreamOut) WriteListInt8(list []int8)

WriteListInt8 writes a list of int8 types

func (*StreamOut) WriteListQBuffer

func (stream *StreamOut) WriteListQBuffer(buffers [][]byte)

WriteListQBuffer writes a list of NEX qBuffer types

func (*StreamOut) WriteListResult added in v1.0.6

func (stream *StreamOut) WriteListResult(results []*Result)

WriteListResult writes a list of NEX Result types

func (*StreamOut) WriteListStationURL added in v1.0.30

func (stream *StreamOut) WriteListStationURL(stationURLs []*StationURL)

WriteListStationURL writes a list of NEX StationURL types

func (*StreamOut) WriteListString

func (stream *StreamOut) WriteListString(strings []string)

WriteListString writes a list of NEX String types

func (*StreamOut) WriteListStructure

func (stream *StreamOut) WriteListStructure(structures interface{})

WriteListStructure writes a list of NEX Structure types

func (*StreamOut) WriteListUInt16BE added in v1.0.26

func (stream *StreamOut) WriteListUInt16BE(list []uint16)

WriteListUInt16BE writes a list of Big-Endian encoded uint16 types

func (*StreamOut) WriteListUInt16LE

func (stream *StreamOut) WriteListUInt16LE(list []uint16)

WriteListUInt16LE writes a list of Little-Endian encoded uint16 types

func (*StreamOut) WriteListUInt32BE added in v1.0.26

func (stream *StreamOut) WriteListUInt32BE(list []uint32)

WriteListUInt32BE writes a list of Big-Endian encoded uint32 types

func (*StreamOut) WriteListUInt32LE

func (stream *StreamOut) WriteListUInt32LE(list []uint32)

WriteListUInt32LE writes a list of Little-Endian encoded uint32 types

func (*StreamOut) WriteListUInt64BE added in v1.0.26

func (stream *StreamOut) WriteListUInt64BE(list []uint64)

WriteListUInt64BE writes a list of Big-Endian encoded uint64 types

func (*StreamOut) WriteListUInt64LE

func (stream *StreamOut) WriteListUInt64LE(list []uint64)

WriteListUInt64LE writes a list of Little-Endian encoded uint64 types

func (*StreamOut) WriteListUInt8

func (stream *StreamOut) WriteListUInt8(list []uint8)

WriteListUInt8 writes a list of uint8 types

func (*StreamOut) WriteMap added in v1.0.25

func (stream *StreamOut) WriteMap(mapType interface{})

WriteMap writes a Map type with the given key and value types

func (*StreamOut) WriteQBuffer

func (stream *StreamOut) WriteQBuffer(data []byte)

WriteQBuffer writes a NEX qBuffer type

func (*StreamOut) WriteResult added in v1.0.6

func (stream *StreamOut) WriteResult(result *Result)

WriteResult writes a NEX Result type

func (*StreamOut) WriteString

func (stream *StreamOut) WriteString(str string)

WriteString writes a NEX string type

func (*StreamOut) WriteStructure

func (stream *StreamOut) WriteStructure(structure StructureInterface)

WriteStructure writes a nex Structure type

func (*StreamOut) WriteUInt16BE added in v1.0.26

func (stream *StreamOut) WriteUInt16BE(u16 uint16)

WriteUInt16BE writes a uint16 as BE

func (*StreamOut) WriteUInt16LE

func (stream *StreamOut) WriteUInt16LE(u16 uint16)

WriteUInt16LE writes a uint16 as LE

func (*StreamOut) WriteUInt32BE added in v1.0.26

func (stream *StreamOut) WriteUInt32BE(u32 uint32)

WriteUInt32BE writes a uint32 as BE

func (*StreamOut) WriteUInt32LE

func (stream *StreamOut) WriteUInt32LE(u32 uint32)

WriteUInt32LE writes a uint32 as LE

func (*StreamOut) WriteUInt64BE added in v1.0.26

func (stream *StreamOut) WriteUInt64BE(u64 uint64)

WriteUInt64BE writes a uint64 as BE

func (*StreamOut) WriteUInt64LE

func (stream *StreamOut) WriteUInt64LE(u64 uint64)

WriteUInt64LE writes a uint64 as LE

func (*StreamOut) WriteUInt8

func (stream *StreamOut) WriteUInt8(u8 uint8)

WriteUInt8 writes a uint8

func (*StreamOut) WriteVariant added in v1.0.25

func (stream *StreamOut) WriteVariant(variant *Variant)

WriteVariant writes a Variant type

type Structure

type Structure struct {
	StructureInterface
	// contains filtered or unexported fields
}

Structure represents a nex Structure type

func (*Structure) ParentType added in v1.0.23

func (structure *Structure) ParentType() StructureInterface

ParentType returns the Structures parent type. nil if the type does not inherit another Structure

func (*Structure) SetParentType added in v1.0.23

func (structure *Structure) SetParentType(parentType StructureInterface)

SetParentType sets the Structures parent type

func (*Structure) SetStructureVersion added in v1.0.26

func (structure *Structure) SetStructureVersion(version uint8)

SetStructureVersion sets the structures version. Only used in NEX 3.5+

func (*Structure) StructureVersion added in v1.0.26

func (structure *Structure) StructureVersion() uint8

StructureVersion returns the structures version. Only used in NEX 3.5+

type StructureInterface

type StructureInterface interface {
	SetParentType(StructureInterface)
	ParentType() StructureInterface
	SetStructureVersion(uint8)
	StructureVersion() uint8
	ExtractFromStream(*StreamIn) error
	Bytes(*StreamOut) []byte
	Copy() StructureInterface
	Equals(StructureInterface) bool
	FormatToString(int) string
}

StructureInterface implements all Structure methods

type Ticket

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

Ticket represents a Kerberos authentication ticket

func NewKerberosTicket added in v1.0.5

func NewKerberosTicket() *Ticket

NewKerberosTicket returns a new Ticket instance

func (*Ticket) Encrypt added in v1.0.5

func (ticket *Ticket) Encrypt(key []byte, stream *StreamOut) ([]byte, error)

Encrypt writes the ticket data to the provided stream and returns the encrypted byte slice

func (*Ticket) InternalData added in v1.0.5

func (ticket *Ticket) InternalData() []byte

InternalData returns the Tickets internal data buffer

func (*Ticket) SessionKey added in v1.0.5

func (ticket *Ticket) SessionKey() []byte

SessionKey returns the Tickets session key

func (*Ticket) SetInternalData added in v1.0.5

func (ticket *Ticket) SetInternalData(internalData []byte)

SetInternalData sets the Tickets internal data buffer

func (*Ticket) SetSessionKey added in v1.0.5

func (ticket *Ticket) SetSessionKey(sessionKey []byte)

SetSessionKey sets the Tickets session key

func (*Ticket) SetTargetPID added in v1.0.5

func (ticket *Ticket) SetTargetPID(targetPID uint32)

SetTargetPID sets the Tickets target PID

func (*Ticket) TargetPID added in v1.0.5

func (ticket *Ticket) TargetPID() uint32

TargetPID returns the Tickets target PID

type TicketInternalData added in v1.0.5

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

TicketInternalData contains information sent to the secure server

func NewKerberosTicketInternalData added in v1.0.5

func NewKerberosTicketInternalData() *TicketInternalData

NewKerberosTicketInternalData returns a new TicketInternalData instance

func (*TicketInternalData) Decrypt added in v1.0.6

func (ticketInternalData *TicketInternalData) Decrypt(stream *StreamIn, key []byte) error

Decrypt decrypts the given data and populates the struct

func (*TicketInternalData) Encrypt added in v1.0.5

func (ticketInternalData *TicketInternalData) Encrypt(key []byte, stream *StreamOut) ([]byte, error)

Encrypt writes the ticket data to the provided stream and returns the encrypted byte slice

func (*TicketInternalData) SessionKey added in v1.0.5

func (ticketInternalData *TicketInternalData) SessionKey() []byte

SessionKey returns the TicketInternalDatas session key

func (*TicketInternalData) SetSessionKey added in v1.0.5

func (ticketInternalData *TicketInternalData) SetSessionKey(sessionKey []byte)

SetSessionKey sets the TicketInternalDatas session key

func (*TicketInternalData) SetTimestamp added in v1.0.5

func (ticketInternalData *TicketInternalData) SetTimestamp(timestamp *DateTime)

SetTimestamp sets the TicketInternalDatas timestamp

func (*TicketInternalData) SetUserPID added in v1.0.5

func (ticketInternalData *TicketInternalData) SetUserPID(userPID uint32)

SetUserPID sets the TicketInternalDatas user PID

func (*TicketInternalData) Timestamp added in v1.0.5

func (ticketInternalData *TicketInternalData) Timestamp() *DateTime

Timestamp returns the TicketInternalDatas timestamp

func (*TicketInternalData) UserPID added in v1.0.5

func (ticketInternalData *TicketInternalData) UserPID() uint32

UserPID returns the TicketInternalDatas user PID

type Variant added in v1.0.24

type Variant struct {
	TypeID uint8
	// * In reality this type does not have this many fields
	// * It only stores the type ID and then the value
	// * However to get better typing, we opt to store each possible
	// * type as it's own field and just check typeID to know which it has
	Int64    int64
	Float64  float64
	Bool     bool
	Str      string
	DateTime *DateTime
	UInt64   uint64
}

Variant can hold one of 7 types; nil, int64, float64, bool, string, DateTime, or uint64

func NewVariant added in v1.0.24

func NewVariant() *Variant

NewVariant returns a new Variant

func (*Variant) Bytes added in v1.0.25

func (variant *Variant) Bytes(stream *StreamOut) []byte

Bytes encodes the Variant and returns a byte array

func (*Variant) Copy added in v1.0.24

func (variant *Variant) Copy() *Variant

Copy returns a new copied instance of Variant

func (*Variant) Equals added in v1.0.24

func (variant *Variant) Equals(other *Variant) bool

Equals checks if the passed Structure contains the same data as the current instance

func (*Variant) ExtractFromStream added in v1.0.24

func (variant *Variant) ExtractFromStream(stream *StreamIn) error

ExtractFromStream extracts a Variant structure from a stream

func (*Variant) FormatToString added in v1.0.28

func (variant *Variant) FormatToString(indentationLevel int) string

FormatToString pretty-prints the struct data using the provided indentation level

func (*Variant) String added in v1.0.24

func (variant *Variant) String() string

String returns a string representation of the struct

type ZLibCompression

type ZLibCompression struct{}

ZLibCompression represents ZLib compression

func (*ZLibCompression) Compress

func (compression *ZLibCompression) Compress(data []byte) []byte

Compress returns the data as-is (needs to be updated to return ZLib compressed data)

func (*ZLibCompression) Decompress

func (compression *ZLibCompression) Decompress(data []byte) []byte

Decompress returns the data as-is (needs to be updated to return ZLib decompressed data)

Jump to

Keyboard shortcuts

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