refactor(mqtt): .Browser references .Driver — extract the client-options builder so the layering exception can go
#512
Reference in New Issue
Block a user
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
ZB.MOM.WW.OtOpcUa.Driver.Mqtt.Browser.csprojcarries aProjectReferencetoDriver.Mqtt(line 44) in addition to.Contracts. Every other driver's.Browserdepends on.Contractsonly.Why it was accepted. The browser needs to open its own broker connection, which means building MQTTnet
client options with the same TLS / CA-pinning / auth semantics the driver uses. Reusing
MqttConnection.BuildClientOptionswas judged better than duplicating security-relevant TLS and CA-pin logicin a second place, where the two copies would drift and one of them would drift open. The exception is
documented rather than silent.
Clean fix. Extract the pure options-building function to
.Contracts(it is transport-free — it mapsMqttDriverOptionsto client options; it does not connect), leavingMqttConnectionas the only thing thatowns a live client. Then drop the
.Driverreference from.Browser.Guard against the wrong fix: do not resolve this by copy-pasting the TLS setup into the browser. The
duplication is the actual hazard the exception was taken to avoid.
Acceptance.
.Browserreferences.Contractsonly; one implementation of the TLS/CA-pin options builderexists in the tree; the live browse suite still connects over TLS with CA pinning (both the pinned-good and
pinned-wrong cases).