http

package
v0.4.0 Latest Latest
Warning

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

Go to latest
Published: May 23, 2023 License: MIT Imports: 12 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// ShutdownTimeout is the time given for outstanding requests to finish before shutdown.
	DefaultShutdownTimeout = 10 * time.Second
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Config

type Config struct {
	Scheme string `toml:"scheme"`
	Host   string `toml:"host"`
	Port   string `toml:"port"`

	Prometheus PrometheusConfig `toml:"prometheus"`
}

type PrometheusConfig added in v0.4.0

type PrometheusConfig struct {
	Enabled bool   `toml:"enabled"`
	Port    string `toml:"port"`
}

type Server

type Server struct {
	LinkService shortly.LinkService

	Prom struct {
		// contains filtered or unexported fields
	}
	// contains filtered or unexported fields
}

func NewServer

func NewServer(c Config) *Server

func (*Server) Close

func (s *Server) Close() error

Close gracefully shuts down the server.

func (*Server) MetricsPort added in v0.4.0

func (s *Server) MetricsPort() int

MetricsPort returns the TCP port for the running metrics server. This is useful in tests where we allocate a random port by using ":0".

func (*Server) Open

func (s *Server) Open() (err error)

Open validates the server options and begins listening on the bind address.

func (*Server) Port

func (s *Server) Port() int

Port returns the TCP port for the running server. This is useful in tests where we allocate a random port by using ":0".

func (*Server) URL

func (s *Server) URL() string

url returns the local base URL of the running server.

Jump to

Keyboard shortcuts

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