Skip to content

Commit

Permalink
Merge pull request #1123 from PSUdaemon/add_local_addr
Browse files Browse the repository at this point in the history
Add LocalAddr to Config struct and honor in broker.Open().
  • Loading branch information
eapache authored Jul 4, 2018
2 parents 5d35641 + 0f655c0 commit f7df95c
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 0 deletions.
1 change: 1 addition & 0 deletions broker.go
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,7 @@ func (b *Broker) Open(conf *Config) error {
dialer := net.Dialer{
Timeout: conf.Net.DialTimeout,
KeepAlive: conf.Net.KeepAlive,
LocalAddr: conf.Net.LocalAddr,
}

if conf.Net.TLS.Enable {
Expand Down
7 changes: 7 additions & 0 deletions config.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import (
"crypto/tls"
"fmt"
"io/ioutil"
"net"
"regexp"
"time"

Expand Down Expand Up @@ -58,6 +59,12 @@ type Config struct {
// KeepAlive specifies the keep-alive period for an active network connection.
// If zero, keep-alives are disabled. (default is 0: disabled).
KeepAlive time.Duration

// LocalAddr is the local address to use when dialing an
// address. The address must be of a compatible type for the
// network being dialed.
// If nil, a local address is automatically chosen.
LocalAddr net.Addr
}

// Metadata is the namespace for metadata management properties used by the
Expand Down

0 comments on commit f7df95c

Please sign in to comment.