Documentation
¶
Index ¶
- type APIClient
- func (c *APIClient) Debug()
- func (c *APIClient) Describe() api.ClientInfo
- func (c *APIClient) GetNodeInfo() (nodeInfo *api.NodeInfo, err error)
- func (c *APIClient) GetNodeRule() (*[]api.DetectRule, error)
- func (c *APIClient) GetUserList() (UserList *[]api.UserInfo, err error)
- func (c *APIClient) ParseSSNodeResponse(nodeInfoResponse *NodeInfoResponse) (*api.NodeInfo, error)
- func (c *APIClient) ParseSSPanelNodeInfo(nodeInfoResponse *NodeInfoResponse) (*api.NodeInfo, error)
- func (c *APIClient) ParseSSPluginNodeResponse(nodeInfoResponse *NodeInfoResponse) (*api.NodeInfo, error)
- func (c *APIClient) ParseTrojanNodeResponse(nodeInfoResponse *NodeInfoResponse) (*api.NodeInfo, error)
- func (c *APIClient) ParseUserListResponse(userInfoResponse *[]UserResponse) (*[]api.UserInfo, error)
- func (c *APIClient) ParseV2rayNodeResponse(nodeInfoResponse *NodeInfoResponse) (*api.NodeInfo, error)
- func (c *APIClient) ReportIllegal(detectResultList *[]api.DetectResult) error
- func (c *APIClient) ReportNodeOnlineUsers(onlineUserList *[]api.OnlineUser) error
- func (c *APIClient) ReportNodeStatus(nodeStatus *api.NodeStatus) (err error)
- func (c *APIClient) ReportUserTraffic(userTraffic *[]api.UserTraffic) error
- type CustomConfig
- type IllegalItem
- type NodeInfoResponse
- type OnlineUser
- type PostData
- type REALITYConfig
- type Response
- type RuleItem
- type SystemLoad
- type UserResponse
- type UserTraffic
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
VlessFlow 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 (*APIClient) Describe ¶
func (c *APIClient) Describe() api.ClientInfo
Describe return a description of the client
func (*APIClient) GetNodeInfo ¶
GetNodeInfo will pull NodeInfo Config from ssPanel
func (*APIClient) GetNodeRule ¶
func (c *APIClient) GetNodeRule() (*[]api.DetectRule, error)
GetNodeRule will pull the audit rule form ssPanel
func (*APIClient) GetUserList ¶
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 node info format
func (*APIClient) ParseSSPanelNodeInfo ¶
func (c *APIClient) ParseSSPanelNodeInfo(nodeInfoResponse *NodeInfoResponse) (*api.NodeInfo, error)
ParseSSPanelNodeInfo parse the response for the given node info format Only available for SSPanel version >= 2021.11
func (*APIClient) ParseSSPluginNodeResponse ¶
func (c *APIClient) ParseSSPluginNodeResponse(nodeInfoResponse *NodeInfoResponse) (*api.NodeInfo, error)
ParseSSPluginNodeResponse parse the response for the given node info format
func (*APIClient) ParseTrojanNodeResponse ¶
func (c *APIClient) ParseTrojanNodeResponse(nodeInfoResponse *NodeInfoResponse) (*api.NodeInfo, error)
ParseTrojanNodeResponse parse the response for the given node info format
func (*APIClient) ParseUserListResponse ¶
func (c *APIClient) ParseUserListResponse(userInfoResponse *[]UserResponse) (*[]api.UserInfo, error)
ParseUserListResponse parse the response for the given node info format
func (*APIClient) ParseV2rayNodeResponse ¶
func (c *APIClient) ParseV2rayNodeResponse(nodeInfoResponse *NodeInfoResponse) (*api.NodeInfo, error)
ParseV2rayNodeResponse parse the response for the given node info 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 CustomConfig ¶
type CustomConfig struct {
OffsetPortNode string `json:"offset_port_node"`
Host string `json:"host"`
Method string `json:"method"`
TLS string `json:"tls"`
EnableVless string `json:"enable_vless"`
Network string `json:"network"`
Security string `json:"security"`
Path string `json:"path"`
VerifyCert bool `json:"verify_cert"`
Obfs string `json:"obfs"`
Header json.RawMessage `json:"header"`
AllowInsecure string `json:"allow_insecure"`
Servicename string `json:"servicename"`
EnableXtls string `json:"enable_xtls"`
Flow string `json:"flow"`
EnableREALITY bool `json:"enable_reality"`
RealityOpts *REALITYConfig `json:"reality-opts"`
}
type IllegalItem ¶
type NodeInfoResponse ¶
type NodeInfoResponse struct {
Group int `json:"node_group"`
Class int `json:"node_class"`
SpeedLimit float64 `json:"node_speedlimit"`
TrafficRate float64 `json:"traffic_rate"`
Sort int `json:"sort"`
RawServerString string `json:"server"`
Type string `json:"type"`
CustomConfig json.RawMessage `json:"custom_config"`
Version string `json:"version"`
}
NodeInfoResponse is the response of node
type OnlineUser ¶
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 {
Dest string `json:"dest,omitempty"`
ProxyProtocolVer uint64 `json:"proxy_protocol_ver,omitempty"`
ServerNames []string `json:"server_names,omitempty"`
PrivateKey string `json:"private_key,omitempty"`
MinClientVer string `json:"min_client_ver,omitempty"`
MaxClientVer string `json:"max_client_ver,omitempty"`
MaxTimeDiff uint64 `json:"max_time_diff,omitempty"`
ShortIds []string `json:"short_ids,omitempty"`
}
type Response ¶
type Response struct {
Ret uint `json:"ret"`
Data json.RawMessage `json:"data"`
}
Response is the common response
type SystemLoad ¶
SystemLoad is the data structure of system load
type UserResponse ¶
type UserResponse struct {
ID int `json:"id"`
Passwd string `json:"passwd"`
Port uint32 `json:"port"`
Method string `json:"method"`
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