web

package
v0.0.0-...-c037003 Latest Latest
Warning

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

Go to latest
Published: Dec 10, 2014 License: GPL-3.0 Imports: 16 Imported by: 0

Documentation

Index

Constants

View Source
const (
	REDIS_HASH_MAX  = 1000
	SESSION_ID      = "SID"
	CTX_SESSION_KEY = 0
)

Variables

This section is empty.

Functions

func Auth

func Auth(w http.ResponseWriter, r *http.Request)

func AuthHash

func AuthHash(r *http.Request) (string, string)

func FreeSpinGame

func FreeSpinGame(w http.ResponseWriter, r *http.Request)

func GetUserName

func GetUserName(conn *redis.Client, r *http.Request) (string, bool, error)

func GetUserNameFromRedis

func GetUserNameFromRedis(r *http.Request) (string, error)

func Hash

func Hash(s string) uint64

func InitUsers

func InitUsers() map[string]*User

func NormalSpinGame

func NormalSpinGame(w http.ResponseWriter, r *http.Request)

func RandomString

func RandomString() (string, error)

func RedisHashKey

func RedisHashKey(prefix, value string) string

func ShowGame

func ShowGame(w http.ResponseWriter, r *http.Request)

func SpinGame

func SpinGame(w http.ResponseWriter, r *http.Request, sp SpinAction, valiateErr error)

Types

type FreeSpinParams

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

type NormalSpinParams

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

type SetSessionIfMissing

type SetSessionIfMissing struct {
	http.Handler
}

func (*SetSessionIfMissing) ServeHTTP

func (f *SetSessionIfMissing) ServeHTTP(w http.ResponseWriter, r *http.Request)

type SpinAction

type SpinAction interface {
	// contains filtered or unexported methods
}

type User

type User struct {
	Id   int64
	Name string
	// contains filtered or unexported fields
}

func AuthUser

func AuthUser(name string, password string) (*User, bool)

func NewAnonymousUser

func NewAnonymousUser(randomName string) *User

func NewUser

func NewUser(id int64, name string) *User

Jump to

Keyboard shortcuts

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