-
Notifications
You must be signed in to change notification settings - Fork 0
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
Ability to use unix socket for connection to nsqd #1
Conversation
conn.go
Outdated
|
||
// create a local copy of the config to set ServerName for this connection | ||
conf := &tls.Config{} | ||
if tlsConf != nil { | ||
conf = tlsConf.Clone() | ||
} | ||
conf.ServerName = host | ||
if c.socketType == "tcp" { |
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.
You did !unixSocket in another place. Maybe it would be better for consistency to do the same here.
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.
also, I don't think we will ever get in here (inside upgradeTLS) for unixSocket. How / why would we?
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.
Keeping backward compatibility with TLS and no need to specify conflicting options explicitly
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.
Looks good to me.
conn.go
Outdated
@@ -90,8 +93,13 @@ func NewConn(addr string, config *Config, delegate ConnDelegate) *Conn { | |||
if !config.initialized { | |||
panic("Config must be created with NewConfig()") | |||
} | |||
socketType := "tcp" |
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.
Probably, it's better to organise this part as method func (*Conn) socketType() string
instead of procedure isSocket since it won't be called too frequently it should not affect performance, but in general LGTM.
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.
Fixed, thank you!
Example to use reader:
and writer:
with connection to nsqd via unix sockets.