Skip to content

Commit

Permalink
Regular expression (regexp) matcher: perform adapt tests
Browse files Browse the repository at this point in the history
  • Loading branch information
vnxme committed Jul 24, 2024
1 parent 574476b commit 2a41102
Showing 1 changed file with 110 additions and 0 deletions.
110 changes: 110 additions & 0 deletions integration/caddyfile_adapt/gd_matcher_regexp.caddytest
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"
}
]
}
]
}
}
}
}
}

0 comments on commit 2a41102

Please sign in to comment.