nattest

package
v1.6.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 10, 2014 License: Apache-2.0 Imports: 6 Imported by: 2

Documentation

Overview

package nattest provides the capability to test a nat-traversed UDP connection by sending packets back and forth between client and server. The client sends 10 packets containing "Ping" to the server, spaced out by 2 seconds. Once the server receives a Ping packet, it responds with 10 packets containing "Pong", spaced out by 2 seconds, and then terminates. Once the client receives a "Pong" packet, it considers the traversal successful.

Note - both the client and server ignore unexpected (gibberish) packets, so as long as client and server both get at least one good packet, the connection is considered successful.

Index

Constants

View Source
const (
	NumUDPTestPackets = 10
	PacketPause       = 2 * time.Second
	ConnTimeout       = NumUDPTestPackets * PacketPause
)

Variables

This section is empty.

Functions

func Ping

func Ping(local *net.UDPAddr, remote *net.UDPAddr) bool

Ping pings the server at the other end of a NAT-traversed UDP connection and looks for echo packets to confirm connectivity with the server. It returns true if connectivity was confirmed, false otherwise.

func Serve

func Serve(local *net.UDPAddr) error

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL