commit
fe4bda67a7
3 changed files with 46 additions and 0 deletions
@ -0,0 +1,10 @@ |
|||
#!/bin/sh |
|||
|
|||
go build -o dnstiming main.go |
|||
container=$(buildah from fedora:33) |
|||
mnt=$(buildah mount $container) |
|||
cp dnstiming $mnt |
|||
chmod 755 $mnt/dnstiming |
|||
buildah config --cmd /dnstiming $container |
|||
buildah commit $container dnstiming |
|||
buildah unmount $container |
|||
@ -0,0 +1,32 @@ |
|||
package main |
|||
|
|||
import ( |
|||
"fmt" |
|||
"net" |
|||
"os" |
|||
"time" |
|||
) |
|||
|
|||
func main() { |
|||
if len(os.Args) != 2 { |
|||
fmt.Printf("Usage: %s hostname\n", os.Args[0]) |
|||
os.Exit(1) |
|||
} |
|||
|
|||
start := time.Now() |
|||
addrs, err := net.LookupHost(os.Args[1]) |
|||
end := time.Now() |
|||
elapsed := end.Sub(start) |
|||
|
|||
if err != nil { |
|||
fmt.Println(err) |
|||
os.Exit(2) |
|||
} |
|||
|
|||
for _, addr := range addrs { |
|||
fmt.Println(addr) |
|||
} |
|||
|
|||
fmt.Println() |
|||
fmt.Printf("Elapsed: %d ms\n", elapsed.Milliseconds()) |
|||
} |
|||
@ -0,0 +1,4 @@ |
|||
#!/bin/sh |
|||
|
|||
podman run --rm --name fedora -d fedora sleep 60 |
|||
podman run --rm --name dnstiming -t dnstiming /dnstiming fedora |
|||
Loading…
Reference in new issue