diff options
| author | Adam Ierymenko <[email protected]> | 2017-02-28 09:22:10 -0800 |
|---|---|---|
| committer | Adam Ierymenko <[email protected]> | 2017-02-28 09:22:10 -0800 |
| commit | 2b10a982e9c9aad4a6ed9b10f5d7bda93a55ffcf (patch) | |
| tree | 95645d1d1868f40986c648fe6d3c910b03622d65 /rule-compiler | |
| parent | 31bece7fa076cf1c5f21743a9a936ade54c0fe1a (diff) | |
Match on tag sender equals or tag recipient equals.
Diffstat (limited to 'rule-compiler')
| -rw-r--r-- | rule-compiler/package.json | 2 | ||||
| -rw-r--r-- | rule-compiler/rule-compiler.js | 14 |
2 files changed, 12 insertions, 4 deletions
diff --git a/rule-compiler/package.json b/rule-compiler/package.json index f0e747a2..451295a4 100644 --- a/rule-compiler/package.json +++ b/rule-compiler/package.json @@ -1,6 +1,6 @@ { "name": "zerotier-rule-compiler", - "version": "1.1.17-2", + "version": "1.1.17-3", "description": "ZeroTier Rule Script Compiler", "main": "cli.js", "scripts": { diff --git a/rule-compiler/rule-compiler.js b/rule-compiler/rule-compiler.js index 7445d39f..feb30f90 100644 --- a/rule-compiler/rule-compiler.js +++ b/rule-compiler/rule-compiler.js @@ -105,6 +105,8 @@ const RESERVED_WORDS = { 'txor': true, 'tdiff': true, 'teq': true, + 'tseq': true, + 'treq': true, 'type': true, 'enum': true, @@ -152,7 +154,9 @@ const KEYWORD_TO_API_MAP = { 'tor': 'MATCH_TAGS_BITWISE_OR', 'txor': 'MATCH_TAGS_BITWISE_XOR', 'tdiff': 'MATCH_TAGS_DIFFERENCE', - 'teq': 'MATCH_TAGS_EQUAL' + 'teq': 'MATCH_TAGS_EQUAL', + 'tseq': 'MATCH_TAG_SENDER', + 'treq': 'MATCH_TAG_RECEIVER' }; // Number of args for each match @@ -179,7 +183,9 @@ const MATCH_ARG_COUNTS = { 'tor': 2, 'txor': 2, 'tdiff': 2, - 'teq': 2 + 'teq': 2, + 'tseq': 2, + 'treq': 2 }; // Regex of all alphanumeric characters in Unicode @@ -477,7 +483,9 @@ function _renderMatches(mtree,rules,macros,caps,tags,params) case 'tor': case 'txor': case 'tdiff': - case 'teq': { + case 'teq': + case 'tseq': + case 'treq': { let tag = tags[args[0][0]]; let tagId = -1; let tagValue = -1; |
