aboutsummaryrefslogtreecommitdiff
path: root/core/net/dns_windows.odin
diff options
context:
space:
mode:
authorLaytan Laats <laytanlaats@hotmail.com>2026-01-11 20:07:03 +0100
committerLaytan Laats <laytanlaats@hotmail.com>2026-01-11 20:21:21 +0100
commitc10771305d91b966f7520b830c398abffe4e9e1d (patch)
tree185497758d0298c4e23f15992a0bb48a44936863 /core/net/dns_windows.odin
parenta6ec199a52ae83603921fcf948fdf45e327fd17d (diff)
net: implement OpenBSD and NetBSD support & add stubs for other targets & cleanup
Diffstat (limited to 'core/net/dns_windows.odin')
-rw-r--r--core/net/dns_windows.odin22
1 files changed, 20 insertions, 2 deletions
diff --git a/core/net/dns_windows.odin b/core/net/dns_windows.odin
index b1e7da97d..393df5fa7 100644
--- a/core/net/dns_windows.odin
+++ b/core/net/dns_windows.odin
@@ -20,11 +20,29 @@ package net
Feoramund: FreeBSD platform code
*/
-import "core:strings"
+import "base:runtime"
+
import "core:mem"
+import "core:os"
+import "core:strings"
+import "core:sync"
import win "core:sys/windows"
+/*
+ Replaces environment placeholders in `dns_configuration`. Only necessary on Windows.
+ Is automatically called, once, by `get_dns_records_*`.
+*/
+@(private)
+_init_dns_configuration :: proc() {
+ sync.once_do(&dns_config_initialized, proc() {
+ runtime.DEFAULT_TEMP_ALLOCATOR_TEMP_GUARD()
+ val := os.replace_environment_placeholders(dns_configuration.hosts_file, context.temp_allocator)
+ copy(dns_configuration.hosts_file_buf[:], val)
+ dns_configuration.hosts_file = string(dns_configuration.hosts_file_buf[:len(val)])
+ })
+}
+
@(private)
_get_dns_records_os :: proc(hostname: string, type: DNS_Record_Type, allocator := context.allocator) -> (records: []DNS_Record, err: DNS_Error) {
context.allocator = allocator
@@ -171,4 +189,4 @@ _get_dns_records_os :: proc(hostname: string, type: DNS_Record_Type, allocator :
records = recs[:]
return
-} \ No newline at end of file
+}