]> Cypherpunks.ru repositories - govpn.git/blobdiff - src/govpn/common.go
Configure MTU on per-user basis
[govpn.git] / src / govpn / common.go
index fabcebe67d0c3f9355f6c247aa794d9a4ea41445..b453ed9be791a0295b49b5dadbee15cab1754bb5 100644 (file)
@@ -28,10 +28,11 @@ import (
 
 const (
        TimeoutDefault = 60
+       MTUMax         = 9000
+       MTUDefault     = 1500 + 14
 )
 
 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
        }
@@ -68,5 +69,5 @@ func cprCycleCalculate(rate int) time.Duration {
        if rate == 0 {
                return time.Duration(0)
        }
-       return time.Second / time.Duration(rate*(1<<10)/MTU)
+       return time.Second / time.Duration(rate*(1<<10)/MTUMax)
 }