mirror of
https://codeberg.org/cunicu/cunicu.git
synced 2025-10-20 15:35:47 +08:00
26 lines
618 B
Go
26 lines
618 B
Go
package device
|
|
|
|
import (
|
|
"fmt"
|
|
"net"
|
|
"os/exec"
|
|
)
|
|
|
|
func (d *BSDKernelDevice) AddRoute(dst net.IPNet, table int) error {
|
|
return exec.Command("setfib", fmt.Sprint(table), "route", "add", "-net", dst.String(), "-interface", d.Name()).Run()
|
|
}
|
|
|
|
func (d *BSDKernelDevice) DeleteRoute(dst net.IPNet, table int) error {
|
|
return exec.Command("setfib", fmt.Sprint(table), "route", "delete", "-net", dst.String(), "-interface", d.Name()).Run()
|
|
}
|
|
|
|
func DetectMTU(ip net.IP) (int, error) {
|
|
// TODO: Thats just a guess
|
|
return 1500, nil
|
|
}
|
|
|
|
func DetectDefaultMTU() (int, error) {
|
|
// TODO: Thats just a guess
|
|
return 1500, nil
|
|
}
|