blob: 5b6ae61fe57978bba99f41cbde887a8a10b26807 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
|
package main
import (
"fmt"
"iptcp-jailpt2/pkg/lnxconfig"
"net/netip"
"os"
)
func main() {
if len(os.Args) != 2 {
fmt.Printf("Usage: %s <configFile>\n", os.Args[0])
os.Exit(1)
}
fileName := os.Args[1]
// Parse the file
lnxConfig, err := lnxconfig.ParseConfig(fileName)
if err != nil {
panic(err)
}
// Demo: print out the IP for each interface in this config
for _, iface := range lnxConfig.Interfaces {
prefixForm := netip.PrefixFrom(iface.AssignedIP, iface.AssignedPrefix.Bits())
fmt.Printf("%s has IP %s\n", iface.Name, prefixForm.String())
}
}
|