add vendor & update README.md

This commit is contained in:
henry.chen
2018-11-19 10:24:54 +08:00
parent 010137ebf5
commit 24d81db8be
674 changed files with 301356 additions and 22 deletions

42
vendor/github.com/gin-gonic/autotls/.editorconfig generated vendored Normal file
View File

@@ -0,0 +1,42 @@
# unifying the coding style for different editors and IDEs => editorconfig.org
; indicate this is the root of the project
root = true
###########################################################
; common
###########################################################
[*]
charset = utf-8
end_of_line = LF
insert_final_newline = true
trim_trailing_whitespace = true
indent_style = space
indent_size = 2
###########################################################
; make
###########################################################
[Makefile]
indent_style = tab
[makefile]
indent_style = tab
###########################################################
; markdown
###########################################################
[*.md]
trim_trailing_whitespace = false
###########################################################
; golang
###########################################################
[*.go]
indent_style = tab

27
vendor/github.com/gin-gonic/autotls/.gitignore generated vendored Normal file
View File

@@ -0,0 +1,27 @@
# Compiled Object files, Static and Dynamic libs (Shared Objects)
*.o
*.a
*.so
# Folders
_obj
_test
# Architecture specific extensions/prefixes
*.[568vq]
[568vq].out
*.cgo1.go
*.cgo2.c
_cgo_defun.c
_cgo_gotypes.go
_cgo_export.*
_testmain.go
*.exe
*.test
*.prof
vendor/*
!vendor/vendor.json

28
vendor/github.com/gin-gonic/autotls/.travis.yml generated vendored Normal file
View File

@@ -0,0 +1,28 @@
language: go
sudo: false
go:
- 1.6.x
- 1.7.x
- 1.8.x
- 1.9.x
- 1.10.x
- master
git:
depth: 3
install:
- go get -v github.com/kardianos/govendor
- govendor sync
- go get -u github.com/campoy/embedmd
script:
- embedmd -d README.md
notifications:
webhooks:
urls:
- https://webhooks.gitter.im/e/7f95bf605c4d356372f4
on_success: change # options: [always|never|change] default: always
on_failure: always # options: [always|never|change] default: always
on_start: false # default: false

21
vendor/github.com/gin-gonic/autotls/LICENSE generated vendored Normal file
View File

@@ -0,0 +1,21 @@
MIT License
Copyright (c) 2017 Gin-Gonic
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.

67
vendor/github.com/gin-gonic/autotls/README.md generated vendored Normal file
View File

@@ -0,0 +1,67 @@
# autotls
[![Build Status](https://travis-ci.org/gin-gonic/autotls.svg?branch=master)](https://travis-ci.org/gin-gonic/autotls)
[![Go Report Card](https://goreportcard.com/badge/github.com/gin-gonic/autotls)](https://goreportcard.com/report/github.com/gin-gonic/autotls)
[![GoDoc](https://godoc.org/github.com/gin-gonic/autotls?status.svg)](https://godoc.org/github.com/gin-gonic/autotls)
[![Join the chat at https://gitter.im/gin-gonic/autotls](https://badges.gitter.im/Join%20Chat.svg)](https://gitter.im/gin-gonic/autotls?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge)
Support Let's Encrypt for a Go server application.
## example
example for 1-line LetsEncrypt HTTPS servers.
[embedmd]:# (example/example1.go go)
```go
package main
import (
"log"
"github.com/gin-gonic/autotls"
"github.com/gin-gonic/gin"
)
func main() {
r := gin.Default()
// Ping handler
r.GET("/ping", func(c *gin.Context) {
c.String(200, "pong")
})
log.Fatal(autotls.Run(r, "example1.com", "example2.com"))
}
```
example for custom autocert manager.
[embedmd]:# (example/example2.go go)
```go
package main
import (
"log"
"github.com/gin-gonic/autotls"
"github.com/gin-gonic/gin"
"golang.org/x/crypto/acme/autocert"
)
func main() {
r := gin.Default()
// Ping handler
r.GET("/ping", func(c *gin.Context) {
c.String(200, "pong")
})
m := autocert.Manager{
Prompt: autocert.AcceptTOS,
HostPolicy: autocert.HostWhitelist("example1.com", "example2.com"),
Cache: autocert.DirCache("/var/www/.cache"),
}
log.Fatal(autotls.RunWithManager(r, &m))
}
```

26
vendor/github.com/gin-gonic/autotls/autotls.go generated vendored Normal file
View File

@@ -0,0 +1,26 @@
package autotls
import (
"crypto/tls"
"net/http"
"golang.org/x/crypto/acme/autocert"
)
// Run support 1-line LetsEncrypt HTTPS servers
func Run(r http.Handler, domain ...string) error {
return http.Serve(autocert.NewListener(domain...), r)
}
// RunWithManager support custom autocert manager
func RunWithManager(r http.Handler, m *autocert.Manager) error {
s := &http.Server{
Addr: ":https",
TLSConfig: &tls.Config{GetCertificate: m.GetCertificate},
Handler: r,
}
go http.ListenAndServe(":http", m.HTTPHandler(nil))
return s.ListenAndServeTLS("", "")
}

23
vendor/github.com/gin-gonic/autotls/doc.go generated vendored Normal file
View File

@@ -0,0 +1,23 @@
// Package autotls support Let's Encrypt for a Go server application.
//
// package main
//
// import (
// "log"
//
// "github.com/gin-gonic/autotls"
// "github.com/gin-gonic/gin"
// )
//
// func main() {
// r := gin.Default()
//
// // Ping handler
// r.GET("/ping", func(c *gin.Context) {
// c.String(200, "pong")
// })
//
// log.Fatal(autotls.Run(r, "example1.com", "example2.com"))
// }
//
package autotls