Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
40 commits
Select commit Hold shift + click to select a range
9521419
Remove c-ares from the build
claude Oct 27, 2026
03b3107
Add bun_dns_resolver, a DNS stub resolver in safe Rust
claude Oct 27, 2026
5404cd7
Move node:dns and Bun.dns onto bun_dns_resolver
claude Oct 27, 2026
50ffa3c
dns_resolver: drop the dead_code allowance
claude Oct 27, 2026
4711cbb
Update comments that spoke of c-ares
claude Oct 27, 2026
e82b78e
Rename cares_jsc to dns_resolver_jsc
claude Oct 27, 2026
7a28c6f
dns: report a poll error to the resolver, and start tests against a l…
claude Oct 27, 2026
c28d338
Test node:dns resolvers against a scripted local server
claude Oct 27, 2026
ae2e559
Test Bun.dns.lookup's search list against a local server
claude Oct 27, 2026
aaebf1b
docs: the c-ares backend is Bun's own resolver now
claude Oct 27, 2026
cb7e030
Merge remote-tracking branch 'origin/main' into claude/c-ares-rust-re…
claude Oct 27, 2026
b1f76f8
dns_resolver: platform settings as data, and a scripted simulation
claude Oct 27, 2026
db67f9d
dns_resolver: fixes from review, and tests that run it in a simulated…
claude Oct 27, 2026
7fbaa46
dns: link iphlpapi on Windows, fix lints, and match c-ares more closely
claude Oct 27, 2026
fc947f0
dns_resolver: one copy of the channel, and a second round against c-ares
claude Oct 27, 2026
a6943be
dns_resolver: compare with logs of c-ares, and two scans that were qu…
claude Oct 27, 2026
e7236b1
test: the driver that the logs of c-ares came from
claude Oct 27, 2026
c2c1e37
dns: fix bugs c-ares fixed after 1.34.9 or lost again, and rename and…
claude Oct 27, 2026
e25c1b0
[autofix.ci] apply automated fixes
autofix-ci[bot] Oct 27, 2026
a85fd3b
dns: golden scripts for `etc`, `readable` and CNAME answers
claude Oct 27, 2026
f8d00dc
test: one reader for the logs of c-ares, which now say what they are
claude Oct 27, 2026
f437ce9
test: drop a DNS test that waited two seconds, and do not count a que…
claude Oct 27, 2026
7eea207
dns: import what dns_sd.rs uses in dns_sd.rs
claude Oct 27, 2026
4929f07
dns_resolver: the cache passes on that a response cannot be written
claude Oct 27, 2026
648bb68
dns_resolver: what a second review found
claude Oct 27, 2026
5987b6c
test: DNS tests say what they assert, and assert it
claude Oct 27, 2026
fd841cb
test: 83 more scripts compared with c-ares
claude Oct 27, 2026
0dd6940
Merge branch 'main' into claude/c-ares-rust-replacement-xrtz9k
claude Oct 28, 2026
3ffb48b
dns: --trim leaves the resolver out of programs that do not use it
claude Oct 28, 2026
857f19e
dns: test that an empty RES_OPTIONS leaves the configuration alone
claude Oct 28, 2026
5566a14
Merge branch 'main' into claude/c-ares-rust-replacement-xrtz9k
claude Oct 28, 2026
711b3cb
Merge branch 'main' into claude/c-ares-rust-replacement-xrtz9k
claude Oct 29, 2026
6bd18b4
Merge branch 'main' into claude/c-ares-rust-replacement-xrtz9k
claude Oct 29, 2026
cc4be3b
aot: update an IR test for the numbers this branch gives the built-ins
claude Oct 29, 2026
0b8f26c
Merge branch 'main' into claude/c-ares-rust-replacement-xrtz9k
claude Oct 29, 2026
718e06b
test: send a request again when the server never saw it, in two AOT n…
claude Oct 29, 2026
949031e
Merge branch 'main' into claude/c-ares-rust-replacement-xrtz9k
claude Oct 29, 2026
b3e456b
Merge branch 'main' into claude/c-ares-rust-replacement-xrtz9k
claude Nov 6, 2026
2ad55e6
Merge branch 'main' into claude/c-ares-rust-replacement-xrtz9k
claude Nov 10, 2026
5f5d5c6
test: sweep the environment variables that the resolver reads
claude Nov 10, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ test/aot/parallel/the-head-of-the-text-of-a-function-is-laid-as-bun-prints-it/**
# Compared line by line with what a runner prints, which ends a line with \n on every system.
test/cli/format/*/expected.txt text eol=lf
test/cli/lint/conformance/expected*.txt text eol=lf
test/js/node/dns/dns-simulation-c-ares.txt text eol=lf
# Embedded in the executable, which splits them at \n.
src/lint/linter/config/presets.txt text eol=lf
src/lint/linter/deprecated.txt text eol=lf
Expand Down
106 changes: 0 additions & 106 deletions .github/workflows/update-cares.yml

This file was deleted.

2 changes: 1 addition & 1 deletion CLAUDE.md
Original file line number Diff line number Diff line change
Expand Up @@ -147,7 +147,7 @@ The Rust side is a Cargo workspace of ~200 crates rooted at `Cargo.toml`. The ke

#### Vendored Dependencies (`vendor/`)

Third-party native libraries are vendored locally and can be read from disk (not git submodules): boringssl (TLS/crypto), brotli, cares (async DNS), highway (SIMD), libdeflate, libuv (Windows event loop), lolhtml (HTML rewriter), lshpack (HTTP/2 HPACK), lsqpack + lsquic (HTTP/3), mimalloc (allocator), nodejs (headers), picohttpparser, rust-argon2 (argon2 for `Bun.password`, Rust), tinycc (FFI JIT, fork: oven-sh/tinycc), WebKit (JavaScriptCore), zlib (zlib-ng), zstd. Build configuration for these is in `scripts/build/deps/*.ts`.
Third-party native libraries are vendored locally and can be read from disk (not git submodules): boringssl (TLS/crypto), brotli, highway (SIMD), libdeflate, libuv (Windows event loop), lolhtml (HTML rewriter), lshpack (HTTP/2 HPACK), lsqpack + lsquic (HTTP/3), mimalloc (allocator), nodejs (headers), picohttpparser, rust-argon2 (argon2 for `Bun.password`, Rust), tinycc (FFI JIT, fork: oven-sh/tinycc), WebKit (JavaScriptCore), zlib (zlib-ng), zstd. Build configuration for these is in `scripts/build/deps/*.ts`.

### JavaScript Class Implementation (C++)

Expand Down
28 changes: 12 additions & 16 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
"src/bundler",
"src/collections",
"src/css",
"src/errno",

Check warning on line 11 in Cargo.toml

View workflow job for this annotation

GitHub Actions / lol-html cargo test

explicit `package.readme` can be inferred
"src/glob",
"src/http",
"src/install",
Expand Down Expand Up @@ -53,13 +53,13 @@
"src/threading",
"src/valkey",
"src/watcher",
"src/cares_sys",
"src/clap",
"src/clap_macros",
"src/crash_handler",
"src/csrf",
"src/css_jsc",
"src/dns",
"src/dns_resolver",
"src/dotenv",
"src/event_loop",
"src/executable",
Expand Down Expand Up @@ -434,13 +434,13 @@
bun_threading = { path = "src/threading" }
bun_valkey = { path = "src/valkey" }
bun_watcher = { path = "src/watcher" }
bun_cares_sys = { path = "src/cares_sys" }
bun_clap = { path = "src/clap" }
bun_clap_macros = { path = "src/clap_macros" }
bun_crash_handler = { path = "src/crash_handler" }
bun_csrf = { path = "src/csrf" }
bun_css_jsc = { path = "src/css_jsc" }
bun_dns = { path = "src/dns" }
bun_dns_resolver = { path = "src/dns_resolver" }
bun_dotenv = { path = "src/dotenv" }
bun_event_loop = { path = "src/event_loop" }
bun_exe_format = { path = "src/exe_format" }
Expand Down
2 changes: 1 addition & 1 deletion LICENSE.md
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ Bun statically links these libraries:
| [`tinycc`](https://github.com/tinycc/tinycc) | LGPL v2.1 |
| [`uSockets`](https://github.com/uNetworking/uSockets) | Apache 2.0 |
| [`zlib-ng`](https://github.com/zlib-ng/zlib-ng) | zlib |
| [`c-ares`](https://github.com/c-ares/c-ares) | MIT licensed |
| [`c-ares`](https://github.com/c-ares/c-ares) (not linked: `src/dns_resolver` and `src/bun_core/ip_address.rs` are derived from parts of it) | MIT licensed |
| [`libicu`](https://github.com/unicode-org/icu) 78 | [license here](https://github.com/unicode-org/icu/blob/main/icu4c/LICENSE) |
| [`libbase64`](https://github.com/aklomp/base64/blob/master/LICENSE) | BSD 2-Clause |
| [`libuv`](https://github.com/libuv/libuv) (on Windows) | MIT |
Expand Down
2 changes: 1 addition & 1 deletion docs/project/license.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ Bun statically links these libraries:
| [`tinycc`](https://github.com/tinycc/tinycc) | LGPL v2.1 |
| [`uSockets`](https://github.com/uNetworking/uSockets) | Apache 2.0 |
| [`zlib-ng`](https://github.com/zlib-ng/zlib-ng) | zlib |
| [`c-ares`](https://github.com/c-ares/c-ares) | MIT licensed |
| [`c-ares`](https://github.com/c-ares/c-ares) (not linked: `src/dns_resolver` and `src/bun_core/ip_address.rs` are derived from parts of it) | MIT licensed |
| [`libicu`](https://github.com/unicode-org/icu) 78 | [ICU license](https://github.com/unicode-org/icu/blob/main/icu4c/LICENSE) |
| [`libbase64`](https://github.com/aklomp/base64/blob/master/LICENSE) | BSD 2-Clause |
| [`libuv`](https://github.com/libuv/libuv) (on Windows) | MIT |
Expand Down
4 changes: 2 additions & 2 deletions docs/runtime/networking/dns.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ dns.prefetch("bun.com", 443);

`Bun.dns.lookup()` accepts a `backend` option that selects the resolver implementation:

- `"c-ares"`: the [c-ares](https://c-ares.org/) asynchronous resolver. It reads `/etc/resolv.conf` directly, so it does not consult NSS modules such as `systemd-resolved`. This backend is the default for `Bun.dns.lookup()` on Linux.
- `"c-ares"`: Bun's own asynchronous resolver, which behaves like the [c-ares](https://c-ares.org/) library it replaced. It reads `/etc/resolv.conf` directly, so it does not consult NSS modules such as `systemd-resolved`. This backend is the default for `Bun.dns.lookup()` on Linux.
- `"system"`: the platform's own resolver (the non-blocking system API on macOS, `getaddrinfo` on a thread pool everywhere else). This backend is the default on macOS, Windows, and Android.
- `"getaddrinfo"` (alias `"libc"`): the POSIX `getaddrinfo(3)` function on a thread pool.

Expand All @@ -35,7 +35,7 @@ import { dns } from "bun";
const [{ address }] = await dns.lookup("example.com", { backend: "system" });
```

`node:dns.lookup()` always uses the `"system"` backend to match Node.js, whose `dns.lookup()` is documented as calling `getaddrinfo(3)`. The `node:dns.resolve*()` functions use c-ares, as they do in Node.js.
`node:dns.lookup()` always uses the `"system"` backend to match Node.js, whose `dns.lookup()` is documented as calling `getaddrinfo(3)`. The `node:dns.resolve*()` functions send DNS queries themselves with the resolver behind the `"c-ares"` backend. Node.js uses c-ares for them.

## DNS caching in Bun

Expand Down
8 changes: 3 additions & 5 deletions packages/bun-types/bun.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2549,7 +2549,7 @@ declare module "bun" {
* ## DNS resolver client
*
* Bun supports three DNS resolvers:
* - `c-ares` - Uses the c-ares library to perform DNS resolution. This is the default on Linux.
* - `c-ares` - Bun's own asynchronous resolver. It keeps the name of the c-ares library, which it replaced and whose behavior it follows. This is the default on Linux.
* - `system` - Uses the system's non-blocking DNS resolver API if available, falls back to `getaddrinfo`. This is the default on macOS and the same as `getaddrinfo` on Linux.
* - `getaddrinfo` - Uses the POSIX standard `getaddrinfo` function. Causes performance issues under concurrent loads.
*
Expand Down Expand Up @@ -2578,8 +2578,7 @@ declare module "bun" {
* The DNS resolver implementation to use
*
* Defaults to `"c-ares"` on Linux and `"system"` on macOS. This default
* may change in a future version of Bun if c-ares is not reliable
* enough.
* may change in a future version of Bun.
*
* On macOS, `system` uses the builtin macOS [non-blocking DNS
* resolution
Expand All @@ -2604,8 +2603,7 @@ declare module "bun" {
* `"system"` uses the same API underneath (except non-blocking).
*
* On Windows, libuv's non-blocking DNS resolver is used by default, and
* when specifying backends "system", "libc", or "getaddrinfo". The c-ares
* backend isn't supported on Windows.
* when specifying backends "system", "libc", or "getaddrinfo".
*/
backend?: "libc" | "c-ares" | "system" | "getaddrinfo";
},
Expand Down
1 change: 1 addition & 0 deletions scripts/build/bun.ts
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,7 @@ function systemLibs(cfg: Config): string[] {
"userenv.lib",
"dbghelp.lib",
"crypt32.lib",
"iphlpapi.lib", // libuv, and the DNS servers of the adapters
"wsock32.lib", // ws2_32 + wsock32 — wsock32 has TransmitFile (sendfile equiv)
"ws2_32.lib",
"delayimp.lib", // required for /delayload: in release
Expand Down
1 change: 0 additions & 1 deletion scripts/build/deps/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -146,7 +146,6 @@ export const mydep: Dependency = {
- **mimalloc.ts** — direct build, single unity TU compiled as C++
- **tinycc.ts** — direct build with a build-time codegen tool
- **zlib.ts** — direct build with per-source SIMD `-m` flags + `.h.in` substitution
- **cares.ts** — direct build with hand-written per-target config.h
- **boringssl.ts** — direct build with NASM assembly (win-x64) and a large gen/ manifest; `forbidUndefined` (with libuv.ts) keeps a dep that bun points at mimalloc from calling libc's allocator behind its back
- **sqlite.ts** — direct build, in-tree source (lives in `src/`, not `vendor/`)
- **libuv.ts** — `enabled: cfg => cfg.windows` for a platform-only dep
Expand Down
Loading
Loading