mirror of
https://github.com/impact-eintr/netstack.git
synced 2025-10-18 18:54:30 +08:00
网络层的一些头文件 除去ipv4相关的 都是一些我不准备看的代码 直接复制了
This commit is contained in:
19
tcpip/header/checksum_test.go
Normal file
19
tcpip/header/checksum_test.go
Normal file
@@ -0,0 +1,19 @@
|
||||
package header_test
|
||||
|
||||
import (
|
||||
"log"
|
||||
"math/rand"
|
||||
"netstack/tcpip/header"
|
||||
"testing"
|
||||
"time"
|
||||
)
|
||||
|
||||
func TestChecksum(t *testing.T) {
|
||||
buf := make([]byte, 1024)
|
||||
rand.Seed(time.Now().Unix())
|
||||
for i := range buf {
|
||||
buf[i] = uint8(rand.Intn(255))
|
||||
}
|
||||
sum := header.Checksum(buf, 0)
|
||||
log.Println(sum)
|
||||
}
|
Reference in New Issue
Block a user