1
0
mirror of https://github.com/v2fly/v2ray-core.git synced 2024-12-22 10:08:15 -05:00

check detour tag size

This commit is contained in:
fcying 2019-10-27 23:13:00 +08:00
parent fa926a1d1d
commit 1cc7702c51
2 changed files with 12 additions and 5 deletions

View File

@ -13,8 +13,8 @@ import (
"v2ray.com/core" "v2ray.com/core"
"v2ray.com/core/common" "v2ray.com/core/common"
"v2ray.com/core/common/buf" "v2ray.com/core/common/buf"
"v2ray.com/core/common/net"
"v2ray.com/core/common/log" "v2ray.com/core/common/log"
"v2ray.com/core/common/net"
"v2ray.com/core/common/protocol" "v2ray.com/core/common/protocol"
"v2ray.com/core/common/session" "v2ray.com/core/common/session"
"v2ray.com/core/features/outbound" "v2ray.com/core/features/outbound"
@ -284,7 +284,11 @@ func (d *DefaultDispatcher) routedDispatch(ctx context.Context, link *transport.
accessMessage := log.AccessMessageFromContext(ctx) accessMessage := log.AccessMessageFromContext(ctx)
if accessMessage != nil { if accessMessage != nil {
accessMessage.Detour = "[" + handler.Tag() + "]" if len(handler.Tag()) > 0 {
accessMessage.Detour = handler.Tag()
} else {
accessMessage.Detour = ""
}
log.Record(accessMessage) log.Record(accessMessage)
} }

View File

@ -26,7 +26,7 @@ type AccessMessage struct {
Status AccessStatus Status AccessStatus
Reason interface{} Reason interface{}
Email string Email string
Detour interface{} Detour string
} }
func (m *AccessMessage) String() string { func (m *AccessMessage) String() string {
@ -37,8 +37,11 @@ func (m *AccessMessage) String() string {
builder.WriteByte(' ') builder.WriteByte(' ')
builder.WriteString(serial.ToString(m.To)) builder.WriteString(serial.ToString(m.To))
builder.WriteByte(' ') builder.WriteByte(' ')
builder.WriteString(serial.ToString(m.Detour)) if len(m.Detour) > 0 {
builder.WriteByte(' ') builder.WriteByte('[')
builder.WriteString(m.Detour)
builder.WriteString("] ")
}
builder.WriteString(serial.ToString(m.Reason)) builder.WriteString(serial.ToString(m.Reason))
if len(m.Email) > 0 { if len(m.Email) > 0 {