mirror of
https://github.com/XTLS/Xray-core.git
synced 2025-04-30 01:08:33 +00:00
Add routeOnly sniffing option
This commit is contained in:
parent
6c9e57d624
commit
a3023e43ef
8 changed files with 121 additions and 89 deletions
|
@ -17,10 +17,6 @@ type ResolvableContext struct {
|
|||
|
||||
// GetTargetIPs overrides original routing.Context's implementation.
|
||||
func (ctx *ResolvableContext) GetTargetIPs() []net.IP {
|
||||
if ips := ctx.Context.GetTargetIPs(); len(ips) != 0 {
|
||||
return ips
|
||||
}
|
||||
|
||||
if len(ctx.resolvedIPs) > 0 {
|
||||
return ctx.resolvedIPs
|
||||
}
|
||||
|
@ -38,6 +34,10 @@ func (ctx *ResolvableContext) GetTargetIPs() []net.IP {
|
|||
newError("resolve ip for ", domain).Base(err).WriteToLog()
|
||||
}
|
||||
|
||||
if ips := ctx.Context.GetTargetIPs(); len(ips) != 0 {
|
||||
return ips
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
|
|
|
@ -70,7 +70,12 @@ func (ctx *Context) GetTargetDomain() string {
|
|||
if ctx.Outbound == nil || !ctx.Outbound.Target.IsValid() {
|
||||
return ""
|
||||
}
|
||||
dest := ctx.Outbound.Target
|
||||
dest := ctx.Outbound.RouteTarget
|
||||
if dest.IsValid() && dest.Address.Family().IsDomain() {
|
||||
return dest.Address.Domain()
|
||||
}
|
||||
|
||||
dest = ctx.Outbound.Target
|
||||
if !dest.Address.Family().IsDomain() {
|
||||
return ""
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue