tcp/udp protocal color

master
sre 4 years ago
parent 84c8ce25ab
commit 64e260578a

@ -11,12 +11,13 @@ func PortDial(address, port, protocol string, timeout int) {
red := color.New(color.FgRed).SprintFunc() red := color.New(color.FgRed).SprintFunc()
yellow := color.New(color.FgYellow).SprintFunc() yellow := color.New(color.FgYellow).SprintFunc()
green := color.New(color.FgGreen).SprintFunc() green := color.New(color.FgGreen).SprintFunc()
blue := color.New(color.FgBlue).SprintFunc()
ip := digIp(address) ip := digIp(address)
if ip == "" { if ip == "" {
fmt.Printf("%v ping: %v: Name or service not known\n", protocol, red(address)) fmt.Printf("%v ping: %v: Name or service not known\n", blue(protocol), red(address))
return return
} }
fmt.Printf("%v ping %v (%v) via port %v (timeout: %vs)...\n", protocol, address, ip, port, timeout) fmt.Printf("%v ping %v (%v) via port %v (timeout: %vs)...\n", blue(protocol), address, ip, port, timeout)
dialTarget := ip + ":" + port dialTarget := ip + ":" + port
for { for {

Loading…
Cancel
Save