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 ¶
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.
Click to show internal directories.
Click to hide internal directories.