feat: HA-Cluster v1.2.x — Split-Brain, TOTP, Enterprise-FW, Drift-Fix, VIP-Recovery
- keepalived: pg_role='standby' hat Vorrang vor role für BACKUP-Bestimmung - keepalived-master.sh: gecrasht Dienste beim MASTER-Übergang starten (nicht nur reload) - confighash: ip_addresses per Interface-Name hashen statt per FK (Cross-Node-Drift-Fix) - TOTP/2FA: RFC 6238 — Setup-Flow, QR-Code, Admin-Disable; two-step Login - Firewall-UI: Enterprise-Design — auto-Beschreibung, icon-only Actions, zero-hit Indikator - fe80-Filter: Link-local IPv6 aus NTP/DNS Listen-Dropdowns entfernen - VIP-Dashboard, Dual-Path VRRP, GW-Tracking (Migrations 0033/0034) - Forward Proxy + DNS erweiterte Einstellungen (Migrations 0031/0032) - unbound-control: edgeguard in unbound-Gruppe via postinst Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
// Package forwardproxy provides CRUD against the forward_proxy_acls
|
||||
// table. Renderer in internal/squid consumes the same rows to emit
|
||||
// /etc/edgeguard/squid/squid.conf.
|
||||
// table and settings in forward_proxy_settings. Renderer in internal/squid
|
||||
// consumes both tables to emit /etc/edgeguard/squid/squid.conf.
|
||||
package forwardproxy
|
||||
|
||||
import (
|
||||
@@ -97,6 +97,52 @@ func (r *Repo) Delete(ctx context.Context, id int64) error {
|
||||
return nil
|
||||
}
|
||||
|
||||
// Settings returns the singleton forward_proxy_settings row.
|
||||
func (r *Repo) GetSettings(ctx context.Context) (*models.ForwardProxySettings, error) {
|
||||
var s models.ForwardProxySettings
|
||||
if err := r.Pool.QueryRow(ctx, `
|
||||
SELECT id, listen_addresses, listen_port,
|
||||
cache_mem_mb, cache_dir_mb, max_obj_size_mb,
|
||||
connect_timeout, read_timeout, request_timeout,
|
||||
created_at, updated_at
|
||||
FROM forward_proxy_settings WHERE id=1`).Scan(
|
||||
&s.ID, &s.ListenAddresses, &s.ListenPort,
|
||||
&s.CacheMemMB, &s.CacheDirMB, &s.MaxObjSizeMB,
|
||||
&s.ConnectTimeout, &s.ReadTimeout, &s.RequestTimeout,
|
||||
&s.CreatedAt, &s.UpdatedAt,
|
||||
); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return &s, nil
|
||||
}
|
||||
|
||||
func (r *Repo) UpdateSettings(ctx context.Context, s models.ForwardProxySettings) (*models.ForwardProxySettings, error) {
|
||||
var out models.ForwardProxySettings
|
||||
if err := r.Pool.QueryRow(ctx, `
|
||||
UPDATE forward_proxy_settings SET
|
||||
listen_addresses=$1, listen_port=$2,
|
||||
cache_mem_mb=$3, cache_dir_mb=$4, max_obj_size_mb=$5,
|
||||
connect_timeout=$6, read_timeout=$7, request_timeout=$8,
|
||||
updated_at=NOW()
|
||||
WHERE id=1
|
||||
RETURNING id, listen_addresses, listen_port,
|
||||
cache_mem_mb, cache_dir_mb, max_obj_size_mb,
|
||||
connect_timeout, read_timeout, request_timeout,
|
||||
created_at, updated_at`,
|
||||
s.ListenAddresses, s.ListenPort,
|
||||
s.CacheMemMB, s.CacheDirMB, s.MaxObjSizeMB,
|
||||
s.ConnectTimeout, s.ReadTimeout, s.RequestTimeout,
|
||||
).Scan(
|
||||
&out.ID, &out.ListenAddresses, &out.ListenPort,
|
||||
&out.CacheMemMB, &out.CacheDirMB, &out.MaxObjSizeMB,
|
||||
&out.ConnectTimeout, &out.ReadTimeout, &out.RequestTimeout,
|
||||
&out.CreatedAt, &out.UpdatedAt,
|
||||
); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return &out, nil
|
||||
}
|
||||
|
||||
func scan(row interface{ Scan(...any) error }) (*models.ForwardProxyACL, error) {
|
||||
var a models.ForwardProxyACL
|
||||
if err := row.Scan(
|
||||
|
||||
Reference in New Issue
Block a user