mirror of
https://github.com/wyx2685/V2bX.git
synced 2025-01-22 18:08:14 -05:00
fix routedDispatch
This commit is contained in:
parent
cea6118ba6
commit
94817e0f82
@ -164,12 +164,12 @@ func (d *DefaultDispatcher) getLink(ctx context.Context, network net.Network) (*
|
|||||||
if user != nil && len(user.Email) > 0 {
|
if user != nil && len(user.Email) > 0 {
|
||||||
limit, err = limiter.GetLimiter(sessionInbound.Tag)
|
limit, err = limiter.GetLimiter(sessionInbound.Tag)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
newError("Get limit info error: ", err).AtError().WriteToLog()
|
newError("get limiter ", sessionInbound.Tag, " error: ", err).AtError().WriteToLog()
|
||||||
common.Close(outboundLink.Writer)
|
common.Close(outboundLink.Writer)
|
||||||
common.Close(inboundLink.Writer)
|
common.Close(inboundLink.Writer)
|
||||||
common.Interrupt(outboundLink.Reader)
|
common.Interrupt(outboundLink.Reader)
|
||||||
common.Interrupt(inboundLink.Reader)
|
common.Interrupt(inboundLink.Reader)
|
||||||
return nil, nil, nil, newError("Get limit info error: ", err)
|
return nil, nil, nil, newError("get limiter ", sessionInbound.Tag, " error: ", err)
|
||||||
}
|
}
|
||||||
// Speed Limit and Device Limit
|
// Speed Limit and Device Limit
|
||||||
w, reject := limit.CheckLimit(user.Email,
|
w, reject := limit.CheckLimit(user.Email,
|
||||||
@ -427,10 +427,7 @@ func (d *DefaultDispatcher) routedDispatch(ctx context.Context, link *transport.
|
|||||||
var err error
|
var err error
|
||||||
l, err = limiter.GetLimiter(sessionInbound.Tag)
|
l, err = limiter.GetLimiter(sessionInbound.Tag)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
newError("get limiter error: ", err).AtError().WriteToLog(session.ExportIDToError(ctx))
|
newError("get limiter ", sessionInbound.Tag, " error: ", err).AtWarning().WriteToLog(session.ExportIDToError(ctx))
|
||||||
common.Close(link.Writer)
|
|
||||||
common.Interrupt(link.Reader)
|
|
||||||
return
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
var destStr string
|
var destStr string
|
||||||
@ -439,6 +436,7 @@ func (d *DefaultDispatcher) routedDispatch(ctx context.Context, link *transport.
|
|||||||
} else {
|
} else {
|
||||||
destStr = destination.Address.IP().String()
|
destStr = destination.Address.IP().String()
|
||||||
}
|
}
|
||||||
|
if l != nil {
|
||||||
if l.CheckDomainRule(destStr) {
|
if l.CheckDomainRule(destStr) {
|
||||||
newError(fmt.Sprintf(
|
newError(fmt.Sprintf(
|
||||||
"User %s access domain %s reject by rule",
|
"User %s access domain %s reject by rule",
|
||||||
@ -459,6 +457,7 @@ func (d *DefaultDispatcher) routedDispatch(ctx context.Context, link *transport.
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
var handler outbound.Handler
|
var handler outbound.Handler
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user