chore: format

This commit is contained in:
Toby 2024-05-07 22:50:58 -07:00
parent abd7725fed
commit 70fee14103
2 changed files with 6 additions and 7 deletions

View File

@ -183,7 +183,7 @@ type cliConfigIO struct {
} }
type cliConfigReplay struct { type cliConfigReplay struct {
Realtime bool `mapstructure:"realtime"` Realtime bool `mapstructure:"realtime"`
} }
type cliConfigWorkers struct { type cliConfigWorkers struct {
@ -212,8 +212,8 @@ func (c *cliConfig) fillIO(config *engine.Config) error {
// Setup IO for pcap file replay // Setup IO for pcap file replay
logger.Info("replaying from pcap file", zap.String("pcap file", pcapFile)) logger.Info("replaying from pcap file", zap.String("pcap file", pcapFile))
ioImpl, err = io.NewPcapPacketIO(io.PcapPacketIOConfig{ ioImpl, err = io.NewPcapPacketIO(io.PcapPacketIOConfig{
PcapFile: pcapFile, PcapFile: pcapFile,
Realtime: c.Replay.Realtime, Realtime: c.Replay.Realtime,
}) })
} else { } else {
// Setup IO for nfqueue // Setup IO for nfqueue

View File

@ -20,17 +20,16 @@ type pcapPacketIO struct {
ioCancel context.CancelFunc ioCancel context.CancelFunc
config PcapPacketIOConfig config PcapPacketIOConfig
dialer *net.Dialer dialer *net.Dialer
} }
type PcapPacketIOConfig struct { type PcapPacketIOConfig struct {
PcapFile string PcapFile string
Realtime bool Realtime bool
} }
func NewPcapPacketIO(config PcapPacketIOConfig) (PacketIO, error) { func NewPcapPacketIO(config PcapPacketIOConfig) (PacketIO, error) {
handle, err := pcap.OpenOffline(config.PcapFile) handle, err := pcap.OpenOffline(config.PcapFile)
if err != nil { if err != nil {
return nil, err return nil, err
} }