home

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: 45 Imported by: ? modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package home implements the behavior of a Gophercraft home server

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Run

func Run()

func RunServer

func RunServer(cfg *config.Home) error

Types

type APIFunc

type APIFunc func(*Request)

type AccessLevel

type AccessLevel int

type CaptchaResponse

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

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 Request

type Request struct {
	Writer    http.ResponseWriter
	Request   *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 Server

type Server struct {
	Config       *config.Home
	WebDirectory string
	DB           *xorm.Engine
	Router       *mux.Router
}

func (*Server) API

func (s *Server) API(prefix string) *WebAPI

func (*Server) AccountID

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

func (*Server) AccountLogin

func (s *Server) AccountLogin(account *models.Account, username, password string) (string, error)

func (*Server) CanEnlistRealm

func (s *Server) CanEnlistRealm(acc *models.Account) bool

func (*Server) GetAccount

func (c *Server) GetAccount(user string) (*models.Account, []models.GameAccount, error)

func (*Server) GetAccountID

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

func (*Server) GetAuthStatus

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

func (*Server) GetCVar

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

func (*Server) GetTicket

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

func (*Server) HandleEnlistRealm

func (h *Server) HandleEnlistRealm(acc *models.Account, enlistRequest *models.WebEnlistRealmRequest) (*models.WebEnlistRealmResponse, error)

func (*Server) HandleSignIn

func (s *Server) HandleSignIn(r *Request)

func (*Server) HandleWebLogin

func (s *Server) HandleWebLogin(username, password string) (*models.Account, string, error)

func (*Server) Home

func (s *Server) Home(rw http.ResponseWriter, r *http.Request)

func (*Server) InfoHandler

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

func (*Server) Intercept

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

func (*Server) ListRealms

func (c *Server) ListRealms() []models.Realm

func (*Server) NewCaptcha

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

func (*Server) PublishRealmInfo

func (c *Server) PublishRealmInfo(r models.Realm) uint64

func (*Server) QueryTokenAccount

func (s *Server) QueryTokenAccount(token string) (*models.Account, error)

func (*Server) RealmList

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

func (*Server) RealmState

func (c *Server) RealmState() []models.Realm

func (*Server) Register

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

func (*Server) ResetAccount

func (c *Server) ResetAccount(user, pass string, tier rpcnet.Tier) error

func (*Server) SetCVar

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

func (*Server) SignOutAll

func (s *Server) SignOutAll(account uint64)

func (*Server) SignUp

func (s *Server) SignUp(rw http.ResponseWriter, r *http.Request)

func (*Server) StoreKey

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

func (*Server) StoreLoginTicket

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

func (*Server) UserExists

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

func (*Server) WebServer

func (s *Server) WebServer() http.Handler

type UserExistsResponse

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

type WebAPI

type WebAPI struct {
	Router *mux.Router
}

func (*WebAPI) On

func (wap *WebAPI) On(route string, handler APIFunc)

Directories

Path Synopsis
package multiproto allows multiple protocols to be interpreted on a single socket, by receiving a small segment of bytes
package multiproto allows multiple protocols to be interpreted on a single socket, by receiving a small segment of bytes

Jump to

Keyboard shortcuts

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