\r\nbob@ubuntu-20-04:~$ sudo apt install -y cargo libssl-dev\r\n<\/pre>\n\u4e0b\u9762\u5b89\u88c5rust\uff0c\u7531\u4e8e\u6309\u7167\u5b98\u65b9\u6587\u6863\u5b89\u88c5rust\uff0c\u6709\u65f6\u4e0b\u8f7d\u6ca1\u6709\u8fdb\u5ea6\uff0c\u6240\u4ee5\u5728\u8fd9\u91cc\u5148\u4fee\u6539\u955c\u50cf\u6e90\uff0c\u6539\u6210\u56fd\u5185\u7684\uff0c\u7136\u540e\u6267\u884c\u5b89\u88c5\uff1a<\/p>\n
\r\nbob@ubuntu-18-04:~$ export RUSTUP_DIST_SERVER=https:\/\/mirrors.ustc.edu.cn\/rust-static\r\nbob@ubuntu-18-04:~$ export RUSTUP_UPDATE_ROOT=https:\/\/mirrors.ustc.edu.cn\/rust-static\/rustup\r\nbob@ubuntu-18-04:~$ curl https:\/\/sh.rustup.rs -sSf | sh\r\n<\/pre>\n
\n\u5728\u4e0b\u9762\u7684\u5730\u65b9\uff0c\u9009\u62e9\u9009\u98791.
\n<\/p>\n
\n\u5b89\u88c5\u5b8c\u6210\uff0c\u9700\u8981\u6267\u884c\u4e0b\u9762\u547d\u4ee4\uff0c\u624d\u80fd\u6b63\u5e38\u4f7f\u7528cargo\u547d\u4ee4\uff1a<\/p>\n
\r\nbob@ubuntu-18-04:~$ source $HOME\/.cargo\/env\r\n<\/pre>\n\u4e0b\u9762\u68c0\u67e5rustc\u7684\u7248\u672c\uff1a<\/p>\n
\r\nbob@ubuntu-18-04:~$ rustc --version\r\nrustc 1.47.0 (18bf6b4f0 2020-10-07)\r\n<\/pre>\n
\n\u4ecegithub\u4e0b\u8f7ddog\u5b89\u88c5\u5305\uff0c\u5e76\u89e3\u538b\uff1a<\/p>\n
\r\nbob@ubuntu-20-04:~$ wget https:\/\/github.com\/ogham\/dog\/archive\/v0.1.0.tar.gz\r\nbob@ubuntu-20-04:~$ tar xvf v0.1.0.tar.gz \r\n<\/pre>\n\u8fdb\u5165\u89e3\u538b\u51fa\u6765\u7684\u76ee\u5f55\uff0c\u5e76\u6784\u5efadog\u7a0b\u5e8f\uff1a<\/p>\n
\r\nbob@ubuntu-20-04:~$ cd dog-0.1.0\/\r\n<\/pre>\n
\n\u4f7f\u7528\u9ed8\u8ba4\u7684\u4ed3\u5e93\u5730\u5740\u66f4\u65b0\u4f1a\u6bd4\u8f83\u6162\uff0c\u5728\u8fd9\u91cc\u6309ctrl+c\u7ed3\u675f\u66f4\u65b0\uff0c\u5728\u5bb6\u76ee\u5f55\u4f1a\u751f\u6210\u4e00\u4e2a.cargo<\/code>\u6587\u4ef6\u5939\uff0c\u8fdb\u53bb\u65b0\u5efa\u4e00\u4e2aconfig<\/code>\u914d\u7f6e\u6587\u4ef6\uff0c\u5c06\u4e0b\u9762\u5185\u5bb9\u6dfb\u52a0\u8fdb\u53bb\u8fd9\u6837\u4fee\u6539\u9ed8\u8ba4\u4ed3\u5e93\uff0c\u66f4\u65b0\u901f\u5ea6\u5c31\u5feb\u8bb8\u591a\u4e86\uff1a<\/p>\n\r\nbob@ubuntu-20-04:~\/dog-0.1.0$ cat ~\/.cargo\/config\r\n\r\n[source.crates-io]\r\nregistry = \"https:\/\/github.com\/rust-lang\/crates.io-index\"\r\n\r\n# \u66ff\u6362\u6210\u4f60\u504f\u597d\u7684\u955c\u50cf\u6e90\r\nreplace-with = 'sjtu'\r\n#replace-with = 'ustc'\r\n\r\n# \u6e05\u534e\u5927\u5b66\r\n[source.tuna]\r\nregistry = \"https:\/\/mirrors.tuna.tsinghua.edu.cn\/git\/crates.io-index.git\"\r\n\r\n# \u4e2d\u56fd\u79d1\u5b66\u6280\u672f\u5927\u5b66\r\n[source.ustc]\r\nregistry = \"git:\/\/mirrors.ustc.edu.cn\/crates.io-index\"\r\n\r\n# \u4e0a\u6d77\u4ea4\u901a\u5927\u5b66\r\n[source.sjtu]\r\nregistry = \"https:\/\/mirrors.sjtug.sjtu.edu.cn\/git\/crates.io-index\"\r\n\r\n# rustcc\u793e\u533a\r\n[source.rustcc]\r\nregistry = \"git:\/\/crates.rustcc.cn\/crates.io-index\"\r\n<\/pre>\n
\n\u4fee\u6539\u5b8c\u6210\u4e4b\u540e\uff0c\u518d\u56de\u5230dog-0.1.0\u76ee\u5f55\u91cc\u9762\uff0c\u91cd\u65b0\u6784\u5efadog\u7a0b\u5e8f\uff0c\u5e76\u8fd0\u884c\u6d4b\u8bd5\u4ee5\u4e0b\uff1a<\/p>\n
\r\nbob@ubuntu-18-04:~\/dog-0.1.0$ cargo build\r\nbob@ubuntu-18-04:~\/dog-0.1.0$ cargo test\r\n<\/pre>\n<\/p>\n
\n\u786e\u4fdddog\u547d\u4ee4\u4ece\u4efb\u4f55\u76ee\u5f55\u8fd0\u884c\uff0c\u5c06\u4e8c\u8fdb\u5236\u6587\u4ef6\u653e\u5728\/usr\/local\/bin<\/code>\u76ee\u5f55\u4e2d\u3002<\/p>\n\r\nbob@ubuntu-18-04:~\/dog-0.1.0$ sudo cp -p ~\/dog-0.1.0\/target\/debug\/dog \/usr\/local\/bin\r\n<\/pre>\n\u8fd0\u884cdog\u5de5\u5177\uff0c\u67e5\u770b\u4ee5\u4e0b\u7248\u672c\uff1a<\/p>\n
\r\nbob@ubuntu-18-04:~$ dog --version\r\ndog \u25cf command-line DNS client\r\nv0.1.0 [] built on 2020-11-19 (pre-release!)\r\nhttps:\/\/dns.lookup.dog\/\r\nbob@ubuntu-18-04:~$ \r\n<\/pre>\n
\n\u53ef\u4ee5\u4f7f\u7528\u6e90\u7801\u5305\u91cc\u9762\u7684\u547d\u4ee4\u8865\u5168\u811a\u672c\uff0c\u5f53\u9700\u8981\u63d0\u793a\u7684\u65f6\u5019\u6309\u4e24\u4e0bTAB\u952e\uff0c\u663e\u793a\u5b50\u547d\u4ee4\uff1a<\/p>\n
\r\nbob@ubuntu-18-04:~$ source ~\/dog-0.1.0\/completions\/dog.bash \r\n<\/pre>\n<\/p>\n
\u5982\u4f55\u4f7f\u7528dog\u547d\u4ee4<\/strong><\/div>\n\u73b0\u5728\uff0c\u8ba9\u6211\u4eec\u770b\u770b\u5982\u4f55\u4f7f\u7528dog\u547d\u4ee4\u67e5\u8be2\u4e0d\u540c\u7684DNS\u8bb0\u5f55\u3002<\/p>\n
\u67e5\u8be2A\u8bb0\u5f55<\/strong><\/span><\/div>\n\r\nbob@ubuntu-18-04:~$ dog www.baidu.com\r\nCNAME www.baidu.com. 5s \"www.a.shifen.com.\"\r\n A www.a.shifen.com. 4s 180.101.49.12\r\n A www.a.shifen.com. 4s 180.101.49.11\r\n<\/pre>\n<\/p>\n
\u67e5\u8be2NS\u8bb0\u5f55<\/strong><\/span><\/div>\n\r\nbob@ubuntu-18-04:~$ dog aliyun.com NS\r\nNS aliyun.com. 5s \"ns3.aliyun.com.\"\r\nNS aliyun.com. 5s \"ns5.aliyun.com.\"\r\nNS aliyun.com. 5s \"ns4.aliyun.com.\"\r\n<\/pre>\n<\/p>\n
\u4f7f\u7528\u6307\u5b9a\u7684\u57df\u540d\u670d\u52a1\u5668\u5730\u5740\u67e5\u8be2<\/strong><\/span><\/div>\n\r\nbob@ubuntu-18-04:~$ dog google.com MX @1.1.1.1\r\nMX google.com. 6m23s 30 \"alt2.aspmx.l.google.com.\"\r\nMX google.com. 6m23s 40 \"alt3.aspmx.l.google.com.\"\r\nMX google.com. 6m23s 10 \"aspmx.l.google.com.\"\r\nMX google.com. 6m23s 50 \"alt4.aspmx.l.google.com.\"\r\nMX google.com. 6m23s 20 \"alt1.aspmx.l.google.com.\"\r\n<\/pre>\n<\/p>\n
JSON\u683c\u5f0f\u8f93\u51fa<\/strong><\/span><\/div>\n\r\nbob@ubuntu-18-04:~$ dog A www.baidu.com -J\r\n{\"responses\":[{\"additionals\":[],\"answers\":[{\"class\":\"IN\",\"domain\":\"www.a.shifen.com.\",\"name\":\"www.baidu.com.\",\"ttl\":5,\"type\":\"CNAME\"},{\"address\":\"180.101.49.11\",\"class\":\"IN\",\"name\":\"www.a.shifen.com.\",\"ttl\":4,\"type\":\"A\"},{\"address\":\"180.101.49.12\",\"class\":\"IN\",\"name\":\"www.a.shifen.com.\",\"ttl\":4,\"type\":\"A\"}],\"authorities\":[],\"queries\":[{\"class\":\"IN\",\"name\":\"www.baidu.com.\",\"type\":1}]}]}\r\n<\/pre>\n<\/p>\n
\u67e5\u770b\u5e2e\u52a9<\/strong><\/span><\/div>\n\r\nbob@ubuntu-18-04:~$ dog --help\r\n<\/pre>\n<\/p>\n
\u603b\u7ed3<\/strong><\/div>\nDog\u662f\u4e00\u4e2a\u7528\u4e8eDNS\u67e5\u8be2\u7684\u547d\u4ee4\u884c\u5de5\u5177\uff0c\u5b83\u7684\u5de5\u4f5c\u539f\u7406\u7c7b\u4f3c\u4e8edig\u3002\u5b83\u5177\u6709\u4e30\u5bcc\u591a\u5f69\u7684\u8f93\u51fa\uff0c\u652f\u6301DNS-over-TLS \u548c DNS-over-HTTPS\u534f\u8bae\uff0c\u5e76\u4e14\u53ef\u4ee5\u8f93\u51faJSON\u683c\u5f0f\u3002<\/p>\n","protected":false},"excerpt":{"rendered":"
Ubuntu 20.04.1 LTS Dog\u662f\u7528Rust\u7f16\u5199\u7684DNS\u67e5\u8be2\u5de5\u5177\u3002Dog\u9700\u8981rustc\u7684\u7248\u672c\u9ad8\u4e8e1 […]<\/p>\n","protected":false},"author":309,"featured_media":205906,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"footnotes":""},"categories":[55],"tags":[],"class_list":["post-205897","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-thread"],"acf":[],"_links":{"self":[{"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/posts\/205897","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/users\/309"}],"replies":[{"embeddable":true,"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/comments?post=205897"}],"version-history":[{"count":1,"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/posts\/205897\/revisions"}],"predecessor-version":[{"id":205923,"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/posts\/205897\/revisions\/205923"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/media\/205906"}],"wp:attachment":[{"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/media?parent=205897"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/categories?post=205897"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/tags?post=205897"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}