Giter Club home page Giter Club logo

Comments (1)

ikropotov avatar ikropotov commented on May 24, 2024

@moshloop I was looking into this issue.
I've found that timeout for DNS checks are read from system /etc/resolv.conf file, and there is no way to set it with stdlib on runtime (except tweaking /etc/resolv.conf)
Explanation:
Here is where actual timeout for DNS call is set
https://github.com/golang/go/blob/master/src/net/dnsclient_unix.go#L153

And this exchange func is called from tryOneName
https://github.com/golang/go/blob/master/src/net/dnsclient_unix.go#L256
where timeOut is read from cfg *dnsConfig

And this call is initiated here
https://github.com/golang/go/blob/master/src/net/dnsclient_unix.go#L595
And finally the dnsConfig is read here
https://github.com/golang/go/blob/master/src/net/dnsclient_unix.go#L579

And if you carefully check that dnsConfig
https://github.com/golang/go/blob/master/src/net/dnsconfig_unix.go#L40

There is either default set for timeout
conf := &dnsConfig{
ndots: 1,
timeout: 5 * time.Second,
attempts: 2,
}

or reading it out of the hardcoded file /etc/resolv.conf
either here
https://github.com/golang/go/blob/master/src/net/dnsclient_unix.go#L337
or here
https://github.com/golang/go/blob/ca978a5ca9390dc759f20db989b49ad9cdcd81d4/src/net/conf.go#L100

So finally it gives us no option to adjust it it on runtime with any config set.

Couple of ideas is to write own dnsCheck thing, which I am not sure if worth for just having a timeout, or somehow tweak that file during calls, but I am not sure if filesystem will be quick enough for concurrent routines.

from canary-checker.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.