(Policy Group) Policy Groups
Policy groups are applied in the policies of rules and can contain multiple proxy servers or other policy groups. The types of policy groups supported are: select (manual selection), auto_test (latency test), fallback (availability test), load_balance (load balancing), and external (external resources used to reference local or remote files). Additionally, Egern also supports two default policies: DIRECT (direct connection) and REJECT (reject connection).
(Select) Manual Selection Policy Group
The manual selection policy group allows users to manually select a sub-policy.
Field Name | Type | Required | Description |
---|---|---|---|
name | string | Yes | Policy name |
policies | array of strings | Yes | Names of sub-policies or proxy servers |
(Auto Test) Latency Test Policy
The latency test policy automatically selects the sub-policy with the lowest latency.
Field Name | Type | Required | Description |
---|---|---|---|
name | string | Yes | Policy name |
policies | array of strings | Yes | Names of sub-policies or proxy servers |
interval | integer | No | Interval for latency tests, default is 10 minutes |
tolerance | integer | No | Allowed latency variation, default is 100 milliseconds |
timeout | integer | No | Latency test timeout, default is 5 seconds |
(Fallback) Availability Test Policy
The availability test policy automatically selects the first accessible sub-policy or proxy.
Field Name | Type | Required | Description |
---|---|---|---|
name | string | Yes | Policy name |
policies | array of strings | Yes | Names of sub-policies or proxy servers |
interval | integer | No | Interval for availability tests, default is 10 minutes |
timeout | integer | No | Availability test timeout, default is 5 seconds |
(Load Balance) Load Balancing Policy
The load balancing policy attempts to evenly distribute traffic across all sub-policies or proxies.
Field Name | Type | Required | Description |
---|---|---|---|
name | string | Yes | Policy name |
policies | array of strings | Yes | Names of sub-policies or proxy servers |
(External) External Resource Policy
This policy uses local or remote policy groups.
Field Name | Type | Required | Description |
---|---|---|---|
name | string | Yes | Policy name |
type | string | Yes | Type of proxy set; options are select , auto_test , fallback , load_balance |
urls | array of strings | Yes | Addresses of proxy servers (local paths or remote links), compatible with Surge and V2Ray formats |
interval | integer | No | Interval for latency tests, default is 10 minutes |
tolerance | integer | No | Allowed latency variation, default is 100 milliseconds |
timeout | integer | No | Latency test timeout, default is 5 seconds |
update_interval | integer | No | Update interval, default is one day |
The local or remote content should be a set of proxy servers.
proxies:
- socks5:
name: Socks5
server: 127.0.0.1
port: 1080
username: ""
password: ""
tfo: true
udp_relay: true
- trojan:
name: Trojan
server: 127.0.0.1
port: 443
sni: bing.com
password: password
tfo: false
udp_relay: true
Configuration Example
Example:
policy_groups:
- select:
name: "Manual Selection"
policies:
- US
- JP
- auto_test:
name: "Latency Test"
policies:
- US
- JP
- fallback:
name: "Availability Test"
policies:
- US
- JP
- load_balance:
name: "Load Balancing"
policies:
- US
- JP
- external:
name: "Remote Proxies"
type: select
urls:
- "https://example/proxies.yaml"
In this configuration, we have set up several policies, including manual selection, latency test, availability test, load balancing, and external resources. Each policy has its own name and lists the proxy servers that can be used for that policy (US
and JP
). In the external resource policy, we have specified a URL for remote proxies.