An error occurred fetching the project authors.
  1. 15 Dec, 2015 1 commit
    • Brad Fitzpatrick's avatar
      net: add Dialer.Cancel to cancel pending dials · 24a83d35
      Brad Fitzpatrick authored
      Dialer.Cancel is a new optional <-chan struct{} channel whose closure
      indicates that the dial should be canceled. It is compatible with the
      x/net/context and http.Request.Cancel types.
      
      Tested by hand with:
      
      package main
      
          import (
                  "log"
                  "net"
                  "time"
          )
      
          func main() {
                  log.Printf("start.")
                  var d net.Dialer
                  cancel := make(chan struct{})
                  time.AfterFunc(2*time.Second, func() {
                          log.Printf("timeout firing")
                          close(cancel)
                  })
                  d.Cancel = cancel
                  c, err := d.Dial("tcp", "192.168.0.1:22")
                  if err != nil {
                          log.Print(err)
                          return
                  }
                  log.Fatalf("unexpected connect: %v", c)
          }
      
      Which says:
      
          2015/12/14 22:24:58 start.
          2015/12/14 22:25:00 timeout firing
          2015/12/14 22:25:00 dial tcp 192.168.0.1:22: operation was canceled
      
      Fixes #11225
      
      Change-Id: I2ef39e3a540e29fe6bfec03ab7a629a6b187fcb3
      Reviewed-on: https://go-review.googlesource.com/17821Reviewed-by: default avatarRuss Cox <rsc@golang.org>
      Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
      TryBot-Result: Gobot Gobot <gobot@golang.org>
      24a83d35
  2. 23 Jul, 2015 1 commit
  3. 16 Jun, 2015 1 commit
    • Paul Marks's avatar
      net: add sequential and RFC 6555-compliant TCP dialing. · 0d8366e2
      Paul Marks authored
      dialSerial connects to a list of addresses in sequence.  If a
      timeout is specified, then each address gets an equal fraction of the
      remaining time, with a magic constant (2 seconds) to prevent
      "dial a million addresses" from allotting zero time to each.
      
      Normally, net.Dial passes the DNS stub resolver's output to dialSerial.
      If an error occurs (like destination/port unreachable), it quickly skips
      to the next address, but a blackhole in the network will cause the
      connection to hang until the timeout elapses.  This is how UNIXy clients
      traditionally behave, and is usually sufficient for non-broken networks.
      
      The DualStack flag enables dialParallel, which implements Happy Eyeballs
      by racing two dialSerial goroutines, giving the preferred family a
      head start (300ms by default).  This allows clients to avoid long
      timeouts when the network blackholes IPv4 xor IPv6.
      
      Fixes #8453
      Fixes #8455
      Fixes #8847
      
      Change-Id: Ie415809c9226a1f7342b0217dcdd8f224ae19058
      Reviewed-on: https://go-review.googlesource.com/8768Reviewed-by: default avatarMikio Hara <mikioh.mikioh@gmail.com>
      Reviewed-by: default avatarBrad Fitzpatrick <bradfitz@golang.org>
      0d8366e2
  4. 29 Apr, 2015 1 commit
    • Mikio Hara's avatar
      net: add Source field to OpError · afd2d2b6
      Mikio Hara authored
      Not only by network, transport-layer intermediaries but by
      virtualization stuff in a node, it is hard to identify the root cause of
      weird faults without information of packet flows after disaster
      happened.
      
      This change adds Source field to OpError to be able to represent a
      5-tuple of internet transport protocols for helping dealing with
      complicated systems.
      
      Also clarifies the usage of Source and Addr fields.
      
      Updates #4856.
      
      Change-Id: I96a523fe391ed14406bfb21604c461d4aac2fa19
      Reviewed-on: https://go-review.googlesource.com/9231Reviewed-by: default avatarIan Lance Taylor <iant@golang.org>
      afd2d2b6
  5. 21 Apr, 2015 1 commit
  6. 10 Apr, 2015 1 commit
    • Paul Marks's avatar
      net: make multi-IP resolution more flexible. · a5dec385
      Paul Marks authored
      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/8360Reviewed-by: default avatarMikio Hara <mikioh.mikioh@gmail.com>
      Run-TryBot: Mikio Hara <mikioh.mikioh@gmail.com>
      TryBot-Result: Gobot Gobot <gobot@golang.org>
      a5dec385
  7. 07 Apr, 2015 1 commit
  8. 09 Feb, 2015 1 commit
  9. 08 Sep, 2014 1 commit
  10. 02 Aug, 2014 1 commit
  11. 20 Jun, 2014 1 commit
  12. 24 Feb, 2014 1 commit
  13. 19 Dec, 2013 1 commit
  14. 18 Oct, 2013 1 commit
  15. 11 Sep, 2013 1 commit
    • Mikio Hara's avatar
      net: implement TCP connection setup with fast failover · 89b26760
      Mikio Hara authored
      This CL adds minimal support of Happy Eyeballs-like TCP connection
      setup to Dialer API. Happy Eyeballs and derivation techniques are
      described in the following:
      
      - Happy Eyeballs: Success with Dual-Stack Hosts
        http://tools.ietf.org/html/rfc6555
      
      - Analysing Dual Stack Behaviour and IPv6 Quality
        http://www.potaroo.net/presentations/2012-04-17-dual-stack-quality.pdf
      
      Usually, the techniques consist of three components below.
      
      - DNS query racers, that run A and AAAA queries in parallel or series
      - A short list of destination addresses
      - TCP SYN racers, that run IPv4 and IPv6 transport in parallel or series
      
      This CL implements only the latter two. The existing DNS query
      component gathers together A and AAAA records in series, so we don't
      touch it here. This CL just uses extended resolveInternetAddr and makes
      it possible to run multiple Dial racers in parallel.
      
      For example, when the given destination is a DNS name and the name has
      multiple address family A and AAAA records, and it happens on the TCP
      wildcard network "tcp" with DualStack=true like the following:
      
      (&net.Dialer{DualStack: true}).Dial("tcp", "www.example.com:80")
      
      The function will return a first established connection either TCP over
      IPv4 or TCP over IPv6, and close the other connection internally.
      
      Fixes #3610.
      Fixes #5267.
      
      Benchmark results on freebsd/amd64 virtual machine, tip vs. tip+12416043:
      
      benchmark                           old ns/op    new ns/op    delta
      BenchmarkTCP4OneShot                    50696        52141   +2.85%
      BenchmarkTCP4OneShotTimeout             65775        66426   +0.99%
      BenchmarkTCP4Persistent                 10986        10457   -4.82%
      BenchmarkTCP4PersistentTimeout          11207        10445   -6.80%
      BenchmarkTCP6OneShot                    62009        63718   +2.76%
      BenchmarkTCP6OneShotTimeout             78351        79138   +1.00%
      BenchmarkTCP6Persistent                 14695        14659   -0.24%
      BenchmarkTCP6PersistentTimeout          15032        14646   -2.57%
      BenchmarkTCP4ConcurrentReadWrite         7215         6217  -13.83%
      BenchmarkTCP6ConcurrentReadWrite         7528         7493   -0.46%
      
      benchmark                          old allocs   new allocs    delta
      BenchmarkTCP4OneShot                       36           36    0.00%
      BenchmarkTCP4OneShotTimeout                36           36    0.00%
      BenchmarkTCP4Persistent                     0            0     n/a%
      BenchmarkTCP4PersistentTimeout              0            0     n/a%
      BenchmarkTCP6OneShot                       37           37    0.00%
      BenchmarkTCP6OneShotTimeout                37           37    0.00%
      BenchmarkTCP6Persistent                     0            0     n/a%
      BenchmarkTCP6PersistentTimeout              0            0     n/a%
      BenchmarkTCP4ConcurrentReadWrite            0            0     n/a%
      BenchmarkTCP6ConcurrentReadWrite            0            0     n/a%
      
      benchmark                           old bytes    new bytes    delta
      BenchmarkTCP4OneShot                     2500         2503    0.12%
      BenchmarkTCP4OneShotTimeout              2508         2505   -0.12%
      BenchmarkTCP4Persistent                     0            0     n/a%
      BenchmarkTCP4PersistentTimeout              0            0     n/a%
      BenchmarkTCP6OneShot                     2713         2707   -0.22%
      BenchmarkTCP6OneShotTimeout              2722         2720   -0.07%
      BenchmarkTCP6Persistent                     0            0     n/a%
      BenchmarkTCP6PersistentTimeout              0            0     n/a%
      BenchmarkTCP4ConcurrentReadWrite            0            0     n/a%
      BenchmarkTCP6ConcurrentReadWrite            0            0     n/a%
      
      R=golang-dev, bradfitz, nightlyone, rsc
      CC=golang-dev
      https://golang.org/cl/12416043
      89b26760
  16. 30 Aug, 2013 1 commit
    • Mikio Hara's avatar
      net: add netaddr interface · 3c6558ad
      Mikio Hara authored
      This CL adds the netaddr interface that will carry a single network
      endpoint address or a short list of IP addresses to dial helper
      functions in the upcoming CLs.
      
      This is in preparation for TCP connection setup with fast failover on
      dual IP stack node as described in RFC 6555.
      
      Update #3610
      Update #5267
      
      R=golang-dev, bradfitz
      CC=golang-dev
      https://golang.org/cl/13368044
      3c6558ad
  17. 14 Aug, 2013 1 commit
  18. 13 Aug, 2013 1 commit
  19. 02 Apr, 2013 1 commit
  20. 23 Mar, 2013 1 commit
    • Mikio Hara's avatar
      net: support IPv6 scoped addressing zone · aa0dda76
      Mikio Hara authored
      This CL provides IPv6 scoped addressing zone support as defined
      in RFC 4007 for internet protocol family connection setups.
      
      Follwoing types and functions allow a literal IPv6 address with
      zone identifer as theirs parameter.
      
      pkg net, func Dial(string, string) (Conn, error)
      pkg net, func DialOpt(string, ...DialOption) (Conn, error)
      pkg net, func DialTimeout(string, string, time.Duration) (Conn, error)
      pkg net, func Listen(string, string) (Listener, error)
      pkg net, func ListenPacket(string, string) (PacketConn, error)
      pkg net, func ResolveIPAddr(string, string) (*IPAddr, error)
      pkg net, func ResolveTCPAddr(string, string) (*TCPAddr, error)
      pkg net, func ResolveUDPAddr(string, string) (*UDPAddr, error)
      pkg net, type IPAddr struct, Zone string
      pkg net, type TCPAddr struct, Zone string
      pkg net, type UDPAddr struct, Zone string
      
      Also follwoing methods return a literal IPv6 address with zone
      identifier string if possible.
      
      pkg net, method (*IPAddr) String() string
      pkg net, method (*TCPAddr) String() string
      pkg net, method (*UDPAddr) String() string
      
      Fixes #4234.
      Fixes #4501.
      Update #5081.
      
      R=rsc, iant
      CC=golang-dev
      https://golang.org/cl/6816116
      aa0dda76
  21. 11 Mar, 2013 1 commit
  22. 10 Mar, 2013 1 commit
  23. 27 Feb, 2013 1 commit
    • Brad Fitzpatrick's avatar
      net: add DialOpt, the extensible Dial w/ options dialer · 752fec22
      Brad Fitzpatrick authored
      Add DialOpt. So we have:
      
      func Dial(net, addr string) (Conn, error)
      func DialTimeout(net, addr string, timeout time.Duration) (Conn, error)
      func DialOpt(addr string, opts ...DialOption) (Conn, error)
      
      DialTimeout (and Dial) are regrettable in retrospect. Maybe
      in a future Go we'll be back down to one Dial, with DialOpt
      becoming Dial.
      
      DialOpt looks like:
      
      c, err := net.DialOpt("google.com:80")  // tcp is default
      c, err := net.DialOpt("google.com:80", net.Timeout(30 * time.Second))
      c, err := net.DialOpt("google.com:80", net.TCPFastOpen())
      c, err := net.DialOpt("google.com:80", net.LocalAddr(..))
      c, err := net.DialOpt("google.com:53", net.Network("udp6"))
      
      And then: (clustered in godoc)
      
      type DialOption interface { /* private only */ }
        func Deadline(time.Time) DialOption
        func LocalAddr(Addr) DialOption
        func Network(string) DialOption
        func TCPFastOpen() DialOption
        func Timeout(time.Duration) DialOption
      
      I'm pretty confident we could add Happy Eyeballs to this too.
      
      Fixes #3097
      Update #3610
      Update #4842
      
      R=golang-dev, r, dave, minux.ma, rsc
      CC=golang-dev
      https://golang.org/cl/7365049
      752fec22
  24. 08 Feb, 2013 2 commits
  25. 11 Jan, 2013 1 commit
  26. 16 Dec, 2012 1 commit
  27. 27 Nov, 2012 1 commit
  28. 08 Nov, 2012 1 commit
  29. 20 Sep, 2012 1 commit
  30. 19 Jul, 2012 1 commit
  31. 28 Feb, 2012 1 commit
  32. 14 Feb, 2012 1 commit
  33. 21 Jan, 2012 1 commit
  34. 20 Dec, 2011 1 commit
  35. 02 Nov, 2011 1 commit
  36. 18 Oct, 2011 1 commit
  37. 30 Jun, 2011 1 commit
  38. 16 May, 2011 1 commit
  39. 20 Apr, 2011 1 commit
    • Russ Cox's avatar
      net: use C library resolver on FreeBSD, Linux, OS X / amd64, 386 · c9164a5d
      Russ Cox authored
      This CL makes it possible to resolve DNS names on OS X
      without offending the Application-Level Firewall.
      
      It also means that cross-compiling from one operating
      system to another is no longer possible when using
      package net, because cgo needs to be able to sniff around
      the local C libraries.  We could special-case this one use
      and check in generated files, but it seems more trouble
      than it's worth.  Cross compiling is dead anyway.
      
      It is still possible to use either GOARCH=amd64 or GOARCH=386
      on typical Linux and OS X x86 systems.
      
      It is also still possible to build GOOS=linux GOARCH=arm on
      any system, because arm is for now excluded from this change
      (there is no cgo for arm yet).
      
      R=iant, r, mikioh
      CC=golang-dev
      https://golang.org/cl/4437053
      c9164a5d