fix websocket for tunnel

This commit is contained in:
ginuerzh
2023-10-17 23:04:30 +08:00
parent 0a565120df
commit a9f0dda805
13 changed files with 83 additions and 186 deletions

View File

@ -38,10 +38,6 @@ func Sniffing(ctx context.Context, rdw io.ReadWriter) (rw io.ReadWriter, host st
if err == nil {
host = r.Host
protocol = ProtoHTTP
if r.Header.Get("Upgrade") == "websocket" {
protocol = ProtoWebsocket
}
return
}
}
@ -93,10 +89,9 @@ func isHTTP(s string) bool {
}
const (
ProtoHTTP = "http"
ProtoWebsocket = "ws"
ProtoTLS = "tls"
ProtoSSHv2 = "SSH-2"
ProtoHTTP = "http"
ProtoTLS = "tls"
ProtoSSHv2 = "SSH-2"
)
func sniffProtocol(hdr []byte) string {