package interceptor import ( "fmt" "net" ) type NetModule struct{} func (n *NetModule) IsPortOpen(host string, port int) bool { conn, err := net.Dial("tcp", net.JoinHostPort(host, fmt.Sprintf("%d", port))) if err != nil { return false } conn.Close() return true }