Skip to content

Commit cb59a9e

Browse files
authored
Config: Remove legacy inbound/outbound/detours (XTLS#3769)
XTLS#3769 (comment)
1 parent 712d858 commit cb59a9e

2 files changed

Lines changed: 0 additions & 150 deletions

File tree

infra/conf/xray.go

Lines changed: 0 additions & 47 deletions
Original file line numberDiff line numberDiff line change
@@ -389,22 +389,6 @@ type Config struct {
389389
// and should not be used.
390390
Port uint16 `json:"port"`
391391

392-
// Deprecated: InboundConfig exists for historical compatibility
393-
// and should not be used.
394-
InboundConfig *InboundDetourConfig `json:"inbound"`
395-
396-
// Deprecated: OutboundConfig exists for historical compatibility
397-
// and should not be used.
398-
OutboundConfig *OutboundDetourConfig `json:"outbound"`
399-
400-
// Deprecated: InboundDetours exists for historical compatibility
401-
// and should not be used.
402-
InboundDetours []InboundDetourConfig `json:"inboundDetour"`
403-
404-
// Deprecated: OutboundDetours exists for historical compatibility
405-
// and should not be used.
406-
OutboundDetours []OutboundDetourConfig `json:"outboundDetour"`
407-
408392
// Deprecated: Global transport config is no longer used
409393
// left for returning error
410394
Transport map[string]json.RawMessage `json:"transport"`
@@ -490,21 +474,6 @@ func (c *Config) Override(o *Config, fn string) {
490474
c.BurstObservatory = o.BurstObservatory
491475
}
492476

493-
// deprecated attrs... keep them for now
494-
if o.InboundConfig != nil {
495-
c.InboundConfig = o.InboundConfig
496-
}
497-
if o.OutboundConfig != nil {
498-
c.OutboundConfig = o.OutboundConfig
499-
}
500-
if o.InboundDetours != nil {
501-
c.InboundDetours = o.InboundDetours
502-
}
503-
if o.OutboundDetours != nil {
504-
c.OutboundDetours = o.OutboundDetours
505-
}
506-
// deprecated attrs
507-
508477
// update the Inbound in slice if the only one in override config has same tag
509478
if len(o.InboundConfigs) > 0 {
510479
for i := range o.InboundConfigs {
@@ -647,14 +616,6 @@ func (c *Config) Build() (*core.Config, error) {
647616

648617
var inbounds []InboundDetourConfig
649618

650-
if c.InboundConfig != nil {
651-
inbounds = append(inbounds, *c.InboundConfig)
652-
}
653-
654-
if len(c.InboundDetours) > 0 {
655-
inbounds = append(inbounds, c.InboundDetours...)
656-
}
657-
658619
if len(c.InboundConfigs) > 0 {
659620
inbounds = append(inbounds, c.InboundConfigs...)
660621
}
@@ -681,14 +642,6 @@ func (c *Config) Build() (*core.Config, error) {
681642

682643
var outbounds []OutboundDetourConfig
683644

684-
if c.OutboundConfig != nil {
685-
outbounds = append(outbounds, *c.OutboundConfig)
686-
}
687-
688-
if len(c.OutboundDetours) > 0 {
689-
outbounds = append(outbounds, c.OutboundDetours...)
690-
}
691-
692645
if len(c.OutboundConfigs) > 0 {
693646
outbounds = append(outbounds, c.OutboundConfigs...)
694647
}

infra/conf/xray_test.go

Lines changed: 0 additions & 103 deletions
Original file line numberDiff line numberDiff line change
@@ -17,9 +17,6 @@ import (
1717
"github.com/xtls/xray-core/common/serial"
1818
core "github.com/xtls/xray-core/core"
1919
. "github.com/xtls/xray-core/infra/conf"
20-
"github.com/xtls/xray-core/proxy/blackhole"
21-
dns_proxy "github.com/xtls/xray-core/proxy/dns"
22-
"github.com/xtls/xray-core/proxy/freedom"
2320
"github.com/xtls/xray-core/proxy/vmess"
2421
"github.com/xtls/xray-core/proxy/vmess/inbound"
2522
"github.com/xtls/xray-core/transport/internet"
@@ -42,40 +39,11 @@ func TestXrayConfig(t *testing.T) {
4239
runMultiTestCase(t, []TestCase{
4340
{
4441
Input: `{
45-
"outbound": {
46-
"protocol": "freedom",
47-
"settings": {}
48-
},
4942
"log": {
5043
"access": "/var/log/xray/access.log",
5144
"loglevel": "error",
5245
"error": "/var/log/xray/error.log"
5346
},
54-
"inbound": {
55-
"streamSettings": {
56-
"network": "ws",
57-
"wsSettings": {
58-
"headers": {
59-
"host": "example.domain"
60-
},
61-
"path": ""
62-
},
63-
"tlsSettings": {
64-
"alpn": "h2"
65-
},
66-
"security": "tls"
67-
},
68-
"protocol": "vmess",
69-
"port": 443,
70-
"settings": {
71-
"clients": [
72-
{
73-
"security": "aes-128-gcm",
74-
"id": "0cdf8a45-303d-4fed-9780-29aa7f54175e"
75-
}
76-
]
77-
}
78-
},
7947
"inbounds": [{
8048
"streamSettings": {
8149
"network": "ws",
@@ -105,15 +73,6 @@ func TestXrayConfig(t *testing.T) {
10573
]
10674
}
10775
}],
108-
"outboundDetour": [
109-
{
110-
"tag": "blocked",
111-
"protocol": "blackhole"
112-
},
113-
{
114-
"protocol": "dns"
115-
}
116-
],
11776
"routing": {
11877
"strategy": "rules",
11978
"settings": {
@@ -163,69 +122,7 @@ func TestXrayConfig(t *testing.T) {
163122
},
164123
}),
165124
},
166-
Outbound: []*core.OutboundHandlerConfig{
167-
{
168-
SenderSettings: serial.ToTypedMessage(&proxyman.SenderConfig{
169-
}),
170-
ProxySettings: serial.ToTypedMessage(&freedom.Config{
171-
DomainStrategy: freedom.Config_AS_IS,
172-
UserLevel: 0,
173-
}),
174-
},
175-
{
176-
Tag: "blocked",
177-
SenderSettings: serial.ToTypedMessage(&proxyman.SenderConfig{
178-
}),
179-
ProxySettings: serial.ToTypedMessage(&blackhole.Config{}),
180-
},
181-
{
182-
SenderSettings: serial.ToTypedMessage(&proxyman.SenderConfig{
183-
}),
184-
ProxySettings: serial.ToTypedMessage(&dns_proxy.Config{
185-
Server: &net.Endpoint{},
186-
Non_IPQuery: "drop",
187-
}),
188-
},
189-
},
190125
Inbound: []*core.InboundHandlerConfig{
191-
{
192-
ReceiverSettings: serial.ToTypedMessage(&proxyman.ReceiverConfig{
193-
PortList: &net.PortList{Range: []*net.PortRange{net.SinglePortRange(443)}},
194-
StreamSettings: &internet.StreamConfig{
195-
ProtocolName: "websocket",
196-
TransportSettings: []*internet.TransportConfig{
197-
{
198-
ProtocolName: "websocket",
199-
Settings: serial.ToTypedMessage(&websocket.Config{
200-
Host: "example.domain",
201-
Header: map[string]string{
202-
"host": "example.domain",
203-
},
204-
}),
205-
},
206-
},
207-
SecurityType: "xray.transport.internet.tls.Config",
208-
SecuritySettings: []*serial.TypedMessage{
209-
serial.ToTypedMessage(&tls.Config{
210-
NextProtocol: []string{"h2"},
211-
}),
212-
},
213-
},
214-
}),
215-
ProxySettings: serial.ToTypedMessage(&inbound.Config{
216-
User: []*protocol.User{
217-
{
218-
Level: 0,
219-
Account: serial.ToTypedMessage(&vmess.Account{
220-
Id: "0cdf8a45-303d-4fed-9780-29aa7f54175e",
221-
SecuritySettings: &protocol.SecurityConfig{
222-
Type: protocol.SecurityType_AES128_GCM,
223-
},
224-
}),
225-
},
226-
},
227-
}),
228-
},
229126
{
230127
ReceiverSettings: serial.ToTypedMessage(&proxyman.ReceiverConfig{
231128
PortList: &net.PortList{Range: []*net.PortRange{{

0 commit comments

Comments
 (0)