From e0de96eb4c7d5349a369172803fb1e8a2c5d5413 Mon Sep 17 00:00:00 2001 From: Hellojack <106379370+H1JK@users.noreply.github.com> Date: Sun, 28 Aug 2022 12:40:44 +0800 Subject: [PATCH] Minor fixes (#45) * Cleanup code * Fix documentation typo --- docs/configuration/inbound/trojan.zh.md | 2 +- transport/v2raygrpclite/conn.go | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/docs/configuration/inbound/trojan.zh.md b/docs/configuration/inbound/trojan.zh.md index f2509c78..392645ad 100644 --- a/docs/configuration/inbound/trojan.zh.md +++ b/docs/configuration/inbound/trojan.zh.md @@ -54,7 +54,7 @@ TLS 配置, 参阅 [TLS](/zh/configuration/shared/tls/#inbound)。 !!! error "" - 没有证据表明 GFW 基于 HTTP 响应检测并阻止木马服务器,并且在服务器上打开标准 http/s 端口是一个更大的特征。 + 没有证据表明 GFW 基于 HTTP 响应检测并阻止 Trojan 服务器,并且在服务器上打开标准 http/s 端口是一个更大的特征。 回退服务器配置。如果 `fallback` 和 `fallback_for_alpn` 为空,则禁用回退。 diff --git a/transport/v2raygrpclite/conn.go b/transport/v2raygrpclite/conn.go index b0607176..22803a98 100644 --- a/transport/v2raygrpclite/conn.go +++ b/transport/v2raygrpclite/conn.go @@ -102,8 +102,8 @@ func (c *GunConn) Write(b []byte) (n int, err error) { binary.BigEndian.PutUint32(grpcHeader[1:5], grpcPayloadLen) _, err = bufio.Copy(c.writer, io.MultiReader(bytes.NewReader(grpcHeader), bytes.NewReader(protobufHeader[:varuintLen+1]), bytes.NewReader(b))) buf.Put(grpcHeader) - if f, ok := c.writer.(http.Flusher); ok { - f.Flush() + if c.flusher != nil { + c.flusher.Flush() } return len(b), wrapError(err) }