mirror of
https://github.com/schollz/croc.git
synced 2025-10-11 13:21:00 +02:00
Merge branch 'master' of github.com:schollz/croc
This commit is contained in:
commit
94e0e3ca67
1 changed files with 8 additions and 1 deletions
|
@ -35,7 +35,14 @@ func init() {
|
||||||
|
|
||||||
func lookupIPs(address string) (ipaddress string, err error) {
|
func lookupIPs(address string) (ipaddress string, err error) {
|
||||||
var publicDns = []string{"1.1.1.1", "8.8.8.8", "8.8.4.4", "1.0.0.1", "8.26.56.26", "208.67.222.222", "208.67.220.220"}
|
var publicDns = []string{"1.1.1.1", "8.8.8.8", "8.8.4.4", "1.0.0.1", "8.26.56.26", "208.67.222.222", "208.67.220.220"}
|
||||||
result := make(chan string, len(publicDns))
|
result := make(chan string, len(publicDns)+1)
|
||||||
|
go func() {
|
||||||
|
ips, _ := net.LookupIP(address)
|
||||||
|
for _, ip := range ips {
|
||||||
|
result <- ip.String()
|
||||||
|
}
|
||||||
|
result <- ""
|
||||||
|
}()
|
||||||
for _, dns := range publicDns {
|
for _, dns := range publicDns {
|
||||||
go func(dns string) {
|
go func(dns string) {
|
||||||
s, _ := lookupIP(address, dns)
|
s, _ := lookupIP(address, dns)
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue