Files
clan-master-thesis/Listings/hyprspace_dispatch.go
T

27 lines
903 B
Go

} else if proto == 0x60 {
dstIP = net.IP(packet[24:40])
if node.cfg.BuiltinAddr6.Equal(dstIP) {
continue
} else if serviceNet.NetworkRange.Contains(dstIP) {
// Are you TCP because your protocol is 6, or is your
// protocol 6 because you are TCP?
if packet[6] == 0x06 {
port := uint16(packet[42])*256 + uint16(packet[43])
if serviceNet.EnsureListener([16]byte(packet[24:40]), port) {
count, err := (*serviceNet.Tun).Write([][]byte{packet}, 0)
if count == 0 || err != nil {
logger.With(err).Error("Error writing to service-network tunnel")
}
}
}
continue
}
}
...
// Check route table for destination address.
route, found := node.cfg.FindRouteForIP(dstIP)
if found {
dst = route.Target.ID
go node.sendPacket(dst, packet, plen)
}