feat: replace onebox ingress with SmartProxy
This commit is contained in:
@@ -166,20 +166,20 @@ export class LogsHandler {
|
||||
const encoder = new TextEncoder();
|
||||
const clientId = crypto.randomUUID();
|
||||
|
||||
// Create a mock WebSocket-like object for the CaddyLogReceiver
|
||||
// Create a mock WebSocket-like object for the proxy log receiver.
|
||||
const mockSocket = {
|
||||
readyState: 1, // WebSocket.OPEN
|
||||
send: (data: string) => {
|
||||
try {
|
||||
virtualStream.sendData(encoder.encode(data));
|
||||
} catch {
|
||||
this.opsServerRef.oneboxRef.caddyLogReceiver.removeClient(clientId);
|
||||
this.opsServerRef.oneboxRef.proxyLogReceiver.removeClient(clientId);
|
||||
}
|
||||
},
|
||||
};
|
||||
|
||||
const filter = dataArg.filter || {};
|
||||
this.opsServerRef.oneboxRef.caddyLogReceiver.addClient(
|
||||
this.opsServerRef.oneboxRef.proxyLogReceiver.addClient(
|
||||
clientId,
|
||||
mockSocket as any,
|
||||
filter,
|
||||
|
||||
@@ -19,7 +19,7 @@ export class NetworkHandler {
|
||||
redis: 6379,
|
||||
postgresql: 5432,
|
||||
rabbitmq: 5672,
|
||||
caddy: 80,
|
||||
smartproxy: 80,
|
||||
clickhouse: 8123,
|
||||
mariadb: 3306,
|
||||
};
|
||||
@@ -85,7 +85,7 @@ export class NetworkHandler {
|
||||
async (dataArg) => {
|
||||
await requireAdminIdentity(this.opsServerRef.adminHandler, dataArg);
|
||||
const proxyStatus = this.opsServerRef.oneboxRef.reverseProxy.getStatus() as any;
|
||||
const logReceiverStats = this.opsServerRef.oneboxRef.caddyLogReceiver.getStats();
|
||||
const logReceiverStats = this.opsServerRef.oneboxRef.proxyLogReceiver.getStats();
|
||||
|
||||
return {
|
||||
stats: {
|
||||
@@ -115,7 +115,7 @@ export class NetworkHandler {
|
||||
'getTrafficStats',
|
||||
async (dataArg) => {
|
||||
await requireAdminIdentity(this.opsServerRef.adminHandler, dataArg);
|
||||
const trafficStats = this.opsServerRef.oneboxRef.caddyLogReceiver.getTrafficStats(60);
|
||||
const trafficStats = this.opsServerRef.oneboxRef.proxyLogReceiver.getTrafficStats(60);
|
||||
return { stats: trafficStats };
|
||||
},
|
||||
),
|
||||
|
||||
@@ -119,7 +119,7 @@ export class PlatformHandler {
|
||||
const isCore = 'isCore' in provider && (provider as any).isCore === true;
|
||||
|
||||
let status: string = service?.status || 'not-deployed';
|
||||
if (provider.type === 'caddy') {
|
||||
if (provider.type === 'smartproxy') {
|
||||
const proxyStatus = this.opsServerRef.oneboxRef.reverseProxy.getStatus() as any;
|
||||
status = (proxyStatus.running ?? proxyStatus.http?.running) ? 'running' : 'stopped';
|
||||
}
|
||||
@@ -156,7 +156,7 @@ export class PlatformHandler {
|
||||
const isCore = 'isCore' in provider && (provider as any).isCore === true;
|
||||
|
||||
let rawStatus: string = service?.status || 'not-deployed';
|
||||
if (dataArg.serviceType === 'caddy') {
|
||||
if (dataArg.serviceType === 'smartproxy') {
|
||||
const proxyStatus = this.opsServerRef.oneboxRef.reverseProxy.getStatus() as any;
|
||||
rawStatus = (proxyStatus.running ?? proxyStatus.http?.running) ? 'running' : 'stopped';
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user