💋 Sync 2026-11-02 01:02:56

This commit is contained in:
github-actions[bot] committed 2026-11-02 01:02:56 +08:00
1 parent d97dc35e3d
commit 2f941f0ffb
48 files changed
+4891 -1002

No files matched your search

@@ -0,0 +1,58 @@
{
"HKG": "香港 HKG",
"TPE": "台北 TPE",
"KHH": "高雄 KHH",
"NRT": "东京 NRT",
"HND": "东京羽田 HND",
"KIX": "大阪 KIX",
"FUK": "福冈 FUK",
"ICN": "首尔 ICN",
"SIN": "新加坡 SIN",
"BKK": "曼谷 BKK",
"KUL": "吉隆坡 KUL",
"JHB": "新山 JHB",
"MNL": "马尼拉 MNL",
"SGN": "胡志明市 SGN",
"HAN": "河内 HAN",
"CGK": "雅加达 CGK",
"DPS": "巴厘岛 DPS",
"SJC": "圣何塞 SJC",
"SFO": "旧金山 SFO",
"LAX": "洛杉矶 LAX",
"SEA": "西雅图 SEA",
"PDX": "波特兰 PDX",
"DEN": "丹佛 DEN",
"PHX": "菲尼克斯 PHX",
"DFW": "达拉斯 DFW",
"IAH": "休斯顿 IAH",
"ORD": "芝加哥 ORD",
"ATL": "亚特兰大 ATL",
"MIA": "迈阿密 MIA",
"IAD": "华盛顿 IAD",
"EWR": "纽瓦克 EWR",
"JFK": "纽约 JFK",
"BOS": "波士顿 BOS",
"YVR": "温哥华 YVR",
"YYZ": "多伦多 YYZ",
"YUL": "蒙特利尔 YUL",
"FRA": "法兰克福 FRA",
"LHR": "伦敦 LHR",
"AMS": "阿姆斯特丹 AMS",
"CDG": "巴黎 CDG",
"MAD": "马德里 MAD",
"MXP": "米兰 MXP",
"ZRH": "苏黎世 ZRH",
"VIE": "维也纳 VIE",
"ARN": "斯德哥尔摩 ARN",
"HEL": "赫尔辛基 HEL",
"CPH": "哥本哈根 CPH",
"WAW": "华沙 WAW",
"PRG": "布拉格 PRG",
"SYD": "悉尼 SYD",
"MEL": "墨尔本 MEL",
"BNE": "布里斯班 BNE",
"PER": "珀斯 PER",
"AKL": "奥克兰 AKL",
"DXB": "迪拜 DXB",
"DOH": "多哈 DOH"
}
@@ -0,0 +1,102 @@
104.16.0.1
104.16.1.1
104.16.8.1
104.16.16.1
104.16.24.1
104.16.32.1
104.16.48.1
104.16.64.1
104.16.80.1
104.16.96.1
104.16.112.1
104.16.128.1
104.16.144.1
104.16.160.1
104.16.176.1
104.16.192.1
104.16.208.1
104.16.224.1
104.16.240.1
104.17.0.1
104.17.16.1
104.17.32.1
104.17.64.1
104.17.96.1
104.17.128.1
104.17.160.1
104.17.192.1
104.17.224.1
104.18.0.1
104.18.16.1
104.18.32.1
104.18.64.1
104.18.96.1
104.18.128.1
104.18.160.1
104.18.192.1
104.18.224.1
104.19.0.1
104.19.16.1
104.19.32.1
104.19.64.1
104.19.96.1
104.19.128.1
104.19.160.1
104.19.192.1
104.19.224.1
104.20.0.1
104.20.32.1
104.20.64.1
104.20.96.1
104.20.128.1
104.20.160.1
104.20.192.1
104.21.0.1
104.21.16.1
104.21.32.1
104.21.64.1
104.21.96.1
104.22.0.1
104.22.32.1
104.22.64.1
104.24.0.1
104.24.32.1
104.25.0.1
104.25.32.1
104.26.0.1
104.26.32.1
104.27.0.1
104.27.32.1
172.64.0.1
172.64.16.1
172.64.32.1
172.64.64.1
172.64.96.1
172.64.128.1
172.64.160.1
172.64.192.1
172.65.0.1
172.65.32.1
172.66.0.1
172.66.32.1
172.67.0.1
172.67.32.1
172.67.64.1
172.67.128.1
162.158.0.1
162.158.16.1
162.158.32.1
162.158.64.1
162.158.128.1
108.162.192.1
108.162.208.1
108.162.224.1
141.101.64.1
141.101.96.1
141.101.120.1
190.93.240.1
197.234.240.1
198.41.128.1
198.41.160.1
198.41.192.1
198.41.224.1
@@ -0,0 +1,37 @@
{
"admin/services/cf-optimizer": {
"title": "Cloudflare 优选加速",
"order": 65,
"action": {
"type": "firstchild"
},
"depends": {
"acl": [ "luci-app-cf-optimizer" ],
"uci": { "cf-optimizer": true }
}
},
"admin/services/cf-optimizer/overview": {
"title": "状态概览",
"order": 10,
"action": {
"type": "view",
"path": "cf-optimizer/overview"
}
},
"admin/services/cf-optimizer/settings": {
"title": "参数配置",
"order": 20,
"action": {
"type": "view",
"path": "cf-optimizer/settings"
}
},
"admin/services/cf-optimizer/log": {
"title": "运行日志",
"order": 30,
"action": {
"type": "view",
"path": "cf-optimizer/log"
}
}
}
@@ -0,0 +1,28 @@
{
"luci-app-cf-optimizer": {
"description": "Grant access to cf-optimizer LuCI procedures",
"read": {
"ubus": {
"luci.cf-optimizer": [
"get_status",
"get_logs"
]
},
"uci": [
"cf-optimizer"
]
},
"write": {
"ubus": {
"luci.cf-optimizer": [
"run_once",
"clear_logs",
"service_action"
]
},
"uci": [
"cf-optimizer"
]
}
}
}
@@ -0,0 +1,130 @@
'use strict';
import { connect } from 'ubus';
import { access, readfile, writefile, stat, popen } from 'fs';
function exec(cmd) {
let p = popen(cmd, 'r');
if (!p) return { code: -1, stdout: [] };
let out = [];
while (true) {
let line = p.read('line');
if (line == null) break;
push(out, rtrim(line, '\r\n'));
}
let code = p.close();
return { code: code, stdout: out };
}
const _trim = trim;
function trim_str(s) {
if (s == null) return '';
return _trim('' + s);
}
function get_procd_status() {
let u = connect();
if (!u) return { running: false };
let res = u.call('service', 'list', { name: 'cf-optimizer' });
if (res && res['cf-optimizer'] && res['cf-optimizer'].instances) {
let instances = res['cf-optimizer'].instances;
for (let name in instances) {
let inst = instances[name];
if (inst && inst.running)
return { running: true, pid: inst.pid };
}
}
let pid_res = exec('pidof cf-optimizer 2>/dev/null');
if (pid_res.code == 0 && length(pid_res.stdout) > 0) {
let pids = split(trim_str(join(' ', pid_res.stdout)), /\s+/);
if (length(pids) > 0 && pids[0] != '')
return { running: true, pid: +pids[0] };
}
return { running: false };
}
const methods = {};
methods.get_status = {
call: function() {
let proc_st = get_procd_status();
let status_data = null;
const status_file = '/tmp/run/cf-optimizer/status.json';
if (access(status_file)) {
let content = readfile(status_file);
if (content) {
try {
status_data = json(content);
} catch(e) {}
}
}
if (!status_data) {
status_data = {
running: proc_st.running,
last_update: '',
best_ip: '',
best_colo: '',
best_tcp_lat: '',
best_tls_lat: '',
domains: [],
rankings: []
};
}
status_data.service_running = proc_st.running;
status_data.service_pid = proc_st.pid || null;
return status_data;
}
};
methods.get_logs = {
call: function() {
const log_file = '/var/log/cf-optimizer.log';
let logs = [];
if (access(log_file)) {
let res = exec('tail -n 120 ' + log_file + ' 2>/dev/null');
if (res.code == 0) logs = res.stdout;
}
return { logs: logs };
}
};
methods.clear_logs = {
call: function() {
const log_file = '/var/log/cf-optimizer.log';
writefile(log_file, '');
return { success: true };
}
};
methods.run_once = {
call: function() {
exec('/usr/sbin/cf-optimizer run >/dev/null 2>&1 &');
return { success: true };
}
};
methods.service_action = {
args: { action: 'action' },
call: function(req) {
let action = req.args?.action;
if (!action) return { success: false, error: 'Missing action parameter' };
if (action == 'restart') {
exec('/etc/init.d/cf-optimizer restart >/dev/null 2>&1');
} else if (action == 'start') {
exec('/etc/init.d/cf-optimizer start >/dev/null 2>&1');
} else if (action == 'stop') {
exec('/etc/init.d/cf-optimizer stop >/dev/null 2>&1');
}
return { success: true };
}
};
return { 'luci.cf-optimizer': methods };