Versions in this module Expand all Collapse all v2 v2.0.2 May 19, 2024 Changes in this version type MutexMap + func (m *MutexMap[K, V]) DeleteIf(predicate func(key K, value V) bool) int v2.0.1 Apr 7, 2024 Changes in this version + var ResultCodes resultCodes + var ResultNames = map[uint32]string + func DeriveKerberosKey(pid *types.PID, password []byte) []byte + func ResultCodeToName(resultCode uint32) string + type Account struct + PID *types.PID + Password string + Username string + func NewAccount(pid *types.PID, username, password string) *Account + type ByteStreamIn struct + LibraryVersions *LibraryVersions + Settings *ByteStreamSettings + func NewByteStreamIn(data []byte, libraryVersions *LibraryVersions, settings *ByteStreamSettings) *ByteStreamIn + func (bsi *ByteStreamIn) PIDSize() int + func (bsi *ByteStreamIn) Read(length uint64) ([]byte, error) + func (bsi *ByteStreamIn) ReadPrimitiveBool() (bool, error) + func (bsi *ByteStreamIn) ReadPrimitiveFloat32LE() (float32, error) + func (bsi *ByteStreamIn) ReadPrimitiveFloat64LE() (float64, error) + func (bsi *ByteStreamIn) ReadPrimitiveInt16LE() (int16, error) + func (bsi *ByteStreamIn) ReadPrimitiveInt32LE() (int32, error) + func (bsi *ByteStreamIn) ReadPrimitiveInt64LE() (int64, error) + func (bsi *ByteStreamIn) ReadPrimitiveInt8() (int8, error) + func (bsi *ByteStreamIn) ReadPrimitiveUInt16LE() (uint16, error) + func (bsi *ByteStreamIn) ReadPrimitiveUInt32LE() (uint32, error) + func (bsi *ByteStreamIn) ReadPrimitiveUInt64LE() (uint64, error) + func (bsi *ByteStreamIn) ReadPrimitiveUInt8() (uint8, error) + func (bsi *ByteStreamIn) ReadRemaining() []byte + func (bsi *ByteStreamIn) Remaining() uint64 + func (bsi *ByteStreamIn) StringLengthSize() int + func (bsi *ByteStreamIn) UseStructureHeader() bool + type ByteStreamOut struct + LibraryVersions *LibraryVersions + Settings *ByteStreamSettings + func NewByteStreamOut(libraryVersions *LibraryVersions, settings *ByteStreamSettings) *ByteStreamOut + func (bso *ByteStreamOut) CopyNew() types.Writable + func (bso *ByteStreamOut) PIDSize() int + func (bso *ByteStreamOut) StringLengthSize() int + func (bso *ByteStreamOut) UseStructureHeader() bool + func (bso *ByteStreamOut) Write(data []byte) + func (bso *ByteStreamOut) WritePrimitiveBool(b bool) + func (bso *ByteStreamOut) WritePrimitiveFloat32LE(f32 float32) + func (bso *ByteStreamOut) WritePrimitiveFloat64LE(f64 float64) + func (bso *ByteStreamOut) WritePrimitiveInt16LE(s16 int16) + func (bso *ByteStreamOut) WritePrimitiveInt32LE(s32 int32) + func (bso *ByteStreamOut) WritePrimitiveInt64LE(s64 int64) + func (bso *ByteStreamOut) WritePrimitiveInt8(s8 int8) + func (bso *ByteStreamOut) WritePrimitiveUInt16LE(u16 uint16) + func (bso *ByteStreamOut) WritePrimitiveUInt32LE(u32 uint32) + func (bso *ByteStreamOut) WritePrimitiveUInt64LE(u64 uint64) + func (bso *ByteStreamOut) WritePrimitiveUInt8(u8 uint8) + type ByteStreamSettings struct + PIDSize int + StringLengthSize int + UseStructureHeader bool + func NewByteStreamSettings() *ByteStreamSettings + type ConnectionInterface interface + Address func() net.Addr + Endpoint func() EndpointInterface + PID func() *types.PID + SetPID func(pid *types.PID) + type ConnectionState uint8 + const StateConnected + const StateConnecting + const StateDisconnecting + const StateFaulty + const StateNotConnected + type Counter struct + Value T + func NewCounter[T numeric](start T) *Counter[T] + func (c *Counter[T]) Next() T + type EndpointInterface interface + AccessKey func() string + ByteStreamSettings func() *ByteStreamSettings + EmitError func(err *Error) + EnableVerboseRMC func(enabled bool) + LibraryVersions func() *LibraryVersions + Send func(packet PacketInterface) + SetAccessKey func(accessKey string) + SetByteStreamSettings func(settings *ByteStreamSettings) + UseVerboseRMC func() bool + type Error struct + Message string + Packet PacketInterface + ResultCode uint32 + func NewError(resultCode uint32, message string) *Error + func (e Error) Error() string + type HPPClient struct + func NewHPPClient(address *net.TCPAddr, server *HPPServer) *HPPClient + func (c *HPPClient) Address() net.Addr + func (c *HPPClient) Endpoint() EndpointInterface + func (c *HPPClient) PID() *types.PID + func (c *HPPClient) SetPID(pid *types.PID) + type HPPPacket struct + func NewHPPPacket(client *HPPClient, payload []byte) (*HPPPacket, error) + func (p *HPPPacket) Payload() []byte + func (p *HPPPacket) RMCMessage() *RMCMessage + func (p *HPPPacket) Sender() ConnectionInterface + func (p *HPPPacket) SetPayload(payload []byte) + func (p *HPPPacket) SetRMCMessage(message *RMCMessage) + type HPPServer struct + AccountDetailsByPID func(pid *types.PID) (*Account, *Error) + AccountDetailsByUsername func(username string) (*Account, *Error) + func NewHPPServer() *HPPServer + func (s *HPPServer) AccessKey() string + func (s *HPPServer) ByteStreamSettings() *ByteStreamSettings + func (s *HPPServer) EmitError(err *Error) + func (s *HPPServer) EnableVerboseRMC(enable bool) + func (s *HPPServer) LibraryVersions() *LibraryVersions + func (s *HPPServer) Listen(port int) + func (s *HPPServer) ListenSecure(port int, certFile, keyFile string) + func (s *HPPServer) OnData(handler func(packet PacketInterface)) + func (s *HPPServer) RegisterServiceProtocol(protocol ServiceProtocol) + func (s *HPPServer) Send(packet PacketInterface) + func (s *HPPServer) SetAccessKey(accessKey string) + func (s *HPPServer) SetByteStreamSettings(byteStreamSettings *ByteStreamSettings) + func (s *HPPServer) UseVerboseRMC() bool + type KerberosEncryption struct + func NewKerberosEncryption(key []byte) *KerberosEncryption + func (ke *KerberosEncryption) Decrypt(buffer []byte) ([]byte, error) + func (ke *KerberosEncryption) Encrypt(buffer []byte) []byte + func (ke *KerberosEncryption) Validate(buffer []byte) bool + type KerberosTicket struct + InternalData *types.Buffer + SessionKey []byte + TargetPID *types.PID + func NewKerberosTicket() *KerberosTicket + func (kt *KerberosTicket) Encrypt(key []byte, stream *ByteStreamOut) ([]byte, error) + type KerberosTicketInternalData struct + Issued *types.DateTime + Server *PRUDPServer + SessionKey []byte + SourcePID *types.PID + func NewKerberosTicketInternalData(server *PRUDPServer) *KerberosTicketInternalData + func (ti *KerberosTicketInternalData) Decrypt(stream *ByteStreamIn, key []byte) error + func (ti *KerberosTicketInternalData) Encrypt(key []byte, stream *ByteStreamOut) ([]byte, error) + type LibraryVersion struct + GameSpecificPatch string + Major int + Minor int + Patch int + func NewLibraryVersion(major, minor, patch int) *LibraryVersion + func NewPatchedLibraryVersion(major, minor, patch int, gameSpecificPatch string) *LibraryVersion + func (lv *LibraryVersion) Copy() *LibraryVersion + func (lv *LibraryVersion) GreaterOrEqual(compare string) bool + func (lv *LibraryVersion) LessOrEqual(compare string) bool + type LibraryVersions struct + DataStore *LibraryVersion + Main *LibraryVersion + MatchMaking *LibraryVersion + Messaging *LibraryVersion + NATTraversal *LibraryVersion + Ranking *LibraryVersion + Ranking2 *LibraryVersion + Utility *LibraryVersion + func NewLibraryVersions() *LibraryVersions + func (lvs *LibraryVersions) SetDefault(version *LibraryVersion) + type MutexMap struct + func NewMutexMap[K comparable, V any]() *MutexMap[K, V] + func (m *MutexMap[K, V]) Clear(callback func(key K, value V)) + func (m *MutexMap[K, V]) Delete(key K) + func (m *MutexMap[K, V]) Each(callback func(key K, value V) bool) bool + func (m *MutexMap[K, V]) Get(key K) (V, bool) + func (m *MutexMap[K, V]) Has(key K) bool + func (m *MutexMap[K, V]) RunAndDelete(key K, callback func(key K, value V)) + func (m *MutexMap[K, V]) Set(key K, value V) + func (m *MutexMap[K, V]) Size() int + type MutexSlice struct + func NewMutexSlice[V comparable]() *MutexSlice[V] + func (m *MutexSlice[V]) Add(value V) + func (m *MutexSlice[V]) At(index int) (V, bool) + func (m *MutexSlice[V]) Clear() + func (m *MutexSlice[V]) Delete(value V) bool + func (m *MutexSlice[V]) DeleteAll(value V) bool + func (m *MutexSlice[V]) Each(callback func(index int, value V) bool) bool + func (m *MutexSlice[V]) GetIndex(value V) int + func (m *MutexSlice[V]) Has(value V) bool + func (m *MutexSlice[V]) Size() int + func (m *MutexSlice[V]) Values() []V + type PRUDPConnection struct + ConnectionState ConnectionState + DefaultPRUDPVersion int + ID uint32 + ServerConnectionSignature []byte + ServerSessionID uint8 + SessionID uint8 + SessionKey []byte + Signature []byte + Socket *SocketConnection + StationURLs *types.List[*types.StationURL] + StreamID uint8 + StreamSettings *StreamSettings + StreamType constants.StreamType + UnreliablePacketBaseKey []byte + func NewPRUDPConnection(socket *SocketConnection) *PRUDPConnection + func (pc *PRUDPConnection) Address() net.Addr + func (pc *PRUDPConnection) CreateSlidingWindow(substreamID uint8) *SlidingWindow + func (pc *PRUDPConnection) Endpoint() EndpointInterface + func (pc *PRUDPConnection) InitializeSlidingWindows(maxSubstreamID uint8) + func (pc *PRUDPConnection) PID() *types.PID + func (pc *PRUDPConnection) SetPID(pid *types.PID) + func (pc *PRUDPConnection) SlidingWindow(substreamID uint8) *SlidingWindow + type PRUDPEndPoint struct + AccountDetailsByPID func(pid *types.PID) (*Account, *Error) + AccountDetailsByUsername func(username string) (*Account, *Error) + ConnectionIDCounter *Counter[uint32] + Connections *MutexMap[string, *PRUDPConnection] + DefaultStreamSettings *StreamSettings + IsSecureEndPoint bool + Server *PRUDPServer + ServerAccount *Account + StreamID uint8 + func NewPRUDPEndPoint(streamID uint8) *PRUDPEndPoint + func (pep *PRUDPEndPoint) AccessKey() string + func (pep *PRUDPEndPoint) ByteStreamSettings() *ByteStreamSettings + func (pep *PRUDPEndPoint) EmitError(err *Error) + func (pep *PRUDPEndPoint) EnableVerboseRMC(enable bool) + func (pep *PRUDPEndPoint) FindConnectionByID(connectedID uint32) *PRUDPConnection + func (pep *PRUDPEndPoint) FindConnectionByPID(pid uint64) *PRUDPConnection + func (pep *PRUDPEndPoint) LibraryVersions() *LibraryVersions + func (pep *PRUDPEndPoint) OnConnectionEnded(handler func(connection *PRUDPConnection)) + func (pep *PRUDPEndPoint) OnData(handler func(packet PacketInterface)) + func (pep *PRUDPEndPoint) OnDisconnect(handler func(packet PacketInterface)) + func (pep *PRUDPEndPoint) OnError(handler func(err *Error)) + func (pep *PRUDPEndPoint) RegisterCustomPacketHandler(packetType uint16, handler func(packet PRUDPPacketInterface)) + func (pep *PRUDPEndPoint) RegisterServiceProtocol(protocol ServiceProtocol) + func (pep *PRUDPEndPoint) Send(packet PacketInterface) + func (pep *PRUDPEndPoint) SetAccessKey(accessKey string) + func (pep *PRUDPEndPoint) SetByteStreamSettings(byteStreamSettings *ByteStreamSettings) + func (pep *PRUDPEndPoint) UseVerboseRMC() bool + type PRUDPPacket struct + func (p *PRUDPPacket) AddFlag(flag uint16) + func (p *PRUDPPacket) DestinationVirtualPortStreamID() uint8 + func (p *PRUDPPacket) DestinationVirtualPortStreamType() constants.StreamType + func (p *PRUDPPacket) Flags() uint16 + func (p *PRUDPPacket) HasFlag(flag uint16) bool + func (p *PRUDPPacket) Payload() []byte + func (p *PRUDPPacket) RMCMessage() *RMCMessage + func (p *PRUDPPacket) Sender() ConnectionInterface + func (p *PRUDPPacket) SequenceID() uint16 + func (p *PRUDPPacket) SessionID() uint8 + func (p *PRUDPPacket) SetDestinationVirtualPortStreamID(port uint8) + func (p *PRUDPPacket) SetDestinationVirtualPortStreamType(streamType constants.StreamType) + func (p *PRUDPPacket) SetPayload(payload []byte) + func (p *PRUDPPacket) SetRMCMessage(message *RMCMessage) + func (p *PRUDPPacket) SetSender(sender ConnectionInterface) + func (p *PRUDPPacket) SetSequenceID(sequenceID uint16) + func (p *PRUDPPacket) SetSessionID(sessionID uint8) + func (p *PRUDPPacket) SetSourceVirtualPortStreamID(port uint8) + func (p *PRUDPPacket) SetSourceVirtualPortStreamType(streamType constants.StreamType) + func (p *PRUDPPacket) SetSubstreamID(substreamID uint8) + func (p *PRUDPPacket) SetType(packetType uint16) + func (p *PRUDPPacket) SourceVirtualPortStreamID() uint8 + func (p *PRUDPPacket) SourceVirtualPortStreamType() constants.StreamType + func (p *PRUDPPacket) SubstreamID() uint8 + func (p *PRUDPPacket) Type() uint16 + type PRUDPPacketInterface interface + AddFlag func(flag uint16) + Bytes func() []byte + Copy func() PRUDPPacketInterface + DestinationVirtualPortStreamID func() uint8 + DestinationVirtualPortStreamType func() constants.StreamType + Flags func() uint16 + HasFlag func(flag uint16) bool + Payload func() []byte + RMCMessage func() *RMCMessage + Sender func() ConnectionInterface + SequenceID func() uint16 + SessionID func() uint8 + SetDestinationVirtualPortStreamID func(port uint8) + SetDestinationVirtualPortStreamType func(streamType constants.StreamType) + SetPayload func(payload []byte) + SetRMCMessage func(message *RMCMessage) + SetSender func(sender ConnectionInterface) + SetSequenceID func(sequenceID uint16) + SetSessionID func(sessionID uint8) + SetSourceVirtualPortStreamID func(port uint8) + SetSourceVirtualPortStreamType func(streamType constants.StreamType) + SetSubstreamID func(substreamID uint8) + SetType func(packetType uint16) + SourceVirtualPortStreamID func() uint8 + SourceVirtualPortStreamType func() constants.StreamType + SubstreamID func() uint8 + Type func() uint16 + Version func() int + func NewPRUDPPacketsLite(server *PRUDPServer, connection *PRUDPConnection, readStream *ByteStreamIn) ([]PRUDPPacketInterface, error) + func NewPRUDPPacketsV0(server *PRUDPServer, connection *PRUDPConnection, readStream *ByteStreamIn) ([]PRUDPPacketInterface, error) + func NewPRUDPPacketsV1(server *PRUDPServer, connection *PRUDPConnection, readStream *ByteStreamIn) ([]PRUDPPacketInterface, error) + type PRUDPPacketLite struct + func NewPRUDPPacketLite(server *PRUDPServer, connection *PRUDPConnection, readStream *ByteStreamIn) (*PRUDPPacketLite, error) + func (p *PRUDPPacketLite) Bytes() []byte + func (p *PRUDPPacketLite) Copy() PRUDPPacketInterface + func (p *PRUDPPacketLite) DestinationVirtualPortStreamID() uint8 + func (p *PRUDPPacketLite) DestinationVirtualPortStreamType() constants.StreamType + func (p *PRUDPPacketLite) SetDestinationVirtualPortStreamID(port uint8) + func (p *PRUDPPacketLite) SetDestinationVirtualPortStreamType(streamType constants.StreamType) + func (p *PRUDPPacketLite) SetSourceVirtualPortStreamID(port uint8) + func (p *PRUDPPacketLite) SetSourceVirtualPortStreamType(streamType constants.StreamType) + func (p *PRUDPPacketLite) SourceVirtualPortStreamID() uint8 + func (p *PRUDPPacketLite) SourceVirtualPortStreamType() constants.StreamType + func (p *PRUDPPacketLite) Version() int + type PRUDPPacketV0 struct + func NewPRUDPPacketV0(server *PRUDPServer, connection *PRUDPConnection, readStream *ByteStreamIn) (*PRUDPPacketV0, error) + func (p *PRUDPPacketV0) Bytes() []byte + func (p *PRUDPPacketV0) Copy() PRUDPPacketInterface + func (p *PRUDPPacketV0) Version() int + type PRUDPPacketV1 struct + func NewPRUDPPacketV1(server *PRUDPServer, connection *PRUDPConnection, readStream *ByteStreamIn) (*PRUDPPacketV1, error) + func (p *PRUDPPacketV1) Bytes() []byte + func (p *PRUDPPacketV1) Copy() PRUDPPacketInterface + func (p *PRUDPPacketV1) Version() int + type PRUDPServer struct + AccessKey string + ByteStreamSettings *ByteStreamSettings + Connections *MutexMap[string, *SocketConnection] + Endpoints *MutexMap[uint8, *PRUDPEndPoint] + FragmentSize int + KerberosTicketVersion int + LibraryVersions *LibraryVersions + PRUDPV0Settings *PRUDPV0Settings + PRUDPV1Settings *PRUDPV1Settings + PRUDPv1ConnectionSignatureKey []byte + SessionKeyLength int + SupportedFunctions uint32 + UseVerboseRMC bool + func NewPRUDPServer() *PRUDPServer + func (ps *PRUDPServer) BindPRUDPEndPoint(endpoint *PRUDPEndPoint) + func (ps *PRUDPServer) Listen(port int) + func (ps *PRUDPServer) ListenUDP(port int) + func (ps *PRUDPServer) ListenWebSocket(port int) + func (ps *PRUDPServer) ListenWebSocketSecure(port int, certFile, keyFile string) + func (ps *PRUDPServer) Send(packet PacketInterface) + func (ps *PRUDPServer) SetFragmentSize(fragmentSize int) + type PRUDPV0Settings struct + ChecksumCalculator func(packet *PRUDPPacketV0, data []byte) uint32 + ConnectionSignatureCalculator func(packet *PRUDPPacketV0, addr net.Addr) ([]byte, error) + DataSignatureCalculator func(packet *PRUDPPacketV0, sessionKey []byte) []byte + EncryptedConnect bool + IsQuazalMode bool + LegacyConnectionSignature bool + SignatureCalculator func(packet *PRUDPPacketV0, sessionKey, connectionSignature []byte) []byte + UseEnhancedChecksum bool + func NewPRUDPV0Settings() *PRUDPV0Settings + type PRUDPV1Settings struct + ConnectionSignatureCalculator func(packet *PRUDPPacketV1, addr net.Addr) ([]byte, error) + LegacyConnectionSignature bool + SignatureCalculator func(packet *PRUDPPacketV1, sessionKey, connectionSignature []byte) []byte + func NewPRUDPV1Settings() *PRUDPV1Settings + type PacketInterface interface + Payload func() []byte + RMCMessage func() *RMCMessage + Sender func() ConnectionInterface + SetPayload func(payload []byte) + SetRMCMessage func(message *RMCMessage) + type PendingPacket struct + type RMCMessage struct + CallID uint32 + ClassVersionContainer *types.ClassVersionContainer + Endpoint EndpointInterface + ErrorCode uint32 + IsHPP bool + IsRequest bool + IsSuccess bool + MethodID uint32 + MethodName *types.String + Parameters []byte + ProtocolID uint16 + ProtocolName *types.String + func NewRMCError(endpoint EndpointInterface, errorCode uint32) *RMCMessage + func NewRMCMessage(endpoint EndpointInterface) *RMCMessage + func NewRMCRequest(endpoint EndpointInterface) *RMCMessage + func NewRMCSuccess(endpoint EndpointInterface, parameters []byte) *RMCMessage + func (rmc *RMCMessage) Bytes() []byte + func (rmc *RMCMessage) Copy() *RMCMessage + func (rmc *RMCMessage) FromBytes(data []byte) error + type ResendScheduler struct + func NewResendScheduler() *ResendScheduler + func (rs *ResendScheduler) AcknowledgePacket(sequenceID uint16) + func (rs *ResendScheduler) AddPacket(packet PRUDPPacketInterface) + func (rs *ResendScheduler) Stop() + type ServiceProtocol interface + Endpoint func() EndpointInterface + HandlePacket func(packet PacketInterface) + SetEndpoint func(endpoint EndpointInterface) + type SlidingWindow struct + ResendScheduler *ResendScheduler + func NewSlidingWindow() *SlidingWindow + func (sw *SlidingWindow) AddFragment(fragment []byte) []byte + func (sw *SlidingWindow) Decrypt(data []byte) ([]byte, error) + func (sw *SlidingWindow) Encrypt(data []byte) ([]byte, error) + func (sw *SlidingWindow) NextOutgoingSequenceID() uint16 + func (sw *SlidingWindow) ResetFragmentedPayload() + func (sw *SlidingWindow) SetCipherKey(key []byte) + func (sw *SlidingWindow) Update(packet PRUDPPacketInterface) []PRUDPPacketInterface + type SocketConnection struct + Address net.Addr + Connections *MutexMap[uint8, *PRUDPConnection] + Server *PRUDPServer + WebSocketConnection *gws.Conn + func NewSocketConnection(server *PRUDPServer, address net.Addr, webSocketConnection *gws.Conn) *SocketConnection + type StreamSettings struct + ChecksumBase uint32 + CompressionAlgorithm compression.Algorithm + EncryptionAlgorithm encryption.Algorithm + ExtraRestransmitTimeoutTrigger uint32 + ExtraRetransmitTimeoutMultiplier float32 + FaultDetectionEnabled bool + InitialRTT uint32 + KeepAliveTimeout uint32 + MaxPacketRetransmissions uint32 + MaxSilenceTime uint32 + RTTRetransmit uint32 + RetransmitTimeoutMultiplier float32 + WindowSize uint32 + func NewStreamSettings() *StreamSettings + func (ss *StreamSettings) Copy() *StreamSettings + type VirtualPort byte + func (vp *VirtualPort) SetStreamID(streamID uint8) + func (vp *VirtualPort) SetStreamType(streamType constants.StreamType) + func (vp VirtualPort) StreamID() uint8 + func (vp VirtualPort) StreamType() constants.StreamType + type WebSocketServer struct Other modules containing this package github.com/PretendoNetwork/nex-go