mirror of
https://gitea.farpn.net/w1cdn/mwtchahrd.git
synced 2025-12-10 06:28:02 -06:00
Compare commits
35 Commits
v0.1.0
...
05a6bb18b0
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
05a6bb18b0 | ||
|
|
85521543c6 | ||
|
|
6bbfa66c4f | ||
|
|
d95cf3e368 | ||
|
|
20fda492a5 | ||
|
|
97e955156d | ||
|
|
c60723b0a5 | ||
|
|
780c4b5884 | ||
|
|
07c57e85a8 | ||
|
|
875da10174 | ||
|
|
7ce55f020b | ||
|
|
21499a93d9 | ||
|
|
268a79acda | ||
|
|
ad5f2ccd0d | ||
|
|
8af43a54bb | ||
|
|
d20188e152 | ||
|
|
b6b627ef65 | ||
|
|
863657f61f | ||
|
|
f1d0f6dc31 | ||
|
|
d353b1b055 | ||
|
|
f452e72ef9 | ||
|
|
796035ac59 | ||
|
|
b14f4eee6a | ||
|
|
5cd273a476 | ||
|
|
a62cb8630b | ||
|
|
c9f6a4a6c5 | ||
|
|
369de6f873 | ||
|
|
ab4f190138 | ||
|
|
a768d908ed | ||
|
|
c8d7b6a817 | ||
|
|
98da8b95d5 | ||
|
|
7957fa7c2c | ||
|
|
6101932b0d | ||
|
|
8065fcc24e | ||
|
|
3aa395dc4e |
2
.gitignore
vendored
2
.gitignore
vendored
@@ -6,7 +6,7 @@ target/
|
|||||||
|
|
||||||
# Remove Cargo.lock from gitignore if creating an executable, leave it for libraries
|
# Remove Cargo.lock from gitignore if creating an executable, leave it for libraries
|
||||||
# More information here https://doc.rust-lang.org/cargo/guide/cargo-toml-vs-cargo-lock.html
|
# More information here https://doc.rust-lang.org/cargo/guide/cargo-toml-vs-cargo-lock.html
|
||||||
Cargo.lock
|
#Cargo.lock
|
||||||
|
|
||||||
#Cross config
|
#Cross config
|
||||||
Cross.toml
|
Cross.toml
|
||||||
|
|||||||
511
Cargo.lock
generated
Normal file
511
Cargo.lock
generated
Normal file
@@ -0,0 +1,511 @@
|
|||||||
|
# This file is automatically @generated by Cargo.
|
||||||
|
# It is not intended for manual editing.
|
||||||
|
version = 4
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "android_system_properties"
|
||||||
|
version = "0.1.5"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "819e7219dbd41043ac279b19830f2efc897156490d7fd6ea916720117ee66311"
|
||||||
|
dependencies = [
|
||||||
|
"libc",
|
||||||
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "anstream"
|
||||||
|
version = "0.6.21"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "43d5b281e737544384e969a5ccad3f1cdd24b48086a0fc1b2a5262a26b8f4f4a"
|
||||||
|
dependencies = [
|
||||||
|
"anstyle",
|
||||||
|
"anstyle-parse",
|
||||||
|
"anstyle-query",
|
||||||
|
"anstyle-wincon",
|
||||||
|
"colorchoice",
|
||||||
|
"is_terminal_polyfill",
|
||||||
|
"utf8parse",
|
||||||
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "anstyle"
|
||||||
|
version = "1.0.13"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "5192cca8006f1fd4f7237516f40fa183bb07f8fbdfedaa0036de5ea9b0b45e78"
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "anstyle-parse"
|
||||||
|
version = "0.2.7"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "4e7644824f0aa2c7b9384579234ef10eb7efb6a0deb83f9630a49594dd9c15c2"
|
||||||
|
dependencies = [
|
||||||
|
"utf8parse",
|
||||||
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "anstyle-query"
|
||||||
|
version = "1.1.5"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "40c48f72fd53cd289104fc64099abca73db4166ad86ea0b4341abe65af83dadc"
|
||||||
|
dependencies = [
|
||||||
|
"windows-sys 0.61.2",
|
||||||
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "anstyle-wincon"
|
||||||
|
version = "3.0.11"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "291e6a250ff86cd4a820112fb8898808a366d8f9f58ce16d1f538353ad55747d"
|
||||||
|
dependencies = [
|
||||||
|
"anstyle",
|
||||||
|
"once_cell_polyfill",
|
||||||
|
"windows-sys 0.61.2",
|
||||||
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "anyhow"
|
||||||
|
version = "1.0.100"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "a23eb6b1614318a8071c9b2521f36b424b2c83db5eb3a0fead4a6c0809af6e61"
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "autocfg"
|
||||||
|
version = "1.5.0"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "c08606f8c3cbf4ce6ec8e28fb0014a2c086708fe954eaa885384a6165172e7e8"
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "bumpalo"
|
||||||
|
version = "3.19.0"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "46c5e41b57b8bba42a04676d81cb89e9ee8e859a1a66f80a5a72e1cb76b34d43"
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "cc"
|
||||||
|
version = "1.2.46"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "b97463e1064cb1b1c1384ad0a0b9c8abd0988e2a91f52606c80ef14aadb63e36"
|
||||||
|
dependencies = [
|
||||||
|
"find-msvc-tools",
|
||||||
|
"shlex",
|
||||||
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "cfg-if"
|
||||||
|
version = "1.0.4"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "9330f8b2ff13f34540b44e946ef35111825727b38d33286ef986142615121801"
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "chrono"
|
||||||
|
version = "0.4.42"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "145052bdd345b87320e369255277e3fb5152762ad123a901ef5c262dd38fe8d2"
|
||||||
|
dependencies = [
|
||||||
|
"iana-time-zone",
|
||||||
|
"js-sys",
|
||||||
|
"num-traits",
|
||||||
|
"wasm-bindgen",
|
||||||
|
"windows-link",
|
||||||
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "clap"
|
||||||
|
version = "4.5.51"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "4c26d721170e0295f191a69bd9a1f93efcdb0aff38684b61ab5750468972e5f5"
|
||||||
|
dependencies = [
|
||||||
|
"clap_builder",
|
||||||
|
"clap_derive",
|
||||||
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "clap_builder"
|
||||||
|
version = "4.5.51"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "75835f0c7bf681bfd05abe44e965760fea999a5286c6eb2d59883634fd02011a"
|
||||||
|
dependencies = [
|
||||||
|
"anstream",
|
||||||
|
"anstyle",
|
||||||
|
"clap_lex",
|
||||||
|
"strsim",
|
||||||
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "clap_derive"
|
||||||
|
version = "4.5.49"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "2a0b5487afeab2deb2ff4e03a807ad1a03ac532ff5a2cee5d86884440c7f7671"
|
||||||
|
dependencies = [
|
||||||
|
"heck",
|
||||||
|
"proc-macro2",
|
||||||
|
"quote",
|
||||||
|
"syn",
|
||||||
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "clap_lex"
|
||||||
|
version = "0.7.6"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "a1d728cc89cf3aee9ff92b05e62b19ee65a02b5702cff7d5a377e32c6ae29d8d"
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "colorchoice"
|
||||||
|
version = "1.0.4"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "b05b61dc5112cbb17e4b6cd61790d9845d13888356391624cbe7e41efeac1e75"
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "core-foundation-sys"
|
||||||
|
version = "0.8.7"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "773648b94d0e5d620f64f280777445740e61fe701025087ec8b57f45c791888b"
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "find-msvc-tools"
|
||||||
|
version = "0.1.5"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "3a3076410a55c90011c298b04d0cfa770b00fa04e1e3c97d3f6c9de105a03844"
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "heck"
|
||||||
|
version = "0.5.0"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "2304e00983f87ffb38b55b444b5e3b60a884b5d30c0fca7d82fe33449bbe55ea"
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "iana-time-zone"
|
||||||
|
version = "0.1.64"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "33e57f83510bb73707521ebaffa789ec8caf86f9657cad665b092b581d40e9fb"
|
||||||
|
dependencies = [
|
||||||
|
"android_system_properties",
|
||||||
|
"core-foundation-sys",
|
||||||
|
"iana-time-zone-haiku",
|
||||||
|
"js-sys",
|
||||||
|
"log",
|
||||||
|
"wasm-bindgen",
|
||||||
|
"windows-core",
|
||||||
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "iana-time-zone-haiku"
|
||||||
|
version = "0.1.2"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "f31827a206f56af32e590ba56d5d2d085f558508192593743f16b2306495269f"
|
||||||
|
dependencies = [
|
||||||
|
"cc",
|
||||||
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "is_terminal_polyfill"
|
||||||
|
version = "1.70.2"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "a6cb138bb79a146c1bd460005623e142ef0181e3d0219cb493e02f7d08a35695"
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "js-sys"
|
||||||
|
version = "0.3.82"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "b011eec8cc36da2aab2d5cff675ec18454fad408585853910a202391cf9f8e65"
|
||||||
|
dependencies = [
|
||||||
|
"once_cell",
|
||||||
|
"wasm-bindgen",
|
||||||
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "libc"
|
||||||
|
version = "0.2.177"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "2874a2af47a2325c2001a6e6fad9b16a53b802102b528163885171cf92b15976"
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "log"
|
||||||
|
version = "0.4.28"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "34080505efa8e45a4b816c349525ebe327ceaa8559756f0356cba97ef3bf7432"
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "mwtchahrd"
|
||||||
|
version = "0.1.0"
|
||||||
|
dependencies = [
|
||||||
|
"anyhow",
|
||||||
|
"chrono",
|
||||||
|
"clap",
|
||||||
|
"socket2",
|
||||||
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "num-traits"
|
||||||
|
version = "0.2.19"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "071dfc062690e90b734c0b2273ce72ad0ffa95f0c74596bc250dcfd960262841"
|
||||||
|
dependencies = [
|
||||||
|
"autocfg",
|
||||||
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "once_cell"
|
||||||
|
version = "1.21.3"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "42f5e15c9953c5e4ccceeb2e7382a716482c34515315f7b03532b8b4e8393d2d"
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "once_cell_polyfill"
|
||||||
|
version = "1.70.2"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "384b8ab6d37215f3c5301a95a4accb5d64aa607f1fcb26a11b5303878451b4fe"
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "proc-macro2"
|
||||||
|
version = "1.0.103"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "5ee95bc4ef87b8d5ba32e8b7714ccc834865276eab0aed5c9958d00ec45f49e8"
|
||||||
|
dependencies = [
|
||||||
|
"unicode-ident",
|
||||||
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "quote"
|
||||||
|
version = "1.0.42"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "a338cc41d27e6cc6dce6cefc13a0729dfbb81c262b1f519331575dd80ef3067f"
|
||||||
|
dependencies = [
|
||||||
|
"proc-macro2",
|
||||||
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "rustversion"
|
||||||
|
version = "1.0.22"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "b39cdef0fa800fc44525c84ccb54a029961a8215f9619753635a9c0d2538d46d"
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "shlex"
|
||||||
|
version = "1.3.0"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "0fda2ff0d084019ba4d7c6f371c95d8fd75ce3524c3cb8fb653a3023f6323e64"
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "socket2"
|
||||||
|
version = "0.5.10"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "e22376abed350d73dd1cd119b57ffccad95b4e585a7cda43e286245ce23c0678"
|
||||||
|
dependencies = [
|
||||||
|
"libc",
|
||||||
|
"windows-sys 0.52.0",
|
||||||
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "strsim"
|
||||||
|
version = "0.11.1"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "7da8b5736845d9f2fcb837ea5d9e2628564b3b043a70948a3f0b778838c5fb4f"
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "syn"
|
||||||
|
version = "2.0.110"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "a99801b5bd34ede4cf3fc688c5919368fea4e4814a4664359503e6015b280aea"
|
||||||
|
dependencies = [
|
||||||
|
"proc-macro2",
|
||||||
|
"quote",
|
||||||
|
"unicode-ident",
|
||||||
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "unicode-ident"
|
||||||
|
version = "1.0.22"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "9312f7c4f6ff9069b165498234ce8be658059c6728633667c526e27dc2cf1df5"
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "utf8parse"
|
||||||
|
version = "0.2.2"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "06abde3611657adf66d383f00b093d7faecc7fa57071cce2578660c9f1010821"
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "wasm-bindgen"
|
||||||
|
version = "0.2.105"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "da95793dfc411fbbd93f5be7715b0578ec61fe87cb1a42b12eb625caa5c5ea60"
|
||||||
|
dependencies = [
|
||||||
|
"cfg-if",
|
||||||
|
"once_cell",
|
||||||
|
"rustversion",
|
||||||
|
"wasm-bindgen-macro",
|
||||||
|
"wasm-bindgen-shared",
|
||||||
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "wasm-bindgen-macro"
|
||||||
|
version = "0.2.105"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "04264334509e04a7bf8690f2384ef5265f05143a4bff3889ab7a3269adab59c2"
|
||||||
|
dependencies = [
|
||||||
|
"quote",
|
||||||
|
"wasm-bindgen-macro-support",
|
||||||
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "wasm-bindgen-macro-support"
|
||||||
|
version = "0.2.105"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "420bc339d9f322e562942d52e115d57e950d12d88983a14c79b86859ee6c7ebc"
|
||||||
|
dependencies = [
|
||||||
|
"bumpalo",
|
||||||
|
"proc-macro2",
|
||||||
|
"quote",
|
||||||
|
"syn",
|
||||||
|
"wasm-bindgen-shared",
|
||||||
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "wasm-bindgen-shared"
|
||||||
|
version = "0.2.105"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "76f218a38c84bcb33c25ec7059b07847d465ce0e0a76b995e134a45adcb6af76"
|
||||||
|
dependencies = [
|
||||||
|
"unicode-ident",
|
||||||
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "windows-core"
|
||||||
|
version = "0.62.2"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "b8e83a14d34d0623b51dce9581199302a221863196a1dde71a7663a4c2be9deb"
|
||||||
|
dependencies = [
|
||||||
|
"windows-implement",
|
||||||
|
"windows-interface",
|
||||||
|
"windows-link",
|
||||||
|
"windows-result",
|
||||||
|
"windows-strings",
|
||||||
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "windows-implement"
|
||||||
|
version = "0.60.2"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "053e2e040ab57b9dc951b72c264860db7eb3b0200ba345b4e4c3b14f67855ddf"
|
||||||
|
dependencies = [
|
||||||
|
"proc-macro2",
|
||||||
|
"quote",
|
||||||
|
"syn",
|
||||||
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "windows-interface"
|
||||||
|
version = "0.59.3"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "3f316c4a2570ba26bbec722032c4099d8c8bc095efccdc15688708623367e358"
|
||||||
|
dependencies = [
|
||||||
|
"proc-macro2",
|
||||||
|
"quote",
|
||||||
|
"syn",
|
||||||
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "windows-link"
|
||||||
|
version = "0.2.1"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "f0805222e57f7521d6a62e36fa9163bc891acd422f971defe97d64e70d0a4fe5"
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "windows-result"
|
||||||
|
version = "0.4.1"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "7781fa89eaf60850ac3d2da7af8e5242a5ea78d1a11c49bf2910bb5a73853eb5"
|
||||||
|
dependencies = [
|
||||||
|
"windows-link",
|
||||||
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "windows-strings"
|
||||||
|
version = "0.5.1"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "7837d08f69c77cf6b07689544538e017c1bfcf57e34b4c0ff58e6c2cd3b37091"
|
||||||
|
dependencies = [
|
||||||
|
"windows-link",
|
||||||
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "windows-sys"
|
||||||
|
version = "0.52.0"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "282be5f36a8ce781fad8c8ae18fa3f9beff57ec1b52cb3de0789201425d9a33d"
|
||||||
|
dependencies = [
|
||||||
|
"windows-targets",
|
||||||
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "windows-sys"
|
||||||
|
version = "0.61.2"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "ae137229bcbd6cdf0f7b80a31df61766145077ddf49416a728b02cb3921ff3fc"
|
||||||
|
dependencies = [
|
||||||
|
"windows-link",
|
||||||
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "windows-targets"
|
||||||
|
version = "0.52.6"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "9b724f72796e036ab90c1021d4780d4d3d648aca59e491e6b98e725b84e99973"
|
||||||
|
dependencies = [
|
||||||
|
"windows_aarch64_gnullvm",
|
||||||
|
"windows_aarch64_msvc",
|
||||||
|
"windows_i686_gnu",
|
||||||
|
"windows_i686_gnullvm",
|
||||||
|
"windows_i686_msvc",
|
||||||
|
"windows_x86_64_gnu",
|
||||||
|
"windows_x86_64_gnullvm",
|
||||||
|
"windows_x86_64_msvc",
|
||||||
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "windows_aarch64_gnullvm"
|
||||||
|
version = "0.52.6"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "32a4622180e7a0ec044bb555404c800bc9fd9ec262ec147edd5989ccd0c02cd3"
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "windows_aarch64_msvc"
|
||||||
|
version = "0.52.6"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "09ec2a7bb152e2252b53fa7803150007879548bc709c039df7627cabbd05d469"
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "windows_i686_gnu"
|
||||||
|
version = "0.52.6"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "8e9b5ad5ab802e97eb8e295ac6720e509ee4c243f69d781394014ebfe8bbfa0b"
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "windows_i686_gnullvm"
|
||||||
|
version = "0.52.6"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "0eee52d38c090b3caa76c563b86c3a4bd71ef1a819287c19d586d7334ae8ed66"
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "windows_i686_msvc"
|
||||||
|
version = "0.52.6"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "240948bc05c5e7c6dabba28bf89d89ffce3e303022809e73deaefe4f6ec56c66"
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "windows_x86_64_gnu"
|
||||||
|
version = "0.52.6"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "147a5c80aabfbf0c7d901cb5895d1de30ef2907eb21fbbab29ca94c5b08b1a78"
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "windows_x86_64_gnullvm"
|
||||||
|
version = "0.52.6"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "24d5b23dc417412679681396f2b49f3de8c1473deb516bd34410872eff51ed0d"
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "windows_x86_64_msvc"
|
||||||
|
version = "0.52.6"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "589f6da84c646204747d1270a2a5661ea66ed1cced2631d546fdfb155959f9ec"
|
||||||
@@ -8,7 +8,14 @@ authors = ["Chris, N6CTA <mail@n6cta.com>"]
|
|||||||
anyhow = "1.0"
|
anyhow = "1.0"
|
||||||
chrono = "0.4"
|
chrono = "0.4"
|
||||||
clap = { version = "4", features = ["derive"] }
|
clap = { version = "4", features = ["derive"] }
|
||||||
|
openssl-sys = "0.9.111"
|
||||||
|
openssl = { version = "0.10", features = ["vendored"] }
|
||||||
|
rand = "0.9.2"
|
||||||
|
regex = "1.12.2"
|
||||||
|
reqwest = { version = "0.12.24", features = ["json", "blocking"] }
|
||||||
|
serde_json = "1.0.145"
|
||||||
socket2 = "0.5"
|
socket2 = "0.5"
|
||||||
|
|
||||||
[profile.release]
|
[profile.release]
|
||||||
lto = "thin"
|
lto = "thin"
|
||||||
|
|
||||||
|
|||||||
11
Cross.toml
11
Cross.toml
@@ -1,11 +0,0 @@
|
|||||||
[target.aarch64-unknown-linux-gnu]
|
|
||||||
image = "ghcr.io/cross-rs/aarch64-unknown-linux-gnu:edge@sha256:168fa652629cedcd9549e85258be8f83fa008625b187c004d6ea439cf16f6a41"
|
|
||||||
|
|
||||||
[target.x86_64-unknown-linux-gnu]
|
|
||||||
image = "ghcr.io/cross-rs/x86_64-unknown-linux-gnu:edge@sha256:3542b427c3f7d0d2976d7add025c5ba997499411f408b3b26803ccc70fc431da"
|
|
||||||
|
|
||||||
[target.armv7-unknown-linux-gnueabihf]
|
|
||||||
image = "ghcr.io/cross-rs/armv7-unknown-linux-gnueabihf:edge@sha256:3e1def581eb9c9f11cfff85745802f2de5cf9cdeeb5a8495048f393a0993b99b"
|
|
||||||
|
|
||||||
[target.arm-unknown-linux-gnueabihf]
|
|
||||||
image = "ghcr.io/cross-rs/arm-unknown-linux-gnueabihf:edge@sha256:28e7aaae8301506f4f1b3394c8bc23f958d1717043e06f816045e7b8df57e173"
|
|
||||||
43
README.md
43
README.md
@@ -37,7 +37,7 @@ The compiled executable will be located in the `target/release` directory.
|
|||||||
Run the executable with the required arguments:
|
Run the executable with the required arguments:
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
mwtchahrd -i <IP> -p <PORT> [-c <CHANNEL>] [-d] [-u]
|
mwtchahrd -i <IP> -p <PORT> [-c <CHANNEL>] [-d] [-u]
|
||||||
```
|
```
|
||||||
|
|
||||||
### Command‑Line Arguments
|
### Command‑Line Arguments
|
||||||
@@ -56,6 +56,39 @@ mwtchahrd -i <IP> -p <PORT> [-c <CHANNEL>] [-d] [-u]
|
|||||||
|
|
||||||
- `-u, --ui_only`
|
- `-u, --ui_only`
|
||||||
Only display frames with a UI payload. When this flag is set, frames that are not UI are skipped.
|
Only display frames with a UI payload. When this flag is set, frames that are not UI are skipped.
|
||||||
|
|
||||||
|
- `-b, --uip <UIP>`
|
||||||
|
Send UDP to what IP address (e.g. 127.0.0.1) [default: 127.0.0.1].
|
||||||
|
|
||||||
|
- `-k, --uport <UPORT>`
|
||||||
|
Send UDP to what port (e.g. 8000; 55555 disables UDP) [default: 55555].
|
||||||
|
|
||||||
|
- `-s, --spotter <SPOTTER>`
|
||||||
|
Spotter callsign (e.g. W1CDN).
|
||||||
|
|
||||||
|
- `-o, --spothole`
|
||||||
|
Spot UI frames to a Spothole server.
|
||||||
|
|
||||||
|
- `-O, --spothole-alt <SPOTHOLE_ALT>`
|
||||||
|
Provide a different URL than https://spothole.app/api/v1/spot.
|
||||||
|
|
||||||
|
- `-f, --freq <FREQ>`
|
||||||
|
Spotting frequency [default: 14105000].
|
||||||
|
|
||||||
|
- `-y, --my-lat <MY_LAT>`
|
||||||
|
Spotter latitude, DD.dddd.
|
||||||
|
|
||||||
|
- `-x, --my-lon <MY_LON>`
|
||||||
|
Spotter longitude, DD.dddd.
|
||||||
|
|
||||||
|
- `-t, --filter <CALL-SSID,CALL-SSID,...>`
|
||||||
|
Filter out spots from these callsign-UUID combinations (self spots, for example), comma-separated. This is not regex, just full matches.
|
||||||
|
|
||||||
|
- `-h, --help`
|
||||||
|
Print help.
|
||||||
|
|
||||||
|
- `-V, --version`
|
||||||
|
Print version.
|
||||||
|
|
||||||
## Examples
|
## Examples
|
||||||
|
|
||||||
@@ -83,6 +116,14 @@ Monitor only UI frames:
|
|||||||
mwtchahrd -i 127.0.0.1 -p 8000 -u
|
mwtchahrd -i 127.0.0.1 -p 8000 -u
|
||||||
```
|
```
|
||||||
|
|
||||||
|
### Spotting to [Spothole.app](https://spothole.app) API
|
||||||
|
|
||||||
|
Sends only UI frames and mode is hardcoded as `PKT`. Spot from callsign `W1CDN` and report fixed frequency 14.105 MHz. Report your location as spotter and don't spot your own beacons.
|
||||||
|
|
||||||
|
```bash
|
||||||
|
mwtchahrd --ip 192.168.0.6 --port 8000 --spotter W1CDN --spothole --freq 14105000 --my-lat 47.01 --my-lon -97.01 --filter W1CDN-1,W1CDN-7
|
||||||
|
```
|
||||||
|
|
||||||
## Code Overview
|
## Code Overview
|
||||||
|
|
||||||
- **Validation Functions:**
|
- **Validation Functions:**
|
||||||
|
|||||||
7
auto-build-release.sh
Executable file
7
auto-build-release.sh
Executable file
@@ -0,0 +1,7 @@
|
|||||||
|
echo "Building release for multiple targets";
|
||||||
|
cargo build --release;
|
||||||
|
cross build --release --target=aarch64-unknown-linux-gnu;
|
||||||
|
cross build --release --target=x86_64-unknown-linux-gnu;
|
||||||
|
cross build --release --target=armv7-unknown-linux-gnueabihf;
|
||||||
|
cross build --release --target=arm-unknown-linux-gnueabihf;
|
||||||
|
cross build --release --target x86_64-pc-windows-gnu
|
||||||
7
auto-build.sh
Executable file
7
auto-build.sh
Executable file
@@ -0,0 +1,7 @@
|
|||||||
|
echo "Building dev for multiple targets";
|
||||||
|
cargo build;
|
||||||
|
cross build --target=aarch64-unknown-linux-gnu;
|
||||||
|
cross build --target=x86_64-unknown-linux-gnu;
|
||||||
|
cross build --target=armv7-unknown-linux-gnueabihf;
|
||||||
|
cross build --target=arm-unknown-linux-gnueabihf;
|
||||||
|
cross build --target x86_64-pc-windows-gnu
|
||||||
231
src/main.rs
231
src/main.rs
@@ -7,7 +7,14 @@ use std::convert::TryInto;
|
|||||||
use std::io::{Read, Write};
|
use std::io::{Read, Write};
|
||||||
use std::net::TcpStream;
|
use std::net::TcpStream;
|
||||||
use std::thread::sleep;
|
use std::thread::sleep;
|
||||||
use std::time::Duration;
|
use std::time::{Duration, SystemTime, UNIX_EPOCH};
|
||||||
|
use std::net::UdpSocket;
|
||||||
|
use std::net::Ipv4Addr;
|
||||||
|
use serde_json::{json};
|
||||||
|
use reqwest;
|
||||||
|
use regex::Regex;
|
||||||
|
use rand::Rng;
|
||||||
|
|
||||||
|
|
||||||
/// Validate that the provided port string can be parsed into a u16 and is nonzero.
|
/// Validate that the provided port string can be parsed into a u16 and is nonzero.
|
||||||
fn validate_port(port: &str) -> Result<u16, String> {
|
fn validate_port(port: &str) -> Result<u16, String> {
|
||||||
@@ -31,7 +38,7 @@ struct Cli {
|
|||||||
/// AGWPE server IP address (e.g. 127.0.0.1)
|
/// AGWPE server IP address (e.g. 127.0.0.1)
|
||||||
#[arg(short = 'i', long)]
|
#[arg(short = 'i', long)]
|
||||||
ip: std::net::IpAddr,
|
ip: std::net::IpAddr,
|
||||||
|
|
||||||
/// AGWPE server TCP port (e.g. 8000)
|
/// AGWPE server TCP port (e.g. 8000)
|
||||||
#[arg(short = 'p', long, value_parser = validate_port)]
|
#[arg(short = 'p', long, value_parser = validate_port)]
|
||||||
port: u16,
|
port: u16,
|
||||||
@@ -47,6 +54,43 @@ struct Cli {
|
|||||||
/// Only monitor UI frames
|
/// Only monitor UI frames
|
||||||
#[arg(short = 'u', long, default_value_t = false)]
|
#[arg(short = 'u', long, default_value_t = false)]
|
||||||
ui_only: bool,
|
ui_only: bool,
|
||||||
|
|
||||||
|
/// Send UDP to what IP address (e.g. 127.0.0.1)
|
||||||
|
#[arg(short = 'b', long, default_value_t = std::net::IpAddr::V4(Ipv4Addr::new(127, 0, 0, 1)))]
|
||||||
|
uip: std::net::IpAddr,
|
||||||
|
|
||||||
|
/// Send UDP to what port (e.g. 8000; 55555 disables UDP)
|
||||||
|
#[arg(short = 'k', long, value_parser = validate_port, default_value_t = 55555)]
|
||||||
|
uport: u16,
|
||||||
|
|
||||||
|
/// Spotter callsign (e.g. W1CDN)
|
||||||
|
#[arg(short = 's', long)]
|
||||||
|
my_call: Option<String>,
|
||||||
|
|
||||||
|
/// Spot UI frames to a Spothole server
|
||||||
|
#[arg(short = 'o', long, default_value_t = false)]
|
||||||
|
spothole: bool,
|
||||||
|
|
||||||
|
/// Provide a different URL than https://spothole.app/api/v1/spot
|
||||||
|
#[arg(short = 'O', long)]
|
||||||
|
spothole_alt: Option<String>,
|
||||||
|
|
||||||
|
/// Spotting frequency
|
||||||
|
#[arg(short = 'f', long, default_value_t = 14105000)]
|
||||||
|
freq: u32,
|
||||||
|
|
||||||
|
/// Spotter latitude DD.dddd
|
||||||
|
#[arg(short = 'y', long, allow_negative_numbers = true)]
|
||||||
|
my_lat: Option<f64>,
|
||||||
|
|
||||||
|
/// Spotter longitude DD.dddd
|
||||||
|
#[arg(short = 'x', long, allow_negative_numbers = true)]
|
||||||
|
my_lon: Option<f64>,
|
||||||
|
|
||||||
|
/// Filter out spots from these callsign-UUID combinations (self spots, for example), comma-separated
|
||||||
|
#[arg(short = 't', long, value_delimiter = ',', num_args = 1..,)]
|
||||||
|
filter: Vec<String>,
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Convert a byte slice into a hex-dump string for debugging purposes.
|
/// Convert a byte slice into a hex-dump string for debugging purposes.
|
||||||
@@ -338,7 +382,7 @@ impl BufferManager {
|
|||||||
/// - Filters out frames destined for "NODES" and frames with an XID payload.
|
/// - Filters out frames destined for "NODES" and frames with an XID payload.
|
||||||
/// - Optionally filters to only UI frames if requested.
|
/// - Optionally filters to only UI frames if requested.
|
||||||
/// - Buffers multi-line frames and prints a formatted session line.
|
/// - Buffers multi-line frames and prints a formatted session line.
|
||||||
fn handle_frame(frame: &AgwFrame, cli: &Cli, buffers: &mut BufferManager) {
|
fn handle_frame(frame: &AgwFrame, cli: &Cli, buffers: &mut BufferManager, loc_store: &mut HashMap<String, Vec<String>>) {
|
||||||
let hdr = &frame.header;
|
let hdr = &frame.header;
|
||||||
// Process only frames on the specified channel.
|
// Process only frames on the specified channel.
|
||||||
if hdr.port != cli.channel as i32 {
|
if hdr.port != cli.channel as i32 {
|
||||||
@@ -347,6 +391,33 @@ fn handle_frame(frame: &AgwFrame, cli: &Cli, buffers: &mut BufferManager) {
|
|||||||
let source = hdr.callfrom_str();
|
let source = hdr.callfrom_str();
|
||||||
let basic_destination = hdr.callto_str();
|
let basic_destination = hdr.callto_str();
|
||||||
let timestamp = Local::now().format("%H:%M:%S").to_string();
|
let timestamp = Local::now().format("%H:%M:%S").to_string();
|
||||||
|
let my_call = &cli.my_call;
|
||||||
|
let freq = &cli.freq;
|
||||||
|
let my_lat = &cli.my_lat;
|
||||||
|
let my_lon = &cli.my_lon;
|
||||||
|
|
||||||
|
// Split callsign and SSID if there are both
|
||||||
|
let (source_call, source_ssid): (&String, Option<&String>) = if source.contains("-") {
|
||||||
|
let re_source = Regex::new(r"(?P<call>.*)-(?P<ssid>[\d])").unwrap();
|
||||||
|
// Break captures into named values
|
||||||
|
let callssid = re_source.captures(&source).unwrap();
|
||||||
|
|
||||||
|
(&callssid["call"].to_string(), Some(&callssid["ssid"].to_string()))
|
||||||
|
// Otherwise there is just the call and no SSID
|
||||||
|
} else {
|
||||||
|
(&source, None)
|
||||||
|
//(&source, &String::new())
|
||||||
|
};
|
||||||
|
//println!("{:?}",(source_call, source_ssid));
|
||||||
|
|
||||||
|
|
||||||
|
//println!("{} - {}", source_call, source_ssid);
|
||||||
|
|
||||||
|
// If user provides an alternate Spothole URL, use that one
|
||||||
|
let spothole_url = match &cli.spothole_alt {
|
||||||
|
Some(spothole_alt) => spothole_alt,
|
||||||
|
None => &"https://spothole.app/api/v1/spot".to_string(),
|
||||||
|
};
|
||||||
|
|
||||||
// Filter and compute the text from the payload only once.
|
// Filter and compute the text from the payload only once.
|
||||||
let text = filter_text(&frame.payload);
|
let text = filter_text(&frame.payload);
|
||||||
@@ -393,6 +464,139 @@ fn handle_frame(frame: &AgwFrame, cli: &Cli, buffers: &mut BufferManager) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Extract location from APRS format
|
||||||
|
let (lat, lon) = aprs_loc(&text);
|
||||||
|
|
||||||
|
// Store the location
|
||||||
|
// Only update location store if there is a real location
|
||||||
|
if lat > -9999.0_f64 && lon > -9999.0_f64 {
|
||||||
|
let loc = vec![lat.to_string(), lon.to_string()];
|
||||||
|
loc_store.insert(source.clone(), loc);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Look up a stored location
|
||||||
|
// If it doesn't exist, set to empty
|
||||||
|
let stored_loc = match loc_store.get(&source) {
|
||||||
|
Some(loc_value) => loc_value,
|
||||||
|
None => &vec!["".to_string(), "".to_string()],
|
||||||
|
};
|
||||||
|
|
||||||
|
// Only send good locations on
|
||||||
|
let json_lat = stored_loc[0].clone() ;
|
||||||
|
let json_lon = stored_loc[1].clone() ;
|
||||||
|
|
||||||
|
//println!("Stored location: {} {}", stored_loc[0].clone(), stored_loc[1].clone());
|
||||||
|
|
||||||
|
// If Spothole is enabled and this is a UI frame and the source is not filtered
|
||||||
|
if summary == "UI" && cli.spothole && !cli.filter.contains(&source){
|
||||||
|
// POST JSON
|
||||||
|
let packet = json!({
|
||||||
|
"dx_call": &source_call,
|
||||||
|
"dx_ssid": &source_ssid,
|
||||||
|
"de_call": &my_call,
|
||||||
|
"de_latitude": &my_lat,
|
||||||
|
"de_longitude": &my_lon,
|
||||||
|
"freq": &freq,
|
||||||
|
"comment": &text,
|
||||||
|
"dx_latitude": &json_lat,
|
||||||
|
"dx_longitude": &json_lon,
|
||||||
|
"mode": "PKT",
|
||||||
|
"mode_type": "DATA",
|
||||||
|
"mode_source": "SPOT",
|
||||||
|
"time": SystemTime::now().duration_since(UNIX_EPOCH).unwrap().as_secs(),
|
||||||
|
});
|
||||||
|
let client = reqwest::blocking::Client::new();
|
||||||
|
let res = client.post(spothole_url)
|
||||||
|
.json(&packet)
|
||||||
|
.send();
|
||||||
|
println!("sent to {} = {}", spothole_url, packet);
|
||||||
|
println!("res = {res:?}");
|
||||||
|
// If it's filtered, send a note about that
|
||||||
|
} else if summary == "UI" && cli.spothole && cli.filter.contains(&source) {
|
||||||
|
println!("Filter {:?} applied, not spotted", cli.filter)
|
||||||
|
}
|
||||||
|
|
||||||
|
// Send UDP
|
||||||
|
if cli.uport != 55555 {
|
||||||
|
let uaddr = format!("{}:{}", cli.uip, cli.uport);
|
||||||
|
let socket = UdpSocket::bind("0.0.0.0:0");
|
||||||
|
|
||||||
|
let packet = json!({
|
||||||
|
"final_destination": &final_destination,
|
||||||
|
"source": &source,
|
||||||
|
"spotter": &my_call,
|
||||||
|
"spotter_latitude": &my_lat,
|
||||||
|
"spotter_longitude": &my_lon,
|
||||||
|
"summary": &summary,
|
||||||
|
"text": &text,
|
||||||
|
"dx_latitude": &json_lat,
|
||||||
|
"dx_longitude": &json_lon,
|
||||||
|
"freq": &freq,
|
||||||
|
"timestamp": SystemTime::now().duration_since(UNIX_EPOCH).unwrap().as_secs(),
|
||||||
|
"type": "data"
|
||||||
|
});
|
||||||
|
let _ = socket.expect("REASON").send_to(packet.to_string().as_bytes(), uaddr);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
fn aprs_loc(packet: &str) -> (f64, f64) {
|
||||||
|
// Capture different pieces of the location string
|
||||||
|
let re_loc = Regex::new(r"(?P<latd>\d{2})(?P<latm>[\d ]{2}\.[\d ]{2})(?P<ns>[nsNS])/(?P<lond>\d{3})(?P<lonm>[\d ]{2}\.[\d ]{2})(?P<ew>[ewEW])").unwrap();
|
||||||
|
|
||||||
|
// Check for 3rd party traffic, which may include location
|
||||||
|
let re_3p = Regex::new(r"(?<tcpip>TCPIP)").unwrap();
|
||||||
|
let mut loc3p: bool = false;
|
||||||
|
if re_3p.is_match(&packet) {
|
||||||
|
loc3p = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Only proceed if there were captures
|
||||||
|
match re_loc.captures(&packet) {
|
||||||
|
Some(_caps) => {
|
||||||
|
|
||||||
|
// Break captures into named values
|
||||||
|
let loc = re_loc.captures(&packet).unwrap();
|
||||||
|
|
||||||
|
// Initiate randomness for ambiguity..
|
||||||
|
let mut rng = rand::rng();
|
||||||
|
|
||||||
|
// Convert to decimal degrees. If ambiguity spaces are included (see APRS spec), replace them with random digits.
|
||||||
|
let mut lat_dec: f64 = &loc["latd"].trim().parse().expect("Expects a number!") + (&loc["latm"].replace(" ", &rng.random_range(0..9).to_string()).trim().parse().expect("Expects a number!") / 60.0);
|
||||||
|
// If south, make negative
|
||||||
|
if &loc["ns"] == "S" {
|
||||||
|
lat_dec = lat_dec * -1.0
|
||||||
|
}
|
||||||
|
|
||||||
|
// TODO if there are spaces in loc["latm"], the same spaces need to be in loc["lonm"] for proper ambiguity according to APRS spec
|
||||||
|
|
||||||
|
let mut lon_dec: f64 = &loc["lond"].trim().parse().expect("Expects a number!") + (&loc["lonm"].replace(" ", &rng.random_range(0..9).to_string()).trim().parse().expect("Expects a number!") / 60.0);
|
||||||
|
// If west, make negative
|
||||||
|
if &loc["ew"] == "W" {
|
||||||
|
lon_dec = lon_dec * -1.0
|
||||||
|
}
|
||||||
|
|
||||||
|
// String to paste into map for testing
|
||||||
|
//println!("{}, {}", lat_dec, lon_dec);
|
||||||
|
|
||||||
|
// But if after all that, it's a 3rd-party location, toss it
|
||||||
|
// This is the only capture group we ID by numberf
|
||||||
|
if loc3p == true {
|
||||||
|
(lat_dec, lon_dec) = (-9999.0_f64, -9999.0_f64);
|
||||||
|
println!("Dropping location, looks like 3rd party");
|
||||||
|
}
|
||||||
|
|
||||||
|
// Return
|
||||||
|
(lat_dec, lon_dec)
|
||||||
|
|
||||||
|
}
|
||||||
|
// Otherwise if there were no captures, return bad data
|
||||||
|
None => {
|
||||||
|
// The regex did not match. Deal with it here!
|
||||||
|
(-9999.0_f64, -9999.0_f64)
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Main entry point:
|
/// Main entry point:
|
||||||
@@ -403,7 +607,26 @@ fn handle_frame(frame: &AgwFrame, cli: &Cli, buffers: &mut BufferManager) {
|
|||||||
fn main() -> Result<()> {
|
fn main() -> Result<()> {
|
||||||
let cli = Cli::parse();
|
let cli = Cli::parse();
|
||||||
let addr = format!("{}:{}", cli.ip, cli.port);
|
let addr = format!("{}:{}", cli.ip, cli.port);
|
||||||
|
let uaddr = format!("{}:{}", cli.uip, cli.uport);
|
||||||
let reconnect_delay_ms = 5000;
|
let reconnect_delay_ms = 5000;
|
||||||
|
|
||||||
|
// Set up the location store
|
||||||
|
//let mut loc_store = HashMap:: new();
|
||||||
|
let mut loc_store: HashMap<String, Vec<String>> = HashMap::new();
|
||||||
|
|
||||||
|
if cli.uport != 55555 {
|
||||||
|
// Bind the client socket to any available address and port
|
||||||
|
let socket = UdpSocket::bind("0.0.0.0:0")?;
|
||||||
|
println!("UDP client started at {}:{}", cli.uip, cli.uport);
|
||||||
|
// Send a message to the server
|
||||||
|
let packet = json!({
|
||||||
|
"text": "UDP client connected",
|
||||||
|
"timestamp": SystemTime::now().duration_since(UNIX_EPOCH).unwrap().as_secs(),
|
||||||
|
"type": "status"
|
||||||
|
});
|
||||||
|
//let message = "UDP client connected";
|
||||||
|
socket.send_to(packet.to_string().as_bytes(), uaddr)?;
|
||||||
|
}
|
||||||
|
|
||||||
loop {
|
loop {
|
||||||
println!("Connecting to AGWPE server at {addr}");
|
println!("Connecting to AGWPE server at {addr}");
|
||||||
@@ -438,7 +661,7 @@ fn main() -> Result<()> {
|
|||||||
while buffer.len() >= 36 {
|
while buffer.len() >= 36 {
|
||||||
match parse_frame(&buffer, cli.debug) {
|
match parse_frame(&buffer, cli.debug) {
|
||||||
Ok((consumed, frame)) => {
|
Ok((consumed, frame)) => {
|
||||||
handle_frame(&frame, &cli, &mut buffers);
|
handle_frame(&frame, &cli, &mut buffers, &mut loc_store);
|
||||||
// Remove the processed frame from the buffer.
|
// Remove the processed frame from the buffer.
|
||||||
buffer.drain(0..consumed);
|
buffer.drain(0..consumed);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user