-
Notifications
You must be signed in to change notification settings - Fork 961
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
Add support for local host and port binding #238
Conversation
🆒 Looks good. What is the use case for this? Sorry for the lame question, I just have no idea why I would use this so I'm curious as to what you are using it for. |
It's for use when you have multiple IP-addresses bound to a single machine, on a single interface. To give you an example, I have a single interface, on which I have bound 2 IPv4 addresses, and a single IPv6 address. With this change, I can choose which address I want to connect from. If I were running a TOR relay on one of my IPv4 addresses, and wanted to connect to a HTTP service that automatically denies access to all IP-addresses that are on a DNS blacklist (which many TOR nodes are), I could circumvent this by connecting from my other IP address. |
@@ -202,6 +202,13 @@ | |||
end | |||
end | |||
|
|||
context 'when providing a local bind address and port' do |
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 test should be wrapped with the ruby version if statement as well.
With the tweak I just mentioned I'll happily pull it. |
|
||
its(:local_host) { should == '127.0.0.1' } | ||
its(:local_port) { should == 12345 } | ||
end if RUBY_VERSION >= '2.0' |
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.
It is. 😏
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.
Gah. Missed it. Thanks.
Add support for local host and port binding
Add support for specifying a local host and port to bind to, before connecting.
This was implemented as per https://bugs.ruby-lang.org/issues/6617 and only works for Ruby 2.0 or later.