pmpanel

package
v0.0.0-...-eb1eb22 Latest Latest
Warning

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

Go to latest
Published: May 6, 2022 License: MPL-2.0 Imports: 11 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
	NodeType      string
	EnableVless   bool
	EnableXTLS    bool
	SpeedLimit    float64
	DeviceLimit   int
	LocalRuleList []api.DetectRule
	// 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 sspanel

func (*APIClient) GetNodeRule

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

GetNodeRule will pull the audit rule form pmpanel

func (*APIClient) GetUserList

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

GetUserList will pull user form sspanel

func (*APIClient) ParseSSNodeResponse

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

ParseSSNodeResponse parse the response for the given nodeinfor format

func (*APIClient) ParseTrojanNodeResponse

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

ParseTrojanNodeResponse parse the response for the given nodeinfor format

func (*APIClient) ParseUserListResponse

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

ParseUserListResponse parse the response for the given nodeinfo format

func (*APIClient) ParseV2rayNodeResponse

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

ParseV2rayNodeResponse 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 sspanel

func (*APIClient) ReportUserTraffic

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

ReportUserTraffic reports the user traffic

type IllegalItem

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

type NodeInfoResponse

type NodeInfoResponse struct {
	Class           int     `json:"clazz"`
	SpeedLimit      float64 `json:"speedlimit"`
	Method          string  `json:"method"`
	TrafficRate     float64 `json:"trafficRate"`
	RawServerString string  `json:"outServer"`
	Port            int     `json:"outPort"`
	AlterId         int     `json:"alterId"`
	Network         string  `json:"network"`
	Security        string  `json:"security"`
	Host            string  `json:"host"`
	Path            string  `json:"path"`
	Grpc            bool    `json:"grpc"`
	Sni             string  `json:sni`
}

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 {
	Type    string      `json:"type"`
	NodeId  int         `json:"nodeId"`
	Users   interface{} `json:"users"`
	Onlines interface{} `json:"onlines"`
}

PostData is the data structure of post data

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"`
	Passwd      string  `json:"passwd"`
	SpeedLimit  float64 `json:"nodeSpeedlimit"`
	DeviceLimit int     `json:"nodeConnector"`
}

UserResponse is the response of user

type UserTraffic

type UserTraffic struct {
	UID      int    `json:"id"`
	Upload   int64  `json:"up"`
	Download int64  `json:"down"`
	Ip       string `json:"ip"`
}

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