]> Cypherpunks.ru repositories - govpn.git/commitdiff
Move protocol argument check out of cycle
authorSergey Matveev <stargrave@stargrave.org>
Sun, 3 Jul 2016 08:33:19 +0000 (11:33 +0300)
committerSergey Matveev <stargrave@stargrave.org>
Sun, 3 Jul 2016 08:33:19 +0000 (11:33 +0300)
src/cypherpunks.ru/govpn/cmd/govpn-client/main.go

index 3d8cbe65953fd935f480a9aefde3efec28ed61d8..5c510019c11f65fb4f8a54f507b2c6eeaa9c6ff6 100644 (file)
@@ -78,6 +78,12 @@ func main() {
                govpn.EGDInit(*egdPath)
        }
 
+       if *proxyAddr != "" {
+               *proto = "tcp"
+       }
+       if !(*proto == "udp" || *proto == "tcp") {
+               log.Fatalln("Unknown protocol specified")
+       }
        if *verifierRaw == "" {
                log.Fatalln("No verifier specified")
        }
@@ -139,9 +145,6 @@ MainCycle:
                timeouted := make(chan struct{})
                rehandshaking := make(chan struct{})
                termination := make(chan struct{})
-               if *proxyAddr != "" {
-                       *proto = "tcp"
-               }
                switch *proto {
                case "udp":
                        go startUDP(timeouted, rehandshaking, termination)
@@ -151,8 +154,6 @@ MainCycle:
                        } else {
                                go startTCP(timeouted, rehandshaking, termination)
                        }
-               default:
-                       log.Fatalln("Unknown protocol specified")
                }
                select {
                case <-termSignal: