Socket
Book a DemoInstallSign in
Socket

mygithub.libinneed.workers.dev/ssgreg/zerodt

Package Overview
Dependencies
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

mygithub.libinneed.workers.dev/ssgreg/zerodt

Go Modules
Version
v1.1.0
Version published
Created
Source

ZeroDT

GoDoc Build Status Go Report Status

Package ZeroDT offers a zero downtime restart and a graceful shutdown for HTTP servers. Key features:

  • supported both stateless and stateful servers
  • compatible with systemd's socket activation
  • based on out-of-the-box http.Server
  • work with any number of servers
  • not a framework

Example

The simplest way to use ZeroDT is to pass your http.Server to the zerodt.NewApp function and call zerodt.ListenAndServe for an object it returns:

package main

import (
    "io"
    "net/http"
    "time"

    "github.com/ssgreg/zerodt"
)

func hello(w http.ResponseWriter, r *http.Request) {
    io.WriteString(w, "Hello world!")
}

func main() {
    mux := http.NewServeMux()
    mux.HandleFunc("/", hello)

    a := zerodt.NewApp(&http.Server{Addr: ":8081", Handler: mux})
    a.ListenAndServe()
}

Adopting your HTTP server to use as systemd's service

Under construction

FAQs

Package last updated on 18 Apr 2018

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts