-
Notifications
You must be signed in to change notification settings - Fork 443
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
Bind outbound connection to address from configuration #124
Conversation
I'm not necessarily opposed to this change but can't this be addressed outside of |
This will try to bind all outgoing connections to the same address. Unless I'm mistaken, if you set LocalAddr, this will fail when you have more than one server you're trying to connect to, as this will try to open two connections with the same source addr. |
mreiferson, imagine machine with two NICs, when you start nsq listener or consumer, ip address of which NIC they will use? The answer is unpredictable, probably, it's possible to solve issue with iptables and masquerading of all outgoing ip addresses, but it's tricky, isn't it? twmb, if you look into |
Cool, I hadn't read that yet. This looks fine to me other than |
Thanks, fixed. |
Still feels wrong to me. I don't disagree that this patch addresses the issue, my concern is that this approach implies that all of the client libraries need a similar patch whereas, if you handled this at the networking layer, it would apply to anything connecting to nsqd. Curious to hear @jehiah's thoughts... |
If you leave |
certainly won't be needed in most cases but i'm fine exposing this. 👍 |
alright alright |
} | ||
return tval | ||
} | ||
|
||
func coerceString(v interface{}) (string, error) { | ||
switch v.(type) { | ||
switch v := v.(type) { |
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.
let's not shadow v
here (and all the other instances below)
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's golang idiom - reuse name of variables in a type switch statements
https://golang.org/doc/effective_go.html#type_switch
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.
TIL - thanks!
@yashkin thanks, would you mind squashing down to one commit and we'll merge? |
For security reasons it would be great to support such feature as binding outbound address, so nsqd could be firewalled on accepting certain addresses, that reasonable in case when nsq-consumers or producers are placed on machines with multiple interfaces.
Bind outbound connection to address from configuration
For security reasons it would be great to support such feature as
binding outbound address, so nsqd could be firewalled on accepting
certain addresses, that reasonable in case when nsq-consumers or
producers are placed on machines with multiple interfaces.