tproxy

package
v0.0.0-...-4526a9f Latest Latest
Warning

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

Go to latest
Published: Feb 5, 2019 License: GPL-3.0 Imports: 5 Imported by: 0

README

Pass-through user IP manual

Description:

By Linux TPROXY function,you can achieve the source Station service program can see the client's real IP, to achieve this feature requires linux operating systems and programs must meet certain conditions.

Environmental requirements:

The source station must be a service program running on Linux, and Linux needs to meet the following conditions:

  1. Linux kernel version >= 2.6.28

  2. Determine whether the system supports TPROXY, execute:

    grep TPROXY /boot/config-uname -r

    If the output has the following result description is supported.

    CONFIG_NETFILTER_XT_TARGET_TPROXY=m

Deployment steps:

  1. The tproxy environment setup script should be executed with root privileges every time the boot from the source Linux system: tproxy_setup.sh

  2. Execute proxy proxy with root access on the source Linux system

Parameter-tproxy is the tproxy function that turns on the proxy.

./proxy -tproxy

  1. The IP address of the source station to listen to the program requires the use of: 127.0.1.1

For example, the address of the source station before listening is: 0.0.0.0:8800, now need to be modified to: 127.0.1.1:8800

  1. Forwarding rules inside the source address must be the corresponding, such as the above: 127.0.1.1:8800

Documentation

Overview

Package tproxy provides the TCPDial and TCPListen tproxy equivalent of the net package Dial and Listen with tproxy support for linux ONLY.

Index

Constants

View Source
const IP_ORIGADDRS = 20

Variables

View Source
var Debug = false

Debug outs the library in Debug mode

Functions

func IPTcpAddrToUnixSocksAddr

func IPTcpAddrToUnixSocksAddr(addr string) (sa unix.Sockaddr, err error)

IPTcpAddrToUnixSocksAddr returns Sockaddr for specified TCP addr.

func IPv6UdpAddrToUnixSocksAddr

func IPv6UdpAddrToUnixSocksAddr(addr string) (sa unix.Sockaddr, err error)

IPv6UdpAddrToUnixSocksAddr returns Sockaddr for specified IPv6 addr.

func TCPDial

func TCPDial(localAddr, remoteAddr string, timeout time.Duration) (conn net.Conn, err error)

TCPDial is a special tcp connection which binds a non local address as the source. Except then the option to bind to a specific local address which the machine doesn't posses it is exactly like any other net.Conn connection. It is advised to use port numbered 0 in the localAddr and leave the kernel to choose which Local port to use in order to avoid errors and binding conflicts.

func TCPListen

func TCPListen(listenAddr string) (listener net.Listener, err error)

TCPListen is listening for incoming IP packets which are being intercepted. In conflict to regular Listen mehtod the socket destination and source addresses are of the intercepted connection. Else then that it works exactly like net package net.Listen.

Types

This section is empty.

Jump to

Keyboard shortcuts

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