Skip to content
/ go-net Public

Convenience functions and wrappers around net and net/http

Notifications You must be signed in to change notification settings

mattes/go-net

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

8 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

net

GoDoc Build Status

Convenience functions and wrappers around net and net/http for ...

  • Timeouts
  • Graceful Server Shutdowns with Connection Draining
  • Healthy and Ready handlers

Example Usage

package main

import (
  "net/http"
  "github.com/mattes/go-net/server"
)

func main() {
  server.IsBehindGoogleLoadBalancer() // optional

  mux := http.NewServeMux()
  // add handlers ...
  
  // Creates a new Server with /health and /ready handlers
  // which gracefully shuts down on SIGINT or SIGTERM
  log.Fatal(server.ListenAndServe(":8080", mux))
}

Health check vs Ready check

Health Ready
Running 200 200
Shutting down 200 503

Good Reads

About

Convenience functions and wrappers around net and net/http

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages