Skip to content

Commit

Permalink
Add public DNS servers
Browse files Browse the repository at this point in the history
  • Loading branch information
Alexander Sheiko committed Sep 23, 2023
1 parent 9b90f68 commit 1dd6cf9
Show file tree
Hide file tree
Showing 3 changed files with 36 additions and 2 deletions.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ This util performs a ping to measure the network latency from your location to t
- Microsoft Azure
- Oracle Cloud
- OVH Cloud
- Public DNS servers
- QingCloud
- Qiniu Cloud
- Scaleway
Expand Down
14 changes: 12 additions & 2 deletions main.go
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,13 @@ func main() {
t := table.NewWriter()
t.SetOutputMirror(os.Stdout)
t.SetAutoIndex(true)
t.AppendHeader(table.Row{"Provider", "Region", "Location", "RTT", "Status"})
if args.Provider == "dns" && !args.All {
t.SetTitle("Public DNS Servers")
t.Style().Title = table.TitleOptions{Align: text.AlignCenter}
t.AppendHeader(table.Row{"Provider", "Type", "Address", "RTT", "Status"})
} else {
t.AppendHeader(table.Row{"Provider", "Region", "Location", "RTT", "Status"})
}
var minRTT time.Duration
for _, region := range results {
status := text.FgGreen.Sprint("OK")
Expand All @@ -76,7 +82,11 @@ func main() {
if rtt < minRTT || minRTT == 0 {
minRTT = rtt
}
t.AppendRow(table.Row{region.code, region.name, region.location, rtt, status})
if args.Provider == "dns" && !args.All {
t.AppendRow(table.Row{region.name, region.location, region.endpoint, rtt, status})
} else {
t.AppendRow(table.Row{region.code, region.name, region.location, rtt, status})
}
}
t.SetColumnConfigs([]table.ColumnConfig{
{
Expand Down
23 changes: 23 additions & 0 deletions providers.go
Original file line number Diff line number Diff line change
Expand Up @@ -158,6 +158,29 @@ var providers = provider{
// {name: "tor1", location: "Toronto, CA"},
},
},
"dns": {
name: "Public DNS servers",
regions: []*region{
{name: "AdGuard DNS", endpoint: "94.140.14.14", location: "primary"},
{name: "AdGuard DNS", endpoint: "94.140.15.15", location: "secondary"},
{name: "Alternate DNS", endpoint: "76.76.19.19", location: "primary"},
{name: "Alternate DNS", endpoint: "76.223.122.150", location: "secondary"},
{name: "Cloudflare", endpoint: "1.1.1.1", location: "primary"},
{name: "Cloudflare", endpoint: "1.0.0.1", location: "secondary"},
{name: "Comodo", endpoint: "8.26.56.26", location: "primary"},
{name: "Comodo", endpoint: "8.20.247.20", location: "secondary"},
{name: "ControlD", endpoint: "76.76.2.0", location: "primary"},
{name: "ControlD", endpoint: "76.76.10.0", location: "secondary"},
{name: "Google", endpoint: "8.8.8.8", location: "primary"},
{name: "Google", endpoint: "8.8.4.4", location: "secondary"},
{name: "NextDNS", endpoint: "45.90.28.190", location: "primary"},
{name: "NextDNS", endpoint: "45.90.30.190", location: "secondary"},
{name: "OpenDNS", endpoint: "208.67.222.222", location: "primary"},
{name: "OpenDNS", endpoint: "208.67.220.220", location: "secondary"},
{name: "Quad9", endpoint: "9.9.9.9", location: "primary"},
{name: "Quad9", endpoint: "149.112.112.112", location: "secondary"},
},
},
"gcore": {
name: "Gcore Cloud",
hostTemplate: "https://console-serial-%s.cloud.gcorelabs.com",
Expand Down

0 comments on commit 1dd6cf9

Please sign in to comment.