🎉 Sync 2026-10-13 02:34:41

This commit is contained in:
github-actions[bot] committed 2026-10-13 02:34:41 +08:00
1 parent b537a62e59
commit 72c44a6325
38 files changed
+3510 -1734

No files matched your search

@@ -20,11 +20,8 @@ const methods = {
if (leasefile) {
for (let line = leasefile.read('line'); length(line); line = leasefile.read('line')) {
const record = split(line, ':', 7);
if (length(record) == 6 || length(record) == 7) {
// Daemon version >2.3.11 changes lease file format
let recshift = 0;
if (length(record) == 7) recshift = 1;
let descr = trim(record[5 + recshift]);
if (length(record) == 7) {
let descr = trim(record[6]);
let m = match(descr, /^PCP [A-Z]+ ([0-9a-f]{24})$/);
if (m) descr = 'PCP (nonce ' + m[1] + ')';
else if (match(descr, /^NAT-PMP \d+ \w+$/)) descr = 'NAT-PMP';
@@ -33,9 +30,9 @@ const methods = {
push(leases, {
proto: uc(record[0]),
extport: +record[1],
intaddr: arrtoip(iptoarr(record[2 + recshift])),
intport: +record[3 + recshift],
expires: record[4 + recshift] - timelocal(localtime()),
intaddr: arrtoip(iptoarr(record[3])),
intport: +record[4],
expires: record[5] - timelocal(localtime()),
descr: descr
});
}
@@ -84,14 +81,14 @@ const methods = {
const nft = popen('nft --handle list chain inet fw4 upnp_prerouting 2>/dev/null');
if (nft) {
for (let line = nft.read('line'), num = 1; length(line); line = nft.read('line')) {
let m = match(line, /^\t\tiif ".+" @nh,72,8 (0x6|0x11) th dport ([0-9]+).* dnat ip to ([0-9.]+):([0-9]+)/);
let m = match(line, /^\t\tiif ".+" ip protocol ([ut].p) .* dport ([0-9]+).* dnat ip to ([0-9.]+):([0-9]+)/);
if (m) {
push(rules, {
num: `${num}`,
intaddr: arrtoip(iptoarr(m[3])),
intport: +m[4],
extport: +m[2],
proto: (m[1] == '0x6') ? 'TCP' : 'UDP'
proto: uc(m[1])
});
num++;
}
@@ -101,17 +98,14 @@ const methods = {
const nftipv6 = popen('nft --handle list chain inet fw4 upnp_forward 2>/dev/null');
if (nftipv6) {
for (let line = nftipv6.read('line'), num = 1; length(line); line = nftipv6.read('line')) {
let m = match(line, /^\t\tiif ".+" th dport ([0-9]+) @nh,192,128 0x([0-9a-f]+) @nh,48,8 (0x6|0x11) accept/);
let m = match(line, /^\t\tiif ".+" th dport ([0-9]+) ip6 daddr ([0-9a-f:]+) ip6 nexthdr ([ut].p) accept/);
if (m) {
push(rules, {
num: '0',
intaddr: arrtoip(iptoarr(join(':', [substr(m[2], 0, 4),
substr(m[2], 4, 4), substr(m[2], 8, 4), substr(m[2], 12, 4), substr(m[2], 16, 4),
substr(m[2], 20, 4), substr(m[2], 24, 4), substr(m[2], 28, 4)
]))),
intaddr: m[2],
intport: +m[1],
extport: +m[1],
proto: (m[3] == '0x6') ? 'TCP' : 'UDP'
proto: uc(m[3])
});
num++;
}