// /** // * File: HotspotManager.cs // * Author: haraldwolff // * // * This file and it's content is copyrighted by the Author and / or copyright holder. // * Any use wihtout proper permission is illegal and may lead to legal actions. // * // * // **/ using System; using ln.types.odb; using ln.types.odb.mapped; using ln.types.btree; using ln.types.net; using System.Collections.Generic; using System.IO; using skyspot.radius; using System.Linq; namespace skyspot.hotspot { public class HotspotManager { public string BasePath { get; private set; } = "/var/cache/ln.skyspot"; public RadiusSecretsStore SecretsStore { get; private set; } ODB odb; public ODBCollection hotspotNetworks { get; private set; } public ODBCollection radiusSecretsCollection; Dictionary instances = new Dictionary(); public HotspotManager() { odb = new ODB(BasePath); hotspotNetworks = odb.GetCollection(); radiusSecretsCollection = odb.GetCollection(); SecretsStore = radiusSecretsCollection.FirstOrDefault(); if (SecretsStore == null) SecretsStore = new RadiusSecretsStore(); } public void SaveSecretsStore() => radiusSecretsCollection.Upsert(SecretsStore); class HotspotRuntime { public BTree currentSessions { get; } = new BTree(); } } }