Skip to content

Instantly share code, notes, and snippets.

@jpeeler
Created October 2, 2019 17:37
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jpeeler/489d37193796314e8ea8558ce7f348d3 to your computer and use it in GitHub Desktop.
Save jpeeler/489d37193796314e8ea8558ce7f348d3 to your computer and use it in GitHub Desktop.
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