From e9e95941b62a990795adb1ec6d58425fd91b5b5b Mon Sep 17 00:00:00 2001 From: Sergey Matveev Date: Sun, 3 Jul 2016 11:58:08 +0300 Subject: [PATCH] Ability to disable client reconnection --- doc/client.texi | 3 +++ src/cypherpunks.ru/govpn/cmd/govpn-client/main.go | 4 ++++ 2 files changed, 7 insertions(+) diff --git a/doc/client.texi b/doc/client.texi index d3a7f41..58dc74b 100644 --- a/doc/client.texi +++ b/doc/client.texi @@ -37,6 +37,9 @@ to enter it in the terminal. @item -timeout @ref{Timeout} setting in seconds. +@item -noreconnect +Disable reconnection after timeout. + @item -timesync Optional @ref{Timesync, time synchronization} requirement. If set to zero, then no synchronization required. diff --git a/src/cypherpunks.ru/govpn/cmd/govpn-client/main.go b/src/cypherpunks.ru/govpn/cmd/govpn-client/main.go index 7a858bb..98a5b21 100644 --- a/src/cypherpunks.ru/govpn/cmd/govpn-client/main.go +++ b/src/cypherpunks.ru/govpn/cmd/govpn-client/main.go @@ -45,6 +45,7 @@ var ( mtu = flag.Int("mtu", govpn.MTUDefault, "MTU of TAP interface") timeoutP = flag.Int("timeout", 60, "Timeout seconds") timeSync = flag.Int("timesync", 0, "Time synchronization requirement") + noreconnect = flag.Bool("noreconnect", false, "Disable reconnection after timeout") noisy = flag.Bool("noise", false, "Enable noise appending") encless = flag.Bool("encless", false, "Encryptionless mode") cpr = flag.Int("cpr", 0, "Enable constant KiB/sec out traffic rate") @@ -161,6 +162,9 @@ MainCycle: termination <- struct{}{} break MainCycle case <-timeouted: + if *noreconnect { + break MainCycle + } govpn.BothPrintf(`[sleep seconds="%d"]`, timeout) time.Sleep(time.Second * time.Duration(timeout)) case <-rehandshaking: -- 2.44.0