Skip to content

Commit 39361aa

Browse files
committed
Cleanup naming and fix/add documentation
1 parent de90ffe commit 39361aa

2 files changed

Lines changed: 9 additions & 7 deletions

File tree

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -253,7 +253,7 @@ ____
253253
### set_ssl_certificates*
254254

255255
```nim
256-
proc set_ping_interval*(ctx: MqttCtx, sslCertFile: string, sslKeyFile: string) =
256+
proc set_ssl_certificates*(ctx: MqttCtx, sslCert: string, sslKey: string) =
257257
```
258258

259259
Sets the SSL Certificate and Key files to use Mutual TLS authentication

nmqtt.nim

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -25,8 +25,8 @@ type
2525
host: string
2626
port: Port
2727
sslOn: bool
28-
sslCertFile: string
29-
sslKeyFile: string
28+
sslCert: string
29+
sslKey: string
3030
verbosity: int
3131
beenConnected: bool
3232
username: string
@@ -1047,7 +1047,7 @@ proc connectBroker(ctx: MqttCtx) {.async.} =
10471047
ctx.s = await asyncnet.dial(ctx.host, ctx.port)
10481048
if ctx.sslOn:
10491049
when defined(ssl):
1050-
ctx.ssl = newContext(protSSLv23, CVerifyNone, ctx.sslCertFile, ctx.sslKeyFile)
1050+
ctx.ssl = newContext(protSSLv23, CVerifyNone, ctx.sslCert, ctx.sslKey)
10511051
wrapConnectedSocket(ctx.ssl, ctx.s, handshakeAsClient)
10521052
else:
10531053
ctx.wrn "Requested SSL session but ssl is not enabled"
@@ -1105,9 +1105,11 @@ proc set_host*(ctx: MqttCtx, host: string, port: int=1883, sslOn=false) =
11051105
ctx.port = Port(port)
11061106
ctx.sslOn = sslOn
11071107

1108-
proc set_ssl_certificates*(ctx: MqttCtx, sslCertFile: string, sslKeyFile: string) =
1109-
ctx.sslCertFile = sslCertFile
1110-
ctx.sslKeyFile = sslKeyFile
1108+
proc set_ssl_certificates*(ctx: MqttCtx, sslCert: string, sslKey: string) =
1109+
# Sets the SSL Certificate and Key to use when connecting to the remote broker
1110+
# for mutal TLS authentication
1111+
ctx.sslCert = sslCert
1112+
ctx.sslKey = sslKey
11111113

11121114
proc set_auth*(ctx: MqttCtx, username: string, password: string) =
11131115
## Set the authentication for the host.

0 commit comments

Comments
 (0)