...

Package server

import "github.com/sassoftware/relic/server"
Overview
Index
Subdirectories

Overview ▾

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

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)

Subdirectories

Name Synopsis
..
daemon