Documentation ¶
Overview ¶
Package protected is used for creating "protected" connections that bypass Android's VpnService
Index ¶
- Constants
- Variables
- func Configure(protect Protect, dnsServer string)
- func Dial(network, addr string, timeout time.Duration) (net.Conn, error)
- func DialContext(ctx context.Context, network, addr string) (net.Conn, error)
- func DialContextOptions(ctx context.Context, network, addr string, opt *NetOptions) (net.Conn, error)
- func DialUDP(network string, laddr, raddr *net.UDPAddr) (net.PacketConn, error)
- func ListenTCP(laddr *net.TCPAddr, options *NetOptions) (net.Listener, error)
- func ListenUDP(network string, laddr *net.UDPAddr) (net.PacketConn, error)
- func Resolve(network string, addr string) (*net.TCPAddr, error)
- func SetDNSServer(server string)
- func SplitHostPort(addr string) (string, int, error)
- func SupportReusePort() bool
- type DNSRecord
- type DnsResponse
- type NetOptions
- type Protect
- type ProtectedConn
- type ProtectedConnBase
- type ProtectedPacketConn
Constants ¶
View Source
const (
SO_MARK = 0x24
)
Variables ¶
View Source
var SocketMark int
Functions ¶
func DialContext ¶
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 DialContextOptions ¶
func Resolve ¶
Resolve resolves the given address using a DNS lookup on a UDP socket protected by the currnet Protector.
func SetDNSServer ¶
func SetDNSServer(server string)
func SplitHostPort ¶
wrapper around net.SplitHostPort that also converts uses strconv to convert the port to an int
func SupportReusePort ¶
func SupportReusePort() bool
Types ¶
type DnsResponse ¶
type DnsResponse struct {
// contains filtered or unexported fields
}
func DnsLookup ¶
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 ¶
func (response *DnsResponse) PickRecord() (*DNSRecord, error)
type NetOptions ¶
type ProtectedConn ¶
type ProtectedConn struct { net.Conn ProtectedConnBase }
func (*ProtectedConn) Close ¶
func (conn *ProtectedConn) Close() (err error)
Close is used to destroy a protected connection
type ProtectedConnBase ¶
type ProtectedConnBase struct {
// contains filtered or unexported fields
}
type ProtectedPacketConn ¶
type ProtectedPacketConn struct { ProtectedConnBase net.PacketConn // contains filtered or unexported fields }
func (*ProtectedPacketConn) Close ¶
func (c *ProtectedPacketConn) Close() error
Click to show internal directories.
Click to hide internal directories.