Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

database64128 opened this issue Jun 14, 2024 · 1 comment


Copy link

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).

Copy link

Very Very Very good

@gopherbot gopherbot added this to the Proposal milestone Jun 17, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Status: Incoming

No branches or pull requests

3 participants