瀏覽代碼

Fix usage of source in context

Darien Raymond 8 年之前
父節點
當前提交
9716d7fdfe
共有 1 個文件被更改,包括 8 次插入0 次删除
  1. 8 0
      app/router/condition.go

+ 8 - 0
app/router/condition.go

@@ -131,6 +131,10 @@ func (v *CIDRMatcher) Apply(ctx context.Context) bool {
 		dest = proxy.DestinationFromContext(ctx)
 	}
 
+	if !dest.IsValid() {
+		return false
+	}
+
 	if !dest.Address.Family().Either(v2net.AddressFamilyIPv4, v2net.AddressFamilyIPv6) {
 		return false
 	}
@@ -169,6 +173,10 @@ func (v *IPv4Matcher) Apply(ctx context.Context) bool {
 	} else {
 		dest = proxy.DestinationFromContext(ctx)
 	}
+	if !dest.IsValid() {
+		return false
+	}
+
 	if !dest.Address.Family().Either(v2net.AddressFamilyIPv4) {
 		return false
 	}