add go-tun2socks code

This commit is contained in:
Jason
2019-07-16 11:37:52 +08:00
parent 828ba9948d
commit 6d01dec5a4
301 changed files with 69694 additions and 1 deletions

View File

@@ -0,0 +1,18 @@
package route
import (
"errors"
"fmt"
"os/exec"
)
func AddRoute(dest, netmask, gateway string) error {
out, err := exec.Command("ip", "route", "add", dest+"/32", "via", gateway).Output()
if err != nil {
if len(out) != 0 {
return errors.New(fmt.Sprintf("%v, output: %s", err, out))
}
return err
}
return nil
}