# SIMCAT OpenWrt Unified Gateway UCI configuration (/etc/config/simcat-gateway).
# Copy to /etc/config/simcat-gateway (chmod 0600) and provision a >=32-char
# owner secret before changing enabled to '1'. Never store real secrets in git.

config simcat_gateway 'main'
	# Master enable switch. Keep '0' until owner credential is provisioned.
	option enabled '0'

	# Listen address and port. Use loopback ('127.0.0.1:17812') behind a TLS
	# reverse proxy, or bind a trusted LAN IP ('192.168.1.1:17812') for same-WiFi
	# direct access from SIMCAT clients. Never expose plain HTTP to WAN.
	option listen '127.0.0.1:17812'

	# Authentication secret source: 'file' (recommended) or 'uci'.
	option secret_source 'file'
	option token_file '/etc/simcat/owner-token'
	option secret ''

	# Optional PC/SC reader allowlist (exact reader IDs).
	option strict_allowlist '0'
	# list allow_reader 'Alcor Micro AU9540 00 00'

	# Remote write capabilities MUST remain disabled ('0') by default.
	# Even when enabled ('1'), every write action enforces explicit confirm=true.
	option allow_manage '0'
	option allow_download '0'

	# ---- Embedded multi-CPE aggregation, forwarding, quota & eSIM bridge ----
	# Set cpegw_enabled '1' to run the zero-hop in-process cpegw engine.
	option cpegw_enabled '0'
	option cpegw_config '/etc/simcat/cpegw.json'
	# Set '1' only after verifying /etc/simcat/forward.json links & ingress NICs.
	option cpegw_forward_auto '0'
	# Optional external cpegw proxy URL fallback when cpegw_enabled is '0'.
	option cpegw_addr ''
	option allow_public_health '0'

	# ---- Anti-Encrypted-Proxy / VLESS VPN Guard (isolated inet cpegw_proxyguard) ----
	# Modes: 'off' (default), 'audit' (detect & log), 'enforce' (active nft block + conntrack kill),
	# 'strict' (enforce + block QUIC/UDP-443 + DoH/DoT bypass + stricter Reality/entropy heuristics).
	option proxy_guard_mode 'off'
	option proxy_guard_config '/etc/simcat/proxyguard.json'
	# Drop-in *.json rule bundles hot-reloaded on SIGHUP or POST /v2/proxy-guard/rules/reload.
	option proxy_guard_rules_dir '/etc/simcat/proxyguard.d'

	# ---- eeuicc Passport Multi-Client Linkage (LAN Beacon + Remote Relay) ----
	option gateway_name 'SIMCAT OpenWrt'
	# Leave empty to auto-derive a stable gw-<hash> ID from host/machine-id.
	option gateway_id ''
	# Bind to your eeuicc Passport ID (EPASS-...) so your signed-in SIMCAT apps
	# on Windows/macOS/iOS/Android/Linux automatically discover & control this router.
	option passport_subject ''
	# File storing the UIA-issued gateway relay token (generated via:
	#   simcat-gateway -bind-passport-token-file /tmp/uia.tok -gateway-token-file /etc/simcat/gateway-token)
	option gateway_token_file '/etc/simcat/gateway-token'
	# Enable outbound HTTPS long-poll relay over uia.eeuicc.com (works behind CGNAT).
	option passport_relay '0'
	# Enable privacy-preserving signed LAN UDP discovery beacons (UDP :17815).
	option passport_beacon '0'
	# Optional user-managed HTTPS reverse proxy URL for direct remote access.
	option remote_url ''

	# Memory budget tuning for embedded OpenWrt routers (soft Go heap cap).
	option gomemlimit '64MiB'
	option gogc '50'

	# Leave empty to run as root (required for nftables/tc forwarding & pcscd).
	option user ''
