utils

package
v0.18.0 Latest Latest
Warning

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

Go to latest
Published: Dec 11, 2024 License: AGPL-3.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func BodyOrEmptyJsonObj

func BodyOrEmptyJsonObj(c *fiber.Ctx) []byte

BodyOrEmptyJsonObj returns request body or an empty JSON object buffer otherwise.

func ComputeDeviceId

func ComputeDeviceId(bytesSlice ...[]byte) uint64

ComputeDeviceId computes xxh3 hash of the given byte slices. This is the same as Xxh3 function.

func ComputeVisitorId

func ComputeVisitorId(bytesSlice ...[]byte) string

ComputeVisitorId computes xxh3 hash of the given byte slices and adds result as hexadecimal suffix to "prisme_".

func ContextTimeout

func ContextTimeout(ctx context.Context) time.Duration

ContextTimeout extract duration until context timeout and panics if no deadline is found.

func ExtractClientHints added in v0.18.0

func ExtractClientHints(headers *fasthttp.RequestHeader, client *uaparser.Client)

ExtractClientHints parses Sec-Ch-Ua-XXX headers and adds them to the given *uaparser.Client.

func ExtractUtmParams

func ExtractUtmParams(args *fasthttp.Args) event.UtmParams

ExtractUtmParams extracts UTM parameters from the given query args. If no utm_source arg is found, it fallbacks to ref arg.

func PeekAndParseReferrerHeader added in v0.18.0

func PeekAndParseReferrerHeader(c *fiber.Ctx) (uri.Uri, error)

PeekAndParseReferrerHeader retrieves and parses prisme or standard referrer header. In case of error, a fiber error with status 400 bad request is returned.

func PeekAndParseReferrerQueryHeader added in v0.18.0

func PeekAndParseReferrerQueryHeader(c *fiber.Ctx) (uri.Uri, error)

PeekAndParseReferrerHeader retrieves and parses referrer from query parameter or standard header. In case of error, a fiber error with status 400 bad request is returned.

func PeekReferrerHeader

func PeekReferrerHeader(c *fiber.Ctx) []byte

PeekReferrerHeader peek X-Prisme-Referrer header and fallback to standard Referer header otherwise.

func PeekReferrerQueryOrHeader

func PeekReferrerQueryOrHeader(c *fiber.Ctx) []byte

PeekReferrerQueryOrHeader peek referrer from "referrer" query parameter and fallback to standard Referer header otherwise.

func Xxh3

func Xxh3(bytesSlice ...[]byte) uint64

Xxh3 computes xxh3 hash of the given byte slices.

Types

This section is empty.

Jump to

Keyboard shortcuts

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