login

package
v0.0.3 Latest Latest
Warning

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

Go to latest
Published: Jul 16, 2023 License: Apache-2.0, BSD-3-Clause, ISC Imports: 11 Imported by: 0

Documentation

Index

Constants

View Source
const (
	LoginStatusSuccess      = 0
	LoginStatusError        = 1
	LoginStatusSetNickname  = 216
	LoginStatusSetCharacter = 217
)
View Source
const (
	LoginErrorInvalidCredentials    = 0
	LoginErrorAlreadyLoggedIn       = 5100019
	LoginErrorDuplicateConn         = 5100107
	LoginErrorInvalidReconnectToken = 5157002
)

Variables

View Source
var ClientMessageTable = common.NewMessageTable(map[uint16]ClientMessage{
	0x0001: &ClientLogin{},
	0x0003: &ClientSelectServer{},
	0x0006: &ClientSetNickname{},
	0x0007: &ClientCheckNickname{},
	0x0008: &ClientSelectCharacter{},
	0x000B: &ClientReconnect{},
})
View Source
var ServerMessageTable = common.NewMessageTable(map[uint16]ServerMessage{
	0x0001: &ServerLogin{},
	0x0002: &ServerGameServerList{},
	0x0003: &ServerGameSessionKey{},
	0x0006: &ServerMacros{},
	0x0009: &ServerMessageServerList{},
	0x000E: &ServerNicknameCheckResponse{},
	0x0010: &ServerLoginSessionKey{},
	0x0011: &Server0011{},
	0x0040: &ServerGameGuardCheck{},
	0x004D: &ServerLobbiesList{},
})

These are the known possible server message IDs.

Functions

This section is empty.

Types

type ClientCheckNickname

type ClientCheckNickname struct {
	ClientMessage_
	Nickname common.PString
}

type ClientLogin

type ClientLogin struct {
	ClientMessage_
	Username common.PString
	Password common.PString
}

ClientLogin is the payload associated with the ClientLogin packet. It is sent by the client when the client logs in.

type ClientLoginMessage

type ClientLoginMessage struct {
}

type ClientMessage

type ClientMessage interface {
	common.Message
	// contains filtered or unexported methods
}

type ClientMessageID

type ClientMessageID uint16

ClientMessageID is the type used to identify client messages.

type ClientMessage_

type ClientMessage_ struct{}

type ClientReconnect

type ClientReconnect struct {
	ClientMessage_
}

type ClientSelectCharacter

type ClientSelectCharacter struct {
	ClientMessage_
	CharacterID uint32
	HairColor   uint8
	Unknown     uint8
}

type ClientSelectServer

type ClientSelectServer struct {
	ClientMessage_
	Unknown1 uint32
}

type ClientSetNickname

type ClientSetNickname struct {
	ClientMessage_
	Nickname common.PString
}

type Conn

type Conn struct {
	*common.ServerConn[ClientMessage, ServerMessage]
	// contains filtered or unexported fields
}

Conn holds the state for a connection to the server.

func (*Conn) GetServerList

func (c *Conn) GetServerList(ctx context.Context, typ topologypb.Server_Type) (*ServerList, error)

GetServerList returns a server list using the topology store.

func (*Conn) Handle

func (c *Conn) Handle(ctx context.Context) error

Handle runs the main connection loop.

type ConnectMessage

type ConnectMessage struct {
	Unknown1 uint16
	Unknown2 uint16
	Unknown3 uint16
	Key      uint16
	Unknown4 uint16
	ServerID uint16
	Unknown6 uint16
}

ConnectMessage is the message sent by the server when connecting.

func (*ConnectMessage) SetKey added in v0.0.2

func (c *ConnectMessage) SetKey(key uint8)

type LoginError

type LoginError struct {
	Error uint32
}

type LoginSetCharacter

type LoginSetCharacter struct {
}

type LoginSetNickname

type LoginSetNickname struct {
	Unknown uint32
}

type LoginSuccess

type LoginSuccess struct {
	Username common.PString
	UserID   uint32
	Unknown  [14]byte
	Nickname common.PString
}

type Options

type Options struct {
	Logger          zerolog.Logger
	TopologyClient  topologypbconnect.TopologyServiceClient
	AccountsService *accounts.Service
	ConfigProvider  gameconfig.Provider
}

Options specify the options to use to instantiate the login server.

type Server

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

Server provides an implementation of the PangYa login server.

func New

func New(opts Options) *Server

New creates a new instance of the login server.

func (*Server) Listen

func (s *Server) Listen(ctx context.Context, addr string) error

Listen listens for connections on the given port and blocks indefinitely.

func (*Server) Shutdown

func (s *Server) Shutdown(shutdownCtx context.Context) error

type Server0011

type Server0011 struct {
	ServerMessage_
	Unknown byte
}

type ServerEntry

type ServerEntry struct {
	ServerName string `struct:"[40]byte"`
	ServerID   uint32
	MaxUsers   uint32
	NumUsers   uint32
	IPAddress  string `struct:"[18]byte"`
	Port       uint16
	Unknown1   uint16
	Flags      uint16
	Unknown2   [16]byte
}

ServerEntry represents a server in a ServerListMessage.

type ServerGameGuardCheck

type ServerGameGuardCheck struct {
	ServerMessage_
}

type ServerGameServerList

type ServerGameServerList struct {
	ServerMessage_
	ServerList
}

type ServerGameSessionKey

type ServerGameSessionKey struct {
	ServerMessage_
	Unknown    uint32
	SessionKey common.PString
}

type ServerList

type ServerList struct {
	Count   uint8 `struct:"sizeof=Servers"`
	Servers []ServerEntry
}

type ServerLobbiesList

type ServerLobbiesList struct {
	ServerMessage_
}

type ServerLogin

type ServerLogin struct {
	ServerMessage_
	Status byte

	Success      *LoginSuccess      `struct-if:"Status == 0"`
	Error        *LoginError        `struct-if:"Status == 1"`
	SetNickname  *LoginSetNickname  `struct-if:"Status == 216"`
	SetCharacter *LoginSetCharacter `struct-if:"Status == 217"`
}

type ServerLoginSessionKey

type ServerLoginSessionKey struct {
	ServerMessage_
	SessionKey common.PString
}

type ServerMacros

type ServerMacros struct {
	ServerMessage_
}

type ServerMessage

type ServerMessage interface {
	common.Message
	// contains filtered or unexported methods
}

type ServerMessageServerList

type ServerMessageServerList struct {
	ServerMessage_
	ServerList
}

type ServerMessage_

type ServerMessage_ struct{}

type ServerNicknameCheckResponse

type ServerNicknameCheckResponse struct {
	ServerMessage_
	Unknown  uint32
	Nickname common.PString
}

Jump to

Keyboard shortcuts

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