mirror of
https://github.com/XTLS/Xray-core.git
synced 2026-11-16 14:59:56 +00:00
add freedom
This commit is contained in:
@@ -278,6 +278,12 @@ func isValidAddress(addr *net.IPOrDomain) bool {
|
||||
|
||||
// Process implements proxy.Outbound.
|
||||
func (h *Handler) Process(ctx context.Context, link *transport.Link, dialer internet.Dialer) error {
|
||||
if content := session.ContentFromContext(ctx); content != nil && content.SkipDNSResolve {
|
||||
// Keep DNS connections from resolving their server through the built-in DNS.
|
||||
handler := *h
|
||||
handler.resolveStrategy = internet.DomainStrategy_AS_IS
|
||||
h = &handler
|
||||
}
|
||||
outbounds := session.OutboundsFromContext(ctx)
|
||||
ob := outbounds[len(outbounds)-1]
|
||||
if !ob.Target.IsValid() {
|
||||
|
||||
@@ -248,7 +248,10 @@ func DialSystem(ctx context.Context, dest net.Destination, sockopt *SocketConfig
|
||||
dest = *newDest
|
||||
}
|
||||
|
||||
if sockopt.DomainStrategy.HasStrategy() && dest.Address.Family().IsDomain() {
|
||||
content := session.ContentFromContext(ctx)
|
||||
// Only Freedom's target resolution is skipped; proxy server resolution still follows sockopt.
|
||||
skipDNSResolve := outboundName == "freedom" && content != nil && content.SkipDNSResolve
|
||||
if sockopt.DomainStrategy.HasStrategy() && dest.Address.Family().IsDomain() && !skipDNSResolve {
|
||||
finalStrategy := sockopt.DomainStrategy
|
||||
if outboundName == "freedom" && dest.Network == net.Network_UDP && origTargetAddr != nil && src == nil {
|
||||
finalStrategy = finalStrategy.GetDynamicStrategy(origTargetAddr.Family())
|
||||
|
||||
Reference in New Issue
Block a user