stat

package
v0.4.9 Latest Latest
Warning

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

Go to latest
Published: May 15, 2020 License: GPL-3.0 Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func RegisterAuthCreator added in v0.4.3

func RegisterAuthCreator(name string, creator AuthCreator)

Types

type AuthCreator added in v0.4.3

type AuthCreator func(ctx context.Context, config *conf.GlobalConfig) (Authenticator, error)

type Authenticator

type Authenticator interface {
	io.Closer
	AuthUser(hash string) (valid bool, meter TrafficMeter)
	AddUser(hash string) error
	DelUser(hash string) error
	ListUsers() []TrafficMeter
}

func NewAuth added in v0.4.3

func NewAuth(ctx context.Context, name string, config *conf.GlobalConfig) (Authenticator, error)

type TrafficMeter

type TrafficMeter interface {
	io.Closer
	Hash() string
	Count(sent, recv int)
	Get() (sent, recv uint64)
	Reset()
	GetAndReset() (sent, recv uint64)
	GetSpeed() (sent, recv uint64)
	LimitSpeed(send, recv int)
	GetSpeedLimit() (send, recv int)
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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