feat(wip): xray proxy backend
This commit is contained in:
36 files changed
+2265
-996
No files matched your search
@@ -4,28 +4,47 @@
|
||||
}:
|
||||
|
||||
let
|
||||
singBoxCfg = cfg.singBox;
|
||||
proxyCfg = cfg.proxy;
|
||||
singBoxCfg =
|
||||
proxyCfg
|
||||
// {
|
||||
enable = proxyCfg.enable && proxyCfg.singBox.enable;
|
||||
package = proxyCfg.singBox.package;
|
||||
clashApiPort = proxyCfg.singBox.clashApiPort;
|
||||
urlTest = proxyCfg.urlTest // { tolerance = proxyCfg.singBox.urlTest.tolerance; };
|
||||
};
|
||||
xrayCfg = proxyCfg.xray;
|
||||
proxyEnabled = proxyCfg.enable;
|
||||
singBoxEnabled = proxyCfg.enable && proxyCfg.singBox.enable;
|
||||
xrayEnabled = proxyCfg.enable && proxyCfg.xray.enable;
|
||||
activeBackend =
|
||||
if xrayEnabled then
|
||||
"xray"
|
||||
else if singBoxEnabled then
|
||||
"sing-box"
|
||||
else
|
||||
null;
|
||||
perAppRoutingCfg = cfg.perAppRouting;
|
||||
globalTun = singBoxCfg.tun;
|
||||
globalTproxy = singBoxCfg.tproxy;
|
||||
perAppRoutingTun = singBoxCfg.tun.perApp;
|
||||
perAppRoutingTproxy = singBoxCfg.tproxy.perApp;
|
||||
globalTun = proxyCfg.tun;
|
||||
globalTproxy = proxyCfg.tproxy;
|
||||
perAppRoutingTun = proxyCfg.tun.perApp;
|
||||
perAppRoutingTproxy = proxyCfg.tproxy.perApp;
|
||||
perAppZapretCfg = cfg.zapret.perApp;
|
||||
userControlCfg = cfg.userControl;
|
||||
|
||||
selectionMode = singBoxCfg.selection;
|
||||
selectionMode = proxyCfg.selection;
|
||||
builtinTags = [
|
||||
"proxy"
|
||||
"direct"
|
||||
"block"
|
||||
];
|
||||
outboundTags = map (ob: ob.tag) singBoxCfg.outbounds;
|
||||
subscriptionTags = map (sub: sub.tag) singBoxCfg.subscriptions;
|
||||
outboundTags = map (ob: ob.tag) proxyCfg.outbounds;
|
||||
subscriptionTags = map (sub: sub.tag) proxyCfg.subscriptions;
|
||||
|
||||
hasStaticOutbounds = singBoxCfg.outbounds != [ ];
|
||||
hasSubscriptions = singBoxCfg.subscriptions != [ ];
|
||||
hasStaticOutbounds = proxyCfg.outbounds != [ ];
|
||||
hasSubscriptions = proxyCfg.subscriptions != [ ];
|
||||
collapseNamedOutbounds = selectionMode == "first";
|
||||
clashApiEnabled = selectionMode != "first";
|
||||
clashApiEnabled = singBoxEnabled && selectionMode != "first";
|
||||
perAppZapretEnabled = perAppZapretCfg.enable;
|
||||
userControlEnabled = userControlCfg.global.enable || userControlCfg.perApp.enable;
|
||||
|
||||
@@ -33,13 +52,19 @@ let
|
||||
map (rule: rule.outbound) (
|
||||
builtins.filter (
|
||||
rule: !builtins.elem rule.outbound (builtinTags ++ outboundTags)
|
||||
) singBoxCfg.routing.rules
|
||||
) proxyCfg.routing.rules
|
||||
)
|
||||
);
|
||||
in
|
||||
{
|
||||
inherit
|
||||
proxyCfg
|
||||
singBoxCfg
|
||||
xrayCfg
|
||||
proxyEnabled
|
||||
singBoxEnabled
|
||||
xrayEnabled
|
||||
activeBackend
|
||||
perAppRoutingCfg
|
||||
globalTun
|
||||
globalTproxy
|
||||
|
||||
Reference in new issue
Block a user