diff --git a/infra/conf/xray.go b/infra/conf/xray.go index bdcabbd50..3c70ec4c8 100644 --- a/infra/conf/xray.go +++ b/infra/conf/xray.go @@ -251,13 +251,13 @@ func validateOutboundTransportSecurity(rawConfig interface{}, senderSettings *pr if vlessCfg.Encryption != "" && vlessCfg.Encryption != "none" { return nil } - if requiresTransportSecurity(vlessCfg.Address) { + if requiresTransportSecurity(vlessCfg.Vnext[0].Address) { return errors.New("vless without TLS or other encryption is prohibited unless the server address is a private IP or domain") } } if tjCfg, ok := rawConfig.(*TrojanClientConfig); ok { - if requiresTransportSecurity(tjCfg.Address) { + if requiresTransportSecurity(tjCfg.Servers[0].Address) { return errors.New("trojan without TLS is prohibited unless the server address is a private IP or domain") } } @@ -358,13 +358,13 @@ func (c *OutboundDetourConfig) Build() (*core.OutboundHandlerConfig, error) { if err != nil { return nil, errors.New("failed to load outbound detour config for protocol ", c.Protocol).Base(err) } - if err := validateOutboundTransportSecurity(rawConfig, senderSettings); err != nil { - return nil, err - } ts, err := rawConfig.(Buildable).Build() if err != nil { return nil, errors.New("failed to build outbound handler for protocol ", c.Protocol).Base(err) } + if err := validateOutboundTransportSecurity(rawConfig, senderSettings); err != nil { + return nil, err + } return &core.OutboundHandlerConfig{ SenderSettings: serial.ToTypedMessage(senderSettings),