if he tunnel down

Signed-off-by: Jeff Carr <jcarr@wit.com>
This commit is contained in:
Jeff Carr 2023-02-15 20:28:04 -06:00
parent ea88b7049a
commit c228c00d98
2 changed files with 23 additions and 6 deletions

View File

@ -28,10 +28,15 @@
# ifconfig sit1 inet6 add 2001:470:1f10:2a::2/64
# route -A inet6 add ::/0 dev sit1
if [ "$1" = "down" ]; then
ip tunnel del he-ipv6
rmmod sit
exit
fi
modprobe ipv6
ip tunnel add he-ipv6 mode sit remote 184.105.253.14 local 74.87.91.117 ttl 255
ip link set he-ipv6 up
ip addr add 2001:470:1f10:2a::2/64 dev he-ipv6
ip route add ::/0 dev he-ipv6
ip -f inet6 addr

22
net.go
View File

@ -27,6 +27,7 @@ func watchNetworkInterfaces() {
log.Println("something on i =", i)
}
}
log.Println("forever loop")
}
}()
}
@ -51,6 +52,7 @@ func inotifyNetworkInterfaceChanges() error {
// Do something on network interface creation
}
case err := <-watcher.Errors:
log.Println("inotifyNetworkInterfaceChanges() event err =", err)
return err
}
}
@ -60,6 +62,16 @@ func IsIPv6(address string) bool {
return strings.Count(address, ":") >= 2
}
func IsReal(ip *net.IP) bool {
if (ip.IsPrivate() || ip.IsLoopback() || ip.IsLinkLocalUnicast()) {
log.Println("\t\tIP is Real = false")
return false
} else {
log.Println("\t\tIP is Real = true")
return true
}
}
func scanInterfaces() {
ifaces, _ := net.Interfaces()
spew.Dump(ifaces)
@ -84,14 +96,14 @@ func scanInterfaces() {
} else {
log.Println("\t\tIP is IPv4")
}
if (IsReal(&ip)) {
log.Println("\t\tIP is Real = true")
} else {
log.Println("\t\tIP is Real = false")
}
log.Println("\t\tIP is IsPrivate() =", ip.IsPrivate())
log.Println("\t\tIP is IsLoopback() =", ip.IsLoopback())
log.Println("\t\tIP is IsLinkLocalUnicast() =", ip.IsLinkLocalUnicast())
if (ip.IsPrivate() || ip.IsLoopback() || ip.IsLinkLocalUnicast()) {
log.Println("\t\tIP is Real = false")
} else {
log.Println("\t\tIP is Real = true")
}
// log.Println("\t\tIP is () =", ip.())
default:
log.Println("\t\taddr.(type) = NO IDEA WHAT TO DO HERE v =", v)