panel

package
v1.1.7 Latest Latest
Warning

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

Go to latest
Published: Apr 7, 2023 License: MPL-2.0 Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type BaseConfig added in v1.1.0

type BaseConfig struct {
	PushInterval any `json:"push_interval"`
	PullInterval any `json:"pull_interval"`
}

type Client

type Client struct {
	APIHost       string
	Key           string
	NodeType      string
	NodeId        int
	SpeedLimit    int
	DeviceLimit   int
	LocalRuleList []DestinationRule
	// contains filtered or unexported fields
}

func (*Client) Debug

func (c *Client) Debug()

Debug set the client debug for client

func (*Client) Describe

func (c *Client) Describe() ClientInfo

Describe return a description of the client

func (*Client) GetNodeInfo

func (c *Client) GetNodeInfo() (nodeInfo *NodeInfo, err error)

func (*Client) GetUserList

func (c *Client) GetUserList() (UserList []UserInfo, err error)

GetUserList will pull user form sspanel

func (*Client) ReportUserTraffic

func (c *Client) ReportUserTraffic(userTraffic []UserTraffic) error

ReportUserTraffic reports the user traffic

type ClientInfo

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

type DestinationRule added in v1.0.0

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

type NodeInfo

type NodeInfo struct {
	Host            string            `json:"host"`
	ServerPort      int               `json:"server_port"`
	ServerName      string            `json:"server_name"`
	Network         string            `json:"network"`
	NetworkSettings json.RawMessage   `json:"networkSettings"`
	Cipher          string            `json:"cipher"`
	ServerKey       string            `json:"server_key"`
	Tls             int               `json:"tls"`
	Routes          []Route           `json:"routes"`
	BaseConfig      *BaseConfig       `json:"base_config"`
	Rules           []DestinationRule `json:"-"`
	// contains filtered or unexported fields
}

type OnlineUser

type OnlineUser struct {
	UID int
	IP  string
}

type Panel

type Panel interface {
	GetNodeInfo() (nodeInfo *NodeInfo, err error)
	GetUserList() (userList []UserInfo, err error)
	ReportUserTraffic(userTraffic []UserTraffic) (err error)
	Describe() ClientInfo
	Debug()
}

func New

func New(c *conf.ApiConfig) (Panel, error)

type Route added in v1.1.0

type Route struct {
	Id     int         `json:"id"`
	Match  interface{} `json:"match"`
	Action string      `json:"action"`
}

type TrojanUserInfo

type TrojanUserInfo struct {
	Password string `json:"password"`
}

type UserInfo

type UserInfo struct {
	Id         int    `json:"id"`
	Uuid       string `json:"uuid"`
	Email      string `json:"-"`
	SpeedLimit int    `json:"speed_limit"`
	Traffic    int64  `json:"-"`
}

type UserListBody

type UserListBody struct {
	//Msg  string `json:"msg"`
	Users []UserInfo `json:"users"`
}

type UserTraffic

type UserTraffic struct {
	UID      int
	Upload   int64
	Download int64
}

type V2RayUserInfo

type V2RayUserInfo struct {
	Uuid    string `json:"uuid"`
	Email   string `json:"email"`
	AlterId int    `json:"alter_id"`
}

Jump to

Keyboard shortcuts

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