Documentation
¶
Index ¶
- Variables
- func GenRsaKey(crtPath string, keyPath string) error
- func GenRsaKeyIfNeeded(crtPath string, keyPath string) error
- func ListenAutoTLS(app *fiber.App, httpPort, sslPort uint16, certPath string, proxy ...[]string) error
- func PrintMsg(color string, msg string, size int, end bool)
- func RedirectSSL(httpPort, sslPort uint16) func(c fiber.Ctx) error
- func VerifyOrigin(origin []string, proxy []string, ...) func(c fiber.Ctx) error
- type App
- type ConfigData
Constants ¶
This section is empty.
Variables ¶
var Config = ConfigData{
Title: "Web Server",
AppTitle: "WebServer",
Desc: "A Web Server.",
PortHTTP: 8080,
PortSSL: 8443,
}
Functions ¶
func GenRsaKey ¶
GenRsaKey generates a new ssl certificate and key pair
- expires: 3 years
- rsa: 4096
- x509
- sha256
- recommended renewal: once a year
func GenRsaKeyIfNeeded ¶
GenRsaKeyIfNeeded auto detects if the certificates generated by the GenRsaKey method are either
- not synchronized by date modified
- are possibly expired (assuming a 1 year renewal)
If it detects this is true, it will automatically regenerate a new certificate
func ListenAutoTLS ¶
func ListenAutoTLS(app *fiber.App, httpPort, sslPort uint16, certPath string, proxy ...[]string) error
ListenAutoTLS will automatically generate a self signed tls certificate if needed and listen to both http and https ports
@httpPort: 80, @sslPort: 443
@certPath: file path to store ssl certificates to (this will generate a my/path.crt and my/path.key file)
@proxy: optional, if only one proxy is specified, the app will only listen to that ip address
func RedirectSSL ¶
RedirectSSL can be added to `app.Use` to auto redirect http to https
@httpPort: 80, @sslPort: 443
func VerifyOrigin ¶
func VerifyOrigin(origin []string, proxy []string, handleErr ...func(c fiber.Ctx, err error) error) func(c fiber.Ctx) error
VerifyOrigin can be added to `app.Use` to enforce that all connections are coming through a specified domain and proxy ip
@origin: list of valid domains
@proxy: list of valid ip proxies
@handleErr: optional, allows you to define a function for handling invalid origins, instead of returning the default http error