etag

package
v0.1.3 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jun 13, 2026 License: Apache-2.0 Imports: 3 Imported by: 0

Documentation

Overview

Package etag computes deterministic HTTP entity tags for Githome responses.

GitHub serves weak validators (W/"..."), so Githome does too. An ETag is a hash over a resource's version inputs (such as a serialized body, or an updated-at plus lock-version pair), never over presentation details that vary between equal representations. The same inputs always yield the same tag, across processes and restarts.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Match

func Match(ifNoneMatch, tag string) bool

Match reports whether an If-None-Match header value satisfies the given tag. It honors the comma-separated list form and the "*" wildcard, and compares weakly (ignoring the W/ marker), which is correct for GET and HEAD.

func Version

func Version(seed string, id int64, markers ...int64) string

Version returns a weak ETag over a resource's version inputs. Callers pass a stable seed (the resource kind), its public id, and any monotonic version markers such as an updated-at timestamp in nanoseconds and a lock version.

func Weak

func Weak(body []byte) string

Weak returns a weak ETag over the given bytes, e.g. the serialized response body. The tag is the first 16 bytes of the SHA-256 digest, hex-encoded.

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL