server

package
v0.0.0-...-f088481 Latest Latest
Warning

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

Go to latest
Published: Mar 31, 2021 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type HTTPServer

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

HTTPServer is a simple http server with rate limiter

func NewHTTPServer

func NewHTTPServer(opts Opts) *HTTPServer

NewHTTPServer instantiates a new HTTPServer object with the given server configurations

func (*HTTPServer) Start

func (s *HTTPServer) Start(ctx context.Context) error

Start runs the HTTPServer. This is a blocking function. To stop the server, send a cancel signal to the context.

type Opts

type Opts struct {
	Port              int
	RateLimitCount    int
	RateLimitDuration time.Duration
}

Opts stores the configuration options for running HTTP server

Jump to

Keyboard shortcuts

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