DNS stub resolver.
| 1241 | |
| 1242 | |
| 1243 | class Resolver(BaseResolver): |
| 1244 | """DNS stub resolver.""" |
| 1245 | |
| 1246 | def resolve( |
| 1247 | self, |
| 1248 | qname: dns.name.Name | str, |
| 1249 | rdtype: dns.rdatatype.RdataType | str = dns.rdatatype.A, |
| 1250 | rdclass: dns.rdataclass.RdataClass | str = dns.rdataclass.IN, |
| 1251 | tcp: bool = False, |
| 1252 | source: str | None = None, |
| 1253 | raise_on_no_answer: bool = True, |
| 1254 | source_port: int = 0, |
| 1255 | lifetime: float | None = None, |
| 1256 | search: bool | None = None, |
| 1257 | ) -> Answer: # pylint: disable=arguments-differ |
| 1258 | """Query nameservers to find the answer to the question. |
| 1259 | |
| 1260 | The *qname*, *rdtype*, and *rdclass* parameters may be objects |
| 1261 | of the appropriate type, or strings that can be converted into objects |
| 1262 | of the appropriate type. |
| 1263 | |
| 1264 | *qname*, a ``dns.name.Name`` or ``str``, the query name. |
| 1265 | |
| 1266 | *rdtype*, an ``int`` or ``str``, the query type. |
| 1267 | |
| 1268 | *rdclass*, an ``int`` or ``str``, the query class. |
| 1269 | |
| 1270 | *tcp*, a ``bool``. If ``True``, use TCP to make the query. |
| 1271 | |
| 1272 | *source*, a ``str`` or ``None``. If not ``None``, bind to this IP |
| 1273 | address when making queries. |
| 1274 | |
| 1275 | *raise_on_no_answer*, a ``bool``. If ``True``, raise |
| 1276 | ``dns.resolver.NoAnswer`` if there's no answer to the question. |
| 1277 | |
| 1278 | *source_port*, an ``int``, the port from which to send the message. |
| 1279 | |
| 1280 | *lifetime*, a ``float``, how many seconds a query should run |
| 1281 | before timing out. |
| 1282 | |
| 1283 | *search*, a ``bool`` or ``None``, determines whether the |
| 1284 | search list configured in the system's resolver configuration |
| 1285 | are used for relative names, and whether the resolver's domain |
| 1286 | may be added to relative names. The default is ``None``, |
| 1287 | which causes the value of the resolver's |
| 1288 | ``use_search_by_default`` attribute to be used. |
| 1289 | |
| 1290 | Raises ``dns.resolver.LifetimeTimeout`` if no answers could be found |
| 1291 | in the specified lifetime. |
| 1292 | |
| 1293 | Raises ``dns.resolver.NXDOMAIN`` if the query name does not exist. |
| 1294 | |
| 1295 | Raises ``dns.resolver.YXDOMAIN`` if the query name is too long after |
| 1296 | DNAME substitution. |
| 1297 | |
| 1298 | Raises ``dns.resolver.NoAnswer`` if *raise_on_no_answer* is |
| 1299 | ``True`` and the query name exists but has no RRset of the |
| 1300 | desired type and class. |
no outgoing calls
no test coverage detected
searching dependent graphs…