init: 1.0.0
This commit is contained in:
@@ -0,0 +1,121 @@
|
||||
syntax = "v1"
|
||||
|
||||
info (
|
||||
title: "Node API"
|
||||
desc: "API for ppanel"
|
||||
author: "Tension"
|
||||
email: "tension@ppanel.com"
|
||||
version: "0.0.1"
|
||||
)
|
||||
|
||||
import "../types.api"
|
||||
|
||||
type (
|
||||
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"`
|
||||
}
|
||||
)
|
||||
|
||||
@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)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user