2016-10-11 17:02:44 -04:00
|
|
|
syntax = "proto3";
|
|
|
|
|
2016-10-12 10:11:13 -04:00
|
|
|
package v2ray.core.app.router;
|
2016-12-22 18:24:28 -05:00
|
|
|
option csharp_namespace = "V2Ray.Core.App.Router";
|
2022-01-02 10:16:23 -05:00
|
|
|
option go_package = "github.com/v2fly/v2ray-core/v5/app/router";
|
2016-10-12 10:11:13 -04:00
|
|
|
option java_package = "com.v2ray.core.app.router";
|
2017-02-03 17:15:10 -05:00
|
|
|
option java_multiple_files = true;
|
2016-10-11 17:02:44 -04:00
|
|
|
|
2021-06-23 09:34:03 -04:00
|
|
|
import "google/protobuf/any.proto";
|
2020-08-24 08:10:26 -04:00
|
|
|
import "common/net/port.proto";
|
|
|
|
import "common/net/network.proto";
|
2021-09-06 17:34:28 -04:00
|
|
|
import "common/protoext/extensions.proto";
|
2021-09-07 04:13:58 -04:00
|
|
|
import "app/router/routercommon/common.proto";
|
2016-10-11 17:02:44 -04:00
|
|
|
|
2017-11-05 11:19:34 -05:00
|
|
|
|
2016-10-11 17:02:44 -04:00
|
|
|
message RoutingRule {
|
2018-11-07 15:08:20 -05:00
|
|
|
oneof target_tag {
|
|
|
|
// Tag of outbound that this rule is pointing to.
|
|
|
|
string tag = 1;
|
|
|
|
|
|
|
|
// Tag of routing balancer.
|
|
|
|
string balancing_tag = 12;
|
|
|
|
}
|
2020-08-09 04:53:45 -04:00
|
|
|
|
2018-11-01 05:39:03 -04:00
|
|
|
// List of domains for target domain matching.
|
2021-09-07 04:13:58 -04:00
|
|
|
repeated v2ray.core.app.router.routercommon.Domain domain = 2;
|
2018-11-01 04:10:41 -04:00
|
|
|
|
|
|
|
// List of CIDRs for target IP address matching.
|
2019-02-24 17:43:00 -05:00
|
|
|
// Deprecated. Use geoip below.
|
2021-09-07 04:13:58 -04:00
|
|
|
repeated v2ray.core.app.router.routercommon.CIDR cidr = 3 [deprecated = true];
|
2020-08-09 04:53:45 -04:00
|
|
|
|
2020-10-04 20:36:40 -04:00
|
|
|
// 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.
|
2021-09-07 04:13:58 -04:00
|
|
|
repeated v2ray.core.app.router.routercommon.GeoIP geoip = 10;
|
2018-11-01 04:10:41 -04:00
|
|
|
|
2020-10-04 20:36:40 -04:00
|
|
|
// A range of port [from, to]. If the destination port is in this range, this
|
|
|
|
// rule takes effect. Deprecated. Use port_list.
|
2019-02-24 17:43:00 -05:00
|
|
|
v2ray.core.common.net.PortRange port_range = 4 [deprecated = true];
|
|
|
|
|
|
|
|
// List of ports.
|
|
|
|
v2ray.core.common.net.PortList port_list = 14;
|
2018-11-20 10:58:26 -05:00
|
|
|
|
|
|
|
// 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;
|
2018-11-01 04:10:41 -04:00
|
|
|
|
|
|
|
// List of CIDRs for source IP address matching.
|
2021-09-07 04:13:58 -04:00
|
|
|
repeated v2ray.core.app.router.routercommon.CIDR source_cidr = 6 [deprecated = true];
|
2018-11-01 04:10:41 -04:00
|
|
|
|
2020-10-04 20:36:40 -04:00
|
|
|
// List of GeoIPs for source IP address matching. If this entry exists, the
|
|
|
|
// source_cidr above will have no effect.
|
2021-09-07 04:13:58 -04:00
|
|
|
repeated v2ray.core.app.router.routercommon.GeoIP source_geoip = 11;
|
2018-11-01 04:10:41 -04:00
|
|
|
|
2020-08-09 04:53:45 -04:00
|
|
|
// List of ports for source port matching.
|
|
|
|
v2ray.core.common.net.PortList source_port_list = 16;
|
|
|
|
|
2016-10-18 17:01:39 -04:00
|
|
|
repeated string user_email = 7;
|
2016-11-13 15:23:34 -05:00
|
|
|
repeated string inbound_tag = 8;
|
2018-07-16 07:47:00 -04:00
|
|
|
repeated string protocol = 9;
|
2019-02-28 08:04:43 -05:00
|
|
|
|
|
|
|
string attributes = 15;
|
2021-03-03 17:23:52 -05:00
|
|
|
|
|
|
|
string domain_matcher = 17;
|
2021-09-07 03:42:34 -04:00
|
|
|
|
|
|
|
// geo_domain instruct simplified config loader to load geo domain rule and fill in domain field.
|
2021-09-07 04:13:58 -04:00
|
|
|
repeated v2ray.core.app.router.routercommon.GeoSite geo_domain = 68001;
|
2016-10-11 17:02:44 -04:00
|
|
|
}
|
|
|
|
|
2018-11-07 15:08:20 -05:00
|
|
|
message BalancingRule {
|
|
|
|
string tag = 1;
|
|
|
|
repeated string outbound_selector = 2;
|
2021-04-08 15:55:25 -04:00
|
|
|
string strategy = 3;
|
2021-06-19 09:36:54 -04:00
|
|
|
google.protobuf.Any strategy_settings = 4;
|
2021-01-29 19:31:11 -05:00
|
|
|
string fallback_tag = 5;
|
|
|
|
}
|
|
|
|
|
|
|
|
message StrategyWeight {
|
|
|
|
bool regexp = 1;
|
|
|
|
string match = 2;
|
2021-06-19 05:50:03 -04:00
|
|
|
float value = 3;
|
|
|
|
}
|
|
|
|
|
2021-09-07 06:48:24 -04:00
|
|
|
message StrategyRandomConfig {
|
|
|
|
option (v2ray.core.common.protoext.message_opt).type = "balancer";
|
|
|
|
option (v2ray.core.common.protoext.message_opt).short_name = "random";
|
2024-03-10 07:00:06 -04:00
|
|
|
|
|
|
|
string observer_tag = 7;
|
|
|
|
bool alive_only = 8;
|
2021-09-07 06:48:24 -04:00
|
|
|
}
|
|
|
|
|
2021-06-19 05:50:03 -04:00
|
|
|
message StrategyLeastPingConfig {
|
2021-09-07 06:48:24 -04:00
|
|
|
option (v2ray.core.common.protoext.message_opt).type = "balancer";
|
|
|
|
option (v2ray.core.common.protoext.message_opt).short_name = "leastping";
|
|
|
|
|
2021-06-19 05:50:03 -04:00
|
|
|
string observer_tag = 7;
|
2021-01-29 19:31:11 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
message StrategyLeastLoadConfig {
|
2021-09-07 06:48:24 -04:00
|
|
|
option (v2ray.core.common.protoext.message_opt).type = "balancer";
|
|
|
|
option (v2ray.core.common.protoext.message_opt).short_name = "leastload";
|
|
|
|
|
2021-01-29 19:31:11 -05:00
|
|
|
// 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;
|
2021-06-19 05:50:03 -04:00
|
|
|
|
|
|
|
string observer_tag = 7;
|
2021-01-29 19:31:11 -05:00
|
|
|
}
|
|
|
|
|
2021-09-06 17:34:28 -04:00
|
|
|
enum DomainStrategy {
|
|
|
|
// Use domain as is.
|
|
|
|
AsIs = 0;
|
2016-10-18 04:31:39 -04:00
|
|
|
|
2021-09-06 17:34:28 -04:00
|
|
|
// Always resolve IP for domains.
|
|
|
|
UseIp = 1;
|
2016-10-18 04:31:39 -04:00
|
|
|
|
2021-09-06 17:34:28 -04:00
|
|
|
// Resolve to IP if the domain doesn't match any rules.
|
|
|
|
IpIfNonMatch = 2;
|
2017-11-15 06:55:47 -05:00
|
|
|
|
2021-09-06 17:34:28 -04:00
|
|
|
// Resolve to IP if any rule requires IP matching.
|
|
|
|
IpOnDemand = 3;
|
|
|
|
}
|
|
|
|
|
|
|
|
message Config {
|
2016-10-11 17:02:44 -04:00
|
|
|
DomainStrategy domain_strategy = 1;
|
|
|
|
repeated RoutingRule rule = 2;
|
2018-11-07 15:08:20 -05:00
|
|
|
repeated BalancingRule balancing_rule = 3;
|
2018-01-04 05:09:23 -05:00
|
|
|
}
|
2021-09-06 17:34:28 -04:00
|
|
|
|
2021-09-09 09:45:19 -04:00
|
|
|
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.
|
2022-08-19 08:41:18 -04:00
|
|
|
v2ray.core.common.net.NetworkList networks = 13;
|
2021-09-09 09:45:19 -04:00
|
|
|
|
|
|
|
// 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;
|
|
|
|
}
|
|
|
|
|
2021-09-06 17:34:28 -04:00
|
|
|
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;
|
2021-09-09 09:45:19 -04:00
|
|
|
repeated SimplifiedRoutingRule rule = 2;
|
2021-09-06 17:34:28 -04:00
|
|
|
repeated BalancingRule balancing_rule = 3;
|
|
|
|
}
|