Skip to content

Commit 4d32748

Browse files
committed
Experimenting with macOS MagicDNS
Signed-off-by: Percy Wegmann <percy@tailscale.com>
1 parent 2ee2add commit 4d32748

3 files changed

Lines changed: 98 additions & 45 deletions

File tree

.github/workflows/test.yml

Lines changed: 53 additions & 45 deletions
Original file line numberDiff line numberDiff line change
@@ -16,61 +16,69 @@ jobs:
1616
fail-fast: false
1717
matrix:
1818
include:
19-
# Linux tests (AMD64)
20-
- os: ubuntu-latest
21-
runner-os: Linux
19+
# # Linux tests (AMD64)
20+
# - os: ubuntu-latest
21+
# runner-os: Linux
22+
# arch: amd64
23+
# version: latest
24+
# ping: 100.99.0.2,lax-pve.pineapplefish.ts.net,lax-pve
25+
26+
# # Try unstable too
27+
# - os: ubuntu-latest
28+
# runner-os: Linux
29+
# arch: amd64
30+
# version: unstable
31+
32+
# # Try a pinned version
33+
# - os: ubuntu-latest
34+
# runner-os: Linux
35+
# arch: amd64
36+
# # leave version blank to fall back to default
37+
38+
# # Linux tests (ARM64)
39+
# - os: ubuntu-24.04-arm
40+
# runner-os: Linux
41+
# arch: arm64
42+
# version: latest
43+
44+
# # Windows tests (AMD64)
45+
# - os: windows-latest
46+
# runner-os: Windows
47+
# arch: amd64
48+
# version: latest
49+
# ping: 100.99.0.2,lax-pve.pineapplefish.ts.net,lax-pve
50+
51+
# - os: windows-latest
52+
# runner-os: Windows
53+
# arch: amd64
54+
# version: unstable
55+
56+
# # Windows tests (ARM64)
57+
# - os: windows-11-arm
58+
# runner-os: Windows
59+
# arch: arm64
60+
# version: latest
61+
62+
# macOS 13 intel
63+
- os: macos-13
64+
runner-os: macOS
2265
arch: amd64
2366
version: latest
2467
ping: 100.99.0.2,lax-pve.pineapplefish.ts.net,lax-pve
2568

26-
# Try unstable too
27-
- os: ubuntu-latest
28-
runner-os: Linux
29-
arch: amd64
30-
version: unstable
31-
32-
# Try a pinned version
33-
- os: ubuntu-latest
34-
runner-os: Linux
35-
arch: amd64
36-
# leave version blank to fall back to default
37-
38-
# Linux tests (ARM64)
39-
- os: ubuntu-24.04-arm
40-
runner-os: Linux
69+
# macOS 14 ARM
70+
- os: macos-14
71+
runner-os: macOS
4172
arch: arm64
4273
version: latest
43-
44-
# Windows tests (AMD64)
45-
- os: windows-latest
46-
runner-os: Windows
47-
arch: amd64
48-
version: latest
4974
ping: 100.99.0.2,lax-pve.pineapplefish.ts.net,lax-pve
5075

51-
- os: windows-latest
52-
runner-os: Windows
53-
arch: amd64
54-
version: unstable
55-
56-
# Windows tests (ARM64)
57-
- os: windows-11-arm
58-
runner-os: Windows
59-
arch: arm64
60-
version: latest
61-
62-
# macOS intel
63-
- os: macos-13
64-
runner-os: macOS
65-
arch: amd64
66-
version: latest
67-
ping: 100.99.0.2 # hostnames aren't resolving on MacOS, just ping IP lax-pve.pineapplefish.ts.net,lax-pve
68-
69-
# macOS ARM
70-
- os: macos-14
76+
# macOS 15 ARM
77+
- os: macos-15
7178
runner-os: macOS
7279
arch: arm64
7380
version: latest
81+
ping: 100.99.0.2,lax-pve.pineapplefish.ts.net,lax-pve
7482

7583
runs-on: ${{ matrix.os }}
7684

@@ -83,7 +91,7 @@ jobs:
8391
with:
8492
node-version: "24"
8593
cache: "npm"
86-
94+
8795
- name: Install Dependencies
8896
run: npm ci
8997

dist/index.js

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41232,6 +41232,8 @@ async function run() {
4123241232
config.arch = getTailscaleArch(runnerOS);
4123341233
// Install Tailscale
4123441234
await installTailscale(config, runnerOS);
41235+
// Set DNS server to quad 100 if necessary
41236+
await setDNSServerIfNecessary(runnerOS);
4123541237
// Start daemon (non-Windows only)
4123641238
if (runnerOS !== runnerWindows) {
4123741239
await startTailscaleDaemon(config);
@@ -41750,6 +41752,24 @@ async function installCachedBinaries(toolPath, runnerOS) {
4175041752
}
4175141753
}
4175241754
}
41755+
async function setDNSServerIfNecessary(runnerOS) {
41756+
if (runnerOS !== runnerMacOS) {
41757+
return;
41758+
}
41759+
core.info("Setting system DNS server to 100.100.100.100 8.8.8.8 4.4.4.4");
41760+
try {
41761+
await exec.exec("networksetup", [
41762+
"-setdnsservers",
41763+
"Ethernet",
41764+
"100.100.100.100",
41765+
"8.8.8.8",
41766+
"4.4.4.4",
41767+
]);
41768+
}
41769+
catch (e) {
41770+
core.warning(`Failed to set DNS server to 100.100.100.100, continuing: ${e}`);
41771+
}
41772+
}
4175341773
run();
4175441774

4175541775

src/main.ts

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -157,6 +157,9 @@ async function run(): Promise<void> {
157157
// Install Tailscale
158158
await installTailscale(config, runnerOS);
159159

160+
// Set DNS server to quad 100 if necessary
161+
await setDNSServerIfNecessary(runnerOS);
162+
160163
// Start daemon (non-Windows only)
161164
if (runnerOS !== runnerWindows) {
162165
await startTailscaleDaemon(config);
@@ -686,6 +689,7 @@ async function connectToTailscale(
686689
`--authkey=${finalAuthKey}`,
687690
`--hostname=${hostname}`,
688691
"--accept-routes",
692+
"--accept-dns",
689693
...platformArgs,
690694
...config.args.split(" ").filter(Boolean),
691695
];
@@ -799,4 +803,25 @@ async function installCachedBinaries(
799803
}
800804
}
801805

806+
async function setDNSServerIfNecessary(runnerOS: string): Promise<void> {
807+
if (runnerOS !== runnerMacOS) {
808+
return;
809+
}
810+
811+
core.info("Setting system DNS server to 100.100.100.100 8.8.8.8 4.4.4.4");
812+
try {
813+
await exec.exec("networksetup", [
814+
"-setdnsservers",
815+
"Ethernet",
816+
"100.100.100.100",
817+
"8.8.8.8",
818+
"4.4.4.4",
819+
]);
820+
} catch (e) {
821+
core.warning(
822+
`Failed to set DNS server to 100.100.100.100, continuing: ${e}`
823+
);
824+
}
825+
}
826+
802827
run();

0 commit comments

Comments
 (0)