]> Cypherpunks repositories - gostls13.git/commitdiff
doc/go1.18: add net/netip
authorBrad Fitzpatrick <bradfitz@golang.org>
Tue, 2 Nov 2021 05:25:55 +0000 (22:25 -0700)
committerBrad Fitzpatrick <bradfitz@golang.org>
Tue, 2 Nov 2021 06:20:21 +0000 (06:20 +0000)
Updates #46518

Change-Id: Iefc2fec93becc7b36ba2b933ae79f7c9424317fc
Reviewed-on: https://go-review.googlesource.com/c/go/+/360634
Reviewed-by: Ian Lance Taylor <iant@golang.org>
Trust: Brad Fitzpatrick <bradfitz@golang.org>

doc/go1.18.html

index 6fe993d51b5327d666a6fc38afcdcfb6720d1db1..82fe6f452019f5d4a06c403b0f7cf03f530b3940 100644 (file)
@@ -123,10 +123,33 @@ Do not send CLs removing the interior tags from such phrases.
 
 <h2 id="library">Core library</h2>
 
+<h3>TODO</h3>
 <p>
   TODO: complete this section
 </p>
 
+<h3 id="netip">New <code>net/netip</code> package</h3>
+<p>
+  The new <a href="/pkg/net/netip/"><code>net/netip</code></a>
+  package defines a new IP address type, <a href="/pkg/net/netip/#Addr"><code>Addr</code></a>
+  that's a small, comparable, value type. Compared to the existing
+  <a href="/pkg/net/#IP"><code>net.IP</code></a> type, the <code>netip.Addr</code> type takes less
+  memory, is immutable, and is comparable so it supports <code>==</code>
+  and can be used as a map key.
+</p>
+<p>
+  In addition to <code>Addr</code>, the package defines
+  <a href="/pkg/net/netip/#AddrPort"><code>AddrPort</code></a>, representing
+  an IP and port, and
+  <a href="/pkg/net/netip/#Prefix"><code>Prefix</code></a>, representing
+  a network CIDR prefix.
+</p>
+<p>
+  The <code>net</code> package now has methods to send and receive UDP packets
+  using <code>netip.Addr</code> values instead of the relatively heavy
+  <code>*net.UDPAddr</code> values.
+</p>
+
 <h3 id="minor_library_changes">Minor changes to the library</h3>
 
 <p>