Open API of WFilter NGF

From Wiki of WFilter NG Firewall
Revision as of 13:55, 12 July 2019 by WFilter (Talk | contribs)

(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search


Contents

1 Introduction

WFilter NGF has a built-in API library for developers to manipulate the entire system or integrate WFilter features. With APIs, you’re able to:

  • 1. Monitor system/network status.
  • 2. Monitor bandwidth and online users.
  • 3. Set client access policy.

Available APIs are listed in below:

2 Network Status

2.1 List network interfaces

  • Function: get_network_interfaces
  • Parameter: none
  • Return: JSON
  • Result format

2.2 Get interface status and statistics

  • Function: get_network_status
  • Parameter: none
  • Return: JSON
  • Result format

3 Bandwidth and user status

3.1 Get bandwidth history of past N seconds

  • Function: list_bandwidth
  • Parameter: seconds
  • Return: JSON
  • Result format

3.2 List online users

  • Function: list_online_users
  • Parameters: return rows(max 1000), search string
  • Return: JSON
  • Result format

3.3 List online connections of a client

  • Function: list_online_connections
  • Parameter: IP address
  • Return: JSON
  • Result format

4 Get Basic Settings

4.1 List groups

  • Function: list_group
  • Parameter: none
  • Return: JSON
  • Result format

4.2 List WFilter accounts

  • Function: list_account
  • Parameter: none
  • Return: JSON
  • Result format

5 Set client access policy

5.1 Terminate connections(kick off user)

  • Function: kill_connection
  • Parameters:
    • port : connection local port, 0 for all ports
    • type: "ALL"-- all protocols, "RESET"-- reset to default, "REMOVE"-- bypass all blocking, others -- protocol name.
    • minutes: blocking minutes
    • message: message to be displayed(urlencoded)
  • Return: TRUE or FALSE

5.2 Add IP into a virtual group

  • Function: add_virtual_group
  • Parameters:
    • groupid: group ID
    • ip: client IP
    • minutes: stay in this group for N minutes
  • Return: TRUE or FALSE

5.3 Remove IP from a virtual group

  • Function: rm_virtual_group
  • Paramter: IP
  • Return: TRUE or FALSE

5.4 Connect IP with username

  • Function: add_user
  • Parameters
    • ip: ip address
    • user: username(urlencoded)
    • from: from type(eg: webauth, pppoe)
    • expire: expire after N seconds
  • Return: TRUE or FALSE

5.5 Disconnect ip with username

  • Function: rm_user
  • Paramter: ip or username(urlencoded)

6 Add, modify and delete settings

6.1 Load settings

  • Function: config_load
  • cfgname: config file name
  • Return: json format settings

6.2 Add settings

  • Function: config_add
  • Parameters
    • cfgname: config file name
    • type: settings type
    • name: settings section name
    • values: json format settings content

6.3 Modify settings

  • Function: config_set
  • Parameters
    • cfgname: config file name
    • section: settings section name
    • values: json format settings content

6.4 Delete settings

  • Function: config_del
  • Parameters
    • cfgname: config file name
    • section: settings section name

6.5 Apply changes

  • Function: config_apply
  • Parameter: none

7 SDK Download

7.1 php

Download URL: WFilter SDK for php

8 Links

Personal tools
Namespaces

Variants
Actions
Navigation
Tools