cert_util

package
v0.5.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Sep 14, 2023 License: BSD-3-Clause Imports: 5 Imported by: 3

README

cert_util GoDoc

Functions

  • 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

Documentation

Overview

Package cert_utils provides utility for checking ssl-certs in lua.

Example (Package)

cert_util.not_after("host", <ip:port>)

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())
}
Output:

true

Index

Examples

Constants

This section is empty.

Variables

This section is empty.

Functions

func Loader

func Loader(L *lua.LState) int

Loader is the module loader function.

func NotAfter

func NotAfter(L *lua.LState) int

NotAfter lua cert.not_after(hostname, <ip>) returns (unixts cert_not_after, err)

func Preload

func Preload(L *lua.LState)

Preload adds cert_util to the given Lua state's package.preload table. After it has been preloaded, it can be loaded using require:

local cert_util = require("cert_util")

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL