feat: add dockerized 3proxy control plane backend

This commit is contained in:
2026-04-02 00:06:26 +03:00
parent ff2bc8711b
commit 25f6beedd8
20 changed files with 3076 additions and 174 deletions

87
src/shared/contracts.ts Normal file
View File

@@ -0,0 +1,87 @@
import type { ServiceState } from '../lib/3proxy';
export type ServiceProtocol = 'socks5' | 'http';
export type ServiceCommand = 'socks' | 'proxy' | 'admin';
export interface DailyTrafficBucket {
day: string;
bytes: number;
share: number;
}
export interface ProxyServiceRecord {
id: string;
name: string;
command: ServiceCommand;
protocol: ServiceProtocol;
description: string;
port: number;
enabled: boolean;
assignable: boolean;
}
export interface ProxyUserRecord {
id: string;
username: string;
password: string;
serviceId: string;
status: Exclude<ServiceState, 'paused'>;
usedBytes: number;
quotaBytes: number | null;
paused?: boolean;
}
export interface ControlPlaneState {
service: {
versionLabel: string;
lastEvent: string;
startedAt: string | null;
};
traffic: {
totalBytes: number;
liveConnections: number;
activeUsers: number;
daily: DailyTrafficBucket[];
};
userRecords: ProxyUserRecord[];
system: {
publicHost: string;
configMode: string;
reloadMode: string;
storageMode: string;
services: ProxyServiceRecord[];
};
}
export interface DashboardSnapshot {
service: {
status: ServiceState;
pidLabel: string;
versionLabel: string;
uptimeLabel: string;
lastEvent: string;
};
traffic: ControlPlaneState['traffic'];
users: {
total: number;
live: number;
nearQuota: number;
exceeded: number;
};
attention: Array<{
level: Exclude<ServiceState, 'idle' | 'paused'>;
title: string;
message: string;
}>;
userRecords: ProxyUserRecord[];
system: ControlPlaneState['system'] & {
previewConfig: string;
};
}
export interface CreateUserInput {
username: string;
password: string;
serviceId: string;
quotaMb: number | null;
}