Skip to main content

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

FieldTypeMeaning
dispNamestringDisplay name of the VPN
VPNTypestringVPN type. Supports "PPTP", "L2TP", "IPSec"
serverstringServer address
authorizationstringAccount (username)
passwordstringPassword
secretstring, optionalShared secret; can be empty for PPTP
encrypLevelinteger, optionalEncryption level; default 1
groupstring, optionalGroup name; default ""
VPNSendAllTrafficinteger, optionalSend 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