{"action":"created","issue":{"url":"https://api.github.com/repos/golang/go/issues/12476","labels_url":"https://api.github.com/repos/golang/go/issues/12476/labels{/name}","comments_url":"https://api.github.com/repos/golang/go/issues/12476/comments","events_url":"https://api.github.com/repos/golang/go/issues/12476/events","html_url":"https://github.com/golang/go/issues/12476","id":104717175,"number":12476,"title":"net: I would like Dialer.Dial to provide the time it took to do DNS lookups and TCP Connect","user":{"login":"sajal","id":25007,"avatar_url":"https://avatars.githubusercontent.com/u/25007?v=3","gravatar_id":"","url":"https://api.github.com/users/sajal","html_url":"https://github.com/sajal","followers_url":"https://api.github.com/users/sajal/followers","following_url":"https://api.github.com/users/sajal/following{/other_user}","gists_url":"https://api.github.com/users/sajal/gists{/gist_id}","starred_url":"https://api.github.com/users/sajal/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/sajal/subscriptions","organizations_url":"https://api.github.com/users/sajal/orgs","repos_url":"https://api.github.com/users/sajal/repos","events_url":"https://api.github.com/users/sajal/events{/privacy}","received_events_url":"https://api.github.com/users/sajal/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":null,"milestone":{"url":"https://api.github.com/repos/golang/go/milestones/6","html_url":"https://github.com/golang/go/milestones/Unplanned","labels_url":"https://api.github.com/repos/golang/go/milestones/6/labels","id":1055141,"number":6,"title":"Unplanned","description":"No plan to fix in any specific release.\r\n","creator":{"login":"rsc","id":104030,"avatar_url":"https://avatars.githubusercontent.com/u/104030?v=3","gravatar_id":"","url":"https://api.github.com/users/rsc","html_url":"https://github.com/rsc","followers_url":"https://api.github.com/users/rsc/followers","following_url":"https://api.github.com/users/rsc/following{/other_user}","gists_url":"https://api.github.com/users/rsc/gists{/gist_id}","starred_url":"https://api.github.com/users/rsc/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/rsc/subscriptions","organizations_url":"https://api.github.com/users/rsc/orgs","repos_url":"https://api.github.com/users/rsc/repos","events_url":"https://api.github.com/users/rsc/events{/privacy}","received_events_url":"https://api.github.com/users/rsc/received_events","type":"User","site_admin":false},"open_issues":1039,"closed_issues":84,"state":"open","created_at":"2015-04-06T20:47:19Z","updated_at":"2015-09-03T16:26:14Z","due_on":"2099-12-31T05:00:00Z","closed_at":null},"comments":4,"created_at":"2015-09-03T15:08:30Z","updated_at":"2015-09-03T19:59:25Z","closed_at":"2015-09-03T15:31:59Z","body":"When using Dialer.Dial package, I would like to know how long did the DNS queries take to resolve. The reason to know this is because I am building a network debugging tool - [TurboBytes Pulse](https://pulse.turbobytes.com/).\r\n\r\nMy ugly hacky implementation : https://github.com/turbobytes/pulse/blob/master/misc/patch_dialtimer.go\r\n\r\nI place the file above inside net package and it provides me the DNS and Connect timings, but it is not nice to ask users of my tool to patch their Go distribution.\r\n\r\nI would be nice if Go would provide an alternate Dial method which provides timing data for various steps, as well as some debugging information about DualStack handling, failovers, etc.\r\n\r\nPerhaps change Dial's signature to :-\r\n\r\n    type DialDebugInfo struct {\r\n         DNSTime         time.Duration\r\n         ConnectTime   time.Duration\r\n         //Other fields ...\r\n    }\r\n\r\n    func (d *Dialer) Dial(network, address string, debug *DialDebugInfo) (Conn, error)\r\n\r\nIf debug is non-nill, then populate it with all sorts of useful information. \r\n"},"comment":{"url":"https://api.github.com/repos/golang/go/issues/comments/137557979","html_url":"https://github.com/golang/go/issues/12476#issuecomment-137557979","issue_url":"https://api.github.com/repos/golang/go/issues/12476","id":137557979,"user":{"login":"bradfitz","id":2621,"avatar_url":"https://avatars.githubusercontent.com/u/2621?v=3","gravatar_id":"","url":"https://api.github.com/users/bradfitz","html_url":"https://github.com/bradfitz","followers_url":"https://api.github.com/users/bradfitz/followers","following_url":"https://api.github.com/users/bradfitz/following{/other_user}","gists_url":"https://api.github.com/users/bradfitz/gists{/gist_id}","starred_url":"https://api.github.com/users/bradfitz/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/bradfitz/subscriptions","organizations_url":"https://api.github.com/users/bradfitz/orgs","repos_url":"https://api.github.com/users/bradfitz/repos","events_url":"https://api.github.com/users/bradfitz/events{/privacy}","received_events_url":"https://api.github.com/users/bradfitz/received_events","type":"User","site_admin":false},"created_at":"2015-09-03T19:59:25Z","updated_at":"2015-09-03T19:59:25Z","body":"Perhaps `net.Dialer` could have an optional `Resolver`, akin to how `http.Client` has an optional `Transport`, or `http.Server` has an optional ErrorLog`, etc."}}