diff --git a/app/dns/config.pb.go b/app/dns/config.pb.go index 05fd6099b387..e2a9e6aa1659 100644 --- a/app/dns/config.pb.go +++ b/app/dns/config.pb.go @@ -1,7 +1,7 @@ // Code generated by protoc-gen-go. DO NOT EDIT. // versions: -// protoc-gen-go v1.35.1 -// protoc v5.28.2 +// protoc-gen-go v1.34.2 +// protoc v5.28.0 // source: app/dns/config.proto package dns @@ -139,9 +139,11 @@ type NameServer struct { func (x *NameServer) Reset() { *x = NameServer{} - mi := &file_app_dns_config_proto_msgTypes[0] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) + if protoimpl.UnsafeEnabled { + mi := &file_app_dns_config_proto_msgTypes[0] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } } func (x *NameServer) String() string { @@ -152,7 +154,7 @@ func (*NameServer) ProtoMessage() {} func (x *NameServer) ProtoReflect() protoreflect.Message { mi := &file_app_dns_config_proto_msgTypes[0] - if x != nil { + if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { ms.StoreMessageInfo(mi) @@ -239,9 +241,11 @@ type Config struct { func (x *Config) Reset() { *x = Config{} - mi := &file_app_dns_config_proto_msgTypes[1] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) + if protoimpl.UnsafeEnabled { + mi := &file_app_dns_config_proto_msgTypes[1] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } } func (x *Config) String() string { @@ -252,7 +256,7 @@ func (*Config) ProtoMessage() {} func (x *Config) ProtoReflect() protoreflect.Message { mi := &file_app_dns_config_proto_msgTypes[1] - if x != nil { + if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { ms.StoreMessageInfo(mi) @@ -334,9 +338,11 @@ type NameServer_PriorityDomain struct { func (x *NameServer_PriorityDomain) Reset() { *x = NameServer_PriorityDomain{} - mi := &file_app_dns_config_proto_msgTypes[2] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) + if protoimpl.UnsafeEnabled { + mi := &file_app_dns_config_proto_msgTypes[2] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } } func (x *NameServer_PriorityDomain) String() string { @@ -347,7 +353,7 @@ func (*NameServer_PriorityDomain) ProtoMessage() {} func (x *NameServer_PriorityDomain) ProtoReflect() protoreflect.Message { mi := &file_app_dns_config_proto_msgTypes[2] - if x != nil { + if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { ms.StoreMessageInfo(mi) @@ -387,9 +393,11 @@ type NameServer_OriginalRule struct { func (x *NameServer_OriginalRule) Reset() { *x = NameServer_OriginalRule{} - mi := &file_app_dns_config_proto_msgTypes[3] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) + if protoimpl.UnsafeEnabled { + mi := &file_app_dns_config_proto_msgTypes[3] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } } func (x *NameServer_OriginalRule) String() string { @@ -400,7 +408,7 @@ func (*NameServer_OriginalRule) ProtoMessage() {} func (x *NameServer_OriginalRule) ProtoReflect() protoreflect.Message { mi := &file_app_dns_config_proto_msgTypes[3] - if x != nil { + if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { ms.StoreMessageInfo(mi) @@ -444,9 +452,11 @@ type Config_HostMapping struct { func (x *Config_HostMapping) Reset() { *x = Config_HostMapping{} - mi := &file_app_dns_config_proto_msgTypes[4] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) + if protoimpl.UnsafeEnabled { + mi := &file_app_dns_config_proto_msgTypes[4] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } } func (x *Config_HostMapping) String() string { @@ -457,7 +467,7 @@ func (*Config_HostMapping) ProtoMessage() {} func (x *Config_HostMapping) ProtoReflect() protoreflect.Message { mi := &file_app_dns_config_proto_msgTypes[4] - if x != nil { + if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { ms.StoreMessageInfo(mi) @@ -641,6 +651,68 @@ func file_app_dns_config_proto_init() { if File_app_dns_config_proto != nil { return } + if !protoimpl.UnsafeEnabled { + file_app_dns_config_proto_msgTypes[0].Exporter = func(v any, i int) any { + switch v := v.(*NameServer); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_app_dns_config_proto_msgTypes[1].Exporter = func(v any, i int) any { + switch v := v.(*Config); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_app_dns_config_proto_msgTypes[2].Exporter = func(v any, i int) any { + switch v := v.(*NameServer_PriorityDomain); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_app_dns_config_proto_msgTypes[3].Exporter = func(v any, i int) any { + switch v := v.(*NameServer_OriginalRule); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_app_dns_config_proto_msgTypes[4].Exporter = func(v any, i int) any { + switch v := v.(*Config_HostMapping); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + } type x struct{} out := protoimpl.TypeBuilder{ File: protoimpl.DescBuilder{ diff --git a/app/router/config.pb.go b/app/router/config.pb.go index ca6cc38fccd4..b214d12a4f49 100644 --- a/app/router/config.pb.go +++ b/app/router/config.pb.go @@ -1,7 +1,7 @@ // Code generated by protoc-gen-go. DO NOT EDIT. // versions: -// protoc-gen-go v1.35.1 -// protoc v5.28.2 +// protoc-gen-go v1.34.2 +// protoc v5.28.0 // source: app/router/config.proto package router @@ -151,9 +151,11 @@ type Domain struct { func (x *Domain) Reset() { *x = Domain{} - mi := &file_app_router_config_proto_msgTypes[0] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) + if protoimpl.UnsafeEnabled { + mi := &file_app_router_config_proto_msgTypes[0] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } } func (x *Domain) String() string { @@ -164,7 +166,7 @@ func (*Domain) ProtoMessage() {} func (x *Domain) ProtoReflect() protoreflect.Message { mi := &file_app_router_config_proto_msgTypes[0] - if x != nil { + if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { ms.StoreMessageInfo(mi) @@ -214,9 +216,11 @@ type CIDR struct { func (x *CIDR) Reset() { *x = CIDR{} - mi := &file_app_router_config_proto_msgTypes[1] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) + if protoimpl.UnsafeEnabled { + mi := &file_app_router_config_proto_msgTypes[1] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } } func (x *CIDR) String() string { @@ -227,7 +231,7 @@ func (*CIDR) ProtoMessage() {} func (x *CIDR) ProtoReflect() protoreflect.Message { mi := &file_app_router_config_proto_msgTypes[1] - if x != nil { + if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { ms.StoreMessageInfo(mi) @@ -268,9 +272,11 @@ type GeoIP struct { func (x *GeoIP) Reset() { *x = GeoIP{} - mi := &file_app_router_config_proto_msgTypes[2] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) + if protoimpl.UnsafeEnabled { + mi := &file_app_router_config_proto_msgTypes[2] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } } func (x *GeoIP) String() string { @@ -281,7 +287,7 @@ func (*GeoIP) ProtoMessage() {} func (x *GeoIP) ProtoReflect() protoreflect.Message { mi := &file_app_router_config_proto_msgTypes[2] - if x != nil { + if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { ms.StoreMessageInfo(mi) @@ -327,9 +333,11 @@ type GeoIPList struct { func (x *GeoIPList) Reset() { *x = GeoIPList{} - mi := &file_app_router_config_proto_msgTypes[3] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) + if protoimpl.UnsafeEnabled { + mi := &file_app_router_config_proto_msgTypes[3] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } } func (x *GeoIPList) String() string { @@ -340,7 +348,7 @@ func (*GeoIPList) ProtoMessage() {} func (x *GeoIPList) ProtoReflect() protoreflect.Message { mi := &file_app_router_config_proto_msgTypes[3] - if x != nil { + if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { ms.StoreMessageInfo(mi) @@ -373,9 +381,11 @@ type GeoSite struct { func (x *GeoSite) Reset() { *x = GeoSite{} - mi := &file_app_router_config_proto_msgTypes[4] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) + if protoimpl.UnsafeEnabled { + mi := &file_app_router_config_proto_msgTypes[4] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } } func (x *GeoSite) String() string { @@ -386,7 +396,7 @@ func (*GeoSite) ProtoMessage() {} func (x *GeoSite) ProtoReflect() protoreflect.Message { mi := &file_app_router_config_proto_msgTypes[4] - if x != nil { + if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { ms.StoreMessageInfo(mi) @@ -425,9 +435,11 @@ type GeoSiteList struct { func (x *GeoSiteList) Reset() { *x = GeoSiteList{} - mi := &file_app_router_config_proto_msgTypes[5] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) + if protoimpl.UnsafeEnabled { + mi := &file_app_router_config_proto_msgTypes[5] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } } func (x *GeoSiteList) String() string { @@ -438,7 +450,7 @@ func (*GeoSiteList) ProtoMessage() {} func (x *GeoSiteList) ProtoReflect() protoreflect.Message { mi := &file_app_router_config_proto_msgTypes[5] - if x != nil { + if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { ms.StoreMessageInfo(mi) @@ -496,9 +508,11 @@ type RoutingRule struct { func (x *RoutingRule) Reset() { *x = RoutingRule{} - mi := &file_app_router_config_proto_msgTypes[6] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) + if protoimpl.UnsafeEnabled { + mi := &file_app_router_config_proto_msgTypes[6] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } } func (x *RoutingRule) String() string { @@ -509,7 +523,7 @@ func (*RoutingRule) ProtoMessage() {} func (x *RoutingRule) ProtoReflect() protoreflect.Message { mi := &file_app_router_config_proto_msgTypes[6] - if x != nil { + if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { ms.StoreMessageInfo(mi) @@ -661,9 +675,11 @@ type BalancingRule struct { func (x *BalancingRule) Reset() { *x = BalancingRule{} - mi := &file_app_router_config_proto_msgTypes[7] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) + if protoimpl.UnsafeEnabled { + mi := &file_app_router_config_proto_msgTypes[7] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } } func (x *BalancingRule) String() string { @@ -674,7 +690,7 @@ func (*BalancingRule) ProtoMessage() {} func (x *BalancingRule) ProtoReflect() protoreflect.Message { mi := &file_app_router_config_proto_msgTypes[7] - if x != nil { + if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { ms.StoreMessageInfo(mi) @@ -736,9 +752,11 @@ type StrategyWeight struct { func (x *StrategyWeight) Reset() { *x = StrategyWeight{} - mi := &file_app_router_config_proto_msgTypes[8] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) + if protoimpl.UnsafeEnabled { + mi := &file_app_router_config_proto_msgTypes[8] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } } func (x *StrategyWeight) String() string { @@ -749,7 +767,7 @@ func (*StrategyWeight) ProtoMessage() {} func (x *StrategyWeight) ProtoReflect() protoreflect.Message { mi := &file_app_router_config_proto_msgTypes[8] - if x != nil { + if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { ms.StoreMessageInfo(mi) @@ -804,9 +822,11 @@ type StrategyLeastLoadConfig struct { func (x *StrategyLeastLoadConfig) Reset() { *x = StrategyLeastLoadConfig{} - mi := &file_app_router_config_proto_msgTypes[9] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) + if protoimpl.UnsafeEnabled { + mi := &file_app_router_config_proto_msgTypes[9] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } } func (x *StrategyLeastLoadConfig) String() string { @@ -817,7 +837,7 @@ func (*StrategyLeastLoadConfig) ProtoMessage() {} func (x *StrategyLeastLoadConfig) ProtoReflect() protoreflect.Message { mi := &file_app_router_config_proto_msgTypes[9] - if x != nil { + if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { ms.StoreMessageInfo(mi) @@ -879,9 +899,11 @@ type Config struct { func (x *Config) Reset() { *x = Config{} - mi := &file_app_router_config_proto_msgTypes[10] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) + if protoimpl.UnsafeEnabled { + mi := &file_app_router_config_proto_msgTypes[10] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } } func (x *Config) String() string { @@ -892,7 +914,7 @@ func (*Config) ProtoMessage() {} func (x *Config) ProtoReflect() protoreflect.Message { mi := &file_app_router_config_proto_msgTypes[10] - if x != nil { + if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { ms.StoreMessageInfo(mi) @@ -943,9 +965,11 @@ type Domain_Attribute struct { func (x *Domain_Attribute) Reset() { *x = Domain_Attribute{} - mi := &file_app_router_config_proto_msgTypes[11] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) + if protoimpl.UnsafeEnabled { + mi := &file_app_router_config_proto_msgTypes[11] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } } func (x *Domain_Attribute) String() string { @@ -956,7 +980,7 @@ func (*Domain_Attribute) ProtoMessage() {} func (x *Domain_Attribute) ProtoReflect() protoreflect.Message { mi := &file_app_router_config_proto_msgTypes[11] - if x != nil { + if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { ms.StoreMessageInfo(mi) @@ -1237,6 +1261,152 @@ func file_app_router_config_proto_init() { if File_app_router_config_proto != nil { return } + if !protoimpl.UnsafeEnabled { + file_app_router_config_proto_msgTypes[0].Exporter = func(v any, i int) any { + switch v := v.(*Domain); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_app_router_config_proto_msgTypes[1].Exporter = func(v any, i int) any { + switch v := v.(*CIDR); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_app_router_config_proto_msgTypes[2].Exporter = func(v any, i int) any { + switch v := v.(*GeoIP); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_app_router_config_proto_msgTypes[3].Exporter = func(v any, i int) any { + switch v := v.(*GeoIPList); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_app_router_config_proto_msgTypes[4].Exporter = func(v any, i int) any { + switch v := v.(*GeoSite); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_app_router_config_proto_msgTypes[5].Exporter = func(v any, i int) any { + switch v := v.(*GeoSiteList); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_app_router_config_proto_msgTypes[6].Exporter = func(v any, i int) any { + switch v := v.(*RoutingRule); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_app_router_config_proto_msgTypes[7].Exporter = func(v any, i int) any { + switch v := v.(*BalancingRule); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_app_router_config_proto_msgTypes[8].Exporter = func(v any, i int) any { + switch v := v.(*StrategyWeight); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_app_router_config_proto_msgTypes[9].Exporter = func(v any, i int) any { + switch v := v.(*StrategyLeastLoadConfig); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_app_router_config_proto_msgTypes[10].Exporter = func(v any, i int) any { + switch v := v.(*Config); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_app_router_config_proto_msgTypes[11].Exporter = func(v any, i int) any { + switch v := v.(*Domain_Attribute); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + } file_app_router_config_proto_msgTypes[6].OneofWrappers = []any{ (*RoutingRule_Tag)(nil), (*RoutingRule_BalancingTag)(nil), diff --git a/core/xray_test.go b/core/xray_test.go index 43d021efd2b7..eea0a4085cbd 100644 --- a/core/xray_test.go +++ b/core/xray_test.go @@ -54,8 +54,8 @@ func TestXrayClose(t *testing.T) { Listen: net.NewIPOrDomain(net.LocalHostIP), }), ProxySettings: serial.ToTypedMessage(&dokodemo.Config{ - Address: net.NewIPOrDomain(net.LocalHostIP), - Port: uint32(0), + Address: net.NewIPOrDomain(net.LocalHostIP), + Port: uint32(0), Networks: []net.Network{net.Network_TCP}, }), }, diff --git a/infra/conf/dokodemo.go b/infra/conf/dokodemo.go index 2086cb5a439d..e0f76733e5f9 100644 --- a/infra/conf/dokodemo.go +++ b/infra/conf/dokodemo.go @@ -6,11 +6,11 @@ import ( ) type DokodemoConfig struct { - Host *Address `json:"address"` - PortValue uint16 `json:"port"` - NetworkList *NetworkList `json:"network"` - Redirect bool `json:"followRedirect"` - UserLevel uint32 `json:"userLevel"` + Host *Address `json:"address"` + PortValue uint16 `json:"port"` + NetworkList *NetworkList `json:"network"` + Redirect bool `json:"followRedirect"` + UserLevel uint32 `json:"userLevel"` } func (v *DokodemoConfig) Build() (proto.Message, error) { diff --git a/proxy/dokodemo/config.pb.go b/proxy/dokodemo/config.pb.go index b30c123e407c..985b7f1f0666 100644 --- a/proxy/dokodemo/config.pb.go +++ b/proxy/dokodemo/config.pb.go @@ -1,7 +1,7 @@ // Code generated by protoc-gen-go. DO NOT EDIT. // versions: -// protoc-gen-go v1.35.1 -// protoc v5.28.2 +// protoc-gen-go v1.34.2 +// protoc v5.28.0 // source: proxy/dokodemo/config.proto package dokodemo @@ -36,9 +36,11 @@ type Config struct { func (x *Config) Reset() { *x = Config{} - mi := &file_proxy_dokodemo_config_proto_msgTypes[0] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) + if protoimpl.UnsafeEnabled { + mi := &file_proxy_dokodemo_config_proto_msgTypes[0] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } } func (x *Config) String() string { @@ -49,7 +51,7 @@ func (*Config) ProtoMessage() {} func (x *Config) ProtoReflect() protoreflect.Message { mi := &file_proxy_dokodemo_config_proto_msgTypes[0] - if x != nil { + if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { ms.StoreMessageInfo(mi) @@ -163,6 +165,20 @@ func file_proxy_dokodemo_config_proto_init() { if File_proxy_dokodemo_config_proto != nil { return } + if !protoimpl.UnsafeEnabled { + file_proxy_dokodemo_config_proto_msgTypes[0].Exporter = func(v any, i int) any { + switch v := v.(*Config); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + } type x struct{} out := protoimpl.TypeBuilder{ File: protoimpl.DescBuilder{ diff --git a/proxy/freedom/config.pb.go b/proxy/freedom/config.pb.go index 03ce6a02b90d..56fb1a6e047d 100644 --- a/proxy/freedom/config.pb.go +++ b/proxy/freedom/config.pb.go @@ -1,7 +1,7 @@ // Code generated by protoc-gen-go. DO NOT EDIT. // versions: -// protoc-gen-go v1.35.1 -// protoc v5.28.2 +// protoc-gen-go v1.34.2 +// protoc v5.28.0 // source: proxy/freedom/config.proto package freedom @@ -104,9 +104,11 @@ type DestinationOverride struct { func (x *DestinationOverride) Reset() { *x = DestinationOverride{} - mi := &file_proxy_freedom_config_proto_msgTypes[0] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) + if protoimpl.UnsafeEnabled { + mi := &file_proxy_freedom_config_proto_msgTypes[0] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } } func (x *DestinationOverride) String() string { @@ -117,7 +119,7 @@ func (*DestinationOverride) ProtoMessage() {} func (x *DestinationOverride) ProtoReflect() protoreflect.Message { mi := &file_proxy_freedom_config_proto_msgTypes[0] - if x != nil { + if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { ms.StoreMessageInfo(mi) @@ -154,9 +156,11 @@ type Fragment struct { func (x *Fragment) Reset() { *x = Fragment{} - mi := &file_proxy_freedom_config_proto_msgTypes[1] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) + if protoimpl.UnsafeEnabled { + mi := &file_proxy_freedom_config_proto_msgTypes[1] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } } func (x *Fragment) String() string { @@ -167,7 +171,7 @@ func (*Fragment) ProtoMessage() {} func (x *Fragment) ProtoReflect() protoreflect.Message { mi := &file_proxy_freedom_config_proto_msgTypes[1] - if x != nil { + if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { ms.StoreMessageInfo(mi) @@ -238,9 +242,11 @@ type Noise struct { func (x *Noise) Reset() { *x = Noise{} - mi := &file_proxy_freedom_config_proto_msgTypes[2] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) + if protoimpl.UnsafeEnabled { + mi := &file_proxy_freedom_config_proto_msgTypes[2] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } } func (x *Noise) String() string { @@ -251,7 +257,7 @@ func (*Noise) ProtoMessage() {} func (x *Noise) ProtoReflect() protoreflect.Message { mi := &file_proxy_freedom_config_proto_msgTypes[2] - if x != nil { + if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { ms.StoreMessageInfo(mi) @@ -316,9 +322,11 @@ type Config struct { func (x *Config) Reset() { *x = Config{} - mi := &file_proxy_freedom_config_proto_msgTypes[3] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) + if protoimpl.UnsafeEnabled { + mi := &file_proxy_freedom_config_proto_msgTypes[3] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } } func (x *Config) String() string { @@ -329,7 +337,7 @@ func (*Config) ProtoMessage() {} func (x *Config) ProtoReflect() protoreflect.Message { mi := &file_proxy_freedom_config_proto_msgTypes[3] - if x != nil { + if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { ms.StoreMessageInfo(mi) @@ -505,6 +513,56 @@ func file_proxy_freedom_config_proto_init() { if File_proxy_freedom_config_proto != nil { return } + if !protoimpl.UnsafeEnabled { + file_proxy_freedom_config_proto_msgTypes[0].Exporter = func(v any, i int) any { + switch v := v.(*DestinationOverride); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_proxy_freedom_config_proto_msgTypes[1].Exporter = func(v any, i int) any { + switch v := v.(*Fragment); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_proxy_freedom_config_proto_msgTypes[2].Exporter = func(v any, i int) any { + switch v := v.(*Noise); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_proxy_freedom_config_proto_msgTypes[3].Exporter = func(v any, i int) any { + switch v := v.(*Config); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + } type x struct{} out := protoimpl.TypeBuilder{ File: protoimpl.DescBuilder{ diff --git a/proxy/http/config.pb.go b/proxy/http/config.pb.go index 03e03441e02c..bbcddffb90b1 100644 --- a/proxy/http/config.pb.go +++ b/proxy/http/config.pb.go @@ -1,7 +1,7 @@ // Code generated by protoc-gen-go. DO NOT EDIT. // versions: -// protoc-gen-go v1.35.1 -// protoc v5.28.2 +// protoc-gen-go v1.34.2 +// protoc v5.28.0 // source: proxy/http/config.proto package http @@ -32,9 +32,11 @@ type Account struct { func (x *Account) Reset() { *x = Account{} - mi := &file_proxy_http_config_proto_msgTypes[0] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) + if protoimpl.UnsafeEnabled { + mi := &file_proxy_http_config_proto_msgTypes[0] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } } func (x *Account) String() string { @@ -45,7 +47,7 @@ func (*Account) ProtoMessage() {} func (x *Account) ProtoReflect() protoreflect.Message { mi := &file_proxy_http_config_proto_msgTypes[0] - if x != nil { + if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { ms.StoreMessageInfo(mi) @@ -87,9 +89,11 @@ type ServerConfig struct { func (x *ServerConfig) Reset() { *x = ServerConfig{} - mi := &file_proxy_http_config_proto_msgTypes[1] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) + if protoimpl.UnsafeEnabled { + mi := &file_proxy_http_config_proto_msgTypes[1] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } } func (x *ServerConfig) String() string { @@ -100,7 +104,7 @@ func (*ServerConfig) ProtoMessage() {} func (x *ServerConfig) ProtoReflect() protoreflect.Message { mi := &file_proxy_http_config_proto_msgTypes[1] - if x != nil { + if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { ms.StoreMessageInfo(mi) @@ -147,9 +151,11 @@ type Header struct { func (x *Header) Reset() { *x = Header{} - mi := &file_proxy_http_config_proto_msgTypes[2] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) + if protoimpl.UnsafeEnabled { + mi := &file_proxy_http_config_proto_msgTypes[2] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } } func (x *Header) String() string { @@ -160,7 +166,7 @@ func (*Header) ProtoMessage() {} func (x *Header) ProtoReflect() protoreflect.Message { mi := &file_proxy_http_config_proto_msgTypes[2] - if x != nil { + if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { ms.StoreMessageInfo(mi) @@ -202,9 +208,11 @@ type ClientConfig struct { func (x *ClientConfig) Reset() { *x = ClientConfig{} - mi := &file_proxy_http_config_proto_msgTypes[3] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) + if protoimpl.UnsafeEnabled { + mi := &file_proxy_http_config_proto_msgTypes[3] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } } func (x *ClientConfig) String() string { @@ -215,7 +223,7 @@ func (*ClientConfig) ProtoMessage() {} func (x *ClientConfig) ProtoReflect() protoreflect.Message { mi := &file_proxy_http_config_proto_msgTypes[3] - if x != nil { + if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { ms.StoreMessageInfo(mi) @@ -326,6 +334,56 @@ func file_proxy_http_config_proto_init() { if File_proxy_http_config_proto != nil { return } + if !protoimpl.UnsafeEnabled { + file_proxy_http_config_proto_msgTypes[0].Exporter = func(v any, i int) any { + switch v := v.(*Account); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_proxy_http_config_proto_msgTypes[1].Exporter = func(v any, i int) any { + switch v := v.(*ServerConfig); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_proxy_http_config_proto_msgTypes[2].Exporter = func(v any, i int) any { + switch v := v.(*Header); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_proxy_http_config_proto_msgTypes[3].Exporter = func(v any, i int) any { + switch v := v.(*ClientConfig); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + } type x struct{} out := protoimpl.TypeBuilder{ File: protoimpl.DescBuilder{ diff --git a/proxy/socks/client.go b/proxy/socks/client.go index 2ed5740a4f56..e5af31618178 100644 --- a/proxy/socks/client.go +++ b/proxy/socks/client.go @@ -45,7 +45,7 @@ func NewClient(ctx context.Context, config *ClientConfig) (*Client, error) { serverPicker: protocol.NewRoundRobinServerPicker(serverList), policyManager: v.GetFeature(policy.ManagerType()).(policy.Manager), } - + return c, nil } diff --git a/proxy/socks/config.pb.go b/proxy/socks/config.pb.go index ee94d0bc126f..e1bd98726fcd 100644 --- a/proxy/socks/config.pb.go +++ b/proxy/socks/config.pb.go @@ -1,7 +1,7 @@ // Code generated by protoc-gen-go. DO NOT EDIT. // versions: -// protoc-gen-go v1.35.1 -// protoc v5.28.2 +// protoc-gen-go v1.34.2 +// protoc v5.28.0 // source: proxy/socks/config.proto package socks @@ -83,9 +83,11 @@ type Account struct { func (x *Account) Reset() { *x = Account{} - mi := &file_proxy_socks_config_proto_msgTypes[0] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) + if protoimpl.UnsafeEnabled { + mi := &file_proxy_socks_config_proto_msgTypes[0] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } } func (x *Account) String() string { @@ -96,7 +98,7 @@ func (*Account) ProtoMessage() {} func (x *Account) ProtoReflect() protoreflect.Message { mi := &file_proxy_socks_config_proto_msgTypes[0] - if x != nil { + if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { ms.StoreMessageInfo(mi) @@ -140,9 +142,11 @@ type ServerConfig struct { func (x *ServerConfig) Reset() { *x = ServerConfig{} - mi := &file_proxy_socks_config_proto_msgTypes[1] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) + if protoimpl.UnsafeEnabled { + mi := &file_proxy_socks_config_proto_msgTypes[1] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } } func (x *ServerConfig) String() string { @@ -153,7 +157,7 @@ func (*ServerConfig) ProtoMessage() {} func (x *ServerConfig) ProtoReflect() protoreflect.Message { mi := &file_proxy_socks_config_proto_msgTypes[1] - if x != nil { + if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { ms.StoreMessageInfo(mi) @@ -215,9 +219,11 @@ type ClientConfig struct { func (x *ClientConfig) Reset() { *x = ClientConfig{} - mi := &file_proxy_socks_config_proto_msgTypes[2] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) + if protoimpl.UnsafeEnabled { + mi := &file_proxy_socks_config_proto_msgTypes[2] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } } func (x *ClientConfig) String() string { @@ -228,7 +234,7 @@ func (*ClientConfig) ProtoMessage() {} func (x *ClientConfig) ProtoReflect() protoreflect.Message { mi := &file_proxy_socks_config_proto_msgTypes[2] - if x != nil { + if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { ms.StoreMessageInfo(mi) @@ -340,6 +346,44 @@ func file_proxy_socks_config_proto_init() { if File_proxy_socks_config_proto != nil { return } + if !protoimpl.UnsafeEnabled { + file_proxy_socks_config_proto_msgTypes[0].Exporter = func(v any, i int) any { + switch v := v.(*Account); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_proxy_socks_config_proto_msgTypes[1].Exporter = func(v any, i int) any { + switch v := v.(*ServerConfig); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_proxy_socks_config_proto_msgTypes[2].Exporter = func(v any, i int) any { + switch v := v.(*ClientConfig); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + } type x struct{} out := protoimpl.TypeBuilder{ File: protoimpl.DescBuilder{ diff --git a/testing/scenarios/command_test.go b/testing/scenarios/command_test.go index 037255a985b8..b20d6f105bcd 100644 --- a/testing/scenarios/command_test.go +++ b/testing/scenarios/command_test.go @@ -303,8 +303,8 @@ func TestCommanderAddRemoveUser(t *testing.T) { Listen: net.NewIPOrDomain(net.LocalHostIP), }), ProxySettings: serial.ToTypedMessage(&dokodemo.Config{ - Address: net.NewIPOrDomain(dest.Address), - Port: uint32(dest.Port), + Address: net.NewIPOrDomain(dest.Address), + Port: uint32(dest.Port), Networks: []net.Network{net.Network_TCP}, }), }, @@ -458,8 +458,8 @@ func TestCommanderStats(t *testing.T) { Listen: net.NewIPOrDomain(net.LocalHostIP), }), ProxySettings: serial.ToTypedMessage(&dokodemo.Config{ - Address: net.NewIPOrDomain(dest.Address), - Port: uint32(dest.Port), + Address: net.NewIPOrDomain(dest.Address), + Port: uint32(dest.Port), Networks: []net.Network{net.Network_TCP}, }), }, @@ -480,8 +480,8 @@ func TestCommanderStats(t *testing.T) { Listen: net.NewIPOrDomain(net.LocalHostIP), }), ProxySettings: serial.ToTypedMessage(&dokodemo.Config{ - Address: net.NewIPOrDomain(dest.Address), - Port: uint32(dest.Port), + Address: net.NewIPOrDomain(dest.Address), + Port: uint32(dest.Port), Networks: []net.Network{net.Network_TCP}, }), }, diff --git a/testing/scenarios/dokodemo_test.go b/testing/scenarios/dokodemo_test.go index f74fb4bd3fa3..d6b69823e72a 100644 --- a/testing/scenarios/dokodemo_test.go +++ b/testing/scenarios/dokodemo_test.go @@ -85,8 +85,8 @@ func TestDokodemoTCP(t *testing.T) { Listen: net.NewIPOrDomain(net.LocalHostIP), }), ProxySettings: serial.ToTypedMessage(&dokodemo.Config{ - Address: net.NewIPOrDomain(dest.Address), - Port: uint32(dest.Port), + Address: net.NewIPOrDomain(dest.Address), + Port: uint32(dest.Port), Networks: []net.Network{net.Network_TCP}, }), }, @@ -181,8 +181,8 @@ func TestDokodemoUDP(t *testing.T) { Listen: net.NewIPOrDomain(net.LocalHostIP), }), ProxySettings: serial.ToTypedMessage(&dokodemo.Config{ - Address: net.NewIPOrDomain(dest.Address), - Port: uint32(dest.Port), + Address: net.NewIPOrDomain(dest.Address), + Port: uint32(dest.Port), Networks: []net.Network{net.Network_UDP}, }), }, diff --git a/testing/scenarios/feature_test.go b/testing/scenarios/feature_test.go index 6fe0d85098da..a03a64ea6357 100644 --- a/testing/scenarios/feature_test.go +++ b/testing/scenarios/feature_test.go @@ -53,8 +53,8 @@ func TestPassiveConnection(t *testing.T) { Listen: net.NewIPOrDomain(net.LocalHostIP), }), ProxySettings: serial.ToTypedMessage(&dokodemo.Config{ - Address: net.NewIPOrDomain(dest.Address), - Port: uint32(dest.Port), + Address: net.NewIPOrDomain(dest.Address), + Port: uint32(dest.Port), Networks: []net.Network{net.Network_TCP}, }), }, @@ -161,8 +161,8 @@ func TestProxy(t *testing.T) { Listen: net.NewIPOrDomain(net.LocalHostIP), }), ProxySettings: serial.ToTypedMessage(&dokodemo.Config{ - Address: net.NewIPOrDomain(dest.Address), - Port: uint32(dest.Port), + Address: net.NewIPOrDomain(dest.Address), + Port: uint32(dest.Port), Networks: []net.Network{net.Network_TCP}, }), }, @@ -237,7 +237,7 @@ func TestProxyOverKCP(t *testing.T) { PortList: &net.PortList{Range: []*net.PortRange{net.SinglePortRange(serverPort)}}, Listen: net.NewIPOrDomain(net.LocalHostIP), StreamSettings: &internet.StreamConfig{ - ProtocolName: "mkcp", + Protocol: internet.TransportProtocol_MKCP, }, }), ProxySettings: serial.ToTypedMessage(&inbound.Config{ @@ -283,7 +283,7 @@ func TestProxyOverKCP(t *testing.T) { ProxySettings: serial.ToTypedMessage(&freedom.Config{}), SenderSettings: serial.ToTypedMessage(&proxyman.SenderConfig{ StreamSettings: &internet.StreamConfig{ - ProtocolName: "mkcp", + Protocol: internet.TransportProtocol_MKCP, }, }), }, @@ -299,8 +299,8 @@ func TestProxyOverKCP(t *testing.T) { Listen: net.NewIPOrDomain(net.LocalHostIP), }), ProxySettings: serial.ToTypedMessage(&dokodemo.Config{ - Address: net.NewIPOrDomain(dest.Address), - Port: uint32(dest.Port), + Address: net.NewIPOrDomain(dest.Address), + Port: uint32(dest.Port), Networks: []net.Network{net.Network_TCP}, }), }, @@ -327,7 +327,7 @@ func TestProxyOverKCP(t *testing.T) { Tag: "proxy", }, StreamSettings: &internet.StreamConfig{ - ProtocolName: "mkcp", + Protocol: internet.TransportProtocol_MKCP, }, }), }, @@ -386,8 +386,8 @@ func TestBlackhole(t *testing.T) { Listen: net.NewIPOrDomain(net.LocalHostIP), }), ProxySettings: serial.ToTypedMessage(&dokodemo.Config{ - Address: net.NewIPOrDomain(dest.Address), - Port: uint32(dest.Port), + Address: net.NewIPOrDomain(dest.Address), + Port: uint32(dest.Port), Networks: []net.Network{net.Network_TCP}, }), }, @@ -397,8 +397,8 @@ func TestBlackhole(t *testing.T) { Listen: net.NewIPOrDomain(net.LocalHostIP), }), ProxySettings: serial.ToTypedMessage(&dokodemo.Config{ - Address: net.NewIPOrDomain(dest2.Address), - Port: uint32(dest2.Port), + Address: net.NewIPOrDomain(dest2.Address), + Port: uint32(dest2.Port), Networks: []net.Network{net.Network_TCP}, }), }, @@ -512,8 +512,8 @@ func TestUDPConnection(t *testing.T) { Listen: net.NewIPOrDomain(net.LocalHostIP), }), ProxySettings: serial.ToTypedMessage(&dokodemo.Config{ - Address: net.NewIPOrDomain(dest.Address), - Port: uint32(dest.Port), + Address: net.NewIPOrDomain(dest.Address), + Port: uint32(dest.Port), Networks: []net.Network{net.Network_UDP}, }), }, @@ -556,8 +556,8 @@ func TestDomainSniffing(t *testing.T) { }, }), ProxySettings: serial.ToTypedMessage(&dokodemo.Config{ - Address: net.NewIPOrDomain(net.LocalHostIP), - Port: 443, + Address: net.NewIPOrDomain(net.LocalHostIP), + Port: 443, Networks: []net.Network{net.Network_TCP}, }), }, diff --git a/testing/scenarios/policy_test.go b/testing/scenarios/policy_test.go index 1e8aafeaddca..773e6bcf50f1 100644 --- a/testing/scenarios/policy_test.go +++ b/testing/scenarios/policy_test.go @@ -110,8 +110,8 @@ func TestVMessClosing(t *testing.T) { Listen: net.NewIPOrDomain(net.LocalHostIP), }), ProxySettings: serial.ToTypedMessage(&dokodemo.Config{ - Address: net.NewIPOrDomain(dest.Address), - Port: uint32(dest.Port), + Address: net.NewIPOrDomain(dest.Address), + Port: uint32(dest.Port), Networks: []net.Network{net.Network_TCP}, }), }, @@ -214,8 +214,8 @@ func TestZeroBuffer(t *testing.T) { Listen: net.NewIPOrDomain(net.LocalHostIP), }), ProxySettings: serial.ToTypedMessage(&dokodemo.Config{ - Address: net.NewIPOrDomain(dest.Address), - Port: uint32(dest.Port), + Address: net.NewIPOrDomain(dest.Address), + Port: uint32(dest.Port), Networks: []net.Network{net.Network_TCP}, }), }, diff --git a/testing/scenarios/reverse_test.go b/testing/scenarios/reverse_test.go index faaa402efc05..197f6d1f3573 100644 --- a/testing/scenarios/reverse_test.go +++ b/testing/scenarios/reverse_test.go @@ -76,8 +76,8 @@ func TestReverseProxy(t *testing.T) { Listen: net.NewIPOrDomain(net.LocalHostIP), }), ProxySettings: serial.ToTypedMessage(&dokodemo.Config{ - Address: net.NewIPOrDomain(dest.Address), - Port: uint32(dest.Port), + Address: net.NewIPOrDomain(dest.Address), + Port: uint32(dest.Port), Networks: []net.Network{net.Network_TCP}, }), }, @@ -141,8 +141,8 @@ func TestReverseProxy(t *testing.T) { Listen: net.NewIPOrDomain(net.LocalHostIP), }), ProxySettings: serial.ToTypedMessage(&dokodemo.Config{ - Address: net.NewIPOrDomain(dest.Address), - Port: uint32(dest.Port), + Address: net.NewIPOrDomain(dest.Address), + Port: uint32(dest.Port), Networks: []net.Network{net.Network_TCP}, }), }, @@ -255,8 +255,8 @@ func TestReverseProxyLongRunning(t *testing.T) { Listen: net.NewIPOrDomain(net.LocalHostIP), }), ProxySettings: serial.ToTypedMessage(&dokodemo.Config{ - Address: net.NewIPOrDomain(dest.Address), - Port: uint32(dest.Port), + Address: net.NewIPOrDomain(dest.Address), + Port: uint32(dest.Port), Networks: []net.Network{net.Network_TCP}, }), }, @@ -334,8 +334,8 @@ func TestReverseProxyLongRunning(t *testing.T) { Listen: net.NewIPOrDomain(net.LocalHostIP), }), ProxySettings: serial.ToTypedMessage(&dokodemo.Config{ - Address: net.NewIPOrDomain(dest.Address), - Port: uint32(dest.Port), + Address: net.NewIPOrDomain(dest.Address), + Port: uint32(dest.Port), Networks: []net.Network{net.Network_TCP}, }), }, diff --git a/testing/scenarios/socks_test.go b/testing/scenarios/socks_test.go index 83ebebc35f5a..13e6f869c649 100644 --- a/testing/scenarios/socks_test.go +++ b/testing/scenarios/socks_test.go @@ -64,8 +64,8 @@ func TestSocksBridgeTCP(t *testing.T) { Listen: net.NewIPOrDomain(net.LocalHostIP), }), ProxySettings: serial.ToTypedMessage(&dokodemo.Config{ - Address: net.NewIPOrDomain(dest.Address), - Port: uint32(dest.Port), + Address: net.NewIPOrDomain(dest.Address), + Port: uint32(dest.Port), Networks: []net.Network{net.Network_TCP}, }), }, @@ -143,8 +143,8 @@ func TestSocksWithHttpRequest(t *testing.T) { Listen: net.NewIPOrDomain(net.LocalHostIP), }), ProxySettings: serial.ToTypedMessage(&dokodemo.Config{ - Address: net.NewIPOrDomain(dest.Address), - Port: uint32(dest.Port), + Address: net.NewIPOrDomain(dest.Address), + Port: uint32(dest.Port), Networks: []net.Network{net.Network_TCP}, }), }, @@ -213,8 +213,8 @@ func TestSocksBridageUDP(t *testing.T) { Listen: net.NewIPOrDomain(net.LocalHostIP), }), ProxySettings: serial.ToTypedMessage(&dokodemo.Config{ - Address: net.NewIPOrDomain(dest.Address), - Port: uint32(dest.Port), + Address: net.NewIPOrDomain(dest.Address), + Port: uint32(dest.Port), Networks: []net.Network{net.Network_UDP}, }), }, @@ -247,8 +247,8 @@ func TestSocksBridageUDP(t *testing.T) { Listen: net.NewIPOrDomain(net.LocalHostIP), }), ProxySettings: serial.ToTypedMessage(&dokodemo.Config{ - Address: net.NewIPOrDomain(dest.Address), - Port: uint32(dest.Port), + Address: net.NewIPOrDomain(dest.Address), + Port: uint32(dest.Port), Networks: []net.Network{net.Network_UDP}, }), }, @@ -328,8 +328,8 @@ func TestSocksBridageUDPWithRouting(t *testing.T) { Listen: net.NewIPOrDomain(net.LocalHostIP), }), ProxySettings: serial.ToTypedMessage(&dokodemo.Config{ - Address: net.NewIPOrDomain(dest.Address), - Port: uint32(dest.Port), + Address: net.NewIPOrDomain(dest.Address), + Port: uint32(dest.Port), Networks: []net.Network{net.Network_UDP}, }), }, @@ -366,8 +366,8 @@ func TestSocksBridageUDPWithRouting(t *testing.T) { Listen: net.NewIPOrDomain(net.LocalHostIP), }), ProxySettings: serial.ToTypedMessage(&dokodemo.Config{ - Address: net.NewIPOrDomain(dest.Address), - Port: uint32(dest.Port), + Address: net.NewIPOrDomain(dest.Address), + Port: uint32(dest.Port), Networks: []net.Network{net.Network_UDP}, }), }, diff --git a/testing/scenarios/tls_test.go b/testing/scenarios/tls_test.go index a8abccd77a24..4acb2d18f172 100644 --- a/testing/scenarios/tls_test.go +++ b/testing/scenarios/tls_test.go @@ -23,6 +23,7 @@ import ( "github.com/xtls/xray-core/testing/servers/udp" "github.com/xtls/xray-core/transport/internet" "github.com/xtls/xray-core/transport/internet/grpc" + "github.com/xtls/xray-core/transport/internet/http" "github.com/xtls/xray-core/transport/internet/tls" "github.com/xtls/xray-core/transport/internet/websocket" "golang.org/x/sync/errgroup" @@ -80,8 +81,8 @@ func TestSimpleTLSConnection(t *testing.T) { Listen: net.NewIPOrDomain(net.LocalHostIP), }), ProxySettings: serial.ToTypedMessage(&dokodemo.Config{ - Address: net.NewIPOrDomain(dest.Address), - Port: uint32(dest.Port), + Address: net.NewIPOrDomain(dest.Address), + Port: uint32(dest.Port), Networks: []net.Network{net.Network_TCP}, }), }, @@ -195,8 +196,8 @@ func TestAutoIssuingCertificate(t *testing.T) { Listen: net.NewIPOrDomain(net.LocalHostIP), }), ProxySettings: serial.ToTypedMessage(&dokodemo.Config{ - Address: net.NewIPOrDomain(dest.Address), - Port: uint32(dest.Port), + Address: net.NewIPOrDomain(dest.Address), + Port: uint32(dest.Port), Networks: []net.Network{net.Network_TCP}, }), }, @@ -264,7 +265,7 @@ func TestTLSOverKCP(t *testing.T) { PortList: &net.PortList{Range: []*net.PortRange{net.SinglePortRange(serverPort)}}, Listen: net.NewIPOrDomain(net.LocalHostIP), StreamSettings: &internet.StreamConfig{ - ProtocolName: "mkcp", + Protocol: internet.TransportProtocol_MKCP, SecurityType: serial.GetMessageType(&tls.Config{}), SecuritySettings: []*serial.TypedMessage{ serial.ToTypedMessage(&tls.Config{ @@ -300,8 +301,8 @@ func TestTLSOverKCP(t *testing.T) { Listen: net.NewIPOrDomain(net.LocalHostIP), }), ProxySettings: serial.ToTypedMessage(&dokodemo.Config{ - Address: net.NewIPOrDomain(dest.Address), - Port: uint32(dest.Port), + Address: net.NewIPOrDomain(dest.Address), + Port: uint32(dest.Port), Networks: []net.Network{net.Network_TCP}, }), }, @@ -325,7 +326,7 @@ func TestTLSOverKCP(t *testing.T) { }), SenderSettings: serial.ToTypedMessage(&proxyman.SenderConfig{ StreamSettings: &internet.StreamConfig{ - ProtocolName: "mkcp", + Protocol: internet.TransportProtocol_MKCP, SecurityType: serial.GetMessageType(&tls.Config{}), SecuritySettings: []*serial.TypedMessage{ serial.ToTypedMessage(&tls.Config{ @@ -364,7 +365,7 @@ func TestTLSOverWebSocket(t *testing.T) { PortList: &net.PortList{Range: []*net.PortRange{net.SinglePortRange(serverPort)}}, Listen: net.NewIPOrDomain(net.LocalHostIP), StreamSettings: &internet.StreamConfig{ - ProtocolName: "websocket", + Protocol: internet.TransportProtocol_WebSocket, SecurityType: serial.GetMessageType(&tls.Config{}), SecuritySettings: []*serial.TypedMessage{ serial.ToTypedMessage(&tls.Config{ @@ -400,8 +401,8 @@ func TestTLSOverWebSocket(t *testing.T) { Listen: net.NewIPOrDomain(net.LocalHostIP), }), ProxySettings: serial.ToTypedMessage(&dokodemo.Config{ - Address: net.NewIPOrDomain(dest.Address), - Port: uint32(dest.Port), + Address: net.NewIPOrDomain(dest.Address), + Port: uint32(dest.Port), Networks: []net.Network{net.Network_TCP}, }), }, @@ -425,11 +426,11 @@ func TestTLSOverWebSocket(t *testing.T) { }), SenderSettings: serial.ToTypedMessage(&proxyman.SenderConfig{ StreamSettings: &internet.StreamConfig{ - ProtocolName: "websocket", + Protocol: internet.TransportProtocol_WebSocket, TransportSettings: []*internet.TransportConfig{ { - ProtocolName: "websocket", - Settings: serial.ToTypedMessage(&websocket.Config{}), + Protocol: internet.TransportProtocol_WebSocket, + Settings: serial.ToTypedMessage(&websocket.Config{}), }, }, SecurityType: serial.GetMessageType(&tls.Config{}), @@ -457,6 +458,128 @@ func TestTLSOverWebSocket(t *testing.T) { } } +func TestHTTP2(t *testing.T) { + tcpServer := tcp.Server{ + MsgProcessor: xor, + } + dest, err := tcpServer.Start() + common.Must(err) + defer tcpServer.Close() + + userID := protocol.NewID(uuid.New()) + serverPort := tcp.PickPort() + serverConfig := &core.Config{ + Inbound: []*core.InboundHandlerConfig{ + { + ReceiverSettings: serial.ToTypedMessage(&proxyman.ReceiverConfig{ + PortList: &net.PortList{Range: []*net.PortRange{net.SinglePortRange(serverPort)}}, + Listen: net.NewIPOrDomain(net.LocalHostIP), + StreamSettings: &internet.StreamConfig{ + Protocol: internet.TransportProtocol_HTTP, + TransportSettings: []*internet.TransportConfig{ + { + Protocol: internet.TransportProtocol_HTTP, + Settings: serial.ToTypedMessage(&http.Config{ + Host: []string{"example.com"}, + Path: "/testpath", + }), + }, + }, + SecurityType: serial.GetMessageType(&tls.Config{}), + SecuritySettings: []*serial.TypedMessage{ + serial.ToTypedMessage(&tls.Config{ + Certificate: []*tls.Certificate{tls.ParseCertificate(cert.MustGenerate(nil))}, + }), + }, + }, + }), + ProxySettings: serial.ToTypedMessage(&inbound.Config{ + User: []*protocol.User{ + { + Account: serial.ToTypedMessage(&vmess.Account{ + Id: userID.String(), + }), + }, + }, + }), + }, + }, + Outbound: []*core.OutboundHandlerConfig{ + { + ProxySettings: serial.ToTypedMessage(&freedom.Config{}), + }, + }, + } + + clientPort := tcp.PickPort() + clientConfig := &core.Config{ + Inbound: []*core.InboundHandlerConfig{ + { + ReceiverSettings: serial.ToTypedMessage(&proxyman.ReceiverConfig{ + PortList: &net.PortList{Range: []*net.PortRange{net.SinglePortRange(clientPort)}}, + Listen: net.NewIPOrDomain(net.LocalHostIP), + }), + ProxySettings: serial.ToTypedMessage(&dokodemo.Config{ + Address: net.NewIPOrDomain(dest.Address), + Port: uint32(dest.Port), + Networks: []net.Network{net.Network_TCP}, + }), + }, + }, + Outbound: []*core.OutboundHandlerConfig{ + { + ProxySettings: serial.ToTypedMessage(&outbound.Config{ + Receiver: []*protocol.ServerEndpoint{ + { + Address: net.NewIPOrDomain(net.LocalHostIP), + Port: uint32(serverPort), + User: []*protocol.User{ + { + Account: serial.ToTypedMessage(&vmess.Account{ + Id: userID.String(), + }), + }, + }, + }, + }, + }), + SenderSettings: serial.ToTypedMessage(&proxyman.SenderConfig{ + StreamSettings: &internet.StreamConfig{ + Protocol: internet.TransportProtocol_HTTP, + TransportSettings: []*internet.TransportConfig{ + { + Protocol: internet.TransportProtocol_HTTP, + Settings: serial.ToTypedMessage(&http.Config{ + Host: []string{"example.com"}, + Path: "/testpath", + }), + }, + }, + SecurityType: serial.GetMessageType(&tls.Config{}), + SecuritySettings: []*serial.TypedMessage{ + serial.ToTypedMessage(&tls.Config{ + AllowInsecure: true, + }), + }, + }, + }), + }, + }, + } + + servers, err := InitializeServerConfigs(serverConfig, clientConfig) + common.Must(err) + defer CloseAllServers(servers) + + var errg errgroup.Group + for i := 0; i < 10; i++ { + errg.Go(testTCPConn(clientPort, 1024*1024, time.Second*40)) + } + if err := errg.Wait(); err != nil { + t.Error(err) + } +} + func TestGRPC(t *testing.T) { tcpServer := tcp.Server{ MsgProcessor: xor, @@ -516,8 +639,8 @@ func TestGRPC(t *testing.T) { Listen: net.NewIPOrDomain(net.LocalHostIP), }), ProxySettings: serial.ToTypedMessage(&dokodemo.Config{ - Address: net.NewIPOrDomain(dest.Address), - Port: uint32(dest.Port), + Address: net.NewIPOrDomain(dest.Address), + Port: uint32(dest.Port), Networks: []net.Network{net.Network_TCP}, }), }, @@ -632,8 +755,8 @@ func TestGRPCMultiMode(t *testing.T) { Listen: net.NewIPOrDomain(net.LocalHostIP), }), ProxySettings: serial.ToTypedMessage(&dokodemo.Config{ - Address: net.NewIPOrDomain(dest.Address), - Port: uint32(dest.Port), + Address: net.NewIPOrDomain(dest.Address), + Port: uint32(dest.Port), Networks: []net.Network{net.Network_TCP}, }), }, @@ -743,8 +866,8 @@ func TestSimpleTLSConnectionPinned(t *testing.T) { Listen: net.NewIPOrDomain(net.LocalHostIP), }), ProxySettings: serial.ToTypedMessage(&dokodemo.Config{ - Address: net.NewIPOrDomain(dest.Address), - Port: uint32(dest.Port), + Address: net.NewIPOrDomain(dest.Address), + Port: uint32(dest.Port), Networks: []net.Network{net.Network_TCP}, }), }, @@ -845,8 +968,8 @@ func TestSimpleTLSConnectionPinnedWrongCert(t *testing.T) { Listen: net.NewIPOrDomain(net.LocalHostIP), }), ProxySettings: serial.ToTypedMessage(&dokodemo.Config{ - Address: net.NewIPOrDomain(dest.Address), - Port: uint32(dest.Port), + Address: net.NewIPOrDomain(dest.Address), + Port: uint32(dest.Port), Networks: []net.Network{net.Network_TCP}, }), }, @@ -946,8 +1069,8 @@ func TestUTLSConnectionPinned(t *testing.T) { Listen: net.NewIPOrDomain(net.LocalHostIP), }), ProxySettings: serial.ToTypedMessage(&dokodemo.Config{ - Address: net.NewIPOrDomain(dest.Address), - Port: uint32(dest.Port), + Address: net.NewIPOrDomain(dest.Address), + Port: uint32(dest.Port), Networks: []net.Network{net.Network_TCP}, }), }, @@ -1049,8 +1172,8 @@ func TestUTLSConnectionPinnedWrongCert(t *testing.T) { Listen: net.NewIPOrDomain(net.LocalHostIP), }), ProxySettings: serial.ToTypedMessage(&dokodemo.Config{ - Address: net.NewIPOrDomain(dest.Address), - Port: uint32(dest.Port), + Address: net.NewIPOrDomain(dest.Address), + Port: uint32(dest.Port), Networks: []net.Network{net.Network_TCP}, }), }, diff --git a/testing/scenarios/transport_test.go b/testing/scenarios/transport_test.go index bb16deee6388..15648ed7575e 100644 --- a/testing/scenarios/transport_test.go +++ b/testing/scenarios/transport_test.go @@ -41,7 +41,7 @@ func TestHTTPConnectionHeader(t *testing.T) { StreamSettings: &internet.StreamConfig{ TransportSettings: []*internet.TransportConfig{ { - ProtocolName: "tcp", + Protocol: internet.TransportProtocol_TCP, Settings: serial.ToTypedMessage(&tcptransport.Config{ HeaderSettings: serial.ToTypedMessage(&http.Config{}), }), @@ -76,8 +76,8 @@ func TestHTTPConnectionHeader(t *testing.T) { Listen: net.NewIPOrDomain(net.LocalHostIP), }), ProxySettings: serial.ToTypedMessage(&dokodemo.Config{ - Address: net.NewIPOrDomain(dest.Address), - Port: uint32(dest.Port), + Address: net.NewIPOrDomain(dest.Address), + Port: uint32(dest.Port), Networks: []net.Network{net.Network_TCP}, }), }, @@ -103,7 +103,7 @@ func TestHTTPConnectionHeader(t *testing.T) { StreamSettings: &internet.StreamConfig{ TransportSettings: []*internet.TransportConfig{ { - ProtocolName: "tcp", + Protocol: internet.TransportProtocol_TCP, Settings: serial.ToTypedMessage(&tcptransport.Config{ HeaderSettings: serial.ToTypedMessage(&http.Config{}), }), diff --git a/testing/scenarios/vless_test.go b/testing/scenarios/vless_test.go index dcac17ea5374..f4cf58f107c8 100644 --- a/testing/scenarios/vless_test.go +++ b/testing/scenarios/vless_test.go @@ -85,8 +85,8 @@ func TestVless(t *testing.T) { Listen: net.NewIPOrDomain(net.LocalHostIP), }), ProxySettings: serial.ToTypedMessage(&dokodemo.Config{ - Address: net.NewIPOrDomain(dest.Address), - Port: uint32(dest.Port), + Address: net.NewIPOrDomain(dest.Address), + Port: uint32(dest.Port), Networks: []net.Network{net.Network_TCP}, }), }, @@ -148,7 +148,7 @@ func TestVlessTls(t *testing.T) { PortList: &net.PortList{Range: []*net.PortRange{net.SinglePortRange(serverPort)}}, Listen: net.NewIPOrDomain(net.LocalHostIP), StreamSettings: &internet.StreamConfig{ - ProtocolName: "tcp", + Protocol: internet.TransportProtocol_TCP, SecurityType: serial.GetMessageType(&tls.Config{}), SecuritySettings: []*serial.TypedMessage{ serial.ToTypedMessage(&tls.Config{ @@ -190,8 +190,8 @@ func TestVlessTls(t *testing.T) { Listen: net.NewIPOrDomain(net.LocalHostIP), }), ProxySettings: serial.ToTypedMessage(&dokodemo.Config{ - Address: net.NewIPOrDomain(dest.Address), - Port: uint32(dest.Port), + Address: net.NewIPOrDomain(dest.Address), + Port: uint32(dest.Port), Networks: []net.Network{net.Network_TCP}, }), }, @@ -215,11 +215,11 @@ func TestVlessTls(t *testing.T) { }), SenderSettings: serial.ToTypedMessage(&proxyman.SenderConfig{ StreamSettings: &internet.StreamConfig{ - ProtocolName: "tcp", + Protocol: internet.TransportProtocol_TCP, TransportSettings: []*internet.TransportConfig{ { - ProtocolName: "tcp", - Settings: serial.ToTypedMessage(&transtcp.Config{}), + Protocol: internet.TransportProtocol_TCP, + Settings: serial.ToTypedMessage(&transtcp.Config{}), }, }, SecurityType: serial.GetMessageType(&tls.Config{}), @@ -270,7 +270,7 @@ func TestVlessXtlsVision(t *testing.T) { PortList: &net.PortList{Range: []*net.PortRange{net.SinglePortRange(serverPort)}}, Listen: net.NewIPOrDomain(net.LocalHostIP), StreamSettings: &internet.StreamConfig{ - ProtocolName: "tcp", + Protocol: internet.TransportProtocol_TCP, SecurityType: serial.GetMessageType(&tls.Config{}), SecuritySettings: []*serial.TypedMessage{ serial.ToTypedMessage(&tls.Config{ @@ -313,8 +313,8 @@ func TestVlessXtlsVision(t *testing.T) { Listen: net.NewIPOrDomain(net.LocalHostIP), }), ProxySettings: serial.ToTypedMessage(&dokodemo.Config{ - Address: net.NewIPOrDomain(dest.Address), - Port: uint32(dest.Port), + Address: net.NewIPOrDomain(dest.Address), + Port: uint32(dest.Port), Networks: []net.Network{net.Network_TCP}, }), }, @@ -339,11 +339,11 @@ func TestVlessXtlsVision(t *testing.T) { }), SenderSettings: serial.ToTypedMessage(&proxyman.SenderConfig{ StreamSettings: &internet.StreamConfig{ - ProtocolName: "tcp", + Protocol: internet.TransportProtocol_TCP, TransportSettings: []*internet.TransportConfig{ { - ProtocolName: "tcp", - Settings: serial.ToTypedMessage(&transtcp.Config{}), + Protocol: internet.TransportProtocol_TCP, + Settings: serial.ToTypedMessage(&transtcp.Config{}), }, }, SecurityType: serial.GetMessageType(&tls.Config{}), @@ -399,16 +399,16 @@ func TestVlessXtlsVisionReality(t *testing.T) { PortList: &net.PortList{Range: []*net.PortRange{net.SinglePortRange(serverPort)}}, Listen: net.NewIPOrDomain(net.LocalHostIP), StreamSettings: &internet.StreamConfig{ - ProtocolName: "tcp", + Protocol: internet.TransportProtocol_TCP, SecurityType: serial.GetMessageType(&reality.Config{}), SecuritySettings: []*serial.TypedMessage{ serial.ToTypedMessage(&reality.Config{ - Show: true, - Dest: "www.google.com:443", // use google for now, may fail in some region + Show: true, + Dest: "www.google.com:443", // use google for now, may fail in some region ServerNames: []string{"www.google.com"}, - PrivateKey: privateKey, - ShortIds: shortIds, - Type: "tcp", + PrivateKey: privateKey, + ShortIds: shortIds, + Type: "tcp", }), }, }, @@ -447,8 +447,8 @@ func TestVlessXtlsVisionReality(t *testing.T) { Listen: net.NewIPOrDomain(net.LocalHostIP), }), ProxySettings: serial.ToTypedMessage(&dokodemo.Config{ - Address: net.NewIPOrDomain(dest.Address), - Port: uint32(dest.Port), + Address: net.NewIPOrDomain(dest.Address), + Port: uint32(dest.Port), Networks: []net.Network{net.Network_TCP}, }), }, @@ -473,22 +473,22 @@ func TestVlessXtlsVisionReality(t *testing.T) { }), SenderSettings: serial.ToTypedMessage(&proxyman.SenderConfig{ StreamSettings: &internet.StreamConfig{ - ProtocolName: "tcp", + Protocol: internet.TransportProtocol_TCP, TransportSettings: []*internet.TransportConfig{ { - ProtocolName: "tcp", - Settings: serial.ToTypedMessage(&transtcp.Config{}), + Protocol: internet.TransportProtocol_TCP, + Settings: serial.ToTypedMessage(&transtcp.Config{}), }, }, SecurityType: serial.GetMessageType(&reality.Config{}), SecuritySettings: []*serial.TypedMessage{ serial.ToTypedMessage(&reality.Config{ - Show: true, + Show: true, Fingerprint: "chrome", - ServerName: "www.google.com", - PublicKey: publicKey, - ShortId: shortIds[0], - SpiderX: "/", + ServerName: "www.google.com", + PublicKey: publicKey, + ShortId: shortIds[0], + SpiderX: "/", }), }, }, diff --git a/testing/scenarios/vmess_test.go b/testing/scenarios/vmess_test.go index dbffe0d60b22..07235b2c9f31 100644 --- a/testing/scenarios/vmess_test.go +++ b/testing/scenarios/vmess_test.go @@ -71,8 +71,8 @@ func TestVMessDynamicPort(t *testing.T) { Listen: net.NewIPOrDomain(net.LocalHostIP), }), ProxySettings: serial.ToTypedMessage(&dokodemo.Config{ - Address: net.NewIPOrDomain(dest.Address), - Port: uint32(dest.Port), + Address: net.NewIPOrDomain(dest.Address), + Port: uint32(dest.Port), Networks: []net.Network{net.Network_TCP}, }), }, @@ -131,8 +131,8 @@ func TestVMessDynamicPort(t *testing.T) { Listen: net.NewIPOrDomain(net.LocalHostIP), }), ProxySettings: serial.ToTypedMessage(&dokodemo.Config{ - Address: net.NewIPOrDomain(dest.Address), - Port: uint32(dest.Port), + Address: net.NewIPOrDomain(dest.Address), + Port: uint32(dest.Port), Networks: []net.Network{net.Network_TCP}, }), }, @@ -223,8 +223,8 @@ func TestVMessGCM(t *testing.T) { Listen: net.NewIPOrDomain(net.LocalHostIP), }), ProxySettings: serial.ToTypedMessage(&dokodemo.Config{ - Address: net.NewIPOrDomain(dest.Address), - Port: uint32(dest.Port), + Address: net.NewIPOrDomain(dest.Address), + Port: uint32(dest.Port), Networks: []net.Network{net.Network_TCP}, }), }, @@ -325,8 +325,8 @@ func TestVMessGCMReadv(t *testing.T) { Listen: net.NewIPOrDomain(net.LocalHostIP), }), ProxySettings: serial.ToTypedMessage(&dokodemo.Config{ - Address: net.NewIPOrDomain(dest.Address), - Port: uint32(dest.Port), + Address: net.NewIPOrDomain(dest.Address), + Port: uint32(dest.Port), Networks: []net.Network{net.Network_TCP}, }), }, @@ -430,8 +430,8 @@ func TestVMessGCMUDP(t *testing.T) { Listen: net.NewIPOrDomain(net.LocalHostIP), }), ProxySettings: serial.ToTypedMessage(&dokodemo.Config{ - Address: net.NewIPOrDomain(dest.Address), - Port: uint32(dest.Port), + Address: net.NewIPOrDomain(dest.Address), + Port: uint32(dest.Port), Networks: []net.Network{net.Network_UDP}, }), }, @@ -529,8 +529,8 @@ func TestVMessChacha20(t *testing.T) { Listen: net.NewIPOrDomain(net.LocalHostIP), }), ProxySettings: serial.ToTypedMessage(&dokodemo.Config{ - Address: net.NewIPOrDomain(dest.Address), - Port: uint32(dest.Port), + Address: net.NewIPOrDomain(dest.Address), + Port: uint32(dest.Port), Networks: []net.Network{net.Network_TCP}, }), }, @@ -629,8 +629,8 @@ func TestVMessNone(t *testing.T) { Listen: net.NewIPOrDomain(net.LocalHostIP), }), ProxySettings: serial.ToTypedMessage(&dokodemo.Config{ - Address: net.NewIPOrDomain(dest.Address), - Port: uint32(dest.Port), + Address: net.NewIPOrDomain(dest.Address), + Port: uint32(dest.Port), Networks: []net.Network{net.Network_TCP}, }), }, @@ -695,7 +695,7 @@ func TestVMessKCP(t *testing.T) { PortList: &net.PortList{Range: []*net.PortRange{net.SinglePortRange(serverPort)}}, Listen: net.NewIPOrDomain(net.LocalHostIP), StreamSettings: &internet.StreamConfig{ - ProtocolName: "mkcp", + Protocol: internet.TransportProtocol_MKCP, }, }), ProxySettings: serial.ToTypedMessage(&inbound.Config{ @@ -731,8 +731,8 @@ func TestVMessKCP(t *testing.T) { Listen: net.NewIPOrDomain(net.LocalHostIP), }), ProxySettings: serial.ToTypedMessage(&dokodemo.Config{ - Address: net.NewIPOrDomain(dest.Address), - Port: uint32(dest.Port), + Address: net.NewIPOrDomain(dest.Address), + Port: uint32(dest.Port), Networks: []net.Network{net.Network_TCP}, }), }, @@ -759,7 +759,7 @@ func TestVMessKCP(t *testing.T) { }), SenderSettings: serial.ToTypedMessage(&proxyman.SenderConfig{ StreamSettings: &internet.StreamConfig{ - ProtocolName: "mkcp", + Protocol: internet.TransportProtocol_MKCP, }, }), }, @@ -802,10 +802,10 @@ func TestVMessKCPLarge(t *testing.T) { PortList: &net.PortList{Range: []*net.PortRange{net.SinglePortRange(serverPort)}}, Listen: net.NewIPOrDomain(net.LocalHostIP), StreamSettings: &internet.StreamConfig{ - ProtocolName: "mkcp", + Protocol: internet.TransportProtocol_MKCP, TransportSettings: []*internet.TransportConfig{ { - ProtocolName: "mkcp", + Protocol: internet.TransportProtocol_MKCP, Settings: serial.ToTypedMessage(&kcp.Config{ ReadBuffer: &kcp.ReadBuffer{ Size: 512 * 1024, @@ -857,8 +857,8 @@ func TestVMessKCPLarge(t *testing.T) { Listen: net.NewIPOrDomain(net.LocalHostIP), }), ProxySettings: serial.ToTypedMessage(&dokodemo.Config{ - Address: net.NewIPOrDomain(dest.Address), - Port: uint32(dest.Port), + Address: net.NewIPOrDomain(dest.Address), + Port: uint32(dest.Port), Networks: []net.Network{net.Network_TCP}, }), }, @@ -885,10 +885,10 @@ func TestVMessKCPLarge(t *testing.T) { }), SenderSettings: serial.ToTypedMessage(&proxyman.SenderConfig{ StreamSettings: &internet.StreamConfig{ - ProtocolName: "mkcp", + Protocol: internet.TransportProtocol_MKCP, TransportSettings: []*internet.TransportConfig{ { - ProtocolName: "mkcp", + Protocol: internet.TransportProtocol_MKCP, Settings: serial.ToTypedMessage(&kcp.Config{ ReadBuffer: &kcp.ReadBuffer{ Size: 512 * 1024, @@ -984,8 +984,8 @@ func TestVMessGCMMux(t *testing.T) { Listen: net.NewIPOrDomain(net.LocalHostIP), }), ProxySettings: serial.ToTypedMessage(&dokodemo.Config{ - Address: net.NewIPOrDomain(dest.Address), - Port: uint32(dest.Port), + Address: net.NewIPOrDomain(dest.Address), + Port: uint32(dest.Port), Networks: []net.Network{net.Network_TCP}, }), }, @@ -1100,8 +1100,8 @@ func TestVMessGCMMuxUDP(t *testing.T) { Listen: net.NewIPOrDomain(net.LocalHostIP), }), ProxySettings: serial.ToTypedMessage(&dokodemo.Config{ - Address: net.NewIPOrDomain(dest.Address), - Port: uint32(dest.Port), + Address: net.NewIPOrDomain(dest.Address), + Port: uint32(dest.Port), Networks: []net.Network{net.Network_TCP}, }), }, @@ -1111,8 +1111,8 @@ func TestVMessGCMMuxUDP(t *testing.T) { Listen: net.NewIPOrDomain(net.LocalHostIP), }), ProxySettings: serial.ToTypedMessage(&dokodemo.Config{ - Address: net.NewIPOrDomain(udpDest.Address), - Port: uint32(udpDest.Port), + Address: net.NewIPOrDomain(udpDest.Address), + Port: uint32(udpDest.Port), Networks: []net.Network{net.Network_UDP}, }), }, @@ -1224,8 +1224,8 @@ func TestVMessZero(t *testing.T) { Listen: net.NewIPOrDomain(net.LocalHostIP), }), ProxySettings: serial.ToTypedMessage(&dokodemo.Config{ - Address: net.NewIPOrDomain(dest.Address), - Port: uint32(dest.Port), + Address: net.NewIPOrDomain(dest.Address), + Port: uint32(dest.Port), Networks: []net.Network{net.Network_TCP}, }), }, @@ -1323,8 +1323,8 @@ func TestVMessGCMLengthAuth(t *testing.T) { Listen: net.NewIPOrDomain(net.LocalHostIP), }), ProxySettings: serial.ToTypedMessage(&dokodemo.Config{ - Address: net.NewIPOrDomain(dest.Address), - Port: uint32(dest.Port), + Address: net.NewIPOrDomain(dest.Address), + Port: uint32(dest.Port), Networks: []net.Network{net.Network_TCP}, }), }, @@ -1427,8 +1427,8 @@ func TestVMessGCMLengthAuthPlusNoTerminationSignal(t *testing.T) { Listen: net.NewIPOrDomain(net.LocalHostIP), }), ProxySettings: serial.ToTypedMessage(&dokodemo.Config{ - Address: net.NewIPOrDomain(dest.Address), - Port: uint32(dest.Port), + Address: net.NewIPOrDomain(dest.Address), + Port: uint32(dest.Port), Networks: []net.Network{net.Network_TCP}, }), }, diff --git a/testing/scenarios/wireguard_test.go b/testing/scenarios/wireguard_test.go index deaee114ce7a..0609ec776f82 100644 --- a/testing/scenarios/wireguard_test.go +++ b/testing/scenarios/wireguard_test.go @@ -48,13 +48,13 @@ func TestWireguard(t *testing.T) { Listen: net.NewIPOrDomain(net.LocalHostIP), }), ProxySettings: serial.ToTypedMessage(&wireguard.DeviceConfig{ - IsClient: false, - NoKernelTun: false, - Endpoint: []string{"10.0.0.1"}, - Mtu: 1420, - SecretKey: serverPrivate, + IsClient: false, + KernelMode: false, + Endpoint: []string{"10.0.0.1"}, + Mtu: 1420, + SecretKey: serverPrivate, Peers: []*wireguard.PeerConfig{{ - PublicKey: serverPublic, + PublicKey: serverPublic, AllowedIps: []string{"0.0.0.0/0", "::0/0"}, }}, }), @@ -82,8 +82,8 @@ func TestWireguard(t *testing.T) { Listen: net.NewIPOrDomain(net.LocalHostIP), }), ProxySettings: serial.ToTypedMessage(&dokodemo.Config{ - Address: net.NewIPOrDomain(dest.Address), - Port: uint32(dest.Port), + Address: net.NewIPOrDomain(dest.Address), + Port: uint32(dest.Port), Networks: []net.Network{net.Network_TCP}, }), }, @@ -91,14 +91,14 @@ func TestWireguard(t *testing.T) { Outbound: []*core.OutboundHandlerConfig{ { ProxySettings: serial.ToTypedMessage(&wireguard.DeviceConfig{ - IsClient: true, - NoKernelTun: false, - Endpoint: []string{"10.0.0.2"}, - Mtu: 1420, - SecretKey: clientPrivate, + IsClient: true, + KernelMode: false, + Endpoint: []string{"10.0.0.2"}, + Mtu: 1420, + SecretKey: clientPrivate, Peers: []*wireguard.PeerConfig{{ - Endpoint: "127.0.0.1:" + serverPort.String(), - PublicKey: clientPublic, + Endpoint: "127.0.0.1:" + serverPort.String(), + PublicKey: clientPublic, AllowedIps: []string{"0.0.0.0/0", "::0/0"}, }}, }), @@ -119,4 +119,4 @@ func TestWireguard(t *testing.T) { // if err := errg.Wait(); err != nil { // t.Error(err) // } -} +} \ No newline at end of file diff --git a/transport/internet/tls/config.proto b/transport/internet/tls/config.proto index 326e945cf55f..0a84118e16dd 100644 --- a/transport/internet/tls/config.proto +++ b/transport/internet/tls/config.proto @@ -64,10 +64,6 @@ message Config { // Specify cipher suites, except for TLS 1.3. string cipher_suites = 9; - // Whether the server selects its most preferred ciphersuite. - // Deprecated: crypto/tls has ignored this field. - bool prefer_server_cipher_suites = 10 [deprecated = true]; - // TLS Client Hello fingerprint (uTLS). string fingerprint = 11;