upd2
This commit is contained in:
@@ -0,0 +1,16 @@
|
||||
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)
|
||||
}
|
||||
Reference in New Issue
Block a user