• Stars
    star
    26
  • Rank 930,752 (Top 19 %)
  • Language
    Go
  • License
    MIT License
  • Created over 5 years ago
  • Updated 4 months 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

multikey

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

iprepd-firewall

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

padl

secrets management as-a-service
Go
3
star
6

rdtp

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

spoof

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

authio

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

kmssigner

A crypto.Signer implementation based on an AWS KMS key.
Go
2
star
10

vanta-sdk-go

Unofficial Vanta API Client for Go
Go
2
star
11

okta-gbac

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

GoFirewall

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

mapp

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

GoAway

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

NWHacks2019

Platform for remote patient-physician engagement on medication adherence, tracking, and refill. (NWHacks2019 Finalist)
JavaScript
1
star
16

refresh

Go library to keep short-lived credentials fresh with various flexible strategies.
Go
1
star
17

pipeline

staged pipeline framework in go
Go
1
star
18

sni-reverse-proxy

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

ml

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

GoFaceTrainer

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

nwfacts

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

keyswirl

automated key rotation library for replicated authentication services
1
star
23

war

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

streamer

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