Files

873 lines
39 KiB
YAML

openapi: 3.0.3
info:
title: Manager API
version: 1.0.0
servers:
- url: /manager/v1
security:
- BearerAuth: []
tags:
- name: Squads
- name: Nodes
- name: Users
- name: BandwidthLimiters
- name: TrafficLimiters
- name: ConnectionLimiters
- name: RateLimiters
- name: Info
paths:
/version:
get:
tags: [Info]
summary: Server version
responses:
"200":
content:
application/json:
schema:
type: object
required: [version]
properties:
version: {type: string, example: "1.13.11-abc1234"}
/squads:
get:
tags: [Squads]
summary: List squads
parameters:
- {in: query, name: id, schema: {type: integer, format: int32}}
- {$ref: "#/components/parameters/FilterIDIn"}
- {in: query, name: name, schema: {type: string}}
- {$ref: "#/components/parameters/FilterCreatedAtStart"}
- {$ref: "#/components/parameters/FilterCreatedAtEnd"}
- {$ref: "#/components/parameters/FilterUpdatedAtStart"}
- {$ref: "#/components/parameters/FilterUpdatedAtEnd"}
- {$ref: "#/components/parameters/FilterSortAsc"}
- {$ref: "#/components/parameters/FilterSortDesc"}
- {$ref: "#/components/parameters/FilterOffset"}
- {$ref: "#/components/parameters/FilterLimit"}
responses:
"200": {content: {application/json: {schema: {type: array, items: {$ref: "#/components/schemas/Squad"}}}}}
"500": {$ref: "#/components/responses/InternalError"}
post:
tags: [Squads]
summary: Create squad
requestBody: {required: true, content: {application/json: {schema: {$ref: "#/components/schemas/SquadCreate"}}}}
responses:
"201": {content: {application/json: {schema: {$ref: "#/components/schemas/Squad"}}}}
"400": {$ref: "#/components/responses/BadRequest"}
/squads/count:
get:
tags: [Squads]
summary: Count squads
parameters:
- {in: query, name: id, schema: {type: integer, format: int32}}
- {$ref: "#/components/parameters/FilterIDIn"}
- {in: query, name: name, schema: {type: string}}
- {$ref: "#/components/parameters/FilterCreatedAtStart"}
- {$ref: "#/components/parameters/FilterCreatedAtEnd"}
- {$ref: "#/components/parameters/FilterUpdatedAtStart"}
- {$ref: "#/components/parameters/FilterUpdatedAtEnd"}
- {$ref: "#/components/parameters/FilterSortAsc"}
- {$ref: "#/components/parameters/FilterSortDesc"}
- {$ref: "#/components/parameters/FilterOffset"}
- {$ref: "#/components/parameters/FilterLimit"}
responses:
"200": {$ref: "#/components/responses/Count"}
"500": {$ref: "#/components/responses/InternalError"}
/squads/{id}:
parameters: [{$ref: "#/components/parameters/IntID"}]
get:
tags: [Squads]
summary: Get squad
responses:
"200": {content: {application/json: {schema: {$ref: "#/components/schemas/Squad"}}}}
"400": {$ref: "#/components/responses/BadRequest"}
"404": {$ref: "#/components/responses/NotFound"}
"500": {$ref: "#/components/responses/InternalError"}
put:
tags: [Squads]
summary: Update squad
requestBody: {required: true, content: {application/json: {schema: {$ref: "#/components/schemas/SquadUpdate"}}}}
responses:
"200": {content: {application/json: {schema: {$ref: "#/components/schemas/Squad"}}}}
"400": {$ref: "#/components/responses/BadRequest"}
"404": {$ref: "#/components/responses/NotFound"}
delete:
tags: [Squads]
summary: Delete squad
responses:
"200": {content: {application/json: {schema: {$ref: "#/components/schemas/Squad"}}}}
"404": {$ref: "#/components/responses/NotFound"}
"500": {$ref: "#/components/responses/InternalError"}
/nodes:
get:
tags: [Nodes]
summary: List nodes
parameters:
- {in: query, name: uuid, schema: {type: string, format: uuid}}
- {in: query, name: name, schema: {type: string}}
- {$ref: "#/components/parameters/FilterSquadIdIn"}
- {$ref: "#/components/parameters/FilterCreatedAtStart"}
- {$ref: "#/components/parameters/FilterCreatedAtEnd"}
- {$ref: "#/components/parameters/FilterUpdatedAtStart"}
- {$ref: "#/components/parameters/FilterUpdatedAtEnd"}
- {$ref: "#/components/parameters/FilterSortAsc"}
- {$ref: "#/components/parameters/FilterSortDesc"}
- {$ref: "#/components/parameters/FilterOffset"}
- {$ref: "#/components/parameters/FilterLimit"}
responses:
"200": {content: {application/json: {schema: {type: array, items: {$ref: "#/components/schemas/Node"}}}}}
"500": {$ref: "#/components/responses/InternalError"}
post:
tags: [Nodes]
summary: Create node
requestBody: {required: true, content: {application/json: {schema: {$ref: "#/components/schemas/NodeCreate"}}}}
responses:
"201": {content: {application/json: {schema: {$ref: "#/components/schemas/Node"}}}}
"400": {$ref: "#/components/responses/BadRequest"}
/nodes/count:
get:
tags: [Nodes]
summary: Count nodes
parameters:
- {in: query, name: uuid, schema: {type: string, format: uuid}}
- {in: query, name: name, schema: {type: string}}
- {$ref: "#/components/parameters/FilterSquadIdIn"}
- {$ref: "#/components/parameters/FilterCreatedAtStart"}
- {$ref: "#/components/parameters/FilterCreatedAtEnd"}
- {$ref: "#/components/parameters/FilterUpdatedAtStart"}
- {$ref: "#/components/parameters/FilterUpdatedAtEnd"}
- {$ref: "#/components/parameters/FilterSortAsc"}
- {$ref: "#/components/parameters/FilterSortDesc"}
- {$ref: "#/components/parameters/FilterOffset"}
- {$ref: "#/components/parameters/FilterLimit"}
responses:
"200": {$ref: "#/components/responses/Count"}
"500": {$ref: "#/components/responses/InternalError"}
/nodes/{uuid}:
parameters: [{$ref: "#/components/parameters/NodeUUID"}]
get:
tags: [Nodes]
summary: Get node
responses:
"200": {content: {application/json: {schema: {$ref: "#/components/schemas/Node"}}}}
"404": {$ref: "#/components/responses/NotFound"}
"500": {$ref: "#/components/responses/InternalError"}
put:
tags: [Nodes]
summary: Update node
requestBody: {required: true, content: {application/json: {schema: {$ref: "#/components/schemas/NodeUpdate"}}}}
responses:
"200": {content: {application/json: {schema: {$ref: "#/components/schemas/Node"}}}}
"400": {$ref: "#/components/responses/BadRequest"}
"404": {$ref: "#/components/responses/NotFound"}
delete:
tags: [Nodes]
summary: Delete node
responses:
"200": {content: {application/json: {schema: {$ref: "#/components/schemas/Node"}}}}
"404": {$ref: "#/components/responses/NotFound"}
"500": {$ref: "#/components/responses/InternalError"}
/nodes/{uuid}/status:
parameters: [{$ref: "#/components/parameters/NodeUUID"}]
get:
tags: [Nodes]
summary: Get node status
responses:
"200":
content:
application/json:
schema:
type: object
required: [status]
properties:
status:
type: string
enum: [online, offline]
/users:
get:
tags: [Users]
summary: List users
parameters:
- {in: query, name: id, schema: {type: integer, format: int32}}
- {in: query, name: username, schema: {type: string}}
- {in: query, name: inbound, schema: {type: string}}
- {in: query, name: type, schema: {type: string, enum: [hysteria, hysteria2, mtproxy, trojan, tuic, vless, vmess]}}
- {$ref: "#/components/parameters/FilterSquadIdIn"}
- {$ref: "#/components/parameters/FilterCreatedAtStart"}
- {$ref: "#/components/parameters/FilterCreatedAtEnd"}
- {$ref: "#/components/parameters/FilterUpdatedAtStart"}
- {$ref: "#/components/parameters/FilterUpdatedAtEnd"}
- {$ref: "#/components/parameters/FilterSortAsc"}
- {$ref: "#/components/parameters/FilterSortDesc"}
- {$ref: "#/components/parameters/FilterOffset"}
- {$ref: "#/components/parameters/FilterLimit"}
responses:
"200": {content: {application/json: {schema: {type: array, items: {$ref: "#/components/schemas/User"}}}}}
"500": {$ref: "#/components/responses/InternalError"}
post:
tags: [Users]
summary: Create user
requestBody: {required: true, content: {application/json: {schema: {$ref: "#/components/schemas/UserCreate"}}}}
responses:
"201": {content: {application/json: {schema: {$ref: "#/components/schemas/User"}}}}
"400": {$ref: "#/components/responses/BadRequest"}
/users/count:
get:
tags: [Users]
summary: Count users
parameters:
- {in: query, name: id, schema: {type: integer, format: int32}}
- {in: query, name: username, schema: {type: string}}
- {in: query, name: inbound, schema: {type: string}}
- {in: query, name: type, schema: {type: string, enum: [hysteria, hysteria2, mtproxy, trojan, tuic, vless, vmess]}}
- {$ref: "#/components/parameters/FilterSquadIdIn"}
- {$ref: "#/components/parameters/FilterCreatedAtStart"}
- {$ref: "#/components/parameters/FilterCreatedAtEnd"}
- {$ref: "#/components/parameters/FilterUpdatedAtStart"}
- {$ref: "#/components/parameters/FilterUpdatedAtEnd"}
- {$ref: "#/components/parameters/FilterSortAsc"}
- {$ref: "#/components/parameters/FilterSortDesc"}
- {$ref: "#/components/parameters/FilterOffset"}
- {$ref: "#/components/parameters/FilterLimit"}
responses:
"200": {$ref: "#/components/responses/Count"}
"500": {$ref: "#/components/responses/InternalError"}
/users/{id}:
parameters: [{$ref: "#/components/parameters/IntID"}]
get:
tags: [Users]
summary: Get user
responses:
"200": {content: {application/json: {schema: {$ref: "#/components/schemas/User"}}}}
"404": {$ref: "#/components/responses/NotFound"}
"500": {$ref: "#/components/responses/InternalError"}
put:
tags: [Users]
summary: Update user
requestBody: {required: true, content: {application/json: {schema: {$ref: "#/components/schemas/UserUpdate"}}}}
responses:
"200": {content: {application/json: {schema: {$ref: "#/components/schemas/User"}}}}
"400": {$ref: "#/components/responses/BadRequest"}
"404": {$ref: "#/components/responses/NotFound"}
delete:
tags: [Users]
summary: Delete user
responses:
"200": {content: {application/json: {schema: {$ref: "#/components/schemas/User"}}}}
"404": {$ref: "#/components/responses/NotFound"}
"500": {$ref: "#/components/responses/InternalError"}
/bandwidth-limiters:
get:
tags: [BandwidthLimiters]
summary: List bandwidth limiters
parameters:
- {in: query, name: id, schema: {type: integer, format: int32}}
- {in: query, name: strategy, schema: {type: string, enum: [global, connection]}}
- {in: query, name: mode, schema: {type: string, enum: [upload, download, bidirectional]}}
- {in: query, name: type, schema: {type: string}}
- {in: query, name: username, schema: {type: string}}
- {in: query, name: down_start, schema: {type: string}}
- {in: query, name: down_end, schema: {type: string}}
- {in: query, name: up_start, schema: {type: string}}
- {in: query, name: up_end, schema: {type: string}}
- {$ref: "#/components/parameters/FilterSquadIdIn"}
- {$ref: "#/components/parameters/FilterCreatedAtStart"}
- {$ref: "#/components/parameters/FilterCreatedAtEnd"}
- {$ref: "#/components/parameters/FilterUpdatedAtStart"}
- {$ref: "#/components/parameters/FilterUpdatedAtEnd"}
- {$ref: "#/components/parameters/FilterSortAsc"}
- {$ref: "#/components/parameters/FilterSortDesc"}
- {$ref: "#/components/parameters/FilterOffset"}
- {$ref: "#/components/parameters/FilterLimit"}
responses:
"200": {content: {application/json: {schema: {type: array, items: {$ref: "#/components/schemas/BandwidthLimiter"}}}}}
"500": {$ref: "#/components/responses/InternalError"}
post:
tags: [BandwidthLimiters]
summary: Create bandwidth limiter
requestBody: {required: true, content: {application/json: {schema: {$ref: "#/components/schemas/BandwidthLimiterCreate"}}}}
responses:
"201": {content: {application/json: {schema: {$ref: "#/components/schemas/BandwidthLimiter"}}}}
"400": {$ref: "#/components/responses/BadRequest"}
/bandwidth-limiters/count:
get:
tags: [BandwidthLimiters]
summary: Count bandwidth limiters
parameters:
- {in: query, name: id, schema: {type: integer, format: int32}}
- {in: query, name: strategy, schema: {type: string, enum: [global, connection]}}
- {in: query, name: mode, schema: {type: string, enum: [upload, download, bidirectional]}}
- {in: query, name: type, schema: {type: string}}
- {in: query, name: username, schema: {type: string}}
- {in: query, name: down_start, schema: {type: string}}
- {in: query, name: down_end, schema: {type: string}}
- {in: query, name: up_start, schema: {type: string}}
- {in: query, name: up_end, schema: {type: string}}
- {$ref: "#/components/parameters/FilterSquadIdIn"}
- {$ref: "#/components/parameters/FilterCreatedAtStart"}
- {$ref: "#/components/parameters/FilterCreatedAtEnd"}
- {$ref: "#/components/parameters/FilterUpdatedAtStart"}
- {$ref: "#/components/parameters/FilterUpdatedAtEnd"}
- {$ref: "#/components/parameters/FilterSortAsc"}
- {$ref: "#/components/parameters/FilterSortDesc"}
- {$ref: "#/components/parameters/FilterOffset"}
- {$ref: "#/components/parameters/FilterLimit"}
responses:
"200": {$ref: "#/components/responses/Count"}
"500": {$ref: "#/components/responses/InternalError"}
/bandwidth-limiters/{id}:
parameters: [{$ref: "#/components/parameters/IntID"}]
get:
tags: [BandwidthLimiters]
summary: Get bandwidth limiter
responses:
"200": {content: {application/json: {schema: {$ref: "#/components/schemas/BandwidthLimiter"}}}}
"404": {$ref: "#/components/responses/NotFound"}
"500": {$ref: "#/components/responses/InternalError"}
put:
tags: [BandwidthLimiters]
summary: Update bandwidth limiter
requestBody: {required: true, content: {application/json: {schema: {$ref: "#/components/schemas/BandwidthLimiterUpdate"}}}}
responses:
"200": {content: {application/json: {schema: {$ref: "#/components/schemas/BandwidthLimiter"}}}}
"400": {$ref: "#/components/responses/BadRequest"}
"404": {$ref: "#/components/responses/NotFound"}
delete:
tags: [BandwidthLimiters]
summary: Delete bandwidth limiter
responses:
"200": {content: {application/json: {schema: {$ref: "#/components/schemas/BandwidthLimiter"}}}}
"404": {$ref: "#/components/responses/NotFound"}
/traffic-limiters:
get:
tags: [TrafficLimiters]
summary: List traffic limiters
parameters:
- {in: query, name: id, schema: {type: integer, format: int32}}
- {in: query, name: username, schema: {type: string}}
- {in: query, name: outbound, schema: {type: string}}
- {in: query, name: mode, schema: {type: string, enum: [upload, download, bidirectional]}}
- {in: query, name: used_start, schema: {type: string}}
- {in: query, name: used_end, schema: {type: string}}
- {in: query, name: quota_start, schema: {type: string}}
- {in: query, name: quota_end, schema: {type: string}}
- {$ref: "#/components/parameters/FilterSquadIdIn"}
- {$ref: "#/components/parameters/FilterCreatedAtStart"}
- {$ref: "#/components/parameters/FilterCreatedAtEnd"}
- {$ref: "#/components/parameters/FilterUpdatedAtStart"}
- {$ref: "#/components/parameters/FilterUpdatedAtEnd"}
- {$ref: "#/components/parameters/FilterSortAsc"}
- {$ref: "#/components/parameters/FilterSortDesc"}
- {$ref: "#/components/parameters/FilterOffset"}
- {$ref: "#/components/parameters/FilterLimit"}
responses:
"200": {content: {application/json: {schema: {type: array, items: {$ref: "#/components/schemas/TrafficLimiter"}}}}}
"500": {$ref: "#/components/responses/InternalError"}
post:
tags: [TrafficLimiters]
summary: Create traffic limiter
requestBody: {required: true, content: {application/json: {schema: {$ref: "#/components/schemas/TrafficLimiterCreate"}}}}
responses:
"201": {content: {application/json: {schema: {$ref: "#/components/schemas/TrafficLimiter"}}}}
"400": {$ref: "#/components/responses/BadRequest"}
/traffic-limiters/count:
get:
tags: [TrafficLimiters]
summary: Count traffic limiters
parameters:
- {in: query, name: id, schema: {type: integer, format: int32}}
- {in: query, name: username, schema: {type: string}}
- {in: query, name: outbound, schema: {type: string}}
- {in: query, name: mode, schema: {type: string, enum: [upload, download, bidirectional]}}
- {in: query, name: used_start, schema: {type: string}}
- {in: query, name: used_end, schema: {type: string}}
- {in: query, name: quota_start, schema: {type: string}}
- {in: query, name: quota_end, schema: {type: string}}
- {$ref: "#/components/parameters/FilterSquadIdIn"}
- {$ref: "#/components/parameters/FilterCreatedAtStart"}
- {$ref: "#/components/parameters/FilterCreatedAtEnd"}
- {$ref: "#/components/parameters/FilterUpdatedAtStart"}
- {$ref: "#/components/parameters/FilterUpdatedAtEnd"}
- {$ref: "#/components/parameters/FilterSortAsc"}
- {$ref: "#/components/parameters/FilterSortDesc"}
- {$ref: "#/components/parameters/FilterOffset"}
- {$ref: "#/components/parameters/FilterLimit"}
responses:
"200": {$ref: "#/components/responses/Count"}
"500": {$ref: "#/components/responses/InternalError"}
/traffic-limiters/{id}:
parameters: [{$ref: "#/components/parameters/IntID"}]
get:
tags: [TrafficLimiters]
summary: Get traffic limiter
responses:
"200": {content: {application/json: {schema: {$ref: "#/components/schemas/TrafficLimiter"}}}}
"404": {$ref: "#/components/responses/NotFound"}
"500": {$ref: "#/components/responses/InternalError"}
put:
tags: [TrafficLimiters]
summary: Update traffic limiter
requestBody: {required: true, content: {application/json: {schema: {$ref: "#/components/schemas/TrafficLimiterUpdate"}}}}
responses:
"200": {content: {application/json: {schema: {$ref: "#/components/schemas/TrafficLimiter"}}}}
"400": {$ref: "#/components/responses/BadRequest"}
"404": {$ref: "#/components/responses/NotFound"}
delete:
tags: [TrafficLimiters]
summary: Delete traffic limiter
responses:
"200": {content: {application/json: {schema: {$ref: "#/components/schemas/TrafficLimiter"}}}}
"404": {$ref: "#/components/responses/NotFound"}
/connection-limiters:
get:
tags: [ConnectionLimiters]
summary: List connection limiters
parameters:
- {in: query, name: id, schema: {type: integer, format: int32}}
- {in: query, name: strategy, schema: {type: string, enum: [connection]}}
- {in: query, name: username, schema: {type: string}}
- {in: query, name: outbound, schema: {type: string}}
- {in: query, name: connection_type, schema: {type: string, enum: [default, hwid, mux, ip]}}
- {in: query, name: lock_type, schema: {type: string, enum: [manager, default]}}
- {$ref: "#/components/parameters/FilterSquadIdIn"}
- {$ref: "#/components/parameters/FilterCreatedAtStart"}
- {$ref: "#/components/parameters/FilterCreatedAtEnd"}
- {$ref: "#/components/parameters/FilterUpdatedAtStart"}
- {$ref: "#/components/parameters/FilterUpdatedAtEnd"}
- {$ref: "#/components/parameters/FilterSortAsc"}
- {$ref: "#/components/parameters/FilterSortDesc"}
- {$ref: "#/components/parameters/FilterOffset"}
- {$ref: "#/components/parameters/FilterLimit"}
responses:
"200": {content: {application/json: {schema: {type: array, items: {$ref: "#/components/schemas/ConnectionLimiter"}}}}}
"500": {$ref: "#/components/responses/InternalError"}
post:
tags: [ConnectionLimiters]
summary: Create connection limiter
requestBody: {required: true, content: {application/json: {schema: {$ref: "#/components/schemas/ConnectionLimiterCreate"}}}}
responses:
"201": {content: {application/json: {schema: {$ref: "#/components/schemas/ConnectionLimiter"}}}}
"400": {$ref: "#/components/responses/BadRequest"}
/connection-limiters/count:
get:
tags: [ConnectionLimiters]
summary: Count connection limiters
parameters:
- {in: query, name: id, schema: {type: integer, format: int32}}
- {in: query, name: strategy, schema: {type: string, enum: [connection]}}
- {in: query, name: username, schema: {type: string}}
- {in: query, name: outbound, schema: {type: string}}
- {in: query, name: connection_type, schema: {type: string, enum: [default, hwid, mux, ip]}}
- {in: query, name: lock_type, schema: {type: string, enum: [manager, default]}}
- {$ref: "#/components/parameters/FilterSquadIdIn"}
- {$ref: "#/components/parameters/FilterCreatedAtStart"}
- {$ref: "#/components/parameters/FilterCreatedAtEnd"}
- {$ref: "#/components/parameters/FilterUpdatedAtStart"}
- {$ref: "#/components/parameters/FilterUpdatedAtEnd"}
- {$ref: "#/components/parameters/FilterSortAsc"}
- {$ref: "#/components/parameters/FilterSortDesc"}
- {$ref: "#/components/parameters/FilterOffset"}
- {$ref: "#/components/parameters/FilterLimit"}
responses:
"200": {$ref: "#/components/responses/Count"}
"500": {$ref: "#/components/responses/InternalError"}
/connection-limiters/{id}:
parameters: [{$ref: "#/components/parameters/IntID"}]
get:
tags: [ConnectionLimiters]
summary: Get connection limiter
responses:
"200": {content: {application/json: {schema: {$ref: "#/components/schemas/ConnectionLimiter"}}}}
"404": {$ref: "#/components/responses/NotFound"}
"500": {$ref: "#/components/responses/InternalError"}
put:
tags: [ConnectionLimiters]
summary: Update connection limiter
requestBody: {required: true, content: {application/json: {schema: {$ref: "#/components/schemas/ConnectionLimiterUpdate"}}}}
responses:
"200": {content: {application/json: {schema: {$ref: "#/components/schemas/ConnectionLimiter"}}}}
"400": {$ref: "#/components/responses/BadRequest"}
"404": {$ref: "#/components/responses/NotFound"}
delete:
tags: [ConnectionLimiters]
summary: Delete connection limiter
responses:
"200": {content: {application/json: {schema: {$ref: "#/components/schemas/ConnectionLimiter"}}}}
"404": {$ref: "#/components/responses/NotFound"}
/rate-limiters:
get:
tags: [RateLimiters]
summary: List rate limiters
parameters:
- {in: query, name: id, schema: {type: integer, format: int32}}
- {in: query, name: strategy, schema: {type: string, enum: [fixed_window, sliding_window, token_bucket, leaky_bucket]}}
- {in: query, name: username, schema: {type: string}}
- {in: query, name: outbound, schema: {type: string}}
- {in: query, name: connection_type, schema: {type: string, enum: [hwid, mux, ip, default]}}
- {in: query, name: interval, schema: {type: string}}
- {in: query, name: count_start, schema: {type: integer, format: int64}}
- {in: query, name: count_end, schema: {type: integer, format: int64}}
- {$ref: "#/components/parameters/FilterSquadIdIn"}
- {$ref: "#/components/parameters/FilterCreatedAtStart"}
- {$ref: "#/components/parameters/FilterCreatedAtEnd"}
- {$ref: "#/components/parameters/FilterUpdatedAtStart"}
- {$ref: "#/components/parameters/FilterUpdatedAtEnd"}
- {$ref: "#/components/parameters/FilterSortAsc"}
- {$ref: "#/components/parameters/FilterSortDesc"}
- {$ref: "#/components/parameters/FilterOffset"}
- {$ref: "#/components/parameters/FilterLimit"}
responses:
"200": {content: {application/json: {schema: {type: array, items: {$ref: "#/components/schemas/RateLimiter"}}}}}
"500": {$ref: "#/components/responses/InternalError"}
post:
tags: [RateLimiters]
summary: Create rate limiter
requestBody: {required: true, content: {application/json: {schema: {$ref: "#/components/schemas/RateLimiterCreate"}}}}
responses:
"201": {content: {application/json: {schema: {$ref: "#/components/schemas/RateLimiter"}}}}
"400": {$ref: "#/components/responses/BadRequest"}
/rate-limiters/count:
get:
tags: [RateLimiters]
summary: Count rate limiters
parameters:
- {in: query, name: id, schema: {type: integer, format: int32}}
- {in: query, name: strategy, schema: {type: string, enum: [fixed_window, sliding_window, token_bucket, leaky_bucket]}}
- {in: query, name: username, schema: {type: string}}
- {in: query, name: outbound, schema: {type: string}}
- {in: query, name: connection_type, schema: {type: string, enum: [hwid, mux, ip, default]}}
- {in: query, name: interval, schema: {type: string}}
- {in: query, name: count_start, schema: {type: integer, format: int64}}
- {in: query, name: count_end, schema: {type: integer, format: int64}}
- {$ref: "#/components/parameters/FilterSquadIdIn"}
- {$ref: "#/components/parameters/FilterCreatedAtStart"}
- {$ref: "#/components/parameters/FilterCreatedAtEnd"}
- {$ref: "#/components/parameters/FilterUpdatedAtStart"}
- {$ref: "#/components/parameters/FilterUpdatedAtEnd"}
- {$ref: "#/components/parameters/FilterSortAsc"}
- {$ref: "#/components/parameters/FilterSortDesc"}
- {$ref: "#/components/parameters/FilterOffset"}
- {$ref: "#/components/parameters/FilterLimit"}
responses:
"200": {$ref: "#/components/responses/Count"}
"500": {$ref: "#/components/responses/InternalError"}
/rate-limiters/{id}:
parameters: [{$ref: "#/components/parameters/IntID"}]
get:
tags: [RateLimiters]
summary: Get rate limiter
responses:
"200": {content: {application/json: {schema: {$ref: "#/components/schemas/RateLimiter"}}}}
"404": {$ref: "#/components/responses/NotFound"}
"500": {$ref: "#/components/responses/InternalError"}
put:
tags: [RateLimiters]
summary: Update rate limiter
requestBody: {required: true, content: {application/json: {schema: {$ref: "#/components/schemas/RateLimiterUpdate"}}}}
responses:
"200": {content: {application/json: {schema: {$ref: "#/components/schemas/RateLimiter"}}}}
"400": {$ref: "#/components/responses/BadRequest"}
"404": {$ref: "#/components/responses/NotFound"}
delete:
tags: [RateLimiters]
summary: Delete rate limiter
responses:
"200": {content: {application/json: {schema: {$ref: "#/components/schemas/RateLimiter"}}}}
"404": {$ref: "#/components/responses/NotFound"}
components:
securitySchemes:
BearerAuth:
type: http
scheme: bearer
parameters:
FilterCreatedAtStart: {in: query, name: created_at_start, schema: {type: string, format: date-time}}
FilterCreatedAtEnd: {in: query, name: created_at_end, schema: {type: string, format: date-time}}
FilterUpdatedAtStart: {in: query, name: updated_at_start, schema: {type: string, format: date-time}}
FilterUpdatedAtEnd: {in: query, name: updated_at_end, schema: {type: string, format: date-time}}
FilterSortAsc: {in: query, name: sort_asc, schema: {type: string}}
FilterSortDesc: {in: query, name: sort_desc, schema: {type: string}}
FilterOffset: {in: query, name: offset, schema: {type: integer, format: int64, minimum: 0}}
FilterLimit: {in: query, name: limit, schema: {type: integer, format: int64, minimum: 1}}
FilterSquadIdIn:
in: query
name: squad_id_in
schema: {type: array, items: {type: integer, format: int32}}
style: form
explode: true
FilterIDIn:
in: query
name: id_in
schema: {type: array, items: {type: integer, format: int32}}
style: form
explode: true
IntID:
in: path
name: id
required: true
schema: {type: integer, format: int32, example: 1}
NodeUUID:
in: path
name: uuid
required: true
schema: {type: string, format: uuid, example: "a3b8c9d0-4e2f-4a1b-8c3d-9e7f6a5b4c3d"}
responses:
BadRequest:
content:
text/plain:
schema: {type: string}
NotFound:
InternalError:
content:
text/plain:
schema: {type: string}
Count:
content:
application/json:
schema:
type: object
required: [count]
properties:
count: {type: integer, format: int64, example: 42}
schemas:
SquadIDs:
type: array
minItems: 1
items: {type: integer, format: int32}
example: [1]
Squad:
type: object
required: [id, name, created_at, updated_at]
properties:
id: {type: integer, format: int32}
name: {type: string, example: "default"}
created_at: {type: string, format: date-time}
updated_at: {type: string, format: date-time}
SquadCreate:
type: object
required: [name]
properties:
name: {type: string, example: "default"}
SquadUpdate:
type: object
required: [name]
properties:
name: {type: string, example: "default-renamed"}
Node:
type: object
required: [uuid, name, squad_ids, created_at, updated_at]
properties:
uuid: {type: string, format: uuid}
name: {type: string, example: "node-1"}
squad_ids: {$ref: "#/components/schemas/SquadIDs"}
created_at: {type: string, format: date-time}
updated_at: {type: string, format: date-time}
NodeCreate:
type: object
required: [uuid, name, squad_ids]
properties:
uuid: {type: string, format: uuid}
name: {type: string, example: "node-1"}
squad_ids: {$ref: "#/components/schemas/SquadIDs"}
NodeUpdate:
type: object
required: [name]
properties:
name: {type: string, example: "node-1-renamed"}
User:
type: object
required: [id, squad_ids, username, inbound, type, uuid, password, secret, flow, alter_id, created_at, updated_at]
properties:
id: {type: integer, format: int32}
squad_ids: {$ref: "#/components/schemas/SquadIDs"}
username: {type: string, example: "alice"}
inbound: {type: string, example: "vless-in"}
type: {type: string, enum: [hysteria, hysteria2, mtproxy, trojan, tuic, vless, vmess]}
uuid: {type: string}
password: {type: string}
secret: {type: string}
flow: {type: string}
alter_id: {type: integer, format: int32}
created_at: {type: string, format: date-time}
updated_at: {type: string, format: date-time}
UserCreate:
type: object
required: [squad_ids, username, inbound, type]
properties:
squad_ids: {$ref: "#/components/schemas/SquadIDs"}
username: {type: string, example: "alice"}
inbound: {type: string, example: "vless-in"}
type:
type: string
enum: [hysteria, hysteria2, mtproxy, trojan, tuic, vless, vmess]
uuid: {type: string, format: uuid}
password: {type: string}
secret: {type: string}
flow: {type: string}
alter_id: {type: integer, format: int32}
UserUpdate:
type: object
properties:
uuid: {type: string, format: uuid}
password: {type: string}
secret: {type: string}
flow: {type: string}
alter_id: {type: integer, format: int32}
BandwidthLimiter:
type: object
required: [id, squad_ids, outbound, strategy, mode, speed, raw_speed, created_at, updated_at]
properties:
id: {type: integer, format: int32}
squad_ids: {$ref: "#/components/schemas/SquadIDs"}
username: {type: string}
outbound: {type: string, example: "direct"}
strategy: {type: string, enum: [global, connection]}
connection_type: {type: string, enum: [default, hwid, mux, ip]}
mode: {type: string, enum: [upload, download, bidirectional]}
flow_keys: {type: array, items: {type: string, enum: [user, destination, ip, hwid, mux]}}
speed: {type: string, example: "10mbit"}
raw_speed: {type: integer, format: int64}
created_at: {type: string, format: date-time}
updated_at: {type: string, format: date-time}
BandwidthLimiterCreate:
type: object
required: [squad_ids, outbound, strategy, mode, speed]
properties:
squad_ids: {$ref: "#/components/schemas/SquadIDs"}
username: {type: string}
outbound: {type: string, example: "direct"}
strategy: {type: string, enum: [global, connection]}
connection_type: {type: string, enum: [default, hwid, mux, ip]}
mode: {type: string, enum: [upload, download, bidirectional]}
flow_keys: {type: array, items: {type: string, enum: [user, destination, ip, hwid, mux]}}
speed: {type: string, example: "10mbit"}
BandwidthLimiterUpdate:
type: object
required: [outbound, strategy, mode, speed]
properties:
username: {type: string}
outbound: {type: string}
strategy: {type: string, enum: [global, connection]}
connection_type: {type: string, enum: [default, hwid, mux, ip]}
mode: {type: string, enum: [upload, download, bidirectional]}
flow_keys: {type: array, items: {type: string, enum: [user, destination, ip, hwid, mux]}}
speed: {type: string}
TrafficLimiter:
type: object
required: [id, squad_ids, outbound, strategy, mode, raw_used, quota, raw_quota, created_at, updated_at]
properties:
id: {type: integer, format: int32}
squad_ids: {$ref: "#/components/schemas/SquadIDs"}
username: {type: string}
outbound: {type: string, example: "direct"}
strategy: {type: string, enum: [global, bypass]}
mode: {type: string, enum: [upload, download, bidirectional]}
raw_used: {type: integer, format: int64}
quota: {type: string, example: "10gb"}
raw_quota: {type: integer, format: int64}
created_at: {type: string, format: date-time}
updated_at: {type: string, format: date-time}
TrafficLimiterCreate:
type: object
required: [squad_ids, outbound, strategy, mode, quota]
properties:
squad_ids: {$ref: "#/components/schemas/SquadIDs"}
username: {type: string}
outbound: {type: string, example: "direct"}
strategy: {type: string, enum: [global, bypass]}
mode: {type: string, enum: [upload, download, bidirectional]}
quota: {type: string, example: "10gb"}
TrafficLimiterUpdate:
type: object
required: [outbound, strategy, mode, quota]
properties:
username: {type: string}
outbound: {type: string}
strategy: {type: string, enum: [global, bypass]}
mode: {type: string, enum: [upload, download, bidirectional]}
quota: {type: string}
ConnectionLimiter:
type: object
required: [id, squad_ids, outbound, strategy, lock_type, count, created_at, updated_at]
properties:
id: {type: integer, format: int32}
squad_ids: {$ref: "#/components/schemas/SquadIDs"}
username: {type: string}
outbound: {type: string, example: "direct"}
strategy: {type: string, enum: [connection]}
connection_type: {type: string, enum: [default, hwid, mux, ip]}
lock_type: {type: string, enum: [manager, default]}
count: {type: integer, format: int64}
created_at: {type: string, format: date-time}
updated_at: {type: string, format: date-time}
ConnectionLimiterCreate:
type: object
required: [squad_ids, outbound, strategy, lock_type, count]
properties:
squad_ids: {$ref: "#/components/schemas/SquadIDs"}
username: {type: string}
outbound: {type: string, example: "direct"}
strategy: {type: string, enum: [connection]}
connection_type: {type: string, enum: [default, hwid, mux, ip]}
lock_type: {type: string, enum: [manager, default]}
count: {type: integer, format: int64}
ConnectionLimiterUpdate:
type: object
required: [outbound, strategy, lock_type, count]
properties:
username: {type: string}
outbound: {type: string}
strategy: {type: string, enum: [connection]}
connection_type: {type: string, enum: [default, hwid, mux, ip]}
lock_type: {type: string, enum: [manager, default]}
count: {type: integer, format: int64}
RateLimiter:
type: object
required: [id, squad_ids, outbound, strategy, connection_type, count, interval, created_at, updated_at]
properties:
id: {type: integer, format: int32}
squad_ids: {$ref: "#/components/schemas/SquadIDs"}
username: {type: string}
outbound: {type: string, example: "direct"}
strategy: {type: string, enum: [fixed_window, sliding_window, token_bucket, leaky_bucket]}
connection_type: {type: string, enum: [hwid, mux, ip, default]}
count: {type: integer, format: int64}
interval: {type: string, example: "1s"}
created_at: {type: string, format: date-time}
updated_at: {type: string, format: date-time}
RateLimiterCreate:
type: object
required: [squad_ids, outbound, strategy, connection_type, count, interval]
properties:
squad_ids: {$ref: "#/components/schemas/SquadIDs"}
username: {type: string}
outbound: {type: string, example: "direct"}
strategy: {type: string, enum: [fixed_window, sliding_window, token_bucket, leaky_bucket]}
connection_type: {type: string, enum: [hwid, mux, ip, default]}
count: {type: integer, format: int64}
interval: {type: string, example: "1s"}
RateLimiterUpdate:
type: object
required: [outbound, strategy, connection_type, count, interval]
properties:
username: {type: string}
outbound: {type: string}
strategy: {type: string, enum: [fixed_window, sliding_window, token_bucket, leaky_bucket]}
connection_type: {type: string, enum: [hwid, mux, ip, default]}
count: {type: integer, format: int64}
interval: {type: string}