网关集群

获取候选节点列表

简介

获取等待加入网关集群的节点列表

URI

GET /admin-api/nodecandidate/list

请求示例

Shell

curl \
  -H "API-Token: 1df87165-3593-4eca-a910-9ac20005e6ec" \
  http://{admin-site}/admin-api/nodecandidate/list

响应示例

Status: 200 OK
{
    "time": 1614768787,
    "data": {
        "data": [
            {
                "internal_ip": "127.0.0.1",
                "mac_address": "06:86:ce:06:75:a6",
                "_created_unix": "2021-03-03 18:50:16.976704",
                "created_unix": 1614768616.9767,
                "hardware_id": "6b632692eb1f46bd0b8067f6ae9xxxxx",
                "csr": "-----BEGIN NEW CERTIFICATE REQUEST-----\n...\n-----END NEW CERTIFICATE REQUEST-----\n",
                "hostname": "localhost\n",
                "external_ip": "127.0.0.1",
                "os": "Linux\n3.10.0-1062.12.1.el7.x86_64\n",
                "external_ipv6": "",
                "client_city": "HK/"
            }
        ],
        "meta": {
            "count": 1
        }
    },
    "status": 0
}

获取网关集群列表

简介

获取网关集群列表

URI

GET /admin-api/gateway

URI参数

  • detail

    type: integer

    required: no

    description: Are detailed results required (default 0)

  • page

    type: integer

    required: no

    description: Results page (default 1)

  • page_size

    type: integer

    required: no

    description: Results page size (default 20)

请求示例

Shell

curl \
  -H "API-Token: 1df87165-3593-4eca-a910-9ac20005e6ec" \
  http://{admin-site}/admin-api/gateway?detail=1&page_size=100&page=1

响应示例

Status: 200 OK
{
    "data": {
        "data": [
            {
                "is_gray_partition": false,
                "id": 1, // gateway id
                "_modified_unix": 1612133743.1943,
                "nodes": [
                    {
                        "internal_ip": "127.0.0.1",
                        "id": 59, // node id
                        "online_status": true,
                        "_modified_unix": 1612136932.8338,
                        "name": "localhost",
                        "config": {
                            "error_log_level": "default",
                            "proxy_bind_local_ip_list": ["192.168.122.164", "192.168.50.243"],
                            "listen_bind_local_ip_list": ["192.168.122.164", "192.168.50.243"]
                        },
                        "serial": "3049245148",
                        "_created_unix": 1571733586.0325,
                        "sync_status_utime": 1614765663,
                        "hardware_id": "43ac1f19cf445cea5235a536e43xxxxx",
                        "version": 501,
                        "is_healthy": true,
                        "external_ip": "127.0.0.1",
                        "status": 1
                    }
                ],
                "partition": 1,
                "tag": [
                    2
                ],
                "name": "hk",
                "_created_unix": 1506091343.5212,
                "location": {
                    "country": "CN",
                    "isp": "BGP",
                    "province": "Hongkong",
                    "latitude": 30.252501,
                    "continent": "AS",
                    "longitude": 120.165024
                }
            }
        ],
        "meta": {
            "count": 11
        }
    },
    "status": 0
}

新建网关集群

简介

新建网关集群

URI

POST /admin-api/gateway

JSON body 参数

{
    "name": "gateway-name", // gateway name
    "partition": 1, // partition id
}

请求示例

Shell

curl \
  -H "API-Token: 1df87165-3593-4eca-a910-9ac20005e6ec" \
  http://{admin-site}/admin-api/gateway
  -d '{"name": "gateway-name", "partition": 1}'

响应示例

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

批准候选节点加入网关集群

简介

批准候选节点加入网关集群

URI

POST /admin-api/nodecandidate/approve

JSON body 参数

    {
        "cluster": 1, // gateway id
        "status": 1, // 1: Enable, 2: Disabled DNS 3: Offline
        "internal_ip": "127.0.0.1",
        "mac_address": "06:86:ce:06:75:a6",
        "_created_unix": "2021-03-03 18:50:16.976704",
        "created_unix": 1614768616.9767,
        "hardware_id": "6b632692eb1f46bd0b8067f6ae9xxxxx",
        "csr": "-----BEGIN NEW CERTIFICATE REQUEST-----\n...\n-----END NEW CERTIFICATE REQUEST-----\n",
        "hostname": "localhost\n",
        "external_ip": "127.0.0.1",
        "os": "Linux\n3.10.0-1062.12.1.el7.x86_64\n",
        "external_ipv6": "",
        "client_city": "HK/"
    }

请求示例

Shell

curl \
  -H "API-Token: 1df87165-3593-4eca-a910-9ac20005e6ec" \
  http://{admin-site}/admin-api/nodecandidate/approve \
  -d '{"cluster": 1, "status": 1, "internal_ip":"127.0.0.1","mac_address":"06:86:ce:06:75:a6","_created_unix":"2021-03-03 18:50:16.976704","created_unix":1614768616.9767,"hardware_id":"6b632692eb1f46bd0b8067f6ae9xxxxx","csr":"-----BEGIN NEW CERTIFICATE REQUEST-----\n...\n-----END NEW CERTIFICATE REQUEST-----\n","hostname":"localhost\n","external_ip":"127.0.0.1","os":"Linux\n3.10.0-1062.12.1.el7.x86_64\n","external_ipv6":"","client_city":"HK/"}'

响应示例

Status: 200 OK

{"time":1614782044,"status":0}

移除网关集群中的节点

简介

移除网关集群中的节点

URI

DELETE /admin-api/gateway/{gateway_id}/nodes/{node_id}

请求示例

Shell

curl -X DELETE
  -H "API-Token: 1df87165-3593-4eca-a910-9ac20005e6ec" \
  http://{admin-site}/admin-api/gateway/1/nodes/1

响应示例

Status: 200 OK
{"status":0}

获取网关集群标签

简介

获取网关集群标签

URI

GET /admin-api/gatewaytag

请求示例

Shell

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

响应示例

Status: 200 OK
{
    "data": [
        {
            "name": "ZBCySv",
            "id": 1
        },
        {
            "name": "QXnfet",
            "id": 2
        },
        {
            "name": "test-tag1",
            "id": 3
        },
        {
            "name": "tag2",
            "id": 4
        },
        {
            "name": "omZyRp",
            "id": 5
        },
        {
            "name": "nameserver",
            "id": 6
        },
        {
            "name": "122",
            "id": 7
        }
    ],
    "status": 0
}

获取网关集群标签名字

简介

通过网关集群标签 ID 获取名字

URI

GET /admin-api/gatewaytag/{tag_id}

请求示例

Shell

curl \
  -H "API-Token: 1df87165-3593-4eca-a910-9ac20005e6ec" \
  http://{admin-site}/admin-api/gatewaytag/6

响应示例

Status: 200 OK
{
    "data": {
        "name": "nameserver",
        "id": 6
    },
    "status": 0
}