server

package
v0.0.0-...-5238b66 Latest Latest
Warning

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

Go to latest
Published: Feb 1, 2024 License: Apache-2.0 Imports: 26 Imported by: 0

Documentation

Index

Constants

View Source
const RequestForLocationID = "natssync.location.request"

RequestForLocationID send this message to get the location ID

View Source
const ResponseForLocationID = "natssync.location.response"

ResponseForLocationID this is the response subject, the data is the location ID, this message can be sent without a request, if the location ID changes

Variables

This section is empty.

Functions

func GetRouteIDFromAuthHeader

func GetRouteIDFromAuthHeader(c *gin.Context) string

func HandleError

func HandleError(_ *gin.Context, err error) (int, interface{})

func MetricsMiddleware

func MetricsMiddleware(c *gin.Context)

func NewServer

func NewServer() (*server, error)

func RouteHandlerForInternalAPI

func RouteHandlerForInternalAPI(c *gin.Context)

Types

type AboutResponse

type AboutResponse struct {
	AppVersion string `json:"appVersion"`
}

type HttpApiReqMessage

type HttpApiReqMessage struct {
	HttpMethod string
	HttpPath   string
	Body       []byte
	Headers    []HttpReqHeader
	Target     string
}

func NewHttpApiReqMessageFromHttpRequest

func NewHttpApiReqMessageFromHttpRequest(req *http.Request) (*HttpApiReqMessage, error)

func NewHttpApiReqMessageFromNatsMessage

func NewHttpApiReqMessageFromNatsMessage(m *nats.Msg) (*HttpApiReqMessage, error)

func (*HttpApiReqMessage) ToHttpRequest

func (req *HttpApiReqMessage) ToHttpRequest() *http.Request

type HttpApiResponseMessage

type HttpApiResponseMessage struct {
	HttpStatusCode int
	RespBody       string
	RequestID      string
	Headers        map[string]string
}

func NewHttpApiResponseMessageFromError

func NewHttpApiResponseMessageFromError(err error) *HttpApiResponseMessage

func NewHttpApiResponseMessageFromHttpResponse

func NewHttpApiResponseMessageFromHttpResponse(resp *http.Response) *HttpApiResponseMessage

type HttpReqHeader

type HttpReqHeader struct {
	Key    string
	Values []string
}

type JsonError

type JsonError struct {
	Message string `json:"message"`
}

Jump to

Keyboard shortcuts

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