modhttp

package module
v0.0.0-...-614472a Latest Latest
Warning

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

Go to latest
Published: Jun 17, 2024 License: Apache-2.0 Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrServerAlreadyRunning = errors.New("server already running")

Functions

This section is empty.

Types

type AuthCb

type AuthCb func(request *RequestEventSubmission) bool

Within RequestEventSubmission, we optionally add Auth with allows users to encode their preferred auth info. This cb sends that back to the user to perform auth, then a simple T/F return dictates if the request is ok

type Config

type Config struct {
	Address                  string
	GracefulShutdownDuration time.Duration
	AuthCb                   AuthCb
}

type Endpoint

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

Endpoint is the http endpoint that contains all of the required data to get http off the wire and formed into a proper nerv event for publishing

func New

func New(cfg Config, engine *nerv.Engine) *Endpoint

Create the endpoint structure that will be used as the nerv Module interface

func (*Endpoint) GetName

func (ep *Endpoint) GetName() string

func (*Endpoint) RecvModulePane

func (ep *Endpoint) RecvModulePane(p *nerv.ModulePane)

func (*Endpoint) Shutdown

func (ep *Endpoint) Shutdown()

Module interface requirement - Obvious functionality

func (*Endpoint) Start

func (ep *Endpoint) Start() error

Module interface requirement - Obvious functionality

type PingResponse

type PingResponse struct {
	TotalPings int
	TotalFails int
}

func SubmitPing

func SubmitPing(address string, count int, max_failures int) PingResponse

Attempt to ping a server to see if its actually a nerv modhttp

type RequestEventSubmission

type RequestEventSubmission struct {
	Auth  interface{}
	Event nerv.Event
}

type SubmissionResponse

type SubmissionResponse struct {
	Status string
	Body   string
}

func SubmitEvent

func SubmitEvent(address string, event *nerv.Event) (*SubmissionResponse, error)

Submit an event without Auth information

func SubmitEventWithAuth

func SubmitEventWithAuth(address string, event *nerv.Event, auth interface{}) (*SubmissionResponse, error)

Submit an event with the optional Auth interface. Auth will be encoded into JSON with the rest of the message. The server, detecting Auth, will execute server-side callback to have the information analyzed, and conditionally, permit the event submission

Jump to

Keyboard shortcuts

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