@@ -43,7 +43,6 @@ var logger *zap.Logger
4343// Flags
4444var (
4545 cfgFile string
46- pcapFile string
4746 logLevel string
4847 logFormat string
4948)
@@ -119,7 +118,6 @@ func init() {
119118
120119func initFlags () {
121120 rootCmd .PersistentFlags ().StringVarP (& cfgFile , "config" , "c" , "" , "config file" )
122- rootCmd .PersistentFlags ().StringVarP (& pcapFile , "pcap" , "p" , "" , "pcap file (optional)" )
123121 rootCmd .PersistentFlags ().StringVarP (& logLevel , "log-level" , "l" , envOrDefaultString (appLogLevelEnv , "info" ), "log level" )
124122 rootCmd .PersistentFlags ().StringVarP (& logFormat , "log-format" , "f" , envOrDefaultString (appLogFormatEnv , "console" ), "log format" )
125123}
@@ -169,7 +167,6 @@ type cliConfig struct {
169167 IO cliConfigIO `mapstructure:"io"`
170168 Workers cliConfigWorkers `mapstructure:"workers"`
171169 Ruleset cliConfigRuleset `mapstructure:"ruleset"`
172- Replay cliConfigReplay `mapstructure:"replay"`
173170}
174171
175172type cliConfigIO struct {
@@ -180,10 +177,6 @@ type cliConfigIO struct {
180177 RST bool `mapstructure:"rst"`
181178}
182179
183- type cliConfigReplay struct {
184- Realtime bool `mapstructure:"realtime"`
185- }
186-
187180type cliConfigWorkers struct {
188181 Count int `mapstructure:"count"`
189182 QueueSize int `mapstructure:"queueSize"`
@@ -204,30 +197,17 @@ func (c *cliConfig) fillLogger(config *engine.Config) error {
204197}
205198
206199func (c * cliConfig ) fillIO (config * engine.Config ) error {
207- var ioImpl io.PacketIO
208- var err error
209- if pcapFile != "" {
210- // Setup IO for pcap file replay
211- logger .Info ("replaying from pcap file" , zap .String ("pcap file" , pcapFile ))
212- ioImpl , err = io .NewPcapPacketIO (io.PcapPacketIOConfig {
213- PcapFile : pcapFile ,
214- Realtime : c .Replay .Realtime ,
215- })
216- } else {
217- // Setup IO for nfqueue
218- ioImpl , err = io .NewNFQueuePacketIO (io.NFQueuePacketIOConfig {
219- QueueSize : c .IO .QueueSize ,
220- ReadBuffer : c .IO .ReadBuffer ,
221- WriteBuffer : c .IO .WriteBuffer ,
222- Local : c .IO .Local ,
223- RST : c .IO .RST ,
224- })
225- }
226-
200+ nfio , err := io .NewNFQueuePacketIO (io.NFQueuePacketIOConfig {
201+ QueueSize : c .IO .QueueSize ,
202+ ReadBuffer : c .IO .ReadBuffer ,
203+ WriteBuffer : c .IO .WriteBuffer ,
204+ Local : c .IO .Local ,
205+ RST : c .IO .RST ,
206+ })
227207 if err != nil {
228208 return configError {Field : "io" , Err : err }
229209 }
230- config .IO = ioImpl
210+ config .IO = nfio
231211 return nil
232212}
233213
0 commit comments