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
Fix pure ipaddreses (ip's without a port) could not resolve. #156
Conversation
60208cc
to
2a064ad
Compare
I appreciate your work, but why would you want to remove the srv resolution? it is needed to join the vast majority of big server (e g. hypixel) |
Upps I thought it was a normal dns lookup where it got the ip's. but I now see it can also get ports. FIY. mc.hypixel.net seems to function properly. |
Yea, so just revert your changes and only use the default port if the ip is numerical and no port was provided (or if the srv lookup fails) OR as an alternative you could first try the result of the srv lookup, then the provided port (if there is one) and at the or the default port, the second approach would be more complete although a bit harder to implement |
2a064ad
to
e468c48
Compare
I made a new commit, that keeps srv if let Err(_) = std::net::IpAddr::from_str(&addres) {
...
}
same almost
if !IPADDRESS_PATTERN.is_match(&addres) {
...
}
|
e468c48
to
2c2c286
Compare
If you are able to drop it without dropping any functionality that would be great. Are you sure rust can check if somthing is a domain or an ip tho? |
yes I am sure it is define like this. enum IpAddr {
ipV4
ipV6
} |
So you are also sure it that it doesn't automatically resolve the ip behind the domain? |
Yes I tripped checked the code and also run some Manuel test with the server browser. |
protocol/src/protocol/mod.rs
Outdated
Conn::try_stream(&address, port, protocol_version) | ||
} | ||
|
||
fn try_stream(addres: &str, port: u16, protocol_version: i32) -> Result<Conn, Error> { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
there is a typo, in "addres" it should be "address"
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
good catch!
protocol/src/protocol/mod.rs
Outdated
address = next.to_string(); | ||
let mut port = 25565; | ||
|
||
if target.contains(':') { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You could split_once directly here and use a if let instead of first checking contains and then splitting
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't even know why, I did not think about that xD.
34d6f1f
to
d01dd0c
Compare
Can you rebase? then i'll merge this |
93b62b8
to
4d37168
Compare
Okay, can you rebase once again? then i'll merge it lol |
This pr it is rebased on the lastest commit on master ca6e8e2 ? |
There are merge conflicts @kepet19 |
4d37168
to
dced3f0
Compare
Fixed! @terrarier2111 |
I'll wait for the ci and as i have no access to a computer in like 10 minutes until i get home i'll merge it once i got home. |
Okay, i am home now, could you resolve the merge conflicts? its the last time now, i promise |
dced3f0
to
fc64511
Compare
it is running again |
fc64511
to
9df43dc
Compare
9df43dc
to
b15bc46
Compare
b15bc46
to
a160ca2
Compare
Fixes #134
normal hostnames could be resolve without a port. it was only Ip adresses that could not.
The name you can see in the server list is the same as the adress.
Before
Now
I have simplified the code and it can still connect to server where it is protected by TCPShield.
I did throw in a empty server where the field is empty.
also kkmp.dk does not exits.
FIY this pr also removes regex