memory

package
v1.0.8 Latest Latest
Warning

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

Go to latest
Published: May 13, 2021 License: GPL-3.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

View Source
const Name = "MEMORY"

Variables

This section is empty.

Functions

func NewAuthenticator

func NewAuthenticator(ctx context.Context) (statistic.Authenticator, error)

Types

type Authenticator

type Authenticator struct {
	sync.RWMutex
	// contains filtered or unexported fields
}

func (*Authenticator) AddUser

func (a *Authenticator) AddUser(password, hash string) error

func (*Authenticator) AuthUser

func (a *Authenticator) AuthUser(hash string) (bool, statistic.User)

func (*Authenticator) Close

func (a *Authenticator) Close() error

func (*Authenticator) DelUser

func (a *Authenticator) DelUser(hash string) error

func (*Authenticator) ListUsers

func (a *Authenticator) ListUsers() []statistic.User

type Config

type Config struct {
	Passwords []string `json:"password" yaml:"password"`
}

type User

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

func (*User) AddIP

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

func (*User) AddTraffic

func (u *User) AddTraffic(sent, recv int)

func (*User) Close

func (u *User) Close() error

func (*User) DelIP

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

func (*User) GetIP

func (u *User) GetIP() int

func (*User) GetIPLimit

func (u *User) GetIPLimit() int

func (*User) GetSpeed

func (u *User) GetSpeed() (uint64, uint64)

func (*User) GetSpeedLimit

func (u *User) GetSpeedLimit() (send, recv int)

func (*User) GetTraffic

func (u *User) GetTraffic() (uint64, uint64)

func (*User) Hash

func (u *User) Hash() string

func (*User) Password

func (u *User) Password() string

func (*User) ResetTraffic

func (u *User) ResetTraffic() (uint64, uint64)

func (*User) RouterName

func (u *User) RouterName() string

func (*User) SetIPLimit

func (u *User) SetIPLimit(n int)

func (*User) SetSpeedLimit

func (u *User) SetSpeedLimit(send, recv int)

func (*User) SetTraffic

func (u *User) SetTraffic(send, recv uint64)

Jump to

Keyboard shortcuts

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