Documentation ¶
Index ¶
- Constants
- Variables
- func AllowAllOrigins(w http.ResponseWriter)
- func NoCache(w http.ResponseWriter)
- func XMLEscape(in string) string
- type ApplicationIDs
- type DataRateSettings
- type DownlinkMessage
- type Downlinks
- type EndDeviceIDs
- type GatewayMetadata
- type GitlabTreeObject
- type HandleAppCommand
- type HandleCommandForm
- type HandleFileUpload
- type HandleGitlabBrowser
- func (lab *HandleGitlabBrowser) DownloadGitBlob(ctx context.Context, clientIP, projectID string, paths string, fileName string) (content []byte, err error)
- func (_ *HandleGitlabBrowser) GetRateLimitFactor() int
- func (lab *HandleGitlabBrowser) Handle(w http.ResponseWriter, r *http.Request)
- func (lab *HandleGitlabBrowser) Initialise(logger *lalog.Logger, _ *toolbox.CommandProcessor, ...) error
- func (lab *HandleGitlabBrowser) ListGitObjects(ctx context.Context, projectID string, paths string, maxEntries int) (dirs []string, fileNameID map[string]string, err error)
- func (lab *HandleGitlabBrowser) SelfTest() error
- type HandleHTMLDocument
- type HandleLatestRequestsInspector
- func (_ *HandleLatestRequestsInspector) GetRateLimitFactor() int
- func (_ *HandleLatestRequestsInspector) Handle(w http.ResponseWriter, r *http.Request)
- func (_ *HandleLatestRequestsInspector) Initialise(_ *lalog.Logger, _ *toolbox.CommandProcessor, _ string) error
- func (_ *HandleLatestRequestsInspector) SelfTest() error
- type HandleLoraWANWebhook
- func (_ *HandleLoraWANWebhook) GetRateLimitFactor() int
- func (hand *HandleLoraWANWebhook) Handle(w http.ResponseWriter, r *http.Request)
- func (hand *HandleLoraWANWebhook) Initialise(logger *lalog.Logger, cmdProc *toolbox.CommandProcessor, _ string) error
- func (_ *HandleLoraWANWebhook) SelfTest() error
- type HandleMailMe
- type HandleMessageBank
- type HandleMicrosoftBot
- func (hand *HandleMicrosoftBot) GetRateLimitFactor() int
- func (hand *HandleMicrosoftBot) Handle(w http.ResponseWriter, r *http.Request)
- func (hand *HandleMicrosoftBot) Initialise(logger *lalog.Logger, cmdProc *toolbox.CommandProcessor, _ string) error
- func (hand *HandleMicrosoftBot) RetrieveJWT(ctx context.Context) (MicrosoftBotJwt, error)
- func (hand *HandleMicrosoftBot) SelfTest() error
- type HandleProcessExplorer
- func (_ *HandleProcessExplorer) GetRateLimitFactor() int
- func (explorer *HandleProcessExplorer) Handle(w http.ResponseWriter, r *http.Request)
- func (explorer *HandleProcessExplorer) Initialise(logger *lalog.Logger, _ *toolbox.CommandProcessor, _ string) error
- func (explorer *HandleProcessExplorer) SelfTest() error
- type HandlePrometheus
- type HandleRecurringCommands
- func (_ *HandleRecurringCommands) GetRateLimitFactor() int
- func (notif *HandleRecurringCommands) Handle(w http.ResponseWriter, r *http.Request)
- func (notif *HandleRecurringCommands) Initialise(logger *lalog.Logger, cmdProc *toolbox.CommandProcessor, ...) error
- func (_ *HandleRecurringCommands) SelfTest() error
- type HandleReportsRetrieval
- func (hand *HandleReportsRetrieval) GetRateLimitFactor() int
- func (hand *HandleReportsRetrieval) Handle(w http.ResponseWriter, r *http.Request)
- func (hand *HandleReportsRetrieval) Initialise(_ *lalog.Logger, cmdProc *toolbox.CommandProcessor, _ string) error
- func (_ *HandleReportsRetrieval) SelfTest() error
- type HandleRequestInspector
- type HandleSystemInfo
- type HandleTwilioCallCallback
- func (hand *HandleTwilioCallCallback) GetRateLimitFactor() int
- func (hand *HandleTwilioCallCallback) Handle(w http.ResponseWriter, r *http.Request)
- func (hand *HandleTwilioCallCallback) Initialise(logger *lalog.Logger, cmdProc *toolbox.CommandProcessor, ...) error
- func (_ *HandleTwilioCallCallback) SelfTest() error
- type HandleTwilioCallHook
- func (hand *HandleTwilioCallHook) GetRateLimitFactor() int
- func (hand *HandleTwilioCallHook) Handle(w http.ResponseWriter, r *http.Request)
- func (hand *HandleTwilioCallHook) Initialise(logger *lalog.Logger, cmdProc *toolbox.CommandProcessor, ...) error
- func (_ *HandleTwilioCallHook) SelfTest() error
- type HandleTwilioSMSHook
- func (hand *HandleTwilioSMSHook) GetRateLimitFactor() int
- func (hand *HandleTwilioSMSHook) Handle(w http.ResponseWriter, r *http.Request)
- func (hand *HandleTwilioSMSHook) Initialise(logger *lalog.Logger, cmdProc *toolbox.CommandProcessor, _ string) error
- func (_ *HandleTwilioSMSHook) SelfTest() error
- type HandleVirtualMachine
- type HandleVirtualMachineScreenshot
- func (_ *HandleVirtualMachineScreenshot) GetRateLimitFactor() int
- func (handler *HandleVirtualMachineScreenshot) Handle(w http.ResponseWriter, r *http.Request)
- func (_ *HandleVirtualMachineScreenshot) Initialise(*lalog.Logger, *toolbox.CommandProcessor, string) error
- func (_ *HandleVirtualMachineScreenshot) SelfTest() error
- type HandleWebProxy
- type Handler
- type LORADataRate
- type Location
- type Locations
- type MessageReception
- type MessageSettings
- type MicrosoftBotIncomingChat
- type MicrosoftBotIncomingConversation
- type MicrosoftBotJwt
- type MicrosoftBotReply
- type PacketBroker
- type UplinkMessage
- type WebHookPayload
Constants ¶
const ( // FileUploadMaxSizeBytes is the approximate maximum size of file acceptable for upload (~64MB). FileUploadMaxSizeBytes = 64 * 1024 * 1024 // FileUploadCleanUpIntervalSec is the interval at which uploaded files are gone through one by one and outdated ones are deleted FileUploadCleanUpIntervalSec = 180 // FileUploadExpireInSec is the expiration of uploaded files measured in seconds. FileUploadExpireInSec = 24 * 3600 )
const ( GitlabAPITimeoutSec = 110 // Timeout for outgoing API calls made to gitlab GitlabMaxObjects = 4000 // GitlabMaxObjects is the maximum number of objects to list when browsing a git repository. )
const ( // HTMLCurrentDateTime is the string anchor to be replaced by current system time in rendered HTML output. HTMLCurrentDateTime = "#LAITOS_3339TIME" // HTMLClientAddress it the string anchor to be replaced by HTTP client IP address in rendered HTML output. HTMLClientAddress = "#LAITOS_CLIENTADDR" )
const ( DownlinkPriorityNormal = "NORMAL" // AppCommandPort is the magic LoRaWAN port number for a transceiver to // transmit an app command. AppCommandPort = 112 // AppCommandPort is the magic LoRaWAN port number for a transceiver to // transmit a text message. MessagePort = 129 // LoraWANMaxDownlinkMessageLength is the maximum length of a downlink message // that can be handled by LoRaWAN at SF9/125kHz. LoraWANMaxDownlinkMessageLength = 100 )
const ( MicrosoftBotAPITimeoutSec = 30 // MicrosoftBotAPITimeoutSec is the timeout seconds for outgoing HTTP calls. MicrosoftBotCommandTimeoutSec = 30 // Command execution for Microsoft bot is constrained by this timeout. /* MicrosoftBotAPIRateLimitFactor allows (API rate limit factor * BaseRateLimit) number of requests to be made by Microsoft bot platform, per HTTP server rate limit interval. Be aware that API handlers place an extra rate limit based on incoming chat user. This rate limit is designed to protect brute force PIN attack from accidentally exposed API handler URL. */ MicrosoftBotAPIRateLimitFactor = 16 /* MicrosoftBotUserRateLimitIntervalSec is an interval measured in number of seconds that an incoming conversation is allowed to invoke bot command routine. This rate limit is designed to prevent spam chats. */ MicrosoftBotUserRateLimitIntervalSec = 5 )
const ( // ProxyInjectJS is a javascript snippet injected into proxy-target web page for activation of proxy on page elements. ProxyInjectJS = `` /* 4518-byte string literal not displayed */ ProxyTargetTimeoutSec = 120 // ProxyTimeoutSec is the IO timeout for downloading proxy's target URL. )
const ( /* DefaultLinuxDistributionURL is the download URL of PuppyLinux, recommended for use with remote virtual machine controls. PuppyLinux is lightweight yet functional, it has been thoroughly tested with the remote virtual machine control feature. */ DefaultLinuxDistributionURL = "http://distro.ibiblio.org/puppylinux/puppy-fossa/fossapup64-9.5.iso" // HandleVirtualMachinePage is the web template of the virtual machine remote control. HandleVirtualMachinePage = `` /* 2295-byte string literal not displayed */ )
const ( /* TwilioHandlerTimeoutSec is Twilio's HTTP client timeout. As of 2017-02-23, the timeout of 14 seconds is enforced on both SMS and telephone call hooks. To leave some room for IO transfer, the command timeout takes away two seconds from the absolute timeout of 14 seconds. */ TwilioHandlerTimeoutSec = 14 - 2 /* TwilioPhoneticSpellingMagic is the prefix magic to dial in order to have output read back phonetically. The magic must not hinder DTMF PIN input, therefore it begins with 0, which is a DTMF space and cannot be part of a PIN. */ TwilioPhoneticSpellingMagic = "0123" /* TwilioAPIRateLimitFactor allows (API rate limit factor * BaseRateLimit) number of requests to be made by Twilio platform per HTTP server rate limit interval. Be aware that API handlers place an extra rate limit based on incoming phone number. This rate limit is designed to protect brute force PIN attack from accidentally exposed API handler URL. */ TwilioAPIRateLimitFactor = 8 /* TwilioPhoneNumberRateLimitIntervalSec is an interval measured in number of seconds that an incoming phone number is allowed to invoke SMS or voice call routine. This rate limit is designed to prevent spam SMS and calls. */ TwilioPhoneNumberRateLimitIntervalSec = 10 )
const ( // AppBankMaxMessageLength is the maximum length of a single message the // message bank web page will be able to store in the outgoing direction. // A longer message will be truncated before it is stored in the outgoing // direction. AppBankMaxMessageLength = 1024 )
const HTTPClienAppCommandTimeout = 59
HTTPClienAppCommandTimeout is the timeout of app command execution in seconds shared by all capable HTTP endpoints.
const HandleCommandFormPage = `` /* 235-byte string literal not displayed */
const HandleFileUploadPage = `` /* 487-byte string literal not displayed */
HandleFileUploadPage is the HTML source code template of the file upload page.
const HandleGitlabPage = `` /* 572-byte string literal not displayed */
const HandleMailMePage = `` /* 572-byte string literal not displayed */
const HandleMessageBankPage = `` /* 814-byte string literal not displayed */
const HandleRecurringCommandsSetupPage = `` /* 626-byte string literal not displayed */
Variables ¶
var ProxyRemoveRequestHeaders = []string{"Host", "Content-Length", "Accept-Encoding", "Content-Security-Policy", "Set-Cookie"}
var ProxyRemoveResponseHeaders = []string{"Host", "Content-Length", "Transfer-Encoding", "Content-Security-Policy", "Set-Cookie"}
Functions ¶
func AllowAllOrigins ¶
func AllowAllOrigins(w http.ResponseWriter)
AllowAllOrigins sets CORS response headers to allow all origins.
func NoCache ¶
func NoCache(w http.ResponseWriter)
Set response headers to prevent client from caching HTTP request or response.
Types ¶
type ApplicationIDs ¶
type ApplicationIDs struct {
ApplicationID string `json:"application_id"`
}
type DataRateSettings ¶
type DataRateSettings struct {
LORA LORADataRate `json:"lora"`
}
type DownlinkMessage ¶
type Downlinks ¶
type Downlinks struct {
DownlinkMessage []DownlinkMessage `json:"downlinks"`
}
func (Downlinks) JSONString ¶
type EndDeviceIDs ¶
type EndDeviceIDs struct { ApplicationIDs ApplicationIDs `json:"application_ids"` DeviceID string `json:"device_id"` DeviceEUI string `json:"dev_eui"` DeviceAddr string `json:"dev_addr"` }
type GatewayMetadata ¶
type GatewayMetadata struct { ReceptionTime string `json:"time"` RSSI float64 `json:"rssi"` SNR float64 `json:"snr"` PacketBroker PacketBroker `json:"packet_broker"` }
type GitlabTreeObject ¶
type GitlabTreeObject struct { ID string `json:"id"` Name string `json:"name"` Type string `json:"type"` FullPath string `json:"path"` }
An element of gitlab API "/repository/tree" response array.
type HandleAppCommand ¶
type HandleAppCommand struct {
// contains filtered or unexported fields
}
HandleAppCommand executes app command from the incoming request.
func (*HandleAppCommand) GetRateLimitFactor ¶
func (hand *HandleAppCommand) GetRateLimitFactor() int
func (*HandleAppCommand) Handle ¶
func (hand *HandleAppCommand) Handle(w http.ResponseWriter, r *http.Request)
func (*HandleAppCommand) Initialise ¶
func (hand *HandleAppCommand) Initialise(_ *lalog.Logger, cmdProc *toolbox.CommandProcessor, _ string) error
func (*HandleAppCommand) SelfTest ¶
func (_ *HandleAppCommand) SelfTest() error
type HandleCommandForm ¶
type HandleCommandForm struct {
// contains filtered or unexported fields
}
Run feature commands in a simple web form.
func (*HandleCommandForm) GetRateLimitFactor ¶
func (_ *HandleCommandForm) GetRateLimitFactor() int
func (*HandleCommandForm) Handle ¶
func (form *HandleCommandForm) Handle(w http.ResponseWriter, r *http.Request)
func (*HandleCommandForm) Initialise ¶
func (form *HandleCommandForm) Initialise(_ *lalog.Logger, cmdProc *toolbox.CommandProcessor, stripURLPrefixFromResponse string) error
func (*HandleCommandForm) SelfTest ¶
func (_ *HandleCommandForm) SelfTest() error
type HandleFileUpload ¶
type HandleFileUpload struct {
// contains filtered or unexported fields
}
HandleFileUploadPage let visitors upload temporary files for retrieval within 24 hours
func (*HandleFileUpload) GetRateLimitFactor ¶
func (_ *HandleFileUpload) GetRateLimitFactor() int
func (*HandleFileUpload) Handle ¶
func (upload *HandleFileUpload) Handle(w http.ResponseWriter, r *http.Request)
func (*HandleFileUpload) Initialise ¶
func (upload *HandleFileUpload) Initialise(logger *lalog.Logger, _ *toolbox.CommandProcessor, stripURLPrefixFromResponse string) error
Initialise prepares handler logger.
func (*HandleFileUpload) SelfTest ¶
func (_ *HandleFileUpload) SelfTest() error
type HandleGitlabBrowser ¶
type HandleGitlabBrowser struct { PrivateToken string `json:"PrivateToken"` // Gitlab user private token Projects map[string]string `json:"Projects"` // Project shortcut name VS "gitlab project ID" Recipients []string `json:"Recipients"` // Recipients of notification emails MailClient inet.MailClient `json:"-"` // MTA that delivers file download notification email // contains filtered or unexported fields }
Browse gitlab repositories and download repository files.
func (*HandleGitlabBrowser) DownloadGitBlob ¶
func (lab *HandleGitlabBrowser) DownloadGitBlob(ctx context.Context, clientIP, projectID string, paths string, fileName string) (content []byte, err error)
Call gitlab API to download a file form git project.
func (*HandleGitlabBrowser) GetRateLimitFactor ¶
func (_ *HandleGitlabBrowser) GetRateLimitFactor() int
func (*HandleGitlabBrowser) Handle ¶
func (lab *HandleGitlabBrowser) Handle(w http.ResponseWriter, r *http.Request)
func (*HandleGitlabBrowser) Initialise ¶
func (lab *HandleGitlabBrowser) Initialise(logger *lalog.Logger, _ *toolbox.CommandProcessor, stripURLPrefixFromResponse string) error
func (*HandleGitlabBrowser) ListGitObjects ¶
func (lab *HandleGitlabBrowser) ListGitObjects(ctx context.Context, projectID string, paths string, maxEntries int) (dirs []string, fileNameID map[string]string, err error)
Call gitlab API to find out what directories and files are located under that path. Directory names come with suffix forward-slash.
func (*HandleGitlabBrowser) SelfTest ¶
func (lab *HandleGitlabBrowser) SelfTest() error
type HandleHTMLDocument ¶
type HandleHTMLDocument struct { // HTMLContent is the content of HTML page, which may contain magic // placeholders. It is OK to configure the handler to serve an empty HTML // page with no content at all. HTMLContent string `json:"HTMLContent"` // HTMLFilePath is the file path to the HTML page, the content of which may // contain placeholders. HTMLFilePath string `json:"HTMLFilePath"` // contains filtered or unexported fields }
HandleHTMLDocument responds to the HTTP request with a static HTML page. The page may contain placeholders (for example "#LAITOS_3339TIME"), which will be substituted with rendered values when the page is served to a client.
func (*HandleHTMLDocument) GetRateLimitFactor ¶
func (_ *HandleHTMLDocument) GetRateLimitFactor() int
func (*HandleHTMLDocument) Handle ¶
func (doc *HandleHTMLDocument) Handle(w http.ResponseWriter, r *http.Request)
func (*HandleHTMLDocument) Initialise ¶
func (doc *HandleHTMLDocument) Initialise(*lalog.Logger, *toolbox.CommandProcessor, string) error
func (*HandleHTMLDocument) SelfTest ¶
func (_ *HandleHTMLDocument) SelfTest() error
type HandleLatestRequestsInspector ¶
type HandleLatestRequestsInspector struct { }
HandleLatestRequestsInspector turns on/off the recording of the latest HTTP requests processed by HTTP daemons, and displays them for inspection.
func (*HandleLatestRequestsInspector) GetRateLimitFactor ¶
func (_ *HandleLatestRequestsInspector) GetRateLimitFactor() int
GetRateLimitFactor returns the rate limit multiplication factor of this handler, which is integer 1.
func (*HandleLatestRequestsInspector) Handle ¶
func (_ *HandleLatestRequestsInspector) Handle(w http.ResponseWriter, r *http.Request)
Handle shows various parameters about the request (e.g. headers, body, etc) in a plain text response.
func (*HandleLatestRequestsInspector) Initialise ¶
func (_ *HandleLatestRequestsInspector) Initialise(_ *lalog.Logger, _ *toolbox.CommandProcessor, _ string) error
Initialise the handler instance. This function always returns nil.
func (*HandleLatestRequestsInspector) SelfTest ¶
func (_ *HandleLatestRequestsInspector) SelfTest() error
SelfTest always returns nil.
type HandleLoraWANWebhook ¶
type HandleLoraWANWebhook struct {
// contains filtered or unexported fields
}
HandleLoraWANWebhook collects an uplink message from LoRaWAN HTTP integration endpoint, if the message carries an app command, the command will be executed by store&forward command processor, and the result will be delivered as a downlink message.
func (*HandleLoraWANWebhook) GetRateLimitFactor ¶
func (_ *HandleLoraWANWebhook) GetRateLimitFactor() int
func (*HandleLoraWANWebhook) Handle ¶
func (hand *HandleLoraWANWebhook) Handle(w http.ResponseWriter, r *http.Request)
func (*HandleLoraWANWebhook) Initialise ¶
func (hand *HandleLoraWANWebhook) Initialise(logger *lalog.Logger, cmdProc *toolbox.CommandProcessor, _ string) error
func (*HandleLoraWANWebhook) SelfTest ¶
func (_ *HandleLoraWANWebhook) SelfTest() error
type HandleMailMe ¶
type HandleMailMe struct { Recipients []string `json:"Recipients"` // Recipients of these mail messages MailClient inet.MailClient `json:"-"` // contains filtered or unexported fields }
Send Howard an email in a simple web form. The text on the page is deliberately written in Chinese.
func (*HandleMailMe) GetRateLimitFactor ¶
func (mm *HandleMailMe) GetRateLimitFactor() int
func (*HandleMailMe) Handle ¶
func (mm *HandleMailMe) Handle(w http.ResponseWriter, r *http.Request)
func (*HandleMailMe) Initialise ¶
func (mm *HandleMailMe) Initialise(logger *lalog.Logger, _ *toolbox.CommandProcessor, stripURLPrefixFromResponse string) error
func (*HandleMailMe) SelfTest ¶
func (mm *HandleMailMe) SelfTest() error
type HandleMessageBank ¶
type HandleMessageBank struct {
// contains filtered or unexported fields
}
func (*HandleMessageBank) GetRateLimitFactor ¶
func (*HandleMessageBank) GetRateLimitFactor() int
func (*HandleMessageBank) Handle ¶
func (bank *HandleMessageBank) Handle(w http.ResponseWriter, r *http.Request)
func (*HandleMessageBank) Initialise ¶
func (bank *HandleMessageBank) Initialise(logger *lalog.Logger, cmdProc *toolbox.CommandProcessor, stripURLPrefixFromResponse string) error
func (*HandleMessageBank) SelfTest ¶
func (*HandleMessageBank) SelfTest() error
type HandleMicrosoftBot ¶
type HandleMicrosoftBot struct { ClientAppID string `json:"ClientAppID"` // ClientAppID is the bot's "app ID". ClientAppSecret string `json:"ClientAppSecret"` // ClientAppSecret is the bot's application "password". // contains filtered or unexported fields }
HandleMicrosoftBot serves a chat bot endpoint for Microsoft bot framework.
func (*HandleMicrosoftBot) GetRateLimitFactor ¶
func (hand *HandleMicrosoftBot) GetRateLimitFactor() int
func (*HandleMicrosoftBot) Handle ¶
func (hand *HandleMicrosoftBot) Handle(w http.ResponseWriter, r *http.Request)
func (*HandleMicrosoftBot) Initialise ¶
func (hand *HandleMicrosoftBot) Initialise(logger *lalog.Logger, cmdProc *toolbox.CommandProcessor, _ string) error
func (*HandleMicrosoftBot) RetrieveJWT ¶
func (hand *HandleMicrosoftBot) RetrieveJWT(ctx context.Context) (MicrosoftBotJwt, error)
RetrieveJWT asks Microsoft for a new JWT for bot API calls.
func (*HandleMicrosoftBot) SelfTest ¶
func (hand *HandleMicrosoftBot) SelfTest() error
type HandleProcessExplorer ¶
type HandleProcessExplorer struct {
// contains filtered or unexported fields
}
HandleProcessExplorer is an HTTP handler that responds with process IDs that are running on the system, and when given a PID as query parameter, the handler inspects the process for its current status and activities for the response.
func (*HandleProcessExplorer) GetRateLimitFactor ¶
func (_ *HandleProcessExplorer) GetRateLimitFactor() int
func (*HandleProcessExplorer) Handle ¶
func (explorer *HandleProcessExplorer) Handle(w http.ResponseWriter, r *http.Request)
func (*HandleProcessExplorer) Initialise ¶
func (explorer *HandleProcessExplorer) Initialise(logger *lalog.Logger, _ *toolbox.CommandProcessor, _ string) error
func (*HandleProcessExplorer) SelfTest ¶
func (explorer *HandleProcessExplorer) SelfTest() error
type HandlePrometheus ¶
type HandlePrometheus struct {
// contains filtered or unexported fields
}
HandlePrometheus serves metrics readings collected by prometheus' global registry and its "default" gatherer.
func (*HandlePrometheus) GetRateLimitFactor ¶
func (prom *HandlePrometheus) GetRateLimitFactor() int
GetRateLimitFactor returns the rate limit factor of this HTTP handler type.
func (*HandlePrometheus) Handle ¶
func (prom *HandlePrometheus) Handle(w http.ResponseWriter, r *http.Request)
Handle responds to the client request with prometheus metrics information in plain text.
func (*HandlePrometheus) Initialise ¶
func (prom *HandlePrometheus) Initialise(logger *lalog.Logger, _ *toolbox.CommandProcessor, stripURLPrefixFromResponse string) error
Initialise initialises the prometheus HTTP handler only if prometheus integration has been enabled globally. Initialising the handler while prometheus integration is not enabled will not result in an error, and the handler will simply respond with HTTP status Service Unavailable to the clients.
func (*HandlePrometheus) SelfTest ¶
func (prom *HandlePrometheus) SelfTest() error
SelfTest always returns nil as no self test capability is provided to prometheus.
type HandleRecurringCommands ¶
type HandleRecurringCommands struct { RecurringCommands map[string]*common.RecurringCommands `json:"RecurringCommands"` // are mappings between arbitrary ID string and associated command timer. // contains filtered or unexported fields }
HandleRecurringCommands is an HTML form for user to manipulate recurring commands, such as adding/clearing transient commands and pushing text message directly into result.
func (*HandleRecurringCommands) GetRateLimitFactor ¶
func (_ *HandleRecurringCommands) GetRateLimitFactor() int
func (*HandleRecurringCommands) Handle ¶
func (notif *HandleRecurringCommands) Handle(w http.ResponseWriter, r *http.Request)
func (*HandleRecurringCommands) Initialise ¶
func (notif *HandleRecurringCommands) Initialise(logger *lalog.Logger, cmdProc *toolbox.CommandProcessor, stripURLPrefixFromResponse string) error
func (*HandleRecurringCommands) SelfTest ¶
func (_ *HandleRecurringCommands) SelfTest() error
type HandleReportsRetrieval ¶
type HandleReportsRetrieval struct {
// contains filtered or unexported fields
}
HandleReportsRetrieval works as a frontend to the store&forward message processor, allowing visitors to view historical reports and assign an app command for a subject to retireve in its next report.
func (*HandleReportsRetrieval) GetRateLimitFactor ¶
func (hand *HandleReportsRetrieval) GetRateLimitFactor() int
func (*HandleReportsRetrieval) Handle ¶
func (hand *HandleReportsRetrieval) Handle(w http.ResponseWriter, r *http.Request)
func (*HandleReportsRetrieval) Initialise ¶
func (hand *HandleReportsRetrieval) Initialise(_ *lalog.Logger, cmdProc *toolbox.CommandProcessor, _ string) error
func (*HandleReportsRetrieval) SelfTest ¶
func (_ *HandleReportsRetrieval) SelfTest() error
type HandleRequestInspector ¶
type HandleRequestInspector struct { }
HandleRequestInspector is an HTTP handler that displays various parameters about the request (e.g. headers, body, etc) in a plain text response.
func (*HandleRequestInspector) GetRateLimitFactor ¶
func (_ *HandleRequestInspector) GetRateLimitFactor() int
GetRateLimitFactor returns the rate limit multiplication factor of this handler, which is integer 1.
func (*HandleRequestInspector) Handle ¶
func (_ *HandleRequestInspector) Handle(w http.ResponseWriter, r *http.Request)
Handle shows various parameters about the request (e.g. headers, body, etc) in a plain text response.
func (*HandleRequestInspector) Initialise ¶
func (_ *HandleRequestInspector) Initialise(_ *lalog.Logger, _ *toolbox.CommandProcessor, _ string) error
Initialise the handler instance. This function always returns nil.
func (*HandleRequestInspector) SelfTest ¶
func (_ *HandleRequestInspector) SelfTest() error
SelfTest always returns nil.
type HandleSystemInfo ¶
type HandleSystemInfo struct { FeaturesToCheck *toolbox.FeatureSet `json:"-"` // Health check subject - features and their API keys CheckMailCmdRunner *mailcmd.CommandRunner `json:"-"` // Health check subject - mail processor and its mailer // contains filtered or unexported fields }
HandleSystemInfo inspects system and application environment and returns them in text report.
func (*HandleSystemInfo) GetRateLimitFactor ¶
func (_ *HandleSystemInfo) GetRateLimitFactor() int
func (*HandleSystemInfo) Handle ¶
func (info *HandleSystemInfo) Handle(w http.ResponseWriter, r *http.Request)
func (*HandleSystemInfo) Initialise ¶
func (info *HandleSystemInfo) Initialise(logger *lalog.Logger, _ *toolbox.CommandProcessor, _ string) error
func (*HandleSystemInfo) SelfTest ¶
func (_ *HandleSystemInfo) SelfTest() error
type HandleTwilioCallCallback ¶
type HandleTwilioCallCallback struct { MyEndpoint string `json:"-"` // URL endpoint to the callback itself, including prefix /. // contains filtered or unexported fields }
Carry on with command processing in Twilio telephone call conversation.
func (*HandleTwilioCallCallback) GetRateLimitFactor ¶
func (hand *HandleTwilioCallCallback) GetRateLimitFactor() int
func (*HandleTwilioCallCallback) Handle ¶
func (hand *HandleTwilioCallCallback) Handle(w http.ResponseWriter, r *http.Request)
func (*HandleTwilioCallCallback) Initialise ¶
func (hand *HandleTwilioCallCallback) Initialise(logger *lalog.Logger, cmdProc *toolbox.CommandProcessor, stripURLPrefixFromResponse string) error
func (*HandleTwilioCallCallback) SelfTest ¶
func (_ *HandleTwilioCallCallback) SelfTest() error
type HandleTwilioCallHook ¶
type HandleTwilioCallHook struct { CallGreeting string `json:"CallGreeting"` // a message to speak upon picking up a call CallbackEndpoint string `json:"-"` // URL (e.g. /handle_my_call) to command handler endpoint (TwilioCallCallback) // contains filtered or unexported fields }
Say a greeting in Twilio phone number's telephone call hook.
func (*HandleTwilioCallHook) GetRateLimitFactor ¶
func (hand *HandleTwilioCallHook) GetRateLimitFactor() int
func (*HandleTwilioCallHook) Handle ¶
func (hand *HandleTwilioCallHook) Handle(w http.ResponseWriter, r *http.Request)
func (*HandleTwilioCallHook) Initialise ¶
func (hand *HandleTwilioCallHook) Initialise(logger *lalog.Logger, cmdProc *toolbox.CommandProcessor, stripURLPrefixFromResponse string) error
func (*HandleTwilioCallHook) SelfTest ¶
func (_ *HandleTwilioCallHook) SelfTest() error
type HandleTwilioSMSHook ¶
type HandleTwilioSMSHook struct {
// contains filtered or unexported fields
}
Handle Twilio phone number's SMS hook.
func (*HandleTwilioSMSHook) GetRateLimitFactor ¶
func (hand *HandleTwilioSMSHook) GetRateLimitFactor() int
func (*HandleTwilioSMSHook) Handle ¶
func (hand *HandleTwilioSMSHook) Handle(w http.ResponseWriter, r *http.Request)
func (*HandleTwilioSMSHook) Initialise ¶
func (hand *HandleTwilioSMSHook) Initialise(logger *lalog.Logger, cmdProc *toolbox.CommandProcessor, _ string) error
func (*HandleTwilioSMSHook) SelfTest ¶
func (_ *HandleTwilioSMSHook) SelfTest() error
type HandleVirtualMachine ¶
type HandleVirtualMachine struct { LocalUtilityPortNumber int `json:"LocalUtilityPortNumber"` ScreenshotEndpoint string `json:"-"` ScreenshotHandlerInstance *HandleVirtualMachineScreenshot `json:"-"` VM *remotevm.VM `json:"-"` // contains filtered or unexported fields }
HandleVirtualMachine is an HTTP handler that offers remote virtual machine controls, excluding the screenshot itself.
func (*HandleVirtualMachine) GetRateLimitFactor ¶
func (_ *HandleVirtualMachine) GetRateLimitFactor() int
GetRateLimitFactor returns 3, which is at least 3 actions/second, more than sufficient for a virtual machine operator.
func (*HandleVirtualMachine) Handle ¶
func (handler *HandleVirtualMachine) Handle(w http.ResponseWriter, r *http.Request)
Handle renders HTML page, reads user input from HTML form submission, and carries out corresponding VM control operations.
func (*HandleVirtualMachine) Initialise ¶
func (handler *HandleVirtualMachine) Initialise(logger *lalog.Logger, _ *toolbox.CommandProcessor, stripURLPrefixFromResponse string) error
Initialise internal state of the HTTP handler.
func (*HandleVirtualMachine) SelfTest ¶
func (_ *HandleVirtualMachine) SelfTest() error
SelfTest is not applicable to this HTTP handler.
type HandleVirtualMachineScreenshot ¶
HandleVirtualMachineScreenshot is an HTTP handler that takes a screenshot of remote virtual machine and serves it in JPEG.
func (*HandleVirtualMachineScreenshot) GetRateLimitFactor ¶
func (_ *HandleVirtualMachineScreenshot) GetRateLimitFactor() int
GetRateLimitFactor returns 3, which is at least 3 screenshots/second, more than sufficient for a virtual machine operator.
func (*HandleVirtualMachineScreenshot) Handle ¶
func (handler *HandleVirtualMachineScreenshot) Handle(w http.ResponseWriter, r *http.Request)
Handle takes a virtual machine screenshot and responds with JPEG image data completed with appropriate HTTP headers.
func (*HandleVirtualMachineScreenshot) Initialise ¶
func (_ *HandleVirtualMachineScreenshot) Initialise(*lalog.Logger, *toolbox.CommandProcessor, string) error
Initialise is not applicable to this HTTP handler, as its internal
func (*HandleVirtualMachineScreenshot) SelfTest ¶
func (_ *HandleVirtualMachineScreenshot) SelfTest() error
SelfTest is not applicable to this HTTP handler.
type HandleWebProxy ¶
type HandleWebProxy struct { /* OwnEndpoint is the URL endpoint to visit the proxy itself. This is configured by user in HTTP server endpoint configuration, and then the HTTP server initialisation routine assigns this URL endpoint including its prefix (/). */ OwnEndpoint string `json:"-"` // contains filtered or unexported fields }
HandleWebProxy is a pretty dumb client-side rendering web proxy, it does not support anonymity.
func (*HandleWebProxy) GetRateLimitFactor ¶
func (xy *HandleWebProxy) GetRateLimitFactor() int
func (*HandleWebProxy) Handle ¶
func (xy *HandleWebProxy) Handle(w http.ResponseWriter, r *http.Request)
func (*HandleWebProxy) Initialise ¶
func (xy *HandleWebProxy) Initialise(logger *lalog.Logger, _ *toolbox.CommandProcessor, stripURLPrefixFromResponse string) error
func (*HandleWebProxy) SelfTest ¶
func (_ *HandleWebProxy) SelfTest() error
type Handler ¶
type Handler interface { // Initialise prepares internal handler states and optionally memorises the logger and command processor instance. Initialise(logger *lalog.Logger, cmdProc *toolbox.CommandProcessor, stripURLPrefixFromResponse string) error // Handle is the HTTP handler implementation that uses handler internal states to serve API requests. Handle(http.ResponseWriter, *http.Request) // GetRateLimitFactor returns how expensive the handler is to execute on a scale from 1 (most expensive) to infinity (least expensive). GetRateLimitFactor() int // SelfTest validates configuration such as connectivity to external service. It may work only after Initialise() succeeds. SelfTest() error }
An HTTP handler function factory.
type LORADataRate ¶
type MessageReception ¶
type MessageReception struct { DeviceID string DeviceAddr string UplinkCounter int UplinkPort int Latitude, Longitude, Altitude float64 Frequency string SpreadingFactor int Bandwidth int NumGateways int GatewayID string RSSI float64 SNR float64 TimeAtReception string StringPayload string }
MessageReception describes the metadata and payload of an uplink message received by a LoRaWAN gateway. The comment will be stored in-memory by message processor app and message bank app.
type MessageSettings ¶
type MessageSettings struct { DataRate DataRateSettings `json:"data_rate"` DataRateIndex int `json:"data_rate_index"` Frequency string `json:"frequency"` }
type MicrosoftBotIncomingChat ¶
type MicrosoftBotIncomingChat struct { Conversation MicrosoftBotIncomingConversation `json:"conversation"` // Conversation will go into reply's "conversation" property. From json.RawMessage `json:"from"` // From will go into reply's "recipient" property. Locale json.RawMessage `json:"locale"` // Locale will go into reply's "locale" property. Recipient json.RawMessage `json:"recipient"` // Recipient will go into reply's "from" property. ID json.RawMessage `json:"id"` // ID will go into reply's "id" property. Text string `json:"text"` // Text is the content of incoming chat message. ServiceURL string `json:"serviceUrl"` // ServiceURL is the prefix name of endpoint to send chat reply to. Timestamp string `json:"timestamp"` // Timestamp is the timestamp of incoming chat message. }
MicrosoftBotIncomingChat is an "Activity object" carried by incoming chat initiated by a user to bot.
type MicrosoftBotIncomingConversation ¶
type MicrosoftBotIncomingConversation struct { ID string `json:"id"` IsGroup json.RawMessage `json:"isGroup"` Name json.RawMessage `json:"name"` }
MicrosoftBotIncomingConversation is the construct of property "conversation" of MicrosoftBotIncomingChat.
type MicrosoftBotJwt ¶
type MicrosoftBotJwt struct { TokenType string `json:"token_type"` // TokenType should always be "Bearer". ExpiresIn int `json:"expires_in"` // ExpiresIn is the number of seconds till expiry. ExtExpiresIn int `json:"ext_expires_in"` // ExtExpiresIn is not relevant, I do not know what it does. AccessToken string `json:"access_token"` // AccessToken is the JWT. ExpiresAt time.Time `json:"-"` // ExpiresAt is the exact time of expiry, calculated by RetrieveJWT function. }
MicrosoftBotJwt is a JWT returned by Microsoft bot framework.
type MicrosoftBotReply ¶
type MicrosoftBotReply struct { Conversation MicrosoftBotIncomingConversation `json:"conversation"` // Conversation value comes from MicrosoftBotIncomingChat. From json.RawMessage `json:"from"` // From value comes from MicrosoftBotIncomingChat's "Recipient". Locale json.RawMessage `json:"locale"` // Locale value comes from MicrosoftBotIncomingChat. Recipient json.RawMessage `json:"recipient"` // Recipient value comes from MicrosoftBotIncomingChat's "From". ReplyToId json.RawMessage `json:"replyToId"` // ReplyToId value comes from MicrosoftBotIncomingChat's "ID". Type string `json:"type"` // Type must be "message". Text string `json:"text"` // Text is the bot's response text. }
MicrosoftBotReply is a message reply to be sent to user who initiated chat with bot.
type PacketBroker ¶
type UplinkMessage ¶
type UplinkMessage struct { PortNumber int `json:"f_port"` Counter int `json:"f_cnt"` RawPayloadBase64 string `json:"frm_payload"` GatewayMetadata []GatewayMetadata `json:"rx_metadata"` MesageSettings MessageSettings `json:"settings"` Locations Locations `json:"locations"` ConsumedAirtime string `json:"consumed_airtime"` }
type WebHookPayload ¶
type WebHookPayload struct { EndDeviceIDs EndDeviceIDs `json:"end_device_ids"` ReceivedByGatewayAt string `json:"received_at"` UplinkMessage UplinkMessage `json:"uplink_message"` }