A bounded, read-only NUT upsd client for MoonBit native applications
# Offline; no device access
moon run examples/parse --target native///|
test "decode a synthetic NUT response" {
assert_eq(@moonnut.parse_line("VAR demo ups.status \"OL CHRG\""), [
"VAR", "demo", "ups.status", "OL CHRG",
])
}# Only with authorization for the explicitly named target
moon run examples/query --target native -- ups.example.invalid 3493
moon run examples/query --target native -- ups.example.invalid 3493 --ca /path/to/ca.pem| Option | Default | Meaning |
|---|---|---|
| port | 3493 | TCP server port |
| security | Tls | System roots; TlsCaFile(path) uses a custom CA |
| username, password | absent | Paired credentials, TLS only |
| timeout_ms | 5000 | DNS through the complete response |
| max_line_bytes | 65536 | Bytes before a line's LF delimiter |
| max_response_bytes | 4194304 | Total received protocol bytes, including authentication replies |
| max_rows | 4096 | Rows in a list response |
moon update
moon check --target native
moon test --target native
moon build --target native
python3 scripts/tls_smoke.py
moon info --target native
moon fmt --check
# Optional: external official PyNUT v2.8.3 module, kept outside the repository
python3 scripts/reference_smoke.py /external/path/PyNUT.py
# Packaging validation only, not a release
moon publish --dry-runpub suberror NutError {
InvalidArgument(String)
Protocol(String)
Server(String)
LimitExceeded(String)
UnexpectedEof
} derive(Debug)pub struct Client {
// private fields
}pub(all) enum Security {
Tls
TlsCaFile(String)
Plaintext
}Install
Download zipA bounded, read-only NUT upsd client for MoonBit native applications