Skip to content

flow_hooks.php

Flow hooks module for managing network traffic, DDoS protection status, and MAC address monitoring.

API Methods

Method Action Description
check_traffic_flow get traffic flow data Returns the last update data for traffic ticks, including delay and location.
ddos_blackhole trigger ddos blackhole Triggers a blackhole action for an IP address if traffic thresholds are exceeded or after multiple warning attempts.
ddos_protect activate ddos protection Activates DDoS protection for a specific IP address and notifies the customer.
ddos_unblock remove ddos block Removes the blackhole/DDoS protection for a specific IP address.
ddos_unprotect deactivate ddos protection Removes DDoS protection for a specific CIDR range.
ddos_warning trigger ddos warning Sends a DDoS traffic warning to the server owner and logs the event.
mac_change update mac address Updates the MAC address for a specific IP.
mac_check validate mac-ip records Validates MAC-IP bindings by checking ARP records, network activity via nmap, and server status.
mac_report group reports for static MACs Adds a list of IP:MAC pairs to the mac_flow table.
traffic_tick process traffic tick Records a traffic measurement for an IP or processes a group of traffic data.

flow_hooks/check_traffic_flow

Returns the last update data for traffic ticks, including delay and location.

HTTP method: GET

Parameters:

Parameter Required Type Description
action ✅ string Method identifier: check_traffic_flow

Request example

curl -s "https://invapi.hostkey.com/flow_hooks.php" -X GET \
--data "action=check_traffic_flow"
Success response example
{
"last_update": "2024-05-20 12:00:00",
"delay": 400,
"location": "NL"
}
Error examples
{
"code": -1,
"message": "Error retrieving traffic data"
}

flow_hooks/ddos_protect

Activates DDoS protection for a specific IP address and notifies the customer.

HTTP method: POST

Parameters:

Parameter Required Type Description
action ✅ string Method identifier: ddos_protect

Request example

curl -s "https://invapi.hostkey.com/flow_hooks.php" -X POST \
--data "action=ddos_protect"
Success response example
{
"result": "OK",
"action": "ddos_protect",
"data": {}
}
Error examples
{
"code": -1,
"message": "Failed to activate protection"
}

flow_hooks/ddos_unprotect

Removes DDoS protection for a specific CIDR range.

HTTP method: POST

Parameters:

Parameter Required Type Description
action ✅ string Method identifier: ddos_unprotect

Request example

curl -s "https://invapi.hostkey.com/flow_hooks.php" -X POST \
--data "action=ddos_unprotect"
Success response example
{
"result": "OK",
"action": "ddos_unprotect",
"data": {}
}
Error examples
{
"code": -1,
"message": "Failed to remove protection"
}

flow_hooks/mac_change

Updates the MAC address for a specific IP.

HTTP method: POST

Parameters:

Parameter Required Type Description
action ✅ string Method identifier: mac_change
ip ✅ string The IP address for which the MAC address will be changed.
new_mac ✅ string The new MAC address to be assigned.

Request example

curl -s "https://invapi.hostkey.com/flow_hooks.php" -X POST \
--data "action=mac_change" \
--data "ip=VALUE" \
--data "new_mac=VALUE"
Success response example
{
"result": "OK",
"action": "mac_change",
"data": {}
}
Error examples
{
"code": -1,
"message": "Failed to update MAC address"
}

flow_hooks/mac_check

Validates MAC-IP bindings by checking ARP records, network activity via nmap, and server status.

HTTP method: POST

Parameters:

Parameter Required Type Description
action ✅ string Method identifier: mac_check

Request example

curl -s "https://invapi.hostkey.com/flow_hooks.php" -X POST \
--data "action=mac_check"
Success response example
{
"result": "OK",
"action": "mac_check",
"data": [
{
"id": 123,
"ip": "192.168.1.1",
"mac": "00:1A:4C:00:11:22",
"reg_zone": 5,
"updated": "2024-05-20 12:00:00"
}
]
}
Error examples
{
"code": -1,
"message": "Error description"
}

flow_hooks/mac_report

Adds a list of IP:MAC pairs to the mac_flow table.

HTTP method: POST

Parameters:

Parameter Required Type Description
action ✅ string Method identifier: mac_report
ip ✅ string IP address to associate with the MAC address.
macs ✅ array<string> List of MAC addresses to add to the mac_flow table.

Request example

curl -s "https://invapi.hostkey.com/flow_hooks.php" -X POST \
--data "action=mac_report" \
--data "ip=192.168.1.1" \
--data "macs[]=00:11:22:33:44:55" \
--data "macs[]=66:77:88:99:AA:BB"
Success response example
{
"result": "OK",
"action": "mac_report",
"data": {}
}
Error examples
{
"code": -1,
"message": "Error description"
}

flow_hooks/traffic_tick

Records a traffic measurement for an IP or processes a group of traffic data.

HTTP method: POST

Parameters:

Parameter Required Type Description
action ✅ string Method identifier: traffic_tick
ip ❌ integer IP address of the source or destination.
direction ❌ string Traffic direction indicator.
volume ❌ integer Volume of traffic transferred.
data ❌ string Grouped traffic data for processing.

Request example

curl -s "https://invapi.hostkey.com/flow_hooks.php" -X POST \
--data "action=traffic_tick"
Success response example
{
"result": "OK",
"action": "traffic_tick",
"data": {}
}
Error examples
{
"code": -1,
"message": "Error description"
}

flow_hooks/ddos_blackhole

Triggers a blackhole action for an IP address if traffic thresholds are exceeded or after multiple warning attempts.

HTTP method: POST

Parameters:

Parameter Required Type Description
action ✅ string Method identifier: ddos_blackhole
token ✅ string Authentication token
ip ❌ string IP address to be blackholed
rate ❌ number Traffic rate in Mbps
pps ❌ integer Packets per second

Request example

curl -s "https://invapi.hostkey.com/flow_hooks.php" -X POST \
--data "action=ddos_blackhole" \
--data "token=HOSTKEY_TOKEN" \
--data "ip=1.2.3.4" \
--data "rate=100" \
--data "pps=5000"
Success response example
{
"result": "OK",
"action": "ddos_blackhole",
"data": {
"callback": "7bc29eb23fb1b879b21fce509597f07c"
}
}
Error examples
{
"code": -1,
"message": "Error during blackhole operation"
}

flow_hooks/ddos_unblock

Removes the blackhole/DDoS protection for a specific IP address.

HTTP method: POST

Parameters:

Parameter Required Type Description
action ✅ string Method identifier: ddos_unblock
token ✅ string Authentication token
ip ❌ string IP address to unblock. Can be a string or a numeric IP representation.

Request example

curl -s "https://invapi.hostkey.com/flow_hooks.php" -X POST \
--data "action=ddos_unblock" \
--data "token=HOSTKEY_TOKEN" \
--data "ip=1.2.3.4"
Success response example
{
"result": "OK",
"action": "ddos_unblock",
"data": {}
}
Error examples
{
"code": -1,
"message": "Failed to unblock blackhole for IP"
}

flow_hooks/ddos_warning

Sends a DDoS traffic warning to the server owner and logs the event.

HTTP method: POST

Parameters:

Parameter Required Type Description
action ✅ string Method identifier: ddos_warning
token ✅ string Authentication token

Request example

curl -s "https://invapi.hostkey.com/flow_hooks.php" -X POST \
--data "action=ddos_warning" \
--data "token=HOSTKEY_TOKEN"
Success response example
{
"result": "OK",
"action": "ddos_warning",
"data": {}
}
Error examples
{
"code": -1,
"message": "Error during warning notification"
}
question_mark
Is there anything I can help you with?
question_mark
AI Assistant ×