Filter out current host from Tailscale peer list
All checks were successful
Build and Release / build-and-release (push) Successful in 1m50s
All checks were successful
Build and Release / build-and-release (push) Successful in 1m50s
Skip the first line in tailscale status output which is always the current host showing as idle. Add additional hostname check to prevent showing the current host in the peer list. Only display actual remote peers with their connection methods.
This commit is contained in:
parent
8da4522d85
commit
3c278351c9
6
Cargo.lock
generated
6
Cargo.lock
generated
@ -279,7 +279,7 @@ checksum = "a1d728cc89cf3aee9ff92b05e62b19ee65a02b5702cff7d5a377e32c6ae29d8d"
|
||||
|
||||
[[package]]
|
||||
name = "cm-dashboard"
|
||||
version = "0.1.263"
|
||||
version = "0.1.264"
|
||||
dependencies = [
|
||||
"anyhow",
|
||||
"chrono",
|
||||
@ -301,7 +301,7 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "cm-dashboard-agent"
|
||||
version = "0.1.263"
|
||||
version = "0.1.264"
|
||||
dependencies = [
|
||||
"anyhow",
|
||||
"async-trait",
|
||||
@ -325,7 +325,7 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "cm-dashboard-shared"
|
||||
version = "0.1.263"
|
||||
version = "0.1.264"
|
||||
dependencies = [
|
||||
"chrono",
|
||||
"serde",
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
[package]
|
||||
name = "cm-dashboard-agent"
|
||||
version = "0.1.264"
|
||||
version = "0.1.265"
|
||||
edition = "2021"
|
||||
|
||||
[dependencies]
|
||||
|
||||
@ -948,10 +948,20 @@ impl SystemdCollector {
|
||||
let status_output = String::from_utf8_lossy(&output.stdout);
|
||||
let mut peers = Vec::new();
|
||||
|
||||
// Get current hostname to filter it out
|
||||
let current_hostname = gethostname::gethostname()
|
||||
.to_string_lossy()
|
||||
.to_string();
|
||||
|
||||
// Parse tailscale status output
|
||||
// Format: IP hostname user os status
|
||||
// Example: 100.110.98.3 wslbox cm@ linux active; direct 192.168.30.227:53757
|
||||
for line in status_output.lines() {
|
||||
// Note: First line is always the current host, skip it
|
||||
for (idx, line) in status_output.lines().enumerate() {
|
||||
if idx == 0 {
|
||||
continue; // Skip first line (current host)
|
||||
}
|
||||
|
||||
let parts: Vec<&str> = line.split_whitespace().collect();
|
||||
if parts.len() < 5 {
|
||||
continue; // Skip invalid lines
|
||||
@ -964,6 +974,12 @@ impl SystemdCollector {
|
||||
// parts[4+] = status (e.g., "active;", "direct", "192.168.30.227:53757" or "idle;" or "offline")
|
||||
|
||||
let hostname = parts[1];
|
||||
|
||||
// Skip if this is the current host (double-check in case format changes)
|
||||
if hostname == current_hostname {
|
||||
continue;
|
||||
}
|
||||
|
||||
let status_parts = &parts[4..];
|
||||
|
||||
// Determine connection method from status
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
[package]
|
||||
name = "cm-dashboard"
|
||||
version = "0.1.264"
|
||||
version = "0.1.265"
|
||||
edition = "2021"
|
||||
|
||||
[dependencies]
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
[package]
|
||||
name = "cm-dashboard-shared"
|
||||
version = "0.1.264"
|
||||
version = "0.1.265"
|
||||
edition = "2021"
|
||||
|
||||
[dependencies]
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user