-
Notifications
You must be signed in to change notification settings - Fork 4.3k
Removing code that was not being executed and should not be executed. #4721
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
2722486#diff-c3820ebfbe4f1eb7e9d13008e995e0fa8912cad9f058c9f7767aed1df10533d8 tcp:/udp: 前缀似乎确实是没有意料到 ro的判断有点奇怪 去掉的话似乎可以成为一种在客户端强制将域名解析成IP发送的方法?("tcp:ip.sb:80": "127.0.0.1" 这样的写法其实是可以被正常识别的 而且写成域名会被后续的dns解析器继续解析成IP) |
I'm for removing deadcode.. It seems we can remove d.dns as well |
first, this code can only use second, if we want to replace the domain with IP, we can use third, you didn't mention anyway, even adding |
just mention |
这个DNS client可能会被用于(吵了不知道多少遍的)域名解析为IP发送 或者我们可能可以提供一个 net.LookXrayDNS() 之类的函数供其他部分使用(eg: freedom) 虽然这会打破原本的 core features 封装(不过大概本来就已经乱成一团糟了) |
等真的需要再加回来。。如果都同意这段代码没用那就先删了 删了总归是减小复杂度 |
行 那我删了 |
Thanks both! |
during reading dispatcher codes, I encountered a strange code:
Xray-core/app/dispatcher/default.go
Lines 410 to 421 in 72170d8
First, fortunately this code was not executed at all, because
ob.Target.String()
has prefix("tcp:"/"udp:") andhosts.LookupHosts(ob.Target.String())
always returnednil
and as a resultproxied
was alwaysnil
and the code was not executed at all !!!Second, this code should not be executed at all, because the logic of this code is completely wrong, and we should not use
built-in-dns-hosts
to replace theob.Target
and change the destination, because suppose we are in client-side and we want to usebuilt-in-dns
only in client-side, and destination is used in server-side, so we should not change the destination and ob.Target by usingbuilt-in-dns-hosts
, also if we have multiple-ip for a domain this code only replaces one IP.///
fortunately, this code was not executed at all, and removing it is just to clean up the code.