103 Commits

Author SHA1 Message Date
Umputun
5774737128 Handle default and concrete server match conflict #192
- Drop default server match if a concrete server match is found
- Add test case to validate behavior
2024-05-23 12:08:59 -05:00
Umputun
57552c1798 Added support for wildcard prefix in server patterns (#191)
* Added support for wildcard prefix in server patterns

This update introduces the ability to use a wildcard prefix in server patterns for domain matching. It also includes corresponding tests for this new functionality, ensuring "*.domain.com" style patterns can be handled correctly.
2024-05-23 01:56:58 -05:00
Umputun
271beedc99 Added host substitution in MTProxy match type #189
A host substitution functionality has been added to the match logic for the MTProxy match type. This allows for more flexible routing rules, enabling the replacement of "$host" and "${host}" placeholders in the destination URL with the server name, before performing the regex match. Updated corresponding tests to reflect this change.

make additional test without host substitution

add test with ${host} substitution
2024-05-21 22:51:41 -05:00
Dmitry Verkhoturov
0a9e489743 update github.com/didip/tollbooth from v6 to v7 2024-05-09 13:16:40 -05:00
rashpile
7ce7e18931 docker api 1.22 is deprecated -> minimal supported version is 1.24 2024-02-01 14:41:39 -06:00
Sergey Ninua
fe24cf99ef Implement Host header bypassing (#155)
* Initial implementation of keep-host argument

* Add keep-host parsing to the consulcatalog provider

* Update docs

* update from the current master

---------
by @ffix
2024-01-25 03:28:54 -06:00
Umputun
672d4c2af8 add info about limited ip to logs 2023-11-26 16:52:16 -06:00
Umputun
a896f08eec add middleware to optionally allow requests from giving ips/ranges
add new remote param to docker and file providers

lint: http nil body

add support of remote ips to consul provider

local implementation of onlyfrom middleware

lint: missing comment

make proxy tests more readable

preffer public IP if any forwwarded
2023-11-26 16:17:04 -06:00
Nikita Shoshin
2b92c11cc9 fix redirects
Before this change redirects didn't work because method `Service.extendMapper` didn't copy
the value of `URLMapper.RedirectType` to the extended result.

To fix this we return the original `URLMapper` instead of creating a new one (it can also help
to avoid similar bugs in the future). We can reuse `URLMapper` because it is passed
by value.
2023-05-13 22:48:22 -05:00
Umputun
34d9f4d1d5 lint: minor warn on deferred close 2023-02-27 00:00:04 -06:00
Umputun
ca65980093 fix redirects for docker provider 2023-02-25 22:30:54 -06:00
Umputun
22063f08cd fix docker's labels max, make it include .9 for real 2023-02-25 12:57:16 -06:00
Umputun
0ce326dbaa update deps, switch to go 1.19 2022-09-06 22:24:41 -05:00
Umputun
075f66825a update linter and address all lint warns 2021-11-09 12:47:41 -06:00
Alexey Nesterov
184d5ba87c Support regex in host / server
Main consideration is backward compatibility. example.com should be treated as an exact
match, where possible. So current order is: exact host, regex host, * or "".

Regex matches are cached for better performance, cache is invalidated once mappings are refreshed.
2021-11-04 12:00:17 -05:00
Umputun
506ded3ad4 add a warning on missing configuration file for file provider 2021-08-28 12:25:07 -05:00
Umputun
d364904dd8 fix flaky tests 2021-08-12 22:31:15 -05:00
Umputun
9218ad8bac simplify unnecessary complicated TestCheckHealth 2021-07-08 17:08:35 -05:00
Umputun
5dcb303615 fix comment typo 2021-06-26 12:12:47 -05:00
Umputun
503f0b6dca drop regex group in source priority sorting #89 2021-06-08 15:32:35 -05:00
Umputun
297612e7c4 add test 2021-06-08 03:53:16 -05:00
Umputun
247cf13016 fix static match / without webroot defined 2021-06-08 03:48:37 -05:00
Umputun
3fb723c8b9 fix static match on / url 2021-06-08 03:28:30 -05:00
Umputun
3497599d03 add comments and fix docs 2021-06-08 00:45:16 -05:00
Umputun
f0049ef7ac add support of spa-like assets handling 2021-06-07 19:16:18 -05:00
Umputun
fb57a6bb45 remove commented code 2021-06-07 14:54:31 -05:00
Umputun
f8f5871411 quick attempt to de-prioritize assets rules 2021-06-07 14:54:09 -05:00
Umputun
aea74d717f Redirect (#87)
* add @code redirect prefix

* add proxy handling for redirects #86

* add info about redirects
2021-06-06 18:13:59 -05:00
Umputun
7139c57766 RPC plugins support (#85)
* wip

* resolve merge artifacts

* full coverage for conductor

* wire plugin conductor to main and proxy

* wip, with separate match handler

* split matching logic with another handler, add initial docs

* move parts of proxy to handlers, add tests

* add headers in to be sent to proxied url

* merged from master

* add example with docker compose

* supress excesive debug reporting 0-9 disabled in docker

* add plugin tests

* randomize test port

* lint: minor warns

* lint: err shadow
2021-06-01 02:56:39 -05:00
Umputun
556a34f1fb allow reproxy.server to be default for numeric rules 2021-05-26 01:45:42 -05:00
Umputun
e092c7e989 allow docker rules to use external destinations 2021-05-26 00:17:45 -05:00
Umputun
1c1f9d1c3c Docker multi routes (#80)
* support reproxy.N.something labels for docker #78

* lint: suppress false positive

* update linter in ci

* update readme

* add test for failed container parse
2021-05-25 23:48:22 -05:00
Umputun
7e8dca4ccc allow skipping ping param in static provider 2021-05-20 13:14:37 -05:00
Umputun
52e9e7a738 add more time intervals to file event tests 2021-05-18 02:31:36 -05:00
Umputun
095f4d7102 Multi match (#74)
* discovery support for multiple matches

* switch proxy matcher usage, add random selection

* fix multi-match logic

* pass match picker func

* simplify rand picker

* update health params and docs

* fix early termination on discovery multi-match

* add grouping of sorted matches in sorted result

* add mention of live check to readme
2021-05-16 18:34:51 -05:00
nikolay.bystritskiy
bfe5f3fdbf fix ticker, variable names and unnecessary if in Service.Match 2021-05-16 14:17:50 -05:00
nikolay.bystritskiy
e02ddaf256 fix linter warning 2021-05-16 14:17:50 -05:00
nikolay.bystritskiy
49515e307c update health state not sorting or reordering mappers 2021-05-16 14:17:50 -05:00
nikolay.bystritskiy
7bbb7073ba unittest, typos 2021-05-16 14:17:50 -05:00
nikolay.bystritskiy
973d6c9a14 add automatic health-checker 2021-05-16 14:17:50 -05:00
Umputun
d982796e58 simplify consul client a little bit 2021-05-13 02:00:13 -05:00
Negasus
01ae284390 add nolint:prealloc 2021-05-13 01:14:04 -05:00
Negasus
738c3baf6c add consul catalog provider 2021-05-13 01:14:04 -05:00
Umputun
9b9d64894d reproxy.port to enable container 2021-04-28 14:37:11 -05:00
Umputun
2670144e8a add support of docker route prefix 2021-04-28 14:00:38 -05:00
Umputun
69bb10d42f fix default docker dest to include container 2021-04-28 13:40:59 -05:00
Umputun
604391e55e extend tests for tricky cases 2021-04-27 01:57:04 -05:00
Umputun
efded2cf5e flip order in docker proxy+static labels #55
we want proxy rule to have priority over assets rule
2021-04-23 04:05:14 -05:00
Umputun
1aa89cfbd6 fix docker resp struct 2021-04-17 22:55:32 -05:00
Timofey
e7121846da Handle docker API errors 2021-04-17 22:37:32 -05:00