No DNS TTL information in net.LookupSRV()

571 views
Skip to first unread message

fyodor

unread,
Apr 13, 2016, 3:46:24 PM4/13/16
to golang-nuts
Is there a way to obtain TTL information from through the DNS lookup methods in the net package?

I'm implementing a component that uses SRV records from a DNS server and i noticed TTL number aren't returned with the net.LookupSRV function.


The TTL information is in the DNS header returned in the response but i can't see a way just getting the header.


Would it be worth my while to implement something for this and submit this for inclusion in a forthcoming release of Go?

Thx!

Ian Lance Taylor

unread,
Apr 13, 2016, 4:45:48 PM4/13/16
to fyodor, golang-nuts
On Wed, Apr 13, 2016 at 12:31 PM, fyodor <stefank...@gmail.com> wrote:
> Is there a way to obtain TTL information from through the DNS lookup methods
> in the net package?

Not at present.

> I'm implementing a component that uses SRV records from a DNS server and i
> noticed TTL number aren't returned with the net.LookupSRV function.
>
> https://github.com/golang/go/blob/0104a31b8fbcbe52728a08867b26415d282c35d2/src/net/dnsclient.go#L187
>
> The TTL information is in the DNS header returned in the response but i
> can't see a way just getting the header.
>
> https://github.com/golang/go/blob/master/src/net/dnsmsg.go#L126
>
> Would it be worth my while to implement something for this and submit this
> for inclusion in a forthcoming release of Go?

It seems reasonable to me. You should your API proposal to golang-dev
before you much time into it.

Ian

sandro....@gmail.com

unread,
Oct 8, 2016, 9:45:17 AM10/8/16
to golang-nuts, stefank...@gmail.com

Did anything move on this front ? I've the same problem, in look for a TTL value for my lookups...

--strk;

Varun Ahluwalia

unread,
May 26, 2023, 3:45:37 PM5/26/23
to golang-nuts
Is there a TTL support in GoLang DNS, or if it was implemented in a later release, please suggest.
Thanks,

TheDiveO

unread,
May 28, 2023, 10:46:46 AM5/28/23
to golang-nuts
would https://pkg.go.dev/github.com/miekg/dns be an option instead of the std lib?
Reply all
Reply to author
Forward
0 new messages