Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
47 changes: 0 additions & 47 deletions infra/conf/xray.go
Original file line number Diff line number Diff line change
Expand Up @@ -389,22 +389,6 @@ type Config struct {
// and should not be used.
Port uint16 `json:"port"`

// Deprecated: InboundConfig exists for historical compatibility
// and should not be used.
InboundConfig *InboundDetourConfig `json:"inbound"`

// Deprecated: OutboundConfig exists for historical compatibility
// and should not be used.
OutboundConfig *OutboundDetourConfig `json:"outbound"`

// Deprecated: InboundDetours exists for historical compatibility
// and should not be used.
InboundDetours []InboundDetourConfig `json:"inboundDetour"`

// Deprecated: OutboundDetours exists for historical compatibility
// and should not be used.
OutboundDetours []OutboundDetourConfig `json:"outboundDetour"`

// Deprecated: Global transport config is no longer used
// left for returning error
Transport map[string]json.RawMessage `json:"transport"`
Expand Down Expand Up @@ -490,21 +474,6 @@ func (c *Config) Override(o *Config, fn string) {
c.BurstObservatory = o.BurstObservatory
}

// deprecated attrs... keep them for now
if o.InboundConfig != nil {
c.InboundConfig = o.InboundConfig
}
if o.OutboundConfig != nil {
c.OutboundConfig = o.OutboundConfig
}
if o.InboundDetours != nil {
c.InboundDetours = o.InboundDetours
}
if o.OutboundDetours != nil {
c.OutboundDetours = o.OutboundDetours
}
// deprecated attrs

// update the Inbound in slice if the only one in override config has same tag
if len(o.InboundConfigs) > 0 {
for i := range o.InboundConfigs {
Expand Down Expand Up @@ -647,14 +616,6 @@ func (c *Config) Build() (*core.Config, error) {

var inbounds []InboundDetourConfig

if c.InboundConfig != nil {
inbounds = append(inbounds, *c.InboundConfig)
}

if len(c.InboundDetours) > 0 {
inbounds = append(inbounds, c.InboundDetours...)
}

if len(c.InboundConfigs) > 0 {
inbounds = append(inbounds, c.InboundConfigs...)
}
Expand All @@ -681,14 +642,6 @@ func (c *Config) Build() (*core.Config, error) {

var outbounds []OutboundDetourConfig

if c.OutboundConfig != nil {
outbounds = append(outbounds, *c.OutboundConfig)
}

if len(c.OutboundDetours) > 0 {
outbounds = append(outbounds, c.OutboundDetours...)
}

if len(c.OutboundConfigs) > 0 {
outbounds = append(outbounds, c.OutboundConfigs...)
}
Expand Down
103 changes: 0 additions & 103 deletions infra/conf/xray_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,6 @@ import (
"github.com/xtls/xray-core/common/serial"
core "github.com/xtls/xray-core/core"
. "github.com/xtls/xray-core/infra/conf"
"github.com/xtls/xray-core/proxy/blackhole"
dns_proxy "github.com/xtls/xray-core/proxy/dns"
"github.com/xtls/xray-core/proxy/freedom"
"github.com/xtls/xray-core/proxy/vmess"
"github.com/xtls/xray-core/proxy/vmess/inbound"
"github.com/xtls/xray-core/transport/internet"
Expand All @@ -42,40 +39,11 @@ func TestXrayConfig(t *testing.T) {
runMultiTestCase(t, []TestCase{
{
Input: `{
"outbound": {
"protocol": "freedom",
"settings": {}
},
"log": {
"access": "/var/log/xray/access.log",
"loglevel": "error",
"error": "/var/log/xray/error.log"
},
"inbound": {
"streamSettings": {
"network": "ws",
"wsSettings": {
"headers": {
"host": "example.domain"
},
"path": ""
},
"tlsSettings": {
"alpn": "h2"
},
"security": "tls"
},
"protocol": "vmess",
"port": 443,
"settings": {
"clients": [
{
"security": "aes-128-gcm",
"id": "0cdf8a45-303d-4fed-9780-29aa7f54175e"
}
]
}
},
"inbounds": [{
"streamSettings": {
"network": "ws",
Expand Down Expand Up @@ -105,15 +73,6 @@ func TestXrayConfig(t *testing.T) {
]
}
}],
"outboundDetour": [
{
"tag": "blocked",
"protocol": "blackhole"
},
{
"protocol": "dns"
}
],
"routing": {
"strategy": "rules",
"settings": {
Expand Down Expand Up @@ -163,69 +122,7 @@ func TestXrayConfig(t *testing.T) {
},
}),
},
Outbound: []*core.OutboundHandlerConfig{
{
SenderSettings: serial.ToTypedMessage(&proxyman.SenderConfig{
}),
ProxySettings: serial.ToTypedMessage(&freedom.Config{
DomainStrategy: freedom.Config_AS_IS,
UserLevel: 0,
}),
},
{
Tag: "blocked",
SenderSettings: serial.ToTypedMessage(&proxyman.SenderConfig{
}),
ProxySettings: serial.ToTypedMessage(&blackhole.Config{}),
},
{
SenderSettings: serial.ToTypedMessage(&proxyman.SenderConfig{
}),
ProxySettings: serial.ToTypedMessage(&dns_proxy.Config{
Server: &net.Endpoint{},
Non_IPQuery: "drop",
}),
},
},
Inbound: []*core.InboundHandlerConfig{
{
ReceiverSettings: serial.ToTypedMessage(&proxyman.ReceiverConfig{
PortList: &net.PortList{Range: []*net.PortRange{net.SinglePortRange(443)}},
StreamSettings: &internet.StreamConfig{
ProtocolName: "websocket",
TransportSettings: []*internet.TransportConfig{
{
ProtocolName: "websocket",
Settings: serial.ToTypedMessage(&websocket.Config{
Host: "example.domain",
Header: map[string]string{
"host": "example.domain",
},
}),
},
},
SecurityType: "xray.transport.internet.tls.Config",
SecuritySettings: []*serial.TypedMessage{
serial.ToTypedMessage(&tls.Config{
NextProtocol: []string{"h2"},
}),
},
},
}),
ProxySettings: serial.ToTypedMessage(&inbound.Config{
User: []*protocol.User{
{
Level: 0,
Account: serial.ToTypedMessage(&vmess.Account{
Id: "0cdf8a45-303d-4fed-9780-29aa7f54175e",
SecuritySettings: &protocol.SecurityConfig{
Type: protocol.SecurityType_AES128_GCM,
},
}),
},
},
}),
},
{
ReceiverSettings: serial.ToTypedMessage(&proxyman.ReceiverConfig{
PortList: &net.PortList{Range: []*net.PortRange{{
Expand Down