internal

package
v1.5.0 Latest Latest
Warning

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

Go to latest
Published: Feb 2, 2021 License: MIT Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Handler

func Handler(secret string, l logger.Logger, fn WebHookHandler) http.HandlerFunc

func HashPayload

func HashPayload(secret string, playloadBody []byte) string

HashPayload computes the hash of payload's body according to the webhook's secret token see https://developer.github.com/webhooks/securing/#validating-payloads-from-github returning the hash as a hexadecimal string

func IsValidPayload

func IsValidPayload(secret, headerHash string, payload []byte) bool

IsValidPayload checks if the github payload's hash fits with the hash computed by GitHub sent as a header

Types

type Backend added in v1.5.0

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

func NewBackend added in v1.5.0

func NewBackend(debug ...bool) *Backend

实例化对象 不管实例多少次,对象就创建一次。

func (*Backend) Add added in v1.5.0

func (b *Backend) Add(fn func())

添加服务

type GitHubRepo

type GitHubRepo struct {
	Name        string // repository name
	FullName    string // repository full name
	CloneURL    string // repository url
	CommitID    string // push commit id
	CommitName  string // push repo name
	CommitEmail string // push repo email
	CommitAt    string // push time
	BranchName  string // branch name
}

repo info

type PayloadPong

type PayloadPong struct {
	Ok    bool   `json:"ok"`
	Event string `json:"event"`
	Error string `json:"error,omitempty"`
}

type WebHookHandler

type WebHookHandler func(eventName string, payload *GitHubRepo, req *http.Request) error

Jump to

Keyboard shortcuts

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