]> Cypherpunks.ru repositories - govpn.git/blobdiff - src/govpn/common.go
Allow 9000 MTUs on TAP interfaces, consider Ethernet header size
[govpn.git] / src / govpn / common.go
index fabcebe67d0c3f9355f6c247aa794d9a4ea41445..d3f8ec04a595ad62cf960ccfd1ca70310411212f 100644 (file)
@@ -23,15 +23,16 @@ import (
        "os"
        "os/exec"
        "runtime"
-       "time"
 )
 
 const (
        TimeoutDefault = 60
+       EtherSize      = 14
+       MTUMax         = 9000 + EtherSize
+       MTUDefault     = 1500 + EtherSize
 )
 
 var (
-       MTU     int
        Version string
 )
 
@@ -54,7 +55,7 @@ func ScriptCall(path, ifaceName string) ([]byte, error) {
 }
 
 // Zero each byte.
-func sliceZero(data []byte) {
+func SliceZero(data []byte) {
        for i := 0; i < len(data); i++ {
                data[i] = 0
        }
@@ -63,10 +64,3 @@ 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)
-}