netpref

package
v1.1.1 Latest Latest
Warning

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

Go to latest
Published: Nov 21, 2026 License: MIT Imports: 4 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

Process wide preference for IPv4 that every outbound dial of the program follows

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ApplyIPv4Preference

func ApplyIPv4Preference(force bool)

Makes the default HTTP transport and every clone made after it resolve unspecified families as IPv4 first

func DialContext

func DialContext(dial func(ctx context.Context, network, addr string) (net.Conn, error)) func(ctx context.Context, network, addr string) (net.Conn, error)

Dial function that follows the process preference at each dial, so a preference set after a client was built still applies

func Follow

func Follow(t *http.Transport) *http.Transport

Makes a transport follow the process preference at each dial, whatever dial function it already carries

func IPv4Preferred

func IPv4Preferred() bool

Reports whether the process prefers IPv4 for connections that name no address family

Types

type DialFunc

type DialFunc func(ctx context.Context, network, addr string) (net.Conn, error)

Dial function shape of net.Dialer and http.Transport

func PreferIPv4

func PreferIPv4(dial DialFunc) DialFunc

Wraps dial so tcp and udp dials use the host's A records, falling back to full resolution when it has none

Jump to

Keyboard shortcuts

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