mirror of
https://gitea.farpn.net/w1cdn/mwtchahrd.git
synced 2025-12-10 06:28:02 -06:00
Compare commits
11 Commits
875da10174
...
0.1.1
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
ca858bc038 | ||
|
|
fd641c1ca1 | ||
|
|
05a6bb18b0 | ||
|
|
85521543c6 | ||
|
|
6bbfa66c4f | ||
|
|
d95cf3e368 | ||
|
|
20fda492a5 | ||
|
|
97e955156d | ||
|
|
c60723b0a5 | ||
|
|
780c4b5884 | ||
|
|
07c57e85a8 |
2
.gitignore
vendored
2
.gitignore
vendored
@@ -6,7 +6,7 @@ target/
|
||||
|
||||
# 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
|
||||
Cargo.lock
|
||||
#Cargo.lock
|
||||
|
||||
#Cross config
|
||||
Cross.toml
|
||||
|
||||
1882
Cargo.lock
generated
Normal file
1882
Cargo.lock
generated
Normal file
File diff suppressed because it is too large
Load Diff
@@ -1,13 +1,15 @@
|
||||
[package]
|
||||
name = "mwtchahrd"
|
||||
version = "0.1.0"
|
||||
version = "0.1.1"
|
||||
edition = "2021"
|
||||
authors = ["Chris, N6CTA <mail@n6cta.com>"]
|
||||
authors = ["Chris, N6CTA <mail@n6cta.com>", "Matt, W1CDN <admin@w1cdn.net>"]
|
||||
|
||||
[dependencies]
|
||||
anyhow = "1.0"
|
||||
chrono = "0.4"
|
||||
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"] }
|
||||
@@ -16,3 +18,4 @@ socket2 = "0.5"
|
||||
|
||||
[profile.release]
|
||||
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"
|
||||
13
README.md
13
README.md
@@ -75,6 +75,15 @@ mwtchahrd -i <IP> -p <PORT> [-c <CHANNEL>] [-d] [-u]
|
||||
- `-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.
|
||||
|
||||
@@ -109,10 +118,10 @@ 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:
|
||||
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
|
||||
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
|
||||
|
||||
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;
|
||||
27
src/main.rs
27
src/main.rs
@@ -83,10 +83,14 @@ struct Cli {
|
||||
#[arg(short = 'y', long, allow_negative_numbers = true)]
|
||||
my_lat: Option<f64>,
|
||||
|
||||
/// Spotter longitude DD.dddd; to send negaitve (W or S), use = e.g. --my-lon=-97.1
|
||||
/// 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.
|
||||
@@ -484,8 +488,8 @@ fn handle_frame(frame: &AgwFrame, cli: &Cli, buffers: &mut BufferManager, loc_st
|
||||
|
||||
//println!("Stored location: {} {}", stored_loc[0].clone(), stored_loc[1].clone());
|
||||
|
||||
// If Spothole is enabled
|
||||
if summary == "UI" && cli.spothole {
|
||||
// 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,
|
||||
@@ -508,6 +512,9 @@ fn handle_frame(frame: &AgwFrame, cli: &Cli, buffers: &mut BufferManager, loc_st
|
||||
.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
|
||||
@@ -538,6 +545,13 @@ 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) => {
|
||||
@@ -566,6 +580,13 @@ fn aprs_loc(packet: &str) -> (f64, f64) {
|
||||
// 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)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user