-
-
Notifications
You must be signed in to change notification settings - Fork 2
Cleanup: version 1.0.0, drop binaries, fix scan loop #2
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,41 @@ | ||
| name: CI | ||
|
|
||
| on: | ||
| push: | ||
| branches: [main] | ||
| pull_request: | ||
|
|
||
| jobs: | ||
| frontend: | ||
| runs-on: ubuntu-latest | ||
| steps: | ||
| - uses: actions/checkout@v4 | ||
| - uses: actions/setup-node@v4 | ||
| with: | ||
| node-version: 22 | ||
| cache: npm | ||
| - run: npm ci | ||
| - run: npm run lint | ||
| - run: npm run build | ||
|
|
||
| rust: | ||
| runs-on: ubuntu-latest | ||
| defaults: | ||
| run: | ||
| working-directory: src-tauri | ||
| steps: | ||
| - uses: actions/checkout@v4 | ||
| - uses: dtolnay/rust-toolchain@stable | ||
| - name: Install Tauri system dependencies | ||
| working-directory: . | ||
| run: | | ||
| sudo apt-get update | ||
| sudo apt-get install -y \ | ||
| libwebkit2gtk-4.1-dev \ | ||
| libgtk-3-dev \ | ||
| libayatana-appindicator3-dev \ | ||
| librsvg2-dev \ | ||
| patchelf \ | ||
| libssl-dev | ||
| - run: cargo check --locked | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. P1: The Prompt for AI agents |
||
| - run: cargo test --locked --lib | ||
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -13,14 +13,117 @@ pub struct PortStatus { | |
| pub framework: Option<String>, | ||
| } | ||
|
|
||
| fn is_skipped_iface(name: &str) -> bool { | ||
| let n = name.to_lowercase(); | ||
| const SKIP: &[&str] = &[ | ||
| "vpn", | ||
| "tun", | ||
| "tap", | ||
| "wsl", | ||
| "vethernet", | ||
| "docker", | ||
| "hyper-v", | ||
| "vbox", | ||
| "vmware", | ||
| "virtual", | ||
| "loopback", | ||
| "isatap", | ||
| "teredo", | ||
| "bluetooth", | ||
| "nordlynx", | ||
| "tailscale", | ||
| "wg0", | ||
| "wireguard", | ||
| "hamachi", | ||
| "zerotier", | ||
| "br-", | ||
| ]; | ||
| SKIP.iter().any(|s| n.contains(s)) | ||
| } | ||
|
|
||
| /// Prefer typical LAN ranges (192.168, then 10.x, then 172.16-31) and skip | ||
| /// VPN/WSL/CGNAT addresses so QR codes point at an IP phones can actually reach. | ||
| fn lan_priority(v4: std::net::Ipv4Addr) -> Option<u8> { | ||
| if v4.is_loopback() || v4.is_unspecified() || v4.is_link_local() || v4.is_multicast() { | ||
| return None; | ||
| } | ||
| let o = v4.octets(); | ||
| // CGNAT / Tailscale 100.64.0.0/10 | ||
| if o[0] == 100 && (64..=127).contains(&o[1]) { | ||
| return None; | ||
| } | ||
| if o[0] == 192 && o[1] == 168 { | ||
| Some(0) | ||
| } else if o[0] == 10 { | ||
| Some(1) | ||
| } else if o[0] == 172 && (16..=31).contains(&o[1]) { | ||
| Some(2) | ||
| } else { | ||
| None | ||
| } | ||
| } | ||
|
|
||
| #[tauri::command] | ||
| fn get_local_ip() -> Result<String, String> { | ||
| if let Ok(ifaces) = local_ip_address::list_afinet_netifas() { | ||
| let mut best: Option<(u8, String)> = None; | ||
| for (name, ip) in ifaces { | ||
| if is_skipped_iface(&name) { | ||
| continue; | ||
| } | ||
| let std::net::IpAddr::V4(v4) = ip else { | ||
| continue; | ||
| }; | ||
| let Some(prio) = lan_priority(v4) else { | ||
| continue; | ||
| }; | ||
| match &best { | ||
| None => best = Some((prio, v4.to_string())), | ||
| Some((best_prio, _)) if prio < *best_prio => { | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. P2: When multiple adapters share the same priority (e.g. Ethernet and Wi-Fi both on 192.168.x.x), the Prompt for AI agents |
||
| best = Some((prio, v4.to_string())); | ||
| } | ||
| _ => {} | ||
| } | ||
| } | ||
| if let Some((_, ip)) = best { | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. P1: When no eligible RFC1918 interface exists, this new filtered path falls back to Prompt for AI agents |
||
| return Ok(ip); | ||
| } | ||
| } | ||
|
|
||
| match local_ip_address::local_ip() { | ||
| Ok(ip) => Ok(ip.to_string()), | ||
| Err(e) => Err(format!("Failed to get local IP: {}", e)), | ||
| } | ||
| } | ||
|
|
||
| #[cfg(test)] | ||
| mod tests { | ||
| use super::*; | ||
| use std::net::Ipv4Addr; | ||
|
|
||
| #[test] | ||
| fn lan_priority_prefers_rfc1918() { | ||
| assert_eq!(lan_priority(Ipv4Addr::new(192, 168, 1, 15)), Some(0)); | ||
| assert_eq!(lan_priority(Ipv4Addr::new(10, 0, 0, 2)), Some(1)); | ||
| assert_eq!(lan_priority(Ipv4Addr::new(172, 16, 0, 1)), Some(2)); | ||
| assert_eq!(lan_priority(Ipv4Addr::new(100, 64, 0, 1)), None); | ||
| assert_eq!(lan_priority(Ipv4Addr::new(8, 8, 8, 8)), None); | ||
| assert_eq!(lan_priority(Ipv4Addr::LOCALHOST), None); | ||
| assert_eq!(lan_priority(Ipv4Addr::new(169, 254, 1, 1)), None); | ||
| } | ||
|
|
||
| #[test] | ||
| fn skips_virtual_ifaces() { | ||
| assert!(is_skipped_iface("vEthernet (WSL)")); | ||
| assert!(is_skipped_iface("NordLynx")); | ||
| assert!(is_skipped_iface("Tailscale")); | ||
| assert!(is_skipped_iface("Docker Bridge")); | ||
| assert!(!is_skipped_iface("Wi-Fi")); | ||
| assert!(!is_skipped_iface("Ethernet")); | ||
| assert!(!is_skipped_iface("en0")); | ||
| } | ||
| } | ||
|
|
||
| async fn detect_framework(url: &str) -> Option<String> { | ||
| let client = reqwest::Client::builder() | ||
| .timeout(Duration::from_secs(2)) | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
P2: The
rustjob runscargo check/cargo testonubuntu-latest, but EnvTunnel is a Windows-only Tauri app (README lists Windows + Visual Studio Build Tools as the only supported build environment and documents a known Windows link failure). Running on Linux never produces or validates the actual shipping artifact and cannot catch Windows-specific breakages such as the documentedLNK1181: legacy_stdio_definitions.libfailure, so the CI gives false confidence that the app builds. Consider running this job onwindows-latest(with the LIB workaround for the known issue) and/or adding atauri buildstep so the release binary is actually compiled in CI.Prompt for AI agents