api

package module
v1.0.4 Latest Latest
Warning

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

Go to latest
Published: Apr 21, 2020 License: Apache-2.0 Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ContentType added in v1.0.0

func ContentType(r *http.Request) string

helper function to get "content-type" from headers

func Error added in v1.0.4

func Error(w http.ResponseWriter, error string, code int)

wrapper for http.Error that additionally logs the error message to std.Output

func XAuthToken added in v1.0.0

func XAuthToken(r *http.Request) string

helper function to get "x-auth-token" from headers

Types

type HTTPMessage added in v1.0.0

type HTTPMessage struct {
	ID              uuid.UUID
	Msg             []byte
	IsAlreadyHashed bool
	Response        chan HTTPResponse
}

type HTTPResponse added in v1.0.0

type HTTPResponse struct {
	Code    int
	Header  map[string][]string
	Content []byte
}

type HTTPServer

type HTTPServer struct {
	MessageHandler chan HTTPMessage
	AuthTokens     map[string]string
}

func (*HTTPServer) Serve added in v1.0.0

func (srv *HTTPServer) Serve(ctx context.Context, wg *sync.WaitGroup)

Jump to

Keyboard shortcuts

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