-- Import the necessary LuCI modules local uci = require("luci.model.uci").cursor() local sys = require("luci.sys") local util = require("luci.util") -- Define the model m = Map("tganyconnect_cfg", "TorGuard AnyConnect VPN Setup") -- Define the section for the AnyConnect settings s = m:section(TypedSection, "anyconnectconfig", "AnyConnect VPN Settings") s.anonymous = true s.addremove = false -- Define the input fields for the AnyConnect settings user = s:option(Value, "username", translate("VPN Username")) pass = s:option(Value, "password", translate("VPN Password")) svr = s:option(ListValue, "server", translate("VPN Server")) -- Add all servers here svr:value("fr.anyconnect.host", "France Strasbourg") svr:value("ger.anyconnect.host", "Germany Frankfurt") svr:value("ger2.anyconnect.host", "Germany - Frankfurt 2") svr:value("hk.anyconnect.host", "Hong Kong") svr:value("nl.anyconnect.host", "Netherlands") svr:value("pl.anyconnect.host", "Poland") svr:value("sg.anyconnect.host", "Singapore") svr:value("uk.anyconnect.host", "United Kingdom") svr:value("la.usa.anyconnect.host", "USA LA") svr:value("ny.usa.anyconnect.host", "USA NY") dns = s:option(ListValue, "dns", translate("DNS")) -- Add all ports here dns:value("8.8.8.8 8.8.4.4", "Google") dns:value("1.1.1.1 1.0.0.1", "Cloudflare") dns:value("9.9.9.9 149.112.112.112", "Quad9") dns:value("208.67.222.222 208.67.220.220", "OpenDNS") dns:value("84.200.69.80 84.200.70.40", "DNS.WATCH") dns:value("8.26.56.26 8.20.247.2", "Comodo Secure DNS") dns:value("64.6.64.6 64.6.65.6", "Verisign DNS") dns:value("185.228.168.9 185.228.169.9", "CleanBrowsing") dns:value("77.88.8.8 77.88.8.1", "Yandex.DNS") dns:value("91.239.100.100 89.233.43.71", "UncensoredDNS") -- VPN Control: Start/Stop AnyConnect VPN ctrl = m:section(TypedSection, "anyconnectconfig", "VPN Control: Start/Stop AnyConnect") ctrl.anonymous = true ctrl.addremove = false btnStop = ctrl:option(Button, "_btn_start", translate("Click to Stop AnyConnect")) function btnStop.write() io.popen("/etc/init.d/tganyconnect stop") end btnStart = ctrl:option(Button, "_btn_stop", translate("Click to Start AnyConnect")) function btnStart.write() io.popen("/etc/init.d/tganyconnect start") end -- Return the configuration page return m