Fix windows packet capture (#943)

Issues is that Go built-in net.Interfaces function in newer Windows versions return wrong interface names, which libpcap can't consume.
Now we use pcap.FindDevices instead of net.Interfaces.
See this Article for deep understanding of the issue https://haydz.github.io/2020/07/06/Go-Windows-NIC.html

Additionally, found a bug causing big memory allocations, for large requests, when we perform check if messages finished or not.
Because of this bug chunked body encoding check was not working properly.
Was not caught in tests, because test was working on packet array level, and this issue happens when dealing with TCP message object.

Additionally, added a small fix for windows Makefile task, it now generates proper file name.
This commit is contained in:
Leonid Bugaev
2021-06-10 14:46:17 +03:00
committed by GitHub
parent 763ad9b051
commit 58ff8865df
6 changed files with 77 additions and 57 deletions
+4 -4
View File
@@ -59,16 +59,16 @@ release-mac:
rm -rf /tmp/gor-build
release-windows:
echo $(pwd)
docker run -it --rm \
-v `pwd`:/go/src/github.com/buger/goreplay \
-w /go/src/github.com/buger/goreplay \
-e CGO_ENABLED=1 \
docker.elastic.co/beats-dev/golang-crossbuild:1.16.4-main \
--build-cmd "VERSION=make build" \
--build-cmd "make VERSION=$(VERSION) build" \
-p "windows/amd64"
mv ./gor ./gor-$(VERSION)$(PREFIX).exe
mv ./gor ./gor.exe
zip gor-$(VERSION)$(PREFIX)_windows.zip ./gor.exe
rm -rf ./gor.exe
build:
go build -o $(BIN_NAME) $(LDFLAGS)