@ -72,7 +72,7 @@ func forwardWS2TCP(conn1 *websocket.Conn, conn2 net.Conn) {
for {
n, err := conn2.Read(buf)
if err != nil {
if err != nil && err != io.EOF {
log.Errorln(err)
break
}
@ -36,6 +36,8 @@ func (srv *tcpServer) serve(c net.Conn) {
u, _ := url.Parse(srv.remote)
log.Debugf("connected from %s, forward to %s", c.RemoteAddr(), srv.remote)
if u.Scheme == "ws" || u.Scheme == "wss" {
conn1, resp, err := dialer.Dial(srv.remote, nil)
@ -46,6 +46,8 @@ func (wss *wsServer) ServeHTTP(w http.ResponseWriter, r *http.Request) {
return
log.Debugf("request %s, forward to %s", p, remote)
conn, err := upgrader.Upgrade(w, r, nil)