A minimal CoAP (RFC 7252) server built on coap-lite for message encoding and a tokio UdpSocket for transport. The socket, read loop and routing are kept in src/main.rs rather than behind a framework. Routes: GET /hello[?name=X] -> 2.05 "Hello, X!" (defaults to World) POST /hello -> 2.01, name from a raw text or JSON body GET /health -> 2.05 status + uptime Unknown paths return 4.04, known paths with the wrong method 4.05. Includes a CLI client (src/bin/client.rs) for smoke tests and unit tests covering the greeting, payload parsing and query decoding. Verified against node-coap as an independent implementation to confirm wire compatibility. The earlier Node.js prototype is kept under nodejs/ for reference. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
194 lines
4.9 KiB
TOML
194 lines
4.9 KiB
TOML
# This file is automatically @generated by Cargo.
|
|
# It is not intended for manual editing.
|
|
version = 4
|
|
|
|
[[package]]
|
|
name = "autocfg"
|
|
version = "1.5.1"
|
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
checksum = "f2032f911046de80f0a198e0901378627c33f59ea0ac00e363d481118bd70a53"
|
|
|
|
[[package]]
|
|
name = "coap-hello-udp"
|
|
version = "0.1.0"
|
|
dependencies = [
|
|
"coap-lite",
|
|
"tokio",
|
|
]
|
|
|
|
[[package]]
|
|
name = "coap-lite"
|
|
version = "0.13.3"
|
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
checksum = "87d56a0c1bcd331e7758fd3dd95ed7dd87d118a3b7dc57d60332e17bc97c3f91"
|
|
dependencies = [
|
|
"coap-message 0.2.3",
|
|
"coap-message 0.3.7",
|
|
"lru_time_cache",
|
|
]
|
|
|
|
[[package]]
|
|
name = "coap-message"
|
|
version = "0.2.3"
|
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
checksum = "7cc888e15f6be910b58fda4f056f673f58fb9348ea45da014283a14e6d2b58ec"
|
|
|
|
[[package]]
|
|
name = "coap-message"
|
|
version = "0.3.7"
|
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
checksum = "5716ce4b1742dcb19c3a0afa4837a7052b4a7f13a2bd71cd28a05e90877377d4"
|
|
dependencies = [
|
|
"num-traits",
|
|
]
|
|
|
|
[[package]]
|
|
name = "errno"
|
|
version = "0.3.14"
|
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
checksum = "39cab71617ae0d63f51a36d69f866391735b51691dbda63cf6f96d042b63efeb"
|
|
dependencies = [
|
|
"libc",
|
|
"windows-sys",
|
|
]
|
|
|
|
[[package]]
|
|
name = "libc"
|
|
version = "0.2.189"
|
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
checksum = "3eaf3ede3fee6db1a4c2ee091bf8a8b4dccdc6d17f656fb07896ee72867612f2"
|
|
|
|
[[package]]
|
|
name = "lru_time_cache"
|
|
version = "0.11.11"
|
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
checksum = "9106e1d747ffd48e6be5bb2d97fa706ed25b144fbee4d5c02eae110cd8d6badd"
|
|
|
|
[[package]]
|
|
name = "mio"
|
|
version = "1.2.3"
|
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
checksum = "4b18443e9c262bfe8fa82f51666e2642c53393f7e5c27b3e1aeab922cff5b9d8"
|
|
dependencies = [
|
|
"libc",
|
|
"wasi",
|
|
"windows-sys",
|
|
]
|
|
|
|
[[package]]
|
|
name = "num-traits"
|
|
version = "0.2.19"
|
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
checksum = "071dfc062690e90b734c0b2273ce72ad0ffa95f0c74596bc250dcfd960262841"
|
|
dependencies = [
|
|
"autocfg",
|
|
]
|
|
|
|
[[package]]
|
|
name = "pin-project-lite"
|
|
version = "0.2.17"
|
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
checksum = "a89322df9ebe1c1578d689c92318e070967d1042b512afbe49518723f4e6d5cd"
|
|
|
|
[[package]]
|
|
name = "proc-macro2"
|
|
version = "1.0.107"
|
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
checksum = "985e7ec9bb745e6ce6535b544d84d6cd6f7ad8bd711c398938ae983b91a766d9"
|
|
dependencies = [
|
|
"unicode-ident",
|
|
]
|
|
|
|
[[package]]
|
|
name = "quote"
|
|
version = "1.0.47"
|
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
checksum = "1fbf4db142a473a8d80c26bbf18454ed458bf8d26c8219c331daecfdbd079001"
|
|
dependencies = [
|
|
"proc-macro2",
|
|
]
|
|
|
|
[[package]]
|
|
name = "signal-hook-registry"
|
|
version = "1.4.8"
|
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
checksum = "c4db69cba1110affc0e9f7bcd48bbf87b3f4fc7c61fc9155afd4c469eb3d6c1b"
|
|
dependencies = [
|
|
"errno",
|
|
"libc",
|
|
]
|
|
|
|
[[package]]
|
|
name = "socket2"
|
|
version = "0.6.5"
|
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
checksum = "c3d1e2c7f27f8d4cb10542a02c49005dbd6e93095799d6f3be745fae9f8fedd4"
|
|
dependencies = [
|
|
"libc",
|
|
"windows-sys",
|
|
]
|
|
|
|
[[package]]
|
|
name = "syn"
|
|
version = "3.0.4"
|
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
checksum = "e6275cddf4610d1775e6d1fe9469b2e77d0f39fd98fb7450901b821e0c53649f"
|
|
dependencies = [
|
|
"proc-macro2",
|
|
"quote",
|
|
"unicode-ident",
|
|
]
|
|
|
|
[[package]]
|
|
name = "tokio"
|
|
version = "1.53.1"
|
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
checksum = "202caea871b69668250d242070849eb495be178ed697a3e98aebce5bc81a0bed"
|
|
dependencies = [
|
|
"libc",
|
|
"mio",
|
|
"pin-project-lite",
|
|
"signal-hook-registry",
|
|
"socket2",
|
|
"tokio-macros",
|
|
"windows-sys",
|
|
]
|
|
|
|
[[package]]
|
|
name = "tokio-macros"
|
|
version = "2.7.2"
|
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
checksum = "78773a2a397f451582ce068015985c33193cf6dea8b74d2a639fe457b2f07b0e"
|
|
dependencies = [
|
|
"proc-macro2",
|
|
"quote",
|
|
"syn",
|
|
]
|
|
|
|
[[package]]
|
|
name = "unicode-ident"
|
|
version = "1.0.24"
|
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
checksum = "e6e4313cd5fcd3dad5cafa179702e2b244f760991f45397d14d4ebf38247da75"
|
|
|
|
[[package]]
|
|
name = "wasi"
|
|
version = "0.11.1+wasi-snapshot-preview1"
|
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
checksum = "ccf3ec651a847eb01de73ccad15eb7d99f80485de043efb2f370cd654f4ea44b"
|
|
|
|
[[package]]
|
|
name = "windows-link"
|
|
version = "0.2.1"
|
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
checksum = "f0805222e57f7521d6a62e36fa9163bc891acd422f971defe97d64e70d0a4fe5"
|
|
|
|
[[package]]
|
|
name = "windows-sys"
|
|
version = "0.61.2"
|
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
checksum = "ae137229bcbd6cdf0f7b80a31df61766145077ddf49416a728b02cb3921ff3fc"
|
|
dependencies = [
|
|
"windows-link",
|
|
]
|