MCPcopy
hub / github.com/cloudflare/cloudflared / RouteTunnel

Method RouteTunnel

cfapi/hostname.go:178–192  ·  view source on GitHub ↗
(tunnelID uuid.UUID, route HostnameRoute)

Source from the content-addressed store, hash-verified

176}
177
178func (r *RESTClient) RouteTunnel(tunnelID uuid.UUID, route HostnameRoute) (HostnameRouteResult, error) {
179 endpoint := r.baseEndpoints.zoneLevel
180 endpoint.Path = path.Join(endpoint.Path, fmt.Sprintf("%v/routes", tunnelID))
181 resp, err := r.sendRequest("PUT", endpoint, route)
182 if err != nil {
183 return nil, errors.Wrap(err, "REST request failed")
184 }
185 defer resp.Body.Close()
186
187 if resp.StatusCode == http.StatusOK {
188 return route.UnmarshalResult(resp.Body)
189 }
190
191 return nil, r.statusCodeToError("add route", resp)
192}

Callers

nothing calls this directly

Calls 4

sendRequestMethod · 0.95
statusCodeToErrorMethod · 0.95
CloseMethod · 0.65
UnmarshalResultMethod · 0.65

Tested by

no test coverage detected