resolver

package
v0.14.1 Latest Latest
Warning

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

Go to latest
Published: May 8, 2026 License: GPL-3.0 Imports: 6 Imported by: 0

Documentation

Overview

Package resolver constructs *net.Resolver instances with optional SOCKS5 proxy support to prevent DNS leaks when the user configures a SOCKS5 proxy.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewResolver

func NewResolver(proxyURL string) (*net.Resolver, error)

NewResolver returns a *net.Resolver appropriate for the given proxy URL.

When proxyURL is empty, the ALL_PROXY environment variable is consulted via proxy.FromEnvironment(). If it resolves to a SOCKS5 dialer, DNS queries are tunnelled through it. HTTP/HTTPS proxies are intentionally ignored for DNS (only SOCKS5 can proxy raw TCP DNS traffic). If no usable proxy is found, the standard system resolver is returned (nil Dial field).

When proxyURL is a non-empty non-socks5 URL, the standard system resolver is returned.

When proxyURL is a socks5:// URL, DNS queries are tunnelled through the SOCKS5 proxy using DNS-over-TCP, preventing DNS leaks to the local ISP.

Types

This section is empty.

Jump to

Keyboard shortcuts

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