Refine WireGuard client routing and authentication UI

This commit is contained in:
opsx committed 2026-10-21 21:10:53 +08:00
1 parent eabb3e4472
commit 41fb9d5631
33 files changed
+1709 -469

No files matched your search

+21
View File
@@ -0,0 +1,21 @@
//go:build darwin
package main
import (
"context"
"errors"
"net/netip"
"os/exec"
"time"
)
func physicalExitFor(endpoint netip.Addr) (physicalRoute, error) {
ctx, cancel := context.WithTimeout(context.Background(), 3*time.Second)
defer cancel()
output, err := exec.CommandContext(ctx, "/sbin/route", "-n", "get", endpoint.String()).Output()
if err != nil {
return physicalRoute{}, errors.New("无法读取 VPN 网关的当前物理出口")
}
return parsePhysicalRoute(string(output))
}