summaryrefslogtreecommitdiff
path: root/src/net/parse_test.go
Commit message (Collapse)AuthorAgeFilesLines
* net/netip: add new IP address packageBrad Fitzpatrick2021-11-021-27/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | | | Co-authored-by: Alex Willmer <alex@moreati.org.uk> (GitHub @moreati) Co-authored-by: Alexander Yastrebov <yastrebov.alex@gmail.com> Co-authored-by: David Anderson <dave@natulte.net> (Tailscale CLA) Co-authored-by: David Crawshaw <crawshaw@tailscale.com> (Tailscale CLA) Co-authored-by: Dmytro Shynkevych <dmytro@tailscale.com> (Tailscale CLA) Co-authored-by: Elias Naur <mail@eliasnaur.com> Co-authored-by: Joe Tsai <joetsai@digital-static.net> (Tailscale CLA) Co-authored-by: Jonathan Yu <jawnsy@cpan.org> (GitHub @jawnsy) Co-authored-by: Josh Bleecher Snyder <josharian@gmail.com> (Tailscale CLA) Co-authored-by: Maisem Ali <maisem@tailscale.com> (Tailscale CLA) Co-authored-by: Manuel Mendez (Go AUTHORS mmendez534@...) Co-authored-by: Matt Layher <mdlayher@gmail.com> Co-authored-by: Noah Treuhaft <noah.treuhaft@gmail.com> (GitHub @nwt) Co-authored-by: Stefan Majer <stefan.majer@gmail.com> Co-authored-by: Terin Stock <terinjokes@gmail.com> (Cloudflare CLA) Co-authored-by: Tobias Klauser <tklauser@distanz.ch> Fixes #46518 Change-Id: I0041f9e1115d61fa6e95fcf32b01d9faee708712 Reviewed-on: https://go-review.googlesource.com/c/go/+/339309 Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org> TryBot-Result: Go Bot <gobot@golang.org> Reviewed-by: Russ Cox <rsc@golang.org> Trust: Brad Fitzpatrick <bradfitz@golang.org>
* net: remove parsing of negative decimals in IPv4 literalJoe Tsai2016-09-071-3/+2
| | | | | | | | | | | | | | | | | | | | | | | | | https://golang.org/cl/27206 fixed the dtoi function such that it now properly parses negative number. Ironically, this causes several other functions that depended on dtoi to now (incorrectly) parse negative numbers. For example, ParseCIDR("-1.0.0.0/32") used to be rejected prior to the above CL, but is now accepted even though it is an invalid CIDR notation. This CL fixes that regression. We fix this by removing the signed parsing logic entirely from dtoi. It was introduced relatively recently in https://golang.org/cl/12447 to fix a bug where an invalid port was improperly being parsed as OK. It seems to me that the fix in that CL to the port handling logic was sufficient such that a change to dtoi was unnecessary. Updates #16350 Change-Id: I414bb1aa27d0a226ebd4b05a09cb40d784691b43 Reviewed-on: https://go-review.googlesource.com/28414 Reviewed-by: Matthew Dempsky <mdempsky@google.com> Reviewed-by: Mikio Hara <mikioh.mikioh@gmail.com> Run-TryBot: Joe Tsai <thebrokentoaster@gmail.com>
* net: simplify internal dtoi and xtoi funcsDan Peterson2016-08-171-1/+1
| | | | | | | | | | | | | Callers pass strings sliced as necessary instead of giving an offset. Fixes #16350 Change-Id: I7ba896f6ff09e0fd0094ca6c5af5d9a81622f15e Reviewed-on: https://go-review.googlesource.com/27206 Run-TryBot: Matthew Dempsky <mdempsky@google.com> Reviewed-by: Matthew Dempsky <mdempsky@google.com> TryBot-Result: Gobot Gobot <gobot@golang.org>
* net: make Dial, Listen{,Packet} for TCP/UDP with invalid port failMikio Hara2015-11-011-0/+22
| | | | | | | | | | | | | | | This change makes Dial, Listen and ListenPacket with invalid port fail whatever GODEBUG=netdns is. Please be informed that cgoLookupPort with an out of range literal number may return either the lower or upper bound value, 0 or 65535, with no error on some platform. Fixes #11715. Change-Id: I43f9c4fb5526d1bf50b97698e0eb39d29fd74c35 Reviewed-on: https://go-review.googlesource.com/12447 Reviewed-by: Ian Lance Taylor <iant@golang.org>
* net: add mechanisms to force go or cgo lookup, and to debug default strategyBrad Fitzpatrick2015-07-091-0/+27
| | | | | | | | | | | | | | | | | | | | GODEBUG=netdns=1 prints a one-time strategy decision. (cgo or go DNS lookups) GODEBUG=netdns=2 prints the per-lookup strategy as a function of the hostname. The new "netcgo" build tag forces cgo DNS lookups. GODEBUG=netdns=go (or existing build tag "netgo") forces Go DNS resolution. GODEBUG=netdns=cgo (or new build tag "netcgo") forces libc DNS resolution. Options can be combined with e.g. GODEBUG=netdns=go+1 or GODEBUG=netdns=2+cgo. Fixes #11322 Fixes #11450 Change-Id: I7a67e9f759fd0a02320e7803f9ded1638b19e861 Reviewed-on: https://go-review.googlesource.com/11584 Reviewed-by: Russ Cox <rsc@golang.org> Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
* net: simplify error messages in testsMikio Hara2015-05-061-5/+4
| | | | | | | | | | | | | This change simplifies unnecessarily redundant error messages in tests. There's no need to worry any more because package APIs now return consistent, self-descriptive error values. Alos renames ambiguous test functions and makes use of test tables. Change-Id: I7b61027607c4ae2a3cf605d08d58cf449fa27eb2 Reviewed-on: https://go-review.googlesource.com/9662 Reviewed-by: Ian Lance Taylor <iant@golang.org> Run-TryBot: Mikio Hara <mikioh.mikioh@gmail.com>
* build: move package sources from src/pkg to srcRuss Cox2014-09-081-0/+53
Preparation was in CL 134570043. This CL contains only the effect of 'hg mv src/pkg/* src'. For more about the move, see golang.org/s/go14nopkg.