nanopush

package
v0.6.0 Latest Latest
Warning

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

Go to latest
Published: Jan 9, 2024 License: MIT Imports: 15 Imported by: 0

Documentation

Overview

Pacakge nanopush implements an Apple APNs HTTP/2 service for MDM. It implements the PushProvider and PushProviderFactory interfaces.

Index

Constants

View Source
const (
	Development     = "https://api.development.push.apple.com"
	Development2197 = "https://api.development.push.apple.com:2197"
	Production      = "https://api.push.apple.com"
	Production2197  = "https://api.push.apple.com:2197"
)

Variables

This section is empty.

Functions

func ClientWithCert

func ClientWithCert(client *http.Client, cert *tls.Certificate) (*http.Client, error)

ClientWithCert configures an mTLS client cert on the HTTP client.

Types

type Doer

type Doer interface {
	Do(req *http.Request) (*http.Response, error)
}

Doer is ostensibly an *http.Client

type Factory

type Factory struct {
	// contains filtered or unexported fields
}

Factory instantiates new PushProviders.

func NewFactory

func NewFactory(opts ...Option) *Factory

NewFactory creates a new Factory.

func (*Factory) NewPushProvider

func (f *Factory) NewPushProvider(cert *tls.Certificate) (push.PushProvider, error)

NewPushProvider generates a new PushProvider given a tls keypair.

type JSONPushError

type JSONPushError struct {
	Reason    string `json:"reason"`
	Timestamp int64  `json:"timestamp"`
}

JSONPushError is a JSON error returned from the APNs service.

func (*JSONPushError) Error

func (e *JSONPushError) Error() string

type NewClient

type NewClient func(*tls.Certificate) (*http.Client, error)

NewClient describes a callback for setting up an HTTP client for Push notifications.

type Option

type Option func(*Factory)

func WithExpiration

func WithExpiration(expiration time.Duration) Option

WithExpiration sets the APNs expiration time for the push notifications.

func WithNewClient

func WithNewClient(newClient NewClient) Option

WithNewClient sets a callback to setup an HTTP client for each new Push provider.

func WithWorkers

func WithWorkers(workers int) Option

WithWorkers sets how many worker goroutines to use when sending pushes.

type Provider

type Provider struct {
	// contains filtered or unexported fields
}

Provider sends pushes to Apple's APNs servers.

func (*Provider) Push

func (p *Provider) Push(ctx context.Context, pushInfos []*mdm.Push) (map[string]*push.Response, error)

Push sends APNs pushes to MDM enrollments.

Jump to

Keyboard shortcuts

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