Decide whether the gateway should send a PROXY protocol header on the outbound connection to (`instance_id`, `port`). Cache hit returns the declared value. Cache miss returns `false` (no PP) — `is_port_allowed` runs first under fail-close and would have rejected the connection if the policy were truly unknown, so by the time we get here the cache is normally populated. The default-false fallback
(state: &Proxy, instance_id: &str, port: u16)
| 127 | /// cache is normally populated. The default-false fallback is conservative |
| 128 | /// because a missing PP header is safer than a forged one. |
| 129 | pub(crate) fn should_send_pp(state: &Proxy, instance_id: &str, port: u16) -> bool { |
| 130 | state |
| 131 | .lock() |
| 132 | .instance_port_policy(instance_id) |
| 133 | .and_then(|p| p.ports.get(&port)) |
| 134 | .map(|f| f.pp) |
| 135 | .unwrap_or(false) |
| 136 | } |
| 137 | |
| 138 | /// Spawn the background lazy-fetch worker. Should be called once at startup. |
| 139 | pub(crate) fn spawn_fetcher(state: Proxy, mut rx: UnboundedReceiver<String>) { |
no test coverage detected