Create a VPN profile (vpnconf.create)
Declaration
ok = vpnconf.create(conf)
Parameters
- conf
Table. Dictionary describing the VPN profile to create.
Returns
- ok
Boolean. true on success; false on failure (usually due to missing or invalid parameters).
Notes
Quickly create a VPN profile. IKEv2 creation is not supported.
Supported fields of conf
Field | Type | Meaning |
---|---|---|
dispName | string | Display name of the VPN |
VPNType | string | VPN type. Supports "PPTP", "L2TP", "IPSec" |
server | string | Server address |
authorization | string | Account (username) |
password | string | Password |
secret | string, optional | Shared secret; can be empty for PPTP |
encrypLevel | integer, optional | Encryption level; default 1 |
group | string, optional | Group name; default "" |
VPNSendAllTraffic | integer, optional | Send all traffic; default 1 |
Example
local success = vpnconf.create{
dispName = 'A Test VPN', -- VPN display name
VPNType = "L2TP", -- VPN type, supports PPTP, L2TP, IPSec, IKEv2
server = 'www.xxtouch.app', -- Server address
authorization = 'havonz', -- Account
password = '123456', -- Password
secret = 'XXTOUCH', -- Shared secret; PPTP can omit
encrypLevel = 1, -- Encryption level (optional; default 1)
group = '', -- Group name (optional; default "")
VPNSendAllTraffic = 1, -- Send all traffic (optional; default 1)
}
if success then
sys.alert('Created successfully')
else
sys.alert('Creation failed')
end
Note: Uses sys.alert