mirror of
https://github.com/XTLS/Xray-core.git
synced 2026-07-02 09:48:43 +00:00
DNS outbound: Replace "reject" with "return" (rCode is 0 by default) (#6214)
https://github.com/XTLS/Xray-core/pull/6214#issuecomment-4587988752 Example: https://github.com/XTLS/Xray-core/pull/6214#issue-4553786283 --------- Co-authored-by: Meo597 <197331664+Meo597@users.noreply.github.com>
This commit is contained in:
+20
-11
@@ -28,7 +28,7 @@ type RuleAction int32
|
||||
const (
|
||||
RuleAction_Direct RuleAction = 0
|
||||
RuleAction_Drop RuleAction = 1
|
||||
RuleAction_Reject RuleAction = 2
|
||||
RuleAction_Return RuleAction = 2
|
||||
RuleAction_Hijack RuleAction = 3
|
||||
)
|
||||
|
||||
@@ -37,13 +37,13 @@ var (
|
||||
RuleAction_name = map[int32]string{
|
||||
0: "Direct",
|
||||
1: "Drop",
|
||||
2: "Reject",
|
||||
2: "Return",
|
||||
3: "Hijack",
|
||||
}
|
||||
RuleAction_value = map[string]int32{
|
||||
"Direct": 0,
|
||||
"Drop": 1,
|
||||
"Reject": 2,
|
||||
"Return": 2,
|
||||
"Hijack": 3,
|
||||
}
|
||||
)
|
||||
@@ -78,8 +78,9 @@ func (RuleAction) EnumDescriptor() ([]byte, []int) {
|
||||
type DNSRuleConfig struct {
|
||||
state protoimpl.MessageState `protogen:"open.v1"`
|
||||
Action RuleAction `protobuf:"varint,1,opt,name=action,proto3,enum=xray.proxy.dns.RuleAction" json:"action,omitempty"`
|
||||
Qtype []int32 `protobuf:"varint,2,rep,packed,name=qtype,proto3" json:"qtype,omitempty"`
|
||||
QType []int32 `protobuf:"varint,2,rep,packed,name=q_type,json=qType,proto3" json:"q_type,omitempty"`
|
||||
Domain []*geodata.DomainRule `protobuf:"bytes,3,rep,name=domain,proto3" json:"domain,omitempty"`
|
||||
RCode uint32 `protobuf:"varint,4,opt,name=r_code,json=rCode,proto3" json:"r_code,omitempty"`
|
||||
unknownFields protoimpl.UnknownFields
|
||||
sizeCache protoimpl.SizeCache
|
||||
}
|
||||
@@ -121,9 +122,9 @@ func (x *DNSRuleConfig) GetAction() RuleAction {
|
||||
return RuleAction_Direct
|
||||
}
|
||||
|
||||
func (x *DNSRuleConfig) GetQtype() []int32 {
|
||||
func (x *DNSRuleConfig) GetQType() []int32 {
|
||||
if x != nil {
|
||||
return x.Qtype
|
||||
return x.QType
|
||||
}
|
||||
return nil
|
||||
}
|
||||
@@ -135,6 +136,13 @@ func (x *DNSRuleConfig) GetDomain() []*geodata.DomainRule {
|
||||
return nil
|
||||
}
|
||||
|
||||
func (x *DNSRuleConfig) GetRCode() uint32 {
|
||||
if x != nil {
|
||||
return x.RCode
|
||||
}
|
||||
return 0
|
||||
}
|
||||
|
||||
type Config struct {
|
||||
state protoimpl.MessageState `protogen:"open.v1"`
|
||||
UserLevel uint32 `protobuf:"varint,1,opt,name=user_level,json=userLevel,proto3" json:"user_level,omitempty"`
|
||||
@@ -199,11 +207,12 @@ var File_proxy_dns_config_proto protoreflect.FileDescriptor
|
||||
|
||||
const file_proxy_dns_config_proto_rawDesc = "" +
|
||||
"\n" +
|
||||
"\x16proxy/dns/config.proto\x12\x0exray.proxy.dns\x1a\x1ccommon/net/destination.proto\x1a\x1bcommon/geodata/geodat.proto\"\x92\x01\n" +
|
||||
"\x16proxy/dns/config.proto\x12\x0exray.proxy.dns\x1a\x1ccommon/net/destination.proto\x1a\x1bcommon/geodata/geodat.proto\"\xaa\x01\n" +
|
||||
"\rDNSRuleConfig\x122\n" +
|
||||
"\x06action\x18\x01 \x01(\x0e2\x1a.xray.proxy.dns.RuleActionR\x06action\x12\x14\n" +
|
||||
"\x05qtype\x18\x02 \x03(\x05R\x05qtype\x127\n" +
|
||||
"\x06domain\x18\x03 \x03(\v2\x1f.xray.common.geodata.DomainRuleR\x06domain\"\x9c\x01\n" +
|
||||
"\x06action\x18\x01 \x01(\x0e2\x1a.xray.proxy.dns.RuleActionR\x06action\x12\x15\n" +
|
||||
"\x06q_type\x18\x02 \x03(\x05R\x05qType\x127\n" +
|
||||
"\x06domain\x18\x03 \x03(\v2\x1f.xray.common.geodata.DomainRuleR\x06domain\x12\x15\n" +
|
||||
"\x06r_code\x18\x04 \x01(\rR\x05rCode\"\x9c\x01\n" +
|
||||
"\x06Config\x12\x1d\n" +
|
||||
"\n" +
|
||||
"user_level\x18\x01 \x01(\rR\tuserLevel\x121\n" +
|
||||
@@ -215,7 +224,7 @@ const file_proxy_dns_config_proto_rawDesc = "" +
|
||||
"\x06Direct\x10\x00\x12\b\n" +
|
||||
"\x04Drop\x10\x01\x12\n" +
|
||||
"\n" +
|
||||
"\x06Reject\x10\x02\x12\n" +
|
||||
"\x06Return\x10\x02\x12\n" +
|
||||
"\n" +
|
||||
"\x06Hijack\x10\x03BL\n" +
|
||||
"\x12com.xray.proxy.dnsP\x01Z#github.com/xtls/xray-core/proxy/dns\xaa\x02\x0eXray.Proxy.Dnsb\x06proto3"
|
||||
|
||||
Reference in New Issue
Block a user