tproxy

package
v1.12.16 Latest Latest
Warning

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

Go to latest
Published: May 20, 2024 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Overview

This code below is referenced at https://github.com/Asphaltt/go-tproxy/blob/master/tproxy_tcp.go Because the code needs to be customized somewhere, the project is not directly imported

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DialTCP

func DialTCP(laddr, raddr *net.TCPAddr, isnonblocking bool) (*net.TCPConn, error)

DialTCP will open a TCP connection to the specified destination with the specified local address.

func ListenTCP

func ListenTCP(network string, laddr *net.TCPAddr) (net.Listener, error)

ListenTCP will construct a new TCP listener socket with the Linux IP_TRANSPARENT option set on the underlying socket

Types

type Conn

type Conn struct {
	*net.TCPConn
}

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

type Listener

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

Listener describes a TCP Listener with the Linux IP_TRANSPARENT option defined on the listening socket

func (*Listener) Accept

func (listener *Listener) 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 (*Listener) AcceptTProxy

func (listener *Listener) AcceptTProxy() (*Conn, error)

AcceptTProxy will accept a TCP connection and wrap it to a TProxy connection to provide TProxy functionality

func (*Listener) Addr

func (listener *Listener) Addr() net.Addr

Addr returns the network address the listener is accepting connections from

func (*Listener) Close

func (listener *Listener) Close() error

Close will close the listener from accepting any more connections. Any blocked connections will unblock and close

Jump to

Keyboard shortcuts

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