-
-
Notifications
You must be signed in to change notification settings - Fork 76
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Clock matcher: initial commit * Clock matcher: add time zone support * Clock matcher: use UTC by default * Clock matcher: add custom offset support * Clock matcher: provide comments for fields
- Loading branch information
Showing
6 changed files
with
509 additions
and
0 deletions.
There are no files selected for viewing
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
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
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,220 @@ | ||
{ | ||
layer4 { | ||
:8080 { | ||
@night_m clock before 05:00:00 | ||
@morning clock 05:00:00 12:00:00 | ||
@afternoon clock 12:00:00 17:00:00 | ||
@evening clock 17:00:00 21:00:00 | ||
@night_e clock after 21:00:00 | ||
route @night_m @night_e { | ||
proxy 00.upstream.local:8080 | ||
} | ||
route @morning { | ||
proxy 01.upstream.local:8080 02.upstream.local:8080 | ||
} | ||
route @afternoon { | ||
proxy 03.upstream.local:8080 04.upstream.local:8080 05.upstream.local:8080 | ||
} | ||
route @evening { | ||
proxy 06.upstream.local:8080 07.upstream.local:8080 | ||
} | ||
} | ||
:8888 { | ||
@la_is_awake clock 08:00:00 20:00:00 America/Los_Angeles | ||
route @la_is_awake { | ||
proxy existing.machine.local:8888 | ||
} | ||
@la_is_asleep not clock 08:00:00 20:00:00 America/Los_Angeles | ||
route @la_is_asleep { | ||
proxy non-existing.machine.local:8888 | ||
} | ||
} | ||
} | ||
} | ||
---------- | ||
{ | ||
"apps": { | ||
"layer4": { | ||
"servers": { | ||
"srv0": { | ||
"listen": [ | ||
":8080" | ||
], | ||
"routes": [ | ||
{ | ||
"match": [ | ||
{ | ||
"clock": { | ||
"after": "00:00:00", | ||
"before": "05:00:00" | ||
} | ||
}, | ||
{ | ||
"clock": { | ||
"after": "21:00:00", | ||
"before": "00:00:00" | ||
} | ||
} | ||
], | ||
"handle": [ | ||
{ | ||
"handler": "proxy", | ||
"upstreams": [ | ||
{ | ||
"dial": [ | ||
"00.upstream.local:8080" | ||
] | ||
} | ||
] | ||
} | ||
] | ||
}, | ||
{ | ||
"match": [ | ||
{ | ||
"clock": { | ||
"after": "05:00:00", | ||
"before": "12:00:00" | ||
} | ||
} | ||
], | ||
"handle": [ | ||
{ | ||
"handler": "proxy", | ||
"upstreams": [ | ||
{ | ||
"dial": [ | ||
"01.upstream.local:8080" | ||
] | ||
}, | ||
{ | ||
"dial": [ | ||
"02.upstream.local:8080" | ||
] | ||
} | ||
] | ||
} | ||
] | ||
}, | ||
{ | ||
"match": [ | ||
{ | ||
"clock": { | ||
"after": "12:00:00", | ||
"before": "17:00:00" | ||
} | ||
} | ||
], | ||
"handle": [ | ||
{ | ||
"handler": "proxy", | ||
"upstreams": [ | ||
{ | ||
"dial": [ | ||
"03.upstream.local:8080" | ||
] | ||
}, | ||
{ | ||
"dial": [ | ||
"04.upstream.local:8080" | ||
] | ||
}, | ||
{ | ||
"dial": [ | ||
"05.upstream.local:8080" | ||
] | ||
} | ||
] | ||
} | ||
] | ||
}, | ||
{ | ||
"match": [ | ||
{ | ||
"clock": { | ||
"after": "17:00:00", | ||
"before": "21:00:00" | ||
} | ||
} | ||
], | ||
"handle": [ | ||
{ | ||
"handler": "proxy", | ||
"upstreams": [ | ||
{ | ||
"dial": [ | ||
"06.upstream.local:8080" | ||
] | ||
}, | ||
{ | ||
"dial": [ | ||
"07.upstream.local:8080" | ||
] | ||
} | ||
] | ||
} | ||
] | ||
} | ||
] | ||
}, | ||
"srv1": { | ||
"listen": [ | ||
":8888" | ||
], | ||
"routes": [ | ||
{ | ||
"match": [ | ||
{ | ||
"clock": { | ||
"after": "08:00:00", | ||
"before": "20:00:00", | ||
"timezone": "America/Los_Angeles" | ||
} | ||
} | ||
], | ||
"handle": [ | ||
{ | ||
"handler": "proxy", | ||
"upstreams": [ | ||
{ | ||
"dial": [ | ||
"existing.machine.local:8888" | ||
] | ||
} | ||
] | ||
} | ||
] | ||
}, | ||
{ | ||
"match": [ | ||
{ | ||
"not": [ | ||
{ | ||
"clock": { | ||
"after": "08:00:00", | ||
"before": "20:00:00", | ||
"timezone": "America/Los_Angeles" | ||
} | ||
} | ||
] | ||
} | ||
], | ||
"handle": [ | ||
{ | ||
"handler": "proxy", | ||
"upstreams": [ | ||
{ | ||
"dial": [ | ||
"non-existing.machine.local:8888" | ||
] | ||
} | ||
] | ||
} | ||
] | ||
} | ||
] | ||
} | ||
} | ||
} | ||
} | ||
} |
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
Oops, something went wrong.