mirror of
https://github.com/XTLS/Xray-core.git
synced 2026-05-20 21:09:04 +00:00
migrate legacy freedom domainStrategy for config compatibility
This commit is contained in:
@@ -14,6 +14,7 @@ import (
|
||||
"github.com/xtls/xray-core/common/net"
|
||||
"github.com/xtls/xray-core/common/serial"
|
||||
core "github.com/xtls/xray-core/core"
|
||||
"github.com/xtls/xray-core/proxy/freedom"
|
||||
"github.com/xtls/xray-core/transport/internet"
|
||||
)
|
||||
|
||||
@@ -328,6 +329,20 @@ func (c *OutboundDetourConfig) Build() (*core.OutboundHandlerConfig, error) {
|
||||
return nil, errors.New("failed to build outbound handler for protocol ", c.Protocol).Base(err)
|
||||
}
|
||||
|
||||
if fc, ok := ts.(*freedom.Config); ok && fc.DomainStrategy != internet.DomainStrategy_AS_IS {
|
||||
errors.PrintDeprecatedFeatureWarning("freedom.domainStrategy", "streamSettings.sockopt.domainStrategy")
|
||||
if senderSettings.StreamSettings == nil {
|
||||
senderSettings.StreamSettings = &internet.StreamConfig{}
|
||||
}
|
||||
if senderSettings.StreamSettings.SocketSettings == nil {
|
||||
senderSettings.StreamSettings.SocketSettings = &internet.SocketConfig{}
|
||||
}
|
||||
senderSettings.StreamSettings.SocketSettings.DomainStrategy = fc.DomainStrategy
|
||||
if c.ProxySettings != nil && !c.ProxySettings.TransportLayerProxy {
|
||||
errors.LogWarning(context.Background(), `The deprecated "freedom" outbound "domainStrategy" cannot be migrated correctly when "proxySettings.transportLayer" is false. Please update your config(s); the current combination is misconfigured.`)
|
||||
}
|
||||
}
|
||||
|
||||
return &core.OutboundHandlerConfig{
|
||||
SenderSettings: serial.ToTypedMessage(senderSettings),
|
||||
Tag: c.Tag,
|
||||
|
||||
Reference in New Issue
Block a user