Add tailscale checksum
This commit is contained in:
parent
4ebeb2fa86
commit
06b4d4ecd1
11 changed files with 2254 additions and 28 deletions
13
internal/gtcpip/checksum/checksum_default.go
Normal file
13
internal/gtcpip/checksum/checksum_default.go
Normal file
|
|
@ -0,0 +1,13 @@
|
|||
//go:build !amd64
|
||||
|
||||
package checksum
|
||||
|
||||
// Checksum calculates the checksum (as defined in RFC 1071) of the bytes in the
|
||||
// given byte array. This function uses an optimized version of the checksum
|
||||
// algorithm.
|
||||
//
|
||||
// The initial checksum must have been computed on an even number of bytes.
|
||||
func Checksum(buf []byte, initial uint16) uint16 {
|
||||
s, _ := calculateChecksum(buf, false, initial)
|
||||
return s
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue