http

package
v0.0.0-...-859f6d4 Latest Latest
Warning

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

Go to latest
Published: Mar 30, 2024 License: Apache-2.0 Imports: 15 Imported by: 0

Documentation

Index

Constants

View Source
const (
	HeaderKey = "Authorization"
)
View Source
const (
	PluginHTTP = "http"
)

Constants

Variables

This section is empty.

Functions

func MiddlewareBasicAuthentication

func MiddlewareBasicAuthentication(username, password string, next http.Handler) http.Handler

func NewDevice

func NewDevice(ctx context.Context, ID string, config cmap.CustomMap, rxFunc func(msg *model.Message), statusFunc func(state *model.State)) (deviceType.Plugin, error)

New http client

Types

type Config

type Config struct {
	ListenAddress string `yaml:"listen_address"`
	IsAuthEnabled bool   `yaml:"is_auth_enabled"`
	Username      string `yaml:"username"`
	Password      string `yaml:"password" json:"-"`
}

Config details

type Endpoint

type Endpoint struct {
	ID     string
	Config *Config
	// contains filtered or unexported fields
}

Endpoint data

func (*Endpoint) Close

func (ep *Endpoint) Close() error

Close the driver

func (*Endpoint) Name

func (ep *Endpoint) Name() string

func (*Endpoint) Write

func (ep *Endpoint) Write(message *model.Message) error

type RequestData

type RequestData struct {
	Method          string              `json:"method"`
	RemoteAddress   string              `json:"remoteAddress"`
	Host            string              `json:"host"`
	Path            string              `json:"path"`
	Body            string              `json:"body"`
	QueryParameters map[string][]string `json:"queryParameters"`
	Headers         map[string][]string `json:"headers"`
	Timestamp       time.Time           `json:"timestamp"`
}

Jump to

Keyboard shortcuts

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