not_after(hostname, ip:port) - returns unix timestamp for hostname's ssl certificate expiration date. If a second argument will not be passed then will be used default (hostname:443).
Examples
local cert_util = require("cert_util")
local tx, err = cert_util.not_after("google.com", "64.233.165.101:443")
if err then error(err) end
if not(tx == 1548838740) then error("error!") end
state := lua.NewState()
Preload(state)
time.Preload(state)
source := `
local cert_util = require("cert_util")
local time = require("time")
local tx, err = cert_util.not_after("google.com", "64.233.165.101:443")
if err then error(err) end
print(tx > time.unix())
`
if err := state.DoString(source); err != nil {
log.Fatal(err.Error())
}