MCPcopy Index your code
hub / github.com/cloudflare/cloudflared / ListActiveClients

Method ListActiveClients

cfapi/tunnel.go:216–230  ·  view source on GitHub ↗
(tunnelID uuid.UUID)

Source from the content-addressed store, hash-verified

214}
215
216func (r *RESTClient) ListActiveClients(tunnelID uuid.UUID) ([]*ActiveClient, error) {
217 endpoint := r.baseEndpoints.accountLevel
218 endpoint.Path = path.Join(endpoint.Path, fmt.Sprintf("%v/connections", tunnelID))
219 resp, err := r.sendRequest("GET", endpoint, nil)
220 if err != nil {
221 return nil, errors.Wrap(err, "REST request failed")
222 }
223 defer resp.Body.Close()
224
225 if resp.StatusCode == http.StatusOK {
226 return parseConnectionsDetails(resp.Body)
227 }
228
229 return nil, r.statusCodeToError("list connection details", resp)
230}
231
232func parseConnectionsDetails(reader io.Reader) ([]*ActiveClient, error) {
233 var clients []*ActiveClient

Callers

nothing calls this directly

Calls 4

sendRequestMethod · 0.95
statusCodeToErrorMethod · 0.95
parseConnectionsDetailsFunction · 0.85
CloseMethod · 0.65

Tested by

no test coverage detected