Browse Source

websocket: drop support for go1.4 or below

Change-Id: I228f1405aac4ed058dafdfd5fc4cc609c56004fa
Reviewed-on: https://go-review.googlesource.com/30897
Run-TryBot: Mikio Hara <mikioh.mikioh@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
Mikio Hara 9 years ago
parent
commit
8b4af36cd2
3 changed files with 1 additions and 34 deletions
  1. 1 3
      websocket/dial.go
  2. 0 2
      websocket/dial_test.go
  3. 0 29
      websocket/dialdialer.go

+ 1 - 3
websocket/dial.go

@@ -2,8 +2,6 @@
 // Use of this source code is governed by a BSD-style
 // license that can be found in the LICENSE file.
 
-// +build !go1.3
-
 package websocket
 
 import (
@@ -17,7 +15,7 @@ func dialWithDialer(dialer *net.Dialer, config *Config) (conn net.Conn, err erro
 		conn, err = dialer.Dial("tcp", parseAuthority(config.Location))
 
 	case "wss":
-		conn, err = tls.Dial("tcp", parseAuthority(config.Location), config.TlsConfig)
+		conn, err = tls.DialWithDialer(dialer, "tcp", parseAuthority(config.Location), config.TlsConfig)
 
 	default:
 		err = ErrBadScheme

+ 0 - 2
websocket/dialdialer_test.go → websocket/dial_test.go

@@ -2,8 +2,6 @@
 // Use of this source code is governed by a BSD-style
 // license that can be found in the LICENSE file.
 
-// +build go1.3
-
 package websocket
 
 import (

+ 0 - 29
websocket/dialdialer.go

@@ -1,29 +0,0 @@
-// Copyright 2015 The Go Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style
-// license that can be found in the LICENSE file.
-
-// +build go1.3
-
-// We only compile this with Go 1.3+ because previously tls.DialWithDialer
-// wasn't available. The dial.go file is used for previous Go versions.
-
-package websocket
-
-import (
-	"crypto/tls"
-	"net"
-)
-
-func dialWithDialer(dialer *net.Dialer, config *Config) (conn net.Conn, err error) {
-	switch config.Location.Scheme {
-	case "ws":
-		conn, err = dialer.Dial("tcp", parseAuthority(config.Location))
-
-	case "wss":
-		conn, err = tls.DialWithDialer(dialer, "tcp", parseAuthority(config.Location), config.TlsConfig)
-
-	default:
-		err = ErrBadScheme
-	}
-	return
-}