fix(pcap): remove the forever block

This commit is contained in:
2026-02-05 13:18:59 +00:00
parent 92351a80a9
commit b3f32133c3

View File

@@ -5,6 +5,7 @@ import (
"fmt" "fmt"
"os" "os"
"sync" "sync"
"time"
"github.com/google/gopacket" "github.com/google/gopacket"
"github.com/google/gopacket/pcap" "github.com/google/gopacket/pcap"
@@ -20,7 +21,7 @@ type PacketCapture struct {
} }
func NewPacketCapture(iface, outputPath string) (*PacketCapture, error) { func NewPacketCapture(iface, outputPath string) (*PacketCapture, error) {
handle, err := pcap.OpenLive(iface, 65535, true, pcap.BlockForever) handle, err := pcap.OpenLive(iface, 65535, true, 1000*time.Millisecond)
if err != nil { if err != nil {
return nil, fmt.Errorf("pcap open (try running as root): %w", err) return nil, fmt.Errorf("pcap open (try running as root): %w", err)
} }