auth

package
v0.5.1 Latest Latest
Warning

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

Go to latest
Published: Jan 15, 2023 License: GPL-3.0 Imports: 15 Imported by: 0

Documentation

Index

Constants

View Source
const (
	GruntSuccess                         ErrorType = 0x00
	GruntFailBanned                      ErrorType = 0x03
	GruntFailUnknownAccount              ErrorType = 0x04
	GruntFailIncorrectPassword           ErrorType = 0x05
	GruntFailAlreadyOnline               ErrorType = 0x06
	GruntFailNoTime                      ErrorType = 0x07
	GruntFailDbBusy                      ErrorType = 0x08
	GruntFailVersionInvalid              ErrorType = 0x09
	GruntFailVersionUpdate               ErrorType = 0x0A
	GruntFailInvalidServer               ErrorType = 0x0B
	GruntFailSuspended                   ErrorType = 0x0C
	GruntFailFailNoaccess                ErrorType = 0x0D
	GruntSuccessSurvey                   ErrorType = 0x0E
	GruntFailParentcontrol               ErrorType = 0x0F
	GruntFailLockedEnforced              ErrorType = 0x10
	GruntFailTrialEnded                  ErrorType = 0x11
	GruntFailUseBattlenet                ErrorType = 0x12
	GruntFailAntiIndulgence              ErrorType = 0x13
	GruntFailExpired                     ErrorType = 0x14
	GruntFailNoGameAccount               ErrorType = 0x15
	GruntFailChargeback                  ErrorType = 0x16
	GruntFailInternetGameRoomWithoutBnet ErrorType = 0x17
	GruntFailGameAccountLocked           ErrorType = 0x18
	GruntFailUnlockableLock              ErrorType = 0x19
	GruntFailConversionRequired          ErrorType = 0x20
	GruntFailDisconnected                ErrorType = 0xFF

	LoginOk              LoginResult = 0x00
	LoginFailed          LoginResult = 0x01
	LoginFailed2         LoginResult = 0x02
	LoginBanned          LoginResult = 0x03
	LoginUnknownAccount  LoginResult = 0x04
	LoginUnknownAccount3 LoginResult = 0x05
	LoginAlreadyonline   LoginResult = 0x06
	LoginNotime          LoginResult = 0x07
	LoginDbbusy          LoginResult = 0x08
	LoginBadversion      LoginResult = 0x09
	LoginDownloadFile    LoginResult = 0x0A
	LoginFailed3         LoginResult = 0x0B
	LoginSuspended       LoginResult = 0x0C
	LoginFailed4         LoginResult = 0x0D
	LoginConnected       LoginResult = 0x0E
	LoginParentalcontrol LoginResult = 0x0F
	LoginLockedEnforced  LoginResult = 0x10

	NoValidExpFlag uint8 = 0x0
	PreBcExpFlag   uint8 = 0x1
	PostBcExpFlag  uint8 = 0x2

	LogonChallenge     AuthType = 0x00
	LogonProof         AuthType = 0x01
	ReconnectChallenge AuthType = 0x02
	ReconnectProof     AuthType = 0x03
	RealmList          AuthType = 0x10
	XferInitiate       AuthType = 0x30
	XferData           AuthType = 0x31
	XferAccept         AuthType = 0x32
	XferResume         AuthType = 0x33
	XferCancel         AuthType = 0x34

	RealmGreen  uint8 = 0
	RealmYellow uint8 = 1
	RealmRed    uint8 = 2

	GruntLegacy         uint16 = 0x02
	GruntImprovedSystem uint16 = 0x08
)

Variables

View Source
var (
	VersionChallenge = [...]byte{0xBA, 0xA3, 0x1E, 0x99, 0xA0, 0x0B, 0x21, 0x57, 0xFC, 0x37, 0x3F, 0xB3, 0x69, 0xCD, 0xD2, 0xF1}
)

Functions

func RunServer

func RunServer(b Backend, l net.Listener) error

func Version

func Version(build vsn.Build) [3]byte

Types

type AuthLogonChallenge_C

type AuthLogonChallenge_C struct {
	Error        ErrorType
	GameName     string // Encode in reverse.
	Version      [3]byte
	Build        uint16
	Platform     string
	OS           string
	Country      string
	TimezoneBias uint32
	IP           uint32
	I            string
}

AuthLogonChallenge_C is the first packet sent by a client while initiating a connection to an authserver.

func (*AuthLogonChallenge_C) Recv

func (ac *AuthLogonChallenge_C) Recv(build vsn.Build, conn *Connection) error

func (*AuthLogonChallenge_C) Send

func (alcc *AuthLogonChallenge_C) Send(build vsn.Build, out *Connection) error

func (*AuthLogonChallenge_C) Type

func (ac *AuthLogonChallenge_C) Type() AuthType

type AuthLogonChallenge_S

type AuthLogonChallenge_S struct {
	Error            ErrorType
	B                []byte // 32 long
	G                []byte
	N                []byte // 32 long
	S                []byte // 32 long
	VersionChallenge []byte // 16 long
	SecurityFlags    uint8
}

func (*AuthLogonChallenge_S) Recv

func (acls *AuthLogonChallenge_S) Recv(build vsn.Build, conn *Connection) error

func (*AuthLogonChallenge_S) Send

func (acls *AuthLogonChallenge_S) Send(build vsn.Build, conn *Connection) error

func (*AuthLogonChallenge_S) Type

func (acls *AuthLogonChallenge_S) Type() AuthType

type AuthLogonProof_C

type AuthLogonProof_C struct {
	A            []byte // 32 long
	M1           []byte // 20 long
	CRC          []byte // 20 long
	NumberOfKeys uint8
	SecFlags     uint8
}

func (*AuthLogonProof_C) Recv

func (alpc *AuthLogonProof_C) Recv(build vsn.Build, conn *Connection) error

func (*AuthLogonProof_C) Send

func (alpc *AuthLogonProof_C) Send(build vsn.Build, conn *Connection) error

Client sends BE (Big Endian) Server reinterpret_casts struct, converting it to LE in C++ Server converts it back to BE with SetBinary

func (*AuthLogonProof_C) Type

func (alpc *AuthLogonProof_C) Type() AuthType

type AuthLogonProof_S

type AuthLogonProof_S struct {
	Error        ErrorType
	M2           []byte
	AccountFlags uint32
	SurveyID     uint32
	Unk3         uint16
}

func (*AuthLogonProof_S) Recv

func (proof *AuthLogonProof_S) Recv(build vsn.Build, conn *Connection) error

func (*AuthLogonProof_S) Send

func (proof *AuthLogonProof_S) Send(build vsn.Build, conn *Connection) error

func (*AuthLogonProof_S) Type

func (proof *AuthLogonProof_S) Type() AuthType

type AuthType

type AuthType uint8

func (AuthType) String

func (i AuthType) String() string

type Backend

type Backend interface {
	GetAccount(user string) (*models.Account, []models.GameAccount, error)
	ListRealms() []models.Realm
	StoreKey(user, locale, platform string, K []byte)
}

type Client

type Client struct {
	GameName   string
	Version    vsn.Build
	Address    string
	Username   string
	Password   string
	SessionKey []byte
	Realms     []RealmListing
	// contains filtered or unexported fields
}

func Login

func Login(version vsn.Build, address, username, password string) (*Client, error)

func (*Client) Recv

func (cl *Client) Recv() error

func (*Client) RequestRealmListUpdates

func (cl *Client) RequestRealmListUpdates() error

func (*Client) Send

func (cl *Client) Send(p Packet) error

type Connection

type Connection struct {
	net.Conn
}

func Dial

func Dial(address string) (*Connection, error)

func (*Connection) RecvBuffer

func (conn *Connection) RecvBuffer(size int) (*etc.Buffer, error)

func (*Connection) SendBuffer

func (conn *Connection) SendBuffer(e *etc.Buffer) error

type ErrorType

type ErrorType uint8

func (ErrorType) String

func (i ErrorType) String() string

type LoginResult

type LoginResult uint8

type Packet

type Packet interface {
	Type() AuthType
	Send(build vsn.Build, out *Connection) error
	Recv(build vsn.Build, in *Connection) error
}

func LogonChallengePacket_C

func LogonChallengePacket_C(build vsn.Build, username string) Packet

LogonChallengePacket_C is a helper function to simplify the client library.

type RealmList_C

type RealmList_C struct {
	Request uint32
}

func (*RealmList_C) Recv

func (rlc *RealmList_C) Recv(build vsn.Build, conn *Connection) error

func (*RealmList_C) Send

func (rlc *RealmList_C) Send(build vsn.Build, out *Connection) error

func (*RealmList_C) Type

func (rlc *RealmList_C) Type() AuthType

type RealmList_S

type RealmList_S struct {
	Realms []RealmListing
	Flags  uint16
}

func MakeRealmlist

func MakeRealmlist(rlst []models.Realm) *RealmList_S

func (*RealmList_S) Recv

func (rls *RealmList_S) Recv(build vsn.Build, conn *Connection) error

func (*RealmList_S) Send

func (rlst *RealmList_S) Send(build vsn.Build, out *Connection) error

func (*RealmList_S) Type

func (rls *RealmList_S) Type() AuthType

type RealmListing

type RealmListing struct {
	Type       config.RealmType //
	Locked     bool
	Flags      uint8
	Name       string
	Address    string
	Population float32
	Characters uint8
	Timezone   uint8
	ID         uint8
}

type ReconnectChallenge_C

type ReconnectChallenge_C struct {
	Result LoginResult

	ChallengeData []byte
}

func (*ReconnectChallenge_C) Recv

func (rc *ReconnectChallenge_C) Recv(build vsn.Build, in *Connection) error

func (*ReconnectChallenge_C) Send

func (rc *ReconnectChallenge_C) Send(build vsn.Build, out *Connection) error

func (*ReconnectChallenge_C) Type

func (rc *ReconnectChallenge_C) Type() AuthType

type Server

type Server struct {
	Backend
}

func (*Server) Close

func (h *Server) Close() error

func (*Server) Handle

func (server *Server) Handle(cn net.Conn)

type Session

type Session struct {
	K []byte

	M2 []byte

	N *srp.BigNum

	B *srp.BigNum
	// contains filtered or unexported fields
}

func (*Session) Send

func (session *Session) Send(packet Packet) error

Jump to

Keyboard shortcuts

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