f-88: fip: face publique, traduction et routage par source sur l'hôte #88

Signed-off-by: GnomeZworc <nicolas.boufidjeline@g3e.fr>
This commit is contained in:
GnomeZworc 2026-10-29 21:32:29 +01:00
commit 81686de6d6
Signed by: nicolas.boufideline
GPG key ID: 4406BBBF8845D632
8 changed files with 538 additions and 18 deletions

View file

@ -51,6 +51,19 @@ func TableRoutesVia(table int, iface string) ([]*net.IPNet, error) {
return dsts, nil
}
func RouteReplaceDev(table int, dst *net.IPNet, iface string) error {
link, err := netlink.LinkByName(iface)
if err != nil {
return err
}
return netlink.RouteReplace(&netlink.Route{
LinkIndex: link.Attrs().Index,
Dst: dst,
Table: table,
Scope: netlink.SCOPE_LINK,
})
}
func RouteDelViaIfExists(table int, dst *net.IPNet, gw net.IP, iface string) error {
link, err := netlink.LinkByName(iface)
if err != nil {