v2raymanager

package module
v0.0.0-...-5818dc2 Latest Latest
Warning

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

Go to latest
Published: Aug 15, 2023 License: MIT Imports: 11 Imported by: 1

README

v2ray-manager

Documentation

Index

Constants

View Source
const (
	UplinkFormat   = "user>>>%s>>>traffic>>>uplink"
	DownlinkFormat = "user>>>%s>>>traffic>>>downlink"
)

Variables

View Source
var (
	TODOErr = fmt.Errorf("TODO error ")
)

Functions

func IsAlreadyExistsError

func IsAlreadyExistsError(e error) bool

func IsNotFoundError

func IsNotFoundError(e error) bool

Types

type Manager

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

func NewManager

func NewManager(addr, tag string, l *slog.Logger) (*Manager, error)

func (*Manager) AddUser

func (m *Manager) AddUser(ctx context.Context, u User) (bool, error)

return is exist,and error

func (*Manager) GetTrafficAndReset

func (m *Manager) GetTrafficAndReset(ctx context.Context, u User) (TrafficInfo, error)

@todo error handle

func (*Manager) GetUserList

func (m *Manager) GetUserList(ctx context.Context, reset bool) ([]UserData, error)

func (*Manager) RemoveUser

func (m *Manager) RemoveUser(ctx context.Context, u User) error

func (*Manager) SetLogger

func (m *Manager) SetLogger(l *slog.Logger)

type TrafficInfo

type TrafficInfo struct {
	Up, Down int64
}

type User

type User interface {
	GetEmail() string
	GetUUID() string
	GetAlterID() uint32
	GetLevel() uint32
}

type UserData

type UserData struct {
	User        User
	TrafficInfo TrafficInfo
}

Jump to

Keyboard shortcuts

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