webhook

package
v0.9.0 Latest Latest
Warning

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

Go to latest
Published: Jan 18, 2020 License: MIT Imports: 10 Imported by: 0

Documentation

Overview

Package webhook contains the functionality for handling outcoming webhooks.

Index

Constants

View Source
const (

	// DefaultTimeoutSeconds is amount of seconds of timeout used by HTTP sender
	DefaultTimeoutSeconds = 10

	// MinHTTPStatusErrorCode is the lowest number of an HTTP response which indicates an error
	MinHTTPStatusErrorCode = 400

	// SignatureHeader is the name of an HTTP header used to which contains signature of a webhook
	SignatureHeader = "X-Gophish-Signature"

	// Sha256Prefix is the prefix that specifies the hashing algorithm used for signature
	Sha256Prefix = "sha256"
)

Variables

This section is empty.

Functions

func Send

func Send(endPoint EndPoint, data interface{}) error

Send sends data to a single EndPoint

func SendAll

func SendAll(endPoints []EndPoint, data interface{})

SendAll sends data to each of the EndPoints

Types

type EndPoint

type EndPoint struct {
	URL    string
	Secret string
}

EndPoint represents and end point to send a webhook to: url and secret by which payload is signed

type Sender

type Sender interface {
	Send(endPoint EndPoint, data interface{}) error
}

Sender defines behaviour of an entity by which webhook is sent

Jump to

Keyboard shortcuts

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