新TAP测试(TODO 解析arp)

This commit is contained in:
黄思敏 2022-09-01 15:43:38 +08:00
parent cd60823d65
commit 1761d52c40
2 changed files with 15 additions and 17 deletions

View File

@ -99,7 +99,7 @@ func (cli *RPCClient) run() {
} }
defer stream.CloseSend() defer stream.CloseSend()
var ticker = time.NewTicker(time.Millisecond * 200) var ticker = time.NewTicker(time.Millisecond * 1)
buf := bytes.NewBuffer(nil) buf := bytes.NewBuffer(nil)
for { for {

View File

@ -7,8 +7,6 @@ import (
"io" "io"
"log" "log"
"net" "net"
"github.com/klauspost/compress/zstd"
) )
func Compress(writer io.Writer, data [][]byte) { func Compress(writer io.Writer, data [][]byte) {
@ -22,14 +20,14 @@ func Compress(writer io.Writer, data [][]byte) {
} }
// zstd compress // zstd compress
zenc, err := zstd.NewWriter(writer) // zenc, err := zstd.NewWriter(writer)
if err != nil { // if err != nil {
log.Panic(err) // log.Panic(err)
} // }
err = zenc.Flush() // err = zenc.Flush()
if err != nil { // if err != nil {
log.Println(err) // log.Println(err)
} // }
} }
@ -37,12 +35,12 @@ func Decompress(data []byte) (frames [][]byte) {
var err error var err error
var buf = bytes.NewBuffer(data) var buf = bytes.NewBuffer(data)
var zdec *zstd.Decoder // var zdec *zstd.Decoder
zdec, err = zstd.NewReader(buf) // zdec, err = zstd.NewReader(buf)
if err != nil { // if err != nil {
log.Panic(err) // log.Panic(err)
} // }
zdec.Close() // zdec.Close()
dec := gob.NewDecoder(buf) dec := gob.NewDecoder(buf)
err = dec.Decode(&frames) err = dec.Decode(&frames)