zeropanel

package
v0.0.0-...-a9ca781 Latest Latest
Warning

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

Go to latest
Published: Aug 23, 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 APIClient

type APIClient struct {
	APIHost             string
	NodeID              int
	Key                 string
	SpeedLimit          float64
	DeviceLimit         int
	DisableCustomConfig bool
	LocalRuleList       []api.DetectRule
	LastReportOnline    map[int]int
	// contains filtered or unexported fields
}

APIClient create a api client to the panel.

func New

func New(apiConfig *api.Config) *APIClient

New creat a api instance

func (*APIClient) Debug

func (c *APIClient) Debug()

Debug set the client debug for client

func (*APIClient) Describe

func (c *APIClient) Describe() api.ClientInfo

Describe return a description of the client

func (*APIClient) GetNodeInfo

func (c *APIClient) GetNodeInfo() (nodeInfo *api.NodeInfo, err error)

GetNodeInfo will pull NodeInfo Config from zeropanel

func (*APIClient) GetNodeRule

func (c *APIClient) GetNodeRule() (*[]api.DetectRule, error)

GetNodeRule will pull the audit rule form zeropanel

func (*APIClient) GetUserList

func (c *APIClient) GetUserList() (UserList *[]api.UserInfo, err error)

GetUserList will pull user form zeropanel

func (*APIClient) ParseUserListResponse

func (c *APIClient) ParseUserListResponse(userInfoResponse *[]UserResponse) (*[]api.UserInfo, error)

ParseUserListResponse parse the response for the given nodeinfo format

func (*APIClient) ParseZeroPanelNodeInfo

func (c *APIClient) ParseZeroPanelNodeInfo(nodeInfoResponse *NodeInfoResponse) (*api.NodeInfo, error)

ParsezeropanelNodeInfo parse the response for the given nodeinfor format

func (*APIClient) ReportIllegal

func (c *APIClient) ReportIllegal(detectResultList *[]api.DetectResult) error

ReportIllegal reports the user illegal behaviors

func (*APIClient) ReportNodeOnlineUsers

func (c *APIClient) ReportNodeOnlineUsers(onlineUserList *[]api.OnlineUser) error

ReportNodeOnlineUsers reports online user ip

func (*APIClient) ReportNodeStatus

func (c *APIClient) ReportNodeStatus(nodeStatus *api.NodeStatus) (err error)

ReportNodeStatus reports the node status to the zeropanel

func (*APIClient) ReportUserTraffic

func (c *APIClient) ReportUserTraffic(userTraffic *[]api.UserTraffic) error

ReportUserTraffic reports the user traffic

type CustomConfig

type CustomConfig struct {
	OffsetPortUser string          `json:"offset_port_user"`
	OffsetPortNode string          `json:"offset_port_node"`
	Host           string          `json:"host"`
	SSEncryption   string          `json:"ss_encryption"`
	ServerPsk      string          `json:"server_psk"`
	Network        string          `json:"network"`
	Security       string          `json:"security"`
	Path           string          `json:"path"`
	Obfs           string          `json:"obfs"`
	Header         json.RawMessage `json:"header"`
	ServiceName    string          `json:"service_name"`
	Flow           string          `json:"flow"`
	RealityConfig  json.RawMessage `json:"reality_config"`
}

type IllegalItem

type IllegalItem struct {
	ID  int `json:"list_id"`
	UID int `json:"user_id"`
}

type NodeInfoResponse

type NodeInfoResponse struct {
	Class        int             `json:"node_class"`
	SpeedLimit   float64         `json:"node_speedlimit"`
	TrafficRate  float64         `json:"traffic_rate"`
	NodeType     string          `json:"node_type"`
	CustomConfig json.RawMessage `json:"custom_config"`
}

NodeInfoResponse is the response of node

type OnlineUser

type OnlineUser struct {
	UID int    `json:"user_id"`
	IP  string `json:"ip"`
}

OnlineUser is the data structure of online user

type PostData

type PostData struct {
	Data interface{} `json:"data"`
}

PostData is the data structure of post data

type RealityConfig

type RealityConfig struct {
	Show             bool     `json:"show"`
	Dest             string   `json:"dest"`
	ProxyProtocolVer uint64   `json:"proxy_protocol_ver"`
	ServerNames      []string `json:"server_names"`
	PrivateKey       string   `json:"private_key"`
	MinClientVer     string   `json:"min_client_ver"`
	MaxClientVer     string   `json:"max_client_ver"`
	MaxTimeDiff      uint64   `json:"max_time_diff"`
	ShortIds         []string `json:"short_ids"`
}

type Response

type Response struct {
	Ret  uint            `json:"ret"`
	Data json.RawMessage `json:"data"`
}

Response is the common response

type RuleItem

type RuleItem struct {
	ID      int    `json:"id"`
	Content string `json:"regex"`
}

type SystemLoad

type SystemLoad struct {
	Uptime string `json:"uptime"`
	Load   string `json:"load"`
}

SystemLoad is the data structure of systemload

type UserResponse

type UserResponse struct {
	ID          int     `json:"id"`
	Email       string  `json:"email"`
	Passwd      string  `json:"passwd"`
	Port        uint32  `json:"port"`
	SpeedLimit  float64 `json:"node_speedlimit"`
	DeviceLimit int     `json:"node_iplimit"`
	UUID        string  `json:"uuid"`
	AliveIP     int     `json:"alive_ip"`
}

UserResponse is the response of user

type UserTraffic

type UserTraffic struct {
	UID      int   `json:"user_id"`
	Upload   int64 `json:"u"`
	Download int64 `json:"d"`
}

UserTraffic is the data structure of traffic

Jump to

Keyboard shortcuts

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