package documentation
Library that handles the DPI rules.
From __init__.py
:
Function | add |
Store a new global exemption |
Function | add |
Store a new rule |
Function | delete |
Delete a global exemption |
Function | delete |
Delete a rule |
Function | edit |
Edit a global exemption |
Function | edit |
Edit a rule |
Function | list |
List applications available for filtering. |
Function | list |
List device-interface available for filtering. |
Function | list |
Index all global exemptions |
Function | list |
List popular applications available for filtering. |
Function | list |
Index all rules |
Function | load |
Reads the protocols from the netifyd --dump-protos command. |
Function | __load |
Reads the application categories from the netify-categories.json file. |
Function | __load |
Reads the applications from the netify-apps.conf file. |
Function | __load |
Format the applications and protocols into a list of dicts. |
Function | __load |
Reads the protocol categories from the netify-categories.json file. |
Function | __save |
Undocumented |
Function | __save |
Undocumented |
Function | __toggle |
Undocumented |
Store a new global exemption
- Args:
- e_uci: euci instance
- criteria: exemption criteria, usually it's an IP address
- description: description of the rule
- enabled: enable the exemption
- Returns:
- config name of the exemption created
def add_rule(e_uci:
EUci
, enabled: bool
, device: str
, action: str
, applications: list[ str]
, protocols: list[ str]
) -> str
:
(source)
¶
Store a new rule
- Args:
- e_uci: euci instance
- description: description of the rule
- enabled: enable the rule
- action: apply specific action to rule, can be 'block', 'bulk', 'best_effort', 'video' or 'voice'
- device: device to listen and apply the rule on
- applications: list of applications to block
- protocols: list of protocols to block
- Returns:
- config name of the rule created
def edit_exemption(e_uci:
EUci
, config_name: str
, criteria: str
, description: str
, enabled: bool
):
(source)
¶
Edit a global exemption
- Args:
- e_uci: euci instance
- config_name: rule to change
- criteria: exemption criteria, usually it's an IP address
- description: description of the rule
- enabled: enable the exemption
- Raises
- ValidationError: if the config name is invalid
def edit_rule(e_uci:
EUci
, config_name: str
, enabled: bool
, device: str
, action: str
, applications: list[ str]
, protocols: list[ str]
):
(source)
¶
Edit a rule
- Args:
- e_uci: euci instance
- config_name: rule to change
- enabled: enable the rule
- device: device to listen and apply the rule on
- action: apply specific action to rule, can be 'block', 'bulk', 'best_effort', 'video' or 'voice'
- applications: array of applications to block
- protocols: array of protocols to block
- Raises
- ValidationError: if the config name is invalid
List applications available for filtering.
- Args:
- search: search string
- limit: limit the number of results
- page: page number
- Returns:
- list of dicts, each dict contains the property "code" and "name"
List device-interface available for filtering.
- Returns:
- list of dicts, each dict contains the property "interface" and "device"
Index all global exemptions
- Args:
- e_uci: euci instance
- Returns:
- list of dicts, each dict contains the property "config-name", "description", "enabled", "criteria"
List popular applications available for filtering.
- Args:
- limit: limit the number of results
- page: page number
- Returns:
- list of dicts, each dict contains the property "id", "name", "type" and "category"
Index all rules
- Args:
- e_uci: euci instance
- Returns:
- list of dicts, each dict contains the property "config-name", "description", "enabled", "interface" and "blocks"
Reads the protocols from the netifyd --dump-protos command.
- Returns:
- dict of protocols, each dict contains the property "id" and "name"
Reads the application categories from the netify-categories.json file.
- Returns:
- dict of application categories, each dict contains the property "id" and "name"
Reads the applications from the netify-apps.conf file.
- Returns:
- dict of applications, each dict contains the property "id" and "name"
Format the applications and protocols into a list of dicts.
- Returns:
- list of dicts, each dict contains the property "id", "name", "type" and "category"
Reads the protocol categories from the netify-categories.json file.
- Returns:
- dict of protocol categories, each dict contains the property "id" and "name"
def __save_exemption_data(e_uci:
EUci
, config_name: str
, criteria: str
, description: str
, enabled: bool
):
(source)
¶
Undocumented