services: support 0.0.0.0/:: in address options

Previously, client services didn't decode these special INADDR_ANY
addresses and failed to connect.
This commit is contained in:
Erik Arvstedt
2021-10-01 11:51:57 +02:00
parent 1848c3dd98
commit f61e928139
13 changed files with 36 additions and 23 deletions

View File

@@ -83,4 +83,17 @@ let self = {
map = [ map ];
version = 3;
};
# Convert a bind address, which may be a special INADDR_ANY address,
# to an actual IP address
address = addr:
if addr == "0.0.0.0" then
"127.0.0.1"
else if addr == "::" then
"::1"
else
addr;
addressWithPort = addr: port: "${self.address addr}:${toString port}";
}; in self