ChinaDNS 的上游 DNS 分为 国内 DNS
和 可信 DNS
。
- ChinaDNS 会同时向上游的 DNS 发送请求。
- 如果
可信 DNS
先返回,则直接采用可信 DNS
的结果。 - 如果
国内 DNS
先返回,分两种情况:如果返回的结果是国内的 IP, 则采用;否则丢弃并转而采用可信 DNS
的结果。
using Microsoft.CodeAnalysis.CSharp; | |
using Microsoft.CodeAnalysis.CSharp.Scripting; | |
using Microsoft.CodeAnalysis.Scripting; | |
using Mono.CSharp; | |
using System; | |
using System.CodeDom.Compiler; | |
using System.Collections.Generic; | |
using System.Diagnostics; | |
using System.Dynamic; | |
using System.Linq; |
$ LD_PRELOAD=$PWD/sendmsg.so dig twitter.com @8.8.8.8 | |
;; Warning: Message parser reports malformed message packet. <-- malformed 因为把压缩指针当作域名一部分了 | |
;; Question section mismatch: got twitter.com/RESERVED0/CLASS256 | |
; <<>> DiG 9.9.5-3-Ubuntu <<>> twitter.com @8.8.8.8 | |
;; global options: +cmd | |
;; Got answer: | |
;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 44722 | |
;; flags: qr rd ra; QUERY: 1, ANSWER: 4, AUTHORITY: 0, ADDITIONAL: 1 |
-480p - Run tenfoot in 480p rather than 1080p | |
-720p - Run tenfoot in 720p rather than 1080p | |
-accesscode - | |
-all_languages - show longest loc string from any language | |
-batterytestmode - rapidly cycle battery percentages for testing | |
-bigpicture - Start in Steam Big Picture mode | |
-blefw - | |
-cafeapplaunch - Launch apps in a cyber cafe context | |
-candidates - Show libjingle candidates for local connection as they are processed | |
-ccsyntax - Spew details about the localized strings we load |
package main | |
import ( | |
"flag" | |
"io" | |
"log" | |
"net" | |
"net/http" | |
"os" | |
"strings" |