gtscontext

package
v0.17.0-rc1 Latest Latest
Warning

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

Go to latest
Published: Sep 24, 2024 License: AGPL-3.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Barebones

func Barebones(ctx context.Context) bool

Barebones returns whether the "barebones" context key has been set. This can be used to indicate to the database, for example, that only a barebones model need be returned, Allowing it to skip populating sub models.

func DryRun added in v0.10.0

func DryRun(ctx context.Context) bool

DryRun returns whether the "dryrun" context key has been set. This can be used to indicate to functions, (that support it), that only a dry-run of the operation should be performed. As opposed to making any permanent changes.

func HTTPClientSignFunc added in v0.15.0

func HTTPClientSignFunc(ctx context.Context) func(*http.Request) error

HTTPClientSignFunc returns an httpclient signing function for the current client request context. This can be used to resign a request as calling transport's user.

func HTTPSignature added in v0.10.0

func HTTPSignature(ctx context.Context) string

HTTPSignature returns the http signature string value for the current ActivityPub request chain.

func HTTPSignaturePubKeyID added in v0.10.0

func HTTPSignaturePubKeyID(ctx context.Context) *url.URL

HTTPSignaturePubKeyID returns the public key id of the http signature for the current ActivityPub request chain.

func HTTPSignatureVerifier added in v0.10.0

func HTTPSignatureVerifier(ctx context.Context) httpsig.VerifierWithOptions

HTTPSignatureVerifier returns an http signature verifier for the current ActivityPub request chain. This verifier can be called to authenticate the current request.

func IsFastfail added in v0.9.0

func IsFastfail(ctx context.Context) bool

IsFastFail returns whether the "fastfail" context key has been set. This can be used to indicate to an http client, for example, that the result of an outgoing request is time sensitive and so not to bother with retries.

func OtherIRIs added in v0.10.0

func OtherIRIs(ctx context.Context) []*url.URL

OtherIRIs returns other IRIs which are involved in the current ActivityPub request chain. This usually means: other accounts who are mentioned, CC'd, TO'd, or boosted by the current inbox POST request.

func OutgoingPublicKeyID added in v0.10.0

func OutgoingPublicKeyID(ctx context.Context) string

OutgoingPublicKeyID returns the public key ID (URI) associated with context. This value is useful for logging situations in which a given public key URI is relevant, e.g. for outgoing requests being signed by the given key.

func ReceivingAccount added in v0.10.0

func ReceivingAccount(ctx context.Context) *gtsmodel.Account

ReceivingAccount returns the local account who owns the resource being interacted with (inbox, uri, etc) in the current ActivityPub request chain.

func RequestID added in v0.9.0

func RequestID(ctx context.Context) string

RequestID returns the request ID associated with context. This value will usually be set by the request ID middleware handler, either pulling an existing supplied value from request headers, or generating a unique new entry. This is useful for tying together log entries associated with an original incoming request.

func RequestingAccount added in v0.10.0

func RequestingAccount(ctx context.Context) *gtsmodel.Account

RequestingAccount returns the remote account interacting with a local resource (inbox, uri, etc) in the current ActivityPub request chain.

func SetBarebones

func SetBarebones(ctx context.Context) context.Context

SetBarebones sets the "barebones" context flag and returns this wrapped context. See Barebones() for further information on the "barebones" context flag.

func SetDryRun added in v0.10.0

func SetDryRun(ctx context.Context) context.Context

SetDryRun sets the "dryrun" context flag and returns this wrapped context. See DryRun() for further information on the "dryrun" context flag.

func SetFastFail added in v0.9.0

func SetFastFail(ctx context.Context) context.Context

SetFastFail sets the "fastfail" context flag and returns this wrapped context. See IsFastFail() for further information on the "fastfail" context flag.

func SetHTTPClientSignFunc added in v0.15.0

func SetHTTPClientSignFunc(ctx context.Context, fn func(*http.Request) error) context.Context

SetHTTPClientSignFunc stores the given httpclient signing function and returns the wrapped context. See HTTPClientSignFunc() for further information on the signing function value.

func SetHTTPSignature added in v0.10.0

func SetHTTPSignature(ctx context.Context, signature string) context.Context

SetHTTPSignature stores the given http signature string and returns the wrapped context. See HTTPSignature() for further information on the verifier value.

func SetHTTPSignaturePubKeyID added in v0.10.0

func SetHTTPSignaturePubKeyID(ctx context.Context, pubKeyID *url.URL) context.Context

SetHTTPSignaturePubKeyID stores the given http signature public key id and returns the wrapped context. See HTTPSignaturePubKeyID() for further information on the value.

func SetHTTPSignatureVerifier added in v0.10.0

func SetHTTPSignatureVerifier(ctx context.Context, verifier httpsig.VerifierWithOptions) context.Context

SetHTTPSignatureVerifier stores the given http signature verifier and returns the wrapped context. See HTTPSignatureVerifier() for further information on the verifier value.

func SetOtherIRIs added in v0.10.0

func SetOtherIRIs(ctx context.Context, iris []*url.URL) context.Context

SetOtherIRIs stores the given IRIs slice and returns the wrapped context. See OtherIRIs() for further information on the IRIs slice value.

func SetOutgoingPublicKeyID added in v0.10.0

func SetOutgoingPublicKeyID(ctx context.Context, id string) context.Context

SetOutgoingPublicKeyID stores the given public key ID value and returns the wrapped context. See PublicKeyID() for further information on the public key ID value.

func SetReceivingAccount added in v0.10.0

func SetReceivingAccount(ctx context.Context, acct *gtsmodel.Account) context.Context

SetReceivingAccount stores the given receiving account value and returns the wrapped context. See ReceivingAccount() for further information on the receiving account value.

func SetRequestID added in v0.9.0

func SetRequestID(ctx context.Context, id string) context.Context

SetRequestID stores the given request ID value and returns the wrapped context. See RequestID() for further information on the request ID value.

func SetRequestingAccount added in v0.10.0

func SetRequestingAccount(ctx context.Context, acct *gtsmodel.Account) context.Context

SetRequestingAccount stores the given requesting account value and returns the wrapped context. See RequestingAccount() for further information on the requesting account value.

func WithValues added in v0.11.1

func WithValues(ctx context.Context, values context.Context) context.Context

WithValues wraps 'ctx' to use its deadline, done channel and error, but use value store of 'values'.

Types

This section is empty.

Jump to

Keyboard shortcuts

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