Skip to content

Commit c6cceeb

Browse files
committed
Chore: use alpn http 1.1 only on trojan websocket by default
1 parent 967932d commit c6cceeb

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

transport/trojan/trojan.go

+5-3
Original file line numberDiff line numberDiff line change
@@ -22,8 +22,10 @@ const (
2222
)
2323

2424
var (
25-
defaultALPN = []string{"h2", "http/1.1"}
26-
crlf = []byte{'\r', '\n'}
25+
defaultALPN = []string{"h2", "http/1.1"}
26+
defaultWebsocketALPN = []string{"http/1.1"}
27+
28+
crlf = []byte{'\r', '\n'}
2729
)
2830

2931
type Command = byte
@@ -74,7 +76,7 @@ func (t *Trojan) StreamConn(conn net.Conn) (net.Conn, error) {
7476
}
7577

7678
func (t *Trojan) StreamWebsocketConn(conn net.Conn, wsOptions *WebsocketOption) (net.Conn, error) {
77-
alpn := defaultALPN
79+
alpn := defaultWebsocketALPN
7880
if len(t.option.ALPN) != 0 {
7981
alpn = t.option.ALPN
8082
}

0 commit comments

Comments
 (0)