Improve icmpv6.go

- Now doesn't use unsafe
- Much cleaner
- Doesn't run in a goroutine perpetually
- Has a function to create ICMPv6 packets
This commit is contained in:
Neil Alexander 2018-02-14 11:21:23 +00:00
parent 6571a8c300
commit d78e0f7067
2 changed files with 140 additions and 160 deletions

View file

@ -80,11 +80,7 @@ func (tun *tunDevice) read() error {
b := make([]byte, n)
copy(b, buf)
// tun.icmpv6.recv <- b
if tun.iface.IsTAP() {
go tun.icmpv6.parse_packet_tap(b)
} else {
go tun.icmpv6.parse_packet_tun(b)
}
go tun.icmpv6.parse_packet(b)
}
packet := append(util_getBytes(), buf[o:n]...)
tun.send <- packet