Initial commit: DashCaddy v1.0

Full codebase including API server (32 modules + routes), dashboard frontend,
DashCA certificate distribution, installer script, and deployment skills.
This commit is contained in:
2026-03-05 02:26:12 -08:00
commit f61e85d9a7
337 changed files with 75282 additions and 0 deletions

View File

@@ -0,0 +1,61 @@
// Cache Configuration Module
// Provides LRU cache configurations to prevent memory leaks
const { LRUCache } = require('lru-cache');
/**
* Cache configuration presets for different data types
* All TTL values are in milliseconds
*/
const CACHE_CONFIGS = {
// App session cookies (login tokens for SSO)
appSessions: {
max: 500, // Max 500 different services
ttl: 60 * 60 * 1000, // 1 hour TTL
updateAgeOnGet: true, // Refresh TTL on access
ttlAutopurge: true // Auto-cleanup expired entries
},
// IP-based router sessions (Frontier NVG468MQ)
ipSessions: {
max: 1000, // Support up to 1000 IP addresses
ttl: 24 * 60 * 60 * 1000, // 24 hour TTL
updateAgeOnGet: true,
ttlAutopurge: true
},
// DNS server authentication tokens (Technitium)
dnsTokens: {
max: 50, // Max 50 DNS servers
ttl: 6 * 60 * 60 * 1000, // 6 hour TTL (matches SESSION_TTL.DNS_TOKEN)
updateAgeOnGet: false, // Don't refresh - tokens have fixed expiry
ttlAutopurge: true
},
// Tailscale network status
tailscaleStatus: {
max: 1, // Only one status object
ttl: 60 * 1000, // 1 minute TTL
updateAgeOnGet: false,
ttlAutopurge: true
},
// Tailscale API responses (devices, ACLs)
tailscaleAPI: {
max: 5, // devices + ACL + misc
ttl: 5 * 60 * 1000, // 5 min (matches sync interval)
updateAgeOnGet: false,
ttlAutopurge: true
}
};
/**
* Factory function to create a configured LRU cache
* @param {Object} config - Cache configuration from CACHE_CONFIGS
* @returns {LRUCache} Configured LRU cache instance
*/
function createCache(config) {
return new LRUCache(config);
}
module.exports = { CACHE_CONFIGS, createCache };