Thanks to visit codestin.com
Credit goes to github.com

Skip to content
Draft
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
chore: keep nil uuid default org behavior and wintun uninstall
  • Loading branch information
aslilac committed Sep 11, 2026
commit b25dd386fb965e953b260e413e8aeb6f9514a134
9 changes: 5 additions & 4 deletions coderd/httpmw/organizationparam.go
Original file line number Diff line number Diff line change
Expand Up @@ -66,10 +66,11 @@ func ExtractOrganizationParam(db database.Store) func(http.Handler) http.Handler
var organization database.Organization
var dbErr error

// If the name is exactly "default", then we fetch the default
// organization. This is a special case to make it easier
// for single org deployments.
if arg == codersdk.DefaultOrganization {
// If the name is exactly "default" or the nil UUID, then we fetch
// the default organization. This is a special case to make it
// easier for single org deployments, and external callers depend
// on the nil UUID resolving to the default org.
if arg == codersdk.DefaultOrganization || arg == uuid.Nil.String() {
organization, dbErr = db.GetDefaultOrganization(ctx)
} else {
// Try by name or uuid.
Expand Down
8 changes: 8 additions & 0 deletions coderd/httpmw/organizationparam_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -227,5 +227,13 @@ func TestOrganizationParam(t *testing.T) {
res = rw.Result()
defer res.Body.Close()
require.Equal(t, http.StatusOK, res.StatusCode, "by default keyword")

// Try by nil uuid, which resolves to the default org.
chi.RouteContext(r.Context()).URLParams.Add("organization", uuid.Nil.String())
chi.RouteContext(r.Context()).URLParams.Add("user", user.ID.String())
rtr.ServeHTTP(rw, r)
res = rw.Result()
defer res.Body.Close()
require.Equal(t, http.StatusOK, res.StatusCode, "by nil uuid (legacy)")
})
}
20 changes: 20 additions & 0 deletions vpn/tun_windows.go
Original file line number Diff line number Diff line change
Expand Up @@ -138,3 +138,23 @@ func windowsUptime() time.Duration {
r, _, _ := getTickCount64Proc.Call()
return time.Duration(int64(r)) * time.Millisecond
}

// TODO(@dean): implement a way to install/uninstall the wintun driver, most
// likely as a CLI command
//
// This is taken from Tailscale:
// https://github.com/tailscale/tailscale/blob/3abfbf50aebbe3ba57dc749165edb56be6715c0a/cmd/tailscaled/tailscaled_windows.go#L543
func uninstallWinTun(logf logger.Logf) {
dll := windows.NewLazyDLL("wintun.dll")
if err := dll.Load(); err != nil {
logf("Cannot load wintun.dll for uninstall: %v", err)
return
}

logf("Removing wintun driver...")
err := wintun.Uninstall()
logf("Uninstall: %v", err)
}

// TODO(@dean): remove
var _ = uninstallWinTun
Loading