Some checks failed
Build docker and publish / build (20.15.1) (push) Failing after 6m27s
feat: 添加版本和构建时间变量 fix: 修正短信队列类型注释错误 style: 清理未使用的代码和测试文件 docs: 更新安装文档中的下载链接 chore: 迁移数据库脚本添加日志和订阅配置
149 lines
3.7 KiB
Plaintext
149 lines
3.7 KiB
Plaintext
syntax = "v1"
|
|
|
|
info (
|
|
title: "Node API"
|
|
desc: "API for ppanel"
|
|
author: "Tension"
|
|
email: "tension@ppanel.com"
|
|
version: "0.0.1"
|
|
)
|
|
|
|
import "../types.api"
|
|
|
|
type (
|
|
OnlineUser {
|
|
SID int64 `json:"uid"`
|
|
IP string `json:"ip"`
|
|
}
|
|
ShadowsocksProtocol {
|
|
Port int `json:"port"`
|
|
Method string `json:"method"`
|
|
}
|
|
VmessProtocol {
|
|
Host string `json:"host"`
|
|
Port int `json:"port"`
|
|
EnableTLS *bool `json:"enable_tls"`
|
|
TLSConfig string `json:"tls_config"`
|
|
Network string `json:"network"`
|
|
Transport string `json:"transport"`
|
|
}
|
|
VlessProtocol {
|
|
Host string `json:"host"`
|
|
Port int `json:"port"`
|
|
Network string `json:"network"`
|
|
Transport string `json:"transport"`
|
|
Security string `json:"security"`
|
|
SecurityConfig string `json:"security_config"`
|
|
XTLS string `json:"xtls"`
|
|
}
|
|
TrojanProtocol {
|
|
Host string `json:"host"`
|
|
Port int `json:"port"`
|
|
EnableTLS *bool `json:"enable_tls"`
|
|
TLSConfig string `json:"tls_config"`
|
|
Network string `json:"network"`
|
|
Transport string `json:"transport"`
|
|
}
|
|
GetServerConfigRequest {
|
|
ServerCommon
|
|
}
|
|
GetServerConfigResponse {
|
|
Basic ServerBasic `json:"basic"`
|
|
Protocol string `json:"protocol"`
|
|
Config interface{} `json:"config"`
|
|
}
|
|
ServerBasic {
|
|
PushInterval int64 `json:"push_interval"`
|
|
PullInterval int64 `json:"pull_interval"`
|
|
}
|
|
ServerCommon {
|
|
Protocol string `form:"protocol"`
|
|
ServerId int64 `form:"server_id"`
|
|
SecretKey string `form:"secret_key"`
|
|
}
|
|
ServerUser {
|
|
Id int64 `json:"id"`
|
|
UUID string `json:"uuid"`
|
|
SpeedLimit int64 `json:"speed_limit"`
|
|
DeviceLimit int64 `json:"device_limit"`
|
|
}
|
|
GetServerUserListRequest {
|
|
ServerCommon
|
|
}
|
|
GetServerUserListResponse {
|
|
Users []ServerUser `json:"users"`
|
|
}
|
|
UserTraffic {
|
|
SID int64 `json:"uid"`
|
|
Upload int64 `json:"upload"`
|
|
Download int64 `json:"download"`
|
|
}
|
|
ServerPushUserTrafficRequest {
|
|
ServerCommon
|
|
Traffic []UserTraffic `json:"traffic"`
|
|
}
|
|
ServerPushStatusRequest {
|
|
ServerCommon
|
|
Cpu float64 `json:"cpu"`
|
|
Mem float64 `json:"mem"`
|
|
Disk float64 `json:"disk"`
|
|
UpdatedAt int64 `json:"updated_at"`
|
|
}
|
|
OnlineUsersRequest {
|
|
ServerCommon
|
|
Users []OnlineUser `json:"users"`
|
|
}
|
|
QueryServerConfigRequest {
|
|
ServerID int64 `path:"server_id"`
|
|
SecretKey string `form:"secret_key"`
|
|
Protocols []string `form:"protocols,omitempty"`
|
|
}
|
|
QueryServerConfigResponse {
|
|
TrafficReportThreshold int64 `json:"traffic_report_threshold"`
|
|
IPStrategy string `json:"ip_strategy"`
|
|
DNS []NodeDNS `json:"dns"`
|
|
Block []string `json:"block"`
|
|
Outbound []NodeOutbound `json:"outbound"`
|
|
Protocols []Protocol `json:"protocols"`
|
|
Total int64 `json:"total"`
|
|
}
|
|
)
|
|
|
|
@server (
|
|
prefix: v1/server
|
|
group: server
|
|
middleware: ServerMiddleware
|
|
)
|
|
service ppanel {
|
|
@doc "Get user list"
|
|
@handler GetServerUserList
|
|
get /user (GetServerUserListRequest) returns (GetServerUserListResponse)
|
|
|
|
@doc "Push user Traffic"
|
|
@handler ServerPushUserTraffic
|
|
post /push (ServerPushUserTrafficRequest)
|
|
|
|
@doc "Push server status"
|
|
@handler ServerPushStatus
|
|
post /status (ServerPushStatusRequest)
|
|
|
|
@doc "Get server config"
|
|
@handler GetServerConfig
|
|
get /config (GetServerConfigRequest) returns (GetServerConfigResponse)
|
|
|
|
@doc "Push online users"
|
|
@handler PushOnlineUsers
|
|
post /online (OnlineUsersRequest)
|
|
}
|
|
|
|
@server (
|
|
prefix: v2/server
|
|
group: server
|
|
)
|
|
service ppanel {
|
|
@doc "Get Server Protocol Config"
|
|
@handler QueryServerProtocolConfig
|
|
get /:server_id (QueryServerConfigRequest) returns (QueryServerConfigResponse)
|
|
}
|
|
|