From 42f83337837ccc0ec5651759974a58f5d422563d Mon Sep 17 00:00:00 2001 From: Git Sagar Date: Sat, 6 Jun 2026 17:53:01 +0530 Subject: [PATCH] rename -dhcp flag to -no-dhcp for cleaner UX DHCP is on by default; use -no-dhcp to disable. Co-Authored-By: Claude Opus 4.6 (1M context) --- CLAUDE.md | 2 +- cmd/softether-go/main.go | 4 ++-- docs/usage.md | 8 ++++---- 3 files changed, 7 insertions(+), 7 deletions(-) diff --git a/CLAUDE.md b/CLAUDE.md index e82a155..5bd87a0 100644 --- a/CLAUDE.md +++ b/CLAUDE.md @@ -57,7 +57,7 @@ pkg/tap/ ## CLI flags Required: `-host`, `-user` -Optional: `-pass`, `-port` (443), `-hub` (DEFAULT), `-tap` (auto), `-mac`, `-plain-password`, `-insecure`, `-dhcp` (true), `-accept-default-gateway`, `-accept-static-routes`, `-accept-dns`, `-policy-route-table` (0=disabled), `-reconnect-delay` (5s) +Optional: `-pass`, `-port` (443), `-hub` (DEFAULT), `-tap` (auto), `-mac`, `-plain-password`, `-insecure`, `-no-dhcp`, `-accept-default-gateway`, `-accept-static-routes`, `-accept-dns`, `-policy-route-table` (0=disabled), `-reconnect-delay` (5s) ## SoftEther protocol pitfalls diff --git a/cmd/softether-go/main.go b/cmd/softether-go/main.go index 642b9db..b00bc8b 100644 --- a/cmd/softether-go/main.go +++ b/cmd/softether-go/main.go @@ -30,7 +30,7 @@ func main() { tapName := flag.String("tap", "", "TAP interface name (empty = kernel-assigned)") macAddr := flag.String("mac", "", "TAP interface MAC address (e.g. 5E:3B:6F:63:A8:3E)") insecure := flag.Bool("insecure", false, "Skip TLS certificate verification") - dhcpEnabled := flag.Bool("dhcp", true, "Run built-in DHCP client after connecting") + noDHCP := flag.Bool("no-dhcp", false, "Disable built-in DHCP client") reconnectDelay := flag.Duration("reconnect-delay", 5*time.Second, "Delay between reconnection attempts") acceptDefaultGW := flag.Bool("accept-default-gateway", false, "Install DHCP-provided gateway as default route") acceptStaticRoutes := flag.Bool("accept-static-routes", false, "Install DHCP classless static routes (option 121/249)") @@ -89,7 +89,7 @@ func main() { signal.Notify(sig, syscall.SIGINT, syscall.SIGTERM) netOpts := netcfg.Options{ - DHCP: *dhcpEnabled, + DHCP: !*noDHCP, AcceptDefaultGW: *acceptDefaultGW, AcceptStaticRoutes: *acceptStaticRoutes, AcceptDNS: *acceptDNS, diff --git a/docs/usage.md b/docs/usage.md index e8c31e7..02ceb46 100644 --- a/docs/usage.md +++ b/docs/usage.md @@ -22,7 +22,7 @@ softether-go [flags] | `-mac` | *(auto)* | TAP interface MAC address (e.g. `5E:3B:6F:63:A8:3E`) | | `-plain-password` | `false` | Send password as plaintext (AuthType 2, for RADIUS/external auth) | | `-insecure` | `false` | Skip TLS certificate verification | -| `-dhcp` | `true` | Run built-in DHCP client after connecting | +| `-no-dhcp` | `false` | Disable built-in DHCP client | | `-accept-default-gateway` | `false` | Install DHCP-provided gateway as default route | | `-accept-static-routes` | `false` | Install DHCP classless static routes (option 121/249) | | `-accept-dns` | `false` | Set `/etc/resolv.conf` from DHCP-provided DNS servers | @@ -57,9 +57,9 @@ Sets a specific MAC address on the TAP interface before connecting. Useful for d softether-go -host vpn.example.com -user admin -mac 5E:3B:6F:63:A8:3E ``` -### `-dhcp` +### `-no-dhcp` -Enabled by default. Runs the built-in DHCP client through the VPN tunnel after connecting. Disable with `-dhcp=false` if the TAP interface will be configured manually or by an external DHCP client. +Disables the built-in DHCP client. Use this if the TAP interface will be configured manually or by an external DHCP client. ### `-accept-default-gateway` @@ -117,7 +117,7 @@ softether-go \ No DHCP (manual configuration): ```bash -softether-go -host vpn.example.com -user admin -pass secret -dhcp=false -tap vpn0 +softether-go -host vpn.example.com -user admin -pass secret -no-dhcp -tap vpn0 ``` ## Docker