gcore

package
v0.0.0-...-382259f Latest Latest
Warning

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

Go to latest
Published: Jan 25, 2021 License: GPL-3.0 Imports: 30 Imported by: 0

Documentation

Overview

Package gcore implements the main functionality of the Gophercraft Core Authserver.

Index

Constants

This section is empty.

Variables

View Source
var (
	Version = vsn.CoreVersion
)

Functions

This section is empty.

Types

type Account

type Account struct {
	ID           uint64 `xorm:"'id' pk autoincr"`
	Tier         sys.Tier
	Locale       i18n.Locale
	Platform     string
	Username     string
	IdentityHash []byte
}

type CVar

type CVar struct {
	RealmID uint64 `xorm:"'server_id'"`
	Key     string `xorm:"'key'"`
	Value   string
}

type CaptchaResponse

type CaptchaResponse struct {
	Status    int    `json:"status"`
	CaptchaID string `json:"captchaID"`
}

type Core

type Core struct {
	Auth         *config.Auth
	WebDirectory etc.Path

	Key string
	DB  *xorm.Engine
}

func NewCore

func NewCore(cfg *config.Auth) (*Core, error)

func (*Core) APIKey

func (c *Core) APIKey() string

func (*Core) AccountID

func (c *Core) AccountID(user string) uint64

func (*Core) AddRealmToConfig

func (c *Core) AddRealmToConfig(ctx context.Context, req *sys.AddRealmRequest) (*sys.StatusMsg, error)

func (*Core) AnnounceRealm

func (c *Core) AnnounceRealm(ctx context.Context, req *sys.AnnounceRealmMsg) (*sys.StatusMsg, error)

func (*Core) AuthKey

func (c *Core) AuthKey(apk string) int

func (*Core) CheckCredentials

func (c *Core) CheckCredentials(ctx context.Context, req *sys.Credentials) (*sys.CredentialsResponse, error)

func (*Core) CheckPeerIdentity

func (c *Core) CheckPeerIdentity(ctx context.Context, realmID uint64) (*sys.StatusMsg, error)

func (*Core) DoRegistration

func (c *Core) DoRegistration(u, p string) error

func (*Core) GetAccount

func (c *Core) GetAccount(user string) (*Account, []GameAccount, error)

func (*Core) GetAccountID

func (c *Core) GetAccountID(user string) (uint64, error)

func (*Core) GetAuthStatus

func (c *Core) GetAuthStatus(r *Request)

func (*Core) GetCVar

func (c *Core) GetCVar(k string) string

func (*Core) GetNextRealmID

func (c *Core) GetNextRealmID(ctx context.Context, _ *empty.Empty) (*sys.AddRealmRequest, error)

func (*Core) GetTicket

func (c *Core) GetTicket(ticket string) (string, time.Time)

func (*Core) GetVersionData

func (c *Core) GetVersionData(ctx context.Context, _ *empty.Empty) (*sys.VersionData, error)

func (*Core) Home

func (c *Core) Home(rw http.ResponseWriter, r *http.Request)

func (*Core) InfoHandler

func (c *Core) InfoHandler() http.Handler

func (*Core) Intercept

func (c *Core) Intercept(required int, fn RequestHandler) *Interceptor

func (*Core) ListRealms

func (c *Core) ListRealms() []Realm

func (*Core) NewCaptcha

func (c *Core) NewCaptcha(r *Request)

func (*Core) Ping

func (c *Core) Ping(ctx context.Context, req *sys.PingMsg) (*sys.PingMsg, error)

func (*Core) PublishRealmInfo

func (c *Core) PublishRealmInfo(r Realm) uint64

func (*Core) RealmList

func (c *Core) RealmList(r *Request)

func (*Core) RealmState

func (c *Core) RealmState() []Realm

func (*Core) Register

func (c *Core) Register(r *Request)

func (*Core) ReportInfo

func (c *Core) ReportInfo(ctx context.Context, req *sys.Info) (*sys.StatusMsg, error)

func (*Core) ResetAccount

func (c *Core) ResetAccount(user, pass string, tier sys.Tier) error

func (*Core) SetCVar

func (c *Core) SetCVar(k, v string)

func (*Core) SignIn

func (c *Core) SignIn(r *Request)

func (*Core) SignUp

func (c *Core) SignUp(rw http.ResponseWriter, r *http.Request)

func (*Core) StoreKey

func (c *Core) StoreKey(user, locale, platform string, K []byte)

func (*Core) StoreLoginTicket

func (c *Core) StoreLoginTicket(user, ticket string, expiry time.Time)

func (*Core) UserExists

func (c *Core) UserExists(r *Request)

func (*Core) VerifyWorld

func (c *Core) VerifyWorld(ctx context.Context, req *sys.VerifyWorldQuery) (*sys.VerifyWorldResponse, error)

func (*Core) WebAPI

func (c *Core) WebAPI() http.Handler

type GameAccount

type GameAccount struct {
	ID    uint64 `xorm:"'id' pk autoincr"`
	Name  string `xorm:"'name'"`
	Owner uint64 `xorm:"'owner'"`
}

type GenericResponse

type GenericResponse struct {
	Status int    `json:"status"`
	Error  string `json:"error"`
}

type Interceptor

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

func (*Interceptor) ServeHTTP

func (s *Interceptor) ServeHTTP(rw http.ResponseWriter, req *http.Request)

type LoginTicket

type LoginTicket struct {
	Account string
	Ticket  string
	Expiry  time.Time
}

type Realm

type Realm struct {
	ID            uint64    `xorm:"'id' pk" json:"id"`
	Name          string    `xorm:"'name'" json:"name"`
	Version       vsn.Build `json:"version"`
	Locked        bool
	Type          config.RealmType `json:"type"`
	Address       string           `json:"address"`
	Description   string           `json:"description"`
	ActivePlayers uint32           `json:"activePlayers"`
	Timezone      uint32
	LastUpdated   time.Time `json:"lastUpdated"`
}

func (Realm) Offline

func (r Realm) Offline() bool

type RegistrationBody

type RegistrationBody struct {
	Username  string `json:"username"`
	Password  string `json:"password"`
	Expansion uint32 `json:"expansion"`
}

type Request

type Request struct {
	RW        http.ResponseWriter
	R         *http.Request
	Vars      map[string]string
	AuthLevel int
}

func (*Request) Encode

func (r *Request) Encode(status int, v interface{})

func (*Request) Respond

func (r *Request) Respond(status int, err string)

func (*Request) ScanJSON

func (r *Request) ScanJSON(v interface{}) error

type RequestHandler

type RequestHandler func(*Request)

type SessionKey

type SessionKey struct {
	ID uint64 `xorm:"'id' pk"`
	K  []byte
}

type UserExistsResponse

type UserExistsResponse struct {
	Status     int  `json:"status"`
	UserExists bool `json:"exists"`
}

type WebToken

type WebToken struct {
	Token   string `xorm:"'token' pk"`
	Account uint64
	Expiry  time.Time
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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