-
-
Notifications
You must be signed in to change notification settings - Fork 8
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
Version 0.5 #12
Version 0.5 #12
Conversation
76105da
to
cb1d671
Compare
Optimize error handling in other states
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.
@cloudhead I marked specific fixes required to make Socks5 client working to separate them from other chore and maintanence changes
if input[0] != 0x05 { | ||
*self = Socks5::Failed(Error::VersionNotSupported(input[0])); | ||
return Err(Error::VersionNotSupported(input[0])); | ||
} | ||
if input[1] != 0x00 { |
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.
This is the first fix which was required
socks5-client/src/lib.rs
Outdated
let err = ServerError::from(input[1]); | ||
*self = Socks5::Rejected(err); | ||
return Err(Error::Closed); | ||
} | ||
*self = Socks5::Reading(input[1], input[2]); | ||
*self = Socks5::Reading(input[3], input[4]); |
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.
Thi sis the second
socks5-client/src/lib.rs
Outdated
Socks5::Awaiting => 5, | ||
Socks5::Reading(ty, _) if *ty == IPV4 => 5, | ||
Socks5::Reading(ty, _) if *ty == IPV6 => 17, | ||
Socks5::Reading(ty, len) if *ty == DOMAIN => *len as usize + 1, |
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.
And this is the third
@@ -116,10 +116,10 @@ impl Socks5 { | |||
} | |||
if input[1] != 0x00 { | |||
let err = ServerError::from(input[1]); | |||
*self = Socks5::Rejected(err); | |||
return Err(Error::Closed); | |||
*self = Socks5::Rejected(err, input[3], input[4]); |
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.
previously if Socks5 proxy failed, we were leaving some unread data in a buffer. Not important, since the connection is useless anyway, but better to clean up!
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.
LGTM
No description provided.