Skip to content

proposal: net: export supportsIPv4, supportsIPv6, supportsIPv4map #67991

@database64128

Description

@database64128

Proposal Details

The net package queries and caches the capabilities of the system IP stack, and calls these functions to determine the type of socket to open when user code calls Dial, Listen and friends. It'd be nice if user code that opens sockets by hand can conveniently call these existing functions, instead of having to duplicate the feature in user code, or resorting to linkname.

The proposal is to add the following:

// SupportsIPv4 reports whether the platform supports IPv4 networking
// functionality.
func SupportsIPv4() bool

// SupportsIPv6 reports whether the platform supports IPv6 networking
// functionality.
func SupportsIPv6() bool

// SupportsIPv4map reports whether the platform supports mapping an
// IPv4 address inside an IPv6 address at transport layer
// protocols. See RFC 4291, RFC 4038 and RFC 3493.
func SupportsIPv4map() bool

This proposal, if accepted, will allow tfo-go to drop its linkname against net.favoriteAddrFamily.

For #67401 (comment).

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    Status

    Incoming

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions