-
Notifications
You must be signed in to change notification settings - Fork 4.7k
/
config.proto
190 lines (143 loc) · 5.79 KB
/
config.proto
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
syntax = "proto3";
package v2ray.core.app.router;
option csharp_namespace = "V2Ray.Core.App.Router";
option go_package = "github.com/v2fly/v2ray-core/v5/app/router";
option java_package = "com.v2ray.core.app.router";
option java_multiple_files = true;
import "google/protobuf/any.proto";
import "common/net/port.proto";
import "common/net/network.proto";
import "common/protoext/extensions.proto";
import "app/router/routercommon/common.proto";
message RoutingRule {
oneof target_tag {
// Tag of outbound that this rule is pointing to.
string tag = 1;
// Tag of routing balancer.
string balancing_tag = 12;
}
// List of domains for target domain matching.
repeated v2ray.core.app.router.routercommon.Domain domain = 2;
// List of CIDRs for target IP address matching.
// Deprecated. Use geoip below.
repeated v2ray.core.app.router.routercommon.CIDR cidr = 3 [deprecated = true];
// List of GeoIPs for target IP address matching. If this entry exists, the
// cidr above will have no effect. GeoIP fields with the same country code are
// supposed to contain exactly same content. They will be merged during
// runtime. For customized GeoIPs, please leave country code empty.
repeated v2ray.core.app.router.routercommon.GeoIP geoip = 10;
// A range of port [from, to]. If the destination port is in this range, this
// rule takes effect. Deprecated. Use port_list.
v2ray.core.common.net.PortRange port_range = 4 [deprecated = true];
// List of ports.
v2ray.core.common.net.PortList port_list = 14;
// List of networks. Deprecated. Use networks.
v2ray.core.common.net.NetworkList network_list = 5 [deprecated = true];
// List of networks for matching.
repeated v2ray.core.common.net.Network networks = 13;
// List of CIDRs for source IP address matching.
repeated v2ray.core.app.router.routercommon.CIDR source_cidr = 6 [deprecated = true];
// List of GeoIPs for source IP address matching. If this entry exists, the
// source_cidr above will have no effect.
repeated v2ray.core.app.router.routercommon.GeoIP source_geoip = 11;
// List of ports for source port matching.
v2ray.core.common.net.PortList source_port_list = 16;
repeated string user_email = 7;
repeated string inbound_tag = 8;
repeated string protocol = 9;
string attributes = 15;
string domain_matcher = 17;
// geo_domain instruct simplified config loader to load geo domain rule and fill in domain field.
repeated v2ray.core.app.router.routercommon.GeoSite geo_domain = 68001;
}
message BalancingRule {
string tag = 1;
repeated string outbound_selector = 2;
string strategy = 3;
google.protobuf.Any strategy_settings = 4;
string fallback_tag = 5;
}
message StrategyWeight {
bool regexp = 1;
string match = 2;
float value = 3;
}
message StrategyRandomConfig {
option (v2ray.core.common.protoext.message_opt).type = "balancer";
option (v2ray.core.common.protoext.message_opt).short_name = "random";
string observer_tag = 7;
bool alive_only = 8;
}
message StrategyLeastPingConfig {
option (v2ray.core.common.protoext.message_opt).type = "balancer";
option (v2ray.core.common.protoext.message_opt).short_name = "leastping";
string observer_tag = 7;
}
message StrategyLeastLoadConfig {
option (v2ray.core.common.protoext.message_opt).type = "balancer";
option (v2ray.core.common.protoext.message_opt).short_name = "leastload";
// weight settings
repeated StrategyWeight costs = 2;
// RTT baselines for selecting, int64 values of time.Duration
repeated int64 baselines = 3;
// expected nodes count to select
int32 expected = 4;
// max acceptable rtt, filter away high delay nodes. defalut 0
int64 maxRTT = 5;
// acceptable failure rate
float tolerance = 6;
string observer_tag = 7;
}
enum DomainStrategy {
// Use domain as is.
AsIs = 0;
// Always resolve IP for domains.
UseIp = 1;
// Resolve to IP if the domain doesn't match any rules.
IpIfNonMatch = 2;
// Resolve to IP if any rule requires IP matching.
IpOnDemand = 3;
}
message Config {
DomainStrategy domain_strategy = 1;
repeated RoutingRule rule = 2;
repeated BalancingRule balancing_rule = 3;
}
message SimplifiedRoutingRule {
oneof target_tag {
// Tag of outbound that this rule is pointing to.
string tag = 1;
// Tag of routing balancer.
string balancing_tag = 12;
}
// List of domains for target domain matching.
repeated v2ray.core.app.router.routercommon.Domain domain = 2;
// List of GeoIPs for target IP address matching. If this entry exists, the
// cidr above will have no effect. GeoIP fields with the same country code are
// supposed to contain exactly same content. They will be merged during
// runtime. For customized GeoIPs, please leave country code empty.
repeated v2ray.core.app.router.routercommon.GeoIP geoip = 10;
// List of ports.
string port_list = 14;
// List of networks for matching.
v2ray.core.common.net.NetworkList networks = 13;
// List of GeoIPs for source IP address matching. If this entry exists, the
// source_cidr above will have no effect.
repeated v2ray.core.app.router.routercommon.GeoIP source_geoip = 11;
// List of ports for source port matching.
string source_port_list = 16;
repeated string user_email = 7;
repeated string inbound_tag = 8;
repeated string protocol = 9;
string attributes = 15;
string domain_matcher = 17;
// geo_domain instruct simplified config loader to load geo domain rule and fill in domain field.
repeated v2ray.core.app.router.routercommon.GeoSite geo_domain = 68001;
}
message SimplifiedConfig {
option (v2ray.core.common.protoext.message_opt).type = "service";
option (v2ray.core.common.protoext.message_opt).short_name = "router";
DomainStrategy domain_strategy = 1;
repeated SimplifiedRoutingRule rule = 2;
repeated BalancingRule balancing_rule = 3;
}