Files
coa-server-manager/crates/coa-core/examples/net_check.rs
T
ДмитрийandClaude Sonnet 5.5 1609c4f6bf Phase 9: Play with Friends (LAN/direct/private modes, exposure check, firewall rules, UPnP discovery, friend package, realm address reapplied after start)
Verified read-only on the live server: database and console listen on loopback only; login/world are loopback until
the owner enables sharing. Elevation and router changes only happen on explicit action.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
2026-09-30 10:54:18 +05:00

15 lines
741 B
Rust

fn main() {
let root = std::env::args().nth(1).expect("server folder");
let ports = coa_core::layout::read_ports(std::path::Path::new(&root));
println!("LAN address: {:?}", coa_core::net::lan_ip());
for e in coa_core::net::exposure(&ports) {
println!("{:<14} port {:<5} listening={} reachable_from_network={}", e.what, e.port, e.listening, e.reachable_from_network);
}
println!("{:?}", coa_core::net::tailscale());
println!("firewall rules: {:?}", coa_core::firewall::status());
match coa_core::upnp::discover() {
Some(gw) => println!("UPnP router: {} -> outside address {:?}", gw.control_url, coa_core::upnp::external_ip(&gw)),
None => println!("UPnP router: none answered"),
}
}