(host: str)
| 14 | |
| 15 | |
| 16 | def _is_trusted_proxy(host: str) -> bool: |
| 17 | try: |
| 18 | remote_addr = ip_address(host) |
| 19 | except ValueError: |
| 20 | return False |
| 21 | |
| 22 | for proxy in _iter_trusted_proxies(): |
| 23 | try: |
| 24 | if remote_addr in ip_network(proxy, strict=False): |
| 25 | return True |
| 26 | except ValueError: |
| 27 | continue |
| 28 | return False |
| 29 | |
| 30 | |
| 31 | def _get_forwarded_for_ip(header_value: str, fallback_ip: str) -> str: |
no test coverage detected