{"action":"created","comment":{"url":"https://api.github.com/repos/bluejekyll/trust-dns/pulls/comments/140263265","pull_request_review_id":64309988,"id":140263265,"diff_hunk":"@@ -0,0 +1,55 @@\n+use std::io;\n+use std::str::FromStr;\n+use std::net::SocketAddr;\n+\n+use ipconfig::get_adapters;\n+use ipconfig::computer::{get_search_list, get_domain, is_round_robin_enabled};\n+\n+use trust_dns::rr::Name;\n+use config::{ResolverConfig, ResolverOpts, NameServerConfig, Protocol};\n+\n+\n+macro_rules! map_ipconfig_to_io_error {\n+    ($result:expr) => ($result.map_err(|e| io::Error::new(io::ErrorKind::Other, Box::new(e))));\n+}\n+\n+/// Returns the name servers of the computer (of all adapters)\n+fn get_name_servers() -> io::Result<Vec<NameServerConfig>> {\n+    let adapters = map_ipconfig_to_io_error!(get_adapters())?;\n+    let name_servers = adapters\n+        .iter()\n+        .flat_map(|adapter| adapter.dns_servers().iter())\n+        .map(|ipaddr| {\n+                 NameServerConfig {\n+                     socket_addr: SocketAddr::new(*ipaddr, 53),\n+                     protocol: Protocol::Udp,\n+                 }\n+             })\n+        .collect::<Vec<NameServerConfig>>();\n+\n+    Ok(name_servers)\n+}\n+\n+pub(crate) fn read_system_conf() -> io::Result<(ResolverConfig, ResolverOpts)> {\n+    let name_servers = get_name_servers()?;\n+\n+    let search_list: Vec<Name> = map_ipconfig_to_io_error!(get_search_list())?\n+        .iter()\n+        .map(|x| Name::from_str(x))\n+        .collect::<Result<Vec<_>, _>>()?;\n+\n+    let domain = match map_ipconfig_to_io_error!(get_domain())? {\n+        Some(domain) => Name::from_str(&domain)?,\n+        None => Name::root(),\n+    };\n+\n+    let config = ResolverConfig::from_parts(domain, search_list, name_servers);\n+\n+    let rotate = map_ipconfig_to_io_error!(is_round_robin_enabled())?;","path":"resolver/src/system_conf/windows.rs","position":48,"original_position":48,"commit_id":"d4feb57e2d21a65a243d7b5130fe31e9e6cb40ca","original_commit_id":"d4feb57e2d21a65a243d7b5130fe31e9e6cb40ca","user":{"login":"liranringel","id":5730310,"avatar_url":"https://avatars1.githubusercontent.com/u/5730310?v=4","gravatar_id":"","url":"https://api.github.com/users/liranringel","html_url":"https://github.com/liranringel","followers_url":"https://api.github.com/users/liranringel/followers","following_url":"https://api.github.com/users/liranringel/following{/other_user}","gists_url":"https://api.github.com/users/liranringel/gists{/gist_id}","starred_url":"https://api.github.com/users/liranringel/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/liranringel/subscriptions","organizations_url":"https://api.github.com/users/liranringel/orgs","repos_url":"https://api.github.com/users/liranringel/repos","events_url":"https://api.github.com/users/liranringel/events{/privacy}","received_events_url":"https://api.github.com/users/liranringel/received_events","type":"User","site_admin":false},"body":"Yes I think it's the only one (that is documented). I took it from here: https://technet.microsoft.com/en-us/library/dd197418(v=ws.10).aspx\r\n","created_at":"2017-09-21T14:46:00Z","updated_at":"2017-09-21T14:46:00Z","html_url":"https://github.com/bluejekyll/trust-dns/pull/172#discussion_r140263265","pull_request_url":"https://api.github.com/repos/bluejekyll/trust-dns/pulls/172","author_association":"CONTRIBUTOR","_links":{"self":{"href":"https://api.github.com/repos/bluejekyll/trust-dns/pulls/comments/140263265"},"html":{"href":"https://github.com/bluejekyll/trust-dns/pull/172#discussion_r140263265"},"pull_request":{"href":"https://api.github.com/repos/bluejekyll/trust-dns/pulls/172"}},"in_reply_to_id":140150997},"pull_request":{"url":"https://api.github.com/repos/bluejekyll/trust-dns/pulls/172","id":134276474,"html_url":"https://github.com/bluejekyll/trust-dns/pull/172","diff_url":"https://github.com/bluejekyll/trust-dns/pull/172.diff","patch_url":"https://github.com/bluejekyll/trust-dns/pull/172.patch","issue_url":"https://api.github.com/repos/bluejekyll/trust-dns/issues/172","number":172,"state":"open","locked":false,"title":"Get the system configuration on windows","user":{"login":"liranringel","id":5730310,"avatar_url":"https://avatars1.githubusercontent.com/u/5730310?v=4","gravatar_id":"","url":"https://api.github.com/users/liranringel","html_url":"https://github.com/liranringel","followers_url":"https://api.github.com/users/liranringel/followers","following_url":"https://api.github.com/users/liranringel/following{/other_user}","gists_url":"https://api.github.com/users/liranringel/gists{/gist_id}","starred_url":"https://api.github.com/users/liranringel/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/liranringel/subscriptions","organizations_url":"https://api.github.com/users/liranringel/orgs","repos_url":"https://api.github.com/users/liranringel/repos","events_url":"https://api.github.com/users/liranringel/events{/privacy}","received_events_url":"https://api.github.com/users/liranringel/received_events","type":"User","site_admin":false},"body":"Currently it gets only the basic configuration (domain, search list, ipv4 name servers).\r\n\r\nSolves #171 ","created_at":"2017-08-05T02:33:30Z","updated_at":"2017-09-21T14:46:00Z","closed_at":null,"merged_at":null,"merge_commit_sha":"851a664f90292f66ca0d06c628aa0321f3cec682","assignee":null,"assignees":[],"requested_reviewers":[],"milestone":null,"commits_url":"https://api.github.com/repos/bluejekyll/trust-dns/pulls/172/commits","review_comments_url":"https://api.github.com/repos/bluejekyll/trust-dns/pulls/172/comments","review_comment_url":"https://api.github.com/repos/bluejekyll/trust-dns/pulls/comments{/number}","comments_url":"https://api.github.com/repos/bluejekyll/trust-dns/issues/172/comments","statuses_url":"https://api.github.com/repos/bluejekyll/trust-dns/statuses/d4feb57e2d21a65a243d7b5130fe31e9e6cb40ca","head":{"label":"liranringel:windows-dns-config","ref":"windows-dns-config","sha":"d4feb57e2d21a65a243d7b5130fe31e9e6cb40ca","user":{"login":"liranringel","id":5730310,"avatar_url":"https://avatars1.githubusercontent.com/u/5730310?v=4","gravatar_id":"","url":"https://api.github.com/users/liranringel","html_url":"https://github.com/liranringel","followers_url":"https://api.github.com/users/liranringel/followers","following_url":"https://api.github.com/users/liranringel/following{/other_user}","gists_url":"https://api.github.com/users/liranringel/gists{/gist_id}","starred_url":"https://api.github.com/users/liranringel/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/liranringel/subscriptions","organizations_url":"https://api.github.com/users/liranringel/orgs","repos_url":"https://api.github.com/users/liranringel/repos","events_url":"https://api.github.com/users/liranringel/events{/privacy}","received_events_url":"https://api.github.com/users/liranringel/received_events","type":"User","site_admin":false},"repo":{"id":84571483,"name":"trust-dns","full_name":"liranringel/trust-dns","owner":{"login":"liranringel","id":5730310,"avatar_url":"https://avatars1.githubusercontent.com/u/5730310?v=4","gravatar_id":"","url":"https://api.github.com/users/liranringel","html_url":"https://github.com/liranringel","followers_url":"https://api.github.com/users/liranringel/followers","following_url":"https://api.github.com/users/liranringel/following{/other_user}","gists_url":"https://api.github.com/users/liranringel/gists{/gist_id}","starred_url":"https://api.github.com/users/liranringel/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/liranringel/subscriptions","organizations_url":"https://api.github.com/users/liranringel/orgs","repos_url":"https://api.github.com/users/liranringel/repos","events_url":"https://api.github.com/users/liranringel/events{/privacy}","received_events_url":"https://api.github.com/users/liranringel/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/liranringel/trust-dns","description":"A Rust based DNS client and server ","fork":true,"url":"https://api.github.com/repos/liranringel/trust-dns","forks_url":"https://api.github.com/repos/liranringel/trust-dns/forks","keys_url":"https://api.github.com/repos/liranringel/trust-dns/keys{/key_id}","collaborators_url":"https://api.github.com/repos/liranringel/trust-dns/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/liranringel/trust-dns/teams","hooks_url":"https://api.github.com/repos/liranringel/trust-dns/hooks","issue_events_url":"https://api.github.com/repos/liranringel/trust-dns/issues/events{/number}","events_url":"https://api.github.com/repos/liranringel/trust-dns/events","assignees_url":"https://api.github.com/repos/liranringel/trust-dns/assignees{/user}","branches_url":"https://api.github.com/repos/liranringel/trust-dns/branches{/branch}","tags_url":"https://api.github.com/repos/liranringel/trust-dns/tags","blobs_url":"https://api.github.com/repos/liranringel/trust-dns/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/liranringel/trust-dns/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/liranringel/trust-dns/git/refs{/sha}","trees_url":"https://api.github.com/repos/liranringel/trust-dns/git/trees{/sha}","statuses_url":"https://api.github.com/repos/liranringel/trust-dns/statuses/{sha}","languages_url":"https://api.github.com/repos/liranringel/trust-dns/languages","stargazers_url":"https://api.github.com/repos/liranringel/trust-dns/stargazers","contributors_url":"https://api.github.com/repos/liranringel/trust-dns/contributors","subscribers_url":"https://api.github.com/repos/liranringel/trust-dns/subscribers","subscription_url":"https://api.github.com/repos/liranringel/trust-dns/subscription","commits_url":"https://api.github.com/repos/liranringel/trust-dns/commits{/sha}","git_commits_url":"https://api.github.com/repos/liranringel/trust-dns/git/commits{/sha}","comments_url":"https://api.github.com/repos/liranringel/trust-dns/comments{/number}","issue_comment_url":"https://api.github.com/repos/liranringel/trust-dns/issues/comments{/number}","contents_url":"https://api.github.com/repos/liranringel/trust-dns/contents/{+path}","compare_url":"https://api.github.com/repos/liranringel/trust-dns/compare/{base}...{head}","merges_url":"https://api.github.com/repos/liranringel/trust-dns/merges","archive_url":"https://api.github.com/repos/liranringel/trust-dns/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/liranringel/trust-dns/downloads","issues_url":"https://api.github.com/repos/liranringel/trust-dns/issues{/number}","pulls_url":"https://api.github.com/repos/liranringel/trust-dns/pulls{/number}","milestones_url":"https://api.github.com/repos/liranringel/trust-dns/milestones{/number}","notifications_url":"https://api.github.com/repos/liranringel/trust-dns/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/liranringel/trust-dns/labels{/name}","releases_url":"https://api.github.com/repos/liranringel/trust-dns/releases{/id}","deployments_url":"https://api.github.com/repos/liranringel/trust-dns/deployments","created_at":"2017-03-10T15:04:32Z","updated_at":"2017-03-10T15:04:34Z","pushed_at":"2017-09-21T02:46:07Z","git_url":"git://github.com/liranringel/trust-dns.git","ssh_url":"git@github.com:liranringel/trust-dns.git","clone_url":"https://github.com/liranringel/trust-dns.git","svn_url":"https://github.com/liranringel/trust-dns","homepage":"","size":5686,"stargazers_count":0,"watchers_count":0,"language":"Rust","has_issues":false,"has_projects":true,"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":"bluejekyll:master","ref":"master","sha":"502f9b260bcf9fd6311a9abb4abe1ea6ca113881","user":{"login":"bluejekyll","id":986845,"avatar_url":"https://avatars3.githubusercontent.com/u/986845?v=4","gravatar_id":"","url":"https://api.github.com/users/bluejekyll","html_url":"https://github.com/bluejekyll","followers_url":"https://api.github.com/users/bluejekyll/followers","following_url":"https://api.github.com/users/bluejekyll/following{/other_user}","gists_url":"https://api.github.com/users/bluejekyll/gists{/gist_id}","starred_url":"https://api.github.com/users/bluejekyll/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/bluejekyll/subscriptions","organizations_url":"https://api.github.com/users/bluejekyll/orgs","repos_url":"https://api.github.com/users/bluejekyll/repos","events_url":"https://api.github.com/users/bluejekyll/events{/privacy}","received_events_url":"https://api.github.com/users/bluejekyll/received_events","type":"User","site_admin":false},"repo":{"id":40389144,"name":"trust-dns","full_name":"bluejekyll/trust-dns","owner":{"login":"bluejekyll","id":986845,"avatar_url":"https://avatars3.githubusercontent.com/u/986845?v=4","gravatar_id":"","url":"https://api.github.com/users/bluejekyll","html_url":"https://github.com/bluejekyll","followers_url":"https://api.github.com/users/bluejekyll/followers","following_url":"https://api.github.com/users/bluejekyll/following{/other_user}","gists_url":"https://api.github.com/users/bluejekyll/gists{/gist_id}","starred_url":"https://api.github.com/users/bluejekyll/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/bluejekyll/subscriptions","organizations_url":"https://api.github.com/users/bluejekyll/orgs","repos_url":"https://api.github.com/users/bluejekyll/repos","events_url":"https://api.github.com/users/bluejekyll/events{/privacy}","received_events_url":"https://api.github.com/users/bluejekyll/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/bluejekyll/trust-dns","description":"A Rust based DNS client and server ","fork":false,"url":"https://api.github.com/repos/bluejekyll/trust-dns","forks_url":"https://api.github.com/repos/bluejekyll/trust-dns/forks","keys_url":"https://api.github.com/repos/bluejekyll/trust-dns/keys{/key_id}","collaborators_url":"https://api.github.com/repos/bluejekyll/trust-dns/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/bluejekyll/trust-dns/teams","hooks_url":"https://api.github.com/repos/bluejekyll/trust-dns/hooks","issue_events_url":"https://api.github.com/repos/bluejekyll/trust-dns/issues/events{/number}","events_url":"https://api.github.com/repos/bluejekyll/trust-dns/events","assignees_url":"https://api.github.com/repos/bluejekyll/trust-dns/assignees{/user}","branches_url":"https://api.github.com/repos/bluejekyll/trust-dns/branches{/branch}","tags_url":"https://api.github.com/repos/bluejekyll/trust-dns/tags","blobs_url":"https://api.github.com/repos/bluejekyll/trust-dns/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/bluejekyll/trust-dns/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/bluejekyll/trust-dns/git/refs{/sha}","trees_url":"https://api.github.com/repos/bluejekyll/trust-dns/git/trees{/sha}","statuses_url":"https://api.github.com/repos/bluejekyll/trust-dns/statuses/{sha}","languages_url":"https://api.github.com/repos/bluejekyll/trust-dns/languages","stargazers_url":"https://api.github.com/repos/bluejekyll/trust-dns/stargazers","contributors_url":"https://api.github.com/repos/bluejekyll/trust-dns/contributors","subscribers_url":"https://api.github.com/repos/bluejekyll/trust-dns/subscribers","subscription_url":"https://api.github.com/repos/bluejekyll/trust-dns/subscription","commits_url":"https://api.github.com/repos/bluejekyll/trust-dns/commits{/sha}","git_commits_url":"https://api.github.com/repos/bluejekyll/trust-dns/git/commits{/sha}","comments_url":"https://api.github.com/repos/bluejekyll/trust-dns/comments{/number}","issue_comment_url":"https://api.github.com/repos/bluejekyll/trust-dns/issues/comments{/number}","contents_url":"https://api.github.com/repos/bluejekyll/trust-dns/contents/{+path}","compare_url":"https://api.github.com/repos/bluejekyll/trust-dns/compare/{base}...{head}","merges_url":"https://api.github.com/repos/bluejekyll/trust-dns/merges","archive_url":"https://api.github.com/repos/bluejekyll/trust-dns/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/bluejekyll/trust-dns/downloads","issues_url":"https://api.github.com/repos/bluejekyll/trust-dns/issues{/number}","pulls_url":"https://api.github.com/repos/bluejekyll/trust-dns/pulls{/number}","milestones_url":"https://api.github.com/repos/bluejekyll/trust-dns/milestones{/number}","notifications_url":"https://api.github.com/repos/bluejekyll/trust-dns/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/bluejekyll/trust-dns/labels{/name}","releases_url":"https://api.github.com/repos/bluejekyll/trust-dns/releases{/id}","deployments_url":"https://api.github.com/repos/bluejekyll/trust-dns/deployments","created_at":"2015-08-08T02:47:12Z","updated_at":"2017-09-19T01:31:52Z","pushed_at":"2017-09-21T14:18:25Z","git_url":"git://github.com/bluejekyll/trust-dns.git","ssh_url":"git@github.com:bluejekyll/trust-dns.git","clone_url":"https://github.com/bluejekyll/trust-dns.git","svn_url":"https://github.com/bluejekyll/trust-dns","homepage":"","size":5665,"stargazers_count":576,"watchers_count":576,"language":"Rust","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":true,"forks_count":41,"mirror_url":null,"open_issues_count":39,"forks":41,"open_issues":39,"watchers":576,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/bluejekyll/trust-dns/pulls/172"},"html":{"href":"https://github.com/bluejekyll/trust-dns/pull/172"},"issue":{"href":"https://api.github.com/repos/bluejekyll/trust-dns/issues/172"},"comments":{"href":"https://api.github.com/repos/bluejekyll/trust-dns/issues/172/comments"},"review_comments":{"href":"https://api.github.com/repos/bluejekyll/trust-dns/pulls/172/comments"},"review_comment":{"href":"https://api.github.com/repos/bluejekyll/trust-dns/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/bluejekyll/trust-dns/pulls/172/commits"},"statuses":{"href":"https://api.github.com/repos/bluejekyll/trust-dns/statuses/d4feb57e2d21a65a243d7b5130fe31e9e6cb40ca"}},"author_association":"CONTRIBUTOR"}}
{"actor":{"display_login":"liranringel"}}