xray log - minor change

This commit is contained in:
mhsanaei 2025-03-13 11:48:00 +01:00
parent 0bde51b91e
commit b68f0a206c
No known key found for this signature in database
GPG key ID: D875CD086CF668A0

View file

@ -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)