getdns_address(3)
π getdns_address β bestie, let's get you some IPs π
okay so this is getdns_address(3), from the getdns manual, and it's literally the glow-up you need when you've got a hostname and you're begging the universe for an address. two functions, one job. let's go β¨
πΈ NAME πΈ
getdns_address, getdns_address_sync β get ip address(es) for a name
no cap, that's the whole vibe: you give it a name, it gives you addresses. π
π LIBRARY π
DNS Resolver library (libgetdns, -lgetdns)
link against it, queen. that's the -lgetdns right there. π«Ά
β¨ SYNOPSIS β¨
#include <getdns.h>
getdns_return_t
getdns_address (getdns_context *context,
const char *name,
getdns_dict *extensions,
void *userarg,
getdns_transaction_t *transaction_id,
getdns_callback_t callbackfn)
getdns_return_t
getdns_address_sync (getdns_context *context,
const char *name,
getdns_dict *extensions,
getdns_dict **response)
two flavors, bestie: the async one that takes a callbackfn, and the sync one that just hands you a response. pick your fighter. π₯
π¦ DESCRIPTION π¦
so getdns_address(3) and getdns_address_sync are the public entry points into the getdns API library, and what they do is retrieve the address given a host name. and the way that they always return both IPv4 AND IPv6 addresses? iconic. it's giving "why choose". π
this function will use all of the namespaces from the context β and the whole reason is to better emulate getaddrinfo (3). periodt.
here's the tea on every single parameter, no skipping, i don't gatekeep:
contextβ a pointer to the previously created DNS context that's gonna be used with this DNS request. seegetdns_context(3). πnameβ the host name to resolve to an address. and heads up, bestie: note that an IP address is considered invalid here. it's a name field. respect the field. πextensionsβ extensions for this request,NULLif there's no extensions. seelibgetdns(3) for a detailed description of extensions.userargβ returned to the callback function untouched. can beNULL. it's just vibes passing through. β¨transaction_idβ populated by the API and used to identify the callback (for example, togetdns_cancel_callback). can beNULL, and it's set to0if the function fails. πcallbackfnβ a non-NULLpointer to a callback function defined by the application, typically used to process the response. only the asynchronous signature accepts a callback function; the synchronous signature does not include a callback. seelibgetdns(3) for a more detailed discussion of callback functions.responseβ agetdns_dicttype is returned inresponse, and it always contains at least three names:replies_full(a list containing the DNS response as binary data),replies_tree(a list containing the parsed DNS response data) andstatus(an int). the storage associated with this must be freed by a call togetdns_free_sync_request_memory(3).
π¨ bestie, do NOT forget that free. that memory is not gonna free itself and it's not your little meow meow. call getdns_free_sync_request_memory (3). i'm serious. π
π RETURN VALUES π
upon successful completion the functions return GETDNS_RETURN_GOOD, otherwise the following error values are returned. buckle up, there's a whole roster:
GETDNS_RETURN_BAD_CONTEXTβ if the context pointer is invalid or the context has internal deficiencies. it's giving "not that girl". πGETDNS_RETURN_BAD_DOMAIN_NAMEβ if the domain name passed to the function is invalid.GETDNS_RETURN_EXTENSION_MISFORMATβ if the data type specified in one or more of the extensions does not match the specifications.GETDNS_RETURN_GENERIC_ERRORβ if some problem was encountered in the function not addressed by one of the more specific return codes. the catch-all, the main character of error codes. πGETDNS_RETURN_INVALID PARAMETERβ if one or more parameters has an invalid value.GETDNS_RETURN_MEMORY_ERRORβ if unable to allocate the memory required.GETDNS_RETURN_NO_SUCH_EXTENSIONβ if one or more of the strings specified in the extensions are not valid.
and the values of status included in the response parameter are:
GETDNS_RESPSTATUS_GOODβ if at least one response was returned. slay. β¨GETDNS_RESPSTATUS_NO_NAMEβ if queries for the name yielded all negative responses.GETDNS_RESPSTATUS_ALL_TIMEOUTβ if all queries for the name timed out. πGETDNS_RESPSTATUS_NO_SECURE_ANSWERSβ if only secure replies accepted (per context) and at least one response was received but no DNS responses were secure through DNSSEC.
for a more detailed explanation of the response object see libgetdns (3). π
π EXAMPLES π
TBD
yeah bestie. TBD. the examples are coming, they're just running late, that's so on brand. ππ
π FILES π
/etc/hosts/etc/resolv.conf
the classic duo. the OG besties. π«Ά
π SEE ALSO π
libgetdns(3), getdns_context(3), getdns_free_sync_request_memory(3), getdns_general(3), getdns_general_sync(3), getdns_hostname(3), getdns_hostname_sync(3), getdns_service(3), getdns_service_sync(3)
go read the whole family, iykyk. πβ¨
and that's the page, bestie! this was getdns 1.7.3, dated December 2015 β yes she's vintage and she still ate. go resolve something cute. mwah. πππ¦πΈ
π¦ where this page comes from
- alpine 3.24: getdns-doc 1.7.3-r0 Β· BSD-3-Clause
- arch rolling: getdns 1.7.3-2 Β· BSD
- epel 10: getdns-devel 1.7.3-9.el10_2 Β· BSD-3-Clause
- epel 9: getdns-devel 1.7.3-1.el9 Β· BSD-3-Clause
- fedora 43: getdns-devel 1.7.3-9.fc43 Β· BSD-3-Clause
- fedora 43: getdns-devel 1.7.3-9.fc43 Β· BSD-3-Clause
- fedora 44: getdns-devel 1.7.3-10.fc44 Β· BSD-3-Clause
- fedora 44: getdns-devel 1.7.3-10.fc44 Β· BSD-3-Clause
- nixpkgs unstable: getdns 1.7.3
- ubuntu resolute: libgetdns-dev 1.7.3-3 Β· BSD-3-Clause
- ubuntu stonking: libgetdns-dev 1.7.3-5build1 Β· BSD-3-Clause
- Copyright (c) 2013, NLNet Labs, Verisign, Inc
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms