Skip to content

Commit

Permalink
allow to filter connections by protocol
Browse files Browse the repository at this point in the history
Added option to filter connections by protocol.

Just add an operand "protocol" as follow:
```
  "operator": {
    "type": "simple",
    "operand": "protocol",
    "sensitive": false,
    "data": "tcp",
    "list": []
  }
```

closes #64
  • Loading branch information
gustavo-iniguez-goya committed Oct 20, 2020
1 parent 1e6d03e commit 4949ab1
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions daemon/rule/operator.go
Expand Up @@ -31,6 +31,7 @@ const (
OpDstIP = Operand("dest.ip")
OpDstHost = Operand("dest.host")
OpDstPort = Operand("dest.port")
OpProto = Operand("protocol")
OpList = Operand("list")
)

Expand Down Expand Up @@ -130,6 +131,8 @@ func (o *Operator) Match(con *conman.Connection) bool {
return o.cb(con.DstIP.String())
} else if o.Operand == OpDstHost && con.DstHost != "" {
return o.cb(con.DstHost)
} else if o.Operand == OpProto {
return o.cb(con.Protocol)
} else if o.Operand == OpDstPort {
return o.cb(fmt.Sprintf("%d", con.DstPort))
} else if o.Operand == OpList {
Expand Down

0 comments on commit 4949ab1

Please sign in to comment.