gfwproxyshadowsocksdocker-imagegogolanggvisornatnetworksocks4socks5tcpip-stacktortun-devicetun2sockstunneludpwireguard
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
18 lines
327 B
18 lines
327 B
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
|
|
}
|
|
|