Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit6147da5

Browse files
chore: addvpn-daemon run command for macos (#19080)
Continues to addresscoder/coder-desktop-macos#201Identical to the windows command, except we don't write to stdio. We're retaining the system we have for logging on macOS, where we push logs over the tunnel and use the OS logger. I've tested that a build with this command works end-to-end with my new version of Coder Desktop macOS.Also brings in the soft net isolation changes from `main` of coder/tailscale.
1 parent4e7331a commit6147da5

File tree

4 files changed

+77
-4
lines changed

4 files changed

+77
-4
lines changed

‎cli/vpndaemon_darwin.go‎

Lines changed: 73 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,73 @@
1+
//go:build darwin
2+
3+
package cli
4+
5+
import (
6+
"golang.org/x/xerrors"
7+
8+
"cdr.dev/slog"
9+
"github.com/coder/coder/v2/vpn"
10+
"github.com/coder/serpent"
11+
)
12+
13+
func (r*RootCmd)vpnDaemonRun()*serpent.Command {
14+
var (
15+
rpcReadFDint64
16+
rpcWriteFDint64
17+
)
18+
19+
cmd:=&serpent.Command{
20+
Use:"run",
21+
Short:"Run the VPN daemon on macOS.",
22+
Middleware:serpent.Chain(
23+
serpent.RequireNArgs(0),
24+
),
25+
Options: serpent.OptionSet{
26+
{
27+
Flag:"rpc-read-fd",
28+
Env:"CODER_VPN_DAEMON_RPC_READ_FD",
29+
Description:"The file descriptor for the pipe to read from the RPC connection.",
30+
Value:serpent.Int64Of(&rpcReadFD),
31+
Required:true,
32+
},
33+
{
34+
Flag:"rpc-write-fd",
35+
Env:"CODER_VPN_DAEMON_RPC_WRITE_FD",
36+
Description:"The file descriptor for the pipe to write to the RPC connection.",
37+
Value:serpent.Int64Of(&rpcWriteFD),
38+
Required:true,
39+
},
40+
},
41+
Handler:func(inv*serpent.Invocation)error {
42+
ctx:=inv.Context()
43+
44+
ifrpcReadFD<0||rpcWriteFD<0 {
45+
returnxerrors.Errorf("rpc-read-fd (%v) and rpc-write-fd (%v) must be positive",rpcReadFD,rpcWriteFD)
46+
}
47+
ifrpcReadFD==rpcWriteFD {
48+
returnxerrors.Errorf("rpc-read-fd (%v) and rpc-write-fd (%v) must be different",rpcReadFD,rpcWriteFD)
49+
}
50+
51+
pipe,err:=vpn.NewBidirectionalPipe(uintptr(rpcReadFD),uintptr(rpcWriteFD))
52+
iferr!=nil {
53+
returnxerrors.Errorf("create bidirectional RPC pipe: %w",err)
54+
}
55+
deferpipe.Close()
56+
57+
tunnel,err:=vpn.NewTunnel(ctx,slog.Make().Leveled(slog.LevelDebug),pipe,
58+
vpn.NewClient(),
59+
vpn.UseOSNetworkingStack(),
60+
vpn.UseAsLogger(),
61+
)
62+
iferr!=nil {
63+
returnxerrors.Errorf("create new tunnel for client: %w",err)
64+
}
65+
defertunnel.Close()
66+
67+
<-ctx.Done()
68+
returnnil
69+
},
70+
}
71+
72+
returncmd
73+
}

‎cli/vpndaemon_other.go‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
//go:build !windows
1+
//go:build !windows && !darwin
22

33
package cli
44

‎go.mod‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ replace github.com/tcnksm/go-httpstat => github.com/coder/go-httpstat v0.0.0-202
3636

3737
// There are a few minor changes we make to Tailscale that we're slowly upstreaming. Compare here:
3838
// https://github.com/tailscale/tailscale/compare/main...coder:tailscale:main
39-
replacetailscale.com =>github.com/coder/tailscalev1.1.1-0.20250724015444-494197765996
39+
replacetailscale.com =>github.com/coder/tailscalev1.1.1-0.20250729141742-067f1e5d9716
4040

4141
// This is replaced to include
4242
// 1. a fix for a data race: c.f. https://github.com/tailscale/wireguard-go/pull/25

‎go.sum‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -926,8 +926,8 @@ github.com/coder/serpent v0.10.0 h1:ofVk9FJXSek+SmL3yVE3GoArP83M+1tX+H7S4t8BSuM=
926926
github.com/coder/serpentv0.10.0/go.mod h1:cZFW6/fP+kE9nd/oRkEHJpG6sXCtQ+AX7WMMEHv0Y3Q=
927927
github.com/coder/sshv0.0.0-20231128192721-70855dedb788 h1:YoUSJ19E8AtuUFVYBpXuOD6a/zVP3rcxezNsoDseTUw=
928928
github.com/coder/sshv0.0.0-20231128192721-70855dedb788/go.mod h1:aGQbuCLyhRLMzZF067xc84Lh7JDs1FKwCmF1Crl9dxQ=
929-
github.com/coder/tailscalev1.1.1-0.20250724015444-494197765996 h1:9x+ouDw9BKW1tdGzuQOWGMT2XkWLs+QQjeCrxYuU1lo=
930-
github.com/coder/tailscalev1.1.1-0.20250724015444-494197765996/go.mod h1:l7ml5uu7lFh5hY28lGYM4b/oFSmuPHYX6uk4RAu23Lc=
929+
github.com/coder/tailscalev1.1.1-0.20250729141742-067f1e5d9716 h1:hi7o0sA+RPBq8Rvvz+hNrC/OTL2897OKREMIRIuQeTs=
930+
github.com/coder/tailscalev1.1.1-0.20250729141742-067f1e5d9716/go.mod h1:l7ml5uu7lFh5hY28lGYM4b/oFSmuPHYX6uk4RAu23Lc=
931931
github.com/coder/terraform-config-inspectv0.0.0-20250107175719-6d06d90c630e h1:JNLPDi2P73laR1oAclY6jWzAbucf70ASAvf5mh2cME0=
932932
github.com/coder/terraform-config-inspectv0.0.0-20250107175719-6d06d90c630e/go.mod h1:Gz/z9Hbn+4KSp8A2FBtNszfLSdT2Tn/uAKGuVqqWmDI=
933933
github.com/coder/terraform-provider-coder/v2v2.9.0 h1:nd9d1/qHTdx5foBLZoy0SWCc0W13GQUbPTzeGsuLlU0=

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp