blob: 0a578286b23623a2bbb75d322c2c0eed5d0cacff [file] [log] [blame]
Damien Neila6a24dd2024-02-15 09:52:29 -08001// Copyright 2023 The Go Authors. All rights reserved.
2// Use of this source code is governed by a BSD-style
3// license that can be found in the LICENSE file.
4
5//go:build go1.21
6
7package quic
8
9import "net/netip"
10
11// Per-plaform consts describing support for various features.
12//
13// const udpECNSupport indicates whether the platform supports setting
14// the ECN (Explicit Congestion Notification) IP header bits.
15//
16// const udpInvalidLocalAddrIsError indicates whether sending a packet
17// from an local address not associated with the system is an error.
18// For example, assuming 127.0.0.2 is not a local address, does sending
19// from it (using IP_PKTINFO or some other such feature) result in an error?
20
21// unmapAddrPort returns a with any IPv4-mapped IPv6 address prefix removed.
22func unmapAddrPort(a netip.AddrPort) netip.AddrPort {
23 if a.Addr().Is4In6() {
24 return netip.AddrPortFrom(
25 a.Addr().Unmap(),
26 a.Port(),
27 )
28 }
29 return a
30}