├── .drone.yml
├── .gitignore
├── LICENSE
├── Makefile
├── README.md
├── images
└── logo.png
├── main.go
└── vendor
├── github.com
├── apex
│ └── gateway
│ │ ├── Readme.md
│ │ ├── gateway.go
│ │ ├── request.go
│ │ └── response.go
├── aws
│ └── aws-lambda-go
│ │ ├── LICENSE
│ │ ├── LICENSE-LAMBDACODE
│ │ ├── LICENSE-SUMMARY
│ │ ├── events
│ │ ├── README.md
│ │ ├── README_ApiGatewayEvent.md
│ │ ├── README_Cognito.md
│ │ ├── README_Config.md
│ │ ├── README_DynamoDB.md
│ │ ├── README_Kinesis.md
│ │ ├── README_KinesisFirehose.md
│ │ ├── README_S3.md
│ │ ├── README_SNS.md
│ │ ├── apigw.go
│ │ ├── attributevalue.go
│ │ ├── cloudwatch_logs.go
│ │ ├── cognito.go
│ │ ├── config.go
│ │ ├── dynamodb.go
│ │ ├── epoch_time.go
│ │ ├── firehose.go
│ │ ├── kinesis.go
│ │ ├── s3.go
│ │ └── sns.go
│ │ ├── lambda
│ │ ├── entry.go
│ │ ├── function.go
│ │ ├── handler.go
│ │ ├── messages
│ │ │ └── messages.go
│ │ └── panic.go
│ │ └── lambdacontext
│ │ └── context.go
├── gin-contrib
│ └── sse
│ │ ├── LICENSE
│ │ ├── README.md
│ │ ├── sse-decoder.go
│ │ ├── sse-encoder.go
│ │ └── writer.go
├── gin-gonic
│ └── gin
│ │ ├── AUTHORS.md
│ │ ├── BENCHMARKS.md
│ │ ├── CHANGELOG.md
│ │ ├── CODE_OF_CONDUCT.md
│ │ ├── CONTRIBUTING.md
│ │ ├── LICENSE
│ │ ├── Makefile
│ │ ├── README.md
│ │ ├── auth.go
│ │ ├── binding
│ │ ├── binding.go
│ │ ├── default_validator.go
│ │ ├── form.go
│ │ ├── form_mapping.go
│ │ ├── json.go
│ │ ├── msgpack.go
│ │ ├── protobuf.go
│ │ ├── query.go
│ │ └── xml.go
│ │ ├── codecov.yml
│ │ ├── context.go
│ │ ├── context_appengine.go
│ │ ├── debug.go
│ │ ├── deprecated.go
│ │ ├── doc.go
│ │ ├── errors.go
│ │ ├── fs.go
│ │ ├── gin.go
│ │ ├── json
│ │ ├── json.go
│ │ └── jsoniter.go
│ │ ├── logger.go
│ │ ├── mode.go
│ │ ├── path.go
│ │ ├── recovery.go
│ │ ├── render
│ │ ├── data.go
│ │ ├── html.go
│ │ ├── json.go
│ │ ├── msgpack.go
│ │ ├── redirect.go
│ │ ├── render.go
│ │ ├── text.go
│ │ ├── xml.go
│ │ └── yaml.go
│ │ ├── response_writer.go
│ │ ├── routergroup.go
│ │ ├── test_helpers.go
│ │ ├── tree.go
│ │ ├── utils.go
│ │ └── wercker.yml
├── golang
│ └── protobuf
│ │ ├── LICENSE
│ │ └── proto
│ │ ├── Makefile
│ │ ├── clone.go
│ │ ├── decode.go
│ │ ├── encode.go
│ │ ├── equal.go
│ │ ├── extensions.go
│ │ ├── lib.go
│ │ ├── message_set.go
│ │ ├── pointer_reflect.go
│ │ ├── pointer_unsafe.go
│ │ ├── properties.go
│ │ ├── text.go
│ │ └── text_parser.go
├── json-iterator
│ └── go
│ │ ├── Gopkg.lock
│ │ ├── Gopkg.toml
│ │ ├── LICENSE
│ │ ├── README.md
│ │ ├── build.sh
│ │ ├── feature_adapter.go
│ │ ├── feature_any.go
│ │ ├── feature_any_array.go
│ │ ├── feature_any_bool.go
│ │ ├── feature_any_float.go
│ │ ├── feature_any_int32.go
│ │ ├── feature_any_int64.go
│ │ ├── feature_any_invalid.go
│ │ ├── feature_any_nil.go
│ │ ├── feature_any_number.go
│ │ ├── feature_any_object.go
│ │ ├── feature_any_string.go
│ │ ├── feature_any_uint32.go
│ │ ├── feature_any_uint64.go
│ │ ├── feature_config.go
│ │ ├── feature_iter.go
│ │ ├── feature_iter_array.go
│ │ ├── feature_iter_float.go
│ │ ├── feature_iter_int.go
│ │ ├── feature_iter_object.go
│ │ ├── feature_iter_skip.go
│ │ ├── feature_iter_skip_sloppy.go
│ │ ├── feature_iter_skip_strict.go
│ │ ├── feature_iter_string.go
│ │ ├── feature_json_number.go
│ │ ├── feature_pool.go
│ │ ├── feature_reflect.go
│ │ ├── feature_reflect_array.go
│ │ ├── feature_reflect_extension.go
│ │ ├── feature_reflect_map.go
│ │ ├── feature_reflect_native.go
│ │ ├── feature_reflect_object.go
│ │ ├── feature_reflect_optional.go
│ │ ├── feature_reflect_slice.go
│ │ ├── feature_reflect_struct_decoder.go
│ │ ├── feature_stream.go
│ │ ├── feature_stream_float.go
│ │ ├── feature_stream_int.go
│ │ ├── feature_stream_string.go
│ │ ├── fuzzy_mode_convert_table.md
│ │ ├── jsoniter.go
│ │ └── test.sh
├── mattn
│ └── go-isatty
│ │ ├── LICENSE
│ │ ├── README.md
│ │ ├── doc.go
│ │ ├── isatty_appengine.go
│ │ ├── isatty_bsd.go
│ │ ├── isatty_linux.go
│ │ ├── isatty_linux_ppc64x.go
│ │ ├── isatty_others.go
│ │ ├── isatty_solaris.go
│ │ └── isatty_windows.go
├── pkg
│ └── errors
│ │ ├── LICENSE
│ │ ├── README.md
│ │ ├── appveyor.yml
│ │ ├── errors.go
│ │ └── stack.go
└── ugorji
│ └── go
│ ├── LICENSE
│ └── codec
│ ├── 0doc.go
│ ├── README.md
│ ├── binc.go
│ ├── cbor.go
│ ├── decode.go
│ ├── encode.go
│ ├── fast-path.generated.go
│ ├── fast-path.go.tmpl
│ ├── fast-path.not.go
│ ├── gen-dec-array.go.tmpl
│ ├── gen-dec-map.go.tmpl
│ ├── gen-helper.generated.go
│ ├── gen-helper.go.tmpl
│ ├── gen.generated.go
│ ├── gen.go
│ ├── goversion_arrayof_gte_go15.go
│ ├── goversion_arrayof_lt_go15.go
│ ├── goversion_makemap_gte_go19.go
│ ├── goversion_makemap_lt_go19.go
│ ├── goversion_unexportedembeddedptr_gte_go110.go
│ ├── goversion_unexportedembeddedptr_lt_go110.go
│ ├── goversion_unsupported_lt_go14.go
│ ├── goversion_vendor_eq_go15.go
│ ├── goversion_vendor_eq_go16.go
│ ├── goversion_vendor_gte_go17.go
│ ├── goversion_vendor_lt_go15.go
│ ├── helper.go
│ ├── helper_internal.go
│ ├── helper_not_unsafe.go
│ ├── helper_unsafe.go
│ ├── json.go
│ ├── mammoth-test.go.tmpl
│ ├── mammoth2-test.go.tmpl
│ ├── msgpack.go
│ ├── rpc.go
│ ├── simple.go
│ ├── test-cbor-goldens.json
│ └── test.py
├── golang.org
└── x
│ └── sys
│ ├── LICENSE
│ ├── PATENTS
│ └── unix
│ ├── README.md
│ ├── affinity_linux.go
│ ├── asm_darwin_386.s
│ ├── asm_darwin_amd64.s
│ ├── asm_darwin_arm.s
│ ├── asm_darwin_arm64.s
│ ├── asm_dragonfly_amd64.s
│ ├── asm_freebsd_386.s
│ ├── asm_freebsd_amd64.s
│ ├── asm_freebsd_arm.s
│ ├── asm_linux_386.s
│ ├── asm_linux_amd64.s
│ ├── asm_linux_arm.s
│ ├── asm_linux_arm64.s
│ ├── asm_linux_mips64x.s
│ ├── asm_linux_mipsx.s
│ ├── asm_linux_ppc64x.s
│ ├── asm_linux_s390x.s
│ ├── asm_netbsd_386.s
│ ├── asm_netbsd_amd64.s
│ ├── asm_netbsd_arm.s
│ ├── asm_openbsd_386.s
│ ├── asm_openbsd_amd64.s
│ ├── asm_openbsd_arm.s
│ ├── asm_solaris_amd64.s
│ ├── bluetooth_linux.go
│ ├── cap_freebsd.go
│ ├── constants.go
│ ├── dev_darwin.go
│ ├── dev_dragonfly.go
│ ├── dev_freebsd.go
│ ├── dev_linux.go
│ ├── dev_netbsd.go
│ ├── dev_openbsd.go
│ ├── dirent.go
│ ├── endian_big.go
│ ├── endian_little.go
│ ├── env_unix.go
│ ├── errors_freebsd_386.go
│ ├── errors_freebsd_amd64.go
│ ├── errors_freebsd_arm.go
│ ├── flock.go
│ ├── flock_linux_32bit.go
│ ├── gccgo.go
│ ├── gccgo_c.c
│ ├── gccgo_linux_amd64.go
│ ├── mkall.sh
│ ├── mkerrors.sh
│ ├── mksyscall.pl
│ ├── mksyscall_solaris.pl
│ ├── mksysctl_openbsd.pl
│ ├── mksysnum_darwin.pl
│ ├── mksysnum_dragonfly.pl
│ ├── mksysnum_freebsd.pl
│ ├── mksysnum_netbsd.pl
│ ├── mksysnum_openbsd.pl
│ ├── openbsd_pledge.go
│ ├── pagesize_unix.go
│ ├── race.go
│ ├── race0.go
│ ├── sockcmsg_linux.go
│ ├── sockcmsg_unix.go
│ ├── str.go
│ ├── syscall.go
│ ├── syscall_bsd.go
│ ├── syscall_darwin.go
│ ├── syscall_darwin_386.go
│ ├── syscall_darwin_amd64.go
│ ├── syscall_darwin_arm.go
│ ├── syscall_darwin_arm64.go
│ ├── syscall_dragonfly.go
│ ├── syscall_dragonfly_amd64.go
│ ├── syscall_freebsd.go
│ ├── syscall_freebsd_386.go
│ ├── syscall_freebsd_amd64.go
│ ├── syscall_freebsd_arm.go
│ ├── syscall_linux.go
│ ├── syscall_linux_386.go
│ ├── syscall_linux_amd64.go
│ ├── syscall_linux_amd64_gc.go
│ ├── syscall_linux_arm.go
│ ├── syscall_linux_arm64.go
│ ├── syscall_linux_mips64x.go
│ ├── syscall_linux_mipsx.go
│ ├── syscall_linux_ppc64x.go
│ ├── syscall_linux_s390x.go
│ ├── syscall_linux_sparc64.go
│ ├── syscall_netbsd.go
│ ├── syscall_netbsd_386.go
│ ├── syscall_netbsd_amd64.go
│ ├── syscall_netbsd_arm.go
│ ├── syscall_openbsd.go
│ ├── syscall_openbsd_386.go
│ ├── syscall_openbsd_amd64.go
│ ├── syscall_openbsd_arm.go
│ ├── syscall_solaris.go
│ ├── syscall_solaris_amd64.go
│ ├── syscall_unix.go
│ ├── syscall_unix_gc.go
│ ├── timestruct.go
│ ├── zerrors_darwin_386.go
│ ├── zerrors_darwin_amd64.go
│ ├── zerrors_darwin_arm.go
│ ├── zerrors_darwin_arm64.go
│ ├── zerrors_dragonfly_amd64.go
│ ├── zerrors_freebsd_386.go
│ ├── zerrors_freebsd_amd64.go
│ ├── zerrors_freebsd_arm.go
│ ├── zerrors_linux_386.go
│ ├── zerrors_linux_amd64.go
│ ├── zerrors_linux_arm.go
│ ├── zerrors_linux_arm64.go
│ ├── zerrors_linux_mips.go
│ ├── zerrors_linux_mips64.go
│ ├── zerrors_linux_mips64le.go
│ ├── zerrors_linux_mipsle.go
│ ├── zerrors_linux_ppc64.go
│ ├── zerrors_linux_ppc64le.go
│ ├── zerrors_linux_s390x.go
│ ├── zerrors_linux_sparc64.go
│ ├── zerrors_netbsd_386.go
│ ├── zerrors_netbsd_amd64.go
│ ├── zerrors_netbsd_arm.go
│ ├── zerrors_openbsd_386.go
│ ├── zerrors_openbsd_amd64.go
│ ├── zerrors_openbsd_arm.go
│ ├── zerrors_solaris_amd64.go
│ ├── zptrace386_linux.go
│ ├── zptracearm_linux.go
│ ├── zptracemips_linux.go
│ ├── zptracemipsle_linux.go
│ ├── zsyscall_darwin_386.go
│ ├── zsyscall_darwin_amd64.go
│ ├── zsyscall_darwin_arm.go
│ ├── zsyscall_darwin_arm64.go
│ ├── zsyscall_dragonfly_amd64.go
│ ├── zsyscall_freebsd_386.go
│ ├── zsyscall_freebsd_amd64.go
│ ├── zsyscall_freebsd_arm.go
│ ├── zsyscall_linux_386.go
│ ├── zsyscall_linux_amd64.go
│ ├── zsyscall_linux_arm.go
│ ├── zsyscall_linux_arm64.go
│ ├── zsyscall_linux_mips.go
│ ├── zsyscall_linux_mips64.go
│ ├── zsyscall_linux_mips64le.go
│ ├── zsyscall_linux_mipsle.go
│ ├── zsyscall_linux_ppc64.go
│ ├── zsyscall_linux_ppc64le.go
│ ├── zsyscall_linux_s390x.go
│ ├── zsyscall_linux_sparc64.go
│ ├── zsyscall_netbsd_386.go
│ ├── zsyscall_netbsd_amd64.go
│ ├── zsyscall_netbsd_arm.go
│ ├── zsyscall_openbsd_386.go
│ ├── zsyscall_openbsd_amd64.go
│ ├── zsyscall_openbsd_arm.go
│ ├── zsyscall_solaris_amd64.go
│ ├── zsysctl_openbsd_386.go
│ ├── zsysctl_openbsd_amd64.go
│ ├── zsysctl_openbsd_arm.go
│ ├── zsysnum_darwin_386.go
│ ├── zsysnum_darwin_amd64.go
│ ├── zsysnum_darwin_arm.go
│ ├── zsysnum_darwin_arm64.go
│ ├── zsysnum_dragonfly_amd64.go
│ ├── zsysnum_freebsd_386.go
│ ├── zsysnum_freebsd_amd64.go
│ ├── zsysnum_freebsd_arm.go
│ ├── zsysnum_linux_386.go
│ ├── zsysnum_linux_amd64.go
│ ├── zsysnum_linux_arm.go
│ ├── zsysnum_linux_arm64.go
│ ├── zsysnum_linux_mips.go
│ ├── zsysnum_linux_mips64.go
│ ├── zsysnum_linux_mips64le.go
│ ├── zsysnum_linux_mipsle.go
│ ├── zsysnum_linux_ppc64.go
│ ├── zsysnum_linux_ppc64le.go
│ ├── zsysnum_linux_s390x.go
│ ├── zsysnum_linux_sparc64.go
│ ├── zsysnum_netbsd_386.go
│ ├── zsysnum_netbsd_amd64.go
│ ├── zsysnum_netbsd_arm.go
│ ├── zsysnum_openbsd_386.go
│ ├── zsysnum_openbsd_amd64.go
│ ├── zsysnum_openbsd_arm.go
│ ├── ztypes_darwin_386.go
│ ├── ztypes_darwin_amd64.go
│ ├── ztypes_darwin_arm.go
│ ├── ztypes_darwin_arm64.go
│ ├── ztypes_dragonfly_amd64.go
│ ├── ztypes_freebsd_386.go
│ ├── ztypes_freebsd_amd64.go
│ ├── ztypes_freebsd_arm.go
│ ├── ztypes_linux_386.go
│ ├── ztypes_linux_amd64.go
│ ├── ztypes_linux_arm.go
│ ├── ztypes_linux_arm64.go
│ ├── ztypes_linux_mips.go
│ ├── ztypes_linux_mips64.go
│ ├── ztypes_linux_mips64le.go
│ ├── ztypes_linux_mipsle.go
│ ├── ztypes_linux_ppc64.go
│ ├── ztypes_linux_ppc64le.go
│ ├── ztypes_linux_s390x.go
│ ├── ztypes_linux_sparc64.go
│ ├── ztypes_netbsd_386.go
│ ├── ztypes_netbsd_amd64.go
│ ├── ztypes_netbsd_arm.go
│ ├── ztypes_openbsd_386.go
│ ├── ztypes_openbsd_amd64.go
│ ├── ztypes_openbsd_arm.go
│ └── ztypes_solaris_amd64.go
├── gopkg.in
├── go-playground
│ └── validator.v8
│ │ ├── LICENSE
│ │ ├── README.md
│ │ ├── baked_in.go
│ │ ├── cache.go
│ │ ├── doc.go
│ │ ├── logo.png
│ │ ├── regexes.go
│ │ ├── util.go
│ │ └── validator.go
└── yaml.v2
│ ├── LICENSE
│ ├── LICENSE.libyaml
│ ├── README.md
│ ├── apic.go
│ ├── decode.go
│ ├── emitterc.go
│ ├── encode.go
│ ├── parserc.go
│ ├── readerc.go
│ ├── resolve.go
│ ├── scannerc.go
│ ├── sorter.go
│ ├── writerc.go
│ ├── yaml.go
│ ├── yamlh.go
│ └── yamlprivateh.go
└── vendor.json
/.drone.yml:
--------------------------------------------------------------------------------
1 | workspace:
2 | base: /go/src
3 | path: github.com/appleboy/gin-lambda
4 |
5 | pipeline:
6 | build:
7 | image: golang:1.9.4
8 | commands:
9 | - GOOS=linux go build -o main .
10 |
11 | lambda:
12 | image: appleboy/drone-lambda
13 | pull: true
14 | secrets: [ aws_access_key_id, aws_secret_access_key ]
15 | region: ap-southeast-1
16 | function_name: gin
17 | source:
18 | - main
19 |
20 | discord:
21 | image: appleboy/drone-discord
22 | pull: true
23 | secrets: [ discord_webhook_id, discord_webhook_token ]
24 | when:
25 | status: [ success, failure ]
26 |
--------------------------------------------------------------------------------
/.gitignore:
--------------------------------------------------------------------------------
1 | # Binaries for programs and plugins
2 | *.exe
3 | *.dll
4 | *.so
5 | *.dylib
6 |
7 | # Test binary, build with `go test -c`
8 | *.test
9 |
10 | # Output of the go coverage tool, specifically when used with LiteIDE
11 | *.out
12 |
13 | # Project-local glide cache, RE: https://github.com/Masterminds/glide/issues/736
14 | .glide/
15 |
16 | main
17 | deployment.zip
18 | target.txt
19 |
--------------------------------------------------------------------------------
/LICENSE:
--------------------------------------------------------------------------------
1 | MIT License
2 |
3 | Copyright (c) 2018 Bo-Yi Wu
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 |
--------------------------------------------------------------------------------
/Makefile:
--------------------------------------------------------------------------------
1 |
2 | all:
3 | go build -v -o main .
4 |
5 | build:
6 | GOOS=linux go build -o main .
7 |
8 | zip: build
9 | zip deployment.zip main
10 |
--------------------------------------------------------------------------------
/images/logo.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/appleboy/gin-lambda/75413372c9965294e73f6de0f2952a49c18d3d56/images/logo.png
--------------------------------------------------------------------------------
/main.go:
--------------------------------------------------------------------------------
1 | package main
2 |
3 | import (
4 | "log"
5 | "net/http"
6 | "os"
7 |
8 | "github.com/apex/gateway"
9 | "github.com/gin-gonic/gin"
10 | )
11 |
12 | func helloHandler(c *gin.Context) {
13 | name := c.Param("name")
14 | c.String(http.StatusOK, "Hello %s", name)
15 | }
16 |
17 | func welcomeHandler(c *gin.Context) {
18 | c.String(http.StatusOK, "Hello World from Go")
19 | }
20 |
21 | func rootHandler(c *gin.Context) {
22 | c.JSON(http.StatusOK, gin.H{
23 | "text": "Welcome to gin lambda server.",
24 | })
25 | }
26 |
27 | func routerEngine() *gin.Engine {
28 | // set server mode
29 | gin.SetMode(gin.DebugMode)
30 |
31 | r := gin.New()
32 |
33 | // Global middleware
34 | r.Use(gin.Logger())
35 | r.Use(gin.Recovery())
36 |
37 | r.GET("/welcome", welcomeHandler)
38 | r.GET("/user/:name", helloHandler)
39 | r.GET("/", rootHandler)
40 |
41 | return r
42 | }
43 |
44 | func main() {
45 | port := os.Getenv("PORT")
46 | mode := os.Getenv("MODE")
47 | if port == "" {
48 | port = "8080"
49 | }
50 | addr := ":" + port
51 | log.Println("=======================================")
52 | log.Println("Runinng gin-lambda server in " + addr)
53 | log.Println("=======================================")
54 | if mode == "production" {
55 | log.Fatal(gateway.ListenAndServe(addr, routerEngine()))
56 | } else {
57 | log.Fatal(http.ListenAndServe(addr, routerEngine()))
58 | }
59 | }
60 |
--------------------------------------------------------------------------------
/vendor/github.com/apex/gateway/Readme.md:
--------------------------------------------------------------------------------
1 |
2 |
3 | Package gateway provides a drop-in replacement for net/http's `ListenAndServe` for use in AWS Lambda & API Gateway, simply swap it out for `gateway.ListenAndServe`. Extracted from [Up](https://github.com/apex/up) which provides additional middleware features and operational functionality.
4 |
5 | ```go
6 | package main
7 |
8 | import (
9 | "fmt"
10 | "log"
11 | "net/http"
12 | "os"
13 |
14 | "github.com/apex/gateway"
15 | )
16 |
17 | func main() {
18 | addr := ":" + os.Getenv("PORT")
19 | http.HandleFunc("/", hello)
20 | log.Fatal(gateway.ListenAndServe(addr, nil))
21 | }
22 |
23 | func hello(w http.ResponseWriter, r *http.Request) {
24 | fmt.Fprintln(w, "Hello World from Go")
25 | }
26 | ```
27 |
28 | ---
29 |
30 | [](https://godoc.org/github.com/apex/gateway)
31 | 
32 | 
33 |
34 |
35 |
--------------------------------------------------------------------------------
/vendor/github.com/apex/gateway/gateway.go:
--------------------------------------------------------------------------------
1 | // Package gateway provides a drop-in replacement for net/http.ListenAndServe for use in AWS Lambda & API Gateway.
2 | package gateway
3 |
4 | import (
5 | "context"
6 | "net/http"
7 |
8 | "github.com/aws/aws-lambda-go/events"
9 | "github.com/aws/aws-lambda-go/lambda"
10 | )
11 |
12 | // ListenAndServe is a drop-in replacement for
13 | // http.ListenAndServe for use within AWS Lambda.
14 | //
15 | // ListenAndServe always returns a non-nil error.
16 | func ListenAndServe(addr string, h http.Handler) error {
17 | if h == nil {
18 | h = http.DefaultServeMux
19 | }
20 |
21 | lambda.Start(func(ctx context.Context, e events.APIGatewayProxyRequest) (events.APIGatewayProxyResponse, error) {
22 | r, err := NewRequest(ctx, e)
23 | if err != nil {
24 | return events.APIGatewayProxyResponse{}, err
25 | }
26 |
27 | w := NewResponse()
28 | h.ServeHTTP(w, r)
29 | return w.End(), nil
30 | })
31 |
32 | return nil
33 | }
34 |
--------------------------------------------------------------------------------
/vendor/github.com/apex/gateway/request.go:
--------------------------------------------------------------------------------
1 | package gateway
2 |
3 | import (
4 | "context"
5 | "encoding/base64"
6 | "fmt"
7 | "net/http"
8 | "net/url"
9 | "strconv"
10 | "strings"
11 |
12 | "github.com/aws/aws-lambda-go/events"
13 | "github.com/pkg/errors"
14 | )
15 |
16 | // NewRequest returns a new http.Request from the given Lambda event.
17 | func NewRequest(ctx context.Context, e events.APIGatewayProxyRequest) (*http.Request, error) {
18 | // path
19 | u, err := url.Parse(e.Path)
20 | if err != nil {
21 | return nil, errors.Wrap(err, "parsing path")
22 | }
23 |
24 | // querystring
25 | q := u.Query()
26 | for k, v := range e.QueryStringParameters {
27 | q.Set(k, v)
28 | }
29 | u.RawQuery = q.Encode()
30 |
31 | // base64 encoded body
32 | body := e.Body
33 | if e.IsBase64Encoded {
34 | b, err := base64.StdEncoding.DecodeString(body)
35 | if err != nil {
36 | return nil, errors.Wrap(err, "decoding base64 body")
37 | }
38 | body = string(b)
39 | }
40 |
41 | // new request
42 | req, err := http.NewRequest(e.HTTPMethod, u.String(), strings.NewReader(body))
43 | if err != nil {
44 | return nil, errors.Wrap(err, "creating request")
45 | }
46 |
47 | // remote addr
48 | req.RemoteAddr = e.RequestContext.Identity.SourceIP
49 |
50 | // header fields
51 | for k, v := range e.Headers {
52 | req.Header.Set(k, v)
53 | }
54 |
55 | // content-length
56 | if req.Header.Get("Content-Length") == "" && body != "" {
57 | req.Header.Set("Content-Length", strconv.Itoa(len(body)))
58 | }
59 |
60 | // custom fields
61 | req.Header.Set("X-Request-Id", e.RequestContext.RequestID)
62 | req.Header.Set("X-Stage", e.RequestContext.Stage)
63 |
64 | // xray support
65 | if traceID := ctx.Value("x-amzn-trace-id"); traceID != nil {
66 | req.Header.Set("X-Amzn-Trace-Id", fmt.Sprintf("%v", traceID))
67 | }
68 |
69 | // host
70 | req.URL.Host = req.Header.Get("Host")
71 | req.Host = req.URL.Host
72 |
73 | return req, nil
74 | }
75 |
--------------------------------------------------------------------------------
/vendor/github.com/aws/aws-lambda-go/LICENSE-LAMBDACODE:
--------------------------------------------------------------------------------
1 | MIT No Attribution
2 |
3 | Permission is hereby granted, free of charge, to any person obtaining a copy of this
4 | software and associated documentation files (the "Software"), to deal in the Software
5 | without restriction, including without limitation the rights to use, copy, modify,
6 | merge, publish, distribute, sublicense, and/or sell copies of the Software, and to
7 | permit persons to whom the Software is furnished to do so.
8 |
9 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,
10 | INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A
11 | PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
12 | HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
13 | OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
14 | SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
15 |
16 |
--------------------------------------------------------------------------------
/vendor/github.com/aws/aws-lambda-go/LICENSE-SUMMARY:
--------------------------------------------------------------------------------
1 | Copyright 2017 Amazon.com, Inc. or its affiliates. All Rights Reserved.
2 |
3 | Lambda functions are made available under a modified MIT license.
4 | See LICENSE-LAMBDACODE for details.
5 |
6 | The remainder of the project is made available under the terms of the
7 | Apache License, version 2.0. See LICENSE for details.
8 |
--------------------------------------------------------------------------------
/vendor/github.com/aws/aws-lambda-go/events/README.md:
--------------------------------------------------------------------------------
1 | # Overview
2 |
3 | This package provides input types for Lambda functions that process AWS events.
4 |
5 | # Samples
6 |
7 | [API Gateway](README_ApiGatewayEvent.md)
8 |
9 | [Cognito Events](README_Cognito.md)
10 |
11 | [Config Events](README_Config.md)
12 |
13 | [DynamoDB Events](README_DynamoDB.md)
14 |
15 | [Kinesis Events](README_Kinesis.md)
16 |
17 | [Kinesis Firehose Events](README_KinesisFirehose.md)
18 |
19 | [S3 Events](README_S3.md)
20 |
21 | [SNS Events](README_SNS.md)
22 |
--------------------------------------------------------------------------------
/vendor/github.com/aws/aws-lambda-go/events/README_ApiGatewayEvent.md:
--------------------------------------------------------------------------------
1 | # Overview
2 |
3 | API Gateway events consist of a request that was routed to a Lambda function by API Gateway. When this happens, API Gateway expects the result of the function to be the response that API Gateway should respond with.
4 |
5 | # Sample Function
6 |
7 | The following is a sample class and Lambda function that receives Amazon API Gateway event record data as an input, writes some of the record data to CloudWatch Logs, and responds with a 200 status and the same body as the request. (Note that by default anything written to Console will be logged as CloudWatch Logs events.)
8 |
9 | ```go
10 |
11 | package main
12 |
13 | import (
14 | "context"
15 | "fmt"
16 |
17 | "github.com/aws/aws-lambda-go/events"
18 | "github.com/aws/aws-lambda-go/lambda"
19 | )
20 |
21 | func handleRequest(ctx context.Context, request events.APIGatewayProxyRequest) (events.APIGatewayProxyResponse, error) {
22 | fmt.Printf("Processing request data for request %s.\n", request.RequestContext.RequestID)
23 | fmt.Printf("Body size = %d.\n", len(request.Body))
24 |
25 | fmt.Println("Headers:")
26 | for key, value := range request.Headers {
27 | fmt.Printf(" %s: %s\n", key, value)
28 | }
29 |
30 | return events.APIGatewayProxyResponse{Body: request.Body, StatusCode: 200}, nil
31 | }
32 |
33 | func main() {
34 | lambda.Start(handleRequest)
35 | }
36 | ```
37 |
--------------------------------------------------------------------------------
/vendor/github.com/aws/aws-lambda-go/events/README_Cognito.md:
--------------------------------------------------------------------------------
1 | # Sample Function
2 |
3 | The following is a sample Lambda function that receives Amazon Cognito event record data as an input and writes some of the record data to CloudWatch Logs. (Note that by default anything written to Console will be logged as CloudWatch Logs events.)
4 |
5 | ```go
6 |
7 | import (
8 | "strings"
9 | "github.com/aws/aws-lambda-go/events"
10 | )
11 |
12 | func handleRequest(ctx context.Context, cognitoEvent events.CognitoEvent) {
13 | for datasetName, datasetRecord := range cognitoEvent.DatasetRecords {
14 | fmt.Printf("[%s -- %s] %s -> %s -> %s \n",
15 | cognitoEvent.EventType,
16 | datasetName,
17 | datasetRecord.OldValue,
18 | datasetRecord.Op,
19 | datasetRecord.NewValue)
20 | }
21 | }
22 | ```
23 |
--------------------------------------------------------------------------------
/vendor/github.com/aws/aws-lambda-go/events/README_Config.md:
--------------------------------------------------------------------------------
1 | # Sample Function
2 |
3 | The following is a sample Lambda function that receives Amazon Config event record data as an input and writes some of the record data to CloudWatch Logs. (Note that by default anything written to Console will be logged as CloudWatch Logs events.)
4 |
5 | ```go
6 |
7 | import (
8 | "strings"
9 | "github.com/aws/aws-lambda-go/events"
10 | )
11 |
12 | func handleRequest(ctx context.Context, configEvent events.ConfigEvent) {
13 | fmt.Printf("AWS Config rule: %s\n", configEvent.ConfigRuleName)
14 | fmt.Printf("Invoking event JSON: %s\n", configEvent.InvokingEvent)
15 | fmt.Printf("Event version: %s\n", configEvent.Version)
16 | }
17 |
18 | ```
19 |
--------------------------------------------------------------------------------
/vendor/github.com/aws/aws-lambda-go/events/README_Kinesis.md:
--------------------------------------------------------------------------------
1 | # Sample Function
2 |
3 | The following is a sample class and Lambda function that receives Amazon Kinesis event record data as an input and writes some of the record data to CloudWatch Logs. (Note that by default anything written to Console will be logged as CloudWatch Logs events.)
4 |
5 | ```go
6 |
7 | import (
8 | "strings"
9 | "github.com/aws/aws-lambda-go/events")
10 |
11 | func handler(ctx context.Context, kinesisEvent events.KinesisEvent) {
12 | for _, record := range kinesisEvent.Records {
13 | kinesisRecord := record.Kinesis
14 | dataBytes := kinesisRecordData.Data
15 | dataText := string(dataBytes)
16 |
17 | fmt.Printf("%s Data = %s \n", record.EventName, dataText)
18 | }
19 | }
20 |
21 | ```
22 |
--------------------------------------------------------------------------------
/vendor/github.com/aws/aws-lambda-go/events/README_KinesisFirehose.md:
--------------------------------------------------------------------------------
1 | # Sample Function
2 |
3 | The following is a sample Lambda function that transforms Kinesis Firehose records by doing a ToUpper on the data.
4 |
5 | ```go
6 |
7 | import (
8 | "fmt"
9 | "strings"
10 | "github.com/aws/aws-lambda-go/events"
11 | )
12 |
13 | func handleRequest(evnt events.KinesisFirehoseEvent) events.KinesisFirehoseResponse {
14 |
15 | fmt.Printf("InvocationId: %s\n", evnt.InvocationId)
16 | fmt.Printf("DeliveryStreamArn: %s\n", evnt.DeliveryStreamArn)
17 | fmt.Printf("Region: %s\n", evnt.Region)
18 |
19 | var response events.KinesisFirehoseResponse
20 |
21 | for _, record := range evnt.Records {
22 | fmt.Printf("RecordId: %s\n", record.RecordId)
23 | fmt.Printf("ApproximateArrivalTimestamp: %s\n", record.ApproximateArrivalTimestamp)
24 |
25 | // Transform data: ToUpper the data
26 | var transformedRecord kinesisfhevents.FirehoseResponseRecord
27 | transformedRecord.RecordId = record.RecordId
28 | transformedRecord.Result = kinesisfhevents.TransformedStateOk
29 | transformedRecord.Data = strings.ToUpper(string(record.Data))
30 |
31 | response.Records = append(response.Records, transformedRecord)
32 | }
33 |
34 | return response
35 | }
36 | ```
37 |
--------------------------------------------------------------------------------
/vendor/github.com/aws/aws-lambda-go/events/README_S3.md:
--------------------------------------------------------------------------------
1 | # Sample Function
2 |
3 | The following is a sample class and Lambda function that receives Amazon S3 event record data as an input and writes some of the record data to CloudWatch Logs. (Note that by default anything written to Console will be logged as CloudWatch Logs events.)
4 |
5 | ```go
6 |
7 | import (
8 | "strings"
9 | "github.com/aws/aws-lambda-go/events")
10 |
11 | func handler(ctx context.Context, s3Event events.S3Event) {
12 | for _, record := range s3Event.Records {
13 | s3 := record.S3
14 | fmt.Printf("[%s - %s] Bucket = %s, Key = %s \n", record.EventSource, record.EventTime, s3.Bucket.Name, s3.Object.Key)
15 | }
16 | }
17 |
18 | ```
19 |
--------------------------------------------------------------------------------
/vendor/github.com/aws/aws-lambda-go/events/README_SNS.md:
--------------------------------------------------------------------------------
1 |
2 | # Sample Function
3 |
4 | The following is a sample class and Lambda function that receives Amazon SNS event record data as input, writes some of the record data to CloudWatch Logs, and responds with a 200 status and the same body as the request. (Note that by default anything written to Console will be logged as CloudWatch Logs events.)
5 |
6 | ```go
7 | import (
8 | "context"
9 | "fmt"
10 |
11 | "github.com/aws/aws-lambda-go/events"
12 | )
13 |
14 | func handler(ctx context.Context, snsEvent events.SNSEvent) {
15 | for _, record := range snsEvent.Records {
16 | snsRecord := record.SNS
17 |
18 | fmt.Printf("[%s %s] Message = %s \n", record.EventSource, snsRecord.Timestamp, snsRecord.Message)
19 | }
20 | }
21 | ```
22 |
--------------------------------------------------------------------------------
/vendor/github.com/aws/aws-lambda-go/events/cloudwatch_logs.go:
--------------------------------------------------------------------------------
1 | package events
2 |
3 | // CloudwatchLogsEvent represents raw data from a cloudwatch logs event
4 | type CloudwatchLogsEvent struct {
5 | AWSLogs CloudwatchLogsRawData `json:"awslogs"`
6 | }
7 |
8 | // CloudwatchLogsRawData contains gzipped base64 json representing the bulk
9 | // of a cloudwatch logs event
10 | type CloudwatchLogsRawData struct {
11 | Data string `json:"data"`
12 | }
13 |
--------------------------------------------------------------------------------
/vendor/github.com/aws/aws-lambda-go/events/cognito.go:
--------------------------------------------------------------------------------
1 | // Copyright 2017 Amazon.com, Inc. or its affiliates. All Rights Reserved.
2 |
3 | package events
4 |
5 | // CognitoEvent contains data from an event sent from AWS Cognito
6 | type CognitoEvent struct {
7 | DatasetName string `json:"datasetName"`
8 | DatasetRecords map[string]CognitoDatasetRecord `json:"datasetRecords"`
9 | EventType string `json:"eventType"`
10 | IdentityID string `json:"identityId"`
11 | IdentityPoolID string `json:"identityPoolId"`
12 | Region string `json:"region"`
13 | Version int `json:"version"`
14 | }
15 |
16 | // CognitoDatasetRecord represents a record from an AWS Cognito event
17 | type CognitoDatasetRecord struct {
18 | NewValue string `json:"newValue"`
19 | OldValue string `json:"oldValue"`
20 | Op string `json:"op"`
21 | }
22 |
--------------------------------------------------------------------------------
/vendor/github.com/aws/aws-lambda-go/events/config.go:
--------------------------------------------------------------------------------
1 | // Copyright 2017 Amazon.com, Inc. or its affiliates. All Rights Reserved.
2 |
3 | package events
4 |
5 | // ConfigEvent contains data from an event sent from AWS Config
6 | type ConfigEvent struct {
7 | AccountID string `json:"accountId"` // The ID of the AWS account that owns the rule
8 | ConfigRuleArn string `json:"configRuleArn"` // The ARN that AWS Config assigned to the rule
9 | ConfigRuleID string `json:"configRuleId"`
10 | ConfigRuleName string `json:"configRuleName"` // The name that you assigned to the rule that caused AWS Config to publish the event
11 | EventLeftScope bool `json:"eventLeftScope"` // A boolean value that indicates whether the AWS resource to be evaluated has been removed from the rule's scope
12 | ExecutionRoleArn string `json:"executionRoleArn"`
13 | InvokingEvent string `json:"invokingEvent"` // If the event is published in response to a resource configuration change, this value contains a JSON configuration item
14 | ResultToken string `json:"resultToken"` // A token that the function must pass to AWS Config with the PutEvaluations call
15 | RuleParameters string `json:"ruleParameters"` // Key/value pairs that the function processes as part of its evaluation logic
16 | Version string `json:"version"`
17 | }
18 |
--------------------------------------------------------------------------------
/vendor/github.com/aws/aws-lambda-go/events/epoch_time.go:
--------------------------------------------------------------------------------
1 | // Copyright 2017 Amazon.com, Inc. or its affiliates. All Rights Reserved.
2 |
3 | package events
4 |
5 | import (
6 | "encoding/json"
7 | "time"
8 | )
9 |
10 | // SecondsEpochTime serializes a time.Time in JSON as a UNIX epoch time in seconds
11 | type SecondsEpochTime struct {
12 | time.Time
13 | }
14 |
15 | // MilliSecondsEpochTime serializes a time.Time in JSON as a UNIX epoch time in milliseconds.
16 | type MilliSecondsEpochTime struct {
17 | time.Time
18 | }
19 |
20 | const secondsToNanoSecondsFactor = 1000000000
21 | const milliSecondsToNanoSecondsFactor = 1000000
22 |
23 | func (e SecondsEpochTime) MarshalJSON() ([]byte, error) {
24 | // UnixNano() returns the epoch in nanoseconds
25 | unixTime := float64(e.UnixNano()) / float64(secondsToNanoSecondsFactor)
26 | return json.Marshal(unixTime)
27 | }
28 |
29 | func (e *SecondsEpochTime) UnmarshalJSON(b []byte) error {
30 | var epoch float64
31 | err := json.Unmarshal(b, &epoch)
32 | if err != nil {
33 | return err
34 | }
35 |
36 | epochSec := int64(epoch)
37 | epochNano := int64((epoch - float64(epochSec)) * float64(secondsToNanoSecondsFactor))
38 |
39 | // time.Unix(sec, nsec) expects the epoch integral seconds in the first parameter
40 | // and remaining nanoseconds in the second parameter
41 | *e = SecondsEpochTime{time.Unix(epochSec, epochNano)}
42 | return nil
43 | }
44 |
45 | func (e MilliSecondsEpochTime) MarshalJSON() ([]byte, error) {
46 | // UnixNano() returns the epoch in nanoseconds
47 | unixTimeMs := e.UnixNano() / milliSecondsToNanoSecondsFactor
48 | return json.Marshal(unixTimeMs)
49 | }
50 |
51 | func (e *MilliSecondsEpochTime) UnmarshalJSON(b []byte) error {
52 | var epoch int64
53 | err := json.Unmarshal(b, &epoch)
54 | if err != nil {
55 | return err
56 | }
57 | *e = MilliSecondsEpochTime{time.Unix(epoch/1000, (epoch%1000)*1000000)}
58 | return nil
59 | }
60 |
--------------------------------------------------------------------------------
/vendor/github.com/aws/aws-lambda-go/events/firehose.go:
--------------------------------------------------------------------------------
1 | // Copyright 2017 Amazon.com, Inc. or its affiliates. All Rights Reserved.
2 |
3 | package events
4 |
5 | // KinesisFirehoseEvent represents the input event from Amazon Kinesis Firehose. It is used as the input parameter.
6 | type KinesisFirehoseEvent struct {
7 | InvocationID string `json:"invocationId"`
8 | DeliveryStreamArn string `json:"deliveryStreamArn"`
9 | Region string `json:"region"`
10 | Records []KinesisFirehoseEventRecord `json:"records"`
11 | }
12 |
13 | type KinesisFirehoseEventRecord struct {
14 | RecordID string `json:"recordId"`
15 | ApproximateArrivalTimestamp MilliSecondsEpochTime `json:"approximateArrivalTimestamp"`
16 | Data []byte `json:"data"`
17 | }
18 |
19 | // Constants used for describing the transformation result
20 | const (
21 | KinesisFirehoseTransformedStateOk = "TRANSFORMED_STATE_OK"
22 | KinesisFirehoseTransformedStateDropped = "TRANSFORMED_STATE_DROPPED"
23 | KinesisFirehoseTransformedStateProcessingFailed = "TRANSFORMED_STATE_PROCESSINGFAILED"
24 | )
25 |
26 | type KinesisFirehoseResponse struct {
27 | Records []KinesisFirehoseResponseRecord `json:"records"`
28 | }
29 |
30 | type KinesisFirehoseResponseRecord struct {
31 | RecordID string `json:"recordId"`
32 | Result string `json:"result"` // The status of the transformation. May be TransformedStateOk, TransformedStateDropped or TransformedStateProcessingFailed
33 | Data []byte `json:"data"`
34 | }
35 |
--------------------------------------------------------------------------------
/vendor/github.com/aws/aws-lambda-go/events/kinesis.go:
--------------------------------------------------------------------------------
1 | // Copyright 2017 Amazon.com, Inc. or its affiliates. All Rights Reserved.
2 |
3 | package events
4 |
5 | type KinesisEvent struct {
6 | Records []KinesisEventRecord `json:"Records"`
7 | }
8 |
9 | type KinesisEventRecord struct {
10 | AwsRegion string `json:"awsRegion"`
11 | EventID string `json:"eventID"`
12 | EventName string `json:"eventName"`
13 | EventSource string `json:"eventSource"`
14 | EventSourceArn string `json:"eventSourceARN"`
15 | EventVersion string `json:"eventVersion"`
16 | InvokeIdentityArn string `json:"invokeIdentityArn"`
17 | Kinesis KinesisRecord `json:"kinesis"`
18 | }
19 |
20 | type KinesisRecord struct {
21 | ApproximateArrivalTimestamp SecondsEpochTime `json:"approximateArrivalTimestamp"`
22 | Data []byte `json:"data"`
23 | EncryptionType string `json:"encryptionType,omitempty"`
24 | PartitionKey string `json:"partitionKey"`
25 | SequenceNumber string `json:"sequenceNumber"`
26 | KinesisSchemaVersion string `json:"kinesisSchemaVersion"`
27 | }
28 |
--------------------------------------------------------------------------------
/vendor/github.com/aws/aws-lambda-go/events/s3.go:
--------------------------------------------------------------------------------
1 | // Copyright 2017 Amazon.com, Inc. or its affiliates. All Rights Reserved.
2 |
3 | package events
4 |
5 | import (
6 | "time"
7 | )
8 |
9 | type S3Event struct {
10 | Records []S3EventRecord `json:"Records"`
11 | }
12 |
13 | type S3EventRecord struct {
14 | EventVersion string `json:"eventVersion"`
15 | EventSource string `json:"eventSource"`
16 | AWSRegion string `json:"awsRegion"`
17 | EventTime time.Time `json:"eventTime"`
18 | EventName string `json:"eventName"`
19 | PrincipalID S3UserIdentity `json:"userIdentity"`
20 | RequestParameters S3RequestParameters `json:"requestParameters"`
21 | ResponseElements map[string]string `json:"responseElements"`
22 | S3 S3Entity `json:"s3"`
23 | }
24 |
25 | type S3UserIdentity struct {
26 | PrincipalID string `json:"principalId"`
27 | }
28 |
29 | type S3RequestParameters struct {
30 | SourceIPAddress string `json:"sourceIPAddress"`
31 | }
32 |
33 | type S3Entity struct {
34 | SchemaVersion string `json:"s3SchemaVersion"`
35 | ConfigurationID string `json:"configurationId"`
36 | Bucket S3Bucket `json:"bucket"`
37 | Object S3Object `json:"object"`
38 | }
39 |
40 | type S3Bucket struct {
41 | Name string `json:"name"`
42 | OwnerIdentity S3UserIdentity `json:"ownerIdentity"`
43 | Arn string `json:"arn"`
44 | }
45 |
46 | type S3Object struct {
47 | Key string `json:"key"`
48 | Size int64 `json:"size"`
49 | URLDecodedKey string `json:"urlDecodedKey"`
50 | VersionID string `json:"versionId"`
51 | ETag string `json:"eTag"`
52 | Sequencer string `json:"sequencer"`
53 | }
54 |
--------------------------------------------------------------------------------
/vendor/github.com/aws/aws-lambda-go/events/sns.go:
--------------------------------------------------------------------------------
1 | // Copyright 2017 Amazon.com, Inc. or its affiliates. All Rights Reserved.
2 |
3 | package events
4 |
5 | import (
6 | "time"
7 | )
8 |
9 | type SNSEvent struct {
10 | Records []SNSEventRecord `json:"Records"`
11 | }
12 |
13 | type SNSEventRecord struct {
14 | EventVersion string `json:"EventVersion"`
15 | EventSubscriptionArn string `json:"EventSubscriptionArn"`
16 | EventSource string `json:"EventSource"`
17 | SNS SNSEntity `json:"Sns"`
18 | }
19 |
20 | type SNSEntity struct {
21 | Signature string `json:"Signature"`
22 | MessageID string `json:"MessageId"`
23 | Type string `json:"Type"`
24 | TopicArn string `json:"TopicArn"`
25 | MessageAttributes map[string]interface{} `json:"MessageAttributes"`
26 | SignatureVersion string `json:"SignatureVersion"`
27 | Timestamp time.Time `json:"Timestamp"`
28 | SigningCertURL string `json:"SigningCertUrl"`
29 | Message string `json:"Message"`
30 | UnsubscribeURL string `json:"UnsubscribeUrl"`
31 | Subject string `json:"Subject"`
32 | }
33 |
--------------------------------------------------------------------------------
/vendor/github.com/aws/aws-lambda-go/lambda/entry.go:
--------------------------------------------------------------------------------
1 | // Copyright 2017 Amazon.com, Inc. or its affiliates. All Rights Reserved.
2 |
3 | package lambda
4 |
5 | import (
6 | "fmt"
7 | "log"
8 | "net"
9 | "net/rpc"
10 | "os"
11 | )
12 |
13 | // Start takes a handler, and talks to and internal Lambda endpoint to pass Invoke requests to the handler. If a
14 | // handler does not match one of the supported types, the lambda package will respond to new invokes served by in
15 | // internal endpoint with an appropriate error message. Start blocks, and does not return after being called.
16 | //
17 | // Rules:
18 | // * handler must be a function
19 | // * handler may take between 0 and two arguments.
20 | // * If there are two arguments, the first argument must implement "context.Context".
21 | // * handler may return between 0 and two arguments.
22 | // * If there are two return values, the second argument must implement "error".
23 | // * If there is one return value it must implement "error".
24 | //
25 | // func ()
26 | // func () error
27 | // func (TIn) error
28 | // func () (TOut, error)
29 | // func (TIn) (TOut, error)
30 | // func (context.Context) error
31 | // func (context.Context, TIn) error
32 | // func (context.Context) (TOut, error)
33 | // func (context.Context, TIn) (TOut, error)
34 | //
35 | // Where '''TIn''' and '''TOut''' are types compatible with the ''encoding/json'' standard library.
36 | // See https://golang.org/pkg/encoding/json/#Unmarshal for how deserialization behaves
37 | func Start(handler interface{}) {
38 | port := os.Getenv("_LAMBDA_SERVER_PORT")
39 | lis, err := net.Listen("tcp", fmt.Sprintf("localhost:%s", port))
40 | if err != nil {
41 | log.Fatal(err)
42 | }
43 | wrappedHandler := newHandler(handler)
44 | function := new(Function)
45 | function.handler = wrappedHandler
46 | err = rpc.Register(function)
47 | if err != nil {
48 | log.Fatal("failed to register handler function")
49 | }
50 | rpc.Accept(lis)
51 | log.Fatal("accept should not have returned")
52 | }
53 |
--------------------------------------------------------------------------------
/vendor/github.com/aws/aws-lambda-go/lambda/function.go:
--------------------------------------------------------------------------------
1 | // Copyright 2017 Amazon.com, Inc. or its affiliates. All Rights Reserved.
2 |
3 | package lambda
4 |
5 | import (
6 | "context"
7 | "encoding/json"
8 | "reflect"
9 | "time"
10 |
11 | "github.com/aws/aws-lambda-go/lambda/messages"
12 | "github.com/aws/aws-lambda-go/lambdacontext"
13 | )
14 |
15 | type Function struct {
16 | handler lambdaHandler
17 | }
18 |
19 | func (fn *Function) Ping(req *messages.PingRequest, response *messages.PingResponse) error {
20 | *response = messages.PingResponse{}
21 | return nil
22 | }
23 |
24 | func (fn *Function) Invoke(req *messages.InvokeRequest, response *messages.InvokeResponse) error {
25 | defer func() {
26 | if err := recover(); err != nil {
27 | panicInfo := getPanicInfo(err)
28 | response.Error = &messages.InvokeResponse_Error{
29 | Message: panicInfo.Message,
30 | Type: getErrorType(err),
31 | StackTrace: panicInfo.StackTrace,
32 | ShouldExit: true,
33 | }
34 | }
35 | }()
36 |
37 | deadline := time.Unix(req.Deadline.Seconds, req.Deadline.Nanos).UTC()
38 | invokeContext, cancel := context.WithDeadline(context.Background(), deadline)
39 | defer cancel()
40 |
41 | lc := &lambdacontext.LambdaContext{
42 | AwsRequestID: req.RequestId,
43 | InvokedFunctionArn: req.InvokedFunctionArn,
44 | }
45 | if len(req.ClientContext) > 0 {
46 | if err := json.Unmarshal(req.ClientContext, &lc.ClientContext); err != nil {
47 | response.Error = lambdaErrorResponse(err)
48 | return nil
49 | }
50 | }
51 | invokeContext = lambdacontext.NewContext(invokeContext, lc)
52 |
53 | invokeContext = context.WithValue(invokeContext, "x-amzn-trace-id", req.XAmznTraceId)
54 |
55 | payload, err := fn.handler.Invoke(invokeContext, req.Payload)
56 | if err != nil {
57 | response.Error = lambdaErrorResponse(err)
58 | return nil
59 | }
60 | response.Payload = payload
61 | return nil
62 | }
63 |
64 | func getErrorType(err interface{}) string {
65 | errorType := reflect.TypeOf(err)
66 | if errorType.Kind() == reflect.Ptr {
67 | return errorType.Elem().Name()
68 | }
69 | return errorType.Name()
70 | }
71 |
72 | func lambdaErrorResponse(invokeError error) *messages.InvokeResponse_Error {
73 | var errorName string
74 | if errorType := reflect.TypeOf(invokeError); errorType.Kind() == reflect.Ptr {
75 | errorName = errorType.Elem().Name()
76 | } else {
77 | errorName = errorType.Name()
78 | }
79 | return &messages.InvokeResponse_Error{
80 | Message: invokeError.Error(),
81 | Type: errorName,
82 | }
83 | }
84 |
--------------------------------------------------------------------------------
/vendor/github.com/aws/aws-lambda-go/lambda/messages/messages.go:
--------------------------------------------------------------------------------
1 | // Copyright 2017 Amazon.com, Inc. or its affiliates. All Rights Reserved.
2 |
3 | package messages
4 |
5 | type PingRequest struct {
6 | }
7 |
8 | type PingResponse struct {
9 | }
10 |
11 | type InvokeRequest_Timestamp struct {
12 | Seconds int64
13 | Nanos int64
14 | }
15 |
16 | type InvokeRequest struct {
17 | Payload []byte
18 | RequestId string
19 | XAmznTraceId string
20 | Deadline InvokeRequest_Timestamp
21 | InvokedFunctionArn string
22 | CognitoIdentityId string
23 | CognitoIdentityPoolId string
24 | ClientContext []byte
25 | }
26 |
27 | type InvokeResponse struct {
28 | Payload []byte
29 | Error *InvokeResponse_Error
30 | }
31 |
32 | type InvokeResponse_Error struct {
33 | Message string
34 | Type string
35 | StackTrace []*InvokeResponse_Error_StackFrame
36 | ShouldExit bool
37 | }
38 |
39 | type InvokeResponse_Error_StackFrame struct {
40 | Path string `json:"path"`
41 | Line int32 `json:"line"`
42 | Label string `json:"label"`
43 | }
44 |
--------------------------------------------------------------------------------
/vendor/github.com/gin-contrib/sse/LICENSE:
--------------------------------------------------------------------------------
1 | The MIT License (MIT)
2 |
3 | Copyright (c) 2014 Manuel Martínez-Almeida
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/gin-contrib/sse/README.md:
--------------------------------------------------------------------------------
1 | # Server-Sent Events
2 |
3 | [](https://godoc.org/github.com/gin-contrib/sse)
4 | [](https://travis-ci.org/gin-contrib/sse)
5 | [](https://codecov.io/gh/gin-contrib/sse)
6 | [](https://goreportcard.com/report/github.com/gin-contrib/sse)
7 |
8 | Server-sent events (SSE) is a technology where a browser receives automatic updates from a server via HTTP connection. The Server-Sent Events EventSource API is [standardized as part of HTML5[1] by the W3C](http://www.w3.org/TR/2009/WD-eventsource-20091029/).
9 |
10 | - [Read this great SSE introduction by the HTML5Rocks guys](http://www.html5rocks.com/en/tutorials/eventsource/basics/)
11 | - [Browser support](http://caniuse.com/#feat=eventsource)
12 |
13 | ## Sample code
14 |
15 | ```go
16 | import "github.com/gin-contrib/sse"
17 |
18 | func httpHandler(w http.ResponseWriter, req *http.Request) {
19 | // data can be a primitive like a string, an integer or a float
20 | sse.Encode(w, sse.Event{
21 | Event: "message",
22 | Data: "some data\nmore data",
23 | })
24 |
25 | // also a complex type, like a map, a struct or a slice
26 | sse.Encode(w, sse.Event{
27 | Id: "124",
28 | Event: "message",
29 | Data: map[string]interface{}{
30 | "user": "manu",
31 | "date": time.Now().Unix(),
32 | "content": "hi!",
33 | },
34 | })
35 | }
36 | ```
37 | ```
38 | event: message
39 | data: some data\\nmore data
40 |
41 | id: 124
42 | event: message
43 | data: {"content":"hi!","date":1431540810,"user":"manu"}
44 |
45 | ```
46 |
47 | ## Content-Type
48 |
49 | ```go
50 | fmt.Println(sse.ContentType)
51 | ```
52 | ```
53 | text/event-stream
54 | ```
55 |
56 | ## Decoding support
57 |
58 | There is a client-side implementation of SSE coming soon.
59 |
--------------------------------------------------------------------------------
/vendor/github.com/gin-contrib/sse/writer.go:
--------------------------------------------------------------------------------
1 | package sse
2 |
3 | import "io"
4 |
5 | type stringWriter interface {
6 | io.Writer
7 | WriteString(string) (int, error)
8 | }
9 |
10 | type stringWrapper struct {
11 | io.Writer
12 | }
13 |
14 | func (w stringWrapper) WriteString(str string) (int, error) {
15 | return w.Writer.Write([]byte(str))
16 | }
17 |
18 | func checkWriter(writer io.Writer) stringWriter {
19 | if w, ok := writer.(stringWriter); ok {
20 | return w
21 | } else {
22 | return stringWrapper{writer}
23 | }
24 | }
25 |
--------------------------------------------------------------------------------
/vendor/github.com/gin-gonic/gin/CONTRIBUTING.md:
--------------------------------------------------------------------------------
1 | ## Contributing
2 |
3 | - With issues:
4 | - Use the search tool before opening a new issue.
5 | - Please provide source code and commit sha if you found a bug.
6 | - Review existing issues and provide feedback or react to them.
7 |
8 | - With pull requests:
9 | - Open your pull request against `master`
10 | - Your pull request should have no more than two commits, if not you should squash them.
11 | - It should pass all tests in the available continuous integrations systems such as TravisCI.
12 | - You should add/modify tests to cover your proposed code changes.
13 | - If your pull request contains a new feature, please document it on the README.
14 |
--------------------------------------------------------------------------------
/vendor/github.com/gin-gonic/gin/LICENSE:
--------------------------------------------------------------------------------
1 | The MIT License (MIT)
2 |
3 | Copyright (c) 2014 Manuel Martínez-Almeida
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/gin-gonic/gin/Makefile:
--------------------------------------------------------------------------------
1 | GOFMT ?= gofmt "-s"
2 | PACKAGES ?= $(shell go list ./... | grep -v /vendor/)
3 | GOFILES := $(shell find . -name "*.go" -type f -not -path "./vendor/*")
4 |
5 | all: build
6 |
7 | install: deps
8 | govendor sync
9 |
10 | .PHONY: test
11 | test:
12 | go test -v -covermode=count -coverprofile=coverage.out
13 |
14 | .PHONY: fmt
15 | fmt:
16 | $(GOFMT) -w $(GOFILES)
17 |
18 | .PHONY: fmt-check
19 | fmt-check:
20 | # get all go files and run go fmt on them
21 | @diff=$$($(GOFMT) -d $(GOFILES)); \
22 | if [ -n "$$diff" ]; then \
23 | echo "Please run 'make fmt' and commit the result:"; \
24 | echo "$${diff}"; \
25 | exit 1; \
26 | fi;
27 |
28 | vet:
29 | go vet $(PACKAGES)
30 |
31 | deps:
32 | @hash govendor > /dev/null 2>&1; if [ $$? -ne 0 ]; then \
33 | go get -u github.com/kardianos/govendor; \
34 | fi
35 | @hash embedmd > /dev/null 2>&1; if [ $$? -ne 0 ]; then \
36 | go get -u github.com/campoy/embedmd; \
37 | fi
38 |
39 | embedmd:
40 | embedmd -d *.md
41 |
42 | .PHONY: lint
43 | lint:
44 | @hash golint > /dev/null 2>&1; if [ $$? -ne 0 ]; then \
45 | go get -u github.com/golang/lint/golint; \
46 | fi
47 | for PKG in $(PACKAGES); do golint -set_exit_status $$PKG || exit 1; done;
48 |
49 | .PHONY: misspell-check
50 | misspell-check:
51 | @hash misspell > /dev/null 2>&1; if [ $$? -ne 0 ]; then \
52 | go get -u github.com/client9/misspell/cmd/misspell; \
53 | fi
54 | misspell -error $(GOFILES)
55 |
56 | .PHONY: misspell
57 | misspell:
58 | @hash misspell > /dev/null 2>&1; if [ $$? -ne 0 ]; then \
59 | go get -u github.com/client9/misspell/cmd/misspell; \
60 | fi
61 | misspell -w $(GOFILES)
62 |
--------------------------------------------------------------------------------
/vendor/github.com/gin-gonic/gin/binding/default_validator.go:
--------------------------------------------------------------------------------
1 | // Copyright 2017 Manu Martinez-Almeida. All rights reserved.
2 | // Use of this source code is governed by a MIT style
3 | // license that can be found in the LICENSE file.
4 |
5 | package binding
6 |
7 | import (
8 | "reflect"
9 | "sync"
10 |
11 | "gopkg.in/go-playground/validator.v8"
12 | )
13 |
14 | type defaultValidator struct {
15 | once sync.Once
16 | validate *validator.Validate
17 | }
18 |
19 | var _ StructValidator = &defaultValidator{}
20 |
21 | func (v *defaultValidator) ValidateStruct(obj interface{}) error {
22 | if kindOfData(obj) == reflect.Struct {
23 | v.lazyinit()
24 | if err := v.validate.Struct(obj); err != nil {
25 | return error(err)
26 | }
27 | }
28 | return nil
29 | }
30 |
31 | func (v *defaultValidator) RegisterValidation(key string, fn validator.Func) error {
32 | v.lazyinit()
33 | return v.validate.RegisterValidation(key, fn)
34 | }
35 |
36 | func (v *defaultValidator) lazyinit() {
37 | v.once.Do(func() {
38 | config := &validator.Config{TagName: "binding"}
39 | v.validate = validator.New(config)
40 | })
41 | }
42 |
43 | func kindOfData(data interface{}) reflect.Kind {
44 | value := reflect.ValueOf(data)
45 | valueType := value.Kind()
46 | if valueType == reflect.Ptr {
47 | valueType = value.Elem().Kind()
48 | }
49 | return valueType
50 | }
51 |
--------------------------------------------------------------------------------
/vendor/github.com/gin-gonic/gin/binding/form.go:
--------------------------------------------------------------------------------
1 | // Copyright 2014 Manu Martinez-Almeida. All rights reserved.
2 | // Use of this source code is governed by a MIT style
3 | // license that can be found in the LICENSE file.
4 |
5 | package binding
6 |
7 | import "net/http"
8 |
9 | const defaultMemory = 32 * 1024 * 1024
10 |
11 | type formBinding struct{}
12 | type formPostBinding struct{}
13 | type formMultipartBinding struct{}
14 |
15 | func (formBinding) Name() string {
16 | return "form"
17 | }
18 |
19 | func (formBinding) Bind(req *http.Request, obj interface{}) error {
20 | if err := req.ParseForm(); err != nil {
21 | return err
22 | }
23 | req.ParseMultipartForm(defaultMemory)
24 | if err := mapForm(obj, req.Form); err != nil {
25 | return err
26 | }
27 | return validate(obj)
28 | }
29 |
30 | func (formPostBinding) Name() string {
31 | return "form-urlencoded"
32 | }
33 |
34 | func (formPostBinding) Bind(req *http.Request, obj interface{}) error {
35 | if err := req.ParseForm(); err != nil {
36 | return err
37 | }
38 | if err := mapForm(obj, req.PostForm); err != nil {
39 | return err
40 | }
41 | return validate(obj)
42 | }
43 |
44 | func (formMultipartBinding) Name() string {
45 | return "multipart/form-data"
46 | }
47 |
48 | func (formMultipartBinding) Bind(req *http.Request, obj interface{}) error {
49 | if err := req.ParseMultipartForm(defaultMemory); err != nil {
50 | return err
51 | }
52 | if err := mapForm(obj, req.MultipartForm.Value); err != nil {
53 | return err
54 | }
55 | return validate(obj)
56 | }
57 |
--------------------------------------------------------------------------------
/vendor/github.com/gin-gonic/gin/binding/json.go:
--------------------------------------------------------------------------------
1 | // Copyright 2014 Manu Martinez-Almeida. All rights reserved.
2 | // Use of this source code is governed by a MIT style
3 | // license that can be found in the LICENSE file.
4 |
5 | package binding
6 |
7 | import (
8 | "net/http"
9 |
10 | "github.com/gin-gonic/gin/json"
11 | )
12 |
13 | var EnableDecoderUseNumber = false
14 |
15 | type jsonBinding struct{}
16 |
17 | func (jsonBinding) Name() string {
18 | return "json"
19 | }
20 |
21 | func (jsonBinding) Bind(req *http.Request, obj interface{}) error {
22 | decoder := json.NewDecoder(req.Body)
23 | if EnableDecoderUseNumber {
24 | decoder.UseNumber()
25 | }
26 | if err := decoder.Decode(obj); err != nil {
27 | return err
28 | }
29 | return validate(obj)
30 | }
31 |
--------------------------------------------------------------------------------
/vendor/github.com/gin-gonic/gin/binding/msgpack.go:
--------------------------------------------------------------------------------
1 | // Copyright 2017 Manu Martinez-Almeida. All rights reserved.
2 | // Use of this source code is governed by a MIT style
3 | // license that can be found in the LICENSE file.
4 |
5 | package binding
6 |
7 | import (
8 | "net/http"
9 |
10 | "github.com/ugorji/go/codec"
11 | )
12 |
13 | type msgpackBinding struct{}
14 |
15 | func (msgpackBinding) Name() string {
16 | return "msgpack"
17 | }
18 |
19 | func (msgpackBinding) Bind(req *http.Request, obj interface{}) error {
20 | if err := codec.NewDecoder(req.Body, new(codec.MsgpackHandle)).Decode(&obj); err != nil {
21 | return err
22 | }
23 | return validate(obj)
24 | }
25 |
--------------------------------------------------------------------------------
/vendor/github.com/gin-gonic/gin/binding/protobuf.go:
--------------------------------------------------------------------------------
1 | // Copyright 2014 Manu Martinez-Almeida. All rights reserved.
2 | // Use of this source code is governed by a MIT style
3 | // license that can be found in the LICENSE file.
4 |
5 | package binding
6 |
7 | import (
8 | "io/ioutil"
9 | "net/http"
10 |
11 | "github.com/golang/protobuf/proto"
12 | )
13 |
14 | type protobufBinding struct{}
15 |
16 | func (protobufBinding) Name() string {
17 | return "protobuf"
18 | }
19 |
20 | func (protobufBinding) Bind(req *http.Request, obj interface{}) error {
21 |
22 | buf, err := ioutil.ReadAll(req.Body)
23 | if err != nil {
24 | return err
25 | }
26 |
27 | if err = proto.Unmarshal(buf, obj.(proto.Message)); err != nil {
28 | return err
29 | }
30 |
31 | //Here it's same to return validate(obj), but util now we cann't add `binding:""` to the struct
32 | //which automatically generate by gen-proto
33 | return nil
34 | //return validate(obj)
35 | }
36 |
--------------------------------------------------------------------------------
/vendor/github.com/gin-gonic/gin/binding/query.go:
--------------------------------------------------------------------------------
1 | // Copyright 2017 Manu Martinez-Almeida. All rights reserved.
2 | // Use of this source code is governed by a MIT style
3 | // license that can be found in the LICENSE file.
4 |
5 | package binding
6 |
7 | import "net/http"
8 |
9 | type queryBinding struct{}
10 |
11 | func (queryBinding) Name() string {
12 | return "query"
13 | }
14 |
15 | func (queryBinding) Bind(req *http.Request, obj interface{}) error {
16 | values := req.URL.Query()
17 | if err := mapForm(obj, values); err != nil {
18 | return err
19 | }
20 | return validate(obj)
21 | }
22 |
--------------------------------------------------------------------------------
/vendor/github.com/gin-gonic/gin/binding/xml.go:
--------------------------------------------------------------------------------
1 | // Copyright 2014 Manu Martinez-Almeida. All rights reserved.
2 | // Use of this source code is governed by a MIT style
3 | // license that can be found in the LICENSE file.
4 |
5 | package binding
6 |
7 | import (
8 | "encoding/xml"
9 | "net/http"
10 | )
11 |
12 | type xmlBinding struct{}
13 |
14 | func (xmlBinding) Name() string {
15 | return "xml"
16 | }
17 |
18 | func (xmlBinding) Bind(req *http.Request, obj interface{}) error {
19 | decoder := xml.NewDecoder(req.Body)
20 | if err := decoder.Decode(obj); err != nil {
21 | return err
22 | }
23 | return validate(obj)
24 | }
25 |
--------------------------------------------------------------------------------
/vendor/github.com/gin-gonic/gin/codecov.yml:
--------------------------------------------------------------------------------
1 | coverage:
2 | notify:
3 | gitter:
4 | default:
5 | url: https://webhooks.gitter.im/e/d90dcdeeab2f1e357165
6 |
--------------------------------------------------------------------------------
/vendor/github.com/gin-gonic/gin/context_appengine.go:
--------------------------------------------------------------------------------
1 | // +build appengine
2 |
3 | // Copyright 2017 Manu Martinez-Almeida. All rights reserved.
4 | // Use of this source code is governed by a MIT style
5 | // license that can be found in the LICENSE file.
6 |
7 | package gin
8 |
9 | func init() {
10 | defaultAppEngine = true
11 | }
12 |
--------------------------------------------------------------------------------
/vendor/github.com/gin-gonic/gin/debug.go:
--------------------------------------------------------------------------------
1 | // Copyright 2014 Manu Martinez-Almeida. All rights reserved.
2 | // Use of this source code is governed by a MIT style
3 | // license that can be found in the LICENSE file.
4 |
5 | package gin
6 |
7 | import (
8 | "bytes"
9 | "html/template"
10 | "log"
11 | )
12 |
13 | func init() {
14 | log.SetFlags(0)
15 | }
16 |
17 | // IsDebugging returns true if the framework is running in debug mode.
18 | // Use SetMode(gin.ReleaseMode) to disable debug mode.
19 | func IsDebugging() bool {
20 | return ginMode == debugCode
21 | }
22 |
23 | func debugPrintRoute(httpMethod, absolutePath string, handlers HandlersChain) {
24 | if IsDebugging() {
25 | nuHandlers := len(handlers)
26 | handlerName := nameOfFunction(handlers.Last())
27 | debugPrint("%-6s %-25s --> %s (%d handlers)\n", httpMethod, absolutePath, handlerName, nuHandlers)
28 | }
29 | }
30 |
31 | func debugPrintLoadTemplate(tmpl *template.Template) {
32 | if IsDebugging() {
33 | var buf bytes.Buffer
34 | for _, tmpl := range tmpl.Templates() {
35 | buf.WriteString("\t- ")
36 | buf.WriteString(tmpl.Name())
37 | buf.WriteString("\n")
38 | }
39 | debugPrint("Loaded HTML Templates (%d): \n%s\n", len(tmpl.Templates()), buf.String())
40 | }
41 | }
42 |
43 | func debugPrint(format string, values ...interface{}) {
44 | if IsDebugging() {
45 | log.Printf("[GIN-debug] "+format, values...)
46 | }
47 | }
48 |
49 | func debugPrintWARNINGDefault() {
50 | debugPrint(`[WARNING] Creating an Engine instance with the Logger and Recovery middleware already attached.
51 |
52 | `)
53 | }
54 |
55 | func debugPrintWARNINGNew() {
56 | debugPrint(`[WARNING] Running in "debug" mode. Switch to "release" mode in production.
57 | - using env: export GIN_MODE=release
58 | - using code: gin.SetMode(gin.ReleaseMode)
59 |
60 | `)
61 | }
62 |
63 | func debugPrintWARNINGSetHTMLTemplate() {
64 | debugPrint(`[WARNING] Since SetHTMLTemplate() is NOT thread-safe. It should only be called
65 | at initialization. ie. before any route is registered or the router is listening in a socket:
66 |
67 | router := gin.Default()
68 | router.SetHTMLTemplate(template) // << good place
69 |
70 | `)
71 | }
72 |
73 | func debugPrintError(err error) {
74 | if err != nil {
75 | debugPrint("[ERROR] %v\n", err)
76 | }
77 | }
78 |
--------------------------------------------------------------------------------
/vendor/github.com/gin-gonic/gin/deprecated.go:
--------------------------------------------------------------------------------
1 | // Copyright 2014 Manu Martinez-Almeida. All rights reserved.
2 | // Use of this source code is governed by a MIT style
3 | // license that can be found in the LICENSE file.
4 |
5 | package gin
6 |
7 | import (
8 | "log"
9 |
10 | "github.com/gin-gonic/gin/binding"
11 | )
12 |
13 | // BindWith binds the passed struct pointer using the specified binding engine.
14 | // See the binding package.
15 | func (c *Context) BindWith(obj interface{}, b binding.Binding) error {
16 | log.Println(`BindWith(\"interface{}, binding.Binding\") error is going to
17 | be deprecated, please check issue #662 and either use MustBindWith() if you
18 | want HTTP 400 to be automatically returned if any error occur, or use
19 | ShouldBindWith() if you need to manage the error.`)
20 | return c.MustBindWith(obj, b)
21 | }
22 |
--------------------------------------------------------------------------------
/vendor/github.com/gin-gonic/gin/doc.go:
--------------------------------------------------------------------------------
1 | /*
2 | Package gin implements a HTTP web framework called gin.
3 |
4 | See https://gin-gonic.github.io/gin/ for more information about gin.
5 | */
6 | package gin // import "github.com/gin-gonic/gin"
7 |
--------------------------------------------------------------------------------
/vendor/github.com/gin-gonic/gin/fs.go:
--------------------------------------------------------------------------------
1 | // Copyright 2017 Manu Martinez-Almeida. All rights reserved.
2 | // Use of this source code is governed by a MIT style
3 | // license that can be found in the LICENSE file.
4 |
5 | package gin
6 |
7 | import (
8 | "net/http"
9 | "os"
10 | )
11 |
12 | type onlyfilesFS struct {
13 | fs http.FileSystem
14 | }
15 |
16 | type neuteredReaddirFile struct {
17 | http.File
18 | }
19 |
20 | // Dir returns a http.Filesystem that can be used by http.FileServer(). It is used internally
21 | // in router.Static().
22 | // if listDirectory == true, then it works the same as http.Dir() otherwise it returns
23 | // a filesystem that prevents http.FileServer() to list the directory files.
24 | func Dir(root string, listDirectory bool) http.FileSystem {
25 | fs := http.Dir(root)
26 | if listDirectory {
27 | return fs
28 | }
29 | return &onlyfilesFS{fs}
30 | }
31 |
32 | // Open conforms to http.Filesystem.
33 | func (fs onlyfilesFS) Open(name string) (http.File, error) {
34 | f, err := fs.fs.Open(name)
35 | if err != nil {
36 | return nil, err
37 | }
38 | return neuteredReaddirFile{f}, nil
39 | }
40 |
41 | // Readdir overrides the http.File default implementation.
42 | func (f neuteredReaddirFile) Readdir(count int) ([]os.FileInfo, error) {
43 | // this disables directory listing
44 | return nil, nil
45 | }
46 |
--------------------------------------------------------------------------------
/vendor/github.com/gin-gonic/gin/json/json.go:
--------------------------------------------------------------------------------
1 | // Copyright 2017 Bo-Yi Wu. All rights reserved.
2 | // Use of this source code is governed by a MIT style
3 | // license that can be found in the LICENSE file.
4 |
5 | // +build !jsoniter
6 |
7 | package json
8 |
9 | import "encoding/json"
10 |
11 | var (
12 | Marshal = json.Marshal
13 | MarshalIndent = json.MarshalIndent
14 | NewDecoder = json.NewDecoder
15 | )
16 |
--------------------------------------------------------------------------------
/vendor/github.com/gin-gonic/gin/json/jsoniter.go:
--------------------------------------------------------------------------------
1 | // Copyright 2017 Bo-Yi Wu. All rights reserved.
2 | // Use of this source code is governed by a MIT style
3 | // license that can be found in the LICENSE file.
4 |
5 | // +build jsoniter
6 |
7 | package json
8 |
9 | import "github.com/json-iterator/go"
10 |
11 | var (
12 | json = jsoniter.ConfigCompatibleWithStandardLibrary
13 | Marshal = json.Marshal
14 | MarshalIndent = json.MarshalIndent
15 | NewDecoder = json.NewDecoder
16 | )
17 |
--------------------------------------------------------------------------------
/vendor/github.com/gin-gonic/gin/mode.go:
--------------------------------------------------------------------------------
1 | // Copyright 2014 Manu Martinez-Almeida. All rights reserved.
2 | // Use of this source code is governed by a MIT style
3 | // license that can be found in the LICENSE file.
4 |
5 | package gin
6 |
7 | import (
8 | "io"
9 | "os"
10 |
11 | "github.com/gin-gonic/gin/binding"
12 | )
13 |
14 | const ENV_GIN_MODE = "GIN_MODE"
15 |
16 | const (
17 | DebugMode = "debug"
18 | ReleaseMode = "release"
19 | TestMode = "test"
20 | )
21 | const (
22 | debugCode = iota
23 | releaseCode
24 | testCode
25 | )
26 |
27 | // DefaultWriter is the default io.Writer used the Gin for debug output and
28 | // middleware output like Logger() or Recovery().
29 | // Note that both Logger and Recovery provides custom ways to configure their
30 | // output io.Writer.
31 | // To support coloring in Windows use:
32 | // import "github.com/mattn/go-colorable"
33 | // gin.DefaultWriter = colorable.NewColorableStdout()
34 | var DefaultWriter io.Writer = os.Stdout
35 | var DefaultErrorWriter io.Writer = os.Stderr
36 |
37 | var ginMode = debugCode
38 | var modeName = DebugMode
39 |
40 | func init() {
41 | mode := os.Getenv(ENV_GIN_MODE)
42 | SetMode(mode)
43 | }
44 |
45 | func SetMode(value string) {
46 | switch value {
47 | case DebugMode, "":
48 | ginMode = debugCode
49 | case ReleaseMode:
50 | ginMode = releaseCode
51 | case TestMode:
52 | ginMode = testCode
53 | default:
54 | panic("gin mode unknown: " + value)
55 | }
56 | modeName = value
57 | }
58 |
59 | func DisableBindValidation() {
60 | binding.Validator = nil
61 | }
62 |
63 | func EnableJsonDecoderUseNumber() {
64 | binding.EnableDecoderUseNumber = true
65 | }
66 |
67 | func Mode() string {
68 | return modeName
69 | }
70 |
--------------------------------------------------------------------------------
/vendor/github.com/gin-gonic/gin/render/data.go:
--------------------------------------------------------------------------------
1 | // Copyright 2014 Manu Martinez-Almeida. All rights reserved.
2 | // Use of this source code is governed by a MIT style
3 | // license that can be found in the LICENSE file.
4 |
5 | package render
6 |
7 | import "net/http"
8 |
9 | type Data struct {
10 | ContentType string
11 | Data []byte
12 | }
13 |
14 | // Render (Data) writes data with custom ContentType.
15 | func (r Data) Render(w http.ResponseWriter) (err error) {
16 | r.WriteContentType(w)
17 | _, err = w.Write(r.Data)
18 | return
19 | }
20 |
21 | func (r Data) WriteContentType(w http.ResponseWriter) {
22 | writeContentType(w, []string{r.ContentType})
23 | }
24 |
--------------------------------------------------------------------------------
/vendor/github.com/gin-gonic/gin/render/html.go:
--------------------------------------------------------------------------------
1 | // Copyright 2014 Manu Martinez-Almeida. All rights reserved.
2 | // Use of this source code is governed by a MIT style
3 | // license that can be found in the LICENSE file.
4 |
5 | package render
6 |
7 | import (
8 | "html/template"
9 | "net/http"
10 | )
11 |
12 | type Delims struct {
13 | Left string
14 | Right string
15 | }
16 |
17 | type HTMLRender interface {
18 | Instance(string, interface{}) Render
19 | }
20 |
21 | type HTMLProduction struct {
22 | Template *template.Template
23 | Delims Delims
24 | }
25 |
26 | type HTMLDebug struct {
27 | Files []string
28 | Glob string
29 | Delims Delims
30 | FuncMap template.FuncMap
31 | }
32 |
33 | type HTML struct {
34 | Template *template.Template
35 | Name string
36 | Data interface{}
37 | }
38 |
39 | var htmlContentType = []string{"text/html; charset=utf-8"}
40 |
41 | func (r HTMLProduction) Instance(name string, data interface{}) Render {
42 | return HTML{
43 | Template: r.Template,
44 | Name: name,
45 | Data: data,
46 | }
47 | }
48 |
49 | func (r HTMLDebug) Instance(name string, data interface{}) Render {
50 | return HTML{
51 | Template: r.loadTemplate(),
52 | Name: name,
53 | Data: data,
54 | }
55 | }
56 | func (r HTMLDebug) loadTemplate() *template.Template {
57 | if r.FuncMap == nil {
58 | r.FuncMap = template.FuncMap{}
59 | }
60 | if len(r.Files) > 0 {
61 | return template.Must(template.New("").Delims(r.Delims.Left, r.Delims.Right).Funcs(r.FuncMap).ParseFiles(r.Files...))
62 | }
63 | if r.Glob != "" {
64 | return template.Must(template.New("").Delims(r.Delims.Left, r.Delims.Right).Funcs(r.FuncMap).ParseGlob(r.Glob))
65 | }
66 | panic("the HTML debug render was created without files or glob pattern")
67 | }
68 |
69 | func (r HTML) Render(w http.ResponseWriter) error {
70 | r.WriteContentType(w)
71 |
72 | if r.Name == "" {
73 | return r.Template.Execute(w, r.Data)
74 | }
75 | return r.Template.ExecuteTemplate(w, r.Name, r.Data)
76 | }
77 |
78 | func (r HTML) WriteContentType(w http.ResponseWriter) {
79 | writeContentType(w, htmlContentType)
80 | }
81 |
--------------------------------------------------------------------------------
/vendor/github.com/gin-gonic/gin/render/json.go:
--------------------------------------------------------------------------------
1 | // Copyright 2014 Manu Martinez-Almeida. All rights reserved.
2 | // Use of this source code is governed by a MIT style
3 | // license that can be found in the LICENSE file.
4 |
5 | package render
6 |
7 | import (
8 | "bytes"
9 | "net/http"
10 |
11 | "github.com/gin-gonic/gin/json"
12 | )
13 |
14 | type JSON struct {
15 | Data interface{}
16 | }
17 |
18 | type IndentedJSON struct {
19 | Data interface{}
20 | }
21 |
22 | type SecureJSON struct {
23 | Prefix string
24 | Data interface{}
25 | }
26 |
27 | type SecureJSONPrefix string
28 |
29 | var jsonContentType = []string{"application/json; charset=utf-8"}
30 |
31 | func (r JSON) Render(w http.ResponseWriter) (err error) {
32 | if err = WriteJSON(w, r.Data); err != nil {
33 | panic(err)
34 | }
35 | return
36 | }
37 |
38 | func (r JSON) WriteContentType(w http.ResponseWriter) {
39 | writeContentType(w, jsonContentType)
40 | }
41 |
42 | func WriteJSON(w http.ResponseWriter, obj interface{}) error {
43 | writeContentType(w, jsonContentType)
44 | jsonBytes, err := json.Marshal(obj)
45 | if err != nil {
46 | return err
47 | }
48 | w.Write(jsonBytes)
49 | return nil
50 | }
51 |
52 | func (r IndentedJSON) Render(w http.ResponseWriter) error {
53 | r.WriteContentType(w)
54 | jsonBytes, err := json.MarshalIndent(r.Data, "", " ")
55 | if err != nil {
56 | return err
57 | }
58 | w.Write(jsonBytes)
59 | return nil
60 | }
61 |
62 | func (r IndentedJSON) WriteContentType(w http.ResponseWriter) {
63 | writeContentType(w, jsonContentType)
64 | }
65 |
66 | func (r SecureJSON) Render(w http.ResponseWriter) error {
67 | r.WriteContentType(w)
68 | jsonBytes, err := json.Marshal(r.Data)
69 | if err != nil {
70 | return err
71 | }
72 | // if the jsonBytes is array values
73 | if bytes.HasPrefix(jsonBytes, []byte("[")) && bytes.HasSuffix(jsonBytes, []byte("]")) {
74 | w.Write([]byte(r.Prefix))
75 | }
76 | w.Write(jsonBytes)
77 | return nil
78 | }
79 |
80 | func (r SecureJSON) WriteContentType(w http.ResponseWriter) {
81 | writeContentType(w, jsonContentType)
82 | }
83 |
--------------------------------------------------------------------------------
/vendor/github.com/gin-gonic/gin/render/msgpack.go:
--------------------------------------------------------------------------------
1 | // Copyright 2017 Manu Martinez-Almeida. All rights reserved.
2 | // Use of this source code is governed by a MIT style
3 | // license that can be found in the LICENSE file.
4 |
5 | package render
6 |
7 | import (
8 | "net/http"
9 |
10 | "github.com/ugorji/go/codec"
11 | )
12 |
13 | type MsgPack struct {
14 | Data interface{}
15 | }
16 |
17 | var msgpackContentType = []string{"application/msgpack; charset=utf-8"}
18 |
19 | func (r MsgPack) WriteContentType(w http.ResponseWriter) {
20 | writeContentType(w, msgpackContentType)
21 | }
22 |
23 | func (r MsgPack) Render(w http.ResponseWriter) error {
24 | return WriteMsgPack(w, r.Data)
25 | }
26 |
27 | func WriteMsgPack(w http.ResponseWriter, obj interface{}) error {
28 | writeContentType(w, msgpackContentType)
29 | var h codec.Handle = new(codec.MsgpackHandle)
30 | return codec.NewEncoder(w, h).Encode(obj)
31 | }
32 |
--------------------------------------------------------------------------------
/vendor/github.com/gin-gonic/gin/render/redirect.go:
--------------------------------------------------------------------------------
1 | // Copyright 2014 Manu Martinez-Almeida. All rights reserved.
2 | // Use of this source code is governed by a MIT style
3 | // license that can be found in the LICENSE file.
4 |
5 | package render
6 |
7 | import (
8 | "fmt"
9 | "net/http"
10 | )
11 |
12 | type Redirect struct {
13 | Code int
14 | Request *http.Request
15 | Location string
16 | }
17 |
18 | func (r Redirect) Render(w http.ResponseWriter) error {
19 | if (r.Code < 300 || r.Code > 308) && r.Code != 201 {
20 | panic(fmt.Sprintf("Cannot redirect with status code %d", r.Code))
21 | }
22 | http.Redirect(w, r.Request, r.Location, r.Code)
23 | return nil
24 | }
25 |
26 | func (r Redirect) WriteContentType(http.ResponseWriter) {}
27 |
--------------------------------------------------------------------------------
/vendor/github.com/gin-gonic/gin/render/render.go:
--------------------------------------------------------------------------------
1 | // Copyright 2014 Manu Martinez-Almeida. All rights reserved.
2 | // Use of this source code is governed by a MIT style
3 | // license that can be found in the LICENSE file.
4 |
5 | package render
6 |
7 | import "net/http"
8 |
9 | type Render interface {
10 | Render(http.ResponseWriter) error
11 | WriteContentType(w http.ResponseWriter)
12 | }
13 |
14 | var (
15 | _ Render = JSON{}
16 | _ Render = IndentedJSON{}
17 | _ Render = SecureJSON{}
18 | _ Render = XML{}
19 | _ Render = String{}
20 | _ Render = Redirect{}
21 | _ Render = Data{}
22 | _ Render = HTML{}
23 | _ HTMLRender = HTMLDebug{}
24 | _ HTMLRender = HTMLProduction{}
25 | _ Render = YAML{}
26 | _ Render = MsgPack{}
27 | )
28 |
29 | func writeContentType(w http.ResponseWriter, value []string) {
30 | header := w.Header()
31 | if val := header["Content-Type"]; len(val) == 0 {
32 | header["Content-Type"] = value
33 | }
34 | }
35 |
--------------------------------------------------------------------------------
/vendor/github.com/gin-gonic/gin/render/text.go:
--------------------------------------------------------------------------------
1 | // Copyright 2014 Manu Martinez-Almeida. All rights reserved.
2 | // Use of this source code is governed by a MIT style
3 | // license that can be found in the LICENSE file.
4 |
5 | package render
6 |
7 | import (
8 | "fmt"
9 | "io"
10 | "net/http"
11 | )
12 |
13 | type String struct {
14 | Format string
15 | Data []interface{}
16 | }
17 |
18 | var plainContentType = []string{"text/plain; charset=utf-8"}
19 |
20 | func (r String) Render(w http.ResponseWriter) error {
21 | WriteString(w, r.Format, r.Data)
22 | return nil
23 | }
24 |
25 | func (r String) WriteContentType(w http.ResponseWriter) {
26 | writeContentType(w, plainContentType)
27 | }
28 |
29 | func WriteString(w http.ResponseWriter, format string, data []interface{}) {
30 | writeContentType(w, plainContentType)
31 | if len(data) > 0 {
32 | fmt.Fprintf(w, format, data...)
33 | } else {
34 | io.WriteString(w, format)
35 | }
36 | }
37 |
--------------------------------------------------------------------------------
/vendor/github.com/gin-gonic/gin/render/xml.go:
--------------------------------------------------------------------------------
1 | // Copyright 2014 Manu Martinez-Almeida. All rights reserved.
2 | // Use of this source code is governed by a MIT style
3 | // license that can be found in the LICENSE file.
4 |
5 | package render
6 |
7 | import (
8 | "encoding/xml"
9 | "net/http"
10 | )
11 |
12 | type XML struct {
13 | Data interface{}
14 | }
15 |
16 | var xmlContentType = []string{"application/xml; charset=utf-8"}
17 |
18 | func (r XML) Render(w http.ResponseWriter) error {
19 | r.WriteContentType(w)
20 | return xml.NewEncoder(w).Encode(r.Data)
21 | }
22 |
23 | func (r XML) WriteContentType(w http.ResponseWriter) {
24 | writeContentType(w, xmlContentType)
25 | }
26 |
--------------------------------------------------------------------------------
/vendor/github.com/gin-gonic/gin/render/yaml.go:
--------------------------------------------------------------------------------
1 | // Copyright 2014 Manu Martinez-Almeida. All rights reserved.
2 | // Use of this source code is governed by a MIT style
3 | // license that can be found in the LICENSE file.
4 |
5 | package render
6 |
7 | import (
8 | "net/http"
9 |
10 | "gopkg.in/yaml.v2"
11 | )
12 |
13 | type YAML struct {
14 | Data interface{}
15 | }
16 |
17 | var yamlContentType = []string{"application/x-yaml; charset=utf-8"}
18 |
19 | func (r YAML) Render(w http.ResponseWriter) error {
20 | r.WriteContentType(w)
21 |
22 | bytes, err := yaml.Marshal(r.Data)
23 | if err != nil {
24 | return err
25 | }
26 |
27 | w.Write(bytes)
28 | return nil
29 | }
30 |
31 | func (r YAML) WriteContentType(w http.ResponseWriter) {
32 | writeContentType(w, yamlContentType)
33 | }
34 |
--------------------------------------------------------------------------------
/vendor/github.com/gin-gonic/gin/test_helpers.go:
--------------------------------------------------------------------------------
1 | // Copyright 2017 Manu Martinez-Almeida. All rights reserved.
2 | // Use of this source code is governed by a MIT style
3 | // license that can be found in the LICENSE file.
4 |
5 | package gin
6 |
7 | import (
8 | "net/http"
9 | )
10 |
11 | // CreateTestContext returns a fresh engine and context for testing purposes
12 | func CreateTestContext(w http.ResponseWriter) (c *Context, r *Engine) {
13 | r = New()
14 | c = r.allocateContext()
15 | c.reset()
16 | c.writermem.reset(w)
17 | return
18 | }
19 |
--------------------------------------------------------------------------------
/vendor/github.com/gin-gonic/gin/wercker.yml:
--------------------------------------------------------------------------------
1 | box: wercker/default
--------------------------------------------------------------------------------
/vendor/github.com/golang/protobuf/LICENSE:
--------------------------------------------------------------------------------
1 | Go support for Protocol Buffers - Google's data interchange format
2 |
3 | Copyright 2010 The Go Authors. All rights reserved.
4 | https://github.com/golang/protobuf
5 |
6 | Redistribution and use in source and binary forms, with or without
7 | modification, are permitted provided that the following conditions are
8 | met:
9 |
10 | * Redistributions of source code must retain the above copyright
11 | notice, this list of conditions and the following disclaimer.
12 | * Redistributions in binary form must reproduce the above
13 | copyright notice, this list of conditions and the following disclaimer
14 | in the documentation and/or other materials provided with the
15 | distribution.
16 | * Neither the name of Google Inc. nor the names of its
17 | contributors may be used to endorse or promote products derived from
18 | this software without specific prior written permission.
19 |
20 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
21 | "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
22 | LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
23 | A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
24 | OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
25 | SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
26 | LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
27 | DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
28 | THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
29 | (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
30 | OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
31 |
32 |
--------------------------------------------------------------------------------
/vendor/github.com/golang/protobuf/proto/Makefile:
--------------------------------------------------------------------------------
1 | # Go support for Protocol Buffers - Google's data interchange format
2 | #
3 | # Copyright 2010 The Go Authors. All rights reserved.
4 | # https://github.com/golang/protobuf
5 | #
6 | # Redistribution and use in source and binary forms, with or without
7 | # modification, are permitted provided that the following conditions are
8 | # met:
9 | #
10 | # * Redistributions of source code must retain the above copyright
11 | # notice, this list of conditions and the following disclaimer.
12 | # * Redistributions in binary form must reproduce the above
13 | # copyright notice, this list of conditions and the following disclaimer
14 | # in the documentation and/or other materials provided with the
15 | # distribution.
16 | # * Neither the name of Google Inc. nor the names of its
17 | # contributors may be used to endorse or promote products derived from
18 | # this software without specific prior written permission.
19 | #
20 | # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
21 | # "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
22 | # LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
23 | # A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
24 | # OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
25 | # SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
26 | # LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
27 | # DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
28 | # THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
29 | # (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
30 | # OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
31 |
32 | install:
33 | go install
34 |
35 | test: install generate-test-pbs
36 | go test
37 |
38 |
39 | generate-test-pbs:
40 | make install
41 | make -C testdata
42 | protoc --go_out=Mtestdata/test.proto=github.com/golang/protobuf/proto/testdata,Mgoogle/protobuf/any.proto=github.com/golang/protobuf/ptypes/any:. proto3_proto/proto3.proto
43 | make
44 |
--------------------------------------------------------------------------------
/vendor/github.com/json-iterator/go/Gopkg.lock:
--------------------------------------------------------------------------------
1 | # This file is autogenerated, do not edit; changes may be undone by the next 'dep ensure'.
2 |
3 |
4 | [[projects]]
5 | name = "github.com/davecgh/go-spew"
6 | packages = ["spew"]
7 | revision = "346938d642f2ec3594ed81d874461961cd0faa76"
8 | version = "v1.1.0"
9 |
10 | [[projects]]
11 | branch = "master"
12 | name = "github.com/google/gofuzz"
13 | packages = ["."]
14 | revision = "24818f796faf91cd76ec7bddd72458fbced7a6c1"
15 |
16 | [[projects]]
17 | name = "github.com/pmezard/go-difflib"
18 | packages = ["difflib"]
19 | revision = "792786c7400a136282c1664665ae0a8db921c6c2"
20 | version = "v1.0.0"
21 |
22 | [[projects]]
23 | name = "github.com/stretchr/testify"
24 | packages = ["assert","require"]
25 | revision = "69483b4bd14f5845b5a1e55bca19e954e827f1d0"
26 | version = "v1.1.4"
27 |
28 | [solve-meta]
29 | analyzer-name = "dep"
30 | analyzer-version = 1
31 | inputs-digest = "f8b7cf3941d3792cbbd570bb53c093adaf774334d1162c651565c97a58dc9d09"
32 | solver-name = "gps-cdcl"
33 | solver-version = 1
34 |
--------------------------------------------------------------------------------
/vendor/github.com/json-iterator/go/Gopkg.toml:
--------------------------------------------------------------------------------
1 | # Gopkg.toml example
2 | #
3 | # Refer to https://github.com/golang/dep/blob/master/docs/Gopkg.toml.md
4 | # for detailed Gopkg.toml documentation.
5 | #
6 | # required = ["github.com/user/thing/cmd/thing"]
7 | # ignored = ["github.com/user/project/pkgX", "bitbucket.org/user/project/pkgA/pkgY"]
8 | #
9 | # [[constraint]]
10 | # name = "github.com/user/project"
11 | # version = "1.0.0"
12 | #
13 | # [[constraint]]
14 | # name = "github.com/user/project2"
15 | # branch = "dev"
16 | # source = "github.com/myfork/project2"
17 | #
18 | # [[override]]
19 | # name = "github.com/x/y"
20 | # version = "2.4.0"
21 |
22 |
23 | [[constraint]]
24 | name = "github.com/davecgh/go-spew"
25 | version = "1.1.0"
26 |
27 | [[constraint]]
28 | branch = "master"
29 | name = "github.com/google/gofuzz"
30 |
31 | [[constraint]]
32 | name = "github.com/stretchr/testify"
33 | version = "1.1.4"
34 |
--------------------------------------------------------------------------------
/vendor/github.com/json-iterator/go/LICENSE:
--------------------------------------------------------------------------------
1 | MIT License
2 |
3 | Copyright (c) 2016 json-iterator
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/json-iterator/go/build.sh:
--------------------------------------------------------------------------------
1 | #!/bin/bash
2 | set -e
3 | set -x
4 |
5 | if [ ! -d /tmp/build-golang/src/github.com/json-iterator ]; then
6 | mkdir -p /tmp/build-golang/src/github.com/json-iterator
7 | ln -s $PWD /tmp/build-golang/src/github.com/json-iterator/go
8 | fi
9 | export GOPATH=/tmp/build-golang
10 | go get -u github.com/golang/dep/cmd/dep
11 | cd /tmp/build-golang/src/github.com/json-iterator/go
12 | exec $GOPATH/bin/dep ensure -update
13 |
--------------------------------------------------------------------------------
/vendor/github.com/json-iterator/go/feature_any_bool.go:
--------------------------------------------------------------------------------
1 | package jsoniter
2 |
3 | type trueAny struct {
4 | baseAny
5 | }
6 |
7 | func (any *trueAny) LastError() error {
8 | return nil
9 | }
10 |
11 | func (any *trueAny) ToBool() bool {
12 | return true
13 | }
14 |
15 | func (any *trueAny) ToInt() int {
16 | return 1
17 | }
18 |
19 | func (any *trueAny) ToInt32() int32 {
20 | return 1
21 | }
22 |
23 | func (any *trueAny) ToInt64() int64 {
24 | return 1
25 | }
26 |
27 | func (any *trueAny) ToUint() uint {
28 | return 1
29 | }
30 |
31 | func (any *trueAny) ToUint32() uint32 {
32 | return 1
33 | }
34 |
35 | func (any *trueAny) ToUint64() uint64 {
36 | return 1
37 | }
38 |
39 | func (any *trueAny) ToFloat32() float32 {
40 | return 1
41 | }
42 |
43 | func (any *trueAny) ToFloat64() float64 {
44 | return 1
45 | }
46 |
47 | func (any *trueAny) ToString() string {
48 | return "true"
49 | }
50 |
51 | func (any *trueAny) WriteTo(stream *Stream) {
52 | stream.WriteTrue()
53 | }
54 |
55 | func (any *trueAny) Parse() *Iterator {
56 | return nil
57 | }
58 |
59 | func (any *trueAny) GetInterface() interface{} {
60 | return true
61 | }
62 |
63 | func (any *trueAny) ValueType() ValueType {
64 | return BoolValue
65 | }
66 |
67 | func (any *trueAny) MustBeValid() Any {
68 | return any
69 | }
70 |
71 | type falseAny struct {
72 | baseAny
73 | }
74 |
75 | func (any *falseAny) LastError() error {
76 | return nil
77 | }
78 |
79 | func (any *falseAny) ToBool() bool {
80 | return false
81 | }
82 |
83 | func (any *falseAny) ToInt() int {
84 | return 0
85 | }
86 |
87 | func (any *falseAny) ToInt32() int32 {
88 | return 0
89 | }
90 |
91 | func (any *falseAny) ToInt64() int64 {
92 | return 0
93 | }
94 |
95 | func (any *falseAny) ToUint() uint {
96 | return 0
97 | }
98 |
99 | func (any *falseAny) ToUint32() uint32 {
100 | return 0
101 | }
102 |
103 | func (any *falseAny) ToUint64() uint64 {
104 | return 0
105 | }
106 |
107 | func (any *falseAny) ToFloat32() float32 {
108 | return 0
109 | }
110 |
111 | func (any *falseAny) ToFloat64() float64 {
112 | return 0
113 | }
114 |
115 | func (any *falseAny) ToString() string {
116 | return "false"
117 | }
118 |
119 | func (any *falseAny) WriteTo(stream *Stream) {
120 | stream.WriteFalse()
121 | }
122 |
123 | func (any *falseAny) Parse() *Iterator {
124 | return nil
125 | }
126 |
127 | func (any *falseAny) GetInterface() interface{} {
128 | return false
129 | }
130 |
131 | func (any *falseAny) ValueType() ValueType {
132 | return BoolValue
133 | }
134 |
135 | func (any *falseAny) MustBeValid() Any {
136 | return any
137 | }
138 |
--------------------------------------------------------------------------------
/vendor/github.com/json-iterator/go/feature_any_float.go:
--------------------------------------------------------------------------------
1 | package jsoniter
2 |
3 | import (
4 | "strconv"
5 | )
6 |
7 | type floatAny struct {
8 | baseAny
9 | val float64
10 | }
11 |
12 | func (any *floatAny) Parse() *Iterator {
13 | return nil
14 | }
15 |
16 | func (any *floatAny) ValueType() ValueType {
17 | return NumberValue
18 | }
19 |
20 | func (any *floatAny) MustBeValid() Any {
21 | return any
22 | }
23 |
24 | func (any *floatAny) LastError() error {
25 | return nil
26 | }
27 |
28 | func (any *floatAny) ToBool() bool {
29 | return any.ToFloat64() != 0
30 | }
31 |
32 | func (any *floatAny) ToInt() int {
33 | return int(any.val)
34 | }
35 |
36 | func (any *floatAny) ToInt32() int32 {
37 | return int32(any.val)
38 | }
39 |
40 | func (any *floatAny) ToInt64() int64 {
41 | return int64(any.val)
42 | }
43 |
44 | func (any *floatAny) ToUint() uint {
45 | if any.val > 0 {
46 | return uint(any.val)
47 | }
48 | return 0
49 | }
50 |
51 | func (any *floatAny) ToUint32() uint32 {
52 | if any.val > 0 {
53 | return uint32(any.val)
54 | }
55 | return 0
56 | }
57 |
58 | func (any *floatAny) ToUint64() uint64 {
59 | if any.val > 0 {
60 | return uint64(any.val)
61 | }
62 | return 0
63 | }
64 |
65 | func (any *floatAny) ToFloat32() float32 {
66 | return float32(any.val)
67 | }
68 |
69 | func (any *floatAny) ToFloat64() float64 {
70 | return any.val
71 | }
72 |
73 | func (any *floatAny) ToString() string {
74 | return strconv.FormatFloat(any.val, 'E', -1, 64)
75 | }
76 |
77 | func (any *floatAny) WriteTo(stream *Stream) {
78 | stream.WriteFloat64(any.val)
79 | }
80 |
81 | func (any *floatAny) GetInterface() interface{} {
82 | return any.val
83 | }
84 |
--------------------------------------------------------------------------------
/vendor/github.com/json-iterator/go/feature_any_int32.go:
--------------------------------------------------------------------------------
1 | package jsoniter
2 |
3 | import (
4 | "strconv"
5 | )
6 |
7 | type int32Any struct {
8 | baseAny
9 | val int32
10 | }
11 |
12 | func (any *int32Any) LastError() error {
13 | return nil
14 | }
15 |
16 | func (any *int32Any) ValueType() ValueType {
17 | return NumberValue
18 | }
19 |
20 | func (any *int32Any) MustBeValid() Any {
21 | return any
22 | }
23 |
24 | func (any *int32Any) ToBool() bool {
25 | return any.val != 0
26 | }
27 |
28 | func (any *int32Any) ToInt() int {
29 | return int(any.val)
30 | }
31 |
32 | func (any *int32Any) ToInt32() int32 {
33 | return any.val
34 | }
35 |
36 | func (any *int32Any) ToInt64() int64 {
37 | return int64(any.val)
38 | }
39 |
40 | func (any *int32Any) ToUint() uint {
41 | return uint(any.val)
42 | }
43 |
44 | func (any *int32Any) ToUint32() uint32 {
45 | return uint32(any.val)
46 | }
47 |
48 | func (any *int32Any) ToUint64() uint64 {
49 | return uint64(any.val)
50 | }
51 |
52 | func (any *int32Any) ToFloat32() float32 {
53 | return float32(any.val)
54 | }
55 |
56 | func (any *int32Any) ToFloat64() float64 {
57 | return float64(any.val)
58 | }
59 |
60 | func (any *int32Any) ToString() string {
61 | return strconv.FormatInt(int64(any.val), 10)
62 | }
63 |
64 | func (any *int32Any) WriteTo(stream *Stream) {
65 | stream.WriteInt32(any.val)
66 | }
67 |
68 | func (any *int32Any) Parse() *Iterator {
69 | return nil
70 | }
71 |
72 | func (any *int32Any) GetInterface() interface{} {
73 | return any.val
74 | }
75 |
--------------------------------------------------------------------------------
/vendor/github.com/json-iterator/go/feature_any_int64.go:
--------------------------------------------------------------------------------
1 | package jsoniter
2 |
3 | import (
4 | "strconv"
5 | )
6 |
7 | type int64Any struct {
8 | baseAny
9 | val int64
10 | }
11 |
12 | func (any *int64Any) LastError() error {
13 | return nil
14 | }
15 |
16 | func (any *int64Any) ValueType() ValueType {
17 | return NumberValue
18 | }
19 |
20 | func (any *int64Any) MustBeValid() Any {
21 | return any
22 | }
23 |
24 | func (any *int64Any) ToBool() bool {
25 | return any.val != 0
26 | }
27 |
28 | func (any *int64Any) ToInt() int {
29 | return int(any.val)
30 | }
31 |
32 | func (any *int64Any) ToInt32() int32 {
33 | return int32(any.val)
34 | }
35 |
36 | func (any *int64Any) ToInt64() int64 {
37 | return any.val
38 | }
39 |
40 | func (any *int64Any) ToUint() uint {
41 | return uint(any.val)
42 | }
43 |
44 | func (any *int64Any) ToUint32() uint32 {
45 | return uint32(any.val)
46 | }
47 |
48 | func (any *int64Any) ToUint64() uint64 {
49 | return uint64(any.val)
50 | }
51 |
52 | func (any *int64Any) ToFloat32() float32 {
53 | return float32(any.val)
54 | }
55 |
56 | func (any *int64Any) ToFloat64() float64 {
57 | return float64(any.val)
58 | }
59 |
60 | func (any *int64Any) ToString() string {
61 | return strconv.FormatInt(any.val, 10)
62 | }
63 |
64 | func (any *int64Any) WriteTo(stream *Stream) {
65 | stream.WriteInt64(any.val)
66 | }
67 |
68 | func (any *int64Any) Parse() *Iterator {
69 | return nil
70 | }
71 |
72 | func (any *int64Any) GetInterface() interface{} {
73 | return any.val
74 | }
75 |
--------------------------------------------------------------------------------
/vendor/github.com/json-iterator/go/feature_any_invalid.go:
--------------------------------------------------------------------------------
1 | package jsoniter
2 |
3 | import "fmt"
4 |
5 | type invalidAny struct {
6 | baseAny
7 | err error
8 | }
9 |
10 | func newInvalidAny(path []interface{}) *invalidAny {
11 | return &invalidAny{baseAny{}, fmt.Errorf("%v not found", path)}
12 | }
13 |
14 | func (any *invalidAny) LastError() error {
15 | return any.err
16 | }
17 |
18 | func (any *invalidAny) ValueType() ValueType {
19 | return InvalidValue
20 | }
21 |
22 | func (any *invalidAny) MustBeValid() Any {
23 | panic(any.err)
24 | }
25 |
26 | func (any *invalidAny) ToBool() bool {
27 | return false
28 | }
29 |
30 | func (any *invalidAny) ToInt() int {
31 | return 0
32 | }
33 |
34 | func (any *invalidAny) ToInt32() int32 {
35 | return 0
36 | }
37 |
38 | func (any *invalidAny) ToInt64() int64 {
39 | return 0
40 | }
41 |
42 | func (any *invalidAny) ToUint() uint {
43 | return 0
44 | }
45 |
46 | func (any *invalidAny) ToUint32() uint32 {
47 | return 0
48 | }
49 |
50 | func (any *invalidAny) ToUint64() uint64 {
51 | return 0
52 | }
53 |
54 | func (any *invalidAny) ToFloat32() float32 {
55 | return 0
56 | }
57 |
58 | func (any *invalidAny) ToFloat64() float64 {
59 | return 0
60 | }
61 |
62 | func (any *invalidAny) ToString() string {
63 | return ""
64 | }
65 |
66 | func (any *invalidAny) WriteTo(stream *Stream) {
67 | }
68 |
69 | func (any *invalidAny) Get(path ...interface{}) Any {
70 | if any.err == nil {
71 | return &invalidAny{baseAny{}, fmt.Errorf("get %v from invalid", path)}
72 | }
73 | return &invalidAny{baseAny{}, fmt.Errorf("%v, get %v from invalid", any.err, path)}
74 | }
75 |
76 | func (any *invalidAny) Parse() *Iterator {
77 | return nil
78 | }
79 |
80 | func (any *invalidAny) GetInterface() interface{} {
81 | return nil
82 | }
83 |
--------------------------------------------------------------------------------
/vendor/github.com/json-iterator/go/feature_any_nil.go:
--------------------------------------------------------------------------------
1 | package jsoniter
2 |
3 | type nilAny struct {
4 | baseAny
5 | }
6 |
7 | func (any *nilAny) LastError() error {
8 | return nil
9 | }
10 |
11 | func (any *nilAny) ValueType() ValueType {
12 | return NilValue
13 | }
14 |
15 | func (any *nilAny) MustBeValid() Any {
16 | return any
17 | }
18 |
19 | func (any *nilAny) ToBool() bool {
20 | return false
21 | }
22 |
23 | func (any *nilAny) ToInt() int {
24 | return 0
25 | }
26 |
27 | func (any *nilAny) ToInt32() int32 {
28 | return 0
29 | }
30 |
31 | func (any *nilAny) ToInt64() int64 {
32 | return 0
33 | }
34 |
35 | func (any *nilAny) ToUint() uint {
36 | return 0
37 | }
38 |
39 | func (any *nilAny) ToUint32() uint32 {
40 | return 0
41 | }
42 |
43 | func (any *nilAny) ToUint64() uint64 {
44 | return 0
45 | }
46 |
47 | func (any *nilAny) ToFloat32() float32 {
48 | return 0
49 | }
50 |
51 | func (any *nilAny) ToFloat64() float64 {
52 | return 0
53 | }
54 |
55 | func (any *nilAny) ToString() string {
56 | return ""
57 | }
58 |
59 | func (any *nilAny) WriteTo(stream *Stream) {
60 | stream.WriteNil()
61 | }
62 |
63 | func (any *nilAny) Parse() *Iterator {
64 | return nil
65 | }
66 |
67 | func (any *nilAny) GetInterface() interface{} {
68 | return nil
69 | }
70 |
--------------------------------------------------------------------------------
/vendor/github.com/json-iterator/go/feature_any_uint32.go:
--------------------------------------------------------------------------------
1 | package jsoniter
2 |
3 | import (
4 | "strconv"
5 | )
6 |
7 | type uint32Any struct {
8 | baseAny
9 | val uint32
10 | }
11 |
12 | func (any *uint32Any) LastError() error {
13 | return nil
14 | }
15 |
16 | func (any *uint32Any) ValueType() ValueType {
17 | return NumberValue
18 | }
19 |
20 | func (any *uint32Any) MustBeValid() Any {
21 | return any
22 | }
23 |
24 | func (any *uint32Any) ToBool() bool {
25 | return any.val != 0
26 | }
27 |
28 | func (any *uint32Any) ToInt() int {
29 | return int(any.val)
30 | }
31 |
32 | func (any *uint32Any) ToInt32() int32 {
33 | return int32(any.val)
34 | }
35 |
36 | func (any *uint32Any) ToInt64() int64 {
37 | return int64(any.val)
38 | }
39 |
40 | func (any *uint32Any) ToUint() uint {
41 | return uint(any.val)
42 | }
43 |
44 | func (any *uint32Any) ToUint32() uint32 {
45 | return any.val
46 | }
47 |
48 | func (any *uint32Any) ToUint64() uint64 {
49 | return uint64(any.val)
50 | }
51 |
52 | func (any *uint32Any) ToFloat32() float32 {
53 | return float32(any.val)
54 | }
55 |
56 | func (any *uint32Any) ToFloat64() float64 {
57 | return float64(any.val)
58 | }
59 |
60 | func (any *uint32Any) ToString() string {
61 | return strconv.FormatInt(int64(any.val), 10)
62 | }
63 |
64 | func (any *uint32Any) WriteTo(stream *Stream) {
65 | stream.WriteUint32(any.val)
66 | }
67 |
68 | func (any *uint32Any) Parse() *Iterator {
69 | return nil
70 | }
71 |
72 | func (any *uint32Any) GetInterface() interface{} {
73 | return any.val
74 | }
75 |
--------------------------------------------------------------------------------
/vendor/github.com/json-iterator/go/feature_any_uint64.go:
--------------------------------------------------------------------------------
1 | package jsoniter
2 |
3 | import (
4 | "strconv"
5 | )
6 |
7 | type uint64Any struct {
8 | baseAny
9 | val uint64
10 | }
11 |
12 | func (any *uint64Any) LastError() error {
13 | return nil
14 | }
15 |
16 | func (any *uint64Any) ValueType() ValueType {
17 | return NumberValue
18 | }
19 |
20 | func (any *uint64Any) MustBeValid() Any {
21 | return any
22 | }
23 |
24 | func (any *uint64Any) ToBool() bool {
25 | return any.val != 0
26 | }
27 |
28 | func (any *uint64Any) ToInt() int {
29 | return int(any.val)
30 | }
31 |
32 | func (any *uint64Any) ToInt32() int32 {
33 | return int32(any.val)
34 | }
35 |
36 | func (any *uint64Any) ToInt64() int64 {
37 | return int64(any.val)
38 | }
39 |
40 | func (any *uint64Any) ToUint() uint {
41 | return uint(any.val)
42 | }
43 |
44 | func (any *uint64Any) ToUint32() uint32 {
45 | return uint32(any.val)
46 | }
47 |
48 | func (any *uint64Any) ToUint64() uint64 {
49 | return any.val
50 | }
51 |
52 | func (any *uint64Any) ToFloat32() float32 {
53 | return float32(any.val)
54 | }
55 |
56 | func (any *uint64Any) ToFloat64() float64 {
57 | return float64(any.val)
58 | }
59 |
60 | func (any *uint64Any) ToString() string {
61 | return strconv.FormatUint(any.val, 10)
62 | }
63 |
64 | func (any *uint64Any) WriteTo(stream *Stream) {
65 | stream.WriteUint64(any.val)
66 | }
67 |
68 | func (any *uint64Any) Parse() *Iterator {
69 | return nil
70 | }
71 |
72 | func (any *uint64Any) GetInterface() interface{} {
73 | return any.val
74 | }
75 |
--------------------------------------------------------------------------------
/vendor/github.com/json-iterator/go/feature_iter_array.go:
--------------------------------------------------------------------------------
1 | package jsoniter
2 |
3 | // ReadArray read array element, tells if the array has more element to read.
4 | func (iter *Iterator) ReadArray() (ret bool) {
5 | c := iter.nextToken()
6 | switch c {
7 | case 'n':
8 | iter.skipThreeBytes('u', 'l', 'l')
9 | return false // null
10 | case '[':
11 | c = iter.nextToken()
12 | if c != ']' {
13 | iter.unreadByte()
14 | return true
15 | }
16 | return false
17 | case ']':
18 | return false
19 | case ',':
20 | return true
21 | default:
22 | iter.ReportError("ReadArray", "expect [ or , or ] or n, but found "+string([]byte{c}))
23 | return
24 | }
25 | }
26 |
27 | // ReadArrayCB read array with callback
28 | func (iter *Iterator) ReadArrayCB(callback func(*Iterator) bool) (ret bool) {
29 | c := iter.nextToken()
30 | if c == '[' {
31 | c = iter.nextToken()
32 | if c != ']' {
33 | iter.unreadByte()
34 | if !callback(iter) {
35 | return false
36 | }
37 | c = iter.nextToken()
38 | for c == ',' {
39 | if !callback(iter) {
40 | return false
41 | }
42 | c = iter.nextToken()
43 | }
44 | if c != ']' {
45 | iter.ReportError("ReadArrayCB", "expect ] in the end, but found "+string([]byte{c}))
46 | return false
47 | }
48 | return true
49 | }
50 | return true
51 | }
52 | if c == 'n' {
53 | iter.skipThreeBytes('u', 'l', 'l')
54 | return true // null
55 | }
56 | iter.ReportError("ReadArrayCB", "expect [ or n, but found "+string([]byte{c}))
57 | return false
58 | }
59 |
--------------------------------------------------------------------------------
/vendor/github.com/json-iterator/go/feature_iter_skip_strict.go:
--------------------------------------------------------------------------------
1 | //+build !jsoniter_sloppy
2 |
3 | package jsoniter
4 |
5 | import "fmt"
6 |
7 | func (iter *Iterator) skipNumber() {
8 | if !iter.trySkipNumber() {
9 | iter.unreadByte()
10 | iter.ReadFloat32()
11 | }
12 | }
13 |
14 | func (iter *Iterator) trySkipNumber() bool {
15 | dotFound := false
16 | for i := iter.head; i < iter.tail; i++ {
17 | c := iter.buf[i]
18 | switch c {
19 | case '0', '1', '2', '3', '4', '5', '6', '7', '8', '9':
20 | case '.':
21 | if dotFound {
22 | iter.ReportError("validateNumber", `more than one dot found in number`)
23 | return true // already failed
24 | }
25 | if i+1 == iter.tail {
26 | return false
27 | }
28 | c = iter.buf[i+1]
29 | switch c {
30 | case '0', '1', '2', '3', '4', '5', '6', '7', '8', '9':
31 | default:
32 | iter.ReportError("validateNumber", `missing digit after dot`)
33 | return true // already failed
34 | }
35 | dotFound = true
36 | default:
37 | switch c {
38 | case ',', ']', '}', ' ', '\t', '\n', '\r':
39 | if iter.head == i {
40 | return false // if - without following digits
41 | }
42 | iter.head = i
43 | return true // must be valid
44 | }
45 | return false // may be invalid
46 | }
47 | }
48 | return false
49 | }
50 |
51 | func (iter *Iterator) skipString() {
52 | if !iter.trySkipString() {
53 | iter.unreadByte()
54 | iter.ReadString()
55 | }
56 | }
57 |
58 | func (iter *Iterator) trySkipString() bool {
59 | for i := iter.head; i < iter.tail; i++ {
60 | c := iter.buf[i]
61 | if c == '"' {
62 | iter.head = i + 1
63 | return true // valid
64 | } else if c == '\\' {
65 | return false
66 | } else if c < ' ' {
67 | iter.ReportError("trySkipString",
68 | fmt.Sprintf(`invalid control character found: %d`, c))
69 | return true // already failed
70 | }
71 | }
72 | return false
73 | }
74 |
75 | func (iter *Iterator) skipObject() {
76 | iter.unreadByte()
77 | iter.ReadObjectCB(func(iter *Iterator, field string) bool {
78 | iter.Skip()
79 | return true
80 | })
81 | }
82 |
83 | func (iter *Iterator) skipArray() {
84 | iter.unreadByte()
85 | iter.ReadArrayCB(func(iter *Iterator) bool {
86 | iter.Skip()
87 | return true
88 | })
89 | }
90 |
--------------------------------------------------------------------------------
/vendor/github.com/json-iterator/go/feature_json_number.go:
--------------------------------------------------------------------------------
1 | package jsoniter
2 |
3 | import (
4 | "encoding/json"
5 | "strconv"
6 | )
7 |
8 | type Number string
9 |
10 | // String returns the literal text of the number.
11 | func (n Number) String() string { return string(n) }
12 |
13 | // Float64 returns the number as a float64.
14 | func (n Number) Float64() (float64, error) {
15 | return strconv.ParseFloat(string(n), 64)
16 | }
17 |
18 | // Int64 returns the number as an int64.
19 | func (n Number) Int64() (int64, error) {
20 | return strconv.ParseInt(string(n), 10, 64)
21 | }
22 |
23 | func CastJsonNumber(val interface{}) (string, bool) {
24 | switch typedVal := val.(type) {
25 | case json.Number:
26 | return string(typedVal), true
27 | case Number:
28 | return string(typedVal), true
29 | }
30 | return "", false
31 | }
32 |
--------------------------------------------------------------------------------
/vendor/github.com/json-iterator/go/feature_pool.go:
--------------------------------------------------------------------------------
1 | package jsoniter
2 |
3 | import (
4 | "io"
5 | )
6 |
7 | // IteratorPool a thread safe pool of iterators with same configuration
8 | type IteratorPool interface {
9 | BorrowIterator(data []byte) *Iterator
10 | ReturnIterator(iter *Iterator)
11 | }
12 |
13 | // StreamPool a thread safe pool of streams with same configuration
14 | type StreamPool interface {
15 | BorrowStream(writer io.Writer) *Stream
16 | ReturnStream(stream *Stream)
17 | }
18 |
19 | func (cfg *frozenConfig) BorrowStream(writer io.Writer) *Stream {
20 | select {
21 | case stream := <-cfg.streamPool:
22 | stream.Reset(writer)
23 | return stream
24 | default:
25 | return NewStream(cfg, writer, 512)
26 | }
27 | }
28 |
29 | func (cfg *frozenConfig) ReturnStream(stream *Stream) {
30 | stream.Error = nil
31 | stream.Attachment = nil
32 | select {
33 | case cfg.streamPool <- stream:
34 | return
35 | default:
36 | return
37 | }
38 | }
39 |
40 | func (cfg *frozenConfig) BorrowIterator(data []byte) *Iterator {
41 | select {
42 | case iter := <-cfg.iteratorPool:
43 | iter.ResetBytes(data)
44 | return iter
45 | default:
46 | return ParseBytes(cfg, data)
47 | }
48 | }
49 |
50 | func (cfg *frozenConfig) ReturnIterator(iter *Iterator) {
51 | iter.Error = nil
52 | iter.Attachment = nil
53 | select {
54 | case cfg.iteratorPool <- iter:
55 | return
56 | default:
57 | return
58 | }
59 | }
60 |
--------------------------------------------------------------------------------
/vendor/github.com/json-iterator/go/feature_stream_float.go:
--------------------------------------------------------------------------------
1 | package jsoniter
2 |
3 | import (
4 | "math"
5 | "strconv"
6 | )
7 |
8 | var pow10 []uint64
9 |
10 | func init() {
11 | pow10 = []uint64{1, 10, 100, 1000, 10000, 100000, 1000000}
12 | }
13 |
14 | // WriteFloat32 write float32 to stream
15 | func (stream *Stream) WriteFloat32(val float32) {
16 | abs := math.Abs(float64(val))
17 | fmt := byte('f')
18 | // Note: Must use float32 comparisons for underlying float32 value to get precise cutoffs right.
19 | if abs != 0 {
20 | if float32(abs) < 1e-6 || float32(abs) >= 1e21 {
21 | fmt = 'e'
22 | }
23 | }
24 | stream.WriteRaw(strconv.FormatFloat(float64(val), fmt, -1, 32))
25 | }
26 |
27 | // WriteFloat32Lossy write float32 to stream with ONLY 6 digits precision although much much faster
28 | func (stream *Stream) WriteFloat32Lossy(val float32) {
29 | if val < 0 {
30 | stream.writeByte('-')
31 | val = -val
32 | }
33 | if val > 0x4ffffff {
34 | stream.WriteFloat32(val)
35 | return
36 | }
37 | precision := 6
38 | exp := uint64(1000000) // 6
39 | lval := uint64(float64(val)*float64(exp) + 0.5)
40 | stream.WriteUint64(lval / exp)
41 | fval := lval % exp
42 | if fval == 0 {
43 | return
44 | }
45 | stream.writeByte('.')
46 | stream.ensure(10)
47 | for p := precision - 1; p > 0 && fval < pow10[p]; p-- {
48 | stream.writeByte('0')
49 | }
50 | stream.WriteUint64(fval)
51 | for stream.buf[stream.n-1] == '0' {
52 | stream.n--
53 | }
54 | }
55 |
56 | // WriteFloat64 write float64 to stream
57 | func (stream *Stream) WriteFloat64(val float64) {
58 | abs := math.Abs(val)
59 | fmt := byte('f')
60 | // Note: Must use float32 comparisons for underlying float32 value to get precise cutoffs right.
61 | if abs != 0 {
62 | if abs < 1e-6 || abs >= 1e21 {
63 | fmt = 'e'
64 | }
65 | }
66 | stream.WriteRaw(strconv.FormatFloat(float64(val), fmt, -1, 64))
67 | }
68 |
69 | // WriteFloat64Lossy write float64 to stream with ONLY 6 digits precision although much much faster
70 | func (stream *Stream) WriteFloat64Lossy(val float64) {
71 | if val < 0 {
72 | stream.writeByte('-')
73 | val = -val
74 | }
75 | if val > 0x4ffffff {
76 | stream.WriteFloat64(val)
77 | return
78 | }
79 | precision := 6
80 | exp := uint64(1000000) // 6
81 | lval := uint64(val*float64(exp) + 0.5)
82 | stream.WriteUint64(lval / exp)
83 | fval := lval % exp
84 | if fval == 0 {
85 | return
86 | }
87 | stream.writeByte('.')
88 | stream.ensure(10)
89 | for p := precision - 1; p > 0 && fval < pow10[p]; p-- {
90 | stream.writeByte('0')
91 | }
92 | stream.WriteUint64(fval)
93 | for stream.buf[stream.n-1] == '0' {
94 | stream.n--
95 | }
96 | }
97 |
--------------------------------------------------------------------------------
/vendor/github.com/json-iterator/go/fuzzy_mode_convert_table.md:
--------------------------------------------------------------------------------
1 | | json type \ dest type | bool | int | uint | float |string|
2 | | --- | --- | --- | --- |--|--|
3 | | number | positive => true
negative => true
zero => false| 23.2 => 23
-32.1 => -32| 12.1 => 12
-12.1 => 0|as normal|same as origin|
4 | | string | empty string => false
string "0" => false
other strings => true | "123.32" => 123
"-123.4" => -123
"123.23xxxw" => 123
"abcde12" => 0
"-32.1" => -32| 13.2 => 13
-1.1 => 0 |12.1 => 12.1
-12.3 => -12.3
12.4xxa => 12.4
+1.1e2 =>110 |same as origin|
5 | | bool | true => true
false => false| true => 1
false => 0 | true => 1
false => 0 |true => 1
false => 0|true => "true"
false => "false"|
6 | | object | true | 0 | 0 |0|originnal json|
7 | | array | empty array => false
nonempty array => true| [] => 0
[1,2] => 1 | [] => 0
[1,2] => 1 |[] => 0
[1,2] => 1|original json|
--------------------------------------------------------------------------------
/vendor/github.com/json-iterator/go/jsoniter.go:
--------------------------------------------------------------------------------
1 | // Package jsoniter implements encoding and decoding of JSON as defined in
2 | // RFC 4627 and provides interfaces with identical syntax of standard lib encoding/json.
3 | // Converting from encoding/json to jsoniter is no more than replacing the package with jsoniter
4 | // and variable type declarations (if any).
5 | // jsoniter interfaces gives 100% compatibility with code using standard lib.
6 | //
7 | // "JSON and Go"
8 | // (https://golang.org/doc/articles/json_and_go.html)
9 | // gives a description of how Marshal/Unmarshal operate
10 | // between arbitrary or predefined json objects and bytes,
11 | // and it applies to jsoniter.Marshal/Unmarshal as well.
12 | //
13 | // Besides, jsoniter.Iterator provides a different set of interfaces
14 | // iterating given bytes/string/reader
15 | // and yielding parsed elements one by one.
16 | // This set of interfaces reads input as required and gives
17 | // better performance.
18 | package jsoniter
19 |
--------------------------------------------------------------------------------
/vendor/github.com/json-iterator/go/test.sh:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env bash
2 |
3 | set -e
4 | echo "" > coverage.txt
5 |
6 | for d in $(go list ./... | grep -v vendor); do
7 | go test -coverprofile=profile.out $d
8 | if [ -f profile.out ]; then
9 | cat profile.out >> coverage.txt
10 | rm profile.out
11 | fi
12 | done
13 |
--------------------------------------------------------------------------------
/vendor/github.com/mattn/go-isatty/LICENSE:
--------------------------------------------------------------------------------
1 | Copyright (c) Yasuhiro MATSUMOTO
2 |
3 | MIT License (Expat)
4 |
5 | Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
6 |
7 | The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
8 |
9 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
10 |
--------------------------------------------------------------------------------
/vendor/github.com/mattn/go-isatty/README.md:
--------------------------------------------------------------------------------
1 | # go-isatty
2 |
3 | [](http://godoc.org/github.com/mattn/go-isatty)
4 | [](https://travis-ci.org/mattn/go-isatty)
5 | [](https://coveralls.io/github/mattn/go-isatty?branch=master)
6 | [](https://goreportcard.com/report/mattn/go-isatty)
7 |
8 | isatty for golang
9 |
10 | ## Usage
11 |
12 | ```go
13 | package main
14 |
15 | import (
16 | "fmt"
17 | "github.com/mattn/go-isatty"
18 | "os"
19 | )
20 |
21 | func main() {
22 | if isatty.IsTerminal(os.Stdout.Fd()) {
23 | fmt.Println("Is Terminal")
24 | } else if isatty.IsCygwinTerminal(os.Stdout.Fd()) {
25 | fmt.Println("Is Cygwin/MSYS2 Terminal")
26 | } else {
27 | fmt.Println("Is Not Terminal")
28 | }
29 | }
30 | ```
31 |
32 | ## Installation
33 |
34 | ```
35 | $ go get github.com/mattn/go-isatty
36 | ```
37 |
38 | ## License
39 |
40 | MIT
41 |
42 | ## Author
43 |
44 | Yasuhiro Matsumoto (a.k.a mattn)
45 |
46 | ## Thanks
47 |
48 | * k-takata: base idea for IsCygwinTerminal
49 |
50 | https://github.com/k-takata/go-iscygpty
51 |
--------------------------------------------------------------------------------
/vendor/github.com/mattn/go-isatty/doc.go:
--------------------------------------------------------------------------------
1 | // Package isatty implements interface to isatty
2 | package isatty
3 |
--------------------------------------------------------------------------------
/vendor/github.com/mattn/go-isatty/isatty_appengine.go:
--------------------------------------------------------------------------------
1 | // +build appengine
2 |
3 | package isatty
4 |
5 | // IsTerminal returns true if the file descriptor is terminal which
6 | // is always false on on appengine classic which is a sandboxed PaaS.
7 | func IsTerminal(fd uintptr) bool {
8 | return false
9 | }
10 |
11 | // IsCygwinTerminal() return true if the file descriptor is a cygwin or msys2
12 | // terminal. This is also always false on this environment.
13 | func IsCygwinTerminal(fd uintptr) bool {
14 | return false
15 | }
16 |
--------------------------------------------------------------------------------
/vendor/github.com/mattn/go-isatty/isatty_bsd.go:
--------------------------------------------------------------------------------
1 | // +build darwin freebsd openbsd netbsd dragonfly
2 | // +build !appengine
3 |
4 | package isatty
5 |
6 | import (
7 | "syscall"
8 | "unsafe"
9 | )
10 |
11 | const ioctlReadTermios = syscall.TIOCGETA
12 |
13 | // IsTerminal return true if the file descriptor is terminal.
14 | func IsTerminal(fd uintptr) bool {
15 | var termios syscall.Termios
16 | _, _, err := syscall.Syscall6(syscall.SYS_IOCTL, fd, ioctlReadTermios, uintptr(unsafe.Pointer(&termios)), 0, 0, 0)
17 | return err == 0
18 | }
19 |
--------------------------------------------------------------------------------
/vendor/github.com/mattn/go-isatty/isatty_linux.go:
--------------------------------------------------------------------------------
1 | // +build linux
2 | // +build !appengine,!ppc64,!ppc64le
3 |
4 | package isatty
5 |
6 | import (
7 | "syscall"
8 | "unsafe"
9 | )
10 |
11 | const ioctlReadTermios = syscall.TCGETS
12 |
13 | // IsTerminal return true if the file descriptor is terminal.
14 | func IsTerminal(fd uintptr) bool {
15 | var termios syscall.Termios
16 | _, _, err := syscall.Syscall6(syscall.SYS_IOCTL, fd, ioctlReadTermios, uintptr(unsafe.Pointer(&termios)), 0, 0, 0)
17 | return err == 0
18 | }
19 |
--------------------------------------------------------------------------------
/vendor/github.com/mattn/go-isatty/isatty_linux_ppc64x.go:
--------------------------------------------------------------------------------
1 | // +build linux
2 | // +build ppc64 ppc64le
3 |
4 | package isatty
5 |
6 | import (
7 | "unsafe"
8 |
9 | syscall "golang.org/x/sys/unix"
10 | )
11 |
12 | const ioctlReadTermios = syscall.TCGETS
13 |
14 | // IsTerminal return true if the file descriptor is terminal.
15 | func IsTerminal(fd uintptr) bool {
16 | var termios syscall.Termios
17 | _, _, err := syscall.Syscall6(syscall.SYS_IOCTL, fd, ioctlReadTermios, uintptr(unsafe.Pointer(&termios)), 0, 0, 0)
18 | return err == 0
19 | }
20 |
--------------------------------------------------------------------------------
/vendor/github.com/mattn/go-isatty/isatty_others.go:
--------------------------------------------------------------------------------
1 | // +build !windows
2 | // +build !appengine
3 |
4 | package isatty
5 |
6 | // IsCygwinTerminal return true if the file descriptor is a cygwin or msys2
7 | // terminal. This is also always false on this environment.
8 | func IsCygwinTerminal(fd uintptr) bool {
9 | return false
10 | }
11 |
--------------------------------------------------------------------------------
/vendor/github.com/mattn/go-isatty/isatty_solaris.go:
--------------------------------------------------------------------------------
1 | // +build solaris
2 | // +build !appengine
3 |
4 | package isatty
5 |
6 | import (
7 | "golang.org/x/sys/unix"
8 | )
9 |
10 | // IsTerminal returns true if the given file descriptor is a terminal.
11 | // see: http://src.illumos.org/source/xref/illumos-gate/usr/src/lib/libbc/libc/gen/common/isatty.c
12 | func IsTerminal(fd uintptr) bool {
13 | var termio unix.Termio
14 | err := unix.IoctlSetTermio(int(fd), unix.TCGETA, &termio)
15 | return err == nil
16 | }
17 |
--------------------------------------------------------------------------------
/vendor/github.com/mattn/go-isatty/isatty_windows.go:
--------------------------------------------------------------------------------
1 | // +build windows
2 | // +build !appengine
3 |
4 | package isatty
5 |
6 | import (
7 | "strings"
8 | "syscall"
9 | "unicode/utf16"
10 | "unsafe"
11 | )
12 |
13 | const (
14 | fileNameInfo uintptr = 2
15 | fileTypePipe = 3
16 | )
17 |
18 | var (
19 | kernel32 = syscall.NewLazyDLL("kernel32.dll")
20 | procGetConsoleMode = kernel32.NewProc("GetConsoleMode")
21 | procGetFileInformationByHandleEx = kernel32.NewProc("GetFileInformationByHandleEx")
22 | procGetFileType = kernel32.NewProc("GetFileType")
23 | )
24 |
25 | func init() {
26 | // Check if GetFileInformationByHandleEx is available.
27 | if procGetFileInformationByHandleEx.Find() != nil {
28 | procGetFileInformationByHandleEx = nil
29 | }
30 | }
31 |
32 | // IsTerminal return true if the file descriptor is terminal.
33 | func IsTerminal(fd uintptr) bool {
34 | var st uint32
35 | r, _, e := syscall.Syscall(procGetConsoleMode.Addr(), 2, fd, uintptr(unsafe.Pointer(&st)), 0)
36 | return r != 0 && e == 0
37 | }
38 |
39 | // Check pipe name is used for cygwin/msys2 pty.
40 | // Cygwin/MSYS2 PTY has a name like:
41 | // \{cygwin,msys}-XXXXXXXXXXXXXXXX-ptyN-{from,to}-master
42 | func isCygwinPipeName(name string) bool {
43 | token := strings.Split(name, "-")
44 | if len(token) < 5 {
45 | return false
46 | }
47 |
48 | if token[0] != `\msys` && token[0] != `\cygwin` {
49 | return false
50 | }
51 |
52 | if token[1] == "" {
53 | return false
54 | }
55 |
56 | if !strings.HasPrefix(token[2], "pty") {
57 | return false
58 | }
59 |
60 | if token[3] != `from` && token[3] != `to` {
61 | return false
62 | }
63 |
64 | if token[4] != "master" {
65 | return false
66 | }
67 |
68 | return true
69 | }
70 |
71 | // IsCygwinTerminal() return true if the file descriptor is a cygwin or msys2
72 | // terminal.
73 | func IsCygwinTerminal(fd uintptr) bool {
74 | if procGetFileInformationByHandleEx == nil {
75 | return false
76 | }
77 |
78 | // Cygwin/msys's pty is a pipe.
79 | ft, _, e := syscall.Syscall(procGetFileType.Addr(), 1, fd, 0, 0)
80 | if ft != fileTypePipe || e != 0 {
81 | return false
82 | }
83 |
84 | var buf [2 + syscall.MAX_PATH]uint16
85 | r, _, e := syscall.Syscall6(procGetFileInformationByHandleEx.Addr(),
86 | 4, fd, fileNameInfo, uintptr(unsafe.Pointer(&buf)),
87 | uintptr(len(buf)*2), 0, 0)
88 | if r == 0 || e != 0 {
89 | return false
90 | }
91 |
92 | l := *(*uint32)(unsafe.Pointer(&buf))
93 | return isCygwinPipeName(string(utf16.Decode(buf[2 : 2+l/2])))
94 | }
95 |
--------------------------------------------------------------------------------
/vendor/github.com/pkg/errors/LICENSE:
--------------------------------------------------------------------------------
1 | Copyright (c) 2015, Dave Cheney
2 | All rights reserved.
3 |
4 | Redistribution and use in source and binary forms, with or without
5 | modification, are permitted provided that the following conditions are met:
6 |
7 | * Redistributions of source code must retain the above copyright notice, this
8 | list of conditions and the following disclaimer.
9 |
10 | * Redistributions in binary form must reproduce the above copyright notice,
11 | this list of conditions and the following disclaimer in the documentation
12 | and/or other materials provided with the distribution.
13 |
14 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
15 | AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
16 | IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
17 | DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
18 | FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
19 | DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
20 | SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
21 | CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
22 | OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
23 | OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
24 |
--------------------------------------------------------------------------------
/vendor/github.com/pkg/errors/README.md:
--------------------------------------------------------------------------------
1 | # errors [](https://travis-ci.org/pkg/errors) [](https://ci.appveyor.com/project/davecheney/errors/branch/master) [](http://godoc.org/github.com/pkg/errors) [](https://goreportcard.com/report/github.com/pkg/errors) [](https://sourcegraph.com/github.com/pkg/errors?badge)
2 |
3 | Package errors provides simple error handling primitives.
4 |
5 | `go get github.com/pkg/errors`
6 |
7 | The traditional error handling idiom in Go is roughly akin to
8 | ```go
9 | if err != nil {
10 | return err
11 | }
12 | ```
13 | which applied recursively up the call stack results in error reports without context or debugging information. The errors package allows programmers to add context to the failure path in their code in a way that does not destroy the original value of the error.
14 |
15 | ## Adding context to an error
16 |
17 | The errors.Wrap function returns a new error that adds context to the original error. For example
18 | ```go
19 | _, err := ioutil.ReadAll(r)
20 | if err != nil {
21 | return errors.Wrap(err, "read failed")
22 | }
23 | ```
24 | ## Retrieving the cause of an error
25 |
26 | Using `errors.Wrap` constructs a stack of errors, adding context to the preceding error. Depending on the nature of the error it may be necessary to reverse the operation of errors.Wrap to retrieve the original error for inspection. Any error value which implements this interface can be inspected by `errors.Cause`.
27 | ```go
28 | type causer interface {
29 | Cause() error
30 | }
31 | ```
32 | `errors.Cause` will recursively retrieve the topmost error which does not implement `causer`, which is assumed to be the original cause. For example:
33 | ```go
34 | switch err := errors.Cause(err).(type) {
35 | case *MyError:
36 | // handle specifically
37 | default:
38 | // unknown error
39 | }
40 | ```
41 |
42 | [Read the package documentation for more information](https://godoc.org/github.com/pkg/errors).
43 |
44 | ## Contributing
45 |
46 | We welcome pull requests, bug fixes and issue reports. With that said, the bar for adding new symbols to this package is intentionally set high.
47 |
48 | Before proposing a change, please discuss your change by raising an issue.
49 |
50 | ## License
51 |
52 | BSD-2-Clause
53 |
--------------------------------------------------------------------------------
/vendor/github.com/pkg/errors/appveyor.yml:
--------------------------------------------------------------------------------
1 | version: build-{build}.{branch}
2 |
3 | clone_folder: C:\gopath\src\github.com\pkg\errors
4 | shallow_clone: true # for startup speed
5 |
6 | environment:
7 | GOPATH: C:\gopath
8 |
9 | platform:
10 | - x64
11 |
12 | # http://www.appveyor.com/docs/installed-software
13 | install:
14 | # some helpful output for debugging builds
15 | - go version
16 | - go env
17 | # pre-installed MinGW at C:\MinGW is 32bit only
18 | # but MSYS2 at C:\msys64 has mingw64
19 | - set PATH=C:\msys64\mingw64\bin;%PATH%
20 | - gcc --version
21 | - g++ --version
22 |
23 | build_script:
24 | - go install -v ./...
25 |
26 | test_script:
27 | - set PATH=C:\gopath\bin;%PATH%
28 | - go test -v ./...
29 |
30 | #artifacts:
31 | # - path: '%GOPATH%\bin\*.exe'
32 | deploy: off
33 |
--------------------------------------------------------------------------------
/vendor/github.com/ugorji/go/LICENSE:
--------------------------------------------------------------------------------
1 | The MIT License (MIT)
2 |
3 | Copyright (c) 2012-2015 Ugorji Nwoke.
4 | All rights reserved.
5 |
6 | Permission is hereby granted, free of charge, to any person obtaining a copy
7 | of this software and associated documentation files (the "Software"), to deal
8 | in the Software without restriction, including without limitation the rights
9 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
10 | copies of the Software, and to permit persons to whom the Software is
11 | furnished to do so, subject to the following conditions:
12 |
13 | The above copyright notice and this permission notice shall be included in all
14 | copies or substantial portions of the Software.
15 |
16 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
22 | SOFTWARE.
23 |
--------------------------------------------------------------------------------
/vendor/github.com/ugorji/go/codec/fast-path.not.go:
--------------------------------------------------------------------------------
1 | // Copyright (c) 2012-2018 Ugorji Nwoke. All rights reserved.
2 | // Use of this source code is governed by a MIT license found in the LICENSE file.
3 |
4 | // +build notfastpath
5 |
6 | package codec
7 |
8 | import "reflect"
9 |
10 | const fastpathEnabled = false
11 |
12 | // The generated fast-path code is very large, and adds a few seconds to the build time.
13 | // This causes test execution, execution of small tools which use codec, etc
14 | // to take a long time.
15 | //
16 | // To mitigate, we now support the notfastpath tag.
17 | // This tag disables fastpath during build, allowing for faster build, test execution,
18 | // short-program runs, etc.
19 |
20 | func fastpathDecodeTypeSwitch(iv interface{}, d *Decoder) bool { return false }
21 | func fastpathEncodeTypeSwitch(iv interface{}, e *Encoder) bool { return false }
22 | func fastpathEncodeTypeSwitchSlice(iv interface{}, e *Encoder) bool { return false }
23 | func fastpathEncodeTypeSwitchMap(iv interface{}, e *Encoder) bool { return false }
24 | func fastpathDecodeSetZeroTypeSwitch(iv interface{}) bool { return false }
25 |
26 | type fastpathT struct{}
27 | type fastpathE struct {
28 | rtid uintptr
29 | rt reflect.Type
30 | encfn func(*Encoder, *codecFnInfo, reflect.Value)
31 | decfn func(*Decoder, *codecFnInfo, reflect.Value)
32 | }
33 | type fastpathA [0]fastpathE
34 |
35 | func (x fastpathA) index(rtid uintptr) int { return -1 }
36 |
37 | func (_ fastpathT) DecSliceUint8V(v []uint8, canChange bool, d *Decoder) (_ []uint8, changed bool) {
38 | fn := d.cfer().get(uint8SliceTyp, true, true)
39 | d.kSlice(&fn.i, reflect.ValueOf(&v).Elem())
40 | return v, true
41 | }
42 |
43 | var fastpathAV fastpathA
44 | var fastpathTV fastpathT
45 |
46 | // ----
47 | type TestMammoth2Wrapper struct{} // to allow testMammoth work in notfastpath mode
48 |
--------------------------------------------------------------------------------
/vendor/github.com/ugorji/go/codec/gen-dec-map.go.tmpl:
--------------------------------------------------------------------------------
1 | {{var "v"}} := *{{ .Varname }}
2 | {{var "l"}} := r.ReadMapStart()
3 | {{var "bh"}} := z.DecBasicHandle()
4 | if {{var "v"}} == nil {
5 | {{var "rl"}} := z.DecInferLen({{var "l"}}, {{var "bh"}}.MaxInitLen, {{ .Size }})
6 | {{var "v"}} = make(map[{{ .KTyp }}]{{ .Typ }}, {{var "rl"}})
7 | *{{ .Varname }} = {{var "v"}}
8 | }
9 | var {{var "mk"}} {{ .KTyp }}
10 | var {{var "mv"}} {{ .Typ }}
11 | var {{var "mg"}}, {{var "mdn"}} {{if decElemKindPtr}}, {{var "ms"}}, {{var "mok"}}{{end}} bool
12 | if {{var "bh"}}.MapValueReset {
13 | {{if decElemKindPtr}}{{var "mg"}} = true
14 | {{else if decElemKindIntf}}if !{{var "bh"}}.InterfaceReset { {{var "mg"}} = true }
15 | {{else if not decElemKindImmutable}}{{var "mg"}} = true
16 | {{end}} }
17 | if {{var "l"}} != 0 {
18 | {{var "hl"}} := {{var "l"}} > 0
19 | for {{var "j"}} := 0; ({{var "hl"}} && {{var "j"}} < {{var "l"}}) || !({{var "hl"}} || r.CheckBreak()); {{var "j"}}++ {
20 | r.ReadMapElemKey() {{/* z.DecSendContainerState(codecSelfer_containerMapKey{{ .Sfx }}) */}}
21 | {{ $x := printf "%vmk%v" .TempVar .Rand }}{{ decLineVarK $x }}
22 | {{ if eq .KTyp "interface{}" }}{{/* // special case if a byte array. */}}if {{var "bv"}}, {{var "bok"}} := {{var "mk"}}.([]byte); {{var "bok"}} {
23 | {{var "mk"}} = string({{var "bv"}})
24 | }{{ end }}{{if decElemKindPtr}}
25 | {{var "ms"}} = true{{end}}
26 | if {{var "mg"}} {
27 | {{if decElemKindPtr}}{{var "mv"}}, {{var "mok"}} = {{var "v"}}[{{var "mk"}}]
28 | if {{var "mok"}} {
29 | {{var "ms"}} = false
30 | } {{else}}{{var "mv"}} = {{var "v"}}[{{var "mk"}}] {{end}}
31 | } {{if not decElemKindImmutable}}else { {{var "mv"}} = {{decElemZero}} }{{end}}
32 | r.ReadMapElemValue() {{/* z.DecSendContainerState(codecSelfer_containerMapValue{{ .Sfx }}) */}}
33 | {{var "mdn"}} = false
34 | {{ $x := printf "%vmv%v" .TempVar .Rand }}{{ $y := printf "%vmdn%v" .TempVar .Rand }}{{ decLineVar $x $y }}
35 | if {{var "mdn"}} {
36 | if {{ var "bh" }}.DeleteOnNilMapValue { delete({{var "v"}}, {{var "mk"}}) } else { {{var "v"}}[{{var "mk"}}] = {{decElemZero}} }
37 | } else if {{if decElemKindPtr}} {{var "ms"}} && {{end}} {{var "v"}} != nil {
38 | {{var "v"}}[{{var "mk"}}] = {{var "mv"}}
39 | }
40 | }
41 | } // else len==0: TODO: Should we clear map entries?
42 | r.ReadMapEnd() {{/* z.DecSendContainerState(codecSelfer_containerMapEnd{{ .Sfx }}) */}}
43 |
--------------------------------------------------------------------------------
/vendor/github.com/ugorji/go/codec/goversion_arrayof_gte_go15.go:
--------------------------------------------------------------------------------
1 | // Copyright (c) 2012-2018 Ugorji Nwoke. All rights reserved.
2 | // Use of this source code is governed by a MIT license found in the LICENSE file.
3 |
4 | // +build go1.5
5 |
6 | package codec
7 |
8 | import "reflect"
9 |
10 | const reflectArrayOfSupported = true
11 |
12 | func reflectArrayOf(count int, elem reflect.Type) reflect.Type {
13 | return reflect.ArrayOf(count, elem)
14 | }
15 |
--------------------------------------------------------------------------------
/vendor/github.com/ugorji/go/codec/goversion_arrayof_lt_go15.go:
--------------------------------------------------------------------------------
1 | // Copyright (c) 2012-2018 Ugorji Nwoke. All rights reserved.
2 | // Use of this source code is governed by a MIT license found in the LICENSE file.
3 |
4 | // +build !go1.5
5 |
6 | package codec
7 |
8 | import "reflect"
9 |
10 | const reflectArrayOfSupported = false
11 |
12 | func reflectArrayOf(count int, elem reflect.Type) reflect.Type {
13 | panic("codec: reflect.ArrayOf unsupported in this go version")
14 | }
15 |
--------------------------------------------------------------------------------
/vendor/github.com/ugorji/go/codec/goversion_makemap_gte_go19.go:
--------------------------------------------------------------------------------
1 | // Copyright (c) 2012-2018 Ugorji Nwoke. All rights reserved.
2 | // Use of this source code is governed by a MIT license found in the LICENSE file.
3 |
4 | // +build go1.9
5 |
6 | package codec
7 |
8 | import "reflect"
9 |
10 | func makeMapReflect(t reflect.Type, size int) reflect.Value {
11 | if size < 0 {
12 | return reflect.MakeMapWithSize(t, 4)
13 | }
14 | return reflect.MakeMapWithSize(t, size)
15 | }
16 |
--------------------------------------------------------------------------------
/vendor/github.com/ugorji/go/codec/goversion_makemap_lt_go19.go:
--------------------------------------------------------------------------------
1 | // Copyright (c) 2012-2018 Ugorji Nwoke. All rights reserved.
2 | // Use of this source code is governed by a MIT license found in the LICENSE file.
3 |
4 | // +build !go1.9
5 |
6 | package codec
7 |
8 | import "reflect"
9 |
10 | func makeMapReflect(t reflect.Type, size int) reflect.Value {
11 | return reflect.MakeMap(t)
12 | }
13 |
--------------------------------------------------------------------------------
/vendor/github.com/ugorji/go/codec/goversion_unexportedembeddedptr_gte_go110.go:
--------------------------------------------------------------------------------
1 | // Copyright (c) 2012-2018 Ugorji Nwoke. All rights reserved.
2 | // Use of this source code is governed by a MIT license found in the LICENSE file.
3 |
4 | // +build go1.10
5 |
6 | package codec
7 |
8 | const allowSetUnexportedEmbeddedPtr = false
9 |
--------------------------------------------------------------------------------
/vendor/github.com/ugorji/go/codec/goversion_unexportedembeddedptr_lt_go110.go:
--------------------------------------------------------------------------------
1 | // Copyright (c) 2012-2018 Ugorji Nwoke. All rights reserved.
2 | // Use of this source code is governed by a MIT license found in the LICENSE file.
3 |
4 | // +build !go1.10
5 |
6 | package codec
7 |
8 | const allowSetUnexportedEmbeddedPtr = true
9 |
--------------------------------------------------------------------------------
/vendor/github.com/ugorji/go/codec/goversion_unsupported_lt_go14.go:
--------------------------------------------------------------------------------
1 | // Copyright (c) 2012-2018 Ugorji Nwoke. All rights reserved.
2 | // Use of this source code is governed by a MIT license found in the LICENSE file.
3 |
4 | // +build !go1.4
5 |
6 | package codec
7 |
8 | // This codec package will only work for go1.4 and above.
9 | // This is for the following reasons:
10 | // - go 1.4 was released in 2014
11 | // - go runtime is written fully in go
12 | // - interface only holds pointers
13 | // - reflect.Value is stabilized as 3 words
14 |
15 | func init() {
16 | panic("codec: go 1.3 and below are not supported")
17 | }
18 |
--------------------------------------------------------------------------------
/vendor/github.com/ugorji/go/codec/goversion_vendor_eq_go15.go:
--------------------------------------------------------------------------------
1 | // Copyright (c) 2012-2018 Ugorji Nwoke. All rights reserved.
2 | // Use of this source code is governed by a MIT license found in the LICENSE file.
3 |
4 | // +build go1.5,!go1.6
5 |
6 | package codec
7 |
8 | import "os"
9 |
10 | var genCheckVendor = os.Getenv("GO15VENDOREXPERIMENT") == "1"
11 |
--------------------------------------------------------------------------------
/vendor/github.com/ugorji/go/codec/goversion_vendor_eq_go16.go:
--------------------------------------------------------------------------------
1 | // Copyright (c) 2012-2018 Ugorji Nwoke. All rights reserved.
2 | // Use of this source code is governed by a MIT license found in the LICENSE file.
3 |
4 | // +build go1.6,!go1.7
5 |
6 | package codec
7 |
8 | import "os"
9 |
10 | var genCheckVendor = os.Getenv("GO15VENDOREXPERIMENT") != "0"
11 |
--------------------------------------------------------------------------------
/vendor/github.com/ugorji/go/codec/goversion_vendor_gte_go17.go:
--------------------------------------------------------------------------------
1 | // Copyright (c) 2012-2018 Ugorji Nwoke. All rights reserved.
2 | // Use of this source code is governed by a MIT license found in the LICENSE file.
3 |
4 | // +build go1.7
5 |
6 | package codec
7 |
8 | const genCheckVendor = true
9 |
--------------------------------------------------------------------------------
/vendor/github.com/ugorji/go/codec/goversion_vendor_lt_go15.go:
--------------------------------------------------------------------------------
1 | // Copyright (c) 2012-2018 Ugorji Nwoke. All rights reserved.
2 | // Use of this source code is governed by a MIT license found in the LICENSE file.
3 |
4 | // +build !go1.5
5 |
6 | package codec
7 |
8 | var genCheckVendor = false
9 |
--------------------------------------------------------------------------------
/vendor/golang.org/x/sys/LICENSE:
--------------------------------------------------------------------------------
1 | Copyright (c) 2009 The Go Authors. All rights reserved.
2 |
3 | Redistribution and use in source and binary forms, with or without
4 | modification, are permitted provided that the following conditions are
5 | met:
6 |
7 | * Redistributions of source code must retain the above copyright
8 | notice, this list of conditions and the following disclaimer.
9 | * Redistributions in binary form must reproduce the above
10 | copyright notice, this list of conditions and the following disclaimer
11 | in the documentation and/or other materials provided with the
12 | distribution.
13 | * Neither the name of Google Inc. nor the names of its
14 | contributors may be used to endorse or promote products derived from
15 | this software without specific prior written permission.
16 |
17 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
18 | "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
19 | LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
20 | A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
21 | OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
22 | SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
23 | LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
24 | DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
25 | THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
26 | (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
27 | OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
28 |
--------------------------------------------------------------------------------
/vendor/golang.org/x/sys/PATENTS:
--------------------------------------------------------------------------------
1 | Additional IP Rights Grant (Patents)
2 |
3 | "This implementation" means the copyrightable works distributed by
4 | Google as part of the Go project.
5 |
6 | Google hereby grants to You a perpetual, worldwide, non-exclusive,
7 | no-charge, royalty-free, irrevocable (except as stated in this section)
8 | patent license to make, have made, use, offer to sell, sell, import,
9 | transfer and otherwise run, modify and propagate the contents of this
10 | implementation of Go, where such license applies only to those patent
11 | claims, both currently owned or controlled by Google and acquired in
12 | the future, licensable by Google that are necessarily infringed by this
13 | implementation of Go. This grant does not include claims that would be
14 | infringed only as a consequence of further modification of this
15 | implementation. If you or your agent or exclusive licensee institute or
16 | order or agree to the institution of patent litigation against any
17 | entity (including a cross-claim or counterclaim in a lawsuit) alleging
18 | that this implementation of Go or any code incorporated within this
19 | implementation of Go constitutes direct or contributory patent
20 | infringement, or inducement of patent infringement, then any patent
21 | rights granted to you under this License for this implementation of Go
22 | shall terminate as of the date such litigation is filed.
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_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_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/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/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 |
--------------------------------------------------------------------------------
/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_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_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_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 | // See ../runtime/sys_linux_386.s for the reason why we always use int 0x80
14 | // instead of the glibc-specific "CALL 0x10(GS)".
15 | #define INVOKE_SYSCALL INT $0x80
16 |
17 | // Just jump to package syscall's implementation for all these functions.
18 | // The runtime may know about them.
19 |
20 | TEXT ·Syscall(SB),NOSPLIT,$0-28
21 | JMP syscall·Syscall(SB)
22 |
23 | TEXT ·Syscall6(SB),NOSPLIT,$0-40
24 | JMP syscall·Syscall6(SB)
25 |
26 | TEXT ·SyscallNoError(SB),NOSPLIT,$0-24
27 | CALL runtime·entersyscall(SB)
28 | MOVL trap+0(FP), AX // syscall entry
29 | MOVL a1+4(FP), BX
30 | MOVL a2+8(FP), CX
31 | MOVL a3+12(FP), DX
32 | MOVL $0, SI
33 | MOVL $0, DI
34 | INVOKE_SYSCALL
35 | MOVL AX, r1+16(FP)
36 | MOVL DX, r2+20(FP)
37 | CALL runtime·exitsyscall(SB)
38 | RET
39 |
40 | TEXT ·RawSyscall(SB),NOSPLIT,$0-28
41 | JMP syscall·RawSyscall(SB)
42 |
43 | TEXT ·RawSyscall6(SB),NOSPLIT,$0-40
44 | JMP syscall·RawSyscall6(SB)
45 |
46 | TEXT ·RawSyscallNoError(SB),NOSPLIT,$0-24
47 | MOVL trap+0(FP), AX // syscall entry
48 | MOVL a1+4(FP), BX
49 | MOVL a2+8(FP), CX
50 | MOVL a3+12(FP), DX
51 | MOVL $0, SI
52 | MOVL $0, DI
53 | INVOKE_SYSCALL
54 | MOVL AX, r1+16(FP)
55 | MOVL DX, r2+20(FP)
56 | RET
57 |
58 | TEXT ·socketcall(SB),NOSPLIT,$0-36
59 | JMP syscall·socketcall(SB)
60 |
61 | TEXT ·rawsocketcall(SB),NOSPLIT,$0-36
62 | JMP syscall·rawsocketcall(SB)
63 |
64 | TEXT ·seek(SB),NOSPLIT,$0-28
65 | JMP syscall·seek(SB)
66 |
--------------------------------------------------------------------------------
/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 ·SyscallNoError(SB),NOSPLIT,$0-48
23 | CALL runtime·entersyscall(SB)
24 | MOVQ a1+8(FP), DI
25 | MOVQ a2+16(FP), SI
26 | MOVQ a3+24(FP), DX
27 | MOVQ $0, R10
28 | MOVQ $0, R8
29 | MOVQ $0, R9
30 | MOVQ trap+0(FP), AX // syscall entry
31 | SYSCALL
32 | MOVQ AX, r1+32(FP)
33 | MOVQ DX, r2+40(FP)
34 | CALL runtime·exitsyscall(SB)
35 | RET
36 |
37 | TEXT ·RawSyscall(SB),NOSPLIT,$0-56
38 | JMP syscall·RawSyscall(SB)
39 |
40 | TEXT ·RawSyscall6(SB),NOSPLIT,$0-80
41 | JMP syscall·RawSyscall6(SB)
42 |
43 | TEXT ·RawSyscallNoError(SB),NOSPLIT,$0-48
44 | MOVQ a1+8(FP), DI
45 | MOVQ a2+16(FP), SI
46 | MOVQ a3+24(FP), DX
47 | MOVQ $0, R10
48 | MOVQ $0, R8
49 | MOVQ $0, R9
50 | MOVQ trap+0(FP), AX // syscall entry
51 | SYSCALL
52 | MOVQ AX, r1+32(FP)
53 | MOVQ DX, r2+40(FP)
54 | RET
55 |
56 | TEXT ·gettimeofday(SB),NOSPLIT,$0-16
57 | JMP syscall·gettimeofday(SB)
58 |
--------------------------------------------------------------------------------
/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 ·SyscallNoError(SB),NOSPLIT,$0-24
23 | BL runtime·entersyscall(SB)
24 | MOVW trap+0(FP), R7
25 | MOVW a1+4(FP), R0
26 | MOVW a2+8(FP), R1
27 | MOVW a3+12(FP), R2
28 | MOVW $0, R3
29 | MOVW $0, R4
30 | MOVW $0, R5
31 | SWI $0
32 | MOVW R0, r1+16(FP)
33 | MOVW $0, R0
34 | MOVW R0, r2+20(FP)
35 | BL runtime·exitsyscall(SB)
36 | RET
37 |
38 | TEXT ·RawSyscall(SB),NOSPLIT,$0-28
39 | B syscall·RawSyscall(SB)
40 |
41 | TEXT ·RawSyscall6(SB),NOSPLIT,$0-40
42 | B syscall·RawSyscall6(SB)
43 |
44 | TEXT ·RawSyscallNoError(SB),NOSPLIT,$0-24
45 | MOVW trap+0(FP), R7 // syscall entry
46 | MOVW a1+4(FP), R0
47 | MOVW a2+8(FP), R1
48 | MOVW a3+12(FP), R2
49 | SWI $0
50 | MOVW R0, r1+16(FP)
51 | MOVW $0, R0
52 | MOVW R0, r2+20(FP)
53 | RET
54 |
55 | TEXT ·seek(SB),NOSPLIT,$0-28
56 | B syscall·seek(SB)
57 |
--------------------------------------------------------------------------------
/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 ·SyscallNoError(SB),NOSPLIT,$0-48
21 | BL runtime·entersyscall(SB)
22 | MOVD a1+8(FP), R0
23 | MOVD a2+16(FP), R1
24 | MOVD a3+24(FP), R2
25 | MOVD $0, R3
26 | MOVD $0, R4
27 | MOVD $0, R5
28 | MOVD trap+0(FP), R8 // syscall entry
29 | SVC
30 | MOVD R0, r1+32(FP) // r1
31 | MOVD R1, r2+40(FP) // r2
32 | BL runtime·exitsyscall(SB)
33 | RET
34 |
35 | TEXT ·RawSyscall(SB),NOSPLIT,$0-56
36 | B syscall·RawSyscall(SB)
37 |
38 | TEXT ·RawSyscall6(SB),NOSPLIT,$0-80
39 | B syscall·RawSyscall6(SB)
40 |
41 | TEXT ·RawSyscallNoError(SB),NOSPLIT,$0-48
42 | MOVD a1+8(FP), R0
43 | MOVD a2+16(FP), R1
44 | MOVD a3+24(FP), R2
45 | MOVD $0, R3
46 | MOVD $0, R4
47 | MOVD $0, R5
48 | MOVD trap+0(FP), R8 // syscall entry
49 | SVC
50 | MOVD R0, r1+32(FP)
51 | MOVD R1, r2+40(FP)
52 | RET
53 |
--------------------------------------------------------------------------------
/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 ·SyscallNoError(SB),NOSPLIT,$0-48
25 | JAL runtime·entersyscall(SB)
26 | MOVV a1+8(FP), R4
27 | MOVV a2+16(FP), R5
28 | MOVV a3+24(FP), R6
29 | MOVV R0, R7
30 | MOVV R0, R8
31 | MOVV R0, R9
32 | MOVV trap+0(FP), R2 // syscall entry
33 | SYSCALL
34 | MOVV R2, r1+32(FP)
35 | MOVV R3, r2+40(FP)
36 | JAL runtime·exitsyscall(SB)
37 | RET
38 |
39 | TEXT ·RawSyscall(SB),NOSPLIT,$0-56
40 | JMP syscall·RawSyscall(SB)
41 |
42 | TEXT ·RawSyscall6(SB),NOSPLIT,$0-80
43 | JMP syscall·RawSyscall6(SB)
44 |
45 | TEXT ·RawSyscallNoError(SB),NOSPLIT,$0-48
46 | MOVV a1+8(FP), R4
47 | MOVV a2+16(FP), R5
48 | MOVV a3+24(FP), R6
49 | MOVV R0, R7
50 | MOVV R0, R8
51 | MOVV R0, R9
52 | MOVV trap+0(FP), R2 // syscall entry
53 | SYSCALL
54 | MOVV R2, r1+32(FP)
55 | MOVV R3, r2+40(FP)
56 | RET
57 |
--------------------------------------------------------------------------------
/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 ·SyscallNoError(SB),NOSPLIT,$0-24
28 | JAL runtime·entersyscall(SB)
29 | MOVW a1+4(FP), R4
30 | MOVW a2+8(FP), R5
31 | MOVW a3+12(FP), R6
32 | MOVW R0, R7
33 | MOVW trap+0(FP), R2 // syscall entry
34 | SYSCALL
35 | MOVW R2, r1+16(FP) // r1
36 | MOVW R3, r2+20(FP) // r2
37 | JAL runtime·exitsyscall(SB)
38 | RET
39 |
40 | TEXT ·RawSyscall(SB),NOSPLIT,$0-28
41 | JMP syscall·RawSyscall(SB)
42 |
43 | TEXT ·RawSyscall6(SB),NOSPLIT,$0-40
44 | JMP syscall·RawSyscall6(SB)
45 |
46 | TEXT ·RawSyscallNoError(SB),NOSPLIT,$0-24
47 | MOVW a1+4(FP), R4
48 | MOVW a2+8(FP), R5
49 | MOVW a3+12(FP), R6
50 | MOVW trap+0(FP), R2 // syscall entry
51 | SYSCALL
52 | MOVW R2, r1+16(FP)
53 | MOVW R3, r2+20(FP)
54 | RET
55 |
--------------------------------------------------------------------------------
/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 ·SyscallNoError(SB),NOSPLIT,$0-48
25 | BL runtime·entersyscall(SB)
26 | MOVD a1+8(FP), R3
27 | MOVD a2+16(FP), R4
28 | MOVD a3+24(FP), R5
29 | MOVD R0, R6
30 | MOVD R0, R7
31 | MOVD R0, R8
32 | MOVD trap+0(FP), R9 // syscall entry
33 | SYSCALL R9
34 | MOVD R3, r1+32(FP)
35 | MOVD R4, r2+40(FP)
36 | BL runtime·exitsyscall(SB)
37 | RET
38 |
39 | TEXT ·RawSyscall(SB),NOSPLIT,$0-56
40 | BR syscall·RawSyscall(SB)
41 |
42 | TEXT ·RawSyscall6(SB),NOSPLIT,$0-80
43 | BR syscall·RawSyscall6(SB)
44 |
45 | TEXT ·RawSyscallNoError(SB),NOSPLIT,$0-48
46 | MOVD a1+8(FP), R3
47 | MOVD a2+16(FP), R4
48 | MOVD a3+24(FP), R5
49 | MOVD R0, R6
50 | MOVD R0, R7
51 | MOVD R0, R8
52 | MOVD trap+0(FP), R9 // syscall entry
53 | SYSCALL R9
54 | MOVD R3, r1+32(FP)
55 | MOVD R4, r2+40(FP)
56 | RET
57 |
--------------------------------------------------------------------------------
/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 ·SyscallNoError(SB),NOSPLIT,$0-48
25 | BL runtime·entersyscall(SB)
26 | MOVD a1+8(FP), R2
27 | MOVD a2+16(FP), R3
28 | MOVD a3+24(FP), R4
29 | MOVD $0, R5
30 | MOVD $0, R6
31 | MOVD $0, R7
32 | MOVD trap+0(FP), R1 // syscall entry
33 | SYSCALL
34 | MOVD R2, r1+32(FP)
35 | MOVD R3, r2+40(FP)
36 | BL runtime·exitsyscall(SB)
37 | RET
38 |
39 | TEXT ·RawSyscall(SB),NOSPLIT,$0-56
40 | BR syscall·RawSyscall(SB)
41 |
42 | TEXT ·RawSyscall6(SB),NOSPLIT,$0-80
43 | BR syscall·RawSyscall6(SB)
44 |
45 | TEXT ·RawSyscallNoError(SB),NOSPLIT,$0-48
46 | MOVD a1+8(FP), R2
47 | MOVD a2+16(FP), R3
48 | MOVD a3+24(FP), R4
49 | MOVD $0, R5
50 | MOVD $0, R6
51 | MOVD $0, R7
52 | MOVD trap+0(FP), R1 // syscall entry
53 | SYSCALL
54 | MOVD R2, r1+32(FP)
55 | MOVD R3, r2+40(FP)
56 | RET
57 |
--------------------------------------------------------------------------------
/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_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_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/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 |
--------------------------------------------------------------------------------
/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_openbsd_arm.s:
--------------------------------------------------------------------------------
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 !gccgo
6 |
7 | #include "textflag.h"
8 |
9 | //
10 | // System call support for ARM, 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 | 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_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/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/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/golang.org/x/sys/unix/dev_darwin.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 | // Functions to access/create device major and minor numbers matching the
6 | // encoding used in Darwin's sys/types.h header.
7 |
8 | package unix
9 |
10 | // Major returns the major component of a Darwin device number.
11 | func Major(dev uint64) uint32 {
12 | return uint32((dev >> 24) & 0xff)
13 | }
14 |
15 | // Minor returns the minor component of a Darwin device number.
16 | func Minor(dev uint64) uint32 {
17 | return uint32(dev & 0xffffff)
18 | }
19 |
20 | // Mkdev returns a Darwin device number generated from the given major and minor
21 | // components.
22 | func Mkdev(major, minor uint32) uint64 {
23 | return (uint64(major) << 24) | uint64(minor)
24 | }
25 |
--------------------------------------------------------------------------------
/vendor/golang.org/x/sys/unix/dev_dragonfly.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 | // Functions to access/create device major and minor numbers matching the
6 | // encoding used in Dragonfly's sys/types.h header.
7 | //
8 | // The information below is extracted and adapted from sys/types.h:
9 | //
10 | // Minor gives a cookie instead of an index since in order to avoid changing the
11 | // meanings of bits 0-15 or wasting time and space shifting bits 16-31 for
12 | // devices that don't use them.
13 |
14 | package unix
15 |
16 | // Major returns the major component of a DragonFlyBSD device number.
17 | func Major(dev uint64) uint32 {
18 | return uint32((dev >> 8) & 0xff)
19 | }
20 |
21 | // Minor returns the minor component of a DragonFlyBSD device number.
22 | func Minor(dev uint64) uint32 {
23 | return uint32(dev & 0xffff00ff)
24 | }
25 |
26 | // Mkdev returns a DragonFlyBSD device number generated from the given major and
27 | // minor components.
28 | func Mkdev(major, minor uint32) uint64 {
29 | return (uint64(major) << 8) | uint64(minor)
30 | }
31 |
--------------------------------------------------------------------------------
/vendor/golang.org/x/sys/unix/dev_freebsd.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 | // Functions to access/create device major and minor numbers matching the
6 | // encoding used in FreeBSD's sys/types.h header.
7 | //
8 | // The information below is extracted and adapted from sys/types.h:
9 | //
10 | // Minor gives a cookie instead of an index since in order to avoid changing the
11 | // meanings of bits 0-15 or wasting time and space shifting bits 16-31 for
12 | // devices that don't use them.
13 |
14 | package unix
15 |
16 | // Major returns the major component of a FreeBSD device number.
17 | func Major(dev uint64) uint32 {
18 | return uint32((dev >> 8) & 0xff)
19 | }
20 |
21 | // Minor returns the minor component of a FreeBSD device number.
22 | func Minor(dev uint64) uint32 {
23 | return uint32(dev & 0xffff00ff)
24 | }
25 |
26 | // Mkdev returns a FreeBSD device number generated from the given major and
27 | // minor components.
28 | func Mkdev(major, minor uint32) uint64 {
29 | return (uint64(major) << 8) | uint64(minor)
30 | }
31 |
--------------------------------------------------------------------------------
/vendor/golang.org/x/sys/unix/dev_linux.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 | // Functions to access/create device major and minor numbers matching the
6 | // encoding used by the Linux kernel and glibc.
7 | //
8 | // The information below is extracted and adapted from bits/sysmacros.h in the
9 | // glibc sources:
10 | //
11 | // dev_t in glibc is 64-bit, with 32-bit major and minor numbers. glibc's
12 | // default encoding is MMMM Mmmm mmmM MMmm, where M is a hex digit of the major
13 | // number and m is a hex digit of the minor number. This is backward compatible
14 | // with legacy systems where dev_t is 16 bits wide, encoded as MMmm. It is also
15 | // backward compatible with the Linux kernel, which for some architectures uses
16 | // 32-bit dev_t, encoded as mmmM MMmm.
17 |
18 | package unix
19 |
20 | // Major returns the major component of a Linux device number.
21 | func Major(dev uint64) uint32 {
22 | major := uint32((dev & 0x00000000000fff00) >> 8)
23 | major |= uint32((dev & 0xfffff00000000000) >> 32)
24 | return major
25 | }
26 |
27 | // Minor returns the minor component of a Linux device number.
28 | func Minor(dev uint64) uint32 {
29 | minor := uint32((dev & 0x00000000000000ff) >> 0)
30 | minor |= uint32((dev & 0x00000ffffff00000) >> 12)
31 | return minor
32 | }
33 |
34 | // Mkdev returns a Linux device number generated from the given major and minor
35 | // components.
36 | func Mkdev(major, minor uint32) uint64 {
37 | dev := (uint64(major) & 0x00000fff) << 8
38 | dev |= (uint64(major) & 0xfffff000) << 32
39 | dev |= (uint64(minor) & 0x000000ff) << 0
40 | dev |= (uint64(minor) & 0xffffff00) << 12
41 | return dev
42 | }
43 |
--------------------------------------------------------------------------------
/vendor/golang.org/x/sys/unix/dev_netbsd.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 | // Functions to access/create device major and minor numbers matching the
6 | // encoding used in NetBSD's sys/types.h header.
7 |
8 | package unix
9 |
10 | // Major returns the major component of a NetBSD device number.
11 | func Major(dev uint64) uint32 {
12 | return uint32((dev & 0x000fff00) >> 8)
13 | }
14 |
15 | // Minor returns the minor component of a NetBSD device number.
16 | func Minor(dev uint64) uint32 {
17 | minor := uint32((dev & 0x000000ff) >> 0)
18 | minor |= uint32((dev & 0xfff00000) >> 12)
19 | return minor
20 | }
21 |
22 | // Mkdev returns a NetBSD device number generated from the given major and minor
23 | // components.
24 | func Mkdev(major, minor uint32) uint64 {
25 | dev := (uint64(major) << 8) & 0x000fff00
26 | dev |= (uint64(minor) << 12) & 0xfff00000
27 | dev |= (uint64(minor) << 0) & 0x000000ff
28 | return dev
29 | }
30 |
--------------------------------------------------------------------------------
/vendor/golang.org/x/sys/unix/dev_openbsd.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 | // Functions to access/create device major and minor numbers matching the
6 | // encoding used in OpenBSD's sys/types.h header.
7 |
8 | package unix
9 |
10 | // Major returns the major component of an OpenBSD device number.
11 | func Major(dev uint64) uint32 {
12 | return uint32((dev & 0x0000ff00) >> 8)
13 | }
14 |
15 | // Minor returns the minor component of an OpenBSD device number.
16 | func Minor(dev uint64) uint32 {
17 | minor := uint32((dev & 0x000000ff) >> 0)
18 | minor |= uint32((dev & 0xffff0000) >> 8)
19 | return minor
20 | }
21 |
22 | // Mkdev returns an OpenBSD device number generated from the given major and minor
23 | // components.
24 | func Mkdev(major, minor uint32) uint64 {
25 | dev := (uint64(major) << 8) & 0x0000ff00
26 | dev |= (uint64(minor) << 8) & 0xffff0000
27 | dev |= (uint64(minor) << 0) & 0x000000ff
28 | return dev
29 | }
30 |
--------------------------------------------------------------------------------
/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 |
--------------------------------------------------------------------------------
/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/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 |
29 | func Unsetenv(key string) error {
30 | return syscall.Unsetenv(key)
31 | }
32 |
--------------------------------------------------------------------------------
/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 |
--------------------------------------------------------------------------------
/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/golang.org/x/sys/unix/gccgo.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
6 |
7 | package unix
8 |
9 | import "syscall"
10 |
11 | // We can't use the gc-syntax .s files for gccgo. On the plus side
12 | // much of the functionality can be written directly in Go.
13 |
14 | //extern gccgoRealSyscallNoError
15 | func realSyscallNoError(trap, a1, a2, a3, a4, a5, a6, a7, a8, a9 uintptr) (r uintptr)
16 |
17 | //extern gccgoRealSyscall
18 | func realSyscall(trap, a1, a2, a3, a4, a5, a6, a7, a8, a9 uintptr) (r, errno uintptr)
19 |
20 | func SyscallNoError(trap, a1, a2, a3 uintptr) (r1, r2 uintptr) {
21 | syscall.Entersyscall()
22 | r := realSyscallNoError(trap, a1, a2, a3, 0, 0, 0, 0, 0, 0)
23 | syscall.Exitsyscall()
24 | return r, 0
25 | }
26 |
27 | func Syscall(trap, a1, a2, a3 uintptr) (r1, r2 uintptr, err syscall.Errno) {
28 | syscall.Entersyscall()
29 | r, errno := realSyscall(trap, a1, a2, a3, 0, 0, 0, 0, 0, 0)
30 | syscall.Exitsyscall()
31 | return r, 0, syscall.Errno(errno)
32 | }
33 |
34 | func Syscall6(trap, a1, a2, a3, a4, a5, a6 uintptr) (r1, r2 uintptr, err syscall.Errno) {
35 | syscall.Entersyscall()
36 | r, errno := realSyscall(trap, a1, a2, a3, a4, a5, a6, 0, 0, 0)
37 | syscall.Exitsyscall()
38 | return r, 0, syscall.Errno(errno)
39 | }
40 |
41 | func Syscall9(trap, a1, a2, a3, a4, a5, a6, a7, a8, a9 uintptr) (r1, r2 uintptr, err syscall.Errno) {
42 | syscall.Entersyscall()
43 | r, errno := realSyscall(trap, a1, a2, a3, a4, a5, a6, a7, a8, a9)
44 | syscall.Exitsyscall()
45 | return r, 0, syscall.Errno(errno)
46 | }
47 |
48 | func RawSyscallNoError(trap, a1, a2, a3 uintptr) (r1, r2 uintptr) {
49 | r := realSyscallNoError(trap, a1, a2, a3, 0, 0, 0, 0, 0, 0)
50 | return r, 0
51 | }
52 |
53 | func RawSyscall(trap, a1, a2, a3 uintptr) (r1, r2 uintptr, err syscall.Errno) {
54 | r, errno := realSyscall(trap, a1, a2, a3, 0, 0, 0, 0, 0, 0)
55 | return r, 0, syscall.Errno(errno)
56 | }
57 |
58 | func RawSyscall6(trap, a1, a2, a3, a4, a5, a6 uintptr) (r1, r2 uintptr, err syscall.Errno) {
59 | r, errno := realSyscall(trap, a1, a2, a3, a4, a5, a6, 0, 0, 0)
60 | return r, 0, syscall.Errno(errno)
61 | }
62 |
--------------------------------------------------------------------------------
/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 | uintptr_t
35 | gccgoRealSyscallNoError(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)
36 | {
37 | return syscall(trap, a1, a2, a3, a4, a5, a6, a7, a8, a9);
38 | }
39 |
40 | // Define the use function in C so that it is not inlined.
41 |
42 | extern void use(void *) __asm__ (GOSYM_PREFIX GOPKGPATH ".use") __attribute__((noinline));
43 |
44 | void
45 | use(void *p __attribute__ ((unused)))
46 | {
47 | }
48 |
--------------------------------------------------------------------------------
/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 |
--------------------------------------------------------------------------------
/vendor/golang.org/x/sys/unix/mksysnum_darwin.pl:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env perl
2 | # Copyright 2009 The Go Authors. All rights reserved.
3 | # Use of this source code is governed by a BSD-style
4 | # license that can be found in the LICENSE file.
5 | #
6 | # Generate system call table for Darwin from sys/syscall.h
7 |
8 | use strict;
9 |
10 | if($ENV{'GOARCH'} eq "" || $ENV{'GOOS'} eq "") {
11 | print STDERR "GOARCH or GOOS not defined in environment\n";
12 | exit 1;
13 | }
14 |
15 | my $command = "mksysnum_darwin.pl " . join(' ', @ARGV);
16 |
17 | print <){
29 | if(/^#define\s+SYS_(\w+)\s+([0-9]+)/){
30 | my $name = $1;
31 | my $num = $2;
32 | $name =~ y/a-z/A-Z/;
33 | print " SYS_$name = $num;"
34 | }
35 | }
36 |
37 | print <){
30 | if(/^([0-9]+)\s+STD\s+({ \S+\s+(\w+).*)$/){
31 | my $num = $1;
32 | my $proto = $2;
33 | my $name = "SYS_$3";
34 | $name =~ y/a-z/A-Z/;
35 |
36 | # There are multiple entries for enosys and nosys, so comment them out.
37 | if($name =~ /^SYS_E?NOSYS$/){
38 | $name = "// $name";
39 | }
40 | if($name eq 'SYS_SYS_EXIT'){
41 | $name = 'SYS_EXIT';
42 | }
43 |
44 | print " $name = $num; // $proto\n";
45 | }
46 | }
47 |
48 | print <){
30 | if(/^([0-9]+)\s+\S+\s+STD\s+({ \S+\s+(\w+).*)$/){
31 | my $num = $1;
32 | my $proto = $2;
33 | my $name = "SYS_$3";
34 | $name =~ y/a-z/A-Z/;
35 |
36 | # There are multiple entries for enosys and nosys, so comment them out.
37 | if($name =~ /^SYS_E?NOSYS$/){
38 | $name = "// $name";
39 | }
40 | if($name eq 'SYS_SYS_EXIT'){
41 | $name = 'SYS_EXIT';
42 | }
43 |
44 | print " $name = $num; // $proto\n";
45 | }
46 | }
47 |
48 | print <){
31 | if($line =~ /^(.*)\\$/) {
32 | # Handle continuation
33 | $line = $1;
34 | $_ =~ s/^\s+//;
35 | $line .= $_;
36 | } else {
37 | # New line
38 | $line = $_;
39 | }
40 | next if $line =~ /\\$/;
41 | if($line =~ /^([0-9]+)\s+((STD)|(NOERR))\s+(RUMP\s+)?({\s+\S+\s*\*?\s*\|(\S+)\|(\S*)\|(\w+).*\s+})(\s+(\S+))?$/) {
42 | my $num = $1;
43 | my $proto = $6;
44 | my $compat = $8;
45 | my $name = "$7_$9";
46 |
47 | $name = "$7_$11" if $11 ne '';
48 | $name =~ y/a-z/A-Z/;
49 |
50 | if($compat eq '' || $compat eq '13' || $compat eq '30' || $compat eq '50') {
51 | print " $name = $num; // $proto\n";
52 | }
53 | }
54 | }
55 |
56 | print <){
30 | if(/^([0-9]+)\s+STD\s+(NOLOCK\s+)?({ \S+\s+\*?(\w+).*)$/){
31 | my $num = $1;
32 | my $proto = $3;
33 | my $name = $4;
34 | $name =~ y/a-z/A-Z/;
35 |
36 | # There are multiple entries for enosys and nosys, so comment them out.
37 | if($name =~ /^SYS_E?NOSYS$/){
38 | $name = "// $name";
39 | }
40 | if($name eq 'SYS_SYS_EXIT'){
41 | $name = 'SYS_EXIT';
42 | }
43 |
44 | print " $name = $num; // $proto\n";
45 | }
46 | }
47 |
48 | print <= 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/golang.org/x/sys/unix/syscall.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 contains an interface to the low-level operating system
8 | // primitives. OS details vary depending on the underlying system, and
9 | // by default, godoc will display OS-specific documentation for the current
10 | // system. If you want godoc to display OS documentation for another
11 | // system, set $GOOS and $GOARCH to the desired system. For example, if
12 | // you want to view documentation for freebsd/arm on linux/amd64, set $GOOS
13 | // to freebsd and $GOARCH to arm.
14 | // The primary use of this package is inside other packages that provide a more
15 | // portable interface to the system, such as "os", "time" and "net". Use
16 | // those packages rather than this one if you can.
17 | // For details of the functions and data types in this package consult
18 | // the manuals for the appropriate operating system.
19 | // These calls return err == nil to indicate success; otherwise
20 | // err represents an operating system error describing the failure and
21 | // holds a value of type syscall.Errno.
22 | package unix // import "golang.org/x/sys/unix"
23 |
24 | // ByteSliceFromString returns a NUL-terminated slice of bytes
25 | // containing the text of s. If s contains a NUL byte at any
26 | // location, it returns (nil, EINVAL).
27 | func ByteSliceFromString(s string) ([]byte, error) {
28 | for i := 0; i < len(s); i++ {
29 | if s[i] == 0 {
30 | return nil, EINVAL
31 | }
32 | }
33 | a := make([]byte, len(s)+1)
34 | copy(a, s)
35 | return a, nil
36 | }
37 |
38 | // BytePtrFromString returns a pointer to a NUL-terminated array of
39 | // bytes containing the text of s. If s contains a NUL byte at any
40 | // location, it returns (nil, EINVAL).
41 | func BytePtrFromString(s string) (*byte, error) {
42 | a, err := ByteSliceFromString(s)
43 | if err != nil {
44 | return nil, err
45 | }
46 | return &a[0], nil
47 | }
48 |
49 | // Single-word zero for use when we need a valid pointer to 0 bytes.
50 | // See mkunix.pl.
51 | var _zero uintptr
52 |
--------------------------------------------------------------------------------
/vendor/golang.org/x/sys/unix/syscall_darwin_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,darwin
6 |
7 | package unix
8 |
9 | import (
10 | "syscall"
11 | "unsafe"
12 | )
13 |
14 | func setTimespec(sec, nsec int64) Timespec {
15 | return Timespec{Sec: int32(sec), Nsec: int32(nsec)}
16 | }
17 |
18 | func setTimeval(sec, usec int64) Timeval {
19 | return Timeval{Sec: int32(sec), Usec: int32(usec)}
20 | }
21 |
22 | //sysnb gettimeofday(tp *Timeval) (sec int32, usec int32, err error)
23 | func Gettimeofday(tv *Timeval) (err error) {
24 | // The tv passed to gettimeofday must be non-nil
25 | // but is otherwise unused. The answers come back
26 | // in the two registers.
27 | sec, usec, err := gettimeofday(tv)
28 | tv.Sec = int32(sec)
29 | tv.Usec = int32(usec)
30 | return err
31 | }
32 |
33 | func SetKevent(k *Kevent_t, fd, mode, flags int) {
34 | k.Ident = uint32(fd)
35 | k.Filter = int16(mode)
36 | k.Flags = uint16(flags)
37 | }
38 |
39 | func (iov *Iovec) SetLen(length int) {
40 | iov.Len = uint32(length)
41 | }
42 |
43 | func (msghdr *Msghdr) SetControllen(length int) {
44 | msghdr.Controllen = uint32(length)
45 | }
46 |
47 | func (cmsg *Cmsghdr) SetLen(length int) {
48 | cmsg.Len = uint32(length)
49 | }
50 |
51 | func sendfile(outfd int, infd int, offset *int64, count int) (written int, err error) {
52 | var length = uint64(count)
53 |
54 | _, _, e1 := Syscall9(SYS_SENDFILE, uintptr(infd), uintptr(outfd), uintptr(*offset), uintptr(*offset>>32), uintptr(unsafe.Pointer(&length)), 0, 0, 0, 0)
55 |
56 | written = int(length)
57 |
58 | if e1 != 0 {
59 | err = e1
60 | }
61 | return
62 | }
63 |
64 | func Syscall9(num, a1, a2, a3, a4, a5, a6, a7, a8, a9 uintptr) (r1, r2 uintptr, err syscall.Errno)
65 |
66 | // SYS___SYSCTL is used by syscall_bsd.go for all BSDs, but in modern versions
67 | // of darwin/386 the syscall is called sysctl instead of __sysctl.
68 | const SYS___SYSCTL = SYS_SYSCTL
69 |
--------------------------------------------------------------------------------
/vendor/golang.org/x/sys/unix/syscall_darwin_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,darwin
6 |
7 | package unix
8 |
9 | import (
10 | "syscall"
11 | "unsafe"
12 | )
13 |
14 | func setTimespec(sec, nsec int64) Timespec {
15 | return Timespec{Sec: sec, Nsec: nsec}
16 | }
17 |
18 | func setTimeval(sec, usec int64) Timeval {
19 | return Timeval{Sec: sec, Usec: int32(usec)}
20 | }
21 |
22 | //sysnb gettimeofday(tp *Timeval) (sec int64, usec int32, err error)
23 | func Gettimeofday(tv *Timeval) (err error) {
24 | // The tv passed to gettimeofday must be non-nil
25 | // but is otherwise unused. The answers come back
26 | // in the two registers.
27 | sec, usec, err := gettimeofday(tv)
28 | tv.Sec = sec
29 | tv.Usec = usec
30 | return err
31 | }
32 |
33 | func SetKevent(k *Kevent_t, fd, mode, flags int) {
34 | k.Ident = uint64(fd)
35 | k.Filter = int16(mode)
36 | k.Flags = uint16(flags)
37 | }
38 |
39 | func (iov *Iovec) SetLen(length int) {
40 | iov.Len = uint64(length)
41 | }
42 |
43 | func (msghdr *Msghdr) SetControllen(length int) {
44 | msghdr.Controllen = uint32(length)
45 | }
46 |
47 | func (cmsg *Cmsghdr) SetLen(length int) {
48 | cmsg.Len = uint32(length)
49 | }
50 |
51 | func sendfile(outfd int, infd int, offset *int64, count int) (written int, err error) {
52 | var length = uint64(count)
53 |
54 | _, _, e1 := Syscall6(SYS_SENDFILE, uintptr(infd), uintptr(outfd), uintptr(*offset), uintptr(unsafe.Pointer(&length)), 0, 0)
55 |
56 | written = int(length)
57 |
58 | if e1 != 0 {
59 | err = e1
60 | }
61 | return
62 | }
63 |
64 | func Syscall9(num, a1, a2, a3, a4, a5, a6, a7, a8, a9 uintptr) (r1, r2 uintptr, err syscall.Errno)
65 |
66 | // SYS___SYSCTL is used by syscall_bsd.go for all BSDs, but in modern versions
67 | // of darwin/amd64 the syscall is called sysctl instead of __sysctl.
68 | const SYS___SYSCTL = SYS_SYSCTL
69 |
--------------------------------------------------------------------------------
/vendor/golang.org/x/sys/unix/syscall_darwin_arm.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 unix
6 |
7 | import (
8 | "syscall"
9 | "unsafe"
10 | )
11 |
12 | func setTimespec(sec, nsec int64) Timespec {
13 | return Timespec{Sec: int32(sec), Nsec: int32(nsec)}
14 | }
15 |
16 | func setTimeval(sec, usec int64) Timeval {
17 | return Timeval{Sec: int32(sec), Usec: int32(usec)}
18 | }
19 |
20 | //sysnb gettimeofday(tp *Timeval) (sec int32, usec int32, err error)
21 | func Gettimeofday(tv *Timeval) (err error) {
22 | // The tv passed to gettimeofday must be non-nil
23 | // but is otherwise unused. The answers come back
24 | // in the two registers.
25 | sec, usec, err := gettimeofday(tv)
26 | tv.Sec = int32(sec)
27 | tv.Usec = int32(usec)
28 | return err
29 | }
30 |
31 | func SetKevent(k *Kevent_t, fd, mode, flags int) {
32 | k.Ident = uint32(fd)
33 | k.Filter = int16(mode)
34 | k.Flags = uint16(flags)
35 | }
36 |
37 | func (iov *Iovec) SetLen(length int) {
38 | iov.Len = uint32(length)
39 | }
40 |
41 | func (msghdr *Msghdr) SetControllen(length int) {
42 | msghdr.Controllen = uint32(length)
43 | }
44 |
45 | func (cmsg *Cmsghdr) SetLen(length int) {
46 | cmsg.Len = uint32(length)
47 | }
48 |
49 | func sendfile(outfd int, infd int, offset *int64, count int) (written int, err error) {
50 | var length = uint64(count)
51 |
52 | _, _, e1 := Syscall9(SYS_SENDFILE, uintptr(infd), uintptr(outfd), uintptr(*offset), uintptr(*offset>>32), uintptr(unsafe.Pointer(&length)), 0, 0, 0, 0)
53 |
54 | written = int(length)
55 |
56 | if e1 != 0 {
57 | err = e1
58 | }
59 | return
60 | }
61 |
62 | func Syscall9(num, a1, a2, a3, a4, a5, a6, a7, a8, a9 uintptr) (r1, r2 uintptr, err syscall.Errno) // sic
63 |
64 | // SYS___SYSCTL is used by syscall_bsd.go for all BSDs, but in modern versions
65 | // of darwin/arm the syscall is called sysctl instead of __sysctl.
66 | const SYS___SYSCTL = SYS_SYSCTL
67 |
--------------------------------------------------------------------------------
/vendor/golang.org/x/sys/unix/syscall_darwin_arm64.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 arm64,darwin
6 |
7 | package unix
8 |
9 | import (
10 | "syscall"
11 | "unsafe"
12 | )
13 |
14 | func setTimespec(sec, nsec int64) Timespec {
15 | return Timespec{Sec: sec, Nsec: nsec}
16 | }
17 |
18 | func setTimeval(sec, usec int64) Timeval {
19 | return Timeval{Sec: sec, Usec: int32(usec)}
20 | }
21 |
22 | //sysnb gettimeofday(tp *Timeval) (sec int64, usec int32, err error)
23 | func Gettimeofday(tv *Timeval) (err error) {
24 | // The tv passed to gettimeofday must be non-nil
25 | // but is otherwise unused. The answers come back
26 | // in the two registers.
27 | sec, usec, err := gettimeofday(tv)
28 | tv.Sec = sec
29 | tv.Usec = usec
30 | return err
31 | }
32 |
33 | func SetKevent(k *Kevent_t, fd, mode, flags int) {
34 | k.Ident = uint64(fd)
35 | k.Filter = int16(mode)
36 | k.Flags = uint16(flags)
37 | }
38 |
39 | func (iov *Iovec) SetLen(length int) {
40 | iov.Len = uint64(length)
41 | }
42 |
43 | func (msghdr *Msghdr) SetControllen(length int) {
44 | msghdr.Controllen = uint32(length)
45 | }
46 |
47 | func (cmsg *Cmsghdr) SetLen(length int) {
48 | cmsg.Len = uint32(length)
49 | }
50 |
51 | func sendfile(outfd int, infd int, offset *int64, count int) (written int, err error) {
52 | var length = uint64(count)
53 |
54 | _, _, e1 := Syscall6(SYS_SENDFILE, uintptr(infd), uintptr(outfd), uintptr(*offset), uintptr(unsafe.Pointer(&length)), 0, 0)
55 |
56 | written = int(length)
57 |
58 | if e1 != 0 {
59 | err = e1
60 | }
61 | return
62 | }
63 |
64 | func Syscall9(num, a1, a2, a3, a4, a5, a6, a7, a8, a9 uintptr) (r1, r2 uintptr, err syscall.Errno) // sic
65 |
66 | // SYS___SYSCTL is used by syscall_bsd.go for all BSDs, but in modern versions
67 | // of darwin/arm64 the syscall is called sysctl instead of __sysctl.
68 | const SYS___SYSCTL = SYS_SYSCTL
69 |
--------------------------------------------------------------------------------
/vendor/golang.org/x/sys/unix/syscall_dragonfly_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,dragonfly
6 |
7 | package unix
8 |
9 | import (
10 | "syscall"
11 | "unsafe"
12 | )
13 |
14 | func setTimespec(sec, nsec int64) Timespec {
15 | return Timespec{Sec: sec, Nsec: nsec}
16 | }
17 |
18 | func setTimeval(sec, usec int64) Timeval {
19 | return Timeval{Sec: sec, Usec: usec}
20 | }
21 |
22 | func SetKevent(k *Kevent_t, fd, mode, flags int) {
23 | k.Ident = uint64(fd)
24 | k.Filter = int16(mode)
25 | k.Flags = uint16(flags)
26 | }
27 |
28 | func (iov *Iovec) SetLen(length int) {
29 | iov.Len = uint64(length)
30 | }
31 |
32 | func (msghdr *Msghdr) SetControllen(length int) {
33 | msghdr.Controllen = uint32(length)
34 | }
35 |
36 | func (cmsg *Cmsghdr) SetLen(length int) {
37 | cmsg.Len = uint32(length)
38 | }
39 |
40 | func sendfile(outfd int, infd int, offset *int64, count int) (written int, err error) {
41 | var writtenOut uint64 = 0
42 | _, _, e1 := Syscall9(SYS_SENDFILE, uintptr(infd), uintptr(outfd), uintptr(*offset), uintptr(count), 0, uintptr(unsafe.Pointer(&writtenOut)), 0, 0, 0)
43 |
44 | written = int(writtenOut)
45 |
46 | if e1 != 0 {
47 | err = e1
48 | }
49 | return
50 | }
51 |
52 | func Syscall9(num, a1, a2, a3, a4, a5, a6, a7, a8, a9 uintptr) (r1, r2 uintptr, err syscall.Errno)
53 |
--------------------------------------------------------------------------------
/vendor/golang.org/x/sys/unix/syscall_freebsd_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,freebsd
6 |
7 | package unix
8 |
9 | import (
10 | "syscall"
11 | "unsafe"
12 | )
13 |
14 | func setTimespec(sec, nsec int64) Timespec {
15 | return Timespec{Sec: int32(sec), Nsec: int32(nsec)}
16 | }
17 |
18 | func setTimeval(sec, usec int64) Timeval {
19 | return Timeval{Sec: int32(sec), Usec: int32(usec)}
20 | }
21 |
22 | func SetKevent(k *Kevent_t, fd, mode, flags int) {
23 | k.Ident = uint32(fd)
24 | k.Filter = int16(mode)
25 | k.Flags = uint16(flags)
26 | }
27 |
28 | func (iov *Iovec) SetLen(length int) {
29 | iov.Len = uint32(length)
30 | }
31 |
32 | func (msghdr *Msghdr) SetControllen(length int) {
33 | msghdr.Controllen = uint32(length)
34 | }
35 |
36 | func (cmsg *Cmsghdr) SetLen(length int) {
37 | cmsg.Len = uint32(length)
38 | }
39 |
40 | func sendfile(outfd int, infd int, offset *int64, count int) (written int, err error) {
41 | var writtenOut uint64 = 0
42 | _, _, e1 := Syscall9(SYS_SENDFILE, uintptr(infd), uintptr(outfd), uintptr(*offset), uintptr((*offset)>>32), uintptr(count), 0, uintptr(unsafe.Pointer(&writtenOut)), 0, 0)
43 |
44 | written = int(writtenOut)
45 |
46 | if e1 != 0 {
47 | err = e1
48 | }
49 | return
50 | }
51 |
52 | func Syscall9(num, a1, a2, a3, a4, a5, a6, a7, a8, a9 uintptr) (r1, r2 uintptr, err syscall.Errno)
53 |
--------------------------------------------------------------------------------
/vendor/golang.org/x/sys/unix/syscall_freebsd_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,freebsd
6 |
7 | package unix
8 |
9 | import (
10 | "syscall"
11 | "unsafe"
12 | )
13 |
14 | func setTimespec(sec, nsec int64) Timespec {
15 | return Timespec{Sec: sec, Nsec: nsec}
16 | }
17 |
18 | func setTimeval(sec, usec int64) Timeval {
19 | return Timeval{Sec: sec, Usec: usec}
20 | }
21 |
22 | func SetKevent(k *Kevent_t, fd, mode, flags int) {
23 | k.Ident = uint64(fd)
24 | k.Filter = int16(mode)
25 | k.Flags = uint16(flags)
26 | }
27 |
28 | func (iov *Iovec) SetLen(length int) {
29 | iov.Len = uint64(length)
30 | }
31 |
32 | func (msghdr *Msghdr) SetControllen(length int) {
33 | msghdr.Controllen = uint32(length)
34 | }
35 |
36 | func (cmsg *Cmsghdr) SetLen(length int) {
37 | cmsg.Len = uint32(length)
38 | }
39 |
40 | func sendfile(outfd int, infd int, offset *int64, count int) (written int, err error) {
41 | var writtenOut uint64 = 0
42 | _, _, e1 := Syscall9(SYS_SENDFILE, uintptr(infd), uintptr(outfd), uintptr(*offset), uintptr(count), 0, uintptr(unsafe.Pointer(&writtenOut)), 0, 0, 0)
43 |
44 | written = int(writtenOut)
45 |
46 | if e1 != 0 {
47 | err = e1
48 | }
49 | return
50 | }
51 |
52 | func Syscall9(num, a1, a2, a3, a4, a5, a6, a7, a8, a9 uintptr) (r1, r2 uintptr, err syscall.Errno)
53 |
--------------------------------------------------------------------------------
/vendor/golang.org/x/sys/unix/syscall_freebsd_arm.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 arm,freebsd
6 |
7 | package unix
8 |
9 | import (
10 | "syscall"
11 | "unsafe"
12 | )
13 |
14 | func setTimespec(sec, nsec int64) Timespec {
15 | return Timespec{Sec: sec, Nsec: int32(nsec)}
16 | }
17 |
18 | func setTimeval(sec, usec int64) Timeval {
19 | return Timeval{Sec: sec, Usec: int32(usec)}
20 | }
21 |
22 | func SetKevent(k *Kevent_t, fd, mode, flags int) {
23 | k.Ident = uint32(fd)
24 | k.Filter = int16(mode)
25 | k.Flags = uint16(flags)
26 | }
27 |
28 | func (iov *Iovec) SetLen(length int) {
29 | iov.Len = uint32(length)
30 | }
31 |
32 | func (msghdr *Msghdr) SetControllen(length int) {
33 | msghdr.Controllen = uint32(length)
34 | }
35 |
36 | func (cmsg *Cmsghdr) SetLen(length int) {
37 | cmsg.Len = uint32(length)
38 | }
39 |
40 | func sendfile(outfd int, infd int, offset *int64, count int) (written int, err error) {
41 | var writtenOut uint64 = 0
42 | _, _, e1 := Syscall9(SYS_SENDFILE, uintptr(infd), uintptr(outfd), uintptr(*offset), uintptr((*offset)>>32), uintptr(count), 0, uintptr(unsafe.Pointer(&writtenOut)), 0, 0)
43 |
44 | written = int(writtenOut)
45 |
46 | if e1 != 0 {
47 | err = e1
48 | }
49 | return
50 | }
51 |
52 | func Syscall9(num, a1, a2, a3, a4, a5, a6, a7, a8, a9 uintptr) (r1, r2 uintptr, err syscall.Errno)
53 |
--------------------------------------------------------------------------------
/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/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 setTimespec(sec, nsec int64) Timespec {
10 | return Timespec{Sec: sec, Nsec: int32(nsec)}
11 | }
12 |
13 | func setTimeval(sec, usec int64) Timeval {
14 | return Timeval{Sec: sec, Usec: int32(usec)}
15 | }
16 |
17 | func SetKevent(k *Kevent_t, fd, mode, flags int) {
18 | k.Ident = uint32(fd)
19 | k.Filter = uint32(mode)
20 | k.Flags = uint32(flags)
21 | }
22 |
23 | func (iov *Iovec) SetLen(length int) {
24 | iov.Len = uint32(length)
25 | }
26 |
27 | func (msghdr *Msghdr) SetControllen(length int) {
28 | msghdr.Controllen = uint32(length)
29 | }
30 |
31 | func (cmsg *Cmsghdr) SetLen(length int) {
32 | cmsg.Len = uint32(length)
33 | }
34 |
--------------------------------------------------------------------------------
/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 setTimespec(sec, nsec int64) Timespec {
10 | return Timespec{Sec: sec, Nsec: nsec}
11 | }
12 |
13 | func setTimeval(sec, usec int64) Timeval {
14 | return Timeval{Sec: sec, Usec: int32(usec)}
15 | }
16 |
17 | func SetKevent(k *Kevent_t, fd, mode, flags int) {
18 | k.Ident = uint64(fd)
19 | k.Filter = uint32(mode)
20 | k.Flags = uint32(flags)
21 | }
22 |
23 | func (iov *Iovec) SetLen(length int) {
24 | iov.Len = uint64(length)
25 | }
26 |
27 | func (msghdr *Msghdr) SetControllen(length int) {
28 | msghdr.Controllen = uint32(length)
29 | }
30 |
31 | func (cmsg *Cmsghdr) SetLen(length int) {
32 | cmsg.Len = uint32(length)
33 | }
34 |
--------------------------------------------------------------------------------
/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 setTimespec(sec, nsec int64) Timespec {
10 | return Timespec{Sec: sec, Nsec: int32(nsec)}
11 | }
12 |
13 | func setTimeval(sec, usec int64) Timeval {
14 | return Timeval{Sec: sec, Usec: int32(usec)}
15 | }
16 |
17 | func SetKevent(k *Kevent_t, fd, mode, flags int) {
18 | k.Ident = uint32(fd)
19 | k.Filter = uint32(mode)
20 | k.Flags = uint32(flags)
21 | }
22 |
23 | func (iov *Iovec) SetLen(length int) {
24 | iov.Len = uint32(length)
25 | }
26 |
27 | func (msghdr *Msghdr) SetControllen(length int) {
28 | msghdr.Controllen = uint32(length)
29 | }
30 |
31 | func (cmsg *Cmsghdr) SetLen(length int) {
32 | cmsg.Len = uint32(length)
33 | }
34 |
--------------------------------------------------------------------------------
/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 setTimespec(sec, nsec int64) Timespec {
10 | return Timespec{Sec: sec, Nsec: int32(nsec)}
11 | }
12 |
13 | func setTimeval(sec, usec int64) Timeval {
14 | return Timeval{Sec: sec, Usec: int32(usec)}
15 | }
16 |
17 | func SetKevent(k *Kevent_t, fd, mode, flags int) {
18 | k.Ident = uint32(fd)
19 | k.Filter = int16(mode)
20 | k.Flags = uint16(flags)
21 | }
22 |
23 | func (iov *Iovec) SetLen(length int) {
24 | iov.Len = uint32(length)
25 | }
26 |
27 | func (msghdr *Msghdr) SetControllen(length int) {
28 | msghdr.Controllen = uint32(length)
29 | }
30 |
31 | func (cmsg *Cmsghdr) SetLen(length int) {
32 | cmsg.Len = uint32(length)
33 | }
34 |
--------------------------------------------------------------------------------
/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 setTimespec(sec, nsec int64) Timespec {
10 | return Timespec{Sec: sec, Nsec: nsec}
11 | }
12 |
13 | func setTimeval(sec, usec int64) Timeval {
14 | return Timeval{Sec: sec, Usec: usec}
15 | }
16 |
17 | func SetKevent(k *Kevent_t, fd, mode, flags int) {
18 | k.Ident = uint64(fd)
19 | k.Filter = int16(mode)
20 | k.Flags = uint16(flags)
21 | }
22 |
23 | func (iov *Iovec) SetLen(length int) {
24 | iov.Len = uint64(length)
25 | }
26 |
27 | func (msghdr *Msghdr) SetControllen(length int) {
28 | msghdr.Controllen = uint32(length)
29 | }
30 |
31 | func (cmsg *Cmsghdr) SetLen(length int) {
32 | cmsg.Len = uint32(length)
33 | }
34 |
--------------------------------------------------------------------------------
/vendor/golang.org/x/sys/unix/syscall_openbsd_arm.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 arm,openbsd
6 |
7 | package unix
8 |
9 | func setTimespec(sec, nsec int64) Timespec {
10 | return Timespec{Sec: sec, Nsec: int32(nsec)}
11 | }
12 |
13 | func setTimeval(sec, usec int64) Timeval {
14 | return Timeval{Sec: sec, Usec: int32(usec)}
15 | }
16 |
17 | func SetKevent(k *Kevent_t, fd, mode, flags int) {
18 | k.Ident = uint32(fd)
19 | k.Filter = int16(mode)
20 | k.Flags = uint16(flags)
21 | }
22 |
23 | func (iov *Iovec) SetLen(length int) {
24 | iov.Len = uint32(length)
25 | }
26 |
27 | func (msghdr *Msghdr) SetControllen(length int) {
28 | msghdr.Controllen = uint32(length)
29 | }
30 |
31 | func (cmsg *Cmsghdr) SetLen(length int) {
32 | cmsg.Len = uint32(length)
33 | }
34 |
--------------------------------------------------------------------------------
/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 setTimespec(sec, nsec int64) Timespec {
10 | return Timespec{Sec: sec, Nsec: nsec}
11 | }
12 |
13 | func setTimeval(sec, usec int64) Timeval {
14 | return Timeval{Sec: sec, Usec: usec}
15 | }
16 |
17 | func (iov *Iovec) SetLen(length int) {
18 | iov.Len = uint64(length)
19 | }
20 |
21 | func (cmsg *Cmsghdr) SetLen(length int) {
22 | cmsg.Len = uint32(length)
23 | }
24 |
25 | func sendfile(outfd int, infd int, offset *int64, count int) (written int, err error) {
26 | // TODO(aram): implement this, see issue 5847.
27 | panic("unimplemented")
28 | }
29 |
--------------------------------------------------------------------------------
/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 |
--------------------------------------------------------------------------------
/vendor/golang.org/x/sys/unix/zptrace386_linux.go:
--------------------------------------------------------------------------------
1 | // Code generated by linux/mkall.go generatePtracePair(386, amd64). DO NOT EDIT.
2 |
3 | // +build linux
4 | // +build 386 amd64
5 |
6 | package unix
7 |
8 | import "unsafe"
9 |
10 | // PtraceRegs386 is the registers used by 386 binaries.
11 | type PtraceRegs386 struct {
12 | Ebx int32
13 | Ecx int32
14 | Edx int32
15 | Esi int32
16 | Edi int32
17 | Ebp int32
18 | Eax int32
19 | Xds int32
20 | Xes int32
21 | Xfs int32
22 | Xgs int32
23 | Orig_eax int32
24 | Eip int32
25 | Xcs int32
26 | Eflags int32
27 | Esp int32
28 | Xss int32
29 | }
30 |
31 | // PtraceGetRegs386 fetches the registers used by 386 binaries.
32 | func PtraceGetRegs386(pid int, regsout *PtraceRegs386) error {
33 | return ptrace(PTRACE_GETREGS, pid, 0, uintptr(unsafe.Pointer(regsout)))
34 | }
35 |
36 | // PtraceSetRegs386 sets the registers used by 386 binaries.
37 | func PtraceSetRegs386(pid int, regs *PtraceRegs386) error {
38 | return ptrace(PTRACE_SETREGS, pid, 0, uintptr(unsafe.Pointer(regs)))
39 | }
40 |
41 | // PtraceRegsAmd64 is the registers used by amd64 binaries.
42 | type PtraceRegsAmd64 struct {
43 | R15 uint64
44 | R14 uint64
45 | R13 uint64
46 | R12 uint64
47 | Rbp uint64
48 | Rbx uint64
49 | R11 uint64
50 | R10 uint64
51 | R9 uint64
52 | R8 uint64
53 | Rax uint64
54 | Rcx uint64
55 | Rdx uint64
56 | Rsi uint64
57 | Rdi uint64
58 | Orig_rax uint64
59 | Rip uint64
60 | Cs uint64
61 | Eflags uint64
62 | Rsp uint64
63 | Ss uint64
64 | Fs_base uint64
65 | Gs_base uint64
66 | Ds uint64
67 | Es uint64
68 | Fs uint64
69 | Gs uint64
70 | }
71 |
72 | // PtraceGetRegsAmd64 fetches the registers used by amd64 binaries.
73 | func PtraceGetRegsAmd64(pid int, regsout *PtraceRegsAmd64) error {
74 | return ptrace(PTRACE_GETREGS, pid, 0, uintptr(unsafe.Pointer(regsout)))
75 | }
76 |
77 | // PtraceSetRegsAmd64 sets the registers used by amd64 binaries.
78 | func PtraceSetRegsAmd64(pid int, regs *PtraceRegsAmd64) error {
79 | return ptrace(PTRACE_SETREGS, pid, 0, uintptr(unsafe.Pointer(regs)))
80 | }
81 |
--------------------------------------------------------------------------------
/vendor/golang.org/x/sys/unix/zptracearm_linux.go:
--------------------------------------------------------------------------------
1 | // Code generated by linux/mkall.go generatePtracePair(arm, arm64). DO NOT EDIT.
2 |
3 | // +build linux
4 | // +build arm arm64
5 |
6 | package unix
7 |
8 | import "unsafe"
9 |
10 | // PtraceRegsArm is the registers used by arm binaries.
11 | type PtraceRegsArm struct {
12 | Uregs [18]uint32
13 | }
14 |
15 | // PtraceGetRegsArm fetches the registers used by arm binaries.
16 | func PtraceGetRegsArm(pid int, regsout *PtraceRegsArm) error {
17 | return ptrace(PTRACE_GETREGS, pid, 0, uintptr(unsafe.Pointer(regsout)))
18 | }
19 |
20 | // PtraceSetRegsArm sets the registers used by arm binaries.
21 | func PtraceSetRegsArm(pid int, regs *PtraceRegsArm) error {
22 | return ptrace(PTRACE_SETREGS, pid, 0, uintptr(unsafe.Pointer(regs)))
23 | }
24 |
25 | // PtraceRegsArm64 is the registers used by arm64 binaries.
26 | type PtraceRegsArm64 struct {
27 | Regs [31]uint64
28 | Sp uint64
29 | Pc uint64
30 | Pstate uint64
31 | }
32 |
33 | // PtraceGetRegsArm64 fetches the registers used by arm64 binaries.
34 | func PtraceGetRegsArm64(pid int, regsout *PtraceRegsArm64) error {
35 | return ptrace(PTRACE_GETREGS, pid, 0, uintptr(unsafe.Pointer(regsout)))
36 | }
37 |
38 | // PtraceSetRegsArm64 sets the registers used by arm64 binaries.
39 | func PtraceSetRegsArm64(pid int, regs *PtraceRegsArm64) error {
40 | return ptrace(PTRACE_SETREGS, pid, 0, uintptr(unsafe.Pointer(regs)))
41 | }
42 |
--------------------------------------------------------------------------------
/vendor/golang.org/x/sys/unix/zptracemips_linux.go:
--------------------------------------------------------------------------------
1 | // Code generated by linux/mkall.go generatePtracePair(mips, mips64). DO NOT EDIT.
2 |
3 | // +build linux
4 | // +build mips mips64
5 |
6 | package unix
7 |
8 | import "unsafe"
9 |
10 | // PtraceRegsMips is the registers used by mips binaries.
11 | type PtraceRegsMips struct {
12 | Regs [32]uint64
13 | Lo uint64
14 | Hi uint64
15 | Epc uint64
16 | Badvaddr uint64
17 | Status uint64
18 | Cause uint64
19 | }
20 |
21 | // PtraceGetRegsMips fetches the registers used by mips binaries.
22 | func PtraceGetRegsMips(pid int, regsout *PtraceRegsMips) error {
23 | return ptrace(PTRACE_GETREGS, pid, 0, uintptr(unsafe.Pointer(regsout)))
24 | }
25 |
26 | // PtraceSetRegsMips sets the registers used by mips binaries.
27 | func PtraceSetRegsMips(pid int, regs *PtraceRegsMips) error {
28 | return ptrace(PTRACE_SETREGS, pid, 0, uintptr(unsafe.Pointer(regs)))
29 | }
30 |
31 | // PtraceRegsMips64 is the registers used by mips64 binaries.
32 | type PtraceRegsMips64 struct {
33 | Regs [32]uint64
34 | Lo uint64
35 | Hi uint64
36 | Epc uint64
37 | Badvaddr uint64
38 | Status uint64
39 | Cause uint64
40 | }
41 |
42 | // PtraceGetRegsMips64 fetches the registers used by mips64 binaries.
43 | func PtraceGetRegsMips64(pid int, regsout *PtraceRegsMips64) error {
44 | return ptrace(PTRACE_GETREGS, pid, 0, uintptr(unsafe.Pointer(regsout)))
45 | }
46 |
47 | // PtraceSetRegsMips64 sets the registers used by mips64 binaries.
48 | func PtraceSetRegsMips64(pid int, regs *PtraceRegsMips64) error {
49 | return ptrace(PTRACE_SETREGS, pid, 0, uintptr(unsafe.Pointer(regs)))
50 | }
51 |
--------------------------------------------------------------------------------
/vendor/golang.org/x/sys/unix/zptracemipsle_linux.go:
--------------------------------------------------------------------------------
1 | // Code generated by linux/mkall.go generatePtracePair(mipsle, mips64le). DO NOT EDIT.
2 |
3 | // +build linux
4 | // +build mipsle mips64le
5 |
6 | package unix
7 |
8 | import "unsafe"
9 |
10 | // PtraceRegsMipsle is the registers used by mipsle binaries.
11 | type PtraceRegsMipsle struct {
12 | Regs [32]uint64
13 | Lo uint64
14 | Hi uint64
15 | Epc uint64
16 | Badvaddr uint64
17 | Status uint64
18 | Cause uint64
19 | }
20 |
21 | // PtraceGetRegsMipsle fetches the registers used by mipsle binaries.
22 | func PtraceGetRegsMipsle(pid int, regsout *PtraceRegsMipsle) error {
23 | return ptrace(PTRACE_GETREGS, pid, 0, uintptr(unsafe.Pointer(regsout)))
24 | }
25 |
26 | // PtraceSetRegsMipsle sets the registers used by mipsle binaries.
27 | func PtraceSetRegsMipsle(pid int, regs *PtraceRegsMipsle) error {
28 | return ptrace(PTRACE_SETREGS, pid, 0, uintptr(unsafe.Pointer(regs)))
29 | }
30 |
31 | // PtraceRegsMips64le is the registers used by mips64le binaries.
32 | type PtraceRegsMips64le struct {
33 | Regs [32]uint64
34 | Lo uint64
35 | Hi uint64
36 | Epc uint64
37 | Badvaddr uint64
38 | Status uint64
39 | Cause uint64
40 | }
41 |
42 | // PtraceGetRegsMips64le fetches the registers used by mips64le binaries.
43 | func PtraceGetRegsMips64le(pid int, regsout *PtraceRegsMips64le) error {
44 | return ptrace(PTRACE_GETREGS, pid, 0, uintptr(unsafe.Pointer(regsout)))
45 | }
46 |
47 | // PtraceSetRegsMips64le sets the registers used by mips64le binaries.
48 | func PtraceSetRegsMips64le(pid int, regs *PtraceRegsMips64le) error {
49 | return ptrace(PTRACE_SETREGS, pid, 0, uintptr(unsafe.Pointer(regs)))
50 | }
51 |
--------------------------------------------------------------------------------
/vendor/gopkg.in/go-playground/validator.v8/LICENSE:
--------------------------------------------------------------------------------
1 | The MIT License (MIT)
2 |
3 | Copyright (c) 2015 Dean Karn
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 |
23 |
--------------------------------------------------------------------------------
/vendor/gopkg.in/go-playground/validator.v8/logo.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/appleboy/gin-lambda/75413372c9965294e73f6de0f2952a49c18d3d56/vendor/gopkg.in/go-playground/validator.v8/logo.png
--------------------------------------------------------------------------------
/vendor/gopkg.in/yaml.v2/LICENSE.libyaml:
--------------------------------------------------------------------------------
1 | The following files were ported to Go from C files of libyaml, and thus
2 | are still covered by their original copyright and license:
3 |
4 | apic.go
5 | emitterc.go
6 | parserc.go
7 | readerc.go
8 | scannerc.go
9 | writerc.go
10 | yamlh.go
11 | yamlprivateh.go
12 |
13 | Copyright (c) 2006 Kirill Simonov
14 |
15 | Permission is hereby granted, free of charge, to any person obtaining a copy of
16 | this software and associated documentation files (the "Software"), to deal in
17 | the Software without restriction, including without limitation the rights to
18 | use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
19 | of the Software, and to permit persons to whom the Software is furnished to do
20 | so, subject to the following conditions:
21 |
22 | The above copyright notice and this permission notice shall be included in all
23 | copies or substantial portions of the Software.
24 |
25 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
26 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
27 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
28 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
29 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
30 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
31 | SOFTWARE.
32 |
--------------------------------------------------------------------------------