dns_ip6(3)

πŸ“¦
version 0.34 Β· 2 versions
  • 0.34 Β· alpine 3.24, debian bookworm, debian trixie, nixos 26.05, nixpkgs unstable, opensuse-leap 16.0, ubuntu noble, ubuntu questing, ubuntu resolute, ubuntu stonking (latest)
  • 0.30 Β· fedora 43, fedora 44, ubuntu jammy
, in alpine 3.24, debian bookworm, debian trixie, nixos 26.05, nixpkgs unstable, opensuse-leap 16.0, ubuntu noble, ubuntu questing, ubuntu resolute, ubuntu stonking

✨ dns_ip6 β€” the glow-up where your fqdn becomes IPv6 addresses ✨

ok bestie, we're in the dns_ip6(3) zone, part of the Library Functions Manual πŸ’– this is the function you call when you want IPv6 addresses and you want them now.


πŸŽ€ NAME πŸŽ€

dns_ip6 β€” look up IPv6 addresses


🌸 SYNTAX 🌸

#include <libowfat/dns.h>

int dns_ip6(stralloc* out,stralloc* fqdn);

πŸ¦‹ DESCRIPTION πŸ¦‹

so here's the tea, dns_ip6 goes and looks up 16-byte IPv6 addresses for the fully-qualified domain name sitting in fqdn. it takes the concatenation of all those IPv6 addresses and drops them into out, then returns 0. iconic behavior honestly. 🫢

and if the domain literally doesn't exist in DNS, or it exists but has no IP addresses at all? then out will just be empty. no addresses, no drama. πŸ’€

dns_ip6 is also so thoughtful because it looks up 4-byte IPv4 addresses too and converts them into IPv4-mapped IPv6 addresses like ::ffff:1.2.3.4 β€” which gives you easy backwards compatibility for IPv6 applications. it's giving main character energy, it's giving "I got you covered." πŸ‘‘

now, if dns_ip6 hits trouble with the DNS lookup or runs out of memory, it returns -1 and sets errno appropriately. and here's the spicy part: it may or may not change out. so don't go assuming anything about out in that case, fr fr. 😭

⚠️ ngl, that "may or may not change out" thing is real β€” when it returns -1, treat out as unreliable. no cap.

and the bestie shortcut: if fqdn is already an IPv6 address, dns_ip6 puts that IP address straight into out without checking DNS. no lookup, no waiting, just vibes. ✨ IPv4 addresses are also used directly without DNS lookup. so either way, if you handed it an address, it's not gonna go bother the resolver about it. periodt. πŸ’…


🌈 SEE ALSO 🌈


and that's the whole page, bestie πŸŽ€ this lil legend lives in the Library Functions Manual and it signs off as dns_ip6(3) β€” go forth and resolve some addresses, you've got this πŸ’–πŸŒΈπŸ¦‹