Skip to content

Comments

DNS-Hosts: return only first matched-result#4706

Closed
patterniha wants to merge 1 commit intoXTLS:mainfrom
patterniha:hosts2
Closed

DNS-Hosts: return only first matched-result#4706
patterniha wants to merge 1 commit intoXTLS:mainfrom
patterniha:hosts2

Conversation

@patterniha
Copy link
Collaborator

@patterniha patterniha commented May 7, 2025

we should not append matched-results in hosts, reason: #4673 (comment)

///

I tried to solve this problem in #4673 but it didn't work, because json.Unmarshal had messed up the order and the first matched-result was not necessarily the first matched-result to appear in the json.

///

but now I changed json.Unmarshal as well and the problem is completely solved.

(In fact, if I knew I could solve "json.Unmarshal" problem so soon, I wouldn't have opened #4702 at all)

@yuhan6665
Copy link
Member

As discussed, we'd like to keep host config simple. Which means host config should just be a map, should not respect any order.
Any matching, fallback behavior should be move to routing or other DNS config. The previous example
"geosite:google": ["216.239.38.119"]
is invalid.
If anyone has a strong use case, we can reopen.

@yuhan6665 yuhan6665 closed this May 8, 2025
@patterniha
Copy link
Collaborator Author

This change was suggested by a telegram-user and I think it should be done, because we can have multiple-ips for each result, and there is no need for appending.
(Also i gave you a more strong use case in telegram)

///

Anyway, this is depends on opinion and it doesn't really matter.

What really matters is "happy-eyeballs" and "dns-new-featutes" PR, i solved are your problems and answered all your questions But after a month, they still haven't merged.

I need them for serverless-for-Iran-anti-sanction-versiom.

Many users are waiting for this configuration and this configuration solves the problem of many users in iran.

Many users will actually no longer need to buy a VPN in iran.

They will also be useful for other uses and Chinese users will also benefit.

@RPRX @yuhan6665 @Fangliding @KobeArthurScofield

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants