tun2socks

package
v0.0.0-...-4cf4c4f Latest Latest
Warning

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

Go to latest
Published: Apr 24, 2022 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ConnectIntraTunnel

func ConnectIntraTunnel(fd int, fakedns string, dohdns doh.Transport, protector protect.Protector, listener intra.Listener) (intra.Tunnel, error)

ConnectIntraTunnel reads packets from a TUN device and applies the Intra routing rules. Currently, this only consists of redirecting DNS packets to a specified server; all other data flows directly to its destination.

`fd` is the TUN device. The IntraTunnel acquires an additional reference to it, which

is released by IntraTunnel.Disconnect(), so the caller must close `fd` _and_ call
Disconnect() in order to close the TUN device.

`fakedns` is the DNS server that the system believes it is using, in "host:port" style.

The port is normally 53.

`udpdns` and `tcpdns` are the location of the actual DNS server being used. For DNS

tunneling in Intra, these are typically high-numbered ports on localhost.

`dohdns` is the initial DoH transport. It must not be `nil`. `protector` is a wrapper for Android's VpnService.protect() method. `listener` will be provided with a summary of each TCP and UDP socket when it is closed.

Throws an exception if the TUN file descriptor cannot be opened, or if the tunnel fails to connect.

func NewDoHTransport

func NewDoHTransport(url string, ips string, protector protect.Protector, auth doh.ClientAuth, listener intra.Listener) (doh.Transport, error)

NewDoHTransport returns a DNSTransport that connects to the specified DoH server. `url` is the URL of a DoH server (no template, POST-only). If it is nonempty, it

overrides `udpdns` and `tcpdns`.

`ips` is an optional comma-separated list of IP addresses for the server. (This

wrapper is required because gomobile can't make bindings for []string.)

`protector` is the socket protector to use for all external network activity. `auth` will provide a client certificate if required by the TLS server. `listener` will be notified after each DNS query succeeds or fails.

Types

This section is empty.

Jump to

Keyboard shortcuts

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