]> Cypherpunks.ru repositories - govpn.git/blobdiff - src/govpn/common.go
Huge code refactoring
[govpn.git] / src / govpn / common.go
index fbafd56ab680de6afc61eb50f41890e1ed1babfc..263ef45941ef94cc2f591b93d24b0dc81e699997 100644 (file)
@@ -23,6 +23,7 @@ import (
        "os"
        "os/exec"
        "runtime"
+       "time"
 )
 
 const (
@@ -62,3 +63,10 @@ func sliceZero(data []byte) {
 func VersionGet() string {
        return "GoVPN version " + Version + " built with " + runtime.Version()
 }
+
+func cprCycleCalculate(rate int) time.Duration {
+       if rate == 0 {
+               return time.Duration(0)
+       }
+       return time.Second / time.Duration(rate*(1<<10)/MTU)
+}