panel

package
v0.0.1 Latest Latest
Warning

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

Go to latest
Published: Aug 27, 2022 License: MPL-2.0 Imports: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Client

type Client struct {
	APIHost  string
	NodeID   int
	Key      string
	NodeType string
	//EnableSS2022     bool
	EnableVless     bool
	EnableXTLS      bool
	SpeedLimit      float64
	DeviceLimit     int
	LocalRuleList   []DetectRule
	RemoteRuleCache *[]Rule

	NodeInfoRspMd5 [16]byte
	NodeRuleRspMd5 [16]byte
	// contains filtered or unexported fields
}

func (*Client) Debug

func (c *Client) Debug()

Debug set the client debug for client

func (*Client) Describe

func (c *Client) Describe() ClientInfo

Describe return a description of the client

func (*Client) GetNodeInfo

func (c *Client) GetNodeInfo() (nodeInfo *NodeInfo, err error)

GetNodeInfo will pull NodeInfo Config from sspanel

func (*Client) GetNodeRule

func (c *Client) GetNodeRule() ([]DetectRule, []string, error)

func (*Client) GetUserList

func (c *Client) GetUserList() (UserList []UserInfo, err error)

GetUserList will pull user form sspanel

func (*Client) ParseSSNodeResponse

func (c *Client) ParseSSNodeResponse() (*NodeInfo, error)

ParseSSNodeResponse parse the response for the given nodeinfor format

func (*Client) ParseTrojanNodeResponse

func (c *Client) ParseTrojanNodeResponse(body []byte) (*NodeInfo, error)

ParseTrojanNodeResponse parse the response for the given nodeinfor format

func (*Client) ParseV2rayNodeResponse

func (c *Client) ParseV2rayNodeResponse(body []byte, notParseNode, parseRule bool) (*NodeInfo, error)

ParseV2rayNodeResponse parse the response for the given nodeinfor format

func (*Client) ReportUserTraffic

func (c *Client) ReportUserTraffic(userTraffic []UserTraffic) error

ReportUserTraffic reports the user traffic

type ClientInfo

type ClientInfo struct {
	APIHost  string
	NodeID   int
	Key      string
	NodeType string
}

type DetectResult

type DetectResult struct {
	UID    int
	RuleID int
}

type DetectRule

type DetectRule struct {
	ID      int
	Pattern *regexp.Regexp
}

type NodeInfo

type NodeInfo struct {
	DeviceLimit int
	SpeedLimit  uint64
	NodeType    string
	NodeId      int
	TLSType     string
	EnableVless bool
	EnableTls   bool
	//EnableSS2022 bool
	V2ray  *V2rayConfig
	Trojan *TrojanConfig
	SS     *SSConfig
}

type OnlineUser

type OnlineUser struct {
	UID int
	IP  string
}

type Panel

type Panel interface {
	GetNodeInfo() (nodeInfo *NodeInfo, err error)
	GetUserList() (userList []UserInfo, err error)
	ReportUserTraffic(userTraffic []UserTraffic) (err error)
	Describe() ClientInfo
	GetNodeRule() (ruleList []DetectRule, protocolList []string, err error)
	Debug()
}

func New

func New(apiConfig *conf.ApiConfig) Panel

type Rule

type Rule struct {
	Type        string   `json:"type"`
	InboundTag  string   `json:"inboundTag,omitempty"`
	OutboundTag string   `json:"outboundTag"`
	Domain      []string `json:"domain,omitempty"`
	Protocol    []string `json:"protocol,omitempty"`
}

type SSConfig

type SSConfig struct {
	Port              int    `json:"port"`
	TransportProtocol string `json:"transportProtocol"`
	CypherMethod      string `json:"cypher"`
}

type TrojanConfig

type TrojanConfig struct {
	LocalPort         int           `json:"local_port"`
	Password          []interface{} `json:"password"`
	TransportProtocol string
	Ssl               struct {
		Sni string `json:"sni"`
	} `json:"ssl"`
}

type TrojanUserInfo

type TrojanUserInfo struct {
	Password string `json:"password"`
}

type UserInfo

type UserInfo struct {
	/*DeviceLimit int             `json:"device_limit"`
	SpeedLimit  uint64          `json:"speed_limit"`*/
	UID        int             `json:"id"`
	Port       int             `json:"port"`
	Cipher     string          `json:"cipher"`
	Secret     string          `json:"secret"`
	V2rayUser  *V2RayUserInfo  `json:"v2ray_user"`
	TrojanUser *TrojanUserInfo `json:"trojan_user"`
}

func (*UserInfo) GetUserEmail

func (p *UserInfo) GetUserEmail() string

type UserListBody

type UserListBody struct {
	//Msg  string `json:"msg"`
	Data []UserInfo `json:"data"`
}

type UserTraffic

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

type V2RayUserInfo

type V2RayUserInfo struct {
	Uuid    string `json:"uuid"`
	Email   string `json:"email"`
	AlterId int    `json:"alter_id"`
}

type V2rayConfig

type V2rayConfig struct {
	Inbounds []conf.InboundDetourConfig `json:"inbounds"`
	Routing  *struct {
		Rules json.RawMessage `json:"rules"`
	} `json:"routing"`
}

Jump to

Keyboard shortcuts

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