Xray-core icon indicating copy to clipboard operation
Xray-core copied to clipboard

DNS hosts: Support return RCode

Open j2rong4cn opened this issue 7 months ago • 13 comments

返回指定RCode: https://www.iana.org/assignments/dns-parameters/dns-parameters.xhtml#dns-parameters-6 示例:

{
  "dns": {
    "hosts": {
      "geosite:category-ads-all": "#3"
    }
  }
}

j2rong4cn avatar May 01 '25 02:05 j2rong4cn

@j2rong4cn

when rcode=0, instead of RCodeError(0) it should return dns.EmptyResponse

and in other cases you should return:

errors.New("returning nil for domain ", domain).Base(err) instead of err.

patterniha avatar May 01 '25 03:05 patterniha

change "dns.go" instead to cover "errors.New("returning nil for domain ", domain).Base(err)" too.

patterniha avatar May 01 '25 03:05 patterniha

@j2rong4cn

when rcode=0, instead of RCodeError(0) it should return dns.EmptyResponse

and in other cases you should return:

errors.New("returning nil for domain ", domain).Base(err) instead of err.

Thanks for the review, any other questions?

j2rong4cn avatar May 01 '25 03:05 j2rong4cn

change your codes base on https://github.com/XTLS/Xray-core/pull/4702

The matched-results are appended again.

Give "#" the highest priority, meaning if one result is "#", other results will be omitted.(you should change "lookupInternal" function)

patterniha avatar May 09 '25 07:05 patterniha

change your codes base on #4702

The matched-results are appended again.

Give "#" the highest priority, meaning if one result is "#", other results will be omitted.(you should change "lookupInternal" function)

我提交新代码了,你看一下对不对?

j2rong4cn avatar May 09 '25 07:05 j2rong4cn

In my opinion it is ok and can be merged. But I am not the decision maker, my PRs haven't been merged yet.

patterniha avatar May 09 '25 09:05 patterniha

@j2rong4cn

LookupHosts function is removed from dns.go, change your code to resolve conflicts.

patterniha avatar May 15 '25 15:05 patterniha

需要 rebase,功能太小众,放下个版本

RPRX avatar Jun 06 '25 02:06 RPRX

@j2rong4cn ?

patterniha avatar Jun 08 '25 18:06 patterniha

@RPRX

ready to merge.

patterniha avatar Jun 09 '25 08:06 patterniha

DNS 最近的 new features 在下个版本可能会有变动,比如 https://github.com/XTLS/Xray-core/pull/4666 我合并前没看,前面讨论了什么也忘了,参数可能会重新设计

RPRX avatar Jun 09 '25 13:06 RPRX

DNS's recent new features may change in the next version. For example, I didn't read #4666 before merging it, and I forgot what was discussed before. The parameters may be redesigned.

@RPRX

my serverless-config is almost ready, If I publish it and then make changes again, many users will be confused. The features are very simple, If possible, finalize it sooner.

patterniha avatar Jun 09 '25 13:06 patterniha

@patterniha 即使现在 finalize 了,近期也不会再发版了,即使以后参数改了,新旧参数都填上应该就行了

RPRX avatar Jun 09 '25 15:06 RPRX

@RPRX

The problems solved in these PRs(I found them) are important and should be fixed in the new version:

https://github.com/XTLS/Xray-core/pull/4899: fix UDP dispatcher cause close connection frequently problem https://github.com/XTLS/Xray-core/pull/4869: fix reverse problems https://github.com/XTLS/Xray-core/pull/4861: fix MUX.cool problems https://github.com/XTLS/Xray-core/pull/4816 and https://github.com/XTLS/Xray-core/pull/4804: fix freedom-UDP problems

I checked them all and they are OK, also @Fangliding created/approved them.

also this PR extends the features of DNS-host and It is OK too.

patterniha avatar Jul 19 '25 06:07 patterniha

@RPRX

Can you spare some time for my PRs?

I spent a lot of time to finding and fixing these bugs, please review them.

fang close my new PRs because I have many open PRs instead of giving the right reason !!!

patterniha avatar Jul 19 '25 14:07 patterniha

@patterniha 你们的 PR 会在新版本前被合并

RPRX avatar Jul 21 '25 04:07 RPRX