{"action":"created","issue":{"url":"https://api.github.com/repos/rust-lang/rust/issues/24250","labels_url":"https://api.github.com/repos/rust-lang/rust/issues/24250/labels{/name}","comments_url":"https://api.github.com/repos/rust-lang/rust/issues/24250/comments","events_url":"https://api.github.com/repos/rust-lang/rust/issues/24250/events","html_url":"https://github.com/rust-lang/rust/issues/24250","id":67463378,"number":24250,"title":"std::net::lookup_host repeats output","user":{"login":"nieksand","id":1396037,"avatar_url":"https://avatars.githubusercontent.com/u/1396037?v=3","gravatar_id":"","url":"https://api.github.com/users/nieksand","html_url":"https://github.com/nieksand","followers_url":"https://api.github.com/users/nieksand/followers","following_url":"https://api.github.com/users/nieksand/following{/other_user}","gists_url":"https://api.github.com/users/nieksand/gists{/gist_id}","starred_url":"https://api.github.com/users/nieksand/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/nieksand/subscriptions","organizations_url":"https://api.github.com/users/nieksand/orgs","repos_url":"https://api.github.com/users/nieksand/repos","events_url":"https://api.github.com/users/nieksand/events{/privacy}","received_events_url":"https://api.github.com/users/nieksand/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/rust-lang/rust/labels/A-io","name":"A-io","color":"d7e102"}],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":1,"created_at":"2015-04-09T22:23:50Z","updated_at":"2015-04-13T07:07:16Z","closed_at":null,"body":"Using std::net::lookup_host seems to duplicate each IP in the result set.\r\n```\r\nprompt> ./main rust-lang.org\r\nV4(72.8.141.90:0)\r\nV4(72.8.141.90:0)\r\n\r\nprompt> ./main google.com | sort\r\nV4(74.125.28.100:0)\r\nV4(74.125.28.100:0)\r\nV4(74.125.28.101:0)\r\nV4(74.125.28.101:0)\r\nV4(74.125.28.102:0)\r\nV4(74.125.28.102:0)\r\nV4(74.125.28.113:0)\r\nV4(74.125.28.113:0)\r\nV4(74.125.28.138:0)\r\nV4(74.125.28.138:0)\r\nV4(74.125.28.139:0)\r\nV4(74.125.28.139:0)\r\nV6([2607:f8b0:400e:c04::66]:0)\r\nV6([2607:f8b0:400e:c04::66]:0)\r\n```\r\n\r\nThe documentation snippet (https://doc.rust-lang.org/std/net/fn.lookup_host.html) is enough to reproduce. \r\n\r\nI also have a simple gist here:  https://gist.github.com/nieksand/9c42100be6dc52df3305\r\n\r\nI'm using the latest Rust from master branch on MacOS X 10.9.5.  I have not checked on other platforms.  I see this for any hostname that I try, so I don't think it's a problem on the nameserver side.\r\n\r\nExpected behavior is seeing each IP address listed only once."},"comment":{"url":"https://api.github.com/repos/rust-lang/rust/issues/comments/92240152","html_url":"https://github.com/rust-lang/rust/issues/24250#issuecomment-92240152","issue_url":"https://api.github.com/repos/rust-lang/rust/issues/24250","id":92240152,"user":{"login":"imron","id":1484640,"avatar_url":"https://avatars.githubusercontent.com/u/1484640?v=3","gravatar_id":"","url":"https://api.github.com/users/imron","html_url":"https://github.com/imron","followers_url":"https://api.github.com/users/imron/followers","following_url":"https://api.github.com/users/imron/following{/other_user}","gists_url":"https://api.github.com/users/imron/gists{/gist_id}","starred_url":"https://api.github.com/users/imron/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/imron/subscriptions","organizations_url":"https://api.github.com/users/imron/orgs","repos_url":"https://api.github.com/users/imron/repos","events_url":"https://api.github.com/users/imron/events{/privacy}","received_events_url":"https://api.github.com/users/imron/received_events","type":"User","site_admin":false},"created_at":"2015-04-13T07:07:16Z","updated_at":"2015-04-13T07:07:16Z","body":"This is happening because the underlying call to getaddrinfo doesn't provide an addrinfo as a hint, and so the linked list of returned addrinfo structs contains addrinfo for both TCP and UDP protocols.\r\n\r\nA simple fix would be to simply pass in a hint specifying only one protocol (e.g. TCP)\r\n\r\nHowever I'm not sure how often you'll find a hostname that has UDP available but not TCP and vice versa, and whether or not it's worth capturing that with something like LookupHostUdp and LookupHostTcp."}}