• Stars
    star
    24
  • Rank 952,673 (Top 20 %)
  • Language
    Go
  • License
    MIT License
  • Created about 5 years ago
  • Updated over 1 year ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

A layer of abstraction the around acme/autocert certificate manager (Golang)

Simple Secure Server

Go Report Card Documentation GitHub issues license Mentioned in Awesome Go

Prerequisites:

  • Your server must be reachable through the provided domain name, this is how LetsEncrypt verifies domain ownership and grants your server a trusted certificate

With Default Values:

ss, err := sslmgr.NewSecureServer(handler, "yourhostname.com")
if err != nil {
	log.Fatal(err)
}
ss.ListenAndServe()

Note: This option uses the file system as the certificate cache. If your use case does not have a persistent file system, you should provide a value for CertCache in the ServerConfig as shown below.

With Optional Values:

(Using the certcache library to define a cache)

ss, err := sslmgr.NewServer(sslmgr.ServerConfig{
	Hostnames: []string{os.Getenv("CN_FOR_CERTIFICATE")},
	HTTPPort:  ":80",
	HTTPSPort: ":443",
	Handler:   h,
	ServeSSLFunc: func() bool {
		return strings.ToLower(os.Getenv("PROD")) == "true"
	},
	CertCache: certcache.NewLayered(
		certcache.NewLogger(),
		autocert.DirCache("."),
	),
	ReadTimeout:         5 * time.Second,
	WriteTimeout:        5 * time.Second,
	IdleTimeout:         25 * time.Second,
	GracefulnessTimeout: 5 * time.Second,
	GracefulShutdownErrHandler: func(e error) {
		log.Fatal(e)
	},
})
if err != nil {
	log.Fatal(err)
}

ss.ListenAndServe()

More Repositories

1

certcache

Useful wrappers around the acme/autocert Cache interface
Go
7
star
2

snyk_code_ignore

A wrapper around the Snyk CLI that allows ignoring code issues with in-line comments
Shell
5
star
3

iprepd-firewall

Seamless IP reputation based application-layer firewall for services written in Go
Go
4
star
4

padl

secrets management as-a-service
Go
3
star
5

rdtp

[WIP] A cross OS transport layer service implemented as a daemon process
Go
3
star
6

spoof

a utility for injecting spoofed frames into a network
Go
3
star
7

multikey

n-out-of-N-keys encryption framework based on shamir's secret sharing algorithm
Go
3
star
8

authio

Authenticated message implementations of io.Reader and io.Writer
Go
2
star
9

okta-gbac

A thin group ownership wrapper around the Okta Developer API
Go
1
star
10

GoFirewall

A software defined IP based firewall wrapper library for HTTP endpoint handlers in Go
Go
1
star
11

mapp

The companion app for every event you will ever attend!
JavaScript
1
star
12

GoAway

An OpenCV based motion detector and utilities written in Golang
Go
1
star
13

pipeline

staged pipeline framework in go
Go
1
star
14

GoFaceTrainer

Train a facial recognition model in Go using OpenCV and Machine Box
Go
1
star
15

sni-reverse-proxy

Pure-Go SNI-based reverse proxy
Go
1
star
16

ml

Wasteland for all things related to my ML self-learn journey
1
star
17

nwfacts

The ultimate anti-bias tool for browsing the news
JavaScript
1
star
18

keyswirl

automated key rotation library for replicated authentication services
1
star
19

war

A utility to run commands with assumed-role credentials in the environment.
Go
1
star
20

streamer

A python3 video streaming client and server with RSTP and RTP
Python
1
star