Skip to main content

Tcp Edge Traffic Policy Module

Replace TCP Edge Traffic Policy Module

Request

PUT /edges/tcp/{id}/traffic_policy

Example Request

curl \
-X PUT \
-H "Authorization: Bearer {API_KEY}" \
-H "Content-Type: application/json" \
-H "Ngrok-Version: 2" \
-d '{"enabled":true,"value":"{\"on_tcp_connect\":[{\"name\":\"Block IP\",\"expressions\":[\"conn.client_ip == '192.0.2.0'\"],\"actions\":[{\"type\":\"deny\"}]}]}"}' \
https://api.ngrok.com/edges/tcp/edgtcp_2na2LcXAoeqQiTSblYkbFjqOWiA/traffic_policy

Parameters

NameTypeDescription
enabledbooleantrue if the module will be applied to traffic, false to disable. default true if unspecified
valuestringthe traffic policy that should be applied to the traffic on your endpoint.

Response

Returns a 200 response on success

Example Response

{
"enabled": true,
"value": "{\"on_tcp_connect\":[{\"name\":\"Block IP\",\"expressions\":[\"conn.client_ip == '192.0.2.0'\"],\"actions\":[{\"type\":\"deny\"}]}]}"
}

Fields

NameTypeDescription
enabledbooleantrue if the module will be applied to traffic, false to disable. default true if unspecified
valuestringthe traffic policy that should be applied to the traffic on your endpoint.

Get TCP Edge Traffic Policy Module

Request

GET /edges/tcp/{id}/traffic_policy

Example Request

curl \
-X GET \
-H "Authorization: Bearer {API_KEY}" \
-H "Ngrok-Version: 2" \
https://api.ngrok.com/edges/tcp/edgtcp_2na2LcXAoeqQiTSblYkbFjqOWiA/traffic_policy

Response

Returns a 200 response on success

Example Response

{
"enabled": true,
"value": "{\"on_tcp_connect\":[{\"name\":\"Block IP\",\"expressions\":[\"conn.client_ip == '192.0.2.0'\"],\"actions\":[{\"type\":\"deny\"}]}]}"
}

Fields

NameTypeDescription
enabledbooleantrue if the module will be applied to traffic, false to disable. default true if unspecified
valuestringthe traffic policy that should be applied to the traffic on your endpoint.

Delete TCP Edge Traffic Policy Module

Request

DELETE /edges/tcp/{id}/traffic_policy

Example Request

curl \
-X DELETE \
-H "Authorization: Bearer {API_KEY}" \
-H "Ngrok-Version: 2" \
https://api.ngrok.com/edges/tcp/edgtcp_2na2LcXAoeqQiTSblYkbFjqOWiA/traffic_policy

Response

Returns a 204 response with no body on success