mirror of
https://github.com/golang/go
synced 2024-09-05 16:04:50 +00:00
doc/go1.18: add net/netip
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>
This commit is contained in:
parent
4633b2db4b
commit
c1ea3395a6
|
@ -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>
|
||||
|
|
Loading…
Reference in a new issue