Skip to content

Instantly share code, notes, and snippets.

@jpeeler

jpeeler/test lookup

Created Oct 2, 2019
Embed
What would you like to do?
test
# tested with:
# sudo firewall-cmd --direct --add-rule ipv4 filter OUTPUT 0 -d <IP> -j DROP
package main
import (
"fmt"
"net"
"time"
)
func main() {
for i := 0; i < 30; i++ {
time.Sleep(1 * time.Second)
go func(count int) {
t := time.Now()
conn, err := net.DialTimeout("tcp", "google.com:80", 1*time.Second)
duration := time.Now().Sub(t)
fmt.Printf("%v: Duration=%v, conn=%v, err=%v\n", count, duration, conn, err)
}(i)
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment