-
-
Notifications
You must be signed in to change notification settings - Fork 77
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Regular expression (regexp) matcher: perform adapt tests
- Loading branch information
Showing
1 changed file
with
110 additions
and
0 deletions.
There are no files selected for viewing
110 changes: 110 additions & 0 deletions
110
integration/caddyfile_adapt/gd_matcher_regexp.caddytest
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,110 @@ | ||
{ | ||
layer4 { | ||
:12345 { | ||
# regexp reads only 4 bytes by default | ||
@r1 regexp \d+ | ||
route @r1 { | ||
proxy r1.machine.local:10001 | ||
} | ||
@r2 regexp \xFF\xEE\xDD\xCC\xBB\xAA 6 | ||
route @r2 { | ||
proxy r2.machine.local:10001 | ||
} | ||
@r3 regexp ^(b|c|r)at(.*)\x00\x00$ 10 | ||
route @r3 { | ||
proxy r3.machine.local:10001 | ||
} | ||
route { | ||
echo | ||
} | ||
} | ||
} | ||
} | ||
---------- | ||
{ | ||
"apps": { | ||
"layer4": { | ||
"servers": { | ||
"srv0": { | ||
"listen": [ | ||
":12345" | ||
], | ||
"routes": [ | ||
{ | ||
"match": [ | ||
{ | ||
"regexp": { | ||
"pattern": "\\d+" | ||
} | ||
} | ||
], | ||
"handle": [ | ||
{ | ||
"handler": "proxy", | ||
"upstreams": [ | ||
{ | ||
"dial": [ | ||
"r1.machine.local:10001" | ||
] | ||
} | ||
] | ||
} | ||
] | ||
}, | ||
{ | ||
"match": [ | ||
{ | ||
"regexp": { | ||
"count": 6, | ||
"pattern": "\\xFF\\xEE\\xDD\\xCC\\xBB\\xAA" | ||
} | ||
} | ||
], | ||
"handle": [ | ||
{ | ||
"handler": "proxy", | ||
"upstreams": [ | ||
{ | ||
"dial": [ | ||
"r2.machine.local:10001" | ||
] | ||
} | ||
] | ||
} | ||
] | ||
}, | ||
{ | ||
"match": [ | ||
{ | ||
"regexp": { | ||
"count": 10, | ||
"pattern": "^(b|c|r)at(.*)\\x00\\x00$" | ||
} | ||
} | ||
], | ||
"handle": [ | ||
{ | ||
"handler": "proxy", | ||
"upstreams": [ | ||
{ | ||
"dial": [ | ||
"r3.machine.local:10001" | ||
] | ||
} | ||
] | ||
} | ||
] | ||
}, | ||
{ | ||
"handle": [ | ||
{ | ||
"handler": "echo" | ||
} | ||
] | ||
} | ||
] | ||
} | ||
} | ||
} | ||
} | ||
} |