Skip to content

Instantly share code, notes, and snippets.

View tom-hoover's full-sized avatar

Tom Hoover tom-hoover

  • Valcom, Inc.
  • Roanoke, Virginia, USA, Earth
View GitHub Profile
@tom-hoover
tom-hoover / golang-nuts.go
Created October 22, 2020 13:20 — forked from ryanfitz/golang-nuts.go
two ways to call a function every 2 seconds
package main
import (
"fmt"
"time"
)
// Suggestions from golang-nuts
// http://play.golang.org/p/Ctg3_AQisl
@tom-hoover
tom-hoover / golang-tls.md
Created October 22, 2020 11:30 — forked from 6174/golang-tls.md
Simple Golang HTTPS/TLS Examples
Generate private key (.key)
# Key considerations for algorithm "RSA" ≥ 2048-bit
openssl genrsa -out server.key 2048
    
# Key considerations for algorithm "ECDSA" ≥ secp384r1
# List ECDSA the supported curves (openssl ecparam -list_curves)
openssl ecparam -genkey -name secp384r1 -out server.key
@tom-hoover
tom-hoover / redirectExample.go
Created October 22, 2020 11:30 — forked from d-schmidt/redirectExample.go
How to redirect HTTP to HTTPS with a golang webserver.
package main
import (
"net/http"
"log"
)
func redirect(w http.ResponseWriter, req *http.Request) {
// remove/add not default ports from req.Host
target := "https://" + req.Host + req.URL.Path
if len(req.URL.RawQuery) > 0 {