{"action":"created","issue":{"url":"https://api.github.com/repos/ipfs/go-ipfs/issues/1937","labels_url":"https://api.github.com/repos/ipfs/go-ipfs/issues/1937/labels{/name}","comments_url":"https://api.github.com/repos/ipfs/go-ipfs/issues/1937/comments","events_url":"https://api.github.com/repos/ipfs/go-ipfs/issues/1937/events","html_url":"https://github.com/ipfs/go-ipfs/pull/1937","id":114765812,"number":1937,"title":"refactor net code to use transports, in rough accordance with libp2p","user":{"login":"whyrusleeping","id":1243164,"avatar_url":"https://avatars.githubusercontent.com/u/1243164?v=3","gravatar_id":"","url":"https://api.github.com/users/whyrusleeping","html_url":"https://github.com/whyrusleeping","followers_url":"https://api.github.com/users/whyrusleeping/followers","following_url":"https://api.github.com/users/whyrusleeping/following{/other_user}","gists_url":"https://api.github.com/users/whyrusleeping/gists{/gist_id}","starred_url":"https://api.github.com/users/whyrusleeping/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/whyrusleeping/subscriptions","organizations_url":"https://api.github.com/users/whyrusleeping/orgs","repos_url":"https://api.github.com/users/whyrusleeping/repos","events_url":"https://api.github.com/users/whyrusleeping/events{/privacy}","received_events_url":"https://api.github.com/users/whyrusleeping/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/ipfs/go-ipfs/labels/in%20progress","name":"in progress","color":"ededed"}],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":6,"created_at":"2015-11-03T08:09:01Z","updated_at":"2015-11-03T18:05:04Z","closed_at":null,"pull_request":{"url":"https://api.github.com/repos/ipfs/go-ipfs/pulls/1937","html_url":"https://github.com/ipfs/go-ipfs/pull/1937","diff_url":"https://github.com/ipfs/go-ipfs/pull/1937.diff","patch_url":"https://github.com/ipfs/go-ipfs/pull/1937.patch"},"body":"refactor as discussed with @jbenet. (with a couple extra methods on the interfaces)\r\n\r\nThis has the nice effect of removing go-multiaddr-net imports from a lot of places.\r\n\r\nLicense: MIT\r\nSigned-off-by: Jeromy <jeromyj@gmail.com>"},"comment":{"url":"https://api.github.com/repos/ipfs/go-ipfs/issues/comments/153438290","html_url":"https://github.com/ipfs/go-ipfs/pull/1937#issuecomment-153438290","issue_url":"https://api.github.com/repos/ipfs/go-ipfs/issues/1937","id":153438290,"user":{"login":"cryptix","id":111202,"avatar_url":"https://avatars.githubusercontent.com/u/111202?v=3","gravatar_id":"","url":"https://api.github.com/users/cryptix","html_url":"https://github.com/cryptix","followers_url":"https://api.github.com/users/cryptix/followers","following_url":"https://api.github.com/users/cryptix/following{/other_user}","gists_url":"https://api.github.com/users/cryptix/gists{/gist_id}","starred_url":"https://api.github.com/users/cryptix/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/cryptix/subscriptions","organizations_url":"https://api.github.com/users/cryptix/orgs","repos_url":"https://api.github.com/users/cryptix/repos","events_url":"https://api.github.com/users/cryptix/events{/privacy}","received_events_url":"https://api.github.com/users/cryptix/received_events","type":"User","site_admin":false},"created_at":"2015-11-03T18:05:04Z","updated_at":"2015-11-03T18:05:04Z","body":"Couldn't you type assert to other interface in `SetTimeout` like:\r\n\r\n```go\r\n\r\nfunc SetTimeout(t time.Duration) DialOpts {\r\n\treturn func(tr *Transport) error {\r\n\t\t\r\n\t\tswitch v := tr.(type) {\r\n\t\tcase ma.Timeouter:\r\n\t\t\t_ = v.SetTimeout(t)\r\n\t\t\r\n\t\tcase net.Dialer:\r\n\t\t\td := Dialer{Timeout: timeout}\r\n\t\t\ttr.UseDialer(d)\r\n\t\t}\r\n\t}\r\n}\r\n\r\n```"}}