Documentation ¶
Index ¶
- Constants
- func NewAuthenticator(ctx context.Context) (statistic.Authenticator, error)
- type Authenticator
- func (a *Authenticator) AddUser(hash string) error
- func (a *Authenticator) AuthUser(hash string) (bool, statistic.User)
- func (a *Authenticator) Close() error
- func (a *Authenticator) DelUser(hash string) error
- func (a *Authenticator) ListUsers() []statistic.User
- func (a *Authenticator) SetKeyShare(hash string, pwd string) error
- func (a *Authenticator) SetUserIPLimit(hash string, limit int) error
- func (a *Authenticator) SetUserSpeedLimit(hash string, send, recv int) error
- func (a *Authenticator) SetUserTraffic(hash string, sent, recv uint64) error
- type Config
- type User
- func (u *User) AddIP(ip string) bool
- func (u *User) AddRecvTraffic(recv int)
- func (u *User) AddSentTraffic(sent int)
- func (u *User) Close() error
- func (u *User) DelIP(ip string) bool
- func (u *User) GetHash() string
- func (u *User) GetIP() int
- func (u *User) GetIPLimit() int
- func (u *User) GetKeyShare() string
- func (u *User) GetSpeed() (uint64, uint64)
- func (u *User) GetSpeedLimit() (send, recv int)
- func (u *User) GetTraffic() (uint64, uint64)
- func (u *User) ResetTraffic() (uint64, uint64)
- func (u *User) SetSpeedLimit(send, recv int)
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 {
// contains filtered or unexported fields
}
func (*Authenticator) AddUser ¶
func (a *Authenticator) AddUser(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
func (*Authenticator) SetKeyShare ¶
func (a *Authenticator) SetKeyShare(hash string, pwd string) error
func (*Authenticator) SetUserIPLimit ¶
func (a *Authenticator) SetUserIPLimit(hash string, limit int) error
func (*Authenticator) SetUserSpeedLimit ¶
func (a *Authenticator) SetUserSpeedLimit(hash string, send, recv int) error
func (*Authenticator) SetUserTraffic ¶
func (a *Authenticator) SetUserTraffic(hash string, sent, recv uint64) error
type User ¶
type User struct { // WARNING: do not change the order of these fields. // 64-bit fields that use `sync/atomic` package functions // must be 64-bit aligned on 32-bit systems. // Reference: https://github.com/golang/go/issues/599 // Solution: https://github.com/golang/go/issues/11891#issuecomment-433623786 Sent uint64 Recv uint64 Hash string MaxIPNum int SendLimiter *rate.Limiter RecvLimiter *rate.Limiter // contains filtered or unexported fields }
func (*User) AddRecvTraffic ¶
func (*User) AddSentTraffic ¶
func (*User) GetIPLimit ¶
func (*User) GetKeyShare ¶
func (*User) GetSpeedLimit ¶
func (*User) GetTraffic ¶
func (*User) ResetTraffic ¶
func (*User) SetSpeedLimit ¶
Click to show internal directories.
Click to hide internal directories.