package main import ( "fmt" "log" "net" "os" ) var ( IP string Port string ScanType = "tcp" ) func main() { if len(os.Args) != 3 { fmt.Printf("Insufficient arguments:\n./simple-port-scanner $IP $PORT") os.Exit(0) } IP = os.Args[1] Port = os.Args[2] fmt.Printf("Scanning %v:%v...\n", IP, Port) conn, err := net.Dial(ScanType, IP+":"+Port) if err != nil { log.Fatalf("Fatal error occurred while scanning port: %v\n", err) } defer conn.Close() } func handleConn(conn net.Conn) { }