| 107 | } |
| 108 | |
| 109 | func requestHealthCheck(socketPath string) (string, error) { |
| 110 | conn, err := net.Dial("unix", socketPath) |
| 111 | if err != nil { |
| 112 | return "", err |
| 113 | } |
| 114 | c := &http.Client{ |
| 115 | Transport: &http.Transport{ |
| 116 | DialContext: func(context.Context, string, string) (net.Conn, error) { |
| 117 | return conn, nil |
| 118 | }, |
| 119 | }, |
| 120 | } |
| 121 | req, _ := http.NewRequest("GET", "http://unused/health", nil) |
| 122 | resp, err := c.Do(req) |
| 123 | if err != nil { |
| 124 | return "", err |
| 125 | } |
| 126 | body, _ := io.ReadAll(resp.Body) |
| 127 | resp.Body.Close() |
| 128 | return string(body), nil |
| 129 | } |