nat

package
v2.0.0-...-f08b0b4 Latest Latest
Warning

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

Go to latest
Published: Dec 18, 2022 License: GPL-3.0 Imports: 2 Imported by: 0

Documentation

Overview

Package nat provides simple NAT table implements.

* Normal (Full Cone) NAT A full cone NAT is one where all requests from the same internal IP address and port are mapped to the same external IP address and port. Furthermore, any external host can send a packet to the internal host, by sending a packet to the mapped external address.

* Restricted Cone NAT A restricted cone NAT is one where all requests from the same internal IP address and port are mapped to the same external IP address and port. Unlike a full cone NAT, an external host (with IP address X) can send a packet to the internal host only if the internal host had previously sent a packet to IP address X.

* Port Restricted Cone NAT A port restricted cone NAT is like a restricted cone NAT, but the restriction includes port numbers. Specifically, an external host can send a packet, with source IP address X and source port P, to the internal host only if the internal host had previously sent a packet to IP address X and port P.

* Symmetric NAT A symmetric NAT is one where all requests from the same internal IP address and port, to a specific destination IP address and port, are mapped to the same external IP address and port. If the same host sends a packet with the same source address and port, but to a different destination, a different mapping is used. Furthermore, only the external host that receives a packet can send a UDP packet back to the internal host.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Table

type Table struct {
	// contains filtered or unexported fields
}

func NewTable

func NewTable() *Table

func (*Table) Delete

func (t *Table) Delete(key string)

func (*Table) Get

func (t *Table) Get(key string) net.PacketConn

func (*Table) GetOrCreateLock

func (t *Table) GetOrCreateLock(key string) (*sync.Cond, bool)

func (*Table) Set

func (t *Table) Set(key string, pc net.PacketConn)

Jump to

Keyboard shortcuts

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