HTTPS to a relay board could not work. Nearly every board that offers it signs its own certificate — there is no authority anywhere that could have signed it — so the request failed verification before it left. A checkbox, per board, off by default. Not a blanket switch, because the other HTTPS case is real and opposite: a board reached from outside through a proxy with a genuine certificate, where verification is the only thing standing between an antenna switch and the internet. Same setting, two boards, different answers. Off by default is only safe if the failure explains itself, so a certificate error now names the box to tick. Go's own "x509: certificate signed by unknown authority" is accurate and tells an operator nothing about what to do next. Shown only once an https:// URL is actually in the board's configuration. A board on plain HTTP has no certificate to argue about, and an option that cannot matter yet is one more thing to wonder about. The flag joins the driver cache key: ticking it has to rebuild the driver, or the cached one would go on refusing the certificate with the verifying client it already holds. The boards that take a bare host — WebSwitch, KMTronic — keep verification. An https:// typed there is the proxy case by construction, since they default to plain HTTP on the LAN. Three tests against a real self-signed TLS server: accepted with the box, refused with a message naming it without the box, and one board's setting not leaking into another's.
36 lines
1.0 KiB
Go
36 lines
1.0 KiB
Go
//go:build !windows
|
|
|
|
// The Denkovi USB board is driven through FTDI's D2XX bit-bang API (ftd2xx.dll),
|
|
// which OpsLog only wires up on Windows. This stub keeps the package building on
|
|
// other platforms; every call reports the board is unavailable.
|
|
package relaydev
|
|
|
|
import (
|
|
"context"
|
|
"fmt"
|
|
)
|
|
|
|
type denkoviStub struct{ count int }
|
|
|
|
// NewDenkovi returns a stub on non-Windows builds.
|
|
func NewDenkovi(serial string, count int) Device {
|
|
if count != 4 {
|
|
count = 8
|
|
}
|
|
return denkoviStub{count: count}
|
|
}
|
|
|
|
func (s denkoviStub) Count() int { return s.count }
|
|
func (denkoviStub) Close() error { return nil }
|
|
func (denkoviStub) Status(context.Context) ([]bool, error) {
|
|
return nil, fmt.Errorf("Denkovi USB relay board is only supported on Windows")
|
|
}
|
|
func (denkoviStub) Set(context.Context, int, bool) error {
|
|
return fmt.Errorf("Denkovi USB relay board is only supported on Windows")
|
|
}
|
|
|
|
// ListDenkovi has no devices to report off Windows.
|
|
func ListDenkovi() ([]string, error) {
|
|
return nil, fmt.Errorf("Denkovi USB relay board is only supported on Windows")
|
|
}
|