{"action":"opened","number":288,"pull_request":{"url":"https://api.github.com/repos/shadowsocks/shadowsocks/pulls/288","id":28791221,"html_url":"https://github.com/shadowsocks/shadowsocks/pull/288","diff_url":"https://github.com/shadowsocks/shadowsocks/pull/288.diff","patch_url":"https://github.com/shadowsocks/shadowsocks/pull/288.patch","issue_url":"https://api.github.com/repos/shadowsocks/shadowsocks/issues/288","number":288,"state":"open","locked":false,"title":"Add random choice in asyncdns.py","user":{"login":"warriorpaw","id":3822240,"avatar_url":"https://avatars.githubusercontent.com/u/3822240?v=3","gravatar_id":"","url":"https://api.github.com/users/warriorpaw","html_url":"https://github.com/warriorpaw","followers_url":"https://api.github.com/users/warriorpaw/followers","following_url":"https://api.github.com/users/warriorpaw/following{/other_user}","gists_url":"https://api.github.com/users/warriorpaw/gists{/gist_id}","starred_url":"https://api.github.com/users/warriorpaw/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/warriorpaw/subscriptions","organizations_url":"https://api.github.com/users/warriorpaw/orgs","repos_url":"https://api.github.com/users/warriorpaw/repos","events_url":"https://api.github.com/users/warriorpaw/events{/privacy}","received_events_url":"https://api.github.com/users/warriorpaw/received_events","type":"User","site_admin":false},"body":"当一个域名中下面有多个记录，以前的asyncdns.py是只使用第一条记录，客户端使用域名连接服务器的时候，别的IP都浪费了，并且现在的VPS基本都会给N个IPV6地址\r\n所以修改了一下，保留全部记录，给callback的时候random.choice随机选一个出来，开销应该可以忽略不计吧。\r\n\r\n例如 ，按照下面这个域名DIG的结果，以前代码永远都只使用“2405:4200:2:3::1:1”去连接\r\n; <<>> DiG 9.9.5-3ubuntu0.1-Ubuntu <<>> aaaa ipv6.xxxxx.com\r\n;; global options: +cmd\r\n;; Got answer:\r\n;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 38503\r\n;; flags: qr rd ra; QUERY: 1, ANSWER: 3, AUTHORITY: 0, ADDITIONAL: 1\r\n\r\n;; OPT PSEUDOSECTION:\r\n; EDNS: version: 0, flags:; udp: 512\r\n;; QUESTION SECTION:\r\n;ipv6.xxxxx.com.\t\tIN\tAAAA\r\n\r\n;; ANSWER SECTION:\r\nipv6.xxxxx.com.\t2912\tIN\tAAAA\t2405:4200:2:3::1:1\r\nipv6.xxxxx.com.\t2912\tIN\tAAAA\t2405:4200:2:3::1:2\r\nipv6.xxxxx.com.\t2912\tIN\tAAAA\t2405:4200:2:3::1:3\r\n\r\n;; Query time: 365 msec\r\n;; SERVER: 127.0.0.1#53(127.0.0.1)\r\n;; WHEN: Fri Feb 06 15:45:25 CST 2015\r\n;; MSG SIZE  rcvd: 132\r\n","created_at":"2015-02-06T08:04:35Z","updated_at":"2015-02-06T08:04:35Z","closed_at":null,"merged_at":null,"merge_commit_sha":null,"assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/shadowsocks/shadowsocks/pulls/288/commits","review_comments_url":"https://api.github.com/repos/shadowsocks/shadowsocks/pulls/288/comments","review_comment_url":"https://api.github.com/repos/shadowsocks/shadowsocks/pulls/comments/{number}","comments_url":"https://api.github.com/repos/shadowsocks/shadowsocks/issues/288/comments","statuses_url":"https://api.github.com/repos/shadowsocks/shadowsocks/statuses/0e3e9776fdfc252b152824232051e83613eddecc","head":{"label":"warriorpaw:master","ref":"master","sha":"0e3e9776fdfc252b152824232051e83613eddecc","user":{"login":"warriorpaw","id":3822240,"avatar_url":"https://avatars.githubusercontent.com/u/3822240?v=3","gravatar_id":"","url":"https://api.github.com/users/warriorpaw","html_url":"https://github.com/warriorpaw","followers_url":"https://api.github.com/users/warriorpaw/followers","following_url":"https://api.github.com/users/warriorpaw/following{/other_user}","gists_url":"https://api.github.com/users/warriorpaw/gists{/gist_id}","starred_url":"https://api.github.com/users/warriorpaw/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/warriorpaw/subscriptions","organizations_url":"https://api.github.com/users/warriorpaw/orgs","repos_url":"https://api.github.com/users/warriorpaw/repos","events_url":"https://api.github.com/users/warriorpaw/events{/privacy}","received_events_url":"https://api.github.com/users/warriorpaw/received_events","type":"User","site_admin":false},"repo":{"id":30400236,"name":"shadowsocks","full_name":"warriorpaw/shadowsocks","owner":{"login":"warriorpaw","id":3822240,"avatar_url":"https://avatars.githubusercontent.com/u/3822240?v=3","gravatar_id":"","url":"https://api.github.com/users/warriorpaw","html_url":"https://github.com/warriorpaw","followers_url":"https://api.github.com/users/warriorpaw/followers","following_url":"https://api.github.com/users/warriorpaw/following{/other_user}","gists_url":"https://api.github.com/users/warriorpaw/gists{/gist_id}","starred_url":"https://api.github.com/users/warriorpaw/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/warriorpaw/subscriptions","organizations_url":"https://api.github.com/users/warriorpaw/orgs","repos_url":"https://api.github.com/users/warriorpaw/repos","events_url":"https://api.github.com/users/warriorpaw/events{/privacy}","received_events_url":"https://api.github.com/users/warriorpaw/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/warriorpaw/shadowsocks","description":"A fast tunnel proxy that helps you bypass firewalls","fork":true,"url":"https://api.github.com/repos/warriorpaw/shadowsocks","forks_url":"https://api.github.com/repos/warriorpaw/shadowsocks/forks","keys_url":"https://api.github.com/repos/warriorpaw/shadowsocks/keys{/key_id}","collaborators_url":"https://api.github.com/repos/warriorpaw/shadowsocks/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/warriorpaw/shadowsocks/teams","hooks_url":"https://api.github.com/repos/warriorpaw/shadowsocks/hooks","issue_events_url":"https://api.github.com/repos/warriorpaw/shadowsocks/issues/events{/number}","events_url":"https://api.github.com/repos/warriorpaw/shadowsocks/events","assignees_url":"https://api.github.com/repos/warriorpaw/shadowsocks/assignees{/user}","branches_url":"https://api.github.com/repos/warriorpaw/shadowsocks/branches{/branch}","tags_url":"https://api.github.com/repos/warriorpaw/shadowsocks/tags","blobs_url":"https://api.github.com/repos/warriorpaw/shadowsocks/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/warriorpaw/shadowsocks/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/warriorpaw/shadowsocks/git/refs{/sha}","trees_url":"https://api.github.com/repos/warriorpaw/shadowsocks/git/trees{/sha}","statuses_url":"https://api.github.com/repos/warriorpaw/shadowsocks/statuses/{sha}","languages_url":"https://api.github.com/repos/warriorpaw/shadowsocks/languages","stargazers_url":"https://api.github.com/repos/warriorpaw/shadowsocks/stargazers","contributors_url":"https://api.github.com/repos/warriorpaw/shadowsocks/contributors","subscribers_url":"https://api.github.com/repos/warriorpaw/shadowsocks/subscribers","subscription_url":"https://api.github.com/repos/warriorpaw/shadowsocks/subscription","commits_url":"https://api.github.com/repos/warriorpaw/shadowsocks/commits{/sha}","git_commits_url":"https://api.github.com/repos/warriorpaw/shadowsocks/git/commits{/sha}","comments_url":"https://api.github.com/repos/warriorpaw/shadowsocks/comments{/number}","issue_comment_url":"https://api.github.com/repos/warriorpaw/shadowsocks/issues/comments/{number}","contents_url":"https://api.github.com/repos/warriorpaw/shadowsocks/contents/{+path}","compare_url":"https://api.github.com/repos/warriorpaw/shadowsocks/compare/{base}...{head}","merges_url":"https://api.github.com/repos/warriorpaw/shadowsocks/merges","archive_url":"https://api.github.com/repos/warriorpaw/shadowsocks/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/warriorpaw/shadowsocks/downloads","issues_url":"https://api.github.com/repos/warriorpaw/shadowsocks/issues{/number}","pulls_url":"https://api.github.com/repos/warriorpaw/shadowsocks/pulls{/number}","milestones_url":"https://api.github.com/repos/warriorpaw/shadowsocks/milestones{/number}","notifications_url":"https://api.github.com/repos/warriorpaw/shadowsocks/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/warriorpaw/shadowsocks/labels{/name}","releases_url":"https://api.github.com/repos/warriorpaw/shadowsocks/releases{/id}","created_at":"2015-02-06T07:16:32Z","updated_at":"2015-02-06T07:38:43Z","pushed_at":"2015-02-06T07:38:41Z","git_url":"git://github.com/warriorpaw/shadowsocks.git","ssh_url":"git@github.com:warriorpaw/shadowsocks.git","clone_url":"https://github.com/warriorpaw/shadowsocks.git","svn_url":"https://github.com/warriorpaw/shadowsocks","homepage":"","size":3504,"stargazers_count":0,"watchers_count":0,"language":"Python","has_issues":false,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":0,"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"shadowsocks:master","ref":"master","sha":"e71ce6c758643f06c05de06d5dd10cb7fe205378","user":{"login":"shadowsocks","id":3006190,"avatar_url":"https://avatars.githubusercontent.com/u/3006190?v=3","gravatar_id":"","url":"https://api.github.com/users/shadowsocks","html_url":"https://github.com/shadowsocks","followers_url":"https://api.github.com/users/shadowsocks/followers","following_url":"https://api.github.com/users/shadowsocks/following{/other_user}","gists_url":"https://api.github.com/users/shadowsocks/gists{/gist_id}","starred_url":"https://api.github.com/users/shadowsocks/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/shadowsocks/subscriptions","organizations_url":"https://api.github.com/users/shadowsocks/orgs","repos_url":"https://api.github.com/users/shadowsocks/repos","events_url":"https://api.github.com/users/shadowsocks/events{/privacy}","received_events_url":"https://api.github.com/users/shadowsocks/received_events","type":"Organization","site_admin":false},"repo":{"id":4086616,"name":"shadowsocks","full_name":"shadowsocks/shadowsocks","owner":{"login":"shadowsocks","id":3006190,"avatar_url":"https://avatars.githubusercontent.com/u/3006190?v=3","gravatar_id":"","url":"https://api.github.com/users/shadowsocks","html_url":"https://github.com/shadowsocks","followers_url":"https://api.github.com/users/shadowsocks/followers","following_url":"https://api.github.com/users/shadowsocks/following{/other_user}","gists_url":"https://api.github.com/users/shadowsocks/gists{/gist_id}","starred_url":"https://api.github.com/users/shadowsocks/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/shadowsocks/subscriptions","organizations_url":"https://api.github.com/users/shadowsocks/orgs","repos_url":"https://api.github.com/users/shadowsocks/repos","events_url":"https://api.github.com/users/shadowsocks/events{/privacy}","received_events_url":"https://api.github.com/users/shadowsocks/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/shadowsocks/shadowsocks","description":"A fast tunnel proxy that helps you bypass firewalls","fork":false,"url":"https://api.github.com/repos/shadowsocks/shadowsocks","forks_url":"https://api.github.com/repos/shadowsocks/shadowsocks/forks","keys_url":"https://api.github.com/repos/shadowsocks/shadowsocks/keys{/key_id}","collaborators_url":"https://api.github.com/repos/shadowsocks/shadowsocks/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/shadowsocks/shadowsocks/teams","hooks_url":"https://api.github.com/repos/shadowsocks/shadowsocks/hooks","issue_events_url":"https://api.github.com/repos/shadowsocks/shadowsocks/issues/events{/number}","events_url":"https://api.github.com/repos/shadowsocks/shadowsocks/events","assignees_url":"https://api.github.com/repos/shadowsocks/shadowsocks/assignees{/user}","branches_url":"https://api.github.com/repos/shadowsocks/shadowsocks/branches{/branch}","tags_url":"https://api.github.com/repos/shadowsocks/shadowsocks/tags","blobs_url":"https://api.github.com/repos/shadowsocks/shadowsocks/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/shadowsocks/shadowsocks/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/shadowsocks/shadowsocks/git/refs{/sha}","trees_url":"https://api.github.com/repos/shadowsocks/shadowsocks/git/trees{/sha}","statuses_url":"https://api.github.com/repos/shadowsocks/shadowsocks/statuses/{sha}","languages_url":"https://api.github.com/repos/shadowsocks/shadowsocks/languages","stargazers_url":"https://api.github.com/repos/shadowsocks/shadowsocks/stargazers","contributors_url":"https://api.github.com/repos/shadowsocks/shadowsocks/contributors","subscribers_url":"https://api.github.com/repos/shadowsocks/shadowsocks/subscribers","subscription_url":"https://api.github.com/repos/shadowsocks/shadowsocks/subscription","commits_url":"https://api.github.com/repos/shadowsocks/shadowsocks/commits{/sha}","git_commits_url":"https://api.github.com/repos/shadowsocks/shadowsocks/git/commits{/sha}","comments_url":"https://api.github.com/repos/shadowsocks/shadowsocks/comments{/number}","issue_comment_url":"https://api.github.com/repos/shadowsocks/shadowsocks/issues/comments/{number}","contents_url":"https://api.github.com/repos/shadowsocks/shadowsocks/contents/{+path}","compare_url":"https://api.github.com/repos/shadowsocks/shadowsocks/compare/{base}...{head}","merges_url":"https://api.github.com/repos/shadowsocks/shadowsocks/merges","archive_url":"https://api.github.com/repos/shadowsocks/shadowsocks/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/shadowsocks/shadowsocks/downloads","issues_url":"https://api.github.com/repos/shadowsocks/shadowsocks/issues{/number}","pulls_url":"https://api.github.com/repos/shadowsocks/shadowsocks/pulls{/number}","milestones_url":"https://api.github.com/repos/shadowsocks/shadowsocks/milestones{/number}","notifications_url":"https://api.github.com/repos/shadowsocks/shadowsocks/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/shadowsocks/shadowsocks/labels{/name}","releases_url":"https://api.github.com/repos/shadowsocks/shadowsocks/releases{/id}","created_at":"2012-04-20T13:10:49Z","updated_at":"2015-02-06T07:35:10Z","pushed_at":"2015-02-03T10:45:59Z","git_url":"git://github.com/shadowsocks/shadowsocks.git","ssh_url":"git@github.com:shadowsocks/shadowsocks.git","clone_url":"https://github.com/shadowsocks/shadowsocks.git","svn_url":"https://github.com/shadowsocks/shadowsocks","homepage":"","size":3504,"stargazers_count":5763,"watchers_count":5763,"language":"Python","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":1198,"mirror_url":null,"open_issues_count":7,"forks":1198,"open_issues":7,"watchers":5763,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/shadowsocks/shadowsocks/pulls/288"},"html":{"href":"https://github.com/shadowsocks/shadowsocks/pull/288"},"issue":{"href":"https://api.github.com/repos/shadowsocks/shadowsocks/issues/288"},"comments":{"href":"https://api.github.com/repos/shadowsocks/shadowsocks/issues/288/comments"},"review_comments":{"href":"https://api.github.com/repos/shadowsocks/shadowsocks/pulls/288/comments"},"review_comment":{"href":"https://api.github.com/repos/shadowsocks/shadowsocks/pulls/comments/{number}"},"commits":{"href":"https://api.github.com/repos/shadowsocks/shadowsocks/pulls/288/commits"},"statuses":{"href":"https://api.github.com/repos/shadowsocks/shadowsocks/statuses/0e3e9776fdfc252b152824232051e83613eddecc"}},"merged":false,"mergeable":null,"mergeable_state":"unknown","merged_by":null,"comments":0,"review_comments":0,"commits":1,"additions":5,"deletions":6,"changed_files":1}}