resolver

package
v0.4.3 Latest Latest
Warning

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

Go to latest
Published: Oct 17, 2026 License: Apache-2.0 Imports: 13 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package resolver 让程序的出站域名解析使用自定义 DNS 服务器,支持普通 DNS 与 DNS over HTTPS。

服务器写法(与 Lucky 兼容):

223.5.5.5              普通 DNS,默认 53 端口
223.5.5.5:5353         普通 DNS,指定端口
doh@223.5.5.5          DoH,地址为 https://223.5.5.5/dns-query
doh@dns.alidns.com/x   DoH,自定义路径
https://doh.pub/dns-query

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Install

func Install(list []string) error

Install 设置全局解析器;list 为空时恢复系统默认。无效项被忽略并返回错误。

func New

func New(servers []Server) *net.Resolver

New 创建依次尝试各服务器的解析器。

func Validate

func Validate(list []string) error

Validate 校验一组服务器配置。

Types

type Server

type Server struct {
	// Addr 为普通 DNS 的 IP:端口;DoH 时为空
	Addr string
	// URL 为 DoH 地址
	URL string
}

Server 是解析后的一个 DNS 服务器。

func Parse

func Parse(s string) (Server, error)

Parse 解析一项服务器配置。

Jump to

Keyboard shortcuts

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