Documentation ¶
Overview ¶
Package protected is used for creating "protected" connections that bypass Android's VpnService
Index ¶
- func Configure(protect Protect, dnsServer string)
- func Dial(network, addr string, timeout time.Duration) (net.Conn, error)
- func Resolve(network string, addr string) (*net.TCPAddr, error)
- func SetDNSServer(server string)
- func SplitHostPort(addr string) (string, int, error)
- type DNSRecord
- type DnsResponse
- type Protect
- type ProtectedConn
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Dial ¶
Dial creates a new protected connection, it assumes that the address has already been resolved to an IPv4 address.
- syscall API calls are used to create and bind to the specified system device (this is primarily used for Android VpnService routing functionality)
func Resolve ¶
Resolve resolves the given address using a DNS lookup on a UDP socket protected by the currnet Protector.
func SetDNSServer ¶ added in v0.26.0
func SetDNSServer(server string)
Types ¶
type DnsResponse ¶
type DnsResponse struct {
// contains filtered or unexported fields
}
func DnsLookup ¶ added in v0.26.0
func DnsLookup(addr string, conn net.Conn) (*DnsResponse, error)
dnsLookup is used whenever we need to conduct a DNS query over a given TCP connection
func (*DnsResponse) PickRandomIP ¶
func (response *DnsResponse) PickRandomIP() (net.IP, error)
PickRandomIP picks a random IP address from a DNS response
func (*DnsResponse) PickRecord ¶ added in v0.26.0
func (response *DnsResponse) PickRecord() (*DNSRecord, error)
type ProtectedConn ¶
func (*ProtectedConn) Close ¶
func (conn *ProtectedConn) Close() (err error)
Close is used to destroy a protected connection
func (*ProtectedConn) GetConn ¶
func (conn *ProtectedConn) GetConn() net.Conn
cleanup is ran whenever we encounter a socket error we use a mutex since this connection is active in a variety of goroutines and to prevent any possible race conditions