]> Cypherpunks.ru repositories - govpn.git/blobdiff - src/cypherpunks.ru/govpn/cmd/govpn-client/main.go
Pass parameters to scripts through environment variables
[govpn.git] / src / cypherpunks.ru / govpn / cmd / govpn-client / main.go
index b46a16eb93203cb93a7002d372b24b64de050602..032a288c78734013b106243b6a140f7dde0af7b9 100644 (file)
@@ -43,6 +43,7 @@ var (
        proxyAuth   = flag.String("proxy-auth", "", "user:password Basic proxy auth")
        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")
        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")
@@ -70,6 +71,9 @@ func main() {
                govpn.EGDInit(*egdPath)
        }
 
+       if *verifierRaw == "" {
+               log.Fatalln("No verifier specified")
+       }
        verifier, err := govpn.VerifierFromString(*verifierRaw)
        if err != nil {
                log.Fatalln(err)
@@ -90,13 +94,16 @@ func main() {
                Iface:    *ifaceName,
                MTU:      *mtu,
                Timeout:  time.Second * time.Duration(timeout),
+               TimeSync: *timeSync,
                Noise:    *noisy,
                CPR:      *cpr,
                Encless:  *encless,
                Verifier: verifier,
                DSAPriv:  priv,
        }
-       idsCache = govpn.NewCipherCache([]govpn.PeerId{*verifier.Id})
+       idsCache = govpn.NewCipherCache()
+       confs := map[govpn.PeerId]*govpn.PeerConf{*verifier.Id: conf}
+       idsCache.Update(&confs)
        log.Println(govpn.VersionGet())
 
        tap, err = govpn.TAPListen(*ifaceName, *mtu)
@@ -149,5 +156,5 @@ MainCycle:
                close(rehandshaking)
                close(termination)
        }
-       govpn.ScriptCall(*downPath, *ifaceName)
+       govpn.ScriptCall(*downPath, *ifaceName, *remoteAddr)
 }