├── caddyhttp
├── rewrite
│ └── testdata
│ │ ├── testdir
│ │ └── empty
│ │ └── testfile
├── browse
│ └── testdata
│ │ ├── header.html
│ │ ├── photos
│ │ ├── hidden.html
│ │ ├── test3.html
│ │ ├── test.html
│ │ ├── test2.html
│ │ └── test1
│ │ │ └── test.html
│ │ └── photos.tpl
├── templates
│ └── testdata
│ │ ├── header.html
│ │ ├── images
│ │ ├── header.html
│ │ ├── img.htm
│ │ └── img2.htm
│ │ ├── root.html
│ │ └── photos
│ │ └── test.html
├── markdown
│ ├── testdata
│ │ ├── header.html
│ │ ├── docflags
│ │ │ ├── test.md
│ │ │ └── template.txt
│ │ ├── og
│ │ │ └── first.md
│ │ ├── blog
│ │ │ └── test.md
│ │ ├── log
│ │ │ └── test.md
│ │ ├── markdown_tpl.html
│ │ └── tpl_with_include.html
│ ├── summary
│ │ ├── summary_test.go
│ │ └── summary.go
│ ├── metadata
│ │ ├── metadata_yaml.go
│ │ ├── metadata_none.go
│ │ └── metadata_toml.go
│ └── process_test.go
├── websocket
│ └── websocket_test.go
├── bind
│ ├── bind.go
│ └── bind_test.go
├── requestid
│ ├── setup.go
│ ├── requestid.go
│ ├── requestid_test.go
│ └── setup_test.go
├── caddyhttp_test.go
├── push
│ └── push.go
├── index
│ ├── index.go
│ └── index_test.go
├── pprof
│ ├── setup_test.go
│ └── setup.go
├── proxy
│ ├── setup.go
│ └── body.go
├── mime
│ └── mime.go
├── internalsrv
│ └── setup.go
├── limits
│ └── handler_test.go
└── expvar
│ ├── expvar_test.go
│ └── setup_test.go
├── caddyfile
└── testdata
│ ├── import_test1.txt
│ ├── import_test2.txt
│ ├── import_glob2.txt
│ ├── import_glob1.txt
│ └── import_glob0.txt
├── caddytls
├── client_test.go
├── storagetest
│ └── memorystorage_test.go
└── filestorage_test.go
├── vendor
├── github.com
│ ├── xenolf
│ │ └── lego
│ │ │ └── acme
│ │ │ ├── pop_challenge.go
│ │ │ ├── utils.go
│ │ │ ├── challenges.go
│ │ │ ├── LICENSE
│ │ │ ├── http_challenge.go
│ │ │ └── provider.go
│ ├── lucas-clemente
│ │ ├── quic-go
│ │ │ ├── integrationtests
│ │ │ │ ├── self
│ │ │ │ │ └── self.go
│ │ │ │ ├── chrome
│ │ │ │ │ └── chrome.go
│ │ │ │ ├── gquic
│ │ │ │ │ └── gquic.go
│ │ │ │ └── tools
│ │ │ │ │ └── testlog
│ │ │ │ │ └── testlog.go
│ │ │ ├── crypto
│ │ │ │ ├── key_exchange.go
│ │ │ │ ├── nonce.go
│ │ │ │ ├── AEAD.go
│ │ │ │ ├── cert_sets.go
│ │ │ │ └── cert_cache.go
│ │ │ ├── congestion
│ │ │ │ ├── stats.go
│ │ │ │ ├── clock.go
│ │ │ │ └── bandwidth.go
│ │ │ ├── frames
│ │ │ │ ├── ack_range.go
│ │ │ │ ├── frame.go
│ │ │ │ ├── ping_frame.go
│ │ │ │ ├── blocked_frame.go
│ │ │ │ └── log.go
│ │ │ ├── protocol
│ │ │ │ ├── perspective.go
│ │ │ │ └── encryption_level.go
│ │ │ ├── internal
│ │ │ │ ├── utils
│ │ │ │ │ ├── streamframe_interval.go
│ │ │ │ │ ├── packet_interval.go
│ │ │ │ │ ├── atomic_bool.go
│ │ │ │ │ ├── connection_id.go
│ │ │ │ │ ├── host.go
│ │ │ │ │ └── timer.go
│ │ │ │ └── mocks
│ │ │ │ │ └── gen.go
│ │ │ ├── buffer_pool.go
│ │ │ ├── h2quic
│ │ │ │ ├── request_body.go
│ │ │ │ └── gzipreader.go
│ │ │ ├── ackhandler
│ │ │ │ ├── packet.go
│ │ │ │ ├── retransmittable.go
│ │ │ │ └── interfaces.go
│ │ │ ├── handshake
│ │ │ │ └── interface.go
│ │ │ ├── conn.go
│ │ │ ├── LICENSE
│ │ │ ├── example
│ │ │ │ └── client
│ │ │ │ │ └── main.go
│ │ │ └── flowcontrol
│ │ │ │ └── interface.go
│ │ ├── aes12
│ │ │ ├── cipher_generic.go
│ │ │ └── LICENSE
│ │ ├── fnv128a
│ │ │ └── LICENSE
│ │ └── quic-go-certificates
│ │ │ └── LICENSE
│ ├── codahale
│ │ └── aesnicheck
│ │ │ ├── check_asm.go
│ │ │ ├── asm_amd64.s
│ │ │ ├── check_generic.go
│ │ │ ├── docs.go
│ │ │ ├── cmd
│ │ │ └── aesnicheck
│ │ │ │ └── aesnicheck.go
│ │ │ └── LICENSE
│ ├── dustin
│ │ └── go-humanize
│ │ │ ├── humanize.go
│ │ │ ├── ordinals.go
│ │ │ ├── ftoa.go
│ │ │ ├── big.go
│ │ │ ├── commaf.go
│ │ │ └── LICENSE
│ ├── jimstudt
│ │ └── http-authentication
│ │ │ └── basic
│ │ │ ├── bcrypt.go
│ │ │ ├── util.go
│ │ │ ├── plain.go
│ │ │ ├── LICENSE
│ │ │ └── sha.go
│ ├── alecthomas
│ │ └── units
│ │ │ ├── doc.go
│ │ │ ├── si.go
│ │ │ └── COPYING
│ ├── gorilla
│ │ └── websocket
│ │ │ ├── mask_safe.go
│ │ │ ├── client_clone.go
│ │ │ ├── conn_read.go
│ │ │ ├── conn_read_legacy.go
│ │ │ └── examples
│ │ │ └── chat
│ │ │ └── main.go
│ ├── miekg
│ │ └── dns
│ │ │ ├── COPYRIGHT
│ │ │ ├── udp_other.go
│ │ │ ├── udp_windows.go
│ │ │ ├── scanner.go
│ │ │ ├── reverse.go
│ │ │ ├── udp.go
│ │ │ ├── dane.go
│ │ │ └── rawmsg.go
│ ├── hashicorp
│ │ └── go-syslog
│ │ │ ├── unsupported.go
│ │ │ ├── syslog.go
│ │ │ └── LICENSE
│ ├── aead
│ │ └── chacha20
│ │ │ ├── chacha
│ │ │ └── chacha_ref.go
│ │ │ └── LICENSE
│ ├── naoina
│ │ ├── toml
│ │ │ └── LICENSE
│ │ └── go-stringutil
│ │ │ └── LICENSE
│ └── nu7hatch
│ │ └── gouuid
│ │ └── COPYING
├── gopkg.in
│ ├── natefinch
│ │ └── lumberjack.v2
│ │ │ ├── chown.go
│ │ │ ├── chown_linux.go
│ │ │ └── LICENSE
│ ├── alecthomas
│ │ └── kingpin.v2
│ │ │ ├── guesswidth.go
│ │ │ ├── guesswidth_unix.go
│ │ │ ├── completions.go
│ │ │ ├── envar.go
│ │ │ ├── COPYING
│ │ │ └── actions.go
│ ├── yaml.v2
│ │ └── LICENSE
│ └── square
│ │ └── go-jose.v1
│ │ ├── doc.go
│ │ └── json
│ │ └── tags.go
├── golang.org
│ └── x
│ │ ├── sys
│ │ └── unix
│ │ │ ├── endian_big.go
│ │ │ ├── endian_little.go
│ │ │ ├── constants.go
│ │ │ ├── syscall_no_getwd.go
│ │ │ ├── zsysnum_solaris_amd64.go
│ │ │ ├── env_unset.go
│ │ │ ├── syscall_linux_amd64_gc.go
│ │ │ ├── flock_linux_32bit.go
│ │ │ ├── asm_solaris_amd64.s
│ │ │ ├── gccgo_linux_sparc64.go
│ │ │ ├── gccgo_linux_amd64.go
│ │ │ ├── race0.go
│ │ │ ├── env_unix.go
│ │ │ ├── syscall_unix_gc.go
│ │ │ ├── asm_linux_arm64.s
│ │ │ ├── str.go
│ │ │ ├── file_unix.go
│ │ │ ├── race.go
│ │ │ ├── asm_linux_s390x.s
│ │ │ ├── asm_linux_ppc64x.s
│ │ │ ├── asm_linux_arm.s
│ │ │ ├── asm_linux_mips64x.s
│ │ │ ├── flock.go
│ │ │ ├── asm_freebsd_arm.s
│ │ │ ├── asm_netbsd_arm.s
│ │ │ ├── asm_darwin_386.s
│ │ │ ├── asm_freebsd_386.s
│ │ │ ├── asm_netbsd_386.s
│ │ │ ├── asm_openbsd_386.s
│ │ │ ├── asm_darwin_amd64.s
│ │ │ ├── asm_freebsd_amd64.s
│ │ │ ├── asm_linux_amd64.s
│ │ │ ├── asm_netbsd_amd64.s
│ │ │ ├── asm_openbsd_amd64.s
│ │ │ ├── asm_dragonfly_amd64.s
│ │ │ ├── asm_darwin_arm.s
│ │ │ ├── bluetooth_linux.go
│ │ │ ├── asm_darwin_arm64.s
│ │ │ ├── asm_linux_mipsx.s
│ │ │ ├── asm_linux_386.s
│ │ │ ├── syscall_solaris_amd64.go
│ │ │ ├── openbsd_pledge.go
│ │ │ ├── syscall_openbsd_amd64.go
│ │ │ ├── syscall_netbsd_386.go
│ │ │ ├── syscall_netbsd_arm.go
│ │ │ ├── syscall_netbsd_amd64.go
│ │ │ ├── syscall_openbsd_386.go
│ │ │ ├── gccgo_c.c
│ │ │ └── sockcmsg_linux.go
│ │ ├── oauth2
│ │ ├── google
│ │ │ ├── appengineflex_hook.go
│ │ │ └── appengine_hook.go
│ │ ├── amazon
│ │ │ └── amazon.go
│ │ ├── vk
│ │ │ └── vk.go
│ │ ├── slack
│ │ │ └── slack.go
│ │ ├── uber
│ │ │ └── uber.go
│ │ ├── bitbucket
│ │ │ └── bitbucket.go
│ │ ├── heroku
│ │ │ └── heroku.go
│ │ ├── yandex
│ │ │ └── yandex.go
│ │ ├── github
│ │ │ └── github.go
│ │ ├── fitbit
│ │ │ └── fitbit.go
│ │ ├── facebook
│ │ │ └── facebook.go
│ │ ├── foursquare
│ │ │ └── foursquare.go
│ │ ├── linkedin
│ │ │ └── linkedin.go
│ │ ├── microsoft
│ │ │ └── microsoft.go
│ │ ├── odnoklassniki
│ │ │ └── odnoklassniki.go
│ │ ├── client_appengine.go
│ │ ├── mediamath
│ │ │ └── mediamath.go
│ │ └── paypal
│ │ │ └── paypal.go
│ │ ├── crypto
│ │ ├── curve25519
│ │ │ ├── const_amd64.h
│ │ │ ├── const_amd64.s
│ │ │ └── doc.go
│ │ └── ssh
│ │ │ └── terminal
│ │ │ ├── util_bsd.go
│ │ │ └── util_linux.go
│ │ └── net
│ │ ├── http2
│ │ ├── not_go19.go
│ │ ├── go16.go
│ │ ├── go19.go
│ │ ├── not_go16.go
│ │ └── not_go18.go
│ │ ├── websocket
│ │ ├── dial.go
│ │ ├── examplehandler_test.go
│ │ └── exampledial_test.go
│ │ └── context
│ │ └── go19.go
└── google.golang.org
│ ├── appengine
│ ├── internal
│ │ ├── main.go
│ │ ├── identity.go
│ │ ├── app_id.go
│ │ └── main_vm.go
│ ├── cloudsql
│ │ ├── cloudsql_classic.go
│ │ └── cloudsql_vm.go
│ ├── socket
│ │ └── doc.go
│ ├── timeout.go
│ ├── appengine_vm.go
│ ├── aetest
│ │ ├── instance_classic.go
│ │ ├── doc.go
│ │ └── user.go
│ ├── namespace.go
│ ├── file
│ │ └── file.go
│ ├── user
│ │ ├── user_classic.go
│ │ └── user_vm.go
│ ├── demos
│ │ └── helloworld
│ │ │ └── helloworld.go
│ └── errors.go
│ └── api
│ ├── gensupport
│ ├── doc.go
│ └── header.go
│ └── googleapi
│ ├── internal
│ └── uritemplates
│ │ └── utils.go
│ └── transport
│ └── apikey.go
├── sigtrap_nonposix.go
├── rlimit_nonposix.go
├── .gitignore
├── caddy
├── main_test.go
├── main.go
└── caddymain
│ └── run_test.go
├── assets_test.go
├── rlimit_posix.go
├── .github
├── PULL_REQUEST_TEMPLATE.md
└── ISSUE_TEMPLATE.md
├── .gitattributes
├── assets.go
└── appveyor.yml
/caddyhttp/rewrite/testdata/testdir/empty:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/caddyhttp/rewrite/testdata/testfile:
--------------------------------------------------------------------------------
1 | empty
--------------------------------------------------------------------------------
/caddyfile/testdata/import_test1.txt:
--------------------------------------------------------------------------------
1 | dir2 arg1 arg2
2 | dir3
--------------------------------------------------------------------------------
/caddyhttp/browse/testdata/header.html:
--------------------------------------------------------------------------------
1 |
Header
2 |
--------------------------------------------------------------------------------
/caddytls/client_test.go:
--------------------------------------------------------------------------------
1 | package caddytls
2 |
3 | // TODO
4 |
--------------------------------------------------------------------------------
/caddyhttp/browse/testdata/photos/hidden.html:
--------------------------------------------------------------------------------
1 | Should be hidden
2 |
--------------------------------------------------------------------------------
/caddyhttp/templates/testdata/header.html:
--------------------------------------------------------------------------------
1 | Header title
2 |
--------------------------------------------------------------------------------
/vendor/github.com/xenolf/lego/acme/pop_challenge.go:
--------------------------------------------------------------------------------
1 | package acme
2 |
--------------------------------------------------------------------------------
/caddyfile/testdata/import_test2.txt:
--------------------------------------------------------------------------------
1 | host1 {
2 | dir1
3 | dir2 arg1
4 | }
--------------------------------------------------------------------------------
/caddyhttp/templates/testdata/images/header.html:
--------------------------------------------------------------------------------
1 | Header title
2 |
--------------------------------------------------------------------------------
/caddyfile/testdata/import_glob2.txt:
--------------------------------------------------------------------------------
1 | glob2.host0 {
2 | dir2 arg1
3 | }
4 |
--------------------------------------------------------------------------------
/caddyhttp/markdown/testdata/header.html:
--------------------------------------------------------------------------------
1 | Header for: {{.Doc.title}}
--------------------------------------------------------------------------------
/caddyhttp/browse/testdata/photos/test3.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
--------------------------------------------------------------------------------
/caddyfile/testdata/import_glob1.txt:
--------------------------------------------------------------------------------
1 | glob1.host0 {
2 | dir1
3 | dir2 arg1
4 | }
5 |
--------------------------------------------------------------------------------
/vendor/github.com/lucas-clemente/quic-go/integrationtests/self/self.go:
--------------------------------------------------------------------------------
1 | package self
2 |
--------------------------------------------------------------------------------
/vendor/github.com/lucas-clemente/quic-go/integrationtests/chrome/chrome.go:
--------------------------------------------------------------------------------
1 | package chrome
2 |
--------------------------------------------------------------------------------
/vendor/github.com/lucas-clemente/quic-go/integrationtests/gquic/gquic.go:
--------------------------------------------------------------------------------
1 | package gquic
2 |
--------------------------------------------------------------------------------
/caddyfile/testdata/import_glob0.txt:
--------------------------------------------------------------------------------
1 | glob0.host0 {
2 | dir2 arg1
3 | }
4 |
5 | glob0.host1 {
6 | }
7 |
--------------------------------------------------------------------------------
/caddyhttp/markdown/testdata/docflags/test.md:
--------------------------------------------------------------------------------
1 | ---
2 | var_string: hello
3 | var_bool: true
4 | ---
5 |
--------------------------------------------------------------------------------
/caddyhttp/markdown/testdata/og/first.md:
--------------------------------------------------------------------------------
1 | ---
2 | title: first_post
3 | sitename: title
4 | ---
5 | # Test h1
6 |
--------------------------------------------------------------------------------
/sigtrap_nonposix.go:
--------------------------------------------------------------------------------
1 | // +build windows plan9 nacl
2 |
3 | package caddy
4 |
5 | func trapSignalsPosix() {}
6 |
--------------------------------------------------------------------------------
/caddyhttp/markdown/testdata/docflags/template.txt:
--------------------------------------------------------------------------------
1 | Doc.var_string {{.Doc.var_string}}
2 | Doc.var_bool {{.Doc.var_bool}}
3 |
--------------------------------------------------------------------------------
/caddyhttp/templates/testdata/images/img.htm:
--------------------------------------------------------------------------------
1 | img{%.Include "header.html"%}
2 |
--------------------------------------------------------------------------------
/caddyhttp/templates/testdata/images/img2.htm:
--------------------------------------------------------------------------------
1 | img{{.Include "header.html"}}
2 |
--------------------------------------------------------------------------------
/caddyhttp/templates/testdata/root.html:
--------------------------------------------------------------------------------
1 | {{ root }}{{.Include "header.html"}}
2 |
--------------------------------------------------------------------------------
/caddyhttp/browse/testdata/photos/test.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | Test
5 |
6 |
7 |
8 |
9 |
--------------------------------------------------------------------------------
/caddyhttp/browse/testdata/photos/test2.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | Test 2
5 |
6 |
7 |
8 |
9 |
--------------------------------------------------------------------------------
/caddyhttp/templates/testdata/photos/test.html:
--------------------------------------------------------------------------------
1 | test page{{.Include "../header.html"}}
2 |
--------------------------------------------------------------------------------
/caddyhttp/browse/testdata/photos/test1/test.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | Test
5 |
6 |
7 |
8 |
9 |
--------------------------------------------------------------------------------
/vendor/github.com/codahale/aesnicheck/check_asm.go:
--------------------------------------------------------------------------------
1 | // +build amd64
2 |
3 | package aesnicheck
4 |
5 | // HasAESNI returns whether AES-NI is supported by the CPU.
6 | func HasAESNI() bool
7 |
--------------------------------------------------------------------------------
/vendor/gopkg.in/natefinch/lumberjack.v2/chown.go:
--------------------------------------------------------------------------------
1 | // +build !linux
2 |
3 | package lumberjack
4 |
5 | import (
6 | "os"
7 | )
8 |
9 | func chown(_ string, _ os.FileInfo) error {
10 | return nil
11 | }
12 |
--------------------------------------------------------------------------------
/vendor/github.com/codahale/aesnicheck/asm_amd64.s:
--------------------------------------------------------------------------------
1 | // func HasAESNI() bool
2 | TEXT ·HasAESNI(SB),$0
3 | XORQ AX, AX
4 | INCL AX
5 | CPUID
6 | SHRQ $25, CX
7 | ANDQ $1, CX
8 | MOVB CX, ret+0(FP)
9 | RET
10 |
--------------------------------------------------------------------------------
/vendor/github.com/codahale/aesnicheck/check_generic.go:
--------------------------------------------------------------------------------
1 | // +build !amd64
2 |
3 | package aesnicheck
4 |
5 | // HasAESNI returns whether AES-NI is supported by the CPU.
6 | func HasAESNI() bool {
7 | return false
8 | }
9 |
--------------------------------------------------------------------------------
/rlimit_nonposix.go:
--------------------------------------------------------------------------------
1 | // +build windows plan9 nacl
2 |
3 | package caddy
4 |
5 | // checkFdlimit issues a warning if the OS limit for
6 | // max file descriptors is below a recommended minimum.
7 | func checkFdlimit() {
8 | }
9 |
--------------------------------------------------------------------------------
/vendor/gopkg.in/alecthomas/kingpin.v2/guesswidth.go:
--------------------------------------------------------------------------------
1 | // +build appengine !linux,!freebsd,!darwin,!dragonfly,!netbsd,!openbsd
2 |
3 | package kingpin
4 |
5 | import "io"
6 |
7 | func guessWidth(w io.Writer) int {
8 | return 80
9 | }
10 |
--------------------------------------------------------------------------------
/.gitignore:
--------------------------------------------------------------------------------
1 | .DS_Store
2 | Thumbs.db
3 | _gitignore/
4 | Vagrantfile
5 | .vagrant/
6 | /.idea
7 |
8 | dist/builds/
9 | dist/release/
10 |
11 | error.log
12 | access.log
13 |
14 | /*.conf
15 | Caddyfile
16 |
17 | og_static/
18 |
19 | .vscode/
--------------------------------------------------------------------------------
/caddyhttp/markdown/testdata/blog/test.md:
--------------------------------------------------------------------------------
1 | ---
2 | title: Markdown test 1
3 | sitename: A Caddy website
4 | ---
5 |
6 | ## Welcome on the blog
7 |
8 | Body
9 |
10 | ``` go
11 | func getTrue() bool {
12 | return true
13 | }
14 | ```
15 |
--------------------------------------------------------------------------------
/caddyhttp/markdown/testdata/log/test.md:
--------------------------------------------------------------------------------
1 | ---
2 | title: Markdown test 2
3 | sitename: A Caddy website
4 | ---
5 |
6 | ## Welcome on the blog
7 |
8 | Body
9 |
10 | ``` go
11 | func getTrue() bool {
12 | return true
13 | }
14 | ```
15 |
--------------------------------------------------------------------------------
/vendor/github.com/lucas-clemente/quic-go/crypto/key_exchange.go:
--------------------------------------------------------------------------------
1 | package crypto
2 |
3 | // KeyExchange manages the exchange of keys
4 | type KeyExchange interface {
5 | PublicKey() []byte
6 | CalculateSharedKey(otherPublic []byte) ([]byte, error)
7 | }
8 |
--------------------------------------------------------------------------------
/caddyhttp/markdown/testdata/markdown_tpl.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | {{.Doc.title}}
5 |
6 |
7 | {{.Include "header.html"}}
8 | Welcome to {{.Doc.sitename}}!
9 | {{.Doc.body}}
10 |
11 |
12 |
--------------------------------------------------------------------------------
/caddyhttp/markdown/testdata/tpl_with_include.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | {{.Doc.title}}
5 |
6 |
7 | Welcome to {{.Doc.sitename}}!
8 |
9 | {{.Doc.body}}
10 |
11 |
12 |
--------------------------------------------------------------------------------
/vendor/github.com/lucas-clemente/quic-go/congestion/stats.go:
--------------------------------------------------------------------------------
1 | package congestion
2 |
3 | import "github.com/lucas-clemente/quic-go/protocol"
4 |
5 | type connectionStats struct {
6 | slowstartPacketsLost protocol.PacketNumber
7 | slowstartBytesLost protocol.ByteCount
8 | }
9 |
--------------------------------------------------------------------------------
/caddyhttp/browse/testdata/photos.tpl:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | Template
5 |
6 |
7 | {{.Include "header.html"}}
8 | {{.Path}}
9 | {{range .Items}}
10 | {{.Name}}
11 | {{end}}
12 |
13 |
14 |
--------------------------------------------------------------------------------
/vendor/github.com/lucas-clemente/quic-go/frames/ack_range.go:
--------------------------------------------------------------------------------
1 | package frames
2 |
3 | import "github.com/lucas-clemente/quic-go/protocol"
4 |
5 | // AckRange is an ACK range
6 | type AckRange struct {
7 | FirstPacketNumber protocol.PacketNumber
8 | LastPacketNumber protocol.PacketNumber
9 | }
10 |
--------------------------------------------------------------------------------
/vendor/github.com/lucas-clemente/quic-go/protocol/perspective.go:
--------------------------------------------------------------------------------
1 | package protocol
2 |
3 | // Perspective determines if we're acting as a server or a client
4 | type Perspective int
5 |
6 | // the perspectives
7 | const (
8 | PerspectiveServer Perspective = 1
9 | PerspectiveClient Perspective = 2
10 | )
11 |
--------------------------------------------------------------------------------
/caddytls/storagetest/memorystorage_test.go:
--------------------------------------------------------------------------------
1 | package storagetest
2 |
3 | import "testing"
4 |
5 | func TestMemoryStorage(t *testing.T) {
6 | storage := NewInMemoryStorage()
7 | storageTest := &StorageTest{
8 | Storage: storage,
9 | PostTest: storage.Clear,
10 | }
11 | storageTest.Test(t, false)
12 | }
13 |
--------------------------------------------------------------------------------
/vendor/golang.org/x/sys/unix/endian_big.go:
--------------------------------------------------------------------------------
1 | // Copyright 2016 The Go Authors. All rights reserved.
2 | // Use of this source code is governed by a BSD-style
3 | // license that can be found in the LICENSE file.
4 | //
5 | // +build ppc64 s390x mips mips64
6 |
7 | package unix
8 |
9 | const isBigEndian = true
10 |
--------------------------------------------------------------------------------
/caddyhttp/markdown/summary/summary_test.go:
--------------------------------------------------------------------------------
1 | package summary
2 |
3 | import "testing"
4 |
5 | func TestMarkdown(t *testing.T) {
6 | input := []byte(`Testing with just a few words.`)
7 | got := string(Markdown(input, 3))
8 | if want := "Testing with just"; want != got {
9 | t.Errorf("Expected '%s' but got '%s'", want, got)
10 | }
11 | }
12 |
--------------------------------------------------------------------------------
/caddytls/filestorage_test.go:
--------------------------------------------------------------------------------
1 | package caddytls
2 |
3 | // *********************************** NOTE ********************************
4 | // Due to circular package dependencies with the storagetest sub package and
5 | // the fact that we want to use that harness to test file storage, the tests
6 | // for file storage are done in the storagetest package.
7 |
--------------------------------------------------------------------------------
/vendor/github.com/dustin/go-humanize/humanize.go:
--------------------------------------------------------------------------------
1 | /*
2 | Package humanize converts boring ugly numbers to human-friendly strings and back.
3 |
4 | Durations can be turned into strings such as "3 days ago", numbers
5 | representing sizes like 82854982 into useful strings like, "83 MB" or
6 | "79 MiB" (whichever you prefer).
7 | */
8 | package humanize
9 |
--------------------------------------------------------------------------------
/vendor/golang.org/x/sys/unix/endian_little.go:
--------------------------------------------------------------------------------
1 | // Copyright 2016 The Go Authors. All rights reserved.
2 | // Use of this source code is governed by a BSD-style
3 | // license that can be found in the LICENSE file.
4 | //
5 | // +build 386 amd64 amd64p32 arm arm64 ppc64le mipsle mips64le
6 |
7 | package unix
8 |
9 | const isBigEndian = false
10 |
--------------------------------------------------------------------------------
/vendor/github.com/lucas-clemente/quic-go/internal/utils/streamframe_interval.go:
--------------------------------------------------------------------------------
1 | package utils
2 |
3 | import "github.com/lucas-clemente/quic-go/protocol"
4 |
5 | // ByteInterval is an interval from one ByteCount to the other
6 | // +gen linkedlist
7 | type ByteInterval struct {
8 | Start protocol.ByteCount
9 | End protocol.ByteCount
10 | }
11 |
--------------------------------------------------------------------------------
/vendor/github.com/lucas-clemente/quic-go/internal/mocks/gen.go:
--------------------------------------------------------------------------------
1 | package mocks
2 |
3 | //go:generate mockgen -destination mocks_fc/flow_control_manager.go -package mocks_fc github.com/lucas-clemente/quic-go/flowcontrol FlowControlManager
4 | //go:generate mockgen -destination cpm.go -package mocks github.com/lucas-clemente/quic-go/handshake ConnectionParametersManager
5 |
--------------------------------------------------------------------------------
/vendor/github.com/lucas-clemente/quic-go/internal/utils/packet_interval.go:
--------------------------------------------------------------------------------
1 | package utils
2 |
3 | import "github.com/lucas-clemente/quic-go/protocol"
4 |
5 | // PacketInterval is an interval from one PacketNumber to the other
6 | // +gen linkedlist
7 | type PacketInterval struct {
8 | Start protocol.PacketNumber
9 | End protocol.PacketNumber
10 | }
11 |
--------------------------------------------------------------------------------
/vendor/github.com/lucas-clemente/quic-go/frames/frame.go:
--------------------------------------------------------------------------------
1 | package frames
2 |
3 | import (
4 | "bytes"
5 |
6 | "github.com/lucas-clemente/quic-go/protocol"
7 | )
8 |
9 | // A Frame in QUIC
10 | type Frame interface {
11 | Write(b *bytes.Buffer, version protocol.VersionNumber) error
12 | MinLength(version protocol.VersionNumber) (protocol.ByteCount, error)
13 | }
14 |
--------------------------------------------------------------------------------
/vendor/golang.org/x/sys/unix/constants.go:
--------------------------------------------------------------------------------
1 | // Copyright 2015 The Go Authors. All rights reserved.
2 | // Use of this source code is governed by a BSD-style
3 | // license that can be found in the LICENSE file.
4 |
5 | // +build darwin dragonfly freebsd linux netbsd openbsd solaris
6 |
7 | package unix
8 |
9 | const (
10 | R_OK = 0x4
11 | W_OK = 0x2
12 | X_OK = 0x1
13 | )
14 |
--------------------------------------------------------------------------------
/vendor/google.golang.org/appengine/internal/main.go:
--------------------------------------------------------------------------------
1 | // Copyright 2011 Google Inc. All rights reserved.
2 | // Use of this source code is governed by the Apache 2.0
3 | // license that can be found in the LICENSE file.
4 |
5 | // +build appengine
6 |
7 | package internal
8 |
9 | import (
10 | "appengine_internal"
11 | )
12 |
13 | func Main() {
14 | appengine_internal.Main()
15 | }
16 |
--------------------------------------------------------------------------------
/vendor/golang.org/x/sys/unix/syscall_no_getwd.go:
--------------------------------------------------------------------------------
1 | // Copyright 2013 The Go Authors. All rights reserved.
2 | // Use of this source code is governed by a BSD-style
3 | // license that can be found in the LICENSE file.
4 |
5 | // +build dragonfly freebsd netbsd openbsd
6 |
7 | package unix
8 |
9 | const ImplementsGetwd = false
10 |
11 | func Getwd() (string, error) { return "", ENOTSUP }
12 |
--------------------------------------------------------------------------------
/vendor/golang.org/x/sys/unix/zsysnum_solaris_amd64.go:
--------------------------------------------------------------------------------
1 | // Copyright 2014 The Go Authors. All rights reserved.
2 | // Use of this source code is governed by a BSD-style
3 | // license that can be found in the LICENSE file.
4 |
5 | // +build amd64,solaris
6 |
7 | package unix
8 |
9 | // TODO(aram): remove these before Go 1.3.
10 | const (
11 | SYS_EXECVE = 59
12 | SYS_FCNTL = 62
13 | )
14 |
--------------------------------------------------------------------------------
/vendor/github.com/jimstudt/http-authentication/basic/bcrypt.go:
--------------------------------------------------------------------------------
1 | package basic
2 |
3 | import (
4 | "fmt"
5 | "strings"
6 | )
7 |
8 | // Reject any password encoded using bcrypt.
9 | func RejectBcrypt(src string) (EncodedPasswd, error) {
10 | if strings.HasPrefix(src, "$2y$") {
11 | return nil, fmt.Errorf("bcrypt passwords are not accepted: %s", src)
12 | }
13 |
14 | return nil, nil
15 | }
16 |
--------------------------------------------------------------------------------
/vendor/github.com/lucas-clemente/quic-go/crypto/nonce.go:
--------------------------------------------------------------------------------
1 | package crypto
2 |
3 | import (
4 | "encoding/binary"
5 |
6 | "github.com/lucas-clemente/quic-go/protocol"
7 | )
8 |
9 | func makeNonce(iv []byte, packetNumber protocol.PacketNumber) []byte {
10 | res := make([]byte, 12)
11 | copy(res[0:4], iv)
12 | binary.LittleEndian.PutUint64(res[4:12], uint64(packetNumber))
13 | return res
14 | }
15 |
--------------------------------------------------------------------------------
/vendor/golang.org/x/sys/unix/env_unset.go:
--------------------------------------------------------------------------------
1 | // Copyright 2014 The Go Authors. All rights reserved.
2 | // Use of this source code is governed by a BSD-style
3 | // license that can be found in the LICENSE file.
4 |
5 | // +build go1.4
6 |
7 | package unix
8 |
9 | import "syscall"
10 |
11 | func Unsetenv(key string) error {
12 | // This was added in Go 1.4.
13 | return syscall.Unsetenv(key)
14 | }
15 |
--------------------------------------------------------------------------------
/vendor/golang.org/x/sys/unix/syscall_linux_amd64_gc.go:
--------------------------------------------------------------------------------
1 | // Copyright 2016 The Go Authors. All rights reserved.
2 | // Use of this source code is governed by a BSD-style
3 | // license that can be found in the LICENSE file.
4 |
5 | // +build amd64,linux
6 | // +build !gccgo
7 |
8 | package unix
9 |
10 | import "syscall"
11 |
12 | //go:noescape
13 | func gettimeofday(tv *Timeval) (err syscall.Errno)
14 |
--------------------------------------------------------------------------------
/vendor/golang.org/x/oauth2/google/appengineflex_hook.go:
--------------------------------------------------------------------------------
1 | // Copyright 2015 The Go Authors. All rights reserved.
2 | // Use of this source code is governed by a BSD-style
3 | // license that can be found in the LICENSE file.
4 |
5 | // +build appenginevm
6 |
7 | package google
8 |
9 | func init() {
10 | appengineFlex = true // Flex doesn't support appengine.AccessToken; depend on metadata server.
11 | }
12 |
--------------------------------------------------------------------------------
/vendor/golang.org/x/crypto/curve25519/const_amd64.h:
--------------------------------------------------------------------------------
1 | // Copyright 2012 The Go Authors. All rights reserved.
2 | // Use of this source code is governed by a BSD-style
3 | // license that can be found in the LICENSE file.
4 |
5 | // This code was translated into a form compatible with 6a from the public
6 | // domain sources in SUPERCOP: https://bench.cr.yp.to/supercop.html
7 |
8 | #define REDMASK51 0x0007FFFFFFFFFFFF
9 |
--------------------------------------------------------------------------------
/caddy/main_test.go:
--------------------------------------------------------------------------------
1 | package main
2 |
3 | import "testing"
4 |
5 | // This works because it does not have the same signature as the
6 | // conventional "TestMain" function described in the testing package
7 | // godoc.
8 | func TestMain(t *testing.T) {
9 | var ran bool
10 | run = func() {
11 | ran = true
12 | }
13 | main()
14 | if !ran {
15 | t.Error("Expected Run() to be called, but it wasn't")
16 | }
17 | }
18 |
--------------------------------------------------------------------------------
/vendor/golang.org/x/crypto/ssh/terminal/util_bsd.go:
--------------------------------------------------------------------------------
1 | // Copyright 2013 The Go Authors. All rights reserved.
2 | // Use of this source code is governed by a BSD-style
3 | // license that can be found in the LICENSE file.
4 |
5 | // +build darwin dragonfly freebsd netbsd openbsd
6 |
7 | package terminal
8 |
9 | import "syscall"
10 |
11 | const ioctlReadTermios = syscall.TIOCGETA
12 | const ioctlWriteTermios = syscall.TIOCSETA
13 |
--------------------------------------------------------------------------------
/vendor/golang.org/x/net/http2/not_go19.go:
--------------------------------------------------------------------------------
1 | // Copyright 2016 The Go Authors. All rights reserved.
2 | // Use of this source code is governed by a BSD-style
3 | // license that can be found in the LICENSE file.
4 |
5 | // +build !go1.9
6 |
7 | package http2
8 |
9 | import (
10 | "net/http"
11 | )
12 |
13 | func configureServer19(s *http.Server, conf *Server) error {
14 | // not supported prior to go1.9
15 | return nil
16 | }
17 |
--------------------------------------------------------------------------------
/vendor/golang.org/x/net/http2/go16.go:
--------------------------------------------------------------------------------
1 | // Copyright 2016 The Go Authors. All rights reserved.
2 | // Use of this source code is governed by a BSD-style
3 | // license that can be found in the LICENSE file.
4 |
5 | // +build go1.6
6 |
7 | package http2
8 |
9 | import (
10 | "net/http"
11 | "time"
12 | )
13 |
14 | func transportExpectContinueTimeout(t1 *http.Transport) time.Duration {
15 | return t1.ExpectContinueTimeout
16 | }
17 |
--------------------------------------------------------------------------------
/vendor/github.com/alecthomas/units/doc.go:
--------------------------------------------------------------------------------
1 | // Package units provides helpful unit multipliers and functions for Go.
2 | //
3 | // The goal of this package is to have functionality similar to the time [1] package.
4 | //
5 | //
6 | // [1] http://golang.org/pkg/time/
7 | //
8 | // It allows for code like this:
9 | //
10 | // n, err := ParseBase2Bytes("1KB")
11 | // // n == 1024
12 | // n = units.Mebibyte * 512
13 | package units
14 |
--------------------------------------------------------------------------------
/vendor/github.com/lucas-clemente/quic-go/crypto/AEAD.go:
--------------------------------------------------------------------------------
1 | package crypto
2 |
3 | import "github.com/lucas-clemente/quic-go/protocol"
4 |
5 | // An AEAD implements QUIC's authenticated encryption and associated data
6 | type AEAD interface {
7 | Open(dst, src []byte, packetNumber protocol.PacketNumber, associatedData []byte) ([]byte, error)
8 | Seal(dst, src []byte, packetNumber protocol.PacketNumber, associatedData []byte) []byte
9 | }
10 |
--------------------------------------------------------------------------------
/vendor/github.com/gorilla/websocket/mask_safe.go:
--------------------------------------------------------------------------------
1 | // Copyright 2016 The Gorilla WebSocket Authors. All rights reserved. Use of
2 | // this source code is governed by a BSD-style license that can be found in the
3 | // LICENSE file.
4 |
5 | // +build appengine
6 |
7 | package websocket
8 |
9 | func maskBytes(key [4]byte, pos int, b []byte) int {
10 | for i := range b {
11 | b[i] ^= key[pos&3]
12 | pos++
13 | }
14 | return pos & 3
15 | }
16 |
--------------------------------------------------------------------------------
/vendor/golang.org/x/net/http2/go19.go:
--------------------------------------------------------------------------------
1 | // Copyright 2015 The Go Authors. All rights reserved.
2 | // Use of this source code is governed by a BSD-style
3 | // license that can be found in the LICENSE file.
4 |
5 | // +build go1.9
6 |
7 | package http2
8 |
9 | import (
10 | "net/http"
11 | )
12 |
13 | func configureServer19(s *http.Server, conf *Server) error {
14 | s.RegisterOnShutdown(conf.state.startGracefulShutdown)
15 | return nil
16 | }
17 |
--------------------------------------------------------------------------------
/vendor/golang.org/x/oauth2/google/appengine_hook.go:
--------------------------------------------------------------------------------
1 | // Copyright 2015 The Go Authors. All rights reserved.
2 | // Use of this source code is governed by a BSD-style
3 | // license that can be found in the LICENSE file.
4 |
5 | // +build appengine appenginevm
6 |
7 | package google
8 |
9 | import "google.golang.org/appengine"
10 |
11 | func init() {
12 | appengineTokenFunc = appengine.AccessToken
13 | appengineAppIDFunc = appengine.AppID
14 | }
15 |
--------------------------------------------------------------------------------
/caddy/main.go:
--------------------------------------------------------------------------------
1 | // By moving the application's package main logic into
2 | // a package other than main, it becomes much easier to
3 | // wrap caddy for custom builds that are go-gettable.
4 | // https://caddy.community/t/my-wish-for-0-9-go-gettable-custom-builds/59?u=matt
5 |
6 | package main
7 |
8 | import "github.com/WedgeServer/wedge/caddy/caddymain"
9 |
10 | var run = caddymain.Run // replaced for tests
11 |
12 | func main() {
13 | run()
14 | }
15 |
--------------------------------------------------------------------------------
/vendor/google.golang.org/appengine/cloudsql/cloudsql_classic.go:
--------------------------------------------------------------------------------
1 | // Copyright 2013 Google Inc. All rights reserved.
2 | // Use of this source code is governed by the Apache 2.0
3 | // license that can be found in the LICENSE file.
4 |
5 | // +build appengine
6 |
7 | package cloudsql
8 |
9 | import (
10 | "net"
11 |
12 | "appengine/cloudsql"
13 | )
14 |
15 | func connect(instance string) (net.Conn, error) {
16 | return cloudsql.Dial(instance)
17 | }
18 |
--------------------------------------------------------------------------------
/vendor/github.com/gorilla/websocket/client_clone.go:
--------------------------------------------------------------------------------
1 | // Copyright 2013 The Gorilla WebSocket Authors. All rights reserved.
2 | // Use of this source code is governed by a BSD-style
3 | // license that can be found in the LICENSE file.
4 |
5 | // +build go1.8
6 |
7 | package websocket
8 |
9 | import "crypto/tls"
10 |
11 | func cloneTLSConfig(cfg *tls.Config) *tls.Config {
12 | if cfg == nil {
13 | return &tls.Config{}
14 | }
15 | return cfg.Clone()
16 | }
17 |
--------------------------------------------------------------------------------
/vendor/github.com/lucas-clemente/quic-go/congestion/clock.go:
--------------------------------------------------------------------------------
1 | package congestion
2 |
3 | import "time"
4 |
5 | // A Clock returns the current time
6 | type Clock interface {
7 | Now() time.Time
8 | }
9 |
10 | // DefaultClock implements the Clock interface using the Go stdlib clock.
11 | type DefaultClock struct{}
12 |
13 | var _ Clock = DefaultClock{}
14 |
15 | // Now gets the current time
16 | func (DefaultClock) Now() time.Time {
17 | return time.Now()
18 | }
19 |
--------------------------------------------------------------------------------
/vendor/golang.org/x/sys/unix/flock_linux_32bit.go:
--------------------------------------------------------------------------------
1 | // +build linux,386 linux,arm linux,mips linux,mipsle
2 |
3 | // Copyright 2014 The Go Authors. All rights reserved.
4 | // Use of this source code is governed by a BSD-style
5 | // license that can be found in the LICENSE file.
6 |
7 | package unix
8 |
9 | func init() {
10 | // On 32-bit Linux systems, the fcntl syscall that matches Go's
11 | // Flock_t type is SYS_FCNTL64, not SYS_FCNTL.
12 | fcntl64Syscall = SYS_FCNTL64
13 | }
14 |
--------------------------------------------------------------------------------
/vendor/google.golang.org/appengine/cloudsql/cloudsql_vm.go:
--------------------------------------------------------------------------------
1 | // Copyright 2013 Google Inc. All rights reserved.
2 | // Use of this source code is governed by the Apache 2.0
3 | // license that can be found in the LICENSE file.
4 |
5 | // +build !appengine
6 |
7 | package cloudsql
8 |
9 | import (
10 | "errors"
11 | "net"
12 | )
13 |
14 | func connect(instance string) (net.Conn, error) {
15 | return nil, errors.New(`cloudsql: not supported in App Engine "flexible environment"`)
16 | }
17 |
--------------------------------------------------------------------------------
/vendor/github.com/lucas-clemente/quic-go/internal/utils/atomic_bool.go:
--------------------------------------------------------------------------------
1 | package utils
2 |
3 | import "sync/atomic"
4 |
5 | // An AtomicBool is an atomic bool
6 | type AtomicBool struct {
7 | v int32
8 | }
9 |
10 | // Set sets the value
11 | func (a *AtomicBool) Set(value bool) {
12 | var n int32
13 | if value {
14 | n = 1
15 | }
16 | atomic.StoreInt32(&a.v, n)
17 | }
18 |
19 | // Get gets the value
20 | func (a *AtomicBool) Get() bool {
21 | return atomic.LoadInt32(&a.v) != 0
22 | }
23 |
--------------------------------------------------------------------------------
/vendor/google.golang.org/appengine/socket/doc.go:
--------------------------------------------------------------------------------
1 | // Copyright 2012 Google Inc. All rights reserved.
2 | // Use of this source code is governed by the Apache 2.0
3 | // license that can be found in the LICENSE file.
4 |
5 | // Package socket provides outbound network sockets.
6 | //
7 | // This package is only required in the classic App Engine environment.
8 | // Applications running only in App Engine "flexible environment" should
9 | // use the standard library's net package.
10 | package socket
11 |
--------------------------------------------------------------------------------
/vendor/github.com/gorilla/websocket/conn_read.go:
--------------------------------------------------------------------------------
1 | // Copyright 2016 The Gorilla WebSocket Authors. All rights reserved.
2 | // Use of this source code is governed by a BSD-style
3 | // license that can be found in the LICENSE file.
4 |
5 | // +build go1.5
6 |
7 | package websocket
8 |
9 | import "io"
10 |
11 | func (c *Conn) read(n int) ([]byte, error) {
12 | p, err := c.br.Peek(n)
13 | if err == io.EOF {
14 | err = errUnexpectedEOF
15 | }
16 | c.br.Discard(len(p))
17 | return p, err
18 | }
19 |
--------------------------------------------------------------------------------
/vendor/google.golang.org/api/gensupport/doc.go:
--------------------------------------------------------------------------------
1 | // Copyright 2016 The Go Authors. All rights reserved.
2 | // Use of this source code is governed by a BSD-style
3 | // license that can be found in the LICENSE file.
4 |
5 | // Package gensupport is an internal implementation detail used by code
6 | // generated by the google-api-go-generator tool.
7 | //
8 | // This package may be modified at any time without regard for backwards
9 | // compatibility. It should not be used directly by API users.
10 | package gensupport
11 |
--------------------------------------------------------------------------------
/assets_test.go:
--------------------------------------------------------------------------------
1 | package caddy
2 |
3 | import (
4 | "os"
5 | "strings"
6 | "testing"
7 | )
8 |
9 | func TestAssetsPath(t *testing.T) {
10 | if actual := AssetsPath(); !strings.HasSuffix(actual, ".caddy") {
11 | t.Errorf("Expected path to be a .caddy folder, got: %v", actual)
12 | }
13 |
14 | os.Setenv("CADDYPATH", "testpath")
15 | if actual, expected := AssetsPath(), "testpath"; actual != expected {
16 | t.Errorf("Expected path to be %v, got: %v", expected, actual)
17 | }
18 | os.Setenv("CADDYPATH", "")
19 | }
20 |
--------------------------------------------------------------------------------
/vendor/github.com/dustin/go-humanize/ordinals.go:
--------------------------------------------------------------------------------
1 | package humanize
2 |
3 | import "strconv"
4 |
5 | // Ordinal gives you the input number in a rank/ordinal format.
6 | //
7 | // Ordinal(3) -> 3rd
8 | func Ordinal(x int) string {
9 | suffix := "th"
10 | switch x % 10 {
11 | case 1:
12 | if x%100 != 11 {
13 | suffix = "st"
14 | }
15 | case 2:
16 | if x%100 != 12 {
17 | suffix = "nd"
18 | }
19 | case 3:
20 | if x%100 != 13 {
21 | suffix = "rd"
22 | }
23 | }
24 | return strconv.Itoa(x) + suffix
25 | }
26 |
--------------------------------------------------------------------------------
/vendor/gopkg.in/natefinch/lumberjack.v2/chown_linux.go:
--------------------------------------------------------------------------------
1 | package lumberjack
2 |
3 | import (
4 | "os"
5 | "syscall"
6 | )
7 |
8 | // os_Chown is a var so we can mock it out during tests.
9 | var os_Chown = os.Chown
10 |
11 | func chown(name string, info os.FileInfo) error {
12 | f, err := os.OpenFile(name, os.O_CREATE|os.O_WRONLY|os.O_TRUNC, info.Mode())
13 | if err != nil {
14 | return err
15 | }
16 | f.Close()
17 | stat := info.Sys().(*syscall.Stat_t)
18 | return os_Chown(name, int(stat.Uid), int(stat.Gid))
19 | }
20 |
--------------------------------------------------------------------------------
/caddyhttp/markdown/summary/summary.go:
--------------------------------------------------------------------------------
1 | package summary
2 |
3 | import (
4 | "bytes"
5 |
6 | "github.com/russross/blackfriday"
7 | )
8 |
9 | // Markdown formats input using a plain-text renderer, and
10 | // then returns up to the first `wordcount` words as a summary.
11 | func Markdown(input []byte, wordcount int) []byte {
12 | words := bytes.Fields(blackfriday.Markdown(input, renderer{}, 0))
13 | if wordcount > len(words) {
14 | wordcount = len(words)
15 | }
16 | return bytes.Join(words[0:wordcount], []byte{' '})
17 | }
18 |
--------------------------------------------------------------------------------
/vendor/golang.org/x/sys/unix/asm_solaris_amd64.s:
--------------------------------------------------------------------------------
1 | // Copyright 2014 The Go Authors. All rights reserved.
2 | // Use of this source code is governed by a BSD-style
3 | // license that can be found in the LICENSE file.
4 |
5 | // +build !gccgo
6 |
7 | #include "textflag.h"
8 |
9 | //
10 | // System calls for amd64, Solaris are implemented in runtime/syscall_solaris.go
11 | //
12 |
13 | TEXT ·sysvicall6(SB),NOSPLIT,$0-88
14 | JMP syscall·sysvicall6(SB)
15 |
16 | TEXT ·rawSysvicall6(SB),NOSPLIT,$0-88
17 | JMP syscall·rawSysvicall6(SB)
18 |
--------------------------------------------------------------------------------
/vendor/google.golang.org/appengine/internal/identity.go:
--------------------------------------------------------------------------------
1 | // Copyright 2011 Google Inc. All rights reserved.
2 | // Use of this source code is governed by the Apache 2.0
3 | // license that can be found in the LICENSE file.
4 |
5 | package internal
6 |
7 | import netcontext "golang.org/x/net/context"
8 |
9 | // These functions are implementations of the wrapper functions
10 | // in ../appengine/identity.go. See that file for commentary.
11 |
12 | func AppID(c netcontext.Context) string {
13 | return appID(FullyQualifiedAppID(c))
14 | }
15 |
--------------------------------------------------------------------------------
/vendor/github.com/dustin/go-humanize/ftoa.go:
--------------------------------------------------------------------------------
1 | package humanize
2 |
3 | import "strconv"
4 |
5 | func stripTrailingZeros(s string) string {
6 | offset := len(s) - 1
7 | for offset > 0 {
8 | if s[offset] == '.' {
9 | offset--
10 | break
11 | }
12 | if s[offset] != '0' {
13 | break
14 | }
15 | offset--
16 | }
17 | return s[:offset+1]
18 | }
19 |
20 | // Ftoa converts a float to a string with no trailing zeros.
21 | func Ftoa(num float64) string {
22 | return stripTrailingZeros(strconv.FormatFloat(num, 'f', 6, 64))
23 | }
24 |
--------------------------------------------------------------------------------
/vendor/github.com/lucas-clemente/quic-go/internal/utils/connection_id.go:
--------------------------------------------------------------------------------
1 | package utils
2 |
3 | import (
4 | "crypto/rand"
5 | "encoding/binary"
6 |
7 | "github.com/lucas-clemente/quic-go/protocol"
8 | )
9 |
10 | // GenerateConnectionID generates a connection ID using cryptographic random
11 | func GenerateConnectionID() (protocol.ConnectionID, error) {
12 | b := make([]byte, 8)
13 | _, err := rand.Read(b)
14 | if err != nil {
15 | return 0, err
16 | }
17 | return protocol.ConnectionID(binary.LittleEndian.Uint64(b)), nil
18 | }
19 |
--------------------------------------------------------------------------------
/vendor/golang.org/x/net/http2/not_go16.go:
--------------------------------------------------------------------------------
1 | // Copyright 2015 The Go Authors. All rights reserved.
2 | // Use of this source code is governed by a BSD-style
3 | // license that can be found in the LICENSE file.
4 |
5 | // +build !go1.6
6 |
7 | package http2
8 |
9 | import (
10 | "net/http"
11 | "time"
12 | )
13 |
14 | func configureTransport(t1 *http.Transport) (*Transport, error) {
15 | return nil, errTransportVersion
16 | }
17 |
18 | func transportExpectContinueTimeout(t1 *http.Transport) time.Duration {
19 | return 0
20 |
21 | }
22 |
--------------------------------------------------------------------------------
/vendor/golang.org/x/crypto/ssh/terminal/util_linux.go:
--------------------------------------------------------------------------------
1 | // Copyright 2013 The Go Authors. All rights reserved.
2 | // Use of this source code is governed by a BSD-style
3 | // license that can be found in the LICENSE file.
4 |
5 | package terminal
6 |
7 | // These constants are declared here, rather than importing
8 | // them from the syscall package as some syscall packages, even
9 | // on linux, for example gccgo, do not declare them.
10 | const ioctlReadTermios = 0x5401 // syscall.TCGETS
11 | const ioctlWriteTermios = 0x5402 // syscall.TCSETS
12 |
--------------------------------------------------------------------------------
/vendor/golang.org/x/sys/unix/gccgo_linux_sparc64.go:
--------------------------------------------------------------------------------
1 | // Copyright 2016 The Go Authors. All rights reserved.
2 | // Use of this source code is governed by a BSD-style
3 | // license that can be found in the LICENSE file.
4 |
5 | // +build gccgo,linux,sparc64
6 |
7 | package unix
8 |
9 | import "syscall"
10 |
11 | //extern sysconf
12 | func realSysconf(name int) int64
13 |
14 | func sysconf(name int) (n int64, err syscall.Errno) {
15 | r := realSysconf(name)
16 | if r < 0 {
17 | return 0, syscall.GetErrno()
18 | }
19 | return r, 0
20 | }
21 |
--------------------------------------------------------------------------------
/vendor/golang.org/x/oauth2/amazon/amazon.go:
--------------------------------------------------------------------------------
1 | // Copyright 2017 The oauth2 Authors. All rights reserved.
2 | // Use of this source code is governed by a BSD-style
3 | // license that can be found in the LICENSE file.
4 |
5 | // Package amazon provides constants for using OAuth2 to access Amazon.
6 | package amazon
7 |
8 | import (
9 | "golang.org/x/oauth2"
10 | )
11 |
12 | // Endpoint is Amazon's OAuth 2.0 endpoint.
13 | var Endpoint = oauth2.Endpoint{
14 | AuthURL: "https://www.amazon.com/ap/oa",
15 | TokenURL: "https://api.amazon.com/auth/o2/token",
16 | }
17 |
--------------------------------------------------------------------------------
/vendor/golang.org/x/sys/unix/gccgo_linux_amd64.go:
--------------------------------------------------------------------------------
1 | // Copyright 2015 The Go Authors. All rights reserved.
2 | // Use of this source code is governed by a BSD-style
3 | // license that can be found in the LICENSE file.
4 |
5 | // +build gccgo,linux,amd64
6 |
7 | package unix
8 |
9 | import "syscall"
10 |
11 | //extern gettimeofday
12 | func realGettimeofday(*Timeval, *byte) int32
13 |
14 | func gettimeofday(tv *Timeval) (err syscall.Errno) {
15 | r := realGettimeofday(tv, nil)
16 | if r < 0 {
17 | return syscall.GetErrno()
18 | }
19 | return 0
20 | }
21 |
--------------------------------------------------------------------------------
/caddyhttp/websocket/websocket_test.go:
--------------------------------------------------------------------------------
1 | package websocket
2 |
3 | import (
4 | "net/http"
5 | "testing"
6 | )
7 |
8 | func TestBuildEnv(t *testing.T) {
9 | req, err := http.NewRequest("GET", "http://localhost", nil)
10 | if err != nil {
11 | t.Fatal("Error setting up request:", err)
12 | }
13 | req.RemoteAddr = "localhost:50302"
14 |
15 | env, err := buildEnv("/bin/command", req)
16 | if err != nil {
17 | t.Fatal("Didn't expect an error:", err)
18 | }
19 | if len(env) == 0 {
20 | t.Fatalf("Expected non-empty environment; got %#v", env)
21 | }
22 | }
23 |
--------------------------------------------------------------------------------
/vendor/golang.org/x/oauth2/vk/vk.go:
--------------------------------------------------------------------------------
1 | // Copyright 2015 The Go Authors. All rights reserved.
2 | // Use of this source code is governed by a BSD-style
3 | // license that can be found in the LICENSE file.
4 |
5 | // Package vk provides constants for using OAuth2 to access VK.com.
6 | package vk // import "golang.org/x/oauth2/vk"
7 |
8 | import (
9 | "golang.org/x/oauth2"
10 | )
11 |
12 | // Endpoint is VK's OAuth 2.0 endpoint.
13 | var Endpoint = oauth2.Endpoint{
14 | AuthURL: "https://oauth.vk.com/authorize",
15 | TokenURL: "https://oauth.vk.com/access_token",
16 | }
17 |
--------------------------------------------------------------------------------
/vendor/github.com/codahale/aesnicheck/docs.go:
--------------------------------------------------------------------------------
1 | // Package aesnicheck provides a simple check to see if crypto/aes is using
2 | // AES-NI instructions or if the AES transform is being done in software. AES-NI
3 | // is constant-time, which makes it impervious to cache-level timing attacks. For
4 | // security-conscious deployments on public cloud infrastructure (Amazon EC2,
5 | // Google Compute Engine, Microsoft Azure, etc.) this may be critical.
6 | //
7 | // See http://eprint.iacr.org/2014/248 for details on cross-VM timing attacks on
8 | // AES keys.
9 | package aesnicheck
10 |
--------------------------------------------------------------------------------
/vendor/github.com/miekg/dns/COPYRIGHT:
--------------------------------------------------------------------------------
1 | Copyright 2009 The Go Authors. All rights reserved. Use of this source code
2 | is governed by a BSD-style license that can be found in the LICENSE file.
3 | Extensions of the original work are copyright (c) 2011 Miek Gieben
4 |
5 | Copyright 2011 Miek Gieben. All rights reserved. Use of this source code is
6 | governed by a BSD-style license that can be found in the LICENSE file.
7 |
8 | Copyright 2014 CloudFlare. All rights reserved. Use of this source code is
9 | governed by a BSD-style license that can be found in the LICENSE file.
10 |
--------------------------------------------------------------------------------
/vendor/github.com/gorilla/websocket/conn_read_legacy.go:
--------------------------------------------------------------------------------
1 | // Copyright 2016 The Gorilla WebSocket Authors. All rights reserved.
2 | // Use of this source code is governed by a BSD-style
3 | // license that can be found in the LICENSE file.
4 |
5 | // +build !go1.5
6 |
7 | package websocket
8 |
9 | import "io"
10 |
11 | func (c *Conn) read(n int) ([]byte, error) {
12 | p, err := c.br.Peek(n)
13 | if err == io.EOF {
14 | err = errUnexpectedEOF
15 | }
16 | if len(p) > 0 {
17 | // advance over the bytes just read
18 | io.ReadFull(c.br, p)
19 | }
20 | return p, err
21 | }
22 |
--------------------------------------------------------------------------------
/vendor/github.com/jimstudt/http-authentication/basic/util.go:
--------------------------------------------------------------------------------
1 | package basic
2 |
3 | import (
4 | "crypto/sha1"
5 | "crypto/subtle"
6 | )
7 |
8 | func constantTimeEquals(a string, b string) bool {
9 | // compare SHA-1 as a gatekeeper in constant time
10 | // then check that we didn't get by because of a collision
11 | aSha := sha1.Sum([]byte(a))
12 | bSha := sha1.Sum([]byte(b))
13 | if subtle.ConstantTimeCompare(aSha[:], bSha[:]) == 1 {
14 | // yes, this bit isn't constant, but you had to make a Sha1 collision to get here
15 | return a == b
16 | }
17 | return false
18 | }
19 |
--------------------------------------------------------------------------------
/vendor/google.golang.org/appengine/timeout.go:
--------------------------------------------------------------------------------
1 | // Copyright 2013 Google Inc. All rights reserved.
2 | // Use of this source code is governed by the Apache 2.0
3 | // license that can be found in the LICENSE file.
4 |
5 | package appengine
6 |
7 | import "golang.org/x/net/context"
8 |
9 | // IsTimeoutError reports whether err is a timeout error.
10 | func IsTimeoutError(err error) bool {
11 | if err == context.DeadlineExceeded {
12 | return true
13 | }
14 | if t, ok := err.(interface {
15 | IsTimeout() bool
16 | }); ok {
17 | return t.IsTimeout()
18 | }
19 | return false
20 | }
21 |
--------------------------------------------------------------------------------
/vendor/golang.org/x/oauth2/slack/slack.go:
--------------------------------------------------------------------------------
1 | // Copyright 2016 The Go Authors. All rights reserved.
2 | // Use of this source code is governed by a BSD-style
3 | // license that can be found in the LICENSE file.
4 |
5 | // Package slack provides constants for using OAuth2 to access Slack.
6 | package slack // import "golang.org/x/oauth2/slack"
7 |
8 | import (
9 | "golang.org/x/oauth2"
10 | )
11 |
12 | // Endpoint is Slack's OAuth 2.0 endpoint.
13 | var Endpoint = oauth2.Endpoint{
14 | AuthURL: "https://slack.com/oauth/authorize",
15 | TokenURL: "https://slack.com/api/oauth.access",
16 | }
17 |
--------------------------------------------------------------------------------
/vendor/golang.org/x/oauth2/uber/uber.go:
--------------------------------------------------------------------------------
1 | // Copyright 2016 The Go Authors. All rights reserved.
2 | // Use of this source code is governed by a BSD-style
3 | // license that can be found in the LICENSE file.
4 |
5 | // Package uber provides constants for using OAuth2 to access Uber.
6 | package uber // import "golang.org/x/oauth2/uber"
7 |
8 | import (
9 | "golang.org/x/oauth2"
10 | )
11 |
12 | // Endpoint is Uber's OAuth 2.0 endpoint.
13 | var Endpoint = oauth2.Endpoint{
14 | AuthURL: "https://login.uber.com/oauth/v2/authorize",
15 | TokenURL: "https://login.uber.com/oauth/v2/token",
16 | }
17 |
--------------------------------------------------------------------------------
/vendor/golang.org/x/oauth2/bitbucket/bitbucket.go:
--------------------------------------------------------------------------------
1 | // Copyright 2015 The oauth2 Authors. All rights reserved.
2 | // Use of this source code is governed by a BSD-style
3 | // license that can be found in the LICENSE file.
4 |
5 | // Package bitbucket provides constants for using OAuth2 to access Bitbucket.
6 | package bitbucket
7 |
8 | import (
9 | "golang.org/x/oauth2"
10 | )
11 |
12 | // Endpoint is Bitbucket's OAuth 2.0 endpoint.
13 | var Endpoint = oauth2.Endpoint{
14 | AuthURL: "https://bitbucket.org/site/oauth2/authorize",
15 | TokenURL: "https://bitbucket.org/site/oauth2/access_token",
16 | }
17 |
--------------------------------------------------------------------------------
/vendor/golang.org/x/oauth2/heroku/heroku.go:
--------------------------------------------------------------------------------
1 | // Copyright 2016 The Go Authors. All rights reserved.
2 | // Use of this source code is governed by a BSD-style
3 | // license that can be found in the LICENSE file.
4 |
5 | // Package heroku provides constants for using OAuth2 to access Heroku.
6 | package heroku // import "golang.org/x/oauth2/heroku"
7 |
8 | import (
9 | "golang.org/x/oauth2"
10 | )
11 |
12 | // Endpoint is Heroku's OAuth 2.0 endpoint.
13 | var Endpoint = oauth2.Endpoint{
14 | AuthURL: "https://id.heroku.com/oauth/authorize",
15 | TokenURL: "https://id.heroku.com/oauth/token",
16 | }
17 |
--------------------------------------------------------------------------------
/vendor/golang.org/x/oauth2/yandex/yandex.go:
--------------------------------------------------------------------------------
1 | // Copyright 2017 The Go Authors. All rights reserved.
2 | // Use of this source code is governed by a BSD-style
3 | // license that can be found in the LICENSE file.
4 |
5 | // Package yandex provides constants for using OAuth2 to access Yandex APIs.
6 | package yandex // import "golang.org/x/oauth2/yandex"
7 |
8 | import (
9 | "golang.org/x/oauth2"
10 | )
11 |
12 | // Endpoint is the Yandex OAuth 2.0 endpoint.
13 | var Endpoint = oauth2.Endpoint{
14 | AuthURL: "https://oauth.yandex.com/authorize",
15 | TokenURL: "https://oauth.yandex.com/token",
16 | }
17 |
--------------------------------------------------------------------------------
/caddyhttp/bind/bind.go:
--------------------------------------------------------------------------------
1 | package bind
2 |
3 | import (
4 | "github.com/WedgeServer/wedge"
5 | "github.com/WedgeServer/wedge/caddyhttp/httpserver"
6 | )
7 |
8 | func init() {
9 | caddy.RegisterPlugin("bind", caddy.Plugin{
10 | ServerType: "http",
11 | Action: setupBind,
12 | })
13 | }
14 |
15 | func setupBind(c *caddy.Controller) error {
16 | config := httpserver.GetConfig(c)
17 | for c.Next() {
18 | if !c.Args(&config.ListenHost) {
19 | return c.ArgErr()
20 | }
21 | config.TLS.ListenHost = config.ListenHost // necessary for ACME challenges, see issue #309
22 | }
23 | return nil
24 | }
25 |
--------------------------------------------------------------------------------
/vendor/golang.org/x/oauth2/github/github.go:
--------------------------------------------------------------------------------
1 | // Copyright 2014 The Go Authors. All rights reserved.
2 | // Use of this source code is governed by a BSD-style
3 | // license that can be found in the LICENSE file.
4 |
5 | // Package github provides constants for using OAuth2 to access Github.
6 | package github // import "golang.org/x/oauth2/github"
7 |
8 | import (
9 | "golang.org/x/oauth2"
10 | )
11 |
12 | // Endpoint is Github's OAuth 2.0 endpoint.
13 | var Endpoint = oauth2.Endpoint{
14 | AuthURL: "https://github.com/login/oauth/authorize",
15 | TokenURL: "https://github.com/login/oauth/access_token",
16 | }
17 |
--------------------------------------------------------------------------------
/vendor/github.com/codahale/aesnicheck/cmd/aesnicheck/aesnicheck.go:
--------------------------------------------------------------------------------
1 | // Command aesnicheck queries the CPU for AES-NI support. If AES-NI is supported,
2 | // aesnicheck will print "supported" and exit with a status of 0. If AES-NI is
3 | // not supported, aesnicheck will print "unsupported" and exit with a status of
4 | // -1.
5 | package main
6 |
7 | import (
8 | "fmt"
9 | "os"
10 |
11 | "github.com/codahale/aesnicheck"
12 | )
13 |
14 | func main() {
15 | if aesnicheck.HasAESNI() {
16 | fmt.Println("supported")
17 | os.Exit(0)
18 | } else {
19 | fmt.Println("unsupported")
20 | os.Exit(-1)
21 | }
22 | }
23 |
--------------------------------------------------------------------------------
/vendor/github.com/lucas-clemente/quic-go/crypto/cert_sets.go:
--------------------------------------------------------------------------------
1 | package crypto
2 |
3 | import (
4 | "bytes"
5 |
6 | "github.com/lucas-clemente/quic-go-certificates"
7 | )
8 |
9 | type certSet [][]byte
10 |
11 | var certSets = map[uint64]certSet{
12 | certsets.CertSet2Hash: certsets.CertSet2,
13 | certsets.CertSet3Hash: certsets.CertSet3,
14 | }
15 |
16 | // findCertInSet searches for the cert in the set. Negative return value means not found.
17 | func (s *certSet) findCertInSet(cert []byte) int {
18 | for i, c := range *s {
19 | if bytes.Equal(c, cert) {
20 | return i
21 | }
22 | }
23 | return -1
24 | }
25 |
--------------------------------------------------------------------------------
/vendor/github.com/hashicorp/go-syslog/unsupported.go:
--------------------------------------------------------------------------------
1 | // +build windows plan9 nacl
2 |
3 | package gsyslog
4 |
5 | import (
6 | "fmt"
7 | )
8 |
9 | // NewLogger is used to construct a new Syslogger
10 | func NewLogger(p Priority, facility, tag string) (Syslogger, error) {
11 | return nil, fmt.Errorf("Platform does not support syslog")
12 | }
13 |
14 | // DialLogger is used to construct a new Syslogger that establishes connection to remote syslog server
15 | func DialLogger(network, raddr string, p Priority, facility, tag string) (Syslogger, error) {
16 | return nil, fmt.Errorf("Platform does not support syslog")
17 | }
18 |
--------------------------------------------------------------------------------
/vendor/github.com/miekg/dns/udp_other.go:
--------------------------------------------------------------------------------
1 | // +build !linux appengine
2 |
3 | package dns
4 |
5 | import (
6 | "net"
7 | )
8 |
9 | // These do nothing. See udp_linux.go for an example of how to implement this.
10 |
11 | // We tried to adhire to some kind of naming scheme.
12 | func setUDPSocketOptions(conn *net.UDPConn) error { return nil }
13 | func setUDPSocketOptions4(conn *net.UDPConn) error { return nil }
14 | func setUDPSocketOptions6(conn *net.UDPConn) error { return nil }
15 | func getUDPSocketOptions6Only(conn *net.UDPConn) (bool, error) { return false, nil }
16 |
--------------------------------------------------------------------------------
/vendor/golang.org/x/oauth2/fitbit/fitbit.go:
--------------------------------------------------------------------------------
1 | // Copyright 2016 The Go Authors. All rights reserved.
2 | // Use of this source code is governed by a BSD-style
3 | // license that can be found in the LICENSE file.
4 |
5 | // Package fitbit provides constants for using OAuth2 to access the Fitbit API.
6 | package fitbit // import "golang.org/x/oauth2/fitbit"
7 |
8 | import (
9 | "golang.org/x/oauth2"
10 | )
11 |
12 | // Endpoint is the Fitbit API's OAuth 2.0 endpoint.
13 | var Endpoint = oauth2.Endpoint{
14 | AuthURL: "https://www.fitbit.com/oauth2/authorize",
15 | TokenURL: "https://api.fitbit.com/oauth2/token",
16 | }
17 |
--------------------------------------------------------------------------------
/vendor/golang.org/x/oauth2/facebook/facebook.go:
--------------------------------------------------------------------------------
1 | // Copyright 2015 The Go Authors. All rights reserved.
2 | // Use of this source code is governed by a BSD-style
3 | // license that can be found in the LICENSE file.
4 |
5 | // Package facebook provides constants for using OAuth2 to access Facebook.
6 | package facebook // import "golang.org/x/oauth2/facebook"
7 |
8 | import (
9 | "golang.org/x/oauth2"
10 | )
11 |
12 | // Endpoint is Facebook's OAuth 2.0 endpoint.
13 | var Endpoint = oauth2.Endpoint{
14 | AuthURL: "https://www.facebook.com/dialog/oauth",
15 | TokenURL: "https://graph.facebook.com/oauth/access_token",
16 | }
17 |
--------------------------------------------------------------------------------
/caddyhttp/requestid/setup.go:
--------------------------------------------------------------------------------
1 | package requestid
2 |
3 | import (
4 | "github.com/WedgeServer/wedge"
5 | "github.com/WedgeServer/wedge/caddyhttp/httpserver"
6 | )
7 |
8 | func init() {
9 | caddy.RegisterPlugin("request_id", caddy.Plugin{
10 | ServerType: "http",
11 | Action: setup,
12 | })
13 | }
14 |
15 | func setup(c *caddy.Controller) error {
16 | for c.Next() {
17 | if c.NextArg() {
18 | return c.ArgErr() //no arg expected.
19 | }
20 | }
21 |
22 | httpserver.GetConfig(c).AddMiddleware(func(next httpserver.Handler) httpserver.Handler {
23 | return Handler{Next: next}
24 | })
25 |
26 | return nil
27 | }
28 |
--------------------------------------------------------------------------------
/vendor/github.com/lucas-clemente/quic-go/buffer_pool.go:
--------------------------------------------------------------------------------
1 | package quic
2 |
3 | import (
4 | "sync"
5 |
6 | "github.com/lucas-clemente/quic-go/protocol"
7 | )
8 |
9 | var bufferPool sync.Pool
10 |
11 | func getPacketBuffer() []byte {
12 | return bufferPool.Get().([]byte)
13 | }
14 |
15 | func putPacketBuffer(buf []byte) {
16 | if cap(buf) != int(protocol.MaxReceivePacketSize) {
17 | panic("putPacketBuffer called with packet of wrong size!")
18 | }
19 | bufferPool.Put(buf[:0])
20 | }
21 |
22 | func init() {
23 | bufferPool.New = func() interface{} {
24 | return make([]byte, 0, protocol.MaxReceivePacketSize)
25 | }
26 | }
27 |
--------------------------------------------------------------------------------
/vendor/gopkg.in/yaml.v2/LICENSE:
--------------------------------------------------------------------------------
1 | Copyright 2011-2016 Canonical Ltd.
2 |
3 | Licensed under the Apache License, Version 2.0 (the "License");
4 | you may not use this file except in compliance with the License.
5 | You may obtain a copy of the License at
6 |
7 | http://www.apache.org/licenses/LICENSE-2.0
8 |
9 | Unless required by applicable law or agreed to in writing, software
10 | distributed under the License is distributed on an "AS IS" BASIS,
11 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 | See the License for the specific language governing permissions and
13 | limitations under the License.
14 |
--------------------------------------------------------------------------------
/vendor/golang.org/x/oauth2/foursquare/foursquare.go:
--------------------------------------------------------------------------------
1 | // Copyright 2016 The Go Authors. All rights reserved.
2 | // Use of this source code is governed by a BSD-style
3 | // license that can be found in the LICENSE file.
4 |
5 | // Package foursquare provides constants for using OAuth2 to access Foursquare.
6 | package foursquare // import "golang.org/x/oauth2/foursquare"
7 |
8 | import (
9 | "golang.org/x/oauth2"
10 | )
11 |
12 | // Endpoint is Foursquare's OAuth 2.0 endpoint.
13 | var Endpoint = oauth2.Endpoint{
14 | AuthURL: "https://foursquare.com/oauth2/authorize",
15 | TokenURL: "https://foursquare.com/oauth2/access_token",
16 | }
17 |
--------------------------------------------------------------------------------
/vendor/golang.org/x/oauth2/linkedin/linkedin.go:
--------------------------------------------------------------------------------
1 | // Copyright 2015 The Go Authors. All rights reserved.
2 | // Use of this source code is governed by a BSD-style
3 | // license that can be found in the LICENSE file.
4 |
5 | // Package linkedin provides constants for using OAuth2 to access LinkedIn.
6 | package linkedin // import "golang.org/x/oauth2/linkedin"
7 |
8 | import (
9 | "golang.org/x/oauth2"
10 | )
11 |
12 | // Endpoint is LinkedIn's OAuth 2.0 endpoint.
13 | var Endpoint = oauth2.Endpoint{
14 | AuthURL: "https://www.linkedin.com/uas/oauth2/authorization",
15 | TokenURL: "https://www.linkedin.com/uas/oauth2/accessToken",
16 | }
17 |
--------------------------------------------------------------------------------
/vendor/golang.org/x/sys/unix/race0.go:
--------------------------------------------------------------------------------
1 | // Copyright 2012 The Go Authors. All rights reserved.
2 | // Use of this source code is governed by a BSD-style
3 | // license that can be found in the LICENSE file.
4 |
5 | // +build darwin,!race linux,!race freebsd,!race netbsd openbsd solaris dragonfly
6 |
7 | package unix
8 |
9 | import (
10 | "unsafe"
11 | )
12 |
13 | const raceenabled = false
14 |
15 | func raceAcquire(addr unsafe.Pointer) {
16 | }
17 |
18 | func raceReleaseMerge(addr unsafe.Pointer) {
19 | }
20 |
21 | func raceReadRange(addr unsafe.Pointer, len int) {
22 | }
23 |
24 | func raceWriteRange(addr unsafe.Pointer, len int) {
25 | }
26 |
--------------------------------------------------------------------------------
/vendor/github.com/xenolf/lego/acme/utils.go:
--------------------------------------------------------------------------------
1 | package acme
2 |
3 | import (
4 | "fmt"
5 | "time"
6 | )
7 |
8 | // WaitFor polls the given function 'f', once every 'interval', up to 'timeout'.
9 | func WaitFor(timeout, interval time.Duration, f func() (bool, error)) error {
10 | var lastErr string
11 | timeup := time.After(timeout)
12 | for {
13 | select {
14 | case <-timeup:
15 | return fmt.Errorf("Time limit exceeded. Last error: %s", lastErr)
16 | default:
17 | }
18 |
19 | stop, err := f()
20 | if stop {
21 | return nil
22 | }
23 | if err != nil {
24 | lastErr = err.Error()
25 | }
26 |
27 | time.Sleep(interval)
28 | }
29 | }
30 |
--------------------------------------------------------------------------------
/caddyhttp/caddyhttp_test.go:
--------------------------------------------------------------------------------
1 | package caddyhttp
2 |
3 | import (
4 | "strings"
5 | "testing"
6 |
7 | "github.com/WedgeServer/wedge"
8 | )
9 |
10 | // TODO: this test could be improved; the purpose is to
11 | // ensure that the standard plugins are in fact plugged in
12 | // and registered properly; this is a quick/naive way to do it.
13 | func TestStandardPlugins(t *testing.T) {
14 | numStandardPlugins := 32 // importing caddyhttp plugs in this many plugins
15 | s := caddy.DescribePlugins()
16 | if got, want := strings.Count(s, "\n"), numStandardPlugins+5; got != want {
17 | t.Errorf("Expected all standard plugins to be plugged in, got:\n%s", s)
18 | }
19 | }
20 |
--------------------------------------------------------------------------------
/vendor/golang.org/x/oauth2/microsoft/microsoft.go:
--------------------------------------------------------------------------------
1 | // Copyright 2016 The Go Authors. All rights reserved.
2 | // Use of this source code is governed by a BSD-style
3 | // license that can be found in the LICENSE file.
4 |
5 | // Package microsoft provides constants for using OAuth2 to access Windows Live ID.
6 | package microsoft // import "golang.org/x/oauth2/microsoft"
7 |
8 | import (
9 | "golang.org/x/oauth2"
10 | )
11 |
12 | // LiveConnectEndpoint is Windows's Live ID OAuth 2.0 endpoint.
13 | var LiveConnectEndpoint = oauth2.Endpoint{
14 | AuthURL: "https://login.live.com/oauth20_authorize.srf",
15 | TokenURL: "https://login.live.com/oauth20_token.srf",
16 | }
17 |
--------------------------------------------------------------------------------
/vendor/golang.org/x/oauth2/odnoklassniki/odnoklassniki.go:
--------------------------------------------------------------------------------
1 | // Copyright 2015 The Go Authors. All rights reserved.
2 | // Use of this source code is governed by a BSD-style
3 | // license that can be found in the LICENSE file.
4 |
5 | // Package odnoklassniki provides constants for using OAuth2 to access Odnoklassniki.
6 | package odnoklassniki // import "golang.org/x/oauth2/odnoklassniki"
7 |
8 | import (
9 | "golang.org/x/oauth2"
10 | )
11 |
12 | // Endpoint is Odnoklassniki's OAuth 2.0 endpoint.
13 | var Endpoint = oauth2.Endpoint{
14 | AuthURL: "https://www.odnoklassniki.ru/oauth/authorize",
15 | TokenURL: "https://api.odnoklassniki.ru/oauth/token.do",
16 | }
17 |
--------------------------------------------------------------------------------
/caddyhttp/push/push.go:
--------------------------------------------------------------------------------
1 | package push
2 |
3 | import (
4 | "net/http"
5 |
6 | "github.com/WedgeServer/wedge/caddyhttp/httpserver"
7 | )
8 |
9 | type (
10 | // Rule describes conditions on which resources will be pushed
11 | Rule struct {
12 | Path string
13 | Resources []Resource
14 | }
15 |
16 | // Resource describes resource to be pushed
17 | Resource struct {
18 | Path string
19 | Method string
20 | Header http.Header
21 | }
22 |
23 | // Middleware supports pushing resources to clients
24 | Middleware struct {
25 | Next httpserver.Handler
26 | Rules []Rule
27 | Root http.FileSystem
28 | }
29 |
30 | ruleOp func([]Resource)
31 | )
32 |
--------------------------------------------------------------------------------
/vendor/golang.org/x/oauth2/client_appengine.go:
--------------------------------------------------------------------------------
1 | // Copyright 2014 The Go Authors. All rights reserved.
2 | // Use of this source code is governed by a BSD-style
3 | // license that can be found in the LICENSE file.
4 |
5 | // +build appengine
6 |
7 | // App Engine hooks.
8 |
9 | package oauth2
10 |
11 | import (
12 | "net/http"
13 |
14 | "golang.org/x/net/context"
15 | "golang.org/x/oauth2/internal"
16 | "google.golang.org/appengine/urlfetch"
17 | )
18 |
19 | func init() {
20 | internal.RegisterContextClientFunc(contextClientAppEngine)
21 | }
22 |
23 | func contextClientAppEngine(ctx context.Context) (*http.Client, error) {
24 | return urlfetch.Client(ctx), nil
25 | }
26 |
--------------------------------------------------------------------------------
/vendor/google.golang.org/appengine/appengine_vm.go:
--------------------------------------------------------------------------------
1 | // Copyright 2015 Google Inc. All rights reserved.
2 | // Use of this source code is governed by the Apache 2.0
3 | // license that can be found in the LICENSE file.
4 |
5 | // +build !appengine
6 |
7 | package appengine
8 |
9 | import (
10 | "golang.org/x/net/context"
11 |
12 | "google.golang.org/appengine/internal"
13 | )
14 |
15 | // BackgroundContext returns a context not associated with a request.
16 | // This should only be used when not servicing a request.
17 | // This only works in App Engine "flexible environment".
18 | func BackgroundContext() context.Context {
19 | return internal.BackgroundContext()
20 | }
21 |
--------------------------------------------------------------------------------
/rlimit_posix.go:
--------------------------------------------------------------------------------
1 | // +build !windows,!plan9,!nacl
2 |
3 | package caddy
4 |
5 | import (
6 | "fmt"
7 | "syscall"
8 | )
9 |
10 | // checkFdlimit issues a warning if the OS limit for
11 | // max file descriptors is below a recommended minimum.
12 | func checkFdlimit() {
13 | const min = 8192
14 |
15 | // Warn if ulimit is too low for production sites
16 | rlimit := &syscall.Rlimit{}
17 | err := syscall.Getrlimit(syscall.RLIMIT_NOFILE, rlimit)
18 | if err == nil && rlimit.Cur < min {
19 | fmt.Printf("WARNING: File descriptor limit %d is too low for production servers. "+
20 | "At least %d is recommended. Fix with \"ulimit -n %d\".\n", rlimit.Cur, min, min)
21 | }
22 |
23 | }
24 |
--------------------------------------------------------------------------------
/caddyhttp/index/index.go:
--------------------------------------------------------------------------------
1 | package index
2 |
3 | import (
4 | "github.com/WedgeServer/wedge"
5 | "github.com/WedgeServer/wedge/caddyhttp/staticfiles"
6 | )
7 |
8 | func init() {
9 | caddy.RegisterPlugin("index", caddy.Plugin{
10 | ServerType: "http",
11 | Action: setupIndex,
12 | })
13 | }
14 |
15 | func setupIndex(c *caddy.Controller) error {
16 | var index []string
17 |
18 | for c.Next() {
19 | args := c.RemainingArgs()
20 |
21 | if len(args) == 0 {
22 | return c.Errf("Expected at least one index")
23 | }
24 |
25 | for _, in := range args {
26 | index = append(index, in)
27 | }
28 |
29 | staticfiles.IndexPages = index
30 | }
31 |
32 | return nil
33 | }
34 |
--------------------------------------------------------------------------------
/vendor/golang.org/x/sys/unix/env_unix.go:
--------------------------------------------------------------------------------
1 | // Copyright 2010 The Go Authors. All rights reserved.
2 | // Use of this source code is governed by a BSD-style
3 | // license that can be found in the LICENSE file.
4 |
5 | // +build darwin dragonfly freebsd linux netbsd openbsd solaris
6 |
7 | // Unix environment variables.
8 |
9 | package unix
10 |
11 | import "syscall"
12 |
13 | func Getenv(key string) (value string, found bool) {
14 | return syscall.Getenv(key)
15 | }
16 |
17 | func Setenv(key, value string) error {
18 | return syscall.Setenv(key, value)
19 | }
20 |
21 | func Clearenv() {
22 | syscall.Clearenv()
23 | }
24 |
25 | func Environ() []string {
26 | return syscall.Environ()
27 | }
28 |
--------------------------------------------------------------------------------
/vendor/github.com/hashicorp/go-syslog/syslog.go:
--------------------------------------------------------------------------------
1 | package gsyslog
2 |
3 | // Priority maps to the syslog priority levels
4 | type Priority int
5 |
6 | const (
7 | LOG_EMERG Priority = iota
8 | LOG_ALERT
9 | LOG_CRIT
10 | LOG_ERR
11 | LOG_WARNING
12 | LOG_NOTICE
13 | LOG_INFO
14 | LOG_DEBUG
15 | )
16 |
17 | // Syslogger interface is used to write log messages to syslog
18 | type Syslogger interface {
19 | // WriteLevel is used to write a message at a given level
20 | WriteLevel(Priority, []byte) error
21 |
22 | // Write is used to write a message at the default level
23 | Write([]byte) (int, error)
24 |
25 | // Close is used to close the connection to the logger
26 | Close() error
27 | }
28 |
--------------------------------------------------------------------------------
/vendor/github.com/lucas-clemente/quic-go/congestion/bandwidth.go:
--------------------------------------------------------------------------------
1 | package congestion
2 |
3 | import (
4 | "time"
5 |
6 | "github.com/lucas-clemente/quic-go/protocol"
7 | )
8 |
9 | // Bandwidth of a connection
10 | type Bandwidth uint64
11 |
12 | const (
13 | // BitsPerSecond is 1 bit per second
14 | BitsPerSecond Bandwidth = 1
15 | // BytesPerSecond is 1 byte per second
16 | BytesPerSecond = 8 * BitsPerSecond
17 | )
18 |
19 | // BandwidthFromDelta calculates the bandwidth from a number of bytes and a time delta
20 | func BandwidthFromDelta(bytes protocol.ByteCount, delta time.Duration) Bandwidth {
21 | return Bandwidth(bytes) * Bandwidth(time.Second) / Bandwidth(delta) * BytesPerSecond
22 | }
23 |
--------------------------------------------------------------------------------
/vendor/golang.org/x/net/websocket/dial.go:
--------------------------------------------------------------------------------
1 | // Copyright 2015 The Go Authors. All rights reserved.
2 | // Use of this source code is governed by a BSD-style
3 | // license that can be found in the LICENSE file.
4 |
5 | package websocket
6 |
7 | import (
8 | "crypto/tls"
9 | "net"
10 | )
11 |
12 | func dialWithDialer(dialer *net.Dialer, config *Config) (conn net.Conn, err error) {
13 | switch config.Location.Scheme {
14 | case "ws":
15 | conn, err = dialer.Dial("tcp", parseAuthority(config.Location))
16 |
17 | case "wss":
18 | conn, err = tls.DialWithDialer(dialer, "tcp", parseAuthority(config.Location), config.TlsConfig)
19 |
20 | default:
21 | err = ErrBadScheme
22 | }
23 | return
24 | }
25 |
--------------------------------------------------------------------------------
/vendor/github.com/lucas-clemente/quic-go/internal/utils/host.go:
--------------------------------------------------------------------------------
1 | package utils
2 |
3 | import (
4 | "net/url"
5 | "strings"
6 | )
7 |
8 | // HostnameFromAddr determines the hostname in an address string
9 | func HostnameFromAddr(addr string) (string, error) {
10 | p, err := url.Parse(addr)
11 | if err != nil {
12 | return "", err
13 | }
14 | h := p.Host
15 |
16 | // copied from https://golang.org/src/net/http/transport.go
17 | if hasPort(h) {
18 | h = h[:strings.LastIndex(h, ":")]
19 | }
20 |
21 | return h, nil
22 | }
23 |
24 | // copied from https://golang.org/src/net/http/http.go
25 | func hasPort(s string) bool {
26 | return strings.LastIndex(s, ":") > strings.LastIndex(s, "]")
27 | }
28 |
--------------------------------------------------------------------------------
/vendor/golang.org/x/sys/unix/syscall_unix_gc.go:
--------------------------------------------------------------------------------
1 | // Copyright 2016 The Go Authors. All rights reserved.
2 | // Use of this source code is governed by a BSD-style
3 | // license that can be found in the LICENSE file.
4 |
5 | // +build darwin dragonfly freebsd linux netbsd openbsd solaris
6 | // +build !gccgo
7 |
8 | package unix
9 |
10 | import "syscall"
11 |
12 | func Syscall(trap, a1, a2, a3 uintptr) (r1, r2 uintptr, err syscall.Errno)
13 | func Syscall6(trap, a1, a2, a3, a4, a5, a6 uintptr) (r1, r2 uintptr, err syscall.Errno)
14 | func RawSyscall(trap, a1, a2, a3 uintptr) (r1, r2 uintptr, err syscall.Errno)
15 | func RawSyscall6(trap, a1, a2, a3, a4, a5, a6 uintptr) (r1, r2 uintptr, err syscall.Errno)
16 |
--------------------------------------------------------------------------------
/.github/PULL_REQUEST_TEMPLATE.md:
--------------------------------------------------------------------------------
1 |
4 |
5 | ### 1. What does this change do, exactly?
6 |
7 |
8 | ### 2. Please link to the relevant issues.
9 |
10 |
11 | ### 3. Which documentation changes (if any) need to be made because of this PR?
12 |
13 |
14 | ### 4. Checklist
15 |
16 | - [ ] I have written tests and verified that they fail without my change
17 | - [ ] I have squashed any insignificant commits
18 | - [ ] This change has comments for package types, values, functions, and non-obvious lines of code
19 | - [ ] I am willing to help maintain this change if there are issues with it later
20 |
--------------------------------------------------------------------------------
/vendor/golang.org/x/sys/unix/asm_linux_arm64.s:
--------------------------------------------------------------------------------
1 | // Copyright 2015 The Go Authors. All rights reserved.
2 | // Use of this source code is governed by a BSD-style
3 | // license that can be found in the LICENSE file.
4 |
5 | // +build linux
6 | // +build arm64
7 | // +build !gccgo
8 |
9 | #include "textflag.h"
10 |
11 | // Just jump to package syscall's implementation for all these functions.
12 | // The runtime may know about them.
13 |
14 | TEXT ·Syscall(SB),NOSPLIT,$0-56
15 | B syscall·Syscall(SB)
16 |
17 | TEXT ·Syscall6(SB),NOSPLIT,$0-80
18 | B syscall·Syscall6(SB)
19 |
20 | TEXT ·RawSyscall(SB),NOSPLIT,$0-56
21 | B syscall·RawSyscall(SB)
22 |
23 | TEXT ·RawSyscall6(SB),NOSPLIT,$0-80
24 | B syscall·RawSyscall6(SB)
25 |
--------------------------------------------------------------------------------
/vendor/google.golang.org/appengine/aetest/instance_classic.go:
--------------------------------------------------------------------------------
1 | // +build appengine
2 |
3 | package aetest
4 |
5 | import "appengine/aetest"
6 |
7 | // NewInstance launches a running instance of api_server.py which can be used
8 | // for multiple test Contexts that delegate all App Engine API calls to that
9 | // instance.
10 | // If opts is nil the default values are used.
11 | func NewInstance(opts *Options) (Instance, error) {
12 | aetest.PrepareDevAppserver = PrepareDevAppserver
13 | var aeOpts *aetest.Options
14 | if opts != nil {
15 | aeOpts = &aetest.Options{
16 | AppID: opts.AppID,
17 | StronglyConsistentDatastore: opts.StronglyConsistentDatastore,
18 | }
19 | }
20 | return aetest.NewInstance(aeOpts)
21 | }
22 |
--------------------------------------------------------------------------------
/caddyhttp/bind/bind_test.go:
--------------------------------------------------------------------------------
1 | package bind
2 |
3 | import (
4 | "testing"
5 |
6 | "github.com/WedgeServer/wedge"
7 | "github.com/WedgeServer/wedge/caddyhttp/httpserver"
8 | )
9 |
10 | func TestSetupBind(t *testing.T) {
11 | c := caddy.NewTestController("http", `bind 1.2.3.4`)
12 | err := setupBind(c)
13 | if err != nil {
14 | t.Fatalf("Expected no errors, but got: %v", err)
15 | }
16 |
17 | cfg := httpserver.GetConfig(c)
18 | if got, want := cfg.ListenHost, "1.2.3.4"; got != want {
19 | t.Errorf("Expected the config's ListenHost to be %s, was %s", want, got)
20 | }
21 | if got, want := cfg.TLS.ListenHost, "1.2.3.4"; got != want {
22 | t.Errorf("Expected the TLS config's ListenHost to be %s, was %s", want, got)
23 | }
24 | }
25 |
--------------------------------------------------------------------------------
/vendor/golang.org/x/net/websocket/examplehandler_test.go:
--------------------------------------------------------------------------------
1 | // Copyright 2012 The Go Authors. All rights reserved.
2 | // Use of this source code is governed by a BSD-style
3 | // license that can be found in the LICENSE file.
4 |
5 | package websocket_test
6 |
7 | import (
8 | "io"
9 | "net/http"
10 |
11 | "golang.org/x/net/websocket"
12 | )
13 |
14 | // Echo the data received on the WebSocket.
15 | func EchoServer(ws *websocket.Conn) {
16 | io.Copy(ws, ws)
17 | }
18 |
19 | // This example demonstrates a trivial echo server.
20 | func ExampleHandler() {
21 | http.Handle("/echo", websocket.Handler(EchoServer))
22 | err := http.ListenAndServe(":12345", nil)
23 | if err != nil {
24 | panic("ListenAndServe: " + err.Error())
25 | }
26 | }
27 |
--------------------------------------------------------------------------------
/vendor/golang.org/x/sys/unix/str.go:
--------------------------------------------------------------------------------
1 | // Copyright 2009 The Go Authors. All rights reserved.
2 | // Use of this source code is governed by a BSD-style
3 | // license that can be found in the LICENSE file.
4 |
5 | // +build darwin dragonfly freebsd linux netbsd openbsd solaris
6 |
7 | package unix
8 |
9 | func itoa(val int) string { // do it here rather than with fmt to avoid dependency
10 | if val < 0 {
11 | return "-" + uitoa(uint(-val))
12 | }
13 | return uitoa(uint(val))
14 | }
15 |
16 | func uitoa(val uint) string {
17 | var buf [32]byte // big enough for int64
18 | i := len(buf) - 1
19 | for val >= 10 {
20 | buf[i] = byte(val%10 + '0')
21 | i--
22 | val /= 10
23 | }
24 | buf[i] = byte(val + '0')
25 | return string(buf[i:])
26 | }
27 |
--------------------------------------------------------------------------------
/vendor/github.com/lucas-clemente/quic-go/h2quic/request_body.go:
--------------------------------------------------------------------------------
1 | package h2quic
2 |
3 | import (
4 | "io"
5 |
6 | quic "github.com/lucas-clemente/quic-go"
7 | )
8 |
9 | type requestBody struct {
10 | requestRead bool
11 | dataStream quic.Stream
12 | }
13 |
14 | // make sure the requestBody can be used as a http.Request.Body
15 | var _ io.ReadCloser = &requestBody{}
16 |
17 | func newRequestBody(stream quic.Stream) *requestBody {
18 | return &requestBody{dataStream: stream}
19 | }
20 |
21 | func (b *requestBody) Read(p []byte) (int, error) {
22 | b.requestRead = true
23 | return b.dataStream.Read(p)
24 | }
25 |
26 | func (b *requestBody) Close() error {
27 | // stream's Close() closes the write side, not the read side
28 | return nil
29 | }
30 |
--------------------------------------------------------------------------------
/vendor/golang.org/x/crypto/curve25519/const_amd64.s:
--------------------------------------------------------------------------------
1 | // Copyright 2012 The Go Authors. All rights reserved.
2 | // Use of this source code is governed by a BSD-style
3 | // license that can be found in the LICENSE file.
4 |
5 | // This code was translated into a form compatible with 6a from the public
6 | // domain sources in SUPERCOP: https://bench.cr.yp.to/supercop.html
7 |
8 | // +build amd64,!gccgo,!appengine
9 |
10 | // These constants cannot be encoded in non-MOVQ immediates.
11 | // We access them directly from memory instead.
12 |
13 | DATA ·_121666_213(SB)/8, $996687872
14 | GLOBL ·_121666_213(SB), 8, $8
15 |
16 | DATA ·_2P0(SB)/8, $0xFFFFFFFFFFFDA
17 | GLOBL ·_2P0(SB), 8, $8
18 |
19 | DATA ·_2P1234(SB)/8, $0xFFFFFFFFFFFFE
20 | GLOBL ·_2P1234(SB), 8, $8
21 |
--------------------------------------------------------------------------------
/vendor/golang.org/x/sys/unix/file_unix.go:
--------------------------------------------------------------------------------
1 | // Copyright 2017 The Go Authors. All rights reserved.
2 | // Use of this source code is governed by a BSD-style
3 | // license that can be found in the LICENSE file.
4 |
5 | package unix
6 |
7 | import (
8 | "os"
9 | "syscall"
10 | )
11 |
12 | // FIXME: unexported function from os
13 | // syscallMode returns the syscall-specific mode bits from Go's portable mode bits.
14 | func syscallMode(i os.FileMode) (o uint32) {
15 | o |= uint32(i.Perm())
16 | if i&os.ModeSetuid != 0 {
17 | o |= syscall.S_ISUID
18 | }
19 | if i&os.ModeSetgid != 0 {
20 | o |= syscall.S_ISGID
21 | }
22 | if i&os.ModeSticky != 0 {
23 | o |= syscall.S_ISVTX
24 | }
25 | // No mapping for Go's ModeTemporary (plan9 only).
26 | return
27 | }
28 |
--------------------------------------------------------------------------------
/vendor/google.golang.org/api/googleapi/internal/uritemplates/utils.go:
--------------------------------------------------------------------------------
1 | // Copyright 2016 The Go Authors. All rights reserved.
2 | // Use of this source code is governed by a BSD-style
3 | // license that can be found in the LICENSE file.
4 |
5 | package uritemplates
6 |
7 | // Expand parses then expands a URI template with a set of values to produce
8 | // the resultant URI. Two forms of the result are returned: one with all the
9 | // elements escaped, and one with the elements unescaped.
10 | func Expand(path string, values map[string]string) (escaped, unescaped string, err error) {
11 | template, err := parse(path)
12 | if err != nil {
13 | return "", "", err
14 | }
15 | escaped, unescaped = template.Expand(values)
16 | return escaped, unescaped, nil
17 | }
18 |
--------------------------------------------------------------------------------
/vendor/golang.org/x/sys/unix/race.go:
--------------------------------------------------------------------------------
1 | // Copyright 2012 The Go Authors. All rights reserved.
2 | // Use of this source code is governed by a BSD-style
3 | // license that can be found in the LICENSE file.
4 |
5 | // +build darwin,race linux,race freebsd,race
6 |
7 | package unix
8 |
9 | import (
10 | "runtime"
11 | "unsafe"
12 | )
13 |
14 | const raceenabled = true
15 |
16 | func raceAcquire(addr unsafe.Pointer) {
17 | runtime.RaceAcquire(addr)
18 | }
19 |
20 | func raceReleaseMerge(addr unsafe.Pointer) {
21 | runtime.RaceReleaseMerge(addr)
22 | }
23 |
24 | func raceReadRange(addr unsafe.Pointer, len int) {
25 | runtime.RaceReadRange(addr, len)
26 | }
27 |
28 | func raceWriteRange(addr unsafe.Pointer, len int) {
29 | runtime.RaceWriteRange(addr, len)
30 | }
31 |
--------------------------------------------------------------------------------
/vendor/github.com/dustin/go-humanize/big.go:
--------------------------------------------------------------------------------
1 | package humanize
2 |
3 | import (
4 | "math/big"
5 | )
6 |
7 | // order of magnitude (to a max order)
8 | func oomm(n, b *big.Int, maxmag int) (float64, int) {
9 | mag := 0
10 | m := &big.Int{}
11 | for n.Cmp(b) >= 0 {
12 | n.DivMod(n, b, m)
13 | mag++
14 | if mag == maxmag && maxmag >= 0 {
15 | break
16 | }
17 | }
18 | return float64(n.Int64()) + (float64(m.Int64()) / float64(b.Int64())), mag
19 | }
20 |
21 | // total order of magnitude
22 | // (same as above, but with no upper limit)
23 | func oom(n, b *big.Int) (float64, int) {
24 | mag := 0
25 | m := &big.Int{}
26 | for n.Cmp(b) >= 0 {
27 | n.DivMod(n, b, m)
28 | mag++
29 | }
30 | return float64(n.Int64()) + (float64(m.Int64()) / float64(b.Int64())), mag
31 | }
32 |
--------------------------------------------------------------------------------
/caddyhttp/pprof/setup_test.go:
--------------------------------------------------------------------------------
1 | package pprof
2 |
3 | import (
4 | "testing"
5 |
6 | "github.com/WedgeServer/wedge"
7 | )
8 |
9 | func TestSetup(t *testing.T) {
10 | tests := []struct {
11 | input string
12 | shouldErr bool
13 | }{
14 | {`pprof`, false},
15 | {`pprof {}`, true},
16 | {`pprof /foo`, true},
17 | {`pprof {
18 | a b
19 | }`, true},
20 | {`pprof
21 | pprof`, true},
22 | }
23 | for i, test := range tests {
24 | c := caddy.NewTestController("http", test.input)
25 | err := setup(c)
26 | if test.shouldErr && err == nil {
27 | t.Errorf("Test %v: Expected error but found nil", i)
28 | } else if !test.shouldErr && err != nil {
29 | t.Errorf("Test %v: Expected no error but found error: %v", i, err)
30 | }
31 | }
32 | }
33 |
--------------------------------------------------------------------------------
/vendor/golang.org/x/net/context/go19.go:
--------------------------------------------------------------------------------
1 | // Copyright 2017 The Go Authors. All rights reserved.
2 | // Use of this source code is governed by a BSD-style
3 | // license that can be found in the LICENSE file.
4 |
5 | // +build go1.9
6 |
7 | package context
8 |
9 | import "context" // standard library's context, as of Go 1.7
10 |
11 | // A Context carries a deadline, a cancelation signal, and other values across
12 | // API boundaries.
13 | //
14 | // Context's methods may be called by multiple goroutines simultaneously.
15 | type Context = context.Context
16 |
17 | // A CancelFunc tells an operation to abandon its work.
18 | // A CancelFunc does not wait for the work to stop.
19 | // After the first call, subsequent calls to a CancelFunc do nothing.
20 | type CancelFunc = context.CancelFunc
21 |
--------------------------------------------------------------------------------
/vendor/golang.org/x/sys/unix/asm_linux_s390x.s:
--------------------------------------------------------------------------------
1 | // Copyright 2016 The Go Authors. All rights reserved.
2 | // Use of this source code is governed by a BSD-style
3 | // license that can be found in the LICENSE file.
4 |
5 | // +build s390x
6 | // +build linux
7 | // +build !gccgo
8 |
9 | #include "textflag.h"
10 |
11 | //
12 | // System calls for s390x, Linux
13 | //
14 |
15 | // Just jump to package syscall's implementation for all these functions.
16 | // The runtime may know about them.
17 |
18 | TEXT ·Syscall(SB),NOSPLIT,$0-56
19 | BR syscall·Syscall(SB)
20 |
21 | TEXT ·Syscall6(SB),NOSPLIT,$0-80
22 | BR syscall·Syscall6(SB)
23 |
24 | TEXT ·RawSyscall(SB),NOSPLIT,$0-56
25 | BR syscall·RawSyscall(SB)
26 |
27 | TEXT ·RawSyscall6(SB),NOSPLIT,$0-80
28 | BR syscall·RawSyscall6(SB)
29 |
--------------------------------------------------------------------------------
/vendor/google.golang.org/api/gensupport/header.go:
--------------------------------------------------------------------------------
1 | // Copyright 2017 The Go Authors. All rights reserved.
2 | // Use of this source code is governed by a BSD-style
3 | // license that can be found in the LICENSE file.
4 |
5 | package gensupport
6 |
7 | import (
8 | "fmt"
9 | "runtime"
10 | "strings"
11 | )
12 |
13 | // GoogleClientHeader returns the value to use for the x-goog-api-client
14 | // header, which is used internally by Google.
15 | func GoogleClientHeader(generatorVersion, clientElement string) string {
16 | elts := []string{"gl-go/" + strings.Replace(runtime.Version(), " ", "_", -1)}
17 | if clientElement != "" {
18 | elts = append(elts, clientElement)
19 | }
20 | elts = append(elts, fmt.Sprintf("gdcl/%s", generatorVersion))
21 | return strings.Join(elts, " ")
22 | }
23 |
--------------------------------------------------------------------------------
/vendor/github.com/alecthomas/units/si.go:
--------------------------------------------------------------------------------
1 | package units
2 |
3 | // SI units.
4 | type SI int64
5 |
6 | // SI unit multiples.
7 | const (
8 | Kilo SI = 1000
9 | Mega = Kilo * 1000
10 | Giga = Mega * 1000
11 | Tera = Giga * 1000
12 | Peta = Tera * 1000
13 | Exa = Peta * 1000
14 | )
15 |
16 | func MakeUnitMap(suffix, shortSuffix string, scale int64) map[string]float64 {
17 | return map[string]float64{
18 | shortSuffix: 1,
19 | "K" + suffix: float64(scale),
20 | "M" + suffix: float64(scale * scale),
21 | "G" + suffix: float64(scale * scale * scale),
22 | "T" + suffix: float64(scale * scale * scale * scale),
23 | "P" + suffix: float64(scale * scale * scale * scale * scale),
24 | "E" + suffix: float64(scale * scale * scale * scale * scale * scale),
25 | }
26 | }
27 |
--------------------------------------------------------------------------------
/vendor/golang.org/x/net/http2/not_go18.go:
--------------------------------------------------------------------------------
1 | // Copyright 2016 The Go Authors. All rights reserved.
2 | // Use of this source code is governed by a BSD-style
3 | // license that can be found in the LICENSE file.
4 |
5 | // +build !go1.8
6 |
7 | package http2
8 |
9 | import (
10 | "io"
11 | "net/http"
12 | )
13 |
14 | func configureServer18(h1 *http.Server, h2 *Server) error {
15 | // No IdleTimeout to sync prior to Go 1.8.
16 | return nil
17 | }
18 |
19 | func shouldLogPanic(panicValue interface{}) bool {
20 | return panicValue != nil
21 | }
22 |
23 | func reqGetBody(req *http.Request) func() (io.ReadCloser, error) {
24 | return nil
25 | }
26 |
27 | func reqBodyIsNoBody(io.ReadCloser) bool { return false }
28 |
29 | func go18httpNoBody() io.ReadCloser { return nil } // for tests only
30 |
--------------------------------------------------------------------------------
/vendor/golang.org/x/sys/unix/asm_linux_ppc64x.s:
--------------------------------------------------------------------------------
1 | // Copyright 2014 The Go Authors. All rights reserved.
2 | // Use of this source code is governed by a BSD-style
3 | // license that can be found in the LICENSE file.
4 |
5 | // +build linux
6 | // +build ppc64 ppc64le
7 | // +build !gccgo
8 |
9 | #include "textflag.h"
10 |
11 | //
12 | // System calls for ppc64, Linux
13 | //
14 |
15 | // Just jump to package syscall's implementation for all these functions.
16 | // The runtime may know about them.
17 |
18 | TEXT ·Syscall(SB),NOSPLIT,$0-56
19 | BR syscall·Syscall(SB)
20 |
21 | TEXT ·Syscall6(SB),NOSPLIT,$0-80
22 | BR syscall·Syscall6(SB)
23 |
24 | TEXT ·RawSyscall(SB),NOSPLIT,$0-56
25 | BR syscall·RawSyscall(SB)
26 |
27 | TEXT ·RawSyscall6(SB),NOSPLIT,$0-80
28 | BR syscall·RawSyscall6(SB)
29 |
--------------------------------------------------------------------------------
/vendor/golang.org/x/sys/unix/asm_linux_arm.s:
--------------------------------------------------------------------------------
1 | // Copyright 2009 The Go Authors. All rights reserved.
2 | // Use of this source code is governed by a BSD-style
3 | // license that can be found in the LICENSE file.
4 |
5 | // +build !gccgo
6 |
7 | #include "textflag.h"
8 |
9 | //
10 | // System calls for arm, Linux
11 | //
12 |
13 | // Just jump to package syscall's implementation for all these functions.
14 | // The runtime may know about them.
15 |
16 | TEXT ·Syscall(SB),NOSPLIT,$0-28
17 | B syscall·Syscall(SB)
18 |
19 | TEXT ·Syscall6(SB),NOSPLIT,$0-40
20 | B syscall·Syscall6(SB)
21 |
22 | TEXT ·RawSyscall(SB),NOSPLIT,$0-28
23 | B syscall·RawSyscall(SB)
24 |
25 | TEXT ·RawSyscall6(SB),NOSPLIT,$0-40
26 | B syscall·RawSyscall6(SB)
27 |
28 | TEXT ·seek(SB),NOSPLIT,$0-32
29 | B syscall·seek(SB)
30 |
--------------------------------------------------------------------------------
/vendor/golang.org/x/sys/unix/asm_linux_mips64x.s:
--------------------------------------------------------------------------------
1 | // Copyright 2015 The Go Authors. All rights reserved.
2 | // Use of this source code is governed by a BSD-style
3 | // license that can be found in the LICENSE file.
4 |
5 | // +build linux
6 | // +build mips64 mips64le
7 | // +build !gccgo
8 |
9 | #include "textflag.h"
10 |
11 | //
12 | // System calls for mips64, Linux
13 | //
14 |
15 | // Just jump to package syscall's implementation for all these functions.
16 | // The runtime may know about them.
17 |
18 | TEXT ·Syscall(SB),NOSPLIT,$0-56
19 | JMP syscall·Syscall(SB)
20 |
21 | TEXT ·Syscall6(SB),NOSPLIT,$0-80
22 | JMP syscall·Syscall6(SB)
23 |
24 | TEXT ·RawSyscall(SB),NOSPLIT,$0-56
25 | JMP syscall·RawSyscall(SB)
26 |
27 | TEXT ·RawSyscall6(SB),NOSPLIT,$0-80
28 | JMP syscall·RawSyscall6(SB)
29 |
--------------------------------------------------------------------------------
/vendor/golang.org/x/sys/unix/flock.go:
--------------------------------------------------------------------------------
1 | // Copyright 2014 The Go Authors. All rights reserved.
2 | // Use of this source code is governed by a BSD-style
3 | // license that can be found in the LICENSE file.
4 |
5 | // +build darwin dragonfly freebsd linux netbsd openbsd
6 |
7 | package unix
8 |
9 | import "unsafe"
10 |
11 | // fcntl64Syscall is usually SYS_FCNTL, but is overridden on 32-bit Linux
12 | // systems by flock_linux_32bit.go to be SYS_FCNTL64.
13 | var fcntl64Syscall uintptr = SYS_FCNTL
14 |
15 | // FcntlFlock performs a fcntl syscall for the F_GETLK, F_SETLK or F_SETLKW command.
16 | func FcntlFlock(fd uintptr, cmd int, lk *Flock_t) error {
17 | _, _, errno := Syscall(fcntl64Syscall, fd, uintptr(cmd), uintptr(unsafe.Pointer(lk)))
18 | if errno == 0 {
19 | return nil
20 | }
21 | return errno
22 | }
23 |
--------------------------------------------------------------------------------
/caddyhttp/requestid/requestid.go:
--------------------------------------------------------------------------------
1 | package requestid
2 |
3 | import (
4 | "context"
5 | "log"
6 | "net/http"
7 |
8 | "github.com/WedgeServer/wedge/caddyhttp/httpserver"
9 | uuid "github.com/nu7hatch/gouuid"
10 | )
11 |
12 | // Handler is a middleware handler
13 | type Handler struct {
14 | Next httpserver.Handler
15 | }
16 |
17 | func (h Handler) ServeHTTP(w http.ResponseWriter, r *http.Request) (int, error) {
18 | reqid := UUID()
19 | c := context.WithValue(r.Context(), httpserver.RequestIDCtxKey, reqid)
20 | r = r.WithContext(c)
21 |
22 | return h.Next.ServeHTTP(w, r)
23 | }
24 |
25 | // UUID returns U4 UUID
26 | func UUID() string {
27 | u4, err := uuid.NewV4()
28 | if err != nil {
29 | log.Printf("[ERROR] generating request ID: %v", err)
30 | return ""
31 | }
32 |
33 | return u4.String()
34 | }
35 |
--------------------------------------------------------------------------------
/vendor/golang.org/x/sys/unix/asm_freebsd_arm.s:
--------------------------------------------------------------------------------
1 | // Copyright 2012 The Go Authors. All rights reserved.
2 | // Use of this source code is governed by a BSD-style
3 | // license that can be found in the LICENSE file.
4 |
5 | // +build !gccgo
6 |
7 | #include "textflag.h"
8 |
9 | //
10 | // System call support for ARM, FreeBSD
11 | //
12 |
13 | // Just jump to package syscall's implementation for all these functions.
14 | // The runtime may know about them.
15 |
16 | TEXT ·Syscall(SB),NOSPLIT,$0-28
17 | B syscall·Syscall(SB)
18 |
19 | TEXT ·Syscall6(SB),NOSPLIT,$0-40
20 | B syscall·Syscall6(SB)
21 |
22 | TEXT ·Syscall9(SB),NOSPLIT,$0-52
23 | B syscall·Syscall9(SB)
24 |
25 | TEXT ·RawSyscall(SB),NOSPLIT,$0-28
26 | B syscall·RawSyscall(SB)
27 |
28 | TEXT ·RawSyscall6(SB),NOSPLIT,$0-40
29 | B syscall·RawSyscall6(SB)
30 |
--------------------------------------------------------------------------------
/vendor/golang.org/x/sys/unix/asm_netbsd_arm.s:
--------------------------------------------------------------------------------
1 | // Copyright 2013 The Go Authors. All rights reserved.
2 | // Use of this source code is governed by a BSD-style
3 | // license that can be found in the LICENSE file.
4 |
5 | // +build !gccgo
6 |
7 | #include "textflag.h"
8 |
9 | //
10 | // System call support for ARM, NetBSD
11 | //
12 |
13 | // Just jump to package syscall's implementation for all these functions.
14 | // The runtime may know about them.
15 |
16 | TEXT ·Syscall(SB),NOSPLIT,$0-28
17 | B syscall·Syscall(SB)
18 |
19 | TEXT ·Syscall6(SB),NOSPLIT,$0-40
20 | B syscall·Syscall6(SB)
21 |
22 | TEXT ·Syscall9(SB),NOSPLIT,$0-52
23 | B syscall·Syscall9(SB)
24 |
25 | TEXT ·RawSyscall(SB),NOSPLIT,$0-28
26 | B syscall·RawSyscall(SB)
27 |
28 | TEXT ·RawSyscall6(SB),NOSPLIT,$0-40
29 | B syscall·RawSyscall6(SB)
30 |
--------------------------------------------------------------------------------
/vendor/github.com/lucas-clemente/aes12/cipher_generic.go:
--------------------------------------------------------------------------------
1 | // Copyright 2012 The Go Authors. All rights reserved.
2 | // Use of this source code is governed by a BSD-style
3 | // license that can be found in the LICENSE file.
4 |
5 | // +build !amd64,!s390x
6 |
7 | package aes12
8 |
9 | // newCipher calls the newCipherGeneric function
10 | // directly. Platforms with hardware accelerated
11 | // implementations of AES should implement their
12 | // own version of newCipher (which may then call
13 | // newCipherGeneric if needed).
14 | func newCipher(key []byte) (Block, error) {
15 | return newCipherGeneric(key)
16 | }
17 |
18 | // expandKey is used by BenchmarkExpand and should
19 | // call an assembly implementation if one is available.
20 | func expandKey(key []byte, enc, dec []uint32) {
21 | expandKeyGo(key, enc, dec)
22 | }
23 |
--------------------------------------------------------------------------------
/vendor/golang.org/x/sys/unix/asm_darwin_386.s:
--------------------------------------------------------------------------------
1 | // Copyright 2009 The Go Authors. All rights reserved.
2 | // Use of this source code is governed by a BSD-style
3 | // license that can be found in the LICENSE file.
4 |
5 | // +build !gccgo
6 |
7 | #include "textflag.h"
8 |
9 | //
10 | // System call support for 386, Darwin
11 | //
12 |
13 | // Just jump to package syscall's implementation for all these functions.
14 | // The runtime may know about them.
15 |
16 | TEXT ·Syscall(SB),NOSPLIT,$0-28
17 | JMP syscall·Syscall(SB)
18 |
19 | TEXT ·Syscall6(SB),NOSPLIT,$0-40
20 | JMP syscall·Syscall6(SB)
21 |
22 | TEXT ·Syscall9(SB),NOSPLIT,$0-52
23 | JMP syscall·Syscall9(SB)
24 |
25 | TEXT ·RawSyscall(SB),NOSPLIT,$0-28
26 | JMP syscall·RawSyscall(SB)
27 |
28 | TEXT ·RawSyscall6(SB),NOSPLIT,$0-40
29 | JMP syscall·RawSyscall6(SB)
30 |
--------------------------------------------------------------------------------
/vendor/golang.org/x/sys/unix/asm_freebsd_386.s:
--------------------------------------------------------------------------------
1 | // Copyright 2009 The Go Authors. All rights reserved.
2 | // Use of this source code is governed by a BSD-style
3 | // license that can be found in the LICENSE file.
4 |
5 | // +build !gccgo
6 |
7 | #include "textflag.h"
8 |
9 | //
10 | // System call support for 386, FreeBSD
11 | //
12 |
13 | // Just jump to package syscall's implementation for all these functions.
14 | // The runtime may know about them.
15 |
16 | TEXT ·Syscall(SB),NOSPLIT,$0-28
17 | JMP syscall·Syscall(SB)
18 |
19 | TEXT ·Syscall6(SB),NOSPLIT,$0-40
20 | JMP syscall·Syscall6(SB)
21 |
22 | TEXT ·Syscall9(SB),NOSPLIT,$0-52
23 | JMP syscall·Syscall9(SB)
24 |
25 | TEXT ·RawSyscall(SB),NOSPLIT,$0-28
26 | JMP syscall·RawSyscall(SB)
27 |
28 | TEXT ·RawSyscall6(SB),NOSPLIT,$0-40
29 | JMP syscall·RawSyscall6(SB)
30 |
--------------------------------------------------------------------------------
/vendor/golang.org/x/sys/unix/asm_netbsd_386.s:
--------------------------------------------------------------------------------
1 | // Copyright 2009 The Go Authors. All rights reserved.
2 | // Use of this source code is governed by a BSD-style
3 | // license that can be found in the LICENSE file.
4 |
5 | // +build !gccgo
6 |
7 | #include "textflag.h"
8 |
9 | //
10 | // System call support for 386, NetBSD
11 | //
12 |
13 | // Just jump to package syscall's implementation for all these functions.
14 | // The runtime may know about them.
15 |
16 | TEXT ·Syscall(SB),NOSPLIT,$0-28
17 | JMP syscall·Syscall(SB)
18 |
19 | TEXT ·Syscall6(SB),NOSPLIT,$0-40
20 | JMP syscall·Syscall6(SB)
21 |
22 | TEXT ·Syscall9(SB),NOSPLIT,$0-52
23 | JMP syscall·Syscall9(SB)
24 |
25 | TEXT ·RawSyscall(SB),NOSPLIT,$0-28
26 | JMP syscall·RawSyscall(SB)
27 |
28 | TEXT ·RawSyscall6(SB),NOSPLIT,$0-40
29 | JMP syscall·RawSyscall6(SB)
30 |
--------------------------------------------------------------------------------
/vendor/golang.org/x/sys/unix/asm_openbsd_386.s:
--------------------------------------------------------------------------------
1 | // Copyright 2009 The Go Authors. All rights reserved.
2 | // Use of this source code is governed by a BSD-style
3 | // license that can be found in the LICENSE file.
4 |
5 | // +build !gccgo
6 |
7 | #include "textflag.h"
8 |
9 | //
10 | // System call support for 386, OpenBSD
11 | //
12 |
13 | // Just jump to package syscall's implementation for all these functions.
14 | // The runtime may know about them.
15 |
16 | TEXT ·Syscall(SB),NOSPLIT,$0-28
17 | JMP syscall·Syscall(SB)
18 |
19 | TEXT ·Syscall6(SB),NOSPLIT,$0-40
20 | JMP syscall·Syscall6(SB)
21 |
22 | TEXT ·Syscall9(SB),NOSPLIT,$0-52
23 | JMP syscall·Syscall9(SB)
24 |
25 | TEXT ·RawSyscall(SB),NOSPLIT,$0-28
26 | JMP syscall·RawSyscall(SB)
27 |
28 | TEXT ·RawSyscall6(SB),NOSPLIT,$0-40
29 | JMP syscall·RawSyscall6(SB)
30 |
--------------------------------------------------------------------------------
/caddyhttp/requestid/requestid_test.go:
--------------------------------------------------------------------------------
1 | package requestid
2 |
3 | import (
4 | "context"
5 | "net/http"
6 | "testing"
7 |
8 | "github.com/WedgeServer/wedge/caddyhttp/httpserver"
9 | )
10 |
11 | func TestRequestID(t *testing.T) {
12 | request, err := http.NewRequest("GET", "http://localhost/", nil)
13 | if err != nil {
14 | t.Fatal("Could not create HTTP request:", err)
15 | }
16 |
17 | reqid := UUID()
18 |
19 | c := context.WithValue(request.Context(), httpserver.RequestIDCtxKey, reqid)
20 |
21 | request = request.WithContext(c)
22 |
23 | // See caddyhttp/replacer.go
24 | value, _ := request.Context().Value(httpserver.RequestIDCtxKey).(string)
25 |
26 | if value == "" {
27 | t.Fatal("Request ID should not be empty")
28 | }
29 |
30 | if value != reqid {
31 | t.Fatal("Request ID does not match")
32 | }
33 | }
34 |
--------------------------------------------------------------------------------
/vendor/github.com/lucas-clemente/quic-go/frames/ping_frame.go:
--------------------------------------------------------------------------------
1 | package frames
2 |
3 | import (
4 | "bytes"
5 |
6 | "github.com/lucas-clemente/quic-go/protocol"
7 | )
8 |
9 | // A PingFrame is a ping frame
10 | type PingFrame struct{}
11 |
12 | // ParsePingFrame parses a Ping frame
13 | func ParsePingFrame(r *bytes.Reader) (*PingFrame, error) {
14 | frame := &PingFrame{}
15 |
16 | _, err := r.ReadByte()
17 | if err != nil {
18 | return nil, err
19 | }
20 |
21 | return frame, nil
22 | }
23 |
24 | func (f *PingFrame) Write(b *bytes.Buffer, version protocol.VersionNumber) error {
25 | typeByte := uint8(0x07)
26 | b.WriteByte(typeByte)
27 | return nil
28 | }
29 |
30 | // MinLength of a written frame
31 | func (f *PingFrame) MinLength(version protocol.VersionNumber) (protocol.ByteCount, error) {
32 | return 1, nil
33 | }
34 |
--------------------------------------------------------------------------------
/vendor/golang.org/x/sys/unix/asm_darwin_amd64.s:
--------------------------------------------------------------------------------
1 | // Copyright 2009 The Go Authors. All rights reserved.
2 | // Use of this source code is governed by a BSD-style
3 | // license that can be found in the LICENSE file.
4 |
5 | // +build !gccgo
6 |
7 | #include "textflag.h"
8 |
9 | //
10 | // System call support for AMD64, Darwin
11 | //
12 |
13 | // Just jump to package syscall's implementation for all these functions.
14 | // The runtime may know about them.
15 |
16 | TEXT ·Syscall(SB),NOSPLIT,$0-56
17 | JMP syscall·Syscall(SB)
18 |
19 | TEXT ·Syscall6(SB),NOSPLIT,$0-80
20 | JMP syscall·Syscall6(SB)
21 |
22 | TEXT ·Syscall9(SB),NOSPLIT,$0-104
23 | JMP syscall·Syscall9(SB)
24 |
25 | TEXT ·RawSyscall(SB),NOSPLIT,$0-56
26 | JMP syscall·RawSyscall(SB)
27 |
28 | TEXT ·RawSyscall6(SB),NOSPLIT,$0-80
29 | JMP syscall·RawSyscall6(SB)
30 |
--------------------------------------------------------------------------------
/vendor/golang.org/x/sys/unix/asm_freebsd_amd64.s:
--------------------------------------------------------------------------------
1 | // Copyright 2009 The Go Authors. All rights reserved.
2 | // Use of this source code is governed by a BSD-style
3 | // license that can be found in the LICENSE file.
4 |
5 | // +build !gccgo
6 |
7 | #include "textflag.h"
8 |
9 | //
10 | // System call support for AMD64, FreeBSD
11 | //
12 |
13 | // Just jump to package syscall's implementation for all these functions.
14 | // The runtime may know about them.
15 |
16 | TEXT ·Syscall(SB),NOSPLIT,$0-56
17 | JMP syscall·Syscall(SB)
18 |
19 | TEXT ·Syscall6(SB),NOSPLIT,$0-80
20 | JMP syscall·Syscall6(SB)
21 |
22 | TEXT ·Syscall9(SB),NOSPLIT,$0-104
23 | JMP syscall·Syscall9(SB)
24 |
25 | TEXT ·RawSyscall(SB),NOSPLIT,$0-56
26 | JMP syscall·RawSyscall(SB)
27 |
28 | TEXT ·RawSyscall6(SB),NOSPLIT,$0-80
29 | JMP syscall·RawSyscall6(SB)
30 |
--------------------------------------------------------------------------------
/vendor/golang.org/x/sys/unix/asm_linux_amd64.s:
--------------------------------------------------------------------------------
1 | // Copyright 2009 The Go Authors. All rights reserved.
2 | // Use of this source code is governed by a BSD-style
3 | // license that can be found in the LICENSE file.
4 |
5 | // +build !gccgo
6 |
7 | #include "textflag.h"
8 |
9 | //
10 | // System calls for AMD64, Linux
11 | //
12 |
13 | // Just jump to package syscall's implementation for all these functions.
14 | // The runtime may know about them.
15 |
16 | TEXT ·Syscall(SB),NOSPLIT,$0-56
17 | JMP syscall·Syscall(SB)
18 |
19 | TEXT ·Syscall6(SB),NOSPLIT,$0-80
20 | JMP syscall·Syscall6(SB)
21 |
22 | TEXT ·RawSyscall(SB),NOSPLIT,$0-56
23 | JMP syscall·RawSyscall(SB)
24 |
25 | TEXT ·RawSyscall6(SB),NOSPLIT,$0-80
26 | JMP syscall·RawSyscall6(SB)
27 |
28 | TEXT ·gettimeofday(SB),NOSPLIT,$0-16
29 | JMP syscall·gettimeofday(SB)
30 |
--------------------------------------------------------------------------------
/vendor/golang.org/x/sys/unix/asm_netbsd_amd64.s:
--------------------------------------------------------------------------------
1 | // Copyright 2009 The Go Authors. All rights reserved.
2 | // Use of this source code is governed by a BSD-style
3 | // license that can be found in the LICENSE file.
4 |
5 | // +build !gccgo
6 |
7 | #include "textflag.h"
8 |
9 | //
10 | // System call support for AMD64, NetBSD
11 | //
12 |
13 | // Just jump to package syscall's implementation for all these functions.
14 | // The runtime may know about them.
15 |
16 | TEXT ·Syscall(SB),NOSPLIT,$0-56
17 | JMP syscall·Syscall(SB)
18 |
19 | TEXT ·Syscall6(SB),NOSPLIT,$0-80
20 | JMP syscall·Syscall6(SB)
21 |
22 | TEXT ·Syscall9(SB),NOSPLIT,$0-104
23 | JMP syscall·Syscall9(SB)
24 |
25 | TEXT ·RawSyscall(SB),NOSPLIT,$0-56
26 | JMP syscall·RawSyscall(SB)
27 |
28 | TEXT ·RawSyscall6(SB),NOSPLIT,$0-80
29 | JMP syscall·RawSyscall6(SB)
30 |
--------------------------------------------------------------------------------
/vendor/golang.org/x/sys/unix/asm_openbsd_amd64.s:
--------------------------------------------------------------------------------
1 | // Copyright 2009 The Go Authors. All rights reserved.
2 | // Use of this source code is governed by a BSD-style
3 | // license that can be found in the LICENSE file.
4 |
5 | // +build !gccgo
6 |
7 | #include "textflag.h"
8 |
9 | //
10 | // System call support for AMD64, OpenBSD
11 | //
12 |
13 | // Just jump to package syscall's implementation for all these functions.
14 | // The runtime may know about them.
15 |
16 | TEXT ·Syscall(SB),NOSPLIT,$0-56
17 | JMP syscall·Syscall(SB)
18 |
19 | TEXT ·Syscall6(SB),NOSPLIT,$0-80
20 | JMP syscall·Syscall6(SB)
21 |
22 | TEXT ·Syscall9(SB),NOSPLIT,$0-104
23 | JMP syscall·Syscall9(SB)
24 |
25 | TEXT ·RawSyscall(SB),NOSPLIT,$0-56
26 | JMP syscall·RawSyscall(SB)
27 |
28 | TEXT ·RawSyscall6(SB),NOSPLIT,$0-80
29 | JMP syscall·RawSyscall6(SB)
30 |
--------------------------------------------------------------------------------
/vendor/golang.org/x/sys/unix/asm_dragonfly_amd64.s:
--------------------------------------------------------------------------------
1 | // Copyright 2009 The Go Authors. All rights reserved.
2 | // Use of this source code is governed by a BSD-style
3 | // license that can be found in the LICENSE file.
4 |
5 | // +build !gccgo
6 |
7 | #include "textflag.h"
8 |
9 | //
10 | // System call support for AMD64, DragonFly
11 | //
12 |
13 | // Just jump to package syscall's implementation for all these functions.
14 | // The runtime may know about them.
15 |
16 | TEXT ·Syscall(SB),NOSPLIT,$0-64
17 | JMP syscall·Syscall(SB)
18 |
19 | TEXT ·Syscall6(SB),NOSPLIT,$0-88
20 | JMP syscall·Syscall6(SB)
21 |
22 | TEXT ·Syscall9(SB),NOSPLIT,$0-112
23 | JMP syscall·Syscall9(SB)
24 |
25 | TEXT ·RawSyscall(SB),NOSPLIT,$0-64
26 | JMP syscall·RawSyscall(SB)
27 |
28 | TEXT ·RawSyscall6(SB),NOSPLIT,$0-88
29 | JMP syscall·RawSyscall6(SB)
30 |
--------------------------------------------------------------------------------
/caddyhttp/proxy/setup.go:
--------------------------------------------------------------------------------
1 | package proxy
2 |
3 | import (
4 | "github.com/WedgeServer/wedge"
5 | "github.com/WedgeServer/wedge/caddyhttp/httpserver"
6 | )
7 |
8 | func init() {
9 | caddy.RegisterPlugin("proxy", caddy.Plugin{
10 | ServerType: "http",
11 | Action: setup,
12 | })
13 | }
14 |
15 | // setup configures a new Proxy middleware instance.
16 | func setup(c *caddy.Controller) error {
17 | upstreams, err := NewStaticUpstreams(c.Dispenser, httpserver.GetConfig(c).Host())
18 | if err != nil {
19 | return err
20 | }
21 | httpserver.GetConfig(c).AddMiddleware(func(next httpserver.Handler) httpserver.Handler {
22 | return Proxy{Next: next, Upstreams: upstreams}
23 | })
24 |
25 | // Register shutdown handlers.
26 | for _, upstream := range upstreams {
27 | c.OnShutdown(upstream.Stop)
28 | }
29 |
30 | return nil
31 | }
32 |
--------------------------------------------------------------------------------
/vendor/golang.org/x/sys/unix/asm_darwin_arm.s:
--------------------------------------------------------------------------------
1 | // Copyright 2015 The Go Authors. All rights reserved.
2 | // Use of this source code is governed by a BSD-style
3 | // license that can be found in the LICENSE file.
4 |
5 | // +build !gccgo
6 | // +build arm,darwin
7 |
8 | #include "textflag.h"
9 |
10 | //
11 | // System call support for ARM, Darwin
12 | //
13 |
14 | // Just jump to package syscall's implementation for all these functions.
15 | // The runtime may know about them.
16 |
17 | TEXT ·Syscall(SB),NOSPLIT,$0-28
18 | B syscall·Syscall(SB)
19 |
20 | TEXT ·Syscall6(SB),NOSPLIT,$0-40
21 | B syscall·Syscall6(SB)
22 |
23 | TEXT ·Syscall9(SB),NOSPLIT,$0-52
24 | B syscall·Syscall9(SB)
25 |
26 | TEXT ·RawSyscall(SB),NOSPLIT,$0-28
27 | B syscall·RawSyscall(SB)
28 |
29 | TEXT ·RawSyscall6(SB),NOSPLIT,$0-40
30 | B syscall·RawSyscall6(SB)
31 |
--------------------------------------------------------------------------------
/vendor/google.golang.org/appengine/internal/app_id.go:
--------------------------------------------------------------------------------
1 | // Copyright 2011 Google Inc. All rights reserved.
2 | // Use of this source code is governed by the Apache 2.0
3 | // license that can be found in the LICENSE file.
4 |
5 | package internal
6 |
7 | import (
8 | "strings"
9 | )
10 |
11 | func parseFullAppID(appid string) (partition, domain, displayID string) {
12 | if i := strings.Index(appid, "~"); i != -1 {
13 | partition, appid = appid[:i], appid[i+1:]
14 | }
15 | if i := strings.Index(appid, ":"); i != -1 {
16 | domain, appid = appid[:i], appid[i+1:]
17 | }
18 | return partition, domain, appid
19 | }
20 |
21 | // appID returns "appid" or "domain.com:appid".
22 | func appID(fullAppID string) string {
23 | _, dom, dis := parseFullAppID(fullAppID)
24 | if dom != "" {
25 | return dom + ":" + dis
26 | }
27 | return dis
28 | }
29 |
--------------------------------------------------------------------------------
/vendor/golang.org/x/sys/unix/bluetooth_linux.go:
--------------------------------------------------------------------------------
1 | // Copyright 2016 The Go Authors. All rights reserved.
2 | // Use of this source code is governed by a BSD-style
3 | // license that can be found in the LICENSE file.
4 |
5 | // Bluetooth sockets and messages
6 |
7 | package unix
8 |
9 | // Bluetooth Protocols
10 | const (
11 | BTPROTO_L2CAP = 0
12 | BTPROTO_HCI = 1
13 | BTPROTO_SCO = 2
14 | BTPROTO_RFCOMM = 3
15 | BTPROTO_BNEP = 4
16 | BTPROTO_CMTP = 5
17 | BTPROTO_HIDP = 6
18 | BTPROTO_AVDTP = 7
19 | )
20 |
21 | const (
22 | HCI_CHANNEL_RAW = 0
23 | HCI_CHANNEL_USER = 1
24 | HCI_CHANNEL_MONITOR = 2
25 | HCI_CHANNEL_CONTROL = 3
26 | )
27 |
28 | // Socketoption Level
29 | const (
30 | SOL_BLUETOOTH = 0x112
31 | SOL_HCI = 0x0
32 | SOL_L2CAP = 0x6
33 | SOL_RFCOMM = 0x12
34 | SOL_SCO = 0x11
35 | )
36 |
--------------------------------------------------------------------------------
/vendor/golang.org/x/sys/unix/asm_darwin_arm64.s:
--------------------------------------------------------------------------------
1 | // Copyright 2015 The Go Authors. All rights reserved.
2 | // Use of this source code is governed by a BSD-style
3 | // license that can be found in the LICENSE file.
4 |
5 | // +build !gccgo
6 | // +build arm64,darwin
7 |
8 | #include "textflag.h"
9 |
10 | //
11 | // System call support for AMD64, Darwin
12 | //
13 |
14 | // Just jump to package syscall's implementation for all these functions.
15 | // The runtime may know about them.
16 |
17 | TEXT ·Syscall(SB),NOSPLIT,$0-56
18 | B syscall·Syscall(SB)
19 |
20 | TEXT ·Syscall6(SB),NOSPLIT,$0-80
21 | B syscall·Syscall6(SB)
22 |
23 | TEXT ·Syscall9(SB),NOSPLIT,$0-104
24 | B syscall·Syscall9(SB)
25 |
26 | TEXT ·RawSyscall(SB),NOSPLIT,$0-56
27 | B syscall·RawSyscall(SB)
28 |
29 | TEXT ·RawSyscall6(SB),NOSPLIT,$0-80
30 | B syscall·RawSyscall6(SB)
31 |
--------------------------------------------------------------------------------
/vendor/golang.org/x/net/websocket/exampledial_test.go:
--------------------------------------------------------------------------------
1 | // Copyright 2012 The Go Authors. All rights reserved.
2 | // Use of this source code is governed by a BSD-style
3 | // license that can be found in the LICENSE file.
4 |
5 | package websocket_test
6 |
7 | import (
8 | "fmt"
9 | "log"
10 |
11 | "golang.org/x/net/websocket"
12 | )
13 |
14 | // This example demonstrates a trivial client.
15 | func ExampleDial() {
16 | origin := "http://localhost/"
17 | url := "ws://localhost:12345/ws"
18 | ws, err := websocket.Dial(url, "", origin)
19 | if err != nil {
20 | log.Fatal(err)
21 | }
22 | if _, err := ws.Write([]byte("hello, world!\n")); err != nil {
23 | log.Fatal(err)
24 | }
25 | var msg = make([]byte, 512)
26 | var n int
27 | if n, err = ws.Read(msg); err != nil {
28 | log.Fatal(err)
29 | }
30 | fmt.Printf("Received: %s.\n", msg[:n])
31 | }
32 |
--------------------------------------------------------------------------------
/vendor/golang.org/x/sys/unix/asm_linux_mipsx.s:
--------------------------------------------------------------------------------
1 | // Copyright 2016 The Go Authors. All rights reserved.
2 | // Use of this source code is governed by a BSD-style
3 | // license that can be found in the LICENSE file.
4 |
5 | // +build linux
6 | // +build mips mipsle
7 | // +build !gccgo
8 |
9 | #include "textflag.h"
10 |
11 | //
12 | // System calls for mips, Linux
13 | //
14 |
15 | // Just jump to package syscall's implementation for all these functions.
16 | // The runtime may know about them.
17 |
18 | TEXT ·Syscall(SB),NOSPLIT,$0-28
19 | JMP syscall·Syscall(SB)
20 |
21 | TEXT ·Syscall6(SB),NOSPLIT,$0-40
22 | JMP syscall·Syscall6(SB)
23 |
24 | TEXT ·Syscall9(SB),NOSPLIT,$0-52
25 | JMP syscall·Syscall9(SB)
26 |
27 | TEXT ·RawSyscall(SB),NOSPLIT,$0-28
28 | JMP syscall·RawSyscall(SB)
29 |
30 | TEXT ·RawSyscall6(SB),NOSPLIT,$0-40
31 | JMP syscall·RawSyscall6(SB)
32 |
--------------------------------------------------------------------------------
/vendor/github.com/lucas-clemente/quic-go/protocol/encryption_level.go:
--------------------------------------------------------------------------------
1 | package protocol
2 |
3 | // EncryptionLevel is the encryption level
4 | // Default value is Unencrypted
5 | type EncryptionLevel int
6 |
7 | const (
8 | // EncryptionUnspecified is a not specified encryption level
9 | EncryptionUnspecified EncryptionLevel = iota
10 | // EncryptionUnencrypted is not encrypted
11 | EncryptionUnencrypted
12 | // EncryptionSecure is encrypted, but not forward secure
13 | EncryptionSecure
14 | // EncryptionForwardSecure is forward secure
15 | EncryptionForwardSecure
16 | )
17 |
18 | func (e EncryptionLevel) String() string {
19 | switch e {
20 | case EncryptionUnencrypted:
21 | return "unencrypted"
22 | case EncryptionSecure:
23 | return "encrypted (not forward-secure)"
24 | case EncryptionForwardSecure:
25 | return "forward-secure"
26 | }
27 | return "unknown"
28 | }
29 |
--------------------------------------------------------------------------------
/caddyhttp/proxy/body.go:
--------------------------------------------------------------------------------
1 | package proxy
2 |
3 | import (
4 | "bytes"
5 | "io"
6 | "io/ioutil"
7 | )
8 |
9 | type bufferedBody struct {
10 | *bytes.Reader
11 | }
12 |
13 | func (*bufferedBody) Close() error {
14 | return nil
15 | }
16 |
17 | // rewind allows bufferedBody to be read again.
18 | func (b *bufferedBody) rewind() error {
19 | if b == nil {
20 | return nil
21 | }
22 | _, err := b.Seek(0, io.SeekStart)
23 | return err
24 | }
25 |
26 | // newBufferedBody returns *bufferedBody to use in place of src. Closes src
27 | // and returns Read error on src. All content from src is buffered.
28 | func newBufferedBody(src io.ReadCloser) (*bufferedBody, error) {
29 | if src == nil {
30 | return nil, nil
31 | }
32 | b, err := ioutil.ReadAll(src)
33 | src.Close()
34 | if err != nil {
35 | return nil, err
36 | }
37 | return &bufferedBody{
38 | Reader: bytes.NewReader(b),
39 | }, nil
40 | }
41 |
--------------------------------------------------------------------------------
/vendor/google.golang.org/appengine/namespace.go:
--------------------------------------------------------------------------------
1 | // Copyright 2012 Google Inc. All rights reserved.
2 | // Use of this source code is governed by the Apache 2.0
3 | // license that can be found in the LICENSE file.
4 |
5 | package appengine
6 |
7 | import (
8 | "fmt"
9 | "regexp"
10 |
11 | "golang.org/x/net/context"
12 |
13 | "google.golang.org/appengine/internal"
14 | )
15 |
16 | // Namespace returns a replacement context that operates within the given namespace.
17 | func Namespace(c context.Context, namespace string) (context.Context, error) {
18 | if !validNamespace.MatchString(namespace) {
19 | return nil, fmt.Errorf("appengine: namespace %q does not match /%s/", namespace, validNamespace)
20 | }
21 | return internal.NamespacedContext(c, namespace), nil
22 | }
23 |
24 | // validNamespace matches valid namespace names.
25 | var validNamespace = regexp.MustCompile(`^[0-9A-Za-z._-]{0,100}$`)
26 |
--------------------------------------------------------------------------------
/caddyhttp/pprof/setup.go:
--------------------------------------------------------------------------------
1 | package pprof
2 |
3 | import (
4 | "github.com/WedgeServer/wedge"
5 | "github.com/WedgeServer/wedge/caddyhttp/httpserver"
6 | )
7 |
8 | func init() {
9 | caddy.RegisterPlugin("pprof", caddy.Plugin{
10 | ServerType: "http",
11 | Action: setup,
12 | })
13 | }
14 |
15 | // setup returns a new instance of a pprof handler. It accepts no arguments or options.
16 | func setup(c *caddy.Controller) error {
17 | found := false
18 |
19 | for c.Next() {
20 | if found {
21 | return c.Err("pprof can only be specified once")
22 | }
23 | if len(c.RemainingArgs()) != 0 {
24 | return c.ArgErr()
25 | }
26 | if c.NextBlock() {
27 | return c.ArgErr()
28 | }
29 | found = true
30 | }
31 |
32 | httpserver.GetConfig(c).AddMiddleware(func(next httpserver.Handler) httpserver.Handler {
33 | return &Handler{Next: next, Mux: NewMux()}
34 | })
35 |
36 | return nil
37 | }
38 |
--------------------------------------------------------------------------------
/vendor/github.com/lucas-clemente/quic-go/ackhandler/packet.go:
--------------------------------------------------------------------------------
1 | package ackhandler
2 |
3 | import (
4 | "time"
5 |
6 | "github.com/lucas-clemente/quic-go/frames"
7 | "github.com/lucas-clemente/quic-go/protocol"
8 | )
9 |
10 | // A Packet is a packet
11 | // +gen linkedlist
12 | type Packet struct {
13 | PacketNumber protocol.PacketNumber
14 | Frames []frames.Frame
15 | Length protocol.ByteCount
16 | EncryptionLevel protocol.EncryptionLevel
17 |
18 | SendTime time.Time
19 | }
20 |
21 | // GetFramesForRetransmission gets all the frames for retransmission
22 | func (p *Packet) GetFramesForRetransmission() []frames.Frame {
23 | var fs []frames.Frame
24 | for _, frame := range p.Frames {
25 | switch frame.(type) {
26 | case *frames.AckFrame:
27 | continue
28 | case *frames.StopWaitingFrame:
29 | continue
30 | }
31 | fs = append(fs, frame)
32 | }
33 | return fs
34 | }
35 |
--------------------------------------------------------------------------------
/vendor/github.com/lucas-clemente/quic-go/h2quic/gzipreader.go:
--------------------------------------------------------------------------------
1 | package h2quic
2 |
3 | // copied from net/transport.go
4 |
5 | // gzipReader wraps a response body so it can lazily
6 | // call gzip.NewReader on the first call to Read
7 | import (
8 | "compress/gzip"
9 | "io"
10 | )
11 |
12 | // call gzip.NewReader on the first call to Read
13 | type gzipReader struct {
14 | body io.ReadCloser // underlying Response.Body
15 | zr *gzip.Reader // lazily-initialized gzip reader
16 | zerr error // sticky error
17 | }
18 |
19 | func (gz *gzipReader) Read(p []byte) (n int, err error) {
20 | if gz.zerr != nil {
21 | return 0, gz.zerr
22 | }
23 | if gz.zr == nil {
24 | gz.zr, err = gzip.NewReader(gz.body)
25 | if err != nil {
26 | gz.zerr = err
27 | return 0, err
28 | }
29 | }
30 | return gz.zr.Read(p)
31 | }
32 |
33 | func (gz *gzipReader) Close() error {
34 | return gz.body.Close()
35 | }
36 |
--------------------------------------------------------------------------------
/vendor/github.com/miekg/dns/udp_windows.go:
--------------------------------------------------------------------------------
1 | // +build windows
2 |
3 | package dns
4 |
5 | import "net"
6 |
7 | type SessionUDP struct {
8 | raddr *net.UDPAddr
9 | }
10 |
11 | func (s *SessionUDP) RemoteAddr() net.Addr { return s.raddr }
12 |
13 | // ReadFromSessionUDP acts just like net.UDPConn.ReadFrom(), but returns a session object instead of a
14 | // net.UDPAddr.
15 | func ReadFromSessionUDP(conn *net.UDPConn, b []byte) (int, *SessionUDP, error) {
16 | n, raddr, err := conn.ReadFrom(b)
17 | if err != nil {
18 | return n, nil, err
19 | }
20 | session := &SessionUDP{raddr.(*net.UDPAddr)}
21 | return n, session, err
22 | }
23 |
24 | // WriteToSessionUDP acts just like net.UDPConn.WritetTo(), but uses a *SessionUDP instead of a net.Addr.
25 | func WriteToSessionUDP(conn *net.UDPConn, b []byte, session *SessionUDP) (int, error) {
26 | n, err := conn.WriteTo(b, session.raddr)
27 | return n, err
28 | }
29 |
30 |
--------------------------------------------------------------------------------
/vendor/golang.org/x/oauth2/mediamath/mediamath.go:
--------------------------------------------------------------------------------
1 | // Copyright 2016 The Go Authors. All rights reserved.
2 | // Use of this source code is governed by a BSD-style
3 | // license that can be found in the LICENSE file.
4 |
5 | // Package mediamath provides constants for using OAuth2 to access MediaMath.
6 | package mediamath // import "golang.org/x/oauth2/mediamath"
7 |
8 | import (
9 | "golang.org/x/oauth2"
10 | )
11 |
12 | // Endpoint is MediaMath's OAuth 2.0 endpoint for production.
13 | var Endpoint = oauth2.Endpoint{
14 | AuthURL: "https://api.mediamath.com/oauth2/v1.0/authorize",
15 | TokenURL: "https://api.mediamath.com/oauth2/v1.0/token",
16 | }
17 |
18 | // SandboxEndpoint is MediaMath's OAuth 2.0 endpoint for sandbox.
19 | var SandboxEndpoint = oauth2.Endpoint{
20 | AuthURL: "https://t1sandbox.mediamath.com/oauth2/v1.0/authorize",
21 | TokenURL: "https://t1sandbox.mediamath.com/oauth2/v1.0/token",
22 | }
23 |
--------------------------------------------------------------------------------
/.gitattributes:
--------------------------------------------------------------------------------
1 | # shell scripts should not use tabs to indent!
2 | *.bash text eol=lf core.whitespace whitespace=tab-in-indent,trailing-space,tabwidth=2
3 | *.sh text eol=lf core.whitespace whitespace=tab-in-indent,trailing-space,tabwidth=2
4 |
5 | # files for systemd (shell-similar)
6 | *.path text eol=lf core.whitespace whitespace=tab-in-indent,trailing-space,tabwidth=2
7 | *.service text eol=lf core.whitespace whitespace=tab-in-indent,trailing-space,tabwidth=2
8 | *.timer text eol=lf core.whitespace whitespace=tab-in-indent,trailing-space,tabwidth=2
9 |
10 | # go fmt will enforce this, but in case a user has not called "go fmt" allow GIT to catch this:
11 | *.go text eol=lf core.whitespace whitespace=indent-with-non-tab,trailing-space,tabwidth=4
12 |
13 | *.yml text eol=lf core.whitespace whitespace=tab-in-indent,trailing-space,tabwidth=2
14 | .git* text eol=auto core.whitespace whitespace=trailing-space
15 |
--------------------------------------------------------------------------------
/caddyhttp/mime/mime.go:
--------------------------------------------------------------------------------
1 | package mime
2 |
3 | import (
4 | "net/http"
5 | "path"
6 |
7 | "github.com/WedgeServer/wedge/caddyhttp/httpserver"
8 | )
9 |
10 | // Config represent a mime config. Map from extension to mime-type.
11 | // Note, this should be safe with concurrent read access, as this is
12 | // not modified concurrently.
13 | type Config map[string]string
14 |
15 | // Mime sets Content-Type header of requests based on configurations.
16 | type Mime struct {
17 | Next httpserver.Handler
18 | Configs Config
19 | }
20 |
21 | // ServeHTTP implements the httpserver.Handler interface.
22 | func (e Mime) ServeHTTP(w http.ResponseWriter, r *http.Request) (int, error) {
23 | // Get a clean /-path, grab the extension
24 | ext := path.Ext(path.Clean(r.URL.Path))
25 |
26 | if contentType, ok := e.Configs[ext]; ok {
27 | w.Header().Set("Content-Type", contentType)
28 | }
29 |
30 | return e.Next.ServeHTTP(w, r)
31 | }
32 |
--------------------------------------------------------------------------------
/assets.go:
--------------------------------------------------------------------------------
1 | package caddy
2 |
3 | import (
4 | "os"
5 | "path/filepath"
6 | "runtime"
7 | )
8 |
9 | // AssetsPath returns the path to the folder
10 | // where the application may store data. If
11 | // CADDYPATH env variable is set, that value
12 | // is used. Otherwise, the path is the result
13 | // of evaluating "$HOME/.caddy".
14 | func AssetsPath() string {
15 | if caddyPath := os.Getenv("CADDYPATH"); caddyPath != "" {
16 | return caddyPath
17 | }
18 | return filepath.Join(userHomeDir(), ".caddy")
19 | }
20 |
21 | // userHomeDir returns the user's home directory according to
22 | // environment variables.
23 | //
24 | // Credit: http://stackoverflow.com/a/7922977/1048862
25 | func userHomeDir() string {
26 | if runtime.GOOS == "windows" {
27 | home := os.Getenv("HOMEDRIVE") + os.Getenv("HOMEPATH")
28 | if home == "" {
29 | home = os.Getenv("USERPROFILE")
30 | }
31 | return home
32 | }
33 | return os.Getenv("HOME")
34 | }
35 |
--------------------------------------------------------------------------------
/vendor/gopkg.in/alecthomas/kingpin.v2/guesswidth_unix.go:
--------------------------------------------------------------------------------
1 | // +build !appengine,linux freebsd darwin dragonfly netbsd openbsd
2 |
3 | package kingpin
4 |
5 | import (
6 | "io"
7 | "os"
8 | "strconv"
9 | "syscall"
10 | "unsafe"
11 | )
12 |
13 | func guessWidth(w io.Writer) int {
14 | // check if COLUMNS env is set to comply with
15 | // http://pubs.opengroup.org/onlinepubs/009604499/basedefs/xbd_chap08.html
16 | colsStr := os.Getenv("COLUMNS")
17 | if colsStr != "" {
18 | if cols, err := strconv.Atoi(colsStr); err == nil {
19 | return cols
20 | }
21 | }
22 |
23 | if t, ok := w.(*os.File); ok {
24 | fd := t.Fd()
25 | var dimensions [4]uint16
26 |
27 | if _, _, err := syscall.Syscall6(
28 | syscall.SYS_IOCTL,
29 | uintptr(fd),
30 | uintptr(syscall.TIOCGWINSZ),
31 | uintptr(unsafe.Pointer(&dimensions)),
32 | 0, 0, 0,
33 | ); err == 0 {
34 | return int(dimensions[1])
35 | }
36 | }
37 | return 80
38 | }
39 |
--------------------------------------------------------------------------------
/vendor/github.com/dustin/go-humanize/commaf.go:
--------------------------------------------------------------------------------
1 | // +build go1.6
2 |
3 | package humanize
4 |
5 | import (
6 | "bytes"
7 | "math/big"
8 | "strings"
9 | )
10 |
11 | // BigCommaf produces a string form of the given big.Float in base 10
12 | // with commas after every three orders of magnitude.
13 | func BigCommaf(v *big.Float) string {
14 | buf := &bytes.Buffer{}
15 | if v.Sign() < 0 {
16 | buf.Write([]byte{'-'})
17 | v.Abs(v)
18 | }
19 |
20 | comma := []byte{','}
21 |
22 | parts := strings.Split(v.Text('f', -1), ".")
23 | pos := 0
24 | if len(parts[0])%3 != 0 {
25 | pos += len(parts[0]) % 3
26 | buf.WriteString(parts[0][:pos])
27 | buf.Write(comma)
28 | }
29 | for ; pos < len(parts[0]); pos += 3 {
30 | buf.WriteString(parts[0][pos : pos+3])
31 | buf.Write(comma)
32 | }
33 | buf.Truncate(buf.Len() - 1)
34 |
35 | if len(parts) > 1 {
36 | buf.Write([]byte{'.'})
37 | buf.WriteString(parts[1])
38 | }
39 | return buf.String()
40 | }
41 |
--------------------------------------------------------------------------------
/vendor/github.com/xenolf/lego/acme/challenges.go:
--------------------------------------------------------------------------------
1 | package acme
2 |
3 | // Challenge is a string that identifies a particular type and version of ACME challenge.
4 | type Challenge string
5 |
6 | const (
7 | // HTTP01 is the "http-01" ACME challenge https://github.com/ietf-wg-acme/acme/blob/master/draft-ietf-acme-acme.md#http
8 | // Note: HTTP01ChallengePath returns the URL path to fulfill this challenge
9 | HTTP01 = Challenge("http-01")
10 | // TLSSNI01 is the "tls-sni-01" ACME challenge https://github.com/ietf-wg-acme/acme/blob/master/draft-ietf-acme-acme.md#tls-with-server-name-indication-tls-sni
11 | // Note: TLSSNI01ChallengeCert returns a certificate to fulfill this challenge
12 | TLSSNI01 = Challenge("tls-sni-01")
13 | // DNS01 is the "dns-01" ACME challenge https://github.com/ietf-wg-acme/acme/blob/master/draft-ietf-acme-acme.md#dns
14 | // Note: DNS01Record returns a DNS record which will fulfill this challenge
15 | DNS01 = Challenge("dns-01")
16 | )
17 |
--------------------------------------------------------------------------------
/vendor/github.com/aead/chacha20/chacha/chacha_ref.go:
--------------------------------------------------------------------------------
1 | // Copyright (c) 2016 Andreas Auernhammer. All rights reserved.
2 | // Use of this source code is governed by a license that can be
3 | // found in the LICENSE file.
4 |
5 | // +build !amd64,!386 gccgo appengine nacl
6 |
7 | package chacha
8 |
9 | import "encoding/binary"
10 |
11 | func initialize(state *[64]byte, key []byte, nonce *[16]byte) {
12 | binary.LittleEndian.PutUint32(state[0:], sigma[0])
13 | binary.LittleEndian.PutUint32(state[4:], sigma[1])
14 | binary.LittleEndian.PutUint32(state[8:], sigma[2])
15 | binary.LittleEndian.PutUint32(state[12:], sigma[3])
16 | copy(state[16:], key[:])
17 | copy(state[48:], nonce[:])
18 | }
19 |
20 | func xorKeyStream(dst, src []byte, block, state *[64]byte, rounds int) int {
21 | return xorKeyStreamGeneric(dst, src, block, state, rounds)
22 | }
23 |
24 | func hChaCha20(out *[32]byte, nonce *[16]byte, key *[32]byte) {
25 | hChaCha20Generic(out, nonce, key)
26 | }
27 |
--------------------------------------------------------------------------------
/vendor/golang.org/x/sys/unix/asm_linux_386.s:
--------------------------------------------------------------------------------
1 | // Copyright 2009 The Go Authors. All rights reserved.
2 | // Use of this source code is governed by a BSD-style
3 | // license that can be found in the LICENSE file.
4 |
5 | // +build !gccgo
6 |
7 | #include "textflag.h"
8 |
9 | //
10 | // System calls for 386, Linux
11 | //
12 |
13 | // Just jump to package syscall's implementation for all these functions.
14 | // The runtime may know about them.
15 |
16 | TEXT ·Syscall(SB),NOSPLIT,$0-28
17 | JMP syscall·Syscall(SB)
18 |
19 | TEXT ·Syscall6(SB),NOSPLIT,$0-40
20 | JMP syscall·Syscall6(SB)
21 |
22 | TEXT ·RawSyscall(SB),NOSPLIT,$0-28
23 | JMP syscall·RawSyscall(SB)
24 |
25 | TEXT ·RawSyscall6(SB),NOSPLIT,$0-40
26 | JMP syscall·RawSyscall6(SB)
27 |
28 | TEXT ·socketcall(SB),NOSPLIT,$0-36
29 | JMP syscall·socketcall(SB)
30 |
31 | TEXT ·rawsocketcall(SB),NOSPLIT,$0-36
32 | JMP syscall·rawsocketcall(SB)
33 |
34 | TEXT ·seek(SB),NOSPLIT,$0-28
35 | JMP syscall·seek(SB)
36 |
--------------------------------------------------------------------------------
/caddyhttp/internalsrv/setup.go:
--------------------------------------------------------------------------------
1 | package internalsrv
2 |
3 | import (
4 | "github.com/WedgeServer/wedge"
5 | "github.com/WedgeServer/wedge/caddyhttp/httpserver"
6 | )
7 |
8 | func init() {
9 | caddy.RegisterPlugin("internal", caddy.Plugin{
10 | ServerType: "http",
11 | Action: setup,
12 | })
13 | }
14 |
15 | // Internal configures a new Internal middleware instance.
16 | func setup(c *caddy.Controller) error {
17 | paths, err := internalParse(c)
18 | if err != nil {
19 | return err
20 | }
21 |
22 | httpserver.GetConfig(c).AddMiddleware(func(next httpserver.Handler) httpserver.Handler {
23 | return Internal{Next: next, Paths: paths}
24 | })
25 |
26 | return nil
27 | }
28 |
29 | func internalParse(c *caddy.Controller) ([]string, error) {
30 | var paths []string
31 |
32 | for c.Next() {
33 | if c.NextArg() {
34 | paths = append(paths, c.Val())
35 | }
36 | if c.NextArg() {
37 | return nil, c.ArgErr()
38 | }
39 | }
40 |
41 | return paths, nil
42 | }
43 |
--------------------------------------------------------------------------------
/vendor/github.com/lucas-clemente/quic-go/integrationtests/tools/testlog/testlog.go:
--------------------------------------------------------------------------------
1 | package testlog
2 |
3 | import (
4 | "flag"
5 | "log"
6 | "os"
7 |
8 | "github.com/lucas-clemente/quic-go/internal/utils"
9 |
10 | . "github.com/onsi/ginkgo"
11 | . "github.com/onsi/gomega"
12 | )
13 |
14 | var (
15 | logFileName string // the log file set in the ginkgo flags
16 | logFile *os.File
17 | )
18 |
19 | // read the logfile command line flag
20 | // to set call ginkgo -- -logfile=log.txt
21 | func init() {
22 | flag.StringVar(&logFileName, "logfile", "", "log file")
23 | }
24 |
25 | var _ = BeforeEach(func() {
26 | log.SetFlags(log.Ldate | log.Ltime | log.Lmicroseconds)
27 |
28 | if len(logFileName) > 0 {
29 | var err error
30 | logFile, err = os.Create("./log.txt")
31 | Expect(err).ToNot(HaveOccurred())
32 | log.SetOutput(logFile)
33 | utils.SetLogLevel(utils.LogLevelDebug)
34 | }
35 | })
36 |
37 | var _ = AfterEach(func() {
38 | if len(logFileName) > 0 {
39 | _ = logFile.Close()
40 | }
41 | })
42 |
--------------------------------------------------------------------------------
/vendor/golang.org/x/oauth2/paypal/paypal.go:
--------------------------------------------------------------------------------
1 | // Copyright 2015 The Go Authors. All rights reserved.
2 | // Use of this source code is governed by a BSD-style
3 | // license that can be found in the LICENSE file.
4 |
5 | // Package paypal provides constants for using OAuth2 to access PayPal.
6 | package paypal // import "golang.org/x/oauth2/paypal"
7 |
8 | import (
9 | "golang.org/x/oauth2"
10 | )
11 |
12 | // Endpoint is PayPal's OAuth 2.0 endpoint in live (production) environment.
13 | var Endpoint = oauth2.Endpoint{
14 | AuthURL: "https://www.paypal.com/webapps/auth/protocol/openidconnect/v1/authorize",
15 | TokenURL: "https://api.paypal.com/v1/identity/openidconnect/tokenservice",
16 | }
17 |
18 | // SandboxEndpoint is PayPal's OAuth 2.0 endpoint in sandbox (testing) environment.
19 | var SandboxEndpoint = oauth2.Endpoint{
20 | AuthURL: "https://www.sandbox.paypal.com/webapps/auth/protocol/openidconnect/v1/authorize",
21 | TokenURL: "https://api.sandbox.paypal.com/v1/identity/openidconnect/tokenservice",
22 | }
23 |
--------------------------------------------------------------------------------
/vendor/github.com/miekg/dns/scanner.go:
--------------------------------------------------------------------------------
1 | package dns
2 |
3 | // Implement a simple scanner, return a byte stream from an io reader.
4 |
5 | import (
6 | "bufio"
7 | "io"
8 | "text/scanner"
9 | )
10 |
11 | type scan struct {
12 | src *bufio.Reader
13 | position scanner.Position
14 | eof bool // Have we just seen a eof
15 | }
16 |
17 | func scanInit(r io.Reader) *scan {
18 | s := new(scan)
19 | s.src = bufio.NewReader(r)
20 | s.position.Line = 1
21 | return s
22 | }
23 |
24 | // tokenText returns the next byte from the input
25 | func (s *scan) tokenText() (byte, error) {
26 | c, err := s.src.ReadByte()
27 | if err != nil {
28 | return c, err
29 | }
30 | // delay the newline handling until the next token is delivered,
31 | // fixes off-by-one errors when reporting a parse error.
32 | if s.eof == true {
33 | s.position.Line++
34 | s.position.Column = 0
35 | s.eof = false
36 | }
37 | if c == '\n' {
38 | s.eof = true
39 | return c, nil
40 | }
41 | s.position.Column++
42 | return c, nil
43 | }
44 |
--------------------------------------------------------------------------------
/vendor/golang.org/x/sys/unix/syscall_solaris_amd64.go:
--------------------------------------------------------------------------------
1 | // Copyright 2009 The Go Authors. All rights reserved.
2 | // Use of this source code is governed by a BSD-style
3 | // license that can be found in the LICENSE file.
4 |
5 | // +build amd64,solaris
6 |
7 | package unix
8 |
9 | func TimespecToNsec(ts Timespec) int64 { return int64(ts.Sec)*1e9 + int64(ts.Nsec) }
10 |
11 | func NsecToTimespec(nsec int64) (ts Timespec) {
12 | ts.Sec = nsec / 1e9
13 | ts.Nsec = nsec % 1e9
14 | return
15 | }
16 |
17 | func NsecToTimeval(nsec int64) (tv Timeval) {
18 | nsec += 999 // round up to microsecond
19 | tv.Usec = nsec % 1e9 / 1e3
20 | tv.Sec = int64(nsec / 1e9)
21 | return
22 | }
23 |
24 | func (iov *Iovec) SetLen(length int) {
25 | iov.Len = uint64(length)
26 | }
27 |
28 | func (cmsg *Cmsghdr) SetLen(length int) {
29 | cmsg.Len = uint32(length)
30 | }
31 |
32 | func sendfile(outfd int, infd int, offset *int64, count int) (written int, err error) {
33 | // TODO(aram): implement this, see issue 5847.
34 | panic("unimplemented")
35 | }
36 |
--------------------------------------------------------------------------------
/.github/ISSUE_TEMPLATE.md:
--------------------------------------------------------------------------------
1 | ### 1. What version of Wedge are you using (`wedge -version`)?
2 |
3 |
4 | ### 2. What are you trying to do?
5 |
6 |
7 | ### 3. What is your entire Wedgefile?
8 | ```text
9 | (paste Wedgefile here)
10 | ```
11 |
12 | ### 4. How did you run Wedge (give the full command and describe the execution environment)?
13 |
14 |
15 | ### 5. Please paste any relevant HTTP request(s) here.
16 |
17 |
18 |
19 |
20 | ### 6. What did you expect to see?
21 |
22 |
23 | ### 7. What did you see instead (give full error messages and/or log)?
24 |
25 |
26 | ### 8. How can someone who is starting from scratch reproduce the bug as minimally as possible?
27 |
28 |
29 |
--------------------------------------------------------------------------------
/vendor/google.golang.org/appengine/file/file.go:
--------------------------------------------------------------------------------
1 | // Copyright 2014 Google Inc. All rights reserved.
2 | // Use of this source code is governed by the Apache 2.0
3 | // license that can be found in the LICENSE file.
4 |
5 | // Package file provides helper functions for using Google Cloud Storage.
6 | package file
7 |
8 | import (
9 | "fmt"
10 |
11 | "golang.org/x/net/context"
12 |
13 | "google.golang.org/appengine/internal"
14 | aipb "google.golang.org/appengine/internal/app_identity"
15 | )
16 |
17 | // DefaultBucketName returns the name of this application's
18 | // default Google Cloud Storage bucket.
19 | func DefaultBucketName(c context.Context) (string, error) {
20 | req := &aipb.GetDefaultGcsBucketNameRequest{}
21 | res := &aipb.GetDefaultGcsBucketNameResponse{}
22 |
23 | err := internal.Call(c, "app_identity_service", "GetDefaultGcsBucketName", req, res)
24 | if err != nil {
25 | return "", fmt.Errorf("file: no default bucket name returned in RPC response: %v", res)
26 | }
27 | return res.GetDefaultGcsBucketName(), nil
28 | }
29 |
--------------------------------------------------------------------------------
/vendor/github.com/gorilla/websocket/examples/chat/main.go:
--------------------------------------------------------------------------------
1 | // Copyright 2013 The Gorilla WebSocket Authors. All rights reserved.
2 | // Use of this source code is governed by a BSD-style
3 | // license that can be found in the LICENSE file.
4 |
5 | package main
6 |
7 | import (
8 | "flag"
9 | "log"
10 | "net/http"
11 | )
12 |
13 | var addr = flag.String("addr", ":8080", "http service address")
14 |
15 | func serveHome(w http.ResponseWriter, r *http.Request) {
16 | log.Println(r.URL)
17 | if r.URL.Path != "/" {
18 | http.Error(w, "Not found", 404)
19 | return
20 | }
21 | if r.Method != "GET" {
22 | http.Error(w, "Method not allowed", 405)
23 | return
24 | }
25 | http.ServeFile(w, r, "home.html")
26 | }
27 |
28 | func main() {
29 | flag.Parse()
30 | hub := newHub()
31 | go hub.run()
32 | http.HandleFunc("/", serveHome)
33 | http.HandleFunc("/ws", func(w http.ResponseWriter, r *http.Request) {
34 | serveWs(hub, w, r)
35 | })
36 | err := http.ListenAndServe(*addr, nil)
37 | if err != nil {
38 | log.Fatal("ListenAndServe: ", err)
39 | }
40 | }
41 |
--------------------------------------------------------------------------------
/caddyhttp/index/index_test.go:
--------------------------------------------------------------------------------
1 | package index
2 |
3 | import (
4 | "testing"
5 |
6 | "github.com/WedgeServer/wedge"
7 | "github.com/WedgeServer/wedge/caddyhttp/staticfiles"
8 | )
9 |
10 | func TestIndexIncompleteParams(t *testing.T) {
11 | c := caddy.NewTestController("", "index")
12 |
13 | err := setupIndex(c)
14 | if err == nil {
15 | t.Error("Expected an error, but didn't get one")
16 | }
17 | }
18 |
19 | func TestIndex(t *testing.T) {
20 | c := caddy.NewTestController("", "index a.html b.html c.html")
21 |
22 | err := setupIndex(c)
23 | if err != nil {
24 | t.Errorf("Expected no errors, got: %v", err)
25 | }
26 |
27 | expectedIndex := []string{"a.html", "b.html", "c.html"}
28 |
29 | if len(staticfiles.IndexPages) != 3 {
30 | t.Errorf("Expected 3 values, got %v", len(staticfiles.IndexPages))
31 | }
32 |
33 | // Ensure ordering is correct
34 | for i, actual := range staticfiles.IndexPages {
35 | if actual != expectedIndex[i] {
36 | t.Errorf("Expected value in position %d to be %v, got %v", i, expectedIndex[i], actual)
37 | }
38 | }
39 | }
40 |
--------------------------------------------------------------------------------
/vendor/github.com/lucas-clemente/quic-go/handshake/interface.go:
--------------------------------------------------------------------------------
1 | package handshake
2 |
3 | import "github.com/lucas-clemente/quic-go/protocol"
4 |
5 | // Sealer seals a packet
6 | type Sealer func(dst, src []byte, packetNumber protocol.PacketNumber, associatedData []byte) []byte
7 |
8 | // CryptoSetup is a crypto setup
9 | type CryptoSetup interface {
10 | Open(dst, src []byte, packetNumber protocol.PacketNumber, associatedData []byte) ([]byte, protocol.EncryptionLevel, error)
11 | HandleCryptoStream() error
12 | // TODO: clean up this interface
13 | DiversificationNonce() []byte // only needed for cryptoSetupServer
14 | SetDiversificationNonce([]byte) // only needed for cryptoSetupClient
15 |
16 | GetSealer() (protocol.EncryptionLevel, Sealer)
17 | GetSealerWithEncryptionLevel(protocol.EncryptionLevel) (Sealer, error)
18 | GetSealerForCryptoStream() (protocol.EncryptionLevel, Sealer)
19 | }
20 |
21 | // TransportParameters are parameters sent to the peer during the handshake
22 | type TransportParameters struct {
23 | RequestConnectionIDTruncation bool
24 | }
25 |
--------------------------------------------------------------------------------
/vendor/github.com/jimstudt/http-authentication/basic/plain.go:
--------------------------------------------------------------------------------
1 | package basic
2 |
3 | import (
4 | "fmt"
5 | )
6 |
7 | type plainPassword struct {
8 | password string
9 | }
10 |
11 | // Accept any password in the plain text encoding.
12 | // Be careful: This matches any line, so it *must* be the last parser in you list.
13 | func AcceptPlain(pw string) (EncodedPasswd, error) {
14 | return &plainPassword{pw}, nil
15 | }
16 |
17 | // Reject any plain text encoded passoword.
18 | // Be careful: This matches any line, so it *must* be the last parser in you list.
19 | func RejectPlain(pw string) (EncodedPasswd, error) {
20 | return nil, fmt.Errorf("plain password rejected: %s", pw)
21 | }
22 |
23 | func (p *plainPassword) MatchesPassword(pw string) bool {
24 | // Notice: nginx prefixes plain passwords with {PLAIN}, so we see if that would
25 | // let us match too. I'd split {PLAIN} off, but someone probably uses that
26 | // in their password. It's a big planet.
27 | return constantTimeEquals(pw, p.password) || constantTimeEquals("{PLAIN}"+pw, p.password)
28 | }
29 |
--------------------------------------------------------------------------------
/vendor/github.com/lucas-clemente/quic-go/ackhandler/retransmittable.go:
--------------------------------------------------------------------------------
1 | package ackhandler
2 |
3 | import (
4 | "github.com/lucas-clemente/quic-go/frames"
5 | )
6 |
7 | // Returns a new slice with all non-retransmittable frames deleted.
8 | func stripNonRetransmittableFrames(fs []frames.Frame) []frames.Frame {
9 | res := make([]frames.Frame, 0, len(fs))
10 | for _, f := range fs {
11 | if IsFrameRetransmittable(f) {
12 | res = append(res, f)
13 | }
14 | }
15 | return res
16 | }
17 |
18 | // IsFrameRetransmittable returns true if the frame should be retransmitted.
19 | func IsFrameRetransmittable(f frames.Frame) bool {
20 | switch f.(type) {
21 | case *frames.StopWaitingFrame:
22 | return false
23 | case *frames.AckFrame:
24 | return false
25 | default:
26 | return true
27 | }
28 | }
29 |
30 | // HasRetransmittableFrames returns true if at least one frame is retransmittable.
31 | func HasRetransmittableFrames(fs []frames.Frame) bool {
32 | for _, f := range fs {
33 | if IsFrameRetransmittable(f) {
34 | return true
35 | }
36 | }
37 | return false
38 | }
39 |
--------------------------------------------------------------------------------
/vendor/gopkg.in/alecthomas/kingpin.v2/completions.go:
--------------------------------------------------------------------------------
1 | package kingpin
2 |
3 | // HintAction is a function type who is expected to return a slice of possible
4 | // command line arguments.
5 | type HintAction func() []string
6 | type completionsMixin struct {
7 | hintActions []HintAction
8 | builtinHintActions []HintAction
9 | }
10 |
11 | func (a *completionsMixin) addHintAction(action HintAction) {
12 | a.hintActions = append(a.hintActions, action)
13 | }
14 |
15 | // Allow adding of HintActions which are added internally, ie, EnumVar
16 | func (a *completionsMixin) addHintActionBuiltin(action HintAction) {
17 | a.builtinHintActions = append(a.builtinHintActions, action)
18 | }
19 |
20 | func (a *completionsMixin) resolveCompletions() []string {
21 | var hints []string
22 |
23 | options := a.builtinHintActions
24 | if len(a.hintActions) > 0 {
25 | // User specified their own hintActions. Use those instead.
26 | options = a.hintActions
27 | }
28 |
29 | for _, hintAction := range options {
30 | hints = append(hints, hintAction()...)
31 | }
32 | return hints
33 | }
34 |
--------------------------------------------------------------------------------
/caddyhttp/limits/handler_test.go:
--------------------------------------------------------------------------------
1 | package limits
2 |
3 | import (
4 | "io/ioutil"
5 | "net/http"
6 | "net/http/httptest"
7 | "strings"
8 | "testing"
9 |
10 | "github.com/WedgeServer/wedge/caddyhttp/httpserver"
11 | )
12 |
13 | func TestBodySizeLimit(t *testing.T) {
14 | var (
15 | gotContent []byte
16 | gotError error
17 | expectContent = "hello"
18 | )
19 | l := Limit{
20 | Next: httpserver.HandlerFunc(func(w http.ResponseWriter, r *http.Request) (int, error) {
21 | gotContent, gotError = ioutil.ReadAll(r.Body)
22 | return 0, nil
23 | }),
24 | BodyLimits: []httpserver.PathLimit{{Path: "/", Limit: int64(len(expectContent))}},
25 | }
26 |
27 | r := httptest.NewRequest("GET", "/", strings.NewReader(expectContent+expectContent))
28 | l.ServeHTTP(httptest.NewRecorder(), r)
29 | if got := string(gotContent); got != expectContent {
30 | t.Errorf("expected content[%s], got[%s]", expectContent, got)
31 | }
32 | if gotError != httpserver.ErrMaxBytesExceeded {
33 | t.Errorf("expect error %v, got %v", httpserver.ErrMaxBytesExceeded, gotError)
34 | }
35 | }
36 |
--------------------------------------------------------------------------------
/vendor/github.com/miekg/dns/reverse.go:
--------------------------------------------------------------------------------
1 | package dns
2 |
3 | // StringToType is the reverse of TypeToString, needed for string parsing.
4 | var StringToType = reverseInt16(TypeToString)
5 |
6 | // StringToClass is the reverse of ClassToString, needed for string parsing.
7 | var StringToClass = reverseInt16(ClassToString)
8 |
9 | // StringToOpcode is a map of opcodes to strings.
10 | var StringToOpcode = reverseInt(OpcodeToString)
11 |
12 | // StringToRcode is a map of rcodes to strings.
13 | var StringToRcode = reverseInt(RcodeToString)
14 |
15 | // Reverse a map
16 | func reverseInt8(m map[uint8]string) map[string]uint8 {
17 | n := make(map[string]uint8, len(m))
18 | for u, s := range m {
19 | n[s] = u
20 | }
21 | return n
22 | }
23 |
24 | func reverseInt16(m map[uint16]string) map[string]uint16 {
25 | n := make(map[string]uint16, len(m))
26 | for u, s := range m {
27 | n[s] = u
28 | }
29 | return n
30 | }
31 |
32 | func reverseInt(m map[int]string) map[string]int {
33 | n := make(map[string]int, len(m))
34 | for u, s := range m {
35 | n[s] = u
36 | }
37 | return n
38 | }
39 |
--------------------------------------------------------------------------------
/vendor/golang.org/x/sys/unix/openbsd_pledge.go:
--------------------------------------------------------------------------------
1 | // Copyright 2016 The Go Authors. All rights reserved.
2 | // Use of this source code is governed by a BSD-style
3 | // license that can be found in the LICENSE file.
4 |
5 | // +build openbsd
6 | // +build 386 amd64 arm
7 |
8 | package unix
9 |
10 | import (
11 | "syscall"
12 | "unsafe"
13 | )
14 |
15 | const (
16 | SYS_PLEDGE = 108
17 | )
18 |
19 | // Pledge implements the pledge syscall. For more information see pledge(2).
20 | func Pledge(promises string, paths []string) error {
21 | promisesPtr, err := syscall.BytePtrFromString(promises)
22 | if err != nil {
23 | return err
24 | }
25 | promisesUnsafe, pathsUnsafe := unsafe.Pointer(promisesPtr), unsafe.Pointer(nil)
26 | if paths != nil {
27 | var pathsPtr []*byte
28 | if pathsPtr, err = syscall.SlicePtrFromStrings(paths); err != nil {
29 | return err
30 | }
31 | pathsUnsafe = unsafe.Pointer(&pathsPtr[0])
32 | }
33 | _, _, e := syscall.Syscall(SYS_PLEDGE, uintptr(promisesUnsafe), uintptr(pathsUnsafe), 0)
34 | if e != 0 {
35 | return e
36 | }
37 | return nil
38 | }
39 |
--------------------------------------------------------------------------------
/vendor/github.com/lucas-clemente/quic-go/ackhandler/interfaces.go:
--------------------------------------------------------------------------------
1 | package ackhandler
2 |
3 | import (
4 | "time"
5 |
6 | "github.com/lucas-clemente/quic-go/frames"
7 | "github.com/lucas-clemente/quic-go/protocol"
8 | )
9 |
10 | // SentPacketHandler handles ACKs received for outgoing packets
11 | type SentPacketHandler interface {
12 | // SentPacket may modify the packet
13 | SentPacket(packet *Packet) error
14 | ReceivedAck(ackFrame *frames.AckFrame, withPacketNumber protocol.PacketNumber, recvTime time.Time) error
15 |
16 | SendingAllowed() bool
17 | GetStopWaitingFrame(force bool) *frames.StopWaitingFrame
18 | DequeuePacketForRetransmission() (packet *Packet)
19 | GetLeastUnacked() protocol.PacketNumber
20 |
21 | GetAlarmTimeout() time.Time
22 | OnAlarm()
23 | }
24 |
25 | // ReceivedPacketHandler handles ACKs needed to send for incoming packets
26 | type ReceivedPacketHandler interface {
27 | ReceivedPacket(packetNumber protocol.PacketNumber, shouldInstigateAck bool) error
28 | SetLowerLimit(protocol.PacketNumber)
29 |
30 | GetAlarmTimeout() time.Time
31 | GetAckFrame() *frames.AckFrame
32 | }
33 |
--------------------------------------------------------------------------------
/vendor/github.com/miekg/dns/udp.go:
--------------------------------------------------------------------------------
1 | // +build !windows
2 |
3 | package dns
4 |
5 | import (
6 | "net"
7 | )
8 |
9 | // SessionUDP holds the remote address and the associated
10 | // out-of-band data.
11 | type SessionUDP struct {
12 | raddr *net.UDPAddr
13 | context []byte
14 | }
15 |
16 | // RemoteAddr returns the remote network address.
17 | func (s *SessionUDP) RemoteAddr() net.Addr { return s.raddr }
18 |
19 | // ReadFromSessionUDP acts just like net.UDPConn.ReadFrom(), but returns a session object instead of a
20 | // net.UDPAddr.
21 | func ReadFromSessionUDP(conn *net.UDPConn, b []byte) (int, *SessionUDP, error) {
22 | oob := make([]byte, 40)
23 | n, oobn, _, raddr, err := conn.ReadMsgUDP(b, oob)
24 | if err != nil {
25 | return n, nil, err
26 | }
27 | return n, &SessionUDP{raddr, oob[:oobn]}, err
28 | }
29 |
30 | // WriteToSessionUDP acts just like net.UDPConn.WritetTo(), but uses a *SessionUDP instead of a net.Addr.
31 | func WriteToSessionUDP(conn *net.UDPConn, b []byte, session *SessionUDP) (int, error) {
32 | n, _, err := conn.WriteMsgUDP(b, session.context, session.raddr)
33 | return n, err
34 | }
35 |
--------------------------------------------------------------------------------
/vendor/gopkg.in/alecthomas/kingpin.v2/envar.go:
--------------------------------------------------------------------------------
1 | package kingpin
2 |
3 | import (
4 | "os"
5 | "regexp"
6 | )
7 |
8 | var (
9 | envVarValuesSeparator = "\r?\n"
10 | envVarValuesTrimmer = regexp.MustCompile(envVarValuesSeparator + "$")
11 | envVarValuesSplitter = regexp.MustCompile(envVarValuesSeparator)
12 | )
13 |
14 | type envarMixin struct {
15 | envar string
16 | noEnvar bool
17 | }
18 |
19 | func (e *envarMixin) HasEnvarValue() bool {
20 | return e.GetEnvarValue() != ""
21 | }
22 |
23 | func (e *envarMixin) GetEnvarValue() string {
24 | if e.noEnvar || e.envar == "" {
25 | return ""
26 | }
27 | return os.Getenv(e.envar)
28 | }
29 |
30 | func (e *envarMixin) GetSplitEnvarValue() []string {
31 | values := make([]string, 0)
32 |
33 | envarValue := e.GetEnvarValue()
34 | if envarValue == "" {
35 | return values
36 | }
37 |
38 | // Split by new line to extract multiple values, if any.
39 | trimmed := envVarValuesTrimmer.ReplaceAllString(envarValue, "")
40 | for _, value := range envVarValuesSplitter.Split(trimmed, -1) {
41 | values = append(values, value)
42 | }
43 |
44 | return values
45 | }
46 |
--------------------------------------------------------------------------------
/vendor/google.golang.org/appengine/aetest/doc.go:
--------------------------------------------------------------------------------
1 | /*
2 | Package aetest provides an API for running dev_appserver for use in tests.
3 |
4 | An example test file:
5 |
6 | package foo_test
7 |
8 | import (
9 | "testing"
10 |
11 | "google.golang.org/appengine/memcache"
12 | "google.golang.org/appengine/aetest"
13 | )
14 |
15 | func TestFoo(t *testing.T) {
16 | ctx, done, err := aetest.NewContext()
17 | if err != nil {
18 | t.Fatal(err)
19 | }
20 | defer done()
21 |
22 | it := &memcache.Item{
23 | Key: "some-key",
24 | Value: []byte("some-value"),
25 | }
26 | err = memcache.Set(ctx, it)
27 | if err != nil {
28 | t.Fatalf("Set err: %v", err)
29 | }
30 | it, err = memcache.Get(ctx, "some-key")
31 | if err != nil {
32 | t.Fatalf("Get err: %v; want no error", err)
33 | }
34 | if g, w := string(it.Value), "some-value" ; g != w {
35 | t.Errorf("retrieved Item.Value = %q, want %q", g, w)
36 | }
37 | }
38 |
39 | The environment variable APPENGINE_DEV_APPSERVER specifies the location of the
40 | dev_appserver.py executable to use. If unset, the system PATH is consulted.
41 | */
42 | package aetest
43 |
--------------------------------------------------------------------------------
/vendor/google.golang.org/appengine/user/user_classic.go:
--------------------------------------------------------------------------------
1 | // Copyright 2015 Google Inc. All rights reserved.
2 | // Use of this source code is governed by the Apache 2.0
3 | // license that can be found in the LICENSE file.
4 |
5 | // +build appengine
6 |
7 | package user
8 |
9 | import (
10 | "appengine/user"
11 |
12 | "golang.org/x/net/context"
13 |
14 | "google.golang.org/appengine/internal"
15 | )
16 |
17 | func Current(ctx context.Context) *User {
18 | c, err := internal.ClassicContextFromContext(ctx)
19 | if err != nil {
20 | panic(err)
21 | }
22 | u := user.Current(c)
23 | if u == nil {
24 | return nil
25 | }
26 | // Map appengine/user.User to this package's User type.
27 | return &User{
28 | Email: u.Email,
29 | AuthDomain: u.AuthDomain,
30 | Admin: u.Admin,
31 | ID: u.ID,
32 | FederatedIdentity: u.FederatedIdentity,
33 | FederatedProvider: u.FederatedProvider,
34 | }
35 | }
36 |
37 | func IsAdmin(ctx context.Context) bool {
38 | c, err := internal.ClassicContextFromContext(ctx)
39 | if err != nil {
40 | panic(err)
41 | }
42 |
43 | return user.IsAdmin(c)
44 | }
45 |
--------------------------------------------------------------------------------
/vendor/github.com/alecthomas/units/COPYING:
--------------------------------------------------------------------------------
1 | Copyright (C) 2014 Alec Thomas
2 |
3 | Permission is hereby granted, free of charge, to any person obtaining a copy of
4 | this software and associated documentation files (the "Software"), to deal in
5 | the Software without restriction, including without limitation the rights to
6 | use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
7 | of the Software, and to permit persons to whom the Software is furnished to do
8 | so, subject to the following conditions:
9 |
10 | The above copyright notice and this permission notice shall be included in all
11 | copies or substantial portions of the Software.
12 |
13 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
14 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
15 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
16 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
17 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
18 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
19 | SOFTWARE.
20 |
--------------------------------------------------------------------------------
/vendor/golang.org/x/sys/unix/syscall_openbsd_amd64.go:
--------------------------------------------------------------------------------
1 | // Copyright 2009 The Go Authors. All rights reserved.
2 | // Use of this source code is governed by a BSD-style
3 | // license that can be found in the LICENSE file.
4 |
5 | // +build amd64,openbsd
6 |
7 | package unix
8 |
9 | func Getpagesize() int { return 4096 }
10 |
11 | func TimespecToNsec(ts Timespec) int64 { return int64(ts.Sec)*1e9 + int64(ts.Nsec) }
12 |
13 | func NsecToTimespec(nsec int64) (ts Timespec) {
14 | ts.Sec = nsec / 1e9
15 | ts.Nsec = nsec % 1e9
16 | return
17 | }
18 |
19 | func NsecToTimeval(nsec int64) (tv Timeval) {
20 | nsec += 999 // round up to microsecond
21 | tv.Usec = nsec % 1e9 / 1e3
22 | tv.Sec = nsec / 1e9
23 | return
24 | }
25 |
26 | func SetKevent(k *Kevent_t, fd, mode, flags int) {
27 | k.Ident = uint64(fd)
28 | k.Filter = int16(mode)
29 | k.Flags = uint16(flags)
30 | }
31 |
32 | func (iov *Iovec) SetLen(length int) {
33 | iov.Len = uint64(length)
34 | }
35 |
36 | func (msghdr *Msghdr) SetControllen(length int) {
37 | msghdr.Controllen = uint32(length)
38 | }
39 |
40 | func (cmsg *Cmsghdr) SetLen(length int) {
41 | cmsg.Len = uint32(length)
42 | }
43 |
--------------------------------------------------------------------------------
/vendor/gopkg.in/square/go-jose.v1/doc.go:
--------------------------------------------------------------------------------
1 | /*-
2 | * Copyright 2014 Square Inc.
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 |
17 | /*
18 |
19 | Package jose aims to provide an implementation of the Javascript Object Signing
20 | and Encryption set of standards. For the moment, it mainly focuses on
21 | encryption and signing based on the JSON Web Encryption and JSON Web Signature
22 | standards. The library supports both the compact and full serialization
23 | formats, and has optional support for multiple recipients.
24 |
25 | */
26 | package jose // import "gopkg.in/square/go-jose.v1"
27 |
--------------------------------------------------------------------------------
/caddyhttp/expvar/expvar_test.go:
--------------------------------------------------------------------------------
1 | package expvar
2 |
3 | import (
4 | "fmt"
5 | "net/http"
6 | "net/http/httptest"
7 | "testing"
8 |
9 | "github.com/WedgeServer/wedge/caddyhttp/httpserver"
10 | )
11 |
12 | func TestExpVar(t *testing.T) {
13 | rw := ExpVar{
14 | Next: httpserver.HandlerFunc(contentHandler),
15 | Resource: "/d/v",
16 | }
17 |
18 | tests := []struct {
19 | from string
20 | result int
21 | }{
22 | {"/d/v", 0},
23 | {"/x/y", http.StatusOK},
24 | }
25 |
26 | for i, test := range tests {
27 | req, err := http.NewRequest("GET", test.from, nil)
28 | if err != nil {
29 | t.Fatalf("Test %d: Could not create HTTP request %v", i, err)
30 | }
31 | rec := httptest.NewRecorder()
32 | result, err := rw.ServeHTTP(rec, req)
33 | if err != nil {
34 | t.Fatalf("Test %d: Could not ServeHTTP %v", i, err)
35 | }
36 | if result != test.result {
37 | t.Errorf("Test %d: Expected Header '%d' but was '%d'",
38 | i, test.result, result)
39 | }
40 | }
41 | }
42 |
43 | func contentHandler(w http.ResponseWriter, r *http.Request) (int, error) {
44 | fmt.Fprintf(w, r.URL.String())
45 | return http.StatusOK, nil
46 | }
47 |
--------------------------------------------------------------------------------
/vendor/google.golang.org/appengine/demos/helloworld/helloworld.go:
--------------------------------------------------------------------------------
1 | // Copyright 2014 Google Inc. All rights reserved.
2 | // Use of this source code is governed by the Apache 2.0
3 | // license that can be found in the LICENSE file.
4 |
5 | // This example only works on App Engine "flexible environment".
6 | // +build !appengine
7 |
8 | package main
9 |
10 | import (
11 | "html/template"
12 | "net/http"
13 | "time"
14 |
15 | "google.golang.org/appengine"
16 | "google.golang.org/appengine/log"
17 | )
18 |
19 | var initTime = time.Now()
20 |
21 | func main() {
22 | http.HandleFunc("/", handle)
23 | appengine.Main()
24 | }
25 |
26 | func handle(w http.ResponseWriter, r *http.Request) {
27 | if r.URL.Path != "/" {
28 | http.NotFound(w, r)
29 | return
30 | }
31 |
32 | ctx := appengine.NewContext(r)
33 | log.Infof(ctx, "Serving the front page.")
34 |
35 | tmpl.Execute(w, time.Since(initTime))
36 | }
37 |
38 | var tmpl = template.Must(template.New("front").Parse(`
39 |
40 |
41 |
42 | Hello, World! 세상아 안녕!
43 |
44 |
45 |
46 | This instance has been running for {{.}}.
47 |
48 |
49 |
50 | `))
51 |
--------------------------------------------------------------------------------
/vendor/gopkg.in/alecthomas/kingpin.v2/COPYING:
--------------------------------------------------------------------------------
1 | Copyright (C) 2014 Alec Thomas
2 |
3 | Permission is hereby granted, free of charge, to any person obtaining a copy of
4 | this software and associated documentation files (the "Software"), to deal in
5 | the Software without restriction, including without limitation the rights to
6 | use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
7 | of the Software, and to permit persons to whom the Software is furnished to do
8 | so, subject to the following conditions:
9 |
10 | The above copyright notice and this permission notice shall be included in all
11 | copies or substantial portions of the Software.
12 |
13 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
14 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
15 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
16 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
17 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
18 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
19 | SOFTWARE.
20 |
--------------------------------------------------------------------------------
/caddyhttp/markdown/metadata/metadata_yaml.go:
--------------------------------------------------------------------------------
1 | package metadata
2 |
3 | import (
4 | "bytes"
5 |
6 | "gopkg.in/yaml.v2"
7 | )
8 |
9 | // YAMLParser is the Parser for YAML
10 | type YAMLParser struct {
11 | metadata Metadata
12 | markdown *bytes.Buffer
13 | }
14 |
15 | // Type returns the kind of metadata parser.
16 | func (y *YAMLParser) Type() string {
17 | return "YAML"
18 | }
19 |
20 | // Init prepares the metadata parser for parsing.
21 | func (y *YAMLParser) Init(b *bytes.Buffer) bool {
22 | meta, data := splitBuffer(b, "---")
23 | if meta == nil || data == nil {
24 | return false
25 | }
26 | y.markdown = data
27 |
28 | m := make(map[string]interface{})
29 | if err := yaml.Unmarshal(meta.Bytes(), &m); err != nil {
30 | return false
31 | }
32 | y.metadata = NewMetadata(m)
33 |
34 | return true
35 | }
36 |
37 | // Metadata returns parsed metadata. It should be called
38 | // only after a call to Parse returns without error.
39 | func (y *YAMLParser) Metadata() Metadata {
40 | return y.metadata
41 | }
42 |
43 | // Markdown renders the text as a byte array
44 | func (y *YAMLParser) Markdown() []byte {
45 | return y.markdown.Bytes()
46 | }
47 |
--------------------------------------------------------------------------------
/vendor/github.com/lucas-clemente/quic-go/conn.go:
--------------------------------------------------------------------------------
1 | package quic
2 |
3 | import (
4 | "net"
5 | "sync"
6 | )
7 |
8 | type connection interface {
9 | Write([]byte) error
10 | Read([]byte) (int, net.Addr, error)
11 | Close() error
12 | LocalAddr() net.Addr
13 | RemoteAddr() net.Addr
14 | SetCurrentRemoteAddr(net.Addr)
15 | }
16 |
17 | type conn struct {
18 | mutex sync.RWMutex
19 |
20 | pconn net.PacketConn
21 | currentAddr net.Addr
22 | }
23 |
24 | var _ connection = &conn{}
25 |
26 | func (c *conn) Write(p []byte) error {
27 | _, err := c.pconn.WriteTo(p, c.currentAddr)
28 | return err
29 | }
30 |
31 | func (c *conn) Read(p []byte) (int, net.Addr, error) {
32 | return c.pconn.ReadFrom(p)
33 | }
34 |
35 | func (c *conn) SetCurrentRemoteAddr(addr net.Addr) {
36 | c.mutex.Lock()
37 | c.currentAddr = addr
38 | c.mutex.Unlock()
39 | }
40 |
41 | func (c *conn) LocalAddr() net.Addr {
42 | return c.pconn.LocalAddr()
43 | }
44 |
45 | func (c *conn) RemoteAddr() net.Addr {
46 | c.mutex.RLock()
47 | addr := c.currentAddr
48 | c.mutex.RUnlock()
49 | return addr
50 | }
51 |
52 | func (c *conn) Close() error {
53 | return c.pconn.Close()
54 | }
55 |
--------------------------------------------------------------------------------
/vendor/github.com/lucas-clemente/quic-go/frames/blocked_frame.go:
--------------------------------------------------------------------------------
1 | package frames
2 |
3 | import (
4 | "bytes"
5 |
6 | "github.com/lucas-clemente/quic-go/internal/utils"
7 | "github.com/lucas-clemente/quic-go/protocol"
8 | )
9 |
10 | // A BlockedFrame in QUIC
11 | type BlockedFrame struct {
12 | StreamID protocol.StreamID
13 | }
14 |
15 | //Write writes a BlockedFrame frame
16 | func (f *BlockedFrame) Write(b *bytes.Buffer, version protocol.VersionNumber) error {
17 | b.WriteByte(0x05)
18 | utils.WriteUint32(b, uint32(f.StreamID))
19 | return nil
20 | }
21 |
22 | // MinLength of a written frame
23 | func (f *BlockedFrame) MinLength(version protocol.VersionNumber) (protocol.ByteCount, error) {
24 | return 1 + 4, nil
25 | }
26 |
27 | // ParseBlockedFrame parses a BLOCKED frame
28 | func ParseBlockedFrame(r *bytes.Reader) (*BlockedFrame, error) {
29 | frame := &BlockedFrame{}
30 |
31 | // read the TypeByte
32 | _, err := r.ReadByte()
33 | if err != nil {
34 | return nil, err
35 | }
36 |
37 | sid, err := utils.ReadUint32(r)
38 | if err != nil {
39 | return nil, err
40 | }
41 | frame.StreamID = protocol.StreamID(sid)
42 |
43 | return frame, nil
44 | }
45 |
--------------------------------------------------------------------------------
/vendor/github.com/naoina/toml/LICENSE:
--------------------------------------------------------------------------------
1 | Copyright (c) 2014 Naoya Inada
2 |
3 | Permission is hereby granted, free of charge, to any person obtaining a copy
4 | of this software and associated documentation files (the "Software"), to deal
5 | in the Software without restriction, including without limitation the rights
6 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
7 | copies of the Software, and to permit persons to whom the Software is
8 | furnished to do so, subject to the following conditions:
9 |
10 | The above copyright notice and this permission notice shall be included in
11 | all copies or substantial portions of the Software.
12 |
13 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
14 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
15 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
16 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
17 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
18 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
19 | THE SOFTWARE.
20 |
--------------------------------------------------------------------------------
/vendor/golang.org/x/crypto/curve25519/doc.go:
--------------------------------------------------------------------------------
1 | // Copyright 2012 The Go Authors. All rights reserved.
2 | // Use of this source code is governed by a BSD-style
3 | // license that can be found in the LICENSE file.
4 |
5 | // Package curve25519 provides an implementation of scalar multiplication on
6 | // the elliptic curve known as curve25519. See https://cr.yp.to/ecdh.html
7 | package curve25519 // import "golang.org/x/crypto/curve25519"
8 |
9 | // basePoint is the x coordinate of the generator of the curve.
10 | var basePoint = [32]byte{9, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}
11 |
12 | // ScalarMult sets dst to the product in*base where dst and base are the x
13 | // coordinates of group points and all values are in little-endian form.
14 | func ScalarMult(dst, in, base *[32]byte) {
15 | scalarMult(dst, in, base)
16 | }
17 |
18 | // ScalarBaseMult sets dst to the product in*base where dst and base are the x
19 | // coordinates of group points, base is the standard generator and all values
20 | // are in little-endian form.
21 | func ScalarBaseMult(dst, in *[32]byte) {
22 | ScalarMult(dst, in, &basePoint)
23 | }
24 |
--------------------------------------------------------------------------------
/vendor/github.com/lucas-clemente/quic-go/frames/log.go:
--------------------------------------------------------------------------------
1 | package frames
2 |
3 | import "github.com/lucas-clemente/quic-go/internal/utils"
4 |
5 | // LogFrame logs a frame, either sent or received
6 | func LogFrame(frame Frame, sent bool) {
7 | if !utils.Debug() {
8 | return
9 | }
10 | dir := "<-"
11 | if sent {
12 | dir = "->"
13 | }
14 | switch f := frame.(type) {
15 | case *StreamFrame:
16 | utils.Debugf("\t%s &frames.StreamFrame{StreamID: %d, FinBit: %t, Offset: 0x%x, Data length: 0x%x, Offset + Data length: 0x%x}", dir, f.StreamID, f.FinBit, f.Offset, f.DataLen(), f.Offset+f.DataLen())
17 | case *StopWaitingFrame:
18 | if sent {
19 | utils.Debugf("\t%s &frames.StopWaitingFrame{LeastUnacked: 0x%x, PacketNumberLen: 0x%x}", dir, f.LeastUnacked, f.PacketNumberLen)
20 | } else {
21 | utils.Debugf("\t%s &frames.StopWaitingFrame{LeastUnacked: 0x%x}", dir, f.LeastUnacked)
22 | }
23 | case *AckFrame:
24 | utils.Debugf("\t%s &frames.AckFrame{LargestAcked: 0x%x, LowestAcked: 0x%x, AckRanges: %#v, DelayTime: %s}", dir, f.LargestAcked, f.LowestAcked, f.AckRanges, f.DelayTime.String())
25 | default:
26 | utils.Debugf("\t%s %#v", dir, frame)
27 | }
28 | }
29 |
--------------------------------------------------------------------------------
/vendor/github.com/nu7hatch/gouuid/COPYING:
--------------------------------------------------------------------------------
1 | Copyright (C) 2011 by Krzysztof Kowalik
2 |
3 | Permission is hereby granted, free of charge, to any person obtaining a copy of
4 | this software and associated documentation files (the "Software"), to deal in
5 | the Software without restriction, including without limitation the rights to
6 | use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
7 | of the Software, and to permit persons to whom the Software is furnished to do
8 | so, subject to the following conditions:
9 |
10 | The above copyright notice and this permission notice shall be included in all
11 | copies or substantial portions of the Software.
12 |
13 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
14 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
15 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
16 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
17 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
18 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
19 | SOFTWARE.
--------------------------------------------------------------------------------
/vendor/golang.org/x/sys/unix/syscall_netbsd_386.go:
--------------------------------------------------------------------------------
1 | // Copyright 2009 The Go Authors. All rights reserved.
2 | // Use of this source code is governed by a BSD-style
3 | // license that can be found in the LICENSE file.
4 |
5 | // +build 386,netbsd
6 |
7 | package unix
8 |
9 | func Getpagesize() int { return 4096 }
10 |
11 | func TimespecToNsec(ts Timespec) int64 { return int64(ts.Sec)*1e9 + int64(ts.Nsec) }
12 |
13 | func NsecToTimespec(nsec int64) (ts Timespec) {
14 | ts.Sec = int64(nsec / 1e9)
15 | ts.Nsec = int32(nsec % 1e9)
16 | return
17 | }
18 |
19 | func NsecToTimeval(nsec int64) (tv Timeval) {
20 | nsec += 999 // round up to microsecond
21 | tv.Usec = int32(nsec % 1e9 / 1e3)
22 | tv.Sec = int64(nsec / 1e9)
23 | return
24 | }
25 |
26 | func SetKevent(k *Kevent_t, fd, mode, flags int) {
27 | k.Ident = uint32(fd)
28 | k.Filter = uint32(mode)
29 | k.Flags = uint32(flags)
30 | }
31 |
32 | func (iov *Iovec) SetLen(length int) {
33 | iov.Len = uint32(length)
34 | }
35 |
36 | func (msghdr *Msghdr) SetControllen(length int) {
37 | msghdr.Controllen = uint32(length)
38 | }
39 |
40 | func (cmsg *Cmsghdr) SetLen(length int) {
41 | cmsg.Len = uint32(length)
42 | }
43 |
--------------------------------------------------------------------------------
/vendor/golang.org/x/sys/unix/syscall_netbsd_arm.go:
--------------------------------------------------------------------------------
1 | // Copyright 2013 The Go Authors. All rights reserved.
2 | // Use of this source code is governed by a BSD-style
3 | // license that can be found in the LICENSE file.
4 |
5 | // +build arm,netbsd
6 |
7 | package unix
8 |
9 | func Getpagesize() int { return 4096 }
10 |
11 | func TimespecToNsec(ts Timespec) int64 { return int64(ts.Sec)*1e9 + int64(ts.Nsec) }
12 |
13 | func NsecToTimespec(nsec int64) (ts Timespec) {
14 | ts.Sec = int64(nsec / 1e9)
15 | ts.Nsec = int32(nsec % 1e9)
16 | return
17 | }
18 |
19 | func NsecToTimeval(nsec int64) (tv Timeval) {
20 | nsec += 999 // round up to microsecond
21 | tv.Usec = int32(nsec % 1e9 / 1e3)
22 | tv.Sec = int64(nsec / 1e9)
23 | return
24 | }
25 |
26 | func SetKevent(k *Kevent_t, fd, mode, flags int) {
27 | k.Ident = uint32(fd)
28 | k.Filter = uint32(mode)
29 | k.Flags = uint32(flags)
30 | }
31 |
32 | func (iov *Iovec) SetLen(length int) {
33 | iov.Len = uint32(length)
34 | }
35 |
36 | func (msghdr *Msghdr) SetControllen(length int) {
37 | msghdr.Controllen = uint32(length)
38 | }
39 |
40 | func (cmsg *Cmsghdr) SetLen(length int) {
41 | cmsg.Len = uint32(length)
42 | }
43 |
--------------------------------------------------------------------------------
/vendor/github.com/naoina/go-stringutil/LICENSE:
--------------------------------------------------------------------------------
1 | Copyright (c) 2015 Naoya Inada
2 |
3 | Permission is hereby granted, free of charge, to any person obtaining a copy
4 | of this software and associated documentation files (the "Software"), to deal
5 | in the Software without restriction, including without limitation the rights
6 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
7 | copies of the Software, and to permit persons to whom the Software is
8 | furnished to do so, subject to the following conditions:
9 |
10 | The above copyright notice and this permission notice shall be included in
11 | all copies or substantial portions of the Software.
12 |
13 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
14 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
15 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
16 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
17 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
18 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
19 | THE SOFTWARE.
20 |
--------------------------------------------------------------------------------
/vendor/golang.org/x/sys/unix/syscall_netbsd_amd64.go:
--------------------------------------------------------------------------------
1 | // Copyright 2009 The Go Authors. All rights reserved.
2 | // Use of this source code is governed by a BSD-style
3 | // license that can be found in the LICENSE file.
4 |
5 | // +build amd64,netbsd
6 |
7 | package unix
8 |
9 | func Getpagesize() int { return 4096 }
10 |
11 | func TimespecToNsec(ts Timespec) int64 { return int64(ts.Sec)*1e9 + int64(ts.Nsec) }
12 |
13 | func NsecToTimespec(nsec int64) (ts Timespec) {
14 | ts.Sec = int64(nsec / 1e9)
15 | ts.Nsec = int64(nsec % 1e9)
16 | return
17 | }
18 |
19 | func NsecToTimeval(nsec int64) (tv Timeval) {
20 | nsec += 999 // round up to microsecond
21 | tv.Usec = int32(nsec % 1e9 / 1e3)
22 | tv.Sec = int64(nsec / 1e9)
23 | return
24 | }
25 |
26 | func SetKevent(k *Kevent_t, fd, mode, flags int) {
27 | k.Ident = uint64(fd)
28 | k.Filter = uint32(mode)
29 | k.Flags = uint32(flags)
30 | }
31 |
32 | func (iov *Iovec) SetLen(length int) {
33 | iov.Len = uint64(length)
34 | }
35 |
36 | func (msghdr *Msghdr) SetControllen(length int) {
37 | msghdr.Controllen = uint32(length)
38 | }
39 |
40 | func (cmsg *Cmsghdr) SetLen(length int) {
41 | cmsg.Len = uint32(length)
42 | }
43 |
--------------------------------------------------------------------------------
/vendor/golang.org/x/sys/unix/syscall_openbsd_386.go:
--------------------------------------------------------------------------------
1 | // Copyright 2009 The Go Authors. All rights reserved.
2 | // Use of this source code is governed by a BSD-style
3 | // license that can be found in the LICENSE file.
4 |
5 | // +build 386,openbsd
6 |
7 | package unix
8 |
9 | func Getpagesize() int { return 4096 }
10 |
11 | func TimespecToNsec(ts Timespec) int64 { return int64(ts.Sec)*1e9 + int64(ts.Nsec) }
12 |
13 | func NsecToTimespec(nsec int64) (ts Timespec) {
14 | ts.Sec = int64(nsec / 1e9)
15 | ts.Nsec = int32(nsec % 1e9)
16 | return
17 | }
18 |
19 | func NsecToTimeval(nsec int64) (tv Timeval) {
20 | nsec += 999 // round up to microsecond
21 | tv.Usec = int32(nsec % 1e9 / 1e3)
22 | tv.Sec = int64(nsec / 1e9)
23 | return
24 | }
25 |
26 | func SetKevent(k *Kevent_t, fd, mode, flags int) {
27 | k.Ident = uint32(fd)
28 | k.Filter = int16(mode)
29 | k.Flags = uint16(flags)
30 | }
31 |
32 | func (iov *Iovec) SetLen(length int) {
33 | iov.Len = uint32(length)
34 | }
35 |
36 | func (msghdr *Msghdr) SetControllen(length int) {
37 | msghdr.Controllen = uint32(length)
38 | }
39 |
40 | func (cmsg *Cmsghdr) SetLen(length int) {
41 | cmsg.Len = uint32(length)
42 | }
43 |
--------------------------------------------------------------------------------
/vendor/gopkg.in/alecthomas/kingpin.v2/actions.go:
--------------------------------------------------------------------------------
1 | package kingpin
2 |
3 | // Action callback executed at various stages after all values are populated.
4 | // The application, commands, arguments and flags all have corresponding
5 | // actions.
6 | type Action func(*ParseContext) error
7 |
8 | type actionMixin struct {
9 | actions []Action
10 | preActions []Action
11 | }
12 |
13 | type actionApplier interface {
14 | applyActions(*ParseContext) error
15 | applyPreActions(*ParseContext) error
16 | }
17 |
18 | func (a *actionMixin) addAction(action Action) {
19 | a.actions = append(a.actions, action)
20 | }
21 |
22 | func (a *actionMixin) addPreAction(action Action) {
23 | a.preActions = append(a.preActions, action)
24 | }
25 |
26 | func (a *actionMixin) applyActions(context *ParseContext) error {
27 | for _, action := range a.actions {
28 | if err := action(context); err != nil {
29 | return err
30 | }
31 | }
32 | return nil
33 | }
34 |
35 | func (a *actionMixin) applyPreActions(context *ParseContext) error {
36 | for _, preAction := range a.preActions {
37 | if err := preAction(context); err != nil {
38 | return err
39 | }
40 | }
41 | return nil
42 | }
43 |
--------------------------------------------------------------------------------
/vendor/github.com/lucas-clemente/aes12/LICENSE:
--------------------------------------------------------------------------------
1 | MIT License
2 |
3 | Copyright (c) 2016 Lucas Clemente
4 |
5 | Permission is hereby granted, free of charge, to any person obtaining a copy
6 | of this software and associated documentation files (the "Software"), to deal
7 | in the Software without restriction, including without limitation the rights
8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9 | copies of the Software, and to permit persons to whom the Software is
10 | furnished to do so, subject to the following conditions:
11 |
12 | The above copyright notice and this permission notice shall be included in all
13 | copies or substantial portions of the Software.
14 |
15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21 | SOFTWARE.
22 |
--------------------------------------------------------------------------------
/appveyor.yml:
--------------------------------------------------------------------------------
1 | version: "{build}"
2 |
3 | hosts:
4 | quic.clemente.io: 127.0.0.1
5 |
6 | os: Windows Server 2012 R2
7 |
8 | clone_folder: c:\gopath\src\github.com\mholt\caddy
9 |
10 | environment:
11 | GOPATH: c:\gopath
12 |
13 | install:
14 | - rmdir c:\go /s /q
15 | - appveyor DownloadFile https://storage.googleapis.com/golang/go1.9.windows-amd64.zip
16 | - 7z x go1.9.windows-amd64.zip -y -oC:\ > NUL
17 | - set PATH=%GOPATH%\bin;%PATH%
18 | - go version
19 | - go env
20 | - go get -t ./...
21 | - go get github.com/golang/lint/golint
22 | - go get github.com/FiloSottile/vendorcheck
23 | # Install gometalinter and certain linters
24 | - go get github.com/alecthomas/gometalinter
25 | - go get github.com/client9/misspell/cmd/misspell
26 | - go get github.com/gordonklaus/ineffassign
27 | - go get golang.org/x/tools/cmd/goimports
28 | - go get github.com/tsenart/deadcode
29 |
30 | build: off
31 |
32 | test_script:
33 | - gometalinter --disable-all -E vet -E gofmt -E misspell -E ineffassign -E goimports -E deadcode --tests --vendor ./...
34 | - vendorcheck ./...
35 | - go test -race ./...
36 |
37 | after_test:
38 | - golint ./...
39 |
40 | deploy: off
41 |
--------------------------------------------------------------------------------
/caddyhttp/markdown/metadata/metadata_none.go:
--------------------------------------------------------------------------------
1 | package metadata
2 |
3 | import (
4 | "bytes"
5 | )
6 |
7 | // NoneParser is the parser for plaintext markdown with no metadata.
8 | type NoneParser struct {
9 | metadata Metadata
10 | markdown *bytes.Buffer
11 | }
12 |
13 | // Type returns the kind of parser this struct is.
14 | func (n *NoneParser) Type() string {
15 | return "None"
16 | }
17 |
18 | // Init prepases and parses the metadata and markdown file
19 | func (n *NoneParser) Init(b *bytes.Buffer) bool {
20 | m := make(map[string]interface{})
21 | n.metadata = NewMetadata(m)
22 | n.markdown = bytes.NewBuffer(b.Bytes())
23 |
24 | return true
25 | }
26 |
27 | // Parse the metadata
28 | func (n *NoneParser) Parse(b []byte) ([]byte, error) {
29 | return nil, nil
30 | }
31 |
32 | // Metadata returns parsed metadata. It should be called
33 | // only after a call to Parse returns without error.
34 | func (n *NoneParser) Metadata() Metadata {
35 | return n.metadata
36 | }
37 |
38 | // Markdown returns parsed markdown. It should be called
39 | // only after a call to Parse returns without error.
40 | func (n *NoneParser) Markdown() []byte {
41 | return n.markdown.Bytes()
42 | }
43 |
--------------------------------------------------------------------------------
/vendor/github.com/codahale/aesnicheck/LICENSE:
--------------------------------------------------------------------------------
1 | The MIT License (MIT)
2 |
3 | Copyright (c) 2014 Coda Hale
4 |
5 | Permission is hereby granted, free of charge, to any person obtaining a copy
6 | of this software and associated documentation files (the "Software"), to deal
7 | in the Software without restriction, including without limitation the rights
8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9 | copies of the Software, and to permit persons to whom the Software is
10 | furnished to do so, subject to the following conditions:
11 |
12 | The above copyright notice and this permission notice shall be included in
13 | all copies or substantial portions of the Software.
14 |
15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
21 | THE SOFTWARE.
22 |
--------------------------------------------------------------------------------
/vendor/github.com/hashicorp/go-syslog/LICENSE:
--------------------------------------------------------------------------------
1 | The MIT License (MIT)
2 |
3 | Copyright (c) 2014 Armon Dadgar
4 |
5 | Permission is hereby granted, free of charge, to any person obtaining a copy of
6 | this software and associated documentation files (the "Software"), to deal in
7 | the Software without restriction, including without limitation the rights to
8 | use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
9 | the Software, and to permit persons to whom the Software is furnished to do so,
10 | subject to the following conditions:
11 |
12 | The above copyright notice and this permission notice shall be included in all
13 | copies or substantial portions of the Software.
14 |
15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
17 | FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
18 | COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
19 | IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
20 | CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
21 |
--------------------------------------------------------------------------------
/vendor/gopkg.in/natefinch/lumberjack.v2/LICENSE:
--------------------------------------------------------------------------------
1 | The MIT License (MIT)
2 |
3 | Copyright (c) 2014 Nate Finch
4 |
5 | Permission is hereby granted, free of charge, to any person obtaining a copy
6 | of this software and associated documentation files (the "Software"), to deal
7 | in the Software without restriction, including without limitation the rights
8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9 | copies of the Software, and to permit persons to whom the Software is
10 | furnished to do so, subject to the following conditions:
11 |
12 | The above copyright notice and this permission notice shall be included in all
13 | copies or substantial portions of the Software.
14 |
15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21 | SOFTWARE.
--------------------------------------------------------------------------------
/vendor/github.com/aead/chacha20/LICENSE:
--------------------------------------------------------------------------------
1 | The MIT License (MIT)
2 |
3 | Copyright (c) 2016 Andreas Auernhammer
4 |
5 | Permission is hereby granted, free of charge, to any person obtaining a copy
6 | of this software and associated documentation files (the "Software"), to deal
7 | in the Software without restriction, including without limitation the rights
8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9 | copies of the Software, and to permit persons to whom the Software is
10 | furnished to do so, subject to the following conditions:
11 |
12 | The above copyright notice and this permission notice shall be included in all
13 | copies or substantial portions of the Software.
14 |
15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21 | SOFTWARE.
22 |
--------------------------------------------------------------------------------
/caddyhttp/requestid/setup_test.go:
--------------------------------------------------------------------------------
1 | package requestid
2 |
3 | import (
4 | "testing"
5 |
6 | "github.com/WedgeServer/wedge"
7 | "github.com/WedgeServer/wedge/caddyhttp/httpserver"
8 | )
9 |
10 | func TestSetup(t *testing.T) {
11 | c := caddy.NewTestController("http", `requestid`)
12 | err := setup(c)
13 | if err != nil {
14 | t.Errorf("Expected no errors, got: %v", err)
15 | }
16 | mids := httpserver.GetConfig(c).Middleware()
17 | if len(mids) == 0 {
18 | t.Fatal("Expected middleware, got 0 instead")
19 | }
20 |
21 | handler := mids[0](httpserver.EmptyNext)
22 | myHandler, ok := handler.(Handler)
23 |
24 | if !ok {
25 | t.Fatalf("Expected handler to be type Handler, got: %#v", handler)
26 | }
27 |
28 | if !httpserver.SameNext(myHandler.Next, httpserver.EmptyNext) {
29 | t.Error("'Next' field of handler was not set properly")
30 | }
31 | }
32 |
33 | func TestSetupWithArg(t *testing.T) {
34 | c := caddy.NewTestController("http", `requestid abc`)
35 | err := setup(c)
36 | if err == nil {
37 | t.Errorf("Expected an error, got: %v", err)
38 | }
39 | mids := httpserver.GetConfig(c).Middleware()
40 | if len(mids) != 0 {
41 | t.Fatal("Expected no middleware")
42 | }
43 | }
44 |
--------------------------------------------------------------------------------
/vendor/github.com/jimstudt/http-authentication/basic/LICENSE:
--------------------------------------------------------------------------------
1 | The MIT License (MIT)
2 |
3 | Copyright (c) 2014 Jim Studt
4 |
5 | Permission is hereby granted, free of charge, to any person obtaining a copy
6 | of this software and associated documentation files (the "Software"), to deal
7 | in the Software without restriction, including without limitation the rights
8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9 | copies of the Software, and to permit persons to whom the Software is
10 | furnished to do so, subject to the following conditions:
11 |
12 | The above copyright notice and this permission notice shall be included in all
13 | copies or substantial portions of the Software.
14 |
15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21 | SOFTWARE.
--------------------------------------------------------------------------------
/vendor/github.com/lucas-clemente/fnv128a/LICENSE:
--------------------------------------------------------------------------------
1 | The MIT License (MIT)
2 |
3 | Copyright (c) 2016 Lucas Clemente
4 |
5 | Permission is hereby granted, free of charge, to any person obtaining a copy
6 | of this software and associated documentation files (the "Software"), to deal
7 | in the Software without restriction, including without limitation the rights
8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9 | copies of the Software, and to permit persons to whom the Software is
10 | furnished to do so, subject to the following conditions:
11 |
12 | The above copyright notice and this permission notice shall be included in all
13 | copies or substantial portions of the Software.
14 |
15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21 | SOFTWARE.
22 |
--------------------------------------------------------------------------------
/vendor/github.com/lucas-clemente/quic-go-certificates/LICENSE:
--------------------------------------------------------------------------------
1 | MIT License
2 |
3 | Copyright (c) 2016 Lucas Clemente
4 |
5 | Permission is hereby granted, free of charge, to any person obtaining a copy
6 | of this software and associated documentation files (the "Software"), to deal
7 | in the Software without restriction, including without limitation the rights
8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9 | copies of the Software, and to permit persons to whom the Software is
10 | furnished to do so, subject to the following conditions:
11 |
12 | The above copyright notice and this permission notice shall be included in all
13 | copies or substantial portions of the Software.
14 |
15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21 | SOFTWARE.
22 |
--------------------------------------------------------------------------------
/vendor/github.com/lucas-clemente/quic-go/internal/utils/timer.go:
--------------------------------------------------------------------------------
1 | package utils
2 |
3 | import "time"
4 |
5 | // A Timer wrapper that behaves correctly when resetting
6 | type Timer struct {
7 | t *time.Timer
8 | read bool
9 | deadline time.Time
10 | }
11 |
12 | // NewTimer creates a new timer that is not set
13 | func NewTimer() *Timer {
14 | return &Timer{t: time.NewTimer(0)}
15 | }
16 |
17 | // Chan returns the channel of the wrapped timer
18 | func (t *Timer) Chan() <-chan time.Time {
19 | return t.t.C
20 | }
21 |
22 | // Reset the timer, no matter whether the value was read or not
23 | func (t *Timer) Reset(deadline time.Time) {
24 | if deadline.Equal(t.deadline) {
25 | // No need to reset the timer
26 | return
27 | }
28 |
29 | // We need to drain the timer if the value from its channel was not read yet.
30 | // See https://groups.google.com/forum/#!topic/golang-dev/c9UUfASVPoU
31 | if !t.t.Stop() && !t.read {
32 | <-t.t.C
33 | }
34 | t.t.Reset(deadline.Sub(time.Now()))
35 |
36 | t.read = false
37 | t.deadline = deadline
38 | }
39 |
40 | // SetRead should be called after the value from the chan was read
41 | func (t *Timer) SetRead() {
42 | t.read = true
43 | }
44 |
--------------------------------------------------------------------------------
/vendor/github.com/xenolf/lego/acme/LICENSE:
--------------------------------------------------------------------------------
1 | The MIT License (MIT)
2 |
3 | Copyright (c) 2015-2017 Sebastian Erhart
4 |
5 | Permission is hereby granted, free of charge, to any person obtaining a copy
6 | of this software and associated documentation files (the "Software"), to deal
7 | in the Software without restriction, including without limitation the rights
8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9 | copies of the Software, and to permit persons to whom the Software is
10 | furnished to do so, subject to the following conditions:
11 |
12 | The above copyright notice and this permission notice shall be included in all
13 | copies or substantial portions of the Software.
14 |
15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21 | SOFTWARE.
22 |
--------------------------------------------------------------------------------
/vendor/github.com/jimstudt/http-authentication/basic/sha.go:
--------------------------------------------------------------------------------
1 | package basic
2 |
3 | import (
4 | "crypto/sha1"
5 | "crypto/subtle"
6 | "encoding/base64"
7 | "fmt"
8 | "strings"
9 | )
10 |
11 | type shaPassword struct {
12 | hashed []byte
13 | }
14 |
15 | // Accept valid SHA encoded passwords.
16 | func AcceptSha(src string) (EncodedPasswd, error) {
17 | if !strings.HasPrefix(src, "{SHA}") {
18 | return nil, nil
19 | }
20 |
21 | b64 := strings.TrimPrefix(src, "{SHA}")
22 | hashed, err := base64.StdEncoding.DecodeString(b64)
23 | if err != nil {
24 | return nil, fmt.Errorf("Malformed sha1(%s): %s", src, err.Error())
25 | }
26 | if len(hashed) != sha1.Size {
27 | return nil, fmt.Errorf("Malformed sha1(%s): wrong length", src)
28 | }
29 | return &shaPassword{hashed}, nil
30 | }
31 |
32 | // Reject any password encoded as SHA.
33 | func RejectSha(src string) (EncodedPasswd, error) {
34 | if !strings.HasPrefix(src, "{SHA}") {
35 | return nil, nil
36 | }
37 | return nil, fmt.Errorf("sha password rejected: %s", src)
38 | }
39 |
40 | func (s *shaPassword) MatchesPassword(pw string) bool {
41 | h := sha1.Sum([]byte(pw))
42 | return subtle.ConstantTimeCompare(h[:], s.hashed) == 1
43 | }
44 |
--------------------------------------------------------------------------------
/vendor/github.com/lucas-clemente/quic-go/LICENSE:
--------------------------------------------------------------------------------
1 | MIT License
2 |
3 | Copyright (c) 2016 the quic-go authors & Google, Inc.
4 |
5 | Permission is hereby granted, free of charge, to any person obtaining a copy
6 | of this software and associated documentation files (the "Software"), to deal
7 | in the Software without restriction, including without limitation the rights
8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9 | copies of the Software, and to permit persons to whom the Software is
10 | furnished to do so, subject to the following conditions:
11 |
12 | The above copyright notice and this permission notice shall be included in all
13 | copies or substantial portions of the Software.
14 |
15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21 | SOFTWARE.
22 |
--------------------------------------------------------------------------------
/vendor/github.com/miekg/dns/dane.go:
--------------------------------------------------------------------------------
1 | package dns
2 |
3 | import (
4 | "crypto/sha256"
5 | "crypto/sha512"
6 | "crypto/x509"
7 | "encoding/hex"
8 | "errors"
9 | )
10 |
11 | // CertificateToDANE converts a certificate to a hex string as used in the TLSA or SMIMEA records.
12 | func CertificateToDANE(selector, matchingType uint8, cert *x509.Certificate) (string, error) {
13 | switch matchingType {
14 | case 0:
15 | switch selector {
16 | case 0:
17 | return hex.EncodeToString(cert.Raw), nil
18 | case 1:
19 | return hex.EncodeToString(cert.RawSubjectPublicKeyInfo), nil
20 | }
21 | case 1:
22 | h := sha256.New()
23 | switch selector {
24 | case 0:
25 | h.Write(cert.Raw)
26 | return hex.EncodeToString(h.Sum(nil)), nil
27 | case 1:
28 | h.Write(cert.RawSubjectPublicKeyInfo)
29 | return hex.EncodeToString(h.Sum(nil)), nil
30 | }
31 | case 2:
32 | h := sha512.New()
33 | switch selector {
34 | case 0:
35 | h.Write(cert.Raw)
36 | return hex.EncodeToString(h.Sum(nil)), nil
37 | case 1:
38 | h.Write(cert.RawSubjectPublicKeyInfo)
39 | return hex.EncodeToString(h.Sum(nil)), nil
40 | }
41 | }
42 | return "", errors.New("dns: bad MatchingType or Selector")
43 | }
44 |
--------------------------------------------------------------------------------
/vendor/github.com/lucas-clemente/quic-go/example/client/main.go:
--------------------------------------------------------------------------------
1 | package main
2 |
3 | import (
4 | "bytes"
5 | "flag"
6 | "io"
7 | "net/http"
8 | "sync"
9 |
10 | "github.com/lucas-clemente/quic-go/h2quic"
11 | "github.com/lucas-clemente/quic-go/internal/utils"
12 | )
13 |
14 | func main() {
15 | verbose := flag.Bool("v", false, "verbose")
16 | flag.Parse()
17 | urls := flag.Args()
18 |
19 | if *verbose {
20 | utils.SetLogLevel(utils.LogLevelDebug)
21 | } else {
22 | utils.SetLogLevel(utils.LogLevelInfo)
23 | }
24 | utils.SetLogTimeFormat("")
25 |
26 | hclient := &http.Client{
27 | Transport: &h2quic.RoundTripper{},
28 | }
29 |
30 | var wg sync.WaitGroup
31 | wg.Add(len(urls))
32 | for _, addr := range urls {
33 | utils.Infof("GET %s", addr)
34 | go func(addr string) {
35 | rsp, err := hclient.Get(addr)
36 | if err != nil {
37 | panic(err)
38 | }
39 | utils.Infof("Got response for %s: %#v", addr, rsp)
40 |
41 | body := &bytes.Buffer{}
42 | _, err = io.Copy(body, rsp.Body)
43 | if err != nil {
44 | panic(err)
45 | }
46 | utils.Infof("Request Body:")
47 | utils.Infof("%s", body.Bytes())
48 | wg.Done()
49 | }(addr)
50 | }
51 | wg.Wait()
52 | }
53 |
--------------------------------------------------------------------------------
/vendor/golang.org/x/sys/unix/gccgo_c.c:
--------------------------------------------------------------------------------
1 | // Copyright 2015 The Go Authors. All rights reserved.
2 | // Use of this source code is governed by a BSD-style
3 | // license that can be found in the LICENSE file.
4 |
5 | // +build gccgo
6 |
7 | #include
8 | #include
9 | #include
10 |
11 | #define _STRINGIFY2_(x) #x
12 | #define _STRINGIFY_(x) _STRINGIFY2_(x)
13 | #define GOSYM_PREFIX _STRINGIFY_(__USER_LABEL_PREFIX__)
14 |
15 | // Call syscall from C code because the gccgo support for calling from
16 | // Go to C does not support varargs functions.
17 |
18 | struct ret {
19 | uintptr_t r;
20 | uintptr_t err;
21 | };
22 |
23 | struct ret
24 | gccgoRealSyscall(uintptr_t trap, uintptr_t a1, uintptr_t a2, uintptr_t a3, uintptr_t a4, uintptr_t a5, uintptr_t a6, uintptr_t a7, uintptr_t a8, uintptr_t a9)
25 | {
26 | struct ret r;
27 |
28 | errno = 0;
29 | r.r = syscall(trap, a1, a2, a3, a4, a5, a6, a7, a8, a9);
30 | r.err = errno;
31 | return r;
32 | }
33 |
34 | // Define the use function in C so that it is not inlined.
35 |
36 | extern void use(void *) __asm__ (GOSYM_PREFIX GOPKGPATH ".use") __attribute__((noinline));
37 |
38 | void
39 | use(void *p __attribute__ ((unused)))
40 | {
41 | }
42 |
--------------------------------------------------------------------------------
/caddyhttp/expvar/setup_test.go:
--------------------------------------------------------------------------------
1 | package expvar
2 |
3 | import (
4 | "testing"
5 |
6 | "github.com/WedgeServer/wedge"
7 | "github.com/WedgeServer/wedge/caddyhttp/httpserver"
8 | )
9 |
10 | func TestSetup(t *testing.T) {
11 | c := caddy.NewTestController("http", `expvar`)
12 | err := setup(c)
13 | if err != nil {
14 | t.Errorf("Expected no errors, got: %v", err)
15 | }
16 | mids := httpserver.GetConfig(c).Middleware()
17 | if len(mids) == 0 {
18 | t.Fatal("Expected middleware, got 0 instead")
19 | }
20 |
21 | c = caddy.NewTestController("http", `expvar /d/v`)
22 | err = setup(c)
23 | if err != nil {
24 | t.Errorf("Expected no errors, got: %v", err)
25 | }
26 | mids = httpserver.GetConfig(c).Middleware()
27 | if len(mids) == 0 {
28 | t.Fatal("Expected middleware, got 0 instead")
29 | }
30 |
31 | handler := mids[0](httpserver.EmptyNext)
32 | myHandler, ok := handler.(ExpVar)
33 | if !ok {
34 | t.Fatalf("Expected handler to be type ExpVar, got: %#v", handler)
35 | }
36 | if myHandler.Resource != "/d/v" {
37 | t.Errorf("Expected /d/v as expvar resource")
38 | }
39 | if !httpserver.SameNext(myHandler.Next, httpserver.EmptyNext) {
40 | t.Error("'Next' field of handler was not set properly")
41 | }
42 | }
43 |
--------------------------------------------------------------------------------
/vendor/google.golang.org/api/googleapi/transport/apikey.go:
--------------------------------------------------------------------------------
1 | // Copyright 2012 Google Inc. All rights reserved.
2 | // Use of this source code is governed by a BSD-style
3 | // license that can be found in the LICENSE file.
4 |
5 | // Package transport contains HTTP transports used to make
6 | // authenticated API requests.
7 | package transport
8 |
9 | import (
10 | "errors"
11 | "net/http"
12 | )
13 |
14 | // APIKey is an HTTP Transport which wraps an underlying transport and
15 | // appends an API Key "key" parameter to the URL of outgoing requests.
16 | type APIKey struct {
17 | // Key is the API Key to set on requests.
18 | Key string
19 |
20 | // Transport is the underlying HTTP transport.
21 | // If nil, http.DefaultTransport is used.
22 | Transport http.RoundTripper
23 | }
24 |
25 | func (t *APIKey) RoundTrip(req *http.Request) (*http.Response, error) {
26 | rt := t.Transport
27 | if rt == nil {
28 | rt = http.DefaultTransport
29 | if rt == nil {
30 | return nil, errors.New("googleapi/transport: no Transport specified or available")
31 | }
32 | }
33 | newReq := *req
34 | args := newReq.URL.Query()
35 | args.Set("key", t.Key)
36 | newReq.URL.RawQuery = args.Encode()
37 | return rt.RoundTrip(&newReq)
38 | }
39 |
--------------------------------------------------------------------------------
/vendor/github.com/lucas-clemente/quic-go/crypto/cert_cache.go:
--------------------------------------------------------------------------------
1 | package crypto
2 |
3 | import (
4 | "fmt"
5 | "hash/fnv"
6 |
7 | "github.com/hashicorp/golang-lru"
8 | "github.com/lucas-clemente/quic-go/protocol"
9 | )
10 |
11 | var (
12 | compressedCertsCache *lru.Cache
13 | )
14 |
15 | func getCompressedCert(chain [][]byte, pCommonSetHashes, pCachedHashes []byte) ([]byte, error) {
16 | // Hash all inputs
17 | hasher := fnv.New64a()
18 | for _, v := range chain {
19 | hasher.Write(v)
20 | }
21 | hasher.Write(pCommonSetHashes)
22 | hasher.Write(pCachedHashes)
23 | hash := hasher.Sum64()
24 |
25 | var result []byte
26 |
27 | resultI, isCached := compressedCertsCache.Get(hash)
28 | if isCached {
29 | result = resultI.([]byte)
30 | } else {
31 | var err error
32 | result, err = compressChain(chain, pCommonSetHashes, pCachedHashes)
33 | if err != nil {
34 | return nil, err
35 | }
36 | compressedCertsCache.Add(hash, result)
37 | }
38 |
39 | return result, nil
40 | }
41 |
42 | func init() {
43 | var err error
44 | compressedCertsCache, err = lru.New(protocol.NumCachedCertificates)
45 | if err != nil {
46 | panic(fmt.Sprintf("fatal error in quic-go: could not create lru cache: %s", err.Error()))
47 | }
48 | }
49 |
--------------------------------------------------------------------------------
/vendor/github.com/dustin/go-humanize/LICENSE:
--------------------------------------------------------------------------------
1 | Copyright (c) 2005-2008 Dustin Sallings
2 |
3 | Permission is hereby granted, free of charge, to any person obtaining a copy
4 | of this software and associated documentation files (the "Software"), to deal
5 | in the Software without restriction, including without limitation the rights
6 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
7 | copies of the Software, and to permit persons to whom the Software is
8 | furnished to do so, subject to the following conditions:
9 |
10 | The above copyright notice and this permission notice shall be included in
11 | all copies or substantial portions of the Software.
12 |
13 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
14 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
15 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
16 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
17 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
18 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
19 | SOFTWARE.
20 |
21 |
22 |
--------------------------------------------------------------------------------
/vendor/google.golang.org/appengine/aetest/user.go:
--------------------------------------------------------------------------------
1 | package aetest
2 |
3 | import (
4 | "hash/crc32"
5 | "net/http"
6 | "strconv"
7 |
8 | "google.golang.org/appengine/user"
9 | )
10 |
11 | // Login causes the provided Request to act as though issued by the given user.
12 | func Login(u *user.User, req *http.Request) {
13 | req.Header.Set("X-AppEngine-User-Email", u.Email)
14 | id := u.ID
15 | if id == "" {
16 | id = strconv.Itoa(int(crc32.Checksum([]byte(u.Email), crc32.IEEETable)))
17 | }
18 | req.Header.Set("X-AppEngine-User-Id", id)
19 | req.Header.Set("X-AppEngine-User-Federated-Identity", u.Email)
20 | req.Header.Set("X-AppEngine-User-Federated-Provider", u.FederatedProvider)
21 | if u.Admin {
22 | req.Header.Set("X-AppEngine-User-Is-Admin", "1")
23 | } else {
24 | req.Header.Set("X-AppEngine-User-Is-Admin", "0")
25 | }
26 | }
27 |
28 | // Logout causes the provided Request to act as though issued by a logged-out
29 | // user.
30 | func Logout(req *http.Request) {
31 | req.Header.Del("X-AppEngine-User-Email")
32 | req.Header.Del("X-AppEngine-User-Id")
33 | req.Header.Del("X-AppEngine-User-Is-Admin")
34 | req.Header.Del("X-AppEngine-User-Federated-Identity")
35 | req.Header.Del("X-AppEngine-User-Federated-Provider")
36 | }
37 |
--------------------------------------------------------------------------------
/caddyhttp/markdown/metadata/metadata_toml.go:
--------------------------------------------------------------------------------
1 | package metadata
2 |
3 | import (
4 | "bytes"
5 |
6 | "github.com/naoina/toml"
7 | )
8 |
9 | // TOMLParser is the Parser for TOML
10 | type TOMLParser struct {
11 | metadata Metadata
12 | markdown *bytes.Buffer
13 | }
14 |
15 | // Type returns the kind of parser this struct is.
16 | func (t *TOMLParser) Type() string {
17 | return "TOML"
18 | }
19 |
20 | // Init prepares and parses the metadata and markdown file itself
21 | func (t *TOMLParser) Init(b *bytes.Buffer) bool {
22 | meta, data := splitBuffer(b, "+++")
23 | if meta == nil || data == nil {
24 | return false
25 | }
26 | t.markdown = data
27 |
28 | m := make(map[string]interface{})
29 | if err := toml.Unmarshal(meta.Bytes(), &m); err != nil {
30 | return false
31 | }
32 | t.metadata = NewMetadata(m)
33 |
34 | return true
35 | }
36 |
37 | // Metadata returns parsed metadata. It should be called
38 | // only after a call to Parse returns without error.
39 | func (t *TOMLParser) Metadata() Metadata {
40 | return t.metadata
41 | }
42 |
43 | // Markdown returns parser markdown. It should be called only after a call to Parse returns without error.
44 | func (t *TOMLParser) Markdown() []byte {
45 | return t.markdown.Bytes()
46 | }
47 |
--------------------------------------------------------------------------------
/vendor/github.com/xenolf/lego/acme/http_challenge.go:
--------------------------------------------------------------------------------
1 | package acme
2 |
3 | import (
4 | "fmt"
5 | "log"
6 | )
7 |
8 | type httpChallenge struct {
9 | jws *jws
10 | validate validateFunc
11 | provider ChallengeProvider
12 | }
13 |
14 | // HTTP01ChallengePath returns the URL path for the `http-01` challenge
15 | func HTTP01ChallengePath(token string) string {
16 | return "/.well-known/acme-challenge/" + token
17 | }
18 |
19 | func (s *httpChallenge) Solve(chlng challenge, domain string) error {
20 |
21 | logf("[INFO][%s] acme: Trying to solve HTTP-01", domain)
22 |
23 | // Generate the Key Authorization for the challenge
24 | keyAuth, err := getKeyAuthorization(chlng.Token, s.jws.privKey)
25 | if err != nil {
26 | return err
27 | }
28 |
29 | err = s.provider.Present(domain, chlng.Token, keyAuth)
30 | if err != nil {
31 | return fmt.Errorf("[%s] error presenting token: %v", domain, err)
32 | }
33 | defer func() {
34 | err := s.provider.CleanUp(domain, chlng.Token, keyAuth)
35 | if err != nil {
36 | log.Printf("[%s] error cleaning up: %v", domain, err)
37 | }
38 | }()
39 |
40 | return s.validate(s.jws, domain, chlng.URI, challenge{Resource: "challenge", Type: chlng.Type, Token: chlng.Token, KeyAuthorization: keyAuth})
41 | }
42 |
--------------------------------------------------------------------------------
/vendor/google.golang.org/appengine/internal/main_vm.go:
--------------------------------------------------------------------------------
1 | // Copyright 2011 Google Inc. All rights reserved.
2 | // Use of this source code is governed by the Apache 2.0
3 | // license that can be found in the LICENSE file.
4 |
5 | // +build !appengine
6 |
7 | package internal
8 |
9 | import (
10 | "io"
11 | "log"
12 | "net/http"
13 | "net/url"
14 | "os"
15 | )
16 |
17 | func Main() {
18 | installHealthChecker(http.DefaultServeMux)
19 |
20 | port := "8080"
21 | if s := os.Getenv("PORT"); s != "" {
22 | port = s
23 | }
24 |
25 | host := ""
26 | if IsDevAppServer() {
27 | host = "127.0.0.1"
28 | }
29 | if err := http.ListenAndServe(host+":"+port, http.HandlerFunc(handleHTTP)); err != nil {
30 | log.Fatalf("http.ListenAndServe: %v", err)
31 | }
32 | }
33 |
34 | func installHealthChecker(mux *http.ServeMux) {
35 | // If no health check handler has been installed by this point, add a trivial one.
36 | const healthPath = "/_ah/health"
37 | hreq := &http.Request{
38 | Method: "GET",
39 | URL: &url.URL{
40 | Path: healthPath,
41 | },
42 | }
43 | if _, pat := mux.Handler(hreq); pat != healthPath {
44 | mux.HandleFunc(healthPath, func(w http.ResponseWriter, r *http.Request) {
45 | io.WriteString(w, "ok")
46 | })
47 | }
48 | }
49 |
--------------------------------------------------------------------------------
/vendor/golang.org/x/sys/unix/sockcmsg_linux.go:
--------------------------------------------------------------------------------
1 | // Copyright 2011 The Go Authors. All rights reserved.
2 | // Use of this source code is governed by a BSD-style
3 | // license that can be found in the LICENSE file.
4 |
5 | // Socket control messages
6 |
7 | package unix
8 |
9 | import "unsafe"
10 |
11 | // UnixCredentials encodes credentials into a socket control message
12 | // for sending to another process. This can be used for
13 | // authentication.
14 | func UnixCredentials(ucred *Ucred) []byte {
15 | b := make([]byte, CmsgSpace(SizeofUcred))
16 | h := (*Cmsghdr)(unsafe.Pointer(&b[0]))
17 | h.Level = SOL_SOCKET
18 | h.Type = SCM_CREDENTIALS
19 | h.SetLen(CmsgLen(SizeofUcred))
20 | *((*Ucred)(cmsgData(h))) = *ucred
21 | return b
22 | }
23 |
24 | // ParseUnixCredentials decodes a socket control message that contains
25 | // credentials in a Ucred structure. To receive such a message, the
26 | // SO_PASSCRED option must be enabled on the socket.
27 | func ParseUnixCredentials(m *SocketControlMessage) (*Ucred, error) {
28 | if m.Header.Level != SOL_SOCKET {
29 | return nil, EINVAL
30 | }
31 | if m.Header.Type != SCM_CREDENTIALS {
32 | return nil, EINVAL
33 | }
34 | ucred := *(*Ucred)(unsafe.Pointer(&m.Data[0]))
35 | return &ucred, nil
36 | }
37 |
--------------------------------------------------------------------------------
/vendor/github.com/xenolf/lego/acme/provider.go:
--------------------------------------------------------------------------------
1 | package acme
2 |
3 | import "time"
4 |
5 | // ChallengeProvider enables implementing a custom challenge
6 | // provider. Present presents the solution to a challenge available to
7 | // be solved. CleanUp will be called by the challenge if Present ends
8 | // in a non-error state.
9 | type ChallengeProvider interface {
10 | Present(domain, token, keyAuth string) error
11 | CleanUp(domain, token, keyAuth string) error
12 | }
13 |
14 | // ChallengeProviderTimeout allows for implementing a
15 | // ChallengeProvider where an unusually long timeout is required when
16 | // waiting for an ACME challenge to be satisfied, such as when
17 | // checking for DNS record progagation. If an implementor of a
18 | // ChallengeProvider provides a Timeout method, then the return values
19 | // of the Timeout method will be used when appropriate by the acme
20 | // package. The interval value is the time between checks.
21 | //
22 | // The default values used for timeout and interval are 60 seconds and
23 | // 2 seconds respectively. These are used when no Timeout method is
24 | // defined for the ChallengeProvider.
25 | type ChallengeProviderTimeout interface {
26 | ChallengeProvider
27 | Timeout() (timeout, interval time.Duration)
28 | }
29 |
--------------------------------------------------------------------------------
/vendor/github.com/lucas-clemente/quic-go/flowcontrol/interface.go:
--------------------------------------------------------------------------------
1 | package flowcontrol
2 |
3 | import "github.com/lucas-clemente/quic-go/protocol"
4 |
5 | // WindowUpdate provides the data for WindowUpdateFrames.
6 | type WindowUpdate struct {
7 | StreamID protocol.StreamID
8 | Offset protocol.ByteCount
9 | }
10 |
11 | // A FlowControlManager manages the flow control
12 | type FlowControlManager interface {
13 | NewStream(streamID protocol.StreamID, contributesToConnectionFlow bool)
14 | RemoveStream(streamID protocol.StreamID)
15 | // methods needed for receiving data
16 | ResetStream(streamID protocol.StreamID, byteOffset protocol.ByteCount) error
17 | UpdateHighestReceived(streamID protocol.StreamID, byteOffset protocol.ByteCount) error
18 | AddBytesRead(streamID protocol.StreamID, n protocol.ByteCount) error
19 | GetWindowUpdates() []WindowUpdate
20 | GetReceiveWindow(streamID protocol.StreamID) (protocol.ByteCount, error)
21 | // methods needed for sending data
22 | AddBytesSent(streamID protocol.StreamID, n protocol.ByteCount) error
23 | SendWindowSize(streamID protocol.StreamID) (protocol.ByteCount, error)
24 | RemainingConnectionWindowSize() protocol.ByteCount
25 | UpdateWindow(streamID protocol.StreamID, offset protocol.ByteCount) (bool, error)
26 | }
27 |
--------------------------------------------------------------------------------
/vendor/gopkg.in/square/go-jose.v1/json/tags.go:
--------------------------------------------------------------------------------
1 | // Copyright 2011 The Go Authors. All rights reserved.
2 | // Use of this source code is governed by a BSD-style
3 | // license that can be found in the LICENSE file.
4 |
5 | package json
6 |
7 | import (
8 | "strings"
9 | )
10 |
11 | // tagOptions is the string following a comma in a struct field's "json"
12 | // tag, or the empty string. It does not include the leading comma.
13 | type tagOptions string
14 |
15 | // parseTag splits a struct field's json tag into its name and
16 | // comma-separated options.
17 | func parseTag(tag string) (string, tagOptions) {
18 | if idx := strings.Index(tag, ","); idx != -1 {
19 | return tag[:idx], tagOptions(tag[idx+1:])
20 | }
21 | return tag, tagOptions("")
22 | }
23 |
24 | // Contains reports whether a comma-separated list of options
25 | // contains a particular substr flag. substr must be surrounded by a
26 | // string boundary or commas.
27 | func (o tagOptions) Contains(optionName string) bool {
28 | if len(o) == 0 {
29 | return false
30 | }
31 | s := string(o)
32 | for s != "" {
33 | var next string
34 | i := strings.Index(s, ",")
35 | if i >= 0 {
36 | s, next = s[:i], s[i+1:]
37 | }
38 | if s == optionName {
39 | return true
40 | }
41 | s = next
42 | }
43 | return false
44 | }
45 |
--------------------------------------------------------------------------------
/caddy/caddymain/run_test.go:
--------------------------------------------------------------------------------
1 | package caddymain
2 |
3 | import (
4 | "runtime"
5 | "testing"
6 | )
7 |
8 | func TestSetCPU(t *testing.T) {
9 | currentCPU := runtime.GOMAXPROCS(-1)
10 | maxCPU := runtime.NumCPU()
11 | halfCPU := int(0.5 * float32(maxCPU))
12 | if halfCPU < 1 {
13 | halfCPU = 1
14 | }
15 | for i, test := range []struct {
16 | input string
17 | output int
18 | shouldErr bool
19 | }{
20 | {"1", 1, false},
21 | {"-1", currentCPU, true},
22 | {"0", currentCPU, true},
23 | {"100%", maxCPU, false},
24 | {"50%", halfCPU, false},
25 | {"110%", currentCPU, true},
26 | {"-10%", currentCPU, true},
27 | {"invalid input", currentCPU, true},
28 | {"invalid input%", currentCPU, true},
29 | {"9999", maxCPU, false}, // over available CPU
30 | } {
31 | err := setCPU(test.input)
32 | if test.shouldErr && err == nil {
33 | t.Errorf("Test %d: Expected error, but there wasn't any", i)
34 | }
35 | if !test.shouldErr && err != nil {
36 | t.Errorf("Test %d: Expected no error, but there was one: %v", i, err)
37 | }
38 | if actual, expected := runtime.GOMAXPROCS(-1), test.output; actual != expected {
39 | t.Errorf("Test %d: GOMAXPROCS was %d but expected %d", i, actual, expected)
40 | }
41 | // teardown
42 | runtime.GOMAXPROCS(currentCPU)
43 | }
44 | }
45 |
--------------------------------------------------------------------------------
/vendor/google.golang.org/appengine/errors.go:
--------------------------------------------------------------------------------
1 | // Copyright 2011 Google Inc. All rights reserved.
2 | // Use of this source code is governed by the Apache 2.0
3 | // license that can be found in the LICENSE file.
4 |
5 | // This file provides error functions for common API failure modes.
6 |
7 | package appengine
8 |
9 | import (
10 | "fmt"
11 |
12 | "google.golang.org/appengine/internal"
13 | )
14 |
15 | // IsOverQuota reports whether err represents an API call failure
16 | // due to insufficient available quota.
17 | func IsOverQuota(err error) bool {
18 | callErr, ok := err.(*internal.CallError)
19 | return ok && callErr.Code == 4
20 | }
21 |
22 | // MultiError is returned by batch operations when there are errors with
23 | // particular elements. Errors will be in a one-to-one correspondence with
24 | // the input elements; successful elements will have a nil entry.
25 | type MultiError []error
26 |
27 | func (m MultiError) Error() string {
28 | s, n := "", 0
29 | for _, e := range m {
30 | if e != nil {
31 | if n == 0 {
32 | s = e.Error()
33 | }
34 | n++
35 | }
36 | }
37 | switch n {
38 | case 0:
39 | return "(0 errors)"
40 | case 1:
41 | return s
42 | case 2:
43 | return s + " (and 1 other error)"
44 | }
45 | return fmt.Sprintf("%s (and %d other errors)", s, n-1)
46 | }
47 |
--------------------------------------------------------------------------------
/vendor/github.com/miekg/dns/rawmsg.go:
--------------------------------------------------------------------------------
1 | package dns
2 |
3 | import "encoding/binary"
4 |
5 | // rawSetRdlength sets the rdlength in the header of
6 | // the RR. The offset 'off' must be positioned at the
7 | // start of the header of the RR, 'end' must be the
8 | // end of the RR.
9 | func rawSetRdlength(msg []byte, off, end int) bool {
10 | l := len(msg)
11 | Loop:
12 | for {
13 | if off+1 > l {
14 | return false
15 | }
16 | c := int(msg[off])
17 | off++
18 | switch c & 0xC0 {
19 | case 0x00:
20 | if c == 0x00 {
21 | // End of the domainname
22 | break Loop
23 | }
24 | if off+c > l {
25 | return false
26 | }
27 | off += c
28 |
29 | case 0xC0:
30 | // pointer, next byte included, ends domainname
31 | off++
32 | break Loop
33 | }
34 | }
35 | // The domainname has been seen, we at the start of the fixed part in the header.
36 | // Type is 2 bytes, class is 2 bytes, ttl 4 and then 2 bytes for the length.
37 | off += 2 + 2 + 4
38 | if off+2 > l {
39 | return false
40 | }
41 | //off+1 is the end of the header, 'end' is the end of the rr
42 | //so 'end' - 'off+2' is the length of the rdata
43 | rdatalen := end - (off + 2)
44 | if rdatalen > 0xFFFF {
45 | return false
46 | }
47 | binary.BigEndian.PutUint16(msg[off:], uint16(rdatalen))
48 | return true
49 | }
50 |
--------------------------------------------------------------------------------
/caddyhttp/markdown/process_test.go:
--------------------------------------------------------------------------------
1 | package markdown
2 |
3 | import (
4 | "os"
5 | "strings"
6 | "testing"
7 |
8 | "github.com/WedgeServer/wedge/caddyhttp/httpserver"
9 | )
10 |
11 | func TestConfig_Markdown(t *testing.T) {
12 | tests := []map[string]string{
13 | {"author": "authorVal"},
14 | {"copyright": "copyrightVal"},
15 | {"description": "descriptionVal"},
16 | {"subject": "subjectVal"},
17 | {"author": "authorVal", "copyright": "copyrightVal"},
18 | {"author": "authorVal", "copyright": "copyrightVal", "description": "descriptionVal"},
19 | {"author": "authorVal", "copyright": "copyrightVal", "description": "descriptionVal", "subject": "subjectVal"},
20 | }
21 |
22 | for i, meta := range tests {
23 | config := &Config{
24 | Template: GetDefaultTemplate(),
25 | }
26 |
27 | toml := "+++"
28 | for key, val := range meta {
29 | toml = toml + "\n" + key + "= \"" + val + "\""
30 | }
31 | toml = toml + "\n+++"
32 |
33 | res, _ := config.Markdown("Test title", strings.NewReader(toml), []os.FileInfo{}, httpserver.Context{})
34 | sRes := string(res)
35 |
36 | for key, val := range meta {
37 | c := strings.Contains(sRes, "")
38 | if !c {
39 | t.Error("Test case", i, "should contain meta", key, val)
40 | }
41 | }
42 | }
43 | }
44 |
--------------------------------------------------------------------------------
/vendor/google.golang.org/appengine/user/user_vm.go:
--------------------------------------------------------------------------------
1 | // Copyright 2014 Google Inc. All rights reserved.
2 | // Use of this source code is governed by the Apache 2.0
3 | // license that can be found in the LICENSE file.
4 |
5 | // +build !appengine
6 |
7 | package user
8 |
9 | import (
10 | "golang.org/x/net/context"
11 |
12 | "google.golang.org/appengine/internal"
13 | )
14 |
15 | // Current returns the currently logged-in user,
16 | // or nil if the user is not signed in.
17 | func Current(c context.Context) *User {
18 | h := internal.IncomingHeaders(c)
19 | u := &User{
20 | Email: h.Get("X-AppEngine-User-Email"),
21 | AuthDomain: h.Get("X-AppEngine-Auth-Domain"),
22 | ID: h.Get("X-AppEngine-User-Id"),
23 | Admin: h.Get("X-AppEngine-User-Is-Admin") == "1",
24 | FederatedIdentity: h.Get("X-AppEngine-Federated-Identity"),
25 | FederatedProvider: h.Get("X-AppEngine-Federated-Provider"),
26 | }
27 | if u.Email == "" && u.FederatedIdentity == "" {
28 | return nil
29 | }
30 | return u
31 | }
32 |
33 | // IsAdmin returns true if the current user is signed in and
34 | // is currently registered as an administrator of the application.
35 | func IsAdmin(c context.Context) bool {
36 | h := internal.IncomingHeaders(c)
37 | return h.Get("X-AppEngine-User-Is-Admin") == "1"
38 | }
39 |
--------------------------------------------------------------------------------