feat: add dockerized 3proxy control plane backend
This commit is contained in:
39
server/lib/config.test.ts
Normal file
39
server/lib/config.test.ts
Normal file
@@ -0,0 +1,39 @@
|
||||
import { describe, expect, it } from 'vitest';
|
||||
import { createDefaultState, render3proxyConfig } from './config';
|
||||
|
||||
describe('render3proxyConfig', () => {
|
||||
it('renders enabled services with their own ports and per-service ACLs', () => {
|
||||
const state = createDefaultState();
|
||||
const config = render3proxyConfig(state, {
|
||||
rootDir: '/runtime',
|
||||
configPath: '/runtime/generated/3proxy.cfg',
|
||||
counterPath: '/runtime/state/counters.3cf',
|
||||
reportDir: '/runtime/state/reports',
|
||||
logPath: '/runtime/logs/3proxy.log',
|
||||
pidPath: '/runtime/3proxy.pid',
|
||||
});
|
||||
|
||||
expect(config).toContain('socks -p1080 -u2');
|
||||
expect(config).toContain('socks -p2080 -u2');
|
||||
expect(config).toContain('admin -p8081 -s');
|
||||
expect(config).toContain('allow night-shift,ops-east');
|
||||
expect(config).toContain('allow lab-unlimited,burst-user');
|
||||
});
|
||||
|
||||
it('excludes paused users from credentials and ACLs', () => {
|
||||
const state = createDefaultState();
|
||||
state.userRecords[0].paused = true;
|
||||
const config = render3proxyConfig(state, {
|
||||
rootDir: '/runtime',
|
||||
configPath: '/runtime/generated/3proxy.cfg',
|
||||
counterPath: '/runtime/state/counters.3cf',
|
||||
reportDir: '/runtime/state/reports',
|
||||
logPath: '/runtime/logs/3proxy.log',
|
||||
pidPath: '/runtime/3proxy.pid',
|
||||
});
|
||||
|
||||
expect(config).not.toContain('night-shift:CL:kettle!23');
|
||||
expect(config).not.toContain('allow night-shift,ops-east');
|
||||
expect(config).toContain('allow ops-east');
|
||||
});
|
||||
});
|
||||
Reference in New Issue
Block a user