# 全局 IP 列表

# 新建全局 IP 列表

# URI

POST /admin-api/global/1/ip_list

# JSON body 参数

  • name

    type: string

    required: yes

    description: name of global IP list

  • type

    type: string

    required: yes

    description: type of global IP list, value can be 'ipv4' or 'ipv6'

  • items

    type: array

    required: yes

    description: list of ip address objects

  • items.ip

    type: ip

    required: yes

    description: ip address (ipv4 or ipv6)

# 请求示例

# Shell

curl \
  -X POST \
  -H "API-Token: 1df87165-3593-4eca-a910-9ac20005e6ec" \
  http://admin-site/admin-api/global/1/ip_list \
  -d '{
      "name": "ip-list-1",
      "type": "ipv4",
      "items": [
        {"ip": "127.0.0.1"},
        {"ip": "127.0.0.2/32"}
      ]
  }'

# 响应示例

Status: 200 OK
{ "status":0, "data": {"id": 1} }

# 修改全局 IP 列表(覆盖)

# URI

PUT /admin-api/global/1/ip_list/{ip_list_id}

# 请求示例

# Shell

curl \
  -X PUT \
  -H "API-Token: 1df87165-3593-4eca-a910-9ac20005e6ec" \
  http://admin-site/admin-api/global/1/ip_list/1 \
  -d '{
      {"items":[{"ip":"10.0.0.100"}]}
  }'

# 响应示例

Status: 200 OK
{ "status":0 }

# 追加 IP 至已存在 IP 列表

# URI

PUT /admin-api/ip_list/append

# 请求示例

# Shell

curl \
  -X PUT \
  -H "API-Token: 1df87165-3593-4eca-a910-9ac20005e6ec" \
  http://admin-site/admin-api/ip_list/{ip_list_id}/append \
  -d '{
      "items":[{"ip":"10.0.0.101"}]
  }'

# 响应示例

Status: 200 OK
{ "status":0 }

# 获取全局 IP 列表

# URI

GET /admin-api/global/1/ip_list

# 请求示例

# Shell

curl \
  -H "API-Token: 1df87165-3593-4eca-a910-9ac20005e6ec" \
  http://admin-site/admin-api/global/1/ip_list

# 响应示例

Status: 200 OK
{
  "data": [
    {
      "id": 1,
      "items": [
        { "id": 1, "ip": "127.0.0.1" },
        { "id": 2, "ip": "127.0.0.2" }
      ],
      "name": "ip-list-1",
      "type": "ipv4"
    }
  ],
  "status": 0
}

# 根据 id 移除对应的 IP 列表

# URI

DELETE /admin-api/global/1/ip_list/{ip_list_id}

# 请求示例

curl \
  -X DELETE \
  -H "API-Token: 1df87165-3593-4eca-a910-9ac20005e6ec" \
  http://admin-site/admin-api/global/1/ip_list/1

# 响应示例

Status: 200 OK
{"status": 0}