auth

package
v0.0.0-...-cf76086 Latest Latest
Warning

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

Go to latest
Published: Dec 14, 2014 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

View Source
const (
	UserType_Normal = iota
	UserType_BlackList
	UserType_Super
	UserType_Admin

	CacheTime = 30

	DefaultMaxOnlineServerNum = 2
	DefaultMaxSessionNum      = 2
	DefaultMaxPipeNum         = 2
	DefaultMaxSameIPServers   = 2
	DefaultMaxCSModeData      = 10000000 //bytes
)

Variables

This section is empty.

Functions

func AddUser

func AddUser(name string, user *User) (string, error)

func DeInit

func DeInit()

func DelUser

func DelUser(name string) (bool, error)

func GenUserKey

func GenUserKey(name string) string

func GetUserNameList

func GetUserNameList(limita, limitb string) []string

func Init

func Init(user, passwd, host string) error

func UpdateUser

func UpdateUser(name string, user *User) error

func UpdateUserKey

func UpdateUserKey(name, key string) error

Types

type User

type User struct {
	//save to database
	UserName string
	Passwd   string
	UserType int
	AuthKey  string

	LastLoginTime      int64
	LastLogoutTime     int64
	MaxOnlineServerNum int
	MaxSessionNum      int
	MaxPipeNum         int
	MaxSameIPServers   int
	TodayCSModeData    int `stop:"true"`
	// contains filtered or unexported fields
}

func GetUser

func GetUser(name string) (*User, error)

func GetUserByKey

func GetUserByKey(key string) (*User, error)

func (*User) CheckIpLimit

func (u *User) CheckIpLimit(ip string) bool

func (*User) CheckOnlineServiceNum

func (u *User) CheckOnlineServiceNum() bool

func (*User) CheckPipeNum

func (u *User) CheckPipeNum(n int) bool

func (*User) CheckSessionNum

func (u *User) CheckSessionNum(n int) bool

func (*User) CheckType

func (u *User) CheckType() bool

func (*User) DeInit

func (u *User) DeInit()

func (*User) IsAlive

func (u *User) IsAlive() bool

func (*User) OnLogin

func (u *User) OnLogin()

func (*User) OnLogout

func (u *User) OnLogout()

func (*User) SetCacheTime

func (u *User) SetCacheTime(t int64)

func (*User) UpdateCSMode

func (u *User) UpdateCSMode(size int) bool

Jump to

Keyboard shortcuts

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