xmanager

package
v1.1.3 Latest Latest
Warning

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

Go to latest
Published: Jan 1, 2023 License: MIT 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
	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 xmanager

func (*APIClient) GetNodeRule

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

GetNodeRule will pull the audit rule form sspanel

func (*APIClient) GetTransitNodeInfo

func (c *APIClient) GetTransitNodeInfo() (transitnodeinfo *api.TransitNodeInfo, err error)

GetNodeInfo will pull GetTransitNodeInfo Config from xmanager

func (*APIClient) GetUserList

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

GetUserList will pull user form xmanager

func (*APIClient) ParseNodeResponse

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

func (*APIClient) ParseTransitNodeResponse

func (c *APIClient) ParseTransitNodeResponse(nodeInfoResponse *TransitNodeInfoResponse) (*api.TransitNodeInfo, error)

func (*APIClient) ParseUserListResponse

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

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 xmanager

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 {
	SpeedLimit       float64 `json:"speedlimit"`
	Method           string  `json:"method"`
	Port             uint32  `json:"port"`
	Address          string  `json:"server"`
	Type             string  `json:"type"`
	Security         string  `json:"security"`
	Host             string  `json:"host"`
	Path             string  `json:"path"`
	Headertype       string  `json:"header"`
	Protocol         string  `json:"protocol"`
	AllowInsecure    bool    `json:"allowinsecure"`
	RelayNodeID      int     `json:"relayid"`
	ListenIP         string  `json:"listenip"`
	ProxyProtocol    bool    `json:"proxyprotocol"`
	Sniffing         bool    `json:"sniffing"`
	ServiceName      string  `json:"servicename"`
	Fingerprint      string  `json:"tlsfingerprint"`
	RejectUnknownSNI bool    `json:"rejectunknownsni"`
	Quic_security    string  `json:"quic_security"`
	Quic_key         string  `json:"quic_key"`
}

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 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:"rule"`
}

type SystemLoad

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

SystemLoad is the data structure of systemload

type TransitNodeInfoResponse

type TransitNodeInfoResponse struct {
	SpeedLimit       float64 `json:"speedlimit"`
	Method           string  `json:"method"`
	Port             uint32  `json:"port"`
	Address          string  `json:"server"`
	Type             string  `json:"type"`
	Security         string  `json:"security"`
	Host             string  `json:"host"`
	Path             string  `json:"path"`
	Headertype       string  `json:"header"`
	Protocol         string  `json:"protocol"`
	AllowInsecure    bool    `json:"allowinsecure"`
	NodeID           int     `json:"relayid"`
	ListenIP         string  `json:"listenip"`
	ProxyProtocol    bool    `json:"proxyprotocol"`
	Sniffing         bool    `json:"sniffing"`
	ServiceName      string  `json:"servicename"`
	Flow             string  `json:"flow"`
	Fingerprint      string  `json:"tlsfingerprint"`
	RejectUnknownSNI bool    `json:"rejectunknownsni"`
	Quic_security    string  `json:"quic_security"`
	Quic_key         string  `json:"quic_key"`
}

type UserResponse

type UserResponse struct {
	ID          int     `json:"id"`
	Email       string  `json:"email"`
	Passwd      string  `json:"passwd"`
	SpeedLimit  float64 `json:"speedlimit"`
	DeviceLimit int     `json:"iplimit"`
	UUID        string  `json:"uuid"`
	IPcount     int     `json:"ip_count"`
	LimitType   int     `json:"limit_type"`
}

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