httplistener

package
v0.0.0-...-884d78e Latest Latest
Warning

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

Go to latest
Published: Jul 16, 2021 License: MIT Imports: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type HTTPAPIError

type HTTPAPIError struct {
	Msg string
}

HTTPAPIError is returned when an API method fails. It wraps the error message.

type HTTPAPIResponse

type HTTPAPIResponse struct {
	ServerID string
	// the original type is ResponseType. Here we want the mnemonic string to
	// return in the HTTP API response.
	Type  string
	Data  interface{}
	Error *string
}

HTTPAPIResponse is returned when an API method succeeds. It wraps the content of an api.Response and reworks some of its fields

func NewHTTPAPIResponse

func NewHTTPAPIResponse(r *api.Response) *HTTPAPIResponse

NewHTTPAPIResponse returns an HTTPAPIResponse from an api.Response object. In case of errors, some fields are set accordingly.

type HTTPListener

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

HTTPListener implements the api.Listener interface.

func NewHTTPListener

func NewHTTPListener(listenAddr string) *HTTPListener

func (*HTTPListener) Serve

func (h *HTTPListener) Serve(ctx xcontext.Context, a *api.API) error

Serve implements the api.Listener.Serve interface method. It starts an HTTP API listener and returns an api.Event channel that the caller can iterate on.

Jump to

Keyboard shortcuts

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