thttp

package
v0.0.0 Latest Latest
Warning

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

Go to latest
Published: Apr 4, 2019 License: MIT Imports: 12 Imported by: 0

Documentation

Index

Constants

View Source
const (
	//StdPort defines the standard port for thttp yarf
	StdPort string = "23456"

	//StdProtocol defines the standard protocol for thttp yarf
	StdProtocol string = "http"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Client

type Client struct {
	Timeout time.Duration
}

Client defines the server config used

type Discovery

type Discovery interface {
	URL() (string, error)
}

Discovery defines the interface needed to support http discovery

type DiscoveryDNSA

type DiscoveryDNSA struct {
	Protocol string
	Host     string
	Port     string

	Resolv string
	// contains filtered or unexported fields
}

DiscoveryDNSA defines a discover using dns A records to round robin

func (*DiscoveryDNSA) URL

func (d *DiscoveryDNSA) URL() (string, error)

URL implements the Discovery interface

type DiscoveryDefault

type DiscoveryDefault struct {
	Protocol string
	Host     string
	Port     string
}

DiscoveryDefault defines the default discovery using the provided host name

func (*DiscoveryDefault) URL

func (d *DiscoveryDefault) URL() (string, error)

URL implements the Discovery interface

type HTTPTransporter

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

HTTPTransporter implements the yarf.Transport for using http as a transport protocol

func NewHTTPTransporter

func NewHTTPTransporter(options Options) (*HTTPTransporter, error)

NewHTTPTransporter a constructor for the HTTPTransporter

func (*HTTPTransporter) Call

func (h *HTTPTransporter) Call(ctx context.Context, function string, requestData []byte) (response []byte, err error)

Call implements client side call of transporter

func (*HTTPTransporter) Close

func (h *HTTPTransporter) Close() error

Close halts the http server to receive requests

func (*HTTPTransporter) Listen

func (h *HTTPTransporter) Listen(function string, toExec func(ctx context.Context, requestData []byte) (responseData []byte)) (err error)

Listen defines the function that will handle yarf requests

func (*HTTPTransporter) Start

func (h *HTTPTransporter) Start() error

Start initiates the http server to receive requests

type Options

type Options struct {
	Server    Server
	Client    Client
	Discovery Discovery
}

Options defines the options used by the http yarf transport

type Server

type Server struct {
	Addr      string
	TLSConfig *tls.Config
	// contains filtered or unexported fields
}

Server defines the server config used

Jump to

Keyboard shortcuts

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