if he tunnel down
Signed-off-by: Jeff Carr <jcarr@wit.com>
This commit is contained in:
parent
ea88b7049a
commit
c228c00d98
|
@ -28,10 +28,15 @@
|
||||||
# ifconfig sit1 inet6 add 2001:470:1f10:2a::2/64
|
# ifconfig sit1 inet6 add 2001:470:1f10:2a::2/64
|
||||||
# route -A inet6 add ::/0 dev sit1
|
# route -A inet6 add ::/0 dev sit1
|
||||||
|
|
||||||
|
if [ "$1" = "down" ]; then
|
||||||
|
ip tunnel del he-ipv6
|
||||||
|
rmmod sit
|
||||||
|
exit
|
||||||
|
fi
|
||||||
|
|
||||||
modprobe ipv6
|
modprobe ipv6
|
||||||
ip tunnel add he-ipv6 mode sit remote 184.105.253.14 local 74.87.91.117 ttl 255
|
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 link set he-ipv6 up
|
||||||
ip addr add 2001:470:1f10:2a::2/64 dev he-ipv6
|
ip addr add 2001:470:1f10:2a::2/64 dev he-ipv6
|
||||||
ip route add ::/0 dev he-ipv6
|
ip route add ::/0 dev he-ipv6
|
||||||
ip -f inet6 addr
|
ip -f inet6 addr
|
||||||
|
|
||||||
|
|
22
net.go
22
net.go
|
@ -27,6 +27,7 @@ func watchNetworkInterfaces() {
|
||||||
log.Println("something on i =", i)
|
log.Println("something on i =", i)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
log.Println("forever loop")
|
||||||
}
|
}
|
||||||
}()
|
}()
|
||||||
}
|
}
|
||||||
|
@ -51,6 +52,7 @@ func inotifyNetworkInterfaceChanges() error {
|
||||||
// Do something on network interface creation
|
// Do something on network interface creation
|
||||||
}
|
}
|
||||||
case err := <-watcher.Errors:
|
case err := <-watcher.Errors:
|
||||||
|
log.Println("inotifyNetworkInterfaceChanges() event err =", err)
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -60,6 +62,16 @@ func IsIPv6(address string) bool {
|
||||||
return strings.Count(address, ":") >= 2
|
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() {
|
func scanInterfaces() {
|
||||||
ifaces, _ := net.Interfaces()
|
ifaces, _ := net.Interfaces()
|
||||||
spew.Dump(ifaces)
|
spew.Dump(ifaces)
|
||||||
|
@ -84,14 +96,14 @@ func scanInterfaces() {
|
||||||
} else {
|
} else {
|
||||||
log.Println("\t\tIP is IPv4")
|
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 IsPrivate() =", ip.IsPrivate())
|
||||||
log.Println("\t\tIP is IsLoopback() =", ip.IsLoopback())
|
log.Println("\t\tIP is IsLoopback() =", ip.IsLoopback())
|
||||||
log.Println("\t\tIP is IsLinkLocalUnicast() =", ip.IsLinkLocalUnicast())
|
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.())
|
// log.Println("\t\tIP is () =", ip.())
|
||||||
default:
|
default:
|
||||||
log.Println("\t\taddr.(type) = NO IDEA WHAT TO DO HERE v =", v)
|
log.Println("\t\taddr.(type) = NO IDEA WHAT TO DO HERE v =", v)
|
||||||
|
|
Loading…
Reference in New Issue