fix(wireguard): исправить endpoint и поля клиентского шаблона

This commit is contained in:
Denozordec committed 2026-10-08 23:21:45 +07:00
1 parent 206255b856
commit c82e8fa12b
13 files changed
+128 -29

No files matched your search

+5 -2
View File
@@ -291,13 +291,16 @@ export function generatePeerClientConf(args: {
? `PrivateKey = ${args.peerPrivateKey}`
: `# PrivateKey = <ключ клиента>`,
)
if (args.peerAddress) lines.push(`Address = ${args.peerAddress}`)
if (args.peerAddress?.trim()) lines.push(`Address = ${args.peerAddress.trim()}`)
else lines.push(`# Address = <укажите адрес клиента>`)
if (args.peerDns) lines.push(`DNS = ${args.peerDns}`)
lines.push(``)
lines.push(`[Peer]`)
lines.push(`PublicKey = ${args.serverPublicKey}`)
lines.push(`AllowedIPs = ${(args.allowedIps?.length ? args.allowedIps : ["0.0.0.0/0"]).join(", ")}`)
if (args.allowedIps?.length) lines.push(`AllowedIPs = ${args.allowedIps.join(", ")}`)
else lines.push(`# AllowedIPs = <укажите сети через туннель>`)
if (args.endpoint) lines.push(`Endpoint = ${args.endpoint}`)
else lines.push(`# Endpoint = <укажите адрес сервера и порт>`)
if (args.persistentKeepalive != null && args.persistentKeepalive > 0) {
lines.push(`PersistentKeepalive = ${args.persistentKeepalive}`)
}