refactor
This commit is contained in:
13 files changed
+1404
-1299
No files matched your search
@@ -1,12 +1,12 @@
|
||||
{
|
||||
lib,
|
||||
cfg,
|
||||
sb,
|
||||
t,
|
||||
ar,
|
||||
art,
|
||||
artp,
|
||||
arz,
|
||||
singBoxCfg,
|
||||
tgWsProxyCfg,
|
||||
appRoutingCfg,
|
||||
appRoutingTun,
|
||||
appRoutingTproxy,
|
||||
appRoutingZapret,
|
||||
builtinTags,
|
||||
outboundTags,
|
||||
invalidRoutingTargets,
|
||||
@@ -19,7 +19,7 @@
|
||||
|
||||
[
|
||||
{
|
||||
assertion = !sb.enable || (sb.outbounds != [ ] || sb.subscriptions != [ ]);
|
||||
assertion = !singBoxCfg.enable || (singBoxCfg.outbounds != [ ] || singBoxCfg.subscriptions != [ ]);
|
||||
message = "proxy-suite: at least one outbound or subscription is required when singBox.enable = true";
|
||||
}
|
||||
{
|
||||
@@ -35,15 +35,15 @@
|
||||
message = "proxy-suite: routing.rules reference unknown outbound tag(s): ${lib.concatStringsSep ", " invalidRoutingTargets}";
|
||||
}
|
||||
{
|
||||
assertion = !(sb.tproxy.enable && sb.tproxy.autostart && sb.tun.enable && sb.tun.autostart);
|
||||
assertion = !(singBoxCfg.tproxy.enable && singBoxCfg.tproxy.autostart && singBoxCfg.tun.enable && singBoxCfg.tun.autostart);
|
||||
message = "proxy-suite: singBox.tproxy.autostart and singBox.tun.autostart cannot both be enabled at the same time";
|
||||
}
|
||||
{
|
||||
assertion = ar.enable || ar.profiles == [ ];
|
||||
assertion = appRoutingCfg.enable || appRoutingCfg.profiles == [ ];
|
||||
message = "proxy-suite: appRouting.profiles requires appRouting.enable = true";
|
||||
}
|
||||
{
|
||||
assertion = !ar.proxychains.enable || ar.enable;
|
||||
assertion = !appRoutingCfg.proxychains.enable || appRoutingCfg.enable;
|
||||
message = "proxy-suite: appRouting.proxychains.enable requires appRouting.enable = true";
|
||||
}
|
||||
{
|
||||
@@ -51,117 +51,117 @@
|
||||
message = "proxy-suite: appRouting profile names must be unique";
|
||||
}
|
||||
{
|
||||
assertion = !hasProxychainsProfiles || ar.proxychains.enable;
|
||||
assertion = !hasProxychainsProfiles || appRoutingCfg.proxychains.enable;
|
||||
message = "proxy-suite: route=proxychains in appRouting.profiles requires appRouting.proxychains.enable = true";
|
||||
}
|
||||
{
|
||||
assertion = !art.enable || ar.enable;
|
||||
assertion = !appRoutingTun.enable || appRoutingCfg.enable;
|
||||
message = "proxy-suite: appRouting.backends.tun.enable requires appRouting.enable = true";
|
||||
}
|
||||
{
|
||||
assertion = !(hasTunProfiles && !art.enable);
|
||||
assertion = !(hasTunProfiles && !appRoutingTun.enable);
|
||||
message = "proxy-suite: route=tun in appRouting profiles requires appRouting.backends.tun.enable = true";
|
||||
}
|
||||
{
|
||||
assertion = !artp.enable || ar.enable;
|
||||
assertion = !appRoutingTproxy.enable || appRoutingCfg.enable;
|
||||
message = "proxy-suite: appRouting.backends.tproxy.enable requires appRouting.enable = true";
|
||||
}
|
||||
{
|
||||
assertion = !(hasTproxyProfiles && !artp.enable);
|
||||
assertion = !(hasTproxyProfiles && !appRoutingTproxy.enable);
|
||||
message = "proxy-suite: route=tproxy in appRouting profiles requires appRouting.backends.tproxy.enable = true";
|
||||
}
|
||||
{
|
||||
assertion = !arz.enable || ar.enable;
|
||||
message = "proxy-suite: appRouting.backends.zapret.enable requires appRouting.enable = true";
|
||||
assertion = !appRoutingZapret.enable || appRoutingCfg.enable;
|
||||
message = "proxy-suite: appRouting.backends.zapretgWsProxyCfg.enable requires appRouting.enable = true";
|
||||
}
|
||||
{
|
||||
assertion = !arz.enable || cfg.zapret.enable;
|
||||
message = "proxy-suite: appRouting.backends.zapret.enable requires zapret.enable = true";
|
||||
assertion = !appRoutingZapret.enable || cfg.zapret.enable;
|
||||
message = "proxy-suite: appRouting.backends.zapretgWsProxyCfg.enable requires zapretgWsProxyCfg.enable = true";
|
||||
}
|
||||
{
|
||||
assertion = !(hasZapretProfiles && (!arz.enable || !cfg.zapret.enable));
|
||||
message = "proxy-suite: route=zapret in appRouting profiles requires appRouting.backends.zapret.enable = true and zapret.enable = true";
|
||||
assertion = !(hasZapretProfiles && (!appRoutingZapret.enable || !cfg.zapret.enable));
|
||||
message = "proxy-suite: route=zapret in appRouting profiles requires appRouting.backends.zapretgWsProxyCfg.enable = true and zapretgWsProxyCfg.enable = true";
|
||||
}
|
||||
{
|
||||
assertion = !(art.enable && sb.tproxy.enable && art.fwmark == sb.fwmark);
|
||||
assertion = !(appRoutingTun.enable && singBoxCfg.tproxy.enable && appRoutingTun.fwmark == singBoxCfg.fwmark);
|
||||
message = "proxy-suite: appRouting.backends.tun.fwmark must differ from singBox.fwmark when singBox.tproxy.enable = true";
|
||||
}
|
||||
{
|
||||
assertion = !(art.enable && sb.tproxy.enable && art.fwmark == sb.proxyMark);
|
||||
assertion = !(appRoutingTun.enable && singBoxCfg.tproxy.enable && appRoutingTun.fwmark == singBoxCfg.proxyMark);
|
||||
message = "proxy-suite: appRouting.backends.tun.fwmark must differ from singBox.proxyMark when singBox.tproxy.enable = true";
|
||||
}
|
||||
{
|
||||
assertion = !(art.enable && sb.tproxy.enable && art.routeTable == sb.routeTable);
|
||||
assertion = !(appRoutingTun.enable && singBoxCfg.tproxy.enable && appRoutingTun.routeTable == singBoxCfg.routeTable);
|
||||
message = "proxy-suite: appRouting.backends.tun.routeTable must differ from singBox.routeTable when singBox.tproxy.enable = true";
|
||||
}
|
||||
{
|
||||
assertion = !(artp.enable && artp.fwmark == sb.fwmark);
|
||||
assertion = !(appRoutingTproxy.enable && appRoutingTproxy.fwmark == singBoxCfg.fwmark);
|
||||
message = "proxy-suite: appRouting.backends.tproxy.fwmark must differ from singBox.fwmark";
|
||||
}
|
||||
{
|
||||
assertion = !(artp.enable && artp.fwmark == sb.proxyMark);
|
||||
assertion = !(appRoutingTproxy.enable && appRoutingTproxy.fwmark == singBoxCfg.proxyMark);
|
||||
message = "proxy-suite: appRouting.backends.tproxy.fwmark must differ from singBox.proxyMark";
|
||||
}
|
||||
{
|
||||
assertion = !(artp.enable && artp.routeTable == sb.routeTable);
|
||||
assertion = !(appRoutingTproxy.enable && appRoutingTproxy.routeTable == singBoxCfg.routeTable);
|
||||
message = "proxy-suite: appRouting.backends.tproxy.routeTable must differ from singBox.routeTable";
|
||||
}
|
||||
{
|
||||
assertion = !(art.enable && artp.enable && art.fwmark == artp.fwmark);
|
||||
assertion = !(appRoutingTun.enable && appRoutingTproxy.enable && appRoutingTun.fwmark == appRoutingTproxy.fwmark);
|
||||
message = "proxy-suite: appRouting.backends.tun.fwmark and appRouting.backends.tproxy.fwmark must differ";
|
||||
}
|
||||
{
|
||||
assertion = !(art.enable && artp.enable && art.routeTable == artp.routeTable);
|
||||
assertion = !(appRoutingTun.enable && appRoutingTproxy.enable && appRoutingTun.routeTable == appRoutingTproxy.routeTable);
|
||||
message = "proxy-suite: appRouting.backends.tun.routeTable and appRouting.backends.tproxy.routeTable must differ";
|
||||
}
|
||||
{
|
||||
assertion = !(arz.enable && arz.filterMark == sb.fwmark);
|
||||
message = "proxy-suite: appRouting.backends.zapret.filterMark must differ from singBox.fwmark";
|
||||
assertion = !(appRoutingZapret.enable && appRoutingZapret.filterMark == singBoxCfg.fwmark);
|
||||
message = "proxy-suite: appRouting.backends.zapretgWsProxyCfg.filterMark must differ from singBox.fwmark";
|
||||
}
|
||||
{
|
||||
assertion = !(arz.enable && arz.filterMark == sb.proxyMark);
|
||||
message = "proxy-suite: appRouting.backends.zapret.filterMark must differ from singBox.proxyMark";
|
||||
assertion = !(appRoutingZapret.enable && appRoutingZapret.filterMark == singBoxCfg.proxyMark);
|
||||
message = "proxy-suite: appRouting.backends.zapretgWsProxyCfg.filterMark must differ from singBox.proxyMark";
|
||||
}
|
||||
{
|
||||
assertion = !(art.enable && arz.enable && art.fwmark == arz.filterMark);
|
||||
message = "proxy-suite: appRouting.backends.tun.fwmark and appRouting.backends.zapret.filterMark must differ";
|
||||
assertion = !(appRoutingTun.enable && appRoutingZapret.enable && appRoutingTun.fwmark == appRoutingZapret.filterMark);
|
||||
message = "proxy-suite: appRouting.backends.tun.fwmark and appRouting.backends.zapretgWsProxyCfg.filterMark must differ";
|
||||
}
|
||||
{
|
||||
assertion = !(artp.enable && arz.enable && artp.fwmark == arz.filterMark);
|
||||
message = "proxy-suite: appRouting.backends.tproxy.fwmark and appRouting.backends.zapret.filterMark must differ";
|
||||
assertion = !(appRoutingTproxy.enable && appRoutingZapret.enable && appRoutingTproxy.fwmark == appRoutingZapret.filterMark);
|
||||
message = "proxy-suite: appRouting.backends.tproxy.fwmark and appRouting.backends.zapretgWsProxyCfg.filterMark must differ";
|
||||
}
|
||||
{
|
||||
assertion = !(arz.enable && builtins.elem arz.filterMark [ 536870912 1073741824 ]);
|
||||
message = "proxy-suite: appRouting.backends.zapret.filterMark must not use zapret internal desync mark bits";
|
||||
assertion = !(appRoutingZapret.enable && builtins.elem appRoutingZapret.filterMark [ 536870912 1073741824 ]);
|
||||
message = "proxy-suite: appRouting.backends.zapretgWsProxyCfg.filterMark must not use zapret internal desync mark bits";
|
||||
}
|
||||
{
|
||||
assertion = !(arz.enable && builtins.elem sb.fwmark [ 67108864 134217728 ]);
|
||||
assertion = !(appRoutingZapret.enable && builtins.elem singBoxCfg.fwmark [ 67108864 134217728 ]);
|
||||
message = "proxy-suite: singBox.fwmark must not use app-zapret internal desync mark bits";
|
||||
}
|
||||
{
|
||||
assertion = !(arz.enable && builtins.elem sb.proxyMark [ 67108864 134217728 ]);
|
||||
assertion = !(appRoutingZapret.enable && builtins.elem singBoxCfg.proxyMark [ 67108864 134217728 ]);
|
||||
message = "proxy-suite: singBox.proxyMark must not use app-zapret internal desync mark bits";
|
||||
}
|
||||
{
|
||||
assertion = !(art.enable && arz.enable && builtins.elem art.fwmark [ 67108864 134217728 ]);
|
||||
assertion = !(appRoutingTun.enable && appRoutingZapret.enable && builtins.elem appRoutingTun.fwmark [ 67108864 134217728 ]);
|
||||
message = "proxy-suite: appRouting.backends.tun.fwmark must not use app-zapret internal desync mark bits";
|
||||
}
|
||||
{
|
||||
assertion = !(artp.enable && arz.enable && builtins.elem artp.fwmark [ 67108864 134217728 ]);
|
||||
assertion = !(appRoutingTproxy.enable && appRoutingZapret.enable && builtins.elem appRoutingTproxy.fwmark [ 67108864 134217728 ]);
|
||||
message = "proxy-suite: appRouting.backends.tproxy.fwmark must not use app-zapret internal desync mark bits";
|
||||
}
|
||||
{
|
||||
assertion = !(arz.enable && builtins.elem arz.filterMark [ 67108864 134217728 ]);
|
||||
message = "proxy-suite: appRouting.backends.zapret.filterMark must not use app-zapret internal desync mark bits";
|
||||
assertion = !(appRoutingZapret.enable && builtins.elem appRoutingZapret.filterMark [ 67108864 134217728 ]);
|
||||
message = "proxy-suite: appRouting.backends.zapretgWsProxyCfg.filterMark must not use app-zapret internal desync mark bits";
|
||||
}
|
||||
{
|
||||
assertion =
|
||||
!t.enable
|
||||
!tgWsProxyCfg.enable
|
||||
||
|
||||
builtins.length (
|
||||
builtins.filter (x: x != null) [
|
||||
t.secret
|
||||
t.secretFile
|
||||
tgWsProxyCfg.secret
|
||||
tgWsProxyCfg.secretFile
|
||||
]
|
||||
) == 1;
|
||||
message = "proxy-suite: tgWsProxy requires exactly one of secret or secretFile";
|
||||
@@ -179,7 +179,7 @@
|
||||
) == 1;
|
||||
message = "proxy-suite: outbound '${ob.tag}': set exactly one of urlFile, url, or json";
|
||||
}
|
||||
]) sb.outbounds
|
||||
]) singBoxCfg.outbounds
|
||||
++ lib.concatMap (sub: [
|
||||
{
|
||||
assertion =
|
||||
@@ -191,4 +191,4 @@
|
||||
) == 1;
|
||||
message = "proxy-suite: subscription '${sub.tag}': set exactly one of urlFile or url";
|
||||
}
|
||||
]) sb.subscriptions
|
||||
]) singBoxCfg.subscriptions
|
||||
Reference in new issue
Block a user