mirror of
https://github.com/MHSanaei/3x-ui.git
synced 2026-07-14 00:26:06 +00:00
db5ce06256
Custom geosite/geoip downloads built their own ssrfSafeTransport and never used the configured Panel Network Proxy, so geo updates failed on servers where GitHub is filtered. Route all custom-geo HTTP (startup probes + downloads) through panelProxy when set, falling back to the direct SSRF-guarded transport otherwise; the target URL stays SSRF-validated. The Telegram bot only honored a socks5:// panel proxy and silently rejected http(s)://, despite the setting advertising both. Branch the fasthttp dialer (FasthttpHTTPDialer for http(s), FasthttpSocksDialer for socks5) and accept all three schemes in the fallback and NewBot validation. Add tests proving the panel proxy is used by custom geo and that the bot dialer speaks HTTP CONNECT vs SOCKS5 per scheme.
37 lines
1.5 KiB
TypeScript
37 lines
1.5 KiB
TypeScript
import { z } from 'zod';
|
|
|
|
import { SSMethodSchema } from '../shared/shadowsocks';
|
|
|
|
export const SSNetworkSchema = z.enum(['tcp', 'udp', 'tcp,udp']);
|
|
export type SSNetwork = z.infer<typeof SSNetworkSchema>;
|
|
|
|
// On a single-user shadowsocks inbound the client carries no method/password
|
|
// of its own — the inbound-level method+password are authoritative. On a
|
|
// 2022-blake3 multi-user setup each client provides its own password (and
|
|
// optionally a per-client method).
|
|
export const ShadowsocksClientSchema = z.object({
|
|
method: z.string().default(''),
|
|
password: z.string().default(''),
|
|
email: z.string().min(1),
|
|
limitIp: z.number().int().min(0).default(0),
|
|
totalGB: z.number().int().min(0).default(0),
|
|
expiryTime: z.number().int().default(0),
|
|
enable: z.boolean().default(true),
|
|
tgId: z.number().int().default(0),
|
|
subId: z.string().default(''),
|
|
comment: z.string().default(''),
|
|
reset: z.number().int().min(0).default(0),
|
|
created_at: z.number().int().optional(),
|
|
updated_at: z.number().int().optional(),
|
|
});
|
|
export type ShadowsocksClient = z.infer<typeof ShadowsocksClientSchema>;
|
|
|
|
export const ShadowsocksInboundSettingsSchema = z.object({
|
|
method: SSMethodSchema.default('2022-blake3-aes-256-gcm'),
|
|
password: z.string().default(''),
|
|
network: SSNetworkSchema.default('tcp,udp'),
|
|
clients: z.array(ShadowsocksClientSchema).default([]),
|
|
ivCheck: z.boolean().default(false),
|
|
});
|
|
export type ShadowsocksInboundSettings = z.infer<typeof ShadowsocksInboundSettingsSchema>;
|