Skip to content

Commit

Permalink
Merge pull request #14 from certego/refactoring
Browse files Browse the repository at this point in the history
Refactoring
  • Loading branch information
ManofWax committed Feb 13, 2024
2 parents fab4a9c + c94f2ca commit 23958d8
Show file tree
Hide file tree
Showing 24 changed files with 1,255 additions and 569 deletions.
3 changes: 1 addition & 2 deletions .github/workflows/python-app.yml
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,5 @@ jobs:
isort ./buffalogs --sp .github/configurations/python_linters/.isort.cfg --profile black --filter-files --check-only --diff
- name: Test with pytest
run: |
source ../venv/bin/activate
source ./venv/bin/activate
pytest routing_test.py
working-directory: ./routingfilter
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ venv
._*

# Pycharm
.idea/workspace.xml
.idea/

# Documentation
docs/_build
Expand Down
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
## 2.0.x
### 2.0.0
#### Changes
* Refactoring of Routing Filter Class (object-oriented)

## 1.6.x
### 1.6.3
#### Bugfix
Expand Down
21 changes: 6 additions & 15 deletions docs/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ Available filters
For filter types which use "key" and "value" field, they can be both a string or a list of strings.
The chosen logic is OR (at least a match must be satisfied).

* **ALL** - matches with everithing, always returns True (if this matches, all other rules are ignored)
* **ALL** - matches with everything, always returns True (if this matches, all other rules are ignored)
* **EXISTS** - returns True if the key in "key" field exists
* **NOT_EXISTS** - returns False if the key in "key" field exists
* **EQUALS** - returns True if the value in the specified "key" is equal to "value"
Expand Down Expand Up @@ -128,22 +128,13 @@ We create the following rule: ::
}
}

If we apply this rule to `test_event_n1`, it will match, since the `src_addr` is in the subnet `192.168.1.0/24`. We are obtaining the following output: ::
If we apply this rule to `test_event_n1`, it will match, since the `src_addr` is in the subnet `192.168.1.0/24`. We are obtaining an object `Results` with attribute `rules`, which indicates the rule ID, and attribute `output`, that in this case is: ::

{
"rules": [
{
"type": "NETWORK",
"key": "src_addr",
"value": "192.168.1.0/24"
}
],
"output": {
"filtered": False
}
}
{
"filtered": False
}

The second event will not match with rule `test_event_n1`, since the `src_addr` is not in the subnet `192.168.1.0/24`. The function will return an empty dictionary.
The second event will not match with rule `test_event_n1`, since the `src_addr` is not in the subnet `192.168.1.0/24`. The function will return an object `Results` with output value equals to `None`.

Routing
==================
Expand Down
223 changes: 155 additions & 68 deletions routing_test.py

Large diffs are not rendered by default.

294 changes: 0 additions & 294 deletions routingfilter/configfilter.py

This file was deleted.

Empty file.
Loading

0 comments on commit 23958d8

Please sign in to comment.