|
@@ -3,6 +3,7 @@ package ws
|
|
|
import (
|
|
import (
|
|
|
"crypto/tls"
|
|
"crypto/tls"
|
|
|
"fmt"
|
|
"fmt"
|
|
|
|
|
+ "io/ioutil"
|
|
|
"net"
|
|
"net"
|
|
|
|
|
|
|
|
"github.com/gorilla/websocket"
|
|
"github.com/gorilla/websocket"
|
|
@@ -44,7 +45,6 @@ func init() {
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
func wsDial(src v2net.Address, dest v2net.Destination) (*wsconn, error) {
|
|
func wsDial(src v2net.Address, dest v2net.Destination) (*wsconn, error) {
|
|
|
- //internet.DialToDest(src, dest)
|
|
|
|
|
commonDial := func(network, addr string) (net.Conn, error) {
|
|
commonDial := func(network, addr string) (net.Conn, error) {
|
|
|
return internet.DialToDest(src, dest)
|
|
return internet.DialToDest(src, dest)
|
|
|
}
|
|
}
|
|
@@ -84,7 +84,7 @@ func wsDial(src v2net.Address, dest v2net.Destination) (*wsconn, error) {
|
|
|
if the port you are using is not well-known,
|
|
if the port you are using is not well-known,
|
|
|
specify it to avoid this process.
|
|
specify it to avoid this process.
|
|
|
|
|
|
|
|
- We will re return "CRASH"turn "unknown" if we can't guess it, cause Dial to fail.
|
|
|
|
|
|
|
+ We will return "CRASH"turn "unknown" if we can't guess it, cause Dial to fail.
|
|
|
*/
|
|
*/
|
|
|
case 80:
|
|
case 80:
|
|
|
case 8080:
|
|
case 8080:
|
|
@@ -110,8 +110,11 @@ func wsDial(src v2net.Address, dest v2net.Destination) (*wsconn, error) {
|
|
|
uri := func(dst v2net.Destination, pto string, path string) string {
|
|
uri := func(dst v2net.Destination, pto string, path string) string {
|
|
|
return fmt.Sprintf("%v://%v:%v/%v", pto, dst.NetAddr(), dst.Port(), path)
|
|
return fmt.Sprintf("%v://%v:%v/%v", pto, dst.NetAddr(), dst.Port(), path)
|
|
|
}(dest, effpto, effectiveConfig.Path)
|
|
}(dest, effpto, effectiveConfig.Path)
|
|
|
- conn, _, err := dialer.Dial(uri, nil)
|
|
|
|
|
|
|
+
|
|
|
|
|
+ conn, resp, err := dialer.Dial(uri, nil)
|
|
|
if err != nil {
|
|
if err != nil {
|
|
|
|
|
+ reason, reasonerr := ioutil.ReadAll(resp.Body)
|
|
|
|
|
+ log.Info(string(reason), reasonerr)
|
|
|
return nil, err
|
|
return nil, err
|
|
|
}
|
|
}
|
|
|
return func() internet.Connection {
|
|
return func() internet.Connection {
|