Skip to content

tmthrgd/hsts

Repository files navigation

hsts

GoDoc Build Status

Package hsts provides access to the Chromium HSTS preloaded list.

The list is manually converted into go code occasionally with go generate.

To request your site be added to the list, please visit hstspreload.org.

Usage

import "go.tmthrgd.dev/hsts"

Hostnames (or domain names) can be checked for inclusion in the list by calling IsPreloaded:

if hsts.IsPreloaded(hostname) {
	// ...
}

Transport is a http.RoundTripper that automatically upgrades insecure http requests to hosts in the preload list into secure https requests. It can be used by setting the (*http.Client).Transport field as follows:

client := &http.Client{
	Transport: &hsts.Transport{},
}
resp, err := client.Do(req)

License

BSD 3-Clause License

The minimal perfect hashing code was taken from cespare/mph by Caleb Spare and is licensed under an MIT License.

About

The Chromium HSTS preloaded list for Golang.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages