main.go 481 B

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