usermanager

package
v1.1.2 Latest Latest
Warning

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

Go to latest
Published: Jul 14, 2019 License: GPL-3.0 Imports: 18 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrInvalidMac = errors.New("Mac mismatch")
View Source
var ErrUserNotActive = errors.New("User is not active")
View Source
var ErrUserNotFound = errors.New("User does not exist in db")
View Source
var PutUint16 = binary.BigEndian.PutUint16
View Source
var PutUint32 = binary.BigEndian.PutUint32
View Source
var PutUint64 = binary.BigEndian.PutUint64
View Source
var Uint32 = binary.BigEndian.Uint32
View Source
var Uint64 = binary.BigEndian.Uint64

Functions

This section is empty.

Types

type User

type User struct {
	*UserInfo
	// contains filtered or unexported fields
}

func MakeUser

func MakeUser(up *Userpanel, uinfo *UserInfo) *User

func (*User) DelSession

func (u *User) DelSession(sessionID uint32)

func (*User) GetSession

func (u *User) GetSession(sessionID uint32, obfs mux.Obfser, deobfs mux.Deobfser, obfsedRead func(net.Conn, []byte) (int, error)) (sesh *mux.Session, existing bool, err error)

type UserInfo

type UserInfo struct {
	UID []byte
	// ALL of the following fields have to be accessed atomically
	SessionsCap uint32
	UpRate      int64
	DownRate    int64
	UpCredit    int64
	DownCredit  int64
	ExpiryTime  int64
}

for the ease of using json package

type Userpanel

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

func MakeUserpanel

func MakeUserpanel(dbPath, bakRoot string) (*Userpanel, error)

func (*Userpanel) GetAndActivateAdminUser

func (up *Userpanel) GetAndActivateAdminUser(AdminUID []byte) (*User, error)

func (*Userpanel) GetAndActivateUser

func (up *Userpanel) GetAndActivateUser(UID []byte) (*User, error)

GetUser is used to retrieve a user if s/he is active, or to retrieve the user's info from the db and mark it as an active user

func (*Userpanel) MakeController

func (up *Userpanel) MakeController(adminUID []byte) *controller

Jump to

Keyboard shortcuts

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