Add san-jorge.argentina

This commit is contained in:
Alex D. 2024-09-19 11:12:06 +00:00
parent 80c9840035
commit 28d66dcc64
Signed by: caskd
GPG Key ID: F92BA85F61F4C173
1 changed files with 89 additions and 0 deletions

View File

@ -0,0 +1,89 @@
package main
import (
"fmt"
"log"
"net/netip"
"os"
"git.redxen.eu/caskd/s6-netdev"
)
func main() {
var (
err error
l = log.New(os.Stderr, "s6-netdev: ", log.Ltime|log.Lshortfile|log.Lmsgprefix)
ifs = make(s6netdev.IfMap)
)
t := s6netdev.S6NewTree()
// Loopback
ifs.AddIf(&s6netdev.Iface{
Name: "lo",
Type: &s6netdev.NetdevIfTypes.Loopback,
})
// Physical interfaces
for _, v := range []string{"p1s0"} {
ifs.AddIf(&s6netdev.Iface{
Name: fmt.Sprintf("en%s", v),
Type: &s6netdev.NetdevIfTypes.Phys,
})
}
// Bridge interfaces
ifs.AddIf(&s6netdev.Iface{
Name: "br-v6",
Type: &s6netdev.NetdevIfTypes.Bridge,
Properties: []s6netdev.Property{
{Key: "stp_state", Value: "0", Default: "0"},
{Key: "mcast_snooping", Value: "0", Default: "1"},
},
})
// Wireguard interfaces
ifs.AddIf(&s6netdev.Iface{
Name: "wg-tunnel",
Type: &s6netdev.NetdevIfTypes.Wireguard,
Addresses: []netip.Prefix{
netip.MustParsePrefix("172.22.12.8/32"),
netip.MustParsePrefix("fd42:42:42::2:8/128"),
},
Routes: []s6netdev.Route{
{Net: netip.MustParsePrefix("172.22.12.0/24")},
{Net: netip.MustParsePrefix("fd42:42:42::2:0/120")},
},
})
for _, m := range []struct {
Master string
Slaves []string
}{
{
Master: "br-v6",
Slaves: []string{
"enp1s0",
},
},
} {
master := ifs[m.Master]
for _, slave := range m.Slaves {
master.Slaves = append(master.Slaves, ifs[slave])
}
ifs[m.Master] = master
}
for _, v := range ifs {
t.Services(*v)
}
for _, v := range t.S6Services() {
if s6netdev.NetdevIsDummy(v.Name) {
continue
}
l.Printf("Commiting %s\n", v.Name)
if err = t.S6CommitService(v); err != nil {
l.Fatalf("Failed to commit %s, %s\n", v.Name, err)
}
}
}