server

package
v7.0.2+incompatible Latest Latest
Warning

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

Go to latest
Published: Jul 5, 2018 License: Apache-2.0 Imports: 30 Imported by: 7

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetClientDN

func GetClientDN(request *http.Request) string

func GetClientIP

func GetClientIP(request *http.Request) string

func GetClientName

func GetClientName(request *http.Request) string

func GetClientRoles

func GetClientRoles(request *http.Request) []string

Types

type Response

type Response interface {
	Headers() map[string]string
	Status() int
	Bytes() []byte
}
var AccessDeniedResponse Response = &bytesResponse{
	StatusCode:  http.StatusForbidden,
	ContentType: "text/plain",
	Body:        []byte("Access denied\r\n"),
}

func BytesResponse

func BytesResponse(body []byte, contentType string) Response

func ErrorResponse

func ErrorResponse(statusCode int) Response

func JSONResponse

func JSONResponse(data interface{}) (Response, error)

func StringResponse

func StringResponse(statusCode int, body string) Response

type Server

type Server struct {
	Config   *config.Config
	ErrorLog *log.Logger

	Closed <-chan bool
	// contains filtered or unexported fields
}

func New

func New(config *config.Config) (*Server, error)

func (*Server) CheckKeyAccess

func (s *Server) CheckKeyAccess(request *http.Request, keyName string) *config.KeyConfig

func (*Server) Close

func (s *Server) Close() error

func (*Server) Healthy

func (s *Server) Healthy(request *http.Request) bool

func (*Server) LogError

func (s *Server) LogError(request *http.Request, err interface{}, traceback []byte) Response

Log an unhandled error with optional traceback

func (*Server) Logf

func (s *Server) Logf(format string, args ...interface{})

Log a general message

func (*Server) Logr

func (s *Server) Logr(request *http.Request, format string, args ...interface{})

Log a message associated with an ongoing request

func (*Server) ReopenLogger

func (s *Server) ReopenLogger() error

func (*Server) ServeHTTP

func (s *Server) ServeHTTP(writer http.ResponseWriter, request *http.Request)

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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