mirror of
https://github.com/buger/goreplay.git
synced 2024-04-21 12:32:02 +00:00
Use latest libpcap and ensure to close sockets
This commit is contained in:
@@ -5,14 +5,18 @@ import (
|
||||
"reflect"
|
||||
"strings"
|
||||
"time"
|
||||
"sync"
|
||||
)
|
||||
|
||||
// InOutPlugins struct for holding references to plugins
|
||||
type InOutPlugins struct {
|
||||
Inputs []io.Reader
|
||||
Outputs []io.Writer
|
||||
All []interface{}
|
||||
}
|
||||
|
||||
|
||||
var pluginMu sync.Mutex
|
||||
// Plugins holds all the plugin objects
|
||||
var Plugins *InOutPlugins = new(InOutPlugins)
|
||||
|
||||
@@ -67,10 +71,15 @@ func registerPlugin(constructor interface{}, options ...interface{}) {
|
||||
if isW {
|
||||
Plugins.Outputs = append(Plugins.Outputs, pluginWrapper.(io.Writer))
|
||||
}
|
||||
|
||||
Plugins.All = append(Plugins.All, plugin)
|
||||
}
|
||||
|
||||
// InitPlugins specify and initialize all available plugins
|
||||
func InitPlugins() {
|
||||
pluginMu.Lock()
|
||||
defer pluginMu.Unlock()
|
||||
|
||||
for _, options := range Settings.inputDummy {
|
||||
registerPlugin(NewDummyInput, options)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user