summaryrefslogtreecommitdiff
path: root/src/net/parse.go
Commit message (Collapse)AuthorAgeFilesLines
* net: expand nss myhostname fallback detectionDan Peterson2016-11-291-8/+14
| | | | | | | | | | | | | Expand myhostname fallback detection to properly detect the local hostname in addition to other supported special names and suffixes. Fixes #17967 Change-Id: I1fe141fd9838b25886c08b6f2fd325e58be60457 Reviewed-on: https://go-review.googlesource.com/33550 Reviewed-by: Matthew Dempsky <mdempsky@google.com> Run-TryBot: Matthew Dempsky <mdempsky@google.com> TryBot-Result: Gobot Gobot <gobot@golang.org>
* net: remove parsing of negative decimals in IPv4 literalJoe Tsai2016-09-071-13/+1
| | | | | | | | | | | | | | | | | | | | | | | | | 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-11/+11
| | | | | | | | | | | | | 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>
* all: remove unnecessary type conversionsMatthew Dempsky2016-04-151-2/+2
| | | | | | | | | | | | | cmd and runtime were handled separately, and I'm intentionally skipped syscall. This is the rest of the standard library. CL generated mechanically with github.com/mdempsky/unconvert. Change-Id: I9e0eff886974dedc37adb93f602064b83e469122 Reviewed-on: https://go-review.googlesource.com/22104 Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org> Run-TryBot: Matthew Dempsky <mdempsky@google.com> TryBot-Result: Gobot Gobot <gobot@golang.org>
* net: check /etc/hosts for modifications every 5 seconds, not 5 minutesRuss Cox2016-01-061-0/+9
| | | | | | | | | | | | | | | | | But also cache the previous parsed form and don't reread if the size and modification time are both unchanged from before. On systems with stable /etc/hosts this should result in more stat calls but only a single parsing of /etc/hosts. On systems with variable /etc/hosts files (like some Docker systems) this should result in quicker adoption of changes. Fixes #13340. Change-Id: Iba93b204be73d6d903cd17c58038a4fcfd0952b9 Reviewed-on: https://go-review.googlesource.com/18258 Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
* net: make Dial, Listen{,Packet} for TCP/UDP with invalid port failMikio Hara2015-11-011-1/+13
| | | | | | | | | | | | | | | 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: use IndexByte implementation from runtime packageIlya Tocar2015-10-161-16/+9
| | | | | | | | | | | | | | In net/parse.go we reimplement bytes.IndexByte and strings.IndexByte, However those are implemented in runtime/$GOARCH_asm.s. Using versions from runtime should provide performance advantage, and keep the same code together. Change-Id: I6212184bdf6aa1f2c03ce26d4b63f5b379d8ed0c Reviewed-on: https://go-review.googlesource.com/15953 Run-TryBot: Ilya Tocar <ilya.tocar@intel.com> Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org> TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
* net: add mechanisms to force go or cgo lookup, and to debug default strategyBrad Fitzpatrick2015-07-091-0/+23
| | | | | | | | | | | | | | | | | | | | 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: use Go's DNS resolver when system configuration permitsBrad Fitzpatrick2015-04-231-0/+129
| | | | | | | | | | | | | | | | | If the machine's network configuration files (resolv.conf, nsswitch.conf) don't have any unsupported options, prefer Go's DNS resolver, which doesn't have the cgo & thread over. It means users can have more than 500 DNS requests outstanding (our current limit for cgo lookups) and not have one blocked thread per outstanding request. Discussed in thread https://groups.google.com/d/msg/golang-dev/2ZUi792oztM/Q0rg_DkF5HMJ Change-Id: I3f685d70aff6b47bec30b63e9fba674b20507f95 Reviewed-on: https://go-review.googlesource.com/8945 Reviewed-by: Ian Lance Taylor <iant@golang.org> Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
* net: simplify itoa conversionsMartin Möhrmann2015-01-221-33/+20
| | | | | | | | | | | | Rename itod to uitoa to have consistent naming with other itoa functions. Reduce redundant code by calling uitoa from itoa. Reduce buffer to maximally needed size for conversion of 64bit integers. Adjust calls to itoa functions in package net to use new name for itod. Avoid calls to itoa if uitoa suffices. Change-Id: I79deaede4d4b0c076a99a4f4dd6f644ba1daec53 Reviewed-on: https://go-review.googlesource.com/2212 Reviewed-by: Mikio Hara <mikioh.mikioh@gmail.com>
* build: move package sources from src/pkg to srcRuss Cox2014-09-081-0/+247
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.