Sub AppStart (Args() As String)
settings = File.ReadMap(File.DirApp, "settings.txt")
' settings.Get("ssl_port")
updateIp.Initialize("updateIp", 10 * 60 * 1000) '10 minutes
updateIp.Enabled = True
UpdateIp_Tick
broker.Initialize("", 0) 'first parameter is the event name. It is currently not used.
broker.DebugLog = True
SetUpSSL(settings.Get("ssl_port"))
broker.Start
StartMessageLoop 'Non-UI app
End Sub
Sub SetUpSSL(port As Object)
Dim jo As JavaObject = broker
Dim config As JavaObject = jo.GetFieldJO("config")
config.RunMethod("setProperty", Array("ssl_port", port))
config.RunMethod("setProperty", Array("key_manager_password", KeyManagerPassword))
config.RunMethod("setProperty", Array("key_store_password", KeyStorePassword))
config.RunMethod("setProperty", Array("jks_path", $"${File.DirApp}\testserver.jks"$)) 'path to keystore file
End Sub
Sub UpdateIp_Tick
Dim j As HttpJob
j.Initialize("j", Me)
j.Download2("https://www.duckdns.org/update", Array As String("domains", domain, "token", token, _
"ipv6", "", "clear", "false"))
End Sub
Sub JobDone (j As HttpJob)
If j.Success = True Then
Log("Update DuckDNS: " & j.GetString)
Else
Log("Error updating Duck DNS: " & j.ErrorMessage)
End If
j.Release
End Sub