index.html 139 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743174417451746174717481749175017511752175317541755175617571758175917601761176217631764176517661767176817691770177117721773177417751776177717781779178017811782178317841785178617871788178917901791179217931794179517961797179817991800180118021803180418051806180718081809181018111812181318141815181618171818181918201821182218231824182518261827182818291830183118321833183418351836183718381839184018411842184318441845184618471848184918501851185218531854185518561857185818591860186118621863186418651866186718681869187018711872187318741875187618771878187918801881188218831884188518861887188818891890189118921893189418951896189718981899190019011902190319041905190619071908190919101911191219131914191519161917191819191920192119221923192419251926192719281929193019311932193319341935193619371938193919401941194219431944194519461947194819491950195119521953195419551956195719581959196019611962196319641965196619671968196919701971197219731974197519761977197819791980198119821983198419851986198719881989199019911992199319941995199619971998199920002001200220032004200520062007200820092010201120122013201420152016201720182019202020212022202320242025202620272028202920302031203220332034203520362037203820392040204120422043204420452046204720482049205020512052205320542055205620572058205920602061206220632064206520662067206820692070207120722073207420752076207720782079208020812082208320842085208620872088208920902091209220932094209520962097209820992100210121022103210421052106210721082109211021112112211321142115211621172118211921202121212221232124212521262127212821292130213121322133213421352136213721382139214021412142214321442145214621472148214921502151215221532154215521562157215821592160216121622163216421652166216721682169217021712172217321742175217621772178217921802181218221832184218521862187218821892190219121922193
  1. <!DOCTYPE html>
  2. <html lang="el" class="dark">
  3. <head>
  4. <meta charset="UTF-8">
  5. <meta name="viewport" content="width=device-width, initial-scale=1.0">
  6. <title>Proxmox RouterOS | Network Appliance</title>
  7. <link rel="icon" href="data:image/svg+xml,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='%2310b981'><path d='M12 2L2 7l10 5 10-5-10-5zM2 17l10 5 10-5M2 12l10 5 10-5'/></svg>">
  8. <script src="https://cdn.tailwindcss.com"></script>
  9. <script>
  10. tailwind.config = {
  11. darkMode: 'class',
  12. theme: {
  13. extend: {
  14. colors: {
  15. brand: {
  16. 50: '#ecfdf5',
  17. 100: '#d1fae5',
  18. 400: '#34d399',
  19. 500: '#10b981',
  20. 600: '#059669',
  21. 700: '#047857',
  22. 800: '#065f46',
  23. 900: '#064e3b',
  24. }
  25. }
  26. }
  27. }
  28. }
  29. </script>
  30. <link rel="stylesheet" href="style.css">
  31. </head>
  32. <body class="bg-[#0b101e] text-slate-100 min-h-screen flex flex-col font-sans antialiased selection:bg-brand-500 selection:text-white">
  33. <!-- Toast Notification Container -->
  34. <div id="toast-container" class="fixed top-5 right-5 z-50 flex flex-col space-y-2 pointer-events-none"></div>
  35. <!-- Main Layout -->
  36. <div class="flex flex-1 overflow-hidden h-screen">
  37. <!-- Sidebar -->
  38. <aside id="sidebar" class="w-64 bg-[#0f172a]/95 border-r border-slate-800 flex flex-col flex-shrink-0 transition-all duration-300 z-30">
  39. <!-- Brand Header -->
  40. <div class="h-16 flex items-center px-5 border-b border-slate-800 justify-between">
  41. <div class="flex items-center space-x-3">
  42. <div class="w-9 h-9 rounded-xl bg-gradient-to-tr from-brand-600 to-cyan-500 flex items-center justify-center shadow-lg shadow-brand-500/20 text-white font-bold">
  43. <svg class="w-5 h-5" fill="none" stroke="currentColor" viewBox="0 0 24 24">
  44. <path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M13 10V3L4 14h7v7l9-11h-7z" />
  45. </svg>
  46. </div>
  47. <div>
  48. <div class="font-bold text-sm tracking-wide text-white flex items-center gap-1.5">
  49. <span>RouterOS</span>
  50. <span class="text-[10px] bg-brand-500/20 text-brand-400 font-mono px-1.5 py-0.5 rounded border border-brand-500/30">LXC</span>
  51. </div>
  52. <div class="text-[11px] text-slate-400">Proxmox Gateway</div>
  53. </div>
  54. </div>
  55. </div>
  56. <!-- Live Health Pill -->
  57. <div class="px-4 py-3 border-b border-slate-800/60 bg-slate-900/40">
  58. <div class="flex items-center justify-between text-xs mb-1.5">
  59. <span class="text-slate-400 font-medium">Gateway Status</span>
  60. <span class="flex items-center text-emerald-400 font-medium text-[11px]">
  61. <span class="relative flex h-2 w-2 mr-1.5">
  62. <span class="animate-ping absolute inline-flex h-full w-full rounded-full bg-emerald-400 opacity-75"></span>
  63. <span class="relative inline-flex rounded-full h-2 w-2 bg-emerald-500"></span>
  64. </span>
  65. Online
  66. </span>
  67. </div>
  68. <div class="text-[11px] text-slate-400 font-mono truncate" id="side-gateway-ip">GW: Scanning...</div>
  69. </div>
  70. <!-- Navigation Menu -->
  71. <nav class="flex-1 px-3 py-3 space-y-1 overflow-y-auto">
  72. <!-- CATEGORY: OVERVIEW -->
  73. <div class="px-3 pt-2 pb-1 text-[10px] font-bold text-slate-500 uppercase tracking-wider">Overview</div>
  74. <a href="#dashboard" onclick="navigate('dashboard')" id="nav-dashboard"
  75. class="nav-link flex items-center justify-between px-3 py-2 rounded-lg text-xs font-medium transition-all group bg-brand-500/10 text-brand-400 border border-brand-500/20">
  76. <div class="flex items-center space-x-2.5">
  77. <svg class="w-4 h-4" fill="none" stroke="currentColor" viewBox="0 0 24 24">
  78. <path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M4 6a2 2 0 012-2h2a2 2 0 012 2v2a2 2 0 01-2 2H6a2 2 0 01-2-2V6zM14 6a2 2 0 012-2h2a2 2 0 012 2v2a2 2 0 01-2 2h-2a2 2 0 01-2-2V6zM4 16a2 2 0 012-2h2a2 2 0 012 2v2a2 2 0 01-2 2H6a2 2 0 01-2-2v-2zM14 16a2 2 0 012-2h2a2 2 0 012 2v2a2 2 0 01-2 2h-2a2 2 0 01-2-2v-2z" />
  79. </svg>
  80. <span>Dashboard</span>
  81. </div>
  82. </a>
  83. <!-- CATEGORY: NETWORKING -->
  84. <div class="px-3 pt-3 pb-1 text-[10px] font-bold text-slate-500 uppercase tracking-wider">Networking</div>
  85. <a href="#interfaces" onclick="navigate('interfaces')" id="nav-interfaces"
  86. class="nav-link flex items-center justify-between px-3 py-2 rounded-lg text-xs font-medium transition-all group text-slate-300 hover:bg-slate-800/80 hover:text-white">
  87. <div class="flex items-center space-x-2.5">
  88. <svg class="w-4 h-4" fill="none" stroke="currentColor" viewBox="0 0 24 24">
  89. <path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M8 9l3 3-3 3m5 0h3M5 20h14a2 2 0 002-2V6a2 2 0 00-2-2H5a2 2 0 00-2 2v12a2 2 0 002 2z" />
  90. </svg>
  91. <span>Interfaces</span>
  92. </div>
  93. <span id="badge-ifaces-count" class="text-[10px] bg-slate-800 text-slate-300 px-1.5 py-0.2 rounded-full font-mono">0</span>
  94. </a>
  95. <a href="#vlans" onclick="navigate('vlans')" id="nav-vlans"
  96. class="nav-link flex items-center justify-between px-3 py-2 rounded-lg text-xs font-medium transition-all group text-slate-300 hover:bg-slate-800/80 hover:text-white">
  97. <div class="flex items-center space-x-2.5">
  98. <svg class="w-4 h-4" fill="none" stroke="currentColor" viewBox="0 0 24 24">
  99. <path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M7 7h.01M7 3h5c.512 0 1.024.195 1.414.586l7 7a2 2 0 010 2.828l-7 7a2 2 0 01-2.828 0l-7-7A1.994 1.994 0 013 12V7a4 4 0 014-4z" />
  100. </svg>
  101. <span>VLANs (802.1Q)</span>
  102. </div>
  103. <span id="badge-vlans-count" class="text-[10px] bg-cyan-950 text-cyan-400 border border-cyan-800/50 px-1.5 py-0.2 rounded-full font-mono">0</span>
  104. </a>
  105. <a href="#firewall" onclick="navigate('firewall')" id="nav-firewall"
  106. class="nav-link flex items-center justify-between px-3 py-2 rounded-lg text-xs font-medium transition-all group text-slate-300 hover:bg-slate-800/80 hover:text-white">
  107. <div class="flex items-center space-x-2.5">
  108. <svg class="w-4 h-4 text-emerald-400" fill="none" stroke="currentColor" viewBox="0 0 24 24">
  109. <path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M9 12l2 2 4-4m5.618-4.016A11.955 11.955 0 0112 2.944a11.955 11.955 0 01-8.618 3.04A12.02 12.02 0 003 9c0 5.591 3.824 10.29 9 11.622 5.176-1.332 9-6.03 9-11.622 0-1.042-.133-2.052-.382-3.016z" />
  110. </svg>
  111. <span>Firewall</span>
  112. </div>
  113. <span id="badge-firewall-count" class="text-[10px] bg-emerald-950 text-emerald-400 border border-emerald-800/50 px-1.5 py-0.2 rounded-full font-mono">0</span>
  114. </a>
  115. <a href="#routes" onclick="navigate('routes')" id="nav-routes"
  116. class="nav-link flex items-center justify-between px-3 py-2 rounded-lg text-xs font-medium transition-all group text-slate-300 hover:bg-slate-800/80 hover:text-white">
  117. <div class="flex items-center space-x-2.5">
  118. <svg class="w-4 h-4 text-cyan-400" fill="none" stroke="currentColor" viewBox="0 0 24 24">
  119. <path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M9 20l-5.447-2.724A1 1 0 013 16.382V5.618a1 1 0 011.447-.894L9 7m0 13l6-3m-6 3V7m6 10l4.553 2.276A1 1 0 0021 18.382V7.618a1 1 0 00-.553-.894L15 4m0 13V4m0 0L9 7" />
  120. </svg>
  121. <span>Routes & Policy</span>
  122. </div>
  123. <span id="badge-routes-count" class="text-[10px] bg-slate-800 text-slate-300 px-1.5 py-0.2 rounded-full font-mono">0</span>
  124. </a>
  125. <!-- CATEGORY: WAN & ACCESS -->
  126. <div class="px-3 pt-3 pb-1 text-[10px] font-bold text-slate-500 uppercase tracking-wider">WAN & Access</div>
  127. <a href="#pppoe" onclick="navigate('pppoe')" id="nav-pppoe"
  128. class="nav-link flex items-center justify-between px-3 py-2 rounded-lg text-xs font-medium transition-all group text-slate-300 hover:bg-slate-800/80 hover:text-white">
  129. <div class="flex items-center space-x-2.5">
  130. <svg class="w-4 h-4" fill="none" stroke="currentColor" viewBox="0 0 24 24">
  131. <path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M13 10V3L4 14h7v7l9-11h-7z" />
  132. </svg>
  133. <span>PPPoE Client</span>
  134. </div>
  135. <span id="badge-pppoe-status" class="w-2 h-2 rounded-full bg-slate-600"></span>
  136. </a>
  137. <!-- CATEGORY: VPN & TUNNELS -->
  138. <div class="px-3 pt-3 pb-1 text-[10px] font-bold text-slate-500 uppercase tracking-wider">VPN & Tunnels</div>
  139. <a href="#wireguard" onclick="navigate('wireguard')" id="nav-wireguard"
  140. class="nav-link flex items-center justify-between px-3 py-2 rounded-lg text-xs font-medium transition-all group text-slate-300 hover:bg-slate-800/80 hover:text-white">
  141. <div class="flex items-center space-x-2.5">
  142. <svg class="w-4 h-4 text-rose-400" fill="none" stroke="currentColor" viewBox="0 0 24 24">
  143. <path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M9 12l2 2 4-4m5.618-4.016A11.955 11.955 0 0112 2.944a11.955 11.955 0 01-8.618 3.04A12.02 12.02 0 003 9c0 5.591 3.824 10.29 9 11.622 5.176-1.332 9-6.03 9-11.622 0-1.042-.133-2.052-.382-3.016z" />
  144. </svg>
  145. <span>WireGuard</span>
  146. </div>
  147. <span id="badge-wg-status" class="w-2 h-2 rounded-full bg-slate-600"></span>
  148. </a>
  149. <a href="#ipsec" onclick="navigate('ipsec')" id="nav-ipsec"
  150. class="nav-link flex items-center justify-between px-3 py-2 rounded-lg text-xs font-medium transition-all group text-slate-300 hover:bg-slate-800/80 hover:text-white">
  151. <div class="flex items-center space-x-2.5">
  152. <svg class="w-4 h-4 text-amber-400" fill="none" stroke="currentColor" viewBox="0 0 24 24">
  153. <path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M12 15v2m-6 4h12a2 2 0 002-2v-6a2 2 0 00-2-2H6a2 2 0 00-2 2v6a2 2 0 002 2zm10-10V7a4 4 0 00-8 0v4h8z" />
  154. </svg>
  155. <span>IPSec (IKEv2)</span>
  156. </div>
  157. <span id="badge-ipsec-status" class="w-2 h-2 rounded-full bg-slate-600"></span>
  158. </a>
  159. <a href="#l2tp" onclick="navigate('l2tp')" id="nav-l2tp"
  160. class="nav-link flex items-center justify-between px-3 py-2 rounded-lg text-xs font-medium transition-all group text-slate-300 hover:bg-slate-800/80 hover:text-white">
  161. <div class="flex items-center space-x-2.5">
  162. <svg class="w-4 h-4 text-cyan-400" fill="none" stroke="currentColor" viewBox="0 0 24 24">
  163. <path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M21 12a9 9 0 01-9 9m9-9a9 9 0 00-9-9m9 9H3m9 9a9 9 0 01-9-9m9 9c1.657 0 3-4.03 3-9s-1.343-9-3-9m0 18c-1.657 0-3-4.03-3-9s1.343-9 3-9m-9 9a9 9 0 019-9" />
  164. </svg>
  165. <span>L2TP Client</span>
  166. </div>
  167. <span id="badge-l2tp-status" class="w-2 h-2 rounded-full bg-slate-600"></span>
  168. </a>
  169. <a href="#pptp" onclick="navigate('pptp')" id="nav-pptp"
  170. class="nav-link flex items-center justify-between px-3 py-2 rounded-lg text-xs font-medium transition-all group text-slate-300 hover:bg-slate-800/80 hover:text-white">
  171. <div class="flex items-center space-x-2.5">
  172. <svg class="w-4 h-4 text-purple-400" fill="none" stroke="currentColor" viewBox="0 0 24 24">
  173. <path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M15 7a2 2 0 012 2m4 0a6 6 0 01-7.743 5.743L11 17H9v2H7v2H4a1 1 0 01-1-1v-2.586a1 1 0 01.293-.707l5.964-5.964A6 6 0 1121 9z" />
  174. </svg>
  175. <span>PPTP Client</span>
  176. </div>
  177. <span id="badge-pptp-status" class="w-2 h-2 rounded-full bg-slate-600"></span>
  178. </a>
  179. <!-- CATEGORY: SYSTEM -->
  180. <div class="px-3 pt-3 pb-1 text-[10px] font-bold text-slate-500 uppercase tracking-wider">System</div>
  181. <a href="#persistence" onclick="navigate('persistence')" id="nav-persistence"
  182. class="nav-link flex items-center justify-between px-3 py-2 rounded-lg text-xs font-medium transition-all group text-slate-300 hover:bg-slate-800/80 hover:text-white">
  183. <div class="flex items-center space-x-2.5">
  184. <svg class="w-4 h-4" fill="none" stroke="currentColor" viewBox="0 0 24 24">
  185. <path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M8 7H5a2 2 0 00-2 2v9a2 2 0 002 2h14a2 2 0 002-2V9a2 2 0 00-2-2h-3m-1 4l-3 3m0 0l-3-3m3 3V4" />
  186. </svg>
  187. <span>Debian Config</span>
  188. </div>
  189. <span class="text-[10px] bg-slate-800 text-slate-400 px-1.5 py-0.2 rounded">.cfg</span>
  190. </a>
  191. </nav>
  192. <!-- Sidebar Footer: Host System Metrics -->
  193. <div class="p-4 border-t border-slate-800/80 bg-slate-900/60">
  194. <div class="flex items-center justify-between text-xs text-slate-400 mb-2">
  195. <span class="truncate font-mono" id="side-hostname">debian-lxc</span>
  196. <span class="text-[11px] text-slate-500" id="side-uptime">0h 0m</span>
  197. </div>
  198. <div class="mb-2">
  199. <div class="flex justify-between text-[11px] text-slate-400 mb-1">
  200. <span>CPU Load</span>
  201. <span id="side-cpu-val" class="font-mono text-slate-300">0.00</span>
  202. </div>
  203. <div class="w-full bg-slate-800 h-1.5 rounded-full overflow-hidden">
  204. <div id="side-cpu-bar" class="bg-brand-500 h-full rounded-full transition-all duration-500" style="width: 15%"></div>
  205. </div>
  206. </div>
  207. <div>
  208. <div class="flex justify-between text-[11px] text-slate-400 mb-1">
  209. <span>RAM Usage</span>
  210. <span id="side-ram-val" class="font-mono text-slate-300">0%</span>
  211. </div>
  212. <div class="w-full bg-slate-800 h-1.5 rounded-full overflow-hidden">
  213. <div id="side-ram-bar" class="bg-cyan-500 h-full rounded-full transition-all duration-500" style="width: 25%"></div>
  214. </div>
  215. </div>
  216. </div>
  217. </aside>
  218. <!-- Main Content Area -->
  219. <div class="flex-1 flex flex-col min-w-0 overflow-hidden">
  220. <!-- Top Navbar -->
  221. <header class="h-16 bg-[#0f172a]/80 backdrop-blur border-b border-slate-800 flex items-center justify-between px-6 z-20">
  222. <div class="flex items-center space-x-4">
  223. <button onclick="toggleSidebar()" class="lg:hidden p-2 rounded-lg text-slate-400 hover:text-white hover:bg-slate-800">
  224. <svg class="w-6 h-6" fill="none" stroke="currentColor" viewBox="0 0 24 24">
  225. <path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M4 6h16M4 12h16M4 18h16" />
  226. </svg>
  227. </button>
  228. <div>
  229. <h1 id="page-title" class="text-lg font-bold text-white tracking-tight">Dashboard Overview</h1>
  230. <p id="page-subtitle" class="text-xs text-slate-400">Live router performance and interface management</p>
  231. </div>
  232. </div>
  233. <div class="flex items-center space-x-3">
  234. <!-- Active Tunnels Pill -->
  235. <div class="flex items-center bg-slate-800/80 border border-slate-700/60 rounded-full px-3 py-1 text-xs text-slate-300 space-x-2">
  236. <span id="tunnels-dot" class="w-2 h-2 rounded-full bg-slate-500"></span>
  237. <span id="tunnels-label" class="font-mono text-[11px]">0 Active VPN Tunnels</span>
  238. </div>
  239. <!-- Quick Actions -->
  240. <button onclick="openVlanModal()" class="flex items-center space-x-2 bg-gradient-to-r from-brand-600 to-cyan-600 hover:from-brand-500 hover:to-cyan-500 text-white font-medium text-xs px-3.5 py-2 rounded-lg shadow-lg shadow-brand-500/20 transition-all">
  241. <svg class="w-4 h-4" fill="none" stroke="currentColor" viewBox="0 0 24 24">
  242. <path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M12 4v16m8-8H4" />
  243. </svg>
  244. <span>+ Create VLAN</span>
  245. </button>
  246. <button onclick="fetchData(true)" title="Manual Refresh" class="p-2 rounded-lg bg-slate-800 hover:bg-slate-700 text-slate-300 hover:text-white border border-slate-700 transition">
  247. <svg id="refresh-spinner" class="w-4 h-4" fill="none" stroke="currentColor" viewBox="0 0 24 24">
  248. <path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M4 4v5h.582m15.356 2A8.001 8.001 0 004.582 9m0 0H9m11 11v-5h-.581m0 0a8.003 8.003 0 01-15.357-2m15.357 2H15" />
  249. </svg>
  250. </button>
  251. </div>
  252. </header>
  253. <!-- Scrollable Main Viewport -->
  254. <main class="flex-1 overflow-y-auto p-6 space-y-6">
  255. <!-- ================= SECTION: DASHBOARD ================= -->
  256. <section id="section-dashboard" class="space-y-6">
  257. <div class="grid grid-cols-1 sm:grid-cols-2 lg:grid-cols-4 gap-4">
  258. <div class="bg-slate-900/80 border border-slate-800 rounded-xl p-5 relative overflow-hidden group hover:border-slate-700 transition">
  259. <div class="flex items-center justify-between mb-3">
  260. <span class="text-xs font-semibold text-slate-400 uppercase tracking-wider">Interfaces</span>
  261. <div class="p-2 bg-brand-500/10 text-brand-400 rounded-lg">
  262. <svg class="w-5 h-5" fill="none" stroke="currentColor" viewBox="0 0 24 24">
  263. <path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M8 9l3 3-3 3m5 0h3M5 20h14a2 2 0 002-2V6a2 2 0 00-2-2H5a2 2 0 00-2 2v12a2 2 0 002 2z" />
  264. </svg>
  265. </div>
  266. </div>
  267. <div class="flex items-baseline space-x-2">
  268. <span id="stat-ifaces-up" class="text-2xl font-bold text-white">0</span>
  269. <span class="text-xs text-slate-400">UP /</span>
  270. <span id="stat-ifaces-total" class="text-sm font-semibold text-slate-400">0 Total</span>
  271. </div>
  272. <div class="mt-2 text-xs text-slate-400 flex items-center">
  273. <span id="stat-ifaces-down" class="text-rose-400 font-medium mr-1.5">0 DOWN</span>
  274. <span class="text-slate-500">•</span>
  275. <span class="text-slate-400 ml-1.5">Plug & Play</span>
  276. </div>
  277. </div>
  278. <div class="bg-slate-900/80 border border-slate-800 rounded-xl p-5 relative overflow-hidden group hover:border-slate-700 transition">
  279. <div class="flex items-center justify-between mb-3">
  280. <span class="text-xs font-semibold text-slate-400 uppercase tracking-wider">802.1Q VLANs</span>
  281. <div class="p-2 bg-cyan-500/10 text-cyan-400 rounded-lg">
  282. <svg class="w-5 h-5" fill="none" stroke="currentColor" viewBox="0 0 24 24">
  283. <path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M7 7h.01M7 3h5c.512 0 1.024.195 1.414.586l7 7a2 2 0 010 2.828l-7 7a2 2 0 01-2.828 0l-7-7A1.994 1.994 0 013 12V7a4 4 0 014-4z" />
  284. </svg>
  285. </div>
  286. </div>
  287. <div class="flex items-baseline space-x-2">
  288. <span id="stat-vlans-count" class="text-2xl font-bold text-cyan-400">0</span>
  289. <span class="text-xs text-slate-400">Virtual Subnets</span>
  290. </div>
  291. <div class="mt-2 text-xs text-slate-400">Kernel Tagging Active</div>
  292. </div>
  293. <div class="bg-slate-900/80 border border-slate-800 rounded-xl p-5 relative overflow-hidden group hover:border-slate-700 transition">
  294. <div class="flex items-center justify-between mb-3">
  295. <span class="text-xs font-semibold text-slate-400 uppercase tracking-wider">WAN & VPN Services</span>
  296. <div class="p-2 bg-violet-500/10 text-violet-400 rounded-lg">
  297. <svg class="w-5 h-5" fill="none" stroke="currentColor" viewBox="0 0 24 24">
  298. <path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M12 15v2m-6 4h12a2 2 0 002-2v-6a2 2 0 00-2-2H6a2 2 0 00-2 2v6a2 2 0 002 2zm10-10V7a4 4 0 00-8 0v4h8z" />
  299. </svg>
  300. </div>
  301. </div>
  302. <div class="flex items-baseline space-x-2">
  303. <span id="stat-vpn-active" class="text-2xl font-bold text-violet-400">0</span>
  304. <span class="text-xs text-slate-400">Connected Tunnels</span>
  305. </div>
  306. <div class="mt-2 text-[11px] text-slate-400 flex items-center gap-1.5 font-mono">
  307. <span>WG • IPSec • PPPoE • L2TP</span>
  308. </div>
  309. </div>
  310. <div class="bg-slate-900/80 border border-slate-800 rounded-xl p-5 relative overflow-hidden group hover:border-slate-700 transition">
  311. <div class="flex items-center justify-between mb-3">
  312. <span class="text-xs font-semibold text-slate-400 uppercase tracking-wider">Live Traffic</span>
  313. <div class="p-2 bg-amber-500/10 text-amber-400 rounded-lg">
  314. <svg class="w-5 h-5" fill="none" stroke="currentColor" viewBox="0 0 24 24">
  315. <path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M13 7h8m0 0v8m0-8l-8 8-4-4-6 6" />
  316. </svg>
  317. </div>
  318. </div>
  319. <div class="space-y-1">
  320. <div class="flex items-center justify-between text-xs">
  321. <span class="text-slate-400 flex items-center gap-1"><span class="text-emerald-400 font-bold">↓</span> RX:</span>
  322. <span id="stat-traffic-rx" class="font-mono font-semibold text-emerald-400">0 B/s</span>
  323. </div>
  324. <div class="flex items-center justify-between text-xs">
  325. <span class="text-slate-400 flex items-center gap-1"><span class="text-cyan-400 font-bold">↑</span> TX:</span>
  326. <span id="stat-traffic-tx" class="font-mono font-semibold text-cyan-400">0 B/s</span>
  327. </div>
  328. </div>
  329. </div>
  330. </div>
  331. <!-- Port Matrix -->
  332. <div class="bg-slate-900/90 border border-slate-800 rounded-xl p-5">
  333. <div class="flex items-center justify-between mb-4">
  334. <div>
  335. <h3 class="text-sm font-bold text-white uppercase tracking-wider flex items-center gap-2">
  336. <span>Hardware & Virtual Port Matrix</span>
  337. <span class="text-[10px] bg-slate-800 text-slate-400 font-normal px-2 py-0.5 rounded-full">Live Hardware State</span>
  338. </h3>
  339. </div>
  340. </div>
  341. <div id="port-matrix" class="grid grid-cols-2 sm:grid-cols-3 md:grid-cols-4 lg:grid-cols-6 gap-3"></div>
  342. </div>
  343. <!-- Quick Overview Tables -->
  344. <div class="grid grid-cols-1 lg:grid-cols-2 gap-6">
  345. <div class="bg-slate-900/90 border border-slate-800 rounded-xl p-5">
  346. <div class="flex items-center justify-between mb-4">
  347. <h3 class="text-sm font-bold text-white">Interfaces Overview</h3>
  348. <button onclick="navigate('interfaces')" class="text-xs text-brand-400 hover:text-brand-300 font-medium">View All →</button>
  349. </div>
  350. <div class="overflow-x-auto">
  351. <table class="w-full text-left text-xs">
  352. <thead class="text-slate-400 border-b border-slate-800">
  353. <tr><th class="pb-2">Interface</th><th class="pb-2">Role</th><th class="pb-2">IP</th><th class="pb-2 text-right">Status</th></tr>
  354. </thead>
  355. <tbody id="quick-interfaces-table" class="divide-y divide-slate-800/60 font-mono"></tbody>
  356. </table>
  357. </div>
  358. </div>
  359. <div class="bg-slate-900/90 border border-slate-800 rounded-xl p-5">
  360. <div class="flex items-center justify-between mb-4">
  361. <h3 class="text-sm font-bold text-white">Active VLANs</h3>
  362. <button onclick="navigate('vlans')" class="text-xs text-cyan-400 hover:text-cyan-300 font-medium">Manage →</button>
  363. </div>
  364. <div class="overflow-x-auto">
  365. <table class="w-full text-left text-xs">
  366. <thead class="text-slate-400 border-b border-slate-800">
  367. <tr><th class="pb-2">VLAN</th><th class="pb-2">Device</th><th class="pb-2">Subnet</th><th class="pb-2 text-right">Parent</th></tr>
  368. </thead>
  369. <tbody id="quick-vlans-table" class="divide-y divide-slate-800/60 font-mono"></tbody>
  370. </table>
  371. </div>
  372. </div>
  373. </div>
  374. </section>
  375. <!-- ================= SECTION: INTERFACES (HIERARCHICAL TREE) ================= -->
  376. <section id="section-interfaces" class="hidden space-y-6">
  377. <div class="bg-slate-900/90 border border-slate-800 rounded-xl p-4 flex flex-wrap items-center justify-between gap-4">
  378. <div class="flex items-center space-x-2">
  379. <span class="text-xs font-semibold text-slate-400 mr-2">Filter:</span>
  380. <button onclick="filterIfaces('all')" id="filter-all" class="filter-btn px-3 py-1.5 rounded-lg text-xs font-medium bg-slate-800 text-white border border-slate-700">All Interfaces</button>
  381. <button onclick="filterIfaces('has_vlans')" id="filter-has_vlans" class="filter-btn px-3 py-1.5 rounded-lg text-xs font-medium text-slate-400 hover:bg-slate-800 hover:text-white">With VLANs</button>
  382. <button onclick="filterIfaces('physical')" id="filter-physical" class="filter-btn px-3 py-1.5 rounded-lg text-xs font-medium text-slate-400 hover:bg-slate-800 hover:text-white">Physical Only</button>
  383. <button onclick="filterIfaces('up')" id="filter-up" class="filter-btn px-3 py-1.5 rounded-lg text-xs font-medium text-slate-400 hover:bg-slate-800 hover:text-white">Only UP</button>
  384. </div>
  385. <div class="flex items-center space-x-3">
  386. <button onclick="expandAllIfaces(true)" class="text-xs text-cyan-400 hover:text-cyan-300 font-medium px-2.5 py-1.5 rounded bg-cyan-950/50 border border-cyan-800/60">Expand All</button>
  387. <button onclick="expandAllIfaces(false)" class="text-xs text-slate-400 hover:text-slate-300 font-medium px-2.5 py-1.5 rounded bg-slate-800 border border-slate-700">Collapse All</button>
  388. <input type="text" id="iface-search" oninput="renderInterfacesList()" placeholder="Search interfaces..."
  389. class="bg-slate-800/80 border border-slate-700 rounded-lg px-3 py-1.5 text-xs text-white placeholder-slate-500 focus:outline-none focus:border-brand-500 w-48">
  390. </div>
  391. </div>
  392. <div class="bg-slate-900/90 border border-slate-800 rounded-xl overflow-hidden shadow-2xl">
  393. <div class="p-4 border-b border-slate-800 bg-slate-950/40 flex items-center justify-between">
  394. <div>
  395. <h3 class="text-sm font-bold text-white flex items-center gap-2">
  396. <span>Interface Hierarchy & VLAN Sub-interfaces</span>
  397. <span class="text-[10px] bg-cyan-500/10 text-cyan-400 border border-cyan-500/20 px-2 py-0.5 rounded font-mono">Expandable Tree</span>
  398. </h3>
  399. </div>
  400. <div class="text-xs text-slate-400">
  401. <span id="ifaces-list-summary" class="font-mono">Loading interfaces...</span>
  402. </div>
  403. </div>
  404. <div class="overflow-x-auto">
  405. <table class="w-full text-left text-xs">
  406. <thead class="text-slate-400 bg-slate-950/80 border-b border-slate-800 uppercase tracking-wider text-[11px]">
  407. <tr>
  408. <th class="py-3 px-3 font-semibold w-8 text-center"></th>
  409. <th class="py-3 px-4 font-semibold">Interface / Type</th>
  410. <th class="py-3 px-4 font-semibold">Role & Alias</th>
  411. <th class="py-3 px-4 font-semibold">IP Address (CIDR)</th>
  412. <th class="py-3 px-4 font-semibold">MAC & MTU</th>
  413. <th class="py-3 px-4 font-semibold">Throughput (RX/TX)</th>
  414. <th class="py-3 px-4 font-semibold">Link State</th>
  415. <th class="py-3 px-4 font-semibold text-right">Actions</th>
  416. </tr>
  417. </thead>
  418. <tbody id="interfaces-tree-tbody" class="divide-y divide-slate-800 font-mono"></tbody>
  419. </table>
  420. </div>
  421. <div id="interfaces-empty-state" class="hidden p-12 text-center text-slate-500">
  422. No interfaces found matching your search.
  423. </div>
  424. </div>
  425. </section>
  426. <!-- ================= SECTION: VLANS (802.1Q) ================= -->
  427. <section id="section-vlans" class="hidden space-y-6">
  428. <div class="bg-gradient-to-r from-cyan-950/60 via-slate-900 to-slate-900 border border-cyan-800/40 rounded-xl p-5 flex flex-wrap items-center justify-between gap-4">
  429. <div class="max-w-xl">
  430. <div class="flex items-center gap-2 mb-1">
  431. <span class="px-2 py-0.5 rounded text-[11px] font-mono bg-cyan-500/20 text-cyan-400 border border-cyan-500/30 font-semibold">IEEE 802.1Q</span>
  432. <h2 class="text-base font-bold text-white">VLAN Virtual Sub-interfaces</h2>
  433. </div>
  434. <p class="text-xs text-slate-400 leading-relaxed">
  435. Tagged sub-interfaces on physical parent interfaces (e.g. <code class="text-cyan-300">eth0.10</code>).
  436. </p>
  437. </div>
  438. <button onclick="openVlanModal()" class="flex items-center space-x-2 bg-gradient-to-r from-brand-600 to-cyan-600 hover:from-brand-500 hover:to-cyan-500 text-white font-semibold text-xs px-4 py-2.5 rounded-lg shadow-lg shadow-cyan-500/20 transition">
  439. <span>+ Create VLAN Sub-interface</span>
  440. </button>
  441. </div>
  442. <div class="bg-slate-900/90 border border-slate-800 rounded-xl overflow-hidden">
  443. <div class="p-4 border-b border-slate-800 flex items-center justify-between">
  444. <h3 class="text-sm font-bold text-white">Configured VLANs</h3>
  445. <input type="text" id="vlan-search" oninput="renderVlansList()" placeholder="Filter VLAN ID..."
  446. class="bg-slate-800 border border-slate-700 rounded-lg px-3 py-1 text-xs text-white focus:outline-none focus:border-cyan-500 w-52">
  447. </div>
  448. <div class="overflow-x-auto">
  449. <table class="w-full text-left text-xs font-mono">
  450. <thead class="text-slate-400 bg-slate-950/60 border-b border-slate-800 uppercase tracking-wider text-[11px] font-sans">
  451. <tr>
  452. <th class="py-3 px-4 font-semibold">VLAN ID</th>
  453. <th class="py-3 px-4 font-semibold">Device</th>
  454. <th class="py-3 px-4 font-semibold">Parent</th>
  455. <th class="py-3 px-4 font-semibold">Subnet (CIDR)</th>
  456. <th class="py-3 px-4 font-semibold">Role</th>
  457. <th class="py-3 px-4 font-semibold">MTU</th>
  458. <th class="py-3 px-4 font-semibold">Status</th>
  459. <th class="py-3 px-4 font-semibold text-right">Actions</th>
  460. </tr>
  461. </thead>
  462. <tbody id="vlans-table-body" class="divide-y divide-slate-800"></tbody>
  463. </table>
  464. </div>
  465. <div id="vlans-empty-state" class="hidden p-12 text-center text-slate-500">
  466. No VLANs configured. Click "+ Create VLAN" to add one.
  467. </div>
  468. </div>
  469. </section>
  470. <!-- ================= SECTION: PPPoE CLIENTS (MikroTik style) ================= -->
  471. <section id="section-pppoe" class="hidden space-y-6">
  472. <div class="bg-gradient-to-r from-blue-950/40 via-slate-900 to-slate-900 border border-blue-900/30 rounded-xl p-5 flex flex-wrap items-center justify-between gap-4">
  473. <div>
  474. <div class="flex items-center gap-2 mb-1">
  475. <span class="px-2 py-0.5 rounded text-[10px] font-mono bg-blue-500/20 text-blue-300 border border-blue-500/30 font-semibold">/interface pppoe-client</span>
  476. <h2 class="text-base font-bold text-white">PPPoE Client Sessions</h2>
  477. </div>
  478. <p class="text-xs text-slate-400">Manage multiple Point-to-Point Protocol over Ethernet WAN connections (MikroTik RouterOS style).</p>
  479. </div>
  480. <button onclick="openAddPPPoEModal()" class="text-xs font-semibold px-4 py-2 rounded-lg bg-blue-600 hover:bg-blue-500 text-white shadow-lg shadow-blue-500/20 transition flex items-center gap-1.5">
  481. <span>+ Add PPPoE Client</span>
  482. </button>
  483. </div>
  484. <div class="bg-slate-900/90 border border-slate-800 rounded-xl overflow-hidden">
  485. <div class="p-4 border-b border-slate-800 flex items-center justify-between">
  486. <h3 class="text-sm font-bold text-white">Configured PPPoE Interfaces</h3>
  487. <span id="pppoe-count-badge" class="text-xs font-mono bg-slate-800 text-slate-300 px-2.5 py-0.5 rounded-full">0 Interfaces</span>
  488. </div>
  489. <div class="overflow-x-auto">
  490. <table class="w-full text-left text-xs font-mono">
  491. <thead class="text-slate-400 bg-slate-950/60 border-b border-slate-800 uppercase tracking-wider text-[10px] font-sans">
  492. <tr>
  493. <th class="py-2.5 px-3 w-12 text-center" title="Flags: R=Running, X=Disabled">Flag</th>
  494. <th class="py-2.5 px-3">Name</th>
  495. <th class="py-2.5 px-3">Interface</th>
  496. <th class="py-2.5 px-3">User</th>
  497. <th class="py-2.5 px-3">Assigned IP</th>
  498. <th class="py-2.5 px-3">Device</th>
  499. <th class="py-2.5 px-3 text-center">Def. Route</th>
  500. <th class="py-2.5 px-3 text-right font-sans">Actions</th>
  501. </tr>
  502. </thead>
  503. <tbody id="pppoe-table-body" class="divide-y divide-slate-800/80"></tbody>
  504. </table>
  505. </div>
  506. <div id="pppoe-empty" class="hidden p-10 text-center text-slate-500 text-xs font-sans">
  507. No PPPoE clients configured. Click "+ Add PPPoE Client" to add a connection.
  508. </div>
  509. </div>
  510. </section>
  511. <!-- ================= SECTION: WIREGUARD (MikroTik style) ================= -->
  512. <section id="section-wireguard" class="hidden space-y-6">
  513. <div class="bg-gradient-to-r from-rose-950/40 via-slate-900 to-slate-900 border border-rose-900/30 rounded-xl p-5 flex flex-wrap items-center justify-between gap-4">
  514. <div>
  515. <div class="flex items-center gap-2 mb-1">
  516. <span class="px-2 py-0.5 rounded text-[10px] font-mono bg-rose-500/20 text-rose-300 border border-rose-500/30 font-semibold">/interface wireguard</span>
  517. <h2 class="text-base font-bold text-white">WireGuard VPN Suite</h2>
  518. </div>
  519. <p class="text-xs text-slate-400">High-performance multi-interface WireGuard server and peer controller (MikroTik RouterOS v7 style).</p>
  520. </div>
  521. <div class="flex items-center space-x-2.5">
  522. <button onclick="openAddWGInterfaceModal()" class="text-xs font-semibold px-3.5 py-2 rounded-lg bg-rose-600 hover:bg-rose-500 text-white shadow-lg shadow-rose-500/20 transition">
  523. + Add Interface
  524. </button>
  525. <button onclick="openAddWGPeerModal()" class="text-xs font-semibold px-3.5 py-2 rounded-lg bg-slate-800 hover:bg-slate-700 text-white border border-slate-700 transition">
  526. + Add Peer
  527. </button>
  528. </div>
  529. </div>
  530. <!-- Sub Tabs: Interfaces / Peers -->
  531. <div class="flex border-b border-slate-800 space-x-2">
  532. <button id="wg-subtab-btn-ifaces" onclick="switchWGSubTab('ifaces')" class="px-4 py-2.5 text-xs font-bold border-b-2 border-rose-500 text-white transition flex items-center gap-2">
  533. <span>Interfaces</span>
  534. <span id="wg-subtab-badge-ifaces" class="px-1.5 py-0.5 rounded text-[10px] bg-slate-800 text-slate-300">0</span>
  535. </button>
  536. <button id="wg-subtab-btn-peers" onclick="switchWGSubTab('peers')" class="px-4 py-2.5 text-xs font-bold border-b-2 border-transparent text-slate-400 hover:text-slate-200 transition flex items-center gap-2">
  537. <span>Peers</span>
  538. <span id="wg-subtab-badge-peers" class="px-1.5 py-0.5 rounded text-[10px] bg-slate-800 text-slate-300">0</span>
  539. </button>
  540. </div>
  541. <!-- Sub-Tab 1: Interfaces -->
  542. <div id="wg-subtab-ifaces" class="bg-slate-900/90 border border-slate-800 rounded-xl overflow-hidden">
  543. <div class="p-4 border-b border-slate-800 flex items-center justify-between">
  544. <h3 class="text-sm font-bold text-white">WireGuard Interfaces</h3>
  545. <span id="wg-ifaces-count" class="text-xs font-mono text-slate-400">0 Interfaces</span>
  546. </div>
  547. <div class="overflow-x-auto">
  548. <table class="w-full text-left text-xs font-mono">
  549. <thead class="text-slate-400 bg-slate-950/60 border-b border-slate-800 uppercase tracking-wider text-[10px] font-sans">
  550. <tr>
  551. <th class="py-2.5 px-3 w-12 text-center" title="Flags: R=Running, X=Disabled">Flag</th>
  552. <th class="py-2.5 px-3">Name</th>
  553. <th class="py-2.5 px-3">Listen Port</th>
  554. <th class="py-2.5 px-3">Tunnel Address</th>
  555. <th class="py-2.5 px-3">Public Key</th>
  556. <th class="py-2.5 px-3">MTU</th>
  557. <th class="py-2.5 px-3 text-center">Peers</th>
  558. <th class="py-2.5 px-3 text-right font-sans">Actions</th>
  559. </tr>
  560. </thead>
  561. <tbody id="wg-ifaces-table-body" class="divide-y divide-slate-800/80"></tbody>
  562. </table>
  563. </div>
  564. <div id="wg-ifaces-empty" class="hidden p-10 text-center text-slate-500 text-xs font-sans">
  565. No WireGuard interfaces configured. Click "+ Add Interface" to create wg0.
  566. </div>
  567. </div>
  568. <!-- Sub-Tab 2: Peers -->
  569. <div id="wg-subtab-peers" class="hidden bg-slate-900/90 border border-slate-800 rounded-xl overflow-hidden">
  570. <div class="p-4 border-b border-slate-800 flex items-center justify-between flex-wrap gap-3">
  571. <div class="flex items-center gap-3">
  572. <h3 class="text-sm font-bold text-white">WireGuard Peers</h3>
  573. <span id="wg-peers-count" class="text-xs font-mono text-slate-400">0 Peers</span>
  574. </div>
  575. <div class="flex items-center gap-2">
  576. <label class="text-xs text-slate-400 font-sans">Filter Interface:</label>
  577. <select id="wg-peers-filter-iface" onchange="renderWGPeers()" class="bg-slate-800 border border-slate-700 rounded-lg px-2.5 py-1 text-xs text-white font-mono">
  578. <option value="">All Interfaces</option>
  579. </select>
  580. </div>
  581. </div>
  582. <div class="overflow-x-auto">
  583. <table class="w-full text-left text-xs font-mono">
  584. <thead class="text-slate-400 bg-slate-950/60 border-b border-slate-800 uppercase tracking-wider text-[10px] font-sans">
  585. <tr>
  586. <th class="py-2.5 px-3 w-12 text-center" title="Flags: R=Active, X=Disabled">Flag</th>
  587. <th class="py-2.5 px-3">Interface</th>
  588. <th class="py-2.5 px-3">Peer Name</th>
  589. <th class="py-2.5 px-3">Public Key</th>
  590. <th class="py-2.5 px-3">Allowed IPs</th>
  591. <th class="py-2.5 px-3">Endpoint</th>
  592. <th class="py-2.5 px-3">Latest Handshake</th>
  593. <th class="py-2.5 px-3">Traffic (RX/TX)</th>
  594. <th class="py-2.5 px-3 text-right font-sans">Action</th>
  595. </tr>
  596. </thead>
  597. <tbody id="wg-peers-table-body" class="divide-y divide-slate-800/80"></tbody>
  598. </table>
  599. </div>
  600. <div id="wg-peers-empty" class="hidden p-10 text-center text-slate-500 text-xs font-sans">
  601. No peers found for the selected interface. Click "+ Add Peer" to add a client or branch.
  602. </div>
  603. </div>
  604. </section>
  605. <!-- ================= SECTION: IPSEC (MikroTik style) ================= -->
  606. <section id="section-ipsec" class="hidden space-y-6">
  607. <div class="bg-gradient-to-r from-amber-950/40 via-slate-900 to-slate-900 border border-amber-900/30 rounded-xl p-5 flex flex-wrap items-center justify-between gap-4">
  608. <div>
  609. <div class="flex items-center gap-2 mb-1">
  610. <span class="px-2 py-0.5 rounded text-[10px] font-mono bg-amber-500/20 text-amber-300 border border-amber-500/30 font-semibold">/ip ipsec</span>
  611. <h2 class="text-base font-bold text-white">IPSec (IKEv2) Tunnels</h2>
  612. </div>
  613. <p class="text-xs text-slate-400">Enterprise strongSwan 6 Site-to-Site and Remote Gateway connections.</p>
  614. </div>
  615. <button onclick="openAddIPSecModal()" class="text-xs font-semibold px-4 py-2 rounded-lg bg-amber-600 hover:bg-amber-500 text-white shadow-lg shadow-amber-500/20 transition">
  616. + Add IPSec Tunnel
  617. </button>
  618. </div>
  619. <div class="bg-slate-900/90 border border-slate-800 rounded-xl overflow-hidden">
  620. <div class="p-4 border-b border-slate-800 flex items-center justify-between">
  621. <h3 class="text-sm font-bold text-white">Configured IPSec Tunnels</h3>
  622. <span id="ipsec-sas-badge" class="text-xs font-mono bg-slate-800 text-slate-300 px-2.5 py-0.5 rounded-full">0 Active SAs</span>
  623. </div>
  624. <div class="overflow-x-auto">
  625. <table class="w-full text-left text-xs font-mono">
  626. <thead class="text-slate-400 bg-slate-950/60 border-b border-slate-800 uppercase tracking-wider text-[10px] font-sans">
  627. <tr>
  628. <th class="py-2.5 px-3 w-12 text-center" title="Flags: R=Established, X=Disabled">Flag</th>
  629. <th class="py-2.5 px-4">Connection Name</th>
  630. <th class="py-2.5 px-4">Local Subnet</th>
  631. <th class="py-2.5 px-4">Remote Gateway</th>
  632. <th class="py-2.5 px-4">Remote Subnet</th>
  633. <th class="py-2.5 px-4">Status</th>
  634. <th class="py-2.5 px-4 text-right font-sans">Actions</th>
  635. </tr>
  636. </thead>
  637. <tbody id="ipsec-table-body" class="divide-y divide-slate-800"></tbody>
  638. </table>
  639. </div>
  640. <div id="ipsec-empty" class="hidden p-10 text-center text-slate-500 text-xs font-sans">
  641. No IPSec tunnels configured. Click "+ Add IPSec Tunnel" to set up site-to-site networking.
  642. </div>
  643. </div>
  644. </section>
  645. <!-- ================= SECTION: L2TP CLIENT (MikroTik style) ================= -->
  646. <section id="section-l2tp" class="hidden space-y-6">
  647. <div class="bg-gradient-to-r from-cyan-950/40 via-slate-900 to-slate-900 border border-cyan-900/30 rounded-xl p-5 flex flex-wrap items-center justify-between gap-4">
  648. <div>
  649. <div class="flex items-center gap-2 mb-1">
  650. <span class="px-2 py-0.5 rounded text-[10px] font-mono bg-cyan-500/20 text-cyan-300 border border-cyan-500/30 font-semibold">/interface l2tp-client</span>
  651. <h2 class="text-base font-bold text-white">L2TP Client Sessions</h2>
  652. </div>
  653. <p class="text-xs text-slate-400">Multiple Layer 2 Tunneling Protocol clients with optional IPSec PSK encryption.</p>
  654. </div>
  655. <button onclick="openAddL2TPModal()" class="text-xs font-semibold px-4 py-2 rounded-lg bg-cyan-600 hover:bg-cyan-500 text-white shadow-lg shadow-cyan-500/20 transition">
  656. + Add L2TP Client
  657. </button>
  658. </div>
  659. <div class="bg-slate-900/90 border border-slate-800 rounded-xl overflow-hidden">
  660. <div class="p-4 border-b border-slate-800 flex items-center justify-between">
  661. <h3 class="text-sm font-bold text-white">Configured L2TP Clients</h3>
  662. <span id="l2tp-count-badge" class="text-xs font-mono bg-slate-800 text-slate-300 px-2.5 py-0.5 rounded-full">0 Clients</span>
  663. </div>
  664. <div class="overflow-x-auto">
  665. <table class="w-full text-left text-xs font-mono">
  666. <thead class="text-slate-400 bg-slate-950/60 border-b border-slate-800 uppercase tracking-wider text-[10px] font-sans">
  667. <tr>
  668. <th class="py-2.5 px-3 w-12 text-center" title="Flags: R=Running, X=Disabled">Flag</th>
  669. <th class="py-2.5 px-3">Name</th>
  670. <th class="py-2.5 px-3">Server Address</th>
  671. <th class="py-2.5 px-3">User</th>
  672. <th class="py-2.5 px-3">Assigned IP</th>
  673. <th class="py-2.5 px-3">Device</th>
  674. <th class="py-2.5 px-3 text-center">Def. Route</th>
  675. <th class="py-2.5 px-3 text-right font-sans">Actions</th>
  676. </tr>
  677. </thead>
  678. <tbody id="l2tp-table-body" class="divide-y divide-slate-800/80"></tbody>
  679. </table>
  680. </div>
  681. <div id="l2tp-empty" class="hidden p-10 text-center text-slate-500 text-xs font-sans">
  682. No L2TP clients configured. Click "+ Add L2TP Client" to add a tunnel.
  683. </div>
  684. </div>
  685. </section>
  686. <!-- ================= SECTION: PPTP CLIENT (MikroTik style) ================= -->
  687. <section id="section-pptp" class="hidden space-y-6">
  688. <div class="bg-gradient-to-r from-purple-950/40 via-slate-900 to-slate-900 border border-purple-900/30 rounded-xl p-5 flex flex-wrap items-center justify-between gap-4">
  689. <div>
  690. <div class="flex items-center gap-2 mb-1">
  691. <span class="px-2 py-0.5 rounded text-[10px] font-mono bg-purple-500/20 text-purple-300 border border-purple-500/30 font-semibold">/interface pptp-client</span>
  692. <h2 class="text-base font-bold text-white">PPTP Client Sessions</h2>
  693. </div>
  694. <p class="text-xs text-slate-400">Multiple Point-to-Point Tunneling Protocol clients with MPPE-128 encryption.</p>
  695. </div>
  696. <button onclick="openAddPPTPModal()" class="text-xs font-semibold px-4 py-2 rounded-lg bg-purple-600 hover:bg-purple-500 text-white shadow-lg shadow-purple-500/20 transition">
  697. + Add PPTP Client
  698. </button>
  699. </div>
  700. <div class="bg-slate-900/90 border border-slate-800 rounded-xl overflow-hidden">
  701. <div class="p-4 border-b border-slate-800 flex items-center justify-between">
  702. <h3 class="text-sm font-bold text-white">Configured PPTP Clients</h3>
  703. <span id="pptp-count-badge" class="text-xs font-mono bg-slate-800 text-slate-300 px-2.5 py-0.5 rounded-full">0 Clients</span>
  704. </div>
  705. <div class="overflow-x-auto">
  706. <table class="w-full text-left text-xs font-mono">
  707. <thead class="text-slate-400 bg-slate-950/60 border-b border-slate-800 uppercase tracking-wider text-[10px] font-sans">
  708. <tr>
  709. <th class="py-2.5 px-3 w-12 text-center" title="Flags: R=Running, X=Disabled">Flag</th>
  710. <th class="py-2.5 px-3">Name</th>
  711. <th class="py-2.5 px-3">Server Address</th>
  712. <th class="py-2.5 px-3">User</th>
  713. <th class="py-2.5 px-3">Assigned IP</th>
  714. <th class="py-2.5 px-3">Device</th>
  715. <th class="py-2.5 px-3 text-center">MPPE</th>
  716. <th class="py-2.5 px-3 text-right font-sans">Actions</th>
  717. </tr>
  718. </thead>
  719. <tbody id="pptp-table-body" class="divide-y divide-slate-800/80"></tbody>
  720. </table>
  721. </div>
  722. <div id="pptp-empty" class="hidden p-10 text-center text-slate-500 text-xs font-sans">
  723. No PPTP clients configured. Click "+ Add PPTP Client" to add a tunnel.
  724. </div>
  725. </div>
  726. </section>
  727. <!-- ================= SECTION: FIREWALL (/ip firewall) ================= -->
  728. <section id="section-firewall" class="hidden space-y-6">
  729. <div class="bg-gradient-to-r from-emerald-950/40 via-slate-900 to-slate-900 border border-emerald-900/30 rounded-xl p-5 flex flex-wrap items-center justify-between gap-4">
  730. <div>
  731. <div class="flex items-center gap-2 mb-1">
  732. <span class="px-2 py-0.5 rounded text-[10px] font-mono bg-emerald-500/20 text-emerald-300 border border-emerald-500/30 font-semibold">/ip firewall</span>
  733. <h2 class="text-base font-bold text-white">Firewall & Traffic Controller</h2>
  734. </div>
  735. <p class="text-xs text-slate-400">Complete MikroTik-grade stateful filter, NAT, packet/connection marking (Mangle), address lists and live connection tracker.</p>
  736. </div>
  737. <div class="flex items-center space-x-2.5">
  738. <button id="fw-primary-add-btn" onclick="openCurrentFWModal()" class="text-xs font-semibold px-4 py-2 rounded-lg bg-emerald-600 hover:bg-emerald-500 text-white shadow-lg shadow-emerald-500/20 transition flex items-center gap-1.5">
  739. <span>+ Add Rule</span>
  740. </button>
  741. <button onclick="resetFirewallCounters()" class="text-xs font-medium px-3 py-2 rounded-lg bg-slate-800 hover:bg-slate-700 text-slate-300 border border-slate-700 transition" title="Reset all packet & byte counters to zero">
  742. Reset Counters
  743. </button>
  744. </div>
  745. </div>
  746. <!-- Sub Tabs: Filter / NAT / Mangle / Address Lists / Connections -->
  747. <div class="flex border-b border-slate-800 space-x-1 overflow-x-auto">
  748. <button id="fw-subtab-btn-filter" onclick="switchFWSubTab('filter')" class="px-4 py-2.5 text-xs font-bold border-b-2 border-emerald-500 text-white transition flex items-center gap-2 whitespace-nowrap">
  749. <span>Filter Rules</span>
  750. <span id="fw-badge-filter" class="px-1.5 py-0.2 rounded text-[10px] bg-slate-800 text-slate-300">0</span>
  751. </button>
  752. <button id="fw-subtab-btn-nat" onclick="switchFWSubTab('nat')" class="px-4 py-2.5 text-xs font-bold border-b-2 border-transparent text-slate-400 hover:text-slate-200 transition flex items-center gap-2 whitespace-nowrap">
  753. <span>NAT</span>
  754. <span id="fw-badge-nat" class="px-1.5 py-0.2 rounded text-[10px] bg-slate-800 text-slate-300">0</span>
  755. </button>
  756. <button id="fw-subtab-btn-mangle" onclick="switchFWSubTab('mangle')" class="px-4 py-2.5 text-xs font-bold border-b-2 border-transparent text-slate-400 hover:text-slate-200 transition flex items-center gap-2 whitespace-nowrap">
  757. <span>Mangle</span>
  758. <span id="fw-badge-mangle" class="px-1.5 py-0.2 rounded text-[10px] bg-slate-800 text-slate-300">0</span>
  759. </button>
  760. <button id="fw-subtab-btn-addrlist" onclick="switchFWSubTab('addrlist')" class="px-4 py-2.5 text-xs font-bold border-b-2 border-transparent text-slate-400 hover:text-slate-200 transition flex items-center gap-2 whitespace-nowrap">
  761. <span>Address Lists</span>
  762. <span id="fw-badge-addrlist" class="px-1.5 py-0.2 rounded text-[10px] bg-slate-800 text-slate-300">0</span>
  763. </button>
  764. <button id="fw-subtab-btn-connections" onclick="switchFWSubTab('connections')" class="px-4 py-2.5 text-xs font-bold border-b-2 border-transparent text-slate-400 hover:text-slate-200 transition flex items-center gap-2 whitespace-nowrap">
  765. <span>Connections</span>
  766. <span id="fw-badge-connections" class="px-1.5 py-0.2 rounded text-[10px] bg-emerald-950 text-emerald-400 border border-emerald-800/40">0</span>
  767. </button>
  768. </div>
  769. <!-- ================= TAB 1: FILTER RULES ================= -->
  770. <div id="fw-subtab-filter" class="bg-slate-900/90 border border-slate-800 rounded-xl overflow-hidden">
  771. <div class="p-4 border-b border-slate-800 flex items-center justify-between flex-wrap gap-3">
  772. <div class="flex items-center gap-3">
  773. <h3 class="text-sm font-bold text-white">Firewall Filter Rules</h3>
  774. <span id="filter-count-badge" class="text-xs font-mono text-slate-400">0 Rules</span>
  775. </div>
  776. <div class="flex items-center gap-2">
  777. <label class="text-xs text-slate-400 font-sans">Chain:</label>
  778. <select id="filter-filter-chain" onchange="renderFilterRules()" class="bg-slate-800 border border-slate-700 rounded-lg px-2.5 py-1 text-xs text-white font-mono">
  779. <option value="">All Chains</option>
  780. <option value="input">input</option>
  781. <option value="forward">forward</option>
  782. <option value="output">output</option>
  783. </select>
  784. </div>
  785. </div>
  786. <div class="overflow-x-auto">
  787. <table class="w-full text-left text-xs font-mono">
  788. <thead class="text-slate-400 bg-slate-950/60 border-b border-slate-800 uppercase tracking-wider text-[10px] font-sans">
  789. <tr>
  790. <th class="py-2.5 px-3 w-10 text-center">#</th>
  791. <th class="py-2.5 px-3 w-12 text-center" title="Flags: X=Disabled, C=Comment">Flag</th>
  792. <th class="py-2.5 px-3">Chain</th>
  793. <th class="py-2.5 px-3">Src. Address</th>
  794. <th class="py-2.5 px-3">Dst. Address</th>
  795. <th class="py-2.5 px-3">Protocol</th>
  796. <th class="py-2.5 px-3">Ports</th>
  797. <th class="py-2.5 px-3">In / Out</th>
  798. <th class="py-2.5 px-3">Action</th>
  799. <th class="py-2.5 px-3">Packets / Bytes</th>
  800. <th class="py-2.5 px-3">Comment</th>
  801. <th class="py-2.5 px-3 text-right font-sans">Order & Actions</th>
  802. </tr>
  803. </thead>
  804. <tbody id="filter-table-body" class="divide-y divide-slate-800/80"></tbody>
  805. </table>
  806. </div>
  807. <div id="filter-empty" class="hidden p-10 text-center text-slate-500 text-xs font-sans">
  808. No filter rules found in this chain. Click "+ Add Rule" to create one.
  809. </div>
  810. </div>
  811. <!-- ================= TAB 2: NAT RULES ================= -->
  812. <div id="fw-subtab-nat" class="hidden bg-slate-900/90 border border-slate-800 rounded-xl overflow-hidden">
  813. <div class="p-4 border-b border-slate-800 flex items-center justify-between flex-wrap gap-3">
  814. <div class="flex items-center gap-3">
  815. <h3 class="text-sm font-bold text-white">NAT Rules</h3>
  816. <span id="nat-count-badge" class="text-xs font-mono text-slate-400">0 Rules</span>
  817. </div>
  818. <div class="flex items-center gap-2">
  819. <label class="text-xs text-slate-400 font-sans">Chain:</label>
  820. <select id="nat-filter-chain" onchange="renderNATRules()" class="bg-slate-800 border border-slate-700 rounded-lg px-2.5 py-1 text-xs text-white font-mono">
  821. <option value="">All Chains</option>
  822. <option value="srcnat">srcnat (SNAT / Masquerade)</option>
  823. <option value="dstnat">dstnat (Port Forwarding)</option>
  824. </select>
  825. </div>
  826. </div>
  827. <div class="overflow-x-auto">
  828. <table class="w-full text-left text-xs font-mono">
  829. <thead class="text-slate-400 bg-slate-950/60 border-b border-slate-800 uppercase tracking-wider text-[10px] font-sans">
  830. <tr>
  831. <th class="py-2.5 px-3 w-10 text-center">#</th>
  832. <th class="py-2.5 px-3 w-12 text-center">Flag</th>
  833. <th class="py-2.5 px-3">Chain</th>
  834. <th class="py-2.5 px-3">Src. Address</th>
  835. <th class="py-2.5 px-3">Dst. Address</th>
  836. <th class="py-2.5 px-3">Proto/Port</th>
  837. <th class="py-2.5 px-3">Out / In</th>
  838. <th class="py-2.5 px-3">Action</th>
  839. <th class="py-2.5 px-3">To Address:Port</th>
  840. <th class="py-2.5 px-3">Packets / Bytes</th>
  841. <th class="py-2.5 px-3">Comment</th>
  842. <th class="py-2.5 px-3 text-right font-sans">Order & Actions</th>
  843. </tr>
  844. </thead>
  845. <tbody id="nat-table-body" class="divide-y divide-slate-800/80"></tbody>
  846. </table>
  847. </div>
  848. <div id="nat-empty" class="hidden p-10 text-center text-slate-500 text-xs font-sans">
  849. No NAT rules configured. Click "+ Add Rule" to add masquerade or port forwarding.
  850. </div>
  851. </div>
  852. <!-- ================= TAB 3: MANGLE RULES ================= -->
  853. <div id="fw-subtab-mangle" class="hidden bg-slate-900/90 border border-slate-800 rounded-xl overflow-hidden">
  854. <div class="p-4 border-b border-slate-800 flex items-center justify-between flex-wrap gap-3">
  855. <div class="flex items-center gap-3">
  856. <h3 class="text-sm font-bold text-white">Mangle Packet & Connection Marking</h3>
  857. <span id="mangle-count-badge" class="text-xs font-mono text-slate-400">0 Rules</span>
  858. </div>
  859. <div class="flex items-center gap-2">
  860. <label class="text-xs text-slate-400 font-sans">Chain:</label>
  861. <select id="mangle-filter-chain" onchange="renderMangleRules()" class="bg-slate-800 border border-slate-700 rounded-lg px-2.5 py-1 text-xs text-white font-mono">
  862. <option value="">All Chains</option>
  863. <option value="prerouting">prerouting</option>
  864. <option value="forward">forward</option>
  865. <option value="postrouting">postrouting</option>
  866. <option value="input">input</option>
  867. <option value="output">output</option>
  868. </select>
  869. </div>
  870. </div>
  871. <div class="overflow-x-auto">
  872. <table class="w-full text-left text-xs font-mono">
  873. <thead class="text-slate-400 bg-slate-950/60 border-b border-slate-800 uppercase tracking-wider text-[10px] font-sans">
  874. <tr>
  875. <th class="py-2.5 px-3 w-10 text-center">#</th>
  876. <th class="py-2.5 px-3 w-12 text-center">Flag</th>
  877. <th class="py-2.5 px-3">Chain</th>
  878. <th class="py-2.5 px-3">Src. Address</th>
  879. <th class="py-2.5 px-3">Dst. Address</th>
  880. <th class="py-2.5 px-3">Action</th>
  881. <th class="py-2.5 px-3">New Mark / Value</th>
  882. <th class="py-2.5 px-3 text-center">Pass</th>
  883. <th class="py-2.5 px-3">Packets / Bytes</th>
  884. <th class="py-2.5 px-3">Comment</th>
  885. <th class="py-2.5 px-3 text-right font-sans">Order & Actions</th>
  886. </tr>
  887. </thead>
  888. <tbody id="mangle-table-body" class="divide-y divide-slate-800/80"></tbody>
  889. </table>
  890. </div>
  891. <div id="mangle-empty" class="hidden p-10 text-center text-slate-500 text-xs font-sans">
  892. No mangle rules configured. Click "+ Add Rule" to mark connections or routing for Multi-WAN.
  893. </div>
  894. </div>
  895. <!-- ================= TAB 4: ADDRESS LISTS ================= -->
  896. <div id="fw-subtab-addrlist" class="hidden bg-slate-900/90 border border-slate-800 rounded-xl overflow-hidden">
  897. <div class="p-4 border-b border-slate-800 flex items-center justify-between flex-wrap gap-3">
  898. <div class="flex items-center gap-3">
  899. <h3 class="text-sm font-bold text-white">Address Lists (ipset)</h3>
  900. <span id="addrlist-count-badge" class="text-xs font-mono text-slate-400">0 Entries</span>
  901. </div>
  902. <div class="flex items-center gap-2">
  903. <label class="text-xs text-slate-400 font-sans">List:</label>
  904. <select id="addrlist-filter-name" onchange="renderAddressLists()" class="bg-slate-800 border border-slate-700 rounded-lg px-2.5 py-1 text-xs text-white font-mono">
  905. <option value="">All Lists</option>
  906. </select>
  907. </div>
  908. </div>
  909. <div class="overflow-x-auto">
  910. <table class="w-full text-left text-xs font-mono">
  911. <thead class="text-slate-400 bg-slate-950/60 border-b border-slate-800 uppercase tracking-wider text-[10px] font-sans">
  912. <tr>
  913. <th class="py-2.5 px-3 w-10 text-center">#</th>
  914. <th class="py-2.5 px-3 w-12 text-center">Flag</th>
  915. <th class="py-2.5 px-3">List Name</th>
  916. <th class="py-2.5 px-3">IP Address / CIDR</th>
  917. <th class="py-2.5 px-3">Comment</th>
  918. <th class="py-2.5 px-3 text-right font-sans">Actions</th>
  919. </tr>
  920. </thead>
  921. <tbody id="addrlist-table-body" class="divide-y divide-slate-800/80"></tbody>
  922. </table>
  923. </div>
  924. <div id="addrlist-empty" class="hidden p-10 text-center text-slate-500 text-xs font-sans">
  925. No address list entries configured. Click "+ Add Item" to define a group of IPs/subnets.
  926. </div>
  927. </div>
  928. <!-- ================= TAB 5: ACTIVE CONNECTIONS ================= -->
  929. <div id="fw-subtab-connections" class="hidden bg-slate-900/90 border border-slate-800 rounded-xl overflow-hidden">
  930. <div class="p-4 border-b border-slate-800 flex items-center justify-between flex-wrap gap-3">
  931. <div class="flex items-center gap-3">
  932. <h3 class="text-sm font-bold text-white">Active Conntrack Connections</h3>
  933. <span id="conns-count-badge" class="text-xs font-mono bg-emerald-500/10 text-emerald-400 border border-emerald-500/30 px-2 py-0.5 rounded-full">0 Flows</span>
  934. </div>
  935. <div class="flex items-center gap-2 flex-wrap">
  936. <input type="text" id="conns-search-input" oninput="renderConnections()" placeholder="Filter IP, port..." class="bg-slate-800 border border-slate-700 rounded-lg px-3 py-1 text-xs text-white font-mono focus:outline-none focus:border-emerald-500">
  937. <select id="conns-filter-proto" onchange="renderConnections()" class="bg-slate-800 border border-slate-700 rounded-lg px-2 py-1 text-xs text-white font-mono">
  938. <option value="">All Proto</option>
  939. <option value="TCP">TCP</option>
  940. <option value="UDP">UDP</option>
  941. <option value="ICMP">ICMP</option>
  942. </select>
  943. <button onclick="loadConnections()" class="text-xs text-emerald-400 hover:text-emerald-300 font-semibold px-2 py-1 bg-slate-800 rounded border border-slate-700">Refresh</button>
  944. </div>
  945. </div>
  946. <div class="overflow-x-auto max-h-[550px] overflow-y-auto">
  947. <table class="w-full text-left text-xs font-mono">
  948. <thead class="text-slate-400 bg-slate-950/80 border-b border-slate-800 uppercase tracking-wider text-[10px] font-sans sticky top-0 z-10 backdrop-blur-sm">
  949. <tr>
  950. <th class="py-2.5 px-3">Proto</th>
  951. <th class="py-2.5 px-3">Source Address</th>
  952. <th class="py-2.5 px-3">Destination Address</th>
  953. <th class="py-2.5 px-3">Reply Source</th>
  954. <th class="py-2.5 px-3">Reply Dest</th>
  955. <th class="py-2.5 px-3">TCP State</th>
  956. <th class="py-2.5 px-3">Mark</th>
  957. <th class="py-2.5 px-3">Timeout</th>
  958. <th class="py-2.5 px-3 text-right font-sans">Action</th>
  959. </tr>
  960. </thead>
  961. <tbody id="conns-table-body" class="divide-y divide-slate-800/60"></tbody>
  962. </table>
  963. </div>
  964. <div id="conns-empty" class="hidden p-10 text-center text-slate-500 text-xs font-sans">
  965. No active connections found matching your search.
  966. </div>
  967. </div>
  968. </section>
  969. <!-- ================= SECTION: ROUTES & POLICY (/ip route & rules) ================= -->
  970. <section id="section-routes" class="hidden space-y-6">
  971. <div class="bg-gradient-to-r from-cyan-950/40 via-slate-900 to-slate-900 border border-cyan-900/30 rounded-xl p-5 flex flex-wrap items-center justify-between gap-4">
  972. <div>
  973. <div class="flex items-center gap-2 mb-1">
  974. <span class="px-2 py-0.5 rounded text-[10px] font-mono bg-cyan-500/20 text-cyan-300 border border-cyan-500/30 font-semibold">/ip route</span>
  975. <h2 class="text-base font-bold text-white">IP Routes & Policy Rules</h2>
  976. </div>
  977. <p class="text-xs text-slate-400">Kernel FIB/RIB routing tables, static gateways, multipath uplinks, and policy routing (ip rule / fwmark lookup).</p>
  978. </div>
  979. <div class="flex items-center space-x-2.5">
  980. <button onclick="openAddRouteModal()" class="text-xs font-semibold px-4 py-2 rounded-lg bg-cyan-600 hover:bg-cyan-500 text-white shadow-lg shadow-cyan-500/20 transition">
  981. + Add Route
  982. </button>
  983. <button onclick="openAddPolicyRuleModal()" class="text-xs font-semibold px-3 py-2 rounded-lg bg-slate-800 hover:bg-slate-700 text-white border border-slate-700 transition">
  984. + Add Rule
  985. </button>
  986. <button onclick="openAddTableModal()" class="text-xs font-semibold px-3 py-2 rounded-lg bg-slate-800 hover:bg-slate-700 text-slate-300 border border-slate-700 transition">
  987. + New Table
  988. </button>
  989. </div>
  990. </div>
  991. <!-- Sub Tabs: Routes / Policy Rules / Tables -->
  992. <div class="flex border-b border-slate-800 space-x-1">
  993. <button id="routes-subtab-btn-routes" onclick="switchRoutesSubTab('routes')" class="px-4 py-2.5 text-xs font-bold border-b-2 border-cyan-500 text-white transition flex items-center gap-2">
  994. <span>Routes</span>
  995. <span id="routes-badge-routes" class="px-1.5 py-0.2 rounded text-[10px] bg-slate-800 text-slate-300">0</span>
  996. </button>
  997. <button id="routes-subtab-btn-rules" onclick="switchRoutesSubTab('rules')" class="px-4 py-2.5 text-xs font-bold border-b-2 border-transparent text-slate-400 hover:text-slate-200 transition flex items-center gap-2">
  998. <span>Policy Rules (/ip route rule)</span>
  999. <span id="routes-badge-rules" class="px-1.5 py-0.2 rounded text-[10px] bg-slate-800 text-slate-300">0</span>
  1000. </button>
  1001. <button id="routes-subtab-btn-tables" onclick="switchRoutesSubTab('tables')" class="px-4 py-2.5 text-xs font-bold border-b-2 border-transparent text-slate-400 hover:text-slate-200 transition flex items-center gap-2">
  1002. <span>Routing Tables</span>
  1003. <span id="routes-badge-tables" class="px-1.5 py-0.2 rounded text-[10px] bg-slate-800 text-slate-300">0</span>
  1004. </button>
  1005. </div>
  1006. <!-- Sub-Tab 1: Routes Table -->
  1007. <div id="routes-subtab-routes" class="bg-slate-900/90 border border-slate-800 rounded-xl overflow-hidden">
  1008. <div class="p-4 border-b border-slate-800 flex items-center justify-between flex-wrap gap-3">
  1009. <div class="flex items-center gap-3">
  1010. <h3 class="text-sm font-bold text-white">Active Routing Table (RIB)</h3>
  1011. <span id="routes-count-badge" class="text-xs font-mono text-slate-400">0 Routes</span>
  1012. </div>
  1013. <div class="flex items-center gap-2">
  1014. <label class="text-xs text-slate-400 font-sans">Table Filter:</label>
  1015. <select id="routes-filter-table" onchange="renderRoutesList()" class="bg-slate-800 border border-slate-700 rounded-lg px-2.5 py-1 text-xs text-white font-mono">
  1016. <option value="">All Tables</option>
  1017. <option value="main">main</option>
  1018. </select>
  1019. <button onclick="loadRoutes()" class="text-xs text-cyan-400 hover:text-cyan-300 font-semibold px-2 py-1 bg-slate-800 rounded border border-slate-700">Refresh</button>
  1020. </div>
  1021. </div>
  1022. <div class="overflow-x-auto">
  1023. <table class="w-full text-left text-xs font-mono">
  1024. <thead class="text-slate-400 bg-slate-950/60 border-b border-slate-800 uppercase tracking-wider text-[10px] font-sans">
  1025. <tr>
  1026. <th class="py-2.5 px-3 w-16 text-center" title="Flags: D=Dynamic, A=Active, C=Connect, S=Static, X=Disabled">Flags</th>
  1027. <th class="py-2.5 px-3">Dst. Address</th>
  1028. <th class="py-2.5 px-3">Gateway</th>
  1029. <th class="py-2.5 px-3">Distance</th>
  1030. <th class="py-2.5 px-3">Table / Mark</th>
  1031. <th class="py-2.5 px-3">Interface</th>
  1032. <th class="py-2.5 px-3">Comment</th>
  1033. <th class="py-2.5 px-3 text-right font-sans">Actions</th>
  1034. </tr>
  1035. </thead>
  1036. <tbody id="routes-table-body" class="divide-y divide-slate-800/80"></tbody>
  1037. </table>
  1038. </div>
  1039. <div id="routes-empty" class="hidden p-10 text-center text-slate-500 text-xs font-sans">
  1040. No routes found.
  1041. </div>
  1042. </div>
  1043. <!-- Sub-Tab 2: Policy Rules (/ip route rule) -->
  1044. <div id="routes-subtab-rules" class="hidden bg-slate-900/90 border border-slate-800 rounded-xl overflow-hidden">
  1045. <div class="p-4 border-b border-slate-800 flex items-center justify-between">
  1046. <h3 class="text-sm font-bold text-white">Policy Routing Rules (ip rule)</h3>
  1047. <span id="rules-count-badge" class="text-xs font-mono text-slate-400">0 Rules</span>
  1048. </div>
  1049. <div class="overflow-x-auto">
  1050. <table class="w-full text-left text-xs font-mono">
  1051. <thead class="text-slate-400 bg-slate-950/60 border-b border-slate-800 uppercase tracking-wider text-[10px] font-sans">
  1052. <tr>
  1053. <th class="py-2.5 px-3 w-16">Pref</th>
  1054. <th class="py-2.5 px-3">Src. Address</th>
  1055. <th class="py-2.5 px-3">Dst. Address</th>
  1056. <th class="py-2.5 px-3">Routing Mark (fwmark)</th>
  1057. <th class="py-2.5 px-3">Lookup Table</th>
  1058. <th class="py-2.5 px-3">Action</th>
  1059. <th class="py-2.5 px-3 text-right font-sans">Actions</th>
  1060. </tr>
  1061. </thead>
  1062. <tbody id="rules-table-body" class="divide-y divide-slate-800/80"></tbody>
  1063. </table>
  1064. </div>
  1065. <div id="rules-empty" class="hidden p-10 text-center text-slate-500 text-xs font-sans">
  1066. No policy rules configured. Click "+ Add Rule" to route traffic based on routing-mark or source IP.
  1067. </div>
  1068. </div>
  1069. <!-- Sub-Tab 3: Routing Tables -->
  1070. <div id="routes-subtab-tables" class="hidden bg-slate-900/90 border border-slate-800 rounded-xl overflow-hidden">
  1071. <div class="p-4 border-b border-slate-800 flex items-center justify-between">
  1072. <h3 class="text-sm font-bold text-white">Defined Routing Tables (/etc/iproute2/rt_tables)</h3>
  1073. <span id="tables-count-badge" class="text-xs font-mono text-slate-400">0 Tables</span>
  1074. </div>
  1075. <div class="overflow-x-auto">
  1076. <table class="w-full text-left text-xs font-mono">
  1077. <thead class="text-slate-400 bg-slate-950/60 border-b border-slate-800 uppercase tracking-wider text-[10px] font-sans">
  1078. <tr>
  1079. <th class="py-2.5 px-3 w-20">FIB ID</th>
  1080. <th class="py-2.5 px-3">Table Name</th>
  1081. <th class="py-2.5 px-3">Comment / Purpose</th>
  1082. </tr>
  1083. </thead>
  1084. <tbody id="tables-table-body" class="divide-y divide-slate-800/80"></tbody>
  1085. </table>
  1086. </div>
  1087. </div>
  1088. </section>
  1089. <!-- ================= SECTION: DEBIAN CONFIG PERSISTENCE ================= -->
  1090. <section id="section-persistence" class="hidden space-y-6">
  1091. <div class="bg-slate-900/90 border border-slate-800 rounded-xl p-5">
  1092. <div class="flex flex-wrap items-center justify-between gap-4 mb-4">
  1093. <div>
  1094. <h3 class="text-sm font-bold text-white flex items-center gap-2">
  1095. <span>Debian /etc/network/interfaces.d/ Persistence</span>
  1096. <span class="text-[10px] bg-brand-500/20 text-brand-400 px-2 py-0.5 rounded border border-brand-500/30">Debian Native</span>
  1097. </h3>
  1098. <p class="text-xs text-slate-400 mt-1">Changes saved to <code class="text-brand-400">/etc/network/interfaces.d/vlans.cfg</code> survive container reboots.</p>
  1099. </div>
  1100. <div class="flex items-center space-x-3">
  1101. <button onclick="loadDebianConfig()" class="text-xs bg-slate-800 hover:bg-slate-700 text-slate-300 px-3 py-2 rounded-lg border border-slate-700 transition">Re-generate Preview</button>
  1102. <button onclick="saveDebianConfig()" class="flex items-center space-x-2 bg-brand-600 hover:bg-brand-500 text-white font-medium text-xs px-4 py-2 rounded-lg shadow-lg shadow-brand-500/20 transition">
  1103. <span>Save to Debian Config</span>
  1104. </button>
  1105. </div>
  1106. </div>
  1107. <div class="relative">
  1108. <pre id="debian-config-view" class="bg-slate-950 p-4 rounded-lg font-mono text-xs text-slate-300 overflow-x-auto border border-slate-800 max-h-96 leading-relaxed">Loading config preview...</pre>
  1109. </div>
  1110. </div>
  1111. </section>
  1112. </main>
  1113. </div>
  1114. </div>
  1115. <!-- ================= MODAL: CREATE VLAN ================= -->
  1116. <div id="vlan-modal" class="fixed inset-0 bg-slate-950/80 backdrop-blur-sm z-50 hidden flex items-center justify-center p-4">
  1117. <div class="bg-slate-900 border border-slate-800 rounded-2xl w-full max-w-lg shadow-2xl overflow-hidden animate-in">
  1118. <div class="px-6 py-4 border-b border-slate-800 flex items-center justify-between bg-slate-950/40">
  1119. <h3 class="text-sm font-bold text-white">Create New VLAN Interface</h3>
  1120. <button onclick="closeVlanModal()" class="text-slate-400 hover:text-white p-1 rounded-lg">✕</button>
  1121. </div>
  1122. <form id="vlan-form" onsubmit="submitCreateVlan(event)" class="p-6 space-y-4">
  1123. <div>
  1124. <label class="block text-xs font-semibold text-slate-300 mb-1.5">Parent Interface *</label>
  1125. <select id="vlan-parent" onchange="autoSuggestVlanName()" required class="w-full bg-slate-800 border border-slate-700 rounded-lg px-3 py-2 text-xs text-white focus:outline-none focus:border-cyan-500 font-mono"></select>
  1126. </div>
  1127. <div class="grid grid-cols-2 gap-4">
  1128. <div>
  1129. <label class="block text-xs font-semibold text-slate-300 mb-1.5">VLAN ID (1-4094) *</label>
  1130. <input type="number" id="vlan-id" min="1" max="4094" placeholder="10" required oninput="autoSuggestVlanName()" class="w-full bg-slate-800 border border-slate-700 rounded-lg px-3 py-2 text-xs text-white font-mono">
  1131. </div>
  1132. <div>
  1133. <label class="block text-xs font-semibold text-slate-300 mb-1.5">Interface Name</label>
  1134. <input type="text" id="vlan-name" placeholder="eth0.10" class="w-full bg-slate-800 border border-slate-700 rounded-lg px-3 py-2 text-xs text-white font-mono">
  1135. </div>
  1136. </div>
  1137. <div>
  1138. <div class="flex items-center justify-between mb-1.5">
  1139. <label class="text-xs font-semibold text-slate-300">Router IP Address & CIDR</label>
  1140. <div class="flex space-x-1">
  1141. <button type="button" onclick="setSubnetPreset('/24')" class="text-[10px] bg-slate-800 text-slate-400 px-1.5 py-0.5 rounded">/24</button>
  1142. <button type="button" onclick="setSubnetPreset('/23')" class="text-[10px] bg-slate-800 text-slate-400 px-1.5 py-0.5 rounded">/23</button>
  1143. <button type="button" onclick="setSubnetPreset('/16')" class="text-[10px] bg-slate-800 text-slate-400 px-1.5 py-0.5 rounded">/16</button>
  1144. </div>
  1145. </div>
  1146. <input type="text" id="vlan-ip" placeholder="192.168.10.1/24" class="w-full bg-slate-800 border border-slate-700 rounded-lg px-3 py-2 text-xs text-white font-mono">
  1147. </div>
  1148. <div class="grid grid-cols-2 gap-4">
  1149. <div>
  1150. <label class="block text-xs font-semibold text-slate-300 mb-1.5">Role Tag</label>
  1151. <select id="vlan-role" class="w-full bg-slate-800 border border-slate-700 rounded-lg px-3 py-2 text-xs text-white">
  1152. <option value="LAN">LAN</option>
  1153. <option value="GUEST">Guest Network</option>
  1154. <option value="IOT">IoT / Smart Home</option>
  1155. <option value="DMZ">DMZ / Isolated</option>
  1156. <option value="MGMT">Management</option>
  1157. <option value="WAN">WAN / Uplink</option>
  1158. </select>
  1159. </div>
  1160. <div>
  1161. <label class="block text-xs font-semibold text-slate-300 mb-1.5">Description / Alias</label>
  1162. <input type="text" id="vlan-desc" placeholder="Guest WiFi Subnet" class="w-full bg-slate-800 border border-slate-700 rounded-lg px-3 py-2 text-xs text-white">
  1163. </div>
  1164. </div>
  1165. <div class="pt-4 border-t border-slate-800 flex justify-end space-x-3">
  1166. <button type="button" onclick="closeVlanModal()" class="px-4 py-2 rounded-lg text-xs font-medium text-slate-400 hover:bg-slate-800">Cancel</button>
  1167. <button type="submit" id="vlan-submit-btn" class="px-5 py-2 rounded-lg text-xs font-semibold bg-gradient-to-r from-brand-600 to-cyan-600 text-white">Create VLAN</button>
  1168. </div>
  1169. </form>
  1170. </div>
  1171. </div>
  1172. <!-- ================= MODAL: EDIT INTERFACE ================= -->
  1173. <div id="iface-modal" class="fixed inset-0 bg-slate-950/80 backdrop-blur-sm z-50 hidden flex items-center justify-center p-4">
  1174. <div class="bg-slate-900 border border-slate-800 rounded-2xl w-full max-w-lg shadow-2xl overflow-hidden animate-in">
  1175. <div class="px-6 py-4 border-b border-slate-800 flex items-center justify-between bg-slate-950/40">
  1176. <div>
  1177. <h3 class="text-sm font-bold text-white flex items-center gap-2">
  1178. <span id="modal-iface-name">eth0</span>
  1179. <span id="modal-iface-badge" class="text-[10px] font-mono px-2 py-0.5 rounded bg-slate-800 text-slate-300">Ethernet</span>
  1180. </h3>
  1181. </div>
  1182. <button onclick="closeIfaceModal()" class="text-slate-400 hover:text-white p-1 rounded-lg">✕</button>
  1183. </div>
  1184. <div class="p-6 space-y-5">
  1185. <div class="grid grid-cols-2 gap-4 p-3 bg-slate-950/60 rounded-xl border border-slate-800/80">
  1186. <div>
  1187. <span class="block text-[11px] text-slate-400 mb-1">Administrative Link</span>
  1188. <div class="flex items-center space-x-2">
  1189. <button id="modal-btn-up" onclick="setIfaceState(currentModalIface, 'up')" class="px-3 py-1 rounded text-xs font-semibold bg-emerald-600/30 text-emerald-400 border border-emerald-500/40">UP</button>
  1190. <button id="modal-btn-down" onclick="setIfaceState(currentModalIface, 'down')" class="px-3 py-1 rounded text-xs font-semibold bg-slate-800 text-slate-400 hover:bg-rose-600/30 hover:text-rose-400">DOWN</button>
  1191. </div>
  1192. </div>
  1193. <div>
  1194. <span class="block text-[11px] text-slate-400 mb-1">MTU Size</span>
  1195. <div class="flex items-center space-x-2">
  1196. <input type="number" id="modal-iface-mtu" min="68" max="9000" class="w-24 bg-slate-800 border border-slate-700 rounded px-2 py-1 text-xs text-white font-mono">
  1197. <button onclick="applyMTU()" class="text-xs bg-slate-800 hover:bg-slate-700 text-white px-2.5 py-1 rounded border border-slate-700">Set</button>
  1198. </div>
  1199. </div>
  1200. </div>
  1201. <div>
  1202. <label class="block text-xs font-semibold text-slate-300 mb-1.5">Assigned IP Addresses</label>
  1203. <div id="modal-ip-list" class="space-y-1.5 mb-3 font-mono text-xs"></div>
  1204. <div class="flex space-x-2">
  1205. <input type="text" id="modal-new-ip" placeholder="192.168.100.1/24" class="flex-1 bg-slate-800 border border-slate-700 rounded-lg px-3 py-2 text-xs text-white font-mono">
  1206. <button onclick="addInterfaceIP()" class="bg-brand-600 hover:bg-brand-500 text-white px-4 py-2 rounded-lg text-xs font-semibold">+ Add IP</button>
  1207. </div>
  1208. </div>
  1209. <div class="grid grid-cols-2 gap-4">
  1210. <div>
  1211. <label class="block text-xs font-semibold text-slate-300 mb-1.5">Role Tag</label>
  1212. <select id="modal-iface-role" class="w-full bg-slate-800 border border-slate-700 rounded-lg px-3 py-2 text-xs text-white">
  1213. <option value="WAN">WAN / Uplink</option>
  1214. <option value="LAN">LAN</option>
  1215. <option value="DMZ">DMZ</option>
  1216. <option value="GUEST">Guest</option>
  1217. <option value="IOT">IoT</option>
  1218. <option value="MGMT">Management</option>
  1219. </select>
  1220. </div>
  1221. <div>
  1222. <label class="block text-xs font-semibold text-slate-300 mb-1.5">Description</label>
  1223. <input type="text" id="modal-iface-desc" class="w-full bg-slate-800 border border-slate-700 rounded-lg px-3 py-2 text-xs text-white">
  1224. </div>
  1225. </div>
  1226. <div class="pt-4 border-t border-slate-800 flex justify-between items-center">
  1227. <button id="modal-delete-vlan-btn" onclick="confirmDeleteVlan(currentModalIface)" class="hidden text-xs text-rose-400 hover:text-rose-300">Delete VLAN</button>
  1228. <div class="flex space-x-3">
  1229. <button onclick="closeIfaceModal()" class="px-4 py-2 rounded-lg text-xs font-medium text-slate-400 hover:bg-slate-800">Close</button>
  1230. <button onclick="saveInterfaceMetadata()" class="px-5 py-2 rounded-lg text-xs font-semibold bg-brand-600 hover:bg-brand-500 text-white">Save Changes</button>
  1231. </div>
  1232. </div>
  1233. </div>
  1234. </div>
  1235. </div>
  1236. <!-- ================= MODAL: PPPoE CLIENT ================= -->
  1237. <div id="pppoe-modal" class="fixed inset-0 bg-slate-950/80 backdrop-blur-sm z-50 hidden flex items-center justify-center p-4">
  1238. <div class="bg-slate-900 border border-slate-800 rounded-2xl w-full max-w-lg shadow-2xl overflow-hidden animate-in">
  1239. <div class="px-6 py-4 border-b border-slate-800 flex items-center justify-between bg-slate-950/40">
  1240. <h3 id="pppoe-modal-title" class="text-sm font-bold text-white">Add PPPoE Client Interface</h3>
  1241. <button onclick="closePPPoEModal()" class="text-slate-400 hover:text-white p-1 rounded-lg">✕</button>
  1242. </div>
  1243. <form onsubmit="submitSavePPPoE(event)" class="p-6 space-y-4">
  1244. <input type="hidden" id="pppoe-modal-edit-orig">
  1245. <div class="grid grid-cols-2 gap-4">
  1246. <div>
  1247. <label class="block text-xs font-semibold text-slate-300 mb-1.5">Name *</label>
  1248. <input type="text" id="pppoe-modal-name" placeholder="pppoe-out1" required class="w-full bg-slate-800 border border-slate-700 rounded-lg px-3 py-2 text-xs text-white font-mono focus:outline-none focus:border-blue-500">
  1249. </div>
  1250. <div>
  1251. <label class="block text-xs font-semibold text-slate-300 mb-1.5">Interface *</label>
  1252. <select id="pppoe-modal-iface" required class="w-full bg-slate-800 border border-slate-700 rounded-lg px-3 py-2 text-xs text-white font-mono focus:outline-none focus:border-blue-500"></select>
  1253. </div>
  1254. </div>
  1255. <div class="grid grid-cols-2 gap-4">
  1256. <div>
  1257. <label class="block text-xs font-semibold text-slate-300 mb-1.5">Username *</label>
  1258. <input type="text" id="pppoe-modal-user" placeholder="user@isp" required class="w-full bg-slate-800 border border-slate-700 rounded-lg px-3 py-2 text-xs text-white font-mono focus:outline-none focus:border-blue-500">
  1259. </div>
  1260. <div>
  1261. <label class="block text-xs font-semibold text-slate-300 mb-1.5">Password *</label>
  1262. <input type="password" id="pppoe-modal-pass" required class="w-full bg-slate-800 border border-slate-700 rounded-lg px-3 py-2 text-xs text-white font-mono focus:outline-none focus:border-blue-500">
  1263. </div>
  1264. </div>
  1265. <div class="grid grid-cols-2 gap-4">
  1266. <div>
  1267. <label class="block text-xs font-semibold text-slate-300 mb-1.5">Service Name (Optional)</label>
  1268. <input type="text" id="pppoe-modal-service" placeholder="ISP Service" class="w-full bg-slate-800 border border-slate-700 rounded-lg px-3 py-2 text-xs text-white">
  1269. </div>
  1270. <div>
  1271. <label class="block text-xs font-semibold text-slate-300 mb-1.5">MTU</label>
  1272. <input type="number" id="pppoe-modal-mtu" value="1492" min="576" max="1500" class="w-full bg-slate-800 border border-slate-700 rounded-lg px-3 py-2 text-xs text-white font-mono">
  1273. </div>
  1274. </div>
  1275. <div class="grid grid-cols-3 gap-2 pt-2 border-t border-slate-800/80">
  1276. <label class="flex items-center space-x-2 cursor-pointer">
  1277. <input type="checkbox" id="pppoe-modal-defroute" checked class="rounded bg-slate-800 border-slate-700 text-blue-500">
  1278. <span class="text-xs text-slate-300 font-medium">Default Route</span>
  1279. </label>
  1280. <label class="flex items-center space-x-2 cursor-pointer">
  1281. <input type="checkbox" id="pppoe-modal-reconnect" checked class="rounded bg-slate-800 border-slate-700 text-blue-500">
  1282. <span class="text-xs text-slate-300 font-medium">Auto-Reconnect</span>
  1283. </label>
  1284. <label class="flex items-center space-x-2 cursor-pointer">
  1285. <input type="checkbox" id="pppoe-modal-disabled" class="rounded bg-slate-800 border-slate-700 text-rose-500">
  1286. <span class="text-xs text-slate-300 font-medium">Disabled (X)</span>
  1287. </label>
  1288. </div>
  1289. <div class="pt-4 border-t border-slate-800 flex justify-end space-x-3">
  1290. <button type="button" onclick="closePPPoEModal()" class="px-4 py-2 rounded-lg text-xs font-medium text-slate-400 hover:bg-slate-800">Cancel</button>
  1291. <button type="submit" class="px-5 py-2 rounded-lg text-xs font-semibold bg-blue-600 hover:bg-blue-500 text-white shadow-lg shadow-blue-500/20">Save PPPoE</button>
  1292. </div>
  1293. </form>
  1294. </div>
  1295. </div>
  1296. <!-- ================= MODAL: WIREGUARD INTERFACE ================= -->
  1297. <div id="wg-iface-modal" class="fixed inset-0 bg-slate-950/80 backdrop-blur-sm z-50 hidden flex items-center justify-center p-4">
  1298. <div class="bg-slate-900 border border-slate-800 rounded-2xl w-full max-w-lg shadow-2xl overflow-hidden animate-in">
  1299. <div class="px-6 py-4 border-b border-slate-800 flex items-center justify-between bg-slate-950/40">
  1300. <h3 id="wg-iface-modal-title" class="text-sm font-bold text-white">Add WireGuard Interface</h3>
  1301. <button onclick="closeAddWGInterfaceModal()" class="text-slate-400 hover:text-white p-1 rounded-lg">✕</button>
  1302. </div>
  1303. <form onsubmit="submitSaveWGInterface(event)" class="p-6 space-y-4">
  1304. <input type="hidden" id="wg-iface-modal-edit-orig">
  1305. <div class="grid grid-cols-2 gap-4">
  1306. <div>
  1307. <label class="block text-xs font-semibold text-slate-300 mb-1.5">Interface Name *</label>
  1308. <input type="text" id="wg-iface-modal-name" placeholder="wg0" required class="w-full bg-slate-800 border border-slate-700 rounded-lg px-3 py-2 text-xs text-white font-mono focus:outline-none focus:border-rose-500">
  1309. </div>
  1310. <div>
  1311. <label class="block text-xs font-semibold text-slate-300 mb-1.5">Listen Port *</label>
  1312. <input type="number" id="wg-iface-modal-port" value="51820" min="1" max="65535" required class="w-full bg-slate-800 border border-slate-700 rounded-lg px-3 py-2 text-xs text-white font-mono focus:outline-none focus:border-rose-500">
  1313. </div>
  1314. </div>
  1315. <div class="grid grid-cols-2 gap-4">
  1316. <div>
  1317. <label class="block text-xs font-semibold text-slate-300 mb-1.5">Tunnel IP (CIDR) *</label>
  1318. <input type="text" id="wg-iface-modal-addr" placeholder="10.10.0.1/24" required class="w-full bg-slate-800 border border-slate-700 rounded-lg px-3 py-2 text-xs text-white font-mono focus:outline-none focus:border-rose-500">
  1319. </div>
  1320. <div>
  1321. <label class="block text-xs font-semibold text-slate-300 mb-1.5">MTU</label>
  1322. <input type="number" id="wg-iface-modal-mtu" value="1420" min="1280" max="1500" class="w-full bg-slate-800 border border-slate-700 rounded-lg px-3 py-2 text-xs text-white font-mono">
  1323. </div>
  1324. </div>
  1325. <div>
  1326. <div class="flex items-center justify-between mb-1.5">
  1327. <label class="text-xs font-semibold text-slate-300">Public Key</label>
  1328. <button type="button" onclick="generateWGInterfaceKeys()" class="text-[10px] text-cyan-400 hover:text-cyan-300 font-semibold">Generate New Keypair</button>
  1329. </div>
  1330. <input type="text" id="wg-iface-modal-pubkey" readonly class="w-full bg-slate-950 border border-slate-800 rounded-lg px-3 py-2 text-xs text-slate-300 font-mono">
  1331. </div>
  1332. <div>
  1333. <label class="block text-xs font-semibold text-slate-300 mb-1.5">Private Key (Secret) *</label>
  1334. <input type="password" id="wg-iface-modal-privkey" required class="w-full bg-slate-950 border border-slate-800 rounded-lg px-3 py-2 text-xs text-slate-300 font-mono focus:outline-none focus:border-rose-500">
  1335. </div>
  1336. <div class="pt-2">
  1337. <label class="flex items-center space-x-2 cursor-pointer">
  1338. <input type="checkbox" id="wg-iface-modal-disabled" class="rounded bg-slate-800 border-slate-700 text-rose-500">
  1339. <span class="text-xs text-slate-300 font-medium">Disabled (X)</span>
  1340. </label>
  1341. </div>
  1342. <div class="pt-4 border-t border-slate-800 flex justify-end space-x-3">
  1343. <button type="button" onclick="closeAddWGInterfaceModal()" class="px-4 py-2 rounded-lg text-xs font-medium text-slate-400 hover:bg-slate-800">Cancel</button>
  1344. <button type="submit" class="px-5 py-2 rounded-lg text-xs font-semibold bg-rose-600 hover:bg-rose-500 text-white shadow-lg shadow-rose-500/20">Save Interface</button>
  1345. </div>
  1346. </form>
  1347. </div>
  1348. </div>
  1349. <!-- ================= MODAL: ADD WIREGUARD PEER ================= -->
  1350. <div id="wg-peer-modal" class="fixed inset-0 bg-slate-950/80 backdrop-blur-sm z-50 hidden flex items-center justify-center p-4">
  1351. <div class="bg-slate-900 border border-slate-800 rounded-2xl w-full max-w-lg shadow-2xl overflow-hidden animate-in">
  1352. <div class="px-6 py-4 border-b border-slate-800 flex items-center justify-between bg-slate-950/40">
  1353. <h3 id="wg-peer-modal-title" class="text-sm font-bold text-white">Add WireGuard Peer</h3>
  1354. <button onclick="closeAddWGPeerModal()" class="text-slate-400 hover:text-white p-1 rounded-lg">✕</button>
  1355. </div>
  1356. <form onsubmit="submitSaveWGPeer(event)" class="p-6 space-y-4">
  1357. <div class="grid grid-cols-2 gap-4">
  1358. <div>
  1359. <label class="block text-xs font-semibold text-slate-300 mb-1.5">WireGuard Interface *</label>
  1360. <select id="wg-peer-modal-iface" required class="w-full bg-slate-800 border border-slate-700 rounded-lg px-3 py-2 text-xs text-white font-mono focus:outline-none focus:border-rose-500"></select>
  1361. </div>
  1362. <div>
  1363. <label class="block text-xs font-semibold text-slate-300 mb-1.5">Peer Name / Alias *</label>
  1364. <input type="text" id="wg-peer-modal-name" placeholder="Laptop, iPhone, Branch" required class="w-full bg-slate-800 border border-slate-700 rounded-lg px-3 py-2 text-xs text-white">
  1365. </div>
  1366. </div>
  1367. <div>
  1368. <label class="block text-xs font-semibold text-slate-300 mb-1.5">Peer Public Key *</label>
  1369. <input type="text" id="wg-peer-modal-pubkey" placeholder="Base64 44-character public key" required class="w-full bg-slate-800 border border-slate-700 rounded-lg px-3 py-2 text-xs text-white font-mono">
  1370. </div>
  1371. <div>
  1372. <label class="block text-xs font-semibold text-slate-300 mb-1.5">Allowed IPs (CIDR) *</label>
  1373. <input type="text" id="wg-peer-modal-allowedips" placeholder="e.g. 10.10.0.2/32, 192.168.20.0/24" required class="w-full bg-slate-800 border border-slate-700 rounded-lg px-3 py-2 text-xs text-white font-mono">
  1374. </div>
  1375. <div class="grid grid-cols-2 gap-4">
  1376. <div>
  1377. <label class="block text-xs font-semibold text-slate-300 mb-1.5">Endpoint (Optional)</label>
  1378. <input type="text" id="wg-peer-modal-endpoint" placeholder="host:port" class="w-full bg-slate-800 border border-slate-700 rounded-lg px-3 py-2 text-xs text-white font-mono">
  1379. </div>
  1380. <div>
  1381. <label class="block text-xs font-semibold text-slate-300 mb-1.5">Keepalive (sec)</label>
  1382. <input type="number" id="wg-peer-modal-keepalive" value="25" class="w-full bg-slate-800 border border-slate-700 rounded-lg px-3 py-2 text-xs text-white font-mono">
  1383. </div>
  1384. </div>
  1385. <div>
  1386. <label class="block text-xs font-semibold text-slate-300 mb-1.5">Preshared Key (Optional)</label>
  1387. <input type="password" id="wg-peer-modal-preshared" placeholder="Optional PSK for extra post-quantum security" class="w-full bg-slate-800 border border-slate-700 rounded-lg px-3 py-2 text-xs text-white font-mono">
  1388. </div>
  1389. <div class="pt-2">
  1390. <label class="flex items-center space-x-2 cursor-pointer">
  1391. <input type="checkbox" id="wg-peer-modal-disabled" class="rounded bg-slate-800 border-slate-700 text-rose-500">
  1392. <span class="text-xs text-slate-300 font-medium">Disabled (X)</span>
  1393. </label>
  1394. </div>
  1395. <div class="pt-4 border-t border-slate-800 flex justify-end space-x-3">
  1396. <button type="button" onclick="closeAddWGPeerModal()" class="px-4 py-2 rounded-lg text-xs font-medium text-slate-400 hover:bg-slate-800">Cancel</button>
  1397. <button type="submit" class="px-5 py-2 rounded-lg text-xs font-semibold bg-rose-600 hover:bg-rose-500 text-white">Save Peer</button>
  1398. </div>
  1399. </form>
  1400. </div>
  1401. </div>
  1402. <!-- ================= MODAL: IPSEC TUNNEL ================= -->
  1403. <div id="ipsec-modal" class="fixed inset-0 bg-slate-950/80 backdrop-blur-sm z-50 hidden flex items-center justify-center p-4">
  1404. <div class="bg-slate-900 border border-slate-800 rounded-2xl w-full max-w-lg shadow-2xl overflow-hidden animate-in">
  1405. <div class="px-6 py-4 border-b border-slate-800 flex items-center justify-between bg-slate-950/40">
  1406. <h3 id="ipsec-modal-title" class="text-sm font-bold text-white">Configure IPSec IKEv2 Tunnel</h3>
  1407. <button onclick="closeAddIPSecModal()" class="text-slate-400 hover:text-white p-1 rounded-lg">✕</button>
  1408. </div>
  1409. <form onsubmit="submitSaveIPSec(event)" class="p-6 space-y-4">
  1410. <div>
  1411. <label class="block text-xs font-semibold text-slate-300 mb-1.5">Connection Name *</label>
  1412. <input type="text" id="ipsec-modal-name" placeholder="e.g. site-to-site-office" required class="w-full bg-slate-800 border border-slate-700 rounded-lg px-3 py-2 text-xs text-white font-mono">
  1413. </div>
  1414. <div class="grid grid-cols-2 gap-4">
  1415. <div>
  1416. <label class="block text-xs font-semibold text-slate-300 mb-1.5">Local Subnet *</label>
  1417. <input type="text" id="ipsec-modal-localts" placeholder="192.168.10.0/24" required class="w-full bg-slate-800 border border-slate-700 rounded-lg px-3 py-2 text-xs text-white font-mono">
  1418. </div>
  1419. <div>
  1420. <label class="block text-xs font-semibold text-slate-300 mb-1.5">Remote Subnet *</label>
  1421. <input type="text" id="ipsec-modal-remotets" placeholder="192.168.20.0/24" required class="w-full bg-slate-800 border border-slate-700 rounded-lg px-3 py-2 text-xs text-white font-mono">
  1422. </div>
  1423. </div>
  1424. <div>
  1425. <label class="block text-xs font-semibold text-slate-300 mb-1.5">Remote Gateway IP / FQDN *</label>
  1426. <input type="text" id="ipsec-modal-remotegw" placeholder="203.0.113.50 or vpn.remote.com" required class="w-full bg-slate-800 border border-slate-700 rounded-lg px-3 py-2 text-xs text-white font-mono">
  1427. </div>
  1428. <div>
  1429. <label class="block text-xs font-semibold text-slate-300 mb-1.5">Pre-Shared Key (PSK) *</label>
  1430. <input type="password" id="ipsec-modal-psk" placeholder="Secret Pre-Shared Key" required class="w-full bg-slate-800 border border-slate-700 rounded-lg px-3 py-2 text-xs text-white font-mono">
  1431. </div>
  1432. <div class="grid grid-cols-2 gap-4">
  1433. <div>
  1434. <label class="block text-xs font-semibold text-slate-300 mb-1.5">IKE Proposals</label>
  1435. <input type="text" id="ipsec-modal-ikeprop" value="aes256-sha256-modp2048,default" class="w-full bg-slate-800 border border-slate-700 rounded-lg px-3 py-2 text-[11px] text-white font-mono">
  1436. </div>
  1437. <div>
  1438. <label class="block text-xs font-semibold text-slate-300 mb-1.5">ESP Proposals</label>
  1439. <input type="text" id="ipsec-modal-espprop" value="aes256-sha256-modp2048,default" class="w-full bg-slate-800 border border-slate-700 rounded-lg px-3 py-2 text-[11px] text-white font-mono">
  1440. </div>
  1441. </div>
  1442. <div class="grid grid-cols-2 gap-4 pt-2">
  1443. <label class="flex items-center space-x-2 cursor-pointer">
  1444. <input type="checkbox" id="ipsec-modal-autostart" checked class="rounded bg-slate-800 border-slate-700 text-amber-500">
  1445. <span class="text-xs text-slate-300 font-medium">Auto-start on boot</span>
  1446. </label>
  1447. <label class="flex items-center space-x-2 cursor-pointer">
  1448. <input type="checkbox" id="ipsec-modal-disabled" class="rounded bg-slate-800 border-slate-700 text-rose-500">
  1449. <span class="text-xs text-slate-300 font-medium">Disabled (X)</span>
  1450. </label>
  1451. </div>
  1452. <div class="pt-4 border-t border-slate-800 flex justify-end space-x-3">
  1453. <button type="button" onclick="closeAddIPSecModal()" class="px-4 py-2 rounded-lg text-xs font-medium text-slate-400 hover:bg-slate-800">Cancel</button>
  1454. <button type="submit" class="px-5 py-2 rounded-lg text-xs font-semibold bg-amber-600 hover:bg-amber-500 text-white">Save Tunnel</button>
  1455. </div>
  1456. </form>
  1457. </div>
  1458. </div>
  1459. <!-- ================= MODAL: L2TP CLIENT ================= -->
  1460. <div id="l2tp-modal" class="fixed inset-0 bg-slate-950/80 backdrop-blur-sm z-50 hidden flex items-center justify-center p-4">
  1461. <div class="bg-slate-900 border border-slate-800 rounded-2xl w-full max-w-lg shadow-2xl overflow-hidden animate-in">
  1462. <div class="px-6 py-4 border-b border-slate-800 flex items-center justify-between bg-slate-950/40">
  1463. <h3 id="l2tp-modal-title" class="text-sm font-bold text-white">Add L2TP Client Interface</h3>
  1464. <button onclick="closeL2TPModal()" class="text-slate-400 hover:text-white p-1 rounded-lg">✕</button>
  1465. </div>
  1466. <form onsubmit="submitSaveL2TP(event)" class="p-6 space-y-4">
  1467. <div>
  1468. <label class="block text-xs font-semibold text-slate-300 mb-1.5">Client Interface Name *</label>
  1469. <input type="text" id="l2tp-modal-name" placeholder="l2tp-out1" required class="w-full bg-slate-800 border border-slate-700 rounded-lg px-3 py-2 text-xs text-white font-mono focus:outline-none focus:border-cyan-500">
  1470. </div>
  1471. <div>
  1472. <label class="block text-xs font-semibold text-slate-300 mb-1.5">Connect To (Server IP / Host) *</label>
  1473. <input type="text" id="l2tp-modal-server" placeholder="vpn.example.com or 203.0.113.1" required class="w-full bg-slate-800 border border-slate-700 rounded-lg px-3 py-2 text-xs text-white font-mono focus:outline-none focus:border-cyan-500">
  1474. </div>
  1475. <div class="grid grid-cols-2 gap-4">
  1476. <div>
  1477. <label class="block text-xs font-semibold text-slate-300 mb-1.5">Username *</label>
  1478. <input type="text" id="l2tp-modal-user" required class="w-full bg-slate-800 border border-slate-700 rounded-lg px-3 py-2 text-xs text-white font-mono focus:outline-none focus:border-cyan-500">
  1479. </div>
  1480. <div>
  1481. <label class="block text-xs font-semibold text-slate-300 mb-1.5">Password *</label>
  1482. <input type="password" id="l2tp-modal-pass" required class="w-full bg-slate-800 border border-slate-700 rounded-lg px-3 py-2 text-xs text-white font-mono focus:outline-none focus:border-cyan-500">
  1483. </div>
  1484. </div>
  1485. <div>
  1486. <label class="block text-xs font-semibold text-slate-300 mb-1.5">IPSec Secret / PSK (Optional for L2TP/IPsec)</label>
  1487. <input type="password" id="l2tp-modal-ipsec" placeholder="Optional Pre-Shared Key" class="w-full bg-slate-800 border border-slate-700 rounded-lg px-3 py-2 text-xs text-white font-mono">
  1488. </div>
  1489. <div class="grid grid-cols-2 gap-4 pt-2">
  1490. <label class="flex items-center space-x-2 cursor-pointer">
  1491. <input type="checkbox" id="l2tp-modal-defroute" checked class="rounded bg-slate-800 border-slate-700 text-cyan-500">
  1492. <span class="text-xs text-slate-300 font-medium">Default Route</span>
  1493. </label>
  1494. <label class="flex items-center space-x-2 cursor-pointer">
  1495. <input type="checkbox" id="l2tp-modal-disabled" class="rounded bg-slate-800 border-slate-700 text-rose-500">
  1496. <span class="text-xs text-slate-300 font-medium">Disabled (X)</span>
  1497. </label>
  1498. </div>
  1499. <div class="pt-4 border-t border-slate-800 flex justify-end space-x-3">
  1500. <button type="button" onclick="closeL2TPModal()" class="px-4 py-2 rounded-lg text-xs font-medium text-slate-400 hover:bg-slate-800">Cancel</button>
  1501. <button type="submit" class="px-5 py-2 rounded-lg text-xs font-semibold bg-cyan-600 hover:bg-cyan-500 text-white shadow-lg shadow-cyan-500/20">Save L2TP</button>
  1502. </div>
  1503. </form>
  1504. </div>
  1505. </div>
  1506. <!-- ================= MODAL: PPTP CLIENT ================= -->
  1507. <div id="pptp-modal" class="fixed inset-0 bg-slate-950/80 backdrop-blur-sm z-50 hidden flex items-center justify-center p-4">
  1508. <div class="bg-slate-900 border border-slate-800 rounded-2xl w-full max-w-lg shadow-2xl overflow-hidden animate-in">
  1509. <div class="px-6 py-4 border-b border-slate-800 flex items-center justify-between bg-slate-950/40">
  1510. <h3 id="pptp-modal-title" class="text-sm font-bold text-white">Add PPTP Client Interface</h3>
  1511. <button onclick="closePPTPModal()" class="text-slate-400 hover:text-white p-1 rounded-lg">✕</button>
  1512. </div>
  1513. <form onsubmit="submitSavePPTP(event)" class="p-6 space-y-4">
  1514. <div>
  1515. <label class="block text-xs font-semibold text-slate-300 mb-1.5">Client Interface Name *</label>
  1516. <input type="text" id="pptp-modal-name" placeholder="pptp-out1" required class="w-full bg-slate-800 border border-slate-700 rounded-lg px-3 py-2 text-xs text-white font-mono focus:outline-none focus:border-purple-500">
  1517. </div>
  1518. <div>
  1519. <label class="block text-xs font-semibold text-slate-300 mb-1.5">Connect To (Server IP / Host) *</label>
  1520. <input type="text" id="pptp-modal-server" placeholder="vpn.example.com or 203.0.113.1" required class="w-full bg-slate-800 border border-slate-700 rounded-lg px-3 py-2 text-xs text-white font-mono focus:outline-none focus:border-purple-500">
  1521. </div>
  1522. <div class="grid grid-cols-2 gap-4">
  1523. <div>
  1524. <label class="block text-xs font-semibold text-slate-300 mb-1.5">Username *</label>
  1525. <input type="text" id="pptp-modal-user" required class="w-full bg-slate-800 border border-slate-700 rounded-lg px-3 py-2 text-xs text-white font-mono focus:outline-none focus:border-purple-500">
  1526. </div>
  1527. <div>
  1528. <label class="block text-xs font-semibold text-slate-300 mb-1.5">Password *</label>
  1529. <input type="password" id="pptp-modal-pass" required class="w-full bg-slate-800 border border-slate-700 rounded-lg px-3 py-2 text-xs text-white font-mono focus:outline-none focus:border-purple-500">
  1530. </div>
  1531. </div>
  1532. <div class="grid grid-cols-3 gap-2 pt-2 border-t border-slate-800/80">
  1533. <label class="flex items-center space-x-2 cursor-pointer">
  1534. <input type="checkbox" id="pptp-modal-mppe" checked class="rounded bg-slate-800 border-slate-700 text-purple-500">
  1535. <span class="text-xs text-slate-300 font-medium">MPPE-128</span>
  1536. </label>
  1537. <label class="flex items-center space-x-2 cursor-pointer">
  1538. <input type="checkbox" id="pptp-modal-defroute" checked class="rounded bg-slate-800 border-slate-700 text-purple-500">
  1539. <span class="text-xs text-slate-300 font-medium">Default Route</span>
  1540. </label>
  1541. <label class="flex items-center space-x-2 cursor-pointer">
  1542. <input type="checkbox" id="pptp-modal-disabled" class="rounded bg-slate-800 border-slate-700 text-rose-500">
  1543. <span class="text-xs text-slate-300 font-medium">Disabled (X)</span>
  1544. </label>
  1545. </div>
  1546. <div class="pt-4 border-t border-slate-800 flex justify-end space-x-3">
  1547. <button type="button" onclick="closePPTPModal()" class="px-4 py-2 rounded-lg text-xs font-medium text-slate-400 hover:bg-slate-800">Cancel</button>
  1548. <button type="submit" class="px-5 py-2 rounded-lg text-xs font-semibold bg-purple-600 hover:bg-purple-500 text-white shadow-lg shadow-purple-500/20">Save PPTP</button>
  1549. </div>
  1550. </form>
  1551. </div>
  1552. </div>
  1553. <!-- ================= MODAL: FIREWALL FILTER RULE ================= -->
  1554. <div id="filter-modal" class="fixed inset-0 bg-slate-950/80 backdrop-blur-sm z-50 hidden flex items-center justify-center p-4">
  1555. <div class="bg-slate-900 border border-slate-800 rounded-2xl w-full max-w-xl shadow-2xl overflow-hidden animate-in max-h-[90vh] flex flex-col">
  1556. <div class="px-6 py-4 border-b border-slate-800 flex items-center justify-between bg-slate-950/40">
  1557. <h3 id="filter-modal-title" class="text-sm font-bold text-white">Add Firewall Filter Rule</h3>
  1558. <button onclick="closeFilterModal()" class="text-slate-400 hover:text-white p-1 rounded-lg">✕</button>
  1559. </div>
  1560. <form onsubmit="submitSaveFilterRule(event)" class="p-6 space-y-4 overflow-y-auto flex-1 text-xs">
  1561. <input type="hidden" id="filter-modal-id">
  1562. <div class="grid grid-cols-2 gap-4">
  1563. <div>
  1564. <label class="block font-semibold text-slate-300 mb-1">Chain *</label>
  1565. <select id="filter-modal-chain" required class="w-full bg-slate-800 border border-slate-700 rounded-lg px-3 py-2 text-white font-mono focus:outline-none focus:border-emerald-500">
  1566. <option value="input">input (traffic to router)</option>
  1567. <option value="forward" selected>forward (routed traffic)</option>
  1568. <option value="output">output (traffic from router)</option>
  1569. </select>
  1570. </div>
  1571. <div>
  1572. <label class="block font-semibold text-slate-300 mb-1">Action *</label>
  1573. <select id="filter-modal-action" onchange="toggleFilterActionFields()" required class="w-full bg-slate-800 border border-slate-700 rounded-lg px-3 py-2 text-white font-mono focus:outline-none focus:border-emerald-500">
  1574. <option value="accept" selected>accept</option>
  1575. <option value="drop">drop</option>
  1576. <option value="reject">reject</option>
  1577. <option value="log">log</option>
  1578. <option value="jump">jump</option>
  1579. <option value="return">return</option>
  1580. </select>
  1581. </div>
  1582. </div>
  1583. <div id="filter-action-reject-box" class="hidden p-3 bg-rose-950/20 border border-rose-900/30 rounded-lg">
  1584. <label class="block font-semibold text-rose-300 mb-1">Reject With</label>
  1585. <select id="filter-modal-rejectwith" class="w-full bg-slate-800 border border-slate-700 rounded-lg px-3 py-1.5 text-white font-mono">
  1586. <option value="icmp-network-unreachable">icmp-network-unreachable</option>
  1587. <option value="icmp-host-unreachable">icmp-host-unreachable</option>
  1588. <option value="icmp-port-unreachable">icmp-port-unreachable</option>
  1589. <option value="tcp-reset">tcp-reset (TCP RST)</option>
  1590. </select>
  1591. </div>
  1592. <div class="p-3 bg-slate-950/60 border border-slate-800/80 rounded-xl space-y-3">
  1593. <span class="block font-bold text-slate-400 uppercase tracking-wider text-[10px]">Match Properties</span>
  1594. <div class="grid grid-cols-2 gap-3">
  1595. <div>
  1596. <label class="block font-semibold text-slate-300 mb-1">Protocol</label>
  1597. <select id="filter-modal-proto" class="w-full bg-slate-800 border border-slate-700 rounded-lg px-3 py-1.5 text-white font-mono">
  1598. <option value="all">all</option>
  1599. <option value="tcp">tcp (6)</option>
  1600. <option value="udp">udp (17)</option>
  1601. <option value="icmp">icmp (1)</option>
  1602. <option value="gre">gre (47)</option>
  1603. <option value="esp">esp (50)</option>
  1604. </select>
  1605. </div>
  1606. <div>
  1607. <label class="block font-semibold text-slate-300 mb-1">Connection Mark</label>
  1608. <input type="text" id="filter-modal-connmark" placeholder="e.g. wan2_conn" class="w-full bg-slate-800 border border-slate-700 rounded-lg px-3 py-1.5 text-white font-mono">
  1609. </div>
  1610. </div>
  1611. <div class="grid grid-cols-2 gap-3">
  1612. <div>
  1613. <label class="block font-semibold text-slate-300 mb-1">Src. Address / CIDR</label>
  1614. <input type="text" id="filter-modal-src" placeholder="192.168.1.0/24 or !10.0.0.1" class="w-full bg-slate-800 border border-slate-700 rounded-lg px-3 py-1.5 text-white font-mono">
  1615. </div>
  1616. <div>
  1617. <label class="block font-semibold text-slate-300 mb-1">Dst. Address / CIDR</label>
  1618. <input type="text" id="filter-modal-dst" placeholder="0.0.0.0/0 or !192.168.10.1" class="w-full bg-slate-800 border border-slate-700 rounded-lg px-3 py-1.5 text-white font-mono">
  1619. </div>
  1620. </div>
  1621. <div class="grid grid-cols-2 gap-3">
  1622. <div>
  1623. <label class="block font-semibold text-slate-300 mb-1">Src. Port(s)</label>
  1624. <input type="text" id="filter-modal-sport" placeholder="80,443 or 1000-2000" class="w-full bg-slate-800 border border-slate-700 rounded-lg px-3 py-1.5 text-white font-mono">
  1625. </div>
  1626. <div>
  1627. <label class="block font-semibold text-slate-300 mb-1">Dst. Port(s)</label>
  1628. <input type="text" id="filter-modal-dport" placeholder="80,443,8080" class="w-full bg-slate-800 border border-slate-700 rounded-lg px-3 py-1.5 text-white font-mono">
  1629. </div>
  1630. </div>
  1631. <div class="grid grid-cols-2 gap-3">
  1632. <div>
  1633. <label class="block font-semibold text-slate-300 mb-1">In. Interface</label>
  1634. <select id="filter-modal-iniface" class="w-full bg-slate-800 border border-slate-700 rounded-lg px-3 py-1.5 text-white font-mono"></select>
  1635. </div>
  1636. <div>
  1637. <label class="block font-semibold text-slate-300 mb-1">Out. Interface</label>
  1638. <select id="filter-modal-outiface" class="w-full bg-slate-800 border border-slate-700 rounded-lg px-3 py-1.5 text-white font-mono"></select>
  1639. </div>
  1640. </div>
  1641. <div>
  1642. <label class="block font-semibold text-slate-300 mb-1.5">Connection State</label>
  1643. <div class="flex flex-wrap gap-3">
  1644. <label class="flex items-center space-x-1.5 cursor-pointer">
  1645. <input type="checkbox" id="filter-modal-cs-established" class="rounded bg-slate-800 border-slate-700 text-emerald-500">
  1646. <span class="text-slate-300">established</span>
  1647. </label>
  1648. <label class="flex items-center space-x-1.5 cursor-pointer">
  1649. <input type="checkbox" id="filter-modal-cs-related" class="rounded bg-slate-800 border-slate-700 text-emerald-500">
  1650. <span class="text-slate-300">related</span>
  1651. </label>
  1652. <label class="flex items-center space-x-1.5 cursor-pointer">
  1653. <input type="checkbox" id="filter-modal-cs-new" class="rounded bg-slate-800 border-slate-700 text-emerald-500">
  1654. <span class="text-slate-300">new</span>
  1655. </label>
  1656. <label class="flex items-center space-x-1.5 cursor-pointer">
  1657. <input type="checkbox" id="filter-modal-cs-invalid" class="rounded bg-slate-800 border-slate-700 text-rose-500">
  1658. <span class="text-slate-300">invalid</span>
  1659. </label>
  1660. </div>
  1661. </div>
  1662. <div class="grid grid-cols-2 gap-3">
  1663. <div>
  1664. <label class="block font-semibold text-slate-300 mb-1">Src. Address List</label>
  1665. <select id="filter-modal-srclist" class="w-full bg-slate-800 border border-slate-700 rounded-lg px-3 py-1.5 text-white font-mono">
  1666. <option value="">(None)</option>
  1667. </select>
  1668. </div>
  1669. <div>
  1670. <label class="block font-semibold text-slate-300 mb-1">Dst. Address List</label>
  1671. <select id="filter-modal-dstlist" class="w-full bg-slate-800 border border-slate-700 rounded-lg px-3 py-1.5 text-white font-mono">
  1672. <option value="">(None)</option>
  1673. </select>
  1674. </div>
  1675. </div>
  1676. </div>
  1677. <div>
  1678. <label class="block font-semibold text-slate-300 mb-1">Comment</label>
  1679. <input type="text" id="filter-modal-comment" placeholder="e.g. Drop invalid packets" class="w-full bg-slate-800 border border-slate-700 rounded-lg px-3 py-1.5 text-white">
  1680. </div>
  1681. <div class="pt-2">
  1682. <label class="flex items-center space-x-2 cursor-pointer">
  1683. <input type="checkbox" id="filter-modal-disabled" class="rounded bg-slate-800 border-slate-700 text-rose-500">
  1684. <span class="font-medium text-slate-300">Disabled (X)</span>
  1685. </label>
  1686. </div>
  1687. <div class="pt-4 border-t border-slate-800 flex justify-end space-x-3">
  1688. <button type="button" onclick="closeFilterModal()" class="px-4 py-2 rounded-lg text-slate-400 hover:bg-slate-800">Cancel</button>
  1689. <button type="submit" class="px-5 py-2 rounded-lg font-semibold bg-emerald-600 hover:bg-emerald-500 text-white shadow-lg shadow-emerald-500/20">Save Filter Rule</button>
  1690. </div>
  1691. </form>
  1692. </div>
  1693. </div>
  1694. <!-- ================= MODAL: FIREWALL NAT RULE ================= -->
  1695. <div id="nat-modal" class="fixed inset-0 bg-slate-950/80 backdrop-blur-sm z-50 hidden flex items-center justify-center p-4">
  1696. <div class="bg-slate-900 border border-slate-800 rounded-2xl w-full max-w-xl shadow-2xl overflow-hidden animate-in max-h-[90vh] flex flex-col">
  1697. <div class="px-6 py-4 border-b border-slate-800 flex items-center justify-between bg-slate-950/40">
  1698. <h3 id="nat-modal-title" class="text-sm font-bold text-white">Add NAT Rule</h3>
  1699. <button onclick="closeNATModal()" class="text-slate-400 hover:text-white p-1 rounded-lg">✕</button>
  1700. </div>
  1701. <form onsubmit="submitSaveNATRule(event)" class="p-6 space-y-4 overflow-y-auto flex-1 text-xs">
  1702. <input type="hidden" id="nat-modal-id">
  1703. <div class="grid grid-cols-2 gap-4">
  1704. <div>
  1705. <label class="block font-semibold text-slate-300 mb-1">Chain *</label>
  1706. <select id="nat-modal-chain" onchange="toggleNATChainFields()" required class="w-full bg-slate-800 border border-slate-700 rounded-lg px-3 py-2 text-white font-mono focus:outline-none focus:border-emerald-500">
  1707. <option value="srcnat" selected>srcnat (Outgoing / Masquerade)</option>
  1708. <option value="dstnat">dstnat (Incoming / Port Forwarding)</option>
  1709. </select>
  1710. </div>
  1711. <div>
  1712. <label class="block font-semibold text-slate-300 mb-1">Action *</label>
  1713. <select id="nat-modal-action" onchange="toggleNATActionFields()" required class="w-full bg-slate-800 border border-slate-700 rounded-lg px-3 py-2 text-white font-mono focus:outline-none focus:border-emerald-500">
  1714. <option value="masquerade" selected>masquerade</option>
  1715. <option value="src-nat">src-nat</option>
  1716. <option value="dst-nat">dst-nat</option>
  1717. <option value="redirect">redirect</option>
  1718. <option value="accept">accept</option>
  1719. </select>
  1720. </div>
  1721. </div>
  1722. <div id="nat-action-to-box" class="p-3 bg-slate-950/60 border border-slate-800/80 rounded-xl space-y-3">
  1723. <span class="block font-bold text-slate-400 uppercase tracking-wider text-[10px]">NAT Target (To Addresses / Ports)</span>
  1724. <div class="grid grid-cols-2 gap-3">
  1725. <div>
  1726. <label class="block font-semibold text-slate-300 mb-1">To Addresses</label>
  1727. <input type="text" id="nat-modal-toaddr" placeholder="192.168.10.50" class="w-full bg-slate-800 border border-slate-700 rounded-lg px-3 py-1.5 text-white font-mono">
  1728. </div>
  1729. <div>
  1730. <label class="block font-semibold text-slate-300 mb-1">To Ports</label>
  1731. <input type="text" id="nat-modal-toport" placeholder="80 or 8080" class="w-full bg-slate-800 border border-slate-700 rounded-lg px-3 py-1.5 text-white font-mono">
  1732. </div>
  1733. </div>
  1734. </div>
  1735. <div class="p-3 bg-slate-950/60 border border-slate-800/80 rounded-xl space-y-3">
  1736. <span class="block font-bold text-slate-400 uppercase tracking-wider text-[10px]">Match Properties</span>
  1737. <div class="grid grid-cols-2 gap-3">
  1738. <div>
  1739. <label class="block font-semibold text-slate-300 mb-1">Protocol</label>
  1740. <select id="nat-modal-proto" class="w-full bg-slate-800 border border-slate-700 rounded-lg px-3 py-1.5 text-white font-mono">
  1741. <option value="all">all</option>
  1742. <option value="tcp">tcp</option>
  1743. <option value="udp">udp</option>
  1744. <option value="icmp">icmp</option>
  1745. </select>
  1746. </div>
  1747. <div>
  1748. <label class="block font-semibold text-slate-300 mb-1">Dst. Port(s)</label>
  1749. <input type="text" id="nat-modal-dport" placeholder="80,443" class="w-full bg-slate-800 border border-slate-700 rounded-lg px-3 py-1.5 text-white font-mono">
  1750. </div>
  1751. </div>
  1752. <div class="grid grid-cols-2 gap-3">
  1753. <div>
  1754. <label class="block font-semibold text-slate-300 mb-1">Src. Address / CIDR</label>
  1755. <input type="text" id="nat-modal-src" placeholder="192.168.10.0/24" class="w-full bg-slate-800 border border-slate-700 rounded-lg px-3 py-1.5 text-white font-mono">
  1756. </div>
  1757. <div>
  1758. <label class="block font-semibold text-slate-300 mb-1">Dst. Address / CIDR</label>
  1759. <input type="text" id="nat-modal-dst" placeholder="e.g. WAN Public IP" class="w-full bg-slate-800 border border-slate-700 rounded-lg px-3 py-1.5 text-white font-mono">
  1760. </div>
  1761. </div>
  1762. <div class="grid grid-cols-2 gap-3">
  1763. <div>
  1764. <label class="block font-semibold text-slate-300 mb-1">In. Interface</label>
  1765. <select id="nat-modal-iniface" class="w-full bg-slate-800 border border-slate-700 rounded-lg px-3 py-1.5 text-white font-mono"></select>
  1766. </div>
  1767. <div>
  1768. <label class="block font-semibold text-slate-300 mb-1">Out. Interface</label>
  1769. <select id="nat-modal-outiface" class="w-full bg-slate-800 border border-slate-700 rounded-lg px-3 py-1.5 text-white font-mono"></select>
  1770. </div>
  1771. </div>
  1772. </div>
  1773. <div>
  1774. <label class="block font-semibold text-slate-300 mb-1">Comment</label>
  1775. <input type="text" id="nat-modal-comment" placeholder="e.g. Masquerade to WAN" class="w-full bg-slate-800 border border-slate-700 rounded-lg px-3 py-1.5 text-white">
  1776. </div>
  1777. <div class="pt-2">
  1778. <label class="flex items-center space-x-2 cursor-pointer">
  1779. <input type="checkbox" id="nat-modal-disabled" class="rounded bg-slate-800 border-slate-700 text-rose-500">
  1780. <span class="font-medium text-slate-300">Disabled (X)</span>
  1781. </label>
  1782. </div>
  1783. <div class="pt-4 border-t border-slate-800 flex justify-end space-x-3">
  1784. <button type="button" onclick="closeNATModal()" class="px-4 py-2 rounded-lg text-slate-400 hover:bg-slate-800">Cancel</button>
  1785. <button type="submit" class="px-5 py-2 rounded-lg font-semibold bg-emerald-600 hover:bg-emerald-500 text-white shadow-lg shadow-emerald-500/20">Save NAT Rule</button>
  1786. </div>
  1787. </form>
  1788. </div>
  1789. </div>
  1790. <!-- ================= MODAL: FIREWALL MANGLE RULE ================= -->
  1791. <div id="mangle-modal" class="fixed inset-0 bg-slate-950/80 backdrop-blur-sm z-50 hidden flex items-center justify-center p-4">
  1792. <div class="bg-slate-900 border border-slate-800 rounded-2xl w-full max-w-xl shadow-2xl overflow-hidden animate-in max-h-[90vh] flex flex-col">
  1793. <div class="px-6 py-4 border-b border-slate-800 flex items-center justify-between bg-slate-950/40">
  1794. <h3 id="mangle-modal-title" class="text-sm font-bold text-white">Add Mangle Rule</h3>
  1795. <button onclick="closeMangleModal()" class="text-slate-400 hover:text-white p-1 rounded-lg">✕</button>
  1796. </div>
  1797. <form onsubmit="submitSaveMangleRule(event)" class="p-6 space-y-4 overflow-y-auto flex-1 text-xs">
  1798. <input type="hidden" id="mangle-modal-id">
  1799. <div class="grid grid-cols-2 gap-4">
  1800. <div>
  1801. <label class="block font-semibold text-slate-300 mb-1">Chain *</label>
  1802. <select id="mangle-modal-chain" required class="w-full bg-slate-800 border border-slate-700 rounded-lg px-3 py-2 text-white font-mono focus:outline-none focus:border-emerald-500">
  1803. <option value="prerouting" selected>prerouting (Policy Routing / Marks)</option>
  1804. <option value="forward">forward</option>
  1805. <option value="postrouting">postrouting</option>
  1806. <option value="input">input</option>
  1807. <option value="output">output</option>
  1808. </select>
  1809. </div>
  1810. <div>
  1811. <label class="block font-semibold text-slate-300 mb-1">Action *</label>
  1812. <select id="mangle-modal-action" onchange="toggleMangleActionFields()" required class="w-full bg-slate-800 border border-slate-700 rounded-lg px-3 py-2 text-white font-mono focus:outline-none focus:border-emerald-500">
  1813. <option value="mark-connection" selected>mark-connection</option>
  1814. <option value="mark-routing">mark-routing (Policy Routing)</option>
  1815. <option value="mark-packet">mark-packet (QoS / Queues)</option>
  1816. <option value="change-mss">change-mss (TCP MSS Clamp)</option>
  1817. <option value="set-dscp">set-dscp</option>
  1818. <option value="accept">accept</option>
  1819. </select>
  1820. </div>
  1821. </div>
  1822. <div id="mangle-target-box" class="p-3 bg-slate-950/60 border border-slate-800/80 rounded-xl space-y-3">
  1823. <span class="block font-bold text-slate-400 uppercase tracking-wider text-[10px]">Mark Target & Passthrough</span>
  1824. <div class="grid grid-cols-2 gap-3">
  1825. <div id="mangle-field-newmark">
  1826. <label class="block font-semibold text-slate-300 mb-1">New Mark Name</label>
  1827. <input type="text" id="mangle-modal-newmark" placeholder="e.g. wan2_conn or to_WAN2" class="w-full bg-slate-800 border border-slate-700 rounded-lg px-3 py-1.5 text-white font-mono">
  1828. </div>
  1829. <div class="flex items-center pt-5">
  1830. <label class="flex items-center space-x-2 cursor-pointer">
  1831. <input type="checkbox" id="mangle-modal-passthrough" checked class="rounded bg-slate-800 border-slate-700 text-emerald-500">
  1832. <span class="font-medium text-slate-300">Passthrough</span>
  1833. </label>
  1834. </div>
  1835. </div>
  1836. </div>
  1837. <div class="p-3 bg-slate-950/60 border border-slate-800/80 rounded-xl space-y-3">
  1838. <span class="block font-bold text-slate-400 uppercase tracking-wider text-[10px]">Match Criteria</span>
  1839. <div class="grid grid-cols-2 gap-3">
  1840. <div>
  1841. <label class="block font-semibold text-slate-300 mb-1">Src. Address / CIDR</label>
  1842. <input type="text" id="mangle-modal-src" placeholder="192.168.10.0/24" class="w-full bg-slate-800 border border-slate-700 rounded-lg px-3 py-1.5 text-white font-mono">
  1843. </div>
  1844. <div>
  1845. <label class="block font-semibold text-slate-300 mb-1">Dst. Address / CIDR</label>
  1846. <input type="text" id="mangle-modal-dst" placeholder="!192.168.0.0/16" class="w-full bg-slate-800 border border-slate-700 rounded-lg px-3 py-1.5 text-white font-mono">
  1847. </div>
  1848. </div>
  1849. <div class="grid grid-cols-2 gap-3">
  1850. <div>
  1851. <label class="block font-semibold text-slate-300 mb-1">Connection Mark</label>
  1852. <input type="text" id="mangle-modal-connmark" placeholder="e.g. wan2_conn" class="w-full bg-slate-800 border border-slate-700 rounded-lg px-3 py-1.5 text-white font-mono">
  1853. </div>
  1854. <div>
  1855. <label class="block font-semibold text-slate-300 mb-1">In. Interface</label>
  1856. <select id="mangle-modal-iniface" class="w-full bg-slate-800 border border-slate-700 rounded-lg px-3 py-1.5 text-white font-mono"></select>
  1857. </div>
  1858. </div>
  1859. </div>
  1860. <div>
  1861. <label class="block font-semibold text-slate-300 mb-1">Comment</label>
  1862. <input type="text" id="mangle-modal-comment" placeholder="e.g. Mark routing for Office traffic" class="w-full bg-slate-800 border border-slate-700 rounded-lg px-3 py-1.5 text-white">
  1863. </div>
  1864. <div class="pt-2">
  1865. <label class="flex items-center space-x-2 cursor-pointer">
  1866. <input type="checkbox" id="mangle-modal-disabled" class="rounded bg-slate-800 border-slate-700 text-rose-500">
  1867. <span class="font-medium text-slate-300">Disabled (X)</span>
  1868. </label>
  1869. </div>
  1870. <div class="pt-4 border-t border-slate-800 flex justify-end space-x-3">
  1871. <button type="button" onclick="closeMangleModal()" class="px-4 py-2 rounded-lg text-slate-400 hover:bg-slate-800">Cancel</button>
  1872. <button type="submit" class="px-5 py-2 rounded-lg font-semibold bg-emerald-600 hover:bg-emerald-500 text-white shadow-lg shadow-emerald-500/20">Save Mangle Rule</button>
  1873. </div>
  1874. </form>
  1875. </div>
  1876. </div>
  1877. <!-- ================= MODAL: ADDRESS LIST ENTRY ================= -->
  1878. <div id="addrlist-modal" class="fixed inset-0 bg-slate-950/80 backdrop-blur-sm z-50 hidden flex items-center justify-center p-4">
  1879. <div class="bg-slate-900 border border-slate-800 rounded-2xl w-full max-w-md shadow-2xl overflow-hidden animate-in">
  1880. <div class="px-6 py-4 border-b border-slate-800 flex items-center justify-between bg-slate-950/40">
  1881. <h3 id="addrlist-modal-title" class="text-sm font-bold text-white">Add Address List Entry</h3>
  1882. <button onclick="closeAddrListModal()" class="text-slate-400 hover:text-white p-1 rounded-lg">✕</button>
  1883. </div>
  1884. <form onsubmit="submitSaveAddrList(event)" class="p-6 space-y-4 text-xs">
  1885. <div>
  1886. <label class="block font-semibold text-slate-300 mb-1.5">List Name *</label>
  1887. <input type="text" id="addrlist-modal-name" placeholder="e.g. LAN_Subnets, Blocked_IPs" required class="w-full bg-slate-800 border border-slate-700 rounded-lg px-3 py-2 text-white font-mono focus:outline-none focus:border-emerald-500">
  1888. </div>
  1889. <div>
  1890. <label class="block font-semibold text-slate-300 mb-1.5">IP Address / Subnet (CIDR) *</label>
  1891. <input type="text" id="addrlist-modal-addr" placeholder="192.168.10.0/24 or 203.0.113.5" required class="w-full bg-slate-800 border border-slate-700 rounded-lg px-3 py-2 text-white font-mono focus:outline-none focus:border-emerald-500">
  1892. </div>
  1893. <div>
  1894. <label class="block font-semibold text-slate-300 mb-1.5">Comment</label>
  1895. <input type="text" id="addrlist-modal-comment" placeholder="Optional description" class="w-full bg-slate-800 border border-slate-700 rounded-lg px-3 py-2 text-white">
  1896. </div>
  1897. <div class="pt-4 border-t border-slate-800 flex justify-end space-x-3">
  1898. <button type="button" onclick="closeAddrListModal()" class="px-4 py-2 rounded-lg text-slate-400 hover:bg-slate-800">Cancel</button>
  1899. <button type="submit" class="px-5 py-2 rounded-lg font-semibold bg-emerald-600 hover:bg-emerald-500 text-white shadow-lg shadow-emerald-500/20">Add to List</button>
  1900. </div>
  1901. </form>
  1902. </div>
  1903. </div>
  1904. <!-- ================= MODAL: ADD / EDIT ROUTE ================= -->
  1905. <div id="route-modal" class="fixed inset-0 bg-slate-950/80 backdrop-blur-sm z-50 hidden flex items-center justify-center p-4">
  1906. <div class="bg-slate-900 border border-slate-800 rounded-2xl w-full max-w-lg shadow-2xl overflow-hidden animate-in">
  1907. <div class="px-6 py-4 border-b border-slate-800 flex items-center justify-between bg-slate-950/40">
  1908. <h3 id="route-modal-title" class="text-sm font-bold text-white">Add Static Route</h3>
  1909. <button onclick="closeRouteModal()" class="text-slate-400 hover:text-white p-1 rounded-lg">✕</button>
  1910. </div>
  1911. <form onsubmit="submitSaveRoute(event)" class="p-6 space-y-4 text-xs">
  1912. <input type="hidden" id="route-modal-id">
  1913. <div>
  1914. <label class="block font-semibold text-slate-300 mb-1.5">Dst. Address (CIDR) *</label>
  1915. <input type="text" id="route-modal-dst" value="0.0.0.0/0" placeholder="0.0.0.0/0 or 10.0.0.0/8" required class="w-full bg-slate-800 border border-slate-700 rounded-lg px-3 py-2 text-white font-mono focus:outline-none focus:border-cyan-500">
  1916. </div>
  1917. <div class="grid grid-cols-2 gap-4">
  1918. <div>
  1919. <label class="block font-semibold text-slate-300 mb-1.5">Gateway (IP or Interface) *</label>
  1920. <input type="text" id="route-modal-gw" placeholder="192.168.1.1 or wg0" required class="w-full bg-slate-800 border border-slate-700 rounded-lg px-3 py-2 text-white font-mono focus:outline-none focus:border-cyan-500">
  1921. </div>
  1922. <div>
  1923. <label class="block font-semibold text-slate-300 mb-1.5">Routing Table / Mark</label>
  1924. <select id="route-modal-table" class="w-full bg-slate-800 border border-slate-700 rounded-lg px-3 py-2 text-white font-mono focus:outline-none focus:border-cyan-500">
  1925. <option value="main" selected>main</option>
  1926. </select>
  1927. </div>
  1928. </div>
  1929. <div class="grid grid-cols-2 gap-4">
  1930. <div>
  1931. <label class="block font-semibold text-slate-300 mb-1.5">Distance (Metric)</label>
  1932. <input type="number" id="route-modal-distance" value="1" min="1" max="255" class="w-full bg-slate-800 border border-slate-700 rounded-lg px-3 py-2 text-white font-mono">
  1933. </div>
  1934. <div>
  1935. <label class="block font-semibold text-slate-300 mb-1.5">Interface (Optional)</label>
  1936. <select id="route-modal-iface" class="w-full bg-slate-800 border border-slate-700 rounded-lg px-3 py-2 text-white font-mono"></select>
  1937. </div>
  1938. </div>
  1939. <div>
  1940. <label class="block font-semibold text-slate-300 mb-1.5">Comment</label>
  1941. <input type="text" id="route-modal-comment" placeholder="e.g. Primary WAN Default Gateway" class="w-full bg-slate-800 border border-slate-700 rounded-lg px-3 py-2 text-white">
  1942. </div>
  1943. <div class="pt-2">
  1944. <label class="flex items-center space-x-2 cursor-pointer">
  1945. <input type="checkbox" id="route-modal-disabled" class="rounded bg-slate-800 border-slate-700 text-rose-500">
  1946. <span class="font-medium text-slate-300">Disabled (X)</span>
  1947. </label>
  1948. </div>
  1949. <div class="pt-4 border-t border-slate-800 flex justify-end space-x-3">
  1950. <button type="button" onclick="closeRouteModal()" class="px-4 py-2 rounded-lg text-slate-400 hover:bg-slate-800">Cancel</button>
  1951. <button type="submit" class="px-5 py-2 rounded-lg font-semibold bg-cyan-600 hover:bg-cyan-500 text-white shadow-lg shadow-cyan-500/20">Save Route</button>
  1952. </div>
  1953. </form>
  1954. </div>
  1955. </div>
  1956. <!-- ================= MODAL: ADD POLICY ROUTING RULE ================= -->
  1957. <div id="prule-modal" class="fixed inset-0 bg-slate-950/80 backdrop-blur-sm z-50 hidden flex items-center justify-center p-4">
  1958. <div class="bg-slate-900 border border-slate-800 rounded-2xl w-full max-w-lg shadow-2xl overflow-hidden animate-in">
  1959. <div class="px-6 py-4 border-b border-slate-800 flex items-center justify-between bg-slate-950/40">
  1960. <h3 id="prule-modal-title" class="text-sm font-bold text-white">Add Policy Routing Rule (/ip route rule)</h3>
  1961. <button onclick="closePolicyRuleModal()" class="text-slate-400 hover:text-white p-1 rounded-lg">✕</button>
  1962. </div>
  1963. <form onsubmit="submitSavePolicyRule(event)" class="p-6 space-y-4 text-xs">
  1964. <input type="hidden" id="prule-modal-id">
  1965. <div class="grid grid-cols-2 gap-4">
  1966. <div>
  1967. <label class="block font-semibold text-slate-300 mb-1.5">Priority / Preference</label>
  1968. <input type="number" id="prule-modal-pref" placeholder="1000" class="w-full bg-slate-800 border border-slate-700 rounded-lg px-3 py-2 text-white font-mono">
  1969. </div>
  1970. <div>
  1971. <label class="block font-semibold text-slate-300 mb-1.5">Routing Mark (fwmark)</label>
  1972. <input type="text" id="prule-modal-mark" placeholder="e.g. to_WAN2 or 100" class="w-full bg-slate-800 border border-slate-700 rounded-lg px-3 py-2 text-white font-mono">
  1973. </div>
  1974. </div>
  1975. <div class="grid grid-cols-2 gap-4">
  1976. <div>
  1977. <label class="block font-semibold text-slate-300 mb-1.5">Src. Address (CIDR)</label>
  1978. <input type="text" id="prule-modal-src" placeholder="192.168.10.0/24" class="w-full bg-slate-800 border border-slate-700 rounded-lg px-3 py-2 text-white font-mono">
  1979. </div>
  1980. <div>
  1981. <label class="block font-semibold text-slate-300 mb-1.5">Dst. Address (CIDR)</label>
  1982. <input type="text" id="prule-modal-dst" placeholder="0.0.0.0/0" class="w-full bg-slate-800 border border-slate-700 rounded-lg px-3 py-2 text-white font-mono">
  1983. </div>
  1984. </div>
  1985. <div class="grid grid-cols-2 gap-4">
  1986. <div>
  1987. <label class="block font-semibold text-slate-300 mb-1.5">Lookup Table *</label>
  1988. <select id="prule-modal-table" required class="w-full bg-slate-800 border border-slate-700 rounded-lg px-3 py-2 text-white font-mono"></select>
  1989. </div>
  1990. <div>
  1991. <label class="block font-semibold text-slate-300 mb-1.5">Action</label>
  1992. <select id="prule-modal-action" class="w-full bg-slate-800 border border-slate-700 rounded-lg px-3 py-2 text-white font-mono">
  1993. <option value="lookup" selected>lookup (standard)</option>
  1994. <option value="unreachable">unreachable</option>
  1995. <option value="blackhole">blackhole</option>
  1996. </select>
  1997. </div>
  1998. </div>
  1999. <div class="pt-4 border-t border-slate-800 flex justify-end space-x-3">
  2000. <button type="button" onclick="closePolicyRuleModal()" class="px-4 py-2 rounded-lg text-slate-400 hover:bg-slate-800">Cancel</button>
  2001. <button type="submit" class="px-5 py-2 rounded-lg font-semibold bg-cyan-600 hover:bg-cyan-500 text-white shadow-lg shadow-cyan-500/20">Save Policy Rule</button>
  2002. </div>
  2003. </form>
  2004. </div>
  2005. </div>
  2006. <!-- ================= MODAL: CREATE ROUTING TABLE ================= -->
  2007. <div id="table-modal" class="fixed inset-0 bg-slate-950/80 backdrop-blur-sm z-50 hidden flex items-center justify-center p-4">
  2008. <div class="bg-slate-900 border border-slate-800 rounded-2xl w-full max-w-md shadow-2xl overflow-hidden animate-in">
  2009. <div class="px-6 py-4 border-b border-slate-800 flex items-center justify-between bg-slate-950/40">
  2010. <h3 class="text-sm font-bold text-white">Create New Routing Table</h3>
  2011. <button onclick="closeTableModal()" class="text-slate-400 hover:text-white p-1 rounded-lg">✕</button>
  2012. </div>
  2013. <form onsubmit="submitSaveTable(event)" class="p-6 space-y-4 text-xs">
  2014. <div>
  2015. <label class="block font-semibold text-slate-300 mb-1.5">Table Name *</label>
  2016. <input type="text" id="table-modal-name" placeholder="e.g. wan2_traffic, vpn_table" required class="w-full bg-slate-800 border border-slate-700 rounded-lg px-3 py-2 text-white font-mono focus:outline-none focus:border-cyan-500">
  2017. </div>
  2018. <div>
  2019. <label class="block font-semibold text-slate-300 mb-1.5">FIB Table ID (Optional)</label>
  2020. <input type="number" id="table-modal-id" min="1" max="252" placeholder="Auto (100+)" class="w-full bg-slate-800 border border-slate-700 rounded-lg px-3 py-2 text-white font-mono">
  2021. </div>
  2022. <div>
  2023. <label class="block font-semibold text-slate-300 mb-1.5">Comment</label>
  2024. <input type="text" id="table-modal-comment" placeholder="Purpose of this routing table" class="w-full bg-slate-800 border border-slate-700 rounded-lg px-3 py-2 text-white">
  2025. </div>
  2026. <div class="pt-4 border-t border-slate-800 flex justify-end space-x-3">
  2027. <button type="button" onclick="closeTableModal()" class="px-4 py-2 rounded-lg text-slate-400 hover:bg-slate-800">Cancel</button>
  2028. <button type="submit" class="px-5 py-2 rounded-lg font-semibold bg-cyan-600 hover:bg-cyan-500 text-white shadow-lg shadow-cyan-500/20">Create Table</button>
  2029. </div>
  2030. </form>
  2031. </div>
  2032. </div>
  2033. <script src="app.js"></script>
  2034. </body>
  2035. </html>