1
0
mirror of https://github.com/v2fly/v2ray-core.git synced 2024-11-18 10:26:01 -05:00
This commit is contained in:
Darien Raymond 2017-04-26 10:59:18 +02:00
parent 7c59b2e224
commit 39005d8fc4
No known key found for this signature in database
GPG Key ID: 7251FFA14BB18169
2 changed files with 4 additions and 7 deletions

View File

@ -9,15 +9,16 @@ import (
"v2ray.com/core/common"
v2net "v2ray.com/core/common/net"
"v2ray.com/core/transport/internet"
v2tls "v2ray.com/core/transport/internet/tls"
"v2ray.com/core/transport/internet/tls"
)
// Dial dials a WebSocket connection to the given destination.
func Dial(ctx context.Context, dest v2net.Destination) (internet.Connection, error) {
log.Trace(newError("creating connection to ", dest))
conn, err := dialWebsocket(ctx, dest)
if err != nil {
return nil, newError("dial failed")
return nil, newError("failed to dial WebSocket")
}
return internet.Connection(conn), nil
}
@ -43,7 +44,7 @@ func dialWebsocket(ctx context.Context, dest v2net.Destination) (net.Conn, error
protocol := "ws"
if securitySettings := internet.SecuritySettingsFromContext(ctx); securitySettings != nil {
tlsConfig, ok := securitySettings.(*v2tls.Config)
tlsConfig, ok := securitySettings.(*tls.Config)
if ok {
protocol = "wss"
dialer.TLSClientConfig = tlsConfig.GetTLSConfig()

View File

@ -17,10 +17,6 @@ import (
v2tls "v2ray.com/core/transport/internet/tls"
)
var (
ErrClosedListener = newError("Listener is closed.")
)
type requestHandler struct {
path string
ln *Listener