-
Notifications
You must be signed in to change notification settings - Fork 442
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
config: add Dialer option to connect through a proxy #296
base: master
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -36,6 +36,12 @@ type BackoffStrategy interface { | |
Calculate(attempt int) time.Duration | ||
} | ||
|
||
// A Dialer is a means to establish a connection. | ||
type Dialer interface { | ||
// Dial connects to the given address via the proxy. | ||
Dial(network, addr string) (c net.Conn, err error) | ||
} | ||
|
||
// ExponentialStrategy implements an exponential backoff strategy (default) | ||
type ExponentialStrategy struct { | ||
cfg *Config | ||
|
@@ -101,6 +107,10 @@ type Config struct { | |
// LocalAddr is the local address to use when dialing an nsqd. | ||
// If empty, a local address is automatically chosen. | ||
LocalAddr net.Addr `opt:"local_addr"` | ||
// Dialer affect connection when dialing an nsqd. Overwrite this to connect over proxy. | ||
// | ||
// Conflict with options LocalAddr and DialTimeout. | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Correct, this does conflict. We should probably error when a |
||
Dialer Dialer `opt:"dialer"` | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. We need to decide how to handle configuration specified for this See: https://github.com/nsqio/nsq/blob/master/apps/nsq_to_file/nsq_to_file.go#L131-L135 And an example of how we handle |
||
|
||
// Duration between polling lookupd for new producers, and fractional jitter to add to | ||
// the lookupd pool loop. this helps evenly distribute requests even if multiple consumers | ||
|
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 use: