g3proxy: only allow id match in user egress path selection

This commit is contained in:
Zhang Jingqiang 2024-04-19 16:47:57 +08:00
parent 2997dc815c
commit e3ae1fa2f7
21 changed files with 161 additions and 337 deletions

View file

@ -5,13 +5,15 @@ Egress Path Selection
#####################
Usually there are many outgoing ip addresses on proxy machine, and we may provide one to one server port mapping to
each of them. In many cases, we may have one server port mapping to many outgoing ip addresses, and we default to
use a random selection policy, which will match the most common use cases. But for some users, they may want to
connect to such one to many server port, but bind each connection to a specific ip address, so we need a path selection
policy which the user can tell us within each connection negotiation stage.
each of them.
In most cases, we may have one server port mapped to many outgoing ip addresses, and by default using a random selection
policy. But sometimes, users may want to specify which outgoing IP address to use.
Instead of setting up a lot of servers and escapers that are mapped together, we can use only a single pair of server
and escaper with the help of `egress path selection`.
For path selection to work, the escapers used must support and enable it.
Not all escapers support it, see the config documentation for each one for confirmation.
Not all escapers support it, see the config documentation for each escaper for confirmation.
server support
==============
@ -44,18 +46,11 @@ user support
User level egress path selection can be enabled via :ref:`egress_path <config_user_egress_path>` config option.
The supported method is :ref:`by json <proto_egress_path_selection_by_json>`.
The supported method is :ref:`by id map <proto_egress_path_selection_by_id_map>`.
selection methods
=================
default
-------
**value**: constant("default")
The default one, just like no path selection enabled.
.. _proto_egress_path_selection_by_index:
by index
@ -68,10 +63,10 @@ For escapers with multiple nodes (may be next escapers or ip addresses), the nod
The value will be wrapped into range *1 - len(nodes)*.
**NOTE*** the start value is *1*, *0* is the same as *len(nodes) - 1*.
.. _proto_egress_path_selection_by_json:
.. _proto_egress_path_selection_by_id_map:
by json
-------
by id map
---------
**value**: json object
@ -79,4 +74,4 @@ The root value should be a json map.
The key should be the escaper name, so the corresponding value will be handled by that escaper.
The format of the value is defined by each :ref:`escaper <configuration_escaper>` that has such support.
The value should be a `ID` string value, which the meaning will be different on each type of escaper.