modules/monitoring: add sing-box monitoring

This commit is contained in:
xinyangli 2024-12-10 12:04:54 +08:00
parent e4fd9e8b23
commit dacd22b7d2
Signed by: xin
SSH key fingerprint: SHA256:UU5pRTl7NiLFJbWJZa+snLylZSXIz5rgHmwjzv8v4oE
6 changed files with 69 additions and 0 deletions

View file

@ -1,5 +1,6 @@
{
config,
pkgs,
lib,
...
}:
@ -114,7 +115,24 @@ let
}
]);
};
experimental = {
v2ray_api = {
listen = "127.0.0.1:15175";
stats = {
users = map (u: u.name) users;
enabled = true;
inbounds = map (p: "sg" + toString p) (lib.range 0 4);
};
};
};
};
sing-box = pkgs.sing-box.overrideAttrs (
finalAttrs: previousAttrs: {
tags = previousAttrs.tags ++ [
"with_v2ray_api"
];
}
);
in
{
options.commonSettings.proxyServer = {
@ -166,6 +184,7 @@ in
services.sing-box = {
enable = true;
package = sing-box;
settings = (
mkSingConfig (
map (n: {