http

package
v0.3.3 Latest Latest
Warning

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

Go to latest
Published: Jun 16, 2021 License: Apache-2.0 Imports: 11 Imported by: 0

README

Grav Transport: HTTP

This repo is a simple transport plugin for Grav that uses basic HTTP/S.

Handler functions are made available for Vektor and http.Server, all managed by the GravTransportHTTP object that emits events to a set of HTTP endpoints.

grav-transport-http is in prototype stages, not ready for use

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Endpoint

type Endpoint struct {
	URL *url.URL
	// contains filtered or unexported fields
}

Endpoint represents an HTTP endpoint that is "connected"

func (*Endpoint) CanReplace

func (e *Endpoint) CanReplace() bool

CanReplace returns true if the connection can be replaced

func (*Endpoint) Close

func (e *Endpoint) Close()

Close "closes" the connection

func (*Endpoint) DoIncomingHandshake

func (e *Endpoint) DoIncomingHandshake(ack *grav.TransportHandshakeAck) (*grav.TransportHandshake, error)

DoIncomingHandshake does an incoming handshake

func (*Endpoint) DoOutgoingHandshake

func (e *Endpoint) DoOutgoingHandshake(handshake *grav.TransportHandshake) (*grav.TransportHandshakeAck, error)

DoOutgoingHandshake does an outgoing handshake

func (*Endpoint) Send

func (e *Endpoint) Send(msg grav.Message) error

Send sends a message to the connection

func (*Endpoint) Start

func (e *Endpoint) Start(recvFunc grav.ReceiveFunc)

Start "starts" the connection

type Transport

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

Transport is an HTTP handler manager that pushes messages into a bus

func New

func New() *Transport

New creates a new http transport

func (*Transport) CreateConnection

func (t *Transport) CreateConnection(endpoint string) (grav.Connection, error)

CreateConnection adds an HTTP/S endpoint to emit messages to

func (*Transport) HTTPHandlerFunc

func (t *Transport) HTTPHandlerFunc() http.HandlerFunc

HTTPHandlerFunc returns an http.HandlerFunc for incoming messages

func (*Transport) HandlerFunc

func (t *Transport) HandlerFunc() vk.HandlerFunc

HandlerFunc returns a vk handlerFunc for incoming messages use HTTPHAndlerFunc for a regular Go http.HandlerFunc

func (*Transport) Setup

func (t *Transport) Setup(opts *grav.TransportOpts, connFunc grav.ConnectFunc, findFunc grav.FindFunc) error

Setup sets the transport up for connections

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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