Files
netio1/examples/host_fqdn.v
T
2026-04-04 00:47:35 +03:00

17 lines
411 B
V

import netio
import os
fn main() {
// Resolve the fully qualified domain name for host.
// This programm is analog for `hostname -f` command.
hostname := os.hostname()!
ai := netio.translate_addr(node: hostname, flags: netio.ai_canonname)!
mut fqdn := ''
for a in ai {
// Not needed to iterate over all entries, return the first one per getaddrinfo(3).
fqdn = a.canonical
break
}
println(fqdn)
}