gotun2socks

package module
v0.0.0-...-6fb6714 Latest Latest
Warning

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

Go to latest
Published: Dec 22, 2016 License: BSD-2-Clause Imports: 11 Imported by: 0

README

gotun2socks

A Golang implementation of tun2socks, including a library and a binary program.

The binary program works on Linux, OS X and Windows.

Usage

Windows users need to install TAP-windows driver first.

The binary program will create tun/tap device, config its IP address. On Windows, it also configs DNS resolvers of the opened tun/tap device.

Users need to change routing table so that packets are sent through the tun/tap device. Generaly the process includes changing default route to the tun/tap device, and exclude IP addresses of remote servers to go through the original network device so that traffic forwarded from local SOCKS5 proxy to remote servers would not loop back. See Tun2Socks Introduction for how to change routing table. Linux and OS X users may also need to change system DNS resolvers in case the resolvers are not accessible by remote servers.

UDP forwarding

This implementation forwards UDP using standard SOCKS5 UDP request/reply. Thus to make UDP-based protocols (such as DNS) work, it needs to be chained with a UDP-enabled SOCKS5 proxy.

Credits

Documentation

Index

Constants

View Source
const (
	// simplified server-side tcp states
	CLOSED      tcpState = 0x0
	SYN_RCVD    tcpState = 0x1
	ESTABLISHED tcpState = 0x2
	FIN_WAIT_1  tcpState = 0x3
	FIN_WAIT_2  tcpState = 0x4
	CLOSING     tcpState = 0x5
	LAST_ACK    tcpState = 0x6
	TIME_WAIT   tcpState = 0x7

	MAX_RECV_WINDOW int = 65535
	MAX_SEND_WINDOW int = 65535
)
View Source
const (
	MTU = 1500
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Tun2Socks

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

func New

func New(dev io.ReadWriteCloser, localSocksAddr string, dnsServers []string, publicOnly bool, enableDnsCache bool) *Tun2Socks

func (*Tun2Socks) Run

func (t2s *Tun2Socks) Run()

func (*Tun2Socks) Stop

func (t2s *Tun2Socks) Stop()

Directories

Path Synopsis
bin
internal

Jump to

Keyboard shortcuts

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