network
network
¶
Rootless networking helpers.
The slirp4netns gateway and resolv.conf parsing live here so
nothing in the firewall path has to reach into the broader podman_info
package just to derive a host address or DNS server.
slirp4netns_gateway(cidr=None)
¶
Compute the slirp4netns gateway address (CIDR base + 2).
Reads containers.conf for a cidr= override when cidr is None.
Falls back to the default CIDR on malformed input.
Source code in src/terok_shield/podman_info/network.py
parse_slirp4netns_cidr()
¶
Read the slirp4netns CIDR from containers.conf, or return the default.
User config (XDG) is checked first in rootless mode, then system paths.
When running as root, user config is skipped to prevent untrusted
XDG_CONFIG_HOME from influencing firewall rules.
Source code in src/terok_shield/podman_info/network.py
parse_resolv_conf(text)
¶
Extract the first nameserver address from resolv.conf content.
Returns an empty string if no valid nameserver line is found.