Preferred way to string-encode encode an address that could be a sockaddr_in, sockaddr_in6, or sockaddr_un for ProxyTarget
For hsproxy's ProxyTarget
, we want a way to write al element in our configuration file that includes an encapsulation method (eg "direct"/"pnat" or "hsrproxy") and a target address (eg "/var/run/my_service/PORT" or "127.0.0.1:9999"). @Diziet offered to figure out what the preferred way to encode the latter is.
We definitely want to be able to represent inet addresses in their usual format ("127.0.0.1:9999", "[::1]:9999") and possibly a tagged format too ("inet:127.0.1.9999"? "tcp:[::1]:9999"?). We probably want to allow tagged unix addresses like "unix:/home/foo/port"; we may want to allow untagged addresses if they start with a /
.
If there's a standard or a best practice here, let's adopt it.