Use latest libpcap and ensure to close sockets

This commit is contained in:
Leonid Bugaev
2016-05-13 14:33:20 +05:00
parent cbc871b83f
commit 19bfb8211c
11 changed files with 101 additions and 48 deletions
+9
View File
@@ -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)
}