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

View File

@@ -1,15 +1,15 @@
import type { ControlPlaneState, DashboardSnapshot } from '../shared/contracts';
export const panelAuth = {
login: 'admin',
password: 'proxy-ui-demo',
};
export const dashboardSnapshot = {
export const dashboardSnapshot: ControlPlaneState = {
service: {
status: 'live' as const,
pidLabel: 'pid 17',
versionLabel: '3proxy 0.9.x',
uptimeLabel: 'uptime 6h 14m',
lastEvent: 'Last graceful reload 2m ago',
startedAt: '2026-04-01T15:45:00.000Z',
},
traffic: {
totalBytes: 1_557_402_624,
@@ -23,29 +23,6 @@ export const dashboardSnapshot = {
{ day: 'Fri', bytes: 547_037_696, share: 1 },
],
},
users: {
total: 18,
live: 9,
nearQuota: 3,
exceeded: 1,
},
attention: [
{
level: 'warn' as const,
title: 'Quota pressure detected',
message: '3 users crossed 80% of their assigned transfer cap.',
},
{
level: 'live' as const,
title: 'Config watcher online',
message: 'The next runtime slice will prefer graceful reload over full restart.',
},
{
level: 'fail' as const,
title: 'Admin API not wired yet',
message: 'Buttons are UI-first placeholders until the backend control plane lands.',
},
],
userRecords: [
{
id: 'u-1',
@@ -68,7 +45,7 @@ export const dashboardSnapshot = {
{
id: 'u-3',
username: 'lab-unlimited',
password: 'open lane',
password: 'open-lane',
serviceId: 'socks-lab',
status: 'idle' as const,
usedBytes: 42_844_160,
@@ -91,59 +68,80 @@ export const dashboardSnapshot = {
storageMode: 'flat files for config and counters',
services: [
{
id: 'socks-main',
name: 'SOCKS5 main',
protocol: 'socks5',
description: 'Primary SOCKS5 entrypoint with user auth.',
port: 1080,
id: 'socks-main',
name: 'SOCKS5 main',
command: 'socks',
protocol: 'socks5',
description: 'Primary SOCKS5 entrypoint with user auth.',
port: 1080,
enabled: true,
assignable: true,
},
{
id: 'socks-lab',
name: 'SOCKS5 lab',
protocol: 'socks5',
description: 'Secondary SOCKS5 service for lab and overflow users.',
port: 2080,
id: 'socks-lab',
name: 'SOCKS5 lab',
command: 'socks',
protocol: 'socks5',
description: 'Secondary SOCKS5 service for lab and overflow users.',
port: 2080,
enabled: true,
assignable: true,
},
{
id: 'admin',
name: 'Admin',
protocol: 'http',
description: 'Restricted admin visibility endpoint.',
port: 8081,
id: 'admin',
name: 'Admin',
command: 'admin',
protocol: 'http',
description: 'Restricted admin visibility endpoint.',
port: 8081,
enabled: true,
assignable: false,
},
{
id: 'proxy',
name: 'HTTP proxy',
protocol: 'http',
description: 'Optional HTTP/HTTPS proxy profile.',
port: 3128,
id: 'proxy',
name: 'HTTP proxy',
command: 'proxy',
protocol: 'http',
description: 'Optional HTTP/HTTPS proxy profile.',
port: 3128,
enabled: false,
assignable: true,
},
],
previewConfig: `daemon
pidfile /var/run/3proxy/3proxy.pid
monitor /etc/3proxy/generated/3proxy.cfg
auth strong
users night-shift:CL:kettle!23 ops-east:CL:east/line
counter /var/lib/3proxy/counters.3cf D /var/lib/3proxy/reports/%Y-%m-%d.txt
countall 1 D 1024 night-shift * * * * * *
countall 2 D 1024 ops-east * * * * * *
flush
allow night-shift,ops-east
socks -p1080 -u2
flush
allow *
admin -p8081 -s`,
},
};
export const fallbackDashboardSnapshot: DashboardSnapshot = {
service: {
status: 'live',
pidLabel: 'pid 17',
versionLabel: dashboardSnapshot.service.versionLabel,
uptimeLabel: 'uptime 6h 14m',
lastEvent: dashboardSnapshot.service.lastEvent,
},
traffic: dashboardSnapshot.traffic,
users: {
total: dashboardSnapshot.userRecords.length,
live: dashboardSnapshot.userRecords.filter((user) => user.status === 'live').length,
nearQuota: 1,
exceeded: 1,
},
attention: [
{
level: 'warn',
title: 'Quota pressure detected',
message: 'Fallback snapshot is active until the backend API responds.',
},
],
userRecords: dashboardSnapshot.userRecords,
system: {
...dashboardSnapshot.system,
previewConfig: `pidfile /runtime/3proxy.pid
monitor /runtime/generated/3proxy.cfg
auth strong
users night-shift:CL:kettle!23 ops-east:CL:east/line
flush
allow night-shift,ops-east
socks -p1080 -u2`,
},
};