use color red

master
sre 4 years ago
parent 5f636b60b4
commit 09803ed982

@ -8,15 +8,16 @@ import (
)
func PortDial(address, port, protocol string, timeout int) {
red := color.New(color.FgRed).SprintFunc()
green := color.New(color.FgGreen).SprintFunc()
ip := digIp(address)
if ip == "" {
fmt.Printf("%v ping: %v: Name or service not known\n", protocol, address)
fmt.Printf("%v ping: %v: Name or service not known\n", protocol, red(address))
return
}
fmt.Printf("%v ping %v (%v) via port %v (timeout: %vs)...\n", protocol, address, ip, port, timeout)
dialTarget := ip + ":" + port
red := color.New(color.FgRed).SprintFunc()
green := color.New(color.FgGreen).SprintFunc()
for {
startTime := time.Now()
conn, err := net.DialTimeout(protocol, dialTarget, time.Duration(timeout)*time.Second)

Loading…
Cancel
Save