iptables-helper/docs/swagger.yaml

269 lines
6.5 KiB
YAML

basePath: /
definitions:
errorx.CodeErrorResponse:
properties:
code:
description: 状态码
example: 200
type: integer
data:
description: 数据
msg:
description: 信息
example: OK
type: string
type: object
iptables.Info:
properties:
chains:
items:
type: string
type: array
policies:
items:
$ref: '#/definitions/iptables.Policy'
type: array
rules:
items:
$ref: '#/definitions/iptables.Rule'
type: array
type: object
iptables.Policy:
properties:
name:
type: string
target:
type: string
type: object
iptables.Rule:
properties:
chain:
type: string
cmd:
type: string
destination:
description: '-d [dest] example: 192.168.1.1, 192.168.1.0/24'
type: string
dstPort:
description: '--dport example: 80'
type: string
dstPorts:
description: '--dports example: 45000:46000'
type: string
excludeDestination:
description: '! -d [source] example: 192.168.1.1, 192.168.1.0/24'
type: string
excludeInputInterface:
description: '! -i [interface]'
type: string
excludeOutputInterface:
description: '! -o [interface]'
type: string
excludeProtocol:
description: '! -p [proto] example: all, tcp, udp, icmp'
type: string
excludeSource:
description: '! -s [source] example: 192.168.1.1, 192.168.1.0/24'
type: string
goto:
description: -g [chain Chain]
type: string
inputInterface:
description: -i [interface]
type: string
jump:
description: -j [target Chain]
type: string
limit:
description: '--limit example: 3/min'
type: string
match:
description: '-m [match] 用于匹配扩展模块 example: tcp udp icmp'
type: string
outputInterface:
description: -o [interface]
type: string
protocol:
description: '-p [proto] example: all, tcp, udp, icmp'
type: string
source:
description: '-s [source] example: 192.168.1.1, 192.168.1.0/24'
type: string
srcPort:
description: '--sport example: 22 80'
type: string
srcPorts:
description: '--sports example: 20000:40000'
type: string
type: object
net.InterfaceAddr:
properties:
addr:
type: string
type: object
net.InterfaceStat:
properties:
addrs:
items:
$ref: '#/definitions/net.InterfaceAddr'
type: array
flags:
description: e.g., FlagUp, FlagLoopback, FlagMulticast
items:
type: string
type: array
hardwareaddr:
description: IEEE MAC-48, EUI-48 and EUI-64 form
type: string
index:
type: integer
mtu:
description: maximum transmission unit
type: integer
name:
description: e.g., "en0", "lo0", "eth0.100"
type: string
type: object
resp.Response:
properties:
code:
description: 状态码
example: 200
type: integer
data:
description: 数据
msg:
description: 信息
example: OK
type: string
type: object
info:
contact:
email: 919411476@qq.com
name: Shikong
description: iptables-helper 的 swagger
license:
name: Apache 2.0
url: http://www.apache.org/licenses/LICENSE-2.0.html
termsOfService: http://swagger.io/terms/
title: iptables-helper API
version: "1.0"
paths:
/if/info:
get:
consumes:
- application/json
description: 获取 网卡 信息
produces:
- application/json
responses:
"200":
description: OK
schema:
allOf:
- $ref: '#/definitions/resp.Response'
- properties:
data:
items:
$ref: '#/definitions/net.InterfaceStat'
type: array
type: object
default:
description: ""
schema:
$ref: '#/definitions/errorx.CodeErrorResponse'
summary: 获取 网卡 信息
tags:
- Info
/info:
get:
consumes:
- application/json
description: 获取 iptables 规则 信息
produces:
- application/json
responses:
"200":
description: OK
schema:
allOf:
- $ref: '#/definitions/resp.Response'
- properties:
data:
$ref: '#/definitions/iptables.Info'
type: object
default:
description: ""
schema:
$ref: '#/definitions/errorx.CodeErrorResponse'
summary: 获取 iptables 规则 信息
tags:
- Info
/rule/add:
post:
consumes:
- application/json
description: 添加 iptables 规则
parameters:
- description: 规则
in: body
name: vo
required: true
schema:
$ref: '#/definitions/iptables.Rule'
- description: 是否插入第一条(高优先级),否则为追加
in: query
name: isInsert
required: true
type: boolean
produces:
- application/json
responses:
"200":
description: OK
schema:
allOf:
- $ref: '#/definitions/resp.Response'
- properties:
data:
type: string
type: object
default:
description: ""
schema:
$ref: '#/definitions/errorx.CodeErrorResponse'
summary: 添加 iptables 规则
tags:
- Info
/rule/del/cmd:
delete:
consumes:
- application/json
description: 删除 iptables 规则
parameters:
- description: 根据 cmd 命令参数 删除指定规则
in: query
name: cmd
required: true
type: string
produces:
- application/json
responses:
"200":
description: OK
schema:
allOf:
- $ref: '#/definitions/resp.Response'
- properties:
data:
type: string
type: object
default:
description: ""
schema:
$ref: '#/definitions/errorx.CodeErrorResponse'
summary: 删除 iptables 规则
tags:
- Info
swagger: "2.0"