Documentation
¶
Index ¶
- Variables
- func ClientIP(r *http.Request, trustedProxy bool) string
- func HoneypotEmpty(value string) bool
- func HoneypotPassed(r *http.Request, field string) bool
- func New(store ports.Store, maxBatchSize int) http.Handler
- func NewWithOptions(store ports.Store, maxBatchSize int, verifier ports.TokenVerifier, ...) http.Handler
- func NewWithSessionTTL(store ports.Store, maxBatchSize int, verifier ports.TokenVerifier, ...) http.Handler
- func RenderHTML(w http.ResponseWriter, template string, vars map[string]any) error
- func SignFormToken(formID string, version int, expiresAt time.Time, secret []byte) (string, error)
- func SignInAppToken(tenantID, appID, subject string, expiresAt time.Time, secret []byte) (string, error)
- func WithAIGateway(gateway *ai.Gateway) func(*Server)
- func WithExtensionHost(host *extension.Host) func(*Server)
- func WithPublicGuard(limiter *IPRateLimiter, captcha CaptchaVerifier, trustedProxy bool) func(*Server)
- type CaptchaRequest
- type CaptchaVerifier
- type FormToken
- type IPRateLimiter
- type InAppToken
- type NoopCaptchaVerifier
- type SESNotification
- type SNSMessage
- type Server
Constants ¶
This section is empty.
Variables ¶
Functions ¶
func ClientIP ¶
ClientIP uses forwarding headers only when the deployment explicitly trusts its proxy. Otherwise RemoteAddr is authoritative.
func HoneypotEmpty ¶
HoneypotEmpty is true only when the hidden bot-trap field is absent or blank.
func HoneypotPassed ¶
HoneypotPassed reads a form field without making assumptions about the submitted payload's schema.
func NewWithOptions ¶
func NewWithSessionTTL ¶
func RenderHTML ¶
RenderHTML renders a pinned public resource and writes it as HTML. Callers are responsible for loading the immutable version; this helper deliberately does not accept a draft resource.
func SignFormToken ¶
SignFormToken creates a compact URL-safe token binding a form to its pinned version and expiry. The signed value is also suitable as a submission idempotency key.
func SignInAppToken ¶
func SignInAppToken(tenantID, appID, subject string, expiresAt time.Time, secret []byte) (string, error)
SignInAppToken creates a compact URL-safe token binding a subject (external_id) to a tenant and app for known-subject inbox access.
func WithAIGateway ¶
WithAIGateway injects a configured gateway for governed AI endpoint tests and deployments that select a custom provider implementation.
func WithExtensionHost ¶
WithExtensionHost enables the governed extension seams for event ingestion.
func WithPublicGuard ¶
func WithPublicGuard(limiter *IPRateLimiter, captcha CaptchaVerifier, trustedProxy bool) func(*Server)
Types ¶
type CaptchaRequest ¶
type CaptchaVerifier ¶
type CaptchaVerifier interface {
Verify(context.Context, CaptchaRequest) error
}
CaptchaVerifier is deliberately pluggable; the v1 default is a no-op and deployments may inject a provider-backed verifier.
type FormToken ¶
type IPRateLimiter ¶
type IPRateLimiter struct {
// contains filtered or unexported fields
}
IPRateLimiter is a deterministic, in-memory token bucket keyed by client IP. A request consumes one token. It is intended for the public HTTP edge; durable abuse controls can be layered in front of it when needed.
func NewIPRateLimiter ¶
func NewIPRateLimiter(ratePerSecond float64, burst int) *IPRateLimiter
func (*IPRateLimiter) Allow ¶
func (l *IPRateLimiter) Allow(ip string) bool
Allow reports whether one request from ip fits in its bucket.
type InAppToken ¶
func VerifyInAppToken ¶
func VerifyInAppToken(token, expectedTenantID, expectedAppID string, secret []byte, now time.Time) (InAppToken, error)
VerifyInAppToken validates the signature, expected tenant/app binding, and expiry. now is injected so expiry behavior remains unit-testable.
type NoopCaptchaVerifier ¶
type NoopCaptchaVerifier struct{}
func (NoopCaptchaVerifier) Verify ¶
func (NoopCaptchaVerifier) Verify(context.Context, CaptchaRequest) error
type SESNotification ¶
type SESNotification struct {
EventType string `json:"eventType"`
Bounce *struct {
BounceType string `json:"bounceType"`
BounceSubType string `json:"bounceSubType"`
BouncedRecipients []struct {
EmailAddress string `json:"emailAddress"`
} `json:"bouncedRecipients"`
} `json:"bounce,omitempty"`
Complaint *struct {
ComplainedRecipients []struct {
EmailAddress string `json:"emailAddress"`
} `json:"complainedRecipients"`
} `json:"complaint,omitempty"`
Delivery *struct {
Timestamp string `json:"timestamp"`
Recipients []string `json:"recipients"`
} `json:"delivery,omitempty"`
Mail struct {
MessageId string `json:"messageId"`
Headers []struct {
Name string `json:"name"`
Value string `json:"value"`
} `json:"headers"`
} `json:"mail"`
}
SESNotification represents the nested message payload sent by Amazon SES inside SNS.
type SNSMessage ¶
type SNSMessage struct {
Type string `json:"Type"`
MessageId string `json:"MessageId"`
Token string `json:"Token,omitempty"`
TopicArn string `json:"TopicArn"`
Subject string `json:"Subject,omitempty"`
Message string `json:"Message"`
Timestamp string `json:"Timestamp"`
SignatureVersion string `json:"SignatureVersion"`
Signature string `json:"Signature"`
SigningCertURL string `json:"SigningCertURL"`
SubscribeURL string `json:"SubscribeURL,omitempty"`
}
SNSMessage represents the standard JSON envelope sent by AWS SNS.
type Server ¶
type Server struct {
// contains filtered or unexported fields
}
func (*Server) SetAllowedTopicARNs ¶
SetAllowedTopicARNs configures the allowed Topic ARNs for incoming SNS callbacks.
func (*Server) SetBlobStore ¶
func (*Server) SetTracking ¶
SetTracking sets the HMAC secret key and tracking base URL used by link redirect and open pixel handlers.
Source Files
¶
- ai_activity.go
- ai_copilot_audience.go
- ai_copilot_content.go
- ai_copilot_insights.go
- ai_copilot_journey.go
- ai_copilot_performance.go
- ai_generation.go
- ai_governance.go
- ai_prompts.go
- callbacks.go
- callbacks_email.go
- campaigns.go
- catalogs.go
- companies.go
- confirm.go
- connectors.go
- device_tokens.go
- dry_run.go
- experiments.go
- extensions.go
- flags.go
- form_submit.go
- forms.go
- identity.go
- imports.go
- ingestion.go
- journeys.go
- lead_scoring.go
- maker_checker.go
- messages.go
- onboarding.go
- overview.go
- pages_assets.go
- publicguard.go
- publicserve.go
- reports.go
- saml.go
- saved_reports.go
- scim.go
- scoring.go
- scoring_models.go
- segments.go
- server.go
- settings.go
- short_links.go
- stages.go
- suppressions.go
- teams.go
- template_export.go
- templates.go
- unsubscribe.go