MCPcopy Create free account
hub / github.com/tailscale/tailcat / DERPMapCache

Interface DERPMapCache

tailcat.go:109–119  ·  view source on GitHub ↗

DERPMapCache is an option for [ConnInfo.Expand] and [FetchDERPMap] that caches fetched DERP maps. Without one, a process-wide in-memory cache is used; provide an implementation (like the tailcat CLI's on-disk one) to persist across processes. Implementations just store bytes; the freshness policy li

Source from the content-addressed store, hash-verified

107// (the ETag is opaque to us), and a stored map of any age is used as
108// a fallback if the fetch fails or times out.
109type DERPMapCache interface {
110 // Get returns the previously stored DERP map response for url:
111 // its raw JSON, the server's ETag (or ""), and when it was
112 // stored. It returns ok == false if nothing usable is stored.
113 Get(url string) (data []byte, etag string, storedAt time.Time, ok bool)
114
115 // Put stores the DERP map response for url, replacing any prior
116 // entry and marking it stored as of now. An empty etag means the
117 // server sent none.
118 Put(url string, data []byte, etag string) error
119}
120
121// derpMapCacheMaxAge is how old a cached DERP map may be and still be
122// used without revalidating with the server.

Callers 9

StartMethod · 0.65
fetchDERPMapFunction · 0.65
advertiseEndpointsMethod · 0.65
StartMethod · 0.65
onMeowMethod · 0.65
StatusMethod · 0.65
newNetstackFunction · 0.65
createEngineFunction · 0.65
fetchDERPMapFunction · 0.65

Implementers 2

memDERPMapCachetailcat.go
derpMapCachecmd/tailcat/tailcat.go

Calls

no outgoing calls

Tested by

no test coverage detected