网络层的一些头文件 除去ipv4相关的 都是一些我不准备看的代码 直接复制了

This commit is contained in:
impact-eintr
2022-11-27 17:24:14 +08:00
parent 386afff633
commit 5947778dfa
15 changed files with 1903 additions and 5 deletions

View 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)
}