nex

package module
v0.0.0-...-0875ff9 Latest Latest
Warning

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

Go to latest
Published: Sep 2, 2023 License: AGPL-3.0 Imports: 15 Imported by: 1

README

Barebones Rendez-vous library written in Go

GoDoc

Install

go get github.com/ihatecompvir/nex-go

Usage note

While this package can be used stand-alone, it only provides the bare minimum for a Rendez-vous server. It does not support any Rendez-vous protocols. To make proper Rendez-vous servers, see NEX Protocols Go

This library is designed around, and customized for, Rock Band 3. While it may work with other Quazal Rendez-vous titles that aren't Rock Band 3, do not expect it to work correctly out of the box with anything but Rock Band 3. If you are looking for a more generic NEX/PRUDP library, see the upstream version of this repository.

Usage
package main

import (
    "github.com/ihatecompvir/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) {
        // Handle data packet
    })

    nexServer.Listen("192.168.0.28:60000")
}

Documentation

Index

Constants

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

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

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

	// FlagHasSize is the ID for the PRUDP HasSize Flag
	FlagHasSize uint8 = 0x8
)
View Source
const (
	// SynPacket is the ID for the PRUDP Syn Packet type
	SynPacket uint8 = 0x0

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

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

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

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

Variables

This section is empty.

Functions

func MD5Hash

func MD5Hash(text []byte) []byte

MD5Hash returns the MD5 hash of the input

Types

type Client

type Client struct {
	Username string // the platform username of the client, "Master User (FRIEND CODE)" on Wii
	WiiFC    string // only used for Wii, Friend Code
	// 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) 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) ExternalStationURL

func (client *Client) ExternalStationURL() string

SetExternalStationURL returns the clients external station URL

func (*Client) FragmentedPayloadData

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

func (*Client) LastFragmentSequenceID

func (client *Client) LastFragmentSequenceID() uint16

func (*Client) PlayerID

func (client *Client) PlayerID() uint32

PlayerID returns the clients Player ID

func (*Client) Reset

func (client *Client) Reset()

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) SequenceIDCounterOut

func (client *Client) SequenceIDCounterOut() *Counter

SequenceIDCounterOut returns the clients packet SequenceID counter 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) SetConnectionID

func (client *Client) SetConnectionID(connectionID uint32)

SetConnectionID sets the clients Connection ID

func (*Client) SetExternalStationURL

func (client *Client) SetExternalStationURL(externalStationURL string)

SetExternalStationURL sets the clients external station URL

func (*Client) SetFragmentedPayloadData

func (client *Client) SetFragmentedPayloadData(data []byte)

func (*Client) SetLastFragmentSequenceID

func (client *Client) SetLastFragmentSequenceID(sequenceID uint16)

func (*Client) SetPlayerID

func (client *Client) SetPlayerID(playerID uint32)

SetPlayerID sets the clients Player ID

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) 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) UpdateAccessKey

func (client *Client) UpdateAccessKey(accessKey string)

UpdateAccessKey sets the client signature base and signature key

func (*Client) UpdateRC4Key

func (client *Client) UpdateRC4Key(RC4Key []byte)

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 uint64) *Counter

NewCounter returns a new Counter, with a starting number

func (*Counter) Increment

func (counter *Counter) Increment() uint64

Increment increments the counter by 1 and returns the value

func (Counter) Value

func (counter Counter) Value() uint64

Value returns the counters current value

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) Now

func (datetime *DateTime) Now() uint64

Now gets current time and converts it into a format DateTime can understand

func (*DateTime) Value

func (datetime *DateTime) Value() uint64

Value returns the stored DateTime time

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 KerberosEncryption

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

KerberosEncryption is used to encrypt/decrypt using Kerberos

func NewKerberosEncryption

func NewKerberosEncryption(key []byte) *KerberosEncryption

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 NullData

type NullData struct {
	*Structure
}

NullData represents a structure with no data

func NewNullData

func NewNullData() *NullData

NewNullData returns a new NullData Structure

func (*NullData) Bytes

func (nullData *NullData) Bytes(stream *StreamOut) []byte

Bytes does nothing for NullData

func (*NullData) ExtractFromStream

func (nullData *NullData) ExtractFromStream(stream *StreamIn) error

ExtractFromStream does nothing for NullData

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 uint8)

AddFlag adds the given flag to the packet flag bitmask

func (*Packet) ClearFlag

func (packet *Packet) ClearFlag(flag uint8)

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() uint8

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 uint8) 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 uint8)

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 uint8)

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() uint8

Type returns the packet type

func (*Packet) Version

func (packet *Packet) Version() uint8

Version gets the packet PRUDP version

type PacketInterface

type PacketInterface interface {
	Sender() *Client
	SetVersion(version uint8)
	Version() uint8
	SetSource(source uint8)
	Source() uint8
	SetDestination(destination uint8)
	Destination() uint8
	SetType(packetType uint8)
	Type() uint8
	SetFlags(bitmask uint8)
	Flags() uint8
	HasFlag(flag uint8) bool
	AddFlag(flag uint8)
	ClearFlag(flag uint8)
	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
	RMCRequest() RMCRequest
	Bytes() []byte
}

PacketInterface implements all Packet methods

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() uint32

Checksum returns the packet checksum

func (*PacketV0) Decode

func (packet *PacketV0) Decode() error

Decode decodes the packet

func (*PacketV0) SetChecksum

func (packet *PacketV0) SetChecksum(checksum uint32)

SetChecksum sets the packet checksum

type RMCRequest

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

RMCRequest represets a RMC request

func NewRMCRequest

func NewRMCRequest(data []byte) (RMCRequest, error)

NewRMCRequest returns a new parsed 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) 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) 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) 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) 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 uint64)

SetTime sets the RVConnectionData time

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) ChecksumVersion

func (server *Server) ChecksumVersion() int

ChecksumVersion returns the server packet checksum version

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) 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) FlagsVersion

func (server *Server) FlagsVersion() int

FlagsVersion returns the server packet flags version

func (*Server) FragmentSize

func (server *Server) FragmentSize() int16

KerberosKeySize returns the server kerberos key size

func (*Server) KerberosKeySize

func (server *Server) KerberosKeySize() int

KerberosKeySize returns the server kerberos key size

func (*Server) Kick

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

Kick removes a client from the server

func (*Server) Listen

func (server *Server) Listen(address string)

Listen starts a NEX server on a given address

func (*Server) NexVersion

func (server *Server) NexVersion() int

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) PrudpVersion

func (server *Server) PrudpVersion() int

PrudpVersion returns the server PRUDP 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) SetChecksumVersion

func (server *Server) SetChecksumVersion(checksumVersion int)

SetChecksumVersion sets the server packet checksum version

func (*Server) SetFlagsVersion

func (server *Server) SetFlagsVersion(flagsVersion int)

SetFlagsVersion sets the server packet flags version

func (*Server) SetFragmentSize

func (server *Server) SetFragmentSize(fragmentSize int16)

SetKerberosKeySize sets the server kerberos key size

func (*Server) SetKerberosKeySize

func (server *Server) SetKerberosKeySize(kerberosKeySize int)

SetKerberosKeySize sets the server kerberos key size

func (*Server) SetNexVersion

func (server *Server) SetNexVersion(nexVersion int)

SetNexVersion sets the server NEX version

func (*Server) SetPacketCompression

func (server *Server) SetPacketCompression(compression func([]byte) []byte)

SetPacketCompression sets the packet compression function

func (*Server) SetPrudpVersion

func (server *Server) SetPrudpVersion(prudpVersion int)

SetPrudpVersion sets the server PRUDP version

func (*Server) SetSignatureVersion

func (server *Server) SetSignatureVersion(signatureVersion int)

SetSignatureVersion sets the server packet signature version

func (*Server) SetSocket

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

SetSocket sets the underlying UDP socket

func (*Server) SignatureVersion

func (server *Server) SignatureVersion() int

SignatureVersion returns the server packet signature version

func (*Server) Socket

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

Socket returns the underlying server UDP socket

func (*Server) UsePacketCompression

func (server *Server) UsePacketCompression(usePacketCompression bool)

UsePacketCompression enables or disables packet compression

type StationURL

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

StationURL contains the data for a NEX station URL

func NewStationURL

func NewStationURL(str string) *StationURL

NewStationURL returns a new StationURL instance

func (*StationURL) Address

func (station *StationURL) Address() string

func (*StationURL) CID

func (station *StationURL) CID() string

func (*StationURL) EncodeToString

func (station *StationURL) EncodeToString() string

EncodeToString encodes the StationURL into a string

func (*StationURL) FromString

func (station *StationURL) FromString(str string)

FromString parses the StationURL data from a string

func (*StationURL) Natf

func (station *StationURL) Natf() string

func (*StationURL) Natm

func (station *StationURL) Natm() string

func (*StationURL) PID

func (station *StationURL) PID() string

func (*StationURL) PRID

func (station *StationURL) PRID() string

func (*StationURL) Pmp

func (station *StationURL) Pmp() string

func (*StationURL) Port

func (station *StationURL) Port() string

func (*StationURL) ProbeInit

func (station *StationURL) ProbeInit() string

func (*StationURL) RVCID

func (station *StationURL) RVCID() string

func (*StationURL) SID

func (station *StationURL) SID() string

func (*StationURL) Scheme

func (station *StationURL) Scheme() string

func (*StationURL) SetAddress

func (station *StationURL) SetAddress(address *string)

SetAddress sets the StationURL address

func (*StationURL) SetCID

func (station *StationURL) SetCID(cid *string)

SetCID sets the StationURL CID

func (*StationURL) SetNatf

func (station *StationURL) SetNatf(natf *string)

SetNatf sets the StationURL Natf

func (*StationURL) SetNatm

func (station *StationURL) SetNatm(natm *string)

SetNatm sets the StationURL Natm

func (*StationURL) SetPRID

func (station *StationURL) SetPRID(prid *string)

SetPRID sets the StationURL PRID

func (*StationURL) SetPid

func (station *StationURL) SetPid(pid *string)

SetPid sets the StationURL PID

func (*StationURL) SetPmp

func (station *StationURL) SetPmp(pmp *string)

SetPmp sets the StationURL Pmp

func (*StationURL) SetPort

func (station *StationURL) SetPort(port *string)

SetPort sets the StationURL port

func (*StationURL) SetProbeInit

func (station *StationURL) SetProbeInit(probeinit *string)

SetProbeInit sets the StationURL ProbeInit

func (*StationURL) SetRVCID

func (station *StationURL) SetRVCID(rvcid *string)

SetRVCID sets the StationURL RVCID

func (*StationURL) SetSID

func (station *StationURL) SetSID(sid *string)

SetSID sets the StationURL SID

func (*StationURL) SetScheme

func (station *StationURL) SetScheme(scheme *string)

SetScheme sets the StationURL scheme

func (*StationURL) SetStream

func (station *StationURL) SetStream(stream *string)

SetStream sets the StationURL stream

func (*StationURL) SetType

func (station *StationURL) SetType(transportType *string)

SetType sets the StationURL transportType

func (*StationURL) SetUpnp

func (station *StationURL) SetUpnp(upnp *string)

SetUpnp sets the StationURL Upnp

func (*StationURL) Stream

func (station *StationURL) Stream() string

func (*StationURL) Type

func (station *StationURL) Type() string

func (*StationURL) Upnp

func (station *StationURL) Upnp() string

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) Read2ByteString

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

func (*StreamIn) Read4ByteString

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

ReadString reads and returns a u32 length nex string type

func (*StreamIn) ReadBuffer

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

ReadBuffer reads a nex Buffer type

func (*StreamIn) ReadListUInt16LE

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

ReadListUInt16LE reads a list of uint16 types

func (*StreamIn) ReadListUInt32LE

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

ReadListUInt32LE reads a list of uint32 types

func (*StreamIn) ReadListUInt64LE

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

ReadListUInt64LE reads a list of uint64 types

func (*StreamIn) ReadListUInt8

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

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) ReadString

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

ReadString reads and returns a nex string type 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) ReadUInt16LE

func (stream *StreamIn) ReadUInt16LE() uint16

ReadUInt16LE reads a uint16

func (*StreamIn) ReadUInt24LE

func (stream *StreamIn) ReadUInt24LE() uint32

ReadUInt24LE reads a uint32

func (*StreamIn) ReadUInt32LE

func (stream *StreamIn) ReadUInt32LE() uint32

ReadUInt32LE reads a uint32

func (*StreamIn) ReadUInt64LE

func (stream *StreamIn) ReadUInt64LE() uint64

ReadUInt64LE reads a uint64

func (*StreamIn) ReadUInt8

func (stream *StreamIn) ReadUInt8() uint8

ReadUInt8 reads a uint8

func (*StreamIn) ReadVariant

func (stream *StreamIn) ReadVariant() interface{}

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

type StreamOut

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

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

func NewStream

func NewStream() *StreamOut

NewStreamIn returns a new NEX input stream

func NewStreamOut

func NewStreamOut(server *Server) *StreamOut

NewStreamOut returns a new nex output stream

func (*StreamOut) WriteBuffer

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

WriteBuffer writes a NEX Buffer type

func (*StreamOut) WriteBufferString

func (stream *StreamOut) WriteBufferString(str string)

func (*StreamOut) WriteListStructure

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

WriteListStructure writes a list of Structure types

func (*StreamOut) WriteListUInt16LE

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

WriteListUInt16LE writes a list of uint16 types

func (*StreamOut) WriteListUInt32LE

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

WriteListUInt32LE writes a list of uint32 types

func (*StreamOut) WriteListUInt64LE

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

WriteListUInt64LE writes a list of uint64 types

func (*StreamOut) WriteListUInt8

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

WriteListUInt8 writes a list of uint8 types

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) WriteUInt16LE

func (stream *StreamOut) WriteUInt16LE(u16 uint16)

WriteUInt16LE writes a uint16 as LE

func (*StreamOut) WriteUInt32LE

func (stream *StreamOut) WriteUInt32LE(u32 uint32)

WriteUInt32LE writes a uint32 as LE

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

type Structure

type Structure struct {
	StructureInterface
}

Structure represents a nex Structure type

func (*Structure) Hierarchy

func (structure *Structure) Hierarchy() []StructureInterface

Hierarchy returns a Structure hierarchy

type StructureInterface

type StructureInterface interface {
	Hierarchy() []StructureInterface
	ExtractFromStream(*StreamIn) error
	Bytes(*StreamOut) []byte
}

StructureInterface implements all Structure methods

type Ticket

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

Ticket represents a Kerberos authentication ticket

type TicketData

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

TicketData contains the encrypted ticket info and an optional key used for deriving the encryption key for TicketInfo

type TicketInfo

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

TicketInfo contains the actual data of the ticket

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