server

package
v1.10.0 Latest Latest
Warning

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

Go to latest
Published: Dec 28, 2021 License: Apache-2.0 Imports: 31 Imported by: 0

Documentation

Index

Constants

View Source
const (
	DefaultListenHTTP                = ":80"
	DefaultCacheDuration             = 12 * time.Hour
	DefaultKeepaliveInterval         = 30 * time.Second
	DefaultManagerInterval           = time.Minute
	DefaultAtSenderInterval          = 10 * time.Second
	DefaultMinDelay                  = 10 * time.Second
	DefaultMaxDelay                  = 3 * 24 * time.Hour
	DefaultMessageLimit              = 512
	DefaultFirebaseKeepaliveInterval = time.Hour
)

Defines default config settings

View Source
const (
	DefaultGlobalTopicLimit             = 5000
	DefaultVisitorRequestLimitBurst     = 60
	DefaultVisitorRequestLimitReplenish = 10 * time.Second
	DefaultVisitorEmailLimitBurst       = 16
	DefaultVisitorEmailLimitReplenish   = time.Hour
	DefaultVisitorSubscriptionLimit     = 30
)

Defines all the limits - global topic limit: max number of topics overall - per visitor request limit: max number of PUT/GET/.. requests (here: 60 requests bucket, replenished at a rate of one per 10 seconds) - per visitor email limit: max number of emails (here: 16 email bucket, replenished at a rate of one per hour) - per visitor subscription limit: max number of subscriptions (active HTTP connections) per per-visitor/IP

Variables

This section is empty.

Functions

This section is empty.

Types

type Config added in v1.8.0

type Config struct {
	BaseURL                      string
	ListenHTTP                   string
	ListenHTTPS                  string
	KeyFile                      string
	CertFile                     string
	FirebaseKeyFile              string
	CacheFile                    string
	CacheDuration                time.Duration
	KeepaliveInterval            time.Duration
	ManagerInterval              time.Duration
	AtSenderInterval             time.Duration
	FirebaseKeepaliveInterval    time.Duration
	SMTPSenderAddr               string
	SMTPSenderUser               string
	SMTPSenderPass               string
	SMTPSenderFrom               string
	SMTPServerListen             string
	SMTPServerDomain             string
	SMTPServerAddrPrefix         string
	MessageLimit                 int
	MinDelay                     time.Duration
	MaxDelay                     time.Duration
	GlobalTopicLimit             int
	VisitorRequestLimitBurst     int
	VisitorRequestLimitReplenish time.Duration
	VisitorEmailLimitBurst       int
	VisitorEmailLimitReplenish   time.Duration
	VisitorSubscriptionLimit     int
	BehindProxy                  bool
}

Config is the main config struct for the application. Use New to instantiate a default config struct.

func NewConfig added in v1.8.0

func NewConfig() *Config

NewConfig instantiates a default new server config

type Server

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

Server is the main server, providing the UI and API for ntfy

func New

func New(conf *Config) (*Server, error)

New instantiates a new Server. It creates the cache and adds a Firebase subscriber (if configured).

func (*Server) Run

func (s *Server) Run() error

Run executes the main server. It listens on HTTP (+ HTTPS, if configured), and starts a manager go routine to print stats and prune messages.

func (*Server) Stop added in v1.8.0

func (s *Server) Stop()

Stop stops HTTP (+HTTPS) server and all managers

Jump to

Keyboard shortcuts

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