Documentation ¶
Index ¶
- Variables
- func GenToken() string
- type AuthData
- type AuthRequest
- type AuthResponse
- type User
- func (u *User) GetFromController() (fromUser packet.RecvChan, toUser packet.SendChan)
- func (u *User) GetFromDataChannel() (fromUser packet.RecvChan, toUser packet.SendChan)
- func (u *User) GobDecode(data []byte) error
- func (u *User) GobEncode() ([]byte, error)
- func (u *User) IsOnline() bool
- func (u User) String() string
- type UserInfo
- type Users
- func (us *Users) AddUser(ui *UserInfo) *User
- func (us *Users) Find(username string) *User
- func (us *Users) FindByIP(addr ip.IP) *User
- func (us *Users) FindId(id int) *User
- func (u *Users) Load(fp string) error
- func (us *Users) Login(userId int, pswd string) *User
- func (us *Users) LoginByName(name string, pswd string) *User
- func (us *Users) Register(name string, pswd string) *User
- func (u *Users) Save(fp string) error
- func (us *Users) Show() []User
Constants ¶
This section is empty.
Variables ¶
View Source
var (
ErrInvalidAuthToken = logex.Define("invalid auth token")
)
View Source
var (
ErrUserNotFound = logex.Define("user not found")
)
Functions ¶
Types ¶
type AuthRequest ¶
type AuthRequest struct { UserName string `json:"username"` Token []byte `json:"token"` IV []byte `json:"iv"` }
Token = aes_256_cfb(md5(pswd) + ":" + timestamp, key, iv) key = specified key by config iv = base64(rand(16))
func NewAuthRequest ¶
func NewAuthRequest(userName string, timestamp int64, passcode, key []byte) *AuthRequest
passcode: sha1(password + salt)
type AuthResponse ¶
type User ¶
func (*User) GetFromController ¶
func (*User) GetFromDataChannel ¶
Click to show internal directories.
Click to hide internal directories.