webhook

package module
v0.1.1 Latest Latest
Warning

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

Go to latest
Published: Jul 23, 2019 License: Apache-2.0 Imports: 1 Imported by: 10

README

wrp-listener

wrp-listener is a library that provides a webhook registerer and a validation function to be used for authentication.

Build Status codecov.io Code Climate Issue Count Go Report Card Apache V2 License GitHub release GoDoc

Summary

Wrp-listener provides packages to help a consumer register to a webhook and authenticate messages received. Registering to a webhook can be done directly or set up to run at an interval. Message authentication is set up to work with the bascule library.

Install

Add details here.

Contributing

Refer to CONTRIBUTING.md.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Config

type Config struct {
	// The URL to deliver messages to.
	URL string `json:"url"`

	// The content-type to set the messages to (unless specified by WRP).
	ContentType string `json:"content_type"`

	// The secret to use for the SHA1 HMAC.
	// Optional, set to "" to disable behavior.
	Secret string `json:"secret,omitempty"`

	// The max number of times to retry for webhook
	MaxRetryCount int `json:"max_retry_count,omitempty"`

	// alt_urls is a list of explicit URLs that should be round robin on faliure
	AlternativeURLs []string `json:"alt_urls,omitempty"`
}

Configuration for message delivery

type Matcher

type Matcher struct {
	// The list of regular expressions to match device id type against.
	DeviceID []string `json:"device_id"`
}

Matcher type contains values to match against the metadata.

type W

type W struct {
	// Configuration for message delivery
	Config Config `json:"config"`

	// The URL to notify when we cut off a client due to overflow.
	// Optional, set to "" to disable behavior
	FailureURL string `json:"failure_url"`

	// The list of regular expressions to match event type against.
	Events []string `json:"events"`

	// Matcher type contains values to match against the metadata.
	Matcher Matcher `json:"matcher,omitempty"`

	// The specified duration for this hook to live
	Duration time.Duration `json:"duration"`

	// The absolute time when this hook is to be disabled
	Until time.Time `json:"until"`

	// The address that performed the registration
	Address string `json:"registered_from_address"`
}

W is the structure that represents the Webhook listener data we share.

(Note to Wes: this follows the golang naming conventions. webhook.Webhook "stutters", and this type is really the central type of this package. Calling it a single letter is the norm. This could also go in the server package, in which case I'd change the name to Webhook, since service.Webhook works better. See https://blog.golang.org/package-names)

Directories

Path Synopsis
examples
basicListener Module
timedListener Module

Jump to

Keyboard shortcuts

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