parent
8761690691
commit
d9f3f554e5
@ -5,9 +5,9 @@ PKG_RELEASE:=1
|
||||
|
||||
PKG_SOURCE_PROTO:=git
|
||||
PKG_SOURCE_URL:=https://github.com/MetaCubeX/mihomo.git
|
||||
PKG_SOURCE_DATE:=2025-04-17
|
||||
PKG_SOURCE_VERSION:=76052b5b26f532b916643edf0b24782fa3195fb2
|
||||
PKG_MIRROR_HASH:=346ada947d1408bb81faf19cada29d2a70d71f1accf967221c7e1b362d4fbcab
|
||||
PKG_SOURCE_DATE:=2025-04-18
|
||||
PKG_SOURCE_VERSION:=619c9dc0c633c12ac46e38b7b423e7c01f06197f
|
||||
PKG_MIRROR_HASH:=907be1b4f33e71bd9aa36f0cd76aefbce39a1b346f80ff09730c47fa80be4658
|
||||
|
||||
PKG_LICENSE:=GPL3.0+
|
||||
PKG_MAINTAINER:=Joseph Mory <morytyann@gmail.com>
|
||||
@ -16,7 +16,7 @@ PKG_BUILD_DEPENDS:=golang/host
|
||||
PKG_BUILD_PARALLEL:=1
|
||||
PKG_BUILD_FLAGS:=no-mips16
|
||||
|
||||
PKG_BUILD_VERSION:=alpha-76052b5
|
||||
PKG_BUILD_VERSION:=alpha-619c9dc
|
||||
PKG_BUILD_TIME:=$(shell date -u -Iseconds)
|
||||
|
||||
GO_PKG:=github.com/metacubex/mihomo
|
||||
|
@ -42,9 +42,12 @@ fi
|
||||
`
|
||||
ucode -S -e '
|
||||
import { cursor } from "uci";
|
||||
|
||||
const uci = cursor();
|
||||
|
||||
const config = uci.get_all("nikki");
|
||||
const result = {};
|
||||
|
||||
for (let section_id in config) {
|
||||
const section = config[section_id];
|
||||
const section_type = section[".type"];
|
||||
@ -61,13 +64,45 @@ for (let section_type in result) {
|
||||
delete section[".index"];
|
||||
}
|
||||
}
|
||||
for (let x in result["subscription"]) {
|
||||
x["url"] = "*";
|
||||
if (exists(result, "mixin")) {
|
||||
for (let x in result["mixin"]) {
|
||||
if (exists(x, "api_secret")) {
|
||||
x["api_secret"] = "*";
|
||||
}
|
||||
}
|
||||
}
|
||||
for (let x in result["lan_access_control"]) {
|
||||
x["ip"] = "*";
|
||||
x["ip6"] = "*";
|
||||
x["mac"] = "*";
|
||||
if (exists(result, "authentication")) {
|
||||
for (let x in result["authentication"]) {
|
||||
if (exists(x, "password")) {
|
||||
x["password"] = "*";
|
||||
}
|
||||
}
|
||||
}
|
||||
if (exists(result, "subscription")) {
|
||||
for (let x in result["subscription"]) {
|
||||
if (exists(x, "url")) {
|
||||
x["url"] = "*";
|
||||
}
|
||||
}
|
||||
}
|
||||
if (exists(result, "lan_access_control")) {
|
||||
for (let x in result["lan_access_control"]) {
|
||||
if (exists(x, "ip")) {
|
||||
for (let i = 0; i < length(x["ip"]); i++) {
|
||||
x["ip"][i] = "*";
|
||||
}
|
||||
}
|
||||
if (exists(x, "ip6")) {
|
||||
for (let i = 0; i < length(x["ip6"]); i++) {
|
||||
x["ip6"][i] = "*";
|
||||
}
|
||||
}
|
||||
if (exists(x, "mac")) {
|
||||
for (let i = 0; i < length(x["mac"]); i++) {
|
||||
x["mac"][i] = "*";
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
delete result["status"];
|
||||
delete result["editor"];
|
||||
@ -77,53 +112,83 @@ print(result);
|
||||
`
|
||||
\`\`\`
|
||||
## profile
|
||||
\`\`\`yaml
|
||||
\`\`\`json
|
||||
`
|
||||
yq -M -P '
|
||||
. |= (
|
||||
select(has("secret")) | .secret = "*" |
|
||||
select(has("authentication")) | .authentication = []
|
||||
) |
|
||||
.proxy-providers.* |= (
|
||||
select(has("url")) |= .url = "*" |
|
||||
select(has("payload")) |= .payload[] |= (
|
||||
select(has("server")) |= .server = "*" |
|
||||
select(has("servername")) |= .servername = "*" |
|
||||
select(has("sni")) |= .sni = "*" |
|
||||
select(has("port")) |= .port = "*" |
|
||||
select(has("ports")) |= .ports = "*" |
|
||||
select(has("port-range")) |= .port-range = "*" |
|
||||
select(has("uuid")) |= .uuid = "*" |
|
||||
select(has("private-key")) |= .private-key = "*" |
|
||||
select(has("public-key")) |= .public-key = "*" |
|
||||
select(has("token")) |= .token="*" |
|
||||
select(has("username")) |= .username = "*" |
|
||||
select(has("password")) |= .password = "*" |
|
||||
select(has("peers")) |= .peers[] |= (
|
||||
select(has("server")) |= .server = "*" |
|
||||
select(has("public-key")) |= .public-key = "*"
|
||||
)
|
||||
)
|
||||
) |
|
||||
.proxies[] |= (
|
||||
select(has("server")) |= .server = "*" |
|
||||
select(has("servername")) |= .servername = "*" |
|
||||
select(has("sni")) |= .sni = "*" |
|
||||
select(has("port")) |= .port = "*" |
|
||||
select(has("ports")) |= .ports = "*" |
|
||||
select(has("port-range")) |= .port-range = "*" |
|
||||
select(has("uuid")) |= .uuid = "*" |
|
||||
select(has("private-key")) |= .private-key = "*" |
|
||||
select(has("public-key")) |= .public-key = "*" |
|
||||
select(has("token")) |= .token="*" |
|
||||
select(has("username")) |= .username = "*" |
|
||||
select(has("password")) |= .password = "*" |
|
||||
select(has("peers")) |= .peers[] |= (
|
||||
select(has("server")) |= .server = "*" |
|
||||
select(has("public-key")) |= .public-key = "*"
|
||||
)
|
||||
)
|
||||
' < /etc/nikki/run/config.yaml
|
||||
ucode -S -e '
|
||||
import { popen } from "fs";
|
||||
|
||||
function desensitize_proxies(proxies) {
|
||||
for (let x in proxies) {
|
||||
if (exists(x, "server")) {
|
||||
x["server"] = "*";
|
||||
}
|
||||
if (exists(x, "servername")) {
|
||||
x["servername"] = "*";
|
||||
}
|
||||
if (exists(x, "sni")) {
|
||||
x["sni"] = "*";
|
||||
}
|
||||
if (exists(x, "port")) {
|
||||
x["port"] = "*";
|
||||
}
|
||||
if (exists(x, "ports")) {
|
||||
x["ports"] = "*";
|
||||
}
|
||||
if (exists(x, "port-range")) {
|
||||
x["port-range"] = "*";
|
||||
}
|
||||
if (exists(x, "uuid")) {
|
||||
x["uuid"] = "*";
|
||||
}
|
||||
if (exists(x, "private-key")) {
|
||||
x["private-key"] = "*";
|
||||
}
|
||||
if (exists(x, "public-key")) {
|
||||
x["public-key"] = "*";
|
||||
}
|
||||
if (exists(x, "token")) {
|
||||
x["token"] = "*";
|
||||
}
|
||||
if (exists(x, "username")) {
|
||||
x["username"] = "*";
|
||||
}
|
||||
if (exists(x, "password")) {
|
||||
x["password"] = "*";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function desensitize_profile() {
|
||||
let profile = {};
|
||||
const process = popen("yq -p yaml -o json /etc/nikki/run/config.yaml");
|
||||
if (process) {
|
||||
profile = json(process);
|
||||
if (exists(profile, "secret")) {
|
||||
profile["secret"] = "*";
|
||||
}
|
||||
if (exists(profile, "authentication")) {
|
||||
profile["authentication"] = [];
|
||||
}
|
||||
if (exists(profile, "proxy-providers")) {
|
||||
for (let x in profile["proxy-providers"]) {
|
||||
if (exists(x, "url")) {
|
||||
x["url"] = "*";
|
||||
}
|
||||
if (exists(x, "payload")) {
|
||||
desensitize_proxies(x["payload"]);
|
||||
}
|
||||
}
|
||||
}
|
||||
if (exists(profile, "proxies")) {
|
||||
desensitize_proxies(profile["proxies"]);
|
||||
}
|
||||
process.close();
|
||||
}
|
||||
return profile;
|
||||
}
|
||||
|
||||
print(desensitize_profile());
|
||||
'
|
||||
`
|
||||
\`\`\`
|
||||
## ip rule
|
||||
|
Loading…
Reference in New Issue
Block a user