aboutsummaryrefslogtreecommitdiff
path: root/connection_handler.go
diff options
context:
space:
mode:
authorEmiliano Ciavatta2020-04-09 10:55:32 +0000
committerEmiliano Ciavatta2020-04-09 10:55:32 +0000
commit3d2997eb8b80792f09eb984f841c71b907894bcb (patch)
tree7bf7879ebe3ad72191329b8e607f36368b10a5b7 /connection_handler.go
parent7ca2f30a0eb21e22071f4e6b04a5207fa273d283 (diff)
Add FillWithMatchedRules method
Diffstat (limited to 'connection_handler.go')
-rw-r--r--connection_handler.go7
1 files changed, 7 insertions, 0 deletions
diff --git a/connection_handler.go b/connection_handler.go
index 4fc2a95..de7f508 100644
--- a/connection_handler.go
+++ b/connection_handler.go
@@ -35,6 +35,7 @@ type ConnectionHandler interface {
Complete(handler *StreamHandler)
Storage() Storage
PatternsDatabase() hyperscan.StreamDatabase
+ PatternsDatabaseSize() int
}
type connectionHandlerImpl struct {
@@ -203,6 +204,8 @@ func (ch *connectionHandlerImpl) Complete(handler *StreamHandler) {
ServerDocuments: len(server.documentsIDs),
ProcessedAt: time.Now(),
}
+ ch.factory.rulesManager.FillWithMatchedRules(&connection, client.patternMatches, server.patternMatches)
+
_, err := ch.Storage().Insert(Connections).One(connection)
if err != nil {
log.WithError(err).WithField("connection", connection).Error("failed to insert a connection")
@@ -228,6 +231,10 @@ func (ch *connectionHandlerImpl) PatternsDatabase() hyperscan.StreamDatabase {
return ch.factory.rulesDatabase.database
}
+func (ch *connectionHandlerImpl) PatternsDatabaseSize() int {
+ return ch.factory.rulesDatabase.databaseSize
+}
+
func (sf StreamFlow) Hash() uint64 {
return sf[0].FastHash() ^ sf[1].FastHash() ^ sf[2].FastHash() ^ sf[3].FastHash()
}