From f04cb0b2887cc17a4ae2a5f679fc2c45a881a66a Mon Sep 17 00:00:00 2001 From: Kobe Arthur Scofield <26771058+KobeArthurScofield@users.noreply.github.com> Date: Mon, 9 Sep 2024 14:03:21 +0800 Subject: [PATCH] Config: Remove some legacy fields from V2Ray 3.x era (#3776) https://github.com/XTLS/Xray-core/pull/3776#issue-2512316726 --- app/proxyman/config.go | 16 --- app/proxyman/config.pb.go | 169 +++++++++--------------------- app/proxyman/config.proto | 10 +- infra/conf/vmess.go | 7 -- infra/conf/xray.go | 23 ---- testing/scenarios/feature_test.go | 5 +- 6 files changed, 54 insertions(+), 176 deletions(-) diff --git a/app/proxyman/config.go b/app/proxyman/config.go index 73c00c74..76d7a194 100644 --- a/app/proxyman/config.go +++ b/app/proxyman/config.go @@ -19,21 +19,5 @@ func (c *ReceiverConfig) GetEffectiveSniffingSettings() *SniffingConfig { return c.SniffingSettings } - if len(c.DomainOverride) > 0 { - var p []string - for _, kd := range c.DomainOverride { - switch kd { - case KnownProtocols_HTTP: - p = append(p, "http") - case KnownProtocols_TLS: - p = append(p, "tls") - } - } - return &SniffingConfig{ - Enabled: true, - DestinationOverride: p, - } - } - return nil } diff --git a/app/proxyman/config.pb.go b/app/proxyman/config.pb.go index aed85b98..5ba3ac56 100644 --- a/app/proxyman/config.pb.go +++ b/app/proxyman/config.pb.go @@ -1,7 +1,7 @@ // Code generated by protoc-gen-go. DO NOT EDIT. // versions: // protoc-gen-go v1.34.2 -// protoc v5.27.0 +// protoc v5.28.0 // source: app/proxyman/config.proto package proxyman @@ -23,52 +23,6 @@ const ( _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20) ) -type KnownProtocols int32 - -const ( - KnownProtocols_HTTP KnownProtocols = 0 - KnownProtocols_TLS KnownProtocols = 1 -) - -// Enum value maps for KnownProtocols. -var ( - KnownProtocols_name = map[int32]string{ - 0: "HTTP", - 1: "TLS", - } - KnownProtocols_value = map[string]int32{ - "HTTP": 0, - "TLS": 1, - } -) - -func (x KnownProtocols) Enum() *KnownProtocols { - p := new(KnownProtocols) - *p = x - return p -} - -func (x KnownProtocols) String() string { - return protoimpl.X.EnumStringOf(x.Descriptor(), protoreflect.EnumNumber(x)) -} - -func (KnownProtocols) Descriptor() protoreflect.EnumDescriptor { - return file_app_proxyman_config_proto_enumTypes[0].Descriptor() -} - -func (KnownProtocols) Type() protoreflect.EnumType { - return &file_app_proxyman_config_proto_enumTypes[0] -} - -func (x KnownProtocols) Number() protoreflect.EnumNumber { - return protoreflect.EnumNumber(x) -} - -// Deprecated: Use KnownProtocols.Descriptor instead. -func (KnownProtocols) EnumDescriptor() ([]byte, []int) { - return file_app_proxyman_config_proto_rawDescGZIP(), []int{0} -} - type AllocationStrategy_Type int32 const ( @@ -105,11 +59,11 @@ func (x AllocationStrategy_Type) String() string { } func (AllocationStrategy_Type) Descriptor() protoreflect.EnumDescriptor { - return file_app_proxyman_config_proto_enumTypes[1].Descriptor() + return file_app_proxyman_config_proto_enumTypes[0].Descriptor() } func (AllocationStrategy_Type) Type() protoreflect.EnumType { - return &file_app_proxyman_config_proto_enumTypes[1] + return &file_app_proxyman_config_proto_enumTypes[0] } func (x AllocationStrategy_Type) Number() protoreflect.EnumNumber { @@ -323,12 +277,7 @@ type ReceiverConfig struct { AllocationStrategy *AllocationStrategy `protobuf:"bytes,3,opt,name=allocation_strategy,json=allocationStrategy,proto3" json:"allocation_strategy,omitempty"` StreamSettings *internet.StreamConfig `protobuf:"bytes,4,opt,name=stream_settings,json=streamSettings,proto3" json:"stream_settings,omitempty"` ReceiveOriginalDestination bool `protobuf:"varint,5,opt,name=receive_original_destination,json=receiveOriginalDestination,proto3" json:"receive_original_destination,omitempty"` - // Override domains for the given protocol. - // Deprecated. Use sniffing_settings. - // - // Deprecated: Marked as deprecated in app/proxyman/config.proto. - DomainOverride []KnownProtocols `protobuf:"varint,7,rep,packed,name=domain_override,json=domainOverride,proto3,enum=xray.app.proxyman.KnownProtocols" json:"domain_override,omitempty"` - SniffingSettings *SniffingConfig `protobuf:"bytes,8,opt,name=sniffing_settings,json=sniffingSettings,proto3" json:"sniffing_settings,omitempty"` + SniffingSettings *SniffingConfig `protobuf:"bytes,7,opt,name=sniffing_settings,json=sniffingSettings,proto3" json:"sniffing_settings,omitempty"` } func (x *ReceiverConfig) Reset() { @@ -398,14 +347,6 @@ func (x *ReceiverConfig) GetReceiveOriginalDestination() bool { return false } -// Deprecated: Marked as deprecated in app/proxyman/config.proto. -func (x *ReceiverConfig) GetDomainOverride() []KnownProtocols { - if x != nil { - return x.DomainOverride - } - return nil -} - func (x *ReceiverConfig) GetSniffingSettings() *SniffingConfig { if x != nil { return x.SniffingSettings @@ -817,7 +758,7 @@ var file_app_proxyman_config_proto_rawDesc = []byte{ 0x79, 0x18, 0x04, 0x20, 0x01, 0x28, 0x08, 0x52, 0x0c, 0x6d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0x4f, 0x6e, 0x6c, 0x79, 0x12, 0x1d, 0x0a, 0x0a, 0x72, 0x6f, 0x75, 0x74, 0x65, 0x5f, 0x6f, 0x6e, 0x6c, 0x79, 0x18, 0x05, 0x20, 0x01, 0x28, 0x08, 0x52, 0x09, 0x72, 0x6f, 0x75, 0x74, 0x65, - 0x4f, 0x6e, 0x6c, 0x79, 0x22, 0x8d, 0x04, 0x0a, 0x0e, 0x52, 0x65, 0x63, 0x65, 0x69, 0x76, 0x65, + 0x4f, 0x6e, 0x6c, 0x79, 0x22, 0xbd, 0x03, 0x0a, 0x0e, 0x52, 0x65, 0x63, 0x65, 0x69, 0x76, 0x65, 0x72, 0x43, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x12, 0x36, 0x0a, 0x09, 0x70, 0x6f, 0x72, 0x74, 0x5f, 0x6c, 0x69, 0x73, 0x74, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x19, 0x2e, 0x78, 0x72, 0x61, 0x79, 0x2e, 0x63, 0x6f, 0x6d, 0x6d, 0x6f, 0x6e, 0x2e, 0x6e, 0x65, 0x74, 0x2e, 0x50, 0x6f, 0x72, @@ -840,13 +781,8 @@ var file_app_proxyman_config_proto_rawDesc = []byte{ 0x5f, 0x64, 0x65, 0x73, 0x74, 0x69, 0x6e, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x18, 0x05, 0x20, 0x01, 0x28, 0x08, 0x52, 0x1a, 0x72, 0x65, 0x63, 0x65, 0x69, 0x76, 0x65, 0x4f, 0x72, 0x69, 0x67, 0x69, 0x6e, 0x61, 0x6c, 0x44, 0x65, 0x73, 0x74, 0x69, 0x6e, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x4e, - 0x0a, 0x0f, 0x64, 0x6f, 0x6d, 0x61, 0x69, 0x6e, 0x5f, 0x6f, 0x76, 0x65, 0x72, 0x72, 0x69, 0x64, - 0x65, 0x18, 0x07, 0x20, 0x03, 0x28, 0x0e, 0x32, 0x21, 0x2e, 0x78, 0x72, 0x61, 0x79, 0x2e, 0x61, - 0x70, 0x70, 0x2e, 0x70, 0x72, 0x6f, 0x78, 0x79, 0x6d, 0x61, 0x6e, 0x2e, 0x4b, 0x6e, 0x6f, 0x77, - 0x6e, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x63, 0x6f, 0x6c, 0x73, 0x42, 0x02, 0x18, 0x01, 0x52, 0x0e, - 0x64, 0x6f, 0x6d, 0x61, 0x69, 0x6e, 0x4f, 0x76, 0x65, 0x72, 0x72, 0x69, 0x64, 0x65, 0x12, 0x4e, 0x0a, 0x11, 0x73, 0x6e, 0x69, 0x66, 0x66, 0x69, 0x6e, 0x67, 0x5f, 0x73, 0x65, 0x74, 0x74, 0x69, - 0x6e, 0x67, 0x73, 0x18, 0x08, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x21, 0x2e, 0x78, 0x72, 0x61, 0x79, + 0x6e, 0x67, 0x73, 0x18, 0x07, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x21, 0x2e, 0x78, 0x72, 0x61, 0x79, 0x2e, 0x61, 0x70, 0x70, 0x2e, 0x70, 0x72, 0x6f, 0x78, 0x79, 0x6d, 0x61, 0x6e, 0x2e, 0x53, 0x6e, 0x69, 0x66, 0x66, 0x69, 0x6e, 0x67, 0x43, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x52, 0x10, 0x73, 0x6e, 0x69, 0x66, 0x66, 0x69, 0x6e, 0x67, 0x53, 0x65, 0x74, 0x74, 0x69, 0x6e, 0x67, 0x73, 0x4a, 0x04, @@ -894,16 +830,13 @@ var file_app_proxyman_config_proto_rawDesc = []byte{ 0x01, 0x28, 0x05, 0x52, 0x0f, 0x78, 0x75, 0x64, 0x70, 0x43, 0x6f, 0x6e, 0x63, 0x75, 0x72, 0x72, 0x65, 0x6e, 0x63, 0x79, 0x12, 0x28, 0x0a, 0x0f, 0x78, 0x75, 0x64, 0x70, 0x50, 0x72, 0x6f, 0x78, 0x79, 0x55, 0x44, 0x50, 0x34, 0x34, 0x33, 0x18, 0x04, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0f, 0x78, - 0x75, 0x64, 0x70, 0x50, 0x72, 0x6f, 0x78, 0x79, 0x55, 0x44, 0x50, 0x34, 0x34, 0x33, 0x2a, 0x23, - 0x0a, 0x0e, 0x4b, 0x6e, 0x6f, 0x77, 0x6e, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x63, 0x6f, 0x6c, 0x73, - 0x12, 0x08, 0x0a, 0x04, 0x48, 0x54, 0x54, 0x50, 0x10, 0x00, 0x12, 0x07, 0x0a, 0x03, 0x54, 0x4c, - 0x53, 0x10, 0x01, 0x42, 0x55, 0x0a, 0x15, 0x63, 0x6f, 0x6d, 0x2e, 0x78, 0x72, 0x61, 0x79, 0x2e, - 0x61, 0x70, 0x70, 0x2e, 0x70, 0x72, 0x6f, 0x78, 0x79, 0x6d, 0x61, 0x6e, 0x50, 0x01, 0x5a, 0x26, - 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x78, 0x74, 0x6c, 0x73, 0x2f, - 0x78, 0x72, 0x61, 0x79, 0x2d, 0x63, 0x6f, 0x72, 0x65, 0x2f, 0x61, 0x70, 0x70, 0x2f, 0x70, 0x72, - 0x6f, 0x78, 0x79, 0x6d, 0x61, 0x6e, 0xaa, 0x02, 0x11, 0x58, 0x72, 0x61, 0x79, 0x2e, 0x41, 0x70, - 0x70, 0x2e, 0x50, 0x72, 0x6f, 0x78, 0x79, 0x6d, 0x61, 0x6e, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, - 0x6f, 0x33, + 0x75, 0x64, 0x70, 0x50, 0x72, 0x6f, 0x78, 0x79, 0x55, 0x44, 0x50, 0x34, 0x34, 0x33, 0x42, 0x55, + 0x0a, 0x15, 0x63, 0x6f, 0x6d, 0x2e, 0x78, 0x72, 0x61, 0x79, 0x2e, 0x61, 0x70, 0x70, 0x2e, 0x70, + 0x72, 0x6f, 0x78, 0x79, 0x6d, 0x61, 0x6e, 0x50, 0x01, 0x5a, 0x26, 0x67, 0x69, 0x74, 0x68, 0x75, + 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x78, 0x74, 0x6c, 0x73, 0x2f, 0x78, 0x72, 0x61, 0x79, 0x2d, + 0x63, 0x6f, 0x72, 0x65, 0x2f, 0x61, 0x70, 0x70, 0x2f, 0x70, 0x72, 0x6f, 0x78, 0x79, 0x6d, 0x61, + 0x6e, 0xaa, 0x02, 0x11, 0x58, 0x72, 0x61, 0x79, 0x2e, 0x41, 0x70, 0x70, 0x2e, 0x50, 0x72, 0x6f, + 0x78, 0x79, 0x6d, 0x61, 0x6e, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, } var ( @@ -918,48 +851,46 @@ func file_app_proxyman_config_proto_rawDescGZIP() []byte { return file_app_proxyman_config_proto_rawDescData } -var file_app_proxyman_config_proto_enumTypes = make([]protoimpl.EnumInfo, 2) +var file_app_proxyman_config_proto_enumTypes = make([]protoimpl.EnumInfo, 1) var file_app_proxyman_config_proto_msgTypes = make([]protoimpl.MessageInfo, 10) var file_app_proxyman_config_proto_goTypes = []any{ - (KnownProtocols)(0), // 0: xray.app.proxyman.KnownProtocols - (AllocationStrategy_Type)(0), // 1: xray.app.proxyman.AllocationStrategy.Type - (*InboundConfig)(nil), // 2: xray.app.proxyman.InboundConfig - (*AllocationStrategy)(nil), // 3: xray.app.proxyman.AllocationStrategy - (*SniffingConfig)(nil), // 4: xray.app.proxyman.SniffingConfig - (*ReceiverConfig)(nil), // 5: xray.app.proxyman.ReceiverConfig - (*InboundHandlerConfig)(nil), // 6: xray.app.proxyman.InboundHandlerConfig - (*OutboundConfig)(nil), // 7: xray.app.proxyman.OutboundConfig - (*SenderConfig)(nil), // 8: xray.app.proxyman.SenderConfig - (*MultiplexingConfig)(nil), // 9: xray.app.proxyman.MultiplexingConfig - (*AllocationStrategy_AllocationStrategyConcurrency)(nil), // 10: xray.app.proxyman.AllocationStrategy.AllocationStrategyConcurrency - (*AllocationStrategy_AllocationStrategyRefresh)(nil), // 11: xray.app.proxyman.AllocationStrategy.AllocationStrategyRefresh - (*net.PortList)(nil), // 12: xray.common.net.PortList - (*net.IPOrDomain)(nil), // 13: xray.common.net.IPOrDomain - (*internet.StreamConfig)(nil), // 14: xray.transport.internet.StreamConfig - (*serial.TypedMessage)(nil), // 15: xray.common.serial.TypedMessage - (*internet.ProxyConfig)(nil), // 16: xray.transport.internet.ProxyConfig + (AllocationStrategy_Type)(0), // 0: xray.app.proxyman.AllocationStrategy.Type + (*InboundConfig)(nil), // 1: xray.app.proxyman.InboundConfig + (*AllocationStrategy)(nil), // 2: xray.app.proxyman.AllocationStrategy + (*SniffingConfig)(nil), // 3: xray.app.proxyman.SniffingConfig + (*ReceiverConfig)(nil), // 4: xray.app.proxyman.ReceiverConfig + (*InboundHandlerConfig)(nil), // 5: xray.app.proxyman.InboundHandlerConfig + (*OutboundConfig)(nil), // 6: xray.app.proxyman.OutboundConfig + (*SenderConfig)(nil), // 7: xray.app.proxyman.SenderConfig + (*MultiplexingConfig)(nil), // 8: xray.app.proxyman.MultiplexingConfig + (*AllocationStrategy_AllocationStrategyConcurrency)(nil), // 9: xray.app.proxyman.AllocationStrategy.AllocationStrategyConcurrency + (*AllocationStrategy_AllocationStrategyRefresh)(nil), // 10: xray.app.proxyman.AllocationStrategy.AllocationStrategyRefresh + (*net.PortList)(nil), // 11: xray.common.net.PortList + (*net.IPOrDomain)(nil), // 12: xray.common.net.IPOrDomain + (*internet.StreamConfig)(nil), // 13: xray.transport.internet.StreamConfig + (*serial.TypedMessage)(nil), // 14: xray.common.serial.TypedMessage + (*internet.ProxyConfig)(nil), // 15: xray.transport.internet.ProxyConfig } var file_app_proxyman_config_proto_depIdxs = []int32{ - 1, // 0: xray.app.proxyman.AllocationStrategy.type:type_name -> xray.app.proxyman.AllocationStrategy.Type - 10, // 1: xray.app.proxyman.AllocationStrategy.concurrency:type_name -> xray.app.proxyman.AllocationStrategy.AllocationStrategyConcurrency - 11, // 2: xray.app.proxyman.AllocationStrategy.refresh:type_name -> xray.app.proxyman.AllocationStrategy.AllocationStrategyRefresh - 12, // 3: xray.app.proxyman.ReceiverConfig.port_list:type_name -> xray.common.net.PortList - 13, // 4: xray.app.proxyman.ReceiverConfig.listen:type_name -> xray.common.net.IPOrDomain - 3, // 5: xray.app.proxyman.ReceiverConfig.allocation_strategy:type_name -> xray.app.proxyman.AllocationStrategy - 14, // 6: xray.app.proxyman.ReceiverConfig.stream_settings:type_name -> xray.transport.internet.StreamConfig - 0, // 7: xray.app.proxyman.ReceiverConfig.domain_override:type_name -> xray.app.proxyman.KnownProtocols - 4, // 8: xray.app.proxyman.ReceiverConfig.sniffing_settings:type_name -> xray.app.proxyman.SniffingConfig - 15, // 9: xray.app.proxyman.InboundHandlerConfig.receiver_settings:type_name -> xray.common.serial.TypedMessage - 15, // 10: xray.app.proxyman.InboundHandlerConfig.proxy_settings:type_name -> xray.common.serial.TypedMessage - 13, // 11: xray.app.proxyman.SenderConfig.via:type_name -> xray.common.net.IPOrDomain - 14, // 12: xray.app.proxyman.SenderConfig.stream_settings:type_name -> xray.transport.internet.StreamConfig - 16, // 13: xray.app.proxyman.SenderConfig.proxy_settings:type_name -> xray.transport.internet.ProxyConfig - 9, // 14: xray.app.proxyman.SenderConfig.multiplex_settings:type_name -> xray.app.proxyman.MultiplexingConfig - 15, // [15:15] is the sub-list for method output_type - 15, // [15:15] is the sub-list for method input_type - 15, // [15:15] is the sub-list for extension type_name - 15, // [15:15] is the sub-list for extension extendee - 0, // [0:15] is the sub-list for field type_name + 0, // 0: xray.app.proxyman.AllocationStrategy.type:type_name -> xray.app.proxyman.AllocationStrategy.Type + 9, // 1: xray.app.proxyman.AllocationStrategy.concurrency:type_name -> xray.app.proxyman.AllocationStrategy.AllocationStrategyConcurrency + 10, // 2: xray.app.proxyman.AllocationStrategy.refresh:type_name -> xray.app.proxyman.AllocationStrategy.AllocationStrategyRefresh + 11, // 3: xray.app.proxyman.ReceiverConfig.port_list:type_name -> xray.common.net.PortList + 12, // 4: xray.app.proxyman.ReceiverConfig.listen:type_name -> xray.common.net.IPOrDomain + 2, // 5: xray.app.proxyman.ReceiverConfig.allocation_strategy:type_name -> xray.app.proxyman.AllocationStrategy + 13, // 6: xray.app.proxyman.ReceiverConfig.stream_settings:type_name -> xray.transport.internet.StreamConfig + 3, // 7: xray.app.proxyman.ReceiverConfig.sniffing_settings:type_name -> xray.app.proxyman.SniffingConfig + 14, // 8: xray.app.proxyman.InboundHandlerConfig.receiver_settings:type_name -> xray.common.serial.TypedMessage + 14, // 9: xray.app.proxyman.InboundHandlerConfig.proxy_settings:type_name -> xray.common.serial.TypedMessage + 12, // 10: xray.app.proxyman.SenderConfig.via:type_name -> xray.common.net.IPOrDomain + 13, // 11: xray.app.proxyman.SenderConfig.stream_settings:type_name -> xray.transport.internet.StreamConfig + 15, // 12: xray.app.proxyman.SenderConfig.proxy_settings:type_name -> xray.transport.internet.ProxyConfig + 8, // 13: xray.app.proxyman.SenderConfig.multiplex_settings:type_name -> xray.app.proxyman.MultiplexingConfig + 14, // [14:14] is the sub-list for method output_type + 14, // [14:14] is the sub-list for method input_type + 14, // [14:14] is the sub-list for extension type_name + 14, // [14:14] is the sub-list for extension extendee + 0, // [0:14] is the sub-list for field type_name } func init() { file_app_proxyman_config_proto_init() } @@ -1094,7 +1025,7 @@ func file_app_proxyman_config_proto_init() { File: protoimpl.DescBuilder{ GoPackagePath: reflect.TypeOf(x{}).PkgPath(), RawDescriptor: file_app_proxyman_config_proto_rawDesc, - NumEnums: 2, + NumEnums: 1, NumMessages: 10, NumExtensions: 0, NumServices: 0, diff --git a/app/proxyman/config.proto b/app/proxyman/config.proto index fe18c378..635ffad2 100644 --- a/app/proxyman/config.proto +++ b/app/proxyman/config.proto @@ -40,11 +40,6 @@ message AllocationStrategy { AllocationStrategyRefresh refresh = 3; } -enum KnownProtocols { - HTTP = 0; - TLS = 1; -} - message SniffingConfig { // Whether or not to enable content sniffing on an inbound connection. bool enabled = 1; @@ -71,10 +66,7 @@ message ReceiverConfig { xray.transport.internet.StreamConfig stream_settings = 4; bool receive_original_destination = 5; reserved 6; - // Override domains for the given protocol. - // Deprecated. Use sniffing_settings. - repeated KnownProtocols domain_override = 7 [ deprecated = true ]; - SniffingConfig sniffing_settings = 8; + SniffingConfig sniffing_settings = 7; } message InboundHandlerConfig { diff --git a/infra/conf/vmess.go b/infra/conf/vmess.go index 23eb6948..90ab92d4 100644 --- a/infra/conf/vmess.go +++ b/infra/conf/vmess.go @@ -57,10 +57,6 @@ func (c *VMessDetourConfig) Build() *inbound.DetourConfig { } } -type FeaturesConfig struct { - Detour *VMessDetourConfig `json:"detour"` -} - type VMessDefaultConfig struct { Level byte `json:"level"` } @@ -74,7 +70,6 @@ func (c *VMessDefaultConfig) Build() *inbound.DefaultConfig { type VMessInboundConfig struct { Users []json.RawMessage `json:"clients"` - Features *FeaturesConfig `json:"features"` Defaults *VMessDefaultConfig `json:"default"` DetourConfig *VMessDetourConfig `json:"detour"` } @@ -89,8 +84,6 @@ func (c *VMessInboundConfig) Build() (proto.Message, error) { if c.DetourConfig != nil { config.Detour = c.DetourConfig.Build() - } else if c.Features != nil && c.Features.Detour != nil { - config.Detour = c.Features.Detour.Build() } config.User = make([]*protocol.User, len(c.Users)) diff --git a/infra/conf/xray.go b/infra/conf/xray.go index cce7c3bf..6daca0f7 100644 --- a/infra/conf/xray.go +++ b/infra/conf/xray.go @@ -48,21 +48,6 @@ var ( ctllog = log.New(os.Stderr, "xctl> ", 0) ) -func toProtocolList(s []string) ([]proxyman.KnownProtocols, error) { - kp := make([]proxyman.KnownProtocols, 0, 8) - for _, p := range s { - switch strings.ToLower(p) { - case "http": - kp = append(kp, proxyman.KnownProtocols_HTTP) - case "https", "tls", "ssl": - kp = append(kp, proxyman.KnownProtocols_TLS) - default: - return nil, errors.New("Unknown protocol: ", p) - } - } - return kp, nil -} - type SniffingConfig struct { Enabled bool `json:"enabled"` DestOverride *StringList `json:"destOverride"` @@ -175,7 +160,6 @@ type InboundDetourConfig struct { Tag string `json:"tag"` Allocation *InboundDetourAllocationConfig `json:"allocate"` StreamSetting *StreamConfig `json:"streamSettings"` - DomainOverride *StringList `json:"domainOverride"` SniffingConfig *SniffingConfig `json:"sniffing"` } @@ -249,13 +233,6 @@ func (c *InboundDetourConfig) Build() (*core.InboundHandlerConfig, error) { } receiverSettings.SniffingSettings = s } - if c.DomainOverride != nil { - kp, err := toProtocolList(*c.DomainOverride) - if err != nil { - return nil, errors.New("failed to parse inbound detour config").Base(err) - } - receiverSettings.DomainOverride = kp - } settings := []byte("{}") if c.Settings != nil { diff --git a/testing/scenarios/feature_test.go b/testing/scenarios/feature_test.go index bee4598f..0e2f8785 100644 --- a/testing/scenarios/feature_test.go +++ b/testing/scenarios/feature_test.go @@ -560,8 +560,9 @@ func TestDomainSniffing(t *testing.T) { ReceiverSettings: serial.ToTypedMessage(&proxyman.ReceiverConfig{ PortList: &net.PortList{Range: []*net.PortRange{net.SinglePortRange(sniffingPort)}}, Listen: net.NewIPOrDomain(net.LocalHostIP), - DomainOverride: []proxyman.KnownProtocols{ - proxyman.KnownProtocols_TLS, + SniffingSettings: &proxyman.SniffingConfig{ + Enabled: true, + DestinationOverride: []string{"tls"}, }, }), ProxySettings: serial.ToTypedMessage(&dokodemo.Config{