func PingTCP(t *testing.T, ip net.IP, port int) net.Conn {
	addr := fmt.Sprintf("%s:%d", ip, port)
	network := "tcp"
	if isIpv6(ip) {
		network = "tcp6"
		addr = fmt.Sprintf("[%s]:%d", ip, port)
	}

	conn, err := net.Dial(network, addr)
	require.NoError(t, err)

	_, err = conn.Write([]byte("ping"))
	require.NoError(t, err)
	bs := make([]byte, 10)
	_, err = conn.Read(bs)
	require.NoError(t, err)

	return conn
}
// PingTCP connects to the provided IP address over TCP/TCPv6, sends the string "ping",
// reads from the connection, and returns the open connection for further use/inspection.
PingTCP connects to the provided IP address over TCP/TCPv6, sends the string "ping",
reads from the connection, and returns the open connection for further use/inspection.
// PingTCP connects to the provided IP address over TCP / TCPv6 sends the string " ping " // reads from the connection and returns the open connection for further use / inspection .
func PingTCP(t *testing.T, ip net.IP, port int) net.Conn {
	addr := fmt.Sprintf("%s:%d", ip, port)
	network := "tcp"
	if isIpv6(ip) {
		network = "tcp6"
		addr = fmt.Sprintf("[%s]:%d", ip, port)
	}
	conn, err := net.Dial(network, addr)
	require.NoError(t, err)
	_, err = conn.Write([]byte("ping"))
	require.NoError(t, err)
	bs := make([]byte, 10)
	_, err = conn.Read(bs)
	require.NoError(t, err)
	return conn
}
func PingTCP ( t * testing . T , ip net . IP , port int ) net . Conn { addr := fmt . Sprintf ( " " , ip , port ) network := " " if isIpv6 ( ip ) { network = " " addr = fmt . Sprintf ( " " , ip , port ) } conn , err := net . Dial ( network , addr ) require . NoError ( t , err ) _ , err = conn . Write ( [ ] byte ( " " ) ) require . NoError ( t , err ) bs := make ( [ ] byte , 10 ) _ , err = conn . Read ( bs ) require . NoError ( t , err ) return conn }
PingTCP connects to the provided IP address over TCP/TCPv6, sends the string "ping",
reads from the connection, and returns the open connection for further use/inspection.
PingTCP connects to the provided IP address over TCP / TCPv6 sends the string " ping " reads from the connection and returns the open connection for further use / inspection .