Thanks to visit codestin.com
Credit goes to github.com

Skip to content

gowww/secure

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

13 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

gowww secure GoDoc Build Coverage Go Report Status Testing

Package secure provides security utilities, CSP, HPKP, HSTS and other security wins.

Installing

  1. Get package:

    go get -u github.com/gowww/secure
  2. Import it in your code:

    import "github.com/gowww/secure"

Usage

To wrap an http.Handler, use Handle:

mux := http.NewServeMux()

mux.HandleFunc("/", func(w http.ResponseWriter, r *http.Request) {
	fmt.Fprint(w, "Hello")
})

http.ListenAndServe(":8080", secure.Handle(mux, nil))

To wrap an http.HandlerFunc, use HandleFunc:

http.Handle("/", secure.HandleFunc(func(w http.ResponseWriter, r *http.Request) {
	fmt.Fprint(w, "Hello")
}, nil))

http.ListenAndServe(":8080", nil)

To set custom security options, see Options GoDoc reference.

About

🔑 Security utilities, CSP, HPKP, HSTS and other security wins

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages