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: ? modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

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