panel

package
v1.1.10 Latest Latest
Warning

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

Go to latest
Published: Jul 24, 2026 License: MPL-2.0 Imports: 19 Imported by: 0

Documentation

Index

Constants

View Source
const CertificateSHA256Header = "X-Node-Certificate-SHA256"

Variables

This section is empty.

Functions

func IsSupportedProtocol added in v1.1.9

func IsSupportedProtocol(protocol string) bool

IsSupportedProtocol reports whether this node binary can consume and run a server protocol. PPanel may return more protocol types than a node release supports; callers use this to leave unsupported configurations untouched.

Types

type AliveMap

type AliveMap struct {
	Alive map[int]int `json:"alive"`
}

type DNSItem

type DNSItem struct {
	Proto      string   `json:"proto"`
	Address    string   `json:"address"`
	ServerName string   `json:"server_name"`
	Domains    []string `json:"domains"`
}

type Data

type Data struct {
	TrafficReportThreshold int         `json:"traffic_report_threshold"`
	PushInterval           int         `json:"push_interval"`
	PullInterval           int         `json:"pull_interval"`
	IPStrategy             string      `json:"ip_strategy"`
	DNS                    *[]DNSItem  `json:"dns"`
	Block                  *[]string   `json:"block"`
	Outbound               *[]Outbound `json:"outbound"`
	Protocols              *[]Protocol `json:"protocols"`
	Total                  int         `json:"total"`
}

type NodeClient added in v1.1.4

type NodeClient struct {
	Client      *resty.Client
	APIHost     string
	SecretKey   string
	NodeType    string
	NodeId      int
	UseProtobuf bool

	UserList *UserListBody
	AliveMap *AliveMap
	// contains filtered or unexported fields
}

func NewNodeClient added in v1.1.4

func NewNodeClient(c *conf.NodeApiConfig) (*NodeClient, error)

func (*NodeClient) GetUserAlive added in v1.1.4

func (c *NodeClient) GetUserAlive() (map[int]int, error)

func (*NodeClient) GetUserList added in v1.1.4

func (c *NodeClient) GetUserList(ctx context.Context) ([]UserInfo, error)

func (*NodeClient) ReportNodeOnlineUsers added in v1.1.4

func (c *NodeClient) ReportNodeOnlineUsers(ctx context.Context, data *[]OnlineUser) error

func (*NodeClient) ReportNodeStatus added in v1.1.4

func (c *NodeClient) ReportNodeStatus(nodeStatus *NodeStatus) (err error)

func (*NodeClient) ReportUserTraffic added in v1.1.4

func (c *NodeClient) ReportUserTraffic(ctx context.Context, userTraffic *[]UserTraffic) error

func (*NodeClient) SetCertificateSHA256 added in v1.1.10

func (c *NodeClient) SetCertificateSHA256(fingerprint string)

SetCertificateSHA256 attaches the normalized certificate fingerprint to all subsequent requests made by this node client. The fingerprint is set only for self-signed nodes by the node controller.

type NodeInfo

type NodeInfo struct {
	Id                     int
	Type                   string
	PushInterval           int
	PullInterval           int
	TrafficReportThreshold int
	ACMEEmail              string
	ACMECADirURL           string
	Protocol               *Protocol
}

type NodeStatus

type NodeStatus struct {
	CPU    float64
	Mem    float64
	Disk   float64
	Uptime uint64
}

type OnlineUser

type OnlineUser struct {
	UID int
	IP  string
}

type Outbound

type Outbound struct {
	Name                 string   `json:"name"`
	Protocol             string   `json:"protocol"`
	Address              string   `json:"address"`
	Port                 int      `json:"port"`
	User                 string   `json:"user"`
	Password             string   `json:"password"`
	UUID                 string   `json:"uuid"`
	Cipher               string   `json:"cipher"`
	Security             string   `json:"security"`
	SNI                  string   `json:"sni"`
	AllowInsecure        bool     `json:"allow_insecure"`
	Fingerprint          string   `json:"fingerprint"`
	Transport            string   `json:"transport"`
	Host                 string   `json:"host"`
	Path                 string   `json:"path"`
	ServiceName          string   `json:"service_name"`
	Flow                 string   `json:"flow"`
	UoT                  bool     `json:"uot"`
	UoTVersion           int      `json:"uot_version"`
	CongestionController string   `json:"congestion_controller"`
	UDPStream            bool     `json:"udp_stream"`
	ReduceRTT            bool     `json:"reduce_rtt"`
	Heartbeat            int      `json:"heartbeat"`
	RealityPublicKey     string   `json:"reality_public_key"`
	RealityShortID       string   `json:"reality_short_id"`
	SpiderX              string   `json:"spider_x"`
	Settings             string   `json:"settings"`
	StreamSettings       string   `json:"stream_settings"`
	Rules                []string `json:"rules"`
}

type Protocol

type Protocol struct {
	Type                    string  `json:"type"`
	Port                    int     `json:"port"`
	Enable                  bool    `json:"enable"`
	Security                string  `json:"security"`
	SNI                     string  `json:"sni"`
	AllowInsecure           bool    `json:"allow_insecure"`
	Fingerprint             string  `json:"fingerprint"`
	RealityServerAddr       string  `json:"reality_server_addr"`
	RealityServerPort       int     `json:"reality_server_port"`
	RealityPrivateKey       string  `json:"reality_private_key"`
	RealityPublicKey        string  `json:"reality_public_key"`
	RealityShortID          string  `json:"reality_short_id"`
	Transport               string  `json:"transport"`
	Host                    string  `json:"host"`
	Path                    string  `json:"path"`
	ServiceName             string  `json:"service_name"`
	Cipher                  string  `json:"cipher"`
	ServerKey               string  `json:"server_key"`
	Flow                    string  `json:"flow"`
	UoT                     bool    `json:"uot"`
	UoTVersion              int     `json:"uot_version"`
	AcceptProxyProtocol     bool    `json:"accept_proxy_protocol"`
	HopPorts                string  `json:"hop_ports"`
	HopInterval             int     `json:"hop_interval"`
	ObfsPassword            string  `json:"obfs_password"`
	DisableSNI              bool    `json:"disable_sni"`
	ReduceRTT               bool    `json:"reduce_rtt"`
	UDPRelayMode            string  `json:"udp_relay_mode"`
	CongestionController    string  `json:"congestion_controller"`
	Multiplex               string  `json:"multiplex"`
	PaddingScheme           string  `json:"padding_scheme"`
	UpMbps                  int     `json:"up_mbps"`
	DownMbps                int     `json:"down_mbps"`
	Obfs                    string  `json:"obfs"`
	ObfsHost                string  `json:"obfs_host"`
	ObfsPath                string  `json:"obfs_path"`
	XHTTPMode               string  `json:"xhttp_mode"`
	XHTTPExtra              string  `json:"xhttp_extra"`
	Encryption              string  `json:"encryption"`
	EncryptionMode          string  `json:"encryption_mode"`
	EncryptionRTT           string  `json:"encryption_rtt"`
	EncryptionTicket        string  `json:"encryption_ticket"`
	EncryptionServerPadding string  `json:"encryption_server_padding"`
	EncryptionPrivateKey    string  `json:"encryption_private_key"`
	EncryptionClientPadding string  `json:"encryption_client_padding"`
	EncryptionPassword      string  `json:"encryption_password"`
	EchEnable               bool    `json:"ech_enable"`
	EchServerName           string  `json:"ech_server_name"`
	Ratio                   float64 `json:"ratio"`
	CertMode                string  `json:"cert_mode"`
	CertDNSProvider         string  `json:"cert_dns_provider"`
	CertDNSEnv              string  `json:"cert_dns_env"`
}

type ServerClient added in v1.1.4

type ServerClient struct {
	Client           *resty.Client
	APIHost          string
	SecretKey        string
	ServerId         int
	ServerConfigEtag string

	UseProtobuf bool
	// contains filtered or unexported fields
}

func NewServerClient added in v1.1.4

func NewServerClient(c *conf.ServerApiConfig) *ServerClient

type ServerConfigResponse

type ServerConfigResponse struct {
	Code        int    `json:"code"`
	Msg         string `json:"msg"`
	Data        *Data  `json:"data"`
	UseProtobuf bool   `json:"-"`
}

func GetServerConfig

func GetServerConfig(ctx context.Context, c *ServerClient) (*ServerConfigResponse, error)

type ServerPushStatusRequest

type ServerPushStatusRequest struct {
	Cpu       float64 `json:"cpu"`
	Mem       float64 `json:"mem"`
	Disk      float64 `json:"disk"`
	UpdatedAt int64   `json:"updated_at"`
}

type ServerPushUserTrafficRequest

type ServerPushUserTrafficRequest struct {
	Traffic []UserTraffic `json:"traffic"`
}

type UserInfo

type UserInfo struct {
	Id          int    `json:"id"`
	Uuid        string `json:"uuid"`
	SpeedLimit  int    `json:"speed_limit"`
	DeviceLimit int    `json:"device_limit"`
}

type UserListBody

type UserListBody struct {
	Users []UserInfo `json:"users"`
}

type UserOnlineBody

type UserOnlineBody struct {
	Users []OnlineUser `json:"users"`
}

type UserTraffic

type UserTraffic struct {
	UID      int   `json:"uid"`
	Upload   int64 `json:"upload"`
	Download int64 `json:"download"`
}

Jump to

Keyboard shortcuts

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