Documentation ¶
Overview ¶
Copyright (c) 2020 RethinkDNS and its authors.
This Source Code Form is subject to the terms of the Mozilla Public License, v. 2.0. If a copy of the MPL was not distributed with this file, You can obtain one at http://mozilla.org/MPL/2.0/.
Index ¶
Constants ¶
const BlockModeFilter int = 1
BlockModeFilter filters packets on connection establishment.
const BlockModeFilterProc int = 3
BlockModeFilterProc determines owner-uid of a tcp/udp connection from procfs before filtering
const BlockModeNone int = 0
BlockModeNone filters no packet.
const BlockModeSink int = 2
BlockModeSink blackholes all packets.
const DNSModeIP int = 1
DNSModeIP redirects DNS requests sent to the IP endpoint set by VPN.
const DNSModeNone = 0
DNSModeNone does not redirect DNS queries sent to the tunnel.
const DNSModePort int = 2
DNSModePort redirects all DNS requests on port 53.
const IP4 = "4"
const IP46 = "46"
const IP6 = "6"
const NICID = 0x01
const Ns4 = 0b010 // 2
msb to lsb: ipv6, ipv4, lwip(1) or netstack(0)
const Ns46 = 0b110 // 6
const Ns6 = 0b100 // 4
const PtModeAuto int = 0
PtModeAuto does not enforce (but may still use) 6to4 protocol translation.
const PtModeForce64 int = 1
PtModeForce64 enforces 6to4 protocol translation.
const PtModeNo46 int = 2
Android implements 464Xlat out-of-the-box, so this zero userspace impl
Variables ¶
var Debug bool = false
Functions ¶
Types ¶
type DNSOptions ¶
type DNSOptions struct {
// contains filtered or unexported fields
}
DNSOptions define https or socks5 proxy options
func NewDNSOptions ¶
func NewDNSOptions(ipport string) (*DNSOptions, error)
NewDNSOptions returns a new DNSOpitons object.
func NewDNSOptionsFromHostname ¶
func NewDNSOptionsFromHostname(hostname, ipcsv string) (*DNSOptions, error)
func NewDNSOptionsFromNetIp ¶
func NewDNSOptionsFromNetIp(ipp netip.AddrPort) (*DNSOptions, error)
func (*DNSOptions) AddrPort ¶
func (d *DNSOptions) AddrPort() string
func (*DNSOptions) ResolvedAddrs ¶
func (d *DNSOptions) ResolvedAddrs() string
func (*DNSOptions) String ¶
func (d *DNSOptions) String() string
type ProxyOptions ¶
type ProxyOptions struct { Auth *proxy.Auth IP string // just the ip Host string // just the hostname (no port) Port string // just the port number IPPort string // may be a url or ip:port Scheme string // http, https, socks5, pip Addrs []string // list of ips if ipport is a url; may be nil }
ProxyOptions define https or socks5 proxy options
func NewAuthProxyOptions ¶
func NewAuthProxyOptions(scheme, username, password, ip, port string, addrs []string) *ProxyOptions
NewAuthProxyOptions returns a new ProxyOptions object with authentication object.
func NewProxyOptions ¶
func NewProxyOptions(ip string, port string) *ProxyOptions
NewProxyOptions returns a new ProxyOptions object.
func (*ProxyOptions) FullUrl ¶
func (p *ProxyOptions) FullUrl() string
func (*ProxyOptions) HasAuth ¶
func (p *ProxyOptions) HasAuth() bool
func (*ProxyOptions) String ¶
func (p *ProxyOptions) String() string
func (*ProxyOptions) Url ¶
func (p *ProxyOptions) Url() string
type TunMode ¶
type TunMode struct { // DNSMode specifies the kind of DNS traffic to be trapped and routed to DoH servers DNSMode int // BlockMode instructs change in firewall behaviour. BlockMode int // PtMode determines 6to4 translation heuristics. PtMode int }
TunMode specifies dns, firewall, xlat, and ip modes
func DefaultTunMode ¶
func DefaultTunMode() *TunMode
DefaultTunMode returns a new default TunMode with IP-only DNS capture and replay (not all DNS traffic but only the DNS traffic sent to [tcp/udp]handler.fakedns is captured and replayed to the remote DoH server) and with firewall disabled.
func NewTunMode ¶
NewTunMode returns a new TunMode object. `d` sets dns-mode. `b` sets block-mode. `pt` sets natpt-mode.