Source file src/vendor/golang.org/x/net/quic/udp.go

     1  // 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  package quic
     6  
     7  import "net/netip"
     8  
     9  // Per-plaform consts describing support for various features.
    10  //
    11  // const udpECNSupport indicates whether the platform supports setting
    12  // the ECN (Explicit Congestion Notification) IP header bits.
    13  //
    14  // const udpInvalidLocalAddrIsError indicates whether sending a packet
    15  // from an local address not associated with the system is an error.
    16  // For example, assuming 127.0.0.2 is not a local address, does sending
    17  // from it (using IP_PKTINFO or some other such feature) result in an error?
    18  
    19  // unmapAddrPort returns a with any IPv4-mapped IPv6 address prefix removed.
    20  func unmapAddrPort(a netip.AddrPort) netip.AddrPort {
    21  	if a.Addr().Is4In6() {
    22  		return netip.AddrPortFrom(
    23  			a.Addr().Unmap(),
    24  			a.Port(),
    25  		)
    26  	}
    27  	return a
    28  }
    29  

View as plain text