Returns the operating system's name servers unless custom name servers are set. On error, an empty list is returned.
(self)
| 40 | |
| 41 | @cache |
| 42 | def name_servers(self) -> list[str]: |
| 43 | """ |
| 44 | Returns the operating system's name servers unless custom name servers are set. |
| 45 | On error, an empty list is returned. |
| 46 | """ |
| 47 | try: |
| 48 | return ( |
| 49 | ctx.options.dns_name_servers |
| 50 | or mitmproxy_rs.dns.get_system_dns_servers() |
| 51 | ) |
| 52 | except RuntimeError as e: |
| 53 | logger.warning( |
| 54 | f"Failed to get system dns servers: {e}\n" |
| 55 | f"The dns_name_servers option needs to be set manually." |
| 56 | ) |
| 57 | return [] |
| 58 | |
| 59 | @cache |
| 60 | def resolver(self) -> Resolver: |
no outgoing calls