MCPcopy Create free account
hub / github.com/tailscale/tailscale / webhooksHandler

Function webhooksHandler

docs/webhooks/example.go:50–63  ·  view source on GitHub ↗
(w http.ResponseWriter, req *http.Request)

Source from the content-addressed store, hash-verified

48}
49
50func webhooksHandler(w http.ResponseWriter, req *http.Request) {
51 defer req.Body.Close()
52 events, err := verifyWebhookSignature(req, secret)
53 if err != nil {
54 log.Printf("error validating signature: %v\n", err)
55 } else {
56 log.Printf("events received %v\n", events)
57 // Do something with your events. :)
58 }
59
60 // The handler should always report 2XX except in the case of
61 // transient failures (e.g. database backend is down).
62 // Otherwise your future events will be blocked by retries.
63}
64
65// verifyWebhookSignature checks the request's "Tailscale-Webhook-Signature"
66// header to verify that the events were signed by your webhook secret.

Callers

nothing calls this directly

Calls 3

verifyWebhookSignatureFunction · 0.85
PrintfMethod · 0.80
CloseMethod · 0.65

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…