Browse Source

xray log - minor change

mhsanaei 2 weeks ago
parent
commit
b68f0a206c
1 changed files with 19 additions and 2 deletions
  1. 19 2
      xray/log_writer.go

+ 19 - 2
xray/log_writer.go

@@ -41,8 +41,16 @@ func (lw *LogWriter) Write(m []byte) (n int, err error) {
 		if len(matches) > 3 {
 			level := matches[2]
 			msgBody := matches[3]
+			msgBodyLower := strings.ToLower(msgBody)
 
-			if strings.Contains(strings.ToLower(msgBody), "failed") {
+			if strings.Contains(msgBodyLower, "tls handshake error") ||
+				strings.Contains(msgBodyLower, "connection ends") {
+				logger.Debug("XRAY: " + msgBody)
+				lw.lastLine = ""
+				continue
+			}
+
+			if strings.Contains(msgBodyLower, "failed") {
 				logger.Error("XRAY: " + msgBody)
 			} else {
 				switch level {
@@ -60,7 +68,16 @@ func (lw *LogWriter) Write(m []byte) (n int, err error) {
 			}
 			lw.lastLine = ""
 		} else if msg != "" {
-			if strings.Contains(strings.ToLower(msg), "failed") {
+			msgLower := strings.ToLower(msg)
+
+			if strings.Contains(msgLower, "tls handshake error") ||
+				strings.Contains(msgLower, "connection ends") {
+				logger.Debug("XRAY: " + msg)
+				lw.lastLine = msg
+				continue
+			}
+
+			if strings.Contains(msgLower, "failed") {
 				logger.Error("XRAY: " + msg)
 			} else {
 				logger.Debug("XRAY: " + msg)