Get gateway, whether it's an IP or hostname
And add v6 versions
This commit is contained in:
parent
7629a979b4
commit
326c4a1796
14
lib.nix
14
lib.nix
|
@ -37,9 +37,19 @@ let
|
|||
attrNames
|
||||
(filterAttrs (_: hostOpts: hostOpts.domain == domain) entities.hosts);
|
||||
|
||||
getSiteGateway = site: entities.sites."${site-name}".gateway-v4;
|
||||
getSiteGatewayV4 = siteName:
|
||||
let site = config.fudo.sites."${siteName}";
|
||||
in if hasAttr "local-gateway" site then getHostIpv4 else site.gateway-v4;
|
||||
|
||||
getHostGateway = hostname: (getHostSite hostname).gateway-v4;
|
||||
getHostGatewayV4 = hostname:
|
||||
getSiteGatewayV4 config.fudo.hosts."${hostname}".site;
|
||||
|
||||
getSiteGatewayV6 = siteName:
|
||||
let site = config.fudo.sites."${siteName}";
|
||||
in if hasAttr "local-gateway" site then getHostIpv6 else site.gateway-v6;
|
||||
|
||||
getHostGatewayV6 = hostname:
|
||||
getSiteGatewayV6 config.fudo.hosts."${hostname}".site;
|
||||
|
||||
in {
|
||||
inherit getHostSite getHostDomain getHostRealm getHostFqdn getHostIpv4
|
||||
|
|
Loading…
Reference in New Issue