Skip to content

Commit b68f0a2

Browse files
committed
xray log - minor change
1 parent 0bde51b commit b68f0a2

File tree

1 file changed

+19
-2
lines changed

1 file changed

+19
-2
lines changed

xray/log_writer.go

+19-2
Original file line numberDiff line numberDiff line change
@@ -41,8 +41,16 @@ func (lw *LogWriter) Write(m []byte) (n int, err error) {
4141
if len(matches) > 3 {
4242
level := matches[2]
4343
msgBody := matches[3]
44+
msgBodyLower := strings.ToLower(msgBody)
4445

45-
if strings.Contains(strings.ToLower(msgBody), "failed") {
46+
if strings.Contains(msgBodyLower, "tls handshake error") ||
47+
strings.Contains(msgBodyLower, "connection ends") {
48+
logger.Debug("XRAY: " + msgBody)
49+
lw.lastLine = ""
50+
continue
51+
}
52+
53+
if strings.Contains(msgBodyLower, "failed") {
4654
logger.Error("XRAY: " + msgBody)
4755
} else {
4856
switch level {
@@ -60,7 +68,16 @@ func (lw *LogWriter) Write(m []byte) (n int, err error) {
6068
}
6169
lw.lastLine = ""
6270
} else if msg != "" {
63-
if strings.Contains(strings.ToLower(msg), "failed") {
71+
msgLower := strings.ToLower(msg)
72+
73+
if strings.Contains(msgLower, "tls handshake error") ||
74+
strings.Contains(msgLower, "connection ends") {
75+
logger.Debug("XRAY: " + msg)
76+
lw.lastLine = msg
77+
continue
78+
}
79+
80+
if strings.Contains(msgLower, "failed") {
6481
logger.Error("XRAY: " + msg)
6582
} else {
6683
logger.Debug("XRAY: " + msg)

0 commit comments

Comments
 (0)