pushgateway

package
v1.10.1 Latest Latest
Warning

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

Go to latest
Published: Nov 4, 2026 License: MIT Imports: 25 Imported by: 0

Documentation

Overview

Package pushgateway is an HTTP gateway that registers devices and relays sealed pushes to FCM and APNs without ever seeing the notification content.

A client registers a device token and gets back an opaque handle. Only the gateway can open a handle, so the sending server never learns the token. The package never imports a driver module: callers inject drivers as driver.Driver values.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func New

func New(cfg Config) (http.Handler, error)

New validates cfg and returns a handler serving POST /v1/registrations and POST /v1/send.

Types

type Config

type Config struct {
	SealingKeys      []SealingKey     // [0] seals new handles; every entry opens them
	Android          *Platform        // FCM; nil: android registrations answer 400
	IOS              *Platform        // APNs; nil: ios registrations answer 400. The gateway sets setting "sandbox" per send from the handle's apns_env
	ServerPerSecond  float64          // per server key; 0 means 50; burst = ceil(rate), at least 1
	HandlePerMinute  float64          // per device (platform and token); 0 means 30; burst = ceil(rate), at least 1
	Logger           *slog.Logger     // nil means slog.Default()
	Now              func() time.Time // nil means time.Now; addition for tests
	PlaceholderTitle string           // iOS alert shown until the extension decrypts; "" means "Notification"
	PlaceholderBody  string           // "" means "New notification"
}

Config configures a gateway.

type Platform

type Platform struct {
	Driver      driver.Driver
	Credentials map[string]string
	Settings    map[string]string
}

Platform is one delivery route: a Herald driver and the provider credentials and settings it reads, as Herald providers carry them.

type SealingKey

type SealingKey struct {
	ID  string // appears in handles as h1.<ID>.<...>; 1 to 32 chars of [A-Za-z0-9_-]
	Key []byte // 32 bytes, AES-256-GCM
}

SealingKey is an AES-256-GCM key that seals and opens device handles.

Jump to

Keyboard shortcuts

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