Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Conn ¶
Conn describes a connection accepted by the TProxy listener.
It is simply a TCP connection with the ability to dial a connection to the original destination while assuming the IP address of the client
func DialTCP ¶ added in v0.2.0
DialTCP creates transparent connection network must be "tcp", "tcp4" or "tcp6" if laddr is nil, use dontAssumeRemote as false
func (Conn) DialOriginalDestination ¶
DialOriginalDestination will open a TCP connection to the original destination that the client was trying to connect to before being intercepted.
When `dontAssumeRemote` is false, the connection will originate from the IP address and port that the client used when making the connection. Otherwise, when true, the connection will originate from an IP address and port assigned by the Linux kernel that is owned by the operating system
type PacketConn ¶
PacketConn wraps net.UDPConn to show difference
func DialUDP ¶
DialUDP connects to the remote address raddr on the network net, which must be "udp", "udp4", or "udp6". If laddr is not nil, it is used as the local address for the connection.
func ListenUDP ¶
func ListenUDP(network string, laddr *net.UDPAddr) (PacketConn, error)
ListenUDP will construct a new UDP listener socket with the Linux IP_TRANSPARENT option set on the underlying socket
func (PacketConn) ReadFromUDPAddrPortTProxy ¶
func (conn PacketConn) ReadFromUDPAddrPortTProxy(b []byte) (int, netip.AddrPort, netip.AddrPort, error)
ReadFromUDPAddrPortTProxy reads a UDP packet from c, copying the payload into b. It returns the number of bytes copied into b and the return address that was on the packet.
Out-of-band data is also read in so that the original destination address can be identified and parsed.
func (PacketConn) ReadFromUDPTProxy ¶
ReadFromUDPTProxy reads a UDP packet from c, copying the payload into b. It returns the number of bytes copied into b and the return address that was on the packet.
Out-of-band data is also read in so that the original destination address can be identified and parsed.
type TCPListener ¶
type TCPListener struct {
*net.TCPListener
}
Listener describes a TCP Listener with the Linux IP_TRANSPARENT option defined on the listening socket
func ListenTCP ¶
func ListenTCP(network string, laddr *net.TCPAddr) (TCPListener, error)
ListenTCP will construct a new TCP listener socket with the Linux IP_TRANSPARENT option set on the underlying socket
func (TCPListener) Accept ¶
func (ln TCPListener) Accept() (net.Conn, error)
Accept waits for and returns the next connection to the listener.
This command wraps the AcceptTProxy method of the Listener
func (TCPListener) AcceptTProxy ¶
func (ln TCPListener) AcceptTProxy() (Conn, error)
AcceptTProxy will accept a TCP connection and wrap it to a TProxy connection to provide TProxy functionality
func (TCPListener) Addr ¶
func (ln TCPListener) Addr() net.Addr
Addr returns the network address the listener is accepting connections from
func (TCPListener) Close ¶
func (ln TCPListener) Close() error
Close will close the listener from accepting any more connections. Any blocked connections will unblock and close