feat(xtream-proxy): rewrite proxy logic and update configuration format
Build and Push Docker Images / build-and-push (push) Successful in 39s
Build and Push Docker Images / build-and-push (push) Successful in 39s
Refactor the xtream-proxy from a single-file Express-based server to a modular Node.js application using native http/https modules. This change introduces a major version bump to 2.0.0. - Replace `hosts.txt` with `upstreams.json` for configuration - Remove heavy dependencies (`express`, `ws`) in favor of native modules - Implement new environment variables for proxy credentials and timeouts - Add `src/` directory for modular code structure - Add `docker-compose.example.yml` for easier deployment - Update Dockerfile to support the new directory structure and environment - Improve error handling and probe logic for upstream selection
This commit is contained in:
1 parent
baaae2b850
commit
4bd2088edd
18 files changed
+1173
-1223
No files matched your search
@@ -0,0 +1,26 @@
|
||||
'use strict';
|
||||
|
||||
const { settings } = require('./settings');
|
||||
const { getUpstreams } = require('./config');
|
||||
const {
|
||||
getLastProbeAt,
|
||||
rankedUpstreams,
|
||||
describeUpstream,
|
||||
} = require('./upstreams');
|
||||
|
||||
function healthPayload() {
|
||||
const upstreams = getUpstreams();
|
||||
const ranked = rankedUpstreams();
|
||||
const selected = ranked.find((entry) => !entry.busy) || ranked[0] || null;
|
||||
|
||||
return {
|
||||
ok: upstreams.some((upstream) => upstream.state.healthy),
|
||||
configFile: settings.configFile,
|
||||
probeIntervalSec: settings.probeIntervalSec,
|
||||
lastProbeAt: getLastProbeAt(),
|
||||
selected: selected ? describeUpstream(selected.upstream) : null,
|
||||
upstreams: upstreams.map(describeUpstream),
|
||||
};
|
||||
}
|
||||
|
||||
module.exports = { healthPayload };
|
||||
Reference in new issue
Block a user