feat: resolve .numa services to LAN IP for remote clients #23
13
src/main.rs
13
src/main.rs
@@ -208,8 +208,6 @@ async fn main() -> numa::Result<()> {
|
|||||||
});
|
});
|
||||||
|
|
||||||
let zone_count: usize = ctx.zone_map.values().map(|m| m.len()).sum();
|
let zone_count: usize = ctx.zone_map.values().map(|m| m.len()).sum();
|
||||||
let dns_is_public = config.server.bind_addr.starts_with("0.0.0.0");
|
|
||||||
|
|
||||||
// Build banner rows, then size the box to fit the longest value
|
// Build banner rows, then size the box to fit the longest value
|
||||||
let api_url = format!("http://localhost:{}", api_port);
|
let api_url = format!("http://localhost:{}", api_port);
|
||||||
let proxy_label = if config.proxy.enabled {
|
let proxy_label = if config.proxy.enabled {
|
||||||
@@ -309,7 +307,7 @@ async fn main() -> numa::Result<()> {
|
|||||||
);
|
);
|
||||||
if let Some(ref label) = proxy_label {
|
if let Some(ref label) = proxy_label {
|
||||||
row("Proxy", g, label);
|
row("Proxy", g, label);
|
||||||
if !config.lan.enabled && !dns_is_public && config.proxy.bind_addr == "127.0.0.1" {
|
if config.proxy.bind_addr == "127.0.0.1" {
|
||||||
let y = "\x1b[38;2;204;176;59m"; // yellow
|
let y = "\x1b[38;2;204;176;59m"; // yellow
|
||||||
row(
|
row(
|
||||||
"",
|
"",
|
||||||
@@ -387,16 +385,11 @@ async fn main() -> numa::Result<()> {
|
|||||||
axum::serve(listener, app).await.unwrap();
|
axum::serve(listener, app).await.unwrap();
|
||||||
});
|
});
|
||||||
|
|
||||||
// Proxy binds 0.0.0.0 when LAN is enabled or DNS is already on 0.0.0.0 (cross-machine access)
|
let proxy_bind: std::net::Ipv4Addr = config
|
||||||
let proxy_bind: std::net::Ipv4Addr = if config.lan.enabled || dns_is_public {
|
|
||||||
std::net::Ipv4Addr::UNSPECIFIED
|
|
||||||
} else {
|
|
||||||
config
|
|
||||||
.proxy
|
.proxy
|
||||||
.bind_addr
|
.bind_addr
|
||||||
.parse()
|
.parse()
|
||||||
.unwrap_or(std::net::Ipv4Addr::LOCALHOST)
|
.unwrap_or(std::net::Ipv4Addr::LOCALHOST);
|
||||||
};
|
|
||||||
|
|
||||||
// Spawn HTTP reverse proxy for .numa domains
|
// Spawn HTTP reverse proxy for .numa domains
|
||||||
if config.proxy.enabled {
|
if config.proxy.enabled {
|
||||||
|
|||||||
Reference in New Issue
Block a user