Compare commits
6 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| bdd53b1551 | |||
| 982d2882e9 | |||
| 2b0cf9a46d | |||
| d6854076fe | |||
| 6991b69d40 | |||
| b8f630f8ab |
+20
-6
@@ -1,16 +1,30 @@
|
|||||||
<a name="readme-top"></a>
|
<a name="readme-top"></a>
|
||||||
# Changelog
|
# Changelog
|
||||||
|
|
||||||
## [1.4.3](https://github.com/perfect-panel/ppanel-web/compare/v1.4.2...v1.4.3) (2025-09-16)
|
## [1.4.4](https://github.com/perfect-panel/ppanel-web/compare/v1.4.3...v1.4.4) (2025-09-16)
|
||||||
|
|
||||||
|
|
||||||
### 🐛 Bug Fixes
|
### 🐛 Bug Fixes
|
||||||
|
|
||||||
* Add success toast message for sorting in nodes and servers pages ([2d5175d](https://github.com/perfect-panel/ppanel-web/commit/2d5175d))
|
* Add minimum value constraint for count and user limit inputs in CouponForm ([6991b69](https://github.com/perfect-panel/ppanel-web/commit/6991b69))
|
||||||
* Implement encryption and obfuscation features in protocol configuration ([54de16b](https://github.com/perfect-panel/ppanel-web/commit/54de16b))
|
* Add protocol-related constants, default configurations, field definitions, and validation modes ([d685407](https://github.com/perfect-panel/ppanel-web/commit/d685407))
|
||||||
* Refactor toB64 function to toB64Url for URL-safe base64 encoding in VlessX25519Pair generation ([8700cf6](https://github.com/perfect-panel/ppanel-web/commit/8700cf6))
|
* Added the enabled field in the protocol configuration, updated the related type definition and default configuration ([2b0cf9a](https://github.com/perfect-panel/ppanel-web/commit/2b0cf9a))
|
||||||
* Simplify initialValues assignment and update node submission logic in NodesPage ([05d6c89](https://github.com/perfect-panel/ppanel-web/commit/05d6c89))
|
* Filter available protocols to exclude disabled ones in NodeForm ([982d288](https://github.com/perfect-panel/ppanel-web/commit/982d288))
|
||||||
* Update bun.lockb to reflect dependency changes ([ebcebd7](https://github.com/perfect-panel/ppanel-web/commit/ebcebd7))
|
* Refactor key generation logic and update dependencies for ML-KEM-768 integration ([b8f630f](https://github.com/perfect-panel/ppanel-web/commit/b8f630f))
|
||||||
|
|
||||||
|
<a name="readme-top"></a>
|
||||||
|
|
||||||
|
# Changelog
|
||||||
|
|
||||||
|
## [1.4.3](https://github.com/perfect-panel/ppanel-web/compare/v1.4.2...v1.4.3) (2025-09-16)
|
||||||
|
|
||||||
|
### 🐛 Bug Fixes
|
||||||
|
|
||||||
|
- Add success toast message for sorting in nodes and servers pages ([2d5175d](https://github.com/perfect-panel/ppanel-web/commit/2d5175d))
|
||||||
|
- Implement encryption and obfuscation features in protocol configuration ([54de16b](https://github.com/perfect-panel/ppanel-web/commit/54de16b))
|
||||||
|
- Refactor toB64 function to toB64Url for URL-safe base64 encoding in VlessX25519Pair generation ([8700cf6](https://github.com/perfect-panel/ppanel-web/commit/8700cf6))
|
||||||
|
- Simplify initialValues assignment and update node submission logic in NodesPage ([05d6c89](https://github.com/perfect-panel/ppanel-web/commit/05d6c89))
|
||||||
|
- Update bun.lockb to reflect dependency changes ([ebcebd7](https://github.com/perfect-panel/ppanel-web/commit/ebcebd7))
|
||||||
|
|
||||||
<a name="readme-top"></a>
|
<a name="readme-top"></a>
|
||||||
|
|
||||||
|
|||||||
@@ -307,6 +307,7 @@ export default function CouponForm<T extends Record<string, any>>({
|
|||||||
<EnhancedInput
|
<EnhancedInput
|
||||||
placeholder={t('form.countPlaceholder')}
|
placeholder={t('form.countPlaceholder')}
|
||||||
type='number'
|
type='number'
|
||||||
|
min={0}
|
||||||
step={1}
|
step={1}
|
||||||
{...field}
|
{...field}
|
||||||
onValueChange={(value) => {
|
onValueChange={(value) => {
|
||||||
@@ -328,6 +329,7 @@ export default function CouponForm<T extends Record<string, any>>({
|
|||||||
<EnhancedInput
|
<EnhancedInput
|
||||||
placeholder={t('form.userLimitPlaceholder')}
|
placeholder={t('form.userLimitPlaceholder')}
|
||||||
type='number'
|
type='number'
|
||||||
|
min={0}
|
||||||
step={1}
|
step={1}
|
||||||
{...field}
|
{...field}
|
||||||
onValueChange={(value) => {
|
onValueChange={(value) => {
|
||||||
|
|||||||
@@ -128,8 +128,8 @@ export default function NodeForm(props: {
|
|||||||
const availableProtocols = useMemo(() => {
|
const availableProtocols = useMemo(() => {
|
||||||
if (!currentServer?.protocols) return [];
|
if (!currentServer?.protocols) return [];
|
||||||
|
|
||||||
return (currentServer.protocols as Array<{ type: ProtocolName; port?: number }>)
|
return currentServer.protocols
|
||||||
.filter((p) => p.type)
|
.filter((p) => p.enable !== false)
|
||||||
.map((p) => ({
|
.map((p) => ({
|
||||||
protocol: p.type,
|
protocol: p.type,
|
||||||
port: p.port,
|
port: p.port,
|
||||||
|
|||||||
@@ -0,0 +1,99 @@
|
|||||||
|
export const protocols = [
|
||||||
|
'shadowsocks',
|
||||||
|
'vmess',
|
||||||
|
'vless',
|
||||||
|
'trojan',
|
||||||
|
'hysteria2',
|
||||||
|
'tuic',
|
||||||
|
'anytls',
|
||||||
|
'socks',
|
||||||
|
'naive',
|
||||||
|
'http',
|
||||||
|
'mieru',
|
||||||
|
] as const;
|
||||||
|
|
||||||
|
// Global label map for display; fallback to raw value if missing
|
||||||
|
export const LABELS = {
|
||||||
|
// transport
|
||||||
|
'tcp': 'TCP',
|
||||||
|
'udp': 'UDP',
|
||||||
|
'websocket': 'WebSocket',
|
||||||
|
'grpc': 'gRPC',
|
||||||
|
'mkcp': 'mKCP',
|
||||||
|
'httpupgrade': 'HTTP Upgrade',
|
||||||
|
'xhttp': 'XHTTP',
|
||||||
|
// security
|
||||||
|
'none': 'NONE',
|
||||||
|
'tls': 'TLS',
|
||||||
|
'reality': 'Reality',
|
||||||
|
// fingerprint
|
||||||
|
'chrome': 'Chrome',
|
||||||
|
'firefox': 'Firefox',
|
||||||
|
'safari': 'Safari',
|
||||||
|
'ios': 'IOS',
|
||||||
|
'android': 'Android',
|
||||||
|
'edge': 'edge',
|
||||||
|
'360': '360',
|
||||||
|
'qq': 'QQ',
|
||||||
|
// multiplex
|
||||||
|
'low': 'Low',
|
||||||
|
'middle': 'Middle',
|
||||||
|
'high': 'High',
|
||||||
|
} as const;
|
||||||
|
|
||||||
|
// Flat arrays for enum-like sets
|
||||||
|
export const SS_CIPHERS = [
|
||||||
|
'aes-128-gcm',
|
||||||
|
'aes-192-gcm',
|
||||||
|
'aes-256-gcm',
|
||||||
|
'chacha20-ietf-poly1305',
|
||||||
|
'2022-blake3-aes-128-gcm',
|
||||||
|
'2022-blake3-aes-256-gcm',
|
||||||
|
'2022-blake3-chacha20-poly1305',
|
||||||
|
] as const;
|
||||||
|
|
||||||
|
export const TRANSPORTS = {
|
||||||
|
vmess: ['tcp', 'websocket', 'grpc'] as const,
|
||||||
|
vless: ['tcp', 'websocket', 'grpc', 'mkcp', 'httpupgrade', 'xhttp'] as const,
|
||||||
|
trojan: ['tcp', 'websocket', 'grpc'] as const,
|
||||||
|
mieru: ['tcp', 'udp'] as const,
|
||||||
|
} as const;
|
||||||
|
|
||||||
|
export const SECURITY = {
|
||||||
|
vmess: ['none', 'tls'] as const,
|
||||||
|
vless: ['none', 'tls', 'reality'] as const,
|
||||||
|
trojan: ['tls'] as const,
|
||||||
|
hysteria2: ['tls'] as const,
|
||||||
|
tuic: ['tls'] as const,
|
||||||
|
anytls: ['tls'] as const,
|
||||||
|
naive: ['none', 'tls'] as const,
|
||||||
|
http: ['none', 'tls'] as const,
|
||||||
|
} as const;
|
||||||
|
|
||||||
|
export const FLOWS = {
|
||||||
|
vless: ['none', 'xtls-rprx-direct', 'xtls-rprx-splice', 'xtls-rprx-vision'] as const,
|
||||||
|
} as const;
|
||||||
|
|
||||||
|
export const TUIC_UDP_RELAY_MODES = ['native', 'quic'] as const;
|
||||||
|
export const TUIC_CONGESTION = ['bbr', 'cubic', 'new_reno'] as const;
|
||||||
|
export const XHTTP_MODES = ['auto', 'packet-up', 'stream-up', 'stream-one'] as const;
|
||||||
|
export const ENCRYPTION_TYPES = ['none', 'mlkem768x25519plus'] as const;
|
||||||
|
export const ENCRYPTION_MODES = ['native', 'xorpub', 'random'] as const;
|
||||||
|
export const ENCRYPTION_RTT = ['0rtt', '1rtt'] as const;
|
||||||
|
export const FINGERPRINTS = [
|
||||||
|
'chrome',
|
||||||
|
'firefox',
|
||||||
|
'safari',
|
||||||
|
'ios',
|
||||||
|
'android',
|
||||||
|
'edge',
|
||||||
|
'360',
|
||||||
|
'qq',
|
||||||
|
] as const;
|
||||||
|
|
||||||
|
export const multiplexLevels = ['none', 'low', 'middle', 'high'] as const;
|
||||||
|
|
||||||
|
export function getLabel(value: string): string {
|
||||||
|
const label = (LABELS as Record<string, string>)[value];
|
||||||
|
return label ?? value.toUpperCase();
|
||||||
|
}
|
||||||
@@ -0,0 +1,111 @@
|
|||||||
|
import { XHTTP_MODES } from './constants';
|
||||||
|
import type { ProtocolType } from './types';
|
||||||
|
|
||||||
|
export function getProtocolDefaultConfig(proto: ProtocolType) {
|
||||||
|
switch (proto) {
|
||||||
|
case 'shadowsocks':
|
||||||
|
return {
|
||||||
|
type: 'shadowsocks',
|
||||||
|
enable: false,
|
||||||
|
port: null,
|
||||||
|
cipher: 'chacha20-ietf-poly1305',
|
||||||
|
server_key: null,
|
||||||
|
obfs: 'none',
|
||||||
|
obfs_host: null,
|
||||||
|
obfs_path: null,
|
||||||
|
} as any;
|
||||||
|
case 'vmess':
|
||||||
|
return {
|
||||||
|
type: 'vmess',
|
||||||
|
enable: false,
|
||||||
|
port: null,
|
||||||
|
transport: 'tcp',
|
||||||
|
security: 'none',
|
||||||
|
} as any;
|
||||||
|
case 'vless':
|
||||||
|
return {
|
||||||
|
type: 'vless',
|
||||||
|
enable: false,
|
||||||
|
port: null,
|
||||||
|
transport: 'tcp',
|
||||||
|
security: 'none',
|
||||||
|
flow: 'none',
|
||||||
|
xhttp_mode: XHTTP_MODES[0], // 'auto'
|
||||||
|
xhttp_extra: null,
|
||||||
|
} as any;
|
||||||
|
case 'trojan':
|
||||||
|
return {
|
||||||
|
type: 'trojan',
|
||||||
|
enable: false,
|
||||||
|
port: null,
|
||||||
|
transport: 'tcp',
|
||||||
|
security: 'tls',
|
||||||
|
} as any;
|
||||||
|
case 'hysteria2':
|
||||||
|
return {
|
||||||
|
type: 'hysteria2',
|
||||||
|
enable: false,
|
||||||
|
port: null,
|
||||||
|
hop_ports: null,
|
||||||
|
hop_interval: null,
|
||||||
|
obfs: 'none',
|
||||||
|
obfs_password: null,
|
||||||
|
security: 'tls',
|
||||||
|
up_mbps: null,
|
||||||
|
down_mbps: null,
|
||||||
|
} as any;
|
||||||
|
case 'tuic':
|
||||||
|
return {
|
||||||
|
type: 'tuic',
|
||||||
|
enable: false,
|
||||||
|
port: null,
|
||||||
|
disable_sni: false,
|
||||||
|
reduce_rtt: false,
|
||||||
|
udp_relay_mode: 'native',
|
||||||
|
congestion_controller: 'bbr',
|
||||||
|
security: 'tls',
|
||||||
|
sni: null,
|
||||||
|
allow_insecure: false,
|
||||||
|
fingerprint: 'chrome',
|
||||||
|
} as any;
|
||||||
|
case 'socks':
|
||||||
|
return {
|
||||||
|
type: 'socks',
|
||||||
|
enable: false,
|
||||||
|
port: null,
|
||||||
|
} as any;
|
||||||
|
case 'naive':
|
||||||
|
return {
|
||||||
|
type: 'naive',
|
||||||
|
enable: false,
|
||||||
|
port: null,
|
||||||
|
security: 'none',
|
||||||
|
} as any;
|
||||||
|
case 'http':
|
||||||
|
return {
|
||||||
|
type: 'http',
|
||||||
|
enable: false,
|
||||||
|
port: null,
|
||||||
|
security: 'none',
|
||||||
|
} as any;
|
||||||
|
case 'mieru':
|
||||||
|
return {
|
||||||
|
type: 'mieru',
|
||||||
|
port: null,
|
||||||
|
multiplex: 'none',
|
||||||
|
transport: 'tcp',
|
||||||
|
} as any;
|
||||||
|
case 'anytls':
|
||||||
|
return {
|
||||||
|
type: 'anytls',
|
||||||
|
port: null,
|
||||||
|
security: 'tls',
|
||||||
|
padding_scheme: null,
|
||||||
|
sni: null,
|
||||||
|
allow_insecure: false,
|
||||||
|
fingerprint: 'chrome',
|
||||||
|
} as any;
|
||||||
|
default:
|
||||||
|
return {} as any;
|
||||||
|
}
|
||||||
|
}
|
||||||
+28
-378
@@ -1,374 +1,24 @@
|
|||||||
import { z } from 'zod';
|
import {
|
||||||
import { generatePassword, generateRealityKeyPair, generateRealityShortId } from './generate';
|
generateMLKEM768KeyPair,
|
||||||
import { generateVlessX25519Pair } from './generate/mlkem768x25519plus';
|
generatePassword,
|
||||||
|
generateRealityKeyPair,
|
||||||
export const protocols = [
|
generateRealityShortId,
|
||||||
'shadowsocks',
|
} from '../generate';
|
||||||
'vmess',
|
import {
|
||||||
'vless',
|
ENCRYPTION_MODES,
|
||||||
'trojan',
|
ENCRYPTION_RTT,
|
||||||
'hysteria2',
|
ENCRYPTION_TYPES,
|
||||||
'tuic',
|
FINGERPRINTS,
|
||||||
'anytls',
|
FLOWS,
|
||||||
'socks',
|
multiplexLevels,
|
||||||
'naive',
|
SECURITY,
|
||||||
'http',
|
SS_CIPHERS,
|
||||||
'meru',
|
TRANSPORTS,
|
||||||
] as const;
|
TUIC_CONGESTION,
|
||||||
|
TUIC_UDP_RELAY_MODES,
|
||||||
export type FieldConfig = {
|
XHTTP_MODES,
|
||||||
name: string;
|
} from './constants';
|
||||||
type: 'input' | 'select' | 'switch' | 'number' | 'textarea';
|
import type { FieldConfig } from './types';
|
||||||
label: string;
|
|
||||||
placeholder?: string | ((t: (key: string) => string, protocol: any) => string);
|
|
||||||
options?: readonly string[];
|
|
||||||
defaultValue?: any;
|
|
||||||
min?: number;
|
|
||||||
max?: number;
|
|
||||||
step?: number;
|
|
||||||
suffix?: string;
|
|
||||||
generate?: {
|
|
||||||
function: () => any;
|
|
||||||
updateFields?: Record<string, string>;
|
|
||||||
};
|
|
||||||
condition?: (protocol: any, values: any) => boolean;
|
|
||||||
group?: 'basic' | 'transport' | 'security' | 'reality' | 'obfs' | 'encryption';
|
|
||||||
gridSpan?: 1 | 2;
|
|
||||||
};
|
|
||||||
|
|
||||||
// Global label map for display; fallback to raw value if missing
|
|
||||||
export const LABELS = {
|
|
||||||
// transport
|
|
||||||
'tcp': 'TCP',
|
|
||||||
'udp': 'UDP',
|
|
||||||
'websocket': 'WebSocket',
|
|
||||||
'grpc': 'gRPC',
|
|
||||||
'mkcp': 'mKCP',
|
|
||||||
'httpupgrade': 'HTTP Upgrade',
|
|
||||||
'xhttp': 'XHTTP',
|
|
||||||
// security
|
|
||||||
'none': 'NONE',
|
|
||||||
'tls': 'TLS',
|
|
||||||
'reality': 'Reality',
|
|
||||||
// fingerprint
|
|
||||||
'chrome': 'Chrome',
|
|
||||||
'firefox': 'Firefox',
|
|
||||||
'safari': 'Safari',
|
|
||||||
'ios': 'IOS',
|
|
||||||
'android': 'Android',
|
|
||||||
'edge': 'edge',
|
|
||||||
'360': '360',
|
|
||||||
'qq': 'QQ',
|
|
||||||
// multiplex
|
|
||||||
'low': 'Low',
|
|
||||||
'middle': 'Middle',
|
|
||||||
'high': 'High',
|
|
||||||
} as const;
|
|
||||||
|
|
||||||
// Flat arrays for enum-like sets
|
|
||||||
export const SS_CIPHERS = [
|
|
||||||
'aes-128-gcm',
|
|
||||||
'aes-192-gcm',
|
|
||||||
'aes-256-gcm',
|
|
||||||
'chacha20-ietf-poly1305',
|
|
||||||
'2022-blake3-aes-128-gcm',
|
|
||||||
'2022-blake3-aes-256-gcm',
|
|
||||||
'2022-blake3-chacha20-poly1305',
|
|
||||||
] as const;
|
|
||||||
|
|
||||||
export const TRANSPORTS = {
|
|
||||||
vmess: ['tcp', 'websocket', 'grpc'] as const,
|
|
||||||
vless: ['tcp', 'websocket', 'grpc', 'mkcp', 'httpupgrade', 'xhttp'] as const,
|
|
||||||
trojan: ['tcp', 'websocket', 'grpc'] as const,
|
|
||||||
meru: ['tcp', 'udp'] as const,
|
|
||||||
} as const;
|
|
||||||
|
|
||||||
export const SECURITY = {
|
|
||||||
vmess: ['none', 'tls'] as const,
|
|
||||||
vless: ['none', 'tls', 'reality'] as const,
|
|
||||||
trojan: ['tls'] as const,
|
|
||||||
hysteria2: ['tls'] as const,
|
|
||||||
tuic: ['tls'] as const,
|
|
||||||
anytls: ['tls'] as const,
|
|
||||||
naive: ['none', 'tls'] as const,
|
|
||||||
http: ['none', 'tls'] as const,
|
|
||||||
} as const;
|
|
||||||
|
|
||||||
export const FLOWS = {
|
|
||||||
vless: ['none', 'xtls-rprx-direct', 'xtls-rprx-splice', 'xtls-rprx-vision'] as const,
|
|
||||||
} as const;
|
|
||||||
|
|
||||||
export const TUIC_UDP_RELAY_MODES = ['native', 'quic'] as const;
|
|
||||||
export const TUIC_CONGESTION = ['bbr', 'cubic', 'new_reno'] as const;
|
|
||||||
export const XHTTP_MODES = ['auto', 'packet-up', 'stream-up', 'stream-one'] as const;
|
|
||||||
export const ENCRYPTION_TYPES = ['none', 'mlkem768x25519plus'] as const;
|
|
||||||
export const ENCRYPTION_MODES = ['native', 'xorpub', 'random'] as const;
|
|
||||||
export const ENCRYPTION_RTT = ['0rtt', '1rtt'] as const;
|
|
||||||
export const FINGERPRINTS = [
|
|
||||||
'chrome',
|
|
||||||
'firefox',
|
|
||||||
'safari',
|
|
||||||
'ios',
|
|
||||||
'android',
|
|
||||||
'edge',
|
|
||||||
'360',
|
|
||||||
'qq',
|
|
||||||
] as const;
|
|
||||||
|
|
||||||
export const multiplexLevels = ['none', 'low', 'middle', 'high'] as const;
|
|
||||||
|
|
||||||
export function getLabel(value: string): string {
|
|
||||||
const label = (LABELS as Record<string, string>)[value];
|
|
||||||
return label ?? value.toUpperCase();
|
|
||||||
}
|
|
||||||
|
|
||||||
const nullableString = z.string().nullish();
|
|
||||||
const nullableBool = z.boolean().nullish();
|
|
||||||
const nullablePort = z.number().int().min(0).max(65535).nullish();
|
|
||||||
|
|
||||||
const ss = z.object({
|
|
||||||
type: z.literal('shadowsocks'),
|
|
||||||
host: nullableString,
|
|
||||||
port: nullablePort,
|
|
||||||
cipher: z.enum(SS_CIPHERS as any).nullish(),
|
|
||||||
server_key: nullableString,
|
|
||||||
obfs: z.enum(['none', 'http', 'tls'] as const).nullish(),
|
|
||||||
obfs_host: nullableString,
|
|
||||||
obfs_path: nullableString,
|
|
||||||
});
|
|
||||||
|
|
||||||
const vmess = z.object({
|
|
||||||
type: z.literal('vmess'),
|
|
||||||
host: nullableString,
|
|
||||||
port: nullablePort,
|
|
||||||
transport: z.enum(TRANSPORTS.vmess as any).nullish(),
|
|
||||||
security: z.enum(SECURITY.vmess as any).nullish(),
|
|
||||||
path: nullableString,
|
|
||||||
service_name: nullableString,
|
|
||||||
sni: nullableString,
|
|
||||||
allow_insecure: nullableBool,
|
|
||||||
fingerprint: nullableString,
|
|
||||||
});
|
|
||||||
|
|
||||||
const vless = z.object({
|
|
||||||
type: z.literal('vless'),
|
|
||||||
host: nullableString,
|
|
||||||
port: nullablePort,
|
|
||||||
transport: z.enum(TRANSPORTS.vless as any).nullish(),
|
|
||||||
security: z.enum(SECURITY.vless as any).nullish(),
|
|
||||||
path: nullableString,
|
|
||||||
service_name: nullableString,
|
|
||||||
flow: z.enum(FLOWS.vless as any).nullish(),
|
|
||||||
sni: nullableString,
|
|
||||||
allow_insecure: nullableBool,
|
|
||||||
fingerprint: nullableString,
|
|
||||||
reality_server_addr: nullableString,
|
|
||||||
reality_server_port: nullablePort,
|
|
||||||
reality_private_key: nullableString,
|
|
||||||
reality_public_key: nullableString,
|
|
||||||
reality_short_id: nullableString,
|
|
||||||
mode: nullableString,
|
|
||||||
extra: nullableString,
|
|
||||||
encryption: z.enum(ENCRYPTION_TYPES as any).nullish(),
|
|
||||||
encryption_mode: z.enum(ENCRYPTION_MODES as any).nullish(),
|
|
||||||
encryption_rtt: z.enum(ENCRYPTION_RTT as any).nullish(),
|
|
||||||
encryption_ticket: nullableString,
|
|
||||||
encryption_server_padding: nullableString,
|
|
||||||
encryption_private_key: nullableString,
|
|
||||||
encryption_client_padding: nullableString,
|
|
||||||
encryption_password: nullableString,
|
|
||||||
});
|
|
||||||
|
|
||||||
const trojan = z.object({
|
|
||||||
type: z.literal('trojan'),
|
|
||||||
host: nullableString,
|
|
||||||
port: nullablePort,
|
|
||||||
transport: z.enum(TRANSPORTS.trojan as any).nullish(),
|
|
||||||
security: z.enum(SECURITY.trojan as any).nullish(),
|
|
||||||
path: nullableString,
|
|
||||||
service_name: nullableString,
|
|
||||||
sni: nullableString,
|
|
||||||
allow_insecure: nullableBool,
|
|
||||||
fingerprint: nullableString,
|
|
||||||
});
|
|
||||||
|
|
||||||
const hysteria2 = z.object({
|
|
||||||
type: z.literal('hysteria2'),
|
|
||||||
hop_ports: nullableString,
|
|
||||||
hop_interval: z.number().nullish(),
|
|
||||||
obfs_password: nullableString,
|
|
||||||
obfs: z.enum(['none', 'salamander'] as const).nullish(),
|
|
||||||
port: nullablePort,
|
|
||||||
security: z.enum(SECURITY.hysteria2 as any).nullish(),
|
|
||||||
sni: nullableString,
|
|
||||||
allow_insecure: nullableBool,
|
|
||||||
fingerprint: nullableString,
|
|
||||||
up_mbps: z.number().nullish(),
|
|
||||||
down_mbps: z.number().nullish(),
|
|
||||||
});
|
|
||||||
|
|
||||||
const tuic = z.object({
|
|
||||||
type: z.literal('tuic'),
|
|
||||||
host: nullableString,
|
|
||||||
port: nullablePort,
|
|
||||||
disable_sni: z.boolean().nullish(),
|
|
||||||
reduce_rtt: z.boolean().nullish(),
|
|
||||||
udp_relay_mode: z.enum(TUIC_UDP_RELAY_MODES as any).nullish(),
|
|
||||||
congestion_controller: z.enum(TUIC_CONGESTION as any).nullish(),
|
|
||||||
security: z.enum(SECURITY.tuic as any).nullish(),
|
|
||||||
sni: nullableString,
|
|
||||||
allow_insecure: nullableBool,
|
|
||||||
fingerprint: nullableString,
|
|
||||||
});
|
|
||||||
|
|
||||||
const anytls = z.object({
|
|
||||||
type: z.literal('anytls'),
|
|
||||||
port: nullablePort,
|
|
||||||
security: z.enum(SECURITY.anytls as any).nullish(),
|
|
||||||
sni: nullableString,
|
|
||||||
allow_insecure: nullableBool,
|
|
||||||
fingerprint: nullableString,
|
|
||||||
padding_scheme: nullableString,
|
|
||||||
});
|
|
||||||
|
|
||||||
const socks = z.object({
|
|
||||||
type: z.literal('socks'),
|
|
||||||
port: nullablePort,
|
|
||||||
});
|
|
||||||
|
|
||||||
const naive = z.object({
|
|
||||||
type: z.literal('naive'),
|
|
||||||
port: nullablePort,
|
|
||||||
security: z.enum(SECURITY.naive as any).nullish(),
|
|
||||||
sni: nullableString,
|
|
||||||
allow_insecure: nullableBool,
|
|
||||||
fingerprint: nullableString,
|
|
||||||
});
|
|
||||||
|
|
||||||
const http = z.object({
|
|
||||||
type: z.literal('http'),
|
|
||||||
port: nullablePort,
|
|
||||||
security: z.enum(SECURITY.http as any).nullish(),
|
|
||||||
sni: nullableString,
|
|
||||||
allow_insecure: nullableBool,
|
|
||||||
fingerprint: nullableString,
|
|
||||||
});
|
|
||||||
|
|
||||||
const meru = z.object({
|
|
||||||
type: z.literal('meru'),
|
|
||||||
port: nullablePort,
|
|
||||||
multiplex: z.enum(multiplexLevels).nullish(),
|
|
||||||
transport: z.enum(TRANSPORTS.meru as any).nullish(),
|
|
||||||
});
|
|
||||||
|
|
||||||
export const protocolApiScheme = z.discriminatedUnion('type', [
|
|
||||||
ss,
|
|
||||||
vmess,
|
|
||||||
vless,
|
|
||||||
trojan,
|
|
||||||
hysteria2,
|
|
||||||
tuic,
|
|
||||||
anytls,
|
|
||||||
socks,
|
|
||||||
naive,
|
|
||||||
http,
|
|
||||||
meru,
|
|
||||||
]);
|
|
||||||
|
|
||||||
export const formSchema = z.object({
|
|
||||||
name: z.string().min(1),
|
|
||||||
address: z.string().min(1),
|
|
||||||
country: z.string().optional(),
|
|
||||||
city: z.string().optional(),
|
|
||||||
ratio: z.number().default(1),
|
|
||||||
protocols: z.array(protocolApiScheme),
|
|
||||||
});
|
|
||||||
|
|
||||||
export type ServerFormValues = z.infer<typeof formSchema>;
|
|
||||||
|
|
||||||
export type ProtocolType = (typeof protocols)[number];
|
|
||||||
|
|
||||||
export function getProtocolDefaultConfig(proto: ProtocolType) {
|
|
||||||
switch (proto) {
|
|
||||||
case 'shadowsocks':
|
|
||||||
return {
|
|
||||||
type: 'shadowsocks',
|
|
||||||
port: null,
|
|
||||||
cipher: 'chacha20-ietf-poly1305',
|
|
||||||
server_key: null,
|
|
||||||
obfs: 'none',
|
|
||||||
obfs_host: null,
|
|
||||||
obfs_path: null,
|
|
||||||
} as any;
|
|
||||||
case 'vmess':
|
|
||||||
return { type: 'vmess', port: null, transport: 'tcp', security: 'none' } as any;
|
|
||||||
case 'vless':
|
|
||||||
return { type: 'vless', port: null, transport: 'tcp', security: 'none', flow: 'none' } as any;
|
|
||||||
case 'trojan':
|
|
||||||
return { type: 'trojan', port: null, transport: 'tcp', security: 'tls' } as any;
|
|
||||||
case 'hysteria2':
|
|
||||||
return {
|
|
||||||
type: 'hysteria2',
|
|
||||||
port: null,
|
|
||||||
hop_ports: null,
|
|
||||||
hop_interval: null,
|
|
||||||
obfs: 'none',
|
|
||||||
obfs_password: null,
|
|
||||||
security: 'tls',
|
|
||||||
up_mbps: null,
|
|
||||||
down_mbps: null,
|
|
||||||
} as any;
|
|
||||||
case 'tuic':
|
|
||||||
return {
|
|
||||||
type: 'tuic',
|
|
||||||
port: null,
|
|
||||||
disable_sni: false,
|
|
||||||
reduce_rtt: false,
|
|
||||||
udp_relay_mode: 'native',
|
|
||||||
congestion_controller: 'bbr',
|
|
||||||
security: 'tls',
|
|
||||||
sni: null,
|
|
||||||
allow_insecure: false,
|
|
||||||
fingerprint: 'chrome',
|
|
||||||
} as any;
|
|
||||||
case 'socks':
|
|
||||||
return {
|
|
||||||
type: 'socks',
|
|
||||||
port: null,
|
|
||||||
} as any;
|
|
||||||
case 'naive':
|
|
||||||
return {
|
|
||||||
type: 'naive',
|
|
||||||
port: null,
|
|
||||||
security: 'none',
|
|
||||||
} as any;
|
|
||||||
case 'http':
|
|
||||||
return {
|
|
||||||
type: 'http',
|
|
||||||
port: null,
|
|
||||||
security: 'none',
|
|
||||||
} as any;
|
|
||||||
case 'meru':
|
|
||||||
return {
|
|
||||||
type: 'meru',
|
|
||||||
port: null,
|
|
||||||
multiplex: 'none',
|
|
||||||
transport: 'tcp',
|
|
||||||
} as any;
|
|
||||||
case 'anytls':
|
|
||||||
return {
|
|
||||||
type: 'anytls',
|
|
||||||
port: null,
|
|
||||||
security: 'tls',
|
|
||||||
padding_scheme: null,
|
|
||||||
sni: null,
|
|
||||||
allow_insecure: false,
|
|
||||||
fingerprint: 'chrome',
|
|
||||||
} as any;
|
|
||||||
default:
|
|
||||||
return {} as any;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
export const PROTOCOL_FIELDS: Record<string, FieldConfig[]> = {
|
export const PROTOCOL_FIELDS: Record<string, FieldConfig[]> = {
|
||||||
shadowsocks: [
|
shadowsocks: [
|
||||||
@@ -561,7 +211,7 @@ export const PROTOCOL_FIELDS: Record<string, FieldConfig[]> = {
|
|||||||
condition: (p) => p.transport === 'grpc',
|
condition: (p) => p.transport === 'grpc',
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: 'mode',
|
name: 'xhttp_mode',
|
||||||
type: 'select',
|
type: 'select',
|
||||||
label: 'mode',
|
label: 'mode',
|
||||||
options: XHTTP_MODES,
|
options: XHTTP_MODES,
|
||||||
@@ -570,7 +220,7 @@ export const PROTOCOL_FIELDS: Record<string, FieldConfig[]> = {
|
|||||||
condition: (p) => p.transport === 'xhttp',
|
condition: (p) => p.transport === 'xhttp',
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: 'extra',
|
name: 'xhttp_extra',
|
||||||
type: 'textarea',
|
type: 'textarea',
|
||||||
label: 'extra',
|
label: 'extra',
|
||||||
placeholder: '{}',
|
placeholder: '{}',
|
||||||
@@ -700,10 +350,10 @@ export const PROTOCOL_FIELDS: Record<string, FieldConfig[]> = {
|
|||||||
placeholder: (t) => t('encryption_private_key_placeholder'),
|
placeholder: (t) => t('encryption_private_key_placeholder'),
|
||||||
group: 'encryption',
|
group: 'encryption',
|
||||||
generate: {
|
generate: {
|
||||||
function: () => generateVlessX25519Pair(),
|
function: generateMLKEM768KeyPair,
|
||||||
updateFields: {
|
updateFields: {
|
||||||
encryption_private_key: 'privateKeyB64',
|
encryption_private_key: 'privateKey',
|
||||||
encryption_password: 'passwordB64',
|
encryption_password: 'publicKey',
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
condition: (p) => p.encryption === 'mlkem768x25519plus',
|
condition: (p) => p.encryption === 'mlkem768x25519plus',
|
||||||
@@ -1006,7 +656,7 @@ export const PROTOCOL_FIELDS: Record<string, FieldConfig[]> = {
|
|||||||
condition: (p) => p.security !== 'none',
|
condition: (p) => p.security !== 'none',
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
meru: [
|
mieru: [
|
||||||
{
|
{
|
||||||
name: 'port',
|
name: 'port',
|
||||||
type: 'number',
|
type: 'number',
|
||||||
@@ -1028,7 +678,7 @@ export const PROTOCOL_FIELDS: Record<string, FieldConfig[]> = {
|
|||||||
name: 'transport',
|
name: 'transport',
|
||||||
type: 'select',
|
type: 'select',
|
||||||
label: 'transport',
|
label: 'transport',
|
||||||
options: TRANSPORTS.meru,
|
options: TRANSPORTS.mieru,
|
||||||
defaultValue: 'tcp',
|
defaultValue: 'tcp',
|
||||||
group: 'transport',
|
group: 'transport',
|
||||||
},
|
},
|
||||||
@@ -0,0 +1,30 @@
|
|||||||
|
// Re-export all constants
|
||||||
|
export {
|
||||||
|
ENCRYPTION_MODES,
|
||||||
|
ENCRYPTION_RTT,
|
||||||
|
ENCRYPTION_TYPES,
|
||||||
|
FINGERPRINTS,
|
||||||
|
FLOWS,
|
||||||
|
LABELS,
|
||||||
|
SECURITY,
|
||||||
|
SS_CIPHERS,
|
||||||
|
TRANSPORTS,
|
||||||
|
TUIC_CONGESTION,
|
||||||
|
TUIC_UDP_RELAY_MODES,
|
||||||
|
XHTTP_MODES,
|
||||||
|
getLabel,
|
||||||
|
multiplexLevels,
|
||||||
|
protocols,
|
||||||
|
} from './constants';
|
||||||
|
|
||||||
|
// Re-export all types
|
||||||
|
export type { FieldConfig, ProtocolType, ServerFormValues } from './types';
|
||||||
|
|
||||||
|
// Re-export all schemas
|
||||||
|
export { formSchema, protocolApiScheme } from './schemas';
|
||||||
|
|
||||||
|
// Re-export defaults
|
||||||
|
export { getProtocolDefaultConfig } from './defaults';
|
||||||
|
|
||||||
|
// Re-export fields
|
||||||
|
export { PROTOCOL_FIELDS } from './fields';
|
||||||
@@ -0,0 +1,187 @@
|
|||||||
|
import { z } from 'zod';
|
||||||
|
import {
|
||||||
|
ENCRYPTION_MODES,
|
||||||
|
ENCRYPTION_RTT,
|
||||||
|
ENCRYPTION_TYPES,
|
||||||
|
FLOWS,
|
||||||
|
multiplexLevels,
|
||||||
|
SECURITY,
|
||||||
|
SS_CIPHERS,
|
||||||
|
TRANSPORTS,
|
||||||
|
TUIC_CONGESTION,
|
||||||
|
TUIC_UDP_RELAY_MODES,
|
||||||
|
XHTTP_MODES,
|
||||||
|
} from './constants';
|
||||||
|
|
||||||
|
const nullableString = z.string().nullish();
|
||||||
|
const nullableBool = z.boolean().nullish();
|
||||||
|
const nullablePort = z.number().int().min(0).max(65535).nullish();
|
||||||
|
|
||||||
|
const ss = z.object({
|
||||||
|
type: z.literal('shadowsocks'),
|
||||||
|
enable: nullableBool,
|
||||||
|
host: nullableString,
|
||||||
|
port: nullablePort,
|
||||||
|
cipher: z.enum(SS_CIPHERS).nullish(),
|
||||||
|
server_key: nullableString,
|
||||||
|
obfs: z.enum(['none', 'http', 'tls'] as const).nullish(),
|
||||||
|
obfs_host: nullableString,
|
||||||
|
obfs_path: nullableString,
|
||||||
|
});
|
||||||
|
|
||||||
|
const vmess = z.object({
|
||||||
|
type: z.literal('vmess'),
|
||||||
|
enable: nullableBool,
|
||||||
|
host: nullableString,
|
||||||
|
port: nullablePort,
|
||||||
|
transport: z.enum(TRANSPORTS.vmess).nullish(),
|
||||||
|
security: z.enum(SECURITY.vmess).nullish(),
|
||||||
|
path: nullableString,
|
||||||
|
service_name: nullableString,
|
||||||
|
sni: nullableString,
|
||||||
|
allow_insecure: nullableBool,
|
||||||
|
fingerprint: nullableString,
|
||||||
|
});
|
||||||
|
|
||||||
|
const vless = z.object({
|
||||||
|
type: z.literal('vless'),
|
||||||
|
enable: nullableBool,
|
||||||
|
host: nullableString,
|
||||||
|
port: nullablePort,
|
||||||
|
transport: z.enum(TRANSPORTS.vless).nullish(),
|
||||||
|
security: z.enum(SECURITY.vless).nullish(),
|
||||||
|
path: nullableString,
|
||||||
|
service_name: nullableString,
|
||||||
|
flow: z.enum(FLOWS.vless).nullish(),
|
||||||
|
sni: nullableString,
|
||||||
|
allow_insecure: nullableBool,
|
||||||
|
fingerprint: nullableString,
|
||||||
|
reality_server_addr: nullableString,
|
||||||
|
reality_server_port: nullablePort,
|
||||||
|
reality_private_key: nullableString,
|
||||||
|
reality_public_key: nullableString,
|
||||||
|
reality_short_id: nullableString,
|
||||||
|
xhttp_mode: z.enum(XHTTP_MODES).nullish(),
|
||||||
|
xhttp_extra: nullableString,
|
||||||
|
encryption: z.enum(ENCRYPTION_TYPES).nullish(),
|
||||||
|
encryption_mode: z.enum(ENCRYPTION_MODES).nullish(),
|
||||||
|
encryption_rtt: z.enum(ENCRYPTION_RTT).nullish(),
|
||||||
|
encryption_ticket: nullableString,
|
||||||
|
encryption_server_padding: nullableString,
|
||||||
|
encryption_private_key: nullableString,
|
||||||
|
encryption_client_padding: nullableString,
|
||||||
|
encryption_password: nullableString,
|
||||||
|
});
|
||||||
|
|
||||||
|
const trojan = z.object({
|
||||||
|
type: z.literal('trojan'),
|
||||||
|
enable: nullableBool,
|
||||||
|
host: nullableString,
|
||||||
|
port: nullablePort,
|
||||||
|
transport: z.enum(TRANSPORTS.trojan).nullish(),
|
||||||
|
security: z.enum(SECURITY.trojan).nullish(),
|
||||||
|
path: nullableString,
|
||||||
|
service_name: nullableString,
|
||||||
|
sni: nullableString,
|
||||||
|
allow_insecure: nullableBool,
|
||||||
|
fingerprint: nullableString,
|
||||||
|
});
|
||||||
|
|
||||||
|
const hysteria2 = z.object({
|
||||||
|
type: z.literal('hysteria2'),
|
||||||
|
enable: nullableBool,
|
||||||
|
hop_ports: nullableString,
|
||||||
|
hop_interval: z.number().nullish(),
|
||||||
|
obfs_password: nullableString,
|
||||||
|
obfs: z.enum(['none', 'salamander'] as const).nullish(),
|
||||||
|
port: nullablePort,
|
||||||
|
security: z.enum(SECURITY.hysteria2).nullish(),
|
||||||
|
sni: nullableString,
|
||||||
|
allow_insecure: nullableBool,
|
||||||
|
fingerprint: nullableString,
|
||||||
|
up_mbps: z.number().nullish(),
|
||||||
|
down_mbps: z.number().nullish(),
|
||||||
|
});
|
||||||
|
|
||||||
|
const tuic = z.object({
|
||||||
|
type: z.literal('tuic'),
|
||||||
|
enable: nullableBool,
|
||||||
|
host: nullableString,
|
||||||
|
port: nullablePort,
|
||||||
|
disable_sni: z.boolean().nullish(),
|
||||||
|
reduce_rtt: z.boolean().nullish(),
|
||||||
|
udp_relay_mode: z.enum(TUIC_UDP_RELAY_MODES).nullish(),
|
||||||
|
congestion_controller: z.enum(TUIC_CONGESTION).nullish(),
|
||||||
|
security: z.enum(SECURITY.tuic).nullish(),
|
||||||
|
sni: nullableString,
|
||||||
|
allow_insecure: nullableBool,
|
||||||
|
fingerprint: nullableString,
|
||||||
|
});
|
||||||
|
|
||||||
|
const anytls = z.object({
|
||||||
|
type: z.literal('anytls'),
|
||||||
|
enable: nullableBool,
|
||||||
|
port: nullablePort,
|
||||||
|
security: z.enum(SECURITY.anytls).nullish(),
|
||||||
|
sni: nullableString,
|
||||||
|
allow_insecure: nullableBool,
|
||||||
|
fingerprint: nullableString,
|
||||||
|
padding_scheme: nullableString,
|
||||||
|
});
|
||||||
|
|
||||||
|
const socks = z.object({
|
||||||
|
type: z.literal('socks'),
|
||||||
|
enable: nullableBool,
|
||||||
|
port: nullablePort,
|
||||||
|
});
|
||||||
|
|
||||||
|
const naive = z.object({
|
||||||
|
type: z.literal('naive'),
|
||||||
|
enable: nullableBool,
|
||||||
|
port: nullablePort,
|
||||||
|
security: z.enum(SECURITY.naive).nullish(),
|
||||||
|
sni: nullableString,
|
||||||
|
allow_insecure: nullableBool,
|
||||||
|
fingerprint: nullableString,
|
||||||
|
});
|
||||||
|
|
||||||
|
const http = z.object({
|
||||||
|
type: z.literal('http'),
|
||||||
|
enable: nullableBool,
|
||||||
|
port: nullablePort,
|
||||||
|
security: z.enum(SECURITY.http).nullish(),
|
||||||
|
sni: nullableString,
|
||||||
|
allow_insecure: nullableBool,
|
||||||
|
fingerprint: nullableString,
|
||||||
|
});
|
||||||
|
|
||||||
|
const mieru = z.object({
|
||||||
|
type: z.literal('mieru'),
|
||||||
|
enable: nullableBool,
|
||||||
|
port: nullablePort,
|
||||||
|
multiplex: z.enum(multiplexLevels).nullish(),
|
||||||
|
transport: z.enum(TRANSPORTS.mieru).nullish(),
|
||||||
|
});
|
||||||
|
|
||||||
|
export const protocolApiScheme = z.discriminatedUnion('type', [
|
||||||
|
ss,
|
||||||
|
vmess,
|
||||||
|
vless,
|
||||||
|
trojan,
|
||||||
|
hysteria2,
|
||||||
|
tuic,
|
||||||
|
anytls,
|
||||||
|
socks,
|
||||||
|
naive,
|
||||||
|
http,
|
||||||
|
mieru,
|
||||||
|
]);
|
||||||
|
|
||||||
|
export const formSchema = z.object({
|
||||||
|
name: z.string().min(1),
|
||||||
|
address: z.string().min(1),
|
||||||
|
country: z.string().optional(),
|
||||||
|
city: z.string().optional(),
|
||||||
|
ratio: z.number().default(1),
|
||||||
|
protocols: z.array(protocolApiScheme),
|
||||||
|
});
|
||||||
@@ -0,0 +1,27 @@
|
|||||||
|
import { z } from 'zod';
|
||||||
|
import { protocols } from './constants';
|
||||||
|
import { formSchema } from './schemas';
|
||||||
|
|
||||||
|
export type FieldConfig = {
|
||||||
|
name: string;
|
||||||
|
type: 'input' | 'select' | 'switch' | 'number' | 'textarea';
|
||||||
|
label: string;
|
||||||
|
placeholder?: string | ((t: (key: string) => string, protocol: any) => string);
|
||||||
|
options?: readonly string[];
|
||||||
|
defaultValue?: any;
|
||||||
|
min?: number;
|
||||||
|
max?: number;
|
||||||
|
step?: number;
|
||||||
|
suffix?: string;
|
||||||
|
generate?: {
|
||||||
|
function: () => Promise<string | Record<string, string>> | string | Record<string, string>;
|
||||||
|
updateFields?: Record<string, string>;
|
||||||
|
};
|
||||||
|
condition?: (protocol: any, values: any) => boolean;
|
||||||
|
group?: 'basic' | 'transport' | 'security' | 'reality' | 'obfs' | 'encryption';
|
||||||
|
gridSpan?: 1 | 2;
|
||||||
|
};
|
||||||
|
|
||||||
|
export type ServerFormValues = z.infer<typeof formSchema>;
|
||||||
|
|
||||||
|
export type ProtocolType = (typeof protocols)[number];
|
||||||
@@ -1,6 +1,4 @@
|
|||||||
export { generatePassword } from './random';
|
export { generateMLKEM768KeyPair } from './mlkem768';
|
||||||
export {
|
export { generateRealityShortId } from './short-id';
|
||||||
generateRealityKeyPair,
|
export { generatePassword } from './uid';
|
||||||
generateRealityShortId,
|
export { generateRealityKeyPair } from './x25519';
|
||||||
publicKeyFromPrivate,
|
|
||||||
} from './reality-key';
|
|
||||||
|
|||||||
@@ -0,0 +1,16 @@
|
|||||||
|
import mlkem from 'mlkem-wasm';
|
||||||
|
import { toB64Url } from './util';
|
||||||
|
|
||||||
|
export async function generateMLKEM768KeyPair() {
|
||||||
|
const mlkemKeyPair = await mlkem.generateKey({ name: 'ML-KEM-768' }, true, [
|
||||||
|
'encapsulateBits',
|
||||||
|
'decapsulateBits',
|
||||||
|
]);
|
||||||
|
const mlkemPublicKeyRaw = await mlkem.exportKey('raw-public', mlkemKeyPair.publicKey);
|
||||||
|
const mlkemPrivateKeyRaw = await mlkem.exportKey('raw-seed', mlkemKeyPair.privateKey);
|
||||||
|
|
||||||
|
return {
|
||||||
|
publicKey: toB64Url(new Uint8Array(mlkemPublicKeyRaw)),
|
||||||
|
privateKey: toB64Url(new Uint8Array(mlkemPrivateKeyRaw)),
|
||||||
|
};
|
||||||
|
}
|
||||||
@@ -1,23 +0,0 @@
|
|||||||
import { x25519 } from '@noble/curves/ed25519';
|
|
||||||
|
|
||||||
const toB64Url = (u8: Uint8Array) =>
|
|
||||||
(typeof Buffer !== 'undefined'
|
|
||||||
? Buffer.from(u8).toString('base64')
|
|
||||||
: btoa(String.fromCharCode(...u8))
|
|
||||||
)
|
|
||||||
.replace(/\+/g, '-')
|
|
||||||
.replace(/\//g, '_')
|
|
||||||
.replace(/=+$/g, '');
|
|
||||||
|
|
||||||
export type VlessX25519Pair = {
|
|
||||||
passwordB64: string;
|
|
||||||
privateKeyB64: string;
|
|
||||||
};
|
|
||||||
|
|
||||||
export function generateVlessX25519Pair(): VlessX25519Pair {
|
|
||||||
const { secretKey, publicKey } = x25519.keygen();
|
|
||||||
return {
|
|
||||||
passwordB64: toB64Url(publicKey),
|
|
||||||
privateKeyB64: toB64Url(secretKey),
|
|
||||||
};
|
|
||||||
}
|
|
||||||
@@ -1,49 +0,0 @@
|
|||||||
import { x25519 } from '@noble/curves/ed25519.js';
|
|
||||||
|
|
||||||
function toB64Url(bytes: Uint8Array) {
|
|
||||||
return btoa(String.fromCharCode(...bytes))
|
|
||||||
.replace(/\+/g, '-')
|
|
||||||
.replace(/\//g, '_')
|
|
||||||
.replace(/=+$/g, '');
|
|
||||||
}
|
|
||||||
function fromB64Url(s: string) {
|
|
||||||
const b64 = s
|
|
||||||
.replace(/-/g, '+')
|
|
||||||
.replace(/_/g, '/')
|
|
||||||
.padEnd(Math.ceil(s.length / 4) * 4, '=');
|
|
||||||
const bin = atob(b64);
|
|
||||||
return new Uint8Array([...bin].map((c) => c.charCodeAt(0)));
|
|
||||||
}
|
|
||||||
/**
|
|
||||||
* Generate a Reality key pair
|
|
||||||
* @returns An object containing the private and public keys in base64url format
|
|
||||||
*/
|
|
||||||
export function generateRealityKeyPair() {
|
|
||||||
const { secretKey, publicKey } = x25519.keygen();
|
|
||||||
return { privateKey: toB64Url(secretKey), publicKey: toB64Url(publicKey) };
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Derive public key from private key
|
|
||||||
* @param privateKeyB64Url Private key in base64url format
|
|
||||||
* @returns Public key in base64url format
|
|
||||||
*/
|
|
||||||
export function publicKeyFromPrivate(privateKeyB64Url: string) {
|
|
||||||
return toB64Url(x25519.getPublicKey(fromB64Url(privateKeyB64Url)));
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Generate a short ID for Reality
|
|
||||||
* @returns A random hexadecimal string of length 2, 4, 6, 8, 10, 12, 14, or 16
|
|
||||||
*/
|
|
||||||
export function generateRealityShortId() {
|
|
||||||
const hex = '0123456789abcdef';
|
|
||||||
const lengths = [2, 4, 6, 8, 10, 12, 14, 16];
|
|
||||||
const idx = Math.floor(Math.random() * lengths.length);
|
|
||||||
const len = lengths[idx] ?? 16;
|
|
||||||
let out = '';
|
|
||||||
for (let i = 0; i < len; i++) {
|
|
||||||
out += hex.charAt(Math.floor(Math.random() * hex.length));
|
|
||||||
}
|
|
||||||
return out;
|
|
||||||
}
|
|
||||||
@@ -0,0 +1,15 @@
|
|||||||
|
/**
|
||||||
|
* Generate a short ID for Reality
|
||||||
|
* @returns A random hexadecimal string of length 2, 4, 6, 8, 10, 12, 14, or 16
|
||||||
|
*/
|
||||||
|
export function generateRealityShortId() {
|
||||||
|
const hex = '0123456789abcdef';
|
||||||
|
const lengths = [2, 4, 6, 8, 10, 12, 14, 16];
|
||||||
|
const idx = Math.floor(Math.random() * lengths.length);
|
||||||
|
const len = lengths[idx] ?? 16;
|
||||||
|
let out = '';
|
||||||
|
for (let i = 0; i < len; i++) {
|
||||||
|
out += hex.charAt(Math.floor(Math.random() * hex.length));
|
||||||
|
}
|
||||||
|
return out;
|
||||||
|
}
|
||||||
@@ -0,0 +1,6 @@
|
|||||||
|
export function toB64Url(bytes: Uint8Array) {
|
||||||
|
return btoa(String.fromCharCode(...bytes))
|
||||||
|
.replace(/\+/g, '-')
|
||||||
|
.replace(/\//g, '_')
|
||||||
|
.replace(/=+$/g, '');
|
||||||
|
}
|
||||||
@@ -0,0 +1,11 @@
|
|||||||
|
import { x25519 } from '@noble/curves/ed25519';
|
||||||
|
import { toB64Url } from './util';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Generate a Reality key pair
|
||||||
|
* @returns An object containing the private and public keys in base64url format
|
||||||
|
*/
|
||||||
|
export function generateRealityKeyPair() {
|
||||||
|
const { secretKey, publicKey } = x25519.keygen();
|
||||||
|
return { privateKey: toB64Url(secretKey), publicKey: toB64Url(publicKey) };
|
||||||
|
}
|
||||||
@@ -102,8 +102,8 @@ function DynamicField({
|
|||||||
<Button
|
<Button
|
||||||
type='button'
|
type='button'
|
||||||
variant='ghost'
|
variant='ghost'
|
||||||
onClick={() => {
|
onClick={async () => {
|
||||||
const result = field.generate!.function();
|
const result = await field.generate!.function();
|
||||||
if (typeof result === 'string') {
|
if (typeof result === 'string') {
|
||||||
fieldProps.onChange(result);
|
fieldProps.onChange(result);
|
||||||
} else if (field.generate!.updateFields) {
|
} else if (field.generate!.updateFields) {
|
||||||
@@ -364,24 +364,18 @@ export default function ServerForm(props: {
|
|||||||
}, [initialValues]);
|
}, [initialValues]);
|
||||||
|
|
||||||
async function handleSubmit(values: Record<string, any>) {
|
async function handleSubmit(values: Record<string, any>) {
|
||||||
const filtered = (values?.protocols || []).filter((p: any, index: number) => {
|
const filteredProtocols = (values?.protocols || []).filter((protocol: any) => {
|
||||||
const port = Number(p?.port);
|
const port = Number(protocol?.port);
|
||||||
const protocolType = PROTOCOLS[index];
|
return protocol && Number.isFinite(port) && port > 0 && port <= 65535;
|
||||||
return protocolType && p && Number.isFinite(port) && port > 0 && port <= 65535;
|
|
||||||
});
|
});
|
||||||
|
|
||||||
if (filtered.length === 0) {
|
|
||||||
toast.error(t('validation_failed'));
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
const result = {
|
const result = {
|
||||||
name: values.name,
|
name: values.name,
|
||||||
country: values.country,
|
country: values.country,
|
||||||
city: values.city,
|
city: values.city,
|
||||||
ratio: Number(values.ratio || 1),
|
ratio: values.ratio || 1,
|
||||||
address: values.address,
|
address: values.address,
|
||||||
protocols: filtered,
|
protocols: filteredProtocols,
|
||||||
};
|
};
|
||||||
|
|
||||||
const ok = await onSubmit(result);
|
const ok = await onSubmit(result);
|
||||||
@@ -507,6 +501,7 @@ export default function ServerForm(props: {
|
|||||||
{t('protocol_configurations_desc')}
|
{t('protocol_configurations_desc')}
|
||||||
</p>
|
</p>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<Accordion
|
<Accordion
|
||||||
type='single'
|
type='single'
|
||||||
collapsible
|
collapsible
|
||||||
@@ -520,39 +515,45 @@ export default function ServerForm(props: {
|
|||||||
PROTOCOLS.findIndex((t) => t === type),
|
PROTOCOLS.findIndex((t) => t === type),
|
||||||
);
|
);
|
||||||
const current = (protocolsValues[i] || {}) as Record<string, any>;
|
const current = (protocolsValues[i] || {}) as Record<string, any>;
|
||||||
const isEnabled = current.port && Number(current.port) > 0;
|
|
||||||
const fields = PROTOCOL_FIELDS[type] || [];
|
const fields = PROTOCOL_FIELDS[type] || [];
|
||||||
return (
|
return (
|
||||||
<AccordionItem key={type} value={type} className='mb-2 rounded-lg border'>
|
<AccordionItem key={type} value={type} className='mb-2 rounded-lg border'>
|
||||||
<AccordionTrigger className='px-4 py-3 hover:no-underline'>
|
<AccordionTrigger className='px-4 py-3 hover:no-underline'>
|
||||||
<div className='flex w-full items-center justify-between'>
|
<div className='flex w-full items-center justify-between'>
|
||||||
<div className='flex flex-col items-start'>
|
<div className='flex flex-col items-start gap-1'>
|
||||||
<div className='flex items-center gap-2'>
|
<div className='flex items-center gap-1'>
|
||||||
<span className='font-medium capitalize'>{type}</span>
|
<span className='font-medium capitalize'>{type}</span>
|
||||||
</div>
|
{current.transport && (
|
||||||
<span
|
<Badge variant='secondary' className='text-xs'>
|
||||||
className={cn(
|
{current.transport.toUpperCase()}
|
||||||
'text-muted-foreground text-xs',
|
</Badge>
|
||||||
isEnabled && 'text-green-500',
|
|
||||||
)}
|
)}
|
||||||
>
|
{current.security && current.security !== 'none' && (
|
||||||
{isEnabled ? t('enabled') : t('disabled')}
|
<Badge variant='outline' className='text-xs'>
|
||||||
</span>
|
{current.security.toUpperCase()}
|
||||||
</div>
|
</Badge>
|
||||||
<div className='mr-2 flex items-center gap-1'>
|
)}
|
||||||
{current.transport && (
|
{current.port && <Badge className='text-xs'>{current.port}</Badge>}
|
||||||
<Badge variant='secondary' className='text-xs'>
|
</div>
|
||||||
{current.transport.toUpperCase()}
|
<div className='flex items-center gap-1'>
|
||||||
</Badge>
|
<span
|
||||||
)}
|
className={cn(
|
||||||
{current.security && current.security !== 'none' && (
|
'text-xs',
|
||||||
<Badge variant='outline' className='text-xs'>
|
current.enable ? 'text-green-500' : 'text-muted-foreground',
|
||||||
{current.security.toUpperCase()}
|
)}
|
||||||
</Badge>
|
>
|
||||||
)}
|
{current.enable ? t('enabled') : t('disabled')}
|
||||||
|
</span>
|
||||||
{current.port && <Badge className='text-xs'>{current.port}</Badge>}
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
<Switch
|
||||||
|
className='mr-2'
|
||||||
|
checked={!!current.enable}
|
||||||
|
onCheckedChange={(checked) => {
|
||||||
|
form.setValue(`protocols.${i}.enable`, checked);
|
||||||
|
}}
|
||||||
|
onClick={(e) => e.stopPropagation()}
|
||||||
|
/>
|
||||||
</div>
|
</div>
|
||||||
</AccordionTrigger>
|
</AccordionTrigger>
|
||||||
<AccordionContent className='px-4 pb-4 pt-0'>
|
<AccordionContent className='px-4 pb-4 pt-0'>
|
||||||
@@ -621,7 +622,8 @@ export default function ServerForm(props: {
|
|||||||
return false;
|
return false;
|
||||||
})}
|
})}
|
||||||
>
|
>
|
||||||
{loading && <Icon icon='mdi:loading' className='mr-2 animate-spin' />} {t('confirm')}
|
{loading && <Icon icon='mdi:loading' className='mr-2 animate-spin' />}
|
||||||
|
{t('confirm')}
|
||||||
</Button>
|
</Button>
|
||||||
</SheetFooter>
|
</SheetFooter>
|
||||||
</SheetContent>
|
</SheetContent>
|
||||||
|
|||||||
@@ -18,6 +18,7 @@
|
|||||||
"ahooks": "^3.9.4",
|
"ahooks": "^3.9.4",
|
||||||
"axios": "^1.11.0",
|
"axios": "^1.11.0",
|
||||||
"js-yaml": "^4.1.0",
|
"js-yaml": "^4.1.0",
|
||||||
|
"mlkem-wasm": "^0.0.6",
|
||||||
"nanoid": "^5.1.5",
|
"nanoid": "^5.1.5",
|
||||||
"next": "^15.5.2",
|
"next": "^15.5.2",
|
||||||
"next-intl": "^3.26.3",
|
"next-intl": "^3.26.3",
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
// @ts-ignore
|
// @ts-ignore
|
||||||
|
|
||||||
// API 更新时间:
|
// API 更新时间:
|
||||||
// API 唯一标识:
|
// API 唯一标识:
|
||||||
import * as ads from './ads';
|
import * as ads from './ads';
|
||||||
|
|||||||
+27
-4
@@ -1496,6 +1496,7 @@ declare namespace API {
|
|||||||
type Protocol = {
|
type Protocol = {
|
||||||
type: string;
|
type: string;
|
||||||
port: number;
|
port: number;
|
||||||
|
enable: boolean;
|
||||||
security?: string;
|
security?: string;
|
||||||
sni?: string;
|
sni?: string;
|
||||||
allow_insecure?: boolean;
|
allow_insecure?: boolean;
|
||||||
@@ -1519,10 +1520,6 @@ declare namespace API {
|
|||||||
reduce_rtt?: boolean;
|
reduce_rtt?: boolean;
|
||||||
udp_relay_mode?: string;
|
udp_relay_mode?: string;
|
||||||
congestion_controller?: string;
|
congestion_controller?: string;
|
||||||
/** obfs, v2ray-plugin, simple-obfs */
|
|
||||||
plugin?: string;
|
|
||||||
/** plugin options, eg: obfs=http;obfs-host=www.bing.com */
|
|
||||||
plugin_options?: string;
|
|
||||||
/** mux, eg: off/low/medium/high */
|
/** mux, eg: off/low/medium/high */
|
||||||
multiplex?: string;
|
multiplex?: string;
|
||||||
/** padding scheme */
|
/** padding scheme */
|
||||||
@@ -1531,6 +1528,32 @@ declare namespace API {
|
|||||||
up_mbps?: number;
|
up_mbps?: number;
|
||||||
/** download speed limit */
|
/** download speed limit */
|
||||||
down_mbps?: number;
|
down_mbps?: number;
|
||||||
|
/** obfs, 'none', 'http', 'tls' */
|
||||||
|
obfs?: string;
|
||||||
|
/** obfs host */
|
||||||
|
obfs_host?: string;
|
||||||
|
/** obfs path */
|
||||||
|
obfs_path?: string;
|
||||||
|
/** xhttp mode */
|
||||||
|
xhttp_mode?: string;
|
||||||
|
/** xhttp extra path */
|
||||||
|
xhttp_extra?: string;
|
||||||
|
/** encryption,'none', 'mlkem768x25519plus' */
|
||||||
|
encryption?: string;
|
||||||
|
/** encryption mode,'native', 'xorpub', 'random' */
|
||||||
|
encryption_mode?: string;
|
||||||
|
/** encryption rtt,'0rtt', '1rtt' */
|
||||||
|
encryption_rtt?: string;
|
||||||
|
/** encryption ticket */
|
||||||
|
encryption_ticket?: string;
|
||||||
|
/** encryption server padding */
|
||||||
|
encryption_server_padding?: string;
|
||||||
|
/** encryption private key */
|
||||||
|
encryption_private_key?: string;
|
||||||
|
/** encryption client padding */
|
||||||
|
encryption_client_padding?: string;
|
||||||
|
/** encryption password */
|
||||||
|
encryption_password?: string;
|
||||||
};
|
};
|
||||||
|
|
||||||
type PubilcRegisterConfig = {
|
type PubilcRegisterConfig = {
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
// @ts-ignore
|
// @ts-ignore
|
||||||
|
|
||||||
// API 更新时间:
|
// API 更新时间:
|
||||||
// API 唯一标识:
|
// API 唯一标识:
|
||||||
import * as auth from './auth';
|
import * as auth from './auth';
|
||||||
|
|||||||
+27
-4
@@ -504,6 +504,7 @@ declare namespace API {
|
|||||||
type Protocol = {
|
type Protocol = {
|
||||||
type: string;
|
type: string;
|
||||||
port: number;
|
port: number;
|
||||||
|
enable: boolean;
|
||||||
security?: string;
|
security?: string;
|
||||||
sni?: string;
|
sni?: string;
|
||||||
allow_insecure?: boolean;
|
allow_insecure?: boolean;
|
||||||
@@ -527,10 +528,6 @@ declare namespace API {
|
|||||||
reduce_rtt?: boolean;
|
reduce_rtt?: boolean;
|
||||||
udp_relay_mode?: string;
|
udp_relay_mode?: string;
|
||||||
congestion_controller?: string;
|
congestion_controller?: string;
|
||||||
/** obfs, v2ray-plugin, simple-obfs */
|
|
||||||
plugin?: string;
|
|
||||||
/** plugin options, eg: obfs=http;obfs-host=www.bing.com */
|
|
||||||
plugin_options?: string;
|
|
||||||
/** mux, eg: off/low/medium/high */
|
/** mux, eg: off/low/medium/high */
|
||||||
multiplex?: string;
|
multiplex?: string;
|
||||||
/** padding scheme */
|
/** padding scheme */
|
||||||
@@ -539,6 +536,32 @@ declare namespace API {
|
|||||||
up_mbps?: number;
|
up_mbps?: number;
|
||||||
/** download speed limit */
|
/** download speed limit */
|
||||||
down_mbps?: number;
|
down_mbps?: number;
|
||||||
|
/** obfs, 'none', 'http', 'tls' */
|
||||||
|
obfs?: string;
|
||||||
|
/** obfs host */
|
||||||
|
obfs_host?: string;
|
||||||
|
/** obfs path */
|
||||||
|
obfs_path?: string;
|
||||||
|
/** xhttp mode */
|
||||||
|
xhttp_mode?: string;
|
||||||
|
/** xhttp extra path */
|
||||||
|
xhttp_extra?: string;
|
||||||
|
/** encryption,'none', 'mlkem768x25519plus' */
|
||||||
|
encryption?: string;
|
||||||
|
/** encryption mode,'native', 'xorpub', 'random' */
|
||||||
|
encryption_mode?: string;
|
||||||
|
/** encryption rtt,'0rtt', '1rtt' */
|
||||||
|
encryption_rtt?: string;
|
||||||
|
/** encryption ticket */
|
||||||
|
encryption_ticket?: string;
|
||||||
|
/** encryption server padding */
|
||||||
|
encryption_server_padding?: string;
|
||||||
|
/** encryption private key */
|
||||||
|
encryption_private_key?: string;
|
||||||
|
/** encryption client padding */
|
||||||
|
encryption_client_padding?: string;
|
||||||
|
/** encryption password */
|
||||||
|
encryption_password?: string;
|
||||||
};
|
};
|
||||||
|
|
||||||
type PubilcRegisterConfig = {
|
type PubilcRegisterConfig = {
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
// @ts-ignore
|
// @ts-ignore
|
||||||
|
|
||||||
// API 更新时间:
|
// API 更新时间:
|
||||||
// API 唯一标识:
|
// API 唯一标识:
|
||||||
import * as auth from './auth';
|
import * as auth from './auth';
|
||||||
|
|||||||
+27
-4
@@ -504,6 +504,7 @@ declare namespace API {
|
|||||||
type Protocol = {
|
type Protocol = {
|
||||||
type: string;
|
type: string;
|
||||||
port: number;
|
port: number;
|
||||||
|
enable: boolean;
|
||||||
security?: string;
|
security?: string;
|
||||||
sni?: string;
|
sni?: string;
|
||||||
allow_insecure?: boolean;
|
allow_insecure?: boolean;
|
||||||
@@ -527,10 +528,6 @@ declare namespace API {
|
|||||||
reduce_rtt?: boolean;
|
reduce_rtt?: boolean;
|
||||||
udp_relay_mode?: string;
|
udp_relay_mode?: string;
|
||||||
congestion_controller?: string;
|
congestion_controller?: string;
|
||||||
/** obfs, v2ray-plugin, simple-obfs */
|
|
||||||
plugin?: string;
|
|
||||||
/** plugin options, eg: obfs=http;obfs-host=www.bing.com */
|
|
||||||
plugin_options?: string;
|
|
||||||
/** mux, eg: off/low/medium/high */
|
/** mux, eg: off/low/medium/high */
|
||||||
multiplex?: string;
|
multiplex?: string;
|
||||||
/** padding scheme */
|
/** padding scheme */
|
||||||
@@ -539,6 +536,32 @@ declare namespace API {
|
|||||||
up_mbps?: number;
|
up_mbps?: number;
|
||||||
/** download speed limit */
|
/** download speed limit */
|
||||||
down_mbps?: number;
|
down_mbps?: number;
|
||||||
|
/** obfs, 'none', 'http', 'tls' */
|
||||||
|
obfs?: string;
|
||||||
|
/** obfs host */
|
||||||
|
obfs_host?: string;
|
||||||
|
/** obfs path */
|
||||||
|
obfs_path?: string;
|
||||||
|
/** xhttp mode */
|
||||||
|
xhttp_mode?: string;
|
||||||
|
/** xhttp extra path */
|
||||||
|
xhttp_extra?: string;
|
||||||
|
/** encryption,'none', 'mlkem768x25519plus' */
|
||||||
|
encryption?: string;
|
||||||
|
/** encryption mode,'native', 'xorpub', 'random' */
|
||||||
|
encryption_mode?: string;
|
||||||
|
/** encryption rtt,'0rtt', '1rtt' */
|
||||||
|
encryption_rtt?: string;
|
||||||
|
/** encryption ticket */
|
||||||
|
encryption_ticket?: string;
|
||||||
|
/** encryption server padding */
|
||||||
|
encryption_server_padding?: string;
|
||||||
|
/** encryption private key */
|
||||||
|
encryption_private_key?: string;
|
||||||
|
/** encryption client padding */
|
||||||
|
encryption_client_padding?: string;
|
||||||
|
/** encryption password */
|
||||||
|
encryption_password?: string;
|
||||||
};
|
};
|
||||||
|
|
||||||
type PubilcRegisterConfig = {
|
type PubilcRegisterConfig = {
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
// @ts-ignore
|
// @ts-ignore
|
||||||
|
|
||||||
// API 更新时间:
|
// API 更新时间:
|
||||||
// API 唯一标识:
|
// API 唯一标识:
|
||||||
import * as announcement from './announcement';
|
import * as announcement from './announcement';
|
||||||
|
|||||||
Vendored
+27
-4
@@ -543,6 +543,7 @@ declare namespace API {
|
|||||||
type Protocol = {
|
type Protocol = {
|
||||||
type: string;
|
type: string;
|
||||||
port: number;
|
port: number;
|
||||||
|
enable: boolean;
|
||||||
security?: string;
|
security?: string;
|
||||||
sni?: string;
|
sni?: string;
|
||||||
allow_insecure?: boolean;
|
allow_insecure?: boolean;
|
||||||
@@ -566,10 +567,6 @@ declare namespace API {
|
|||||||
reduce_rtt?: boolean;
|
reduce_rtt?: boolean;
|
||||||
udp_relay_mode?: string;
|
udp_relay_mode?: string;
|
||||||
congestion_controller?: string;
|
congestion_controller?: string;
|
||||||
/** obfs, v2ray-plugin, simple-obfs */
|
|
||||||
plugin?: string;
|
|
||||||
/** plugin options, eg: obfs=http;obfs-host=www.bing.com */
|
|
||||||
plugin_options?: string;
|
|
||||||
/** mux, eg: off/low/medium/high */
|
/** mux, eg: off/low/medium/high */
|
||||||
multiplex?: string;
|
multiplex?: string;
|
||||||
/** padding scheme */
|
/** padding scheme */
|
||||||
@@ -578,6 +575,32 @@ declare namespace API {
|
|||||||
up_mbps?: number;
|
up_mbps?: number;
|
||||||
/** download speed limit */
|
/** download speed limit */
|
||||||
down_mbps?: number;
|
down_mbps?: number;
|
||||||
|
/** obfs, 'none', 'http', 'tls' */
|
||||||
|
obfs?: string;
|
||||||
|
/** obfs host */
|
||||||
|
obfs_host?: string;
|
||||||
|
/** obfs path */
|
||||||
|
obfs_path?: string;
|
||||||
|
/** xhttp mode */
|
||||||
|
xhttp_mode?: string;
|
||||||
|
/** xhttp extra path */
|
||||||
|
xhttp_extra?: string;
|
||||||
|
/** encryption,'none', 'mlkem768x25519plus' */
|
||||||
|
encryption?: string;
|
||||||
|
/** encryption mode,'native', 'xorpub', 'random' */
|
||||||
|
encryption_mode?: string;
|
||||||
|
/** encryption rtt,'0rtt', '1rtt' */
|
||||||
|
encryption_rtt?: string;
|
||||||
|
/** encryption ticket */
|
||||||
|
encryption_ticket?: string;
|
||||||
|
/** encryption server padding */
|
||||||
|
encryption_server_padding?: string;
|
||||||
|
/** encryption private key */
|
||||||
|
encryption_private_key?: string;
|
||||||
|
/** encryption client padding */
|
||||||
|
encryption_client_padding?: string;
|
||||||
|
/** encryption password */
|
||||||
|
encryption_password?: string;
|
||||||
};
|
};
|
||||||
|
|
||||||
type PubilcRegisterConfig = {
|
type PubilcRegisterConfig = {
|
||||||
|
|||||||
+1
-1
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "ppanel-web",
|
"name": "ppanel-web",
|
||||||
"version": "1.4.3",
|
"version": "1.4.4",
|
||||||
"private": true,
|
"private": true,
|
||||||
"homepage": "https://github.com/perfect-panel/ppanel-web",
|
"homepage": "https://github.com/perfect-panel/ppanel-web",
|
||||||
"bugs": {
|
"bugs": {
|
||||||
|
|||||||
Reference in New Issue
Block a user