Dialer: add optional method NetDialTLSContext (#746)

Fixes issue: https://github.com/gorilla/websocket/issues/745

With the previous interface, NetDial and NetDialContext were used for
both TLS and non-TLS TCP connections, and afterwards TLSClientConfig was
used to do the TLS handshake.

While this API works for most cases, it prevents from using more advance
authentication methods during the TLS handshake, as this is out of the
control of the user.

This commits introduces another a new dial method, NetDialTLSContext,
which is used when dialing for TLS/TCP. The code then assumes that the
handshake is done there and TLSClientConfig is not used.

This API change is fully backwards compatible and it better aligns with
net/http.Transport API, which has these two dial flavors. See:

Signed-off-by: Lluis Campos <lluis.campos@northern.tech>
2 files changed
tree: 2ccc05eef68ce9b0085d23b6f85d55cb98cca22c
  1. .circleci/
  2. .github/
  3. examples/
  4. .gitignore
  6. client.go
  7. client_server_test.go
  8. client_test.go
  9. compression.go
  10. compression_test.go
  11. conn.go
  12. conn_broadcast_test.go
  13. conn_test.go
  14. doc.go
  15. example_test.go
  16. go.mod
  17. go.sum
  18. join.go
  19. join_test.go
  20. json.go
  21. json_test.go
  23. mask.go
  24. mask_safe.go
  25. mask_test.go
  26. prepared.go
  27. prepared_test.go
  28. proxy.go
  29. README.md
  30. server.go
  31. server_test.go
  32. tls_handshake.go
  33. tls_handshake_116.go
  34. util.go
  35. util_test.go
  36. x_net_proxy.go

Gorilla WebSocket

GoDoc CircleCI

Gorilla WebSocket is a Go implementation of the WebSocket protocol.

⚠️ The Gorilla WebSocket Package is looking for a new maintainer



The Gorilla WebSocket package provides a complete and tested implementation of the WebSocket protocol. The package API is stable.


go get github.com/gorilla/websocket

Protocol Compliance

The Gorilla WebSocket package passes the server tests in the Autobahn Test Suite using the application in the examples/autobahn subdirectory.