-
Notifications
You must be signed in to change notification settings - Fork 1.5k
Description
This issue proposes exposing k6's internal DNS resolver to extensions, allowing them to benefit from the same DNS configurations as the core k6 modules.
Background
k6 provides a powerful and configurable DNS resolver that supports features like hosts overrides, custom DNS servers, and respecting DNS TTLs. This ensures consistent and controlled name resolution across all test scenarios. However, extensions that perform their own DNS lookups do not have access to this core resolver. This leads to inconsistent behavior, potential security issues (e.g., DNS hijacking), and a poor user experience as extension behavior may not match the k6 script's options.
Proposed Solution
Expose the core k6 DNS resolver as a publicly available Go API that extensions can use. This would allow extensions to perform DNS lookups that respect the user's k6 options, including:
hostsoption: Honor any host overrides specified in the k6 script'soptions.hostsconfiguration.- Custom DNS servers: Use the DNS server configured in
options.dns. - DNS caching: Benefit from k6's built-in DNS caching logic, which respects record TTLs.
By providing a unified DNS resolver API, we can ensure that all k6 extensions, regardless of their function, perform name resolution consistently and securely according to the user's test configuration. This will simplify extension development and improve the reliability of k6 tests.