-
Notifications
You must be signed in to change notification settings - Fork 619
Upgrade default golang to 1.22.5 and backport the fix for 1.18 #9958
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
Merged
Merged
Changes from all commits
Commits
Show all changes
3 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,193 @@ | ||
| diff --git a/src/net/netip/inlining_test.go b/src/net/netip/inlining_test.go | ||
| index 107fe1f083..1250c37725 100644 | ||
| --- a/src/net/netip/inlining_test.go | ||
| +++ b/src/net/netip/inlining_test.go | ||
| @@ -41,8 +41,6 @@ func TestInlining(t *testing.T) { | ||
| "Addr.Is4", | ||
| "Addr.Is4In6", | ||
| "Addr.Is6", | ||
| - "Addr.IsLoopback", | ||
| - "Addr.IsMulticast", | ||
| "Addr.IsInterfaceLocalMulticast", | ||
| "Addr.IsValid", | ||
| "Addr.IsUnspecified", | ||
| diff --git a/src/net/netip/netip.go b/src/net/netip/netip.go | ||
| index f27984ab57..310e4e5bf4 100644 | ||
| --- a/src/net/netip/netip.go | ||
| +++ b/src/net/netip/netip.go | ||
| @@ -75,6 +75,9 @@ var ( | ||
| // address ff02::1. | ||
| func IPv6LinkLocalAllNodes() Addr { return AddrFrom16([16]byte{0: 0xff, 1: 0x02, 15: 0x01}) } | ||
|
|
||
| +// IPv6Loopback returns the IPv6 loopback address ::1. | ||
| +func IPv6Loopback() Addr { return AddrFrom16([16]byte{15: 0x01}) } | ||
| + | ||
| // IPv6Unspecified returns the IPv6 unspecified address "::". | ||
| func IPv6Unspecified() Addr { return Addr{z: z6noz} } | ||
|
|
||
| @@ -515,6 +518,9 @@ func (ip Addr) hasZone() bool { | ||
|
|
||
| // IsLinkLocalUnicast reports whether ip is a link-local unicast address. | ||
| func (ip Addr) IsLinkLocalUnicast() bool { | ||
| + if ip.Is4In6() { | ||
| + ip = ip.Unmap() | ||
| + } | ||
| // Dynamic Configuration of IPv4 Link-Local Addresses | ||
| // https://datatracker.ietf.org/doc/html/rfc3927#section-2.1 | ||
| if ip.Is4() { | ||
| @@ -530,6 +536,9 @@ func (ip Addr) IsLinkLocalUnicast() bool { | ||
|
|
||
| // IsLoopback reports whether ip is a loopback address. | ||
| func (ip Addr) IsLoopback() bool { | ||
| + if ip.Is4In6() { | ||
| + ip = ip.Unmap() | ||
| + } | ||
| // Requirements for Internet Hosts -- Communication Layers (3.2.1.3 Addressing) | ||
| // https://datatracker.ietf.org/doc/html/rfc1122#section-3.2.1.3 | ||
| if ip.Is4() { | ||
| @@ -545,6 +554,9 @@ func (ip Addr) IsLoopback() bool { | ||
|
|
||
| // IsMulticast reports whether ip is a multicast address. | ||
| func (ip Addr) IsMulticast() bool { | ||
| + if ip.Is4In6() { | ||
| + ip = ip.Unmap() | ||
| + } | ||
| // Host Extensions for IP Multicasting (4. HOST GROUP ADDRESSES) | ||
| // https://datatracker.ietf.org/doc/html/rfc1112#section-4 | ||
| if ip.Is4() { | ||
| @@ -563,7 +575,7 @@ func (ip Addr) IsMulticast() bool { | ||
| func (ip Addr) IsInterfaceLocalMulticast() bool { | ||
| // IPv6 Addressing Architecture (2.7.1. Pre-Defined Multicast Addresses) | ||
| // https://datatracker.ietf.org/doc/html/rfc4291#section-2.7.1 | ||
| - if ip.Is6() { | ||
| + if ip.Is6() && !ip.Is4In6() { | ||
| return ip.v6u16(0)&0xff0f == 0xff01 | ||
| } | ||
| return false // zero value | ||
| @@ -571,6 +583,9 @@ func (ip Addr) IsInterfaceLocalMulticast() bool { | ||
|
|
||
| // IsLinkLocalMulticast reports whether ip is a link-local multicast address. | ||
| func (ip Addr) IsLinkLocalMulticast() bool { | ||
| + if ip.Is4In6() { | ||
| + ip = ip.Unmap() | ||
| + } | ||
| // IPv4 Multicast Guidelines (4. Local Network Control Block (224.0.0/24)) | ||
| // https://datatracker.ietf.org/doc/html/rfc5771#section-4 | ||
| if ip.Is4() { | ||
| @@ -599,6 +614,9 @@ func (ip Addr) IsGlobalUnicast() bool { | ||
| return false | ||
| } | ||
|
|
||
| + if ip.Is4In6() { | ||
| + ip = ip.Unmap() | ||
| + } | ||
| // Match package net's IsGlobalUnicast logic. Notably private IPv4 addresses | ||
| // and ULA IPv6 addresses are still considered "global unicast". | ||
| if ip.Is4() && (ip == IPv4Unspecified() || ip == AddrFrom4([4]byte{255, 255, 255, 255})) { | ||
| @@ -616,6 +634,10 @@ func (ip Addr) IsGlobalUnicast() bool { | ||
| // ip is in 10.0.0.0/8, 172.16.0.0/12, 192.168.0.0/16, or fc00::/7. This is the | ||
| // same as net.IP.IsPrivate. | ||
| func (ip Addr) IsPrivate() bool { | ||
| + if ip.Is4In6() { | ||
| + ip = ip.Unmap() | ||
| + } | ||
| + | ||
| // Match the stdlib's IsPrivate logic. | ||
| if ip.Is4() { | ||
| // RFC 1918 allocates 10.0.0.0/8, 172.16.0.0/12, and 192.168.0.0/16 as | ||
| diff --git a/src/net/netip/netip_test.go b/src/net/netip/netip_test.go | ||
| index d988864827..c7e458af43 100644 | ||
| --- a/src/net/netip/netip_test.go | ||
| +++ b/src/net/netip/netip_test.go | ||
| @@ -554,10 +554,13 @@ func TestIPProperties(t *testing.T) { | ||
| ilm6 = mustIP("ff01::1") | ||
| ilmZone6 = mustIP("ff01::1%eth0") | ||
|
|
||
| - private4a = mustIP("10.0.0.1") | ||
| - private4b = mustIP("172.16.0.1") | ||
| - private4c = mustIP("192.168.1.1") | ||
| - private6 = mustIP("fd00::1") | ||
| + private4a = mustIP("10.0.0.1") | ||
| + private4b = mustIP("172.16.0.1") | ||
| + private4c = mustIP("192.168.1.1") | ||
| + private6 = mustIP("fd00::1") | ||
| + private6mapped4a = mustIP("::ffff:10.0.0.1") | ||
| + private6mapped4b = mustIP("::ffff:172.16.0.1") | ||
| + private6mapped4c = mustIP("::ffff:192.168.1.1") | ||
|
|
||
| unspecified4 = AddrFrom4([4]byte{}) | ||
| unspecified6 = IPv6Unspecified() | ||
| @@ -584,6 +587,11 @@ func TestIPProperties(t *testing.T) { | ||
| ip: unicast4, | ||
| globalUnicast: true, | ||
| }, | ||
| + { | ||
| + name: "unicast v6 mapped v4Addr", | ||
| + ip: AddrFrom16(unicast4.As16()), | ||
| + globalUnicast: true, | ||
| + }, | ||
| { | ||
| name: "unicast v6Addr", | ||
| ip: unicast6, | ||
| @@ -605,6 +613,12 @@ func TestIPProperties(t *testing.T) { | ||
| linkLocalMulticast: true, | ||
| multicast: true, | ||
| }, | ||
| + { | ||
| + name: "multicast v6 mapped v4Addr", | ||
| + ip: AddrFrom16(multicast4.As16()), | ||
| + linkLocalMulticast: true, | ||
| + multicast: true, | ||
| + }, | ||
| { | ||
| name: "multicast v6Addr", | ||
| ip: multicast6, | ||
| @@ -622,6 +636,11 @@ func TestIPProperties(t *testing.T) { | ||
| ip: llu4, | ||
| linkLocalUnicast: true, | ||
| }, | ||
| + { | ||
| + name: "link-local unicast v6 mapped v4Addr", | ||
| + ip: AddrFrom16(llu4.As16()), | ||
| + linkLocalUnicast: true, | ||
| + }, | ||
| { | ||
| name: "link-local unicast v6Addr", | ||
| ip: llu6, | ||
| @@ -647,6 +666,11 @@ func TestIPProperties(t *testing.T) { | ||
| ip: loopback6, | ||
| loopback: true, | ||
| }, | ||
| + { | ||
| + name: "loopback v6 mapped v4Addr", | ||
| + ip: AddrFrom16(IPv6Loopback().As16()), | ||
| + loopback: true, | ||
| + }, | ||
| { | ||
| name: "interface-local multicast v6Addr", | ||
| ip: ilm6, | ||
| @@ -683,6 +707,24 @@ func TestIPProperties(t *testing.T) { | ||
| globalUnicast: true, | ||
| private: true, | ||
| }, | ||
| + { | ||
| + name: "private v6 mapped v4Addr 10/8", | ||
| + ip: private6mapped4a, | ||
| + globalUnicast: true, | ||
| + private: true, | ||
| + }, | ||
| + { | ||
| + name: "private v6 mapped v4Addr 172.16/12", | ||
| + ip: private6mapped4b, | ||
| + globalUnicast: true, | ||
| + private: true, | ||
| + }, | ||
| + { | ||
| + name: "private v6 mapped v4Addr 192.168/16", | ||
| + ip: private6mapped4c, | ||
| + globalUnicast: true, | ||
| + private: true, | ||
| + }, | ||
| { | ||
| name: "unspecified v4Addr", | ||
| ip: unspecified4, |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,7 +1,8 @@ | ||
| { | ||
| "Signatures": { | ||
| "go1.19.12.src.tar.gz": "ee5d50e0a7fd74ba1b137cb879609aaaef9880bf72b5d1742100e38ae72bb557", | ||
| "go1.4-bootstrap-20171003.tar.gz": "f4ff5b5eb3a3cae1c993723f3eab519c5bae18866b5e5f96fe1102f0cb5c3e52", | ||
| "go1.21.11.src.tar.gz": "42aee9bf2b6956c75a7ad6aa3f0a51b5821ffeac57f5a2e733a2d6eae1e6d9d2" | ||
| } | ||
| } | ||
| "Signatures": { | ||
| "go1.17.13.src.tar.gz": "a1a48b23afb206f95e7bbaa9b898d965f90826f6f1d1fc0c1d784ada0cd300fd", | ||
| "go1.21.6.src.tar.gz": "124926a62e45f78daabbaedb9c011d97633186a33c238ffc1e25320c02046248", | ||
| "go1.22.5.src.tar.gz": "ac9c723f224969aee624bc34fd34c9e13f2a212d75c71c807de644bb46e112f6", | ||
| "go1.4-bootstrap-20171003.tar.gz": "f4ff5b5eb3a3cae1c993723f3eab519c5bae18866b5e5f96fe1102f0cb5c3e52" | ||
| } | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.