Browse Source

Merge pull request #1975 from fcying/access_log_add_detour_tag

check detour tag size
pull/1981/head
Kslr 5 years ago committed by GitHub
parent
commit
8a36846869
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 8
      app/dispatcher/default.go
  2. 9
      common/log/access.go

8
app/dispatcher/default.go

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

9
common/log/access.go

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

Loading…
Cancel
Save