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) ParseSSPanelNodeInfo(nodeInfoResponse *NodeInfoResponse) (*api.NodeInfo, error)
- func (c *APIClient) ParseUserListResponse(userInfoResponse *[]UserResponse) (*[]api.UserInfo, error)
- func (c *APIClient) ReportIllegal(detectResultList *[]api.DetectResult) error
- func (c *APIClient) ReportNodeOnlineUsers(onlineUserList *[]api.OnlineUser) error
- func (c *APIClient) ReportUserTraffic(userTraffic *[]api.UserTraffic) error
- type CustomConfig
- type IllegalItem
- type NodeInfoResponse
- type OnlineUser
- type PostData
- type Response
- type RuleItem
- 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 SpeedLimit float64 DeviceLimit int LocalRuleList []api.DetectRule LastReportOnline map[int]int // contains filtered or unexported fields }
APIClient create an 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) ParseSSPanelNodeInfo ¶
func (c *APIClient) ParseSSPanelNodeInfo(nodeInfoResponse *NodeInfoResponse) (*api.NodeInfo, error)
ParseSSPanelNodeInfo 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) 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) 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"` Network string `json:"network"` Security string `json:"security"` Path string `json:"path"` VerifyCert bool `json:"verify_cert"` Header json.RawMessage `json:"header"` AllowInsecure string `json:"allow_insecure"` ServerKey string `json:"server_key"` ServiceName string `json:"servicename"` }
type IllegalItem ¶
type NodeInfoResponse ¶
type NodeInfoResponse struct { SpeedLimit float64 `json:"node_speedlimit"` Sort int `json:"sort"` RawServerString string `json:"server"` CustomConfig json.RawMessage `json:"custom_config"` Type string `json:"type"` 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 Response ¶
type Response struct { Ret uint `json:"ret"` Data json.RawMessage `json:"data"` Msg string `json:"msg"` }
Response is the common response
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"` UUID string `json:"uuid"` }
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