Documentation ¶
Overview ¶
Package forward contains a UDP packet forwarder.
Index ¶
Constants ¶
const DefaultTimeout = time.Minute * 5
DefaultTimeout is the default timeout period of inactivity for convenience sake. It is equivelant to 5 minutes.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Forwarder ¶
type Forwarder struct {
// contains filtered or unexported fields
}
Forwarder represents a UDP packet forwarder.
func Forward ¶
Forward forwards UDP packets from the src address to the dst address, with a timeout to "disconnect" clients after the timeout period of inactivity. It implements a reverse NAT and thus supports multiple seperate users. Forward is also asynchronous.
func (*Forwarder) OnConnect ¶
OnConnect can be called with a callback function to be called whenever a new client connects.
func (*Forwarder) OnDisconnect ¶
OnDisconnect can be called with a callback function to be called whenever a new client disconnects (after 5 minutes of inactivity).