]> Cypherpunks.ru repositories - govpn.git/blobdiff - src/govpn/cmd/govpn-client/main.go
If proxy is specified, then forcefully use TCP protocol for convenience
[govpn.git] / src / govpn / cmd / govpn-client / main.go
index d88bb46028c26643713e7a1cc09aa368d562e355..8ebb78dcc95da7c9276e387df69b3be6f5b6c544 100644 (file)
@@ -52,6 +52,7 @@ var (
        timeout     int
        firstUpCall bool = true
        knownPeers  govpn.KnownPeers
+       idsCache    govpn.CipherCache
 )
 
 func main() {
@@ -74,14 +75,14 @@ func main() {
 
        pub, priv := govpn.NewVerifier(id, govpn.StringFromFile(*keyPath))
        conf = &govpn.PeerConf{
-               Id:          id,
-               Timeout:     time.Second * time.Duration(timeout),
-               NoiseEnable: *noisy,
-               CPR:         *cpr,
-               DSAPub:      pub,
-               DSAPriv:     priv,
+               Id:      id,
+               Timeout: time.Second * time.Duration(timeout),
+               Noise:   *noisy,
+               CPR:     *cpr,
+               DSAPub:  pub,
+               DSAPriv: priv,
        }
-       govpn.PeersInitDummy(id, conf)
+       idsCache = govpn.NewCipherCache([]govpn.PeerId{*id})
        log.Println(govpn.VersionGet())
 
        tap, err = govpn.TAPListen(*ifaceName)
@@ -107,6 +108,9 @@ 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)
@@ -121,7 +125,7 @@ MainCycle:
                }
                select {
                case <-termSignal:
-                       log.Fatalln("Finishing...")
+                       log.Fatalln("Finishing")
                        termination <- struct{}{}
                        break MainCycle
                case <-timeouted: