mirror of
https://github.com/XTLS/Xray-core.git
synced 2024-11-22 13:16:07 +03:00
Optimized log (#121)
This commit is contained in:
parent
8fc2d3b61f
commit
be9421fedf
@ -263,9 +263,11 @@ func (d *DefaultDispatcher) routedDispatch(ctx context.Context, link *transport.
|
|||||||
skipRoutePick = content.SkipRoutePick
|
skipRoutePick = content.SkipRoutePick
|
||||||
}
|
}
|
||||||
|
|
||||||
|
var inTag string
|
||||||
if d.router != nil && !skipRoutePick {
|
if d.router != nil && !skipRoutePick {
|
||||||
if route, err := d.router.PickRoute(routing_session.AsRoutingContext(ctx)); err == nil {
|
if route, err := d.router.PickRoute(routing_session.AsRoutingContext(ctx)); err == nil {
|
||||||
tag := route.GetOutboundTag()
|
tag := route.GetOutboundTag()
|
||||||
|
inTag = route.GetInboundTag()
|
||||||
if h := d.ohm.GetHandler(tag); h != nil {
|
if h := d.ohm.GetHandler(tag); h != nil {
|
||||||
newError("taking detour [", tag, "] for [", destination, "]").WriteToLog(session.ExportIDToError(ctx))
|
newError("taking detour [", tag, "] for [", destination, "]").WriteToLog(session.ExportIDToError(ctx))
|
||||||
handler = h
|
handler = h
|
||||||
@ -290,7 +292,11 @@ func (d *DefaultDispatcher) routedDispatch(ctx context.Context, link *transport.
|
|||||||
|
|
||||||
if accessMessage := log.AccessMessageFromContext(ctx); accessMessage != nil {
|
if accessMessage := log.AccessMessageFromContext(ctx); accessMessage != nil {
|
||||||
if tag := handler.Tag(); tag != "" {
|
if tag := handler.Tag(); tag != "" {
|
||||||
accessMessage.Detour = tag
|
if inTag != "" {
|
||||||
|
accessMessage.Detour = inTag + " -> " + tag
|
||||||
|
} else {
|
||||||
|
accessMessage.Detour = tag
|
||||||
|
}
|
||||||
}
|
}
|
||||||
log.Record(accessMessage)
|
log.Record(accessMessage)
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user