Ver Fonte

fix(sub): skip AmneziaWG JSON entries (#6420)

Atirna há 9 horas atrás
pai
commit
4e355edc15
2 ficheiros alterados com 8 adições e 0 exclusões
  1. 2 0
      internal/sub/json_service.go
  2. 6 0
      internal/sub/json_service_test.go

+ 2 - 0
internal/sub/json_service.go

@@ -589,6 +589,8 @@ func (s *SubJsonService) getConfig(subReq *SubService, inbound *model.Inbound, c
 				continue
 			}
 			newOutbounds = append(newOutbounds, wgOutbound)
+		case "amneziawg":
+			continue
 		}
 
 		newOutbounds = append(newOutbounds, s.defaultOutbounds...)

+ 6 - 0
internal/sub/json_service_test.go

@@ -514,3 +514,9 @@ func TestSubJsonServiceWireguardNoKey(t *testing.T) {
 		t.Fatalf("genWireguard = %s, want nil for a keyless wireguard client", raw)
 	}
 }
+
+func TestSubJsonServiceSkipsAmneziaWG(t *testing.T) {
+	if got := NewSubJsonService("", "", "", nil).getConfig(&SubService{address: "sub.example.com"}, &model.Inbound{Listen: "203.0.113.8", Port: 51820, Protocol: model.AmneziaWG}, model.Client{}, "sub.example.com"); len(got) != 0 {
+		t.Fatalf("getConfig emitted %d unsupported AmneziaWG Xray config(s)", len(got))
+	}
+}