aboutsummaryrefslogtreecommitdiff
path: root/pcap_importer.go
diff options
context:
space:
mode:
authorEmiliano Ciavatta2020-04-03 10:47:23 +0000
committerEmiliano Ciavatta2020-04-03 10:47:23 +0000
commit9883cd346f694ad09aac839f9ddc4a25df0e0b0a (patch)
tree7a5bfdf282b273ffc410a9e8c758fb8db73072c7 /pcap_importer.go
parentb02ee06a2dad56650f539f69df5660a88e442059 (diff)
Add connection_handler and stream_handler
Diffstat (limited to 'pcap_importer.go')
-rw-r--r--pcap_importer.go9
1 files changed, 5 insertions, 4 deletions
diff --git a/pcap_importer.go b/pcap_importer.go
index 9428b29..c6260de 100644
--- a/pcap_importer.go
+++ b/pcap_importer.go
@@ -24,7 +24,7 @@ const importedPcapsCollectionName = "imported_pcaps"
type PcapImporter struct {
- storage *Storage
+ storage Storage
streamPool *tcpassembly.StreamPool
assemblers []*tcpassembly.Assembler
sessions map[string]context.CancelFunc
@@ -36,10 +36,11 @@ type PcapImporter struct {
type flowCount [2]int
-func NewPcapImporter(storage *Storage, serverIp string) *PcapImporter {
+func NewPcapImporter(storage Storage, serverIp net.IP) *PcapImporter {
+ serverEndpoint := layers.NewIPEndpoint(serverIp)
streamFactory := &BiDirectionalStreamFactory{
storage: storage,
- serverIp: serverIp,
+ serverIp: serverEndpoint,
}
streamPool := tcpassembly.NewStreamPool(streamFactory)
@@ -50,7 +51,7 @@ func NewPcapImporter(storage *Storage, serverIp string) *PcapImporter {
sessions: make(map[string]context.CancelFunc),
mAssemblers: sync.Mutex{},
mSessions: sync.Mutex{},
- serverIp: layers.NewIPEndpoint(net.ParseIP(serverIp)),
+ serverIp: serverEndpoint,
}
}