dnsutil

package
v0.5.2 Latest Latest
Warning

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

Go to latest
Published: Oct 22, 2026 License: GPL-2.0 Imports: 18 Imported by: ? 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

Copyright (C) 2026 by saba <contact me via issue>

This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.

You should have received a copy of the GNU General Public License along with this program. If not, see <http://www.gnu.org/licenses/>.

In addition, no derivative work may use the name or imply association with this application without prior consent.

Copyright (C) 2026 by saba <contact me via issue>

This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.

You should have received a copy of the GNU General Public License along with this program. If not, see <http://www.gnu.org/licenses/>.

In addition, no derivative work may use the name or imply association with this application without prior consent.

Copyright (C) 2026 by saba <contact me via issue>

This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.

You should have received a copy of the GNU General Public License along with this program. If not, see <http://www.gnu.org/licenses/>.

In addition, no derivative work may use the name or imply association with this application without prior consent.

Copyright (C) 2026 by saba <contact me via issue>

This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.

You should have received a copy of the GNU General Public License along with this program. If not, see <http://www.gnu.org/licenses/>.

In addition, no derivative work may use the name or imply association with this application without prior consent.

Copyright (C) 2026 by saba <contact me via issue>

This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.

You should have received a copy of the GNU General Public License along with this program. If not, see <http://www.gnu.org/licenses/>.

In addition, no derivative work may use the name or imply association with this application without prior consent.

Copyright (C) 2026 by saba <contact me via issue>

This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.

You should have received a copy of the GNU General Public License along with this program. If not, see <http://www.gnu.org/licenses/>.

In addition, no derivative work may use the name or imply association with this application without prior consent.

Copyright (C) 2026 by saba <contact me via issue>

This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.

You should have received a copy of the GNU General Public License along with this program. If not, see <http://www.gnu.org/licenses/>.

In addition, no derivative work may use the name or imply association with this application without prior consent.

Index

Constants

This section is empty.

Variables

View Source
var ClientResolver = sync.OnceValue(func() *Resolver {
	r, err := NewResolver(RecommendedClientOptions())
	if err != nil {
		panic("dnsutil: invalid built-in client options: " + err.Error())
	}
	return r
})

ClientResolver is the shared IPv4-only resolver for client-side lookups of public destinations such as PAC/geodata downloads.

Functions

func NewOutboundHTTPClient

func NewOutboundHTTPClient(timeout time.Duration, resolver *Resolver) *http.Client

NewOutboundHTTPClient returns a client that dials through OutboundDialer and resolves destinations with resolver, falling back to the dialer's own lookup.

func OutboundDialer

func OutboundDialer(timeout time.Duration) *net.Dialer

OutboundDialer returns a net.Dialer that applies best-effort platform-specific outbound bypass options when the host process provides them via environment variables.

func ParseIPLiteral added in v0.5.2

func ParseIPLiteral(s string) (netip.Addr, bool)

ParseIPLiteral parses s as an IP address without a zone. Names are rejected before netip.ParseAddr so the common hostname path allocates nothing.

func Resolve added in v0.5.2

func Resolve(ctx context.Context, addr string) (string, error)

Resolve resolves addr with the process-wide system-DNS resolver.

Types

type Options

type Options struct {
	Timeout time.Duration
	Servers []ServerOptions
}

Options is the name-server policy of a Resolver; RecommendedClientOptions is its only producer.

func RecommendedClientOptions

func RecommendedClientOptions() Options

RecommendedClientOptions is the built-in target-DNS policy used by the mixed proxy client.

type Resolver

type Resolver struct {
	// contains filtered or unexported fields
}

func NewResolver

func NewResolver(opts Options) (*Resolver, error)

func (*Resolver) Resolve

func (r *Resolver) Resolve(ctx context.Context, addr string) (string, error)

Resolve replaces the host of a host:port address with its first IPv4 address.

type ServerOptions

type ServerOptions struct {
	Type      string   // serverTypeDoH or serverTypeLocal
	Address   string   // DoH host name; the port is always 443
	Bootstrap []string // DoH server IPs dialed instead of resolving Address
}

Jump to

Keyboard shortcuts

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