## 获取四层转发列表 ~~~[api] get:/v1/streams integer:page=1#当前页码 integer:limit=10#单页显示数量 integer:listen_port#监听的端口 listen_protocol#监听的协议,可选为tcp、udp backend_ip#源IP,模糊匹配 integer:group#所属的转发组 integer:id#转发ID integer:user_package#所属的套餐 boolean:enable#启用或禁用 state#四层转发状态,可选为200、512、513、514。200是正常,512是套餐过期,513是流量超限,514是被锁定 <<< 返回结果 { "code": 0, "count": 2, "data": [ { "acl": "{}", "backend": "[{\"state\": \"up\", \"addr\": \"1.1.1.1\", \"weight\": 1}]", "backend_port": "99", "backup_node_group": null, "backup_node_group_name": null, "balance_way": "rr", "cname_domain": "cdnfly.com", "cname_hostname": "cbsjyv4m", "cname_hostname2": "", "cname_mode": "site", "cname_state": "done", "cname_task_id": 120525, "conn_limit": "", "create_at": null, "create_at2": "2021-11-26 19:06:02", "enable": 1, "enable_backup_group": 0, "id": 42, "listen": "[{\"protocol\": \"tcp\", \"port\": \"999\"}]", "name": "jason", "node_group_id": 490, "node_group_name": null, "package_name": "ff", "proxy_protocol": 0, "record_id": "732094354142733312", "region_id": 646, "region_name": "test", "s.cname_domain": "cdnfly.com", "s.cname_hostname": "cbsjyv4m", "s.cname_hostname2": "", "s.cname_mode": "site", "state": "200", "stream_state": "200", "sync_state": "done", "task_id": 120524, "uid": 2, "up_cname_domain": "cdnfly.com", "up_cname_hostname": "v325sf8j-u", "up_cname_hostname2": "", "update_at": null, "update_at2": "2021-11-26 19:06:02", "user_package": 425, "version": 1 }, { "acl": "{}", "backend": "[{\"state\": \"up\", \"addr\": \"1.1.1.1\", \"weight\": 1}]", "backend_port": "88", "backup_node_group": null, "backup_node_group_name": null, "balance_way": "rr", "cname_domain": "cdnfly.com", "cname_hostname": "knw42svf", "cname_hostname2": "", "cname_mode": "site", "cname_state": "done", "cname_task_id": 120502, "conn_limit": "", "create_at": null, "create_at2": "2021-11-26 18:57:16", "enable": 1, "enable_backup_group": 0, "id": 41, "listen": "[{\"protocol\": \"tcp\", \"port\": \"88\"}]", "name": "jason", "node_group_id": 490, "node_group_name": null, "package_name": "ff", "proxy_protocol": 0, "record_id": "732093253135826944", "region_id": 646, "region_name": "test", "s.cname_domain": "cdnfly.com", "s.cname_hostname": "knw42svf", "s.cname_hostname2": "", "s.cname_mode": "site", "state": "200", "stream_state": "200", "sync_state": "done", "task_id": 120501, "uid": 2, "up_cname_domain": "cdnfly.com", "up_cname_hostname": "v325sf8j-u", "up_cname_hostname2": "", "update_at": null, "update_at2": "2021-11-26 18:57:16", "user_package": 425, "version": 1 } ] } ~~~ ## 新增一个或多个转发(多个时,数据格式为数组) ~~~[api] post:/v1/streams *integer:user_package#绑定的套餐 *json:listen#监听的协议和端口,格式为json数组,如[{"protocol":"tcp","port":"88"}],protocol可选为tcp或udp balance_way#源站负载均衡方式,可选为ip_hash、rr、least_conn、random boolean:proxy_protocol#回源是否使用proxy protocol协议 *integer:backend_port#回源端口 *json:backend#源IP设置,格式为json数组,如[{"addr":"1.1.1.1","weight":1,"state":"up"}],state可选为up、down、backup integer:conn_limit#连接数限制 json:acl#acl配置,格式为json,如{"default_action":"allow","rule":[{"ip":"1.1.1.1","action":"deny"}]},default_action可选为allow、deny;rule中的action可选为allow,deny。 <<< 返回结果 { "code": 0, "data": "", "msg": "四层转发添加成功" } <<< 提交内容 [{ "user_package": "427", "listen": [{ "protocol": "tcp", "port": "100" }], "backend_port": "100", "backend": [{ "addr": "1.1.1.1" }] }] ~~~ ## 批量修改四层转发(数据格式为数组) ~~~[api] get:/v1/streams *integer:id#四层转发ID integer:user_package#绑定的套餐 json:listen#监听的协议和端口,格式为json数组,如[{"protocol":"tcp","port":"88"}],protocol可选为tcp或udp balance_way#源站负载均衡方式,可选为ip_hash、rr、least_conn、random boolean:proxy_protocol#回源是否使用proxy protocol协议 integer:backend_port#回源端口 json:backend#源IP设置,格式为json数组,如[{"addr":"1.1.1.1","weight":1,"state":"up"}],state可选为up、down、backup integer:conn_limit#连接数限制 json:acl#acl配置,格式为json,如{"default_action":"allow","rule":[{"ip":"1.1.1.1","action":"deny"}]},default_action可选为allow、deny;rule中的action可选为allow,deny。 boolean:enable#启用或禁用 <<< 返回结果 { "code": 0, "data": "", "msg": "更新转发成功" } <<< 提交内容 [{ "id": 1, "enable": 0 }, { "id": 2, "enable": 0 }] ~~~ ## 获取指定四层转发 ~~~[api] get:/v1/streams/41 <<< 返回结果 { "code": 0, "data": { "acl": "{}", "backend": "[{\"state\": \"up\", \"addr\": \"1.1.1.1\", \"weight\": 1}]", "backend_port": "88", "backup_node_group": null, "balance_way": "rr", "cname_domain": "cdnfly.com", "cname_hostname": "knw42svf", "cname_hostname2": "", "cname_mode": "site", "cname_state": "done", "cname_task_id": 120502, "conn_limit": "", "create_at": null, "create_at2": "2021-11-26 18:57:16", "enable": 1, "enable_backup_group": 0, "end_at": "2021-12-16 14:47:38", "groups": null, "id": 41, "listen": "[{\"protocol\": \"tcp\", \"port\": \"88\"}]", "name": "jason", "node_group_id": 490, "node_group_name": null, "package_name": "ff", "proxy_protocol": 0, "record_id": "732093253135826944", "region_id": 646, "s.cname_domain": "cdnfly.com", "s.cname_hostname": "knw42svf", "s.cname_hostname2": "", "s.cname_mode": "site", "state": "200", "stream_state": "200", "sync_state": "done", "task_id": 120501, "uid": 2, "up_cname_domain": "cdnfly.com", "up_cname_hostname": "v325sf8j-u", "up_cname_hostname2": "", "update_at": null, "update_at2": "2021-11-26 18:57:16", "user_package": 425, "version": 1 }, "msg": "" } ~~~ ## 修改指定四层转发 ~~~[api] get:/v1/streams/<四层转发ID> integer:user_package#绑定的套餐 json:listen#监听的协议和端口,格式为json数组,如[{"protocol":"tcp","port":"88"}],protocol可选为tcp或udp balance_way#源站负载均衡方式,可选为ip_hash、rr、least_conn、random boolean:proxy_protocol#回源是否使用proxy protocol协议 integer:backend_port#回源端口 json:backend#源IP设置,格式为json数组,如[{"addr":"1.1.1.1","weight":1,"state":"up"}],state可选为up、down、backup integer:conn_limit#连接数限制 json:acl#acl配置,格式为json,如{"default_action":"allow","rule":[{"ip":"1.1.1.1","action":"deny"}]},default_action可选为allow、deny;rule中的action可选为allow,deny。 boolean:enable#启用或禁用 <<< 返回结果 { "code": 0, "data": "", "msg": "更新转发成功" } <<< 提交内容 { "id": 1, "enable": 0 } ~~~ ## 删除四层转发 ~~~[api] delete:/v1/streams/<四层转发ID,多个以逗号分隔> <<< 返回结果 { "code": 0, "data": "", "msg": "四层转发删除成功" } ~~~