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
| 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. |
| 109 | type 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. |
no outgoing calls
no test coverage detected