fix(pcap): remove the forever block
This commit is contained in:
@@ -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)
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user