mirror of https://github.com/v2ray/v2ray-core
parent
4668f9d3de
commit
7c59b2e224
|
@ -70,13 +70,11 @@ func (d *DefaultDispatcher) Dispatch(ctx context.Context, destination net.Destin
|
||||||
} else {
|
} else {
|
||||||
go func() {
|
go func() {
|
||||||
domain, err := snifer(ctx, sniferList, outbound)
|
domain, err := snifer(ctx, sniferList, outbound)
|
||||||
if err != nil {
|
if err == nil {
|
||||||
log.Trace(newError("failed to snif").Base(err))
|
|
||||||
return
|
|
||||||
}
|
|
||||||
log.Trace(newError("sniffed domain: ", domain))
|
log.Trace(newError("sniffed domain: ", domain))
|
||||||
destination.Address = net.ParseAddress(domain)
|
destination.Address = net.ParseAddress(domain)
|
||||||
ctx = proxy.ContextWithTarget(ctx, destination)
|
ctx = proxy.ContextWithTarget(ctx, destination)
|
||||||
|
}
|
||||||
d.routedDispatch(ctx, outbound, destination)
|
d.routedDispatch(ctx, outbound, destination)
|
||||||
}()
|
}()
|
||||||
}
|
}
|
||||||
|
|
|
@ -45,7 +45,7 @@ func SniffHTTP(b []byte) (string, error) {
|
||||||
value := strings.ToLower(string(bytes.Trim(parts[1], " ")))
|
value := strings.ToLower(string(bytes.Trim(parts[1], " ")))
|
||||||
if key == "host" {
|
if key == "host" {
|
||||||
domain := strings.Split(value, ":")
|
domain := strings.Split(value, ":")
|
||||||
return domain[0], nil
|
return strings.TrimSpace(domain[0]), nil
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return "", ErrMoreData
|
return "", ErrMoreData
|
||||||
|
|
Loading…
Reference in New Issue