diff --git a/client.go b/client.go index 70346a0a..5cea7219 100644 --- a/client.go +++ b/client.go @@ -393,7 +393,7 @@ func (c *client) attemptConnection() (net.Conn, byte, bool, error) { tlsCfg = c.options.OnConnectAttempt(broker, c.options.TLSConfig) } // Start by opening the network connection (tcp, tls, ws) etc - if c.options.CustomOpenConnectionFn != nil{ + if c.options.CustomOpenConnectionFn != nil { conn, err = c.options.CustomOpenConnectionFn(broker, c.options) } else { conn, err = openConnection(broker, tlsCfg, c.options.ConnectTimeout, c.options.HTTPHeaders, c.options.WebsocketOptions, c.options.Dialer) diff --git a/client_test.go b/client_test.go index 45a03d09..d0c7c0dc 100644 --- a/client_test.go +++ b/client_test.go @@ -27,7 +27,7 @@ import ( ) func TestCustomConnectionFunction(t *testing.T) { - // Set netpipe to emu + // Set netpipe to emulate a connection of a different type netClient, netServer := net.Pipe() defer netClient.Close() defer netServer.Close() @@ -59,6 +59,6 @@ func TestCustomConnectionFunction(t *testing.T) { // Analyze first message sent by client and received by the server if len(firstMessage) <= 0 || !strings.Contains(firstMessage, "MQTT") { - t.Error("no message recieved on connect") + t.Error("no message received on connect") } } diff --git a/options.go b/options.go index 936f3ff9..b87b5038 100644 --- a/options.go +++ b/options.go @@ -437,12 +437,12 @@ func (o *ClientOptions) SetDialer(dialer *net.Dialer) *ClientOptions { return o } -// SetCustomOpenConectionFn replaces the inbuilt function that establishes a network connection with a custom function. +// SetCustomOpenConnectionFn replaces the inbuilt function that establishes a network connection with a custom function. // The passed in function should return an open `net.Conn` or an error (see the existing openConnection function for an example) // It enables custom networking types in addition to the defaults (tcp, tls, websockets...) -func (o *ClientOptions) SetCustomOpenConectionFn(customOpenConnectionfn OpenConnectionFunc) *ClientOptions { - if customOpenConnectionfn != nil { - o.CustomOpenConnectionFn = customOpenConnectionfn +func (o *ClientOptions) SetCustomOpenConnectionFn(customOpenConnectionFn OpenConnectionFunc) *ClientOptions { + if customOpenConnectionFn != nil { + o.CustomOpenConnectionFn = customOpenConnectionFn } return o } diff --git a/options_test.go b/options_test.go index 08d527dc..25451ea4 100644 --- a/options_test.go +++ b/options_test.go @@ -32,7 +32,7 @@ func TestSetCustomConnectionOptions(t *testing.T) { return nil, fmt.Errorf("not implemented open connection func") } options := &ClientOptions{} - options = options.SetCustomOpenConectionFn(customConnectionFunc) + options = options.SetCustomOpenConnectionFn(customConnectionFunc) if options.CustomOpenConnectionFn == nil { t.Error("custom open connection function cannot be set") }