protocol

package
v2.0.8 Latest Latest
Warning

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

Go to latest
Published: Jul 22, 2026 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

View Source
const (
	HeaderTaskName       = "X-Cloudtasks-Taskname"
	HeaderQueueName      = "X-Cloudtasks-Queuename"
	HeaderTaskRetryCount = "X-Cloudtasks-Taskretrycount"
	HeaderTaskExecCount  = "X-Cloudtasks-Taskexecutioncount"
	HeaderTaskETA        = "X-Cloudtasks-Tasketa"
)

Cloud Tasks HTTP target headers (canonical MIME form used by net/http.Header.Get).

View Source
const (
	ProtocolAuto        = "auto"
	ProtocolRaw         = "raw"
	ProtocolCloudEvents = "cloudevents"
	ProtocolCloudTasks  = "cloudtasks"
)

Protocol preference from subscriber URL query protocol=.

Variables

This section is empty.

Functions

func IsClaimKey

func IsClaimKey(key string) bool

IsClaimKey reports whether key is claim-shaped authentication metadata.

func SanitizeInbound

func SanitizeInbound(md map[string]string, trustClaims bool) map[string]string

SanitizeInbound applies trust policy to inbound metadata before processDelivery. When trustClaims is false, claim-shaped keys are dropped.

Types

type CloudEvents

type CloudEvents struct{}

CloudEvents decodes CloudEvents 1.0 binary and structured content modes.

func (CloudEvents) Decode

func (c CloudEvents) Decode(r *http.Request) (*Inbound, error)

func (CloudEvents) Match

func (CloudEvents) Match(r *http.Request) bool

func (CloudEvents) Name

func (CloudEvents) Name() string

type CloudTasks

type CloudTasks struct{}

CloudTasks matches Cloud Tasks push requests and maps headers into metadata.

func (CloudTasks) Decode

func (CloudTasks) Decode(r *http.Request) (*Inbound, error)

func (CloudTasks) Match

func (CloudTasks) Match(r *http.Request) bool

func (CloudTasks) Name

func (CloudTasks) Name() string

type Codec

type Codec interface {
	Name() string
	Match(r *http.Request) bool
	Decode(r *http.Request) (*Inbound, error)
}

Codec decodes an HTTP push request into body + metadata.

func DefaultCodecs

func DefaultCodecs() []Codec

DefaultCodecs returns the ordered codec list for protocol=auto.

func SelectCodec

func SelectCodec(protocol string, r *http.Request, codecs []Codec) Codec

SelectCodec picks a codec for the request based on protocol preference.

type Inbound

type Inbound struct {
	Body     []byte
	Metadata map[string]string
}

Inbound is a decoded push message ready for processDelivery.

type Raw

type Raw struct{}

Raw decodes a plain HTTP body with a minimal safe header allowlist.

func (Raw) Decode

func (Raw) Decode(r *http.Request) (*Inbound, error)

func (Raw) Match

func (Raw) Match(_ *http.Request) bool

func (Raw) Name

func (Raw) Name() string

Jump to

Keyboard shortcuts

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