Skip to content
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

Support Duplex Streams for existing_socket #29

Merged

Conversation

castorw
Copy link
Contributor

@castorw castorw commented Mar 22, 2018

Currently existing_socket needs to be an instance of net.Socket - this is limiting to developers who want to provide a specific stream connected to a proxy server (eg. pre-connected netcat stream).

Upon providing such stream, the library can provide SOCKS protocol functionality including authentication.

@coveralls
Copy link

Coverage Status

Coverage decreased (-0.01%) to 36.232% when pulling f221205 on castorw:fix-allow-duplex-stream into e9268fe on JoshGlazebrook:master.

@coveralls
Copy link

coveralls commented Mar 22, 2018

Coverage Status

Coverage decreased (-0.07%) to 36.174% when pulling 5412ab0 on castorw:fix-allow-duplex-stream into e9268fe on JoshGlazebrook:master.

@@ -441,7 +442,7 @@ class SocksClient extends EventEmitter implements SocksClient {
this.state = SocksClientState.Error;

// Destroy Socket
if (!this._socket.destroyed) {
if (this._socket instanceof net.Socket && !this._socket.destroyed) {
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Wouldn't we want to call .destroy() on the stream for instances where _socket is not a net.Socket?

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, I did it kinda bluntly. Fixed now.

@JoshGlazebrook JoshGlazebrook merged commit c26c296 into JoshGlazebrook:master Apr 4, 2018
@castorw castorw deleted the fix-allow-duplex-stream branch May 8, 2018 18:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants