mirror of
https://github.com/fumiama/water.git
synced 2026-06-30 00:40:26 +08:00
add ipv4 total len in wu
This commit is contained in:
@@ -1,6 +1,7 @@
|
|||||||
package waterutil
|
package waterutil
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
"encoding/binary"
|
||||||
"net"
|
"net"
|
||||||
)
|
)
|
||||||
|
|
||||||
@@ -12,6 +13,10 @@ func IPv4ECN(packet []byte) byte {
|
|||||||
return packet[1] & 0x03
|
return packet[1] & 0x03
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func IPv4TotalLength(packet []byte) uint16 {
|
||||||
|
return binary.BigEndian.Uint16(packet[2:4])
|
||||||
|
}
|
||||||
|
|
||||||
func IPv4Identification(packet []byte) [2]byte {
|
func IPv4Identification(packet []byte) [2]byte {
|
||||||
return [2]byte{packet[4], packet[5]}
|
return [2]byte{packet[4], packet[5]}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user