Skip to content

Commit 5c6713c

Browse files
committed
Remove xray.cone.disabled env var
1 parent 94ffd50 commit 5c6713c

9 files changed

Lines changed: 6 additions & 30 deletions

File tree

app/proxyman/inbound/worker.go

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -273,8 +273,7 @@ type udpWorker struct {
273273
checker *task.Periodic
274274
activeConn map[connID]*udpConn
275275

276-
ctx context.Context
277-
cone bool
276+
ctx context.Context
278277
}
279278

280279
func (w *udpWorker) getConnection(id connID) (*udpConn, bool) {
@@ -316,9 +315,6 @@ func (w *udpWorker) callback(b *buf.Buffer, source net.Destination, originalDest
316315
src: source,
317316
}
318317
if originalDest.IsValid() {
319-
if !w.cone {
320-
id.dest = originalDest
321-
}
322318
b.UDP = &originalDest
323319
}
324320
conn, existing := w.getConnection(id)
@@ -418,8 +414,6 @@ func (w *udpWorker) Start() error {
418414
return err
419415
}
420416

421-
w.cone = w.ctx.Value("cone").(bool)
422-
423417
w.checker = &task.Periodic{
424418
Interval: time.Minute,
425419
Execute: w.clean,

common/platform/platform.go

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,6 @@ const (
1616
UseReadV = "xray.buf.readv"
1717
UseFreedomSplice = "xray.buf.splice"
1818
UseVmessPadding = "xray.vmess.padding"
19-
UseCone = "xray.cone.disabled"
2019
UseStrictJSON = "xray.json.strict"
2120

2221
BufferSize = "xray.ray.buffer.size"

common/xudp/xudp.go

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -49,9 +49,6 @@ func init() {
4949
}
5050

5151
func GetGlobalID(ctx context.Context) (globalID [8]byte) {
52-
if cone := ctx.Value("cone"); cone == nil || !cone.(bool) { // cone is nil only in some unit tests
53-
return
54-
}
5552
if inbound := session.InboundFromContext(ctx); inbound != nil && inbound.Source.Network == net.Network_UDP &&
5653
(inbound.Name == "dokodemo-door" || inbound.Name == "socks" || inbound.Name == "shadowsocks" || inbound.Name == "tun") {
5754
h := blake3.New(8, BaseKey)

core/xray.go

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@ import (
77

88
"github.com/xtls/xray-core/common"
99
"github.com/xtls/xray-core/common/errors"
10-
"github.com/xtls/xray-core/common/platform"
1110
"github.com/xtls/xray-core/common/serial"
1211
"github.com/xtls/xray-core/features"
1312
"github.com/xtls/xray-core/features/dns"
@@ -187,9 +186,6 @@ func NewWithContext(ctx context.Context, config *Config) (*Instance, error) {
187186
}
188187

189188
func initInstanceWithConfig(config *Config, server *Instance) (bool, error) {
190-
server.ctx = context.WithValue(server.ctx, "cone",
191-
platform.NewEnvFlag(platform.UseCone).GetValue(func() string { return "" }) != "true")
192-
193189
for _, appSettings := range config.App {
194190
settings, err := appSettings.GetInstance()
195191
if err != nil {

proxy/shadowsocks/server.go

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,6 @@ type Server struct {
2525
config *ServerConfig
2626
validator *Validator
2727
policyManager policy.Manager
28-
cone bool
2928
}
3029

3130
// NewServer create a new Shadowsocks server.
@@ -47,7 +46,6 @@ func NewServer(ctx context.Context, config *ServerConfig) (*Server, error) {
4746
config: config,
4847
validator: validator,
4948
policyManager: v.GetFeature(policy.ManagerType()).(policy.Manager),
50-
cone: ctx.Value("cone").(bool),
5149
}
5250

5351
return s, nil
@@ -185,7 +183,7 @@ func (s *Server) handleUDPPayload(ctx context.Context, conn stat.Connection, dis
185183

186184
data.UDP = &destination
187185

188-
if !s.cone || dest == nil {
186+
if dest == nil {
189187
dest = &destination
190188
}
191189

proxy/socks/server.go

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,6 @@ import (
2828
type Server struct {
2929
config *ServerConfig
3030
policyManager policy.Manager
31-
cone bool
3231
httpServer *http.Server
3332
}
3433

@@ -38,7 +37,6 @@ func NewServer(ctx context.Context, config *ServerConfig) (*Server, error) {
3837
s := &Server{
3938
config: config,
4039
policyManager: v.GetFeature(policy.ManagerType()).(policy.Manager),
41-
cone: ctx.Value("cone").(bool),
4240
}
4341
httpConfig := &http.ServerConfig{
4442
UserLevel: config.UserLevel,
@@ -257,7 +255,7 @@ func (s *Server) handleUDPPayload(ctx context.Context, conn stat.Connection, dis
257255

258256
payload.UDP = &destination
259257

260-
if !s.cone || dest == nil {
258+
if dest == nil {
261259
dest = &destination
262260
}
263261

proxy/trojan/server.go

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,6 @@ type Server struct {
3838
policyManager policy.Manager
3939
validator *Validator
4040
fallbacks map[string]map[string]map[string]*Fallback // or nil
41-
cone bool
4241
}
4342

4443
// NewServer creates a new trojan inbound handler.
@@ -59,7 +58,6 @@ func NewServer(ctx context.Context, config *ServerConfig) (*Server, error) {
5958
server := &Server{
6059
policyManager: v.GetFeature(policy.ManagerType()).(policy.Manager),
6160
validator: validator,
62-
cone: ctx.Value("cone").(bool),
6361
}
6462

6563
if config.Fallbacks != nil {
@@ -302,7 +300,7 @@ func (s *Server) handleUDPPayload(ctx context.Context, sessionPolicy policy.Sess
302300
}
303301
errors.LogInfo(ctx, "tunnelling request to ", destination)
304302

305-
if !s.cone || dest == nil {
303+
if dest == nil {
306304
dest = &destination
307305
}
308306

proxy/vless/outbound/outbound.go

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,6 @@ func init() {
5252
type Handler struct {
5353
server *protocol.ServerSpec
5454
policyManager policy.Manager
55-
cone bool
5655
encryption *encryption.ClientInstance
5756
reverse *Reverse
5857

@@ -80,7 +79,6 @@ func New(ctx context.Context, config *Config) (*Handler, error) {
8079
handler := &Handler{
8180
server: server,
8281
policyManager: v.GetFeature(policy.ManagerType()).(policy.Manager),
83-
cone: ctx.Value("cone").(bool),
8482
}
8583

8684
a := handler.server.User.Account.(*vless.MemoryAccount)
@@ -312,7 +310,7 @@ func (h *Handler) Process(ctx context.Context, link *transport.Link, dialer inte
312310
clientReader := link.Reader // .(*pipe.Reader)
313311
clientWriter := link.Writer // .(*pipe.Writer)
314312
trafficState := proxy.NewTrafficState(account.ID.Bytes())
315-
if request.Command == protocol.RequestCommandUDP && (requestAddons.Flow == vless.XRV || (h.cone && request.Port != 53 && request.Port != 443)) {
313+
if request.Command == protocol.RequestCommandUDP && (requestAddons.Flow == vless.XRV || (request.Port != 53 && request.Port != 443)) {
316314
request.Command = protocol.RequestCommandMux
317315
request.Address = net.DomainAddress("v1.mux.cool")
318316
request.Port = net.Port(666)

proxy/vmess/outbound/outbound.go

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,6 @@ import (
3131
type Handler struct {
3232
server *protocol.ServerSpec
3333
policyManager policy.Manager
34-
cone bool
3534
}
3635

3736
// New creates a new VMess outbound handler.
@@ -48,7 +47,6 @@ func New(ctx context.Context, config *Config) (*Handler, error) {
4847
handler := &Handler{
4948
server: server,
5049
policyManager: v.GetFeature(policy.ManagerType()).(policy.Manager),
51-
cone: ctx.Value("cone").(bool),
5250
}
5351

5452
return handler, nil
@@ -148,7 +146,7 @@ func (h *Handler) Process(ctx context.Context, link *transport.Link, dialer inte
148146
}
149147
}, sessionPolicy.Timeouts.ConnectionIdle)
150148

151-
if request.Command == protocol.RequestCommandUDP && h.cone && request.Port != 53 && request.Port != 443 {
149+
if request.Command == protocol.RequestCommandUDP && request.Port != 53 && request.Port != 443 {
152150
request.Command = protocol.RequestCommandMux
153151
request.Address = net.DomainAddress("v1.mux.cool")
154152
request.Port = net.Port(666)

0 commit comments

Comments
 (0)