Add an ability to specify metric for unsafe routes (#474)

This commit is contained in:
Donatas Abraitis
2021-11-04 04:53:28 +02:00
committed by GitHub
parent bcabcfdaca
commit b358bbab80
6 changed files with 44 additions and 11 deletions

View File

@ -92,7 +92,7 @@ func (c *Tun) Activate() error {
for _, r := range c.UnsafeRoutes {
err = exec.Command(
"C:\\Windows\\System32\\route.exe", "add", r.route.String(), r.via.String(), "IF", strconv.Itoa(iface.Index),
"C:\\Windows\\System32\\route.exe", "add", r.route.String(), r.via.String(), "IF", strconv.Itoa(iface.Index), "METRIC", strconv.Itoa(r.metric),
).Run()
if err != nil {
return fmt.Errorf("failed to add the unsafe_route %s: %v", r.route.String(), err)