MCPcopy
hub / github.com/mitmproxy/mitmproxy / name_servers

Method name_servers

mitmproxy/addons/dns_resolver.py:42–57  ·  view source on GitHub ↗

Returns the operating system's name servers unless custom name servers are set. On error, an empty list is returned.

(self)

Source from the content-addressed store, hash-verified

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:

Callers 3

test_name_serversFunction · 0.95
resolverMethod · 0.95
dns_requestMethod · 0.95

Calls

no outgoing calls

Tested by 1

test_name_serversFunction · 0.76