Skip to content

Commit

Permalink
grumbles: add ipv6 loopback address
Browse files Browse the repository at this point in the history
  • Loading branch information
niklasad1 committed Apr 12, 2023
1 parent c6934d1 commit 3a0b1ec
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions client/rpc-servers/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -141,10 +141,13 @@ pub async fn start_server<M: Send + Sync + 'static>(
fn hosts_filtering(enabled: bool, addrs: &[SocketAddr]) -> AllowHosts {
if enabled {
// NOTE The listening addresses are whitelisted by default.
let mut hosts = Vec::with_capacity(addrs.len() * 2);
let mut hosts = Vec::with_capacity(addrs.len() * 3);
for addr in addrs {
hosts.push(format!("localhost:{}", addr.port()).into());
hosts.push(format!("127.0.0.1:{}", addr.port()).into());
let port = addr.port();

hosts.push(format!("localhost:{port}").into());
hosts.push(format!("127.0.0.1:{port}").into());
hosts.push(format!("[::1]:{port}").into());
}
AllowHosts::Only(hosts)
} else {
Expand Down

0 comments on commit 3a0b1ec

Please sign in to comment.