server

package
v0.0.0-...-7238798 Latest Latest
Warning

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

Go to latest
Published: Dec 13, 2020 License: MIT Imports: 20 Imported by: 0

Documentation

Index

Constants

View Source
const (
	TokenTypeAccess    = "access"
	TokenTypeAccessTTL = time.Duration(15 * time.Minute)
)

Variables

View Source
var (
	DefaultHTTPRequestTimeout = 1 * time.Second

	ErrUnauthorized = errors.New("unauthorized request")
	ErrForbidden    = errors.New("forbidden request")
)
View Source
var (
	MsgStatusOK = []byte("{\"status\": \"OK\"}")
)

JSON messages

Functions

func NewProxy

func NewProxy(cfg config.Config) (proxyServer, error)

Types

type ParsedToken

type ParsedToken struct {
	UID       string
	Type      string
	ExpiresOn int64
}

type Server

type Server struct {
	SVC *http.Server
}

Server is struct with HTTP server and UserService

func NewServer

func NewServer(cfg config.Config) (*Server, error)

NewServer - initialize the http server

func (*Server) Run

func (srv *Server) Run()

Run - function for run server. Support graceful shutdown.

type StatusRecorder

type StatusRecorder struct {
	http.ResponseWriter
	Status int
}

func (*StatusRecorder) WriteHeader

func (r *StatusRecorder) WriteHeader(status int)

Jump to

Keyboard shortcuts

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