1
0
mirror of https://github.com/fumiama/water.git synced 2026-06-17 17:10:34 +08:00

add ipv4 total len in wu

This commit is contained in:
fumiama
2021-12-31 00:04:39 +08:00
parent 3d68512108
commit 38601da6d1

View File

@@ -1,6 +1,7 @@
package waterutil
import (
"encoding/binary"
"net"
)
@@ -12,6 +13,10 @@ func IPv4ECN(packet []byte) byte {
return packet[1] & 0x03
}
func IPv4TotalLength(packet []byte) uint16 {
return binary.BigEndian.Uint16(packet[2:4])
}
func IPv4Identification(packet []byte) [2]byte {
return [2]byte{packet[4], packet[5]}
}