github.com/khulnasoft-lab/khulnasoft@v26.0.1-0.20240328202558-330a6f959fe0+incompatible/integration/plugin/logging/cmd/discard/main.go (about)

     1  package main
     2  
     3  import (
     4  	"net"
     5  	"net/http"
     6  	"time"
     7  )
     8  
     9  func main() {
    10  	l, err := net.Listen("unix", "/run/docker/plugins/plugin.sock")
    11  	if err != nil {
    12  		panic(err)
    13  	}
    14  
    15  	mux := http.NewServeMux()
    16  	handle(mux)
    17  
    18  	server := http.Server{
    19  		Addr:              l.Addr().String(),
    20  		Handler:           mux,
    21  		ReadHeaderTimeout: 2 * time.Second, // This server is not for production code; picked an arbitrary timeout to statisfy gosec (G112: Potential Slowloris Attack)
    22  	}
    23  	server.Serve(l)
    24  }