1
0
mirror of https://github.com/golang/go synced 2024-11-05 16:26:11 -07:00
Commit Graph

21 Commits

Author SHA1 Message Date
Mikio Hara
15779d58ec net: update docs for unimplemented methods and functions
Change-Id: I54e651a952afa8928cc0204ba37092d3b2347266
Reviewed-on: https://go-review.googlesource.com/127737
Run-TryBot: Mikio Hara <mikioh.mikioh@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2018-08-03 15:08:42 +00:00
Audrius Butkevicius
c6295e72bf net: move dial and listen functions under sysDialer, sysListener
Updates #9661

Change-Id: I237e7502cb9faad6dece1e25b1a503739c54d826
Reviewed-on: https://go-review.googlesource.com/115175
Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2018-05-29 23:57:04 +00:00
Aman Gupta
e49bc465a3 net: implement ReadMsg/WriteMsg on windows
This means {Read,Write}Msg{UDP,IP} now work on windows.

Fixes #9252

Change-Id: Ifb105f9ad18d61289b22d7358a95faabe73d2d02
Reviewed-on: https://go-review.googlesource.com/76393
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Alex Brainman <alex.brainman@gmail.com>
2017-11-10 05:55:10 +00:00
Brad Fitzpatrick
a5179bd0a5 net: don't return IPv4 unspecified addr for Resolve*Addr of [::] or [::]:n
ResolveTCPAddr, ResolveUDPAddr, and ResolveIPAddr return at most one
address. When given a name like "golang.org" to resolve that might
have more than 1 address, the net package has historically preferred
IPv4 addresses, with the assumption that many users don't yet have
IPv6 connectivity and randomly selecting between an IPv4 address and
an IPv6 address at runtime wouldn't be a good experience for IPv4-only
users.

In CL 45088 (78cf0e56) I modified the resolution of the
unspecified/empty address to internally resolve to both IPv6 "::" and
0.0.0.0 to fix issue #18806.

That code has 3 other callers I hadn't considered, though: the
Resolve*Addr functions. Since they preferred IPv4, any Resolve*Addr of
"[::]:port" or "::" (for ResolveIPAddr) would internally resolve both
"::" and 0.0.0.0 and then prefer 0.0.0.0, even though the user was
looking up an IPv6 literal.

Add tests and fix it, not by undoing the fix to #18806 but by
selecting the preference function for Resolve*Addr more explicitly: we
still prefer IPv4, but if the address being looked up was an IPv6
literal, prefer IPv6.

The tests are skipped on machines without IPv6.

Fixes #20911

Change-Id: Ib7036cc43182ae4118cd1390c254e17c04a251a3
Reviewed-on: https://go-review.googlesource.com/47554
Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
Reviewed-by: Russ Cox <rsc@golang.org>
2017-07-06 05:39:42 +00:00
Mikio Hara
1a1ce8b5fd net: update documentation on methods of UDPConn
This change simplifies the documentation on methods of UDPConn and
adds a reference to golang.org/x/net/{ipv4,ipv6} packages to the
documentation on {Read,Write}MsgUDP methods.

Change-Id: I425a8d81bc46b6579aa9f89faa4982bb86b40f24
Reviewed-on: https://go-review.googlesource.com/44912
Run-TryBot: Mikio Hara <mikioh.mikioh@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
2017-06-22 21:37:28 +00:00
Mikio Hara
d23064d0a8 net: update documentation on Resolve{TCP,UDP,IP,Unix}Addr
This change clarifies the documentation on
Resolve{TCP,UDP,IP,Unix}Addr to avoid unnecessary confusion about how
the arguments are used to make end point addresses.

Also replaces "name" or "hostname" with "host name" when the term
implies the use of DNS.

Updates #17613.

Change-Id: Id6be87fe2e4666eecd5b92f18ad8b9a6c50a2bd6
Reviewed-on: https://go-review.googlesource.com/34879
Reviewed-by: Ian Lance Taylor <iant@golang.org>
2017-06-22 08:33:47 +00:00
Mikio Hara
e25fa61bb2 net: update documentation on Listen{TCP,UDP,MulticastUDP,IP,Unix,Unixgram}
This change clarifies the documentation on
Listen{TCP,UDP,MulticastUDP,IP,Unix,Unixgram} to avoid unnecessary
confusion about how the arguments for the connection setup functions
are used to make connections.

Change-Id: Ie269453ef49ec2db893391dc3ed2f7b641c14249
Reviewed-on: https://go-review.googlesource.com/34878
Reviewed-by: Ian Lance Taylor <iant@golang.org>
2017-06-22 08:32:51 +00:00
Mikio Hara
1ed79b87f5 net: update documentation on Dial{TCP,UDP,IP,Unix}
This change clarifies the documentation on Dial{TCP,UDP,IP,Unix} to
avoid unnecessary confusion about how the arguments for the connection
setup functions are used to make connections.

Change-Id: I2e378182948fbe221f6ae786ab55e77ae90c3f3b
Reviewed-on: https://go-review.googlesource.com/34877
Reviewed-by: Ian Lance Taylor <iant@golang.org>
2017-06-22 08:32:25 +00:00
Mikio Hara
366bb678aa net: make {TCP,UDP,IP,Unix}Conn compliant of syscall.Conn interface
This change makes {TCP,UDP,IP,Unix}Conn types compliant of
syscall.Conn interface and adds type rawConn as an implementation of
syscall.RawConn interface.

By this change, the long-standing issues regarding unsupported socket
options and system calls can be solved partly and the broken x/net
packages due to https://go-review.googlesource.com/36799 can be
repaired.

Fixes #3661.
Updates #9661.
Updates #19051.
Updates #19435.

Change-Id: Ic996b040418b54f6d043bc70591789d5a5b23270
Reviewed-on: https://go-review.googlesource.com/37039
Run-TryBot: Mikio Hara <mikioh.mikioh@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
2017-05-19 09:10:27 +00:00
Mikio Hara
25a81e77c2 net: add missing comma on BUGS section for consistency
Change-Id: Ic96fb52f37257e06e77cc08da5c73ea6f9ff158c
Reviewed-on: https://go-review.googlesource.com/33592
Reviewed-by: Joe Tsai <thebrokentoaster@gmail.com>
Run-TryBot: Mikio Hara <mikioh.mikioh@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
2016-11-28 03:30:55 +00:00
Chris McGee
e4820bcfed net: add multicast UDP support for plan9
The new implementation adds listening support on a multicast
address with plan9 network interfaces.

Fixes #17218

Change-Id: I2c75515e72e120acb71610cd077fddfbf9cf4e29
Reviewed-on: https://go-review.googlesource.com/29964
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
2016-10-27 02:15:51 +00:00
Paul Marks
5d8324e682 net: add hostname warnings to all first(isIPv4) functions.
In general, these functions cannot behave correctly when given a
hostname, because a hostname may represent multiple IP addresses, and
first(isIPv4) chooses at most one.

Updates #9334

Change-Id: Icfb629f84af4d976476385a3071270253c0000b1
Reviewed-on: https://go-review.googlesource.com/31931
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2016-10-25 04:18:41 +00:00
Brad Fitzpatrick
2bc5f1258e net: add Resolver type, Dialer.Resolver, and DefaultResolver
The new Resolver type (a struct) has 9 Lookup methods, all taking a
context.Context.

There's now a new DefaultResolver global, like http's
DefaultTransport and DefaultClient.

net.Dialer now has an optional Resolver field to set the Resolver.

This also does finishes some resolver cleanup internally, deleting
lookupIPMerge and renaming lookupIPContext into Resolver.LookupIPAddr.

The Resolver currently doesn't let you tweak much, but it's a struct
specifically so we can add knobs in the future. Currently I just added
a bool to force the pure Go resolver. In the future we could let
people provide an interface to implement the methods, or add a Timeout
time.Duration, which would wrap all provided contexts in a
context.WithTimeout.

Fixes #16672

Change-Id: I7ba1f886704f06def7b6b5c4da9809db51bc1495
Reviewed-on: https://go-review.googlesource.com/29440
Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
2016-09-21 18:35:40 +00:00
Mikio Hara
a7ed9ff754 net: document unimplemented methods and functions
Fixes #16802.

Change-Id: I41be7bb4e21e3beaa2136ee69771b0f455b2a7c6
Reviewed-on: https://go-review.googlesource.com/27417
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2016-08-23 14:19:39 +00:00
Brad Fitzpatrick
b6b4004d5a net: context plumbing, add Dialer.DialContext
For #12580 (http.Transport tracing/analytics)
Updates #13021

Change-Id: I126e494a7bd872e42c388ecb58499ecbf0f014cc
Reviewed-on: https://go-review.googlesource.com/22101
Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
Reviewed-by: Mikio Hara <mikioh.mikioh@gmail.com>
2016-04-15 22:48:12 +00:00
Mikio Hara
20de705b71 net: deduplicate UDP socket code
This change consolidates functions and methods related to UDPAddr and
UDPConn for maintenance purpose, especially for documentation.

The followup changes will update comments and examples.

Updates #10624.

Change-Id: Idfe9be8ea46ade1111b0ae176862b2048eafc7be
Reviewed-on: https://go-review.googlesource.com/20120
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
2016-03-16 03:07:52 +00:00
Brad Fitzpatrick
519474451a all: make copyright headers consistent with one space after period
This is a subset of https://golang.org/cl/20022 with only the copyright
header lines, so the next CL will be smaller and more reviewable.

Go policy has been single space after periods in comments for some time.

The copyright header template at:

    https://golang.org/doc/contribute.html#copyright

also uses a single space.

Make them all consistent.

Change-Id: Icc26c6b8495c3820da6b171ca96a74701b4a01b0
Reviewed-on: https://go-review.googlesource.com/20111
Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
Reviewed-by: Matthew Dempsky <mdempsky@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
2016-03-01 23:34:33 +00:00
Mikio Hara
22829bd766 net: don't return non-nil interface values as Source, Addr in OpError
Fixes #10992.

Change-Id: Ia376e4de118993b43e5813da57ab25fea8122048
Reviewed-on: https://go-review.googlesource.com/10476
Reviewed-by: Ian Lance Taylor <iant@golang.org>
2015-06-13 23:39:03 +00:00
Paul Marks
a5dec3859a net: make multi-IP resolution more flexible.
Remove the "netaddr" type, which ambiguously represented either one
address, or a list of addresses. Instead, use "addrList" wherever
multiple addresses are supported.

The "first" method returns the first address matching some condition
(e.g. "is it IPv4?"), primarily to support legacy code that can't handle
multiple addresses.

The "partition" method splits an addrList into two categories, as
defined by some strategy function. This is useful for implementing
Happy Eyeballs, and similar two-channel algorithms.

Finally, internetAddrList (formerly resolveInternetAddr) no longer
mangles the ordering defined by getaddrinfo. In the future, this may
be used by a sequential Dial implementation.

Updates #8453, #8455.

Change-Id: I7375f4c34481580ab40e31d33002a4073a0474f3
Reviewed-on: https://go-review.googlesource.com/8360
Reviewed-by: Mikio Hara <mikioh.mikioh@gmail.com>
Run-TryBot: Mikio Hara <mikioh.mikioh@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
2015-04-10 09:03:25 +00:00
Mikio Hara
7b2b45e544 net: simplify test helpers
This change consolidates test helpers that test platform capabilities.
testNetwork, testAddress and testListenArgs report whether given
ariguments are testable on the current platform configuration to
mitigate to receive weird test results.

Change-Id: Ie1ed568a1f9cc50f3155945ea01562904bc2c389
Reviewed-on: https://go-review.googlesource.com/8076
Reviewed-by: Ian Lance Taylor <iant@golang.org>
2015-03-28 08:21:10 +00:00
Russ Cox
c007ce824d build: move package sources from src/pkg to src
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.
2014-09-08 00:08:51 -04:00