MCPcopy Index your code
hub / github.com/docker/cli / main

Function main

e2e/testutils/plugins/basic.go:17–41  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

15)
16
17func main() {
18 p, err := filepath.Abs(filepath.Join("run", "docker", "plugins"))
19 if err != nil {
20 panic(err)
21 }
22 if err := os.MkdirAll(p, 0o755); err != nil {
23 panic(err)
24 }
25 l, err := net.Listen("unix", filepath.Join(p, "basic.sock"))
26 if err != nil {
27 panic(err)
28 }
29
30 mux := http.NewServeMux()
31 server := http.Server{
32 Addr: l.Addr().String(),
33 Handler: http.NewServeMux(),
34 ReadHeaderTimeout: 2 * time.Second, // G112: Potential Slowloris Attack because ReadHeaderTimeout is not configured in the http.Server
35 }
36 mux.HandleFunc("/Plugin.Activate", func(w http.ResponseWriter, r *http.Request) {
37 w.Header().Set("Content-Type", "application/vnd.docker.plugins.v1.1+json")
38 fmt.Println(w, `{"Implements": ["dummy"]}`)
39 })
40 server.Serve(l)
41}

Callers

nothing calls this directly

Calls 4

AddrMethod · 0.80
PrintlnMethod · 0.80
StringMethod · 0.65
SetMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…