refactor: ♻️ Move config checker code into its own file

This commit is contained in:
Jesse Wierzbinski 2024-06-25 16:30:51 -10:00
parent 8a774fa05d
commit 0ecb65de29
No known key found for this signature in database
2 changed files with 27 additions and 0 deletions

View file

@ -83,6 +83,15 @@ banned_user_agents = [
# "wget\/1.20.3",
]
[http.proxy]
# For SOCKS proxies (e.g. Tor)
# Will be used for all outgoing requests
enabled = false
host = "127.0.0.1"
port = 9050
# Can be socks4, socks4a or socks5
type = "socks5"
[http.tls]
# If these values are set, Lysand will use these files for TLS
enabled = false

View file

@ -120,6 +120,24 @@ export const configValidator = z.object({
// Not using .ip() because we allow CIDR ranges and wildcards and such
banned_ips: z.array(z.string()).default([]),
banned_user_agents: z.array(z.string()).default([]),
proxy: z
.object({
enabled: z.boolean().default(false),
host: z.string().min(1).default("localhost"),
port: z
.number()
.int()
.min(1)
.max(2 ** 16 - 1)
.default(9050),
type: z.enum(["socks4", "socks4a", "socks5"]).default("socks5"),
})
.default({
enabled: false,
host: "localhost",
port: 9050,
type: "socks5",
}),
tls: z
.object({
enabled: z.boolean().default(false),