api

package
v0.3.19 Latest Latest
Warning

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

Go to latest
Published: Jan 2, 2026 License: GPL-3.0 Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// ErrUserNotModified is returned when the user list is not modified.
	ErrUserNotModified = errors.New("users not modified")
	// ErrNodeNotEnabled is returned when the node is not enabled.
	ErrNodeNotEnabled = errors.New("node not enabled")
	// ErrNodeNotFound is returned when the node is not found.
	ErrNodeNotFound = errors.New("node not found")
	// ErrNodeOutOfBandwidth is returned when the node is out of bandwidth.
	ErrNodeOutOfBandwidth = errors.New("node out of bandwidth")
	// ErrNodeNotModified is returned when the node info is not modified.
	ErrNodeNotModified = errors.New("node not modified")
	// ErrRuleNotModified is returned when the rule list is not modified.
	ErrRuleNotModified = errors.New("rules not modified")
)

Functions

This section is empty.

Types

type API

type API interface {
	GetNodeInfo() (nodeInfo *NodeInfo, err error)
	GetUserList() (userList *[]UserInfo, err error)
	ReportNodeOnlineUsers(onlineUser *[]OnlineUser) (err error)
	ReportUserTraffic(userTraffic *[]UserTraffic) (err error)
	Describe() ClientInfo
	GetNodeRule() (ruleList *[]DetectRule, err error)
	ReportIllegal(detectResultList *[]DetectResult) (err error)
	Debug()
}

API is the interface for different panel's api.

type ClientInfo

type ClientInfo struct {
	APIHost  string
	NodeID   int
	Key      string
	NodeType string
}

type Config

type Config struct {
	APIHost      string  `mapstructure:"ApiHost"`
	NodeID       int     `mapstructure:"NodeID"`
	Key          string  `mapstructure:"ApiKey"`
	NodeType     string  `mapstructure:"NodeType"`
	Timeout      int     `mapstructure:"Timeout"`
	SpeedLimit   float64 `mapstructure:"SpeedLimit"`
	DeviceLimit  int     `mapstructure:"DeviceLimit"`
	RuleListPath string  `mapstructure:"RuleListPath"`
}

Config API config

type DetectResult

type DetectResult struct {
	UID    int
	RuleID int
}

type DetectRule

type DetectRule struct {
	ID      int
	Pattern *regexp.Regexp
}

type NodeInfo

type NodeInfo struct {
	NodeType          string // Must be vmess, trojan, shadowsocks and shadowsocks2022
	NodeID            int
	Port              uint32
	SpeedLimit        uint64 // Bps
	AlterID           uint16
	TransportProtocol string
	FakeType          string
	Host              string
	Path              string
	EnableTLS         bool
	CipherMethod      string
	ServerKey         string
	ServiceName       string
	Header            json.RawMessage
	NameServerConfig  []*conf.NameServerConfig
}

type OnlineUser

type OnlineUser struct {
	UID int
	IP  string
}

type UserInfo

type UserInfo struct {
	UID         int
	Email       string
	UUID        string
	Passwd      string
	Port        uint32
	AlterID     uint16
	Method      string
	SpeedLimit  uint64 // Bps
	DeviceLimit int
}

type UserTraffic

type UserTraffic struct {
	UID      int
	Email    string
	Upload   int64
	Download int64
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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