Skip to content

Commit

Permalink
Chore: use alpn http 1.1 only on trojan websocket by default
Browse files Browse the repository at this point in the history
  • Loading branch information
Dreamacro committed Oct 19, 2021
1 parent 967932d commit c6cceeb
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions transport/trojan/trojan.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,10 @@ const (
)

var (
defaultALPN = []string{"h2", "http/1.1"}
crlf = []byte{'\r', '\n'}
defaultALPN = []string{"h2", "http/1.1"}
defaultWebsocketALPN = []string{"http/1.1"}

crlf = []byte{'\r', '\n'}
)

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

func (t *Trojan) StreamWebsocketConn(conn net.Conn, wsOptions *WebsocketOption) (net.Conn, error) {
alpn := defaultALPN
alpn := defaultWebsocketALPN
if len(t.option.ALPN) != 0 {
alpn = t.option.ALPN
}
Expand Down

0 comments on commit c6cceeb

Please sign in to comment.