github.com/xraypb/Xray-core@v1.8.1/app/router/config.proto (about) 1 syntax = "proto3"; 2 3 package xray.app.router; 4 option csharp_namespace = "Xray.App.Router"; 5 option go_package = "github.com/xraypb/Xray-core/app/router"; 6 option java_package = "com.xray.app.router"; 7 option java_multiple_files = true; 8 9 import "common/net/port.proto"; 10 import "common/net/network.proto"; 11 12 // Domain for routing decision. 13 message Domain { 14 // Type of domain value. 15 enum Type { 16 // The value is used as is. 17 Plain = 0; 18 // The value is used as a regular expression. 19 Regex = 1; 20 // The value is a root domain. 21 Domain = 2; 22 // The value is a domain. 23 Full = 3; 24 } 25 26 // Domain matching type. 27 Type type = 1; 28 29 // Domain value. 30 string value = 2; 31 32 message Attribute { 33 string key = 1; 34 35 oneof typed_value { 36 bool bool_value = 2; 37 int64 int_value = 3; 38 } 39 } 40 41 // Attributes of this domain. May be used for filtering. 42 repeated Attribute attribute = 3; 43 } 44 45 // IP for routing decision, in CIDR form. 46 message CIDR { 47 // IP address, should be either 4 or 16 bytes. 48 bytes ip = 1; 49 50 // Number of leading ones in the network mask. 51 uint32 prefix = 2; 52 } 53 54 message GeoIP { 55 string country_code = 1; 56 repeated CIDR cidr = 2; 57 bool reverse_match = 3; 58 } 59 60 message GeoIPList { 61 repeated GeoIP entry = 1; 62 } 63 64 message GeoSite { 65 string country_code = 1; 66 repeated Domain domain = 2; 67 } 68 69 message GeoSiteList { 70 repeated GeoSite entry = 1; 71 } 72 73 message RoutingRule { 74 oneof target_tag { 75 // Tag of outbound that this rule is pointing to. 76 string tag = 1; 77 78 // Tag of routing balancer. 79 string balancing_tag = 12; 80 } 81 82 // List of domains for target domain matching. 83 repeated Domain domain = 2; 84 85 // List of CIDRs for target IP address matching. 86 // Deprecated. Use geoip below. 87 repeated CIDR cidr = 3 [deprecated = true]; 88 89 // List of GeoIPs for target IP address matching. If this entry exists, the 90 // cidr above will have no effect. GeoIP fields with the same country code are 91 // supposed to contain exactly same content. They will be merged during 92 // runtime. For customized GeoIPs, please leave country code empty. 93 repeated GeoIP geoip = 10; 94 95 // A range of port [from, to]. If the destination port is in this range, this 96 // rule takes effect. Deprecated. Use port_list. 97 xray.common.net.PortRange port_range = 4 [deprecated = true]; 98 99 // List of ports. 100 xray.common.net.PortList port_list = 14; 101 102 // List of networks. Deprecated. Use networks. 103 xray.common.net.NetworkList network_list = 5 [deprecated = true]; 104 105 // List of networks for matching. 106 repeated xray.common.net.Network networks = 13; 107 108 // List of CIDRs for source IP address matching. 109 repeated CIDR source_cidr = 6 [deprecated = true]; 110 111 // List of GeoIPs for source IP address matching. If this entry exists, the 112 // source_cidr above will have no effect. 113 repeated GeoIP source_geoip = 11; 114 115 // List of ports for source port matching. 116 xray.common.net.PortList source_port_list = 16; 117 118 repeated string user_email = 7; 119 repeated string inbound_tag = 8; 120 repeated string protocol = 9; 121 122 string attributes = 15; 123 124 string domain_matcher = 17; 125 } 126 127 message BalancingRule { 128 string tag = 1; 129 repeated string outbound_selector = 2; 130 string strategy = 3; 131 } 132 133 message Config { 134 enum DomainStrategy { 135 // Use domain as is. 136 AsIs = 0; 137 138 // Always resolve IP for domains. 139 UseIp = 1; 140 141 // Resolve to IP if the domain doesn't match any rules. 142 IpIfNonMatch = 2; 143 144 // Resolve to IP if any rule requires IP matching. 145 IpOnDemand = 3; 146 } 147 DomainStrategy domain_strategy = 1; 148 repeated RoutingRule rule = 2; 149 repeated BalancingRule balancing_rule = 3; 150 }