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