-
Notifications
You must be signed in to change notification settings - Fork 3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat: impl dns.getServers
#3982
Conversation
nice |
993414d
to
47d9204
Compare
47d9204
to
663aeb6
Compare
function parseResolvConf() { | ||
let servers = []; | ||
try { | ||
const content = fs.readFileSync("/etc/resolv.conf", "utf-8"); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this test will only work on linux
can use test.skipIf(process.platform === “darwin”)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you. This looks good. Let’s let the tests run.
Only part I’m not sure about is the buffer length. If any of the numbers are not 100% correct in all the cases it could cause a crash or undefined behavior and it’d be hard to reproduce.
Assuming the current length isn’t huge (like 64 bytes probably), I suggest adding an extra 512 bytes to it just for wiggle room
About the buffer length, I checked the source code of And https://github.com/ziglang/zig/blob/fc6e5756848cd627b69756853937ce22500e62cc/lib/std/fmt.zig#L1996 |
👍 |
* feat: impl `dns.getServers` Close: oven-sh#3981 * check return value of `ares_inet_ntop`
Close: #3981
What does this PR do?
dns.getServers
functionReference:
How did you verify your code works?
I wrote automated tests
I ran
make js
and committed the transpiled changesI or my editor ran Prettier on the changed files (or I ran
bun fmt
)I included a test for the new code, or an existing test covers it
I checked the lifetime of memory allocated to verify it's (1) freed and (2) only freed when it should be
I or my editor ran
zig fmt
on the changed filesI included a test for the new code, or an existing test covers it
JSValue used outside outside of the stack is either wrapped in a JSC.Strong or is JSValueProtect'ed