Skip to content

Commit bc3d32f

Browse files
- run gofmt -s
1 parent 22582f6 commit bc3d32f

3 files changed

Lines changed: 10 additions & 10 deletions

File tree

https.go

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -9,14 +9,12 @@ import (
99
//
1010
// Example:
1111
//
12-
// http.HandleFunc("/", func(w http.ResponseWriter, r *http.Request) { w.WriteHeader(http.StatusNoContent) })
13-
//
14-
// opts := GenerateOptions{Host: "domain.com"}
15-
// httpServer, _ := Server("8080", opts)
16-
// log.Fatal(httpServer.ListenAndServeTLS("", ""))
12+
// http.HandleFunc("/", func(w http.ResponseWriter, r *http.Request) { w.WriteHeader(http.StatusNoContent) })
1713
//
14+
// opts := GenerateOptions{Host: "domain.com"}
15+
// httpServer, _ := Server("8080", opts)
16+
// log.Fatal(httpServer.ListenAndServeTLS("", ""))
1817
func Server(port string, opts GenerateOptions) (*http.Server, error) {
19-
2018
pub, priv, err := GenerateKeys(opts)
2119
if err != nil {
2220
return nil, err

ssl_go113.go

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
// Generate a self-signed X.509 certificate for a TLS server. Outputs to
77
// 'cert.pem' and 'key.pem' and will overwrite existing files.
88

9+
//go:build go1.13
910
// +build go1.13
1011

1112
package https
@@ -21,11 +22,12 @@ import (
2122
"crypto/x509/pkix"
2223
"encoding/pem"
2324
"errors"
24-
"golang.org/x/xerrors"
2525
"math/big"
2626
"net"
2727
"strings"
2828
"time"
29+
30+
"golang.org/x/xerrors"
2931
)
3032

3133
func publicKey(priv interface{}) interface{} {
@@ -45,7 +47,6 @@ func publicKey(priv interface{}) interface{} {
4547
//
4648
// See https://github.com/denji/golang-tls and https://stackoverflow.com/questions/47857573/passing-certificate-and-key-as-string-to-listenandservetls/47857805
4749
func GenerateKeys(opts GenerateOptions) ([]byte, []byte, error) {
48-
4950
// Validate Options
5051
if opts.Host == "" {
5152
return nil, nil, errors.New("missing required Host parameter")

ssl_legacy.go

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
// Generate a self-signed X.509 certificate for a TLS server. Outputs to
77
// 'cert.pem' and 'key.pem' and will overwrite existing files.
88

9+
//go:build !go1.13
910
// +build !go1.13
1011

1112
package https
@@ -20,11 +21,12 @@ import (
2021
"crypto/x509/pkix"
2122
"encoding/pem"
2223
"errors"
23-
"golang.org/x/xerrors"
2424
"math/big"
2525
"net"
2626
"strings"
2727
"time"
28+
29+
"golang.org/x/xerrors"
2830
)
2931

3032
func publicKey(priv interface{}) interface{} {
@@ -42,7 +44,6 @@ func publicKey(priv interface{}) interface{} {
4244
//
4345
// See https://github.com/denji/golang-tls and https://stackoverflow.com/questions/47857573/passing-certificate-and-key-as-string-to-listenandservetls/47857805
4446
func GenerateKeys(opts GenerateOptions) ([]byte, []byte, error) {
45-
4647
// Validate Options
4748
if opts.Host == "" {
4849
return nil, nil, errors.New("missing required Host parameter")

0 commit comments

Comments
 (0)