package vpn type Manager struct { PPPoE *PPPoEManager WireGuard *WireGuardManager PPTP *PPTPManager L2TP *L2TPManager IPSec *IPSecManager EoIP *EoIPManager PPPServer *PPPServerManager } func NewManager() *Manager { return &Manager{ PPPoE: NewPPPoEManager(), WireGuard: NewWireGuardManager(), PPTP: NewPPTPManager(), L2TP: NewL2TPManager(), IPSec: NewIPSecManager(), EoIP: NewEoIPManager(), PPPServer: NewPPPServerManager(), } } // GetOverallStatus returns a summary of all active instances across all protocols. func (m *Manager) GetOverallStatus() OverallVPNStatus { pppoeList := m.PPPoE.List() wgIfaces := m.WireGuard.ListInterfaces() wgPeers := m.WireGuard.ListPeers("") pptpList := m.PPTP.List() l2tpList := m.L2TP.List() ipsecList := m.IPSec.List() eoipList := m.EoIP.List() activePPPoE := 0 for _, p := range pppoeList { if p.Running { activePPPoE++ } } activeWG := 0 for _, w := range wgIfaces { if w.Running { activeWG++ } } activePPTP := 0 for _, p := range pptpList { if p.Running { activePPTP++ } } activeL2TP := 0 for _, l := range l2tpList { if l.Running { activeL2TP++ } } activeIPSec := 0 for _, i := range ipsecList { if i.Running { activeIPSec++ } } activeEoIP := 0 for _, e := range eoipList { if e.Running { activeEoIP++ } } pppoeSrv := m.PPPServer.GetPPPoEServer() pptpSrv := m.PPPServer.GetPPTPServer() l2tpSrv := m.PPPServer.GetL2TPServer() ipsecSrv := m.PPPServer.GetIPSecServer() pppSessions := len(m.PPPServer.ListActiveSessions()) totalActive := activePPPoE + activeWG + activePPTP + activeL2TP + activeIPSec + activeEoIP + pppSessions return OverallVPNStatus{ TotalPPPoE: len(pppoeList), ActivePPPoE: activePPPoE, TotalWireGuard: len(wgIfaces), ActiveWireGuard: activeWG, TotalWireGuardPeers: len(wgPeers), TotalPPTP: len(pptpList), ActivePPTP: activePPTP, TotalL2TP: len(l2tpList), ActiveL2TP: activeL2TP, TotalIPSec: len(ipsecList), ActiveIPSec: activeIPSec, TotalEoIP: len(eoipList), ActiveEoIP: activeEoIP, TotalPPPSessions: pppSessions, PPPoEServerRunning: pppoeSrv.Running, PPTPServerRunning: pptpSrv.Running, L2TPServerRunning: l2tpSrv.Running, IPSecServerRunning: ipsecSrv.Running, TotalActiveTunnels: totalActive, } }