ghwebhook

package module
v0.0.0-...-a88c19b Latest Latest
Warning

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

Go to latest
Published: Apr 12, 2019 License: MIT Imports: 12 Imported by: ? modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

README

ghwebhook

USAGE

package main

import (
	"log"
	"net/http"

	"github.com/google/go-github/github"
	"github.com/shogo82148/ghwebhook"
)

func main() {
	h := &ghwebhook.Webhook{
		// recommend to set secret
		Secret:       "very-secret-string",
		DB:          db,

		// Restrict IP address
		RestrictAddr: true,
		TrustAddrs:   []string{"::1/128", "127.0.0.0/8"},

		Ping: func(e *github.PingEvent, db *sql.DB) {
			log.Printf("%#v", e)
		},
	}
	http.ListenAndServe(":8080", h)
}

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Webhook

type Webhook struct {
	// Secret is Secret in Github Settings/Webhooks/Manage webhook
	Secret string

	// RestrictAddr enables restrict Service Hook IP Addresses
	// https://help.github.com/articles/github-s-ip-addresses/
	RestrictAddr bool

	// TrustAddrs is the list of trusted IP address (e.g. reverse proxies)
	TrustAddrs []string

	// Database
	DB *sql.DB

	CommitComment            func(e *github.CommitCommentEvent, db *sql.DB)
	Create                   func(e *github.CreateEvent, db *sql.DB)
	Delete                   func(e *github.DeleteEvent, db *sql.DB)
	Deployment               func(e *github.DeploymentEvent, db *sql.DB)
	DeploymentStatus         func(e *github.DeploymentStatusEvent, db *sql.DB)
	Fork                     func(e *github.ForkEvent, db *sql.DB)
	Gollum                   func(e *github.GollumEvent, db *sql.DB)
	Installation             func(e *github.InstallationEvent, db *sql.DB)
	InstallationRepositories func(e *github.InstallationRepositoriesEvent, db *sql.DB)
	IssueComment             func(e *github.IssueCommentEvent, db *sql.DB)
	Issues                   func(e *github.IssuesEvent, db *sql.DB)
	Label                    func(e *github.LabelEvent, db *sql.DB)
	Member                   func(e *github.MemberEvent, db *sql.DB)
	Membership               func(e *github.MembershipEvent, db *sql.DB)
	Milestone                func(e *github.MilestoneEvent, db *sql.DB)
	Organization             func(e *github.OrganizationEvent, db *sql.DB)
	OrgBlock                 func(e *github.OrgBlockEvent, db *sql.DB)
	PageBuild                func(e *github.PageBuildEvent, db *sql.DB)
	Ping                     func(e *github.PingEvent, db *sql.DB)
	Project                  func(e *github.ProjectEvent, db *sql.DB)
	ProjectCard              func(e *github.ProjectCardEvent, db *sql.DB)
	ProjectColumn            func(e *github.ProjectColumnEvent, db *sql.DB)
	Public                   func(e *github.PublicEvent, db *sql.DB)
	PullRequestReview        func(e *github.PullRequestReviewEvent, db *sql.DB)
	PullRequestReviewComment func(e *github.PullRequestReviewCommentEvent, db *sql.DB)
	PullRequest              func(e *github.PullRequestEvent, db *sql.DB)
	Push                     func(e *github.PushEvent, db *sql.DB)
	Repository               func(e *github.RepositoryEvent, db *sql.DB)
	Release                  func(e *github.ReleaseEvent, db *sql.DB)
	Status                   func(e *github.StatusEvent, db *sql.DB)
	Team                     func(e *github.TeamEvent, db *sql.DB)
	TeamAdd                  func(e *github.TeamAddEvent, db *sql.DB)
	Watch                    func(e *github.WatchEvent, db *sql.DB)
	// contains filtered or unexported fields
}

Webhook is a receiver for github webhook.

func (*Webhook) ServeHTTP

func (h *Webhook) ServeHTTP(w http.ResponseWriter, r *http.Request)

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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