Objects utilities
From __init__.py
:
Function | add |
Add domain set to objects config. |
Function | add |
Add host set to objects config. |
Function | delete |
Delete domain set from objects config. |
Function | delete |
Delete host set from objects config. |
Function | edit |
Edit domain set in objects config. |
Function | edit |
Edit host set in objects config. |
Function | get |
Get ipsets linked to domain set. |
Function | get |
Calculate the total number of characters the given domain set will use in the dnsmasq configuration file. This file supports a maximum of 1024 characters per line. |
Function | get |
Get the info of the object. |
Function | get |
Get object from objects config. |
Function | get |
Get the first IP address from an object. |
Function | get |
Get all IP addresses from an object. |
Function | is |
Check if an object is a domain. |
Function | is |
Check if an object is a domain set. |
Function | is |
Check if an object is a host. |
Function | is |
Check if an object is a host set. |
Function | is |
Check if an id is an object id. |
Function | is |
Check if an object is a host set with a single IP address. The IP must not be an IP range. If allow_cidr is True, the IP can be in CIDR notation. |
Function | is |
Check if domain set is used in firewall config. |
Function | is |
Check if host set is used in firewall config. |
Function | is |
firewall config |
Function | is |
Check if an object is a VPN user. |
Function | list |
Get all DHCP static leases from dhcp config |
Function | list |
Get all DNS records from dhcp config |
Function | list |
Get all domain sets from objects config |
Function | list |
Get all host sets from objects config |
Function | list |
Get objects from objects, dhcp, and users config |
Function | list |
Get all VPN users from users config |
Function | object |
Check if the object exists. |
Function | _has |
Undocumented |
Function | _validate |
Undocumented |
Function | _validate |
Undocumented |
Function | _validate |
Undocumented |
str
, family: str
, domains: list[ str]
, timeout: int
= 660) -> str
:
(source)
¶
Add domain set to objects config.
- Args:
- uci: EUci pointer
name: name of domain set
family: can be
ipv4
oripv6
domains: a list of valid DNS names timeout: the timeout in seconds for the DNS resolution, default is660
seconds - Returns:
- id of domain set config that was added
Add host set to objects config.
- Args:
- uci: EUci pointer
name: name of host set
family: can be
ipv4
oripv6
ipaddrs: a list of IP addresses - Returns:
- id of host set config that was added
Delete domain set from objects config.
- Args:
- uci: EUci pointer id: id of domain set to delete
- Returns:
- name of domain set config that was deleted
Delete host set from objects config.
- Args:
- uci: EUci pointer id: id of host set to delete
- Returns:
- name of host set config that was deleted
str
, name: str
, family: str
, domains: list[ str]
, timeout: int
= 660) -> str
:
(source)
¶
Edit domain set in objects config.
- Args:
- uci: EUci pointer
id: id of domain set to edit
name: name of domain set
family: can be
ipv4
oripv6
domains: a list of valid DNS names timeout: the timeout in seconds for the DNS resolution, default is660
seconds - Returns:
- id of domain set config that was edited
Edit host set in objects config.
- Args:
- uci: EUci pointer
id: id of host set to edit
name: name of host set
family: can be
ipv4
oripv6
ipaddrs: a list of IP addresses - Returns:
- id of host set config that was edited
Get ipsets linked to domain set.
- Args:
- uci: EUci pointer id: id of domain set
- Returns:
- a dictionary with
-
firewall
: the ipset id linked to domain set from firewall config -dhcp
: the ipset id linked to domain set from dhcp config
Calculate the total number of characters the given domain set will use in the dnsmasq configuration file. This file supports a maximum of 1024 characters per line.
Example syntax of a domain set in dnsmasq configuration file: nftset=/example1.org/example2.org/example3.org/.../4#inet#fw4#domainSetName
- Args:
- name: name of domain set domains: a list of valid DNS names
- Returns:
- the number of characters
Get the info of the object.
- Args:
- uci: EUci pointer
database_id: id of the object in the form of
<database>/
- Returns:
a dictionary with the following fields:
Get object from objects config.
- Args:
- uci: EUci pointer
id: id of the object in the form of
<database>/
- Returns:
- object from config or None if not found
Get the first IP address from an object.
- Args:
- uci: EUci pointer
id: id of the object in the form of
<database>/
- Returns:
- the first IP address from the object
Get all IP addresses from an object.
- Args:
- uci: EUci pointer
id: id of the object in the form of
<database>/
- Returns:
- a list of unique IP addresses from the object
Check if an object is a domain.
- Args:
- uci: EUci pointer
database_id: id of the object in the form of
<database>/
- Returns:
- True if object is a domain, False otherwise
Check if an object is a domain set.
- Args:
- uci: EUci pointer
id: id of the object in the form of
<database>/
- Returns:
- True if object is a domain set, False otherwise
Check if an object is a host.
- Args:
- uci: EUci pointer
database_id: id of the object in the form of
<database>/
- Returns:
- True if object is a host, False otherwise
Check if an object is a host set.
- Args:
- uci: EUci pointer
id: id of the object in the form of
<database>/
- Returns:
- True if object is a host set, False otherwise
Check if an id is an object id.
- Args:
- id: id to check
- Returns:
- True if id is an object id, False otherwise
Check if an object is a host set with a single IP address.
The IP must not be an IP range.
If allow_cidr
is True, the IP can be in CIDR notation.
- Args:
- uci: EUci pointer
database_id: id of the object in the form of
<database>/
allow_cidr: allow CIDR notation - Returns:
- True if object is a singleton host set, False otherwise
Check if domain set is used in firewall config.
- Args:
- uci: EUci pointer id: id of domain set
- Returns:
- A tuple with: - True if domain set is used in firewall config, False otherwise - a list of firewall sections where domain set is used
Check if host set is used in firewall config.
- Args:
- uci: EUci pointer id: id of host set
- Returns:
- A tuple with: - True if host set is used in firewall config, False otherwise - a list of firewall sections where host set is used
- Check if an object is used in:
- firewall config
- mwan3 config
- dpi config
- existing host set
- Args:
- uci: EUci pointer
id: id of the object in the form of
<database>/
- Returns:
- A tuple with: - True if domain set is used in firewall config, False otherwise - a list of firewall sections where domain set is used
Check if an object is a VPN user.
- Args:
- uci: EUci pointer
database_id: id of the object in the form of
<database>/
- Returns:
- True if object is a VPN user, False otherwise
Get all DHCP static leases from dhcp config
- Args:
- uci: EUci pointer expand: expand the list with all IP addresses of the object used_info: include used and matches info
- Returns:
- a list of all DHCP static leases
Get all DNS records from dhcp config
- Args:
- uci: EUci pointer expand: expand the list with all IP addresses of the object used_info: include used and matches info
- Returns:
- a list of all DNS records
Get all domain sets from objects config
- Args:
- uci: EUci pointer used_info: include used and matches info
- Returns:
- a list of all domain sets
Get all host sets from objects config
- Args:
- uci: EUci pointer used_info: include used and matches info
- Returns:
- a list of all host sets
Get objects from objects, dhcp, and users config
- Args:
- uci: EUci pointer include_domain_sets: include domain sets in the list include_host_sets: include host sets in the list expand: expand the list with all IP addresses of the object
- Returns:
- a list of all objects
Get all VPN users from users config
- Args:
- uci: EUci pointer expand: expand the list with all IP addresses of the object used_info: include used and matches info
- Returns:
- a list of all VPN users
Check if the object exists.
- Args:
- database_id: id to check in the form of
<database>/
- Returns:
- True if object exists, False otherwise