mirror of https://github.com/v2ray/v2ray-core
				
				
				
			
							parent
							
								
									4257d1a0ed
								
							
						
					
					
						commit
						e13def10c4
					
				|  | @ -13,6 +13,33 @@ import ( | |||
| 	"v2ray.com/ext/sysio" | ||||
| ) | ||||
| 
 | ||||
| func TestGeoIPMatcherContainer(t *testing.T) { | ||||
| 	container := &router.GeoIPMatcherContainer{} | ||||
| 
 | ||||
| 	m1, err := container.Add(&router.GeoIP{ | ||||
| 		CountryCode: "CN", | ||||
| 	}) | ||||
| 	common.Must(err) | ||||
| 
 | ||||
| 	m2, err := container.Add(&router.GeoIP{ | ||||
| 		CountryCode: "US", | ||||
| 	}) | ||||
| 	common.Must(err) | ||||
| 
 | ||||
| 	m3, err := container.Add(&router.GeoIP{ | ||||
| 		CountryCode: "CN", | ||||
| 	}) | ||||
| 	common.Must(err) | ||||
| 
 | ||||
| 	if m1 != m3 { | ||||
| 		t.Error("expect same matcher for same geoip, but not") | ||||
| 	} | ||||
| 
 | ||||
| 	if m1 == m2 { | ||||
| 		t.Error("expect different matcher for different geoip, but actually same") | ||||
| 	} | ||||
| } | ||||
| 
 | ||||
| func TestGeoIPMatcher(t *testing.T) { | ||||
| 	cidrList := router.CIDRList{ | ||||
| 		{Ip: []byte{0, 0, 0, 0}, Prefix: 8}, | ||||
|  |  | |||
		Loading…
	
		Reference in New Issue
	
	 Darien Raymond
						Darien Raymond