Documentation ¶
Index ¶
- Variables
- func ReadBytes(buffer io.Reader, length int) ([]byte, error)
- type AuthConnection
- func (rc *AuthConnection) HandleLogin(pkt *ClientLoginChallenge) error
- func (rc *AuthConnection) HandleProof(pkt *ClientLoginProof) error
- func (rc *AuthConnection) HandleRealmList() error
- func (rc *AuthConnection) Send(opcode RealmCommand, payload []byte) error
- func (rc *AuthConnection) Write(bb []byte) error
- type ChallengeStatus
- type ClientLoginChallenge
- type ClientLoginProof
- type ClientRealmlistPacket
- type ManagementClient
- type ManagementService
- type ManagementServiceImpl
- type RData
- type Realm
- type RealmCommand
- type RealmFlags
- type RealmProvider
- type Server
- type ServerLoginChallenge
- type ServerLoginProof
- type ServerOption
- type ServerRealmlistPacket
- type Session
- type StaticRealmProvider
Constants ¶
This section is empty.
Variables ¶
var ( ErrShortRead = errors.New("short read when reading opcode data") ErrWriteSize = errors.New("the written and sent bytes are not equal") ErrNoHandler = errors.New("no handler implemented") )
var ( ErrAccountAlreadyExists = errors.New("account already exists") ErrAccountCreateError = errors.New("can't create account") )
Functions ¶
Types ¶
type AuthConnection ¶
type AuthConnection struct {
// contains filtered or unexported fields
}
func NewAuthConnection ¶
func NewAuthConnection(c net.Conn, rp RealmProvider, management ManagementService, ) *AuthConnection
func (*AuthConnection) HandleLogin ¶
func (rc *AuthConnection) HandleLogin(pkt *ClientLoginChallenge) error
func (*AuthConnection) HandleProof ¶
func (rc *AuthConnection) HandleProof(pkt *ClientLoginProof) error
func (*AuthConnection) HandleRealmList ¶
func (rc *AuthConnection) HandleRealmList() error
func (*AuthConnection) Send ¶
func (rc *AuthConnection) Send(opcode RealmCommand, payload []byte) error
func (*AuthConnection) Write ¶
func (rc *AuthConnection) Write(bb []byte) error
type ChallengeStatus ¶
type ChallengeStatus uint8
const ( ChallengeStatusSuccess ChallengeStatus = iota // Account not found. ChallengeStatusFailed // Account has been banned. ChallengeStatusFailBanned // This <game> account has been closed and is no longer available for use. Please // go to <site>/banned.html for further information. ChallengeStatusFailUnknownAccount // The information you have entered is not valid. Please check the spelling // of the account name and password. If you need help in retrieving a lost or // stolen password, see <site> for more information. ChallengeStatusFailUnknown0 // The information you have entered is not valid. Please check the spelling // of the account name and password. If you need help in retrieving a lost // or stolen password, see <site> for more information. ChallengeStatusFailIncorrectPassword // This account is already logged into <game>. Please check the spelling and try again. ChallengeStatusFailAlreadyOnline // You have used up your prepaid time for this account. Please purchase more to continue playing. ChallengeStatusFailNoTime // Could not log in to <game> at this time. Please try again later. ChallengeStatusFailDBBusy // Unable to validate game version. This may be caused by file corruption or // interference of another program. Please visit <site> for more information // and possible solutions to this issue. ChallengeStatusFailVersionInvalid // Downloading. ChallengeStatusFailVersionUpdate // Unable to connect. ChallengeStatusFailInvalidServer // This <game> account has been temporarily suspended. Please go to <site>/banned.html for further information. ChallengeStatusFailSuspended // Unable to connect. ChallengeStatusFailFailNoaccess // Connected. ChallengeStatusSuccessSurvey // Access to this account has been blocked by parental controls. Your settings may be changed in your // account preferences or at <site>. ChallengeStatusFailParentcontrol // You have applied a lock to your account. You can change your locked status by calling // your account lock phone number. ChallengeStatusFailLockedEnforced // Your trial subscription has expired. Please visit <site> to upgrade your account. ChallengeStatusFailTrialEnded )
type ClientLoginChallenge ¶
type ClientLoginChallenge struct { GameName string Version [3]byte Build uint16 Platform string OS string Locale string WorldRegionBias uint32 IP []uint8 AccountName string }
ClientLoginChallenge received login challenge packet.
func NewClientLoginChallenge ¶
func NewClientLoginChallenge(accName string, build int, version [3]byte) *ClientLoginChallenge
func (*ClientLoginChallenge) MarshalPacket ¶
func (p *ClientLoginChallenge) MarshalPacket() []byte
func (*ClientLoginChallenge) OpCode ¶
func (p *ClientLoginChallenge) OpCode() RealmCommand
func (*ClientLoginChallenge) UnmarshalPacket ¶
func (p *ClientLoginChallenge) UnmarshalPacket(bb wow.PacketData) error
type ClientLoginProof ¶
type ClientLoginProof struct { A big.Int M big.Int CRCHash []byte // 20byte long NumberOfKeys uint8 SecurityFlags uint8 }
ClientLoginProof encodes proof that the client has the correct information.
func (ClientLoginProof) MarshalPacket ¶
func (pkt ClientLoginProof) MarshalPacket() []byte
func (ClientLoginProof) OpCode ¶
func (ClientLoginProof) OpCode() RealmCommand
func (*ClientLoginProof) UnmarshalPacket ¶
func (pkt *ClientLoginProof) UnmarshalPacket(bb wow.PacketData) error
Read will load a ClientLoginProof packet from a buffer. An error will be returned if at least one of the fields didn't load correctly.
type ClientRealmlistPacket ¶
type ClientRealmlistPacket struct {
Unknown uint32
}
ClientRealmlistPacket packet contains no fields.
func (*ClientRealmlistPacket) MarshalPacket ¶
func (pkt *ClientRealmlistPacket) MarshalPacket() []byte
func (*ClientRealmlistPacket) OpCode ¶
func (pkt *ClientRealmlistPacket) OpCode() RealmCommand
func (*ClientRealmlistPacket) UnmarshalPacket ¶
func (pkt *ClientRealmlistPacket) UnmarshalPacket(bb wow.PacketData) error
type ManagementClient ¶
type ManagementClient struct { // RequestTimeout timeout for requests. Default is 5 seconds RequestTimeout time.Duration // contains filtered or unexported fields }
func NewManagementClient ¶
func NewManagementClient(addr string) (*ManagementClient, error)
NewManagementClient initializes new management client with gRPC protocol to interact with the auth server.
func (*ManagementClient) AddSession ¶
func (mc *ManagementClient) AddSession(session *Session)
AddSession adds session to the auth session store.
func (*ManagementClient) Close ¶
func (mc *ManagementClient) Close() error
Close closes the management client connection.
func (*ManagementClient) FindAccount ¶
func (mc *ManagementClient) FindAccount(user string) *store.Account
FindAccount finds an account in the store.
func (*ManagementClient) GetSession ¶
func (mc *ManagementClient) GetSession(user string) *Session
GetSession returns the auth session if any.
func (*ManagementClient) Register ¶
func (mc *ManagementClient) Register(user, pass, email string) error
Register registers a new user in auth server.
type ManagementService ¶
type ManagementService interface { // Registers the user. Returns error if user already exists, // or email is alreay used, or sg. Register(user, pass, email string) error // FindAccount finds an account in the store. FindAccount(user string) *store.Account // GetSession returns the auth session if any. GetSession(user string) *Session // AddSession adds session to the auth session store. AddSession(session *Session) }
ManagementService service provided.
type ManagementServiceImpl ¶
type ManagementServiceImpl struct {
// contains filtered or unexported fields
}
func NewManagementService ¶
func NewManagementService(store store.AccountRepo) *ManagementServiceImpl
NewManagementService initializes account manager.
func (*ManagementServiceImpl) AddSession ¶
func (ms *ManagementServiceImpl) AddSession(session *Session)
AddSession adds session to the auth session store.
func (*ManagementServiceImpl) FindAccount ¶
func (ms *ManagementServiceImpl) FindAccount(user string) *store.Account
FindAccount retrives account from the database.
func (*ManagementServiceImpl) GetSession ¶
func (ms *ManagementServiceImpl) GetSession(user string) *Session
GetSession returns the auth session if any.
type RData ¶
type RData struct { Command uint8 Data wow.PacketData }
func (*RData) Unmarshal ¶
func (r *RData) Unmarshal(lp wow.RealmPacket)
type Realm ¶
type Realm struct { // realm type (this is second column in Cfg_Configs.dbc) Icon uint8 // flags, if 0x01, then realm locked Lock uint8 // see enum RealmFlags Flags RealmFlags // Name name of the server Name string // Address is a network address of the world server Address string // Population Population float32 // NumCharacters number of characters in server NumCharacters uint8 // Timezone Timezone uint8 // Unknown - needs research whats this Unknown uint8 }
Realm is information required to send as part of the realmlist.
type RealmCommand ¶
type RealmCommand uint32
const ( AuthLoginChallenge RealmCommand = iota + 0x00 AuthLoginProof AuthReconnectChallenge // #4 implement reconnect challenge and reconnect proof AuthReconnectProof RealmList RealmCommand = 0x10 )
func (RealmCommand) String ¶
func (i RealmCommand) String() string
type RealmFlags ¶
type RealmFlags uint8
const ( RealmFlagNone RealmFlags = 0x00 RealmFlagInvalid RealmFlags = 0x01 RealmFlagOffline RealmFlags = 0x02 RealmFlagSpecifyBuild RealmFlags = 0x04 RealmFlagUnk1 RealmFlags = 0x08 RealmFlagUnk2 RealmFlags = 0x10 RealmFlagNewPlayers RealmFlags = 0x20 RealmFlagRecommended RealmFlags = 0x40 RealmFlagFull RealmFlags = 0x80 )
type RealmProvider ¶
type Server ¶
type Server struct {
// contains filtered or unexported fields
}
func NewServer ¶
func NewServer(listenAddress string, management ManagementService, opts ...ServerOption) (*Server, error)
func NewServerListener ¶
func NewServerListener(l net.Listener, management ManagementService, opts ...ServerOption) (*Server, error)
func (*Server) StartManagementServer ¶
func (s *Server) StartManagementServer()
StartManagementServer starts the RPC server if the listener is defined for. When the rpcListener is empty, the management server will not be enabled. The listener can be set in the NewServer() constructor with the WithManagement() ServerOption.
type ServerLoginChallenge ¶
type ServerLoginChallenge struct { Status ChallengeStatus B big.Int Salt big.Int // 16 bytes long SaltCRC []byte G uint8 N big.Int }
ServerLoginChallenge is the server's response to a client's challenge. It contains some SRP information used for handshaking.
func (*ServerLoginChallenge) MarshalPacket ¶
func (pkt *ServerLoginChallenge) MarshalPacket() []byte
Bytes writes out the packet to an array of bytes.
func (*ServerLoginChallenge) ReadPacket ¶
func (pkt *ServerLoginChallenge) ReadPacket(data io.Reader) int
type ServerLoginProof ¶
ServerLoginProof is the server's response to a client's challenge. It contains some SRP information used for handshaking.
func (*ServerLoginProof) MarshalPacket ¶
func (pkt *ServerLoginProof) MarshalPacket() []byte
Bytes writes out the packet to an array of bytes.
func (*ServerLoginProof) ReadPacket ¶
func (pkt *ServerLoginProof) ReadPacket(r io.Reader) int
type ServerOption ¶
type ServerOption func(s *Server)
func WithManagement ¶
func WithManagement(l net.Listener) ServerOption
WithManagement this option will initialize a JSON-RPC 2.0 server listening on the specified listener to be able to manage the account server remotely. The management should be enabled to be able to use summitcli and separated world servers.
func WithRealmProvider ¶
func WithRealmProvider(rp RealmProvider) ServerOption
WithRealmProvider sets the realm provider for the server.
type ServerRealmlistPacket ¶
type ServerRealmlistPacket struct {
Realms []*Realm
}
ServerRealmlistPacket is made up of a list of realms.
func (*ServerRealmlistPacket) MarshalPacket ¶
func (pkt *ServerRealmlistPacket) MarshalPacket() []byte
MarshalPacket converts the ServerRealmlist packet to an array of bytes.
func (*ServerRealmlistPacket) ReadPacket ¶
func (pkt *ServerRealmlistPacket) ReadPacket(r *wow.PacketReader)
type StaticRealmProvider ¶
type StaticRealmProvider struct {
RealmList []*Realm
}