statistic

package
v0.0.0-...-7291369 Latest Latest
Warning

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

Go to latest
Published: May 10, 2024 License: GPL-3.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

View Source
const Name = "STATISTICS"

Variables

This section is empty.

Functions

func RegisterAuthenticatorCreator

func RegisterAuthenticatorCreator(name string, creator Creator)

Types

type Authenticator

type Authenticator interface {
	io.Closer
	AuthUser(hash string) (valid bool, user User)
	AddUser(hash string) error
	DelUser(hash string) error
	SetUserTraffic(hash string, sent, recv uint64) error
	SetUserSpeedLimit(hash string, send, recv int) error
	SetUserIPLimit(hash string, limit int) error
	ListUsers() []User
}

func NewAuthenticator

func NewAuthenticator(ctx context.Context, name string) (Authenticator, error)

type Creator

type Creator func(ctx context.Context) (Authenticator, error)

type IPRecorder

type IPRecorder interface {
	AddIP(string) bool
	DelIP(string) bool
	GetIP() int
}

type Metadata

type Metadata interface {
	GetHash() string
	GetKeyShare() string
	GetTraffic() (sent, recv uint64)
	GetSpeedLimit() (sent, recv int)
	GetIPLimit() int
}

type Persistencer

type Persistencer interface {
	SaveUser(Metadata) error
	LoadUser(hash string) (Metadata, error)
	DeleteUser(hash string) error
	ListUser(func(hash string, u Metadata) bool) error
	UpdateUserTraffic(hash string, sent, recv uint64) error
}

type TrafficMeter

type TrafficMeter interface {
	io.Closer
	AddSentTraffic(sent int)
	AddRecvTraffic(recv int)
	ResetTraffic() (sent, recv uint64)
	GetSpeed() (sent, recv uint64)
}

type User

type User interface {
	Metadata
	TrafficMeter
	IPRecorder
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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