From 9e050b140b9fba25d26491e6e4a8d9f6e01ab202 Mon Sep 17 00:00:00 2001 From: Git Sagar Date: Sat, 11 Jul 2026 11:56:37 -0300 Subject: [PATCH] cli: rename -reconnect-delay to -reconnect-delay-secs All time arguments now use -secs suffix with integer seconds for consistency (-reconnect-delay-secs, -keepalive-timeout-secs). Co-Authored-By: Claude Opus 4.6 (1M context) --- CLAUDE.md | 2 +- README.md | 2 +- cmd/softether-go/main.go | 7 ++++--- 3 files changed, 6 insertions(+), 5 deletions(-) diff --git a/CLAUDE.md b/CLAUDE.md index d9ce20b..02c0d5d 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`, `-no-dhcp`, `-accept-default-gateway`, `-accept-static-routes`, `-accept-dns`, `-policy-route-table` (0=disabled), `-connmark`, `-reconnect-delay` (5s), `-keepalive-timeout-secs` (0=disabled) +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), `-connmark`, `-reconnect-delay-secs` (5), `-keepalive-timeout-secs` (0=disabled) ## SoftEther protocol pitfalls diff --git a/README.md b/README.md index b80f0b3..b60d55b 100644 --- a/README.md +++ b/README.md @@ -83,7 +83,7 @@ softether-go [flags] | `-policy-route-table` | `0` | Policy routing table number (0 = disabled) | | `-connmark` | `false` | Use CONNMARK to route DNAT reply traffic back through VPN | | `-keepalive-timeout-secs` | `0` | Close connection if no server data within N seconds (0 = disabled) | -| `-reconnect-delay` | `5s` | Delay between reconnection attempts | +| `-reconnect-delay-secs` | `5` | Delay between reconnection attempts in seconds | ### Authentication diff --git a/cmd/softether-go/main.go b/cmd/softether-go/main.go index 1122a06..c4c25ce 100644 --- a/cmd/softether-go/main.go +++ b/cmd/softether-go/main.go @@ -31,7 +31,7 @@ func main() { 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") noDHCP := flag.Bool("no-dhcp", false, "Disable built-in DHCP client") - reconnectDelay := flag.Duration("reconnect-delay", 5*time.Second, "Delay between reconnection attempts") + reconnectDelay := flag.Int("reconnect-delay-secs", 5, "Delay between reconnection attempts in seconds") 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)") acceptDNS := flag.Bool("accept-dns", false, "Set /etc/resolv.conf from DHCP-provided DNS servers") @@ -106,13 +106,14 @@ func main() { return } log.Printf("session ended: %v", err) - log.Printf("reconnecting in %v...", *reconnectDelay) + delay := time.Duration(*reconnectDelay) * time.Second + log.Printf("reconnecting in %v...", delay) select { case <-sig: log.Println("shutting down") return - case <-time.After(*reconnectDelay): + case <-time.After(delay): } } }