Apply managed DNS mode in the macOS package

This commit is contained in:
Dev Scribe
2026-08-21 15:12:32 +07:00
committed by Cuong Manh Le
parent 1f001a559a
commit 6615e431dc
13 changed files with 432 additions and 64 deletions
+23 -1
View File
@@ -5,12 +5,34 @@ import (
"os"
"os/exec"
"strings"
"sync"
"testing"
"github.com/rs/zerolog"
)
var logOutput strings.Builder
// logOutput is the log sink for the whole test binary. Tests share it with any
// background goroutine the code under test starts (watchdogs, timers), so it
// must tolerate concurrent writes.
var logOutput syncBuffer
// syncBuffer is a strings.Builder guarded by a mutex.
type syncBuffer struct {
mu sync.Mutex
sb strings.Builder
}
func (b *syncBuffer) Write(p []byte) (int, error) {
b.mu.Lock()
defer b.mu.Unlock()
return b.sb.Write(p)
}
func (b *syncBuffer) String() string {
b.mu.Lock()
defer b.mu.Unlock()
return b.sb.String()
}
// envFakeVersionOutput makes this test binary impersonate a ctrld executable: when
// set, the process writes the value to stdout and exits without running any test, so