Example #1
0
// Create a NAT-PMP client for the NAT-PMP server at the default gateway.
func NewClientForDefaultGateway() (nat *Client, err error) {
	var g net.IP
	g, err = gateway.DiscoverGateway()
	if err != nil {
		return
	}
	nat = NewClient(g)
	return
}
Example #2
0
func discoverNATPMP() <-chan NAT {
	res := make(chan NAT, 1)

	ip, err := gateway.DiscoverGateway()
	if err == nil {
		go discoverNATPMPWithAddr(res, ip)
	}

	return res
}