selfsign

package module
v0.0.0-...-9ed889d Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Aug 24, 2017 License: BSD-3-Clause Imports: 11 Imported by: 0

Documentation

Overview

Package selfsign exposes a GetCertificate function that generates self-signed certificates and is suitable for use in the *tls.Config of an HTTPS server.

Based on https://golang.org/src/crypto/tls/generate_cert.go

Index

Examples

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetCertificate

func GetCertificate(hello *tls.ClientHelloInfo) (*tls.Certificate, error)

GetCertificate generates a self-signed certificate

Example
package main

import (
	"crypto/tls"
	"net/http"

	"github.com/davars/selfsign"
)

func main() {
	s := &http.Server{
		Addr:      ":https",
		TLSConfig: &tls.Config{GetCertificate: selfsign.GetCertificate},
	}
	s.ListenAndServeTLS("", "")
}
Output:

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL