diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml
new file mode 100644
index 00000000..186f7f19
--- /dev/null
+++ b/.github/workflows/release.yml
@@ -0,0 +1,46 @@
+# This GitHub action can publish assets for release when a tag is created.
+# Currently its setup to run on any tag that matches the pattern "v*" (ie. v0.1.0).
+#
+# This uses an action (hashicorp/ghaction-import-gpg) that assumes you set your
+# private key in the `GPG_PRIVATE_KEY` secret and passphrase in the `GPG_PASSPHRASE`
+# secret. If you would rather own your own GPG handling, please fork this action
+# or use an alternative one for key handling.
+#
+# You will need to pass the `--batch` flag to `gpg` in your signing step
+# in `goreleaser` to indicate this is being used in a non-interactive mode.
+#
+name: release
+on:
+ push:
+ tags:
+ - 'v*'
+jobs:
+ goreleaser:
+ runs-on: ubuntu-latest
+ steps:
+ - name: Checkout
+ uses: actions/checkout@v2
+ - name: Unshallow
+ run: git fetch --prune --unshallow
+ - name: Set up Go
+ uses: actions/setup-go@v2
+ with:
+ go-version: 1.17
+ - name: Describe plugin
+ id: plugin_describe
+ run: echo "::set-output name=api_version::$(go run . describe | jq -r '.api_version')"
+ - name: Import GPG key
+ id: import_gpg
+ uses: crazy-max/ghaction-import-gpg@v5.0.0
+ env:
+ gpg_private_key: ${{ secrets.GPG_PRIVATE_KEY }}
+ passphrase: ${{ secrets.GPG_PASSPHRASE }}
+ - name: Run GoReleaser
+ uses: goreleaser/goreleaser-action@v2
+ with:
+ version: latest
+ args: release --rm-dist
+ env:
+ GPG_FINGERPRINT: ${{ steps.import_gpg.outputs.fingerprint }}
+ GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
+ API_VERSION: ${{ steps.plugin_describe.outputs.api_version }}
diff --git a/.gitignore b/.gitignore
index a6e39947..7c7dee28 100644
--- a/.gitignore
+++ b/.gitignore
@@ -2,3 +2,9 @@
*~
bin
pkg
+crash.log
+packer_cache/*
+builder-*
+dist/*
+vendor/*
+packer-plugin-xenserver
\ No newline at end of file
diff --git a/.goreleaser.yml b/.goreleaser.yml
new file mode 100644
index 00000000..71544a45
--- /dev/null
+++ b/.goreleaser.yml
@@ -0,0 +1,74 @@
+# This is an example goreleaser.yaml file with some sane defaults.
+# Make sure to check the documentation at http://goreleaser.com
+env:
+ - CGO_ENABLED=0
+before:
+ hooks:
+ # TODO(ddelnano): for now there aren't tests to run
+ # - go test ./...
+ # As part of the release doc files are included as a separate deliverable for
+ # consumption by Packer.io. To include a separate docs.zip uncomment the following command.
+ #- make ci-release-docs
+ # Check plugin compatibility with required version of the Packer SDK
+ - make plugin-check
+builds:
+ # A separated build to run the packer-plugins-check only once for a linux_amd64 binary
+ -
+ id: plugin-check
+ mod_timestamp: '{{ .CommitTimestamp }}'
+ flags:
+ - -trimpath #removes all file system paths from the compiled executable
+ ldflags:
+ - '-s -w -X {{ .ModulePath }}/version.Version={{.Version}} -X {{ .ModulePath }}/version.VersionPrerelease= '
+ goos:
+ - linux
+ goarch:
+ - amd64
+ binary: '{{ .ProjectName }}_v{{ .Version }}_{{ .Env.API_VERSION }}_{{ .Os }}_{{ .Arch }}'
+ -
+ mod_timestamp: '{{ .CommitTimestamp }}'
+ flags:
+ - -trimpath #removes all file system paths from the compiled executable
+ ldflags:
+ - '-s -w -X {{ .ModulePath }}/version.Version={{.Version}} -X {{ .ModulePath }}/version.VersionPrerelease= '
+ goos:
+ - freebsd
+ - windows
+ - linux
+ - darwin
+ goarch:
+ - amd64
+ - '386'
+ - arm
+ - arm64
+ ignore:
+ - goos: darwin
+ goarch: '386'
+ - goos: linux
+ goarch: amd64
+ binary: '{{ .ProjectName }}_v{{ .Version }}_{{ .Env.API_VERSION }}_{{ .Os }}_{{ .Arch }}'
+archives:
+- format: zip
+ files:
+ - none*
+ name_template: '{{ .ProjectName }}_v{{ .Version }}_{{ .Env.API_VERSION }}_{{ .Os }}_{{ .Arch }}'
+checksum:
+ name_template: '{{ .ProjectName }}_v{{ .Version }}_SHA256SUMS'
+ algorithm: sha256
+signs:
+ - artifacts: checksum
+ args:
+ # if you are using this is in a GitHub action or some other automated pipeline, you
+ # need to pass the batch flag to indicate its not interactive.
+ - "--batch"
+ - "--local-user"
+ - "{{ .Env.GPG_FINGERPRINT }}"
+ - "--output"
+ - "${signature}"
+ - "--detach-sign"
+ - "${artifact}"
+release:
+ draft: true
+
+changelog:
+ skip: true
diff --git a/.travis.yml b/.travis.yml
deleted file mode 100644
index 86d95d72..00000000
--- a/.travis.yml
+++ /dev/null
@@ -1,7 +0,0 @@
-language: go
-go:
- # Test with the first and the latest go release - to ensure compatibility
- - 1.6
- - tip
-script:
- - gofmtresult=$(gofmt -s -l .); if [[ -n $gofmtresult ]]; then echo -e "Please run \"gofmt -s -w .\" before committing for the below:\n$gofmtresult"; false; fi
diff --git a/GNUmakefile b/GNUmakefile
new file mode 100644
index 00000000..98fba696
--- /dev/null
+++ b/GNUmakefile
@@ -0,0 +1,34 @@
+NAME=xenserver
+BINARY=packer-plugin-${NAME}
+
+COUNT?=1
+TEST?=$(shell go list ./...)
+HASHICORP_PACKER_PLUGIN_SDK_VERSION?=$(shell go list -m github.com/hashicorp/packer-plugin-sdk | cut -d " " -f2)
+
+.PHONY: dev
+
+build:
+ @go build -o ${BINARY}
+
+dev: build
+ @mkdir -p ~/.packer.d/plugins/
+ @mv ${BINARY} ~/.packer.d/plugins/${BINARY}
+
+test:
+ @go test -race -count $(COUNT) $(TEST) -timeout=3m
+
+install-packer-sdc: ## Install packer sofware development command
+ @go install github.com/hashicorp/packer-plugin-sdk/cmd/packer-sdc@${HASHICORP_PACKER_PLUGIN_SDK_VERSION}
+
+ci-release-docs: install-packer-sdc
+ @packer-sdc renderdocs -src docs -partials docs-partials/ -dst docs/
+ @/bin/sh -c "[ -d docs ] && zip -r docs.zip docs/"
+
+plugin-check: install-packer-sdc build
+ @packer-sdc plugin-check ${BINARY}
+
+testacc: dev
+ @PACKER_ACC=1 go test -count $(COUNT) -v $(TEST) -timeout=120m
+
+generate: install-packer-sdc
+ @go generate ./...
diff --git a/Godeps/Godeps.json b/Godeps/Godeps.json
deleted file mode 100644
index 7d833ee1..00000000
--- a/Godeps/Godeps.json
+++ /dev/null
@@ -1,202 +0,0 @@
-{
- "ImportPath": "github.com/xenserver/packer-builder-xenserver",
- "GoVersion": "go1.6",
- "GodepVersion": "v74",
- "Packages": [
- "./..."
- ],
- "Deps": [
- {
- "ImportPath": "github.com/Sirupsen/logrus",
- "Comment": "v0.10.0-19-gf3cfb45",
- "Rev": "f3cfb454f4c209e6668c95216c4744b8fddb2356"
- },
- {
- "ImportPath": "github.com/dylanmei/iso8601",
- "Comment": "v0.1.0",
- "Rev": "2075bf119b58e5576c6ed9f867b8f3d17f2e54d4"
- },
- {
- "ImportPath": "github.com/dylanmei/winrmtest",
- "Rev": "025617847eb2cf9bd1d851bc3b22ed28e6245ce5"
- },
- {
- "ImportPath": "github.com/hashicorp/errwrap",
- "Rev": "7554cd9344cec97297fa6649b055a8c98c2a1e55"
- },
- {
- "ImportPath": "github.com/hashicorp/go-multierror",
- "Rev": "d30f09973e19c1dfcd120b2d9c4f168e68d6b5d5"
- },
- {
- "ImportPath": "github.com/hashicorp/go-version",
- "Rev": "7e3c02b30806fa5779d3bdfc152ce4c6f40e7b38"
- },
- {
- "ImportPath": "github.com/hashicorp/yamux",
- "Rev": "df949784da9ed028ee76df44652e42d37a09d7e4"
- },
- {
- "ImportPath": "github.com/kr/fs",
- "Rev": "2788f0dbd16903de03cb8186e5c7d97b69ad387b"
- },
- {
- "ImportPath": "github.com/masterzen/simplexml/dom",
- "Rev": "95ba30457eb1121fa27753627c774c7cd4e90083"
- },
- {
- "ImportPath": "github.com/masterzen/winrm/soap",
- "Rev": "54ea5d01478cfc2afccec1504bd0dfcd8c260cfa"
- },
- {
- "ImportPath": "github.com/masterzen/winrm/winrm",
- "Rev": "54ea5d01478cfc2afccec1504bd0dfcd8c260cfa"
- },
- {
- "ImportPath": "github.com/masterzen/xmlpath",
- "Rev": "13f4951698adc0fa9c1dda3e275d489a24201161"
- },
- {
- "ImportPath": "github.com/mitchellh/go-fs",
- "Rev": "a34c1b9334e86165685a9449b782f20465eb8c69"
- },
- {
- "ImportPath": "github.com/mitchellh/go-fs/fat",
- "Rev": "a34c1b9334e86165685a9449b782f20465eb8c69"
- },
- {
- "ImportPath": "github.com/mitchellh/iochan",
- "Rev": "87b45ffd0e9581375c491fef3d32130bb15c5bd7"
- },
- {
- "ImportPath": "github.com/mitchellh/mapstructure",
- "Rev": "281073eb9eb092240d33ef253c404f1cca550309"
- },
- {
- "ImportPath": "github.com/mitchellh/multistep",
- "Rev": "162146fc57112954184d90266f4733e900ed05a5"
- },
- {
- "ImportPath": "github.com/mitchellh/osext",
- "Rev": "5e2d6d41470f99c881826dedd8c526728b783c9c"
- },
- {
- "ImportPath": "github.com/mitchellh/packer/common",
- "Comment": "v0.10.1-135-g63edbd4",
- "Rev": "63edbd40edc5a55394f8532aa9958bbe257b31b5"
- },
- {
- "ImportPath": "github.com/mitchellh/packer/common/ssh",
- "Comment": "v0.10.1-135-g63edbd4",
- "Rev": "63edbd40edc5a55394f8532aa9958bbe257b31b5"
- },
- {
- "ImportPath": "github.com/mitchellh/packer/common/uuid",
- "Comment": "v0.10.1-135-g63edbd4",
- "Rev": "63edbd40edc5a55394f8532aa9958bbe257b31b5"
- },
- {
- "ImportPath": "github.com/mitchellh/packer/communicator/none",
- "Comment": "v0.10.1-135-g63edbd4",
- "Rev": "63edbd40edc5a55394f8532aa9958bbe257b31b5"
- },
- {
- "ImportPath": "github.com/mitchellh/packer/communicator/ssh",
- "Comment": "v0.10.1-135-g63edbd4",
- "Rev": "63edbd40edc5a55394f8532aa9958bbe257b31b5"
- },
- {
- "ImportPath": "github.com/mitchellh/packer/communicator/winrm",
- "Comment": "v0.10.1-135-g63edbd4",
- "Rev": "63edbd40edc5a55394f8532aa9958bbe257b31b5"
- },
- {
- "ImportPath": "github.com/mitchellh/packer/helper/communicator",
- "Comment": "v0.10.1-135-g63edbd4",
- "Rev": "63edbd40edc5a55394f8532aa9958bbe257b31b5"
- },
- {
- "ImportPath": "github.com/mitchellh/packer/helper/config",
- "Comment": "v0.10.1-135-g63edbd4",
- "Rev": "63edbd40edc5a55394f8532aa9958bbe257b31b5"
- },
- {
- "ImportPath": "github.com/mitchellh/packer/packer",
- "Comment": "v0.10.1-135-g63edbd4",
- "Rev": "63edbd40edc5a55394f8532aa9958bbe257b31b5"
- },
- {
- "ImportPath": "github.com/mitchellh/packer/packer/plugin",
- "Comment": "v0.10.1-135-g63edbd4",
- "Rev": "63edbd40edc5a55394f8532aa9958bbe257b31b5"
- },
- {
- "ImportPath": "github.com/mitchellh/packer/packer/rpc",
- "Comment": "v0.10.1-135-g63edbd4",
- "Rev": "63edbd40edc5a55394f8532aa9958bbe257b31b5"
- },
- {
- "ImportPath": "github.com/mitchellh/packer/template",
- "Comment": "v0.10.1-135-g63edbd4",
- "Rev": "63edbd40edc5a55394f8532aa9958bbe257b31b5"
- },
- {
- "ImportPath": "github.com/mitchellh/packer/template/interpolate",
- "Comment": "v0.10.1-135-g63edbd4",
- "Rev": "63edbd40edc5a55394f8532aa9958bbe257b31b5"
- },
- {
- "ImportPath": "github.com/mitchellh/reflectwalk",
- "Rev": "eecf4c70c626c7cfbb95c90195bc34d386c74ac6"
- },
- {
- "ImportPath": "github.com/nilshell/xmlrpc",
- "Rev": "41b9444050f7a0494a44cd5644f5048aa8261b17"
- },
- {
- "ImportPath": "github.com/nu7hatch/gouuid",
- "Rev": "179d4d0c4d8d407a32af483c2354df1d2c91e6c3"
- },
- {
- "ImportPath": "github.com/packer-community/winrmcp/winrmcp",
- "Rev": "f1bcf36a69fa2945e65dd099eee11b560fbd3346"
- },
- {
- "ImportPath": "github.com/pkg/sftp",
- "Rev": "e84cc8c755ca39b7b64f510fe1fffc1b51f210a5"
- },
- {
- "ImportPath": "github.com/satori/go.uuid",
- "Rev": "d41af8bb6a7704f00bc3b7cba9355ae6a5a80048"
- },
- {
- "ImportPath": "github.com/svanharmelen/gocs",
- "Comment": "v1.0.0-4-ga53656b",
- "Rev": "a53656b67c7b6db48362e3b4edb5e335a7162bf0"
- },
- {
- "ImportPath": "github.com/ugorji/go/codec",
- "Rev": "646ae4a518c1c3be0739df898118d9bccf993858"
- },
- {
- "ImportPath": "github.com/xenserver/go-xenserver-client",
- "Rev": "42dc9035c2e805b844614741d804f308bacb7490"
- },
- {
- "ImportPath": "golang.org/x/crypto/curve25519",
- "Rev": "1f22c0103821b9390939b6776727195525381532"
- },
- {
- "ImportPath": "golang.org/x/crypto/ssh",
- "Rev": "1f22c0103821b9390939b6776727195525381532"
- },
- {
- "ImportPath": "golang.org/x/crypto/ssh/agent",
- "Rev": "1f22c0103821b9390939b6776727195525381532"
- },
- {
- "ImportPath": "golang.org/x/sys/unix",
- "Rev": "50c6bc5e4292a1d4e65c6e9be5f53be28bcbe28e"
- }
- ]
-}
diff --git a/Godeps/Readme b/Godeps/Readme
deleted file mode 100644
index 4cdaa53d..00000000
--- a/Godeps/Readme
+++ /dev/null
@@ -1,5 +0,0 @@
-This directory tree is generated automatically by godep.
-
-Please do not edit.
-
-See https://github.com/tools/godep for more information.
diff --git a/README.md b/README.md
index 7629fca4..bd6511d2 100644
--- a/README.md
+++ b/README.md
@@ -1,32 +1,50 @@
-[![Build Status](https://travis-ci.org/xenserver/packer-builder-xenserver.svg?branch=master)](https://travis-ci.org/xenserver/packer-builder-xenserver)
-
# XenServer packer.io builder
This builder plugin extends packer.io to support building images for XenServer.
-You can check out packer [here](https://packer.io).
+This is a fork of the original builder since the original project was abandoned and no longer compilied with recent versions of Go or worked with Xenserver 7.6 and later.
+It improves the original project in the following ways:
+1. Developed alongside the [Xenorchestra terraform provider](https://github.com/ddelnano/terraform-provider-xenorchestra) to ensure the hashicorp ecosystem is interoperable.
+2. Reimplements how the boot commands are sent over VNC to be compatible with later versions of Xenserver (Citrix hypervisor) and XCP
-## Dependencies
-* Packer >= 0.7.2 (https://packer.io)
-* XenServer > 6.2 (http://xenserver.org)
-* Golang (tested with 1.2.1)
+## Status
+At the time of this writing the packer builder has been verified to work with Xenserver 7.6 and can launch VMs with the packer output through the xenorchestra terraform provider.
-## Install Go
+The following list contains things that are incomplete but will be worked on soon:
+- The documentation is still in an inconsistent state with upstream
+- XVA builder is untested
+- Lots of dead code to remove from upstream
-Follow these instructions and install golang on your system:
-* https://golang.org/doc/install
+## Using the builder
-## Install Packer
+The packer builder can be installed via `packer init` as long as the packer template includes the following in it's `pkr.hcl` file
+```
+packer {
+ required_plugins {
+ xenserver= {
+ version = ">= v0.3.2"
+ source = "github.com/ddelnano/xenserver"
+ }
+ }
+}
+```
-Clone the Packer repository:
+The following command will install the packer plugin using the Ubuntu example provided in this repository.
-```shell
-git clone https://github.com/mitchellh/packer.git
```
+packer init examples/ubuntu/ubuntu-2004.pkr.hcl
+```
+
+If you are using an older version of packer or are still using json templates you will need to download the relevant release from the project's [releases page](https://github.com/ddelnano/packer-builder-xenserver/releases) and copy the binary to `~/.packer.d/plugins/packer-builder-xenserver-iso`.
-Then follow the [instructions to build and install a development version of Packer](https://github.com/mitchellh/packer#developing-packer).
+## Developing the builder
+
+### Dependencies
+* Packer >= v1.7.1 (https://packer.io)
+* XenServer / Citrix Hypervisor > 7.6
+* Golang 1.16
## Compile the plugin
@@ -34,74 +52,22 @@ Once you have installed Packer, you must compile this plugin and install the
resulting binary.
```shell
-cd $GOROOT
-mkdir -p src/github.com/xenserver/
-cd src/github.com/xenserver
-git clone https://github.com/xenserver/packer-builder-xenserver.git
-cd packer-builder-xenserver
-./build.sh
+$ go build -o packer-plugin-xenserver
+
+# Add the builder to the location packer expects it to be installed in
+$ mkdir -p ~/.packer.d/plugins/
+$ cp builder-xenserver-iso ~/.packer.d/plugins/packer-builder-xenserver-iso
```
-If the build is successful, you should now have `packer-builder-xenserver-iso` and
-`packer-builder-xenserver-xva` binaries in your `$GOPATH/bin` directory and you are
-ready to get going with packer; skip to the CentOS 6.6 example below.
+# Documentation
-In order to do a cross-compile, run instead:
-```shell
-XC_OS="windows linux" XC_ARCH="386 amd64" ./build.sh
-```
-This builds 32 and 64 bit binaries for both Windows and Linux. Native binaries will
-be installed in `$GOPATH/bin` as above, and cross-compiled ones in the `pkg/` directory.
+For complete documentation on configuration commands, see [the
+xenserver-iso docs](docs/builders/xenserver-iso.html.markdown)
-Don't forget to also cross compile Packer, by running
-```shell
-XC_OS="windows linux" XC_ARCH="386 amd64" make bin
-```
-(instead of `make dev`) in the directory where you checked out Packer.
-
-## CentOS 6.6 Example
-
-Once you've setup the above, you are good to go with an example.
-
-To get you started, there is an example config file which you can use:
-[`examples/centos-6.6.json`](https://github.com/xenserver/packer-builder-xenserver/blob/master/examples/centos-6.6.json)
-
-The example is functional, once suitable `remote_host`, `remote_username` and
-`remote_password` configurations have been substituted.
-
-A brief explanation of what the config parameters mean:
- * `type` - specifies the builder type. This is 'xenserver-iso', for installing
- a VM from scratch, or 'xenserver-xva' to import existing XVA as a starting
- point.
- * `remote_username` - the username for the XenServer host being used.
- * `remote_password` - the password for the XenServer host being used.
- * `remote_host` - the IP for the XenServer host being used.
- * `vm_name` - the name that should be given to the created VM.
- * `vcpus_max` - the maximum number of VCPUs for the VM.
- * `vcpus_atstartup` - the number of startup VCPUs for the VM.
- * `vm_memory` - the static memory configuration for the VM, in MB.
- * `disk_size` - the size of the disk the VM should be created with, in MB.
- * `iso_name` - the name of the ISO visible on a ISO SR connected to the XenServer host.
- * `http_directory` - the path to a local directory to serve up over http.
- * `ssh_username` - the username set by the installer for the instance.
- * `ssh_password` - the password set by the installer for the instance.
- * `boot_command` - a list of commands to be sent to the instance over VNC.
- * `vm_other_config` - a map of string to string for setting vm's other-config.
- * `network_names` - a list of network name for the VIFs to connect with.
-
-Note, the `http_directory` parameter is only required if you
-want Packer to serve up files over HTTP. In this example, the templated variables
-`{{ .HTTPIP }}` and `{{ .HTTPPort }}` will be substituted for the local IP and
-the port that Packer starts its HTTP service on.
-
-Once you've updated the config file with your own parameters, you can use packer
-to build this VM with the following command:
+## Support
-```
-packer build centos-6.6.json
-```
+You can discuss any issues you have or feature requests in [Discord](https://discord.gg/ZpNq8ez).
-# Documentation
+If you'd like to support my effort on the project, please consider buying me a coffee
-For complete documentation on configuration commands, see either [the
-xenserver-iso docs](https://github.com/rdobson/packer-builder-xenserver/blob/master/docs/builders/xenserver-iso.html.markdown) or [the xenserver-xva docs](https://github.com/rdobson/packer-builder-xenserver/blob/master/docs/builders/xenserver-xva.html.markdown).
+[!["Buy Me A Coffee"](https://www.buymeacoffee.com/assets/img/custom_images/orange_img.png)](https://www.buymeacoffee.com/ddelnano)
diff --git a/build.sh b/build.sh
deleted file mode 100755
index efc343e7..00000000
--- a/build.sh
+++ /dev/null
@@ -1,47 +0,0 @@
-#!/bin/bash
-#
-# This script builds the application from source for multiple platforms.
-# Adapted from from packer/scripts/build.sh
-
-# Determine the arch/os combos we're building for
-XC_OS=${XC_OS:-$(go env GOOS)}
-XC_ARCH=${XC_ARCH:-$(go env GOARCH)}
-GOPATH=${GOPATH:-$(go env GOPATH)}
-
-# Delete the old dir
-echo "==> Removing old directory..."
-rm -f bin/*
-rm -rf pkg/*
-rm -rf $GOPATH/pkg/*
-mkdir -p bin/
-
-gox \
- -os="${XC_OS}" \
- -arch="${XC_ARCH}" \
- -output "pkg/{{.OS}}_{{.Arch}}/packer-{{.Dir}}" \
- ./... \
- || exit 1
-
-# Move all the compiled things to the $GOPATH/bin
-GOPATH=${GOPATH:-$(go env GOPATH)}
-case $(uname) in
- CYGWIN*)
- GOPATH="$(cygpath $GOPATH)"
- ;;
-esac
-OLDIFS=$IFS
-IFS=: MAIN_GOPATH=($GOPATH)
-IFS=$OLDIFS
-
-# Copy our OS/Arch to the bin/ directory
-echo "==> Copying binaries for this platform..."
-DEV_PLATFORM="./pkg/$(go env GOOS)_$(go env GOARCH)"
-for F in $(find ${DEV_PLATFORM} -mindepth 1 -maxdepth 1 -type f); do
- cp ${F} bin/
- cp ${F} ${MAIN_GOPATH}/bin/
-done
-
-# Done!
-echo
-echo "==> Results:"
-ls -hl bin/
diff --git a/builder/xenserver/common/artifact.go b/builder/xenserver/common/artifact.go
index 5e6a7cd0..32b6531d 100644
--- a/builder/xenserver/common/artifact.go
+++ b/builder/xenserver/common/artifact.go
@@ -2,7 +2,7 @@ package common
import (
"fmt"
- "github.com/mitchellh/packer/packer"
+ "github.com/hashicorp/packer-plugin-sdk/packer"
"os"
"path/filepath"
)
diff --git a/builder/xenserver/common/client.go b/builder/xenserver/common/client.go
index 33f27846..6341986a 100644
--- a/builder/xenserver/common/client.go
+++ b/builder/xenserver/common/client.go
@@ -4,9 +4,10 @@ import (
"encoding/xml"
"errors"
"fmt"
- "github.com/nilshell/xmlrpc"
"log"
- "regexp"
+
+ xmlrpc "github.com/amfranz/go-xmlrpc-client"
+ xenapi "github.com/terra-farm/go-xen-api-client"
)
type XenAPIClient struct {
@@ -62,9 +63,8 @@ const (
func (c *XenAPIClient) RPCCall(result interface{}, method string, params []interface{}) (err error) {
fmt.Println(params)
- p := new(xmlrpc.Params)
- p.Params = params
- err = c.RPC.Call(method, *p, result)
+ p := xmlrpc.Params{Params: params}
+ err = c.RPC.Call(method, p, result)
return err
}
@@ -202,24 +202,6 @@ func (client *XenAPIClient) GetVMByNameLabel(name_label string) (vms []*VM, err
return vms, nil
}
-func (client *XenAPIClient) GetSRByNameLabel(name_label string) (srs []*SR, err error) {
- srs = make([]*SR, 0)
- result := APIResult{}
- err = client.APICall(&result, "SR.get_by_name_label", name_label)
- if err != nil {
- return srs, err
- }
-
- for _, elem := range result.Value.([]interface{}) {
- sr := new(SR)
- sr.Ref = elem.(string)
- sr.Client = client
- srs = append(srs, sr)
- }
-
- return srs, nil
-}
-
func (client *XenAPIClient) GetNetworkByUuid(network_uuid string) (network *Network, err error) {
network = new(Network)
result := APIResult{}
@@ -268,18 +250,6 @@ func (client *XenAPIClient) GetVdiByNameLabel(name_label string) (vdis []*VDI, e
return vdis, nil
}
-func (client *XenAPIClient) GetSRByUuid(sr_uuid string) (sr *SR, err error) {
- sr = new(SR)
- result := APIResult{}
- err = client.APICall(&result, "SR.get_by_uuid", sr_uuid)
- if err != nil {
- return nil, err
- }
- sr.Ref = result.Value.(string)
- sr.Client = client
- return
-}
-
func (client *XenAPIClient) GetVdiByUuid(vdi_uuid string) (vdi *VDI, err error) {
vdi = new(VDI)
result := APIResult{}
@@ -309,20 +279,6 @@ func (client *XenAPIClient) GetPIFs() (pifs []*PIF, err error) {
return pifs, nil
}
-func (client *XenAPIClient) CreateTask() (task *Task, err error) {
- result := APIResult{}
- err = client.APICall(&result, "task.create", "packer-task", "Packer task")
-
- if err != nil {
- return
- }
-
- task = new(Task)
- task.Ref = result.Value.(string)
- task.Client = client
- return
-}
-
// Host associated functions
func (self *Host) GetSoftwareVersion() (versions map[string]interface{}, err error) {
@@ -400,18 +356,8 @@ func (self *VM) CleanShutdown() (err error) {
return
}
-func (self *VM) HardShutdown() (err error) {
- result := APIResult{}
- err = self.Client.APICall(&result, "VM.hard_shutdown", self.Ref)
- if err != nil {
- return err
- }
- return
-}
-
-func (self *VM) Unpause() (err error) {
- result := APIResult{}
- err = self.Client.APICall(&result, "VM.unpause", self.Ref)
+func Unpause(c *Connection, vmRef xenapi.VMRef) (err error) {
+ err = c.client.VM.Unpause(c.session, vmRef)
if err != nil {
return err
}
@@ -495,39 +441,22 @@ func (self *VM) GetVBDs() (vbds []VBD, err error) {
return vbds, nil
}
-func (self *VM) GetVIFs() (vifs []VIF, err error) {
- vifs = make([]VIF, 0)
- result := APIResult{}
- err = self.Client.APICall(&result, "VM.get_VIFs", self.Ref)
- if err != nil {
- return vifs, err
- }
- for _, elem := range result.Value.([]interface{}) {
- vif := VIF{}
- vif.Ref = elem.(string)
- vif.Client = self.Client
- vifs = append(vifs, vif)
- }
-
- return vifs, nil
-}
-
-func (self *VM) GetDisks() (vdis []*VDI, err error) {
+func GetDisks(c *Connection, vmRef xenapi.VMRef) (vdis []xenapi.VDIRef, err error) {
// Return just data disks (non-isos)
- vdis = make([]*VDI, 0)
- vbds, err := self.GetVBDs()
+ vdis = make([]xenapi.VDIRef, 0)
+ vbds, err := c.client.VM.GetVBDs(c.session, vmRef)
if err != nil {
return nil, err
}
for _, vbd := range vbds {
- rec, err := vbd.GetRecord()
+ rec, err := c.client.VBD.GetRecord(c.session, vbd)
if err != nil {
return nil, err
}
- if rec["type"] == "Disk" {
+ if rec.Type == "Disk" {
- vdi, err := vbd.GetVDI()
+ vdi, err := c.client.VBD.GetVDI(c.session, vbd)
if err != nil {
return nil, err
}
@@ -576,51 +505,53 @@ func (self *VM) SetStaticMemoryRange(min, max uint) (err error) {
return
}
-func (self *VM) ConnectVdi(vdi *VDI, vdiType VDIType) (err error) {
-
- // 1. Create a VBD
-
- vbd_rec := make(xmlrpc.Struct)
- vbd_rec["VM"] = self.Ref
- vbd_rec["VDI"] = vdi.Ref
- vbd_rec["userdevice"] = "autodetect"
- vbd_rec["empty"] = false
- vbd_rec["other_config"] = make(xmlrpc.Struct)
- vbd_rec["qos_algorithm_type"] = ""
- vbd_rec["qos_algorithm_params"] = make(xmlrpc.Struct)
-
- switch vdiType {
- case CD:
- vbd_rec["mode"] = "RO"
- vbd_rec["bootable"] = true
- vbd_rec["unpluggable"] = false
- vbd_rec["type"] = "CD"
- case Disk:
- vbd_rec["mode"] = "RW"
- vbd_rec["bootable"] = false
- vbd_rec["unpluggable"] = false
- vbd_rec["type"] = "Disk"
- case Floppy:
- vbd_rec["mode"] = "RW"
- vbd_rec["bootable"] = false
- vbd_rec["unpluggable"] = true
- vbd_rec["type"] = "Floppy"
- }
-
- result := APIResult{}
- err = self.Client.APICall(&result, "VBD.create", vbd_rec)
+func ConnectVdi(c *Connection, vmRef xenapi.VMRef, vdiRef xenapi.VDIRef, vbdType xenapi.VbdType) (err error) {
+
+ var mode xenapi.VbdMode
+ var unpluggable bool
+ var bootable bool
+ var t xenapi.VbdType
+ switch vbdType {
+ case xenapi.VbdTypeCD:
+ mode = xenapi.VbdModeRO
+ bootable = true
+ unpluggable = false
+ t = xenapi.VbdTypeCD
+ case xenapi.VbdTypeDisk:
+ mode = xenapi.VbdModeRW
+ bootable = false
+ unpluggable = false
+ t = xenapi.VbdTypeDisk
+ case xenapi.VbdTypeFloppy:
+ mode = xenapi.VbdModeRW
+ bootable = false
+ unpluggable = true
+ t = xenapi.VbdTypeFloppy
+ }
+
+ vbd_ref, err := c.client.VBD.Create(c.session, xenapi.VBDRecord{
+ VM: xenapi.VMRef(vmRef),
+ VDI: xenapi.VDIRef(vdiRef),
+ Userdevice: "autodetect",
+ Empty: false,
+ // OtherConfig: map[string]interface{{}},
+ QosAlgorithmType: "",
+ // QosAlgorithmParams: map[string]interface{{}},
+ Mode: mode,
+ Unpluggable: unpluggable,
+ Bootable: bootable,
+ Type: t,
+ })
if err != nil {
return err
}
- vbd_ref := result.Value.(string)
fmt.Println("VBD Ref:", vbd_ref)
- result = APIResult{}
- err = self.Client.APICall(&result, "VBD.get_uuid", vbd_ref)
+ uuid, err := c.client.VBD.GetUUID(c.session, vbd_ref)
- fmt.Println("VBD UUID: ", result.Value.(string))
+ fmt.Println("VBD UUID: ", uuid)
/*
// 2. Plug VBD (Non need - the VM hasn't booted.
// @todo - check VM state
@@ -634,34 +565,32 @@ func (self *VM) ConnectVdi(vdi *VDI, vdiType VDIType) (err error) {
return
}
-func (self *VM) DisconnectVdi(vdi *VDI) error {
- vbds, err := self.GetVBDs()
+func DisconnectVdi(c *Connection, vmRef xenapi.VMRef, vdi xenapi.VDIRef) error {
+ vbds, err := c.client.VM.GetVBDs(c.session, vmRef)
if err != nil {
return fmt.Errorf("Unable to get VM VBDs: %s", err.Error())
}
for _, vbd := range vbds {
- rec, err := vbd.GetRecord()
+ rec, err := c.client.VBD.GetRecord(c.session, vbd)
if err != nil {
- return fmt.Errorf("Could not get record for VBD '%s': %s", vbd.Ref, err.Error())
+ return fmt.Errorf("Could not get record for VBD '%s': %s", vbd, err.Error())
}
-
- if recVdi, ok := rec["VDI"].(string); ok {
- if recVdi == vdi.Ref {
- _ = vbd.Unplug()
- err = vbd.Destroy()
- if err != nil {
- return fmt.Errorf("Could not destroy VBD '%s': %s", vbd.Ref, err.Error())
- }
-
- return nil
+ recVdi := rec.VDI
+ if recVdi == vdi {
+ _ = c.client.VBD.Unplug(c.session, vbd)
+ err = c.client.VBD.Destroy(c.session, vbd)
+ if err != nil {
+ return fmt.Errorf("Could not destroy VBD '%s': %s", vbd, err.Error())
}
+
+ return nil
} else {
- log.Printf("Could not find VDI record in VBD '%s'", vbd.Ref)
+ log.Printf("Could not find VDI record in VBD '%s'", vbd)
}
}
- return fmt.Errorf("Could not find VBD for VDI '%s'", vdi.Ref)
+ return fmt.Errorf("Could not find VBD for VDI '%s'", vdi)
}
func (self *VM) SetPlatform(params map[string]string) (err error) {
@@ -679,31 +608,20 @@ func (self *VM) SetPlatform(params map[string]string) (err error) {
return
}
-func (self *VM) ConnectNetwork(network *Network, device string) (vif *VIF, err error) {
- // Create the VIF
-
- vif_rec := make(xmlrpc.Struct)
- vif_rec["network"] = network.Ref
- vif_rec["VM"] = self.Ref
- vif_rec["MAC"] = ""
- vif_rec["device"] = device
- vif_rec["MTU"] = "1504"
- vif_rec["other_config"] = make(xmlrpc.Struct)
- vif_rec["qos_algorithm_type"] = ""
- vif_rec["qos_algorithm_params"] = make(xmlrpc.Struct)
-
- result := APIResult{}
- err = self.Client.APICall(&result, "VIF.create", vif_rec)
+func ConnectNetwork(c *Connection, networkRef xenapi.NetworkRef, vmRef xenapi.VMRef, device string) (*xenapi.VIFRef, error) {
+ vif, err := c.client.VIF.Create(c.session, xenapi.VIFRecord{
+ Network: networkRef,
+ VM: vmRef,
+ Device: device,
+ LockingMode: xenapi.VifLockingModeNetworkDefault,
+ })
if err != nil {
return nil, err
}
+ log.Printf("Created the following VIF: %s", vif)
- vif = new(VIF)
- vif.Ref = result.Value.(string)
- vif.Client = self.Client
-
- return vif, nil
+ return &vif, nil
}
// Setters
@@ -901,9 +819,9 @@ type TransferRecord struct {
UrlFull string `xml:"url_full,attr"`
}
-func (self *VDI) Expose(format string) (url string, err error) {
+func Expose(c *Connection, vdiRef xenapi.VDIRef, format string) (url string, err error) {
- hosts, err := self.Client.GetHosts()
+ hosts, err := c.client.Host.GetAll(c.session)
if err != nil {
err = errors.New(fmt.Sprintf("Could not retrieve hosts in the pool: %s", err.Error()))
@@ -911,33 +829,31 @@ func (self *VDI) Expose(format string) (url string, err error) {
}
host := hosts[0]
- disk_uuid, err := self.GetUuid()
-
if err != nil {
- err = errors.New(fmt.Sprintf("Failed to get VDI uuid for %s: %s", self.Ref, err.Error()))
+ err = errors.New(fmt.Sprintf("Failed to get VDI uuid for %s: %s", vdiRef, err.Error()))
return "", err
}
args := make(map[string]string)
args["transfer_mode"] = "http"
- args["vdi_uuid"] = disk_uuid
+ args["vdi_uuid"] = string(vdiRef)
args["expose_vhd"] = "true"
args["network_uuid"] = "management"
args["timeout_minutes"] = "5"
- handle, err := host.CallPlugin("transfer", "expose", args)
+ handle, err := c.client.Host.CallPlugin(c.session, host, "transfer", "expose", args)
if err != nil {
- err = errors.New(fmt.Sprintf("Error whilst exposing VDI %s: %s", disk_uuid, err.Error()))
+ err = errors.New(fmt.Sprintf("Error whilst exposing VDI %s: %s", vdiRef, err.Error()))
return "", err
}
args = make(map[string]string)
args["record_handle"] = handle
- record_xml, err := host.CallPlugin("transfer", "get_record", args)
+ record_xml, err := c.client.Host.CallPlugin(c.session, host, "transfer", "get_record", args)
if err != nil {
- err = errors.New(fmt.Sprintf("Unable to retrieve transfer record for VDI %s: %s", disk_uuid, err.Error()))
+ err = errors.New(fmt.Sprintf("Unable to retrieve transfer record for VDI %s: %s", vdiRef, err.Error()))
return "", err
}
@@ -961,17 +877,15 @@ func (self *VDI) Expose(format string) (url string, err error) {
return
}
-// Unexpose a VDI if exposed with a Transfer VM.
-
-func (self *VDI) Unexpose() (err error) {
+func Unexpose(c *Connection, vdiRef xenapi.VDIRef) (err error) {
- disk_uuid, err := self.GetUuid()
+ disk_uuid, err := c.client.VDI.GetUUID(c.session, vdiRef)
if err != nil {
return err
}
- hosts, err := self.Client.GetHosts()
+ hosts, err := c.client.Host.GetAll(c.session)
if err != nil {
err = errors.New(fmt.Sprintf("Could not retrieve hosts in the pool: %s", err.Error()))
@@ -983,7 +897,7 @@ func (self *VDI) Unexpose() (err error) {
args := make(map[string]string)
args["vdi_uuid"] = disk_uuid
- result, err := host.CallPlugin("transfer", "unexpose", args)
+ result, err := c.client.Host.CallPlugin(c.session, host, "transfer", "unexpose", args)
if err != nil {
return err
@@ -996,94 +910,65 @@ func (self *VDI) Unexpose() (err error) {
// Task associated functions
-func (self *Task) GetStatus() (status TaskStatusType, err error) {
- result := APIResult{}
- err = self.Client.APICall(&result, "task.get_status", self.Ref)
- if err != nil {
- return
- }
- rawStatus := result.Value.(string)
- switch rawStatus {
- case "pending":
- status = Pending
- case "success":
- status = Success
- case "failure":
- status = Failure
- case "cancelling":
- status = Cancelling
- case "cancelled":
- status = Cancelled
- default:
- panic(fmt.Sprintf("Task.get_status: Unknown status '%s'", rawStatus))
- }
- return
+// func (self *Task) GetResult() (object *XenAPIObject, err error) {
+// result := APIResult{}
+// err = self.Client.APICall(&result, "task.get_result", self.Ref)
+// if err != nil {
+// return
+// }
+// switch ref := result.Value.(type) {
+// case string:
+// // @fixme: xapi currently sends us an xmlrpc-encoded string via xmlrpc.
+// // This seems to be a bug in xapi. Remove this workaround when it's fixed
+// re := regexp.MustCompile("^([^<]*).*$")
+// match := re.FindStringSubmatch(ref)
+// if match == nil {
+// object = nil
+// } else {
+// object = &XenAPIObject{
+// Ref: match[1],
+// Client: self.Client,
+// }
+// }
+// case nil:
+// object = nil
+// default:
+// err = fmt.Errorf("task.get_result: unknown value type %T (expected string or nil)", ref)
+// }
+// return
+// }
+
+// Client Initiator
+type Connection struct {
+ client *xenapi.Client
+ session xenapi.SessionRef
+ Host string
+ Username string
+ Password string
}
-func (self *Task) GetProgress() (progress float64, err error) {
- result := APIResult{}
- err = self.Client.APICall(&result, "task.get_progress", self.Ref)
- if err != nil {
- return
- }
- progress = result.Value.(float64)
- return
+func (c Connection) GetSession() string {
+ return string(c.session)
}
-func (self *Task) GetResult() (object *XenAPIObject, err error) {
- result := APIResult{}
- err = self.Client.APICall(&result, "task.get_result", self.Ref)
+func NewXenAPIClient(host, username, password string) (*Connection, error) {
+ client, err := xenapi.NewClient("https://"+host, nil)
if err != nil {
- return
- }
- switch ref := result.Value.(type) {
- case string:
- // @fixme: xapi currently sends us an xmlrpc-encoded string via xmlrpc.
- // This seems to be a bug in xapi. Remove this workaround when it's fixed
- re := regexp.MustCompile("^([^<]*).*$")
- match := re.FindStringSubmatch(ref)
- if match == nil {
- object = nil
- } else {
- object = &XenAPIObject{
- Ref: match[1],
- Client: self.Client,
- }
- }
- case nil:
- object = nil
- default:
- err = fmt.Errorf("task.get_result: unknown value type %T (expected string or nil)", ref)
+ return nil, err
}
- return
-}
-func (self *Task) GetErrorInfo() (errorInfo []string, err error) {
- result := APIResult{}
- err = self.Client.APICall(&result, "task.get_error_info", self.Ref)
+ session, err := client.Session.LoginWithPassword(username, password, "1.0", "packer")
if err != nil {
- return
- }
- errorInfo = make([]string, 0)
- for _, infoRaw := range result.Value.([]interface{}) {
- errorInfo = append(errorInfo, fmt.Sprintf("%v", infoRaw))
+ return nil, err
}
- return
-}
-func (self *Task) Destroy() (err error) {
- result := APIResult{}
- err = self.Client.APICall(&result, "task.destroy", self.Ref)
- return
+ return &Connection{client, session, host, username, password}, nil
}
-// Client Initiator
+func (c *Connection) GetClient() *xenapi.Client {
+ return c.client
+}
-func NewXenAPIClient(host, username, password string) (client XenAPIClient) {
- client.Host = host
- client.Url = "http://" + host
- client.Username = username
- client.Password = password
- client.RPC, _ = xmlrpc.NewClient(client.Url, nil)
- return
+func (c *Connection) GetSessionRef() xenapi.SessionRef {
+ return c.session
}
diff --git a/builder/xenserver/common/common_config.go b/builder/xenserver/common/common_config.go
index 26ee51ff..6907e189 100644
--- a/builder/xenserver/common/common_config.go
+++ b/builder/xenserver/common/common_config.go
@@ -6,11 +6,10 @@ import (
"os"
"time"
- "github.com/mitchellh/multistep"
- "github.com/mitchellh/packer/common"
- commonssh "github.com/mitchellh/packer/common/ssh"
- "github.com/mitchellh/packer/template/interpolate"
- xsclient "github.com/xenserver/go-xenserver-client"
+ "github.com/hashicorp/packer-plugin-sdk/common"
+ "github.com/hashicorp/packer-plugin-sdk/multistep"
+ "github.com/hashicorp/packer-plugin-sdk/template/interpolate"
+ xenapi "github.com/terra-farm/go-xen-api-client"
)
type CommonConfig struct {
@@ -21,6 +20,7 @@ type CommonConfig struct {
VMName string `mapstructure:"vm_name"`
VMDescription string `mapstructure:"vm_description"`
SrName string `mapstructure:"sr_name"`
+ SrISOName string `mapstructure:"sr_iso_name"`
FloppyFiles []string `mapstructure:"floppy_files"`
NetworkNames []string `mapstructure:"network_names"`
ExportNetworkNames []string `mapstructure:"export_network_names"`
@@ -163,7 +163,7 @@ func (c *CommonConfig) Prepare(ctx *interpolate.Context, pc *common.PackerConfig
if c.SSHKeyPath != "" {
if _, err := os.Stat(c.SSHKeyPath); err != nil {
errs = append(errs, fmt.Errorf("ssh_key_path is invalid: %s", err))
- } else if _, err := commonssh.FileSigner(c.SSHKeyPath); err != nil {
+ } else if _, err := FileSigner(c.SSHKeyPath); err != nil {
errs = append(errs, fmt.Errorf("ssh_key_path is invalid: %s", err))
}
}
@@ -222,24 +222,66 @@ func (c CommonConfig) ShouldKeepVM(state multistep.StateBag) bool {
}
}
-func (config CommonConfig) GetSR(client xsclient.XenAPIClient) (*xsclient.SR, error) {
+func (config CommonConfig) GetSR(c *Connection) (xenapi.SRRef, error) {
+ var srRef xenapi.SRRef
if config.SrName == "" {
- // Find the default SR
- return client.GetDefaultSR()
+ hostRef, err := c.GetClient().Session.GetThisHost(c.session, c.session)
+
+ if err != nil {
+ return srRef, err
+ }
+
+ pools, err := c.GetClient().Pool.GetAllRecords(c.session)
+
+ if err != nil {
+ return srRef, err
+ }
+
+ for _, pool := range pools {
+ if pool.Master == hostRef {
+ return pool.DefaultSR, nil
+ }
+ }
+
+ return srRef, errors.New(fmt.Sprintf("failed to find default SR on host '%s'", hostRef))
+
+ } else {
+ // Use the provided name label to find the SR to use
+ srs, err := c.GetClient().SR.GetByNameLabel(c.session, config.SrName)
+
+ if err != nil {
+ return srRef, err
+ }
+
+ switch {
+ case len(srs) == 0:
+ return srRef, fmt.Errorf("Couldn't find a SR with the specified name-label '%s'", config.SrName)
+ case len(srs) > 1:
+ return srRef, fmt.Errorf("Found more than one SR with the name '%s'. The name must be unique", config.SrName)
+ }
+
+ return srs[0], nil
+ }
+}
+
+func (config CommonConfig) GetISOSR(c *Connection) (xenapi.SRRef, error) {
+ var srRef xenapi.SRRef
+ if config.SrISOName == "" {
+ return srRef, errors.New("sr_iso_name must be specified in the packer configuration")
} else {
// Use the provided name label to find the SR to use
- srs, err := client.GetSRByNameLabel(config.SrName)
+ srs, err := c.GetClient().SR.GetByNameLabel(c.session, config.SrName)
if err != nil {
- return nil, err
+ return srRef, err
}
switch {
case len(srs) == 0:
- return nil, fmt.Errorf("Couldn't find a SR with the specified name-label '%s'", config.SrName)
+ return srRef, fmt.Errorf("Couldn't find a SR with the specified name-label '%s'", config.SrName)
case len(srs) > 1:
- return nil, fmt.Errorf("Found more than one SR with the name '%s'. The name must be unique", config.SrName)
+ return srRef, fmt.Errorf("Found more than one SR with the name '%s'. The name must be unique", config.SrName)
}
return srs[0], nil
diff --git a/builder/xenserver/common/config.go b/builder/xenserver/common/config.go
new file mode 100644
index 00000000..53e76b7c
--- /dev/null
+++ b/builder/xenserver/common/config.go
@@ -0,0 +1,43 @@
+//go:generate mapstructure-to-hcl2 -type Config
+package common
+
+import (
+ "time"
+
+ "github.com/hashicorp/packer-plugin-sdk/common"
+ "github.com/hashicorp/packer-plugin-sdk/communicator"
+ "github.com/hashicorp/packer-plugin-sdk/template/interpolate"
+)
+
+type Config struct {
+ common.PackerConfig `mapstructure:",squash"`
+ CommonConfig `mapstructure:",squash"`
+ Comm communicator.Config `mapstructure:",squash"`
+
+ VCPUsMax uint `mapstructure:"vcpus_max"`
+ VCPUsAtStartup uint `mapstructure:"vcpus_atstartup"`
+ VMMemory uint `mapstructure:"vm_memory"`
+ DiskSize uint `mapstructure:"disk_size"`
+ CloneTemplate string `mapstructure:"clone_template"`
+ VMOtherConfig map[string]string `mapstructure:"vm_other_config"`
+
+ ISOChecksum string `mapstructure:"iso_checksum"`
+ ISOChecksumType string `mapstructure:"iso_checksum_type"`
+ ISOUrls []string `mapstructure:"iso_urls"`
+ ISOUrl string `mapstructure:"iso_url"`
+ ISOName string `mapstructure:"iso_name"`
+
+ PlatformArgs map[string]string `mapstructure:"platform_args"`
+
+ RawInstallTimeout string `mapstructure:"install_timeout"`
+ InstallTimeout time.Duration ``
+ SourcePath string `mapstructure:"source_path"`
+
+ Firmware string `mapstructure:"firmware"`
+
+ ctx interpolate.Context
+}
+
+func (c Config) GetInterpContext() *interpolate.Context {
+ return &c.ctx
+}
diff --git a/builder/xenserver/common/config.hcl2spec.go b/builder/xenserver/common/config.hcl2spec.go
new file mode 100644
index 00000000..65644ea3
--- /dev/null
+++ b/builder/xenserver/common/config.hcl2spec.go
@@ -0,0 +1,225 @@
+// Code generated by "mapstructure-to-hcl2 -type Config"; DO NOT EDIT.
+
+package common
+
+import (
+ "github.com/hashicorp/hcl/v2/hcldec"
+ "github.com/zclconf/go-cty/cty"
+)
+
+// FlatConfig is an auto-generated flat version of Config.
+// Where the contents of a field with a `mapstructure:,squash` tag are bubbled up.
+type FlatConfig struct {
+ PackerBuildName *string `mapstructure:"packer_build_name" cty:"packer_build_name" hcl:"packer_build_name"`
+ PackerBuilderType *string `mapstructure:"packer_builder_type" cty:"packer_builder_type" hcl:"packer_builder_type"`
+ PackerDebug *bool `mapstructure:"packer_debug" cty:"packer_debug" hcl:"packer_debug"`
+ PackerForce *bool `mapstructure:"packer_force" cty:"packer_force" hcl:"packer_force"`
+ PackerOnError *string `mapstructure:"packer_on_error" cty:"packer_on_error" hcl:"packer_on_error"`
+ PackerUserVars map[string]string `mapstructure:"packer_user_variables" cty:"packer_user_variables" hcl:"packer_user_variables"`
+ PackerSensitiveVars []string `mapstructure:"packer_sensitive_variables" cty:"packer_sensitive_variables" hcl:"packer_sensitive_variables"`
+ Username *string `mapstructure:"remote_username" cty:"remote_username" hcl:"remote_username"`
+ Password *string `mapstructure:"remote_password" cty:"remote_password" hcl:"remote_password"`
+ HostIp *string `mapstructure:"remote_host" cty:"remote_host" hcl:"remote_host"`
+ VMName *string `mapstructure:"vm_name" cty:"vm_name" hcl:"vm_name"`
+ VMDescription *string `mapstructure:"vm_description" cty:"vm_description" hcl:"vm_description"`
+ SrName *string `mapstructure:"sr_name" cty:"sr_name" hcl:"sr_name"`
+ SrISOName *string `mapstructure:"sr_iso_name" cty:"sr_iso_name" hcl:"sr_iso_name"`
+ FloppyFiles []string `mapstructure:"floppy_files" cty:"floppy_files" hcl:"floppy_files"`
+ NetworkNames []string `mapstructure:"network_names" cty:"network_names" hcl:"network_names"`
+ ExportNetworkNames []string `mapstructure:"export_network_names" cty:"export_network_names" hcl:"export_network_names"`
+ HostPortMin *uint `mapstructure:"host_port_min" cty:"host_port_min" hcl:"host_port_min"`
+ HostPortMax *uint `mapstructure:"host_port_max" cty:"host_port_max" hcl:"host_port_max"`
+ BootCommand []string `mapstructure:"boot_command" cty:"boot_command" hcl:"boot_command"`
+ ShutdownCommand *string `mapstructure:"shutdown_command" cty:"shutdown_command" hcl:"shutdown_command"`
+ RawBootWait *string `mapstructure:"boot_wait" cty:"boot_wait" hcl:"boot_wait"`
+ ToolsIsoName *string `mapstructure:"tools_iso_name" cty:"tools_iso_name" hcl:"tools_iso_name"`
+ HTTPDir *string `mapstructure:"http_directory" cty:"http_directory" hcl:"http_directory"`
+ HTTPPortMin *uint `mapstructure:"http_port_min" cty:"http_port_min" hcl:"http_port_min"`
+ HTTPPortMax *uint `mapstructure:"http_port_max" cty:"http_port_max" hcl:"http_port_max"`
+ SSHKeyPath *string `mapstructure:"ssh_key_path" cty:"ssh_key_path" hcl:"ssh_key_path"`
+ SSHPassword *string `mapstructure:"ssh_password" cty:"ssh_password" hcl:"ssh_password"`
+ SSHPort *uint `mapstructure:"ssh_port" cty:"ssh_port" hcl:"ssh_port"`
+ SSHUser *string `mapstructure:"ssh_username" cty:"ssh_username" hcl:"ssh_username"`
+ Type *string `mapstructure:"communicator" cty:"communicator" hcl:"communicator"`
+ PauseBeforeConnect *string `mapstructure:"pause_before_connecting" cty:"pause_before_connecting" hcl:"pause_before_connecting"`
+ SSHHost *string `mapstructure:"ssh_host" cty:"ssh_host" hcl:"ssh_host"`
+ SSHKeyPairName *string `mapstructure:"ssh_keypair_name" undocumented:"true" cty:"ssh_keypair_name" hcl:"ssh_keypair_name"`
+ SSHTemporaryKeyPairName *string `mapstructure:"temporary_key_pair_name" undocumented:"true" cty:"temporary_key_pair_name" hcl:"temporary_key_pair_name"`
+ SSHTemporaryKeyPairType *string `mapstructure:"temporary_key_pair_type" cty:"temporary_key_pair_type" hcl:"temporary_key_pair_type"`
+ SSHTemporaryKeyPairBits *int `mapstructure:"temporary_key_pair_bits" cty:"temporary_key_pair_bits" hcl:"temporary_key_pair_bits"`
+ SSHCiphers []string `mapstructure:"ssh_ciphers" cty:"ssh_ciphers" hcl:"ssh_ciphers"`
+ SSHClearAuthorizedKeys *bool `mapstructure:"ssh_clear_authorized_keys" cty:"ssh_clear_authorized_keys" hcl:"ssh_clear_authorized_keys"`
+ SSHKEXAlgos []string `mapstructure:"ssh_key_exchange_algorithms" cty:"ssh_key_exchange_algorithms" hcl:"ssh_key_exchange_algorithms"`
+ SSHPrivateKeyFile *string `mapstructure:"ssh_private_key_file" undocumented:"true" cty:"ssh_private_key_file" hcl:"ssh_private_key_file"`
+ SSHCertificateFile *string `mapstructure:"ssh_certificate_file" cty:"ssh_certificate_file" hcl:"ssh_certificate_file"`
+ SSHPty *bool `mapstructure:"ssh_pty" cty:"ssh_pty" hcl:"ssh_pty"`
+ SSHTimeout *string `mapstructure:"ssh_timeout" cty:"ssh_timeout" hcl:"ssh_timeout"`
+ SSHWaitTimeout *string `mapstructure:"ssh_wait_timeout" undocumented:"true" cty:"ssh_wait_timeout" hcl:"ssh_wait_timeout"`
+ SSHAgentAuth *bool `mapstructure:"ssh_agent_auth" undocumented:"true" cty:"ssh_agent_auth" hcl:"ssh_agent_auth"`
+ SSHDisableAgentForwarding *bool `mapstructure:"ssh_disable_agent_forwarding" cty:"ssh_disable_agent_forwarding" hcl:"ssh_disable_agent_forwarding"`
+ SSHHandshakeAttempts *int `mapstructure:"ssh_handshake_attempts" cty:"ssh_handshake_attempts" hcl:"ssh_handshake_attempts"`
+ SSHBastionHost *string `mapstructure:"ssh_bastion_host" cty:"ssh_bastion_host" hcl:"ssh_bastion_host"`
+ SSHBastionPort *int `mapstructure:"ssh_bastion_port" cty:"ssh_bastion_port" hcl:"ssh_bastion_port"`
+ SSHBastionAgentAuth *bool `mapstructure:"ssh_bastion_agent_auth" cty:"ssh_bastion_agent_auth" hcl:"ssh_bastion_agent_auth"`
+ SSHBastionUsername *string `mapstructure:"ssh_bastion_username" cty:"ssh_bastion_username" hcl:"ssh_bastion_username"`
+ SSHBastionPassword *string `mapstructure:"ssh_bastion_password" cty:"ssh_bastion_password" hcl:"ssh_bastion_password"`
+ SSHBastionInteractive *bool `mapstructure:"ssh_bastion_interactive" cty:"ssh_bastion_interactive" hcl:"ssh_bastion_interactive"`
+ SSHBastionPrivateKeyFile *string `mapstructure:"ssh_bastion_private_key_file" cty:"ssh_bastion_private_key_file" hcl:"ssh_bastion_private_key_file"`
+ SSHBastionCertificateFile *string `mapstructure:"ssh_bastion_certificate_file" cty:"ssh_bastion_certificate_file" hcl:"ssh_bastion_certificate_file"`
+ SSHFileTransferMethod *string `mapstructure:"ssh_file_transfer_method" cty:"ssh_file_transfer_method" hcl:"ssh_file_transfer_method"`
+ SSHProxyHost *string `mapstructure:"ssh_proxy_host" cty:"ssh_proxy_host" hcl:"ssh_proxy_host"`
+ SSHProxyPort *int `mapstructure:"ssh_proxy_port" cty:"ssh_proxy_port" hcl:"ssh_proxy_port"`
+ SSHProxyUsername *string `mapstructure:"ssh_proxy_username" cty:"ssh_proxy_username" hcl:"ssh_proxy_username"`
+ SSHProxyPassword *string `mapstructure:"ssh_proxy_password" cty:"ssh_proxy_password" hcl:"ssh_proxy_password"`
+ SSHKeepAliveInterval *string `mapstructure:"ssh_keep_alive_interval" cty:"ssh_keep_alive_interval" hcl:"ssh_keep_alive_interval"`
+ SSHReadWriteTimeout *string `mapstructure:"ssh_read_write_timeout" cty:"ssh_read_write_timeout" hcl:"ssh_read_write_timeout"`
+ SSHRemoteTunnels []string `mapstructure:"ssh_remote_tunnels" cty:"ssh_remote_tunnels" hcl:"ssh_remote_tunnels"`
+ SSHLocalTunnels []string `mapstructure:"ssh_local_tunnels" cty:"ssh_local_tunnels" hcl:"ssh_local_tunnels"`
+ SSHPublicKey []byte `mapstructure:"ssh_public_key" undocumented:"true" cty:"ssh_public_key" hcl:"ssh_public_key"`
+ SSHPrivateKey []byte `mapstructure:"ssh_private_key" undocumented:"true" cty:"ssh_private_key" hcl:"ssh_private_key"`
+ WinRMUser *string `mapstructure:"winrm_username" cty:"winrm_username" hcl:"winrm_username"`
+ WinRMPassword *string `mapstructure:"winrm_password" cty:"winrm_password" hcl:"winrm_password"`
+ WinRMHost *string `mapstructure:"winrm_host" cty:"winrm_host" hcl:"winrm_host"`
+ WinRMNoProxy *bool `mapstructure:"winrm_no_proxy" cty:"winrm_no_proxy" hcl:"winrm_no_proxy"`
+ WinRMPort *int `mapstructure:"winrm_port" cty:"winrm_port" hcl:"winrm_port"`
+ WinRMTimeout *string `mapstructure:"winrm_timeout" cty:"winrm_timeout" hcl:"winrm_timeout"`
+ WinRMUseSSL *bool `mapstructure:"winrm_use_ssl" cty:"winrm_use_ssl" hcl:"winrm_use_ssl"`
+ WinRMInsecure *bool `mapstructure:"winrm_insecure" cty:"winrm_insecure" hcl:"winrm_insecure"`
+ WinRMUseNTLM *bool `mapstructure:"winrm_use_ntlm" cty:"winrm_use_ntlm" hcl:"winrm_use_ntlm"`
+ SSHHostPortMin *uint `mapstructure:"ssh_host_port_min" cty:"ssh_host_port_min" hcl:"ssh_host_port_min"`
+ SSHHostPortMax *uint `mapstructure:"ssh_host_port_max" cty:"ssh_host_port_max" hcl:"ssh_host_port_max"`
+ SSHSkipNatMapping *bool `mapstructure:"ssh_skip_nat_mapping" cty:"ssh_skip_nat_mapping" hcl:"ssh_skip_nat_mapping"`
+ OutputDir *string `mapstructure:"output_directory" cty:"output_directory" hcl:"output_directory"`
+ Format *string `mapstructure:"format" cty:"format" hcl:"format"`
+ KeepVM *string `mapstructure:"keep_vm" cty:"keep_vm" hcl:"keep_vm"`
+ IPGetter *string `mapstructure:"ip_getter" cty:"ip_getter" hcl:"ip_getter"`
+ VCPUsMax *uint `mapstructure:"vcpus_max" cty:"vcpus_max" hcl:"vcpus_max"`
+ VCPUsAtStartup *uint `mapstructure:"vcpus_atstartup" cty:"vcpus_atstartup" hcl:"vcpus_atstartup"`
+ VMMemory *uint `mapstructure:"vm_memory" cty:"vm_memory" hcl:"vm_memory"`
+ DiskSize *uint `mapstructure:"disk_size" cty:"disk_size" hcl:"disk_size"`
+ CloneTemplate *string `mapstructure:"clone_template" cty:"clone_template" hcl:"clone_template"`
+ VMOtherConfig map[string]string `mapstructure:"vm_other_config" cty:"vm_other_config" hcl:"vm_other_config"`
+ ISOChecksum *string `mapstructure:"iso_checksum" cty:"iso_checksum" hcl:"iso_checksum"`
+ ISOChecksumType *string `mapstructure:"iso_checksum_type" cty:"iso_checksum_type" hcl:"iso_checksum_type"`
+ ISOUrls []string `mapstructure:"iso_urls" cty:"iso_urls" hcl:"iso_urls"`
+ ISOUrl *string `mapstructure:"iso_url" cty:"iso_url" hcl:"iso_url"`
+ ISOName *string `mapstructure:"iso_name" cty:"iso_name" hcl:"iso_name"`
+ PlatformArgs map[string]string `mapstructure:"platform_args" cty:"platform_args" hcl:"platform_args"`
+ RawInstallTimeout *string `mapstructure:"install_timeout" cty:"install_timeout" hcl:"install_timeout"`
+ SourcePath *string `mapstructure:"source_path" cty:"source_path" hcl:"source_path"`
+ Firmware *string `mapstructure:"firmware" cty:"firmware" hcl:"firmware"`
+}
+
+// FlatMapstructure returns a new FlatConfig.
+// FlatConfig is an auto-generated flat version of Config.
+// Where the contents a fields with a `mapstructure:,squash` tag are bubbled up.
+func (*Config) FlatMapstructure() interface{ HCL2Spec() map[string]hcldec.Spec } {
+ return new(FlatConfig)
+}
+
+// HCL2Spec returns the hcl spec of a Config.
+// This spec is used by HCL to read the fields of Config.
+// The decoded values from this spec will then be applied to a FlatConfig.
+func (*FlatConfig) HCL2Spec() map[string]hcldec.Spec {
+ s := map[string]hcldec.Spec{
+ "packer_build_name": &hcldec.AttrSpec{Name: "packer_build_name", Type: cty.String, Required: false},
+ "packer_builder_type": &hcldec.AttrSpec{Name: "packer_builder_type", Type: cty.String, Required: false},
+ "packer_debug": &hcldec.AttrSpec{Name: "packer_debug", Type: cty.Bool, Required: false},
+ "packer_force": &hcldec.AttrSpec{Name: "packer_force", Type: cty.Bool, Required: false},
+ "packer_on_error": &hcldec.AttrSpec{Name: "packer_on_error", Type: cty.String, Required: false},
+ "packer_user_variables": &hcldec.AttrSpec{Name: "packer_user_variables", Type: cty.Map(cty.String), Required: false},
+ "packer_sensitive_variables": &hcldec.AttrSpec{Name: "packer_sensitive_variables", Type: cty.List(cty.String), Required: false},
+ "remote_username": &hcldec.AttrSpec{Name: "remote_username", Type: cty.String, Required: false},
+ "remote_password": &hcldec.AttrSpec{Name: "remote_password", Type: cty.String, Required: false},
+ "remote_host": &hcldec.AttrSpec{Name: "remote_host", Type: cty.String, Required: false},
+ "vm_name": &hcldec.AttrSpec{Name: "vm_name", Type: cty.String, Required: false},
+ "vm_description": &hcldec.AttrSpec{Name: "vm_description", Type: cty.String, Required: false},
+ "sr_name": &hcldec.AttrSpec{Name: "sr_name", Type: cty.String, Required: false},
+ "sr_iso_name": &hcldec.AttrSpec{Name: "sr_iso_name", Type: cty.String, Required: false},
+ "floppy_files": &hcldec.AttrSpec{Name: "floppy_files", Type: cty.List(cty.String), Required: false},
+ "network_names": &hcldec.AttrSpec{Name: "network_names", Type: cty.List(cty.String), Required: false},
+ "export_network_names": &hcldec.AttrSpec{Name: "export_network_names", Type: cty.List(cty.String), Required: false},
+ "host_port_min": &hcldec.AttrSpec{Name: "host_port_min", Type: cty.Number, Required: false},
+ "host_port_max": &hcldec.AttrSpec{Name: "host_port_max", Type: cty.Number, Required: false},
+ "boot_command": &hcldec.AttrSpec{Name: "boot_command", Type: cty.List(cty.String), Required: false},
+ "shutdown_command": &hcldec.AttrSpec{Name: "shutdown_command", Type: cty.String, Required: false},
+ "boot_wait": &hcldec.AttrSpec{Name: "boot_wait", Type: cty.String, Required: false},
+ "tools_iso_name": &hcldec.AttrSpec{Name: "tools_iso_name", Type: cty.String, Required: false},
+ "http_directory": &hcldec.AttrSpec{Name: "http_directory", Type: cty.String, Required: false},
+ "http_port_min": &hcldec.AttrSpec{Name: "http_port_min", Type: cty.Number, Required: false},
+ "http_port_max": &hcldec.AttrSpec{Name: "http_port_max", Type: cty.Number, Required: false},
+ "ssh_key_path": &hcldec.AttrSpec{Name: "ssh_key_path", Type: cty.String, Required: false},
+ "ssh_password": &hcldec.AttrSpec{Name: "ssh_password", Type: cty.String, Required: false},
+ "ssh_port": &hcldec.AttrSpec{Name: "ssh_port", Type: cty.Number, Required: false},
+ "ssh_username": &hcldec.AttrSpec{Name: "ssh_username", Type: cty.String, Required: false},
+ "communicator": &hcldec.AttrSpec{Name: "communicator", Type: cty.String, Required: false},
+ "pause_before_connecting": &hcldec.AttrSpec{Name: "pause_before_connecting", Type: cty.String, Required: false},
+ "ssh_host": &hcldec.AttrSpec{Name: "ssh_host", Type: cty.String, Required: false},
+ "ssh_keypair_name": &hcldec.AttrSpec{Name: "ssh_keypair_name", Type: cty.String, Required: false},
+ "temporary_key_pair_name": &hcldec.AttrSpec{Name: "temporary_key_pair_name", Type: cty.String, Required: false},
+ "temporary_key_pair_type": &hcldec.AttrSpec{Name: "temporary_key_pair_type", Type: cty.String, Required: false},
+ "temporary_key_pair_bits": &hcldec.AttrSpec{Name: "temporary_key_pair_bits", Type: cty.Number, Required: false},
+ "ssh_ciphers": &hcldec.AttrSpec{Name: "ssh_ciphers", Type: cty.List(cty.String), Required: false},
+ "ssh_clear_authorized_keys": &hcldec.AttrSpec{Name: "ssh_clear_authorized_keys", Type: cty.Bool, Required: false},
+ "ssh_key_exchange_algorithms": &hcldec.AttrSpec{Name: "ssh_key_exchange_algorithms", Type: cty.List(cty.String), Required: false},
+ "ssh_private_key_file": &hcldec.AttrSpec{Name: "ssh_private_key_file", Type: cty.String, Required: false},
+ "ssh_certificate_file": &hcldec.AttrSpec{Name: "ssh_certificate_file", Type: cty.String, Required: false},
+ "ssh_pty": &hcldec.AttrSpec{Name: "ssh_pty", Type: cty.Bool, Required: false},
+ "ssh_timeout": &hcldec.AttrSpec{Name: "ssh_timeout", Type: cty.String, Required: false},
+ "ssh_wait_timeout": &hcldec.AttrSpec{Name: "ssh_wait_timeout", Type: cty.String, Required: false},
+ "ssh_agent_auth": &hcldec.AttrSpec{Name: "ssh_agent_auth", Type: cty.Bool, Required: false},
+ "ssh_disable_agent_forwarding": &hcldec.AttrSpec{Name: "ssh_disable_agent_forwarding", Type: cty.Bool, Required: false},
+ "ssh_handshake_attempts": &hcldec.AttrSpec{Name: "ssh_handshake_attempts", Type: cty.Number, Required: false},
+ "ssh_bastion_host": &hcldec.AttrSpec{Name: "ssh_bastion_host", Type: cty.String, Required: false},
+ "ssh_bastion_port": &hcldec.AttrSpec{Name: "ssh_bastion_port", Type: cty.Number, Required: false},
+ "ssh_bastion_agent_auth": &hcldec.AttrSpec{Name: "ssh_bastion_agent_auth", Type: cty.Bool, Required: false},
+ "ssh_bastion_username": &hcldec.AttrSpec{Name: "ssh_bastion_username", Type: cty.String, Required: false},
+ "ssh_bastion_password": &hcldec.AttrSpec{Name: "ssh_bastion_password", Type: cty.String, Required: false},
+ "ssh_bastion_interactive": &hcldec.AttrSpec{Name: "ssh_bastion_interactive", Type: cty.Bool, Required: false},
+ "ssh_bastion_private_key_file": &hcldec.AttrSpec{Name: "ssh_bastion_private_key_file", Type: cty.String, Required: false},
+ "ssh_bastion_certificate_file": &hcldec.AttrSpec{Name: "ssh_bastion_certificate_file", Type: cty.String, Required: false},
+ "ssh_file_transfer_method": &hcldec.AttrSpec{Name: "ssh_file_transfer_method", Type: cty.String, Required: false},
+ "ssh_proxy_host": &hcldec.AttrSpec{Name: "ssh_proxy_host", Type: cty.String, Required: false},
+ "ssh_proxy_port": &hcldec.AttrSpec{Name: "ssh_proxy_port", Type: cty.Number, Required: false},
+ "ssh_proxy_username": &hcldec.AttrSpec{Name: "ssh_proxy_username", Type: cty.String, Required: false},
+ "ssh_proxy_password": &hcldec.AttrSpec{Name: "ssh_proxy_password", Type: cty.String, Required: false},
+ "ssh_keep_alive_interval": &hcldec.AttrSpec{Name: "ssh_keep_alive_interval", Type: cty.String, Required: false},
+ "ssh_read_write_timeout": &hcldec.AttrSpec{Name: "ssh_read_write_timeout", Type: cty.String, Required: false},
+ "ssh_remote_tunnels": &hcldec.AttrSpec{Name: "ssh_remote_tunnels", Type: cty.List(cty.String), Required: false},
+ "ssh_local_tunnels": &hcldec.AttrSpec{Name: "ssh_local_tunnels", Type: cty.List(cty.String), Required: false},
+ "ssh_public_key": &hcldec.AttrSpec{Name: "ssh_public_key", Type: cty.List(cty.Number), Required: false},
+ "ssh_private_key": &hcldec.AttrSpec{Name: "ssh_private_key", Type: cty.List(cty.Number), Required: false},
+ "winrm_username": &hcldec.AttrSpec{Name: "winrm_username", Type: cty.String, Required: false},
+ "winrm_password": &hcldec.AttrSpec{Name: "winrm_password", Type: cty.String, Required: false},
+ "winrm_host": &hcldec.AttrSpec{Name: "winrm_host", Type: cty.String, Required: false},
+ "winrm_no_proxy": &hcldec.AttrSpec{Name: "winrm_no_proxy", Type: cty.Bool, Required: false},
+ "winrm_port": &hcldec.AttrSpec{Name: "winrm_port", Type: cty.Number, Required: false},
+ "winrm_timeout": &hcldec.AttrSpec{Name: "winrm_timeout", Type: cty.String, Required: false},
+ "winrm_use_ssl": &hcldec.AttrSpec{Name: "winrm_use_ssl", Type: cty.Bool, Required: false},
+ "winrm_insecure": &hcldec.AttrSpec{Name: "winrm_insecure", Type: cty.Bool, Required: false},
+ "winrm_use_ntlm": &hcldec.AttrSpec{Name: "winrm_use_ntlm", Type: cty.Bool, Required: false},
+ "ssh_host_port_min": &hcldec.AttrSpec{Name: "ssh_host_port_min", Type: cty.Number, Required: false},
+ "ssh_host_port_max": &hcldec.AttrSpec{Name: "ssh_host_port_max", Type: cty.Number, Required: false},
+ "ssh_skip_nat_mapping": &hcldec.AttrSpec{Name: "ssh_skip_nat_mapping", Type: cty.Bool, Required: false},
+ "output_directory": &hcldec.AttrSpec{Name: "output_directory", Type: cty.String, Required: false},
+ "format": &hcldec.AttrSpec{Name: "format", Type: cty.String, Required: false},
+ "keep_vm": &hcldec.AttrSpec{Name: "keep_vm", Type: cty.String, Required: false},
+ "ip_getter": &hcldec.AttrSpec{Name: "ip_getter", Type: cty.String, Required: false},
+ "vcpus_max": &hcldec.AttrSpec{Name: "vcpus_max", Type: cty.Number, Required: false},
+ "vcpus_atstartup": &hcldec.AttrSpec{Name: "vcpus_atstartup", Type: cty.Number, Required: false},
+ "vm_memory": &hcldec.AttrSpec{Name: "vm_memory", Type: cty.Number, Required: false},
+ "disk_size": &hcldec.AttrSpec{Name: "disk_size", Type: cty.Number, Required: false},
+ "clone_template": &hcldec.AttrSpec{Name: "clone_template", Type: cty.String, Required: false},
+ "vm_other_config": &hcldec.AttrSpec{Name: "vm_other_config", Type: cty.Map(cty.String), Required: false},
+ "iso_checksum": &hcldec.AttrSpec{Name: "iso_checksum", Type: cty.String, Required: false},
+ "iso_checksum_type": &hcldec.AttrSpec{Name: "iso_checksum_type", Type: cty.String, Required: false},
+ "iso_urls": &hcldec.AttrSpec{Name: "iso_urls", Type: cty.List(cty.String), Required: false},
+ "iso_url": &hcldec.AttrSpec{Name: "iso_url", Type: cty.String, Required: false},
+ "iso_name": &hcldec.AttrSpec{Name: "iso_name", Type: cty.String, Required: false},
+ "platform_args": &hcldec.AttrSpec{Name: "platform_args", Type: cty.Map(cty.String), Required: false},
+ "install_timeout": &hcldec.AttrSpec{Name: "install_timeout", Type: cty.String, Required: false},
+ "source_path": &hcldec.AttrSpec{Name: "source_path", Type: cty.String, Required: false},
+ "firmware": &hcldec.AttrSpec{Name: "firmware", Type: cty.String, Required: false},
+ }
+ return s
+}
diff --git a/builder/xenserver/common/http_upload.go b/builder/xenserver/common/http_upload.go
index 347497b1..156ae7c5 100644
--- a/builder/xenserver/common/http_upload.go
+++ b/builder/xenserver/common/http_upload.go
@@ -3,14 +3,15 @@ package common
import (
"crypto/tls"
"fmt"
- "github.com/mitchellh/multistep"
- "github.com/mitchellh/packer/packer"
- xsclient "github.com/xenserver/go-xenserver-client"
"log"
"net/http"
"net/url"
"os"
"time"
+
+ "github.com/hashicorp/packer-plugin-sdk/multistep"
+ "github.com/hashicorp/packer-plugin-sdk/packer"
+ xsclient "github.com/terra-farm/go-xen-api-client"
)
func appendQuery(urlstring, k, v string) (string, error) {
@@ -24,18 +25,18 @@ func appendQuery(urlstring, k, v string) (string, error) {
return u.String(), err
}
-func HTTPUpload(import_url string, fh *os.File, state multistep.StateBag) (result *xsclient.XenAPIObject, err error) {
+func HTTPUpload(import_url string, fh *os.File, state multistep.StateBag) (result string, err error) {
ui := state.Get("ui").(packer.Ui)
- client := state.Get("client").(xsclient.XenAPIClient)
+ c := state.Get("client").(*Connection)
- task, err := client.CreateTask()
+ task, err := c.client.Task.Create(c.session, "packer-task", "Packer task")
if err != nil {
err = fmt.Errorf("Unable to create task: %s", err.Error())
return
}
- defer task.Destroy()
+ defer c.client.Task.Destroy(c.session, task)
- import_task_url, err := appendQuery(import_url, "task_id", task.Ref)
+ import_task_url, err := appendQuery(import_url, "task_id", string(task))
if err != nil {
return
}
@@ -75,13 +76,13 @@ func HTTPUpload(import_url string, fh *os.File, state multistep.StateBag) (resul
logIteration := 0
err = InterruptibleWait{
Predicate: func() (bool, error) {
- status, err := task.GetStatus()
+ status, err := c.client.Task.GetStatus(c.session, task)
if err != nil {
return false, fmt.Errorf("Failed to get task status: %s", err.Error())
}
switch status {
- case xsclient.Pending:
- progress, err := task.GetProgress()
+ case xsclient.TaskStatusTypePending:
+ progress, err := c.client.Task.GetProgress(c.session, task)
if err != nil {
return false, fmt.Errorf("Failed to get progress: %s", err.Error())
}
@@ -90,15 +91,15 @@ func HTTPUpload(import_url string, fh *os.File, state multistep.StateBag) (resul
log.Printf("Upload %.0f%% complete", progress*100)
}
return false, nil
- case xsclient.Success:
+ case xsclient.TaskStatusTypeSuccess:
return true, nil
- case xsclient.Failure:
- errorInfo, err := task.GetErrorInfo()
+ case xsclient.TaskStatusTypeFailure:
+ errorInfo, err := c.client.Task.GetErrorInfo(c.session, task)
if err != nil {
errorInfo = []string{fmt.Sprintf("furthermore, failed to get error info: %s", err.Error())}
}
return false, fmt.Errorf("Task failed: %s", errorInfo)
- case xsclient.Cancelling, xsclient.Cancelled:
+ case xsclient.TaskStatusTypeCancelling, xsclient.TaskStatusTypeCancelled:
return false, fmt.Errorf("Task cancelled")
default:
return false, fmt.Errorf("Unknown task status %v", status)
@@ -115,7 +116,7 @@ func HTTPUpload(import_url string, fh *os.File, state multistep.StateBag) (resul
return
}
- result, err = task.GetResult()
+ result, err = c.client.Task.GetResult(c.session, task)
if err != nil {
err = fmt.Errorf("Error getting result: %s", err.Error())
return
diff --git a/builder/xenserver/common/interruptible_wait.go b/builder/xenserver/common/interruptible_wait.go
index 3fc4103a..5658802e 100644
--- a/builder/xenserver/common/interruptible_wait.go
+++ b/builder/xenserver/common/interruptible_wait.go
@@ -1,7 +1,7 @@
package common
import (
- "github.com/mitchellh/multistep"
+ "github.com/hashicorp/packer-plugin-sdk/multistep"
"time"
)
diff --git a/builder/xenserver/common/ssh.go b/builder/xenserver/common/ssh.go
index f4a99c42..1f3d1364 100644
--- a/builder/xenserver/common/ssh.go
+++ b/builder/xenserver/common/ssh.go
@@ -2,15 +2,17 @@ package common
import (
"bytes"
+ "encoding/pem"
"fmt"
- "github.com/mitchellh/multistep"
- commonssh "github.com/mitchellh/packer/common/ssh"
- "github.com/mitchellh/packer/communicator/ssh"
- gossh "golang.org/x/crypto/ssh"
"io"
+ "io/ioutil"
"log"
"net"
+ "os"
"strings"
+
+ "github.com/hashicorp/packer-plugin-sdk/multistep"
+ gossh "golang.org/x/crypto/ssh"
)
func SSHAddress(state multistep.StateBag) (string, error) {
@@ -42,12 +44,10 @@ func SSHConfigFunc(config SSHConfig) func(multistep.StateBag) (*gossh.ClientConf
config := state.Get("commonconfig").(CommonConfig)
auth := []gossh.AuthMethod{
gossh.Password(config.SSHPassword),
- gossh.KeyboardInteractive(
- ssh.PasswordKeyboardInteractive(config.SSHPassword)),
}
if config.SSHKeyPath != "" {
- signer, err := commonssh.FileSigner(config.SSHKeyPath)
+ signer, err := FileSigner(config.SSHKeyPath)
if err != nil {
return nil, err
}
@@ -56,8 +56,9 @@ func SSHConfigFunc(config SSHConfig) func(multistep.StateBag) (*gossh.ClientConf
}
return &gossh.ClientConfig{
- User: config.SSHUser,
- Auth: auth,
+ User: config.SSHUser,
+ Auth: auth,
+ HostKeyCallback: gossh.InsecureIgnoreHostKey(),
}, nil
}
}
@@ -94,6 +95,7 @@ func ExecuteHostSSHCmd(state multistep.StateBag, cmd string) (stdout string, err
Auth: []gossh.AuthMethod{
gossh.Password(config.Password),
},
+ HostKeyCallback: gossh.InsecureIgnoreHostKey(),
}
return doExecuteSSHCmd(cmd, sshAddress, sshConfig)
}
@@ -155,13 +157,14 @@ func forward(local_conn net.Conn, config *gossh.ClientConfig, server, remote_des
return nil
}
-func ssh_port_forward(local_listener net.Listener, remote_port uint, remote_dest, host, username, password string) error {
+func ssh_port_forward(local_listener net.Listener, remote_port int, remote_dest, host, username, password string) error {
config := &gossh.ClientConfig{
User: username,
Auth: []gossh.AuthMethod{
gossh.Password(password),
},
+ HostKeyCallback: gossh.InsecureIgnoreHostKey(),
}
for {
@@ -173,8 +176,42 @@ func ssh_port_forward(local_listener net.Listener, remote_port uint, remote_dest
}
// Forward to a remote port
- go forward(local_connection, config, host, remote_dest, remote_port)
+ go forward(local_connection, config, host, remote_dest, uint(remote_port))
}
return nil
}
+
+// FileSigner returns an gossh.Signer for a key file.
+func FileSigner(path string) (gossh.Signer, error) {
+ f, err := os.Open(path)
+ if err != nil {
+ return nil, err
+ }
+ defer f.Close()
+
+ keyBytes, err := ioutil.ReadAll(f)
+ if err != nil {
+ return nil, err
+ }
+
+ // We parse the private key on our own first so that we can
+ // show a nicer error if the private key has a password.
+ block, _ := pem.Decode(keyBytes)
+ if block == nil {
+ return nil, fmt.Errorf(
+ "Failed to read key '%s': no key found", path)
+ }
+ if block.Headers["Proc-Type"] == "4,ENCRYPTED" {
+ return nil, fmt.Errorf(
+ "Failed to read key '%s': password protected keys are\n"+
+ "not supported. Please decrypt the key prior to use.", path)
+ }
+
+ signer, err := gossh.ParsePrivateKey(keyBytes)
+ if err != nil {
+ return nil, fmt.Errorf("Error setting up SSH config: %s", err)
+ }
+
+ return signer, nil
+}
diff --git a/builder/xenserver/common/ssh_config.go b/builder/xenserver/common/ssh_config.go
index 8997c58f..3b0fbd78 100644
--- a/builder/xenserver/common/ssh_config.go
+++ b/builder/xenserver/common/ssh_config.go
@@ -4,8 +4,8 @@ import (
"errors"
"time"
- "github.com/mitchellh/packer/helper/communicator"
- "github.com/mitchellh/packer/template/interpolate"
+ "github.com/hashicorp/packer-plugin-sdk/communicator"
+ "github.com/hashicorp/packer-plugin-sdk/template/interpolate"
)
type SSHConfig struct {
@@ -32,7 +32,7 @@ func (c *SSHConfig) Prepare(ctx *interpolate.Context) []error {
// TODO: backwards compatibility, write fixer instead
if c.SSHKeyPath != "" {
- c.Comm.SSHPrivateKey = c.SSHKeyPath
+ c.Comm.SSHPrivateKeyFile = c.SSHKeyPath
}
if c.SSHWaitTimeout != 0 {
c.Comm.SSHTimeout = c.SSHWaitTimeout
diff --git a/builder/xenserver/common/step_attach_vdi.go b/builder/xenserver/common/step_attach_vdi.go
index 059dc499..0f42bd89 100644
--- a/builder/xenserver/common/step_attach_vdi.go
+++ b/builder/xenserver/common/step_attach_vdi.go
@@ -1,24 +1,27 @@
package common
import (
+ "context"
"fmt"
- "github.com/mitchellh/multistep"
- "github.com/mitchellh/packer/packer"
- xsclient "github.com/xenserver/go-xenserver-client"
"log"
+
+ "github.com/hashicorp/packer-plugin-sdk/multistep"
+ "github.com/hashicorp/packer-plugin-sdk/packer"
+ xsclient "github.com/terra-farm/go-xen-api-client"
)
type StepAttachVdi struct {
VdiUuidKey string
- VdiType xsclient.VDIType
+ VdiType xsclient.VbdType
- vdi *xsclient.VDI
+ vdi xsclient.VDIRef
}
-func (self *StepAttachVdi) Run(state multistep.StateBag) multistep.StepAction {
+func (self *StepAttachVdi) Run(ctx context.Context, state multistep.StateBag) multistep.StepAction {
ui := state.Get("ui").(packer.Ui)
- client := state.Get("client").(xsclient.XenAPIClient)
+ c := state.Get("client").(*Connection)
+ log.Printf("Running attach vdi for key %s\n", self.VdiUuidKey)
var vdiUuid string
if vdiUuidRaw, ok := state.GetOk(self.VdiUuidKey); ok {
vdiUuid = vdiUuidRaw.(string)
@@ -28,20 +31,20 @@ func (self *StepAttachVdi) Run(state multistep.StateBag) multistep.StepAction {
}
var err error
- self.vdi, err = client.GetVdiByUuid(vdiUuid)
+ self.vdi, err = c.client.VDI.GetByUUID(c.session, vdiUuid)
if err != nil {
ui.Error(fmt.Sprintf("Unable to get VDI from UUID '%s': %s", vdiUuid, err.Error()))
return multistep.ActionHalt
}
uuid := state.Get("instance_uuid").(string)
- instance, err := client.GetVMByUuid(uuid)
+ instance, err := c.client.VM.GetByUUID(c.session, uuid)
if err != nil {
ui.Error(fmt.Sprintf("Unable to get VM from UUID '%s': %s", uuid, err.Error()))
return multistep.ActionHalt
}
- err = instance.ConnectVdi(self.vdi, self.VdiType, "")
+ err = ConnectVdi(c, instance, self.vdi, self.VdiType)
if err != nil {
ui.Error(fmt.Sprintf("Error attaching VDI '%s': '%s'", vdiUuid, err.Error()))
return multistep.ActionHalt
@@ -54,17 +57,17 @@ func (self *StepAttachVdi) Run(state multistep.StateBag) multistep.StepAction {
func (self *StepAttachVdi) Cleanup(state multistep.StateBag) {
config := state.Get("commonconfig").(CommonConfig)
- client := state.Get("client").(xsclient.XenAPIClient)
+ c := state.Get("client").(*Connection)
if config.ShouldKeepVM(state) {
return
}
- if self.vdi == nil {
+ if self.vdi == "" {
return
}
uuid := state.Get("instance_uuid").(string)
- instance, err := client.GetVMByUuid(uuid)
+ vmRef, err := c.client.VM.GetByUUID(c.session, uuid)
if err != nil {
log.Printf("Unable to get VM from UUID '%s': %s", uuid, err.Error())
return
@@ -72,7 +75,7 @@ func (self *StepAttachVdi) Cleanup(state multistep.StateBag) {
vdiUuid := state.Get(self.VdiUuidKey).(string)
- err = instance.DisconnectVdi(self.vdi)
+ err = DisconnectVdi(c, vmRef, self.vdi)
if err != nil {
log.Printf("Unable to disconnect VDI '%s': %s", vdiUuid, err.Error())
return
diff --git a/builder/xenserver/common/step_boot_wait.go b/builder/xenserver/common/step_boot_wait.go
index 8155de4b..c084f2eb 100644
--- a/builder/xenserver/common/step_boot_wait.go
+++ b/builder/xenserver/common/step_boot_wait.go
@@ -1,22 +1,23 @@
package common
import (
+ "context"
"fmt"
- "github.com/mitchellh/multistep"
- "github.com/mitchellh/packer/packer"
- xsclient "github.com/xenserver/go-xenserver-client"
+
+ "github.com/hashicorp/packer-plugin-sdk/multistep"
+ "github.com/hashicorp/packer-plugin-sdk/packer"
)
type StepBootWait struct{}
-func (self *StepBootWait) Run(state multistep.StateBag) multistep.StepAction {
- client := state.Get("client").(xsclient.XenAPIClient)
+func (self *StepBootWait) Run(ctx context.Context, state multistep.StateBag) multistep.StepAction {
+ c := state.Get("client").(*Connection)
config := state.Get("commonconfig").(CommonConfig)
ui := state.Get("ui").(packer.Ui)
- instance, _ := client.GetVMByUuid(state.Get("instance_uuid").(string))
+ instance, _ := c.client.VM.GetByUUID(c.session, state.Get("instance_uuid").(string))
ui.Say("Unpausing VM " + state.Get("instance_uuid").(string))
- instance.Unpause()
+ Unpause(c, instance)
if int64(config.BootWait) > 0 {
ui.Say(fmt.Sprintf("Waiting %s for boot...", config.BootWait))
diff --git a/builder/xenserver/common/step_detach_vdi.go b/builder/xenserver/common/step_detach_vdi.go
index 96147e3b..8348eebe 100644
--- a/builder/xenserver/common/step_detach_vdi.go
+++ b/builder/xenserver/common/step_detach_vdi.go
@@ -1,20 +1,21 @@
package common
import (
+ "context"
"fmt"
- "github.com/mitchellh/multistep"
- "github.com/mitchellh/packer/packer"
- xsclient "github.com/xenserver/go-xenserver-client"
"log"
+
+ "github.com/hashicorp/packer-plugin-sdk/multistep"
+ "github.com/hashicorp/packer-plugin-sdk/packer"
)
type StepDetachVdi struct {
VdiUuidKey string
}
-func (self *StepDetachVdi) Run(state multistep.StateBag) multistep.StepAction {
+func (self *StepDetachVdi) Run(ctx context.Context, state multistep.StateBag) multistep.StepAction {
ui := state.Get("ui").(packer.Ui)
- client := state.Get("client").(xsclient.XenAPIClient)
+ c := state.Get("client").(*Connection)
var vdiUuid string
if vdiUuidRaw, ok := state.GetOk(self.VdiUuidKey); ok {
@@ -24,20 +25,20 @@ func (self *StepDetachVdi) Run(state multistep.StateBag) multistep.StepAction {
return multistep.ActionContinue
}
- vdi, err := client.GetVdiByUuid(vdiUuid)
+ vdi, err := c.client.VDI.GetByUUID(c.session, vdiUuid)
if err != nil {
ui.Error(fmt.Sprintf("Unable to get VDI from UUID '%s': %s", vdiUuid, err.Error()))
return multistep.ActionHalt
}
uuid := state.Get("instance_uuid").(string)
- instance, err := client.GetVMByUuid(uuid)
+ instance, err := c.client.VM.GetByUUID(c.session, uuid)
if err != nil {
ui.Error(fmt.Sprintf("Unable to get VM from UUID '%s': %s", uuid, err.Error()))
return multistep.ActionHalt
}
- err = instance.DisconnectVdi(vdi)
+ err = DisconnectVdi(c, instance, vdi)
if err != nil {
ui.Error(fmt.Sprintf("Unable to detach VDI '%s': %s", vdiUuid, err.Error()))
//return multistep.ActionHalt
diff --git a/builder/xenserver/common/step_export.go b/builder/xenserver/common/step_export.go
index d0083e04..3bec5692 100644
--- a/builder/xenserver/common/step_export.go
+++ b/builder/xenserver/common/step_export.go
@@ -1,15 +1,16 @@
package common
import (
+ "context"
"crypto/tls"
"fmt"
- "github.com/mitchellh/multistep"
- "github.com/mitchellh/packer/packer"
- xsclient "github.com/xenserver/go-xenserver-client"
"io"
"net/http"
"os"
"os/exec"
+
+ "github.com/hashicorp/packer-plugin-sdk/multistep"
+ "github.com/hashicorp/packer-plugin-sdk/packer"
)
type StepExport struct{}
@@ -79,36 +80,36 @@ func downloadFile(url, filename string, ui packer.Ui) (err error) {
return nil
}
-func (StepExport) Run(state multistep.StateBag) multistep.StepAction {
+func (StepExport) Run(ctx context.Context, state multistep.StateBag) multistep.StepAction {
config := state.Get("commonconfig").(CommonConfig)
ui := state.Get("ui").(packer.Ui)
- client := state.Get("client").(xsclient.XenAPIClient)
+ c := state.Get("client").(*Connection)
instance_uuid := state.Get("instance_uuid").(string)
suffix := ".vhd"
extrauri := "&format=vhd"
- instance, err := client.GetVMByUuid(instance_uuid)
+ instance, err := c.client.VM.GetByUUID(c.session, instance_uuid)
if err != nil {
ui.Error(fmt.Sprintf("Could not get VM with UUID '%s': %s", instance_uuid, err.Error()))
return multistep.ActionHalt
}
if len(config.ExportNetworkNames) > 0 {
- vifs, err := instance.GetVIFs()
+ vifs, err := c.client.VM.GetVIFs(c.session, instance)
if err != nil {
ui.Error(fmt.Sprintf("Error occured getting VIFs: %s", err.Error()))
return multistep.ActionHalt
}
for _, vif := range vifs {
- err := vif.Destroy()
+ err := c.client.VIF.Destroy(c.session, vif)
if err != nil {
- ui.Error(fmt.Sprintf("Destroy vif fail: '%s': %s", vif.Ref, err.Error()))
+ ui.Error(fmt.Sprintf("Destroy vif fail: '%s': %s", vif, err.Error()))
return multistep.ActionHalt
}
}
for i, networkNameLabel := range config.ExportNetworkNames {
- networks, err := client.GetNetworkByNameLabel(networkNameLabel)
+ networks, err := c.client.Network.GetByNameLabel(c.session, networkNameLabel)
if err != nil {
ui.Error(fmt.Sprintf("Error occured getting Network by name-label: %s", err.Error()))
@@ -126,7 +127,7 @@ func (StepExport) Run(state multistep.StateBag) multistep.StepAction {
//we need the VIF index string
vifIndexString := fmt.Sprintf("%d", i)
- _, err = instance.ConnectNetwork(networks[0], vifIndexString)
+ _, err = ConnectNetwork(c, networks[0], instance, vifIndexString)
if err != nil {
ui.Say(err.Error())
@@ -157,10 +158,10 @@ func (StepExport) Run(state multistep.StateBag) multistep.StepAction {
if xe, e := exec.LookPath("xe"); e == nil && use_xe {
cmd := exec.Command(
xe,
- "-s", client.Host,
+ "-s", c.Host,
"-p", "443",
- "-u", client.Username,
- "-pw", client.Password,
+ "-u", c.Username,
+ "-pw", c.Password,
"vm-export",
"vm="+instance_uuid,
compress_option_xe,
@@ -172,10 +173,10 @@ func (StepExport) Run(state multistep.StateBag) multistep.StepAction {
err = cmd.Run()
} else {
export_url := fmt.Sprintf("https://%s/export?%suuid=%s&session_id=%s",
- client.Host,
+ c.Host,
compress_option_url,
instance_uuid,
- client.Session.(string),
+ c.GetSession(),
)
ui.Say("Getting XVA " + export_url)
@@ -194,28 +195,28 @@ func (StepExport) Run(state multistep.StateBag) multistep.StepAction {
case "vdi_vhd":
// export the disks
- disks, err := instance.GetDisks()
+ disks, err := GetDisks(c, instance)
if err != nil {
ui.Error(fmt.Sprintf("Could not get VM disks: %s", err.Error()))
return multistep.ActionHalt
}
for _, disk := range disks {
- disk_uuid, err := disk.GetUuid()
+ disk_uuid, err := c.client.VDI.GetUUID(c.session, disk)
if err != nil {
ui.Error(fmt.Sprintf("Could not get disk with UUID '%s': %s", disk_uuid, err.Error()))
return multistep.ActionHalt
}
// Work out XenServer version
- hosts, err := client.GetHosts()
+ hosts, err := c.client.Host.GetAll(c.session)
if err != nil {
ui.Error(fmt.Sprintf("Could not retrieve hosts in the pool: %s", err.Error()))
return multistep.ActionHalt
}
host := hosts[0]
- host_software_versions, err := host.GetSoftwareVersion()
- xs_version := host_software_versions["product_version"].(string)
+ host_software_versions, err := c.client.Host.GetSoftwareVersion(c.session, host)
+ xs_version := host_software_versions["product_version"]
if err != nil {
ui.Error(fmt.Sprintf("Could not get the software version: %s", err.Error()))
@@ -228,7 +229,7 @@ func (StepExport) Run(state multistep.StateBag) multistep.StepAction {
if xs_version <= "6.5.0" && config.Format == "vdi_vhd" {
// Export the VHD using a Transfer VM
- disk_export_url, err = disk.Expose("vhd")
+ disk_export_url, err = Expose(c, disk, "vhd")
if err != nil {
ui.Error(fmt.Sprintf("Failed to expose disk %s: %s", disk_uuid, err.Error()))
@@ -242,9 +243,9 @@ func (StepExport) Run(state multistep.StateBag) multistep.StepAction {
// accepted for some reason.
// @todo: raise with XAPI team.
disk_export_url = fmt.Sprintf("https://%s:%s@%s/export_raw_vdi?vdi=%s%s",
- client.Username,
- client.Password,
- client.Host,
+ c.Username,
+ c.Password,
+ c.Host,
disk_uuid,
extrauri)
@@ -261,7 +262,7 @@ func (StepExport) Run(state multistep.StateBag) multistep.StepAction {
// Call unexpose in case a TVM was used. The call is harmless
// if that is not the case.
- disk.Unexpose()
+ Unexpose(c, disk)
}
diff --git a/builder/xenserver/common/step_find_vdi.go b/builder/xenserver/common/step_find_vdi.go
index 34912317..9638ecbc 100644
--- a/builder/xenserver/common/step_find_vdi.go
+++ b/builder/xenserver/common/step_find_vdi.go
@@ -1,10 +1,11 @@
package common
import (
+ "context"
"fmt"
- "github.com/mitchellh/multistep"
- "github.com/mitchellh/packer/packer"
- xsclient "github.com/xenserver/go-xenserver-client"
+
+ "github.com/hashicorp/packer-plugin-sdk/multistep"
+ "github.com/hashicorp/packer-plugin-sdk/packer"
)
type StepFindVdi struct {
@@ -13,16 +14,16 @@ type StepFindVdi struct {
VdiUuidKey string
}
-func (self *StepFindVdi) Run(state multistep.StateBag) multistep.StepAction {
+func (self *StepFindVdi) Run(ctx context.Context, state multistep.StateBag) multistep.StepAction {
ui := state.Get("ui").(packer.Ui)
- client := state.Get("client").(xsclient.XenAPIClient)
+ c := state.Get("client").(*Connection)
// Ignore if VdiName is not specified
if self.VdiName == "" {
return multistep.ActionContinue
}
- vdis, err := client.GetVdiByNameLabel(self.VdiName)
+ vdis, err := c.client.VDI.GetByNameLabel(c.session, self.VdiName)
switch {
case len(vdis) == 0:
@@ -35,7 +36,7 @@ func (self *StepFindVdi) Run(state multistep.StateBag) multistep.StepAction {
vdi := vdis[0]
- vdiUuid, err := vdi.GetUuid()
+ vdiUuid, err := c.client.VDI.GetUUID(c.session, vdi)
if err != nil {
ui.Error(fmt.Sprintf("Unable to get UUID of VDI '%s': %s", self.VdiName, err.Error()))
return multistep.ActionHalt
diff --git a/builder/xenserver/common/step_forward_port_over_ssh.go b/builder/xenserver/common/step_forward_port_over_ssh.go
index 43bae0a7..cf06e5d8 100644
--- a/builder/xenserver/common/step_forward_port_over_ssh.go
+++ b/builder/xenserver/common/step_forward_port_over_ssh.go
@@ -1,13 +1,15 @@
package common
import (
+ "context"
"fmt"
- "github.com/mitchellh/multistep"
- "github.com/mitchellh/packer/packer"
+
+ "github.com/hashicorp/packer-plugin-sdk/multistep"
+ "github.com/hashicorp/packer-plugin-sdk/packer"
)
type StepForwardPortOverSSH struct {
- RemotePort func(state multistep.StateBag) (uint, error)
+ RemotePort func(state multistep.StateBag) (int, error)
RemoteDest func(state multistep.StateBag) (string, error)
HostPortMin uint
@@ -16,7 +18,7 @@ type StepForwardPortOverSSH struct {
ResultKey string
}
-func (self *StepForwardPortOverSSH) Run(state multistep.StateBag) multistep.StepAction {
+func (self *StepForwardPortOverSSH) Run(ctx context.Context, state multistep.StateBag) multistep.StepAction {
config := state.Get("commonconfig").(CommonConfig)
ui := state.Get("ui").(packer.Ui)
diff --git a/builder/xenserver/common/step_get_vnc_port.go b/builder/xenserver/common/step_get_vnc_port.go
index 88afba2f..b4bac56f 100644
--- a/builder/xenserver/common/step_get_vnc_port.go
+++ b/builder/xenserver/common/step_get_vnc_port.go
@@ -2,9 +2,10 @@ package common
import (
"fmt"
- "github.com/mitchellh/multistep"
- "github.com/mitchellh/packer/packer"
"strconv"
+
+ "github.com/hashicorp/packer-plugin-sdk/multistep"
+ "github.com/hashicorp/packer-plugin-sdk/packer"
)
type StepGetVNCPort struct{}
@@ -14,8 +15,8 @@ func (self *StepGetVNCPort) Run(state multistep.StateBag) multistep.StepAction {
ui.Say("Step: forward the instances VNC port over SSH")
- domid := state.Get("domid").(string)
- cmd := fmt.Sprintf("xenstore-read /local/domain/%s/console/vnc-port", domid)
+ domid := state.Get("domid").(int)
+ cmd := fmt.Sprintf("xenstore-read /local/domain/%d/console/vnc-port", domid)
remote_vncport, err := ExecuteHostSSHCmd(state, cmd)
if err != nil {
diff --git a/builder/xenserver/common/step_http_server.go b/builder/xenserver/common/step_http_server.go
index 069030c3..bedf3172 100644
--- a/builder/xenserver/common/step_http_server.go
+++ b/builder/xenserver/common/step_http_server.go
@@ -1,14 +1,16 @@
package common
-// Taken from mitchellh/packer/builder/qemu/step_http_server.go
+// Taken from hashicorp/packer/builder/qemu/step_http_server.go
import (
+ "context"
"fmt"
- "github.com/mitchellh/multistep"
- "github.com/mitchellh/packer/packer"
"log"
"net"
"net/http"
+
+ "github.com/hashicorp/packer-plugin-sdk/multistep"
+ "github.com/hashicorp/packer-plugin-sdk/packer"
)
// This step creates and runs the HTTP server that is serving files from the
@@ -46,13 +48,15 @@ func (snooper IPSnooper) ServeHTTP(resp http.ResponseWriter, req *http.Request)
snooper.handler.ServeHTTP(resp, req)
}
-func (s *StepHTTPServer) Run(state multistep.StateBag) multistep.StepAction {
+func (s *StepHTTPServer) Run(ctx context.Context, state multistep.StateBag) multistep.StepAction {
config := state.Get("commonconfig").(CommonConfig)
ui := state.Get("ui").(packer.Ui)
var httpPort uint = 0
if config.HTTPDir == "" {
- state.Put("http_port", httpPort)
+ // the packer provision steps assert this type is an int
+ // so this cannot be a uint like the rest of the code
+ state.Put("http_port", int(httpPort))
return multistep.ActionContinue
}
@@ -77,7 +81,9 @@ func (s *StepHTTPServer) Run(state multistep.StateBag) multistep.StepAction {
go server.Serve(s.l)
// Save the address into the state so it can be accessed in the future
- state.Put("http_port", httpPort)
+ // the packer provision steps assert this type is an int
+ // so this cannot be a uint like the rest of the code
+ state.Put("http_port", int(httpPort))
return multistep.ActionContinue
}
diff --git a/builder/xenserver/common/step_prepare_output_dir.go b/builder/xenserver/common/step_prepare_output_dir.go
index 129c300d..44e65655 100644
--- a/builder/xenserver/common/step_prepare_output_dir.go
+++ b/builder/xenserver/common/step_prepare_output_dir.go
@@ -1,13 +1,15 @@
package common
-/* Taken from https://raw.githubusercontent.com/mitchellh/packer/master/builder/qemu/step_prepare_output_dir.go */
+/* Taken from https://raw.githubusercontent.com/hashicorp/packer/master/builder/qemu/step_prepare_output_dir.go */
import (
- "github.com/mitchellh/multistep"
- "github.com/mitchellh/packer/packer"
+ "context"
"log"
"os"
"time"
+
+ "github.com/hashicorp/packer-plugin-sdk/multistep"
+ "github.com/hashicorp/packer-plugin-sdk/packer"
)
type StepPrepareOutputDir struct {
@@ -15,7 +17,7 @@ type StepPrepareOutputDir struct {
Path string
}
-func (self *StepPrepareOutputDir) Run(state multistep.StateBag) multistep.StepAction {
+func (self *StepPrepareOutputDir) Run(ctx context.Context, state multistep.StateBag) multistep.StepAction {
ui := state.Get("ui").(packer.Ui)
if _, err := os.Stat(self.Path); err == nil && self.Force {
diff --git a/builder/xenserver/common/step_set_vm_host_ssh_address.go b/builder/xenserver/common/step_set_vm_host_ssh_address.go
index bf9af387..33f7f5da 100644
--- a/builder/xenserver/common/step_set_vm_host_ssh_address.go
+++ b/builder/xenserver/common/step_set_vm_host_ssh_address.go
@@ -1,34 +1,35 @@
package common
import (
+ "context"
"fmt"
- "github.com/mitchellh/multistep"
- "github.com/mitchellh/packer/packer"
- xsclient "github.com/xenserver/go-xenserver-client"
+
+ "github.com/hashicorp/packer-plugin-sdk/multistep"
+ "github.com/hashicorp/packer-plugin-sdk/packer"
)
type StepSetVmHostSshAddress struct{}
-func (self *StepSetVmHostSshAddress) Run(state multistep.StateBag) multistep.StepAction {
+func (self *StepSetVmHostSshAddress) Run(ctx context.Context, state multistep.StateBag) multistep.StepAction {
- client := state.Get("client").(xsclient.XenAPIClient)
+ c := state.Get("client").(*Connection)
ui := state.Get("ui").(packer.Ui)
ui.Say("Step: Set SSH address to VM host IP")
uuid := state.Get("instance_uuid").(string)
- instance, err := client.GetVMByUuid(uuid)
+ instance, err := c.client.VM.GetByUUID(c.session, uuid)
if err != nil {
ui.Error(fmt.Sprintf("Unable to get VM from UUID '%s': %s", uuid, err.Error()))
return multistep.ActionHalt
}
- host, err := instance.GetResidentOn()
+ host, err := c.client.VM.GetResidentOn(c.session, instance)
if err != nil {
ui.Error(fmt.Sprintf("Unable to get VM Host for VM '%s': %s", uuid, err.Error()))
}
- address, err := host.GetAddress()
+ address, err := c.client.Host.GetAddress(c.session, host)
if err != nil {
ui.Error(fmt.Sprintf("Unable to get address from VM Host: %s", err.Error()))
}
diff --git a/builder/xenserver/common/step_set_vm_to_template.go b/builder/xenserver/common/step_set_vm_to_template.go
new file mode 100644
index 00000000..1bf6358a
--- /dev/null
+++ b/builder/xenserver/common/step_set_vm_to_template.go
@@ -0,0 +1,35 @@
+package common
+
+import (
+ "context"
+ "fmt"
+
+ "github.com/hashicorp/packer-plugin-sdk/multistep"
+ "github.com/hashicorp/packer-plugin-sdk/packer"
+)
+
+type StepSetVmToTemplate struct{}
+
+func (StepSetVmToTemplate) Run(ctx context.Context, state multistep.StateBag) multistep.StepAction {
+ ui := state.Get("ui").(packer.Ui)
+ c := state.Get("client").(*Connection)
+ instance_uuid := state.Get("instance_uuid").(string)
+
+ instance, err := c.client.VM.GetByUUID(c.session, instance_uuid)
+ if err != nil {
+ ui.Error(fmt.Sprintf("Could not get VM with UUID '%s': %s", instance_uuid, err.Error()))
+ return multistep.ActionHalt
+ }
+
+ err = c.client.VM.SetIsATemplate(c.session, instance, true)
+
+ if err != nil {
+ ui.Error(fmt.Sprintf("failed to set VM '%s' as a template with error: %v", instance_uuid, err))
+ return multistep.ActionHalt
+ }
+
+ ui.Message("Successfully set VM as a template")
+ return multistep.ActionContinue
+}
+
+func (StepSetVmToTemplate) Cleanup(state multistep.StateBag) {}
diff --git a/builder/xenserver/common/step_shutdown.go b/builder/xenserver/common/step_shutdown.go
index 01324c19..2cafad31 100644
--- a/builder/xenserver/common/step_shutdown.go
+++ b/builder/xenserver/common/step_shutdown.go
@@ -1,22 +1,24 @@
package common
import (
+ "context"
"fmt"
- "github.com/mitchellh/multistep"
- "github.com/mitchellh/packer/packer"
- xsclient "github.com/xenserver/go-xenserver-client"
"time"
+
+ "github.com/hashicorp/packer-plugin-sdk/multistep"
+ "github.com/hashicorp/packer-plugin-sdk/packer"
+ xenapi "github.com/terra-farm/go-xen-api-client"
)
type StepShutdown struct{}
-func (StepShutdown) Run(state multistep.StateBag) multistep.StepAction {
+func (StepShutdown) Run(ctx context.Context, state multistep.StateBag) multistep.StepAction {
config := state.Get("commonconfig").(CommonConfig)
ui := state.Get("ui").(packer.Ui)
- client := state.Get("client").(xsclient.XenAPIClient)
+ c := state.Get("client").(*Connection)
instance_uuid := state.Get("instance_uuid").(string)
- instance, err := client.GetVMByUuid(instance_uuid)
+ instance, err := c.client.VM.GetByUUID(c.session, instance_uuid)
if err != nil {
ui.Error(fmt.Sprintf("Could not get VM with UUID '%s': %s", instance_uuid, err.Error()))
return multistep.ActionHalt
@@ -39,8 +41,8 @@ func (StepShutdown) Run(state multistep.StateBag) multistep.StepAction {
err = InterruptibleWait{
Predicate: func() (bool, error) {
- power_state, err := instance.GetPowerState()
- return power_state == "Halted", err
+ power_state, err := c.client.VM.GetPowerState(c.session, instance)
+ return power_state == xenapi.VMPowerStateHalted, err
},
PredicateInterval: 5 * time.Second,
Timeout: 300 * time.Second,
@@ -54,7 +56,7 @@ func (StepShutdown) Run(state multistep.StateBag) multistep.StepAction {
} else {
ui.Message("Attempting to cleanly shutdown the VM...")
- err = instance.CleanShutdown()
+ err = c.client.VM.CleanShutdown(c.session, instance)
if err != nil {
ui.Error(fmt.Sprintf("Could not shut down VM: %s", err.Error()))
return false
@@ -66,7 +68,7 @@ func (StepShutdown) Run(state multistep.StateBag) multistep.StepAction {
if !success {
ui.Say("WARNING: Forcing hard shutdown of the VM...")
- err = instance.HardShutdown()
+ err = c.client.VM.HardShutdown(c.session, instance)
if err != nil {
ui.Error(fmt.Sprintf("Could not hard shut down VM -- giving up: %s", err.Error()))
return multistep.ActionHalt
diff --git a/builder/xenserver/common/step_start_on_himn.go b/builder/xenserver/common/step_start_on_himn.go
index eba154f5..d5a13b37 100644
--- a/builder/xenserver/common/step_start_on_himn.go
+++ b/builder/xenserver/common/step_start_on_himn.go
@@ -2,12 +2,12 @@ package common
import (
"fmt"
- "github.com/mitchellh/multistep"
- "github.com/mitchellh/packer/packer"
- xsclient "github.com/xenserver/go-xenserver-client"
- gossh "golang.org/x/crypto/ssh"
"log"
"time"
+
+ "github.com/hashicorp/packer-plugin-sdk/multistep"
+ "github.com/hashicorp/packer-plugin-sdk/packer"
+ gossh "golang.org/x/crypto/ssh"
)
type StepStartOnHIMN struct{}
@@ -23,19 +23,19 @@ type StepStartOnHIMN struct{}
func (self *StepStartOnHIMN) Run(state multistep.StateBag) multistep.StepAction {
ui := state.Get("ui").(packer.Ui)
- client := state.Get("client").(xsclient.XenAPIClient)
+ c := state.Get("client").(*Connection)
ui.Say("Step: Start VM on the Host Internal Mangement Network")
uuid := state.Get("instance_uuid").(string)
- instance, err := client.GetVMByUuid(uuid)
+ instance, err := c.client.VM.GetByUUID(c.session, uuid)
if err != nil {
ui.Error(fmt.Sprintf("Unable to get VM from UUID '%s': %s", uuid, err.Error()))
return multistep.ActionHalt
}
// Find the HIMN Ref
- networks, err := client.GetNetworkByNameLabel("Host internal management network")
+ networks, err := c.client.Network.GetByNameLabel(c.session, "Host internal management network")
if err != nil || len(networks) == 0 {
ui.Error("Unable to find a host internal management network")
ui.Error(err.Error())
@@ -45,7 +45,7 @@ func (self *StepStartOnHIMN) Run(state multistep.StateBag) multistep.StepAction
himn := networks[0]
// Create a VIF for the HIMN
- himn_vif, err := instance.ConnectNetwork(himn, "0")
+ himn_vif, err := ConnectNetwork(c, himn, instance, "0")
if err != nil {
ui.Error("Error creating VIF")
ui.Error(err.Error())
@@ -53,22 +53,22 @@ func (self *StepStartOnHIMN) Run(state multistep.StateBag) multistep.StepAction
}
// Start the VM
- instance.Start(false, false)
+ c.client.VM.Start(c.session, instance, false, false)
var himn_iface_ip string = ""
// Obtain the allocated IP
err = InterruptibleWait{
Predicate: func() (found bool, err error) {
- ips, err := himn.GetAssignedIPs()
+ ips, err := c.client.Network.GetAssignedIps(c.session, himn)
if err != nil {
return false, fmt.Errorf("Can't get assigned IPs: %s", err.Error())
}
log.Printf("IPs: %s", ips)
- log.Printf("Ref: %s", instance.Ref)
+ log.Printf("Ref: %s", instance)
//Check for instance.Ref in map
- if vm_ip, ok := ips[himn_vif.Ref]; ok && vm_ip != "" {
+ if vm_ip, ok := ips[*himn_vif]; ok && vm_ip != "" {
ui.Say("Found the VM's IP: " + vm_ip)
himn_iface_ip = vm_ip
return true, nil
diff --git a/builder/xenserver/common/step_start_vm_paused.go b/builder/xenserver/common/step_start_vm_paused.go
index ccae20bc..b8cd1ee1 100644
--- a/builder/xenserver/common/step_start_vm_paused.go
+++ b/builder/xenserver/common/step_start_vm_paused.go
@@ -1,43 +1,53 @@
package common
import (
+ "context"
"fmt"
- "github.com/mitchellh/multistep"
- "github.com/mitchellh/packer/packer"
- xsclient "github.com/xenserver/go-xenserver-client"
- "log"
+
+ "github.com/hashicorp/packer-plugin-sdk/multistep"
+ "github.com/hashicorp/packer-plugin-sdk/packer"
)
-type StepStartVmPaused struct{}
+type StepStartVmPaused struct {
+ VmCleanup
+}
-func (self *StepStartVmPaused) Run(state multistep.StateBag) multistep.StepAction {
+func (self *StepStartVmPaused) Run(ctx context.Context, state multistep.StateBag) multistep.StepAction {
- client := state.Get("client").(xsclient.XenAPIClient)
+ c := state.Get("client").(*Connection)
ui := state.Get("ui").(packer.Ui)
+ config := state.Get("config").(Config)
ui.Say("Step: Start VM Paused")
uuid := state.Get("instance_uuid").(string)
- instance, err := client.GetVMByUuid(uuid)
+ instance, err := c.client.VM.GetByUUID(c.session, uuid)
if err != nil {
ui.Error(fmt.Sprintf("Unable to get VM from UUID '%s': %s", uuid, err.Error()))
return multistep.ActionHalt
}
// note that here "cd" means boot from hard drive ('c') first, then CDROM ('d')
- err = instance.SetHVMBoot("BIOS order", "cd")
+ err = c.client.VM.SetHVMBootPolicy(c.session, instance, "BIOS order")
+
+ if err != nil {
+ ui.Error(fmt.Sprintf("Unable to set HVM boot params: %s", err.Error()))
+ return multistep.ActionHalt
+ }
+
+ err = c.client.VM.SetHVMBootParams(c.session, instance, map[string]string{"order": "cd", "firmware": config.Firmware})
if err != nil {
ui.Error(fmt.Sprintf("Unable to set HVM boot params: %s", err.Error()))
return multistep.ActionHalt
}
- err = instance.Start(true, false)
+ err = c.client.VM.Start(c.session, instance, true, false)
if err != nil {
ui.Error(fmt.Sprintf("Unable to start VM with UUID '%s': %s", uuid, err.Error()))
return multistep.ActionHalt
}
- domid, err := instance.GetDomainId()
+ domid, err := c.client.VM.GetDomid(c.session, instance)
if err != nil {
ui.Error(fmt.Sprintf("Unable to get domid of VM with UUID '%s': %s", uuid, err.Error()))
return multistep.ActionHalt
@@ -46,24 +56,3 @@ func (self *StepStartVmPaused) Run(state multistep.StateBag) multistep.StepActio
return multistep.ActionContinue
}
-
-func (self *StepStartVmPaused) Cleanup(state multistep.StateBag) {
- config := state.Get("commonconfig").(CommonConfig)
- client := state.Get("client").(xsclient.XenAPIClient)
-
- if config.ShouldKeepVM(state) {
- return
- }
-
- uuid := state.Get("instance_uuid").(string)
- instance, err := client.GetVMByUuid(uuid)
- if err != nil {
- log.Printf(fmt.Sprintf("Unable to get VM from UUID '%s': %s", uuid, err.Error()))
- return
- }
-
- err = instance.HardShutdown()
- if err != nil {
- log.Printf(fmt.Sprintf("Unable to force shutdown VM '%s': %s", uuid, err.Error()))
- }
-}
diff --git a/builder/xenserver/common/step_type_boot_command.go b/builder/xenserver/common/step_type_boot_command.go
index a9207eca..00689acd 100644
--- a/builder/xenserver/common/step_type_boot_command.go
+++ b/builder/xenserver/common/step_type_boot_command.go
@@ -3,17 +3,21 @@ package common
/* Heavily borrowed from builder/quemu/step_type_boot_command.go */
import (
+ "context"
+ "crypto/tls"
"fmt"
- "github.com/mitchellh/go-vnc"
- "github.com/mitchellh/multistep"
- "github.com/mitchellh/packer/packer"
- "github.com/mitchellh/packer/template/interpolate"
+ "io"
"log"
"net"
"strings"
"time"
"unicode"
"unicode/utf8"
+
+ "github.com/hashicorp/packer-plugin-sdk/multistep"
+ "github.com/hashicorp/packer-plugin-sdk/packer"
+ "github.com/hashicorp/packer-plugin-sdk/template/interpolate"
+ "github.com/mitchellh/go-vnc"
)
const KeyLeftShift uint = 0xFFE1
@@ -28,21 +32,50 @@ type StepTypeBootCommand struct {
Ctx interpolate.Context
}
-func (self *StepTypeBootCommand) Run(state multistep.StateBag) multistep.StepAction {
+func (self *StepTypeBootCommand) Run(ctx context.Context, state multistep.StateBag) multistep.StepAction {
config := state.Get("commonconfig").(CommonConfig)
ui := state.Get("ui").(packer.Ui)
- vnc_port := state.Get("local_vnc_port").(uint)
- http_port := state.Get("http_port").(uint)
+ c := state.Get("client").(*Connection)
+ httpPort := state.Get("http_port").(int)
// skip this step if we have nothing to type
if len(config.BootCommand) == 0 {
return multistep.ActionContinue
}
- // Connect to the local VNC port as we have set up a SSH port forward
- ui.Say("Connecting to the VM over VNC")
- ui.Message(fmt.Sprintf("Using local port: %d", vnc_port))
- net_conn, err := net.Dial("tcp", fmt.Sprintf("127.0.0.1:%d", vnc_port))
+ vmRef, err := c.client.VM.GetByNameLabel(c.session, config.VMName)
+
+ if err != nil {
+ state.Put("error", err)
+ ui.Error(err.Error())
+ return multistep.ActionHalt
+ }
+
+ if len(vmRef) != 1 {
+ ui.Error(fmt.Sprintf("expected to find a single VM, instead found '%d'. Ensure the VM name is unique", len(vmRef)))
+ }
+
+ consoles, err := c.client.VM.GetConsoles(c.session, vmRef[0])
+ if err != nil {
+ state.Put("error", err)
+ ui.Error(err.Error())
+ return multistep.ActionHalt
+ }
+
+ if len(consoles) != 1 {
+ ui.Error(fmt.Sprintf("expected to find a VM console, instead found '%d'. Ensure there is only one console", len(consoles)))
+ return multistep.ActionHalt
+ }
+
+ location, err := c.client.Console.GetLocation(c.session, consoles[0])
+ if err != nil {
+ ui.Error(err.Error())
+ return multistep.ActionHalt
+ }
+ locationPieces := strings.SplitAfter(location, "/")
+ consoleHost := strings.TrimSuffix(locationPieces[2], "/")
+ ui.Say(fmt.Sprintf("Connecting to the VM console VNC over xapi via %s", consoleHost))
+ conn, err := net.Dial("tcp", fmt.Sprintf("%s:443", consoleHost))
if err != nil {
err := fmt.Errorf("Error connecting to VNC: %s", err)
@@ -51,9 +84,39 @@ func (self *StepTypeBootCommand) Run(state multistep.StateBag) multistep.StepAct
return multistep.ActionHalt
}
- defer net_conn.Close()
+ defer conn.Close()
+
+ tlsConfig := &tls.Config{
+ InsecureSkipVerify: true,
+ }
+ tlsConn := tls.Client(conn, tlsConfig)
+
+ consoleLocation := strings.TrimSpace(fmt.Sprintf("/%s", locationPieces[len(locationPieces)-1]))
+ httpReq := fmt.Sprintf("CONNECT %s HTTP/1.0\r\nHost: %s\r\nCookie: session_id=%s\r\n\r\n", consoleLocation, consoleHost, c.session)
+ fmt.Printf("Sending the follow http req: %v", httpReq)
+
+ ui.Say(fmt.Sprintf("Making HTTP request to initiate VNC connection: %s", httpReq))
+ _, err = io.WriteString(tlsConn, httpReq)
+
+ if err != nil {
+ err := fmt.Errorf("failed to start vnc session: %v", err)
+ state.Put("error", err)
+ ui.Error(err.Error())
+ return multistep.ActionHalt
+ }
+
+ buffer := make([]byte, 10000)
+ _, err = tlsConn.Read(buffer)
+ if err != nil && err != io.EOF {
+ err := fmt.Errorf("failed to read vnc session response: %v", err)
+ state.Put("error", err)
+ ui.Error(err.Error())
+ return multistep.ActionHalt
+ }
+
+ ui.Say(fmt.Sprintf("Received response: %s", string(buffer)))
- c, err := vnc.Client(net_conn, &vnc.ClientConfig{Exclusive: true})
+ vncClient, err := vnc.Client(tlsConn, &vnc.ClientConfig{Exclusive: true})
if err != nil {
err := fmt.Errorf("Error establishing VNC session: %s", err)
@@ -62,9 +125,9 @@ func (self *StepTypeBootCommand) Run(state multistep.StateBag) multistep.StepAct
return multistep.ActionHalt
}
- defer c.Close()
+ defer vncClient.Close()
- log.Printf("Connected to the VNC console: %s", c.DesktopName)
+ log.Printf("Connected to the VNC console: %s", vncClient.DesktopName)
// find local ip
envVar, err := ExecuteHostSSHCmd(state, "echo $SSH_CLIENT")
@@ -82,7 +145,7 @@ func (self *StepTypeBootCommand) Run(state multistep.StateBag) multistep.StepAct
self.Ctx.Data = &bootCommandTemplateData{
config.VMName,
localIp,
- http_port,
+ uint(httpPort),
}
ui.Say("Typing boot commands over VNC...")
@@ -101,7 +164,7 @@ func (self *StepTypeBootCommand) Run(state multistep.StateBag) multistep.StepAct
return multistep.ActionHalt
}
- vncSendString(c, command)
+ vncSendString(vncClient, command)
}
ui.Say("Finished typing.")
@@ -195,7 +258,9 @@ func vncSendString(c *vnc.ClientConn, original string) {
}
c.KeyEvent(keyCode, true)
+ time.Sleep(time.Second / 10)
c.KeyEvent(keyCode, false)
+ time.Sleep(time.Second / 10)
if keyShift {
c.KeyEvent(uint32(KeyLeftShift), false)
diff --git a/builder/xenserver/common/step_upload_vdi.go b/builder/xenserver/common/step_upload_vdi.go
index 300a91ad..67a00f37 100644
--- a/builder/xenserver/common/step_upload_vdi.go
+++ b/builder/xenserver/common/step_upload_vdi.go
@@ -1,13 +1,15 @@
package common
import (
+ "context"
"fmt"
- "github.com/mitchellh/multistep"
- "github.com/mitchellh/packer/packer"
- xsclient "github.com/xenserver/go-xenserver-client"
"log"
"os"
"time"
+
+ "github.com/hashicorp/packer-plugin-sdk/multistep"
+ "github.com/hashicorp/packer-plugin-sdk/packer"
+ xenapi "github.com/terra-farm/go-xen-api-client"
)
type StepUploadVdi struct {
@@ -16,10 +18,10 @@ type StepUploadVdi struct {
VdiUuidKey string
}
-func (self *StepUploadVdi) Run(state multistep.StateBag) multistep.StepAction {
+func (self *StepUploadVdi) Run(ctx context.Context, state multistep.StateBag) multistep.StepAction {
config := state.Get("commonconfig").(CommonConfig)
ui := state.Get("ui").(packer.Ui)
- client := state.Get("client").(xsclient.XenAPIClient)
+ c := state.Get("client").(*Connection)
imagePath := self.ImagePathFunc()
vdiName := self.VdiNameFunc()
@@ -31,9 +33,13 @@ func (self *StepUploadVdi) Run(state multistep.StateBag) multistep.StepAction {
ui.Say(fmt.Sprintf("Step: Upload VDI '%s'", vdiName))
// Create VDI for the image
- sr, err := config.GetSR(client)
+ srs, err := c.client.SR.GetAll(c.session)
+ ui.Say(fmt.Sprintf("Step: Found SRs '%v'", srs))
+
+ sr, err := config.GetISOSR(c)
+
if err != nil {
- ui.Error(fmt.Sprintf("Unable to get SR: %s", err.Error()))
+ ui.Error(fmt.Sprintf("Unable to get SR: %v", err))
return multistep.ActionHalt
}
@@ -53,13 +59,24 @@ func (self *StepUploadVdi) Run(state multistep.StateBag) multistep.StepAction {
fileLength := fstat.Size()
// Create the VDI
- vdi, err := sr.CreateVdi(vdiName, fileLength)
+ // vdi, err := sr.CreateVdi(vdiName, fileLength)
+ vdi, err := c.client.VDI.Create(c.session, xenapi.VDIRecord{
+ NameLabel: vdiName,
+ VirtualSize: int(fileLength),
+ Type: "user",
+ Sharable: false,
+ ReadOnly: false,
+ SR: sr,
+ OtherConfig: map[string]string{
+ "temp": "temp",
+ },
+ })
if err != nil {
ui.Error(fmt.Sprintf("Unable to create VDI '%s': %s", vdiName, err.Error()))
return multistep.ActionHalt
}
- vdiUuid, err := vdi.GetUuid()
+ vdiUuid, err := c.client.VDI.GetUUID(c.session, vdi)
if err != nil {
ui.Error(fmt.Sprintf("Unable to get UUID of VDI '%s': %s", vdiName, err.Error()))
return multistep.ActionHalt
@@ -67,9 +84,9 @@ func (self *StepUploadVdi) Run(state multistep.StateBag) multistep.StepAction {
state.Put(self.VdiUuidKey, vdiUuid)
_, err = HTTPUpload(fmt.Sprintf("https://%s/import_raw_vdi?vdi=%s&session_id=%s",
- client.Host,
- vdi.Ref,
- client.Session.(string),
+ c.Host,
+ vdi,
+ c.GetSession(),
), fh, state)
if err != nil {
ui.Error(fmt.Sprintf("Unable to upload VDI: %s", err.Error()))
@@ -82,7 +99,7 @@ func (self *StepUploadVdi) Run(state multistep.StateBag) multistep.StepAction {
func (self *StepUploadVdi) Cleanup(state multistep.StateBag) {
config := state.Get("commonconfig").(CommonConfig)
ui := state.Get("ui").(packer.Ui)
- client := state.Get("client").(xsclient.XenAPIClient)
+ c := state.Get("client").(*Connection)
vdiName := self.VdiNameFunc()
@@ -102,7 +119,7 @@ func (self *StepUploadVdi) Cleanup(state multistep.StateBag) {
return
}
- vdi, err := client.GetVdiByUuid(vdiUuid)
+ vdi, err := c.client.VDI.GetByUUID(c.session, vdiUuid)
if err != nil {
ui.Error(fmt.Sprintf("Can't get VDI '%s': %s", vdiUuid, err.Error()))
return
@@ -112,7 +129,7 @@ func (self *StepUploadVdi) Cleanup(state multistep.StateBag) {
// so try several times
for i := 0; i < 3; i++ {
log.Printf("Trying to destroy VDI...")
- err = vdi.Destroy()
+ err = c.client.VDI.Destroy(c.session, vdi)
if err == nil {
break
}
diff --git a/builder/xenserver/common/step_wait_for_ip.go b/builder/xenserver/common/step_wait_for_ip.go
index 1d29a2d5..bed9735b 100644
--- a/builder/xenserver/common/step_wait_for_ip.go
+++ b/builder/xenserver/common/step_wait_for_ip.go
@@ -1,29 +1,29 @@
package common
import (
+ "context"
"fmt"
"time"
- "github.com/mitchellh/multistep"
- "github.com/mitchellh/packer/packer"
- "github.com/nilshell/xmlrpc"
- xsclient "github.com/xenserver/go-xenserver-client"
+ "github.com/hashicorp/packer-plugin-sdk/multistep"
+ "github.com/hashicorp/packer-plugin-sdk/packer"
)
type StepWaitForIP struct {
+ VmCleanup
Chan <-chan string
Timeout time.Duration
}
-func (self *StepWaitForIP) Run(state multistep.StateBag) multistep.StepAction {
+func (self *StepWaitForIP) Run(ctx context.Context, state multistep.StateBag) multistep.StepAction {
ui := state.Get("ui").(packer.Ui)
- client := state.Get("client").(xsclient.XenAPIClient)
+ c := state.Get("client").(*Connection)
config := state.Get("commonconfig").(CommonConfig)
ui.Say("Step: Wait for VM's IP to become known to us.")
uuid := state.Get("instance_uuid").(string)
- instance, err := client.GetVMByUuid(uuid)
+ instance, err := c.client.VM.GetByUUID(c.session, uuid)
if err != nil {
ui.Error(fmt.Sprintf("Unable to get VM from UUID '%s': %s", uuid, err.Error()))
return multistep.ActionHalt
@@ -50,14 +50,19 @@ func (self *StepWaitForIP) Run(state multistep.StateBag) multistep.StepAction {
if config.IPGetter == "auto" || config.IPGetter == "tools" {
// Look for PV IP
- metrics, err := instance.GetGuestMetrics()
+ m, err := c.client.VM.GetGuestMetrics(c.session, instance)
if err != nil {
return false, err
}
- if metrics != nil {
- networks := metrics["networks"].(xmlrpc.Struct)
- if ipRaw, ok := networks["0/ip"]; ok {
- if ip = ipRaw.(string); ip != "" {
+ if m != "" {
+ metrics, err := c.client.VMGuestMetrics.GetRecord(c.session, m)
+ if err != nil {
+ return false, err
+ }
+ networks := metrics.Networks
+ var ok bool
+ if ip, ok = networks["0/ip"]; ok {
+ if ip != "" {
ui.Message(fmt.Sprintf("Got IP '%s' from XenServer tools", ip))
return true, nil
}
@@ -81,13 +86,11 @@ func (self *StepWaitForIP) Run(state multistep.StateBag) multistep.StepAction {
return multistep.ActionContinue
}
-func (self *StepWaitForIP) Cleanup(state multistep.StateBag) {}
-
func InstanceSSHIP(state multistep.StateBag) (string, error) {
ip := state.Get("instance_ssh_address").(string)
return ip, nil
}
-func InstanceSSHPort(state multistep.StateBag) (uint, error) {
+func InstanceSSHPort(state multistep.StateBag) (int, error) {
return 22, nil
}
diff --git a/builder/xenserver/common/vm_cleanup.go b/builder/xenserver/common/vm_cleanup.go
new file mode 100644
index 00000000..0c2c59c8
--- /dev/null
+++ b/builder/xenserver/common/vm_cleanup.go
@@ -0,0 +1,31 @@
+package common
+
+import (
+ "fmt"
+ "log"
+
+ "github.com/hashicorp/packer-plugin-sdk/multistep"
+)
+
+type VmCleanup struct{}
+
+func (self *VmCleanup) Cleanup(state multistep.StateBag) {
+ config := state.Get("commonconfig").(CommonConfig)
+ c := state.Get("client").(*Connection)
+
+ if config.ShouldKeepVM(state) {
+ return
+ }
+
+ uuid := state.Get("instance_uuid").(string)
+ instance, err := c.client.VM.GetByUUID(c.session, uuid)
+ if err != nil {
+ log.Printf(fmt.Sprintf("Unable to get VM from UUID '%s': %s", uuid, err.Error()))
+ return
+ }
+
+ err = c.client.VM.HardShutdown(c.session, instance)
+ if err != nil {
+ log.Printf(fmt.Sprintf("Unable to force shutdown VM '%s': %s", uuid, err.Error()))
+ }
+}
diff --git a/builder/xenserver/iso/builder.go b/builder/xenserver/iso/builder.go
index 5ddd91a4..a9e37f1b 100644
--- a/builder/xenserver/iso/builder.go
+++ b/builder/xenserver/iso/builder.go
@@ -1,54 +1,32 @@
package iso
import (
+ "context"
"errors"
"fmt"
- "log"
"path"
"strings"
"time"
- "github.com/mitchellh/multistep"
- "github.com/mitchellh/packer/common"
- "github.com/mitchellh/packer/helper/communicator"
- hconfig "github.com/mitchellh/packer/helper/config"
- "github.com/mitchellh/packer/packer"
- "github.com/mitchellh/packer/template/interpolate"
- xsclient "github.com/xenserver/go-xenserver-client"
+ "github.com/hashicorp/hcl/v2/hcldec"
+ "github.com/hashicorp/packer-plugin-sdk/communicator"
+ "github.com/hashicorp/packer-plugin-sdk/multistep"
+ commonsteps "github.com/hashicorp/packer-plugin-sdk/multistep/commonsteps"
+ "github.com/hashicorp/packer-plugin-sdk/packer"
+ hconfig "github.com/hashicorp/packer-plugin-sdk/template/config"
+ "github.com/hashicorp/packer-plugin-sdk/template/interpolate"
+ xsclient "github.com/terra-farm/go-xen-api-client"
xscommon "github.com/xenserver/packer-builder-xenserver/builder/xenserver/common"
)
-type config struct {
- common.PackerConfig `mapstructure:",squash"`
- xscommon.CommonConfig `mapstructure:",squash"`
-
- VCPUsMax uint `mapstructure:"vcpus_max"`
- VCPUsAtStartup uint `mapstructure:"vcpus_atstartup"`
- VMMemory uint `mapstructure:"vm_memory"`
- DiskSize uint `mapstructure:"disk_size"`
- CloneTemplate string `mapstructure:"clone_template"`
- VMOtherConfig map[string]string `mapstructure:"vm_other_config"`
-
- ISOChecksum string `mapstructure:"iso_checksum"`
- ISOChecksumType string `mapstructure:"iso_checksum_type"`
- ISOUrls []string `mapstructure:"iso_urls"`
- ISOUrl string `mapstructure:"iso_url"`
- ISOName string `mapstructure:"iso_name"`
-
- PlatformArgs map[string]string `mapstructure:"platform_args"`
-
- RawInstallTimeout string `mapstructure:"install_timeout"`
- InstallTimeout time.Duration ``
-
- ctx interpolate.Context
-}
-
type Builder struct {
- config config
+ config xscommon.Config
runner multistep.Runner
}
-func (self *Builder) Prepare(raws ...interface{}) (params []string, retErr error) {
+func (self *Builder) ConfigSpec() hcldec.ObjectSpec { return self.config.FlatMapstructure().HCL2Spec() }
+
+func (self *Builder) Prepare(raws ...interface{}) (params []string, warns []string, retErr error) {
var errs *packer.MultiError
@@ -66,8 +44,8 @@ func (self *Builder) Prepare(raws ...interface{}) (params []string, retErr error
}
errs = packer.MultiErrorAppend(
- errs, self.config.CommonConfig.Prepare(&self.config.ctx, &self.config.PackerConfig)...)
- errs = packer.MultiErrorAppend(errs, self.config.SSHConfig.Prepare(&self.config.ctx)...)
+ errs, self.config.CommonConfig.Prepare(self.config.GetInterpContext(), &self.config.PackerConfig)...)
+ errs = packer.MultiErrorAppend(errs, self.config.SSHConfig.Prepare(self.config.GetInterpContext())...)
// Set default values
@@ -99,6 +77,10 @@ func (self *Builder) Prepare(raws ...interface{}) (params []string, retErr error
self.config.CloneTemplate = "Other install media"
}
+ if self.config.Firmware == "" {
+ self.config.Firmware = "bios"
+ }
+
if len(self.config.PlatformArgs) == 0 {
pargs := make(map[string]string)
pargs["viridian"] = "false"
@@ -148,12 +130,6 @@ func (self *Builder) Prepare(raws ...interface{}) (params []string, retErr error
} else {
self.config.ISOChecksum = strings.ToLower(self.config.ISOChecksum)
}
-
- if hash := common.HashForType(self.config.ISOChecksumType); hash == nil {
- errs = packer.MultiErrorAppend(
- errs, fmt.Errorf("Unsupported checksum type: %s", self.config.ISOChecksumType))
- }
-
}
}
@@ -168,14 +144,6 @@ func (self *Builder) Prepare(raws ...interface{}) (params []string, retErr error
errs = packer.MultiErrorAppend(
errs, errors.New("Only one of iso_url or iso_urls may be specified."))
}
-
- for i, url := range self.config.ISOUrls {
- self.config.ISOUrls[i], err = common.DownloadableURL(url)
- if err != nil {
- errs = packer.MultiErrorAppend(
- errs, fmt.Errorf("Failed to parse iso_urls[%d]: %s", i, err))
- }
- }
} else {
// An ISO name has been provided. It should be attached from an available SR.
@@ -186,26 +154,23 @@ func (self *Builder) Prepare(raws ...interface{}) (params []string, retErr error
retErr = errors.New(errs.Error())
}
- return nil, retErr
+ return nil, nil, retErr
}
-func (self *Builder) Run(ui packer.Ui, hook packer.Hook, cache packer.Cache) (packer.Artifact, error) {
- //Setup XAPI client
- client := xsclient.NewXenAPIClient(self.config.HostIp, self.config.Username, self.config.Password)
+func (self *Builder) Run(ctx context.Context, ui packer.Ui, hook packer.Hook) (packer.Artifact, error) {
+ c, err := xscommon.NewXenAPIClient(self.config.HostIp, self.config.Username, self.config.Password)
- err := client.Login()
if err != nil {
- return nil, err.(error)
+ return nil, err
}
ui.Say("XAPI client session established")
- client.GetHosts()
+ c.GetClient().Host.GetAll(c.GetSessionRef())
//Share state between the other steps using a statebag
state := new(multistep.BasicStateBag)
- state.Put("cache", cache)
- state.Put("client", client)
+ state.Put("client", c)
state.Put("config", self.config)
state.Put("commonconfig", self.config.CommonConfig)
state.Put("hook", hook)
@@ -215,12 +180,11 @@ func (self *Builder) Run(ui packer.Ui, hook packer.Hook, cache packer.Cache) (pa
//Build the steps
download_steps := []multistep.Step{
- &common.StepDownload{
- Checksum: self.config.ISOChecksum,
- ChecksumType: self.config.ISOChecksumType,
- Description: "ISO",
- ResultKey: "iso_path",
- Url: self.config.ISOUrls,
+ &commonsteps.StepDownload{
+ Checksum: self.config.ISOChecksum,
+ Description: "ISO",
+ ResultKey: "iso_path",
+ Url: self.config.ISOUrls,
},
}
@@ -229,8 +193,9 @@ func (self *Builder) Run(ui packer.Ui, hook packer.Hook, cache packer.Cache) (pa
Force: self.config.PackerForce,
Path: self.config.OutputDir,
},
- &common.StepCreateFloppy{
+ &commonsteps.StepCreateFloppy{
Files: self.config.FloppyFiles,
+ Label: "cidata",
},
&xscommon.StepHTTPServer{
Chan: httpReqChan,
@@ -273,33 +238,32 @@ func (self *Builder) Run(ui packer.Ui, hook packer.Hook, cache packer.Cache) (pa
new(stepCreateInstance),
&xscommon.StepAttachVdi{
VdiUuidKey: "floppy_vdi_uuid",
- VdiType: xsclient.Floppy,
+ VdiType: xsclient.VbdTypeFloppy,
},
&xscommon.StepAttachVdi{
VdiUuidKey: "iso_vdi_uuid",
- VdiType: xsclient.CD,
+ VdiType: xsclient.VbdTypeCD,
},
&xscommon.StepAttachVdi{
VdiUuidKey: "isoname_vdi_uuid",
- VdiType: xsclient.CD,
+ VdiType: xsclient.VbdTypeCD,
},
&xscommon.StepAttachVdi{
VdiUuidKey: "tools_vdi_uuid",
- VdiType: xsclient.CD,
+ VdiType: xsclient.VbdTypeCD,
},
new(xscommon.StepStartVmPaused),
new(xscommon.StepSetVmHostSshAddress),
- new(xscommon.StepGetVNCPort),
- &xscommon.StepForwardPortOverSSH{
- RemotePort: xscommon.InstanceVNCPort,
- RemoteDest: xscommon.InstanceVNCIP,
- HostPortMin: self.config.HostPortMin,
- HostPortMax: self.config.HostPortMax,
- ResultKey: "local_vnc_port",
- },
+ // &xscommon.StepForwardPortOverSSH{
+ // RemotePort: xscommon.InstanceVNCPort,
+ // RemoteDest: xscommon.InstanceVNCIP,
+ // HostPortMin: self.config.HostPortMin,
+ // HostPortMax: self.config.HostPortMax,
+ // ResultKey: "local_vnc_port",
+ // },
new(xscommon.StepBootWait),
&xscommon.StepTypeBootCommand{
- Ctx: self.config.ctx,
+ Ctx: *self.config.GetInterpContext(),
},
&xscommon.StepWaitForIP{
Chan: httpReqChan,
@@ -314,12 +278,13 @@ func (self *Builder) Run(ui packer.Ui, hook packer.Hook, cache packer.Cache) (pa
},
&communicator.StepConnect{
Config: &self.config.SSHConfig.Comm,
- Host: xscommon.CommHost,
- SSHConfig: xscommon.SSHConfigFunc(self.config.CommonConfig.SSHConfig),
- SSHPort: xscommon.SSHPort,
+ Host: xscommon.InstanceSSHIP,
+ SSHConfig: self.config.Comm.SSHConfigFunc(),
+ SSHPort: xscommon.InstanceSSHPort,
},
- new(common.StepProvision),
+ new(commonsteps.StepProvision),
new(xscommon.StepShutdown),
+ new(xscommon.StepSetVmToTemplate),
&xscommon.StepDetachVdi{
VdiUuidKey: "iso_vdi_uuid",
},
@@ -340,7 +305,7 @@ func (self *Builder) Run(ui packer.Ui, hook packer.Hook, cache packer.Cache) (pa
}
self.runner = &multistep.BasicRunner{Steps: steps}
- self.runner.Run(state)
+ self.runner.Run(ctx, state)
if rawErr, ok := state.GetOk("error"); ok {
return nil, rawErr.(error)
@@ -358,11 +323,3 @@ func (self *Builder) Run(ui packer.Ui, hook packer.Hook, cache packer.Cache) (pa
return artifact, nil
}
-
-func (self *Builder) Cancel() {
- if self.runner != nil {
- log.Println("Cancelling the step runner...")
- self.runner.Cancel()
- }
- fmt.Println("Cancelling the builder")
-}
diff --git a/builder/xenserver/iso/builder_test.go b/builder/xenserver/iso/builder_test.go
index 1a7a19b8..dd4df151 100644
--- a/builder/xenserver/iso/builder_test.go
+++ b/builder/xenserver/iso/builder_test.go
@@ -1,9 +1,10 @@
package iso
import (
- "github.com/mitchellh/packer/packer"
"reflect"
"testing"
+
+ "github.com/hashicorp/packer-plugin-sdk/packer"
)
func testConfig() map[string]interface{} {
@@ -33,7 +34,7 @@ func TestBuilder_ImplementsBuilder(t *testing.T) {
func TestBuilderPrepare_Defaults(t *testing.T) {
var b Builder
config := testConfig()
- warns, err := b.Prepare(config)
+ _, warns, err := b.Prepare(config)
if len(warns) > 0 {
t.Fatalf("bad: %#v", warns)
}
@@ -67,7 +68,7 @@ func TestBuilderPrepare_DiskSize(t *testing.T) {
config := testConfig()
delete(config, "disk_size")
- warns, err := b.Prepare(config)
+ _, warns, err := b.Prepare(config)
if len(warns) > 0 {
t.Fatalf("bad: %#v", warns)
}
@@ -81,7 +82,7 @@ func TestBuilderPrepare_DiskSize(t *testing.T) {
config["disk_size"] = 60000
b = Builder{}
- warns, err = b.Prepare(config)
+ _, warns, err = b.Prepare(config)
if len(warns) > 0 {
t.Fatalf("bad: %#v", warns)
}
@@ -90,7 +91,7 @@ func TestBuilderPrepare_DiskSize(t *testing.T) {
}
if b.config.DiskSize != 60000 {
- t.Fatalf("bad size: %s", b.config.DiskSize)
+ t.Fatalf("bad size: %d", b.config.DiskSize)
}
}
@@ -100,7 +101,7 @@ func TestBuilderPrepare_Format(t *testing.T) {
// Bad
config["format"] = "foo"
- warns, err := b.Prepare(config)
+ _, warns, err := b.Prepare(config)
if len(warns) > 0 {
t.Fatalf("bad: %#v", warns)
}
@@ -111,7 +112,7 @@ func TestBuilderPrepare_Format(t *testing.T) {
// Good
config["format"] = "vdi_raw"
b = Builder{}
- warns, err = b.Prepare(config)
+ _, warns, err = b.Prepare(config)
if len(warns) > 0 {
t.Fatalf("bad: %#v", warns)
}
@@ -127,7 +128,7 @@ func TestBuilderPrepare_HTTPPort(t *testing.T) {
// Bad
config["http_port_min"] = 1000
config["http_port_max"] = 500
- warns, err := b.Prepare(config)
+ _, warns, err := b.Prepare(config)
if len(warns) > 0 {
t.Fatalf("bad: %#v", warns)
}
@@ -138,7 +139,7 @@ func TestBuilderPrepare_HTTPPort(t *testing.T) {
// Bad
config["http_port_min"] = -500
b = Builder{}
- warns, err = b.Prepare(config)
+ _, warns, err = b.Prepare(config)
if len(warns) > 0 {
t.Fatalf("bad: %#v", warns)
}
@@ -150,7 +151,7 @@ func TestBuilderPrepare_HTTPPort(t *testing.T) {
config["http_port_min"] = 500
config["http_port_max"] = 1000
b = Builder{}
- warns, err = b.Prepare(config)
+ _, warns, err = b.Prepare(config)
if len(warns) > 0 {
t.Fatalf("bad: %#v", warns)
}
@@ -165,7 +166,7 @@ func TestBuilderPrepare_InvalidKey(t *testing.T) {
// Add a random key
config["i_should_not_be_valid"] = true
- warns, err := b.Prepare(config)
+ _, warns, err := b.Prepare(config)
if len(warns) > 0 {
t.Fatalf("bad: %#v", warns)
}
@@ -180,7 +181,7 @@ func TestBuilderPrepare_ISOChecksum(t *testing.T) {
// Test bad
config["iso_checksum"] = ""
- warns, err := b.Prepare(config)
+ _, warns, err := b.Prepare(config)
if len(warns) > 0 {
t.Fatalf("bad: %#v", warns)
}
@@ -191,7 +192,7 @@ func TestBuilderPrepare_ISOChecksum(t *testing.T) {
// Test good
config["iso_checksum"] = "FOo"
b = Builder{}
- warns, err = b.Prepare(config)
+ _, warns, err = b.Prepare(config)
if len(warns) > 0 {
t.Fatalf("bad: %#v", warns)
}
@@ -210,7 +211,7 @@ func TestBuilderPrepare_ISOChecksumType(t *testing.T) {
// Test bad
config["iso_checksum_type"] = ""
- warns, err := b.Prepare(config)
+ _, warns, err := b.Prepare(config)
if len(warns) > 0 {
t.Fatalf("bad: %#v", warns)
}
@@ -221,7 +222,7 @@ func TestBuilderPrepare_ISOChecksumType(t *testing.T) {
// Test good
config["iso_checksum_type"] = "mD5"
b = Builder{}
- warns, err = b.Prepare(config)
+ _, warns, err = b.Prepare(config)
if len(warns) > 0 {
t.Fatalf("bad: %#v", warns)
}
@@ -236,7 +237,7 @@ func TestBuilderPrepare_ISOChecksumType(t *testing.T) {
// Test unknown
config["iso_checksum_type"] = "fake"
b = Builder{}
- warns, err = b.Prepare(config)
+ _, warns, err = b.Prepare(config)
if len(warns) > 0 {
t.Fatalf("bad: %#v", warns)
}
@@ -247,7 +248,7 @@ func TestBuilderPrepare_ISOChecksumType(t *testing.T) {
// Test none
config["iso_checksum_type"] = "none"
b = Builder{}
- warns, err = b.Prepare(config)
+ _, warns, err = b.Prepare(config)
// @todo: give warning in this case?
/*
if len(warns) == 0 {
@@ -272,7 +273,7 @@ func TestBuilderPrepare_ISOUrl(t *testing.T) {
// Test both epty
config["iso_url"] = ""
b = Builder{}
- warns, err := b.Prepare(config)
+ _, warns, err := b.Prepare(config)
if len(warns) > 0 {
t.Fatalf("bad: %#v", warns)
}
@@ -283,7 +284,7 @@ func TestBuilderPrepare_ISOUrl(t *testing.T) {
// Test iso_url set
config["iso_url"] = "http://www.packer.io"
b = Builder{}
- warns, err = b.Prepare(config)
+ _, warns, err = b.Prepare(config)
if len(warns) > 0 {
t.Fatalf("bad: %#v", warns)
}
@@ -300,7 +301,7 @@ func TestBuilderPrepare_ISOUrl(t *testing.T) {
config["iso_url"] = "http://www.packer.io"
config["iso_urls"] = []string{"http://www.packer.io"}
b = Builder{}
- warns, err = b.Prepare(config)
+ _, warns, err = b.Prepare(config)
if len(warns) > 0 {
t.Fatalf("bad: %#v", warns)
}
@@ -316,7 +317,7 @@ func TestBuilderPrepare_ISOUrl(t *testing.T) {
}
b = Builder{}
- warns, err = b.Prepare(config)
+ _, warns, err = b.Prepare(config)
if len(warns) > 0 {
t.Fatalf("bad: %#v", warns)
}
@@ -339,7 +340,7 @@ func TestBuilderPrepare_KeepVM(t *testing.T) {
// Bad
config["keep_vm"] = "foo"
- warns, err := b.Prepare(config)
+ _, warns, err := b.Prepare(config)
if len(warns) > 0 {
t.Fatalf("bad: %#v", warns)
}
@@ -350,7 +351,7 @@ func TestBuilderPrepare_KeepVM(t *testing.T) {
// Good
config["keep_vm"] = "always"
b = Builder{}
- warns, err = b.Prepare(config)
+ _, warns, err = b.Prepare(config)
if len(warns) > 0 {
t.Fatalf("bad: %#v", warns)
}
diff --git a/builder/xenserver/iso/step_create_instance.go b/builder/xenserver/iso/step_create_instance.go
index 8369c527..df6702ae 100644
--- a/builder/xenserver/iso/step_create_instance.go
+++ b/builder/xenserver/iso/step_create_instance.go
@@ -1,29 +1,33 @@
package iso
import (
+ "context"
"fmt"
+ "log"
- "github.com/mitchellh/multistep"
- "github.com/mitchellh/packer/packer"
- xsclient "github.com/xenserver/go-xenserver-client"
+ "github.com/hashicorp/packer-plugin-sdk/multistep"
+ "github.com/hashicorp/packer-plugin-sdk/packer"
+ xenapi "github.com/terra-farm/go-xen-api-client"
+ xsclient "github.com/terra-farm/go-xen-api-client"
+ xscommon "github.com/xenserver/packer-builder-xenserver/builder/xenserver/common"
)
type stepCreateInstance struct {
- instance *xsclient.VM
- vdi *xsclient.VDI
+ instance *xsclient.VMRef
+ vdi *xsclient.VDIRef
}
-func (self *stepCreateInstance) Run(state multistep.StateBag) multistep.StepAction {
+func (self *stepCreateInstance) Run(ctx context.Context, state multistep.StateBag) multistep.StepAction {
- client := state.Get("client").(xsclient.XenAPIClient)
- config := state.Get("config").(config)
+ c := state.Get("client").(*xscommon.Connection)
+ config := state.Get("config").(xscommon.Config)
ui := state.Get("ui").(packer.Ui)
ui.Say("Step: Create Instance")
// Get the template to clone from
- vms, err := client.GetVMByNameLabel(config.CloneTemplate)
+ vms, err := c.GetClient().VM.GetByNameLabel(c.GetSessionRef(), config.CloneTemplate)
switch {
case len(vms) == 0:
@@ -37,51 +41,52 @@ func (self *stepCreateInstance) Run(state multistep.StateBag) multistep.StepActi
template := vms[0]
// Clone that VM template
- instance, err := template.Clone(config.VMName)
+ instance, err := c.GetClient().VM.Clone(c.GetSessionRef(), template, config.VMName)
if err != nil {
ui.Error(fmt.Sprintf("Error cloning VM: %s", err.Error()))
return multistep.ActionHalt
}
- self.instance = instance
+ self.instance = &instance
- err = instance.SetIsATemplate(false)
+ err = c.GetClient().VM.SetIsATemplate(c.GetSessionRef(), instance, false)
if err != nil {
ui.Error(fmt.Sprintf("Error setting is_a_template=false: %s", err.Error()))
return multistep.ActionHalt
}
- err = instance.SetVCPUsMax(config.VCPUsMax)
+ err = c.GetClient().VM.SetVCPUsMax(c.GetSessionRef(), instance, int(config.VCPUsMax))
if err != nil {
ui.Error(fmt.Sprintf("Error setting VM VCPUs Max=%d: %s", config.VCPUsMax, err.Error()))
return multistep.ActionHalt
}
- err = instance.SetVCPUsAtStartup(config.VCPUsAtStartup)
+ err = c.GetClient().VM.SetVCPUsAtStartup(c.GetSessionRef(), instance, int(config.VCPUsAtStartup))
if err != nil {
ui.Error(fmt.Sprintf("Error setting VM VCPUs At Startup=%d: %s", config.VCPUsAtStartup, err.Error()))
return multistep.ActionHalt
}
- err = instance.SetStaticMemoryRange(uint64(config.VMMemory*1024*1024), uint64(config.VMMemory*1024*1024))
+ memory := int(config.VMMemory * 1024 * 1024)
+ err = c.GetClient().VM.SetMemoryLimits(c.GetSessionRef(), instance, memory, memory, memory, memory)
if err != nil {
- ui.Error(fmt.Sprintf("Error setting VM memory=%d: %s", config.VMMemory*1024*1024, err.Error()))
+ ui.Error(fmt.Sprintf("Error setting VM memory=%d: %s", memory, err.Error()))
return multistep.ActionHalt
}
- err = instance.SetPlatform(config.PlatformArgs)
+ err = c.GetClient().VM.SetPlatform(c.GetSessionRef(), instance, config.PlatformArgs)
if err != nil {
ui.Error(fmt.Sprintf("Error setting VM platform: %s", err.Error()))
return multistep.ActionHalt
}
- err = instance.SetDescription(config.VMDescription)
+ err = c.GetClient().VM.SetNameDescription(c.GetSessionRef(), instance, config.VMDescription)
if err != nil {
ui.Error(fmt.Sprintf("Error setting VM description: %s", err.Error()))
return multistep.ActionHalt
}
if len(config.VMOtherConfig) != 0 {
- vm_other_config, err := instance.GetOtherConfig()
+ vm_other_config, err := c.GetClient().VM.GetOtherConfig(c.GetSessionRef(), instance)
if err != nil {
ui.Error(fmt.Sprintf("Error getting VM other-config: %s", err.Error()))
return multistep.ActionHalt
@@ -89,29 +94,47 @@ func (self *stepCreateInstance) Run(state multistep.StateBag) multistep.StepActi
for key, value := range config.VMOtherConfig {
vm_other_config[key] = value
}
- err = instance.SetOtherConfig(vm_other_config)
+ err = c.GetClient().VM.SetOtherConfig(c.GetSessionRef(), instance, vm_other_config)
if err != nil {
ui.Error(fmt.Sprintf("Error setting VM other-config: %s", err.Error()))
return multistep.ActionHalt
}
}
+ err = c.GetClient().VM.RemoveFromOtherConfig(c.GetSessionRef(), instance, "disks")
+ if err != nil {
+ ui.Error(fmt.Sprintf("Error removing disks from VM other-config: %s", err.Error()))
+ return multistep.ActionHalt
+ }
+
// Create VDI for the instance
+ sr, err := config.GetSR(c)
- sr, err := config.GetSR(client)
if err != nil {
ui.Error(fmt.Sprintf("Unable to get SR: %s", err.Error()))
return multistep.ActionHalt
}
- vdi, err := sr.CreateVdi("Packer-disk", int64(config.DiskSize*1024*1024))
+ ui.Say(fmt.Sprintf("Using the following SR for the VM: %s", sr))
+
+ vdi, err := c.GetClient().VDI.Create(c.GetSessionRef(), xenapi.VDIRecord{
+ NameLabel: "Packer-disk",
+ VirtualSize: int(config.DiskSize * 1024 * 1024),
+ Type: "user",
+ Sharable: false,
+ ReadOnly: false,
+ SR: sr,
+ OtherConfig: map[string]string{
+ "temp": "temp",
+ },
+ })
if err != nil {
ui.Error(fmt.Sprintf("Unable to create packer disk VDI: %s", err.Error()))
return multistep.ActionHalt
}
- self.vdi = vdi
+ self.vdi = &vdi
- err = instance.ConnectVdi(vdi, xsclient.Disk, "")
+ err = xscommon.ConnectVdi(c, instance, vdi, xsclient.VbdTypeDisk)
if err != nil {
ui.Error(fmt.Sprintf("Unable to connect packer disk VDI: %s", err.Error()))
return multistep.ActionHalt
@@ -119,15 +142,12 @@ func (self *stepCreateInstance) Run(state multistep.StateBag) multistep.StepActi
// Connect Network
- var network *xsclient.Network
+ var network xsclient.NetworkRef
if len(config.NetworkNames) == 0 {
// No network has be specified. Use the management interface
- network = new(xsclient.Network)
- network.Ref = ""
- network.Client = &client
-
- pifs, err := client.GetPIFs()
+ log.Println("No network name given, attempting to use management interface")
+ pifs, err := c.GetClient().PIF.GetAll(c.GetSessionRef())
if err != nil {
ui.Error(fmt.Sprintf("Error getting PIFs: %s", err.Error()))
@@ -135,34 +155,37 @@ func (self *stepCreateInstance) Run(state multistep.StateBag) multistep.StepActi
}
for _, pif := range pifs {
- pif_rec, err := pif.GetRecord()
+ pif_rec, err := c.GetClient().PIF.GetRecord(c.GetSessionRef(), pif)
if err != nil {
ui.Error(fmt.Sprintf("Error getting PIF record: %s", err.Error()))
return multistep.ActionHalt
}
- if pif_rec["management"].(bool) {
- network.Ref = pif_rec["network"].(string)
+ if pif_rec.Management {
+ network = pif_rec.Network
}
}
- if network.Ref == "" {
+ if string(network) == "" {
ui.Error("Error: couldn't find management network. Aborting.")
return multistep.ActionHalt
}
- _, err = instance.ConnectNetwork(network, "0")
+ log.Printf("Creating VIF on network '%s' on VM '%s'\n", network, instance)
+ _, err = xscommon.ConnectNetwork(c, network, instance, "0")
if err != nil {
- ui.Say(err.Error())
+ ui.Error(fmt.Sprintf("Failed to create VIF with error: %v", err))
+ return multistep.ActionHalt
}
} else {
+ log.Printf("Using provided network names: %v\n", config.NetworkNames)
// Look up each network by it's name label
for i, networkNameLabel := range config.NetworkNames {
- networks, err := client.GetNetworkByNameLabel(networkNameLabel)
+ networks, err := c.GetClient().Network.GetByNameLabel(c.GetSessionRef(), networkNameLabel)
if err != nil {
ui.Error(fmt.Sprintf("Error occured getting Network by name-label: %s", err.Error()))
@@ -180,15 +203,15 @@ func (self *stepCreateInstance) Run(state multistep.StateBag) multistep.StepActi
//we need the VIF index string
vifIndexString := fmt.Sprintf("%d", i)
- _, err = instance.ConnectNetwork(networks[0], vifIndexString)
+ _, err = xscommon.ConnectNetwork(c, networks[0], instance, vifIndexString)
if err != nil {
- ui.Say(err.Error())
+ ui.Say(fmt.Sprintf("Failed to connect VIF with error: %v", err.Error()))
}
}
}
- instanceId, err := instance.GetUuid()
+ instanceId, err := c.GetClient().VM.GetUUID(c.GetSessionRef(), instance)
if err != nil {
ui.Error(fmt.Sprintf("Unable to get VM UUID: %s", err.Error()))
return multistep.ActionHalt
@@ -201,17 +224,18 @@ func (self *stepCreateInstance) Run(state multistep.StateBag) multistep.StepActi
}
func (self *stepCreateInstance) Cleanup(state multistep.StateBag) {
- config := state.Get("config").(config)
+ config := state.Get("config").(xscommon.Config)
if config.ShouldKeepVM(state) {
return
}
ui := state.Get("ui").(packer.Ui)
+ c := state.Get("client").(*xscommon.Connection)
if self.instance != nil {
ui.Say("Destroying VM")
- _ = self.instance.HardShutdown() // redundant, just in case
- err := self.instance.Destroy()
+ _ = c.GetClient().VM.HardShutdown(c.GetSessionRef(), *self.instance) // redundant, just in case
+ err := c.GetClient().VM.Destroy(c.GetSessionRef(), *self.instance)
if err != nil {
ui.Error(err.Error())
}
@@ -219,7 +243,7 @@ func (self *stepCreateInstance) Cleanup(state multistep.StateBag) {
if self.vdi != nil {
ui.Say("Destroying VDI")
- err := self.vdi.Destroy()
+ err := c.GetClient().VDI.Destroy(c.GetSessionRef(), *self.vdi)
if err != nil {
ui.Error(err.Error())
}
diff --git a/builder/xenserver/xva/builder.go b/builder/xenserver/xva/builder.go
index d5781ab5..00235d23 100644
--- a/builder/xenserver/xva/builder.go
+++ b/builder/xenserver/xva/builder.go
@@ -1,41 +1,30 @@
package xva
import (
+ "context"
"errors"
"fmt"
- "log"
"time"
- "github.com/mitchellh/multistep"
- "github.com/mitchellh/packer/common"
- "github.com/mitchellh/packer/helper/communicator"
- hconfig "github.com/mitchellh/packer/helper/config"
- "github.com/mitchellh/packer/packer"
- "github.com/mitchellh/packer/template/interpolate"
- xsclient "github.com/xenserver/go-xenserver-client"
+ "github.com/hashicorp/hcl/v2/hcldec"
+ "github.com/hashicorp/packer-plugin-sdk/communicator"
+ "github.com/hashicorp/packer-plugin-sdk/multistep"
+ commonsteps "github.com/hashicorp/packer-plugin-sdk/multistep/commonsteps"
+ "github.com/hashicorp/packer-plugin-sdk/packer"
+ hconfig "github.com/hashicorp/packer-plugin-sdk/template/config"
+ "github.com/hashicorp/packer-plugin-sdk/template/interpolate"
+ xsclient "github.com/terra-farm/go-xen-api-client"
xscommon "github.com/xenserver/packer-builder-xenserver/builder/xenserver/common"
)
-type config struct {
- common.PackerConfig `mapstructure:",squash"`
- xscommon.CommonConfig `mapstructure:",squash"`
-
- SourcePath string `mapstructure:"source_path"`
- VCPUsMax uint `mapstructure:"vcpus_max"`
- VCPUsAtStartup uint `mapstructure:"vcpus_atstartup"`
- VMMemory uint `mapstructure:"vm_memory"`
-
- PlatformArgs map[string]string `mapstructure:"platform_args"`
-
- ctx interpolate.Context
-}
-
type Builder struct {
- config config
+ config xscommon.Config
runner multistep.Runner
}
-func (self *Builder) Prepare(raws ...interface{}) (params []string, retErr error) {
+func (self *Builder) ConfigSpec() hcldec.ObjectSpec { return self.config.FlatMapstructure().HCL2Spec() }
+
+func (self *Builder) Prepare(raws ...interface{}) (params []string, warns []string, retErr error) {
var errs *packer.MultiError
@@ -53,7 +42,7 @@ func (self *Builder) Prepare(raws ...interface{}) (params []string, retErr error
}
errs = packer.MultiErrorAppend(
- errs, self.config.CommonConfig.Prepare(&self.config.ctx, &self.config.PackerConfig)...)
+ errs, self.config.CommonConfig.Prepare(self.config.GetInterpContext(), &self.config.PackerConfig)...)
// Set default values
if self.config.VCPUsMax == 0 {
@@ -93,27 +82,26 @@ func (self *Builder) Prepare(raws ...interface{}) (params []string, retErr error
retErr = errors.New(errs.Error())
}
- return nil, retErr
+ return nil, nil, retErr
}
-func (self *Builder) Run(ui packer.Ui, hook packer.Hook, cache packer.Cache) (packer.Artifact, error) {
+func (self *Builder) Run(ctx context.Context, ui packer.Ui, hook packer.Hook) (packer.Artifact, error) {
//Setup XAPI client
- client := xsclient.NewXenAPIClient(self.config.HostIp, self.config.Username, self.config.Password)
+ c, err := xscommon.NewXenAPIClient(self.config.HostIp, self.config.Username, self.config.Password)
- err := client.Login()
if err != nil {
- return nil, err.(error)
+ return nil, err
}
+
ui.Say("XAPI client session established")
- client.GetHosts()
+ c.GetClient().Host.GetAll(c.GetSessionRef())
//Share state between the other steps using a statebag
state := new(multistep.BasicStateBag)
- state.Put("cache", cache)
- state.Put("client", client)
- state.Put("config", self.config)
+ state.Put("client", c)
+ // state.Put("config", self.config)
state.Put("commonconfig", self.config.CommonConfig)
state.Put("hook", hook)
state.Put("ui", ui)
@@ -126,7 +114,7 @@ func (self *Builder) Run(ui packer.Ui, hook packer.Hook, cache packer.Cache) (pa
Force: self.config.PackerForce,
Path: self.config.OutputDir,
},
- &common.StepCreateFloppy{
+ &commonsteps.StepCreateFloppy{
Files: self.config.FloppyFiles,
},
new(xscommon.StepHTTPServer),
@@ -149,44 +137,29 @@ func (self *Builder) Run(ui packer.Ui, hook packer.Hook, cache packer.Cache) (pa
new(stepImportInstance),
&xscommon.StepAttachVdi{
VdiUuidKey: "floppy_vdi_uuid",
- VdiType: xsclient.Floppy,
+ VdiType: xsclient.VbdTypeFloppy,
},
&xscommon.StepAttachVdi{
VdiUuidKey: "tools_vdi_uuid",
- VdiType: xsclient.CD,
+ VdiType: xsclient.VbdTypeCD,
},
new(xscommon.StepStartVmPaused),
new(xscommon.StepSetVmHostSshAddress),
- new(xscommon.StepGetVNCPort),
- &xscommon.StepForwardPortOverSSH{
- RemotePort: xscommon.InstanceVNCPort,
- RemoteDest: xscommon.InstanceVNCIP,
- HostPortMin: self.config.HostPortMin,
- HostPortMax: self.config.HostPortMax,
- ResultKey: "local_vnc_port",
- },
new(xscommon.StepBootWait),
&xscommon.StepTypeBootCommand{
- Ctx: self.config.ctx,
+ Ctx: *self.config.GetInterpContext(),
},
&xscommon.StepWaitForIP{
Chan: httpReqChan,
Timeout: 300 * time.Minute, /*self.config.InstallTimeout*/ // @todo change this
},
- &xscommon.StepForwardPortOverSSH{
- RemotePort: xscommon.InstanceSSHPort,
- RemoteDest: xscommon.InstanceSSHIP,
- HostPortMin: self.config.HostPortMin,
- HostPortMax: self.config.HostPortMax,
- ResultKey: "local_ssh_port",
- },
&communicator.StepConnect{
Config: &self.config.SSHConfig.Comm,
Host: xscommon.CommHost,
SSHConfig: xscommon.SSHConfigFunc(self.config.CommonConfig.SSHConfig),
SSHPort: xscommon.SSHPort,
},
- new(common.StepProvision),
+ new(commonsteps.StepProvision),
new(xscommon.StepShutdown),
&xscommon.StepDetachVdi{
VdiUuidKey: "floppy_vdi_uuid",
@@ -198,7 +171,7 @@ func (self *Builder) Run(ui packer.Ui, hook packer.Hook, cache packer.Cache) (pa
}
self.runner = &multistep.BasicRunner{Steps: steps}
- self.runner.Run(state)
+ self.runner.Run(ctx, state)
if rawErr, ok := state.GetOk("error"); ok {
return nil, rawErr.(error)
@@ -216,11 +189,3 @@ func (self *Builder) Run(ui packer.Ui, hook packer.Hook, cache packer.Cache) (pa
return artifact, nil
}
-
-func (self *Builder) Cancel() {
- if self.runner != nil {
- log.Println("Cancelling the step runner...")
- self.runner.Cancel()
- }
- fmt.Println("Cancelling the builder")
-}
diff --git a/builder/xenserver/xva/builder_test.go b/builder/xenserver/xva/builder_test.go
index 0ac71b35..03e029f2 100644
--- a/builder/xenserver/xva/builder_test.go
+++ b/builder/xenserver/xva/builder_test.go
@@ -1,8 +1,9 @@
package xva
import (
- "github.com/mitchellh/packer/packer"
"testing"
+
+ "github.com/hashicorp/packer-plugin-sdk/packer"
)
func testConfig() map[string]interface{} {
@@ -30,7 +31,7 @@ func TestBuilder_ImplementsBuilder(t *testing.T) {
func TestBuilderPrepare_Defaults(t *testing.T) {
var b Builder
config := testConfig()
- warns, err := b.Prepare(config)
+ _, warns, err := b.Prepare(config)
if len(warns) > 0 {
t.Fatalf("bad: %#v", warns)
}
@@ -61,7 +62,7 @@ func TestBuilderPrepare_Format(t *testing.T) {
// Bad
config["format"] = "foo"
- warns, err := b.Prepare(config)
+ _, warns, err := b.Prepare(config)
if len(warns) > 0 {
t.Fatalf("bad: %#v", warns)
}
@@ -72,7 +73,7 @@ func TestBuilderPrepare_Format(t *testing.T) {
// Good
config["format"] = "vdi_raw"
b = Builder{}
- warns, err = b.Prepare(config)
+ _, warns, err = b.Prepare(config)
if len(warns) > 0 {
t.Fatalf("bad: %#v", warns)
}
@@ -88,7 +89,7 @@ func TestBuilderPrepare_HTTPPort(t *testing.T) {
// Bad
config["http_port_min"] = 1000
config["http_port_max"] = 500
- warns, err := b.Prepare(config)
+ _, warns, err := b.Prepare(config)
if len(warns) > 0 {
t.Fatalf("bad: %#v", warns)
}
@@ -99,7 +100,7 @@ func TestBuilderPrepare_HTTPPort(t *testing.T) {
// Bad
config["http_port_min"] = -500
b = Builder{}
- warns, err = b.Prepare(config)
+ _, warns, err = b.Prepare(config)
if len(warns) > 0 {
t.Fatalf("bad: %#v", warns)
}
@@ -111,7 +112,7 @@ func TestBuilderPrepare_HTTPPort(t *testing.T) {
config["http_port_min"] = 500
config["http_port_max"] = 1000
b = Builder{}
- warns, err = b.Prepare(config)
+ _, warns, err = b.Prepare(config)
if len(warns) > 0 {
t.Fatalf("bad: %#v", warns)
}
@@ -126,7 +127,7 @@ func TestBuilderPrepare_InvalidKey(t *testing.T) {
// Add a random key
config["i_should_not_be_valid"] = true
- warns, err := b.Prepare(config)
+ _, warns, err := b.Prepare(config)
if len(warns) > 0 {
t.Fatalf("bad: %#v", warns)
}
@@ -141,7 +142,7 @@ func TestBuilderPrepare_KeepVM(t *testing.T) {
// Bad
config["keep_vm"] = "foo"
- warns, err := b.Prepare(config)
+ _, warns, err := b.Prepare(config)
if len(warns) > 0 {
t.Fatalf("bad: %#v", warns)
}
@@ -152,7 +153,7 @@ func TestBuilderPrepare_KeepVM(t *testing.T) {
// Good
config["keep_vm"] = "always"
b = Builder{}
- warns, err = b.Prepare(config)
+ _, warns, err = b.Prepare(config)
if len(warns) > 0 {
t.Fatalf("bad: %#v", warns)
}
@@ -167,7 +168,7 @@ func TestBuilderPrepare_SourcePath(t *testing.T) {
// Bad
config["source_path"] = ""
- warns, err := b.Prepare(config)
+ _, warns, err := b.Prepare(config)
if len(warns) > 0 {
t.Fatalf("bad: %#v", warns)
}
@@ -178,7 +179,7 @@ func TestBuilderPrepare_SourcePath(t *testing.T) {
// Good
config["source_path"] = "."
b = Builder{}
- warns, err = b.Prepare(config)
+ _, warns, err = b.Prepare(config)
if len(warns) > 0 {
t.Fatalf("bad: %#v", warns)
}
diff --git a/builder/xenserver/xva/step_import_instance.go b/builder/xenserver/xva/step_import_instance.go
index 5d7078a5..54215fa2 100644
--- a/builder/xenserver/xva/step_import_instance.go
+++ b/builder/xenserver/xva/step_import_instance.go
@@ -1,30 +1,32 @@
package xva
import (
+ "context"
"fmt"
"os"
- "github.com/mitchellh/multistep"
- "github.com/mitchellh/packer/packer"
- xsclient "github.com/xenserver/go-xenserver-client"
+ "github.com/hashicorp/packer-plugin-sdk/multistep"
+ "github.com/hashicorp/packer-plugin-sdk/packer"
+ xsclient "github.com/terra-farm/go-xen-api-client"
xscommon "github.com/xenserver/packer-builder-xenserver/builder/xenserver/common"
)
type stepImportInstance struct {
- instance *xsclient.VM
- vdi *xsclient.VDI
+ instance xsclient.VMRef
+ vdi xsclient.VDIRef
}
-func (self *stepImportInstance) Run(state multistep.StateBag) multistep.StepAction {
+func (self *stepImportInstance) Run(ctx context.Context, state multistep.StateBag) multistep.StepAction {
- client := state.Get("client").(xsclient.XenAPIClient)
- config := state.Get("config").(config)
+ c := state.Get("client").(*xscommon.Connection)
+ config := state.Get("config").(xscommon.Config)
ui := state.Get("ui").(packer.Ui)
ui.Say("Step: Import Instance")
// find the SR
- sr, err := config.GetSR(client)
+ srs, err := c.GetClient().SR.GetAll(c.GetSessionRef())
+ sr := srs[0]
if err != nil {
ui.Error(fmt.Sprintf("Unable to get SR: %s", err.Error()))
return multistep.ActionHalt
@@ -38,41 +40,41 @@ func (self *stepImportInstance) Run(state multistep.StateBag) multistep.StepActi
}
result, err := xscommon.HTTPUpload(fmt.Sprintf("https://%s/import?session_id=%s&sr_id=%s",
- client.Host,
- client.Session.(string),
- sr.Ref,
+ c.Host,
+ c.GetSession(),
+ sr,
), fh, state)
if err != nil {
ui.Error(fmt.Sprintf("Unable to upload VDI: %s", err.Error()))
return multistep.ActionHalt
}
- if result == nil {
+ if result == "" {
ui.Error("XAPI did not reply with an instance reference")
return multistep.ActionHalt
}
- instance := xsclient.VM(*result)
+ instance := xsclient.VMRef(result)
- instanceId, err := instance.GetUuid()
+ instanceId, err := c.GetClient().VM.GetUUID(c.GetSessionRef(), instance)
if err != nil {
ui.Error(fmt.Sprintf("Unable to get VM UUID: %s", err.Error()))
return multistep.ActionHalt
}
state.Put("instance_uuid", instanceId)
- err = instance.SetVCPUsMax(config.VCPUsMax)
+ err = c.GetClient().VM.SetVCPUsMax(c.GetSessionRef(), instance, int(config.VCPUsMax))
if err != nil {
ui.Error(fmt.Sprintf("Error setting VM VCPUs Max=%d: %s", config.VCPUsMax, err.Error()))
return multistep.ActionHalt
}
- err = instance.SetVCPUsAtStartup(config.VCPUsAtStartup)
+ err = c.GetClient().VM.SetVCPUsAtStartup(c.GetSessionRef(), instance, int(config.VCPUsAtStartup))
if err != nil {
ui.Error(fmt.Sprintf("Error setting VM VCPUs At Startup=%d: %s", config.VCPUsAtStartup, err.Error()))
return multistep.ActionHalt
}
- instance.SetDescription(config.VMDescription)
+ err = c.GetClient().VM.SetNameDescription(c.GetSessionRef(), instance, config.VMDescription)
if err != nil {
ui.Error(fmt.Sprintf("Error setting VM description: %s", err.Error()))
return multistep.ActionHalt
diff --git a/docs/builders/xenserver-iso.html.markdown b/docs/builders/iso/xenserver-iso.html.markdown
similarity index 82%
rename from docs/builders/xenserver-iso.html.markdown
rename to docs/builders/iso/xenserver-iso.html.markdown
index 8afe06be..9c62c3f2 100644
--- a/docs/builders/xenserver-iso.html.markdown
+++ b/docs/builders/iso/xenserver-iso.html.markdown
@@ -2,7 +2,7 @@
layout: "docs"
page_title: "XenServer Builder (from an ISO)"
description: |-
- The XenServer Packer builder is able to create XenServer virtual machines and export them either as an XVA or a VDI, starting from an ISO image.
+ The XenServer Packer builder is able to create XenServer virtual machines and export them either as an XVA or a VDI and create VM templates starting from an ISO image.
---
# XenServer Builder (from an ISO)
@@ -10,8 +10,7 @@ description: |-
Type: `xenserver-iso`
The XenServer Packer builder is able to create [XenServer](https://www.xenserver.org/)
-virtual machines and export them either as an XVA or a VDI, starting from an
-ISO image.
+virtual machines and export them either as an XVA or a VDI and create VM templates starting from an ISO image.
The builder builds a virtual machine by creating a new virtual machine
from scratch, booting it, installing an OS, provisioning software within
@@ -19,32 +18,6 @@ the OS, then shutting it down. The result of the XenServer builder is a
directory containing all the files necessary to run the virtual machine
portably.
-## Basic Example
-
-Here is a basic example. This example is not functional. Even when the
-`remote_*` fields have been completed, it will start the OS installer but then
-fail because we don't provide the preseed file for Ubuntu to self-install.
-Still, the example serves to show the basic configuration:
-
-```javascript
-{
- "type": "xenserver-iso",
- "remote_host": "your-server.example.com",
- "remote_username": "root",
- "remote_password": "password",
- "iso_url": "http://releases.ubuntu.com/12.04/ubuntu-12.04.5-server-amd64.iso",
- "iso_checksum": "769474248a3897f4865817446f9a4a53",
- "iso_checksum_type": "md5",
- "ssh_username": "packer",
- "ssh_password": "packer",
- "ssh_wait_timeout": "30s",
- "shutdown_command": "echo 'packer' | sudo -S shutdown -P now"
-}
-```
-
-It is important to add a `shutdown_command`. By default Packer forcibly halts the
-virtual machine and the file system may not be sync'd. Thus, changes made in a
-provisioner might not be saved.
## Configuration Reference
@@ -70,7 +43,7 @@ each category, the available options are alphabetized and described.
If this is an HTTP URL, Packer will download it and cache it between
runs.
-* `remote_host` (string) - The host of the remote machine.
+* `remote_host` (string) - The host of the Xenserver / XCP-ng pool primary. Typically these will be specified through environment variables as seen in the [examples](../../examples/centos8.json).
* `remote_username` (string) - The XenServer username used to access the remote machine.
@@ -86,7 +59,7 @@ each category, the available options are alphabetized and described.
be to type just enough to initialize the operating system installer. Special
keys can be typed as well, and are covered in the section below on the boot
command. If this is not specified, it is assumed the installer will start
- itself.
+ itself. See the [Ubuntu](../../examples/ubuntu-2004.json) and [centos](../../examples/centos8.json) examples to see how these are used to launch autoinstall and kickstart respectively.
* `boot_wait` (string) - The time to wait after booting the initial virtual
machine before typing the `boot_command`. The value of this should be
@@ -151,6 +124,10 @@ each category, the available options are alphabetized and described.
regardless of success. "on_success" requests that the VM only be cleaned up if an
artifact was produced. The latter is useful for debugging templates that fail.
+* `network_names` (array of strings) - A list of networks identified by their name label which
+ will be used for the VM during creation. The first network will correspond to the VM's
+ first network interface (VIF), the second will corespond to the second VIF and so on.
+
* `output_directory` (string) - This is the path to the directory where the
resulting virtual machine will be created. This may be relative or absolute.
If relative, the path is relative to the working directory when `packer`
@@ -173,13 +150,9 @@ each category, the available options are alphabetized and described.
```
* `shutdown_command` (string) - The command to use to gracefully shut down
- the machine once all the provisioning is done. By default this is an empty
- string, which tells Packer to just forcefully shut down the machine.
-
-* `shutdown_timeout` (string) - The amount of time to wait after executing
- the `shutdown_command` for the virtual machine to actually shut down.
- If it doesn't shut down in this time, it is an error. By default, the timeout
- is "5m", or five minutes.
+ the machine once all the provisioning is done. If this is omitted, packer
+ will shut down the VM gracefully through the Xen api's vm shutdown command. Unless
+ you have special requirements this should typically be left to its default.
* `ssh_host_port_min` and `ssh_host_port_max` (integer) - The minimum and
maximum port to use for the SSH port on the host machine which is forwarded
@@ -271,7 +244,7 @@ will be replaced by the proper key:
is useful if you have to generally wait for the UI to update before typing more.
In addition to the special keys, each command to type is treated as a
-[configuration template](/docs/templates/configuration-templates.html).
+configuration template.
The available variables are:
* `HTTPIP` and `HTTPPort` - The IP and port, respectively of an HTTP server
@@ -279,19 +252,4 @@ The available variables are:
configuration parameter. If `http_directory` isn't specified, these will be
blank!
-Example boot command. This is actually a working boot command used to start
-an Ubuntu 12.04 installer:
-
-```javascript
-[
- "<esc><esc><enter><wait>",
- "/install/vmlinuz noapic ",
- "preseed/url=http://{{ .HTTPIP }}:{{ .HTTPPort }}/preseed.cfg ",
- "debian-installer=en_US auto locale=en_US kbd-chooser/method=us ",
- "hostname={{ .Name }} ",
- "fb=false debconf/frontend=noninteractive ",
- "keyboard-configuration/modelcode=SKIP keyboard-configuration/layout=USA ",
- "keyboard-configuration/variant=USA console-setup/ask_detect=false ",
- "initrd=/install/initrd.gz -- <enter>"
-]
-```
+See the [examples](../../examples/) for working boot commands.
diff --git a/examples/README.md b/examples/README.md
new file mode 100644
index 00000000..ede7545e
--- /dev/null
+++ b/examples/README.md
@@ -0,0 +1,36 @@
+## Examples
+
+In order for new users to get up and running with the packer builder, a few examples of building a machine image with popular distros have been created.
+
+In order to see an exhaustive list of configuration options for the packer builder please see the [following documentation](../docs/builders/xenserver-iso.html.markdown). This doc will focus on the details relevant to the particular distro.
+
+### Running the examples
+
+In order to run the examples you will need to perform the following steps:
+1. Export those vars:
+```
+PKR_VAR_remote_host
+PKR_VAR_remote_password
+PKR_VAR_remote_username
+PKR_VAR_sr_name
+PKR_VAR_sr_iso_name
+```
+`PKR_VAR_remote_host` must be the resource pool primary, aka the master.
+
+2. Run `packer init path/to/defenition.pkr.hcl` to download the xenserver plugin
+
+2. Run `packer build path/to/defenition.pkr.hcl`
+so for example:
+`packer build examples/centos/centos8-netinstall.pkr.hcl`
+
+### Ubuntu
+
+The Ubuntu example uses the [autoinstall tool](https://ubuntu.com/server/docs/install/autoinstallhttps://ubuntu.com/server/docs/install/autoinstall) to configure the VM template. Please see the [autoinstall docs](https://ubuntu.com/server/docs/install/autoinstall-reference) for an exhaustive list of what is supported.
+
+Packer will create a http server to serve the files as specified from the `http_directory` specified in the builder configuration. This is where the [user-data](http/ubuntu-2004/user-data) and [meta-data](http/ubuntu-2004/meta-data) for autoinstall must be present.
+
+### Centos
+
+The Centos examples use kickstart files to configure the VM template. Please see the [kickstart documentation](https://access.redhat.com/documentation/en-us/red_hat_enterprise_linux/7/html/installation_guide/sect-kickstart-syntax) for the options that are supported.
+
+Packer will create a http server to serve the files as specified from the `http_directory` specified in the builder configuration. This is where the [kickstart config](http/centos8/ks-centos8.cfg) file must be present.
diff --git a/examples/centos-6.6.json b/examples/centos-6.6.json
deleted file mode 100644
index 8eecfc71..00000000
--- a/examples/centos-6.6.json
+++ /dev/null
@@ -1,38 +0,0 @@
-{
- "builders": [
- {
- "type": "xenserver-iso",
- "remote_host": "your-server.example.com",
- "remote_username": "root",
- "remote_password": "password",
-
- "boot_command": [
- " text ks=http://{{ .HTTPIP }}:{{ .HTTPPort }}/centos6-ks.cfg"
- ],
- "boot_wait": "10s",
- "disk_size": 40960,
- "http_directory": "http",
- "iso_checksum": "4ed6c56d365bd3ab12cd88b8a480f4a62e7c66d2",
- "iso_checksum_type": "sha1",
- "iso_url": "{{user `mirror`}}/6.6/isos/x86_64/CentOS-6.6-x86_64-minimal.iso",
- "vm_other_config": {
- "conversionvm":"true"
- },
- "network_names": [
- "Host internal management network",
- "Pool-wide network associated with eth0"
- ],
- "output_directory": "packer-centos-6.6-x86_64-xenserver",
- "shutdown_command": "/sbin/halt",
- "ssh_username": "root",
- "ssh_password": "vmpassword",
- "ssh_wait_timeout": "10000s",
- "vm_name": "packer-centos-6.6-x86_64",
- "vm_description": "Build time: {{isotime}}"
- }
- ],
-
- "variables": {
- "mirror": "http://www.mirrorservice.org/sites/mirror.centos.org"
- }
-}
diff --git a/examples/centos/centos8-local.pkr.hcl b/examples/centos/centos8-local.pkr.hcl
new file mode 100644
index 00000000..c21eb8f7
--- /dev/null
+++ b/examples/centos/centos8-local.pkr.hcl
@@ -0,0 +1,81 @@
+packer {
+ required_plugins {
+ xenserver= {
+ version = ">= v0.3.2"
+ source = "github.com/ddelnano/xenserver"
+ }
+ }
+}
+
+variable "remote_host" {
+ type = string
+ description = "The ip or fqdn of your XenServer. This will be pulled from the env var 'PKR_VAR_remote_host'"
+ sensitive = true
+ default = null
+}
+
+variable "remote_password" {
+ type = string
+ description = "The password used to interact with your XenServer. This will be pulled from the env var 'PKR_VAR_remote_password'"
+ sensitive = true
+ default = null
+}
+
+variable "remote_username" {
+ type = string
+ description = "The username used to interact with your XenServer. This will be pulled from the env var 'PKR_VAR_remote_username'"
+ sensitive = true
+ default = null
+
+}
+
+variable "sr_iso_name" {
+ type = string
+ default = ""
+ description = "The ISO-SR to packer will use"
+
+}
+
+variable "sr_name" {
+ type = string
+ default = ""
+ description = "The name of the SR to packer will use"
+}
+
+locals {
+ timestamp = regex_replace(timestamp(), "[- TZ:]", "")
+}
+
+source "xenserver-iso" "centos8-local" {
+ iso_checksum = "aaf9d4b3071c16dbbda01dfe06085e5d0fdac76df323e3bbe87cce4318052247"
+ iso_checksum_type = "sha1"
+ iso_url = "http://mirrors.ocf.berkeley.edu/centos/8.3.2011/isos/x86_64/CentOS-8.3.2011-x86_64-dvd1.iso"
+
+ sr_iso_name = var.sr_iso_name
+ sr_name = var.sr_name
+ tools_iso_name = "guest-tools.iso"
+
+ remote_host = var.remote_host
+ remote_password = var.remote_password
+ remote_username = var.remote_username
+
+ vm_name = "packer-centos8-local-${local.timestamp}"
+ vm_description = "Build started: ${local.timestamp}\n This was installed from the dvd"
+ vm_memory = 4096
+ disk_size = 4096
+
+ http_directory = "examples/http/centos8"
+ boot_command = [" text ks=http://{{ .HTTPIP }}:{{ .HTTPPort }}/ks-centos8-local.cfg"]
+ boot_wait = "10s"
+
+ ssh_username = "root"
+ ssh_password = "centos"
+ ssh_wait_timeout = "10000s"
+
+ output_directory = "packer-centos8-local"
+ keep_vm = "always"
+}
+
+build {
+ sources = ["xenserver-iso.centos8-local"]
+}
diff --git a/examples/centos/centos8-netinstall.pkr.hcl b/examples/centos/centos8-netinstall.pkr.hcl
new file mode 100644
index 00000000..e34d3692
--- /dev/null
+++ b/examples/centos/centos8-netinstall.pkr.hcl
@@ -0,0 +1,81 @@
+packer {
+ required_plugins {
+ xenserver= {
+ version = ">= v0.3.2"
+ source = "github.com/ddelnano/xenserver"
+ }
+ }
+}
+
+variable "remote_host" {
+ type = string
+ description = "The ip or fqdn of your XenServer. This will be pulled from the env var 'PKR_VAR_remote_host'"
+ sensitive = true
+ default = null
+}
+
+variable "remote_password" {
+ type = string
+ description = "The password used to interact with your XenServer. This will be pulled from the env var 'PKR_VAR_remote_password'"
+ sensitive = true
+ default = null
+}
+
+variable "remote_username" {
+ type = string
+ description = "The username used to interact with your XenServer. This will be pulled from the env var 'PKR_VAR_remote_username'"
+ sensitive = true
+ default = null
+
+}
+
+variable "sr_iso_name" {
+ type = string
+ default = ""
+ description = "The ISO-SR to packer will use"
+
+}
+
+variable "sr_name" {
+ type = string
+ default = ""
+ description = "The name of the SR to packer will use"
+}
+
+locals {
+ timestamp = regex_replace(timestamp(), "[- TZ:]", "")
+}
+
+source "xenserver-iso" "centos8-netinstall" {
+ iso_checksum = "07a8e59c42cc086ec4c49bdce4fae5a17b077dea"
+ iso_checksum_type = "sha1"
+ iso_url = "http://mirrors.ocf.berkeley.edu/centos/8.3.2011/isos/x86_64/CentOS-8.3.2011-x86_64-boot.iso"
+
+ sr_iso_name = var.sr_iso_name
+ sr_name = var.sr_name
+ tools_iso_name = "guest-tools.iso"
+
+ remote_host = var.remote_host
+ remote_password = var.remote_password
+ remote_username = var.remote_username
+
+ vm_name = "packer-centos8-netinstall-${local.timestamp}"
+ vm_description = "Build started: ${local.timestamp}\n This was installed with an external repository"
+ vm_memory = 4096
+ disk_size = 4096
+
+ http_directory = "examples/http/centos8"
+ boot_command = [" text ks=http://{{ .HTTPIP }}:{{ .HTTPPort }}/ks-centos8-netinstall.cfg"]
+ boot_wait = "10s"
+
+ ssh_username = "root"
+ ssh_password = "centos"
+ ssh_wait_timeout = "10000s"
+
+ output_directory = "packer-centos8-netinstall"
+ keep_vm = "always"
+}
+
+build {
+ sources = ["xenserver-iso.centos8-netinstall"]
+}
diff --git a/examples/http/centos6-ks.cfg b/examples/http/centos6-ks.cfg
deleted file mode 100644
index 1c9a1652..00000000
--- a/examples/http/centos6-ks.cfg
+++ /dev/null
@@ -1,48 +0,0 @@
-install
-cdrom
-lang en_US.UTF-8
-keyboard us
-unsupported_hardware
-network --bootproto=dhcp
-rootpw --iscrypted $1$DIlig7gp$FuhFdeHj.R1VrEzZsI4uo0
-firewall --disabled
-authconfig --enableshadow --passalgo=sha512
-selinux --permissive
-timezone UTC
-bootloader --location=mbr
-text
-skipx
-zerombr
-clearpart --all --initlabel
-autopart
-auth --useshadow --enablemd5
-firstboot --disabled
-reboot
-
-%packages --ignoremissing
-@Base
-@Core
-@Development Tools
-openssl-devel
-readline-devel
-zlib-devel
-kernel-devel
-vim
-wget
-%end
-
-%post
-yum -y update
-
-# update root certs
-wget -O/etc/pki/tls/certs/ca-bundle.crt http://curl.haxx.se/ca/cacert.pem
-
-# vagrant
-groupadd vagrant -g 999
-useradd vagrant -g vagrant -G wheel -u 900 -s /bin/bash
-echo "vagrant" | passwd --stdin vagrant
-
-# sudo
-echo "vagrant ALL=(ALL) NOPASSWD: ALL" >> /etc/sudoers
-sed -i "s/^.*requiretty/#Defaults requiretty/" /etc/sudoers
-%end
diff --git a/examples/http/centos8/ks-centos8-local.cfg b/examples/http/centos8/ks-centos8-local.cfg
new file mode 100644
index 00000000..a275dea9
--- /dev/null
+++ b/examples/http/centos8/ks-centos8-local.cfg
@@ -0,0 +1,47 @@
+eula --agreed
+lang en-US.UTF-8
+keyboard --vckeymap='de' --xlayouts='de'
+timezone Europe/Berlin
+
+cdrom
+
+text
+skipx
+firstboot --disable
+
+rootpw --plaintext centos
+
+firewall --enabled --ssh
+selinux --enforcing
+
+# Installation logging level
+logging --level=info
+
+network --bootproto=dhcp --device=eth0 --onboot=on
+
+# System bootloader configuration
+bootloader --location=mbr
+zerombr
+clearpart --all
+
+# Disk partitioning information
+part / --asprimary --fstype="ext4" --size=1024 --grow
+
+
+%addon com_redhat_kdump --disable
+%end
+
+%packages --ignoremissing --excludedocs
+openssh-clients
+sudo
+
+# unnecessary firmware
+-aic94xx-firmware*
+-alsa-*
+-ivtv-*
+-iwl*firmware
+%end
+
+# Reboot after installation
+reboot --eject
+
diff --git a/examples/http/centos8/ks-centos8-netinstall.cfg b/examples/http/centos8/ks-centos8-netinstall.cfg
new file mode 100644
index 00000000..c9e7dc7d
--- /dev/null
+++ b/examples/http/centos8/ks-centos8-netinstall.cfg
@@ -0,0 +1,46 @@
+eula --agreed
+lang en-US.UTF-8
+keyboard --vckeymap='de' --xlayouts='de'
+timezone Europe/Berlin
+
+text
+skipx
+firstboot --disable
+
+url --url="http://mirror.centos.org/centos/8.3.2011/BaseOS/x86_64/os/"
+rootpw --plaintext centos
+
+firewall --enabled --ssh
+selinux --enforcing
+
+# Installation logging level
+logging --level=info
+
+network --bootproto=dhcp --device=eth0 --onboot=on
+
+# System bootloader configuration
+bootloader --location=mbr
+zerombr
+clearpart --all
+
+# Disk partitioning information
+part / --asprimary --fstype="ext4" --size=1024 --grow
+
+
+%addon com_redhat_kdump --disable
+%end
+
+%packages --ignoremissing --excludedocs
+openssh-clients
+sudo
+
+# unnecessary firmware
+-aic94xx-firmware*
+-alsa-*
+-ivtv-*
+-iwl*firmware
+%end
+
+# Reboot after installation
+reboot --eject
+
diff --git a/examples/http/ubuntu-2004/meta-data b/examples/http/ubuntu-2004/meta-data
new file mode 100644
index 00000000..e69de29b
diff --git a/examples/http/ubuntu-2004/user-data b/examples/http/ubuntu-2004/user-data
new file mode 100644
index 00000000..9653b71a
--- /dev/null
+++ b/examples/http/ubuntu-2004/user-data
@@ -0,0 +1,22 @@
+#cloud-config
+
+# hack for cloud-init per:
+# https://github.com/leakespeake/packer/blob/3f3e361751b4be9326b66771d96f2519bc8f885e/builders/vmware/vsphere-iso/ubuntu-server-20-04/hcl2/http/ubuntu-server-subiquity/user-data
+runcmd:
+ # to enable true auto-install for Ubuntu 20.04 with cloud-init nocloud (eliminates "Continue with autoinstall?" prompt)
+ - [eval, 'echo $(cat /proc/cmdline) "autoinstall" > /root/cmdline']
+ - [eval, 'mount -n --bind -o ro /root/cmdline /proc/cmdline']
+ - [eval, 'snap restart subiquity.subiquity-service']
+
+autoinstall:
+ version: 1
+ identity:
+ hostname: ubuntu-server
+ # This is the crypted pass of 'ubuntu'
+ password: "$6$exDY1mhS4KUYCE/2$zmn9ToZwTKLhCw.b4/b.ZRTIZM30JZ4QrOQ2aOXJ8yk96xpcCof0kxKwuX1kqLG/ygbJ1f8wxED22bTL4F46P0"
+ username: testuser
+ packages:
+ - xe-guest-utilities
+ ssh:
+ install-server: yes
+ allow-pw: yes
diff --git a/examples/ubuntu/ubuntu-2004.pkr.hcl b/examples/ubuntu/ubuntu-2004.pkr.hcl
new file mode 100644
index 00000000..67238ffb
--- /dev/null
+++ b/examples/ubuntu/ubuntu-2004.pkr.hcl
@@ -0,0 +1,86 @@
+packer {
+ required_plugins {
+ xenserver= {
+ version = ">= v0.3.2"
+ source = "github.com/ddelnano/xenserver"
+ }
+ }
+}
+
+variable "remote_host" {
+ type = string
+ description = "The ip or fqdn of your XenServer. This will be pulled from the env var 'PKR_VAR_XAPI_HOST'"
+ sensitive = true
+ default = null
+}
+
+variable "remote_password" {
+ type = string
+ description = "The password used to interact with your XenServer. This will be pulled from the env var 'PKR_VAR_XAPI_PASSWORD'"
+ sensitive = true
+ default = null
+}
+
+variable "remote_username" {
+ type = string
+ description = "The username used to interact with your XenServer. This will be pulled from the env var 'PKR_VAR_XAPI_USERNAME'"
+ sensitive = true
+ default = null
+
+}
+
+variable "sr_iso_name" {
+ type = string
+ default = ""
+ description = "The ISO-SR to packer will use"
+
+}
+
+variable "sr_name" {
+ type = string
+ default = ""
+ description = "The name of the SR to packer will use"
+}
+
+locals {
+ timestamp = regex_replace(timestamp(), "[- TZ:]", "")
+}
+
+
+source "xenserver-iso" "ubuntu-2004" {
+ iso_checksum = "5035be37a7e9abbdc09f0d257f3e33416c1a0fb322ba860d42d74aa75c3468d4"
+ iso_checksum_type = "sha256"
+ iso_url = "http://releases.ubuntu.com/20.04/ubuntu-20.04.5-live-server-amd64.iso"
+
+ sr_iso_name = var.sr_iso_name
+ sr_name = var.sr_name
+ tools_iso_name = "guest-tools.iso"
+
+ remote_host = var.remote_host
+ remote_password = var.remote_password
+ remote_username = var.remote_username
+
+ # Change this to match the ISO of ubuntu you are using in the iso_url variable
+ clone_template = "Ubuntu Focal Fossa 20.04"
+ vm_name = "packer-ubuntu-2004-${local.timestamp}"
+ vm_description = "Build started: ${local.timestamp}"
+ vm_memory = 4096
+ disk_size = 20000
+
+ floppy_files = [
+ "examples/http/ubuntu-2004/meta-data",
+ "examples/http/ubuntu-2004/user-data",
+ ]
+
+ ssh_username = "testuser"
+ ssh_password = "ubuntu"
+ ssh_wait_timeout = "60000s"
+ ssh_handshake_attempts = 10000
+
+ output_directory = "packer-ubuntu-2004-iso"
+ keep_vm = "always"
+}
+
+build {
+ sources = ["xenserver-iso.ubuntu-2004"]
+}
diff --git a/go.mod b/go.mod
new file mode 100644
index 00000000..84364a8e
--- /dev/null
+++ b/go.mod
@@ -0,0 +1,16 @@
+module github.com/xenserver/packer-builder-xenserver
+
+go 1.16
+
+require (
+ github.com/amfranz/go-xmlrpc-client v0.0.0-20190612172737-76858463955d
+ github.com/hashicorp/hcl/v2 v2.12.0
+ github.com/hashicorp/packer-plugin-sdk v0.3.0
+ github.com/mitchellh/go-vnc v0.0.0-20150629162542-723ed9867aed
+ github.com/niemeyer/pretty v0.0.0-20200227124842-a10e7caefd8e // indirect
+ github.com/stretchr/objx v0.2.0 // indirect
+ github.com/terra-farm/go-xen-api-client v0.0.2
+ github.com/zclconf/go-cty v1.10.0
+ golang.org/x/crypto v0.0.0-20220427172511-eb4f295cb31f
+ gopkg.in/check.v1 v1.0.0-20200227125254-8fa46927fb4f // indirect
+)
diff --git a/go.sum b/go.sum
new file mode 100644
index 00000000..c13b9b5f
--- /dev/null
+++ b/go.sum
@@ -0,0 +1,1026 @@
+bazil.org/fuse v0.0.0-20160811212531-371fbbdaa898/go.mod h1:Xbm+BRKSBEpa4q4hTSxohYNQpsxXPbPry4JJWOB3LB8=
+cloud.google.com/go v0.26.0/go.mod h1:aQUYkXzVsufM+DwF1aE+0xfcU+56JwCaLick0ClmMTw=
+cloud.google.com/go v0.34.0/go.mod h1:aQUYkXzVsufM+DwF1aE+0xfcU+56JwCaLick0ClmMTw=
+cloud.google.com/go v0.38.0/go.mod h1:990N+gfupTy94rShfmMCWGDn0LpTmnzTp2qbd1dvSRU=
+cloud.google.com/go v0.44.1/go.mod h1:iSa0KzasP4Uvy3f1mN/7PiObzGgflwredwwASm/v6AU=
+cloud.google.com/go v0.44.2/go.mod h1:60680Gw3Yr4ikxnPRS/oxxkBccT6SA1yMk63TGekxKY=
+cloud.google.com/go v0.45.1/go.mod h1:RpBamKRgapWJb87xiFSdk4g1CME7QZg3uwTez+TSTjc=
+cloud.google.com/go v0.46.3/go.mod h1:a6bKKbmY7er1mI7TEI4lsAkts/mkhTSZK8w33B4RAg0=
+cloud.google.com/go v0.50.0/go.mod h1:r9sluTvynVuxRIOHXQEHMFffphuXHOMZMycpNR5e6To=
+cloud.google.com/go v0.52.0/go.mod h1:pXajvRH/6o3+F9jDHZWQ5PbGhn+o8w9qiu/CffaVdO4=
+cloud.google.com/go v0.53.0/go.mod h1:fp/UouUEsRkN6ryDKNW/Upv/JBKnv6WDthjR6+vze6M=
+cloud.google.com/go v0.54.0/go.mod h1:1rq2OEkV3YMf6n/9ZvGWI3GWw0VoqH/1x2nd8Is/bPc=
+cloud.google.com/go v0.56.0/go.mod h1:jr7tqZxxKOVYizybht9+26Z/gUq7tiRzu+ACVAMbKVk=
+cloud.google.com/go v0.57.0/go.mod h1:oXiQ6Rzq3RAkkY7N6t3TcE6jE+CIBBbA36lwQ1JyzZs=
+cloud.google.com/go v0.62.0/go.mod h1:jmCYTdRCQuc1PHIIJ/maLInMho30T/Y0M4hTdTShOYc=
+cloud.google.com/go v0.65.0/go.mod h1:O5N8zS7uWy9vkA9vayVHs65eM1ubvY4h553ofrNHObY=
+cloud.google.com/go v0.72.0/go.mod h1:M+5Vjvlc2wnp6tjzE102Dw08nGShTscUx2nZMufOKPI=
+cloud.google.com/go v0.74.0/go.mod h1:VV1xSbzvo+9QJOxLDaJfTjx5e+MePCpCWwvftOeQmWk=
+cloud.google.com/go v0.78.0/go.mod h1:QjdrLG0uq+YwhjoVOLsS1t7TW8fs36kLs4XO5R5ECHg=
+cloud.google.com/go v0.79.0/go.mod h1:3bzgcEeQlzbuEAYu4mrWhKqWjmpprinYgKJLgKHnbb8=
+cloud.google.com/go v0.81.0/go.mod h1:mk/AM35KwGk/Nm2YSeZbxXdrNK3KZOYHmLkOqC2V6E0=
+cloud.google.com/go v0.83.0/go.mod h1:Z7MJUsANfY0pYPdw0lbnivPx4/vhy/e2FEkSkF7vAVY=
+cloud.google.com/go v0.84.0/go.mod h1:RazrYuxIK6Kb7YrzzhPoLmCVzl7Sup4NrbKPg8KHSUM=
+cloud.google.com/go v0.87.0/go.mod h1:TpDYlFy7vuLzZMMZ+B6iRiELaY7z/gJPaqbMx6mlWcY=
+cloud.google.com/go v0.90.0/go.mod h1:kRX0mNRHe0e2rC6oNakvwQqzyDmg57xJ+SZU1eT2aDQ=
+cloud.google.com/go v0.93.3/go.mod h1:8utlLll2EF5XMAV15woO4lSbWQlk8rer9aLOfLh7+YI=
+cloud.google.com/go v0.94.0 h1:QDB2MZHqjTt0hGKnoEWyG/iWykue/lvkLdogLgrg10U=
+cloud.google.com/go v0.94.0/go.mod h1:qAlAugsXlC+JWO+Bke5vCtc9ONxjQT3drlTTnAplMW4=
+cloud.google.com/go/bigquery v1.0.1/go.mod h1:i/xbL2UlR5RvWAURpBYZTtm/cXjCha9lbfbpx4poX+o=
+cloud.google.com/go/bigquery v1.3.0/go.mod h1:PjpwJnslEMmckchkHFfq+HTD2DmtT67aNFKH1/VBDHE=
+cloud.google.com/go/bigquery v1.4.0/go.mod h1:S8dzgnTigyfTmLBfrtrhyYhwRxG72rYxvftPBK2Dvzc=
+cloud.google.com/go/bigquery v1.5.0/go.mod h1:snEHRnqQbz117VIFhE8bmtwIDY80NLUZUMb4Nv6dBIg=
+cloud.google.com/go/bigquery v1.7.0/go.mod h1://okPTzCYNXSlb24MZs83e2Do+h+VXtc4gLoIoXIAPc=
+cloud.google.com/go/bigquery v1.8.0/go.mod h1:J5hqkt3O0uAFnINi6JXValWIb1v0goeZM77hZzJN/fQ=
+cloud.google.com/go/datastore v1.0.0/go.mod h1:LXYbyblFSglQ5pkeyhO+Qmw7ukd3C+pD7TKLgZqpHYE=
+cloud.google.com/go/datastore v1.1.0/go.mod h1:umbIZjpQpHh4hmRpGhH4tLFup+FVzqBi1b3c64qFpCk=
+cloud.google.com/go/pubsub v1.0.1/go.mod h1:R0Gpsv3s54REJCy4fxDixWD93lHJMoZTyQ2kNxGRt3I=
+cloud.google.com/go/pubsub v1.1.0/go.mod h1:EwwdRX2sKPjnvnqCa270oGRyludottCI76h+R3AArQw=
+cloud.google.com/go/pubsub v1.2.0/go.mod h1:jhfEVHT8odbXTkndysNHCcx0awwzvfOlguIAii9o8iA=
+cloud.google.com/go/pubsub v1.3.1/go.mod h1:i+ucay31+CNRpDW4Lu78I4xXG+O1r/MAHgjpRVR+TSU=
+cloud.google.com/go/storage v1.0.0/go.mod h1:IhtSnM/ZTZV8YYJWCY8RULGVqBDmpoyjwiyrjsg+URw=
+cloud.google.com/go/storage v1.5.0/go.mod h1:tpKbwo567HUNpVclU5sGELwQWBDZ8gh0ZeosJ0Rtdos=
+cloud.google.com/go/storage v1.6.0/go.mod h1:N7U0C8pVQ/+NIKOBQyamJIeKQKkZ+mxpohlUTyfDhBk=
+cloud.google.com/go/storage v1.8.0/go.mod h1:Wv1Oy7z6Yz3DshWRJFhqM/UCfaWIRTdp0RXyy7KQOVs=
+cloud.google.com/go/storage v1.10.0/go.mod h1:FLPqc6j+Ki4BU591ie1oL6qBQGu2Bl/tZ9ullr3+Kg0=
+cloud.google.com/go/storage v1.16.1 h1:sMEIc4wxvoY3NXG7Rn9iP7jb/2buJgWR1vNXCR/UPfs=
+cloud.google.com/go/storage v1.16.1/go.mod h1:LaNorbty3ehnU3rEjXSNV/NRgQA0O8Y+uh6bPe5UOk4=
+dmitri.shuralyov.com/gpu/mtl v0.0.0-20190408044501-666a987793e9/go.mod h1:H6x//7gZCb22OMCxBHrMx7a5I7Hp++hsVxbQ4BYO7hU=
+github.com/Azure/go-ansiterm v0.0.0-20170929234023-d6e3b3328b78/go.mod h1:LmzpDX56iTiv29bbRTIsUNlaFfuhWRQBWjQdVyAevI8=
+github.com/Azure/go-ntlmssp v0.0.0-20180810175552-4a21cbd618b4/go.mod h1:chxPXzSsl7ZWRAuOIE23GDNzjWuZquvFlgA8xmpunjU=
+github.com/Azure/go-ntlmssp v0.0.0-20200615164410-66371956d46c h1:/IBSNwUN8+eKzUzbJPqhK839ygXJ82sde8x3ogr6R28=
+github.com/Azure/go-ntlmssp v0.0.0-20200615164410-66371956d46c/go.mod h1:chxPXzSsl7ZWRAuOIE23GDNzjWuZquvFlgA8xmpunjU=
+github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03qcyfWMU=
+github.com/BurntSushi/xgb v0.0.0-20160522181843-27f122750802/go.mod h1:IVnqGOEym/WlBOVXweHU+Q+/VP0lqqI8lqeDx9IjBqo=
+github.com/ChrisTrenkamp/goxpath v0.0.0-20170922090931-c385f95c6022/go.mod h1:nuWgzSkT5PnyOd+272uUmV0dnAnAn42Mk7PiQC5VzN4=
+github.com/ChrisTrenkamp/goxpath v0.0.0-20210404020558-97928f7e12b6 h1:w0E0fgc1YafGEh5cROhlROMWXiNoZqApk2PDN0M1+Ns=
+github.com/ChrisTrenkamp/goxpath v0.0.0-20210404020558-97928f7e12b6/go.mod h1:nuWgzSkT5PnyOd+272uUmV0dnAnAn42Mk7PiQC5VzN4=
+github.com/DataDog/datadog-go v3.2.0+incompatible/go.mod h1:LButxg5PwREeZtORoXG3tL4fMGNddJ+vMq1mwgfaqoQ=
+github.com/Masterminds/goutils v1.1.0/go.mod h1:8cTjp+g8YejhMuvIA5y2vz3BpJxksy863GQaJW2MFNU=
+github.com/Masterminds/goutils v1.1.1/go.mod h1:8cTjp+g8YejhMuvIA5y2vz3BpJxksy863GQaJW2MFNU=
+github.com/Masterminds/semver v1.5.0/go.mod h1:MB6lktGJrhw8PrUyiEoblNEGEQ+RzHPF078ddwwvV3Y=
+github.com/Masterminds/sprig v2.22.0+incompatible/go.mod h1:y6hNFY5UBTIWBxnzTeuNhlNS5hqE0NB0E6fgfo2Br3o=
+github.com/Microsoft/go-winio v0.4.15-0.20190919025122-fc70bd9a86b5/go.mod h1:tTuCMEN+UleMWgg9dVx4Hu52b1bJo+59jBh3ajtinzw=
+github.com/Microsoft/hcsshim v0.8.9/go.mod h1:5692vkUqntj1idxauYlpoINNKeqCiG6Sg38RRsjT5y8=
+github.com/OneOfOne/xxhash v1.2.2/go.mod h1:HSdplMjZKSmBqAxg5vPj2TmRDmfkzw+cTzAElWljhcU=
+github.com/agext/levenshtein v1.2.1/go.mod h1:JEDfjyjHDjOF/1e4FlBE/PkbqA9OfWu2ki2W0IB5558=
+github.com/agext/levenshtein v1.2.3 h1:YB2fHEn0UJagG8T1rrWknE3ZQzWM06O8AMAatNn7lmo=
+github.com/agext/levenshtein v1.2.3/go.mod h1:JEDfjyjHDjOF/1e4FlBE/PkbqA9OfWu2ki2W0IB5558=
+github.com/alecthomas/template v0.0.0-20160405071501-a0175ee3bccc/go.mod h1:LOuyumcjzFXgccqObfd/Ljyb9UuFJ6TxHnclSeseNhc=
+github.com/alecthomas/template v0.0.0-20190718012654-fb15b899a751/go.mod h1:LOuyumcjzFXgccqObfd/Ljyb9UuFJ6TxHnclSeseNhc=
+github.com/alecthomas/units v0.0.0-20151022065526-2efee857e7cf/go.mod h1:ybxpYRFXyAe+OPACYpWeL0wqObRcbAqCMya13uyzqw0=
+github.com/alecthomas/units v0.0.0-20190717042225-c3de453c63f4/go.mod h1:ybxpYRFXyAe+OPACYpWeL0wqObRcbAqCMya13uyzqw0=
+github.com/amfranz/go-xmlrpc-client v0.0.0-20190612172737-76858463955d h1:39lR6Kg+GsvDpLMD2Mb7gkjXmmLexqfr7SPy4iQWDTE=
+github.com/amfranz/go-xmlrpc-client v0.0.0-20190612172737-76858463955d/go.mod h1:2NlXXRCkTbr/vZtUjcHKhbrESE4a3CDqVrgOROB16dg=
+github.com/antchfx/xpath v1.1.11 h1:WOFtK8TVAjLm3lbgqeP0arlHpvCEeTANeWZ/csPpJkQ=
+github.com/antchfx/xpath v1.1.11/go.mod h1:i54GszH55fYfBmoZXapTHN8T8tkcHfRgLyVwwqzXNcs=
+github.com/antchfx/xquery v0.0.0-20180515051857-ad5b8c7a47b0 h1:JaCC8jz0zdMLk2m+qCCVLLLM/PL93p84w4pK3aJWj60=
+github.com/antchfx/xquery v0.0.0-20180515051857-ad5b8c7a47b0/go.mod h1:LzD22aAzDP8/dyiCKFp31He4m2GPjl0AFyzDtZzUu9M=
+github.com/antihax/optional v1.0.0/go.mod h1:uupD/76wgC+ih3iEmQUL+0Ugr19nfwCT1kdvxnR2qWY=
+github.com/apparentlymart/go-dump v0.0.0-20180507223929-23540a00eaa3 h1:ZSTrOEhiM5J5RFxEaFvMZVEAM1KvT1YzbEOwB2EAGjA=
+github.com/apparentlymart/go-dump v0.0.0-20180507223929-23540a00eaa3/go.mod h1:oL81AME2rN47vu18xqj1S1jPIPuN7afo62yKTNn3XMM=
+github.com/apparentlymart/go-textseg v1.0.0 h1:rRmlIsPEEhUTIKQb7T++Nz/A5Q6C9IuX2wFoYVvnCs0=
+github.com/apparentlymart/go-textseg v1.0.0/go.mod h1:z96Txxhf3xSFMPmb5X/1W05FF/Nj9VFpLOpjS5yuumk=
+github.com/apparentlymart/go-textseg/v13 v13.0.0 h1:Y+KvPE1NYz0xl601PVImeQfFyEy6iT90AvPUL1NNfNw=
+github.com/apparentlymart/go-textseg/v13 v13.0.0/go.mod h1:ZK2fH7c4NqDTLtiYLvIkEghdlcqw7yxLeM89kiTRPUo=
+github.com/armon/circbuf v0.0.0-20150827004946-bbbad097214e/go.mod h1:3U/XgcO3hCbHZ8TKRvWD2dDTCfh9M9ya+I9JpbB7O8o=
+github.com/armon/go-metrics v0.0.0-20180917152333-f0300d1749da/go.mod h1:Q73ZrmVTwzkszR9V5SSuryQ31EELlFMUz1kKyl939pY=
+github.com/armon/go-metrics v0.3.0/go.mod h1:zXjbSimjXTd7vOpY8B0/2LpvNvDoXBuplAD+gJD3GYs=
+github.com/armon/go-metrics v0.3.3/go.mod h1:4O98XIr/9W0sxpJ8UaYkvjk10Iff7SnFrb4QAOwNTFc=
+github.com/armon/go-metrics v0.3.9 h1:O2sNqxBdvq8Eq5xmzljcYzAORli6RWCvEym4cJf9m18=
+github.com/armon/go-metrics v0.3.9/go.mod h1:4O98XIr/9W0sxpJ8UaYkvjk10Iff7SnFrb4QAOwNTFc=
+github.com/armon/go-radix v0.0.0-20180808171621-7fddfc383310/go.mod h1:ufUuZ+zHj4x4TnLV4JWEpy2hxWSpsRywHrMgIH9cCH8=
+github.com/armon/go-radix v1.0.0/go.mod h1:ufUuZ+zHj4x4TnLV4JWEpy2hxWSpsRywHrMgIH9cCH8=
+github.com/aws/aws-sdk-go v1.25.37/go.mod h1:KmX6BPdI08NWTb3/sm4ZGu5ShLoqVDhKgpiN924inxo=
+github.com/aws/aws-sdk-go v1.30.8/go.mod h1:5zCpMtNQVjRREroY7sYe8lOMRSxkhG6MZveU8YkpAk0=
+github.com/aws/aws-sdk-go v1.30.27/go.mod h1:5zCpMtNQVjRREroY7sYe8lOMRSxkhG6MZveU8YkpAk0=
+github.com/aws/aws-sdk-go v1.40.34 h1:SBYmodndE2d4AYucuuJnOXk4MD1SFbucoIdpwKVKeSA=
+github.com/aws/aws-sdk-go v1.40.34/go.mod h1:585smgzpB/KqRA+K3y/NL/oYRqQvpNJYvLm+LY1U59Q=
+github.com/beorn7/perks v0.0.0-20180321164747-3a771d992973/go.mod h1:Dwedo/Wpr24TaqPxmxbtue+5NUziq4I4S80YR8gNf3Q=
+github.com/beorn7/perks v1.0.0/go.mod h1:KWe93zE9D1o94FZ5RNwFwVgaQK1VOXiVxmqh+CedLV8=
+github.com/beorn7/perks v1.0.1/go.mod h1:G2ZrVWU2WbWT9wwq4/hrbKbnv/1ERSJQ0ibhJ6rlkpw=
+github.com/bgentry/go-netrc v0.0.0-20140422174119-9fd32a8b3d3d h1:xDfNPAt8lFiC1UJrqV3uuy861HCTo708pDMbjHHdCas=
+github.com/bgentry/go-netrc v0.0.0-20140422174119-9fd32a8b3d3d/go.mod h1:6QX/PXZ00z/TKoufEY6K/a0k6AhaJrQKdFe6OfVXsa4=
+github.com/bgentry/speakeasy v0.1.0/go.mod h1:+zsyZBPWlz7T6j88CTgSN5bM796AkVf0kBD4zp0CCIs=
+github.com/cenkalti/backoff/v3 v3.0.0/go.mod h1:cIeZDE3IrqwwJl6VUwCN6trj1oXrTS4rc0ij+ULvLYs=
+github.com/cenkalti/backoff/v3 v3.2.2 h1:cfUAAO3yvKMYKPrvhDuHSwQnhZNk/RMHKdZqKTxfm6M=
+github.com/cenkalti/backoff/v3 v3.2.2/go.mod h1:cIeZDE3IrqwwJl6VUwCN6trj1oXrTS4rc0ij+ULvLYs=
+github.com/census-instrumentation/opencensus-proto v0.2.1/go.mod h1:f6KPmirojxKA12rnyqOA5BBL4O983OfeGPqjHWSTneU=
+github.com/cespare/xxhash v1.1.0/go.mod h1:XrSqR1VqqWfGrhpAt58auRo0WTKS1nRRg3ghfAqPWnc=
+github.com/cespare/xxhash/v2 v2.1.1/go.mod h1:VGX0DQ3Q6kWi7AoAeZDth3/j3BFtOZR5XLFGgcrjCOs=
+github.com/chzyer/logex v1.1.10/go.mod h1:+Ywpsq7O8HXn0nuIou7OrIPyXbp3wmkHB+jjWRnGsAI=
+github.com/chzyer/readline v0.0.0-20180603132655-2972be24d48e/go.mod h1:nSuG5e5PlCu98SY8svDHJxuZscDgtXS6KTTbou5AhLI=
+github.com/chzyer/test v0.0.0-20180213035817-a1ea475d72b1/go.mod h1:Q3SI9o4m/ZMnBNeIyt5eFwwo7qiLfzFZmjNmxjkiQlU=
+github.com/circonus-labs/circonus-gometrics v2.3.1+incompatible/go.mod h1:nmEj6Dob7S7YxXgwXpfOuvO54S+tGdZdw9fuRZt25Ag=
+github.com/circonus-labs/circonusllhist v0.1.3/go.mod h1:kMXHVDlOchFAehlya5ePtbp5jckzBHf4XRpQvBOLI+I=
+github.com/client9/misspell v0.3.4/go.mod h1:qj6jICC3Q7zFZvVWo7KLAzC3yx5G7kyvSDkc90ppPyw=
+github.com/cncf/udpa/go v0.0.0-20191209042840-269d4d468f6f/go.mod h1:M8M6+tZqaGXZJjfX53e64911xZQV5JYwmTeXPW+k8Sc=
+github.com/cncf/udpa/go v0.0.0-20200629203442-efcf912fb354/go.mod h1:WmhPx2Nbnhtbo57+VJT5O0JRkEi1Wbu0z5j0R8u5Hbk=
+github.com/cncf/udpa/go v0.0.0-20201120205902-5459f2c99403/go.mod h1:WmhPx2Nbnhtbo57+VJT5O0JRkEi1Wbu0z5j0R8u5Hbk=
+github.com/cncf/xds/go v0.0.0-20210312221358-fbca930ec8ed/go.mod h1:eXthEFrGJvWHgFFCl3hGmgk+/aYT6PnTQLykKQRLhEs=
+github.com/containerd/cgroups v0.0.0-20190919134610-bf292b21730f/go.mod h1:OApqhQ4XNSNC13gXIwDjhOQxjWa/NxkwZXJ1EvqT0ko=
+github.com/containerd/console v0.0.0-20180822173158-c12b1e7919c1/go.mod h1:Tj/on1eG8kiEhd0+fhSDzsPAFESxzBBvdyEgyryXffw=
+github.com/containerd/containerd v1.3.2/go.mod h1:bC6axHOhabU15QhwfG7w5PipXdVtMXFTttgp+kVtyUA=
+github.com/containerd/containerd v1.3.4/go.mod h1:bC6axHOhabU15QhwfG7w5PipXdVtMXFTttgp+kVtyUA=
+github.com/containerd/continuity v0.0.0-20190426062206-aaeac12a7ffc/go.mod h1:GL3xCUCBDV3CZiTSEKksMWbLE66hEyuu9qyDOOqM47Y=
+github.com/containerd/continuity v0.0.0-20200709052629-daa8e1ccc0bc/go.mod h1:cECdGN1O8G9bgKTlLhuPJimka6Xb/Gg7vYzCTNVxhvo=
+github.com/containerd/fifo v0.0.0-20190226154929-a9fb20d87448/go.mod h1:ODA38xgv3Kuk8dQz2ZQXpnv/UZZUHUCL7pnLehbXgQI=
+github.com/containerd/go-runc v0.0.0-20180907222934-5a6d9f37cfa3/go.mod h1:IV7qH3hrUgRmyYrtgEeGWJfWbgcHL9CSRruz2Vqcph0=
+github.com/containerd/ttrpc v0.0.0-20190828154514-0e0f228740de/go.mod h1:PvCDdDGpgqzQIzDW1TphrGLssLDZp2GuS+X5DkEJB8o=
+github.com/containerd/typeurl v0.0.0-20180627222232-a93fcdb778cd/go.mod h1:Cm3kwCdlkCfMSHURc+r6fwoGH6/F1hH3S4sg0rLFWPc=
+github.com/coreos/go-systemd v0.0.0-20190321100706-95778dfbb74e/go.mod h1:F5haX7vjVVG0kc13fIWeqUViNPyEJxv/OmvnBo0Yme4=
+github.com/creack/pty v1.1.9/go.mod h1:oKZEueFk5CKHvIhNR5MUki03XCEU+Q6VDXinZuGJ33E=
+github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
+github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c=
+github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
+github.com/docker/distribution v2.7.1+incompatible/go.mod h1:J2gT2udsDAN96Uj4KfcMRqY0/ypR+oyYUYmja8H+y+w=
+github.com/docker/docker v1.4.2-0.20200319182547-c7ad2b866182/go.mod h1:eEKB0N0r5NX/I1kEveEz05bcu8tLC/8azJZsviup8Sk=
+github.com/docker/go-connections v0.4.0/go.mod h1:Gbd7IOopHjR8Iph03tsViu4nIes5XhDvyHbTtUxmeec=
+github.com/docker/go-units v0.4.0/go.mod h1:fgPhTUdO+D/Jk86RDLlptpiXQzgHJF7gydDDbaIK4Dk=
+github.com/dustin/go-humanize v0.0.0-20171111073723-bb3d318650d4/go.mod h1:HtrtbFcZ19U5GC7JDqmcUSB87Iq5E25KnS6fMYU6eOk=
+github.com/dylanmei/iso8601 v0.1.0 h1:812NGQDBcqquTfH5Yeo7lwR0nzx/cKdsmf3qMjPURUI=
+github.com/dylanmei/iso8601 v0.1.0/go.mod h1:w9KhXSgIyROl1DefbMYIE7UVSIvELTbMrCfx+QkYnoQ=
+github.com/dylanmei/winrmtest v0.0.0-20170819153634-c2fbb09e6c08 h1:0bp6/GrNOrTDtSXe9YYGCwf8jp5Fb/b+4a6MTRm4qzY=
+github.com/dylanmei/winrmtest v0.0.0-20170819153634-c2fbb09e6c08/go.mod h1:VBVDFSBXCIW8JaHQpI8lldSKfYaLMzP9oyq6IJ4fhzY=
+github.com/envoyproxy/go-control-plane v0.9.0/go.mod h1:YTl/9mNaCwkRvm6d1a2C3ymFceY/DCBVvsKhRF0iEA4=
+github.com/envoyproxy/go-control-plane v0.9.1-0.20191026205805-5f8ba28d4473/go.mod h1:YTl/9mNaCwkRvm6d1a2C3ymFceY/DCBVvsKhRF0iEA4=
+github.com/envoyproxy/go-control-plane v0.9.4/go.mod h1:6rpuAdCZL397s3pYoYcLgu1mIlRU8Am5FuJP05cCM98=
+github.com/envoyproxy/go-control-plane v0.9.7/go.mod h1:cwu0lG7PUMfa9snN8LXBig5ynNVH9qI8YYLbd1fK2po=
+github.com/envoyproxy/go-control-plane v0.9.9-0.20201210154907-fd9021fe5dad/go.mod h1:cXg6YxExXjJnVBQHBLXeUAgxn2UodCpnH306RInaBQk=
+github.com/envoyproxy/go-control-plane v0.9.9-0.20210217033140-668b12f5399d/go.mod h1:cXg6YxExXjJnVBQHBLXeUAgxn2UodCpnH306RInaBQk=
+github.com/envoyproxy/go-control-plane v0.9.9-0.20210512163311-63b5d3c536b0/go.mod h1:hliV/p42l8fGbc6Y9bQ70uLwIvmJyVE5k4iMKlh8wCQ=
+github.com/envoyproxy/protoc-gen-validate v0.1.0/go.mod h1:iSmxcyjqTsJpI2R4NaDN7+kN2VEUnK/pcBlmesArF7c=
+github.com/fatih/camelcase v1.0.0/go.mod h1:yN2Sb0lFhZJUdVvtELVWefmrXpuZESvPmqwoZc+/fpc=
+github.com/fatih/color v1.7.0/go.mod h1:Zm6kSWBoL9eyXnKyktHP6abPY2pDugNf5KwzbycvMj4=
+github.com/fatih/color v1.9.0/go.mod h1:eQcE1qtQxscV5RaZvpXrrb8Drkc3/DdQ+uUYCNjL+zU=
+github.com/fatih/color v1.12.0 h1:mRhaKNwANqRgUBGKmnI5ZxEk7QXmjQeCcuYFMX2bfcc=
+github.com/fatih/color v1.12.0/go.mod h1:ELkj/draVOlAH/xkhN6mQ50Qd0MPOk5AAr3maGEBuJM=
+github.com/fatih/structs v1.1.0/go.mod h1:9NiDSp5zOcgEDl+j00MP/WkGVPOlPRLejGD8Ga6PJ7M=
+github.com/fatih/structtag v1.2.0/go.mod h1:mBJUNpUnHmRKrKlQQlmCrh5PuhftFbNv8Ys4/aAZl94=
+github.com/frankban/quicktest v1.10.0 h1:Gfh+GAJZOAoKZsIZeZbdn2JF10kN1XHNvjsvQK8gVkE=
+github.com/frankban/quicktest v1.10.0/go.mod h1:ui7WezCLWMWxVWr1GETZY3smRy0G4KWq9vcPtJmFl7Y=
+github.com/fsnotify/fsnotify v1.4.7/go.mod h1:jwhsz4b93w/PPRr/qN1Yymfu8t87LnFCMoQvtojpjFo=
+github.com/ghodss/yaml v1.0.0/go.mod h1:4dBDuWmgqj2HViK6kFavaiC9ZROes6MMH2rRYeMEF04=
+github.com/go-asn1-ber/asn1-ber v1.3.1/go.mod h1:hEBeB/ic+5LoWskz+yKT7vGhhPYkProFKoKdwZRWMe0=
+github.com/go-gl/glfw v0.0.0-20190409004039-e6da0acd62b1/go.mod h1:vR7hzQXu2zJy9AVAgeJqvqgH9Q5CA+iKCZ2gyEVpxRU=
+github.com/go-gl/glfw/v3.3/glfw v0.0.0-20191125211704-12ad95a8df72/go.mod h1:tQ2UAYgL5IevRw8kRxooKSPJfGvJ9fJQFa0TUsXzTg8=
+github.com/go-gl/glfw/v3.3/glfw v0.0.0-20200222043503-6f7a984d4dc4/go.mod h1:tQ2UAYgL5IevRw8kRxooKSPJfGvJ9fJQFa0TUsXzTg8=
+github.com/go-kit/kit v0.8.0/go.mod h1:xBxKIO96dXMWWy0MnWVtmwkA9/13aqxPnvrjFYMA2as=
+github.com/go-kit/kit v0.9.0/go.mod h1:xBxKIO96dXMWWy0MnWVtmwkA9/13aqxPnvrjFYMA2as=
+github.com/go-ldap/ldap/v3 v3.1.3/go.mod h1:3rbOH3jRS2u6jg2rJnKAMLE/xQyCKIveG2Sa/Cohzb8=
+github.com/go-ldap/ldap/v3 v3.1.10/go.mod h1:5Zun81jBTabRaI8lzN7E1JjyEl1g6zI6u9pd8luAK4Q=
+github.com/go-logfmt/logfmt v0.3.0/go.mod h1:Qt1PoO58o5twSAckw1HlFXLmHsOX5/0LbT9GBnD5lWE=
+github.com/go-logfmt/logfmt v0.4.0/go.mod h1:3RMwSq7FuexP4Kalkev3ejPJsZTpXXBr9+V4qmtdjCk=
+github.com/go-sql-driver/mysql v1.5.0/go.mod h1:DCzpHaOWr8IXmIStZouvnhqoel9Qv2LBy8hT2VhHyBg=
+github.com/go-stack/stack v1.8.0/go.mod h1:v0f6uXyyMGvRgIKkXu+yp6POWl0qKG85gN/melR3HDY=
+github.com/go-test/deep v1.0.2-0.20181118220953-042da051cf31/go.mod h1:wGDj63lr65AM2AQyKZd/NYHGb0R+1RLqB8NKt3aSFNA=
+github.com/go-test/deep v1.0.2/go.mod h1:wGDj63lr65AM2AQyKZd/NYHGb0R+1RLqB8NKt3aSFNA=
+github.com/go-test/deep v1.0.3 h1:ZrJSEWsXzPOxaZnFteGEfooLba+ju3FYIbOrS+rQd68=
+github.com/go-test/deep v1.0.3/go.mod h1:wGDj63lr65AM2AQyKZd/NYHGb0R+1RLqB8NKt3aSFNA=
+github.com/godbus/dbus v0.0.0-20190422162347-ade71ed3457e/go.mod h1:bBOAhwG1umN6/6ZUMtDFBMQR8jRg9O75tm9K00oMsK4=
+github.com/gofrs/flock v0.8.1 h1:+gYjHKf32LDeiEEFhQaotPbLuUXjY5ZqxKgXy7n59aw=
+github.com/gofrs/flock v0.8.1/go.mod h1:F1TvTiK9OcQqauNUHlbJvyl9Qa1QvF/gOUDKA14jxHU=
+github.com/gofrs/uuid v3.2.0+incompatible/go.mod h1:b2aQJv3Z4Fp6yNu3cdSllBxTCLRxnplIgP/c0N/04lM=
+github.com/gofrs/uuid v4.0.0+incompatible h1:1SD/1F5pU8p29ybwgQSwpQk+mwdRrXCYuPhW6m+TnJw=
+github.com/gofrs/uuid v4.0.0+incompatible/go.mod h1:b2aQJv3Z4Fp6yNu3cdSllBxTCLRxnplIgP/c0N/04lM=
+github.com/gogo/protobuf v1.1.1/go.mod h1:r8qH/GZQm5c6nD/R0oafs1akxWv10x8SbQlK7atdtwQ=
+github.com/gogo/protobuf v1.2.1/go.mod h1:hp+jE20tsWTFYpLwKvXlhS1hjn+gTNwPg2I6zVXpSg4=
+github.com/gogo/protobuf v1.3.1/go.mod h1:SlYgWuQ5SjCEi6WLHjHCa1yvBfUnHcTbrrZtXPKa29o=
+github.com/golang/glog v0.0.0-20160126235308-23def4e6c14b/go.mod h1:SBH7ygxi8pfUlaOkMMuAQtPIUF8ecWP5IEl/CR7VP2Q=
+github.com/golang/groupcache v0.0.0-20190702054246-869f871628b6/go.mod h1:cIg4eruTrX1D+g88fzRXU5OdNfaM+9IcxsU14FzY7Hc=
+github.com/golang/groupcache v0.0.0-20191227052852-215e87163ea7/go.mod h1:cIg4eruTrX1D+g88fzRXU5OdNfaM+9IcxsU14FzY7Hc=
+github.com/golang/groupcache v0.0.0-20200121045136-8c9f03a8e57e/go.mod h1:cIg4eruTrX1D+g88fzRXU5OdNfaM+9IcxsU14FzY7Hc=
+github.com/golang/groupcache v0.0.0-20210331224755-41bb18bfe9da h1:oI5xCqsCo564l8iNU+DwB5epxmsaqB+rhGL0m5jtYqE=
+github.com/golang/groupcache v0.0.0-20210331224755-41bb18bfe9da/go.mod h1:cIg4eruTrX1D+g88fzRXU5OdNfaM+9IcxsU14FzY7Hc=
+github.com/golang/mock v1.1.1/go.mod h1:oTYuIxOrZwtPieC+H1uAHpcLFnEyAGVDL/k47Jfbm0A=
+github.com/golang/mock v1.2.0/go.mod h1:oTYuIxOrZwtPieC+H1uAHpcLFnEyAGVDL/k47Jfbm0A=
+github.com/golang/mock v1.3.1/go.mod h1:sBzyDLLjw3U8JLTeZvSv8jJB+tU5PVekmnlKIyFUx0Y=
+github.com/golang/mock v1.4.0/go.mod h1:UOMv5ysSaYNkG+OFQykRIcU/QvvxJf3p21QfJ2Bt3cw=
+github.com/golang/mock v1.4.1/go.mod h1:UOMv5ysSaYNkG+OFQykRIcU/QvvxJf3p21QfJ2Bt3cw=
+github.com/golang/mock v1.4.3/go.mod h1:UOMv5ysSaYNkG+OFQykRIcU/QvvxJf3p21QfJ2Bt3cw=
+github.com/golang/mock v1.4.4/go.mod h1:l3mdAwkq5BuhzHwde/uurv3sEJeZMXNpwsxVWU71h+4=
+github.com/golang/mock v1.5.0/go.mod h1:CWnOUgYIOo4TcNZ0wHX3YZCqsaM1I1Jvs6v3mP3KVu8=
+github.com/golang/mock v1.6.0/go.mod h1:p6yTPP+5HYm5mzsMV8JkE6ZKdX+/wYM6Hr+LicevLPs=
+github.com/golang/protobuf v1.1.0/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U=
+github.com/golang/protobuf v1.2.0/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U=
+github.com/golang/protobuf v1.3.1/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U=
+github.com/golang/protobuf v1.3.2/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U=
+github.com/golang/protobuf v1.3.3/go.mod h1:vzj43D7+SQXF/4pzW/hwtAqwc6iTitCiVSaWz5lYuqw=
+github.com/golang/protobuf v1.3.4/go.mod h1:vzj43D7+SQXF/4pzW/hwtAqwc6iTitCiVSaWz5lYuqw=
+github.com/golang/protobuf v1.3.5/go.mod h1:6O5/vntMXwX2lRkT1hjjk0nAC1IDOTvTlVgjlRvqsdk=
+github.com/golang/protobuf v1.4.0-rc.1/go.mod h1:ceaxUfeHdC40wWswd/P6IGgMaK3YpKi5j83Wpe3EHw8=
+github.com/golang/protobuf v1.4.0-rc.1.0.20200221234624-67d41d38c208/go.mod h1:xKAWHe0F5eneWXFV3EuXVDTCmh+JuBKY0li0aMyXATA=
+github.com/golang/protobuf v1.4.0-rc.2/go.mod h1:LlEzMj4AhA7rCAGe4KMBDvJI+AwstrUpVNzEA03Pprs=
+github.com/golang/protobuf v1.4.0-rc.4.0.20200313231945-b860323f09d0/go.mod h1:WU3c8KckQ9AFe+yFwt9sWVRKCVIyN9cPHBJSNnbL67w=
+github.com/golang/protobuf v1.4.0/go.mod h1:jodUvKwWbYaEsadDk5Fwe5c77LiNKVO9IDvqG2KuDX0=
+github.com/golang/protobuf v1.4.1/go.mod h1:U8fpvMrcmy5pZrNK1lt4xCsGvpyWQ/VVv6QDs8UjoX8=
+github.com/golang/protobuf v1.4.2/go.mod h1:oDoupMAO8OvCJWAcko0GGGIgR6R6ocIYbsSw735rRwI=
+github.com/golang/protobuf v1.4.3/go.mod h1:oDoupMAO8OvCJWAcko0GGGIgR6R6ocIYbsSw735rRwI=
+github.com/golang/protobuf v1.5.0/go.mod h1:FsONVRAS9T7sI+LIUmWTfcYkHO4aIWwzhcaSAoJOfIk=
+github.com/golang/protobuf v1.5.1/go.mod h1:DopwsBzvsk0Fs44TXzsVbJyPhcCPeIwnvohx4u74HPM=
+github.com/golang/protobuf v1.5.2 h1:ROPKBNFfQgOUMifHyP+KYbvpjbdoFNs+aK7DXlji0Tw=
+github.com/golang/protobuf v1.5.2/go.mod h1:XVQd3VNwM+JqD3oG2Ue2ip4fOMUkwXdXDdiuN0vRsmY=
+github.com/golang/snappy v0.0.1/go.mod h1:/XxbfmMg8lxefKM7IXC3fBNl/7bRcc72aCRzEWrmP2Q=
+github.com/golang/snappy v0.0.3/go.mod h1:/XxbfmMg8lxefKM7IXC3fBNl/7bRcc72aCRzEWrmP2Q=
+github.com/golang/snappy v0.0.4 h1:yAGX7huGHXlcLOEtBnF4w7FQwA26wojNCwOYAEhLjQM=
+github.com/golang/snappy v0.0.4/go.mod h1:/XxbfmMg8lxefKM7IXC3fBNl/7bRcc72aCRzEWrmP2Q=
+github.com/google/btree v0.0.0-20180813153112-4030bb1f1f0c/go.mod h1:lNA+9X1NB3Zf8V7Ke586lFgjr2dZNuvo3lPJSGZ5JPQ=
+github.com/google/btree v1.0.0 h1:0udJVsspx3VBr5FwtLhQQtuAsVc79tTq0ocGIPAU6qo=
+github.com/google/btree v1.0.0/go.mod h1:lNA+9X1NB3Zf8V7Ke586lFgjr2dZNuvo3lPJSGZ5JPQ=
+github.com/google/go-cmp v0.2.0/go.mod h1:oXzfMopK8JAjlY9xF4vHSVASa0yLyX7SntLO5aqRK0M=
+github.com/google/go-cmp v0.3.0/go.mod h1:8QqcDgzrUqlUb/G2PQTWiueGozuR1884gddMywk6iLU=
+github.com/google/go-cmp v0.3.1/go.mod h1:8QqcDgzrUqlUb/G2PQTWiueGozuR1884gddMywk6iLU=
+github.com/google/go-cmp v0.4.0/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE=
+github.com/google/go-cmp v0.4.1/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE=
+github.com/google/go-cmp v0.5.0/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE=
+github.com/google/go-cmp v0.5.1/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE=
+github.com/google/go-cmp v0.5.2/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE=
+github.com/google/go-cmp v0.5.3/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE=
+github.com/google/go-cmp v0.5.4/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE=
+github.com/google/go-cmp v0.5.5/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE=
+github.com/google/go-cmp v0.5.6 h1:BKbKCqvP6I+rmFHt06ZmyQtvB8xAkWdhFyr0ZUNZcxQ=
+github.com/google/go-cmp v0.5.6/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE=
+github.com/google/gofuzz v1.0.0/go.mod h1:dBl0BpW6vV/+mYPU4Po3pmUjxk6FQPldtuIdl/M65Eg=
+github.com/google/martian v2.1.0+incompatible h1:/CP5g8u/VJHijgedC/Legn3BAbAaWPgecwXBIDzw5no=
+github.com/google/martian v2.1.0+incompatible/go.mod h1:9I4somxYTbIHy5NJKHRl3wXiIaQGbYVAs8BPL6v8lEs=
+github.com/google/martian/v3 v3.0.0/go.mod h1:y5Zk1BBys9G+gd6Jrk0W3cC1+ELVxBWuIGO+w/tUAp0=
+github.com/google/martian/v3 v3.1.0/go.mod h1:y5Zk1BBys9G+gd6Jrk0W3cC1+ELVxBWuIGO+w/tUAp0=
+github.com/google/martian/v3 v3.2.1 h1:d8MncMlErDFTwQGBK1xhv026j9kqhvw1Qv9IbWT1VLQ=
+github.com/google/martian/v3 v3.2.1/go.mod h1:oBOf6HBosgwRXnUGWUB05QECsc6uvmMiJ3+6W4l/CUk=
+github.com/google/pprof v0.0.0-20181206194817-3ea8567a2e57/go.mod h1:zfwlbNMJ+OItoe0UupaVj+oy1omPYYDuagoSzA8v9mc=
+github.com/google/pprof v0.0.0-20190515194954-54271f7e092f/go.mod h1:zfwlbNMJ+OItoe0UupaVj+oy1omPYYDuagoSzA8v9mc=
+github.com/google/pprof v0.0.0-20191218002539-d4f498aebedc/go.mod h1:ZgVRPoUq/hfqzAqh7sHMqb3I9Rq5C59dIz2SbBwJ4eM=
+github.com/google/pprof v0.0.0-20200212024743-f11f1df84d12/go.mod h1:ZgVRPoUq/hfqzAqh7sHMqb3I9Rq5C59dIz2SbBwJ4eM=
+github.com/google/pprof v0.0.0-20200229191704-1ebb73c60ed3/go.mod h1:ZgVRPoUq/hfqzAqh7sHMqb3I9Rq5C59dIz2SbBwJ4eM=
+github.com/google/pprof v0.0.0-20200430221834-fc25d7d30c6d/go.mod h1:ZgVRPoUq/hfqzAqh7sHMqb3I9Rq5C59dIz2SbBwJ4eM=
+github.com/google/pprof v0.0.0-20200708004538-1a94d8640e99/go.mod h1:ZgVRPoUq/hfqzAqh7sHMqb3I9Rq5C59dIz2SbBwJ4eM=
+github.com/google/pprof v0.0.0-20201023163331-3e6fc7fc9c4c/go.mod h1:kpwsk12EmLew5upagYY7GY0pfYCcupk39gWOCRROcvE=
+github.com/google/pprof v0.0.0-20201203190320-1bf35d6f28c2/go.mod h1:kpwsk12EmLew5upagYY7GY0pfYCcupk39gWOCRROcvE=
+github.com/google/pprof v0.0.0-20210122040257-d980be63207e/go.mod h1:kpwsk12EmLew5upagYY7GY0pfYCcupk39gWOCRROcvE=
+github.com/google/pprof v0.0.0-20210226084205-cbba55b83ad5/go.mod h1:kpwsk12EmLew5upagYY7GY0pfYCcupk39gWOCRROcvE=
+github.com/google/pprof v0.0.0-20210601050228-01bbb1931b22/go.mod h1:kpwsk12EmLew5upagYY7GY0pfYCcupk39gWOCRROcvE=
+github.com/google/pprof v0.0.0-20210609004039-a478d1d731e9/go.mod h1:kpwsk12EmLew5upagYY7GY0pfYCcupk39gWOCRROcvE=
+github.com/google/pprof v0.0.0-20210720184732-4bb14d4b1be1/go.mod h1:kpwsk12EmLew5upagYY7GY0pfYCcupk39gWOCRROcvE=
+github.com/google/renameio v0.1.0/go.mod h1:KWCgfxg9yswjAJkECMjeO8J8rahYeXnNhOm40UhjYkI=
+github.com/google/shlex v0.0.0-20191202100458-e7afc7fbc510/go.mod h1:pupxD2MaaD3pAXIBCelhxNneeOaAeabZDe5s4K6zSpQ=
+github.com/google/uuid v1.1.2/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo=
+github.com/google/uuid v1.3.0 h1:t6JiXgmwXMjEs8VusXIJk2BXHsn+wx8BZdTaoZ5fu7I=
+github.com/google/uuid v1.3.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo=
+github.com/googleapis/gax-go/v2 v2.0.4/go.mod h1:0Wqv26UfaUD9n4G6kQubkQ+KchISgw+vpHVxEJEs9eg=
+github.com/googleapis/gax-go/v2 v2.0.5/go.mod h1:DWXyrwAJ9X0FpwwEdw+IPEYBICEFu5mhpdKc/us6bOk=
+github.com/googleapis/gax-go/v2 v2.1.0 h1:6DWmvNpomjL1+3liNSZbVns3zsYzzCjm6pRBO1tLeso=
+github.com/googleapis/gax-go/v2 v2.1.0/go.mod h1:Q3nei7sK6ybPYH7twZdmQpAd1MKb7pfu6SK+H1/DsU0=
+github.com/gorilla/mux v1.7.4/go.mod h1:DVbg23sWSpFRCP0SfiEN6jmj59UnW/n46BH5rLB71So=
+github.com/grpc-ecosystem/grpc-gateway v1.16.0/go.mod h1:BDjrQk3hbvj6Nolgz8mAMFbcEtjT1g+wF4CSlocrBnw=
+github.com/hashicorp/consul/api v1.10.1 h1:MwZJp86nlnL+6+W1Zly4JUuVn9YHhMggBirMpHGD7kw=
+github.com/hashicorp/consul/api v1.10.1/go.mod h1:XjsvQN+RJGWI2TWy1/kqaE16HrR2J/FWgkYjdZQsX9M=
+github.com/hashicorp/consul/sdk v0.8.0 h1:OJtKBtEjboEZvG6AOUdh4Z1Zbyu0WcxQ0qatRrZHTVU=
+github.com/hashicorp/consul/sdk v0.8.0/go.mod h1:GBvyrGALthsZObzUGsfgHZQDXjg4lOjagTIwIR1vPms=
+github.com/hashicorp/errwrap v1.0.0/go.mod h1:YH+1FKiLXxHSkmPseP+kNlulaMuP3n2brvKWEqk/Jc4=
+github.com/hashicorp/errwrap v1.1.0 h1:OxrOeh75EUXMY8TBjag2fzXGZ40LB6IKw45YeGUDY2I=
+github.com/hashicorp/errwrap v1.1.0/go.mod h1:YH+1FKiLXxHSkmPseP+kNlulaMuP3n2brvKWEqk/Jc4=
+github.com/hashicorp/go-cleanhttp v0.5.0/go.mod h1:JpRdi6/HCYpAwUzNwuwqhbovhLtngrth3wmdIIUrZ80=
+github.com/hashicorp/go-cleanhttp v0.5.1/go.mod h1:JpRdi6/HCYpAwUzNwuwqhbovhLtngrth3wmdIIUrZ80=
+github.com/hashicorp/go-cleanhttp v0.5.2 h1:035FKYIWjmULyFRBKPs8TBQoi0x6d9G4xc9neXJWAZQ=
+github.com/hashicorp/go-cleanhttp v0.5.2/go.mod h1:kO/YDlP8L1346E6Sodw+PrpBSV4/SoxCXGY6BqNFT48=
+github.com/hashicorp/go-getter/gcs/v2 v2.1.0 h1:1S1hvWgHrhUihP/Y4FVbjCWwE7EwxpksKoRcC7g+Hgs=
+github.com/hashicorp/go-getter/gcs/v2 v2.1.0/go.mod h1:dVyTnX1BynHAjbumB4Pk14GoJ+v3VbDUJtbI7G0oOlU=
+github.com/hashicorp/go-getter/s3/v2 v2.1.0 h1:8uwuP97zEQ7y7H4bLzRqiN4T8vmpXeJthigqSEjX+08=
+github.com/hashicorp/go-getter/s3/v2 v2.1.0/go.mod h1:rwzJPQaBuc5riYOucPx84DOE74xIhKENOWgBjK3XVEs=
+github.com/hashicorp/go-getter/v2 v2.1.0 h1:MsLbi7yFKGFPVmpK+un4/k5HFry0tqvo9JppsCmIutU=
+github.com/hashicorp/go-getter/v2 v2.1.0/go.mod h1:w65fE5glbccYjndAuj1kA5lnVBGZYEaH0e5qA1kpIks=
+github.com/hashicorp/go-hclog v0.0.0-20180709165350-ff2cf002a8dd/go.mod h1:9bjs9uLqI8l75knNv3lV1kA55veR+WUPSiKIWcQHudI=
+github.com/hashicorp/go-hclog v0.9.2/go.mod h1:5CU+agLiy3J7N7QjHK5d05KxGsuXiQLrjA0H7acj2lQ=
+github.com/hashicorp/go-hclog v0.12.0/go.mod h1:whpDNt7SSdeAju8AWKIWsul05p54N/39EeqMAyrmvFQ=
+github.com/hashicorp/go-hclog v0.14.1/go.mod h1:whpDNt7SSdeAju8AWKIWsul05p54N/39EeqMAyrmvFQ=
+github.com/hashicorp/go-hclog v0.16.1/go.mod h1:whpDNt7SSdeAju8AWKIWsul05p54N/39EeqMAyrmvFQ=
+github.com/hashicorp/go-hclog v0.16.2 h1:K4ev2ib4LdQETX5cSZBG0DVLk1jwGqSPXBjdah3veNs=
+github.com/hashicorp/go-hclog v0.16.2/go.mod h1:whpDNt7SSdeAju8AWKIWsul05p54N/39EeqMAyrmvFQ=
+github.com/hashicorp/go-immutable-radix v1.0.0/go.mod h1:0y9vanUI8NX6FsYoO3zeMjhV/C5i9g4Q3DwcSNZ4P60=
+github.com/hashicorp/go-immutable-radix v1.1.0/go.mod h1:0y9vanUI8NX6FsYoO3zeMjhV/C5i9g4Q3DwcSNZ4P60=
+github.com/hashicorp/go-immutable-radix v1.3.1 h1:DKHmCUm2hRBK510BaiZlwvpD40f8bJFeZnpfm2KLowc=
+github.com/hashicorp/go-immutable-radix v1.3.1/go.mod h1:0y9vanUI8NX6FsYoO3zeMjhV/C5i9g4Q3DwcSNZ4P60=
+github.com/hashicorp/go-kms-wrapping/entropy v0.1.0/go.mod h1:d1g9WGtAunDNpek8jUIEJnBlbgKS1N2Q61QkHiZyR1g=
+github.com/hashicorp/go-msgpack v0.5.3/go.mod h1:ahLV/dePpqEmjfWmKiqvPkv/twdG7iPBM1vqhUKIvfM=
+github.com/hashicorp/go-msgpack v0.5.5 h1:i9R9JSrqIz0QVLz3sz+i3YJdT7TTSLcfLLzJi9aZTuI=
+github.com/hashicorp/go-msgpack v0.5.5/go.mod h1:ahLV/dePpqEmjfWmKiqvPkv/twdG7iPBM1vqhUKIvfM=
+github.com/hashicorp/go-multierror v1.0.0/go.mod h1:dHtQlpGsu+cZNNAkkCN/P3hoUDHhCYQXV3UM06sGGrk=
+github.com/hashicorp/go-multierror v1.1.0/go.mod h1:spPvp8C1qA32ftKqdAHm4hHTbPw+vmowP0z+KUhOZdA=
+github.com/hashicorp/go-multierror v1.1.1 h1:H5DkEtf6CXdFp0N0Em5UCwQpXMWke8IA0+lD48awMYo=
+github.com/hashicorp/go-multierror v1.1.1/go.mod h1:iw975J/qwKPdAO1clOe2L8331t/9/fmwbPZ6JB6eMoM=
+github.com/hashicorp/go-plugin v1.0.1/go.mod h1:++UyYGoz3o5w9ZzAdZxtQKrWWP+iqPBn3cQptSMzBuY=
+github.com/hashicorp/go-retryablehttp v0.5.3/go.mod h1:9B5zBasrRhHXnJnui7y6sL7es7NDiJgTc6Er0maI1Xs=
+github.com/hashicorp/go-retryablehttp v0.6.2/go.mod h1:gEx6HMUGxYYhJScX7W1Il64m6cc2C1mDaW3NQ9sY1FY=
+github.com/hashicorp/go-retryablehttp v0.6.6/go.mod h1:vAew36LZh98gCBJNLH42IQ1ER/9wtLZZ8meHqQvEYWY=
+github.com/hashicorp/go-retryablehttp v0.7.0 h1:eu1EI/mbirUgP5C8hVsTNaGZreBDlYiwC1FZWkvQPQ4=
+github.com/hashicorp/go-retryablehttp v0.7.0/go.mod h1:vAew36LZh98gCBJNLH42IQ1ER/9wtLZZ8meHqQvEYWY=
+github.com/hashicorp/go-rootcerts v1.0.1/go.mod h1:pqUvnprVnM5bf7AOirdbb01K4ccR319Vf4pU3K5EGc8=
+github.com/hashicorp/go-rootcerts v1.0.2 h1:jzhAVGtqPKbwpyCPELlgNWhE1znq+qwJtW5Oi2viEzc=
+github.com/hashicorp/go-rootcerts v1.0.2/go.mod h1:pqUvnprVnM5bf7AOirdbb01K4ccR319Vf4pU3K5EGc8=
+github.com/hashicorp/go-safetemp v1.0.0 h1:2HR189eFNrjHQyENnQMMpCiBAsRxzbTMIgBhEyExpmo=
+github.com/hashicorp/go-safetemp v1.0.0/go.mod h1:oaerMy3BhqiTbVye6QuFhFtIceqFoDHxNAB65b+Rj1I=
+github.com/hashicorp/go-sockaddr v1.0.0/go.mod h1:7Xibr9yA9JjQq1JpNB2Vw7kxv8xerXegt+ozgdvDeDU=
+github.com/hashicorp/go-sockaddr v1.0.2 h1:ztczhD1jLxIRjVejw8gFomI1BQZOe2WoVOu0SyteCQc=
+github.com/hashicorp/go-sockaddr v1.0.2/go.mod h1:rB4wwRAUzs07qva3c5SdrY/NEtAUjGlgmH/UkBUC97A=
+github.com/hashicorp/go-syslog v1.0.0/go.mod h1:qPfqrKkXGihmCqbJM2mZgkZGvKG1dFdvsLplgctolz4=
+github.com/hashicorp/go-uuid v1.0.0/go.mod h1:6SBZvOh/SIDV7/2o3Jml5SYk/TvGqwFJ/bN7x4byOro=
+github.com/hashicorp/go-uuid v1.0.1/go.mod h1:6SBZvOh/SIDV7/2o3Jml5SYk/TvGqwFJ/bN7x4byOro=
+github.com/hashicorp/go-uuid v1.0.2 h1:cfejS+Tpcp13yd5nYHWDI6qVCny6wyX2Mt5SGur2IGE=
+github.com/hashicorp/go-uuid v1.0.2/go.mod h1:6SBZvOh/SIDV7/2o3Jml5SYk/TvGqwFJ/bN7x4byOro=
+github.com/hashicorp/go-version v1.1.0/go.mod h1:fltr4n8CU8Ke44wwGCBoEymUuxUHl09ZGVZPK5anwXA=
+github.com/hashicorp/go-version v1.2.0/go.mod h1:fltr4n8CU8Ke44wwGCBoEymUuxUHl09ZGVZPK5anwXA=
+github.com/hashicorp/go-version v1.3.0 h1:McDWVJIU/y+u1BRV06dPaLfLCaT7fUTJLp5r04x7iNw=
+github.com/hashicorp/go-version v1.3.0/go.mod h1:fltr4n8CU8Ke44wwGCBoEymUuxUHl09ZGVZPK5anwXA=
+github.com/hashicorp/golang-lru v0.5.0/go.mod h1:/m3WP610KZHVQ1SGc6re/UDhFvYD7pJ4Ao+sR/qLZy8=
+github.com/hashicorp/golang-lru v0.5.1/go.mod h1:/m3WP610KZHVQ1SGc6re/UDhFvYD7pJ4Ao+sR/qLZy8=
+github.com/hashicorp/golang-lru v0.5.3/go.mod h1:iADmTwqILo4mZ8BN3D2Q6+9jd8WM5uGBxy+E8yxSoD4=
+github.com/hashicorp/golang-lru v0.5.4 h1:YDjusn29QI/Das2iO9M0BHnIbxPeyuCHsjMW+lJfyTc=
+github.com/hashicorp/golang-lru v0.5.4/go.mod h1:iADmTwqILo4mZ8BN3D2Q6+9jd8WM5uGBxy+E8yxSoD4=
+github.com/hashicorp/hcl v1.0.0 h1:0Anlzjpi4vEasTeNFn2mLJgTSwt0+6sfsiTG8qcWGx4=
+github.com/hashicorp/hcl v1.0.0/go.mod h1:E5yfLk+7swimpb2L/Alb/PJmXilQ/rhwaUYs4T20WEQ=
+github.com/hashicorp/hcl/v2 v2.12.0 h1:PsYxySWpMD4KPaoJLnsHwtK5Qptvj/4Q6s0t4sUxZf4=
+github.com/hashicorp/hcl/v2 v2.12.0/go.mod h1:FwWsfWEjyV/CMj8s/gqAuiviY72rJ1/oayI9WftqcKg=
+github.com/hashicorp/logutils v1.0.0/go.mod h1:QIAnNjmIWmVIIkWDTG1z5v++HQmx9WQRO+LraFDTW64=
+github.com/hashicorp/mdns v1.0.1/go.mod h1:4gW7WsVCke5TE7EPeYliwHlRUyBtfCwuFwuMg2DmyNY=
+github.com/hashicorp/memberlist v0.2.2 h1:5+RffWKwqJ71YPu9mWsF7ZOscZmwfasdA8kbdC7AO2g=
+github.com/hashicorp/memberlist v0.2.2/go.mod h1:MS2lj3INKhZjWNqd3N0m3J+Jxf3DAOnAH9VT3Sh9MUE=
+github.com/hashicorp/packer-plugin-sdk v0.3.0 h1:G4Uze/85X3n6c+8DawHdxptOZ0vHOeJ2LAAhBFLjYmg=
+github.com/hashicorp/packer-plugin-sdk v0.3.0/go.mod h1:bqpbL7w5Ee2QWrUyAsZI/MdCYpw15ls4mxgn9Ei2DZc=
+github.com/hashicorp/serf v0.9.5 h1:EBWvyu9tcRszt3Bxp3KNssBMP1KuHWyO51lz9+786iM=
+github.com/hashicorp/serf v0.9.5/go.mod h1:UWDWwZeL5cuWDJdl0C6wrvrUwEqtQ4ZKBKKENpqIUyk=
+github.com/hashicorp/vault/api v1.0.5-0.20200519221902-385fac77e20f/go.mod h1:euTFbi2YJgwcju3imEt919lhJKF68nN1cQPq3aA+kBE=
+github.com/hashicorp/vault/api v1.1.1 h1:907ld+Z9cALyvbZK2qUX9cLwvSaEQsMVQB3x2KE8+AI=
+github.com/hashicorp/vault/api v1.1.1/go.mod h1:29UXcn/1cLOPHQNMWA7bCz2By4PSd0VKPAydKXS5yN0=
+github.com/hashicorp/vault/sdk v0.1.14-0.20200519221530-14615acda45f/go.mod h1:WX57W2PwkrOPQ6rVQk+dy5/htHIaB4aBM70EwKThu10=
+github.com/hashicorp/vault/sdk v0.2.1 h1:S4O6Iv/dyKlE9AUTXGa7VOvZmsCvg36toPKgV4f2P4M=
+github.com/hashicorp/vault/sdk v0.2.1/go.mod h1:WfUiO1vYzfBkz1TmoE4ZGU7HD0T0Cl/rZwaxjBkgN4U=
+github.com/hashicorp/yamux v0.0.0-20180604194846-3520598351bb/go.mod h1:+NfK9FKeTrX5uv1uIXGdwYDTeHna2qgaIlx54MXqjAM=
+github.com/hashicorp/yamux v0.0.0-20210826001029-26ff87cf9493 h1:brI5vBRUlAlM34VFmnLPwjnCL/FxAJp9XvOdX6Zt+XE=
+github.com/hashicorp/yamux v0.0.0-20210826001029-26ff87cf9493/go.mod h1:CtWFDAQgb7dxtzFs4tWbplKIe2jSi3+5vKbgIO0SLnQ=
+github.com/hpcloud/tail v1.0.0/go.mod h1:ab1qPbhIpdTxEkNHXyeSf5vhxWSCs/tWer42PpOxQnU=
+github.com/huandu/xstrings v1.3.2/go.mod h1:y5/lhBue+AyNmUVz9RLU9xbLR0o4KIIExikq4ovT0aE=
+github.com/ianlancetaylor/demangle v0.0.0-20181102032728-5e5cf60278f6/go.mod h1:aSSvb/t6k1mPoxDqO4vJh6VOCGPwU4O0C2/Eqndh1Sc=
+github.com/ianlancetaylor/demangle v0.0.0-20200824232613-28f6c0f3b639/go.mod h1:aSSvb/t6k1mPoxDqO4vJh6VOCGPwU4O0C2/Eqndh1Sc=
+github.com/imdario/mergo v0.3.11/go.mod h1:jmQim1M+e3UYxmgPu/WyfjB3N3VflVyUjjjwH0dnCYA=
+github.com/imdario/mergo v0.3.12/go.mod h1:jmQim1M+e3UYxmgPu/WyfjB3N3VflVyUjjjwH0dnCYA=
+github.com/inconshreveable/mousetrap v1.0.0/go.mod h1:PxqpIevigyE2G7u3NXJIT2ANytuPF1OarO4DADm73n8=
+github.com/jehiah/go-strftime v0.0.0-20171201141054-1d33003b3869 h1:IPJ3dvxmJ4uczJe5YQdrYB16oTJlGSC/OyZDqUk9xX4=
+github.com/jehiah/go-strftime v0.0.0-20171201141054-1d33003b3869/go.mod h1:cJ6Cj7dQo+O6GJNiMx+Pa94qKj+TG8ONdKHgMNIyyag=
+github.com/jmespath/go-jmespath v0.0.0-20180206201540-c2b33e8439af/go.mod h1:Nht3zPeWKUH0NzdCt2Blrr5ys8VGpn0CEB0cQHVjt7k=
+github.com/jmespath/go-jmespath v0.3.0/go.mod h1:9QtRXoHjLGCJ5IBSaohpXITPlowMeeYCZ7fLUTSywik=
+github.com/jmespath/go-jmespath v0.4.0 h1:BEgLn5cpjn8UN1mAw4NjwDrS35OdebyEtFe+9YPoQUg=
+github.com/jmespath/go-jmespath v0.4.0/go.mod h1:T8mJZnbsbmF+m6zOOFylbeCJqk5+pHWvzYPziyZiYoo=
+github.com/jmespath/go-jmespath/internal/testify v1.5.1 h1:shLQSRRSCCPj3f2gpwzGwWFoC7ycTf1rcQZHOlsJ6N8=
+github.com/jmespath/go-jmespath/internal/testify v1.5.1/go.mod h1:L3OGu8Wl2/fWfCI6z80xFu9LTZmf1ZRjMHUOPmWr69U=
+github.com/json-iterator/go v1.1.6/go.mod h1:+SdeFBvtyEkXs7REEP0seUULqWtbJapLOCVDaaPEHmU=
+github.com/json-iterator/go v1.1.9/go.mod h1:KdQUCv79m/52Kvf8AW2vK1V8akMuk1QjK/uOdHXbAo4=
+github.com/jstemmer/go-junit-report v0.0.0-20190106144839-af01ea7f8024/go.mod h1:6v2b51hI/fHJwM22ozAgKL4VKDeJcHhJFhtBdhmNjmU=
+github.com/jstemmer/go-junit-report v0.9.1/go.mod h1:Brl9GWCQeLvo8nXZwPNNblvFj/XSXhF0NWZEnDohbsk=
+github.com/julienschmidt/httprouter v1.2.0/go.mod h1:SYymIcj16QtmaHHD7aYtjjsJG7VTCxuUUipMqKk8s4w=
+github.com/kisielk/errcheck v1.1.0/go.mod h1:EZBBE59ingxPouuu3KfxchcWSUPOHkagtvWXihfKN4Q=
+github.com/kisielk/errcheck v1.2.0/go.mod h1:/BMXB+zMLi60iA8Vv6Ksmxu/1UDYcXs4uQLJ+jE2L00=
+github.com/kisielk/gotool v1.0.0/go.mod h1:XhKaO+MFFWcvkIS/tQcRk01m1F5IRFswLeQ+oQHNcck=
+github.com/konsorten/go-windows-terminal-sequences v1.0.1/go.mod h1:T0+1ngSBFLxvqU3pZ+m/2kptfBszLMUkC4ZK/EgS/cQ=
+github.com/konsorten/go-windows-terminal-sequences v1.0.3 h1:CE8S1cTafDpPvMhIxNJKvHsGVBgn1xWYf1NbHQhywc8=
+github.com/konsorten/go-windows-terminal-sequences v1.0.3/go.mod h1:T0+1ngSBFLxvqU3pZ+m/2kptfBszLMUkC4ZK/EgS/cQ=
+github.com/kr/fs v0.1.0 h1:Jskdu9ieNAYnjxsi0LbQp1ulIKZV1LAFgK1tWhpZgl8=
+github.com/kr/fs v0.1.0/go.mod h1:FFnZGqtBN9Gxj7eW1uZ42v5BccTP0vu6NEaFoC2HwRg=
+github.com/kr/logfmt v0.0.0-20140226030751-b84e30acd515/go.mod h1:+0opPa2QZZtGFBFZlji/RkVcI2GknAs/DXo4wKdlNEc=
+github.com/kr/pretty v0.1.0/go.mod h1:dAy3ld7l9f0ibDNOQOHHMYYIIbhfbHSm3C4ZsoJORNo=
+github.com/kr/pretty v0.2.0 h1:s5hAObm+yFO5uHYt5dYjxi2rXrsnmRpJx4OYvIWUaQs=
+github.com/kr/pretty v0.2.0/go.mod h1:ipq/a2n7PKx3OHsz4KJII5eveXtPO4qwEXGdVfWzfnI=
+github.com/kr/pty v1.1.1/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ=
+github.com/kr/text v0.1.0/go.mod h1:4Jbv+DJW3UT/LiOwJeYQe1efqtUx/iVham/4vfdArNI=
+github.com/kr/text v0.2.0 h1:5Nx0Ya0ZqY2ygV366QzturHI13Jq95ApcVaJBhpS+AY=
+github.com/kr/text v0.2.0/go.mod h1:eLer722TekiGuMkidMxC/pM04lWEeraHUUmBw8l2grE=
+github.com/kylelemons/godebug v0.0.0-20170820004349-d65d576e9348/go.mod h1:B69LEHPfb2qLo0BaaOLcbitczOKLWTsrBG9LczfCD4k=
+github.com/masterzen/simplexml v0.0.0-20160608183007-4572e39b1ab9/go.mod h1:kCEbxUJlNDEBNbdQMkPSp6yaKcRXVI6f4ddk8Riv4bc=
+github.com/masterzen/simplexml v0.0.0-20190410153822-31eea3082786 h1:2ZKn+w/BJeL43sCxI2jhPLRv73oVVOjEKZjKkflyqxg=
+github.com/masterzen/simplexml v0.0.0-20190410153822-31eea3082786/go.mod h1:kCEbxUJlNDEBNbdQMkPSp6yaKcRXVI6f4ddk8Riv4bc=
+github.com/masterzen/winrm v0.0.0-20210623064412-3b76017826b0 h1:KqYuDbSr8I2X8H65InN8SafDEa0UaLRy6WEmxDqd0F0=
+github.com/masterzen/winrm v0.0.0-20210623064412-3b76017826b0/go.mod h1:l31LCh9VvG43RJ83A5JLkFPjuz48cZAxBSLQLaIn1p8=
+github.com/mattn/go-colorable v0.0.9/go.mod h1:9vuHe8Xs5qXnSaW/c/ABM9alt+Vo+STaOChaDxuIBZU=
+github.com/mattn/go-colorable v0.1.4/go.mod h1:U0ppj6V5qS13XJ6of8GYAs25YV2eR4EVcfRqFIhoBtE=
+github.com/mattn/go-colorable v0.1.6/go.mod h1:u6P/XSegPjTcexA+o6vUJrdnUu04hMope9wVRipJSqc=
+github.com/mattn/go-colorable v0.1.8 h1:c1ghPdyEDarC70ftn0y+A/Ee++9zz8ljHG1b13eJ0s8=
+github.com/mattn/go-colorable v0.1.8/go.mod h1:u6P/XSegPjTcexA+o6vUJrdnUu04hMope9wVRipJSqc=
+github.com/mattn/go-isatty v0.0.3/go.mod h1:M+lRXTBqGeGNdLjl/ufCoiOlB5xdOkqRJdNxMWT7Zi4=
+github.com/mattn/go-isatty v0.0.8/go.mod h1:Iq45c/XA43vh69/j3iqttzPXn0bhXyGjM0Hdxcsrc5s=
+github.com/mattn/go-isatty v0.0.10/go.mod h1:qgIWMr58cqv1PHHyhnkY9lrL7etaEgOFcMEpPG5Rm84=
+github.com/mattn/go-isatty v0.0.11/go.mod h1:PhnuNfih5lzO57/f3n+odYbM4JtupLOxQOAqxQCu2WE=
+github.com/mattn/go-isatty v0.0.12/go.mod h1:cbi8OIDigv2wuxKPP5vlRcQ1OAZbq2CE4Kysco4FUpU=
+github.com/mattn/go-isatty v0.0.13 h1:qdl+GuBjcsKKDco5BsxPJlId98mSWNKqYA+Co0SC1yA=
+github.com/mattn/go-isatty v0.0.13/go.mod h1:cbi8OIDigv2wuxKPP5vlRcQ1OAZbq2CE4Kysco4FUpU=
+github.com/matttproud/golang_protobuf_extensions v1.0.1/go.mod h1:D8He9yQNgCq6Z5Ld7szi9bcBfOoFv/3dc6xSMkL2PC0=
+github.com/miekg/dns v1.0.14/go.mod h1:W1PPwlIAgtquWBMBEV9nkV9Cazfe8ScdGz/Lj7v3Nrg=
+github.com/miekg/dns v1.1.26 h1:gPxPSwALAeHJSjarOs00QjVdV9QoBvc1D2ujQUr5BzU=
+github.com/miekg/dns v1.1.26/go.mod h1:bPDLeHnStXmXAq1m/Ch/hvfNHr14JKNPMBo3VZKjuso=
+github.com/mitchellh/cli v1.0.0/go.mod h1:hNIlj7HEI86fIcpObd7a0FcrxTWetlwJDGcceTlRvqc=
+github.com/mitchellh/cli v1.1.0/go.mod h1:xcISNoH86gajksDmfB23e/pu+B+GeFRMYmoHXxx3xhI=
+github.com/mitchellh/cli v1.1.2/go.mod h1:6iaV0fGdElS6dPBx0EApTxHrcWvmJphyh2n8YBLPPZ4=
+github.com/mitchellh/copystructure v1.0.0/go.mod h1:SNtv71yrdKgLRyLFxmLdkAbkKEFWgYaq1OVrnRcwhnw=
+github.com/mitchellh/go-fs v0.0.0-20180402235330-b7b9ca407fff h1:bFJ74ac7ZK/jyislqiWdzrnENesFt43sNEBRh1xk/+g=
+github.com/mitchellh/go-fs v0.0.0-20180402235330-b7b9ca407fff/go.mod h1:g7SZj7ABpStq3tM4zqHiVEG5un/DZ1+qJJKO7qx1EvU=
+github.com/mitchellh/go-homedir v1.0.0/go.mod h1:SfyaCUpYCn1Vlf4IUYiD9fPX4A5wJrkLzIz1N1q0pr0=
+github.com/mitchellh/go-homedir v1.1.0 h1:lukF9ziXFxDFPkA1vsr5zpc1XuPDn/wFntq5mG+4E0Y=
+github.com/mitchellh/go-homedir v1.1.0/go.mod h1:SfyaCUpYCn1Vlf4IUYiD9fPX4A5wJrkLzIz1N1q0pr0=
+github.com/mitchellh/go-testing-interface v0.0.0-20171004221916-a61a99592b77/go.mod h1:kRemZodwjscx+RGhAo8eIhFbs2+BFgRtFPeD/KE+zxI=
+github.com/mitchellh/go-testing-interface v1.0.0/go.mod h1:kRemZodwjscx+RGhAo8eIhFbs2+BFgRtFPeD/KE+zxI=
+github.com/mitchellh/go-testing-interface v1.14.1 h1:jrgshOhYAUVNMAJiKbEu7EqAwgJJ2JqpQmpLJOu07cU=
+github.com/mitchellh/go-testing-interface v1.14.1/go.mod h1:gfgS7OtZj6MA4U1UrDRp04twqAjfvlZyCfX3sDjEym8=
+github.com/mitchellh/go-vnc v0.0.0-20150629162542-723ed9867aed h1:FI2NIv6fpef6BQl2u3IZX/Cj20tfypRF4yd+uaHOMtI=
+github.com/mitchellh/go-vnc v0.0.0-20150629162542-723ed9867aed/go.mod h1:3rdaFaCv4AyBgu5ALFM0+tSuHrBh6v692nyQe3ikrq0=
+github.com/mitchellh/go-wordwrap v0.0.0-20150314170334-ad45545899c7/go.mod h1:ZXFpozHsX6DPmq2I0TCekCxypsnAUbP2oI0UX1GXzOo=
+github.com/mitchellh/go-wordwrap v1.0.0/go.mod h1:ZXFpozHsX6DPmq2I0TCekCxypsnAUbP2oI0UX1GXzOo=
+github.com/mitchellh/go-wordwrap v1.0.1 h1:TLuKupo69TCn6TQSyGxwI1EblZZEsQ0vMlAFQflz0v0=
+github.com/mitchellh/go-wordwrap v1.0.1/go.mod h1:R62XHJLzvMFRBbcrT7m7WgmE1eOyTSsCt+hzestvNj0=
+github.com/mitchellh/iochan v1.0.0 h1:C+X3KsSTLFVBr/tK1eYN/vs4rJcvsiLU338UhYPJWeY=
+github.com/mitchellh/iochan v1.0.0/go.mod h1:JwYml1nuB7xOzsp52dPpHFffvOCDupsG0QubkSMEySY=
+github.com/mitchellh/mapstructure v0.0.0-20160808181253-ca63d7c062ee/go.mod h1:FVVH3fgwuzCH5S8UJGiWEs2h04kUh9fWfEaFds41c1Y=
+github.com/mitchellh/mapstructure v1.1.2/go.mod h1:FVVH3fgwuzCH5S8UJGiWEs2h04kUh9fWfEaFds41c1Y=
+github.com/mitchellh/mapstructure v1.3.2/go.mod h1:bFUtVrKA4DC2yAKiSyO/QUcy7e+RRV2QTWOzhPopBRo=
+github.com/mitchellh/mapstructure v1.4.1 h1:CpVNEelQCZBooIPDn+AR3NpivK/TIKU8bDxdASFVQag=
+github.com/mitchellh/mapstructure v1.4.1/go.mod h1:bFUtVrKA4DC2yAKiSyO/QUcy7e+RRV2QTWOzhPopBRo=
+github.com/mitchellh/reflectwalk v1.0.0 h1:9D+8oIskB4VJBN5SFlmc27fSlIBZaov1Wpk/IfikLNY=
+github.com/mitchellh/reflectwalk v1.0.0/go.mod h1:mSTlrgnPZtwu0c4WaC2kGObEpuNDbx0jmZXqmk4esnw=
+github.com/modern-go/concurrent v0.0.0-20180228061459-e0a39a4cb421/go.mod h1:6dJC0mAP4ikYIbvyc7fijjWJddQyLn8Ig3JB5CqoB9Q=
+github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd/go.mod h1:6dJC0mAP4ikYIbvyc7fijjWJddQyLn8Ig3JB5CqoB9Q=
+github.com/modern-go/reflect2 v0.0.0-20180701023420-4b7aa43c6742/go.mod h1:bx2lNnkwVCuqBIxFjflWJWanXIb3RllmbCylyMrvgv0=
+github.com/modern-go/reflect2 v1.0.1/go.mod h1:bx2lNnkwVCuqBIxFjflWJWanXIb3RllmbCylyMrvgv0=
+github.com/morikuni/aec v1.0.0/go.mod h1:BbKIizmSmc5MMPqRYbxO4ZU0S0+P200+tUnFx7PXmsc=
+github.com/mwitkow/go-conntrack v0.0.0-20161129095857-cc309e4a2223/go.mod h1:qRWi+5nqEBWmkhHvq77mSJWrCKwh8bxhgT7d/eI7P4U=
+github.com/niemeyer/pretty v0.0.0-20200227124842-a10e7caefd8e h1:fD57ERR4JtEqsWbfPhv4DMiApHyliiK5xCTNVSPiaAs=
+github.com/niemeyer/pretty v0.0.0-20200227124842-a10e7caefd8e/go.mod h1:zD1mROLANZcx1PVRCS0qkT7pwLkGfwJo4zjcN/Tysno=
+github.com/nu7hatch/gouuid v0.0.0-20131221200532-179d4d0c4d8d h1:VhgPp6v9qf9Agr/56bj7Y/xa04UccTW04VP0Qed4vnQ=
+github.com/nu7hatch/gouuid v0.0.0-20131221200532-179d4d0c4d8d/go.mod h1:YUTz3bUH2ZwIWBy3CJBeOBEugqcmXREj14T+iG/4k4U=
+github.com/oklog/run v1.0.0/go.mod h1:dlhp/R75TPv97u0XWUtDeV/lRKWPKSdTuV0TZvrmrQA=
+github.com/onsi/ginkgo v1.6.0/go.mod h1:lLunBs/Ym6LB5Z9jYTR76FiuTmxDTDusOGeTQH+WWjE=
+github.com/onsi/ginkgo v1.10.1/go.mod h1:lLunBs/Ym6LB5Z9jYTR76FiuTmxDTDusOGeTQH+WWjE=
+github.com/onsi/gomega v1.7.0/go.mod h1:ex+gbHU/CVuBBDIJjb2X0qEXbFg53c61hWP/1CpauHY=
+github.com/opencontainers/go-digest v0.0.0-20180430190053-c9281466c8b2/go.mod h1:cMLVZDEM3+U2I4VmLI6N8jQYUd2OVphdqWwCJHrFt2s=
+github.com/opencontainers/go-digest v1.0.0-rc1/go.mod h1:cMLVZDEM3+U2I4VmLI6N8jQYUd2OVphdqWwCJHrFt2s=
+github.com/opencontainers/go-digest v1.0.0/go.mod h1:0JzlMkj0TRzQZfJkVvzbP0HBR3IKzErnv2BNG4W4MAM=
+github.com/opencontainers/image-spec v1.0.1/go.mod h1:BtxoFyWECRxE4U/7sNtV5W15zMzWCbyJoFRP3s7yZA0=
+github.com/opencontainers/runc v0.0.0-20190115041553-12f6a991201f/go.mod h1:qT5XzbpPznkRYVz/mWwUaVBUv2rmF59PVA73FjuZG0U=
+github.com/opencontainers/runc v0.1.1/go.mod h1:qT5XzbpPznkRYVz/mWwUaVBUv2rmF59PVA73FjuZG0U=
+github.com/opencontainers/runtime-spec v0.1.2-0.20190507144316-5b71a03e2700/go.mod h1:jwyrGlmzljRJv/Fgzds9SsS/C5hL+LL3ko9hs6T5lQ0=
+github.com/packer-community/winrmcp v0.0.0-20180921211025-c76d91c1e7db h1:9uViuKtx1jrlXLBW/pMnhOfzn3iSEdLase/But/IZRU=
+github.com/packer-community/winrmcp v0.0.0-20180921211025-c76d91c1e7db/go.mod h1:f6Izs6JvFTdnRbziASagjZ2vmf55NSIkC/weStxCHqk=
+github.com/pascaldekloe/goe v0.0.0-20180627143212-57f6aae5913c/go.mod h1:lzWF7FIEvWOWxwDKqyGYQf6ZUaNfKdP144TG7ZOy1lc=
+github.com/pascaldekloe/goe v0.1.0 h1:cBOtyMzM9HTpWjXfbbunk26uA6nG3a8n06Wieeh0MwY=
+github.com/pascaldekloe/goe v0.1.0/go.mod h1:lzWF7FIEvWOWxwDKqyGYQf6ZUaNfKdP144TG7ZOy1lc=
+github.com/pierrec/lz4 v2.0.5+incompatible/go.mod h1:pdkljMzZIN41W+lC3N2tnIh5sFi+IEE17M5jbnwPHcY=
+github.com/pierrec/lz4 v2.5.2+incompatible/go.mod h1:pdkljMzZIN41W+lC3N2tnIh5sFi+IEE17M5jbnwPHcY=
+github.com/pierrec/lz4 v2.6.1+incompatible h1:9UY3+iC23yxF0UfGaYrGplQ+79Rg+h/q9FV9ix19jjM=
+github.com/pierrec/lz4 v2.6.1+incompatible/go.mod h1:pdkljMzZIN41W+lC3N2tnIh5sFi+IEE17M5jbnwPHcY=
+github.com/pkg/errors v0.8.0/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0=
+github.com/pkg/errors v0.8.1-0.20171018195549-f15c970de5b7/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0=
+github.com/pkg/errors v0.8.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0=
+github.com/pkg/errors v0.9.1 h1:FEBLx1zS214owpjy7qsBeixbURkuhQAwrK5UwLGTwt4=
+github.com/pkg/errors v0.9.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0=
+github.com/pkg/sftp v1.13.2 h1:taJnKntsWgU+qae21Rx52lIwndAdKrj0mfUNQsz1z4Q=
+github.com/pkg/sftp v1.13.2/go.mod h1:LzqnAvaD5TWeNBsZpfKxSYn1MbjWwOsCIAFFJbpIsK8=
+github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM=
+github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
+github.com/posener/complete v1.1.1/go.mod h1:em0nMJCgc9GFtwrmVmEMR/ZL6WyhyjMBndrE9hABlRI=
+github.com/posener/complete v1.2.3/go.mod h1:WZIdtGGp+qx0sLrYKtIRAruyNpv6hFCicSgv7Sy7s/s=
+github.com/prometheus/client_golang v0.9.1/go.mod h1:7SWBe2y4D6OKWSNQJUaRYU/AaXPKyh/dDVn+NZz0KFw=
+github.com/prometheus/client_golang v0.9.2/go.mod h1:OsXs2jCmiKlQ1lTBmv21f2mNfw4xf/QclQDMrYNZzcM=
+github.com/prometheus/client_golang v1.0.0/go.mod h1:db9x61etRT2tGnBNRi70OPL5FsnadC4Ky3P0J6CfImo=
+github.com/prometheus/client_golang v1.4.0/go.mod h1:e9GMxYsXl05ICDXkRhurwBS4Q3OK1iX/F2sw+iXX5zU=
+github.com/prometheus/client_model v0.0.0-20180712105110-5c3871d89910/go.mod h1:MbSGuTsp3dbXC40dX6PRTWyKYBIrTGTE9sqQNg2J8bo=
+github.com/prometheus/client_model v0.0.0-20190129233127-fd36f4220a90/go.mod h1:xMI15A0UPsDsEKsMN9yxemIoYk6Tm2C1GtYGdfGttqA=
+github.com/prometheus/client_model v0.0.0-20190812154241-14fe0d1b01d4/go.mod h1:xMI15A0UPsDsEKsMN9yxemIoYk6Tm2C1GtYGdfGttqA=
+github.com/prometheus/client_model v0.2.0/go.mod h1:xMI15A0UPsDsEKsMN9yxemIoYk6Tm2C1GtYGdfGttqA=
+github.com/prometheus/common v0.0.0-20181126121408-4724e9255275/go.mod h1:daVV7qP5qjZbuso7PdcryaAu0sAZbrN9i7WWcTMWvro=
+github.com/prometheus/common v0.4.1/go.mod h1:TNfzLD0ON7rHzMJeJkieUDPYmFC7Snx/y86RQel1bk4=
+github.com/prometheus/common v0.9.1/go.mod h1:yhUN8i9wzaXS3w1O07YhxHEBxD+W35wd8bs7vj7HSQ4=
+github.com/prometheus/procfs v0.0.0-20180125133057-cb4147076ac7/go.mod h1:c3At6R/oaqEKCNdg8wHV1ftS6bRYblBhIjjI8uT2IGk=
+github.com/prometheus/procfs v0.0.0-20181005140218-185b4288413d/go.mod h1:c3At6R/oaqEKCNdg8wHV1ftS6bRYblBhIjjI8uT2IGk=
+github.com/prometheus/procfs v0.0.0-20181204211112-1dc9a6cbc91a/go.mod h1:c3At6R/oaqEKCNdg8wHV1ftS6bRYblBhIjjI8uT2IGk=
+github.com/prometheus/procfs v0.0.2/go.mod h1:TjEm7ze935MbeOT/UhFTIMYKhuLP4wbCsTZCD3I8kEA=
+github.com/prometheus/procfs v0.0.8/go.mod h1:7Qr8sr6344vo1JqZ6HhLceV9o3AJ1Ff+GxbHq6oeK9A=
+github.com/rogpeppe/fastuuid v1.2.0/go.mod h1:jVj6XXZzXRy/MSR5jhDC/2q6DgLz+nrA6LYCDYWNEvQ=
+github.com/rogpeppe/go-internal v1.3.0/go.mod h1:M8bDsm7K2OlrFYOpmOWEs/qY81heoFRclV5y23lUDJ4=
+github.com/ryanuber/columnize v0.0.0-20160712163229-9b3edd62028f/go.mod h1:sm1tb6uqfes/u+d4ooFouqFdy9/2g9QGwK3SQygK0Ts=
+github.com/ryanuber/columnize v2.1.0+incompatible/go.mod h1:sm1tb6uqfes/u+d4ooFouqFdy9/2g9QGwK3SQygK0Ts=
+github.com/ryanuber/go-glob v1.0.0 h1:iQh3xXAumdQ+4Ufa5b25cRpC5TYKlno6hsv6Cb3pkBk=
+github.com/ryanuber/go-glob v1.0.0/go.mod h1:807d1WSdnB0XRJzKNil9Om6lcp/3a0v4qIHxIXzX/Yc=
+github.com/satori/go.uuid v1.2.0 h1:0uYX9dsZ2yD7q2RtLRtPSdGDWzjeM3TbMJP9utgA0ww=
+github.com/satori/go.uuid v1.2.0/go.mod h1:dA0hQrYB0VpLJoorglMZABFdXlWrHn1NEOzdhQKdks0=
+github.com/sean-/seed v0.0.0-20170313163322-e2103e2c3529 h1:nn5Wsu0esKSJiIVhscUtVbo7ada43DJhG55ua/hjS5I=
+github.com/sean-/seed v0.0.0-20170313163322-e2103e2c3529/go.mod h1:DxrIzT+xaE7yg65j358z/aeFdxmN0P9QXhEzd20vsDc=
+github.com/sergi/go-diff v1.0.0/go.mod h1:0CfEIISq7TuYL3j771MWULgwwjU+GofnZX9QAmXWZgo=
+github.com/sirupsen/logrus v1.0.4-0.20170822132746-89742aefa4b2/go.mod h1:pMByvHTf9Beacp5x1UXfOR9xyW/9antXMhjMPG0dEzc=
+github.com/sirupsen/logrus v1.2.0/go.mod h1:LxeOpSwHxABJmUn/MG1IvRgCAasNZTLOkJPxbbu5VWo=
+github.com/sirupsen/logrus v1.4.1/go.mod h1:ni0Sbl8bgC9z8RoU9G6nDWqqs/fq4eDPysMBDgk/93Q=
+github.com/sirupsen/logrus v1.4.2/go.mod h1:tLMulIdttU9McNUspp0xgXVQah82FyeX6MwdIuYE2rE=
+github.com/sirupsen/logrus v1.6.0 h1:UBcNElsrwanuuMsnGSlYmtmgbb23qDR5dG+6X6Oo89I=
+github.com/sirupsen/logrus v1.6.0/go.mod h1:7uNnSEd1DgxDLC74fIahvMZmmYsHGZGEOFrfsX/uA88=
+github.com/spaolacci/murmur3 v0.0.0-20180118202830-f09979ecbc72/go.mod h1:JwIasOWyU6f++ZhiEuf87xNszmSA2myDM2Kzu9HwQUA=
+github.com/spf13/cobra v0.0.2-0.20171109065643-2da4a54c5cee/go.mod h1:1l0Ry5zgKvJasoi3XT1TypsSe7PqH0Sj9dhYf7v3XqQ=
+github.com/spf13/pflag v1.0.1-0.20171106142849-4c012f6dcd95/go.mod h1:DYY7MBk1bdzusC3SYhjObp+wFpr4gzcvqqNjLnInEg4=
+github.com/spf13/pflag v1.0.2/go.mod h1:DYY7MBk1bdzusC3SYhjObp+wFpr4gzcvqqNjLnInEg4=
+github.com/spf13/pflag v1.0.3/go.mod h1:DYY7MBk1bdzusC3SYhjObp+wFpr4gzcvqqNjLnInEg4=
+github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME=
+github.com/stretchr/objx v0.1.1/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME=
+github.com/stretchr/objx v0.2.0 h1:Hbg2NidpLE8veEBkEZTL3CvlkUIVzuU9jDplZO54c48=
+github.com/stretchr/objx v0.2.0/go.mod h1:qt09Ya8vawLte6SNmTgCsAVtYtaKzEcn8ATUoHMkEqE=
+github.com/stretchr/testify v1.2.2/go.mod h1:a8OnRcib4nhh0OaRAV+Yts87kKdq0PP7pXfy6kDkUVs=
+github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI=
+github.com/stretchr/testify v1.4.0/go.mod h1:j7eGeouHqKxXV5pUuKE4zz7dFj8WfuZ+81PSLYec5m4=
+github.com/stretchr/testify v1.5.1/go.mod h1:5W2xD1RspED5o8YsWQXVCued0rvSQ+mT+I5cxcmMvtA=
+github.com/stretchr/testify v1.6.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg=
+github.com/stretchr/testify v1.7.0 h1:nwc3DEeHmmLAfoZucVR881uASk0Mfjw8xYJ99tb5CcY=
+github.com/stretchr/testify v1.7.0/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg=
+github.com/terra-farm/go-xen-api-client v0.0.2 h1:EREW0N6XqU935b005yCwbPjm8F6582j2rI5C4ew3ZTQ=
+github.com/terra-farm/go-xen-api-client v0.0.2/go.mod h1:L7+Ea6rxzK7AL4DhcEPDQxdLKb4wKq0sYbxHS2ag9YE=
+github.com/tv42/httpunix v0.0.0-20150427012821-b75d8614f926/go.mod h1:9ESjWnEqriFuLhtthL60Sar/7RFoluCcXsuvEwTV5KM=
+github.com/ugorji/go v1.2.6 h1:tGiWC9HENWE2tqYycIqFTNorMmFRVhNwCpDOpWqnk8E=
+github.com/ugorji/go v1.2.6/go.mod h1:anCg0y61KIhDlPZmnH+so+RQbysYVyDko0IMgJv0Nn0=
+github.com/ugorji/go/codec v1.2.6 h1:7kbGefxLoDBuYXOms4yD7223OpNMMPNPZxXk5TvFcyQ=
+github.com/ugorji/go/codec v1.2.6/go.mod h1:V6TCNZ4PHqoHGFZuSG1W8nrCzzdgA2DozYxWFFpvxTw=
+github.com/ulikunitz/xz v0.5.8/go.mod h1:nbz6k7qbPmH4IRqmfOplQw/tblSgqTqBwxkY0oWt/14=
+github.com/ulikunitz/xz v0.5.10 h1:t92gobL9l3HE202wg3rlk19F6X+JOxl9BBrCCMYEYd8=
+github.com/ulikunitz/xz v0.5.10/go.mod h1:nbz6k7qbPmH4IRqmfOplQw/tblSgqTqBwxkY0oWt/14=
+github.com/urfave/cli v0.0.0-20171014202726-7bc6a0acffa5/go.mod h1:70zkFmudgCuE/ngEzBv17Jvp/497gISqfk5gWijbERA=
+github.com/vmihailenco/msgpack v3.3.3+incompatible/go.mod h1:fy3FlTQTDXWkZ7Bh6AcGMlsjHatGryHQYUTf1ShIgkk=
+github.com/vmihailenco/msgpack/v4 v4.3.12/go.mod h1:gborTTJjAo/GWTqqRjrLCn9pgNN+NXzzngzBKDPIqw4=
+github.com/vmihailenco/tagparser v0.1.1/go.mod h1:OeAg3pn3UbLjkWt+rN9oFYB6u/cQgqMEUPoW2WPyhdI=
+github.com/yuin/goldmark v1.1.25/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74=
+github.com/yuin/goldmark v1.1.27/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74=
+github.com/yuin/goldmark v1.1.32/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74=
+github.com/yuin/goldmark v1.2.1/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74=
+github.com/yuin/goldmark v1.3.5/go.mod h1:mwnBkeHKe2W/ZEtQ+71ViKU8L12m81fl3OWwC1Zlc8k=
+github.com/yuin/goldmark v1.4.1/go.mod h1:mwnBkeHKe2W/ZEtQ+71ViKU8L12m81fl3OWwC1Zlc8k=
+github.com/zclconf/go-cty v1.2.0/go.mod h1:hOPWgoHbaTUnI5k4D2ld+GRpFJSCe6bCM7m1q/N4PQ8=
+github.com/zclconf/go-cty v1.8.0/go.mod h1:vVKLxnk3puL4qRAv72AO+W99LUD4da90g3uUAzyuvAk=
+github.com/zclconf/go-cty v1.10.0 h1:mp9ZXQeIcN8kAwuqorjH+Q+njbJKjLrvB2yIh4q7U+0=
+github.com/zclconf/go-cty v1.10.0/go.mod h1:vVKLxnk3puL4qRAv72AO+W99LUD4da90g3uUAzyuvAk=
+github.com/zclconf/go-cty-debug v0.0.0-20191215020915-b22d67c1ba0b/go.mod h1:ZRKQfBXbGkpdV6QMzT3rU1kSTAnfu1dO8dPKjYprgj8=
+go.opencensus.io v0.21.0/go.mod h1:mSImk1erAIZhrmZN+AvHh14ztQfjbGwt4TtuofqLduU=
+go.opencensus.io v0.22.0/go.mod h1:+kGneAE2xo2IficOXnaByMWTGM9T73dGwxeWcUqIpI8=
+go.opencensus.io v0.22.2/go.mod h1:yxeiOL68Rb0Xd1ddK5vPZ/oVn4vY4Ynel7k9FzqtOIw=
+go.opencensus.io v0.22.3/go.mod h1:yxeiOL68Rb0Xd1ddK5vPZ/oVn4vY4Ynel7k9FzqtOIw=
+go.opencensus.io v0.22.4/go.mod h1:yxeiOL68Rb0Xd1ddK5vPZ/oVn4vY4Ynel7k9FzqtOIw=
+go.opencensus.io v0.22.5/go.mod h1:5pWMHQbX5EPX2/62yrJeAkowc+lfs/XD7Uxpq3pI6kk=
+go.opencensus.io v0.23.0 h1:gqCw0LfLxScz8irSi8exQc7fyQ0fKQU/qnC/X8+V/1M=
+go.opencensus.io v0.23.0/go.mod h1:XItmlyltB5F7CS4xOC1DcqMoFqwtC6OG2xF7mCv7P7E=
+go.opentelemetry.io/proto/otlp v0.7.0/go.mod h1:PqfVotwruBrMGOCsRd/89rSnXhoiJIqeYNgFYFoEGnI=
+go.uber.org/atomic v1.6.0/go.mod h1:sABNBOSYdrvTF6hTgEIbc7YasKWGhgEQZyfxyTvoXHQ=
+golang.org/x/crypto v0.0.0-20171113213409-9f005a07e0d3/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4=
+golang.org/x/crypto v0.0.0-20180904163835-0709b304e793/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4=
+golang.org/x/crypto v0.0.0-20181029021203-45a5f77698d3/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4=
+golang.org/x/crypto v0.0.0-20190222235706-ffb98f73852f/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4=
+golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w=
+golang.org/x/crypto v0.0.0-20190418165655-df01cb2cc480/go.mod h1:WFFai1msRO1wXaEeE5yQxYXgSfI8pQAWXbQop6sCtWE=
+golang.org/x/crypto v0.0.0-20190426145343-a29dc8fdc734/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI=
+golang.org/x/crypto v0.0.0-20190510104115-cbcb75029529/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI=
+golang.org/x/crypto v0.0.0-20190605123033-f99c8df09eb5/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI=
+golang.org/x/crypto v0.0.0-20190923035154-9ee001bba392/go.mod h1:/lpIB1dKB+9EgE3H3cr1v9wB50oz8l4C4h62xy7jSTY=
+golang.org/x/crypto v0.0.0-20191011191535-87dc89f01550/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI=
+golang.org/x/crypto v0.0.0-20200604202706-70a84ac30bf9/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto=
+golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto=
+golang.org/x/crypto v0.0.0-20200820211705-5c72a883971a/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto=
+golang.org/x/crypto v0.0.0-20210421170649-83a5a9bb288b/go.mod h1:T9bdIzuCu7OtxOm1hfPfRQxPLYneinmdGuTeoZ9dtd4=
+golang.org/x/crypto v0.0.0-20210921155107-089bfa567519/go.mod h1:GvvjBRRGRdwPK5ydBHafDWAxML/pGHZbMvKqRZ5+Abc=
+golang.org/x/crypto v0.0.0-20220427172511-eb4f295cb31f h1:OeJjE6G4dgCY4PIXvIRQbE8+RX+uXZyGhUy/ksMGJoc=
+golang.org/x/crypto v0.0.0-20220427172511-eb4f295cb31f/go.mod h1:IxCIyHEi3zRg3s0A5j5BB6A9Jmi73HwBIUl50j+osU4=
+golang.org/x/exp v0.0.0-20190121172915-509febef88a4/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA=
+golang.org/x/exp v0.0.0-20190306152737-a1d7652674e8/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA=
+golang.org/x/exp v0.0.0-20190510132918-efd6b22b2522/go.mod h1:ZjyILWgesfNpC6sMxTJOJm9Kp84zZh5NQWvqDGG3Qr8=
+golang.org/x/exp v0.0.0-20190731235908-ec7cb31e5a56/go.mod h1:JhuoJpWY28nO4Vef9tZUw9qufEGTyX1+7lmHxV5q5G4=
+golang.org/x/exp v0.0.0-20190829153037-c13cbed26979/go.mod h1:86+5VVa7VpoJ4kLfm080zCjGlMRFzhUhsZKEZO7MGek=
+golang.org/x/exp v0.0.0-20191030013958-a1ab85dbe136/go.mod h1:JXzH8nQsPlswgeRAPE3MuO9GYsAcnJvJ4vnMwN/5qkY=
+golang.org/x/exp v0.0.0-20191129062945-2f5052295587/go.mod h1:2RIsYlXP63K8oxa1u096TMicItID8zy7Y6sNkU49FU4=
+golang.org/x/exp v0.0.0-20191227195350-da58074b4299/go.mod h1:2RIsYlXP63K8oxa1u096TMicItID8zy7Y6sNkU49FU4=
+golang.org/x/exp v0.0.0-20200119233911-0405dc783f0a/go.mod h1:2RIsYlXP63K8oxa1u096TMicItID8zy7Y6sNkU49FU4=
+golang.org/x/exp v0.0.0-20200207192155-f17229e696bd/go.mod h1:J/WKrq2StrnmMY6+EHIKF9dgMWnmCNThgcyBT1FY9mM=
+golang.org/x/exp v0.0.0-20200224162631-6cc2880d07d6/go.mod h1:3jZMyOhIsHpP37uCMkUooju7aAi5cS1Q23tOzKc+0MU=
+golang.org/x/image v0.0.0-20190227222117-0694c2d4d067/go.mod h1:kZ7UVZpmo3dzQBMxlp+ypCbDeSB+sBbTgSJuh5dn5js=
+golang.org/x/image v0.0.0-20190802002840-cff245a6509b/go.mod h1:FeLwcggjj3mMvU+oOTbSwawSJRM1uh48EjtB4UJZlP0=
+golang.org/x/lint v0.0.0-20181026193005-c67002cb31c3/go.mod h1:UVdnD1Gm6xHRNCYTkRU2/jEulfH38KcIWyp/GAMgvoE=
+golang.org/x/lint v0.0.0-20190227174305-5b3e6a55c961/go.mod h1:wehouNa3lNwaWXcvxsM5YxQ5yQlVC4a0KAMCusXpPoU=
+golang.org/x/lint v0.0.0-20190301231843-5614ed5bae6f/go.mod h1:UVdnD1Gm6xHRNCYTkRU2/jEulfH38KcIWyp/GAMgvoE=
+golang.org/x/lint v0.0.0-20190313153728-d0100b6bd8b3/go.mod h1:6SW0HCj/g11FgYtHlgUYUwCkIfeOF89ocIRzGO/8vkc=
+golang.org/x/lint v0.0.0-20190409202823-959b441ac422/go.mod h1:6SW0HCj/g11FgYtHlgUYUwCkIfeOF89ocIRzGO/8vkc=
+golang.org/x/lint v0.0.0-20190909230951-414d861bb4ac/go.mod h1:6SW0HCj/g11FgYtHlgUYUwCkIfeOF89ocIRzGO/8vkc=
+golang.org/x/lint v0.0.0-20190930215403-16217165b5de/go.mod h1:6SW0HCj/g11FgYtHlgUYUwCkIfeOF89ocIRzGO/8vkc=
+golang.org/x/lint v0.0.0-20191125180803-fdd1cda4f05f/go.mod h1:5qLYkcX4OjUUV8bRuDixDT3tpyyb+LUpUlRWLxfhWrs=
+golang.org/x/lint v0.0.0-20200130185559-910be7a94367/go.mod h1:3xt1FjdF8hUf6vQPIChWIBhFzV8gjjsPE/fR3IyQdNY=
+golang.org/x/lint v0.0.0-20200302205851-738671d3881b/go.mod h1:3xt1FjdF8hUf6vQPIChWIBhFzV8gjjsPE/fR3IyQdNY=
+golang.org/x/lint v0.0.0-20201208152925-83fdc39ff7b5/go.mod h1:3xt1FjdF8hUf6vQPIChWIBhFzV8gjjsPE/fR3IyQdNY=
+golang.org/x/lint v0.0.0-20210508222113-6edffad5e616/go.mod h1:3xt1FjdF8hUf6vQPIChWIBhFzV8gjjsPE/fR3IyQdNY=
+golang.org/x/mobile v0.0.0-20190312151609-d3739f865fa6/go.mod h1:z+o9i4GpDbdi3rU15maQ/Ox0txvL9dWGYEHz965HBQE=
+golang.org/x/mobile v0.0.0-20190719004257-d2bd2a29d028/go.mod h1:E/iHnbuqvinMTCcRqshq8CkpyQDoeVncDDYHnLhea+o=
+golang.org/x/mobile v0.0.0-20210901025245-1fde1d6c3ca1/go.mod h1:jFTmtFYCV0MFtXBU+J5V/+5AUeVS0ON/0WkE/KSrl6E=
+golang.org/x/mod v0.0.0-20190513183733-4bf6d317e70e/go.mod h1:mXi4GBBbnImb6dmsKGUJ2LatrhH/nqhxcFungHvyanc=
+golang.org/x/mod v0.1.0/go.mod h1:0QHyrYULN0/3qlju5TqG8bIK38QM8yzMo5ekMj3DlcY=
+golang.org/x/mod v0.1.1-0.20191105210325-c90efee705ee/go.mod h1:QqPTAvyqsEbceGzBzNggFXnrqF1CaUcvgkdR5Ot7KZg=
+golang.org/x/mod v0.1.1-0.20191107180719-034126e5016b/go.mod h1:QqPTAvyqsEbceGzBzNggFXnrqF1CaUcvgkdR5Ot7KZg=
+golang.org/x/mod v0.2.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA=
+golang.org/x/mod v0.3.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA=
+golang.org/x/mod v0.4.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA=
+golang.org/x/mod v0.4.1/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA=
+golang.org/x/mod v0.4.2/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA=
+golang.org/x/mod v0.6.0-dev.0.20220106191415-9b9b3d81d5e3/go.mod h1:3p9vT2HGsQu2K1YbXdKPJLVgG5VJdoTa1poYQBtP1AY=
+golang.org/x/net v0.0.0-20180724234803-3673e40ba225/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4=
+golang.org/x/net v0.0.0-20180811021610-c39426892332/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4=
+golang.org/x/net v0.0.0-20180826012351-8a410e7b638d/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4=
+golang.org/x/net v0.0.0-20180906233101-161cd47e91fd/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4=
+golang.org/x/net v0.0.0-20181023162649-9b4f9f5ad519/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4=
+golang.org/x/net v0.0.0-20181114220301-adae6a3d119a/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4=
+golang.org/x/net v0.0.0-20181201002055-351d144fa1fc/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4=
+golang.org/x/net v0.0.0-20190108225652-1e06a53dbb7e/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4=
+golang.org/x/net v0.0.0-20190213061140-3a22650c66bd/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4=
+golang.org/x/net v0.0.0-20190311183353-d8887717615a/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg=
+golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg=
+golang.org/x/net v0.0.0-20190501004415-9ce7a6920f09/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg=
+golang.org/x/net v0.0.0-20190503192946-f4e77d36d62c/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg=
+golang.org/x/net v0.0.0-20190603091049-60506f45cf65/go.mod h1:HSz+uSET+XFnRR8LxR5pz3Of3rY3CfYBVs4xY44aLks=
+golang.org/x/net v0.0.0-20190613194153-d28f0bde5980/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s=
+golang.org/x/net v0.0.0-20190620200207-3b0461eec859/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s=
+golang.org/x/net v0.0.0-20190628185345-da137c7871d7/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s=
+golang.org/x/net v0.0.0-20190724013045-ca1201d0de80/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s=
+golang.org/x/net v0.0.0-20190813141303-74dc4d7220e7/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s=
+golang.org/x/net v0.0.0-20190923162816-aa69164e4478/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s=
+golang.org/x/net v0.0.0-20191004110552-13f9640d40b9/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s=
+golang.org/x/net v0.0.0-20191209160850-c0dbc17a3553/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s=
+golang.org/x/net v0.0.0-20200114155413-6afb5195e5aa/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s=
+golang.org/x/net v0.0.0-20200202094626-16171245cfb2/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s=
+golang.org/x/net v0.0.0-20200222125558-5a598a2470a0/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s=
+golang.org/x/net v0.0.0-20200226121028-0de0cce0169b/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s=
+golang.org/x/net v0.0.0-20200301022130-244492dfa37a/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s=
+golang.org/x/net v0.0.0-20200324143707-d3edc9973b7e/go.mod h1:qpuaurCH72eLCgpAm/N6yyVIVM9cpaDIP3A8BGJEC5A=
+golang.org/x/net v0.0.0-20200501053045-e0ff5e5a1de5/go.mod h1:qpuaurCH72eLCgpAm/N6yyVIVM9cpaDIP3A8BGJEC5A=
+golang.org/x/net v0.0.0-20200506145744-7e3656a0809f/go.mod h1:qpuaurCH72eLCgpAm/N6yyVIVM9cpaDIP3A8BGJEC5A=
+golang.org/x/net v0.0.0-20200513185701-a91f0712d120/go.mod h1:qpuaurCH72eLCgpAm/N6yyVIVM9cpaDIP3A8BGJEC5A=
+golang.org/x/net v0.0.0-20200520182314-0ba52f642ac2/go.mod h1:qpuaurCH72eLCgpAm/N6yyVIVM9cpaDIP3A8BGJEC5A=
+golang.org/x/net v0.0.0-20200602114024-627f9648deb9/go.mod h1:qpuaurCH72eLCgpAm/N6yyVIVM9cpaDIP3A8BGJEC5A=
+golang.org/x/net v0.0.0-20200625001655-4c5254603344/go.mod h1:/O7V0waA8r7cgGh81Ro3o1hOxt32SMVPicZroKQ2sZA=
+golang.org/x/net v0.0.0-20200707034311-ab3426394381/go.mod h1:/O7V0waA8r7cgGh81Ro3o1hOxt32SMVPicZroKQ2sZA=
+golang.org/x/net v0.0.0-20200822124328-c89045814202/go.mod h1:/O7V0waA8r7cgGh81Ro3o1hOxt32SMVPicZroKQ2sZA=
+golang.org/x/net v0.0.0-20201021035429-f5854403a974/go.mod h1:sp8m0HH+o8qH0wwXwYZr8TS3Oi6o0r6Gce1SSxlDquU=
+golang.org/x/net v0.0.0-20201031054903-ff519b6c9102/go.mod h1:sp8m0HH+o8qH0wwXwYZr8TS3Oi6o0r6Gce1SSxlDquU=
+golang.org/x/net v0.0.0-20201110031124-69a78807bb2b/go.mod h1:sp8m0HH+o8qH0wwXwYZr8TS3Oi6o0r6Gce1SSxlDquU=
+golang.org/x/net v0.0.0-20201209123823-ac852fbbde11/go.mod h1:m0MpNAwzfU5UDzcl9v0D8zg8gWTRqZa9RBIspLL5mdg=
+golang.org/x/net v0.0.0-20210119194325-5f4716e94777/go.mod h1:m0MpNAwzfU5UDzcl9v0D8zg8gWTRqZa9RBIspLL5mdg=
+golang.org/x/net v0.0.0-20210226172049-e18ecbb05110/go.mod h1:m0MpNAwzfU5UDzcl9v0D8zg8gWTRqZa9RBIspLL5mdg=
+golang.org/x/net v0.0.0-20210316092652-d523dce5a7f4/go.mod h1:RBQZq4jEuRlivfhVLdyRGr576XBO4/greRjx4P4O3yc=
+golang.org/x/net v0.0.0-20210405180319-a5a99cb37ef4/go.mod h1:p54w0d4576C0XHj96bSt6lcn1PtDYWL6XObtHCRCNQM=
+golang.org/x/net v0.0.0-20210503060351-7fd8e65b6420/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y=
+golang.org/x/net v0.0.0-20210614182718-04defd469f4e/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y=
+golang.org/x/net v0.0.0-20211015210444-4f30a5c0130f/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y=
+golang.org/x/net v0.0.0-20211112202133-69e39bad7dc2 h1:CIJ76btIcR3eFI5EgSo6k1qKw9KJexJuRLI9G7Hp5wE=
+golang.org/x/net v0.0.0-20211112202133-69e39bad7dc2/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y=
+golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U=
+golang.org/x/oauth2 v0.0.0-20190226205417-e64efc72b421/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw=
+golang.org/x/oauth2 v0.0.0-20190604053449-0f29369cfe45/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw=
+golang.org/x/oauth2 v0.0.0-20191202225959-858c2ad4c8b6/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw=
+golang.org/x/oauth2 v0.0.0-20200107190931-bf48bf16ab8d/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw=
+golang.org/x/oauth2 v0.0.0-20200902213428-5d25da1a8d43/go.mod h1:KelEdhl1UZF7XfJ4dDtk6s++YSgaE7mD/BuKKDLBl4A=
+golang.org/x/oauth2 v0.0.0-20201109201403-9fd604954f58/go.mod h1:KelEdhl1UZF7XfJ4dDtk6s++YSgaE7mD/BuKKDLBl4A=
+golang.org/x/oauth2 v0.0.0-20201208152858-08078c50e5b5/go.mod h1:KelEdhl1UZF7XfJ4dDtk6s++YSgaE7mD/BuKKDLBl4A=
+golang.org/x/oauth2 v0.0.0-20210218202405-ba52d332ba99/go.mod h1:KelEdhl1UZF7XfJ4dDtk6s++YSgaE7mD/BuKKDLBl4A=
+golang.org/x/oauth2 v0.0.0-20210220000619-9bb904979d93/go.mod h1:KelEdhl1UZF7XfJ4dDtk6s++YSgaE7mD/BuKKDLBl4A=
+golang.org/x/oauth2 v0.0.0-20210313182246-cd4f82c27b84/go.mod h1:KelEdhl1UZF7XfJ4dDtk6s++YSgaE7mD/BuKKDLBl4A=
+golang.org/x/oauth2 v0.0.0-20210514164344-f6687ab2804c/go.mod h1:KelEdhl1UZF7XfJ4dDtk6s++YSgaE7mD/BuKKDLBl4A=
+golang.org/x/oauth2 v0.0.0-20210628180205-a41e5a781914/go.mod h1:KelEdhl1UZF7XfJ4dDtk6s++YSgaE7mD/BuKKDLBl4A=
+golang.org/x/oauth2 v0.0.0-20210805134026-6f1e6394065a/go.mod h1:KelEdhl1UZF7XfJ4dDtk6s++YSgaE7mD/BuKKDLBl4A=
+golang.org/x/oauth2 v0.0.0-20210819190943-2bc19b11175f h1:Qmd2pbz05z7z6lm0DrgQVVPuBm92jqujBKMHMOlOQEw=
+golang.org/x/oauth2 v0.0.0-20210819190943-2bc19b11175f/go.mod h1:KelEdhl1UZF7XfJ4dDtk6s++YSgaE7mD/BuKKDLBl4A=
+golang.org/x/sync v0.0.0-20180314180146-1d60e4601c6f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
+golang.org/x/sync v0.0.0-20181108010431-42b317875d0f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
+golang.org/x/sync v0.0.0-20181221193216-37e7f081c4d4/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
+golang.org/x/sync v0.0.0-20190227155943-e225da77a7e6/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
+golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
+golang.org/x/sync v0.0.0-20190911185100-cd5d95a43a6e/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
+golang.org/x/sync v0.0.0-20200317015054-43a5402ce75a/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
+golang.org/x/sync v0.0.0-20200625203802-6e8e738ad208/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
+golang.org/x/sync v0.0.0-20201020160332-67f06af15bc9/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
+golang.org/x/sync v0.0.0-20201207232520-09787c993a3a/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
+golang.org/x/sync v0.0.0-20210220032951-036812b2e83c h1:5KslGYwFpkhGh+Q16bwMP3cOontH8FOep7tGV86Y7SQ=
+golang.org/x/sync v0.0.0-20210220032951-036812b2e83c/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
+golang.org/x/sys v0.0.0-20180823144017-11551d06cbcc/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
+golang.org/x/sys v0.0.0-20180830151530-49385e6e1522/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
+golang.org/x/sys v0.0.0-20180905080454-ebe1bf3edb33/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
+golang.org/x/sys v0.0.0-20180909124046-d0be0721c37e/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
+golang.org/x/sys v0.0.0-20181026203630-95b1ffbd15a5/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
+golang.org/x/sys v0.0.0-20181116152217-5ac8a444bdc5/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
+golang.org/x/sys v0.0.0-20190129075346-302c3dd5f1cc/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
+golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
+golang.org/x/sys v0.0.0-20190222072716-a9d3bda3a223/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
+golang.org/x/sys v0.0.0-20190312061237-fead79001313/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
+golang.org/x/sys v0.0.0-20190403152447-81d4e9dc473e/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
+golang.org/x/sys v0.0.0-20190412213103-97732733099d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
+golang.org/x/sys v0.0.0-20190422165155-953cdadca894/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
+golang.org/x/sys v0.0.0-20190502145724-3ef323f4f1fd/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
+golang.org/x/sys v0.0.0-20190502175342-a43fa875dd82/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
+golang.org/x/sys v0.0.0-20190507160741-ecd444e8653b/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
+golang.org/x/sys v0.0.0-20190514135907-3a4b5fb9f71f/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
+golang.org/x/sys v0.0.0-20190606165138-5da285871e9c/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
+golang.org/x/sys v0.0.0-20190624142023-c5567b49c5d0/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
+golang.org/x/sys v0.0.0-20190726091711-fc99dfbffb4e/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
+golang.org/x/sys v0.0.0-20190916202348-b4ddaad3f8a3/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
+golang.org/x/sys v0.0.0-20190922100055-0a153f010e69/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
+golang.org/x/sys v0.0.0-20190924154521-2837fb4f24fe/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
+golang.org/x/sys v0.0.0-20191001151750-bb3f8db39f24/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
+golang.org/x/sys v0.0.0-20191008105621-543471e840be/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
+golang.org/x/sys v0.0.0-20191026070338-33540a1f6037/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
+golang.org/x/sys v0.0.0-20191204072324-ce4227a45e2e/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
+golang.org/x/sys v0.0.0-20191228213918-04cbcbbfeed8/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
+golang.org/x/sys v0.0.0-20200113162924-86b910548bc1/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
+golang.org/x/sys v0.0.0-20200116001909-b77594299b42/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
+golang.org/x/sys v0.0.0-20200122134326-e047566fdf82/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
+golang.org/x/sys v0.0.0-20200124204421-9fbb57f87de9/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
+golang.org/x/sys v0.0.0-20200202164722-d101bd2416d5/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
+golang.org/x/sys v0.0.0-20200212091648-12a6c2dcc1e4/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
+golang.org/x/sys v0.0.0-20200223170610-d5e6a3e2c0ae/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
+golang.org/x/sys v0.0.0-20200302150141-5c8b2ff67527/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
+golang.org/x/sys v0.0.0-20200323222414-85ca7c5b95cd/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
+golang.org/x/sys v0.0.0-20200331124033-c3d80250170d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
+golang.org/x/sys v0.0.0-20200501052902-10377860bb8e/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
+golang.org/x/sys v0.0.0-20200511232937-7e40ca221e25/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
+golang.org/x/sys v0.0.0-20200515095857-1151b9dac4a9/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
+golang.org/x/sys v0.0.0-20200523222454-059865788121/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
+golang.org/x/sys v0.0.0-20200602225109-6fdc65e7d980/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
+golang.org/x/sys v0.0.0-20200803210538-64077c9b5642/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
+golang.org/x/sys v0.0.0-20200905004654-be1d3432aa8f/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
+golang.org/x/sys v0.0.0-20200930185726-fdedc70b468f/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
+golang.org/x/sys v0.0.0-20201119102817-f84b799fce68/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
+golang.org/x/sys v0.0.0-20201201145000-ef89a241ccb3/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
+golang.org/x/sys v0.0.0-20210104204734-6f8348627aad/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
+golang.org/x/sys v0.0.0-20210119212857-b64e53b001e4/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
+golang.org/x/sys v0.0.0-20210220050731-9a76102bfb43/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
+golang.org/x/sys v0.0.0-20210305230114-8fe3ee5dd75b/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
+golang.org/x/sys v0.0.0-20210315160823-c6e025ad8005/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
+golang.org/x/sys v0.0.0-20210320140829-1e4c9ba3b0c4/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
+golang.org/x/sys v0.0.0-20210330210617-4fbd30eecc44/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
+golang.org/x/sys v0.0.0-20210423082822-04245dca01da/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
+golang.org/x/sys v0.0.0-20210423185535-09eb48e85fd7/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
+golang.org/x/sys v0.0.0-20210510120138-977fb7262007/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
+golang.org/x/sys v0.0.0-20210514084401-e8d321eab015/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
+golang.org/x/sys v0.0.0-20210603125802-9665404d3644/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
+golang.org/x/sys v0.0.0-20210615035016-665e8c7367d1/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
+golang.org/x/sys v0.0.0-20210616094352-59db8d763f22/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
+golang.org/x/sys v0.0.0-20210630005230-0f9fa26af87c/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
+golang.org/x/sys v0.0.0-20210806184541-e5e7981a1069/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
+golang.org/x/sys v0.0.0-20210823070655-63515b42dcdf/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
+golang.org/x/sys v0.0.0-20211019181941-9d821ace8654 h1:id054HUawV2/6IGm2IV8KZQjqtwAOo2CYlOToYqa0d0=
+golang.org/x/sys v0.0.0-20211019181941-9d821ace8654/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
+golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo=
+golang.org/x/term v0.0.0-20210615171337-6886f2dfbf5b h1:9zKuko04nR4gjZ4+DNjHqRlAJqbJETHwiNKDqTfOjfE=
+golang.org/x/term v0.0.0-20210615171337-6886f2dfbf5b/go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8=
+golang.org/x/text v0.0.0-20170915032832-14c0d48ead0c/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
+golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
+golang.org/x/text v0.3.1-0.20180807135948-17ff2d5776d2/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
+golang.org/x/text v0.3.2/go.mod h1:bEr9sfX3Q8Zfm5fL9x+3itogRgK3+ptLWKqgva+5dAk=
+golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ=
+golang.org/x/text v0.3.4/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ=
+golang.org/x/text v0.3.5/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ=
+golang.org/x/text v0.3.6/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ=
+golang.org/x/text v0.3.7 h1:olpwvP2KacW1ZWvsR7uQhoyTYvKAupfQrRGBFM352Gk=
+golang.org/x/text v0.3.7/go.mod h1:u+2+/6zg+i71rQMx5EYifcz6MCKuco9NR6JIITiCfzQ=
+golang.org/x/time v0.0.0-20181108054448-85acf8d2951c/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ=
+golang.org/x/time v0.0.0-20190308202827-9d24e82272b4/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ=
+golang.org/x/time v0.0.0-20191024005414-555d28b269f0/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ=
+golang.org/x/time v0.0.0-20200416051211-89c76fbcd5d1/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ=
+golang.org/x/time v0.0.0-20210723032227-1f47c861a9ac h1:7zkz7BUtwNFFqcowJ+RIgu2MaV/MapERkDIy+mwPyjs=
+golang.org/x/time v0.0.0-20210723032227-1f47c861a9ac/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ=
+golang.org/x/tools v0.0.0-20180221164845-07fd8470d635/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ=
+golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ=
+golang.org/x/tools v0.0.0-20181030221726-6c7e314b6563/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ=
+golang.org/x/tools v0.0.0-20190114222345-bf090417da8b/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ=
+golang.org/x/tools v0.0.0-20190226205152-f727befe758c/go.mod h1:9Yl7xja0Znq3iFh3HoIrodX9oNMXvdceNzlUR8zjMvY=
+golang.org/x/tools v0.0.0-20190311212946-11955173bddd/go.mod h1:LCzVGOaR6xXOjkQ3onu1FJEFr0SW1gC7cKk1uF8kGRs=
+golang.org/x/tools v0.0.0-20190312151545-0bb0c0a6e846/go.mod h1:LCzVGOaR6xXOjkQ3onu1FJEFr0SW1gC7cKk1uF8kGRs=
+golang.org/x/tools v0.0.0-20190312170243-e65039ee4138/go.mod h1:LCzVGOaR6xXOjkQ3onu1FJEFr0SW1gC7cKk1uF8kGRs=
+golang.org/x/tools v0.0.0-20190425150028-36563e24a262/go.mod h1:RgjU9mgBXZiqYHBnxXauZ1Gv1EHHAz9KjViQ78xBX0Q=
+golang.org/x/tools v0.0.0-20190506145303-2d16b83fe98c/go.mod h1:RgjU9mgBXZiqYHBnxXauZ1Gv1EHHAz9KjViQ78xBX0Q=
+golang.org/x/tools v0.0.0-20190524140312-2c0ae7006135/go.mod h1:RgjU9mgBXZiqYHBnxXauZ1Gv1EHHAz9KjViQ78xBX0Q=
+golang.org/x/tools v0.0.0-20190606124116-d0a3d012864b/go.mod h1:/rFqwRUd4F7ZHNgwSSTFct+R/Kf4OFW1sUzUTQQTgfc=
+golang.org/x/tools v0.0.0-20190621195816-6e04913cbbac/go.mod h1:/rFqwRUd4F7ZHNgwSSTFct+R/Kf4OFW1sUzUTQQTgfc=
+golang.org/x/tools v0.0.0-20190624222133-a101b041ded4/go.mod h1:/rFqwRUd4F7ZHNgwSSTFct+R/Kf4OFW1sUzUTQQTgfc=
+golang.org/x/tools v0.0.0-20190628153133-6cdbf07be9d0/go.mod h1:/rFqwRUd4F7ZHNgwSSTFct+R/Kf4OFW1sUzUTQQTgfc=
+golang.org/x/tools v0.0.0-20190816200558-6889da9d5479/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo=
+golang.org/x/tools v0.0.0-20190907020128-2ca718005c18/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo=
+golang.org/x/tools v0.0.0-20190911174233-4f2ddba30aff/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo=
+golang.org/x/tools v0.0.0-20191012152004-8de300cfc20a/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo=
+golang.org/x/tools v0.0.0-20191029041327-9cc4af7d6b2c/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo=
+golang.org/x/tools v0.0.0-20191113191852-77e3bb0ad9e7/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo=
+golang.org/x/tools v0.0.0-20191115202509-3a792d9c32b2/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo=
+golang.org/x/tools v0.0.0-20191119224855-298f0cb1881e/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo=
+golang.org/x/tools v0.0.0-20191125144606-a911d9008d1f/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo=
+golang.org/x/tools v0.0.0-20191130070609-6e064ea0cf2d/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo=
+golang.org/x/tools v0.0.0-20191216173652-a0e659d51361/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28=
+golang.org/x/tools v0.0.0-20191227053925-7b8e75db28f4/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28=
+golang.org/x/tools v0.0.0-20200117161641-43d50277825c/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28=
+golang.org/x/tools v0.0.0-20200122220014-bf1340f18c4a/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28=
+golang.org/x/tools v0.0.0-20200130002326-2f3ba24bd6e7/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28=
+golang.org/x/tools v0.0.0-20200204074204-1cc6d1ef6c74/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28=
+golang.org/x/tools v0.0.0-20200207183749-b753a1ba74fa/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28=
+golang.org/x/tools v0.0.0-20200212150539-ea181f53ac56/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28=
+golang.org/x/tools v0.0.0-20200224181240-023911ca70b2/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28=
+golang.org/x/tools v0.0.0-20200227222343-706bc42d1f0d/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28=
+golang.org/x/tools v0.0.0-20200304193943-95d2e580d8eb/go.mod h1:o4KQGtdN14AW+yjsvvwRTJJuXz8XRtIHtEnmAXLyFUw=
+golang.org/x/tools v0.0.0-20200312045724-11d5b4c81c7d/go.mod h1:o4KQGtdN14AW+yjsvvwRTJJuXz8XRtIHtEnmAXLyFUw=
+golang.org/x/tools v0.0.0-20200331025713-a30bf2db82d4/go.mod h1:Sl4aGygMT6LrqrWclx+PTx3U+LnKx/seiNR+3G19Ar8=
+golang.org/x/tools v0.0.0-20200501065659-ab2804fb9c9d/go.mod h1:EkVYQZoAsY45+roYkvgYkIh4xh/qjgUK9TdY2XT94GE=
+golang.org/x/tools v0.0.0-20200512131952-2bc93b1c0c88/go.mod h1:EkVYQZoAsY45+roYkvgYkIh4xh/qjgUK9TdY2XT94GE=
+golang.org/x/tools v0.0.0-20200515010526-7d3b6ebf133d/go.mod h1:EkVYQZoAsY45+roYkvgYkIh4xh/qjgUK9TdY2XT94GE=
+golang.org/x/tools v0.0.0-20200618134242-20370b0cb4b2/go.mod h1:EkVYQZoAsY45+roYkvgYkIh4xh/qjgUK9TdY2XT94GE=
+golang.org/x/tools v0.0.0-20200729194436-6467de6f59a7/go.mod h1:njjCfa9FT2d7l9Bc6FUM5FLjQPp3cFF28FI3qnDFljA=
+golang.org/x/tools v0.0.0-20200804011535-6c149bb5ef0d/go.mod h1:njjCfa9FT2d7l9Bc6FUM5FLjQPp3cFF28FI3qnDFljA=
+golang.org/x/tools v0.0.0-20200825202427-b303f430e36d/go.mod h1:njjCfa9FT2d7l9Bc6FUM5FLjQPp3cFF28FI3qnDFljA=
+golang.org/x/tools v0.0.0-20200904185747-39188db58858/go.mod h1:Cj7w3i3Rnn0Xh82ur9kSqwfTHTeVxaDqrfMjpcNT6bE=
+golang.org/x/tools v0.0.0-20201110124207-079ba7bd75cd/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA=
+golang.org/x/tools v0.0.0-20201201161351-ac6f37ff4c2a/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA=
+golang.org/x/tools v0.0.0-20201208233053-a543418bbed2/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA=
+golang.org/x/tools v0.0.0-20210105154028-b0ab187a4818/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA=
+golang.org/x/tools v0.1.0/go.mod h1:xkSsbof2nBLbhDlRMhhhyNLN/zl3eTqcnHD5viDpcZ0=
+golang.org/x/tools v0.1.1/go.mod h1:o0xws9oXOQQZyjljx8fwUC0k7L1pTE6eaCbjGeHmOkk=
+golang.org/x/tools v0.1.2/go.mod h1:o0xws9oXOQQZyjljx8fwUC0k7L1pTE6eaCbjGeHmOkk=
+golang.org/x/tools v0.1.3/go.mod h1:o0xws9oXOQQZyjljx8fwUC0k7L1pTE6eaCbjGeHmOkk=
+golang.org/x/tools v0.1.4/go.mod h1:o0xws9oXOQQZyjljx8fwUC0k7L1pTE6eaCbjGeHmOkk=
+golang.org/x/tools v0.1.5/go.mod h1:o0xws9oXOQQZyjljx8fwUC0k7L1pTE6eaCbjGeHmOkk=
+golang.org/x/tools v0.1.10/go.mod h1:Uh6Zz+xoGYZom868N8YTex3t7RhtHDBrE8Gzo9bV56E=
+golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
+golang.org/x/xerrors v0.0.0-20191011141410-1b5146add898/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
+golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
+golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1 h1:go1bK/D/BFZV2I8cIQd1NKEZ+0owSTG1fDTci4IqFcE=
+golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
+google.golang.org/api v0.4.0/go.mod h1:8k5glujaEP+g9n7WNsDg8QP6cUVNI86fCNMcbazEtwE=
+google.golang.org/api v0.7.0/go.mod h1:WtwebWUNSVBH/HAw79HIFXZNqEvBhG+Ra+ax0hx3E3M=
+google.golang.org/api v0.8.0/go.mod h1:o4eAsZoiT+ibD93RtjEohWalFOjRDx6CVaqeizhEnKg=
+google.golang.org/api v0.9.0/go.mod h1:o4eAsZoiT+ibD93RtjEohWalFOjRDx6CVaqeizhEnKg=
+google.golang.org/api v0.13.0/go.mod h1:iLdEw5Ide6rF15KTC1Kkl0iskquN2gFfn9o9XIsbkAI=
+google.golang.org/api v0.14.0/go.mod h1:iLdEw5Ide6rF15KTC1Kkl0iskquN2gFfn9o9XIsbkAI=
+google.golang.org/api v0.15.0/go.mod h1:iLdEw5Ide6rF15KTC1Kkl0iskquN2gFfn9o9XIsbkAI=
+google.golang.org/api v0.17.0/go.mod h1:BwFmGc8tA3vsd7r/7kR8DY7iEEGSU04BFxCo5jP/sfE=
+google.golang.org/api v0.18.0/go.mod h1:BwFmGc8tA3vsd7r/7kR8DY7iEEGSU04BFxCo5jP/sfE=
+google.golang.org/api v0.19.0/go.mod h1:BwFmGc8tA3vsd7r/7kR8DY7iEEGSU04BFxCo5jP/sfE=
+google.golang.org/api v0.20.0/go.mod h1:BwFmGc8tA3vsd7r/7kR8DY7iEEGSU04BFxCo5jP/sfE=
+google.golang.org/api v0.21.0/go.mod h1:BwFmGc8tA3vsd7r/7kR8DY7iEEGSU04BFxCo5jP/sfE=
+google.golang.org/api v0.22.0/go.mod h1:BwFmGc8tA3vsd7r/7kR8DY7iEEGSU04BFxCo5jP/sfE=
+google.golang.org/api v0.24.0/go.mod h1:lIXQywCXRcnZPGlsd8NbLnOjtAoL6em04bJ9+z0MncE=
+google.golang.org/api v0.28.0/go.mod h1:lIXQywCXRcnZPGlsd8NbLnOjtAoL6em04bJ9+z0MncE=
+google.golang.org/api v0.29.0/go.mod h1:Lcubydp8VUV7KeIHD9z2Bys/sm/vGKnG1UHuDBSrHWM=
+google.golang.org/api v0.30.0/go.mod h1:QGmEvQ87FHZNiUVJkT14jQNYJ4ZJjdRF23ZXz5138Fc=
+google.golang.org/api v0.35.0/go.mod h1:/XrVsuzM0rZmrsbjJutiuftIzeuTQcEeaYcSk/mQ1dg=
+google.golang.org/api v0.36.0/go.mod h1:+z5ficQTmoYpPn8LCUNVpK5I7hwkpjbcgqA7I34qYtE=
+google.golang.org/api v0.40.0/go.mod h1:fYKFpnQN0DsDSKRVRcQSDQNtqWPfM9i+zNPxepjRCQ8=
+google.golang.org/api v0.41.0/go.mod h1:RkxM5lITDfTzmyKFPt+wGrCJbVfniCr2ool8kTBzRTU=
+google.golang.org/api v0.43.0/go.mod h1:nQsDGjRXMo4lvh5hP0TKqF244gqhGcr/YSIykhUk/94=
+google.golang.org/api v0.47.0/go.mod h1:Wbvgpq1HddcWVtzsVLyfLp8lDg6AA241LmgIL59tHXo=
+google.golang.org/api v0.48.0/go.mod h1:71Pr1vy+TAZRPkPs/xlCf5SsU8WjuAWv1Pfjbtukyy4=
+google.golang.org/api v0.50.0/go.mod h1:4bNT5pAuq5ji4SRZm+5QIkjny9JAyVD/3gaSihNefaw=
+google.golang.org/api v0.51.0/go.mod h1:t4HdrdoNgyN5cbEfm7Lum0lcLDLiise1F8qDKX00sOU=
+google.golang.org/api v0.54.0/go.mod h1:7C4bFFOvVDGXjfDTAsgGwDgAxRDeQ4X8NvUedIt6z3k=
+google.golang.org/api v0.55.0/go.mod h1:38yMfeP1kfjsl8isn0tliTjIb1rJXcQi4UXlbqivdVE=
+google.golang.org/api v0.56.0 h1:08F9XVYTLOGeSQb3xI9C0gXMuQanhdGed0cWFhDozbI=
+google.golang.org/api v0.56.0/go.mod h1:38yMfeP1kfjsl8isn0tliTjIb1rJXcQi4UXlbqivdVE=
+google.golang.org/appengine v1.1.0/go.mod h1:EbEs0AVv82hx2wNQdGPgUI5lhzA/G0D9YwlJXL52JkM=
+google.golang.org/appengine v1.4.0/go.mod h1:xpcJRLb0r/rnEns0DIKYYv+WjYCduHsrkT7/EB5XEv4=
+google.golang.org/appengine v1.5.0/go.mod h1:xpcJRLb0r/rnEns0DIKYYv+WjYCduHsrkT7/EB5XEv4=
+google.golang.org/appengine v1.6.1/go.mod h1:i06prIuMbXzDqacNJfV5OdTW448YApPu5ww/cMBSeb0=
+google.golang.org/appengine v1.6.5/go.mod h1:8WjMMxjGQR8xUklV/ARdw2HLXBOI7O7uCIDZVag1xfc=
+google.golang.org/appengine v1.6.6/go.mod h1:8WjMMxjGQR8xUklV/ARdw2HLXBOI7O7uCIDZVag1xfc=
+google.golang.org/appengine v1.6.7 h1:FZR1q0exgwxzPzp/aF+VccGrSfxfPpkBqjIIEq3ru6c=
+google.golang.org/appengine v1.6.7/go.mod h1:8WjMMxjGQR8xUklV/ARdw2HLXBOI7O7uCIDZVag1xfc=
+google.golang.org/genproto v0.0.0-20180817151627-c66870c02cf8/go.mod h1:JiN7NxoALGmiZfu7CAH4rXhgtRTLTxftemlI0sWmxmc=
+google.golang.org/genproto v0.0.0-20190307195333-5fe7a883aa19/go.mod h1:VzzqZJRnGkLBvHegQrXjBqPurQTc5/KpmUdxsrq26oE=
+google.golang.org/genproto v0.0.0-20190418145605-e7d98fc518a7/go.mod h1:VzzqZJRnGkLBvHegQrXjBqPurQTc5/KpmUdxsrq26oE=
+google.golang.org/genproto v0.0.0-20190425155659-357c62f0e4bb/go.mod h1:VzzqZJRnGkLBvHegQrXjBqPurQTc5/KpmUdxsrq26oE=
+google.golang.org/genproto v0.0.0-20190502173448-54afdca5d873/go.mod h1:VzzqZJRnGkLBvHegQrXjBqPurQTc5/KpmUdxsrq26oE=
+google.golang.org/genproto v0.0.0-20190801165951-fa694d86fc64/go.mod h1:DMBHOl98Agz4BDEuKkezgsaosCRResVns1a3J2ZsMNc=
+google.golang.org/genproto v0.0.0-20190819201941-24fa4b261c55/go.mod h1:DMBHOl98Agz4BDEuKkezgsaosCRResVns1a3J2ZsMNc=
+google.golang.org/genproto v0.0.0-20190911173649-1774047e7e51/go.mod h1:IbNlFCBrqXvoKpeg0TB2l7cyZUmoaFKYIwrEpbDKLA8=
+google.golang.org/genproto v0.0.0-20191108220845-16a3f7862a1a/go.mod h1:n3cpQtvxv34hfy77yVDNjmbRyujviMdxYliBSkLhpCc=
+google.golang.org/genproto v0.0.0-20191115194625-c23dd37a84c9/go.mod h1:n3cpQtvxv34hfy77yVDNjmbRyujviMdxYliBSkLhpCc=
+google.golang.org/genproto v0.0.0-20191216164720-4f79533eabd1/go.mod h1:n3cpQtvxv34hfy77yVDNjmbRyujviMdxYliBSkLhpCc=
+google.golang.org/genproto v0.0.0-20191230161307-f3c370f40bfb/go.mod h1:n3cpQtvxv34hfy77yVDNjmbRyujviMdxYliBSkLhpCc=
+google.golang.org/genproto v0.0.0-20200115191322-ca5a22157cba/go.mod h1:n3cpQtvxv34hfy77yVDNjmbRyujviMdxYliBSkLhpCc=
+google.golang.org/genproto v0.0.0-20200122232147-0452cf42e150/go.mod h1:n3cpQtvxv34hfy77yVDNjmbRyujviMdxYliBSkLhpCc=
+google.golang.org/genproto v0.0.0-20200204135345-fa8e72b47b90/go.mod h1:GmwEX6Z4W5gMy59cAlVYjN9JhxgbQH6Gn+gFDQe2lzA=
+google.golang.org/genproto v0.0.0-20200212174721-66ed5ce911ce/go.mod h1:55QSHmfGQM9UVYDPBsyGGes0y52j32PQ3BqQfXhyH3c=
+google.golang.org/genproto v0.0.0-20200224152610-e50cd9704f63/go.mod h1:55QSHmfGQM9UVYDPBsyGGes0y52j32PQ3BqQfXhyH3c=
+google.golang.org/genproto v0.0.0-20200228133532-8c2c7df3a383/go.mod h1:55QSHmfGQM9UVYDPBsyGGes0y52j32PQ3BqQfXhyH3c=
+google.golang.org/genproto v0.0.0-20200305110556-506484158171/go.mod h1:55QSHmfGQM9UVYDPBsyGGes0y52j32PQ3BqQfXhyH3c=
+google.golang.org/genproto v0.0.0-20200312145019-da6875a35672/go.mod h1:55QSHmfGQM9UVYDPBsyGGes0y52j32PQ3BqQfXhyH3c=
+google.golang.org/genproto v0.0.0-20200331122359-1ee6d9798940/go.mod h1:55QSHmfGQM9UVYDPBsyGGes0y52j32PQ3BqQfXhyH3c=
+google.golang.org/genproto v0.0.0-20200430143042-b979b6f78d84/go.mod h1:55QSHmfGQM9UVYDPBsyGGes0y52j32PQ3BqQfXhyH3c=
+google.golang.org/genproto v0.0.0-20200511104702-f5ebc3bea380/go.mod h1:55QSHmfGQM9UVYDPBsyGGes0y52j32PQ3BqQfXhyH3c=
+google.golang.org/genproto v0.0.0-20200513103714-09dca8ec2884/go.mod h1:55QSHmfGQM9UVYDPBsyGGes0y52j32PQ3BqQfXhyH3c=
+google.golang.org/genproto v0.0.0-20200515170657-fc4c6c6a6587/go.mod h1:YsZOwe1myG/8QRHRsmBRE1LrgQY60beZKjly0O1fX9U=
+google.golang.org/genproto v0.0.0-20200526211855-cb27e3aa2013/go.mod h1:NbSheEEYHJ7i3ixzK3sjbqSGDJWnxyFXZblF3eUsNvo=
+google.golang.org/genproto v0.0.0-20200618031413-b414f8b61790/go.mod h1:jDfRM7FcilCzHH/e9qn6dsT145K34l5v+OpcnNgKAAA=
+google.golang.org/genproto v0.0.0-20200729003335-053ba62fc06f/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no=
+google.golang.org/genproto v0.0.0-20200804131852-c06518451d9c/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no=
+google.golang.org/genproto v0.0.0-20200825200019-8632dd797987/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no=
+google.golang.org/genproto v0.0.0-20200904004341-0bd0a958aa1d/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no=
+google.golang.org/genproto v0.0.0-20201109203340-2640f1f9cdfb/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no=
+google.golang.org/genproto v0.0.0-20201201144952-b05cb90ed32e/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no=
+google.golang.org/genproto v0.0.0-20201210142538-e3217bee35cc/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no=
+google.golang.org/genproto v0.0.0-20201214200347-8c77b98c765d/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no=
+google.golang.org/genproto v0.0.0-20210222152913-aa3ee6e6a81c/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no=
+google.golang.org/genproto v0.0.0-20210303154014-9728d6b83eeb/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no=
+google.golang.org/genproto v0.0.0-20210310155132-4ce2db91004e/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no=
+google.golang.org/genproto v0.0.0-20210319143718-93e7006c17a6/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no=
+google.golang.org/genproto v0.0.0-20210402141018-6c239bbf2bb1/go.mod h1:9lPAdzaEmUacj36I+k7YKbEc5CXzPIeORRgDAUOu28A=
+google.golang.org/genproto v0.0.0-20210513213006-bf773b8c8384/go.mod h1:P3QM42oQyzQSnHPnZ/vqoCdDmzH28fzWByN9asMeM8A=
+google.golang.org/genproto v0.0.0-20210602131652-f16073e35f0c/go.mod h1:UODoCrxHCcBojKKwX1terBiRUaqAsFqJiF615XL43r0=
+google.golang.org/genproto v0.0.0-20210604141403-392c879c8b08/go.mod h1:UODoCrxHCcBojKKwX1terBiRUaqAsFqJiF615XL43r0=
+google.golang.org/genproto v0.0.0-20210608205507-b6d2f5bf0d7d/go.mod h1:UODoCrxHCcBojKKwX1terBiRUaqAsFqJiF615XL43r0=
+google.golang.org/genproto v0.0.0-20210624195500-8bfb893ecb84/go.mod h1:SzzZ/N+nwJDaO1kznhnlzqS8ocJICar6hYhVyhi++24=
+google.golang.org/genproto v0.0.0-20210713002101-d411969a0d9a/go.mod h1:AxrInvYm1dci+enl5hChSFPOmmUF1+uAa/UsgNRWd7k=
+google.golang.org/genproto v0.0.0-20210716133855-ce7ef5c701ea/go.mod h1:AxrInvYm1dci+enl5hChSFPOmmUF1+uAa/UsgNRWd7k=
+google.golang.org/genproto v0.0.0-20210728212813-7823e685a01f/go.mod h1:ob2IJxKrgPT52GcgX759i1sleT07tiKowYBGbczaW48=
+google.golang.org/genproto v0.0.0-20210805201207-89edb61ffb67/go.mod h1:ob2IJxKrgPT52GcgX759i1sleT07tiKowYBGbczaW48=
+google.golang.org/genproto v0.0.0-20210813162853-db860fec028c/go.mod h1:cFeNkxwySK631ADgubI+/XFU/xp8FD5KIVV4rj8UC5w=
+google.golang.org/genproto v0.0.0-20210821163610-241b8fcbd6c8/go.mod h1:eFjDcFEctNawg4eG61bRv87N7iHBWyVhJu7u1kqDUXY=
+google.golang.org/genproto v0.0.0-20210825212027-de86158e7fda/go.mod h1:eFjDcFEctNawg4eG61bRv87N7iHBWyVhJu7u1kqDUXY=
+google.golang.org/genproto v0.0.0-20210828152312-66f60bf46e71/go.mod h1:eFjDcFEctNawg4eG61bRv87N7iHBWyVhJu7u1kqDUXY=
+google.golang.org/genproto v0.0.0-20210831024726-fe130286e0e2 h1:NHN4wOCScVzKhPenJ2dt+BTs3X/XkBVI/Rh4iDt55T8=
+google.golang.org/genproto v0.0.0-20210831024726-fe130286e0e2/go.mod h1:eFjDcFEctNawg4eG61bRv87N7iHBWyVhJu7u1kqDUXY=
+google.golang.org/grpc v1.14.0/go.mod h1:yo6s7OP7yaDglbqo1J04qKzAhqBH6lvTonzMVmEdcZw=
+google.golang.org/grpc v1.19.0/go.mod h1:mqu4LbDTu4XGKhr4mRzUsmM4RtVoemTSY81AxZiDr8c=
+google.golang.org/grpc v1.20.1/go.mod h1:10oTOabMzJvdu6/UiuZezV6QK5dSlG84ov/aaiqXj38=
+google.golang.org/grpc v1.21.1/go.mod h1:oYelfM1adQP15Ek0mdvEgi9Df8B9CZIaU1084ijfRaM=
+google.golang.org/grpc v1.22.0/go.mod h1:Y5yQAOtifL1yxbo5wqy6BxZv8vAUGQwXBOALyacEbxg=
+google.golang.org/grpc v1.23.0/go.mod h1:Y5yQAOtifL1yxbo5wqy6BxZv8vAUGQwXBOALyacEbxg=
+google.golang.org/grpc v1.23.1/go.mod h1:Y5yQAOtifL1yxbo5wqy6BxZv8vAUGQwXBOALyacEbxg=
+google.golang.org/grpc v1.25.1/go.mod h1:c3i+UQWmh7LiEpx4sFZnkU36qjEYZ0imhYfXVyQciAY=
+google.golang.org/grpc v1.26.0/go.mod h1:qbnxyOmOxrQa7FizSgH+ReBfzJrCY1pSN7KXBS8abTk=
+google.golang.org/grpc v1.27.0/go.mod h1:qbnxyOmOxrQa7FizSgH+ReBfzJrCY1pSN7KXBS8abTk=
+google.golang.org/grpc v1.27.1/go.mod h1:qbnxyOmOxrQa7FizSgH+ReBfzJrCY1pSN7KXBS8abTk=
+google.golang.org/grpc v1.28.0/go.mod h1:rpkK4SK4GF4Ach/+MFLZUBavHOvF2JJB5uozKKal+60=
+google.golang.org/grpc v1.29.1/go.mod h1:itym6AZVZYACWQqET3MqgPpjcuV5QH3BxFS3IjizoKk=
+google.golang.org/grpc v1.30.0/go.mod h1:N36X2cJ7JwdamYAgDz+s+rVMFjt3numwzf/HckM8pak=
+google.golang.org/grpc v1.31.0/go.mod h1:N36X2cJ7JwdamYAgDz+s+rVMFjt3numwzf/HckM8pak=
+google.golang.org/grpc v1.31.1/go.mod h1:N36X2cJ7JwdamYAgDz+s+rVMFjt3numwzf/HckM8pak=
+google.golang.org/grpc v1.33.1/go.mod h1:fr5YgcSWrqhRRxogOsw7RzIpsmvOZ6IcH4kBYTpR3n0=
+google.golang.org/grpc v1.33.2/go.mod h1:JMHMWHQWaTccqQQlmk3MJZS+GWXOdAesneDmEnv2fbc=
+google.golang.org/grpc v1.34.0/go.mod h1:WotjhfgOW/POjDeRt8vscBtXq+2VjORFy659qA51WJ8=
+google.golang.org/grpc v1.35.0/go.mod h1:qjiiYl8FncCW8feJPdyg3v6XW24KsRHe+dy9BAGRRjU=
+google.golang.org/grpc v1.36.0/go.mod h1:qjiiYl8FncCW8feJPdyg3v6XW24KsRHe+dy9BAGRRjU=
+google.golang.org/grpc v1.36.1/go.mod h1:qjiiYl8FncCW8feJPdyg3v6XW24KsRHe+dy9BAGRRjU=
+google.golang.org/grpc v1.37.0/go.mod h1:NREThFqKR1f3iQ6oBuvc5LadQuXVGo9rkm5ZGrQdJfM=
+google.golang.org/grpc v1.37.1/go.mod h1:NREThFqKR1f3iQ6oBuvc5LadQuXVGo9rkm5ZGrQdJfM=
+google.golang.org/grpc v1.38.0/go.mod h1:NREThFqKR1f3iQ6oBuvc5LadQuXVGo9rkm5ZGrQdJfM=
+google.golang.org/grpc v1.39.0/go.mod h1:PImNr+rS9TWYb2O4/emRugxiyHZ5JyHW5F+RPnDzfrE=
+google.golang.org/grpc v1.39.1/go.mod h1:PImNr+rS9TWYb2O4/emRugxiyHZ5JyHW5F+RPnDzfrE=
+google.golang.org/grpc v1.40.0 h1:AGJ0Ih4mHjSeibYkFGh1dD9KJ/eOtZ93I6hoHhukQ5Q=
+google.golang.org/grpc v1.40.0/go.mod h1:ogyxbiOoUXAkP+4+xa6PZSE9DZgIHtSpzjDTB9KAK34=
+google.golang.org/grpc/cmd/protoc-gen-go-grpc v1.1.0/go.mod h1:6Kw0yEErY5E/yWrBtf03jp27GLLJujG4z/JK95pnjjw=
+google.golang.org/protobuf v0.0.0-20200109180630-ec00e32a8dfd/go.mod h1:DFci5gLYBciE7Vtevhsrf46CRTquxDuWsQurQQe4oz8=
+google.golang.org/protobuf v0.0.0-20200221191635-4d8936d0db64/go.mod h1:kwYJMbMJ01Woi6D6+Kah6886xMZcty6N08ah7+eCXa0=
+google.golang.org/protobuf v0.0.0-20200228230310-ab0ca4ff8a60/go.mod h1:cfTl7dwQJ+fmap5saPgwCLgHXTUD7jkjRqWcaiX5VyM=
+google.golang.org/protobuf v1.20.1-0.20200309200217-e05f789c0967/go.mod h1:A+miEFZTKqfCUM6K7xSMQL9OKL/b6hQv+e19PK+JZNE=
+google.golang.org/protobuf v1.21.0/go.mod h1:47Nbq4nVaFHyn7ilMalzfO3qCViNmqZ2kzikPIcrTAo=
+google.golang.org/protobuf v1.22.0/go.mod h1:EGpADcykh3NcUnDUJcl1+ZksZNG86OlYog2l/sGQquU=
+google.golang.org/protobuf v1.23.0/go.mod h1:EGpADcykh3NcUnDUJcl1+ZksZNG86OlYog2l/sGQquU=
+google.golang.org/protobuf v1.23.1-0.20200526195155-81db48ad09cc/go.mod h1:EGpADcykh3NcUnDUJcl1+ZksZNG86OlYog2l/sGQquU=
+google.golang.org/protobuf v1.24.0/go.mod h1:r/3tXBNzIEhYS9I1OUVjXDlt8tc493IdKGjtUeSXeh4=
+google.golang.org/protobuf v1.25.0/go.mod h1:9JNX74DMeImyA3h4bdi1ymwjUzf21/xIlbajtzgsN7c=
+google.golang.org/protobuf v1.26.0-rc.1/go.mod h1:jlhhOSvTdKEhbULTjvd4ARK9grFBp09yW+WbY/TyQbw=
+google.golang.org/protobuf v1.26.0/go.mod h1:9q0QmTI4eRPtz6boOQmLYwt+qCgq0jsYwAQnmE0givc=
+google.golang.org/protobuf v1.27.1 h1:SnqbnDw1V7RiZcXPx5MEeqPv2s79L9i7BJUlG/+RurQ=
+google.golang.org/protobuf v1.27.1/go.mod h1:9q0QmTI4eRPtz6boOQmLYwt+qCgq0jsYwAQnmE0givc=
+gopkg.in/airbrake/gobrake.v2 v2.0.9/go.mod h1:/h5ZAUhDkGaJfjzjKLSjv6zCL6O0LLBxU4K+aSYdM/U=
+gopkg.in/alecthomas/kingpin.v2 v2.2.6/go.mod h1:FMv+mEhP44yOT+4EoQTLFTRgOQ1FBLkstjWtayDeSgw=
+gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
+gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
+gopkg.in/check.v1 v1.0.0-20190902080502-41f04d3bba15/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
+gopkg.in/check.v1 v1.0.0-20200227125254-8fa46927fb4f h1:BLraFXnmrev5lT+xlilqcH8XK9/i0At2xKjWk4p6zsU=
+gopkg.in/check.v1 v1.0.0-20200227125254-8fa46927fb4f/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
+gopkg.in/errgo.v2 v2.1.0/go.mod h1:hNsd1EY+bozCKY1Ytp96fpM3vjJbqLJn88ws8XvfDNI=
+gopkg.in/fsnotify.v1 v1.4.7/go.mod h1:Tz8NjZHkW78fSQdbUxIjBTcgA1z1m8ZHf0WmKUhAMys=
+gopkg.in/gemnasium/logrus-airbrake-hook.v2 v2.1.2/go.mod h1:Xk6kEKp8OKb+X14hQBKWaSkCsqBpgog8nAV2xsGOxlo=
+gopkg.in/square/go-jose.v2 v2.3.1/go.mod h1:M9dMgbHiYLoDGQrXy7OpJDJWiKiU//h+vD76mk0e1AI=
+gopkg.in/square/go-jose.v2 v2.5.1/go.mod h1:M9dMgbHiYLoDGQrXy7OpJDJWiKiU//h+vD76mk0e1AI=
+gopkg.in/square/go-jose.v2 v2.6.0 h1:NGk74WTnPKBNUhNzQX7PYcTLUjoq7mzKk2OKbvwk2iI=
+gopkg.in/square/go-jose.v2 v2.6.0/go.mod h1:M9dMgbHiYLoDGQrXy7OpJDJWiKiU//h+vD76mk0e1AI=
+gopkg.in/tomb.v1 v1.0.0-20141024135613-dd632973f1e7/go.mod h1:dt/ZhP58zS4L8KSrWDmTeBkI65Dw0HsyUHuEVlX15mw=
+gopkg.in/yaml.v2 v2.2.1/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI=
+gopkg.in/yaml.v2 v2.2.2/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI=
+gopkg.in/yaml.v2 v2.2.3/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI=
+gopkg.in/yaml.v2 v2.2.4/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI=
+gopkg.in/yaml.v2 v2.2.5/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI=
+gopkg.in/yaml.v2 v2.2.8/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI=
+gopkg.in/yaml.v2 v2.3.0 h1:clyUAQHOM3G0M3f5vQj7LuJrETvjVot3Z5el9nffUtU=
+gopkg.in/yaml.v2 v2.3.0/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI=
+gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=
+gopkg.in/yaml.v3 v3.0.0-20210107192922-496545a6307b h1:h8qDotaEPuJATrMmW04NCwg7v22aHH28wwpauUhK9Oo=
+gopkg.in/yaml.v3 v3.0.0-20210107192922-496545a6307b/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=
+gotest.tools v2.2.0+incompatible/go.mod h1:DsYFclhRJ6vuDpmuTbkuFWG+y2sxOXAzmJt81HFBacw=
+gotest.tools/v3 v3.0.2/go.mod h1:3SzNCllyD9/Y+b5r9JIKQ474KzkZyqLqEfYqMsX94Bk=
+honnef.co/go/tools v0.0.0-20190102054323-c2f93a96b099/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4=
+honnef.co/go/tools v0.0.0-20190106161140-3f1c8253044a/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4=
+honnef.co/go/tools v0.0.0-20190418001031-e561f6794a2a/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4=
+honnef.co/go/tools v0.0.0-20190523083050-ea95bdfd59fc/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4=
+honnef.co/go/tools v0.0.1-2019.2.3/go.mod h1:a3bituU0lyd329TUQxRnasdCoJDkEUEAqEt0JzvZhAg=
+honnef.co/go/tools v0.0.1-2020.1.3/go.mod h1:X/FiERA/W4tHapMX5mGpAtMSVEeEUOyHaw9vFzvIQ3k=
+honnef.co/go/tools v0.0.1-2020.1.4/go.mod h1:X/FiERA/W4tHapMX5mGpAtMSVEeEUOyHaw9vFzvIQ3k=
+rsc.io/binaryregexp v0.2.0/go.mod h1:qTv7/COck+e2FymRvadv62gMdZztPaShugOCi3I+8D8=
+rsc.io/quote/v3 v3.1.0/go.mod h1:yEA65RcK8LyAZtP9Kv3t0HmxON59tX3rD+tICJqUlj0=
+rsc.io/sampler v1.3.0/go.mod h1:T1hPZKmBbMNahiBKFy5HrXp6adAjACjK9JXDnKaTXpA=
diff --git a/main.go b/main.go
new file mode 100644
index 00000000..9a39fd04
--- /dev/null
+++ b/main.go
@@ -0,0 +1,38 @@
+package main
+
+import (
+ "fmt"
+ "os"
+
+ "github.com/xenserver/packer-builder-xenserver/builder/xenserver/iso"
+ "github.com/xenserver/packer-builder-xenserver/builder/xenserver/xva"
+
+ "github.com/hashicorp/packer-plugin-sdk/plugin"
+ "github.com/hashicorp/packer-plugin-sdk/version"
+)
+
+var (
+ // Version is the main version number that is being run at the moment.
+ Version = "v0.3.0"
+
+ // VersionPrerelease is A pre-release marker for the Version. If this is ""
+ // (empty string) then it means that it is a final release. Otherwise, this
+ // is a pre-release such as "dev" (in development), "beta", "rc1", etc.
+ VersionPrerelease = ""
+
+ // PluginVersion is used by the plugin set to allow Packer to recognize
+ // what version this plugin is.
+ PluginVersion = version.InitializePluginVersion(Version, VersionPrerelease)
+)
+
+func main() {
+ pps := plugin.NewSet()
+ pps.RegisterBuilder("iso", new(iso.Builder))
+ pps.RegisterBuilder("xva", new(xva.Builder))
+ pps.SetVersion(PluginVersion)
+ err := pps.Run()
+ if err != nil {
+ fmt.Fprintln(os.Stderr, err.Error())
+ os.Exit(1)
+ }
+}
diff --git a/packer.json b/packer.json
new file mode 100644
index 00000000..5fb77bd7
--- /dev/null
+++ b/packer.json
@@ -0,0 +1,6 @@
+{
+ "builders": [{
+ "type": "xenserver-iso",
+ "tools_iso_name": "guest-tools.iso"
+ }]
+}
diff --git a/plugin/builder-xenserver-iso/main.go b/plugin/builder-xenserver-iso/main.go
deleted file mode 100644
index 445ec8d2..00000000
--- a/plugin/builder-xenserver-iso/main.go
+++ /dev/null
@@ -1,15 +0,0 @@
-package main
-
-import (
- "github.com/mitchellh/packer/packer/plugin"
- "github.com/xenserver/packer-builder-xenserver/builder/xenserver/iso"
-)
-
-func main() {
- server, err := plugin.Server()
- if err != nil {
- panic(err)
- }
- server.RegisterBuilder(new(iso.Builder))
- server.Serve()
-}
diff --git a/plugin/builder-xenserver-xva/main.go b/plugin/builder-xenserver-xva/main.go
deleted file mode 100644
index 4c04dcab..00000000
--- a/plugin/builder-xenserver-xva/main.go
+++ /dev/null
@@ -1,15 +0,0 @@
-package main
-
-import (
- "github.com/mitchellh/packer/packer/plugin"
- "github.com/xenserver/packer-builder-xenserver/builder/xenserver/xva"
-)
-
-func main() {
- server, err := plugin.Server()
- if err != nil {
- panic(err)
- }
- server.RegisterBuilder(new(xva.Builder))
- server.Serve()
-}
diff --git a/vendor/github.com/Sirupsen/logrus/.gitignore b/vendor/github.com/Sirupsen/logrus/.gitignore
deleted file mode 100644
index 66be63a0..00000000
--- a/vendor/github.com/Sirupsen/logrus/.gitignore
+++ /dev/null
@@ -1 +0,0 @@
-logrus
diff --git a/vendor/github.com/Sirupsen/logrus/.travis.yml b/vendor/github.com/Sirupsen/logrus/.travis.yml
deleted file mode 100644
index dee4eb2c..00000000
--- a/vendor/github.com/Sirupsen/logrus/.travis.yml
+++ /dev/null
@@ -1,10 +0,0 @@
-language: go
-go:
- - 1.3
- - 1.4
- - 1.5
- - 1.6
- - tip
-install:
- - go get -t ./...
-script: GOMAXPROCS=4 GORACE="halt_on_error=1" go test -race -v ./...
diff --git a/vendor/github.com/Sirupsen/logrus/CHANGELOG.md b/vendor/github.com/Sirupsen/logrus/CHANGELOG.md
deleted file mode 100644
index f2c2bc21..00000000
--- a/vendor/github.com/Sirupsen/logrus/CHANGELOG.md
+++ /dev/null
@@ -1,66 +0,0 @@
-# 0.10.0
-
-* feature: Add a test hook (#180)
-* feature: `ParseLevel` is now case-insensitive (#326)
-* feature: `FieldLogger` interface that generalizes `Logger` and `Entry` (#308)
-* performance: avoid re-allocations on `WithFields` (#335)
-
-# 0.9.0
-
-* logrus/text_formatter: don't emit empty msg
-* logrus/hooks/airbrake: move out of main repository
-* logrus/hooks/sentry: move out of main repository
-* logrus/hooks/papertrail: move out of main repository
-* logrus/hooks/bugsnag: move out of main repository
-* logrus/core: run tests with `-race`
-* logrus/core: detect TTY based on `stderr`
-* logrus/core: support `WithError` on logger
-* logrus/core: Solaris support
-
-# 0.8.7
-
-* logrus/core: fix possible race (#216)
-* logrus/doc: small typo fixes and doc improvements
-
-
-# 0.8.6
-
-* hooks/raven: allow passing an initialized client
-
-# 0.8.5
-
-* logrus/core: revert #208
-
-# 0.8.4
-
-* formatter/text: fix data race (#218)
-
-# 0.8.3
-
-* logrus/core: fix entry log level (#208)
-* logrus/core: improve performance of text formatter by 40%
-* logrus/core: expose `LevelHooks` type
-* logrus/core: add support for DragonflyBSD and NetBSD
-* formatter/text: print structs more verbosely
-
-# 0.8.2
-
-* logrus: fix more Fatal family functions
-
-# 0.8.1
-
-* logrus: fix not exiting on `Fatalf` and `Fatalln`
-
-# 0.8.0
-
-* logrus: defaults to stderr instead of stdout
-* hooks/sentry: add special field for `*http.Request`
-* formatter/text: ignore Windows for colors
-
-# 0.7.3
-
-* formatter/\*: allow configuration of timestamp layout
-
-# 0.7.2
-
-* formatter/text: Add configuration option for time format (#158)
diff --git a/vendor/github.com/Sirupsen/logrus/LICENSE b/vendor/github.com/Sirupsen/logrus/LICENSE
deleted file mode 100644
index f090cb42..00000000
--- a/vendor/github.com/Sirupsen/logrus/LICENSE
+++ /dev/null
@@ -1,21 +0,0 @@
-The MIT License (MIT)
-
-Copyright (c) 2014 Simon Eskildsen
-
-Permission is hereby granted, free of charge, to any person obtaining a copy
-of this software and associated documentation files (the "Software"), to deal
-in the Software without restriction, including without limitation the rights
-to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
-copies of the Software, and to permit persons to whom the Software is
-furnished to do so, subject to the following conditions:
-
-The above copyright notice and this permission notice shall be included in
-all copies or substantial portions of the Software.
-
-THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
-OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
-THE SOFTWARE.
diff --git a/vendor/github.com/Sirupsen/logrus/README.md b/vendor/github.com/Sirupsen/logrus/README.md
deleted file mode 100644
index 6f04c8a1..00000000
--- a/vendor/github.com/Sirupsen/logrus/README.md
+++ /dev/null
@@ -1,390 +0,0 @@
-# Logrus
[![Build Status](https://travis-ci.org/Sirupsen/logrus.svg?branch=master)](https://travis-ci.org/Sirupsen/logrus) [![GoDoc](https://godoc.org/github.com/Sirupsen/logrus?status.svg)](https://godoc.org/github.com/Sirupsen/logrus)
-
-Logrus is a structured logger for Go (golang), completely API compatible with
-the standard library logger. [Godoc][godoc]. **Please note the Logrus API is not
-yet stable (pre 1.0). Logrus itself is completely stable and has been used in
-many large deployments. The core API is unlikely to change much but please
-version control your Logrus to make sure you aren't fetching latest `master` on
-every build.**
-
-Nicely color-coded in development (when a TTY is attached, otherwise just
-plain text):
-
-![Colored](http://i.imgur.com/PY7qMwd.png)
-
-With `log.SetFormatter(&log.JSONFormatter{})`, for easy parsing by logstash
-or Splunk:
-
-```json
-{"animal":"walrus","level":"info","msg":"A group of walrus emerges from the
-ocean","size":10,"time":"2014-03-10 19:57:38.562264131 -0400 EDT"}
-
-{"level":"warning","msg":"The group's number increased tremendously!",
-"number":122,"omg":true,"time":"2014-03-10 19:57:38.562471297 -0400 EDT"}
-
-{"animal":"walrus","level":"info","msg":"A giant walrus appears!",
-"size":10,"time":"2014-03-10 19:57:38.562500591 -0400 EDT"}
-
-{"animal":"walrus","level":"info","msg":"Tremendously sized cow enters the ocean.",
-"size":9,"time":"2014-03-10 19:57:38.562527896 -0400 EDT"}
-
-{"level":"fatal","msg":"The ice breaks!","number":100,"omg":true,
-"time":"2014-03-10 19:57:38.562543128 -0400 EDT"}
-```
-
-With the default `log.SetFormatter(&log.TextFormatter{})` when a TTY is not
-attached, the output is compatible with the
-[logfmt](http://godoc.org/github.com/kr/logfmt) format:
-
-```text
-time="2015-03-26T01:27:38-04:00" level=debug msg="Started observing beach" animal=walrus number=8
-time="2015-03-26T01:27:38-04:00" level=info msg="A group of walrus emerges from the ocean" animal=walrus size=10
-time="2015-03-26T01:27:38-04:00" level=warning msg="The group's number increased tremendously!" number=122 omg=true
-time="2015-03-26T01:27:38-04:00" level=debug msg="Temperature changes" temperature=-4
-time="2015-03-26T01:27:38-04:00" level=panic msg="It's over 9000!" animal=orca size=9009
-time="2015-03-26T01:27:38-04:00" level=fatal msg="The ice breaks!" err=&{0x2082280c0 map[animal:orca size:9009] 2015-03-26 01:27:38.441574009 -0400 EDT panic It's over 9000!} number=100 omg=true
-exit status 1
-```
-
-#### Example
-
-The simplest way to use Logrus is simply the package-level exported logger:
-
-```go
-package main
-
-import (
- log "github.com/Sirupsen/logrus"
-)
-
-func main() {
- log.WithFields(log.Fields{
- "animal": "walrus",
- }).Info("A walrus appears")
-}
-```
-
-Note that it's completely api-compatible with the stdlib logger, so you can
-replace your `log` imports everywhere with `log "github.com/Sirupsen/logrus"`
-and you'll now have the flexibility of Logrus. You can customize it all you
-want:
-
-```go
-package main
-
-import (
- "os"
- log "github.com/Sirupsen/logrus"
-)
-
-func init() {
- // Log as JSON instead of the default ASCII formatter.
- log.SetFormatter(&log.JSONFormatter{})
-
- // Output to stderr instead of stdout, could also be a file.
- log.SetOutput(os.Stderr)
-
- // Only log the warning severity or above.
- log.SetLevel(log.WarnLevel)
-}
-
-func main() {
- log.WithFields(log.Fields{
- "animal": "walrus",
- "size": 10,
- }).Info("A group of walrus emerges from the ocean")
-
- log.WithFields(log.Fields{
- "omg": true,
- "number": 122,
- }).Warn("The group's number increased tremendously!")
-
- log.WithFields(log.Fields{
- "omg": true,
- "number": 100,
- }).Fatal("The ice breaks!")
-
- // A common pattern is to re-use fields between logging statements by re-using
- // the logrus.Entry returned from WithFields()
- contextLogger := log.WithFields(log.Fields{
- "common": "this is a common field",
- "other": "I also should be logged always",
- })
-
- contextLogger.Info("I'll be logged with common and other field")
- contextLogger.Info("Me too")
-}
-```
-
-For more advanced usage such as logging to multiple locations from the same
-application, you can also create an instance of the `logrus` Logger:
-
-```go
-package main
-
-import (
- "github.com/Sirupsen/logrus"
-)
-
-// Create a new instance of the logger. You can have any number of instances.
-var log = logrus.New()
-
-func main() {
- // The API for setting attributes is a little different than the package level
- // exported logger. See Godoc.
- log.Out = os.Stderr
-
- log.WithFields(logrus.Fields{
- "animal": "walrus",
- "size": 10,
- }).Info("A group of walrus emerges from the ocean")
-}
-```
-
-#### Fields
-
-Logrus encourages careful, structured logging though logging fields instead of
-long, unparseable error messages. For example, instead of: `log.Fatalf("Failed
-to send event %s to topic %s with key %d")`, you should log the much more
-discoverable:
-
-```go
-log.WithFields(log.Fields{
- "event": event,
- "topic": topic,
- "key": key,
-}).Fatal("Failed to send event")
-```
-
-We've found this API forces you to think about logging in a way that produces
-much more useful logging messages. We've been in countless situations where just
-a single added field to a log statement that was already there would've saved us
-hours. The `WithFields` call is optional.
-
-In general, with Logrus using any of the `printf`-family functions should be
-seen as a hint you should add a field, however, you can still use the
-`printf`-family functions with Logrus.
-
-#### Hooks
-
-You can add hooks for logging levels. For example to send errors to an exception
-tracking service on `Error`, `Fatal` and `Panic`, info to StatsD or log to
-multiple places simultaneously, e.g. syslog.
-
-Logrus comes with [built-in hooks](hooks/). Add those, or your custom hook, in
-`init`:
-
-```go
-import (
- log "github.com/Sirupsen/logrus"
- "gopkg.in/gemnasium/logrus-airbrake-hook.v2" // the package is named "aibrake"
- logrus_syslog "github.com/Sirupsen/logrus/hooks/syslog"
- "log/syslog"
-)
-
-func init() {
-
- // Use the Airbrake hook to report errors that have Error severity or above to
- // an exception tracker. You can create custom hooks, see the Hooks section.
- log.AddHook(airbrake.NewHook(123, "xyz", "production"))
-
- hook, err := logrus_syslog.NewSyslogHook("udp", "localhost:514", syslog.LOG_INFO, "")
- if err != nil {
- log.Error("Unable to connect to local syslog daemon")
- } else {
- log.AddHook(hook)
- }
-}
-```
-Note: Syslog hook also support connecting to local syslog (Ex. "/dev/log" or "/var/run/syslog" or "/var/run/log"). For the detail, please check the [syslog hook README](hooks/syslog/README.md).
-
-| Hook | Description |
-| ----- | ----------- |
-| [Airbrake](https://github.com/gemnasium/logrus-airbrake-hook) | Send errors to the Airbrake API V3. Uses the official [`gobrake`](https://github.com/airbrake/gobrake) behind the scenes. |
-| [Airbrake "legacy"](https://github.com/gemnasium/logrus-airbrake-legacy-hook) | Send errors to an exception tracking service compatible with the Airbrake API V2. Uses [`airbrake-go`](https://github.com/tobi/airbrake-go) behind the scenes. |
-| [Papertrail](https://github.com/polds/logrus-papertrail-hook) | Send errors to the [Papertrail](https://papertrailapp.com) hosted logging service via UDP. |
-| [Syslog](https://github.com/Sirupsen/logrus/blob/master/hooks/syslog/syslog.go) | Send errors to remote syslog server. Uses standard library `log/syslog` behind the scenes. |
-| [Bugsnag](https://github.com/Shopify/logrus-bugsnag/blob/master/bugsnag.go) | Send errors to the Bugsnag exception tracking service. |
-| [Sentry](https://github.com/evalphobia/logrus_sentry) | Send errors to the Sentry error logging and aggregation service. |
-| [Hiprus](https://github.com/nubo/hiprus) | Send errors to a channel in hipchat. |
-| [Logrusly](https://github.com/sebest/logrusly) | Send logs to [Loggly](https://www.loggly.com/) |
-| [Slackrus](https://github.com/johntdyer/slackrus) | Hook for Slack chat. |
-| [Journalhook](https://github.com/wercker/journalhook) | Hook for logging to `systemd-journald` |
-| [Graylog](https://github.com/gemnasium/logrus-graylog-hook) | Hook for logging to [Graylog](http://graylog2.org/) |
-| [Raygun](https://github.com/squirkle/logrus-raygun-hook) | Hook for logging to [Raygun.io](http://raygun.io/) |
-| [LFShook](https://github.com/rifflock/lfshook) | Hook for logging to the local filesystem |
-| [Honeybadger](https://github.com/agonzalezro/logrus_honeybadger) | Hook for sending exceptions to Honeybadger |
-| [Mail](https://github.com/zbindenren/logrus_mail) | Hook for sending exceptions via mail |
-| [Rollrus](https://github.com/heroku/rollrus) | Hook for sending errors to rollbar |
-| [Fluentd](https://github.com/evalphobia/logrus_fluent) | Hook for logging to fluentd |
-| [Mongodb](https://github.com/weekface/mgorus) | Hook for logging to mongodb |
-| [Influxus] (http://github.com/vlad-doru/influxus) | Hook for concurrently logging to [InfluxDB] (http://influxdata.com/) |
-| [InfluxDB](https://github.com/Abramovic/logrus_influxdb) | Hook for logging to influxdb |
-| [Octokit](https://github.com/dorajistyle/logrus-octokit-hook) | Hook for logging to github via octokit |
-| [DeferPanic](https://github.com/deferpanic/dp-logrus) | Hook for logging to DeferPanic |
-| [Redis-Hook](https://github.com/rogierlommers/logrus-redis-hook) | Hook for logging to a ELK stack (through Redis) |
-| [Amqp-Hook](https://github.com/vladoatanasov/logrus_amqp) | Hook for logging to Amqp broker (Like RabbitMQ) |
-| [KafkaLogrus](https://github.com/goibibo/KafkaLogrus) | Hook for logging to kafka |
-| [Typetalk](https://github.com/dragon3/logrus-typetalk-hook) | Hook for logging to [Typetalk](https://www.typetalk.in/) |
-| [ElasticSearch](https://github.com/sohlich/elogrus) | Hook for logging to ElasticSearch|
-| [Sumorus](https://github.com/doublefree/sumorus) | Hook for logging to [SumoLogic](https://www.sumologic.com/)|
-| [Logstash](https://github.com/bshuster-repo/logrus-logstash-hook) | Hook for logging to [Logstash](https://www.elastic.co/products/logstash) |
-
-#### Level logging
-
-Logrus has six logging levels: Debug, Info, Warning, Error, Fatal and Panic.
-
-```go
-log.Debug("Useful debugging information.")
-log.Info("Something noteworthy happened!")
-log.Warn("You should probably take a look at this.")
-log.Error("Something failed but I'm not quitting.")
-// Calls os.Exit(1) after logging
-log.Fatal("Bye.")
-// Calls panic() after logging
-log.Panic("I'm bailing.")
-```
-
-You can set the logging level on a `Logger`, then it will only log entries with
-that severity or anything above it:
-
-```go
-// Will log anything that is info or above (warn, error, fatal, panic). Default.
-log.SetLevel(log.InfoLevel)
-```
-
-It may be useful to set `log.Level = logrus.DebugLevel` in a debug or verbose
-environment if your application has that.
-
-#### Entries
-
-Besides the fields added with `WithField` or `WithFields` some fields are
-automatically added to all logging events:
-
-1. `time`. The timestamp when the entry was created.
-2. `msg`. The logging message passed to `{Info,Warn,Error,Fatal,Panic}` after
- the `AddFields` call. E.g. `Failed to send event.`
-3. `level`. The logging level. E.g. `info`.
-
-#### Environments
-
-Logrus has no notion of environment.
-
-If you wish for hooks and formatters to only be used in specific environments,
-you should handle that yourself. For example, if your application has a global
-variable `Environment`, which is a string representation of the environment you
-could do:
-
-```go
-import (
- log "github.com/Sirupsen/logrus"
-)
-
-init() {
- // do something here to set environment depending on an environment variable
- // or command-line flag
- if Environment == "production" {
- log.SetFormatter(&log.JSONFormatter{})
- } else {
- // The TextFormatter is default, you don't actually have to do this.
- log.SetFormatter(&log.TextFormatter{})
- }
-}
-```
-
-This configuration is how `logrus` was intended to be used, but JSON in
-production is mostly only useful if you do log aggregation with tools like
-Splunk or Logstash.
-
-#### Formatters
-
-The built-in logging formatters are:
-
-* `logrus.TextFormatter`. Logs the event in colors if stdout is a tty, otherwise
- without colors.
- * *Note:* to force colored output when there is no TTY, set the `ForceColors`
- field to `true`. To force no colored output even if there is a TTY set the
- `DisableColors` field to `true`
-* `logrus.JSONFormatter`. Logs fields as JSON.
-* `logrus/formatters/logstash.LogstashFormatter`. Logs fields as [Logstash](http://logstash.net) Events.
-
- ```go
- logrus.SetFormatter(&logstash.LogstashFormatter{Type: "application_name"})
- ```
-
-Third party logging formatters:
-
-* [`prefixed`](https://github.com/x-cray/logrus-prefixed-formatter). Displays log entry source along with alternative layout.
-* [`zalgo`](https://github.com/aybabtme/logzalgo). Invoking the P͉̫o̳̼̊w̖͈̰͎e̬͔̭͂r͚̼̹̲ ̫͓͉̳͈ō̠͕͖̚f̝͍̠ ͕̲̞͖͑Z̖̫̤̫ͪa͉̬͈̗l͖͎g̳̥o̰̥̅!̣͔̲̻͊̄ ̙̘̦̹̦.
-
-You can define your formatter by implementing the `Formatter` interface,
-requiring a `Format` method. `Format` takes an `*Entry`. `entry.Data` is a
-`Fields` type (`map[string]interface{}`) with all your fields as well as the
-default ones (see Entries section above):
-
-```go
-type MyJSONFormatter struct {
-}
-
-log.SetFormatter(new(MyJSONFormatter))
-
-func (f *MyJSONFormatter) Format(entry *Entry) ([]byte, error) {
- // Note this doesn't include Time, Level and Message which are available on
- // the Entry. Consult `godoc` on information about those fields or read the
- // source of the official loggers.
- serialized, err := json.Marshal(entry.Data)
- if err != nil {
- return nil, fmt.Errorf("Failed to marshal fields to JSON, %v", err)
- }
- return append(serialized, '\n'), nil
-}
-```
-
-#### Logger as an `io.Writer`
-
-Logrus can be transformed into an `io.Writer`. That writer is the end of an `io.Pipe` and it is your responsibility to close it.
-
-```go
-w := logger.Writer()
-defer w.Close()
-
-srv := http.Server{
- // create a stdlib log.Logger that writes to
- // logrus.Logger.
- ErrorLog: log.New(w, "", 0),
-}
-```
-
-Each line written to that writer will be printed the usual way, using formatters
-and hooks. The level for those entries is `info`.
-
-#### Rotation
-
-Log rotation is not provided with Logrus. Log rotation should be done by an
-external program (like `logrotate(8)`) that can compress and delete old log
-entries. It should not be a feature of the application-level logger.
-
-#### Tools
-
-| Tool | Description |
-| ---- | ----------- |
-|[Logrus Mate](https://github.com/gogap/logrus_mate)|Logrus mate is a tool for Logrus to manage loggers, you can initial logger's level, hook and formatter by config file, the logger will generated with different config at different environment.|
-
-#### Testing
-
-Logrus has a built in facility for asserting the presence of log messages. This is implemented through the `test` hook and provides:
-
-* decorators for existing logger (`test.NewLocal` and `test.NewGlobal`) which basically just add the `test` hook
-* a test logger (`test.NewNullLogger`) that just records log messages (and does not output any):
-
-```go
-logger, hook := NewNullLogger()
-logger.Error("Hello error")
-
-assert.Equal(1, len(hook.Entries))
-assert.Equal(logrus.ErrorLevel, hook.LastEntry().Level)
-assert.Equal("Hello error", hook.LastEntry().Message)
-
-hook.Reset()
-assert.Nil(hook.LastEntry())
-```
diff --git a/vendor/github.com/Sirupsen/logrus/doc.go b/vendor/github.com/Sirupsen/logrus/doc.go
deleted file mode 100644
index dddd5f87..00000000
--- a/vendor/github.com/Sirupsen/logrus/doc.go
+++ /dev/null
@@ -1,26 +0,0 @@
-/*
-Package logrus is a structured logger for Go, completely API compatible with the standard library logger.
-
-
-The simplest way to use Logrus is simply the package-level exported logger:
-
- package main
-
- import (
- log "github.com/Sirupsen/logrus"
- )
-
- func main() {
- log.WithFields(log.Fields{
- "animal": "walrus",
- "number": 1,
- "size": 10,
- }).Info("A walrus appears")
- }
-
-Output:
- time="2015-09-07T08:48:33Z" level=info msg="A walrus appears" animal=walrus number=1 size=10
-
-For a full guide visit https://github.com/Sirupsen/logrus
-*/
-package logrus
diff --git a/vendor/github.com/Sirupsen/logrus/entry.go b/vendor/github.com/Sirupsen/logrus/entry.go
deleted file mode 100644
index 89e966e7..00000000
--- a/vendor/github.com/Sirupsen/logrus/entry.go
+++ /dev/null
@@ -1,264 +0,0 @@
-package logrus
-
-import (
- "bytes"
- "fmt"
- "io"
- "os"
- "time"
-)
-
-// Defines the key when adding errors using WithError.
-var ErrorKey = "error"
-
-// An entry is the final or intermediate Logrus logging entry. It contains all
-// the fields passed with WithField{,s}. It's finally logged when Debug, Info,
-// Warn, Error, Fatal or Panic is called on it. These objects can be reused and
-// passed around as much as you wish to avoid field duplication.
-type Entry struct {
- Logger *Logger
-
- // Contains all the fields set by the user.
- Data Fields
-
- // Time at which the log entry was created
- Time time.Time
-
- // Level the log entry was logged at: Debug, Info, Warn, Error, Fatal or Panic
- Level Level
-
- // Message passed to Debug, Info, Warn, Error, Fatal or Panic
- Message string
-}
-
-func NewEntry(logger *Logger) *Entry {
- return &Entry{
- Logger: logger,
- // Default is three fields, give a little extra room
- Data: make(Fields, 5),
- }
-}
-
-// Returns a reader for the entry, which is a proxy to the formatter.
-func (entry *Entry) Reader() (*bytes.Buffer, error) {
- serialized, err := entry.Logger.Formatter.Format(entry)
- return bytes.NewBuffer(serialized), err
-}
-
-// Returns the string representation from the reader and ultimately the
-// formatter.
-func (entry *Entry) String() (string, error) {
- reader, err := entry.Reader()
- if err != nil {
- return "", err
- }
-
- return reader.String(), err
-}
-
-// Add an error as single field (using the key defined in ErrorKey) to the Entry.
-func (entry *Entry) WithError(err error) *Entry {
- return entry.WithField(ErrorKey, err)
-}
-
-// Add a single field to the Entry.
-func (entry *Entry) WithField(key string, value interface{}) *Entry {
- return entry.WithFields(Fields{key: value})
-}
-
-// Add a map of fields to the Entry.
-func (entry *Entry) WithFields(fields Fields) *Entry {
- data := make(Fields, len(entry.Data)+len(fields))
- for k, v := range entry.Data {
- data[k] = v
- }
- for k, v := range fields {
- data[k] = v
- }
- return &Entry{Logger: entry.Logger, Data: data}
-}
-
-// This function is not declared with a pointer value because otherwise
-// race conditions will occur when using multiple goroutines
-func (entry Entry) log(level Level, msg string) {
- entry.Time = time.Now()
- entry.Level = level
- entry.Message = msg
-
- if err := entry.Logger.Hooks.Fire(level, &entry); err != nil {
- entry.Logger.mu.Lock()
- fmt.Fprintf(os.Stderr, "Failed to fire hook: %v\n", err)
- entry.Logger.mu.Unlock()
- }
-
- reader, err := entry.Reader()
- if err != nil {
- entry.Logger.mu.Lock()
- fmt.Fprintf(os.Stderr, "Failed to obtain reader, %v\n", err)
- entry.Logger.mu.Unlock()
- }
-
- entry.Logger.mu.Lock()
- defer entry.Logger.mu.Unlock()
-
- _, err = io.Copy(entry.Logger.Out, reader)
- if err != nil {
- fmt.Fprintf(os.Stderr, "Failed to write to log, %v\n", err)
- }
-
- // To avoid Entry#log() returning a value that only would make sense for
- // panic() to use in Entry#Panic(), we avoid the allocation by checking
- // directly here.
- if level <= PanicLevel {
- panic(&entry)
- }
-}
-
-func (entry *Entry) Debug(args ...interface{}) {
- if entry.Logger.Level >= DebugLevel {
- entry.log(DebugLevel, fmt.Sprint(args...))
- }
-}
-
-func (entry *Entry) Print(args ...interface{}) {
- entry.Info(args...)
-}
-
-func (entry *Entry) Info(args ...interface{}) {
- if entry.Logger.Level >= InfoLevel {
- entry.log(InfoLevel, fmt.Sprint(args...))
- }
-}
-
-func (entry *Entry) Warn(args ...interface{}) {
- if entry.Logger.Level >= WarnLevel {
- entry.log(WarnLevel, fmt.Sprint(args...))
- }
-}
-
-func (entry *Entry) Warning(args ...interface{}) {
- entry.Warn(args...)
-}
-
-func (entry *Entry) Error(args ...interface{}) {
- if entry.Logger.Level >= ErrorLevel {
- entry.log(ErrorLevel, fmt.Sprint(args...))
- }
-}
-
-func (entry *Entry) Fatal(args ...interface{}) {
- if entry.Logger.Level >= FatalLevel {
- entry.log(FatalLevel, fmt.Sprint(args...))
- }
- os.Exit(1)
-}
-
-func (entry *Entry) Panic(args ...interface{}) {
- if entry.Logger.Level >= PanicLevel {
- entry.log(PanicLevel, fmt.Sprint(args...))
- }
- panic(fmt.Sprint(args...))
-}
-
-// Entry Printf family functions
-
-func (entry *Entry) Debugf(format string, args ...interface{}) {
- if entry.Logger.Level >= DebugLevel {
- entry.Debug(fmt.Sprintf(format, args...))
- }
-}
-
-func (entry *Entry) Infof(format string, args ...interface{}) {
- if entry.Logger.Level >= InfoLevel {
- entry.Info(fmt.Sprintf(format, args...))
- }
-}
-
-func (entry *Entry) Printf(format string, args ...interface{}) {
- entry.Infof(format, args...)
-}
-
-func (entry *Entry) Warnf(format string, args ...interface{}) {
- if entry.Logger.Level >= WarnLevel {
- entry.Warn(fmt.Sprintf(format, args...))
- }
-}
-
-func (entry *Entry) Warningf(format string, args ...interface{}) {
- entry.Warnf(format, args...)
-}
-
-func (entry *Entry) Errorf(format string, args ...interface{}) {
- if entry.Logger.Level >= ErrorLevel {
- entry.Error(fmt.Sprintf(format, args...))
- }
-}
-
-func (entry *Entry) Fatalf(format string, args ...interface{}) {
- if entry.Logger.Level >= FatalLevel {
- entry.Fatal(fmt.Sprintf(format, args...))
- }
- os.Exit(1)
-}
-
-func (entry *Entry) Panicf(format string, args ...interface{}) {
- if entry.Logger.Level >= PanicLevel {
- entry.Panic(fmt.Sprintf(format, args...))
- }
-}
-
-// Entry Println family functions
-
-func (entry *Entry) Debugln(args ...interface{}) {
- if entry.Logger.Level >= DebugLevel {
- entry.Debug(entry.sprintlnn(args...))
- }
-}
-
-func (entry *Entry) Infoln(args ...interface{}) {
- if entry.Logger.Level >= InfoLevel {
- entry.Info(entry.sprintlnn(args...))
- }
-}
-
-func (entry *Entry) Println(args ...interface{}) {
- entry.Infoln(args...)
-}
-
-func (entry *Entry) Warnln(args ...interface{}) {
- if entry.Logger.Level >= WarnLevel {
- entry.Warn(entry.sprintlnn(args...))
- }
-}
-
-func (entry *Entry) Warningln(args ...interface{}) {
- entry.Warnln(args...)
-}
-
-func (entry *Entry) Errorln(args ...interface{}) {
- if entry.Logger.Level >= ErrorLevel {
- entry.Error(entry.sprintlnn(args...))
- }
-}
-
-func (entry *Entry) Fatalln(args ...interface{}) {
- if entry.Logger.Level >= FatalLevel {
- entry.Fatal(entry.sprintlnn(args...))
- }
- os.Exit(1)
-}
-
-func (entry *Entry) Panicln(args ...interface{}) {
- if entry.Logger.Level >= PanicLevel {
- entry.Panic(entry.sprintlnn(args...))
- }
-}
-
-// Sprintlnn => Sprint no newline. This is to get the behavior of how
-// fmt.Sprintln where spaces are always added between operands, regardless of
-// their type. Instead of vendoring the Sprintln implementation to spare a
-// string allocation, we do the simplest thing.
-func (entry *Entry) sprintlnn(args ...interface{}) string {
- msg := fmt.Sprintln(args...)
- return msg[:len(msg)-1]
-}
diff --git a/vendor/github.com/Sirupsen/logrus/exported.go b/vendor/github.com/Sirupsen/logrus/exported.go
deleted file mode 100644
index 9a0120ac..00000000
--- a/vendor/github.com/Sirupsen/logrus/exported.go
+++ /dev/null
@@ -1,193 +0,0 @@
-package logrus
-
-import (
- "io"
-)
-
-var (
- // std is the name of the standard logger in stdlib `log`
- std = New()
-)
-
-func StandardLogger() *Logger {
- return std
-}
-
-// SetOutput sets the standard logger output.
-func SetOutput(out io.Writer) {
- std.mu.Lock()
- defer std.mu.Unlock()
- std.Out = out
-}
-
-// SetFormatter sets the standard logger formatter.
-func SetFormatter(formatter Formatter) {
- std.mu.Lock()
- defer std.mu.Unlock()
- std.Formatter = formatter
-}
-
-// SetLevel sets the standard logger level.
-func SetLevel(level Level) {
- std.mu.Lock()
- defer std.mu.Unlock()
- std.Level = level
-}
-
-// GetLevel returns the standard logger level.
-func GetLevel() Level {
- std.mu.Lock()
- defer std.mu.Unlock()
- return std.Level
-}
-
-// AddHook adds a hook to the standard logger hooks.
-func AddHook(hook Hook) {
- std.mu.Lock()
- defer std.mu.Unlock()
- std.Hooks.Add(hook)
-}
-
-// WithError creates an entry from the standard logger and adds an error to it, using the value defined in ErrorKey as key.
-func WithError(err error) *Entry {
- return std.WithField(ErrorKey, err)
-}
-
-// WithField creates an entry from the standard logger and adds a field to
-// it. If you want multiple fields, use `WithFields`.
-//
-// Note that it doesn't log until you call Debug, Print, Info, Warn, Fatal
-// or Panic on the Entry it returns.
-func WithField(key string, value interface{}) *Entry {
- return std.WithField(key, value)
-}
-
-// WithFields creates an entry from the standard logger and adds multiple
-// fields to it. This is simply a helper for `WithField`, invoking it
-// once for each field.
-//
-// Note that it doesn't log until you call Debug, Print, Info, Warn, Fatal
-// or Panic on the Entry it returns.
-func WithFields(fields Fields) *Entry {
- return std.WithFields(fields)
-}
-
-// Debug logs a message at level Debug on the standard logger.
-func Debug(args ...interface{}) {
- std.Debug(args...)
-}
-
-// Print logs a message at level Info on the standard logger.
-func Print(args ...interface{}) {
- std.Print(args...)
-}
-
-// Info logs a message at level Info on the standard logger.
-func Info(args ...interface{}) {
- std.Info(args...)
-}
-
-// Warn logs a message at level Warn on the standard logger.
-func Warn(args ...interface{}) {
- std.Warn(args...)
-}
-
-// Warning logs a message at level Warn on the standard logger.
-func Warning(args ...interface{}) {
- std.Warning(args...)
-}
-
-// Error logs a message at level Error on the standard logger.
-func Error(args ...interface{}) {
- std.Error(args...)
-}
-
-// Panic logs a message at level Panic on the standard logger.
-func Panic(args ...interface{}) {
- std.Panic(args...)
-}
-
-// Fatal logs a message at level Fatal on the standard logger.
-func Fatal(args ...interface{}) {
- std.Fatal(args...)
-}
-
-// Debugf logs a message at level Debug on the standard logger.
-func Debugf(format string, args ...interface{}) {
- std.Debugf(format, args...)
-}
-
-// Printf logs a message at level Info on the standard logger.
-func Printf(format string, args ...interface{}) {
- std.Printf(format, args...)
-}
-
-// Infof logs a message at level Info on the standard logger.
-func Infof(format string, args ...interface{}) {
- std.Infof(format, args...)
-}
-
-// Warnf logs a message at level Warn on the standard logger.
-func Warnf(format string, args ...interface{}) {
- std.Warnf(format, args...)
-}
-
-// Warningf logs a message at level Warn on the standard logger.
-func Warningf(format string, args ...interface{}) {
- std.Warningf(format, args...)
-}
-
-// Errorf logs a message at level Error on the standard logger.
-func Errorf(format string, args ...interface{}) {
- std.Errorf(format, args...)
-}
-
-// Panicf logs a message at level Panic on the standard logger.
-func Panicf(format string, args ...interface{}) {
- std.Panicf(format, args...)
-}
-
-// Fatalf logs a message at level Fatal on the standard logger.
-func Fatalf(format string, args ...interface{}) {
- std.Fatalf(format, args...)
-}
-
-// Debugln logs a message at level Debug on the standard logger.
-func Debugln(args ...interface{}) {
- std.Debugln(args...)
-}
-
-// Println logs a message at level Info on the standard logger.
-func Println(args ...interface{}) {
- std.Println(args...)
-}
-
-// Infoln logs a message at level Info on the standard logger.
-func Infoln(args ...interface{}) {
- std.Infoln(args...)
-}
-
-// Warnln logs a message at level Warn on the standard logger.
-func Warnln(args ...interface{}) {
- std.Warnln(args...)
-}
-
-// Warningln logs a message at level Warn on the standard logger.
-func Warningln(args ...interface{}) {
- std.Warningln(args...)
-}
-
-// Errorln logs a message at level Error on the standard logger.
-func Errorln(args ...interface{}) {
- std.Errorln(args...)
-}
-
-// Panicln logs a message at level Panic on the standard logger.
-func Panicln(args ...interface{}) {
- std.Panicln(args...)
-}
-
-// Fatalln logs a message at level Fatal on the standard logger.
-func Fatalln(args ...interface{}) {
- std.Fatalln(args...)
-}
diff --git a/vendor/github.com/Sirupsen/logrus/formatter.go b/vendor/github.com/Sirupsen/logrus/formatter.go
deleted file mode 100644
index b5fbe934..00000000
--- a/vendor/github.com/Sirupsen/logrus/formatter.go
+++ /dev/null
@@ -1,45 +0,0 @@
-package logrus
-
-import "time"
-
-const DefaultTimestampFormat = time.RFC3339
-
-// The Formatter interface is used to implement a custom Formatter. It takes an
-// `Entry`. It exposes all the fields, including the default ones:
-//
-// * `entry.Data["msg"]`. The message passed from Info, Warn, Error ..
-// * `entry.Data["time"]`. The timestamp.
-// * `entry.Data["level"]. The level the entry was logged at.
-//
-// Any additional fields added with `WithField` or `WithFields` are also in
-// `entry.Data`. Format is expected to return an array of bytes which are then
-// logged to `logger.Out`.
-type Formatter interface {
- Format(*Entry) ([]byte, error)
-}
-
-// This is to not silently overwrite `time`, `msg` and `level` fields when
-// dumping it. If this code wasn't there doing:
-//
-// logrus.WithField("level", 1).Info("hello")
-//
-// Would just silently drop the user provided level. Instead with this code
-// it'll logged as:
-//
-// {"level": "info", "fields.level": 1, "msg": "hello", "time": "..."}
-//
-// It's not exported because it's still using Data in an opinionated way. It's to
-// avoid code duplication between the two default formatters.
-func prefixFieldClashes(data Fields) {
- if t, ok := data["time"]; ok {
- data["fields.time"] = t
- }
-
- if m, ok := data["msg"]; ok {
- data["fields.msg"] = m
- }
-
- if l, ok := data["level"]; ok {
- data["fields.level"] = l
- }
-}
diff --git a/vendor/github.com/Sirupsen/logrus/hooks.go b/vendor/github.com/Sirupsen/logrus/hooks.go
deleted file mode 100644
index 3f151cdc..00000000
--- a/vendor/github.com/Sirupsen/logrus/hooks.go
+++ /dev/null
@@ -1,34 +0,0 @@
-package logrus
-
-// A hook to be fired when logging on the logging levels returned from
-// `Levels()` on your implementation of the interface. Note that this is not
-// fired in a goroutine or a channel with workers, you should handle such
-// functionality yourself if your call is non-blocking and you don't wish for
-// the logging calls for levels returned from `Levels()` to block.
-type Hook interface {
- Levels() []Level
- Fire(*Entry) error
-}
-
-// Internal type for storing the hooks on a logger instance.
-type LevelHooks map[Level][]Hook
-
-// Add a hook to an instance of logger. This is called with
-// `log.Hooks.Add(new(MyHook))` where `MyHook` implements the `Hook` interface.
-func (hooks LevelHooks) Add(hook Hook) {
- for _, level := range hook.Levels() {
- hooks[level] = append(hooks[level], hook)
- }
-}
-
-// Fire all the hooks for the passed level. Used by `entry.log` to fire
-// appropriate hooks for a log entry.
-func (hooks LevelHooks) Fire(level Level, entry *Entry) error {
- for _, hook := range hooks[level] {
- if err := hook.Fire(entry); err != nil {
- return err
- }
- }
-
- return nil
-}
diff --git a/vendor/github.com/Sirupsen/logrus/json_formatter.go b/vendor/github.com/Sirupsen/logrus/json_formatter.go
deleted file mode 100644
index 2ad6dc5c..00000000
--- a/vendor/github.com/Sirupsen/logrus/json_formatter.go
+++ /dev/null
@@ -1,41 +0,0 @@
-package logrus
-
-import (
- "encoding/json"
- "fmt"
-)
-
-type JSONFormatter struct {
- // TimestampFormat sets the format used for marshaling timestamps.
- TimestampFormat string
-}
-
-func (f *JSONFormatter) Format(entry *Entry) ([]byte, error) {
- data := make(Fields, len(entry.Data)+3)
- for k, v := range entry.Data {
- switch v := v.(type) {
- case error:
- // Otherwise errors are ignored by `encoding/json`
- // https://github.com/Sirupsen/logrus/issues/137
- data[k] = v.Error()
- default:
- data[k] = v
- }
- }
- prefixFieldClashes(data)
-
- timestampFormat := f.TimestampFormat
- if timestampFormat == "" {
- timestampFormat = DefaultTimestampFormat
- }
-
- data["time"] = entry.Time.Format(timestampFormat)
- data["msg"] = entry.Message
- data["level"] = entry.Level.String()
-
- serialized, err := json.Marshal(data)
- if err != nil {
- return nil, fmt.Errorf("Failed to marshal fields to JSON, %v", err)
- }
- return append(serialized, '\n'), nil
-}
diff --git a/vendor/github.com/Sirupsen/logrus/logger.go b/vendor/github.com/Sirupsen/logrus/logger.go
deleted file mode 100644
index 2fdb2317..00000000
--- a/vendor/github.com/Sirupsen/logrus/logger.go
+++ /dev/null
@@ -1,212 +0,0 @@
-package logrus
-
-import (
- "io"
- "os"
- "sync"
-)
-
-type Logger struct {
- // The logs are `io.Copy`'d to this in a mutex. It's common to set this to a
- // file, or leave it default which is `os.Stderr`. You can also set this to
- // something more adventorous, such as logging to Kafka.
- Out io.Writer
- // Hooks for the logger instance. These allow firing events based on logging
- // levels and log entries. For example, to send errors to an error tracking
- // service, log to StatsD or dump the core on fatal errors.
- Hooks LevelHooks
- // All log entries pass through the formatter before logged to Out. The
- // included formatters are `TextFormatter` and `JSONFormatter` for which
- // TextFormatter is the default. In development (when a TTY is attached) it
- // logs with colors, but to a file it wouldn't. You can easily implement your
- // own that implements the `Formatter` interface, see the `README` or included
- // formatters for examples.
- Formatter Formatter
- // The logging level the logger should log at. This is typically (and defaults
- // to) `logrus.Info`, which allows Info(), Warn(), Error() and Fatal() to be
- // logged. `logrus.Debug` is useful in
- Level Level
- // Used to sync writing to the log.
- mu sync.Mutex
-}
-
-// Creates a new logger. Configuration should be set by changing `Formatter`,
-// `Out` and `Hooks` directly on the default logger instance. You can also just
-// instantiate your own:
-//
-// var log = &Logger{
-// Out: os.Stderr,
-// Formatter: new(JSONFormatter),
-// Hooks: make(LevelHooks),
-// Level: logrus.DebugLevel,
-// }
-//
-// It's recommended to make this a global instance called `log`.
-func New() *Logger {
- return &Logger{
- Out: os.Stderr,
- Formatter: new(TextFormatter),
- Hooks: make(LevelHooks),
- Level: InfoLevel,
- }
-}
-
-// Adds a field to the log entry, note that you it doesn't log until you call
-// Debug, Print, Info, Warn, Fatal or Panic. It only creates a log entry.
-// If you want multiple fields, use `WithFields`.
-func (logger *Logger) WithField(key string, value interface{}) *Entry {
- return NewEntry(logger).WithField(key, value)
-}
-
-// Adds a struct of fields to the log entry. All it does is call `WithField` for
-// each `Field`.
-func (logger *Logger) WithFields(fields Fields) *Entry {
- return NewEntry(logger).WithFields(fields)
-}
-
-// Add an error as single field to the log entry. All it does is call
-// `WithError` for the given `error`.
-func (logger *Logger) WithError(err error) *Entry {
- return NewEntry(logger).WithError(err)
-}
-
-func (logger *Logger) Debugf(format string, args ...interface{}) {
- if logger.Level >= DebugLevel {
- NewEntry(logger).Debugf(format, args...)
- }
-}
-
-func (logger *Logger) Infof(format string, args ...interface{}) {
- if logger.Level >= InfoLevel {
- NewEntry(logger).Infof(format, args...)
- }
-}
-
-func (logger *Logger) Printf(format string, args ...interface{}) {
- NewEntry(logger).Printf(format, args...)
-}
-
-func (logger *Logger) Warnf(format string, args ...interface{}) {
- if logger.Level >= WarnLevel {
- NewEntry(logger).Warnf(format, args...)
- }
-}
-
-func (logger *Logger) Warningf(format string, args ...interface{}) {
- if logger.Level >= WarnLevel {
- NewEntry(logger).Warnf(format, args...)
- }
-}
-
-func (logger *Logger) Errorf(format string, args ...interface{}) {
- if logger.Level >= ErrorLevel {
- NewEntry(logger).Errorf(format, args...)
- }
-}
-
-func (logger *Logger) Fatalf(format string, args ...interface{}) {
- if logger.Level >= FatalLevel {
- NewEntry(logger).Fatalf(format, args...)
- }
- os.Exit(1)
-}
-
-func (logger *Logger) Panicf(format string, args ...interface{}) {
- if logger.Level >= PanicLevel {
- NewEntry(logger).Panicf(format, args...)
- }
-}
-
-func (logger *Logger) Debug(args ...interface{}) {
- if logger.Level >= DebugLevel {
- NewEntry(logger).Debug(args...)
- }
-}
-
-func (logger *Logger) Info(args ...interface{}) {
- if logger.Level >= InfoLevel {
- NewEntry(logger).Info(args...)
- }
-}
-
-func (logger *Logger) Print(args ...interface{}) {
- NewEntry(logger).Info(args...)
-}
-
-func (logger *Logger) Warn(args ...interface{}) {
- if logger.Level >= WarnLevel {
- NewEntry(logger).Warn(args...)
- }
-}
-
-func (logger *Logger) Warning(args ...interface{}) {
- if logger.Level >= WarnLevel {
- NewEntry(logger).Warn(args...)
- }
-}
-
-func (logger *Logger) Error(args ...interface{}) {
- if logger.Level >= ErrorLevel {
- NewEntry(logger).Error(args...)
- }
-}
-
-func (logger *Logger) Fatal(args ...interface{}) {
- if logger.Level >= FatalLevel {
- NewEntry(logger).Fatal(args...)
- }
- os.Exit(1)
-}
-
-func (logger *Logger) Panic(args ...interface{}) {
- if logger.Level >= PanicLevel {
- NewEntry(logger).Panic(args...)
- }
-}
-
-func (logger *Logger) Debugln(args ...interface{}) {
- if logger.Level >= DebugLevel {
- NewEntry(logger).Debugln(args...)
- }
-}
-
-func (logger *Logger) Infoln(args ...interface{}) {
- if logger.Level >= InfoLevel {
- NewEntry(logger).Infoln(args...)
- }
-}
-
-func (logger *Logger) Println(args ...interface{}) {
- NewEntry(logger).Println(args...)
-}
-
-func (logger *Logger) Warnln(args ...interface{}) {
- if logger.Level >= WarnLevel {
- NewEntry(logger).Warnln(args...)
- }
-}
-
-func (logger *Logger) Warningln(args ...interface{}) {
- if logger.Level >= WarnLevel {
- NewEntry(logger).Warnln(args...)
- }
-}
-
-func (logger *Logger) Errorln(args ...interface{}) {
- if logger.Level >= ErrorLevel {
- NewEntry(logger).Errorln(args...)
- }
-}
-
-func (logger *Logger) Fatalln(args ...interface{}) {
- if logger.Level >= FatalLevel {
- NewEntry(logger).Fatalln(args...)
- }
- os.Exit(1)
-}
-
-func (logger *Logger) Panicln(args ...interface{}) {
- if logger.Level >= PanicLevel {
- NewEntry(logger).Panicln(args...)
- }
-}
diff --git a/vendor/github.com/Sirupsen/logrus/logrus.go b/vendor/github.com/Sirupsen/logrus/logrus.go
deleted file mode 100644
index e5966911..00000000
--- a/vendor/github.com/Sirupsen/logrus/logrus.go
+++ /dev/null
@@ -1,143 +0,0 @@
-package logrus
-
-import (
- "fmt"
- "log"
- "strings"
-)
-
-// Fields type, used to pass to `WithFields`.
-type Fields map[string]interface{}
-
-// Level type
-type Level uint8
-
-// Convert the Level to a string. E.g. PanicLevel becomes "panic".
-func (level Level) String() string {
- switch level {
- case DebugLevel:
- return "debug"
- case InfoLevel:
- return "info"
- case WarnLevel:
- return "warning"
- case ErrorLevel:
- return "error"
- case FatalLevel:
- return "fatal"
- case PanicLevel:
- return "panic"
- }
-
- return "unknown"
-}
-
-// ParseLevel takes a string level and returns the Logrus log level constant.
-func ParseLevel(lvl string) (Level, error) {
- switch strings.ToLower(lvl) {
- case "panic":
- return PanicLevel, nil
- case "fatal":
- return FatalLevel, nil
- case "error":
- return ErrorLevel, nil
- case "warn", "warning":
- return WarnLevel, nil
- case "info":
- return InfoLevel, nil
- case "debug":
- return DebugLevel, nil
- }
-
- var l Level
- return l, fmt.Errorf("not a valid logrus Level: %q", lvl)
-}
-
-// A constant exposing all logging levels
-var AllLevels = []Level{
- PanicLevel,
- FatalLevel,
- ErrorLevel,
- WarnLevel,
- InfoLevel,
- DebugLevel,
-}
-
-// These are the different logging levels. You can set the logging level to log
-// on your instance of logger, obtained with `logrus.New()`.
-const (
- // PanicLevel level, highest level of severity. Logs and then calls panic with the
- // message passed to Debug, Info, ...
- PanicLevel Level = iota
- // FatalLevel level. Logs and then calls `os.Exit(1)`. It will exit even if the
- // logging level is set to Panic.
- FatalLevel
- // ErrorLevel level. Logs. Used for errors that should definitely be noted.
- // Commonly used for hooks to send errors to an error tracking service.
- ErrorLevel
- // WarnLevel level. Non-critical entries that deserve eyes.
- WarnLevel
- // InfoLevel level. General operational entries about what's going on inside the
- // application.
- InfoLevel
- // DebugLevel level. Usually only enabled when debugging. Very verbose logging.
- DebugLevel
-)
-
-// Won't compile if StdLogger can't be realized by a log.Logger
-var (
- _ StdLogger = &log.Logger{}
- _ StdLogger = &Entry{}
- _ StdLogger = &Logger{}
-)
-
-// StdLogger is what your logrus-enabled library should take, that way
-// it'll accept a stdlib logger and a logrus logger. There's no standard
-// interface, this is the closest we get, unfortunately.
-type StdLogger interface {
- Print(...interface{})
- Printf(string, ...interface{})
- Println(...interface{})
-
- Fatal(...interface{})
- Fatalf(string, ...interface{})
- Fatalln(...interface{})
-
- Panic(...interface{})
- Panicf(string, ...interface{})
- Panicln(...interface{})
-}
-
-// The FieldLogger interface generalizes the Entry and Logger types
-type FieldLogger interface {
- WithField(key string, value interface{}) *Entry
- WithFields(fields Fields) *Entry
- WithError(err error) *Entry
-
- Debugf(format string, args ...interface{})
- Infof(format string, args ...interface{})
- Printf(format string, args ...interface{})
- Warnf(format string, args ...interface{})
- Warningf(format string, args ...interface{})
- Errorf(format string, args ...interface{})
- Fatalf(format string, args ...interface{})
- Panicf(format string, args ...interface{})
-
- Debug(args ...interface{})
- Info(args ...interface{})
- Print(args ...interface{})
- Warn(args ...interface{})
- Warning(args ...interface{})
- Error(args ...interface{})
- Fatal(args ...interface{})
- Panic(args ...interface{})
-
- Debugln(args ...interface{})
- Infoln(args ...interface{})
- Println(args ...interface{})
- Warnln(args ...interface{})
- Warningln(args ...interface{})
- Errorln(args ...interface{})
- Fatalln(args ...interface{})
- Panicln(args ...interface{})
-}
diff --git a/vendor/github.com/Sirupsen/logrus/terminal_bsd.go b/vendor/github.com/Sirupsen/logrus/terminal_bsd.go
deleted file mode 100644
index 71f8d67a..00000000
--- a/vendor/github.com/Sirupsen/logrus/terminal_bsd.go
+++ /dev/null
@@ -1,9 +0,0 @@
-// +build darwin freebsd openbsd netbsd dragonfly
-
-package logrus
-
-import "syscall"
-
-const ioctlReadTermios = syscall.TIOCGETA
-
-type Termios syscall.Termios
diff --git a/vendor/github.com/Sirupsen/logrus/terminal_linux.go b/vendor/github.com/Sirupsen/logrus/terminal_linux.go
deleted file mode 100644
index a2c0b40d..00000000
--- a/vendor/github.com/Sirupsen/logrus/terminal_linux.go
+++ /dev/null
@@ -1,12 +0,0 @@
-// Based on ssh/terminal:
-// Copyright 2013 The Go Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style
-// license that can be found in the LICENSE file.
-
-package logrus
-
-import "syscall"
-
-const ioctlReadTermios = syscall.TCGETS
-
-type Termios syscall.Termios
diff --git a/vendor/github.com/Sirupsen/logrus/terminal_notwindows.go b/vendor/github.com/Sirupsen/logrus/terminal_notwindows.go
deleted file mode 100644
index b343b3a3..00000000
--- a/vendor/github.com/Sirupsen/logrus/terminal_notwindows.go
+++ /dev/null
@@ -1,21 +0,0 @@
-// Based on ssh/terminal:
-// Copyright 2011 The Go Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style
-// license that can be found in the LICENSE file.
-
-// +build linux darwin freebsd openbsd netbsd dragonfly
-
-package logrus
-
-import (
- "syscall"
- "unsafe"
-)
-
-// IsTerminal returns true if stderr's file descriptor is a terminal.
-func IsTerminal() bool {
- fd := syscall.Stderr
- var termios Termios
- _, _, err := syscall.Syscall6(syscall.SYS_IOCTL, uintptr(fd), ioctlReadTermios, uintptr(unsafe.Pointer(&termios)), 0, 0, 0)
- return err == 0
-}
diff --git a/vendor/github.com/Sirupsen/logrus/terminal_solaris.go b/vendor/github.com/Sirupsen/logrus/terminal_solaris.go
deleted file mode 100644
index 3e70bf7b..00000000
--- a/vendor/github.com/Sirupsen/logrus/terminal_solaris.go
+++ /dev/null
@@ -1,15 +0,0 @@
-// +build solaris
-
-package logrus
-
-import (
- "os"
-
- "golang.org/x/sys/unix"
-)
-
-// IsTerminal returns true if the given file descriptor is a terminal.
-func IsTerminal() bool {
- _, err := unix.IoctlGetTermios(int(os.Stdout.Fd()), unix.TCGETA)
- return err == nil
-}
diff --git a/vendor/github.com/Sirupsen/logrus/terminal_windows.go b/vendor/github.com/Sirupsen/logrus/terminal_windows.go
deleted file mode 100644
index 0146845d..00000000
--- a/vendor/github.com/Sirupsen/logrus/terminal_windows.go
+++ /dev/null
@@ -1,27 +0,0 @@
-// Based on ssh/terminal:
-// Copyright 2011 The Go Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style
-// license that can be found in the LICENSE file.
-
-// +build windows
-
-package logrus
-
-import (
- "syscall"
- "unsafe"
-)
-
-var kernel32 = syscall.NewLazyDLL("kernel32.dll")
-
-var (
- procGetConsoleMode = kernel32.NewProc("GetConsoleMode")
-)
-
-// IsTerminal returns true if stderr's file descriptor is a terminal.
-func IsTerminal() bool {
- fd := syscall.Stderr
- var st uint32
- r, _, e := syscall.Syscall(procGetConsoleMode.Addr(), 2, uintptr(fd), uintptr(unsafe.Pointer(&st)), 0)
- return r != 0 && e == 0
-}
diff --git a/vendor/github.com/Sirupsen/logrus/text_formatter.go b/vendor/github.com/Sirupsen/logrus/text_formatter.go
deleted file mode 100644
index 6afd0e03..00000000
--- a/vendor/github.com/Sirupsen/logrus/text_formatter.go
+++ /dev/null
@@ -1,161 +0,0 @@
-package logrus
-
-import (
- "bytes"
- "fmt"
- "runtime"
- "sort"
- "strings"
- "time"
-)
-
-const (
- nocolor = 0
- red = 31
- green = 32
- yellow = 33
- blue = 34
- gray = 37
-)
-
-var (
- baseTimestamp time.Time
- isTerminal bool
-)
-
-func init() {
- baseTimestamp = time.Now()
- isTerminal = IsTerminal()
-}
-
-func miniTS() int {
- return int(time.Since(baseTimestamp) / time.Second)
-}
-
-type TextFormatter struct {
- // Set to true to bypass checking for a TTY before outputting colors.
- ForceColors bool
-
- // Force disabling colors.
- DisableColors bool
-
- // Disable timestamp logging. useful when output is redirected to logging
- // system that already adds timestamps.
- DisableTimestamp bool
-
- // Enable logging the full timestamp when a TTY is attached instead of just
- // the time passed since beginning of execution.
- FullTimestamp bool
-
- // TimestampFormat to use for display when a full timestamp is printed
- TimestampFormat string
-
- // The fields are sorted by default for a consistent output. For applications
- // that log extremely frequently and don't use the JSON formatter this may not
- // be desired.
- DisableSorting bool
-}
-
-func (f *TextFormatter) Format(entry *Entry) ([]byte, error) {
- var keys []string = make([]string, 0, len(entry.Data))
- for k := range entry.Data {
- keys = append(keys, k)
- }
-
- if !f.DisableSorting {
- sort.Strings(keys)
- }
-
- b := &bytes.Buffer{}
-
- prefixFieldClashes(entry.Data)
-
- isColorTerminal := isTerminal && (runtime.GOOS != "windows")
- isColored := (f.ForceColors || isColorTerminal) && !f.DisableColors
-
- timestampFormat := f.TimestampFormat
- if timestampFormat == "" {
- timestampFormat = DefaultTimestampFormat
- }
- if isColored {
- f.printColored(b, entry, keys, timestampFormat)
- } else {
- if !f.DisableTimestamp {
- f.appendKeyValue(b, "time", entry.Time.Format(timestampFormat))
- }
- f.appendKeyValue(b, "level", entry.Level.String())
- if entry.Message != "" {
- f.appendKeyValue(b, "msg", entry.Message)
- }
- for _, key := range keys {
- f.appendKeyValue(b, key, entry.Data[key])
- }
- }
-
- b.WriteByte('\n')
- return b.Bytes(), nil
-}
-
-func (f *TextFormatter) printColored(b *bytes.Buffer, entry *Entry, keys []string, timestampFormat string) {
- var levelColor int
- switch entry.Level {
- case DebugLevel:
- levelColor = gray
- case WarnLevel:
- levelColor = yellow
- case ErrorLevel, FatalLevel, PanicLevel:
- levelColor = red
- default:
- levelColor = blue
- }
-
- levelText := strings.ToUpper(entry.Level.String())[0:4]
-
- if !f.FullTimestamp {
- fmt.Fprintf(b, "\x1b[%dm%s\x1b[0m[%04d] %-44s ", levelColor, levelText, miniTS(), entry.Message)
- } else {
- fmt.Fprintf(b, "\x1b[%dm%s\x1b[0m[%s] %-44s ", levelColor, levelText, entry.Time.Format(timestampFormat), entry.Message)
- }
- for _, k := range keys {
- v := entry.Data[k]
- fmt.Fprintf(b, " \x1b[%dm%s\x1b[0m=%+v", levelColor, k, v)
- }
-}
-
-func needsQuoting(text string) bool {
- for _, ch := range text {
- if !((ch >= 'a' && ch <= 'z') ||
- (ch >= 'A' && ch <= 'Z') ||
- (ch >= '0' && ch <= '9') ||
- ch == '-' || ch == '.') {
- return true
- }
- }
- return false
-}
-
-func (f *TextFormatter) appendKeyValue(b *bytes.Buffer, key string, value interface{}) {
-
- b.WriteString(key)
- b.WriteByte('=')
-
- switch value := value.(type) {
- case string:
- if !needsQuoting(value) {
- b.WriteString(value)
- } else {
- fmt.Fprintf(b, "%q", value)
- }
- case error:
- errmsg := value.Error()
- if !needsQuoting(errmsg) {
- b.WriteString(errmsg)
- } else {
- fmt.Fprintf(b, "%q", value)
- }
- default:
- fmt.Fprint(b, value)
- }
-
- b.WriteByte(' ')
-}
diff --git a/vendor/github.com/Sirupsen/logrus/writer.go b/vendor/github.com/Sirupsen/logrus/writer.go
deleted file mode 100644
index f74d2aa5..00000000
--- a/vendor/github.com/Sirupsen/logrus/writer.go
+++ /dev/null
@@ -1,53 +0,0 @@
-package logrus
-
-import (
- "bufio"
- "io"
- "runtime"
-)
-
-func (logger *Logger) Writer() *io.PipeWriter {
- return logger.WriterLevel(InfoLevel)
-}
-
-func (logger *Logger) WriterLevel(level Level) *io.PipeWriter {
- reader, writer := io.Pipe()
-
- var printFunc func(args ...interface{})
- switch level {
- case DebugLevel:
- printFunc = logger.Debug
- case InfoLevel:
- printFunc = logger.Info
- case WarnLevel:
- printFunc = logger.Warn
- case ErrorLevel:
- printFunc = logger.Error
- case FatalLevel:
- printFunc = logger.Fatal
- case PanicLevel:
- printFunc = logger.Panic
- default:
- printFunc = logger.Print
- }
-
- go logger.writerScanner(reader, printFunc)
- runtime.SetFinalizer(writer, writerFinalizer)
-
- return writer
-}
-
-func (logger *Logger) writerScanner(reader *io.PipeReader, printFunc func(args ...interface{})) {
- scanner := bufio.NewScanner(reader)
- for scanner.Scan() {
- printFunc(scanner.Text())
- }
- if err := scanner.Err(); err != nil {
- logger.Errorf("Error while reading from Writer: %s", err)
- }
- reader.Close()
-}
-
-func writerFinalizer(writer *io.PipeWriter) {
- writer.Close()
-}
diff --git a/vendor/github.com/dylanmei/iso8601/LICENSE b/vendor/github.com/dylanmei/iso8601/LICENSE
deleted file mode 100644
index dcabcdc7..00000000
--- a/vendor/github.com/dylanmei/iso8601/LICENSE
+++ /dev/null
@@ -1,21 +0,0 @@
-The MIT License (MIT)
-
-Copyright (c) 2015 Dylan Meissner
-
-Permission is hereby granted, free of charge, to any person obtaining a copy
-of this software and associated documentation files (the "Software"), to deal
-in the Software without restriction, including without limitation the rights
-to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
-copies of the Software, and to permit persons to whom the Software is
-furnished to do so, subject to the following conditions:
-
-The above copyright notice and this permission notice shall be included in all
-copies or substantial portions of the Software.
-
-THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
-OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
-SOFTWARE.
diff --git a/vendor/github.com/dylanmei/iso8601/README.md b/vendor/github.com/dylanmei/iso8601/README.md
deleted file mode 100644
index c93b3cf7..00000000
--- a/vendor/github.com/dylanmei/iso8601/README.md
+++ /dev/null
@@ -1,9 +0,0 @@
-
-iso 8601 parser and formatter
-=============================
-
-An [ISO8601](https://en.wikipedia.org/wiki/ISO_8601) Go utility.
-
-- *Time* is not yet implemented
-- *Duration* is mostly implemented
-
diff --git a/vendor/github.com/dylanmei/iso8601/duration.go b/vendor/github.com/dylanmei/iso8601/duration.go
deleted file mode 100644
index d5cab17d..00000000
--- a/vendor/github.com/dylanmei/iso8601/duration.go
+++ /dev/null
@@ -1,96 +0,0 @@
-package iso8601
-
-import (
- "errors"
- "fmt"
- "regexp"
- "strconv"
- "time"
-)
-
-var (
- // ErrBadFormat is returned when parsing fails
- ErrBadFormat = errors.New("bad format string")
-
- // ErrNoMonth is raised when a month is in the format string
- ErrNoMonth = errors.New("no months allowed")
-
- full = regexp.MustCompile(`P((?P\d+)Y)?((?P\d+)M)?((?P\d+)D)?(T((?P\d+)H)?((?P\d+)M)?((?P\d+)S)?)?`)
- week = regexp.MustCompile(`P((?P\d+)W)`)
-)
-
-// adapted from https://github.com/BrianHicks/finch/duration
-func ParseDuration(value string) (time.Duration, error) {
- var match []string
- var regex *regexp.Regexp
-
- if week.MatchString(value) {
- match = week.FindStringSubmatch(value)
- regex = week
- } else if full.MatchString(value) {
- match = full.FindStringSubmatch(value)
- regex = full
- } else {
- return time.Duration(0), ErrBadFormat
- }
-
- d := time.Duration(0)
- day := time.Hour * 24
- week := day * 7
- year := day * 365
-
- for i, name := range regex.SubexpNames() {
- part := match[i]
- if i == 0 || name == "" || part == "" {
- continue
- }
-
- value, err := strconv.Atoi(part)
- if err != nil {
- return time.Duration(0), err
- }
- switch name {
- case "year":
- d += year * time.Duration(value)
- case "month":
- return time.Duration(0), ErrNoMonth
- case "week":
- d += week * time.Duration(value)
- case "day":
- d += day * time.Duration(value)
- case "hour":
- d += time.Hour * time.Duration(value)
- case "minute":
- d += time.Minute * time.Duration(value)
- case "second":
- d += time.Second * time.Duration(value)
- }
- }
-
- return d, nil
-}
-
-func FormatDuration(duration time.Duration) string {
- // we're not doing negative durations
- if duration.Seconds() <= 0 {
- return "PT0S"
- }
-
- hours := int(duration.Hours())
- minutes := int(duration.Minutes()) - (hours * 60)
- seconds := int(duration.Seconds()) - (hours*3600 + minutes*60)
-
- // we're not doing Y,M,W
- s := "PT"
- if hours > 0 {
- s = fmt.Sprintf("%s%dH", s, hours)
- }
- if minutes > 0 {
- s = fmt.Sprintf("%s%dM", s, minutes)
- }
- if seconds > 0 {
- s = fmt.Sprintf("%s%dS", s, seconds)
- }
-
- return s
-}
diff --git a/vendor/github.com/dylanmei/winrmtest/LICENSE b/vendor/github.com/dylanmei/winrmtest/LICENSE
deleted file mode 100644
index aac5c68e..00000000
--- a/vendor/github.com/dylanmei/winrmtest/LICENSE
+++ /dev/null
@@ -1,22 +0,0 @@
-Copyright (c) 2014-2015 Dylan Meissner
-
-MIT License
-
-Permission is hereby granted, free of charge, to any person obtaining
-a copy of this software and associated documentation files (the
-"Software"), to deal in the Software without restriction, including
-without limitation the rights to use, copy, modify, merge, publish,
-distribute, sublicense, and/or sell copies of the Software, and to
-permit persons to whom the Software is furnished to do so, subject to
-the following conditions:
-
-The above copyright notice and this permission notice shall be
-included in all copies or substantial portions of the Software.
-
-THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
-WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
diff --git a/vendor/github.com/dylanmei/winrmtest/README.md b/vendor/github.com/dylanmei/winrmtest/README.md
deleted file mode 100644
index 19c19609..00000000
--- a/vendor/github.com/dylanmei/winrmtest/README.md
+++ /dev/null
@@ -1,48 +0,0 @@
-
-# winrmtest
-
-An in-progress testing package to compliment the [masterzen/winrm](https://github.com/masterzen/winrm) Go-based winrm library.
-
-My primary use-case for this is for [dylanmei/packer-communicator-winrm](https://github.com/dylanmei/packer-communicator-winrm), a [Packer](http://packer.io) communicator plugin for interacting with machines using Windows Remote Management.
-
-## Example Use
-
-A fictitious "Windows tools" package.
-
-```
-
-package wintools
-
-import (
- "io"
- "testing"
- "github.com/dylanmei/winrmtest"
-)
-
-func Test_empty_temp_directory(t *testing.T) {
- r := winrmtest.NewRemote()
- defer r.Close()
-
- r.CommandFunc(wimrmtest.MatchText("dir C:\Temp"), func(out, err io.Writer) int {
- out.Write([]byte(` Volume in drive C is Windows 2012 R2
- Volume Serial Number is XXXX-XXXX
-
- Directory of C:\
-
-File Not Found`))
- return 0
- })
-
- lister := NewDirectoryLister(r.Host, r.Port)
- list, _ := lister.TempDirectory()
-
- if count := len(list.Dirs()); count != 0 {
- t.Errorf("Expected 0 directories but found %d.\n", count)
- }
-
- if count := len(list.Files()); count != 0 {
- t.Errorf("Expected 0 files but found %d.\n", count)
- }
-}
-```
-
diff --git a/vendor/github.com/dylanmei/winrmtest/remote.go b/vendor/github.com/dylanmei/winrmtest/remote.go
deleted file mode 100644
index ecc083f7..00000000
--- a/vendor/github.com/dylanmei/winrmtest/remote.go
+++ /dev/null
@@ -1,79 +0,0 @@
-package winrmtest
-
-import (
- "io"
- "net/http"
- "net/http/httptest"
- "net/url"
- "regexp"
- "strconv"
- "strings"
-)
-
-// Remote respresents a WinRM server
-type Remote struct {
- Host string
- Port int
- server *httptest.Server
- service *wsman
-}
-
-// NewRemote returns a new initialized Remote
-func NewRemote() *Remote {
- mux := http.NewServeMux()
- srv := httptest.NewServer(mux)
-
- host, port, _ := splitAddr(srv.URL)
- remote := Remote{
- Host: host,
- Port: port,
- server: srv,
- service: &wsman{},
- }
-
- mux.Handle("/wsman", remote.service)
- return &remote
-}
-
-// Close closes the WinRM server
-func (r *Remote) Close() {
- r.server.Close()
-}
-
-// MatcherFunc respresents a function used to match WinRM commands
-type MatcherFunc func(candidate string) bool
-
-// MatchText return a new MatcherFunc based on text matching
-func MatchText(text string) MatcherFunc {
- return func(candidate string) bool {
- return text == candidate
- }
-}
-
-// MatchPattern return a new MatcherFunc based on pattern matching
-func MatchPattern(pattern string) MatcherFunc {
- r := regexp.MustCompile(pattern)
- return func(candidate string) bool {
- return r.MatchString(candidate)
- }
-}
-
-// CommandFunc respresents a function used to mock WinRM commands
-type CommandFunc func(out, err io.Writer) (exitCode int)
-
-// CommandFunc adds a WinRM command mock function to the WinRM server
-func (r *Remote) CommandFunc(m MatcherFunc, f CommandFunc) {
- r.service.HandleCommand(m, f)
-}
-
-func splitAddr(addr string) (host string, port int, err error) {
- u, err := url.Parse(addr)
- if err != nil {
- return
- }
-
- split := strings.Split(u.Host, ":")
- host = split[0]
- port, err = strconv.Atoi(split[1])
- return
-}
diff --git a/vendor/github.com/dylanmei/winrmtest/wsman.go b/vendor/github.com/dylanmei/winrmtest/wsman.go
deleted file mode 100644
index c6d1c247..00000000
--- a/vendor/github.com/dylanmei/winrmtest/wsman.go
+++ /dev/null
@@ -1,170 +0,0 @@
-package winrmtest
-
-import (
- "bytes"
- "encoding/base64"
- "fmt"
- "net/http"
- "strconv"
- "strings"
-
- "github.com/masterzen/winrm/soap"
- "github.com/masterzen/xmlpath"
- "github.com/satori/go.uuid"
-)
-
-type wsman struct {
- commands []*command
- identitySeed int
-}
-
-type command struct {
- id string
- matcher MatcherFunc
- handler CommandFunc
-}
-
-func (w *wsman) HandleCommand(m MatcherFunc, f CommandFunc) string {
- id := uuid.NewV4().String()
- w.commands = append(w.commands, &command{
- id: id,
- matcher: m,
- handler: f,
- })
-
- return id
-}
-
-func (w *wsman) CommandByText(cmd string) *command {
- for _, c := range w.commands {
- if c.matcher(cmd) {
- return c
- }
- }
- return nil
-}
-
-func (w *wsman) CommandByID(id string) *command {
- for _, c := range w.commands {
- if c.id == id {
- return c
- }
- }
- return nil
-}
-
-func (w *wsman) ServeHTTP(rw http.ResponseWriter, r *http.Request) {
- rw.Header().Add("Content-Type", "application/soap+xml")
-
- defer r.Body.Close()
- env, err := xmlpath.Parse(r.Body)
-
- if err != nil {
- return
- }
-
- action := readAction(env)
- switch {
- case strings.HasSuffix(action, "transfer/Create"):
- // create a new shell
-
- rw.Write([]byte(`
-
- 123
- `))
-
- case strings.HasSuffix(action, "shell/Command"):
- // execute on behalf of the client
- text := readCommand(env)
- cmd := w.CommandByText(text)
-
- if cmd == nil {
- fmt.Printf("I don't know this command: Command=%s\n", text)
- rw.WriteHeader(http.StatusInternalServerError)
- return
- }
-
- rw.Write([]byte(fmt.Sprintf(`
-
- %s
- `, cmd.id)))
-
- case strings.HasSuffix(action, "shell/Receive"):
- // client ready to receive the results
-
- id := readCommandIDFromDesiredStream(env)
- cmd := w.CommandByID(id)
-
- if cmd == nil {
- fmt.Printf("I don't know this command: CommandId=%s\n", id)
- rw.WriteHeader(http.StatusInternalServerError)
- return
- }
-
- stdout := new(bytes.Buffer)
- stderr := new(bytes.Buffer)
- result := cmd.handler(stdout, stderr)
- content := base64.StdEncoding.EncodeToString(stdout.Bytes())
-
- rw.Write([]byte(fmt.Sprintf(`
-
-
- %s
-
-
-
- %d
-
-
- `, id, content, id, id, result)))
-
- case strings.HasSuffix(action, "shell/Signal"):
- // end of the shell command
- rw.WriteHeader(http.StatusOK)
- case strings.HasSuffix(action, "transfer/Delete"):
- // end of the session
- rw.WriteHeader(http.StatusOK)
- default:
- fmt.Printf("I don't know this action: %s\n", action)
- rw.WriteHeader(http.StatusInternalServerError)
- }
-}
-
-func readAction(env *xmlpath.Node) string {
- xpath, err := xmlpath.CompileWithNamespace(
- "//a:Action", soap.GetAllNamespaces())
-
- if err != nil {
- return ""
- }
-
- action, _ := xpath.String(env)
- return action
-}
-
-func readCommand(env *xmlpath.Node) string {
- xpath, err := xmlpath.CompileWithNamespace(
- "//rsp:Command", soap.GetAllNamespaces())
-
- if err != nil {
- return ""
- }
-
- command, _ := xpath.String(env)
- if unquoted, err := strconv.Unquote(command); err == nil {
- return unquoted
- }
- return command
-}
-
-func readCommandIDFromDesiredStream(env *xmlpath.Node) string {
- xpath, err := xmlpath.CompileWithNamespace(
- "//rsp:DesiredStream/@CommandId", soap.GetAllNamespaces())
-
- if err != nil {
- return ""
- }
-
- id, _ := xpath.String(env)
- return id
-}
diff --git a/vendor/github.com/hashicorp/errwrap/LICENSE b/vendor/github.com/hashicorp/errwrap/LICENSE
deleted file mode 100644
index c33dcc7c..00000000
--- a/vendor/github.com/hashicorp/errwrap/LICENSE
+++ /dev/null
@@ -1,354 +0,0 @@
-Mozilla Public License, version 2.0
-
-1. Definitions
-
-1.1. “Contributor”
-
- means each individual or legal entity that creates, contributes to the
- creation of, or owns Covered Software.
-
-1.2. “Contributor Version”
-
- means the combination of the Contributions of others (if any) used by a
- Contributor and that particular Contributor’s Contribution.
-
-1.3. “Contribution”
-
- means Covered Software of a particular Contributor.
-
-1.4. “Covered Software”
-
- means Source Code Form to which the initial Contributor has attached the
- notice in Exhibit A, the Executable Form of such Source Code Form, and
- Modifications of such Source Code Form, in each case including portions
- thereof.
-
-1.5. “Incompatible With Secondary Licenses”
- means
-
- a. that the initial Contributor has attached the notice described in
- Exhibit B to the Covered Software; or
-
- b. that the Covered Software was made available under the terms of version
- 1.1 or earlier of the License, but not also under the terms of a
- Secondary License.
-
-1.6. “Executable Form”
-
- means any form of the work other than Source Code Form.
-
-1.7. “Larger Work”
-
- means a work that combines Covered Software with other material, in a separate
- file or files, that is not Covered Software.
-
-1.8. “License”
-
- means this document.
-
-1.9. “Licensable”
-
- means having the right to grant, to the maximum extent possible, whether at the
- time of the initial grant or subsequently, any and all of the rights conveyed by
- this License.
-
-1.10. “Modifications”
-
- means any of the following:
-
- a. any file in Source Code Form that results from an addition to, deletion
- from, or modification of the contents of Covered Software; or
-
- b. any new file in Source Code Form that contains any Covered Software.
-
-1.11. “Patent Claims” of a Contributor
-
- means any patent claim(s), including without limitation, method, process,
- and apparatus claims, in any patent Licensable by such Contributor that
- would be infringed, but for the grant of the License, by the making,
- using, selling, offering for sale, having made, import, or transfer of
- either its Contributions or its Contributor Version.
-
-1.12. “Secondary License”
-
- means either the GNU General Public License, Version 2.0, the GNU Lesser
- General Public License, Version 2.1, the GNU Affero General Public
- License, Version 3.0, or any later versions of those licenses.
-
-1.13. “Source Code Form”
-
- means the form of the work preferred for making modifications.
-
-1.14. “You” (or “Your”)
-
- means an individual or a legal entity exercising rights under this
- License. For legal entities, “You” includes any entity that controls, is
- controlled by, or is under common control with You. For purposes of this
- definition, “control” means (a) the power, direct or indirect, to cause
- the direction or management of such entity, whether by contract or
- otherwise, or (b) ownership of more than fifty percent (50%) of the
- outstanding shares or beneficial ownership of such entity.
-
-
-2. License Grants and Conditions
-
-2.1. Grants
-
- Each Contributor hereby grants You a world-wide, royalty-free,
- non-exclusive license:
-
- a. under intellectual property rights (other than patent or trademark)
- Licensable by such Contributor to use, reproduce, make available,
- modify, display, perform, distribute, and otherwise exploit its
- Contributions, either on an unmodified basis, with Modifications, or as
- part of a Larger Work; and
-
- b. under Patent Claims of such Contributor to make, use, sell, offer for
- sale, have made, import, and otherwise transfer either its Contributions
- or its Contributor Version.
-
-2.2. Effective Date
-
- The licenses granted in Section 2.1 with respect to any Contribution become
- effective for each Contribution on the date the Contributor first distributes
- such Contribution.
-
-2.3. Limitations on Grant Scope
-
- The licenses granted in this Section 2 are the only rights granted under this
- License. No additional rights or licenses will be implied from the distribution
- or licensing of Covered Software under this License. Notwithstanding Section
- 2.1(b) above, no patent license is granted by a Contributor:
-
- a. for any code that a Contributor has removed from Covered Software; or
-
- b. for infringements caused by: (i) Your and any other third party’s
- modifications of Covered Software, or (ii) the combination of its
- Contributions with other software (except as part of its Contributor
- Version); or
-
- c. under Patent Claims infringed by Covered Software in the absence of its
- Contributions.
-
- This License does not grant any rights in the trademarks, service marks, or
- logos of any Contributor (except as may be necessary to comply with the
- notice requirements in Section 3.4).
-
-2.4. Subsequent Licenses
-
- No Contributor makes additional grants as a result of Your choice to
- distribute the Covered Software under a subsequent version of this License
- (see Section 10.2) or under the terms of a Secondary License (if permitted
- under the terms of Section 3.3).
-
-2.5. Representation
-
- Each Contributor represents that the Contributor believes its Contributions
- are its original creation(s) or it has sufficient rights to grant the
- rights to its Contributions conveyed by this License.
-
-2.6. Fair Use
-
- This License is not intended to limit any rights You have under applicable
- copyright doctrines of fair use, fair dealing, or other equivalents.
-
-2.7. Conditions
-
- Sections 3.1, 3.2, 3.3, and 3.4 are conditions of the licenses granted in
- Section 2.1.
-
-
-3. Responsibilities
-
-3.1. Distribution of Source Form
-
- All distribution of Covered Software in Source Code Form, including any
- Modifications that You create or to which You contribute, must be under the
- terms of this License. You must inform recipients that the Source Code Form
- of the Covered Software is governed by the terms of this License, and how
- they can obtain a copy of this License. You may not attempt to alter or
- restrict the recipients’ rights in the Source Code Form.
-
-3.2. Distribution of Executable Form
-
- If You distribute Covered Software in Executable Form then:
-
- a. such Covered Software must also be made available in Source Code Form,
- as described in Section 3.1, and You must inform recipients of the
- Executable Form how they can obtain a copy of such Source Code Form by
- reasonable means in a timely manner, at a charge no more than the cost
- of distribution to the recipient; and
-
- b. You may distribute such Executable Form under the terms of this License,
- or sublicense it under different terms, provided that the license for
- the Executable Form does not attempt to limit or alter the recipients’
- rights in the Source Code Form under this License.
-
-3.3. Distribution of a Larger Work
-
- You may create and distribute a Larger Work under terms of Your choice,
- provided that You also comply with the requirements of this License for the
- Covered Software. If the Larger Work is a combination of Covered Software
- with a work governed by one or more Secondary Licenses, and the Covered
- Software is not Incompatible With Secondary Licenses, this License permits
- You to additionally distribute such Covered Software under the terms of
- such Secondary License(s), so that the recipient of the Larger Work may, at
- their option, further distribute the Covered Software under the terms of
- either this License or such Secondary License(s).
-
-3.4. Notices
-
- You may not remove or alter the substance of any license notices (including
- copyright notices, patent notices, disclaimers of warranty, or limitations
- of liability) contained within the Source Code Form of the Covered
- Software, except that You may alter any license notices to the extent
- required to remedy known factual inaccuracies.
-
-3.5. Application of Additional Terms
-
- You may choose to offer, and to charge a fee for, warranty, support,
- indemnity or liability obligations to one or more recipients of Covered
- Software. However, You may do so only on Your own behalf, and not on behalf
- of any Contributor. You must make it absolutely clear that any such
- warranty, support, indemnity, or liability obligation is offered by You
- alone, and You hereby agree to indemnify every Contributor for any
- liability incurred by such Contributor as a result of warranty, support,
- indemnity or liability terms You offer. You may include additional
- disclaimers of warranty and limitations of liability specific to any
- jurisdiction.
-
-4. Inability to Comply Due to Statute or Regulation
-
- If it is impossible for You to comply with any of the terms of this License
- with respect to some or all of the Covered Software due to statute, judicial
- order, or regulation then You must: (a) comply with the terms of this License
- to the maximum extent possible; and (b) describe the limitations and the code
- they affect. Such description must be placed in a text file included with all
- distributions of the Covered Software under this License. Except to the
- extent prohibited by statute or regulation, such description must be
- sufficiently detailed for a recipient of ordinary skill to be able to
- understand it.
-
-5. Termination
-
-5.1. The rights granted under this License will terminate automatically if You
- fail to comply with any of its terms. However, if You become compliant,
- then the rights granted under this License from a particular Contributor
- are reinstated (a) provisionally, unless and until such Contributor
- explicitly and finally terminates Your grants, and (b) on an ongoing basis,
- if such Contributor fails to notify You of the non-compliance by some
- reasonable means prior to 60 days after You have come back into compliance.
- Moreover, Your grants from a particular Contributor are reinstated on an
- ongoing basis if such Contributor notifies You of the non-compliance by
- some reasonable means, this is the first time You have received notice of
- non-compliance with this License from such Contributor, and You become
- compliant prior to 30 days after Your receipt of the notice.
-
-5.2. If You initiate litigation against any entity by asserting a patent
- infringement claim (excluding declaratory judgment actions, counter-claims,
- and cross-claims) alleging that a Contributor Version directly or
- indirectly infringes any patent, then the rights granted to You by any and
- all Contributors for the Covered Software under Section 2.1 of this License
- shall terminate.
-
-5.3. In the event of termination under Sections 5.1 or 5.2 above, all end user
- license agreements (excluding distributors and resellers) which have been
- validly granted by You or Your distributors under this License prior to
- termination shall survive termination.
-
-6. Disclaimer of Warranty
-
- Covered Software is provided under this License on an “as is” basis, without
- warranty of any kind, either expressed, implied, or statutory, including,
- without limitation, warranties that the Covered Software is free of defects,
- merchantable, fit for a particular purpose or non-infringing. The entire
- risk as to the quality and performance of the Covered Software is with You.
- Should any Covered Software prove defective in any respect, You (not any
- Contributor) assume the cost of any necessary servicing, repair, or
- correction. This disclaimer of warranty constitutes an essential part of this
- License. No use of any Covered Software is authorized under this License
- except under this disclaimer.
-
-7. Limitation of Liability
-
- Under no circumstances and under no legal theory, whether tort (including
- negligence), contract, or otherwise, shall any Contributor, or anyone who
- distributes Covered Software as permitted above, be liable to You for any
- direct, indirect, special, incidental, or consequential damages of any
- character including, without limitation, damages for lost profits, loss of
- goodwill, work stoppage, computer failure or malfunction, or any and all
- other commercial damages or losses, even if such party shall have been
- informed of the possibility of such damages. This limitation of liability
- shall not apply to liability for death or personal injury resulting from such
- party’s negligence to the extent applicable law prohibits such limitation.
- Some jurisdictions do not allow the exclusion or limitation of incidental or
- consequential damages, so this exclusion and limitation may not apply to You.
-
-8. Litigation
-
- Any litigation relating to this License may be brought only in the courts of
- a jurisdiction where the defendant maintains its principal place of business
- and such litigation shall be governed by laws of that jurisdiction, without
- reference to its conflict-of-law provisions. Nothing in this Section shall
- prevent a party’s ability to bring cross-claims or counter-claims.
-
-9. Miscellaneous
-
- This License represents the complete agreement concerning the subject matter
- hereof. If any provision of this License is held to be unenforceable, such
- provision shall be reformed only to the extent necessary to make it
- enforceable. Any law or regulation which provides that the language of a
- contract shall be construed against the drafter shall not be used to construe
- this License against a Contributor.
-
-
-10. Versions of the License
-
-10.1. New Versions
-
- Mozilla Foundation is the license steward. Except as provided in Section
- 10.3, no one other than the license steward has the right to modify or
- publish new versions of this License. Each version will be given a
- distinguishing version number.
-
-10.2. Effect of New Versions
-
- You may distribute the Covered Software under the terms of the version of
- the License under which You originally received the Covered Software, or
- under the terms of any subsequent version published by the license
- steward.
-
-10.3. Modified Versions
-
- If you create software not governed by this License, and you want to
- create a new license for such software, you may create and use a modified
- version of this License if you rename the license and remove any
- references to the name of the license steward (except to note that such
- modified license differs from this License).
-
-10.4. Distributing Source Code Form that is Incompatible With Secondary Licenses
- If You choose to distribute Source Code Form that is Incompatible With
- Secondary Licenses under the terms of this version of the License, the
- notice described in Exhibit B of this License must be attached.
-
-Exhibit A - Source Code Form License Notice
-
- This Source Code Form is subject to the
- terms of the Mozilla Public License, v.
- 2.0. If a copy of the MPL was not
- distributed with this file, You can
- obtain one at
- http://mozilla.org/MPL/2.0/.
-
-If it is not possible or desirable to put the notice in a particular file, then
-You may include the notice in a location (such as a LICENSE file in a relevant
-directory) where a recipient would be likely to look for such a notice.
-
-You may add additional accurate notices of copyright ownership.
-
-Exhibit B - “Incompatible With Secondary Licenses” Notice
-
- This Source Code Form is “Incompatible
- With Secondary Licenses”, as defined by
- the Mozilla Public License, v. 2.0.
-
diff --git a/vendor/github.com/hashicorp/errwrap/README.md b/vendor/github.com/hashicorp/errwrap/README.md
deleted file mode 100644
index 1c95f597..00000000
--- a/vendor/github.com/hashicorp/errwrap/README.md
+++ /dev/null
@@ -1,89 +0,0 @@
-# errwrap
-
-`errwrap` is a package for Go that formalizes the pattern of wrapping errors
-and checking if an error contains another error.
-
-There is a common pattern in Go of taking a returned `error` value and
-then wrapping it (such as with `fmt.Errorf`) before returning it. The problem
-with this pattern is that you completely lose the original `error` structure.
-
-Arguably the _correct_ approach is that you should make a custom structure
-implementing the `error` interface, and have the original error as a field
-on that structure, such [as this example](http://golang.org/pkg/os/#PathError).
-This is a good approach, but you have to know the entire chain of possible
-rewrapping that happens, when you might just care about one.
-
-`errwrap` formalizes this pattern (it doesn't matter what approach you use
-above) by giving a single interface for wrapping errors, checking if a specific
-error is wrapped, and extracting that error.
-
-## Installation and Docs
-
-Install using `go get github.com/hashicorp/errwrap`.
-
-Full documentation is available at
-http://godoc.org/github.com/hashicorp/errwrap
-
-## Usage
-
-#### Basic Usage
-
-Below is a very basic example of its usage:
-
-```go
-// A function that always returns an error, but wraps it, like a real
-// function might.
-func tryOpen() error {
- _, err := os.Open("/i/dont/exist")
- if err != nil {
- return errwrap.Wrapf("Doesn't exist: {{err}}", err)
- }
-
- return nil
-}
-
-func main() {
- err := tryOpen()
-
- // We can use the Contains helpers to check if an error contains
- // another error. It is safe to do this with a nil error, or with
- // an error that doesn't even use the errwrap package.
- if errwrap.Contains(err, ErrNotExist) {
- // Do something
- }
- if errwrap.ContainsType(err, new(os.PathError)) {
- // Do something
- }
-
- // Or we can use the associated `Get` functions to just extract
- // a specific error. This would return nil if that specific error doesn't
- // exist.
- perr := errwrap.GetType(err, new(os.PathError))
-}
-```
-
-#### Custom Types
-
-If you're already making custom types that properly wrap errors, then
-you can get all the functionality of `errwraps.Contains` and such by
-implementing the `Wrapper` interface with just one function. Example:
-
-```go
-type AppError {
- Code ErrorCode
- Err error
-}
-
-func (e *AppError) WrappedErrors() []error {
- return []error{e.Err}
-}
-```
-
-Now this works:
-
-```go
-err := &AppError{Err: fmt.Errorf("an error")}
-if errwrap.ContainsType(err, fmt.Errorf("")) {
- // This will work!
-}
-```
diff --git a/vendor/github.com/hashicorp/errwrap/errwrap.go b/vendor/github.com/hashicorp/errwrap/errwrap.go
deleted file mode 100644
index a733bef1..00000000
--- a/vendor/github.com/hashicorp/errwrap/errwrap.go
+++ /dev/null
@@ -1,169 +0,0 @@
-// Package errwrap implements methods to formalize error wrapping in Go.
-//
-// All of the top-level functions that take an `error` are built to be able
-// to take any error, not just wrapped errors. This allows you to use errwrap
-// without having to type-check and type-cast everywhere.
-package errwrap
-
-import (
- "errors"
- "reflect"
- "strings"
-)
-
-// WalkFunc is the callback called for Walk.
-type WalkFunc func(error)
-
-// Wrapper is an interface that can be implemented by custom types to
-// have all the Contains, Get, etc. functions in errwrap work.
-//
-// When Walk reaches a Wrapper, it will call the callback for every
-// wrapped error in addition to the wrapper itself. Since all the top-level
-// functions in errwrap use Walk, this means that all those functions work
-// with your custom type.
-type Wrapper interface {
- WrappedErrors() []error
-}
-
-// Wrap defines that outer wraps inner, returning an error type that
-// can be cleanly used with the other methods in this package, such as
-// Contains, GetAll, etc.
-//
-// This function won't modify the error message at all (the outer message
-// will be used).
-func Wrap(outer, inner error) error {
- return &wrappedError{
- Outer: outer,
- Inner: inner,
- }
-}
-
-// Wrapf wraps an error with a formatting message. This is similar to using
-// `fmt.Errorf` to wrap an error. If you're using `fmt.Errorf` to wrap
-// errors, you should replace it with this.
-//
-// format is the format of the error message. The string '{{err}}' will
-// be replaced with the original error message.
-func Wrapf(format string, err error) error {
- outerMsg := ""
- if err != nil {
- outerMsg = err.Error()
- }
-
- outer := errors.New(strings.Replace(
- format, "{{err}}", outerMsg, -1))
-
- return Wrap(outer, err)
-}
-
-// Contains checks if the given error contains an error with the
-// message msg. If err is not a wrapped error, this will always return
-// false unless the error itself happens to match this msg.
-func Contains(err error, msg string) bool {
- return len(GetAll(err, msg)) > 0
-}
-
-// ContainsType checks if the given error contains an error with
-// the same concrete type as v. If err is not a wrapped error, this will
-// check the err itself.
-func ContainsType(err error, v interface{}) bool {
- return len(GetAllType(err, v)) > 0
-}
-
-// Get is the same as GetAll but returns the deepest matching error.
-func Get(err error, msg string) error {
- es := GetAll(err, msg)
- if len(es) > 0 {
- return es[len(es)-1]
- }
-
- return nil
-}
-
-// GetType is the same as GetAllType but returns the deepest matching error.
-func GetType(err error, v interface{}) error {
- es := GetAllType(err, v)
- if len(es) > 0 {
- return es[len(es)-1]
- }
-
- return nil
-}
-
-// GetAll gets all the errors that might be wrapped in err with the
-// given message. The order of the errors is such that the outermost
-// matching error (the most recent wrap) is index zero, and so on.
-func GetAll(err error, msg string) []error {
- var result []error
-
- Walk(err, func(err error) {
- if err.Error() == msg {
- result = append(result, err)
- }
- })
-
- return result
-}
-
-// GetAllType gets all the errors that are the same type as v.
-//
-// The order of the return value is the same as described in GetAll.
-func GetAllType(err error, v interface{}) []error {
- var result []error
-
- var search string
- if v != nil {
- search = reflect.TypeOf(v).String()
- }
- Walk(err, func(err error) {
- var needle string
- if err != nil {
- needle = reflect.TypeOf(err).String()
- }
-
- if needle == search {
- result = append(result, err)
- }
- })
-
- return result
-}
-
-// Walk walks all the wrapped errors in err and calls the callback. If
-// err isn't a wrapped error, this will be called once for err. If err
-// is a wrapped error, the callback will be called for both the wrapper
-// that implements error as well as the wrapped error itself.
-func Walk(err error, cb WalkFunc) {
- if err == nil {
- return
- }
-
- switch e := err.(type) {
- case *wrappedError:
- cb(e.Outer)
- Walk(e.Inner, cb)
- case Wrapper:
- cb(err)
-
- for _, err := range e.WrappedErrors() {
- Walk(err, cb)
- }
- default:
- cb(err)
- }
-}
-
-// wrappedError is an implementation of error that has both the
-// outer and inner errors.
-type wrappedError struct {
- Outer error
- Inner error
-}
-
-func (w *wrappedError) Error() string {
- return w.Outer.Error()
-}
-
-func (w *wrappedError) WrappedErrors() []error {
- return []error{w.Outer, w.Inner}
-}
diff --git a/vendor/github.com/hashicorp/go-multierror/LICENSE b/vendor/github.com/hashicorp/go-multierror/LICENSE
deleted file mode 100644
index 82b4de97..00000000
--- a/vendor/github.com/hashicorp/go-multierror/LICENSE
+++ /dev/null
@@ -1,353 +0,0 @@
-Mozilla Public License, version 2.0
-
-1. Definitions
-
-1.1. “Contributor”
-
- means each individual or legal entity that creates, contributes to the
- creation of, or owns Covered Software.
-
-1.2. “Contributor Version”
-
- means the combination of the Contributions of others (if any) used by a
- Contributor and that particular Contributor’s Contribution.
-
-1.3. “Contribution”
-
- means Covered Software of a particular Contributor.
-
-1.4. “Covered Software”
-
- means Source Code Form to which the initial Contributor has attached the
- notice in Exhibit A, the Executable Form of such Source Code Form, and
- Modifications of such Source Code Form, in each case including portions
- thereof.
-
-1.5. “Incompatible With Secondary Licenses”
- means
-
- a. that the initial Contributor has attached the notice described in
- Exhibit B to the Covered Software; or
-
- b. that the Covered Software was made available under the terms of version
- 1.1 or earlier of the License, but not also under the terms of a
- Secondary License.
-
-1.6. “Executable Form”
-
- means any form of the work other than Source Code Form.
-
-1.7. “Larger Work”
-
- means a work that combines Covered Software with other material, in a separate
- file or files, that is not Covered Software.
-
-1.8. “License”
-
- means this document.
-
-1.9. “Licensable”
-
- means having the right to grant, to the maximum extent possible, whether at the
- time of the initial grant or subsequently, any and all of the rights conveyed by
- this License.
-
-1.10. “Modifications”
-
- means any of the following:
-
- a. any file in Source Code Form that results from an addition to, deletion
- from, or modification of the contents of Covered Software; or
-
- b. any new file in Source Code Form that contains any Covered Software.
-
-1.11. “Patent Claims” of a Contributor
-
- means any patent claim(s), including without limitation, method, process,
- and apparatus claims, in any patent Licensable by such Contributor that
- would be infringed, but for the grant of the License, by the making,
- using, selling, offering for sale, having made, import, or transfer of
- either its Contributions or its Contributor Version.
-
-1.12. “Secondary License”
-
- means either the GNU General Public License, Version 2.0, the GNU Lesser
- General Public License, Version 2.1, the GNU Affero General Public
- License, Version 3.0, or any later versions of those licenses.
-
-1.13. “Source Code Form”
-
- means the form of the work preferred for making modifications.
-
-1.14. “You” (or “Your”)
-
- means an individual or a legal entity exercising rights under this
- License. For legal entities, “You” includes any entity that controls, is
- controlled by, or is under common control with You. For purposes of this
- definition, “control” means (a) the power, direct or indirect, to cause
- the direction or management of such entity, whether by contract or
- otherwise, or (b) ownership of more than fifty percent (50%) of the
- outstanding shares or beneficial ownership of such entity.
-
-
-2. License Grants and Conditions
-
-2.1. Grants
-
- Each Contributor hereby grants You a world-wide, royalty-free,
- non-exclusive license:
-
- a. under intellectual property rights (other than patent or trademark)
- Licensable by such Contributor to use, reproduce, make available,
- modify, display, perform, distribute, and otherwise exploit its
- Contributions, either on an unmodified basis, with Modifications, or as
- part of a Larger Work; and
-
- b. under Patent Claims of such Contributor to make, use, sell, offer for
- sale, have made, import, and otherwise transfer either its Contributions
- or its Contributor Version.
-
-2.2. Effective Date
-
- The licenses granted in Section 2.1 with respect to any Contribution become
- effective for each Contribution on the date the Contributor first distributes
- such Contribution.
-
-2.3. Limitations on Grant Scope
-
- The licenses granted in this Section 2 are the only rights granted under this
- License. No additional rights or licenses will be implied from the distribution
- or licensing of Covered Software under this License. Notwithstanding Section
- 2.1(b) above, no patent license is granted by a Contributor:
-
- a. for any code that a Contributor has removed from Covered Software; or
-
- b. for infringements caused by: (i) Your and any other third party’s
- modifications of Covered Software, or (ii) the combination of its
- Contributions with other software (except as part of its Contributor
- Version); or
-
- c. under Patent Claims infringed by Covered Software in the absence of its
- Contributions.
-
- This License does not grant any rights in the trademarks, service marks, or
- logos of any Contributor (except as may be necessary to comply with the
- notice requirements in Section 3.4).
-
-2.4. Subsequent Licenses
-
- No Contributor makes additional grants as a result of Your choice to
- distribute the Covered Software under a subsequent version of this License
- (see Section 10.2) or under the terms of a Secondary License (if permitted
- under the terms of Section 3.3).
-
-2.5. Representation
-
- Each Contributor represents that the Contributor believes its Contributions
- are its original creation(s) or it has sufficient rights to grant the
- rights to its Contributions conveyed by this License.
-
-2.6. Fair Use
-
- This License is not intended to limit any rights You have under applicable
- copyright doctrines of fair use, fair dealing, or other equivalents.
-
-2.7. Conditions
-
- Sections 3.1, 3.2, 3.3, and 3.4 are conditions of the licenses granted in
- Section 2.1.
-
-
-3. Responsibilities
-
-3.1. Distribution of Source Form
-
- All distribution of Covered Software in Source Code Form, including any
- Modifications that You create or to which You contribute, must be under the
- terms of this License. You must inform recipients that the Source Code Form
- of the Covered Software is governed by the terms of this License, and how
- they can obtain a copy of this License. You may not attempt to alter or
- restrict the recipients’ rights in the Source Code Form.
-
-3.2. Distribution of Executable Form
-
- If You distribute Covered Software in Executable Form then:
-
- a. such Covered Software must also be made available in Source Code Form,
- as described in Section 3.1, and You must inform recipients of the
- Executable Form how they can obtain a copy of such Source Code Form by
- reasonable means in a timely manner, at a charge no more than the cost
- of distribution to the recipient; and
-
- b. You may distribute such Executable Form under the terms of this License,
- or sublicense it under different terms, provided that the license for
- the Executable Form does not attempt to limit or alter the recipients’
- rights in the Source Code Form under this License.
-
-3.3. Distribution of a Larger Work
-
- You may create and distribute a Larger Work under terms of Your choice,
- provided that You also comply with the requirements of this License for the
- Covered Software. If the Larger Work is a combination of Covered Software
- with a work governed by one or more Secondary Licenses, and the Covered
- Software is not Incompatible With Secondary Licenses, this License permits
- You to additionally distribute such Covered Software under the terms of
- such Secondary License(s), so that the recipient of the Larger Work may, at
- their option, further distribute the Covered Software under the terms of
- either this License or such Secondary License(s).
-
-3.4. Notices
-
- You may not remove or alter the substance of any license notices (including
- copyright notices, patent notices, disclaimers of warranty, or limitations
- of liability) contained within the Source Code Form of the Covered
- Software, except that You may alter any license notices to the extent
- required to remedy known factual inaccuracies.
-
-3.5. Application of Additional Terms
-
- You may choose to offer, and to charge a fee for, warranty, support,
- indemnity or liability obligations to one or more recipients of Covered
- Software. However, You may do so only on Your own behalf, and not on behalf
- of any Contributor. You must make it absolutely clear that any such
- warranty, support, indemnity, or liability obligation is offered by You
- alone, and You hereby agree to indemnify every Contributor for any
- liability incurred by such Contributor as a result of warranty, support,
- indemnity or liability terms You offer. You may include additional
- disclaimers of warranty and limitations of liability specific to any
- jurisdiction.
-
-4. Inability to Comply Due to Statute or Regulation
-
- If it is impossible for You to comply with any of the terms of this License
- with respect to some or all of the Covered Software due to statute, judicial
- order, or regulation then You must: (a) comply with the terms of this License
- to the maximum extent possible; and (b) describe the limitations and the code
- they affect. Such description must be placed in a text file included with all
- distributions of the Covered Software under this License. Except to the
- extent prohibited by statute or regulation, such description must be
- sufficiently detailed for a recipient of ordinary skill to be able to
- understand it.
-
-5. Termination
-
-5.1. The rights granted under this License will terminate automatically if You
- fail to comply with any of its terms. However, if You become compliant,
- then the rights granted under this License from a particular Contributor
- are reinstated (a) provisionally, unless and until such Contributor
- explicitly and finally terminates Your grants, and (b) on an ongoing basis,
- if such Contributor fails to notify You of the non-compliance by some
- reasonable means prior to 60 days after You have come back into compliance.
- Moreover, Your grants from a particular Contributor are reinstated on an
- ongoing basis if such Contributor notifies You of the non-compliance by
- some reasonable means, this is the first time You have received notice of
- non-compliance with this License from such Contributor, and You become
- compliant prior to 30 days after Your receipt of the notice.
-
-5.2. If You initiate litigation against any entity by asserting a patent
- infringement claim (excluding declaratory judgment actions, counter-claims,
- and cross-claims) alleging that a Contributor Version directly or
- indirectly infringes any patent, then the rights granted to You by any and
- all Contributors for the Covered Software under Section 2.1 of this License
- shall terminate.
-
-5.3. In the event of termination under Sections 5.1 or 5.2 above, all end user
- license agreements (excluding distributors and resellers) which have been
- validly granted by You or Your distributors under this License prior to
- termination shall survive termination.
-
-6. Disclaimer of Warranty
-
- Covered Software is provided under this License on an “as is” basis, without
- warranty of any kind, either expressed, implied, or statutory, including,
- without limitation, warranties that the Covered Software is free of defects,
- merchantable, fit for a particular purpose or non-infringing. The entire
- risk as to the quality and performance of the Covered Software is with You.
- Should any Covered Software prove defective in any respect, You (not any
- Contributor) assume the cost of any necessary servicing, repair, or
- correction. This disclaimer of warranty constitutes an essential part of this
- License. No use of any Covered Software is authorized under this License
- except under this disclaimer.
-
-7. Limitation of Liability
-
- Under no circumstances and under no legal theory, whether tort (including
- negligence), contract, or otherwise, shall any Contributor, or anyone who
- distributes Covered Software as permitted above, be liable to You for any
- direct, indirect, special, incidental, or consequential damages of any
- character including, without limitation, damages for lost profits, loss of
- goodwill, work stoppage, computer failure or malfunction, or any and all
- other commercial damages or losses, even if such party shall have been
- informed of the possibility of such damages. This limitation of liability
- shall not apply to liability for death or personal injury resulting from such
- party’s negligence to the extent applicable law prohibits such limitation.
- Some jurisdictions do not allow the exclusion or limitation of incidental or
- consequential damages, so this exclusion and limitation may not apply to You.
-
-8. Litigation
-
- Any litigation relating to this License may be brought only in the courts of
- a jurisdiction where the defendant maintains its principal place of business
- and such litigation shall be governed by laws of that jurisdiction, without
- reference to its conflict-of-law provisions. Nothing in this Section shall
- prevent a party’s ability to bring cross-claims or counter-claims.
-
-9. Miscellaneous
-
- This License represents the complete agreement concerning the subject matter
- hereof. If any provision of this License is held to be unenforceable, such
- provision shall be reformed only to the extent necessary to make it
- enforceable. Any law or regulation which provides that the language of a
- contract shall be construed against the drafter shall not be used to construe
- this License against a Contributor.
-
-
-10. Versions of the License
-
-10.1. New Versions
-
- Mozilla Foundation is the license steward. Except as provided in Section
- 10.3, no one other than the license steward has the right to modify or
- publish new versions of this License. Each version will be given a
- distinguishing version number.
-
-10.2. Effect of New Versions
-
- You may distribute the Covered Software under the terms of the version of
- the License under which You originally received the Covered Software, or
- under the terms of any subsequent version published by the license
- steward.
-
-10.3. Modified Versions
-
- If you create software not governed by this License, and you want to
- create a new license for such software, you may create and use a modified
- version of this License if you rename the license and remove any
- references to the name of the license steward (except to note that such
- modified license differs from this License).
-
-10.4. Distributing Source Code Form that is Incompatible With Secondary Licenses
- If You choose to distribute Source Code Form that is Incompatible With
- Secondary Licenses under the terms of this version of the License, the
- notice described in Exhibit B of this License must be attached.
-
-Exhibit A - Source Code Form License Notice
-
- This Source Code Form is subject to the
- terms of the Mozilla Public License, v.
- 2.0. If a copy of the MPL was not
- distributed with this file, You can
- obtain one at
- http://mozilla.org/MPL/2.0/.
-
-If it is not possible or desirable to put the notice in a particular file, then
-You may include the notice in a location (such as a LICENSE file in a relevant
-directory) where a recipient would be likely to look for such a notice.
-
-You may add additional accurate notices of copyright ownership.
-
-Exhibit B - “Incompatible With Secondary Licenses” Notice
-
- This Source Code Form is “Incompatible
- With Secondary Licenses”, as defined by
- the Mozilla Public License, v. 2.0.
diff --git a/vendor/github.com/hashicorp/go-multierror/README.md b/vendor/github.com/hashicorp/go-multierror/README.md
deleted file mode 100644
index e81be50e..00000000
--- a/vendor/github.com/hashicorp/go-multierror/README.md
+++ /dev/null
@@ -1,91 +0,0 @@
-# go-multierror
-
-`go-multierror` is a package for Go that provides a mechanism for
-representing a list of `error` values as a single `error`.
-
-This allows a function in Go to return an `error` that might actually
-be a list of errors. If the caller knows this, they can unwrap the
-list and access the errors. If the caller doesn't know, the error
-formats to a nice human-readable format.
-
-`go-multierror` implements the
-[errwrap](https://github.com/hashicorp/errwrap) interface so that it can
-be used with that library, as well.
-
-## Installation and Docs
-
-Install using `go get github.com/hashicorp/go-multierror`.
-
-Full documentation is available at
-http://godoc.org/github.com/hashicorp/go-multierror
-
-## Usage
-
-go-multierror is easy to use and purposely built to be unobtrusive in
-existing Go applications/libraries that may not be aware of it.
-
-**Building a list of errors**
-
-The `Append` function is used to create a list of errors. This function
-behaves a lot like the Go built-in `append` function: it doesn't matter
-if the first argument is nil, a `multierror.Error`, or any other `error`,
-the function behaves as you would expect.
-
-```go
-var result error
-
-if err := step1(); err != nil {
- result = multierror.Append(result, err)
-}
-if err := step2(); err != nil {
- result = multierror.Append(result, err)
-}
-
-return result
-```
-
-**Customizing the formatting of the errors**
-
-By specifying a custom `ErrorFormat`, you can customize the format
-of the `Error() string` function:
-
-```go
-var result *multierror.Error
-
-// ... accumulate errors here, maybe using Append
-
-if result != nil {
- result.ErrorFormat = func([]error) string {
- return "errors!"
- }
-}
-```
-
-**Accessing the list of errors**
-
-`multierror.Error` implements `error` so if the caller doesn't know about
-multierror, it will work just fine. But if you're aware a multierror might
-be returned, you can use type switches to access the list of errors:
-
-```go
-if err := something(); err != nil {
- if merr, ok := err.(*multierror.Error); ok {
- // Use merr.Errors
- }
-}
-```
-
-**Returning a multierror only if there are errors**
-
-If you build a `multierror.Error`, you can use the `ErrorOrNil` function
-to return an `error` implementation only if there are errors to return:
-
-```go
-var result *multierror.Error
-
-// ... accumulate errors here
-
-// Return the `error` only if errors were added to the multierror, otherwise
-// return nil since there are no errors.
-return result.ErrorOrNil()
-```
diff --git a/vendor/github.com/hashicorp/go-multierror/append.go b/vendor/github.com/hashicorp/go-multierror/append.go
deleted file mode 100644
index 00afa9b3..00000000
--- a/vendor/github.com/hashicorp/go-multierror/append.go
+++ /dev/null
@@ -1,37 +0,0 @@
-package multierror
-
-// Append is a helper function that will append more errors
-// onto an Error in order to create a larger multi-error.
-//
-// If err is not a multierror.Error, then it will be turned into
-// one. If any of the errs are multierr.Error, they will be flattened
-// one level into err.
-func Append(err error, errs ...error) *Error {
- switch err := err.(type) {
- case *Error:
- // Typed nils can reach here, so initialize if we are nil
- if err == nil {
- err = new(Error)
- }
-
- // Go through each error and flatten
- for _, e := range errs {
- switch e := e.(type) {
- case *Error:
- err.Errors = append(err.Errors, e.Errors...)
- default:
- err.Errors = append(err.Errors, e)
- }
- }
-
- return err
- default:
- newErrs := make([]error, 0, len(errs)+1)
- if err != nil {
- newErrs = append(newErrs, err)
- }
- newErrs = append(newErrs, errs...)
-
- return Append(&Error{}, newErrs...)
- }
-}
diff --git a/vendor/github.com/hashicorp/go-multierror/flatten.go b/vendor/github.com/hashicorp/go-multierror/flatten.go
deleted file mode 100644
index aab8e9ab..00000000
--- a/vendor/github.com/hashicorp/go-multierror/flatten.go
+++ /dev/null
@@ -1,26 +0,0 @@
-package multierror
-
-// Flatten flattens the given error, merging any *Errors together into
-// a single *Error.
-func Flatten(err error) error {
- // If it isn't an *Error, just return the error as-is
- if _, ok := err.(*Error); !ok {
- return err
- }
-
- // Otherwise, make the result and flatten away!
- flatErr := new(Error)
- flatten(err, flatErr)
- return flatErr
-}
-
-func flatten(err error, flatErr *Error) {
- switch err := err.(type) {
- case *Error:
- for _, e := range err.Errors {
- flatten(e, flatErr)
- }
- default:
- flatErr.Errors = append(flatErr.Errors, err)
- }
-}
diff --git a/vendor/github.com/hashicorp/go-multierror/format.go b/vendor/github.com/hashicorp/go-multierror/format.go
deleted file mode 100644
index bb65a12e..00000000
--- a/vendor/github.com/hashicorp/go-multierror/format.go
+++ /dev/null
@@ -1,23 +0,0 @@
-package multierror
-
-import (
- "fmt"
- "strings"
-)
-
-// ErrorFormatFunc is a function callback that is called by Error to
-// turn the list of errors into a string.
-type ErrorFormatFunc func([]error) string
-
-// ListFormatFunc is a basic formatter that outputs the number of errors
-// that occurred along with a bullet point list of the errors.
-func ListFormatFunc(es []error) string {
- points := make([]string, len(es))
- for i, err := range es {
- points[i] = fmt.Sprintf("* %s", err)
- }
-
- return fmt.Sprintf(
- "%d error(s) occurred:\n\n%s",
- len(es), strings.Join(points, "\n"))
-}
diff --git a/vendor/github.com/hashicorp/go-multierror/multierror.go b/vendor/github.com/hashicorp/go-multierror/multierror.go
deleted file mode 100644
index 2ea08273..00000000
--- a/vendor/github.com/hashicorp/go-multierror/multierror.go
+++ /dev/null
@@ -1,51 +0,0 @@
-package multierror
-
-import (
- "fmt"
-)
-
-// Error is an error type to track multiple errors. This is used to
-// accumulate errors in cases and return them as a single "error".
-type Error struct {
- Errors []error
- ErrorFormat ErrorFormatFunc
-}
-
-func (e *Error) Error() string {
- fn := e.ErrorFormat
- if fn == nil {
- fn = ListFormatFunc
- }
-
- return fn(e.Errors)
-}
-
-// ErrorOrNil returns an error interface if this Error represents
-// a list of errors, or returns nil if the list of errors is empty. This
-// function is useful at the end of accumulation to make sure that the value
-// returned represents the existence of errors.
-func (e *Error) ErrorOrNil() error {
- if e == nil {
- return nil
- }
- if len(e.Errors) == 0 {
- return nil
- }
-
- return e
-}
-
-func (e *Error) GoString() string {
- return fmt.Sprintf("*%#v", *e)
-}
-
-// WrappedErrors returns the list of errors that this Error is wrapping.
-// It is an implementatin of the errwrap.Wrapper interface so that
-// multierror.Error can be used with that library.
-//
-// This method is not safe to be called concurrently and is no different
-// than accessing the Errors field directly. It is implementd only to
-// satisfy the errwrap.Wrapper interface.
-func (e *Error) WrappedErrors() []error {
- return e.Errors
-}
diff --git a/vendor/github.com/hashicorp/go-multierror/prefix.go b/vendor/github.com/hashicorp/go-multierror/prefix.go
deleted file mode 100644
index 5c477abe..00000000
--- a/vendor/github.com/hashicorp/go-multierror/prefix.go
+++ /dev/null
@@ -1,37 +0,0 @@
-package multierror
-
-import (
- "fmt"
-
- "github.com/hashicorp/errwrap"
-)
-
-// Prefix is a helper function that will prefix some text
-// to the given error. If the error is a multierror.Error, then
-// it will be prefixed to each wrapped error.
-//
-// This is useful to use when appending multiple multierrors
-// together in order to give better scoping.
-func Prefix(err error, prefix string) error {
- if err == nil {
- return nil
- }
-
- format := fmt.Sprintf("%s {{err}}", prefix)
- switch err := err.(type) {
- case *Error:
- // Typed nils can reach here, so initialize if we are nil
- if err == nil {
- err = new(Error)
- }
-
- // Wrap each of the errors
- for i, e := range err.Errors {
- err.Errors[i] = errwrap.Wrapf(format, e)
- }
-
- return err
- default:
- return errwrap.Wrapf(format, err)
- }
-}
diff --git a/vendor/github.com/hashicorp/go-version/.travis.yml b/vendor/github.com/hashicorp/go-version/.travis.yml
deleted file mode 100644
index 9f30eecd..00000000
--- a/vendor/github.com/hashicorp/go-version/.travis.yml
+++ /dev/null
@@ -1,11 +0,0 @@
-language: go
-
-go:
- - 1.0
- - 1.1
- - 1.2
- - 1.3
- - 1.4
-
-script:
- - go test
diff --git a/vendor/github.com/hashicorp/go-version/LICENSE b/vendor/github.com/hashicorp/go-version/LICENSE
deleted file mode 100644
index c33dcc7c..00000000
--- a/vendor/github.com/hashicorp/go-version/LICENSE
+++ /dev/null
@@ -1,354 +0,0 @@
-Mozilla Public License, version 2.0
-
-1. Definitions
-
-1.1. “Contributor”
-
- means each individual or legal entity that creates, contributes to the
- creation of, or owns Covered Software.
-
-1.2. “Contributor Version”
-
- means the combination of the Contributions of others (if any) used by a
- Contributor and that particular Contributor’s Contribution.
-
-1.3. “Contribution”
-
- means Covered Software of a particular Contributor.
-
-1.4. “Covered Software”
-
- means Source Code Form to which the initial Contributor has attached the
- notice in Exhibit A, the Executable Form of such Source Code Form, and
- Modifications of such Source Code Form, in each case including portions
- thereof.
-
-1.5. “Incompatible With Secondary Licenses”
- means
-
- a. that the initial Contributor has attached the notice described in
- Exhibit B to the Covered Software; or
-
- b. that the Covered Software was made available under the terms of version
- 1.1 or earlier of the License, but not also under the terms of a
- Secondary License.
-
-1.6. “Executable Form”
-
- means any form of the work other than Source Code Form.
-
-1.7. “Larger Work”
-
- means a work that combines Covered Software with other material, in a separate
- file or files, that is not Covered Software.
-
-1.8. “License”
-
- means this document.
-
-1.9. “Licensable”
-
- means having the right to grant, to the maximum extent possible, whether at the
- time of the initial grant or subsequently, any and all of the rights conveyed by
- this License.
-
-1.10. “Modifications”
-
- means any of the following:
-
- a. any file in Source Code Form that results from an addition to, deletion
- from, or modification of the contents of Covered Software; or
-
- b. any new file in Source Code Form that contains any Covered Software.
-
-1.11. “Patent Claims” of a Contributor
-
- means any patent claim(s), including without limitation, method, process,
- and apparatus claims, in any patent Licensable by such Contributor that
- would be infringed, but for the grant of the License, by the making,
- using, selling, offering for sale, having made, import, or transfer of
- either its Contributions or its Contributor Version.
-
-1.12. “Secondary License”
-
- means either the GNU General Public License, Version 2.0, the GNU Lesser
- General Public License, Version 2.1, the GNU Affero General Public
- License, Version 3.0, or any later versions of those licenses.
-
-1.13. “Source Code Form”
-
- means the form of the work preferred for making modifications.
-
-1.14. “You” (or “Your”)
-
- means an individual or a legal entity exercising rights under this
- License. For legal entities, “You” includes any entity that controls, is
- controlled by, or is under common control with You. For purposes of this
- definition, “control” means (a) the power, direct or indirect, to cause
- the direction or management of such entity, whether by contract or
- otherwise, or (b) ownership of more than fifty percent (50%) of the
- outstanding shares or beneficial ownership of such entity.
-
-
-2. License Grants and Conditions
-
-2.1. Grants
-
- Each Contributor hereby grants You a world-wide, royalty-free,
- non-exclusive license:
-
- a. under intellectual property rights (other than patent or trademark)
- Licensable by such Contributor to use, reproduce, make available,
- modify, display, perform, distribute, and otherwise exploit its
- Contributions, either on an unmodified basis, with Modifications, or as
- part of a Larger Work; and
-
- b. under Patent Claims of such Contributor to make, use, sell, offer for
- sale, have made, import, and otherwise transfer either its Contributions
- or its Contributor Version.
-
-2.2. Effective Date
-
- The licenses granted in Section 2.1 with respect to any Contribution become
- effective for each Contribution on the date the Contributor first distributes
- such Contribution.
-
-2.3. Limitations on Grant Scope
-
- The licenses granted in this Section 2 are the only rights granted under this
- License. No additional rights or licenses will be implied from the distribution
- or licensing of Covered Software under this License. Notwithstanding Section
- 2.1(b) above, no patent license is granted by a Contributor:
-
- a. for any code that a Contributor has removed from Covered Software; or
-
- b. for infringements caused by: (i) Your and any other third party’s
- modifications of Covered Software, or (ii) the combination of its
- Contributions with other software (except as part of its Contributor
- Version); or
-
- c. under Patent Claims infringed by Covered Software in the absence of its
- Contributions.
-
- This License does not grant any rights in the trademarks, service marks, or
- logos of any Contributor (except as may be necessary to comply with the
- notice requirements in Section 3.4).
-
-2.4. Subsequent Licenses
-
- No Contributor makes additional grants as a result of Your choice to
- distribute the Covered Software under a subsequent version of this License
- (see Section 10.2) or under the terms of a Secondary License (if permitted
- under the terms of Section 3.3).
-
-2.5. Representation
-
- Each Contributor represents that the Contributor believes its Contributions
- are its original creation(s) or it has sufficient rights to grant the
- rights to its Contributions conveyed by this License.
-
-2.6. Fair Use
-
- This License is not intended to limit any rights You have under applicable
- copyright doctrines of fair use, fair dealing, or other equivalents.
-
-2.7. Conditions
-
- Sections 3.1, 3.2, 3.3, and 3.4 are conditions of the licenses granted in
- Section 2.1.
-
-
-3. Responsibilities
-
-3.1. Distribution of Source Form
-
- All distribution of Covered Software in Source Code Form, including any
- Modifications that You create or to which You contribute, must be under the
- terms of this License. You must inform recipients that the Source Code Form
- of the Covered Software is governed by the terms of this License, and how
- they can obtain a copy of this License. You may not attempt to alter or
- restrict the recipients’ rights in the Source Code Form.
-
-3.2. Distribution of Executable Form
-
- If You distribute Covered Software in Executable Form then:
-
- a. such Covered Software must also be made available in Source Code Form,
- as described in Section 3.1, and You must inform recipients of the
- Executable Form how they can obtain a copy of such Source Code Form by
- reasonable means in a timely manner, at a charge no more than the cost
- of distribution to the recipient; and
-
- b. You may distribute such Executable Form under the terms of this License,
- or sublicense it under different terms, provided that the license for
- the Executable Form does not attempt to limit or alter the recipients’
- rights in the Source Code Form under this License.
-
-3.3. Distribution of a Larger Work
-
- You may create and distribute a Larger Work under terms of Your choice,
- provided that You also comply with the requirements of this License for the
- Covered Software. If the Larger Work is a combination of Covered Software
- with a work governed by one or more Secondary Licenses, and the Covered
- Software is not Incompatible With Secondary Licenses, this License permits
- You to additionally distribute such Covered Software under the terms of
- such Secondary License(s), so that the recipient of the Larger Work may, at
- their option, further distribute the Covered Software under the terms of
- either this License or such Secondary License(s).
-
-3.4. Notices
-
- You may not remove or alter the substance of any license notices (including
- copyright notices, patent notices, disclaimers of warranty, or limitations
- of liability) contained within the Source Code Form of the Covered
- Software, except that You may alter any license notices to the extent
- required to remedy known factual inaccuracies.
-
-3.5. Application of Additional Terms
-
- You may choose to offer, and to charge a fee for, warranty, support,
- indemnity or liability obligations to one or more recipients of Covered
- Software. However, You may do so only on Your own behalf, and not on behalf
- of any Contributor. You must make it absolutely clear that any such
- warranty, support, indemnity, or liability obligation is offered by You
- alone, and You hereby agree to indemnify every Contributor for any
- liability incurred by such Contributor as a result of warranty, support,
- indemnity or liability terms You offer. You may include additional
- disclaimers of warranty and limitations of liability specific to any
- jurisdiction.
-
-4. Inability to Comply Due to Statute or Regulation
-
- If it is impossible for You to comply with any of the terms of this License
- with respect to some or all of the Covered Software due to statute, judicial
- order, or regulation then You must: (a) comply with the terms of this License
- to the maximum extent possible; and (b) describe the limitations and the code
- they affect. Such description must be placed in a text file included with all
- distributions of the Covered Software under this License. Except to the
- extent prohibited by statute or regulation, such description must be
- sufficiently detailed for a recipient of ordinary skill to be able to
- understand it.
-
-5. Termination
-
-5.1. The rights granted under this License will terminate automatically if You
- fail to comply with any of its terms. However, if You become compliant,
- then the rights granted under this License from a particular Contributor
- are reinstated (a) provisionally, unless and until such Contributor
- explicitly and finally terminates Your grants, and (b) on an ongoing basis,
- if such Contributor fails to notify You of the non-compliance by some
- reasonable means prior to 60 days after You have come back into compliance.
- Moreover, Your grants from a particular Contributor are reinstated on an
- ongoing basis if such Contributor notifies You of the non-compliance by
- some reasonable means, this is the first time You have received notice of
- non-compliance with this License from such Contributor, and You become
- compliant prior to 30 days after Your receipt of the notice.
-
-5.2. If You initiate litigation against any entity by asserting a patent
- infringement claim (excluding declaratory judgment actions, counter-claims,
- and cross-claims) alleging that a Contributor Version directly or
- indirectly infringes any patent, then the rights granted to You by any and
- all Contributors for the Covered Software under Section 2.1 of this License
- shall terminate.
-
-5.3. In the event of termination under Sections 5.1 or 5.2 above, all end user
- license agreements (excluding distributors and resellers) which have been
- validly granted by You or Your distributors under this License prior to
- termination shall survive termination.
-
-6. Disclaimer of Warranty
-
- Covered Software is provided under this License on an “as is” basis, without
- warranty of any kind, either expressed, implied, or statutory, including,
- without limitation, warranties that the Covered Software is free of defects,
- merchantable, fit for a particular purpose or non-infringing. The entire
- risk as to the quality and performance of the Covered Software is with You.
- Should any Covered Software prove defective in any respect, You (not any
- Contributor) assume the cost of any necessary servicing, repair, or
- correction. This disclaimer of warranty constitutes an essential part of this
- License. No use of any Covered Software is authorized under this License
- except under this disclaimer.
-
-7. Limitation of Liability
-
- Under no circumstances and under no legal theory, whether tort (including
- negligence), contract, or otherwise, shall any Contributor, or anyone who
- distributes Covered Software as permitted above, be liable to You for any
- direct, indirect, special, incidental, or consequential damages of any
- character including, without limitation, damages for lost profits, loss of
- goodwill, work stoppage, computer failure or malfunction, or any and all
- other commercial damages or losses, even if such party shall have been
- informed of the possibility of such damages. This limitation of liability
- shall not apply to liability for death or personal injury resulting from such
- party’s negligence to the extent applicable law prohibits such limitation.
- Some jurisdictions do not allow the exclusion or limitation of incidental or
- consequential damages, so this exclusion and limitation may not apply to You.
-
-8. Litigation
-
- Any litigation relating to this License may be brought only in the courts of
- a jurisdiction where the defendant maintains its principal place of business
- and such litigation shall be governed by laws of that jurisdiction, without
- reference to its conflict-of-law provisions. Nothing in this Section shall
- prevent a party’s ability to bring cross-claims or counter-claims.
-
-9. Miscellaneous
-
- This License represents the complete agreement concerning the subject matter
- hereof. If any provision of this License is held to be unenforceable, such
- provision shall be reformed only to the extent necessary to make it
- enforceable. Any law or regulation which provides that the language of a
- contract shall be construed against the drafter shall not be used to construe
- this License against a Contributor.
-
-
-10. Versions of the License
-
-10.1. New Versions
-
- Mozilla Foundation is the license steward. Except as provided in Section
- 10.3, no one other than the license steward has the right to modify or
- publish new versions of this License. Each version will be given a
- distinguishing version number.
-
-10.2. Effect of New Versions
-
- You may distribute the Covered Software under the terms of the version of
- the License under which You originally received the Covered Software, or
- under the terms of any subsequent version published by the license
- steward.
-
-10.3. Modified Versions
-
- If you create software not governed by this License, and you want to
- create a new license for such software, you may create and use a modified
- version of this License if you rename the license and remove any
- references to the name of the license steward (except to note that such
- modified license differs from this License).
-
-10.4. Distributing Source Code Form that is Incompatible With Secondary Licenses
- If You choose to distribute Source Code Form that is Incompatible With
- Secondary Licenses under the terms of this version of the License, the
- notice described in Exhibit B of this License must be attached.
-
-Exhibit A - Source Code Form License Notice
-
- This Source Code Form is subject to the
- terms of the Mozilla Public License, v.
- 2.0. If a copy of the MPL was not
- distributed with this file, You can
- obtain one at
- http://mozilla.org/MPL/2.0/.
-
-If it is not possible or desirable to put the notice in a particular file, then
-You may include the notice in a location (such as a LICENSE file in a relevant
-directory) where a recipient would be likely to look for such a notice.
-
-You may add additional accurate notices of copyright ownership.
-
-Exhibit B - “Incompatible With Secondary Licenses” Notice
-
- This Source Code Form is “Incompatible
- With Secondary Licenses”, as defined by
- the Mozilla Public License, v. 2.0.
-
diff --git a/vendor/github.com/hashicorp/go-version/README.md b/vendor/github.com/hashicorp/go-version/README.md
deleted file mode 100644
index 1d50070f..00000000
--- a/vendor/github.com/hashicorp/go-version/README.md
+++ /dev/null
@@ -1,65 +0,0 @@
-# Versioning Library for Go
-[![Build Status](https://travis-ci.org/hashicorp/go-version.svg?branch=master)](https://travis-ci.org/hashicorp/go-version)
-
-go-version is a library for parsing versions and version constraints,
-and verifying versions against a set of constraints. go-version
-can sort a collection of versions properly, handles prerelease/beta
-versions, can increment versions, etc.
-
-Versions used with go-version must follow [SemVer](http://semver.org/).
-
-## Installation and Usage
-
-Package documentation can be found on
-[GoDoc](http://godoc.org/github.com/hashicorp/go-version).
-
-Installation can be done with a normal `go get`:
-
-```
-$ go get github.com/hashicorp/go-version
-```
-
-#### Version Parsing and Comparison
-
-```go
-v1, err := version.NewVersion("1.2")
-v2, err := version.NewVersion("1.5+metadata")
-
-// Comparison example. There is also GreaterThan, Equal, and just
-// a simple Compare that returns an int allowing easy >=, <=, etc.
-if v1.LessThan(v2) {
- fmt.Printf("%s is less than %s", v1, v2)
-}
-```
-
-#### Version Constraints
-
-```go
-v1, err := version.NewVersion("1.2")
-
-// Constraints example.
-constraints, err := version.NewConstraint(">= 1.0, < 1.4")
-if constraints.Check(v1) {
- fmt.Printf("%s satisfies constraints %s", v1, constraints)
-}
-```
-
-#### Version Sorting
-
-```go
-versionsRaw := []string{"1.1", "0.7.1", "1.4-beta", "1.4", "2"}
-versions := make([]*version.Version, len(versionsRaw))
-for i, raw := range versionsRaw {
- v, _ := version.NewVersion(raw)
- versions[i] = v
-}
-
-// After this, the versions are properly sorted
-sort.Sort(version.Collection(versions))
-```
-
-## Issues and Contributing
-
-If you find an issue with this library, please report an issue. If you'd
-like, we welcome any contributions. Fork this library and submit a pull
-request.
diff --git a/vendor/github.com/hashicorp/go-version/constraint.go b/vendor/github.com/hashicorp/go-version/constraint.go
deleted file mode 100644
index eb6d86ce..00000000
--- a/vendor/github.com/hashicorp/go-version/constraint.go
+++ /dev/null
@@ -1,156 +0,0 @@
-package version
-
-import (
- "fmt"
- "regexp"
- "strings"
-)
-
-// Constraint represents a single constraint for a version, such as
-// ">= 1.0".
-type Constraint struct {
- f constraintFunc
- check *Version
- original string
-}
-
-// Constraints is a slice of constraints. We make a custom type so that
-// we can add methods to it.
-type Constraints []*Constraint
-
-type constraintFunc func(v, c *Version) bool
-
-var constraintOperators map[string]constraintFunc
-
-var constraintRegexp *regexp.Regexp
-
-func init() {
- constraintOperators = map[string]constraintFunc{
- "": constraintEqual,
- "=": constraintEqual,
- "!=": constraintNotEqual,
- ">": constraintGreaterThan,
- "<": constraintLessThan,
- ">=": constraintGreaterThanEqual,
- "<=": constraintLessThanEqual,
- "~>": constraintPessimistic,
- }
-
- ops := make([]string, 0, len(constraintOperators))
- for k := range constraintOperators {
- ops = append(ops, regexp.QuoteMeta(k))
- }
-
- constraintRegexp = regexp.MustCompile(fmt.Sprintf(
- `^\s*(%s)\s*(%s)\s*$`,
- strings.Join(ops, "|"),
- VersionRegexpRaw))
-}
-
-// NewConstraint will parse one or more constraints from the given
-// constraint string. The string must be a comma-separated list of
-// constraints.
-func NewConstraint(v string) (Constraints, error) {
- vs := strings.Split(v, ",")
- result := make([]*Constraint, len(vs))
- for i, single := range vs {
- c, err := parseSingle(single)
- if err != nil {
- return nil, err
- }
-
- result[i] = c
- }
-
- return Constraints(result), nil
-}
-
-// Check tests if a version satisfies all the constraints.
-func (cs Constraints) Check(v *Version) bool {
- for _, c := range cs {
- if !c.Check(v) {
- return false
- }
- }
-
- return true
-}
-
-// Returns the string format of the constraints
-func (cs Constraints) String() string {
- csStr := make([]string, len(cs))
- for i, c := range cs {
- csStr[i] = c.String()
- }
-
- return strings.Join(csStr, ",")
-}
-
-// Check tests if a constraint is validated by the given version.
-func (c *Constraint) Check(v *Version) bool {
- return c.f(v, c.check)
-}
-
-func (c *Constraint) String() string {
- return c.original
-}
-
-func parseSingle(v string) (*Constraint, error) {
- matches := constraintRegexp.FindStringSubmatch(v)
- if matches == nil {
- return nil, fmt.Errorf("Malformed constraint: %s", v)
- }
-
- check, err := NewVersion(matches[2])
- if err != nil {
- return nil, err
- }
-
- return &Constraint{
- f: constraintOperators[matches[1]],
- check: check,
- original: v,
- }, nil
-}
-
-//-------------------------------------------------------------------
-// Constraint functions
-//-------------------------------------------------------------------
-
-func constraintEqual(v, c *Version) bool {
- return v.Equal(c)
-}
-
-func constraintNotEqual(v, c *Version) bool {
- return !v.Equal(c)
-}
-
-func constraintGreaterThan(v, c *Version) bool {
- return v.Compare(c) == 1
-}
-
-func constraintLessThan(v, c *Version) bool {
- return v.Compare(c) == -1
-}
-
-func constraintGreaterThanEqual(v, c *Version) bool {
- return v.Compare(c) >= 0
-}
-
-func constraintLessThanEqual(v, c *Version) bool {
- return v.Compare(c) <= 0
-}
-
-func constraintPessimistic(v, c *Version) bool {
- if v.LessThan(c) {
- return false
- }
-
- for i := 0; i < c.si-1; i++ {
- if v.segments[i] != c.segments[i] {
- return false
- }
- }
-
- return true
-}
diff --git a/vendor/github.com/hashicorp/go-version/version.go b/vendor/github.com/hashicorp/go-version/version.go
deleted file mode 100644
index d0e0b0c8..00000000
--- a/vendor/github.com/hashicorp/go-version/version.go
+++ /dev/null
@@ -1,251 +0,0 @@
-package version
-
-import (
- "bytes"
- "fmt"
- "reflect"
- "regexp"
- "strconv"
- "strings"
-)
-
-// The compiled regular expression used to test the validity of a version.
-var versionRegexp *regexp.Regexp
-
-// The raw regular expression string used for testing the validity
-// of a version.
-const VersionRegexpRaw string = `([0-9]+(\.[0-9]+){0,2})` +
- `(-([0-9A-Za-z\-]+(\.[0-9A-Za-z\-]+)*))?` +
- `(\+([0-9A-Za-z\-]+(\.[0-9A-Za-z\-]+)*))?` +
- `?`
-
-// Version represents a single version.
-type Version struct {
- metadata string
- pre string
- segments []int
- si int
-}
-
-func init() {
- versionRegexp = regexp.MustCompile("^" + VersionRegexpRaw + "$")
-}
-
-// NewVersion parses the given version and returns a new
-// Version.
-func NewVersion(v string) (*Version, error) {
- matches := versionRegexp.FindStringSubmatch(v)
- if matches == nil {
- return nil, fmt.Errorf("Malformed version: %s", v)
- }
-
- segmentsStr := strings.Split(matches[1], ".")
- segments := make([]int, len(segmentsStr), 3)
- si := 0
- for i, str := range segmentsStr {
- val, err := strconv.ParseInt(str, 10, 32)
- if err != nil {
- return nil, fmt.Errorf(
- "Error parsing version: %s", err)
- }
-
- segments[i] = int(val)
- si += 1
- }
- for i := len(segments); i < 3; i++ {
- segments = append(segments, 0)
- }
-
- return &Version{
- metadata: matches[7],
- pre: matches[4],
- segments: segments,
- si: si,
- }, nil
-}
-
-// Must is a helper that wraps a call to a function returning (*Version, error)
-// and panics if error is non-nil.
-func Must(v *Version, err error) *Version {
- if err != nil {
- panic(err)
- }
-
- return v
-}
-
-// Compare compares this version to another version. This
-// returns -1, 0, or 1 if this version is smaller, equal,
-// or larger than the other version, respectively.
-//
-// If you want boolean results, use the LessThan, Equal,
-// or GreaterThan methods.
-func (v *Version) Compare(other *Version) int {
- // A quick, efficient equality check
- if v.String() == other.String() {
- return 0
- }
-
- segmentsSelf := v.Segments()
- segmentsOther := other.Segments()
-
- // If the segments are the same, we must compare on prerelease info
- if reflect.DeepEqual(segmentsSelf, segmentsOther) {
- preSelf := v.Prerelease()
- preOther := other.Prerelease()
- if preSelf == "" && preOther == "" {
- return 0
- }
- if preSelf == "" {
- return 1
- }
- if preOther == "" {
- return -1
- }
-
- return comparePrereleases(preSelf, preOther)
- }
-
- // Compare the segments
- for i := 0; i < len(segmentsSelf); i++ {
- lhs := segmentsSelf[i]
- rhs := segmentsOther[i]
-
- if lhs == rhs {
- continue
- } else if lhs < rhs {
- return -1
- } else {
- return 1
- }
- }
-
- panic("should not be reached")
-}
-
-func comparePart(preSelf string, preOther string) int {
- if preSelf == preOther {
- return 0
- }
-
- // if a part is empty, we use the other to decide
- if preSelf == "" {
- _, notIsNumeric := strconv.ParseInt(preOther, 10, 64)
- if notIsNumeric == nil {
- return -1
- }
- return 1
- }
-
- if preOther == "" {
- _, notIsNumeric := strconv.ParseInt(preSelf, 10, 64)
- if notIsNumeric == nil {
- return 1
- }
- return -1
- }
-
- if preSelf > preOther {
- return 1
- }
-
- return -1
-}
-
-func comparePrereleases(v string, other string) int {
- // the same pre release!
- if v == other {
- return 0
- }
-
- // split both pre releases for analyse their parts
- selfPreReleaseMeta := strings.Split(v, ".")
- otherPreReleaseMeta := strings.Split(other, ".")
-
- selfPreReleaseLen := len(selfPreReleaseMeta)
- otherPreReleaseLen := len(otherPreReleaseMeta)
-
- biggestLen := otherPreReleaseLen
- if selfPreReleaseLen > otherPreReleaseLen {
- biggestLen = selfPreReleaseLen
- }
-
- // loop for parts to find the first difference
- for i := 0; i < biggestLen; i = i + 1 {
- partSelfPre := ""
- if i < selfPreReleaseLen {
- partSelfPre = selfPreReleaseMeta[i]
- }
-
- partOtherPre := ""
- if i < otherPreReleaseLen {
- partOtherPre = otherPreReleaseMeta[i]
- }
-
- compare := comparePart(partSelfPre, partOtherPre)
- // if parts are equals, continue the loop
- if compare != 0 {
- return compare
- }
- }
-
- return 0
-}
-
-// Equal tests if two versions are equal.
-func (v *Version) Equal(o *Version) bool {
- return v.Compare(o) == 0
-}
-
-// GreaterThan tests if this version is greater than another version.
-func (v *Version) GreaterThan(o *Version) bool {
- return v.Compare(o) > 0
-}
-
-// LessThan tests if this version is less than another version.
-func (v *Version) LessThan(o *Version) bool {
- return v.Compare(o) < 0
-}
-
-// Metadata returns any metadata that was part of the version
-// string.
-//
-// Metadata is anything that comes after the "+" in the version.
-// For example, with "1.2.3+beta", the metadata is "beta".
-func (v *Version) Metadata() string {
- return v.metadata
-}
-
-// Prerelease returns any prerelease data that is part of the version,
-// or blank if there is no prerelease data.
-//
-// Prerelease information is anything that comes after the "-" in the
-// version (but before any metadata). For example, with "1.2.3-beta",
-// the prerelease information is "beta".
-func (v *Version) Prerelease() string {
- return v.pre
-}
-
-// Segments returns the numeric segments of the version as a slice.
-//
-// This excludes any metadata or pre-release information. For example,
-// for a version "1.2.3-beta", segments will return a slice of
-// 1, 2, 3.
-func (v *Version) Segments() []int {
- return v.segments
-}
-
-// String returns the full version string included pre-release
-// and metadata information.
-func (v *Version) String() string {
- var buf bytes.Buffer
- fmt.Fprintf(&buf, "%d.%d.%d", v.segments[0], v.segments[1], v.segments[2])
- if v.pre != "" {
- fmt.Fprintf(&buf, "-%s", v.pre)
- }
- if v.metadata != "" {
- fmt.Fprintf(&buf, "+%s", v.metadata)
- }
-
- return buf.String()
-}
diff --git a/vendor/github.com/hashicorp/go-version/version_collection.go b/vendor/github.com/hashicorp/go-version/version_collection.go
deleted file mode 100644
index cc888d43..00000000
--- a/vendor/github.com/hashicorp/go-version/version_collection.go
+++ /dev/null
@@ -1,17 +0,0 @@
-package version
-
-// Collection is a type that implements the sort.Interface interface
-// so that versions can be sorted.
-type Collection []*Version
-
-func (v Collection) Len() int {
- return len(v)
-}
-
-func (v Collection) Less(i, j int) bool {
- return v[i].LessThan(v[j])
-}
-
-func (v Collection) Swap(i, j int) {
- v[i], v[j] = v[j], v[i]
-}
diff --git a/vendor/github.com/hashicorp/yamux/.gitignore b/vendor/github.com/hashicorp/yamux/.gitignore
deleted file mode 100644
index 83656241..00000000
--- a/vendor/github.com/hashicorp/yamux/.gitignore
+++ /dev/null
@@ -1,23 +0,0 @@
-# Compiled Object files, Static and Dynamic libs (Shared Objects)
-*.o
-*.a
-*.so
-
-# Folders
-_obj
-_test
-
-# Architecture specific extensions/prefixes
-*.[568vq]
-[568vq].out
-
-*.cgo1.go
-*.cgo2.c
-_cgo_defun.c
-_cgo_gotypes.go
-_cgo_export.*
-
-_testmain.go
-
-*.exe
-*.test
diff --git a/vendor/github.com/hashicorp/yamux/LICENSE b/vendor/github.com/hashicorp/yamux/LICENSE
deleted file mode 100644
index f0e5c79e..00000000
--- a/vendor/github.com/hashicorp/yamux/LICENSE
+++ /dev/null
@@ -1,362 +0,0 @@
-Mozilla Public License, version 2.0
-
-1. Definitions
-
-1.1. "Contributor"
-
- means each individual or legal entity that creates, contributes to the
- creation of, or owns Covered Software.
-
-1.2. "Contributor Version"
-
- means the combination of the Contributions of others (if any) used by a
- Contributor and that particular Contributor's Contribution.
-
-1.3. "Contribution"
-
- means Covered Software of a particular Contributor.
-
-1.4. "Covered Software"
-
- means Source Code Form to which the initial Contributor has attached the
- notice in Exhibit A, the Executable Form of such Source Code Form, and
- Modifications of such Source Code Form, in each case including portions
- thereof.
-
-1.5. "Incompatible With Secondary Licenses"
- means
-
- a. that the initial Contributor has attached the notice described in
- Exhibit B to the Covered Software; or
-
- b. that the Covered Software was made available under the terms of
- version 1.1 or earlier of the License, but not also under the terms of
- a Secondary License.
-
-1.6. "Executable Form"
-
- means any form of the work other than Source Code Form.
-
-1.7. "Larger Work"
-
- means a work that combines Covered Software with other material, in a
- separate file or files, that is not Covered Software.
-
-1.8. "License"
-
- means this document.
-
-1.9. "Licensable"
-
- means having the right to grant, to the maximum extent possible, whether
- at the time of the initial grant or subsequently, any and all of the
- rights conveyed by this License.
-
-1.10. "Modifications"
-
- means any of the following:
-
- a. any file in Source Code Form that results from an addition to,
- deletion from, or modification of the contents of Covered Software; or
-
- b. any new file in Source Code Form that contains any Covered Software.
-
-1.11. "Patent Claims" of a Contributor
-
- means any patent claim(s), including without limitation, method,
- process, and apparatus claims, in any patent Licensable by such
- Contributor that would be infringed, but for the grant of the License,
- by the making, using, selling, offering for sale, having made, import,
- or transfer of either its Contributions or its Contributor Version.
-
-1.12. "Secondary License"
-
- means either the GNU General Public License, Version 2.0, the GNU Lesser
- General Public License, Version 2.1, the GNU Affero General Public
- License, Version 3.0, or any later versions of those licenses.
-
-1.13. "Source Code Form"
-
- means the form of the work preferred for making modifications.
-
-1.14. "You" (or "Your")
-
- means an individual or a legal entity exercising rights under this
- License. For legal entities, "You" includes any entity that controls, is
- controlled by, or is under common control with You. For purposes of this
- definition, "control" means (a) the power, direct or indirect, to cause
- the direction or management of such entity, whether by contract or
- otherwise, or (b) ownership of more than fifty percent (50%) of the
- outstanding shares or beneficial ownership of such entity.
-
-
-2. License Grants and Conditions
-
-2.1. Grants
-
- Each Contributor hereby grants You a world-wide, royalty-free,
- non-exclusive license:
-
- a. under intellectual property rights (other than patent or trademark)
- Licensable by such Contributor to use, reproduce, make available,
- modify, display, perform, distribute, and otherwise exploit its
- Contributions, either on an unmodified basis, with Modifications, or
- as part of a Larger Work; and
-
- b. under Patent Claims of such Contributor to make, use, sell, offer for
- sale, have made, import, and otherwise transfer either its
- Contributions or its Contributor Version.
-
-2.2. Effective Date
-
- The licenses granted in Section 2.1 with respect to any Contribution
- become effective for each Contribution on the date the Contributor first
- distributes such Contribution.
-
-2.3. Limitations on Grant Scope
-
- The licenses granted in this Section 2 are the only rights granted under
- this License. No additional rights or licenses will be implied from the
- distribution or licensing of Covered Software under this License.
- Notwithstanding Section 2.1(b) above, no patent license is granted by a
- Contributor:
-
- a. for any code that a Contributor has removed from Covered Software; or
-
- b. for infringements caused by: (i) Your and any other third party's
- modifications of Covered Software, or (ii) the combination of its
- Contributions with other software (except as part of its Contributor
- Version); or
-
- c. under Patent Claims infringed by Covered Software in the absence of
- its Contributions.
-
- This License does not grant any rights in the trademarks, service marks,
- or logos of any Contributor (except as may be necessary to comply with
- the notice requirements in Section 3.4).
-
-2.4. Subsequent Licenses
-
- No Contributor makes additional grants as a result of Your choice to
- distribute the Covered Software under a subsequent version of this
- License (see Section 10.2) or under the terms of a Secondary License (if
- permitted under the terms of Section 3.3).
-
-2.5. Representation
-
- Each Contributor represents that the Contributor believes its
- Contributions are its original creation(s) or it has sufficient rights to
- grant the rights to its Contributions conveyed by this License.
-
-2.6. Fair Use
-
- This License is not intended to limit any rights You have under
- applicable copyright doctrines of fair use, fair dealing, or other
- equivalents.
-
-2.7. Conditions
-
- Sections 3.1, 3.2, 3.3, and 3.4 are conditions of the licenses granted in
- Section 2.1.
-
-
-3. Responsibilities
-
-3.1. Distribution of Source Form
-
- All distribution of Covered Software in Source Code Form, including any
- Modifications that You create or to which You contribute, must be under
- the terms of this License. You must inform recipients that the Source
- Code Form of the Covered Software is governed by the terms of this
- License, and how they can obtain a copy of this License. You may not
- attempt to alter or restrict the recipients' rights in the Source Code
- Form.
-
-3.2. Distribution of Executable Form
-
- If You distribute Covered Software in Executable Form then:
-
- a. such Covered Software must also be made available in Source Code Form,
- as described in Section 3.1, and You must inform recipients of the
- Executable Form how they can obtain a copy of such Source Code Form by
- reasonable means in a timely manner, at a charge no more than the cost
- of distribution to the recipient; and
-
- b. You may distribute such Executable Form under the terms of this
- License, or sublicense it under different terms, provided that the
- license for the Executable Form does not attempt to limit or alter the
- recipients' rights in the Source Code Form under this License.
-
-3.3. Distribution of a Larger Work
-
- You may create and distribute a Larger Work under terms of Your choice,
- provided that You also comply with the requirements of this License for
- the Covered Software. If the Larger Work is a combination of Covered
- Software with a work governed by one or more Secondary Licenses, and the
- Covered Software is not Incompatible With Secondary Licenses, this
- License permits You to additionally distribute such Covered Software
- under the terms of such Secondary License(s), so that the recipient of
- the Larger Work may, at their option, further distribute the Covered
- Software under the terms of either this License or such Secondary
- License(s).
-
-3.4. Notices
-
- You may not remove or alter the substance of any license notices
- (including copyright notices, patent notices, disclaimers of warranty, or
- limitations of liability) contained within the Source Code Form of the
- Covered Software, except that You may alter any license notices to the
- extent required to remedy known factual inaccuracies.
-
-3.5. Application of Additional Terms
-
- You may choose to offer, and to charge a fee for, warranty, support,
- indemnity or liability obligations to one or more recipients of Covered
- Software. However, You may do so only on Your own behalf, and not on
- behalf of any Contributor. You must make it absolutely clear that any
- such warranty, support, indemnity, or liability obligation is offered by
- You alone, and You hereby agree to indemnify every Contributor for any
- liability incurred by such Contributor as a result of warranty, support,
- indemnity or liability terms You offer. You may include additional
- disclaimers of warranty and limitations of liability specific to any
- jurisdiction.
-
-4. Inability to Comply Due to Statute or Regulation
-
- If it is impossible for You to comply with any of the terms of this License
- with respect to some or all of the Covered Software due to statute,
- judicial order, or regulation then You must: (a) comply with the terms of
- this License to the maximum extent possible; and (b) describe the
- limitations and the code they affect. Such description must be placed in a
- text file included with all distributions of the Covered Software under
- this License. Except to the extent prohibited by statute or regulation,
- such description must be sufficiently detailed for a recipient of ordinary
- skill to be able to understand it.
-
-5. Termination
-
-5.1. The rights granted under this License will terminate automatically if You
- fail to comply with any of its terms. However, if You become compliant,
- then the rights granted under this License from a particular Contributor
- are reinstated (a) provisionally, unless and until such Contributor
- explicitly and finally terminates Your grants, and (b) on an ongoing
- basis, if such Contributor fails to notify You of the non-compliance by
- some reasonable means prior to 60 days after You have come back into
- compliance. Moreover, Your grants from a particular Contributor are
- reinstated on an ongoing basis if such Contributor notifies You of the
- non-compliance by some reasonable means, this is the first time You have
- received notice of non-compliance with this License from such
- Contributor, and You become compliant prior to 30 days after Your receipt
- of the notice.
-
-5.2. If You initiate litigation against any entity by asserting a patent
- infringement claim (excluding declaratory judgment actions,
- counter-claims, and cross-claims) alleging that a Contributor Version
- directly or indirectly infringes any patent, then the rights granted to
- You by any and all Contributors for the Covered Software under Section
- 2.1 of this License shall terminate.
-
-5.3. In the event of termination under Sections 5.1 or 5.2 above, all end user
- license agreements (excluding distributors and resellers) which have been
- validly granted by You or Your distributors under this License prior to
- termination shall survive termination.
-
-6. Disclaimer of Warranty
-
- Covered Software is provided under this License on an "as is" basis,
- without warranty of any kind, either expressed, implied, or statutory,
- including, without limitation, warranties that the Covered Software is free
- of defects, merchantable, fit for a particular purpose or non-infringing.
- The entire risk as to the quality and performance of the Covered Software
- is with You. Should any Covered Software prove defective in any respect,
- You (not any Contributor) assume the cost of any necessary servicing,
- repair, or correction. This disclaimer of warranty constitutes an essential
- part of this License. No use of any Covered Software is authorized under
- this License except under this disclaimer.
-
-7. Limitation of Liability
-
- Under no circumstances and under no legal theory, whether tort (including
- negligence), contract, or otherwise, shall any Contributor, or anyone who
- distributes Covered Software as permitted above, be liable to You for any
- direct, indirect, special, incidental, or consequential damages of any
- character including, without limitation, damages for lost profits, loss of
- goodwill, work stoppage, computer failure or malfunction, or any and all
- other commercial damages or losses, even if such party shall have been
- informed of the possibility of such damages. This limitation of liability
- shall not apply to liability for death or personal injury resulting from
- such party's negligence to the extent applicable law prohibits such
- limitation. Some jurisdictions do not allow the exclusion or limitation of
- incidental or consequential damages, so this exclusion and limitation may
- not apply to You.
-
-8. Litigation
-
- Any litigation relating to this License may be brought only in the courts
- of a jurisdiction where the defendant maintains its principal place of
- business and such litigation shall be governed by laws of that
- jurisdiction, without reference to its conflict-of-law provisions. Nothing
- in this Section shall prevent a party's ability to bring cross-claims or
- counter-claims.
-
-9. Miscellaneous
-
- This License represents the complete agreement concerning the subject
- matter hereof. If any provision of this License is held to be
- unenforceable, such provision shall be reformed only to the extent
- necessary to make it enforceable. Any law or regulation which provides that
- the language of a contract shall be construed against the drafter shall not
- be used to construe this License against a Contributor.
-
-
-10. Versions of the License
-
-10.1. New Versions
-
- Mozilla Foundation is the license steward. Except as provided in Section
- 10.3, no one other than the license steward has the right to modify or
- publish new versions of this License. Each version will be given a
- distinguishing version number.
-
-10.2. Effect of New Versions
-
- You may distribute the Covered Software under the terms of the version
- of the License under which You originally received the Covered Software,
- or under the terms of any subsequent version published by the license
- steward.
-
-10.3. Modified Versions
-
- If you create software not governed by this License, and you want to
- create a new license for such software, you may create and use a
- modified version of this License if you rename the license and remove
- any references to the name of the license steward (except to note that
- such modified license differs from this License).
-
-10.4. Distributing Source Code Form that is Incompatible With Secondary
- Licenses If You choose to distribute Source Code Form that is
- Incompatible With Secondary Licenses under the terms of this version of
- the License, the notice described in Exhibit B of this License must be
- attached.
-
-Exhibit A - Source Code Form License Notice
-
- This Source Code Form is subject to the
- terms of the Mozilla Public License, v.
- 2.0. If a copy of the MPL was not
- distributed with this file, You can
- obtain one at
- http://mozilla.org/MPL/2.0/.
-
-If it is not possible or desirable to put the notice in a particular file,
-then You may include the notice in a location (such as a LICENSE file in a
-relevant directory) where a recipient would be likely to look for such a
-notice.
-
-You may add additional accurate notices of copyright ownership.
-
-Exhibit B - "Incompatible With Secondary Licenses" Notice
-
- This Source Code Form is "Incompatible
- With Secondary Licenses", as defined by
- the Mozilla Public License, v. 2.0.
\ No newline at end of file
diff --git a/vendor/github.com/hashicorp/yamux/README.md b/vendor/github.com/hashicorp/yamux/README.md
deleted file mode 100644
index d4db7fc9..00000000
--- a/vendor/github.com/hashicorp/yamux/README.md
+++ /dev/null
@@ -1,86 +0,0 @@
-# Yamux
-
-Yamux (Yet another Multiplexer) is a multiplexing library for Golang.
-It relies on an underlying connection to provide reliability
-and ordering, such as TCP or Unix domain sockets, and provides
-stream-oriented multiplexing. It is inspired by SPDY but is not
-interoperable with it.
-
-Yamux features include:
-
-* Bi-directional streams
- * Streams can be opened by either client or server
- * Useful for NAT traversal
- * Server-side push support
-* Flow control
- * Avoid starvation
- * Back-pressure to prevent overwhelming a receiver
-* Keep Alives
- * Enables persistent connections over a load balancer
-* Efficient
- * Enables thousands of logical streams with low overhead
-
-## Documentation
-
-For complete documentation, see the associated [Godoc](http://godoc.org/github.com/hashicorp/yamux).
-
-## Specification
-
-The full specification for Yamux is provided in the `spec.md` file.
-It can be used as a guide to implementors of interoperable libraries.
-
-## Usage
-
-Using Yamux is remarkably simple:
-
-```go
-
-func client() {
- // Get a TCP connection
- conn, err := net.Dial(...)
- if err != nil {
- panic(err)
- }
-
- // Setup client side of yamux
- session, err := yamux.Client(conn, nil)
- if err != nil {
- panic(err)
- }
-
- // Open a new stream
- stream, err := session.Open()
- if err != nil {
- panic(err)
- }
-
- // Stream implements net.Conn
- stream.Write([]byte("ping"))
-}
-
-func server() {
- // Accept a TCP connection
- conn, err := listener.Accept()
- if err != nil {
- panic(err)
- }
-
- // Setup server side of yamux
- session, err := yamux.Server(conn, nil)
- if err != nil {
- panic(err)
- }
-
- // Accept a stream
- stream, err := session.Accept()
- if err != nil {
- panic(err)
- }
-
- // Listen for a message
- buf := make([]byte, 4)
- stream.Read(buf)
-}
-
-```
-
diff --git a/vendor/github.com/hashicorp/yamux/addr.go b/vendor/github.com/hashicorp/yamux/addr.go
deleted file mode 100644
index be6ebca9..00000000
--- a/vendor/github.com/hashicorp/yamux/addr.go
+++ /dev/null
@@ -1,60 +0,0 @@
-package yamux
-
-import (
- "fmt"
- "net"
-)
-
-// hasAddr is used to get the address from the underlying connection
-type hasAddr interface {
- LocalAddr() net.Addr
- RemoteAddr() net.Addr
-}
-
-// yamuxAddr is used when we cannot get the underlying address
-type yamuxAddr struct {
- Addr string
-}
-
-func (*yamuxAddr) Network() string {
- return "yamux"
-}
-
-func (y *yamuxAddr) String() string {
- return fmt.Sprintf("yamux:%s", y.Addr)
-}
-
-// Addr is used to get the address of the listener.
-func (s *Session) Addr() net.Addr {
- return s.LocalAddr()
-}
-
-// LocalAddr is used to get the local address of the
-// underlying connection.
-func (s *Session) LocalAddr() net.Addr {
- addr, ok := s.conn.(hasAddr)
- if !ok {
- return &yamuxAddr{"local"}
- }
- return addr.LocalAddr()
-}
-
-// RemoteAddr is used to get the address of remote end
-// of the underlying connection
-func (s *Session) RemoteAddr() net.Addr {
- addr, ok := s.conn.(hasAddr)
- if !ok {
- return &yamuxAddr{"remote"}
- }
- return addr.RemoteAddr()
-}
-
-// LocalAddr returns the local address
-func (s *Stream) LocalAddr() net.Addr {
- return s.session.LocalAddr()
-}
-
-// LocalAddr returns the remote address
-func (s *Stream) RemoteAddr() net.Addr {
- return s.session.RemoteAddr()
-}
diff --git a/vendor/github.com/hashicorp/yamux/const.go b/vendor/github.com/hashicorp/yamux/const.go
deleted file mode 100644
index 4f529382..00000000
--- a/vendor/github.com/hashicorp/yamux/const.go
+++ /dev/null
@@ -1,157 +0,0 @@
-package yamux
-
-import (
- "encoding/binary"
- "fmt"
-)
-
-var (
- // ErrInvalidVersion means we received a frame with an
- // invalid version
- ErrInvalidVersion = fmt.Errorf("invalid protocol version")
-
- // ErrInvalidMsgType means we received a frame with an
- // invalid message type
- ErrInvalidMsgType = fmt.Errorf("invalid msg type")
-
- // ErrSessionShutdown is used if there is a shutdown during
- // an operation
- ErrSessionShutdown = fmt.Errorf("session shutdown")
-
- // ErrStreamsExhausted is returned if we have no more
- // stream ids to issue
- ErrStreamsExhausted = fmt.Errorf("streams exhausted")
-
- // ErrDuplicateStream is used if a duplicate stream is
- // opened inbound
- ErrDuplicateStream = fmt.Errorf("duplicate stream initiated")
-
- // ErrReceiveWindowExceeded indicates the window was exceeded
- ErrRecvWindowExceeded = fmt.Errorf("recv window exceeded")
-
- // ErrTimeout is used when we reach an IO deadline
- ErrTimeout = fmt.Errorf("i/o deadline reached")
-
- // ErrStreamClosed is returned when using a closed stream
- ErrStreamClosed = fmt.Errorf("stream closed")
-
- // ErrUnexpectedFlag is set when we get an unexpected flag
- ErrUnexpectedFlag = fmt.Errorf("unexpected flag")
-
- // ErrRemoteGoAway is used when we get a go away from the other side
- ErrRemoteGoAway = fmt.Errorf("remote end is not accepting connections")
-
- // ErrConnectionReset is sent if a stream is reset. This can happen
- // if the backlog is exceeded, or if there was a remote GoAway.
- ErrConnectionReset = fmt.Errorf("connection reset")
-
- // ErrConnectionWriteTimeout indicates that we hit the "safety valve"
- // timeout writing to the underlying stream connection.
- ErrConnectionWriteTimeout = fmt.Errorf("connection write timeout")
-
- // ErrKeepAliveTimeout is sent if a missed keepalive caused the stream close
- ErrKeepAliveTimeout = fmt.Errorf("keepalive timeout")
-)
-
-const (
- // protoVersion is the only version we support
- protoVersion uint8 = 0
-)
-
-const (
- // Data is used for data frames. They are followed
- // by length bytes worth of payload.
- typeData uint8 = iota
-
- // WindowUpdate is used to change the window of
- // a given stream. The length indicates the delta
- // update to the window.
- typeWindowUpdate
-
- // Ping is sent as a keep-alive or to measure
- // the RTT. The StreamID and Length value are echoed
- // back in the response.
- typePing
-
- // GoAway is sent to terminate a session. The StreamID
- // should be 0 and the length is an error code.
- typeGoAway
-)
-
-const (
- // SYN is sent to signal a new stream. May
- // be sent with a data payload
- flagSYN uint16 = 1 << iota
-
- // ACK is sent to acknowledge a new stream. May
- // be sent with a data payload
- flagACK
-
- // FIN is sent to half-close the given stream.
- // May be sent with a data payload.
- flagFIN
-
- // RST is used to hard close a given stream.
- flagRST
-)
-
-const (
- // initialStreamWindow is the initial stream window size
- initialStreamWindow uint32 = 256 * 1024
-)
-
-const (
- // goAwayNormal is sent on a normal termination
- goAwayNormal uint32 = iota
-
- // goAwayProtoErr sent on a protocol error
- goAwayProtoErr
-
- // goAwayInternalErr sent on an internal error
- goAwayInternalErr
-)
-
-const (
- sizeOfVersion = 1
- sizeOfType = 1
- sizeOfFlags = 2
- sizeOfStreamID = 4
- sizeOfLength = 4
- headerSize = sizeOfVersion + sizeOfType + sizeOfFlags +
- sizeOfStreamID + sizeOfLength
-)
-
-type header []byte
-
-func (h header) Version() uint8 {
- return h[0]
-}
-
-func (h header) MsgType() uint8 {
- return h[1]
-}
-
-func (h header) Flags() uint16 {
- return binary.BigEndian.Uint16(h[2:4])
-}
-
-func (h header) StreamID() uint32 {
- return binary.BigEndian.Uint32(h[4:8])
-}
-
-func (h header) Length() uint32 {
- return binary.BigEndian.Uint32(h[8:12])
-}
-
-func (h header) String() string {
- return fmt.Sprintf("Vsn:%d Type:%d Flags:%d StreamID:%d Length:%d",
- h.Version(), h.MsgType(), h.Flags(), h.StreamID(), h.Length())
-}
-
-func (h header) encode(msgType uint8, flags uint16, streamID uint32, length uint32) {
- h[0] = protoVersion
- h[1] = msgType
- binary.BigEndian.PutUint16(h[2:4], flags)
- binary.BigEndian.PutUint32(h[4:8], streamID)
- binary.BigEndian.PutUint32(h[8:12], length)
-}
diff --git a/vendor/github.com/hashicorp/yamux/mux.go b/vendor/github.com/hashicorp/yamux/mux.go
deleted file mode 100644
index 7abc7c74..00000000
--- a/vendor/github.com/hashicorp/yamux/mux.go
+++ /dev/null
@@ -1,87 +0,0 @@
-package yamux
-
-import (
- "fmt"
- "io"
- "os"
- "time"
-)
-
-// Config is used to tune the Yamux session
-type Config struct {
- // AcceptBacklog is used to limit how many streams may be
- // waiting an accept.
- AcceptBacklog int
-
- // EnableKeepalive is used to do a period keep alive
- // messages using a ping.
- EnableKeepAlive bool
-
- // KeepAliveInterval is how often to perform the keep alive
- KeepAliveInterval time.Duration
-
- // ConnectionWriteTimeout is meant to be a "safety valve" timeout after
- // we which will suspect a problem with the underlying connection and
- // close it. This is only applied to writes, where's there's generally
- // an expectation that things will move along quickly.
- ConnectionWriteTimeout time.Duration
-
- // MaxStreamWindowSize is used to control the maximum
- // window size that we allow for a stream.
- MaxStreamWindowSize uint32
-
- // LogOutput is used to control the log destination
- LogOutput io.Writer
-}
-
-// DefaultConfig is used to return a default configuration
-func DefaultConfig() *Config {
- return &Config{
- AcceptBacklog: 256,
- EnableKeepAlive: true,
- KeepAliveInterval: 30 * time.Second,
- ConnectionWriteTimeout: 10 * time.Second,
- MaxStreamWindowSize: initialStreamWindow,
- LogOutput: os.Stderr,
- }
-}
-
-// VerifyConfig is used to verify the sanity of configuration
-func VerifyConfig(config *Config) error {
- if config.AcceptBacklog <= 0 {
- return fmt.Errorf("backlog must be positive")
- }
- if config.KeepAliveInterval == 0 {
- return fmt.Errorf("keep-alive interval must be positive")
- }
- if config.MaxStreamWindowSize < initialStreamWindow {
- return fmt.Errorf("MaxStreamWindowSize must be larger than %d", initialStreamWindow)
- }
- return nil
-}
-
-// Server is used to initialize a new server-side connection.
-// There must be at most one server-side connection. If a nil config is
-// provided, the DefaultConfiguration will be used.
-func Server(conn io.ReadWriteCloser, config *Config) (*Session, error) {
- if config == nil {
- config = DefaultConfig()
- }
- if err := VerifyConfig(config); err != nil {
- return nil, err
- }
- return newSession(config, conn, false), nil
-}
-
-// Client is used to initialize a new client-side connection.
-// There must be at most one client-side connection.
-func Client(conn io.ReadWriteCloser, config *Config) (*Session, error) {
- if config == nil {
- config = DefaultConfig()
- }
-
- if err := VerifyConfig(config); err != nil {
- return nil, err
- }
- return newSession(config, conn, true), nil
-}
diff --git a/vendor/github.com/hashicorp/yamux/session.go b/vendor/github.com/hashicorp/yamux/session.go
deleted file mode 100644
index 20369bdd..00000000
--- a/vendor/github.com/hashicorp/yamux/session.go
+++ /dev/null
@@ -1,598 +0,0 @@
-package yamux
-
-import (
- "bufio"
- "fmt"
- "io"
- "io/ioutil"
- "log"
- "math"
- "net"
- "strings"
- "sync"
- "sync/atomic"
- "time"
-)
-
-// Session is used to wrap a reliable ordered connection and to
-// multiplex it into multiple streams.
-type Session struct {
- // remoteGoAway indicates the remote side does
- // not want futher connections. Must be first for alignment.
- remoteGoAway int32
-
- // localGoAway indicates that we should stop
- // accepting futher connections. Must be first for alignment.
- localGoAway int32
-
- // nextStreamID is the next stream we should
- // send. This depends if we are a client/server.
- nextStreamID uint32
-
- // config holds our configuration
- config *Config
-
- // logger is used for our logs
- logger *log.Logger
-
- // conn is the underlying connection
- conn io.ReadWriteCloser
-
- // bufRead is a buffered reader
- bufRead *bufio.Reader
-
- // pings is used to track inflight pings
- pings map[uint32]chan struct{}
- pingID uint32
- pingLock sync.Mutex
-
- // streams maps a stream id to a stream
- streams map[uint32]*Stream
- streamLock sync.Mutex
-
- // synCh acts like a semaphore. It is sized to the AcceptBacklog which
- // is assumed to be symmetric between the client and server. This allows
- // the client to avoid exceeding the backlog and instead blocks the open.
- synCh chan struct{}
-
- // acceptCh is used to pass ready streams to the client
- acceptCh chan *Stream
-
- // sendCh is used to mark a stream as ready to send,
- // or to send a header out directly.
- sendCh chan sendReady
-
- // recvDoneCh is closed when recv() exits to avoid a race
- // between stream registration and stream shutdown
- recvDoneCh chan struct{}
-
- // shutdown is used to safely close a session
- shutdown bool
- shutdownErr error
- shutdownCh chan struct{}
- shutdownLock sync.Mutex
-}
-
-// sendReady is used to either mark a stream as ready
-// or to directly send a header
-type sendReady struct {
- Hdr []byte
- Body io.Reader
- Err chan error
-}
-
-// newSession is used to construct a new session
-func newSession(config *Config, conn io.ReadWriteCloser, client bool) *Session {
- s := &Session{
- config: config,
- logger: log.New(config.LogOutput, "", log.LstdFlags),
- conn: conn,
- bufRead: bufio.NewReader(conn),
- pings: make(map[uint32]chan struct{}),
- streams: make(map[uint32]*Stream),
- synCh: make(chan struct{}, config.AcceptBacklog),
- acceptCh: make(chan *Stream, config.AcceptBacklog),
- sendCh: make(chan sendReady, 64),
- recvDoneCh: make(chan struct{}),
- shutdownCh: make(chan struct{}),
- }
- if client {
- s.nextStreamID = 1
- } else {
- s.nextStreamID = 2
- }
- go s.recv()
- go s.send()
- if config.EnableKeepAlive {
- go s.keepalive()
- }
- return s
-}
-
-// IsClosed does a safe check to see if we have shutdown
-func (s *Session) IsClosed() bool {
- select {
- case <-s.shutdownCh:
- return true
- default:
- return false
- }
-}
-
-// NumStreams returns the number of currently open streams
-func (s *Session) NumStreams() int {
- s.streamLock.Lock()
- num := len(s.streams)
- s.streamLock.Unlock()
- return num
-}
-
-// Open is used to create a new stream as a net.Conn
-func (s *Session) Open() (net.Conn, error) {
- conn, err := s.OpenStream()
- if err != nil {
- return nil, err
- }
- return conn, nil
-}
-
-// OpenStream is used to create a new stream
-func (s *Session) OpenStream() (*Stream, error) {
- if s.IsClosed() {
- return nil, ErrSessionShutdown
- }
- if atomic.LoadInt32(&s.remoteGoAway) == 1 {
- return nil, ErrRemoteGoAway
- }
-
- // Block if we have too many inflight SYNs
- select {
- case s.synCh <- struct{}{}:
- case <-s.shutdownCh:
- return nil, ErrSessionShutdown
- }
-
-GET_ID:
- // Get and ID, and check for stream exhaustion
- id := atomic.LoadUint32(&s.nextStreamID)
- if id >= math.MaxUint32-1 {
- return nil, ErrStreamsExhausted
- }
- if !atomic.CompareAndSwapUint32(&s.nextStreamID, id, id+2) {
- goto GET_ID
- }
-
- // Register the stream
- stream := newStream(s, id, streamInit)
- s.streamLock.Lock()
- s.streams[id] = stream
- s.streamLock.Unlock()
-
- // Send the window update to create
- if err := stream.sendWindowUpdate(); err != nil {
- return nil, err
- }
- return stream, nil
-}
-
-// Accept is used to block until the next available stream
-// is ready to be accepted.
-func (s *Session) Accept() (net.Conn, error) {
- conn, err := s.AcceptStream()
- if err != nil {
- return nil, err
- }
- return conn, err
-}
-
-// AcceptStream is used to block until the next available stream
-// is ready to be accepted.
-func (s *Session) AcceptStream() (*Stream, error) {
- select {
- case stream := <-s.acceptCh:
- if err := stream.sendWindowUpdate(); err != nil {
- return nil, err
- }
- return stream, nil
- case <-s.shutdownCh:
- return nil, s.shutdownErr
- }
-}
-
-// Close is used to close the session and all streams.
-// Attempts to send a GoAway before closing the connection.
-func (s *Session) Close() error {
- s.shutdownLock.Lock()
- defer s.shutdownLock.Unlock()
-
- if s.shutdown {
- return nil
- }
- s.shutdown = true
- if s.shutdownErr == nil {
- s.shutdownErr = ErrSessionShutdown
- }
- close(s.shutdownCh)
- s.conn.Close()
- <-s.recvDoneCh
-
- s.streamLock.Lock()
- defer s.streamLock.Unlock()
- for _, stream := range s.streams {
- stream.forceClose()
- }
- return nil
-}
-
-// exitErr is used to handle an error that is causing the
-// session to terminate.
-func (s *Session) exitErr(err error) {
- s.shutdownLock.Lock()
- if s.shutdownErr == nil {
- s.shutdownErr = err
- }
- s.shutdownLock.Unlock()
- s.Close()
-}
-
-// GoAway can be used to prevent accepting further
-// connections. It does not close the underlying conn.
-func (s *Session) GoAway() error {
- return s.waitForSend(s.goAway(goAwayNormal), nil)
-}
-
-// goAway is used to send a goAway message
-func (s *Session) goAway(reason uint32) header {
- atomic.SwapInt32(&s.localGoAway, 1)
- hdr := header(make([]byte, headerSize))
- hdr.encode(typeGoAway, 0, 0, reason)
- return hdr
-}
-
-// Ping is used to measure the RTT response time
-func (s *Session) Ping() (time.Duration, error) {
- // Get a channel for the ping
- ch := make(chan struct{})
-
- // Get a new ping id, mark as pending
- s.pingLock.Lock()
- id := s.pingID
- s.pingID++
- s.pings[id] = ch
- s.pingLock.Unlock()
-
- // Send the ping request
- hdr := header(make([]byte, headerSize))
- hdr.encode(typePing, flagSYN, 0, id)
- if err := s.waitForSend(hdr, nil); err != nil {
- return 0, err
- }
-
- // Wait for a response
- start := time.Now()
- select {
- case <-ch:
- case <-time.After(s.config.ConnectionWriteTimeout):
- s.pingLock.Lock()
- delete(s.pings, id) // Ignore it if a response comes later.
- s.pingLock.Unlock()
- return 0, ErrTimeout
- case <-s.shutdownCh:
- return 0, ErrSessionShutdown
- }
-
- // Compute the RTT
- return time.Now().Sub(start), nil
-}
-
-// keepalive is a long running goroutine that periodically does
-// a ping to keep the connection alive.
-func (s *Session) keepalive() {
- for {
- select {
- case <-time.After(s.config.KeepAliveInterval):
- _, err := s.Ping()
- if err != nil {
- s.logger.Printf("[ERR] yamux: keepalive failed: %v", err)
- s.exitErr(ErrKeepAliveTimeout)
- return
- }
- case <-s.shutdownCh:
- return
- }
- }
-}
-
-// waitForSendErr waits to send a header, checking for a potential shutdown
-func (s *Session) waitForSend(hdr header, body io.Reader) error {
- errCh := make(chan error, 1)
- return s.waitForSendErr(hdr, body, errCh)
-}
-
-// waitForSendErr waits to send a header with optional data, checking for a
-// potential shutdown. Since there's the expectation that sends can happen
-// in a timely manner, we enforce the connection write timeout here.
-func (s *Session) waitForSendErr(hdr header, body io.Reader, errCh chan error) error {
- timer := time.NewTimer(s.config.ConnectionWriteTimeout)
- defer timer.Stop()
-
- ready := sendReady{Hdr: hdr, Body: body, Err: errCh}
- select {
- case s.sendCh <- ready:
- case <-s.shutdownCh:
- return ErrSessionShutdown
- case <-timer.C:
- return ErrConnectionWriteTimeout
- }
-
- select {
- case err := <-errCh:
- return err
- case <-s.shutdownCh:
- return ErrSessionShutdown
- case <-timer.C:
- return ErrConnectionWriteTimeout
- }
-}
-
-// sendNoWait does a send without waiting. Since there's the expectation that
-// the send happens right here, we enforce the connection write timeout if we
-// can't queue the header to be sent.
-func (s *Session) sendNoWait(hdr header) error {
- timer := time.NewTimer(s.config.ConnectionWriteTimeout)
- defer timer.Stop()
-
- select {
- case s.sendCh <- sendReady{Hdr: hdr}:
- return nil
- case <-s.shutdownCh:
- return ErrSessionShutdown
- case <-timer.C:
- return ErrConnectionWriteTimeout
- }
-}
-
-// send is a long running goroutine that sends data
-func (s *Session) send() {
- for {
- select {
- case ready := <-s.sendCh:
- // Send a header if ready
- if ready.Hdr != nil {
- sent := 0
- for sent < len(ready.Hdr) {
- n, err := s.conn.Write(ready.Hdr[sent:])
- if err != nil {
- s.logger.Printf("[ERR] yamux: Failed to write header: %v", err)
- asyncSendErr(ready.Err, err)
- s.exitErr(err)
- return
- }
- sent += n
- }
- }
-
- // Send data from a body if given
- if ready.Body != nil {
- _, err := io.Copy(s.conn, ready.Body)
- if err != nil {
- s.logger.Printf("[ERR] yamux: Failed to write body: %v", err)
- asyncSendErr(ready.Err, err)
- s.exitErr(err)
- return
- }
- }
-
- // No error, successful send
- asyncSendErr(ready.Err, nil)
- case <-s.shutdownCh:
- return
- }
- }
-}
-
-// recv is a long running goroutine that accepts new data
-func (s *Session) recv() {
- if err := s.recvLoop(); err != nil {
- s.exitErr(err)
- }
-}
-
-// recvLoop continues to receive data until a fatal error is encountered
-func (s *Session) recvLoop() error {
- defer close(s.recvDoneCh)
- hdr := header(make([]byte, headerSize))
- var handler func(header) error
- for {
- // Read the header
- if _, err := io.ReadFull(s.bufRead, hdr); err != nil {
- if err != io.EOF && !strings.Contains(err.Error(), "closed") && !strings.Contains(err.Error(), "reset by peer") {
- s.logger.Printf("[ERR] yamux: Failed to read header: %v", err)
- }
- return err
- }
-
- // Verify the version
- if hdr.Version() != protoVersion {
- s.logger.Printf("[ERR] yamux: Invalid protocol version: %d", hdr.Version())
- return ErrInvalidVersion
- }
-
- // Switch on the type
- switch hdr.MsgType() {
- case typeData:
- handler = s.handleStreamMessage
- case typeWindowUpdate:
- handler = s.handleStreamMessage
- case typeGoAway:
- handler = s.handleGoAway
- case typePing:
- handler = s.handlePing
- default:
- return ErrInvalidMsgType
- }
-
- // Invoke the handler
- if err := handler(hdr); err != nil {
- return err
- }
- }
-}
-
-// handleStreamMessage handles either a data or window update frame
-func (s *Session) handleStreamMessage(hdr header) error {
- // Check for a new stream creation
- id := hdr.StreamID()
- flags := hdr.Flags()
- if flags&flagSYN == flagSYN {
- if err := s.incomingStream(id); err != nil {
- return err
- }
- }
-
- // Get the stream
- s.streamLock.Lock()
- stream := s.streams[id]
- s.streamLock.Unlock()
-
- // If we do not have a stream, likely we sent a RST
- if stream == nil {
- // Drain any data on the wire
- if hdr.MsgType() == typeData && hdr.Length() > 0 {
- s.logger.Printf("[WARN] yamux: Discarding data for stream: %d", id)
- if _, err := io.CopyN(ioutil.Discard, s.bufRead, int64(hdr.Length())); err != nil {
- s.logger.Printf("[ERR] yamux: Failed to discard data: %v", err)
- return nil
- }
- } else {
- s.logger.Printf("[WARN] yamux: frame for missing stream: %v", hdr)
- }
- return nil
- }
-
- // Check if this is a window update
- if hdr.MsgType() == typeWindowUpdate {
- if err := stream.incrSendWindow(hdr, flags); err != nil {
- if sendErr := s.sendNoWait(s.goAway(goAwayProtoErr)); sendErr != nil {
- s.logger.Printf("[WARN] yamux: failed to send go away: %v", sendErr)
- }
- return err
- }
- return nil
- }
-
- // Read the new data
- if err := stream.readData(hdr, flags, s.bufRead); err != nil {
- if sendErr := s.sendNoWait(s.goAway(goAwayProtoErr)); sendErr != nil {
- s.logger.Printf("[WARN] yamux: failed to send go away: %v", sendErr)
- }
- return err
- }
- return nil
-}
-
-// handlePing is invokde for a typePing frame
-func (s *Session) handlePing(hdr header) error {
- flags := hdr.Flags()
- pingID := hdr.Length()
-
- // Check if this is a query, respond back in a separate context so we
- // don't interfere with the receiving thread blocking for the write.
- if flags&flagSYN == flagSYN {
- go func() {
- hdr := header(make([]byte, headerSize))
- hdr.encode(typePing, flagACK, 0, pingID)
- if err := s.sendNoWait(hdr); err != nil {
- s.logger.Printf("[WARN] yamux: failed to send ping reply: %v", err)
- }
- }()
- return nil
- }
-
- // Handle a response
- s.pingLock.Lock()
- ch := s.pings[pingID]
- if ch != nil {
- delete(s.pings, pingID)
- close(ch)
- }
- s.pingLock.Unlock()
- return nil
-}
-
-// handleGoAway is invokde for a typeGoAway frame
-func (s *Session) handleGoAway(hdr header) error {
- code := hdr.Length()
- switch code {
- case goAwayNormal:
- atomic.SwapInt32(&s.remoteGoAway, 1)
- case goAwayProtoErr:
- s.logger.Printf("[ERR] yamux: received protocol error go away")
- return fmt.Errorf("yamux protocol error")
- case goAwayInternalErr:
- s.logger.Printf("[ERR] yamux: received internal error go away")
- return fmt.Errorf("remote yamux internal error")
- default:
- s.logger.Printf("[ERR] yamux: received unexpected go away")
- return fmt.Errorf("unexpected go away received")
- }
- return nil
-}
-
-// incomingStream is used to create a new incoming stream
-func (s *Session) incomingStream(id uint32) error {
- // Reject immediately if we are doing a go away
- if atomic.LoadInt32(&s.localGoAway) == 1 {
- hdr := header(make([]byte, headerSize))
- hdr.encode(typeWindowUpdate, flagRST, id, 0)
- return s.sendNoWait(hdr)
- }
-
- // Allocate a new stream
- stream := newStream(s, id, streamSYNReceived)
-
- s.streamLock.Lock()
- defer s.streamLock.Unlock()
-
- // Check if stream already exists
- if _, ok := s.streams[id]; ok {
- s.logger.Printf("[ERR] yamux: duplicate stream declared")
- if sendErr := s.sendNoWait(s.goAway(goAwayProtoErr)); sendErr != nil {
- s.logger.Printf("[WARN] yamux: failed to send go away: %v", sendErr)
- }
- return ErrDuplicateStream
- }
-
- // Register the stream
- s.streams[id] = stream
-
- // Check if we've exceeded the backlog
- select {
- case s.acceptCh <- stream:
- return nil
- default:
- // Backlog exceeded! RST the stream
- s.logger.Printf("[WARN] yamux: backlog exceeded, forcing connection reset")
- delete(s.streams, id)
- stream.sendHdr.encode(typeWindowUpdate, flagRST, id, 0)
- return s.sendNoWait(stream.sendHdr)
- }
-}
-
-// closeStream is used to close a stream once both sides have
-// issued a close.
-func (s *Session) closeStream(id uint32) {
- s.streamLock.Lock()
- delete(s.streams, id)
- s.streamLock.Unlock()
-}
-
-// establishStream is used to mark a stream that was in the
-// SYN Sent state as established.
-func (s *Session) establishStream() {
- select {
- case <-s.synCh:
- default:
- panic("established stream without inflight syn")
- }
-}
diff --git a/vendor/github.com/hashicorp/yamux/spec.md b/vendor/github.com/hashicorp/yamux/spec.md
deleted file mode 100644
index 419470b7..00000000
--- a/vendor/github.com/hashicorp/yamux/spec.md
+++ /dev/null
@@ -1,141 +0,0 @@
-# Specification
-
-We use this document to detail the internal specification of Yamux.
-This is used both as a guide for implementing Yamux, but also for
-alternative interoperable libraries to be built.
-
-# Framing
-
-Yamux uses a streaming connection underneath, but imposes a message
-framing so that it can be shared between many logical streams. Each
-frame contains a header like:
-
-* Version (8 bits)
-* Type (8 bits)
-* Flags (16 bits)
-* StreamID (32 bits)
-* Length (32 bits)
-
-This means that each header has a 12 byte overhead.
-All fields are encoded in network order (big endian).
-Each field is described below:
-
-## Version Field
-
-The version field is used for future backwards compatibily. At the
-current time, the field is always set to 0, to indicate the initial
-version.
-
-## Type Field
-
-The type field is used to switch the frame message type. The following
-message types are supported:
-
-* 0x0 Data - Used to transmit data. May transmit zero length payloads
- depending on the flags.
-
-* 0x1 Window Update - Used to updated the senders receive window size.
- This is used to implement per-session flow control.
-
-* 0x2 Ping - Used to measure RTT. It can also be used to heart-beat
- and do keep-alives over TCP.
-
-* 0x3 Go Away - Used to close a session.
-
-## Flag Field
-
-The flags field is used to provide additional information related
-to the message type. The following flags are supported:
-
-* 0x1 SYN - Signals the start of a new stream. May be sent with a data or
- window update message. Also sent with a ping to indicate outbound.
-
-* 0x2 ACK - Acknowledges the start of a new stream. May be sent with a data
- or window update message. Also sent with a ping to indicate response.
-
-* 0x4 FIN - Performs a half-close of a stream. May be sent with a data
- message or window update.
-
-* 0x8 RST - Reset a stream immediately. May be sent with a data or
- window update message.
-
-## StreamID Field
-
-The StreamID field is used to identify the logical stream the frame
-is addressing. The client side should use odd ID's, and the server even.
-This prevents any collisions. Additionally, the 0 ID is reserved to represent
-the session.
-
-Both Ping and Go Away messages should always use the 0 StreamID.
-
-## Length Field
-
-The meaning of the length field depends on the message type:
-
-* Data - provides the length of bytes following the header
-* Window update - provides a delta update to the window size
-* Ping - Contains an opaque value, echoed back
-* Go Away - Contains an error code
-
-# Message Flow
-
-There is no explicit connection setup, as Yamux relies on an underlying
-transport to be provided. However, there is a distinction between client
-and server side of the connection.
-
-## Opening a stream
-
-To open a stream, an initial data or window update frame is sent
-with a new StreamID. The SYN flag should be set to signal a new stream.
-
-The receiver must then reply with either a data or window update frame
-with the StreamID along with the ACK flag to accept the stream or with
-the RST flag to reject the stream.
-
-Because we are relying on the reliable stream underneath, a connection
-can begin sending data once the SYN flag is sent. The corresponding
-ACK does not need to be received. This is particularly well suited
-for an RPC system where a client wants to open a stream and immediately
-fire a request without wiating for the RTT of the ACK.
-
-This does introduce the possibility of a connection being rejected
-after data has been sent already. This is a slight semantic difference
-from TCP, where the conection cannot be refused after it is opened.
-Clients should be prepared to handle this by checking for an error
-that indicates a RST was received.
-
-## Closing a stream
-
-To close a stream, either side sends a data or window update frame
-along with the FIN flag. This does a half-close indicating the sender
-will send no further data.
-
-Once both sides have closed the connection, the stream is closed.
-
-Alternatively, if an error occurs, the RST flag can be used to
-hard close a stream immediately.
-
-## Flow Control
-
-When Yamux is initially starts each stream with a 256KB window size.
-There is no window size for the session.
-
-To prevent the streams from stalling, window update frames should be
-sent regularly. Yamux can be configured to provide a larger limit for
-windows sizes. Both sides assume the initial 256KB window, but can
-immediately send a window update as part of the SYN/ACK indicating a
-larger window.
-
-Both sides should track the number of bytes sent in Data frames
-only, as only they are tracked as part of the window size.
-
-## Session termination
-
-When a session is being terminated, the Go Away message should
-be sent. The Length should be set to one of the following to
-provide an error code:
-
-* 0x0 Normal termination
-* 0x1 Protocol error
-* 0x2 Internal error
-
diff --git a/vendor/github.com/hashicorp/yamux/stream.go b/vendor/github.com/hashicorp/yamux/stream.go
deleted file mode 100644
index 4c3242d3..00000000
--- a/vendor/github.com/hashicorp/yamux/stream.go
+++ /dev/null
@@ -1,452 +0,0 @@
-package yamux
-
-import (
- "bytes"
- "io"
- "sync"
- "sync/atomic"
- "time"
-)
-
-type streamState int
-
-const (
- streamInit streamState = iota
- streamSYNSent
- streamSYNReceived
- streamEstablished
- streamLocalClose
- streamRemoteClose
- streamClosed
- streamReset
-)
-
-// Stream is used to represent a logical stream
-// within a session.
-type Stream struct {
- recvWindow uint32
- sendWindow uint32
-
- id uint32
- session *Session
-
- state streamState
- stateLock sync.Mutex
-
- recvBuf *bytes.Buffer
- recvLock sync.Mutex
-
- controlHdr header
- controlErr chan error
- controlHdrLock sync.Mutex
-
- sendHdr header
- sendErr chan error
- sendLock sync.Mutex
-
- recvNotifyCh chan struct{}
- sendNotifyCh chan struct{}
-
- readDeadline time.Time
- writeDeadline time.Time
-}
-
-// newStream is used to construct a new stream within
-// a given session for an ID
-func newStream(session *Session, id uint32, state streamState) *Stream {
- s := &Stream{
- id: id,
- session: session,
- state: state,
- controlHdr: header(make([]byte, headerSize)),
- controlErr: make(chan error, 1),
- sendHdr: header(make([]byte, headerSize)),
- sendErr: make(chan error, 1),
- recvWindow: initialStreamWindow,
- sendWindow: initialStreamWindow,
- recvNotifyCh: make(chan struct{}, 1),
- sendNotifyCh: make(chan struct{}, 1),
- }
- return s
-}
-
-// Session returns the associated stream session
-func (s *Stream) Session() *Session {
- return s.session
-}
-
-// StreamID returns the ID of this stream
-func (s *Stream) StreamID() uint32 {
- return s.id
-}
-
-// Read is used to read from the stream
-func (s *Stream) Read(b []byte) (n int, err error) {
- defer asyncNotify(s.recvNotifyCh)
-START:
- s.stateLock.Lock()
- switch s.state {
- case streamLocalClose:
- fallthrough
- case streamRemoteClose:
- fallthrough
- case streamClosed:
- if s.recvBuf == nil || s.recvBuf.Len() == 0 {
- s.stateLock.Unlock()
- return 0, io.EOF
- }
- case streamReset:
- s.stateLock.Unlock()
- return 0, ErrConnectionReset
- }
- s.stateLock.Unlock()
-
- // If there is no data available, block
- s.recvLock.Lock()
- if s.recvBuf == nil || s.recvBuf.Len() == 0 {
- s.recvLock.Unlock()
- goto WAIT
- }
-
- // Read any bytes
- n, _ = s.recvBuf.Read(b)
- s.recvLock.Unlock()
-
- // Send a window update potentially
- err = s.sendWindowUpdate()
- return n, err
-
-WAIT:
- var timeout <-chan time.Time
- if !s.readDeadline.IsZero() {
- delay := s.readDeadline.Sub(time.Now())
- timeout = time.After(delay)
- }
- select {
- case <-s.recvNotifyCh:
- goto START
- case <-timeout:
- return 0, ErrTimeout
- }
-}
-
-// Write is used to write to the stream
-func (s *Stream) Write(b []byte) (n int, err error) {
- s.sendLock.Lock()
- defer s.sendLock.Unlock()
- total := 0
- for total < len(b) {
- n, err := s.write(b[total:])
- total += n
- if err != nil {
- return total, err
- }
- }
- return total, nil
-}
-
-// write is used to write to the stream, may return on
-// a short write.
-func (s *Stream) write(b []byte) (n int, err error) {
- var flags uint16
- var max uint32
- var body io.Reader
-START:
- s.stateLock.Lock()
- switch s.state {
- case streamLocalClose:
- fallthrough
- case streamClosed:
- s.stateLock.Unlock()
- return 0, ErrStreamClosed
- case streamReset:
- s.stateLock.Unlock()
- return 0, ErrConnectionReset
- }
- s.stateLock.Unlock()
-
- // If there is no data available, block
- window := atomic.LoadUint32(&s.sendWindow)
- if window == 0 {
- goto WAIT
- }
-
- // Determine the flags if any
- flags = s.sendFlags()
-
- // Send up to our send window
- max = min(window, uint32(len(b)))
- body = bytes.NewReader(b[:max])
-
- // Send the header
- s.sendHdr.encode(typeData, flags, s.id, max)
- if err := s.session.waitForSendErr(s.sendHdr, body, s.sendErr); err != nil {
- return 0, err
- }
-
- // Reduce our send window
- atomic.AddUint32(&s.sendWindow, ^uint32(max-1))
-
- // Unlock
- return int(max), err
-
-WAIT:
- var timeout <-chan time.Time
- if !s.writeDeadline.IsZero() {
- delay := s.writeDeadline.Sub(time.Now())
- timeout = time.After(delay)
- }
- select {
- case <-s.sendNotifyCh:
- goto START
- case <-timeout:
- return 0, ErrTimeout
- }
- return 0, nil
-}
-
-// sendFlags determines any flags that are appropriate
-// based on the current stream state
-func (s *Stream) sendFlags() uint16 {
- s.stateLock.Lock()
- defer s.stateLock.Unlock()
- var flags uint16
- switch s.state {
- case streamInit:
- flags |= flagSYN
- s.state = streamSYNSent
- case streamSYNReceived:
- flags |= flagACK
- s.state = streamEstablished
- }
- return flags
-}
-
-// sendWindowUpdate potentially sends a window update enabling
-// further writes to take place. Must be invoked with the lock.
-func (s *Stream) sendWindowUpdate() error {
- s.controlHdrLock.Lock()
- defer s.controlHdrLock.Unlock()
-
- // Determine the delta update
- max := s.session.config.MaxStreamWindowSize
- delta := max - atomic.LoadUint32(&s.recvWindow)
-
- // Determine the flags if any
- flags := s.sendFlags()
-
- // Check if we can omit the update
- if delta < (max/2) && flags == 0 {
- return nil
- }
-
- // Update our window
- atomic.AddUint32(&s.recvWindow, delta)
-
- // Send the header
- s.controlHdr.encode(typeWindowUpdate, flags, s.id, delta)
- if err := s.session.waitForSendErr(s.controlHdr, nil, s.controlErr); err != nil {
- return err
- }
- return nil
-}
-
-// sendClose is used to send a FIN
-func (s *Stream) sendClose() error {
- s.controlHdrLock.Lock()
- defer s.controlHdrLock.Unlock()
-
- flags := s.sendFlags()
- flags |= flagFIN
- s.controlHdr.encode(typeWindowUpdate, flags, s.id, 0)
- if err := s.session.waitForSendErr(s.controlHdr, nil, s.controlErr); err != nil {
- return err
- }
- return nil
-}
-
-// Close is used to close the stream
-func (s *Stream) Close() error {
- closeStream := false
- s.stateLock.Lock()
- switch s.state {
- // Opened means we need to signal a close
- case streamSYNSent:
- fallthrough
- case streamSYNReceived:
- fallthrough
- case streamEstablished:
- s.state = streamLocalClose
- goto SEND_CLOSE
-
- case streamLocalClose:
- case streamRemoteClose:
- s.state = streamClosed
- closeStream = true
- goto SEND_CLOSE
-
- case streamClosed:
- case streamReset:
- default:
- panic("unhandled state")
- }
- s.stateLock.Unlock()
- return nil
-SEND_CLOSE:
- s.stateLock.Unlock()
- s.sendClose()
- s.notifyWaiting()
- if closeStream {
- s.session.closeStream(s.id)
- }
- return nil
-}
-
-// forceClose is used for when the session is exiting
-func (s *Stream) forceClose() {
- s.stateLock.Lock()
- s.state = streamClosed
- s.stateLock.Unlock()
- s.notifyWaiting()
-}
-
-// processFlags is used to update the state of the stream
-// based on set flags, if any. Lock must be held
-func (s *Stream) processFlags(flags uint16) error {
- // Close the stream without holding the state lock
- closeStream := false
- defer func() {
- if closeStream {
- s.session.closeStream(s.id)
- }
- }()
-
- s.stateLock.Lock()
- defer s.stateLock.Unlock()
- if flags&flagACK == flagACK {
- if s.state == streamSYNSent {
- s.state = streamEstablished
- }
- s.session.establishStream()
- }
- if flags&flagFIN == flagFIN {
- switch s.state {
- case streamSYNSent:
- fallthrough
- case streamSYNReceived:
- fallthrough
- case streamEstablished:
- s.state = streamRemoteClose
- s.notifyWaiting()
- case streamLocalClose:
- s.state = streamClosed
- closeStream = true
- s.notifyWaiting()
- default:
- s.session.logger.Printf("[ERR] yamux: unexpected FIN flag in state %d", s.state)
- return ErrUnexpectedFlag
- }
- }
- if flags&flagRST == flagRST {
- if s.state == streamSYNSent {
- s.session.establishStream()
- }
- s.state = streamReset
- closeStream = true
- s.notifyWaiting()
- }
- return nil
-}
-
-// notifyWaiting notifies all the waiting channels
-func (s *Stream) notifyWaiting() {
- asyncNotify(s.recvNotifyCh)
- asyncNotify(s.sendNotifyCh)
-}
-
-// incrSendWindow updates the size of our send window
-func (s *Stream) incrSendWindow(hdr header, flags uint16) error {
- if err := s.processFlags(flags); err != nil {
- return err
- }
-
- // Increase window, unblock a sender
- atomic.AddUint32(&s.sendWindow, hdr.Length())
- asyncNotify(s.sendNotifyCh)
- return nil
-}
-
-// readData is used to handle a data frame
-func (s *Stream) readData(hdr header, flags uint16, conn io.Reader) error {
- if err := s.processFlags(flags); err != nil {
- return err
- }
-
- // Check that our recv window is not exceeded
- length := hdr.Length()
- if length == 0 {
- return nil
- }
- if remain := atomic.LoadUint32(&s.recvWindow); length > remain {
- s.session.logger.Printf("[ERR] yamux: receive window exceeded (stream: %d, remain: %d, recv: %d)", s.id, remain, length)
- return ErrRecvWindowExceeded
- }
-
- // Wrap in a limited reader
- conn = &io.LimitedReader{R: conn, N: int64(length)}
-
- // Copy into buffer
- s.recvLock.Lock()
- if s.recvBuf == nil {
- // Allocate the receive buffer just-in-time to fit the full data frame.
- // This way we can read in the whole packet without further allocations.
- s.recvBuf = bytes.NewBuffer(make([]byte, 0, length))
- }
- if _, err := io.Copy(s.recvBuf, conn); err != nil {
- s.session.logger.Printf("[ERR] yamux: Failed to read stream data: %v", err)
- s.recvLock.Unlock()
- return err
- }
-
- // Decrement the receive window
- atomic.AddUint32(&s.recvWindow, ^uint32(length-1))
- s.recvLock.Unlock()
-
- // Unblock any readers
- asyncNotify(s.recvNotifyCh)
- return nil
-}
-
-// SetDeadline sets the read and write deadlines
-func (s *Stream) SetDeadline(t time.Time) error {
- if err := s.SetReadDeadline(t); err != nil {
- return err
- }
- if err := s.SetWriteDeadline(t); err != nil {
- return err
- }
- return nil
-}
-
-// SetReadDeadline sets the deadline for future Read calls.
-func (s *Stream) SetReadDeadline(t time.Time) error {
- s.readDeadline = t
- return nil
-}
-
-// SetWriteDeadline sets the deadline for future Write calls
-func (s *Stream) SetWriteDeadline(t time.Time) error {
- s.writeDeadline = t
- return nil
-}
-
-// Shrink is used to compact the amount of buffers utilized
-// This is useful when using Yamux in a connection pool to reduce
-// the idle memory utilization.
-func (s *Stream) Shrink() {
- s.recvLock.Lock()
- if s.recvBuf != nil && s.recvBuf.Len() == 0 {
- s.recvBuf = nil
- }
- s.recvLock.Unlock()
-}
diff --git a/vendor/github.com/hashicorp/yamux/util.go b/vendor/github.com/hashicorp/yamux/util.go
deleted file mode 100644
index 5fe45afc..00000000
--- a/vendor/github.com/hashicorp/yamux/util.go
+++ /dev/null
@@ -1,28 +0,0 @@
-package yamux
-
-// asyncSendErr is used to try an async send of an error
-func asyncSendErr(ch chan error, err error) {
- if ch == nil {
- return
- }
- select {
- case ch <- err:
- default:
- }
-}
-
-// asyncNotify is used to signal a waiting goroutine
-func asyncNotify(ch chan struct{}) {
- select {
- case ch <- struct{}{}:
- default:
- }
-}
-
-// min computes the minimum of two values
-func min(a, b uint32) uint32 {
- if a < b {
- return a
- }
- return b
-}
diff --git a/vendor/github.com/kr/fs/LICENSE b/vendor/github.com/kr/fs/LICENSE
deleted file mode 100644
index 74487567..00000000
--- a/vendor/github.com/kr/fs/LICENSE
+++ /dev/null
@@ -1,27 +0,0 @@
-Copyright (c) 2012 The Go Authors. All rights reserved.
-
-Redistribution and use in source and binary forms, with or without
-modification, are permitted provided that the following conditions are
-met:
-
- * Redistributions of source code must retain the above copyright
-notice, this list of conditions and the following disclaimer.
- * Redistributions in binary form must reproduce the above
-copyright notice, this list of conditions and the following disclaimer
-in the documentation and/or other materials provided with the
-distribution.
- * Neither the name of Google Inc. nor the names of its
-contributors may be used to endorse or promote products derived from
-this software without specific prior written permission.
-
-THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
diff --git a/vendor/github.com/kr/fs/Readme b/vendor/github.com/kr/fs/Readme
deleted file mode 100644
index c95e13fc..00000000
--- a/vendor/github.com/kr/fs/Readme
+++ /dev/null
@@ -1,3 +0,0 @@
-Filesystem Package
-
-http://godoc.org/github.com/kr/fs
diff --git a/vendor/github.com/kr/fs/filesystem.go b/vendor/github.com/kr/fs/filesystem.go
deleted file mode 100644
index f1c4805f..00000000
--- a/vendor/github.com/kr/fs/filesystem.go
+++ /dev/null
@@ -1,36 +0,0 @@
-package fs
-
-import (
- "io/ioutil"
- "os"
- "path/filepath"
-)
-
-// FileSystem defines the methods of an abstract filesystem.
-type FileSystem interface {
-
- // ReadDir reads the directory named by dirname and returns a
- // list of directory entries.
- ReadDir(dirname string) ([]os.FileInfo, error)
-
- // Lstat returns a FileInfo describing the named file. If the file is a
- // symbolic link, the returned FileInfo describes the symbolic link. Lstat
- // makes no attempt to follow the link.
- Lstat(name string) (os.FileInfo, error)
-
- // Join joins any number of path elements into a single path, adding a
- // separator if necessary. The result is Cleaned; in particular, all
- // empty strings are ignored.
- //
- // The separator is FileSystem specific.
- Join(elem ...string) string
-}
-
-// fs represents a FileSystem provided by the os package.
-type fs struct{}
-
-func (f *fs) ReadDir(dirname string) ([]os.FileInfo, error) { return ioutil.ReadDir(dirname) }
-
-func (f *fs) Lstat(name string) (os.FileInfo, error) { return os.Lstat(name) }
-
-func (f *fs) Join(elem ...string) string { return filepath.Join(elem...) }
diff --git a/vendor/github.com/kr/fs/walk.go b/vendor/github.com/kr/fs/walk.go
deleted file mode 100644
index 6ffa1e0b..00000000
--- a/vendor/github.com/kr/fs/walk.go
+++ /dev/null
@@ -1,95 +0,0 @@
-// Package fs provides filesystem-related functions.
-package fs
-
-import (
- "os"
-)
-
-// Walker provides a convenient interface for iterating over the
-// descendants of a filesystem path.
-// Successive calls to the Step method will step through each
-// file or directory in the tree, including the root. The files
-// are walked in lexical order, which makes the output deterministic
-// but means that for very large directories Walker can be inefficient.
-// Walker does not follow symbolic links.
-type Walker struct {
- fs FileSystem
- cur item
- stack []item
- descend bool
-}
-
-type item struct {
- path string
- info os.FileInfo
- err error
-}
-
-// Walk returns a new Walker rooted at root.
-func Walk(root string) *Walker {
- return WalkFS(root, new(fs))
-}
-
-// WalkFS returns a new Walker rooted at root on the FileSystem fs.
-func WalkFS(root string, fs FileSystem) *Walker {
- info, err := fs.Lstat(root)
- return &Walker{
- fs: fs,
- stack: []item{{root, info, err}},
- }
-}
-
-// Step advances the Walker to the next file or directory,
-// which will then be available through the Path, Stat,
-// and Err methods.
-// It returns false when the walk stops at the end of the tree.
-func (w *Walker) Step() bool {
- if w.descend && w.cur.err == nil && w.cur.info.IsDir() {
- list, err := w.fs.ReadDir(w.cur.path)
- if err != nil {
- w.cur.err = err
- w.stack = append(w.stack, w.cur)
- } else {
- for i := len(list) - 1; i >= 0; i-- {
- path := w.fs.Join(w.cur.path, list[i].Name())
- w.stack = append(w.stack, item{path, list[i], nil})
- }
- }
- }
-
- if len(w.stack) == 0 {
- return false
- }
- i := len(w.stack) - 1
- w.cur = w.stack[i]
- w.stack = w.stack[:i]
- w.descend = true
- return true
-}
-
-// Path returns the path to the most recent file or directory
-// visited by a call to Step. It contains the argument to Walk
-// as a prefix; that is, if Walk is called with "dir", which is
-// a directory containing the file "a", Path will return "dir/a".
-func (w *Walker) Path() string {
- return w.cur.path
-}
-
-// Stat returns info for the most recent file or directory
-// visited by a call to Step.
-func (w *Walker) Stat() os.FileInfo {
- return w.cur.info
-}
-
-// Err returns the error, if any, for the most recent attempt
-// by Step to visit a file or directory. If a directory has
-// an error, w will not descend into that directory.
-func (w *Walker) Err() error {
- return w.cur.err
-}
-
-// SkipDir causes the currently visited directory to be skipped.
-// If w is not on a directory, SkipDir has no effect.
-func (w *Walker) SkipDir() {
- w.descend = false
-}
diff --git a/vendor/github.com/masterzen/simplexml/LICENSE b/vendor/github.com/masterzen/simplexml/LICENSE
deleted file mode 100644
index ef51da2b..00000000
--- a/vendor/github.com/masterzen/simplexml/LICENSE
+++ /dev/null
@@ -1,202 +0,0 @@
-
- Apache License
- Version 2.0, January 2004
- http://www.apache.org/licenses/
-
-TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
-
-1. Definitions.
-
- "License" shall mean the terms and conditions for use, reproduction,
- and distribution as defined by Sections 1 through 9 of this document.
-
- "Licensor" shall mean the copyright owner or entity authorized by
- the copyright owner that is granting the License.
-
- "Legal Entity" shall mean the union of the acting entity and all
- other entities that control, are controlled by, or are under common
- control with that entity. For the purposes of this definition,
- "control" means (i) the power, direct or indirect, to cause the
- direction or management of such entity, whether by contract or
- otherwise, or (ii) ownership of fifty percent (50%) or more of the
- outstanding shares, or (iii) beneficial ownership of such entity.
-
- "You" (or "Your") shall mean an individual or Legal Entity
- exercising permissions granted by this License.
-
- "Source" form shall mean the preferred form for making modifications,
- including but not limited to software source code, documentation
- source, and configuration files.
-
- "Object" form shall mean any form resulting from mechanical
- transformation or translation of a Source form, including but
- not limited to compiled object code, generated documentation,
- and conversions to other media types.
-
- "Work" shall mean the work of authorship, whether in Source or
- Object form, made available under the License, as indicated by a
- copyright notice that is included in or attached to the work
- (an example is provided in the Appendix below).
-
- "Derivative Works" shall mean any work, whether in Source or Object
- form, that is based on (or derived from) the Work and for which the
- editorial revisions, annotations, elaborations, or other modifications
- represent, as a whole, an original work of authorship. For the purposes
- of this License, Derivative Works shall not include works that remain
- separable from, or merely link (or bind by name) to the interfaces of,
- the Work and Derivative Works thereof.
-
- "Contribution" shall mean any work of authorship, including
- the original version of the Work and any modifications or additions
- to that Work or Derivative Works thereof, that is intentionally
- submitted to Licensor for inclusion in the Work by the copyright owner
- or by an individual or Legal Entity authorized to submit on behalf of
- the copyright owner. For the purposes of this definition, "submitted"
- means any form of electronic, verbal, or written communication sent
- to the Licensor or its representatives, including but not limited to
- communication on electronic mailing lists, source code control systems,
- and issue tracking systems that are managed by, or on behalf of, the
- Licensor for the purpose of discussing and improving the Work, but
- excluding communication that is conspicuously marked or otherwise
- designated in writing by the copyright owner as "Not a Contribution."
-
- "Contributor" shall mean Licensor and any individual or Legal Entity
- on behalf of whom a Contribution has been received by Licensor and
- subsequently incorporated within the Work.
-
-2. Grant of Copyright License. Subject to the terms and conditions of
- this License, each Contributor hereby grants to You a perpetual,
- worldwide, non-exclusive, no-charge, royalty-free, irrevocable
- copyright license to reproduce, prepare Derivative Works of,
- publicly display, publicly perform, sublicense, and distribute the
- Work and such Derivative Works in Source or Object form.
-
-3. Grant of Patent License. Subject to the terms and conditions of
- this License, each Contributor hereby grants to You a perpetual,
- worldwide, non-exclusive, no-charge, royalty-free, irrevocable
- (except as stated in this section) patent license to make, have made,
- use, offer to sell, sell, import, and otherwise transfer the Work,
- where such license applies only to those patent claims licensable
- by such Contributor that are necessarily infringed by their
- Contribution(s) alone or by combination of their Contribution(s)
- with the Work to which such Contribution(s) was submitted. If You
- institute patent litigation against any entity (including a
- cross-claim or counterclaim in a lawsuit) alleging that the Work
- or a Contribution incorporated within the Work constitutes direct
- or contributory patent infringement, then any patent licenses
- granted to You under this License for that Work shall terminate
- as of the date such litigation is filed.
-
-4. Redistribution. You may reproduce and distribute copies of the
- Work or Derivative Works thereof in any medium, with or without
- modifications, and in Source or Object form, provided that You
- meet the following conditions:
-
- (a) You must give any other recipients of the Work or
- Derivative Works a copy of this License; and
-
- (b) You must cause any modified files to carry prominent notices
- stating that You changed the files; and
-
- (c) You must retain, in the Source form of any Derivative Works
- that You distribute, all copyright, patent, trademark, and
- attribution notices from the Source form of the Work,
- excluding those notices that do not pertain to any part of
- the Derivative Works; and
-
- (d) If the Work includes a "NOTICE" text file as part of its
- distribution, then any Derivative Works that You distribute must
- include a readable copy of the attribution notices contained
- within such NOTICE file, excluding those notices that do not
- pertain to any part of the Derivative Works, in at least one
- of the following places: within a NOTICE text file distributed
- as part of the Derivative Works; within the Source form or
- documentation, if provided along with the Derivative Works; or,
- within a display generated by the Derivative Works, if and
- wherever such third-party notices normally appear. The contents
- of the NOTICE file are for informational purposes only and
- do not modify the License. You may add Your own attribution
- notices within Derivative Works that You distribute, alongside
- or as an addendum to the NOTICE text from the Work, provided
- that such additional attribution notices cannot be construed
- as modifying the License.
-
- You may add Your own copyright statement to Your modifications and
- may provide additional or different license terms and conditions
- for use, reproduction, or distribution of Your modifications, or
- for any such Derivative Works as a whole, provided Your use,
- reproduction, and distribution of the Work otherwise complies with
- the conditions stated in this License.
-
-5. Submission of Contributions. Unless You explicitly state otherwise,
- any Contribution intentionally submitted for inclusion in the Work
- by You to the Licensor shall be under the terms and conditions of
- this License, without any additional terms or conditions.
- Notwithstanding the above, nothing herein shall supersede or modify
- the terms of any separate license agreement you may have executed
- with Licensor regarding such Contributions.
-
-6. Trademarks. This License does not grant permission to use the trade
- names, trademarks, service marks, or product names of the Licensor,
- except as required for reasonable and customary use in describing the
- origin of the Work and reproducing the content of the NOTICE file.
-
-7. Disclaimer of Warranty. Unless required by applicable law or
- agreed to in writing, Licensor provides the Work (and each
- Contributor provides its Contributions) on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
- implied, including, without limitation, any warranties or conditions
- of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
- PARTICULAR PURPOSE. You are solely responsible for determining the
- appropriateness of using or redistributing the Work and assume any
- risks associated with Your exercise of permissions under this License.
-
-8. Limitation of Liability. In no event and under no legal theory,
- whether in tort (including negligence), contract, or otherwise,
- unless required by applicable law (such as deliberate and grossly
- negligent acts) or agreed to in writing, shall any Contributor be
- liable to You for damages, including any direct, indirect, special,
- incidental, or consequential damages of any character arising as a
- result of this License or out of the use or inability to use the
- Work (including but not limited to damages for loss of goodwill,
- work stoppage, computer failure or malfunction, or any and all
- other commercial damages or losses), even if such Contributor
- has been advised of the possibility of such damages.
-
-9. Accepting Warranty or Additional Liability. While redistributing
- the Work or Derivative Works thereof, You may choose to offer,
- and charge a fee for, acceptance of support, warranty, indemnity,
- or other liability obligations and/or rights consistent with this
- License. However, in accepting such obligations, You may act only
- on Your own behalf and on Your sole responsibility, not on behalf
- of any other Contributor, and only if You agree to indemnify,
- defend, and hold each Contributor harmless for any liability
- incurred by, or claims asserted against, such Contributor by reason
- of your accepting any such warranty or additional liability.
-
-END OF TERMS AND CONDITIONS
-
-APPENDIX: How to apply the Apache License to your work.
-
- To apply the Apache License to your work, attach the following
- boilerplate notice, with the fields enclosed by brackets "[]"
- replaced with your own identifying information. (Don't include
- the brackets!) The text should be enclosed in the appropriate
- comment syntax for the file format. We also recommend that a
- file or class name and description of purpose be included on the
- same "printed page" as the copyright notice for easier
- identification within third-party archives.
-
-Copyright [yyyy] [name of copyright owner]
-
-Licensed under the Apache License, Version 2.0 (the "License");
-you may not use this file except in compliance with the License.
-You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
-Unless required by applicable law or agreed to in writing, software
-distributed under the License is distributed on an "AS IS" BASIS,
-WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-See the License for the specific language governing permissions and
-limitations under the License.
diff --git a/vendor/github.com/masterzen/simplexml/dom/document.go b/vendor/github.com/masterzen/simplexml/dom/document.go
deleted file mode 100644
index 783587df..00000000
--- a/vendor/github.com/masterzen/simplexml/dom/document.go
+++ /dev/null
@@ -1,35 +0,0 @@
-package dom
-
-import (
- "bytes"
- "fmt"
-)
-
-type Document struct {
- root *Element
- PrettyPrint bool
- Indentation string
- DocType bool
-}
-
-func CreateDocument() *Document {
- return &Document{PrettyPrint: false, Indentation: " ", DocType: true}
-}
-
-func (doc *Document) SetRoot(node *Element) {
- node.parent = nil
- doc.root = node
-}
-
-func (doc *Document) String() string {
- var b bytes.Buffer
- if doc.DocType {
- fmt.Fprintln(&b, ``)
- }
-
- if doc.root != nil {
- doc.root.Bytes(&b, doc.PrettyPrint, doc.Indentation, 0)
- }
-
- return string(b.Bytes())
-}
diff --git a/vendor/github.com/masterzen/simplexml/dom/element.go b/vendor/github.com/masterzen/simplexml/dom/element.go
deleted file mode 100644
index c5708bbc..00000000
--- a/vendor/github.com/masterzen/simplexml/dom/element.go
+++ /dev/null
@@ -1,199 +0,0 @@
-package dom
-
-import (
- "bytes"
- "encoding/xml"
- "fmt"
-)
-
-type Attr struct {
- Name xml.Name // Attribute namespace and name.
- Value string // Attribute value.
-}
-
-type Element struct {
- name xml.Name
- children []*Element
- parent *Element
- content string
- attributes []*Attr
- namespaces []*Namespace
- document *Document
-}
-
-func CreateElement(n string) *Element {
- element := &Element{name: xml.Name{Local: n}}
- element.children = make([]*Element, 0, 5)
- element.attributes = make([]*Attr, 0, 10)
- element.namespaces = make([]*Namespace, 0, 10)
- return element
-}
-
-func (node *Element) AddChild(child *Element) *Element {
- if child.parent != nil {
- child.parent.RemoveChild(child)
- }
- child.SetParent(node)
- node.children = append(node.children, child)
- return node
-}
-
-func (node *Element) RemoveChild(child *Element) *Element {
- p := -1
- for i, v := range node.children {
- if v == child {
- p = i
- break
- }
- }
-
- if p == -1 {
- return node
- }
-
- copy(node.children[p:], node.children[p+1:])
- node.children = node.children[0 : len(node.children)-1]
- child.parent = nil
- return node
-}
-
-func (node *Element) SetAttr(name string, value string) *Element {
- // namespaces?
- attr := &Attr{Name: xml.Name{Local: name}, Value: value}
- node.attributes = append(node.attributes, attr)
- return node
-}
-
-func (node *Element) SetParent(parent *Element) *Element {
- node.parent = parent
- return node
-}
-
-func (node *Element) SetContent(content string) *Element {
- node.content = content
- return node
-}
-
-// Add a namespace declaration to this node
-func (node *Element) DeclareNamespace(ns Namespace) *Element {
- // check if we already have it
- prefix := node.namespacePrefix(ns.Uri)
- if prefix == ns.Prefix {
- return node
- }
- // add it
- node.namespaces = append(node.namespaces, &ns)
- return node
-}
-
-func (node *Element) DeclaredNamespaces() []*Namespace {
- return node.namespaces
-}
-
-func (node *Element) SetNamespace(prefix string, uri string) {
- resolved := node.namespacePrefix(uri)
- if resolved == "" {
- // we couldn't find the namespace, let's declare it at this node
- node.namespaces = append(node.namespaces, &Namespace{Prefix: prefix, Uri: uri})
- }
- node.name.Space = uri
-}
-
-func (node *Element) Bytes(out *bytes.Buffer, indent bool, indentType string, level int) {
- empty := len(node.children) == 0 && node.content == ""
- content := node.content != ""
- // children := len(node.children) > 0
- // ns := len(node.namespaces) > 0
- // attrs := len(node.attributes) > 0
-
- indentStr := ""
- nextLine := ""
- if indent {
- nextLine = "\n"
- for i := 0; i < level; i++ {
- indentStr += indentType
- }
- }
-
- if node.name.Local != "" {
- if len(node.name.Space) > 0 {
- // first find if ns has been declared, otherwise
- prefix := node.namespacePrefix(node.name.Space)
- fmt.Fprintf(out, "%s<%s:%s", indentStr, prefix, node.name.Local)
- } else {
- fmt.Fprintf(out, "%s<%s", indentStr, node.name.Local)
- }
- }
-
- // declared namespaces
- for _, v := range node.namespaces {
- prefix := node.namespacePrefix(v.Uri)
- fmt.Fprintf(out, ` xmlns:%s="%s"`, prefix, v.Uri)
- }
-
- // attributes
- for _, v := range node.attributes {
- if len(v.Name.Space) > 0 {
- prefix := node.namespacePrefix(v.Name.Space)
- fmt.Fprintf(out, ` %s:%s="%s"`, prefix, v.Name.Local, v.Value)
- } else {
- fmt.Fprintf(out, ` %s="%s"`, v.Name.Local, v.Value)
- }
- }
-
- // close tag
- if empty {
- fmt.Fprintf(out, "/>%s", nextLine)
- } else {
- if content {
- out.WriteRune('>')
- } else {
- fmt.Fprintf(out, ">%s", nextLine)
- }
- }
-
- if len(node.children) > 0 {
- for _, child := range node.children {
- child.Bytes(out, indent, indentType, level+1)
- }
- } else if node.content != "" {
- //val := []byte(node.content)
- //xml.EscapeText(out, val)
- out.WriteString(node.content)
- }
-
- if !empty && len(node.name.Local) > 0 {
- var indentation string
- if content {
- indentation = ""
- } else {
- indentation = indentStr
- }
- if len(node.name.Space) > 0 {
- prefix := node.namespacePrefix(node.name.Space)
- fmt.Fprintf(out, "%s%s:%s>\n", indentation, prefix, node.name.Local)
- } else {
- fmt.Fprintf(out, "%s%s>\n", indentation, node.name.Local)
- }
- }
-}
-
-// Finds the prefix of the given namespace if it has been declared
-// in this node or in one of its parent
-func (node *Element) namespacePrefix(uri string) string {
- for _, ns := range node.namespaces {
- if ns.Uri == uri {
- return ns.Prefix
- }
- }
- if node.parent == nil {
- return ""
- }
- return node.parent.namespacePrefix(uri)
-}
-
-func (node *Element) String() string {
- var b bytes.Buffer
- node.Bytes(&b, false, "", 0)
- return string(b.Bytes())
-}
diff --git a/vendor/github.com/masterzen/simplexml/dom/namespace.go b/vendor/github.com/masterzen/simplexml/dom/namespace.go
deleted file mode 100644
index 3961e654..00000000
--- a/vendor/github.com/masterzen/simplexml/dom/namespace.go
+++ /dev/null
@@ -1,10 +0,0 @@
-package dom
-
-type Namespace struct {
- Prefix string
- Uri string
-}
-
-func (ns *Namespace) SetTo(node *Element) {
- node.SetNamespace(ns.Prefix, ns.Uri)
-}
diff --git a/vendor/github.com/masterzen/winrm/LICENSE b/vendor/github.com/masterzen/winrm/LICENSE
deleted file mode 100644
index ef51da2b..00000000
--- a/vendor/github.com/masterzen/winrm/LICENSE
+++ /dev/null
@@ -1,202 +0,0 @@
-
- Apache License
- Version 2.0, January 2004
- http://www.apache.org/licenses/
-
-TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
-
-1. Definitions.
-
- "License" shall mean the terms and conditions for use, reproduction,
- and distribution as defined by Sections 1 through 9 of this document.
-
- "Licensor" shall mean the copyright owner or entity authorized by
- the copyright owner that is granting the License.
-
- "Legal Entity" shall mean the union of the acting entity and all
- other entities that control, are controlled by, or are under common
- control with that entity. For the purposes of this definition,
- "control" means (i) the power, direct or indirect, to cause the
- direction or management of such entity, whether by contract or
- otherwise, or (ii) ownership of fifty percent (50%) or more of the
- outstanding shares, or (iii) beneficial ownership of such entity.
-
- "You" (or "Your") shall mean an individual or Legal Entity
- exercising permissions granted by this License.
-
- "Source" form shall mean the preferred form for making modifications,
- including but not limited to software source code, documentation
- source, and configuration files.
-
- "Object" form shall mean any form resulting from mechanical
- transformation or translation of a Source form, including but
- not limited to compiled object code, generated documentation,
- and conversions to other media types.
-
- "Work" shall mean the work of authorship, whether in Source or
- Object form, made available under the License, as indicated by a
- copyright notice that is included in or attached to the work
- (an example is provided in the Appendix below).
-
- "Derivative Works" shall mean any work, whether in Source or Object
- form, that is based on (or derived from) the Work and for which the
- editorial revisions, annotations, elaborations, or other modifications
- represent, as a whole, an original work of authorship. For the purposes
- of this License, Derivative Works shall not include works that remain
- separable from, or merely link (or bind by name) to the interfaces of,
- the Work and Derivative Works thereof.
-
- "Contribution" shall mean any work of authorship, including
- the original version of the Work and any modifications or additions
- to that Work or Derivative Works thereof, that is intentionally
- submitted to Licensor for inclusion in the Work by the copyright owner
- or by an individual or Legal Entity authorized to submit on behalf of
- the copyright owner. For the purposes of this definition, "submitted"
- means any form of electronic, verbal, or written communication sent
- to the Licensor or its representatives, including but not limited to
- communication on electronic mailing lists, source code control systems,
- and issue tracking systems that are managed by, or on behalf of, the
- Licensor for the purpose of discussing and improving the Work, but
- excluding communication that is conspicuously marked or otherwise
- designated in writing by the copyright owner as "Not a Contribution."
-
- "Contributor" shall mean Licensor and any individual or Legal Entity
- on behalf of whom a Contribution has been received by Licensor and
- subsequently incorporated within the Work.
-
-2. Grant of Copyright License. Subject to the terms and conditions of
- this License, each Contributor hereby grants to You a perpetual,
- worldwide, non-exclusive, no-charge, royalty-free, irrevocable
- copyright license to reproduce, prepare Derivative Works of,
- publicly display, publicly perform, sublicense, and distribute the
- Work and such Derivative Works in Source or Object form.
-
-3. Grant of Patent License. Subject to the terms and conditions of
- this License, each Contributor hereby grants to You a perpetual,
- worldwide, non-exclusive, no-charge, royalty-free, irrevocable
- (except as stated in this section) patent license to make, have made,
- use, offer to sell, sell, import, and otherwise transfer the Work,
- where such license applies only to those patent claims licensable
- by such Contributor that are necessarily infringed by their
- Contribution(s) alone or by combination of their Contribution(s)
- with the Work to which such Contribution(s) was submitted. If You
- institute patent litigation against any entity (including a
- cross-claim or counterclaim in a lawsuit) alleging that the Work
- or a Contribution incorporated within the Work constitutes direct
- or contributory patent infringement, then any patent licenses
- granted to You under this License for that Work shall terminate
- as of the date such litigation is filed.
-
-4. Redistribution. You may reproduce and distribute copies of the
- Work or Derivative Works thereof in any medium, with or without
- modifications, and in Source or Object form, provided that You
- meet the following conditions:
-
- (a) You must give any other recipients of the Work or
- Derivative Works a copy of this License; and
-
- (b) You must cause any modified files to carry prominent notices
- stating that You changed the files; and
-
- (c) You must retain, in the Source form of any Derivative Works
- that You distribute, all copyright, patent, trademark, and
- attribution notices from the Source form of the Work,
- excluding those notices that do not pertain to any part of
- the Derivative Works; and
-
- (d) If the Work includes a "NOTICE" text file as part of its
- distribution, then any Derivative Works that You distribute must
- include a readable copy of the attribution notices contained
- within such NOTICE file, excluding those notices that do not
- pertain to any part of the Derivative Works, in at least one
- of the following places: within a NOTICE text file distributed
- as part of the Derivative Works; within the Source form or
- documentation, if provided along with the Derivative Works; or,
- within a display generated by the Derivative Works, if and
- wherever such third-party notices normally appear. The contents
- of the NOTICE file are for informational purposes only and
- do not modify the License. You may add Your own attribution
- notices within Derivative Works that You distribute, alongside
- or as an addendum to the NOTICE text from the Work, provided
- that such additional attribution notices cannot be construed
- as modifying the License.
-
- You may add Your own copyright statement to Your modifications and
- may provide additional or different license terms and conditions
- for use, reproduction, or distribution of Your modifications, or
- for any such Derivative Works as a whole, provided Your use,
- reproduction, and distribution of the Work otherwise complies with
- the conditions stated in this License.
-
-5. Submission of Contributions. Unless You explicitly state otherwise,
- any Contribution intentionally submitted for inclusion in the Work
- by You to the Licensor shall be under the terms and conditions of
- this License, without any additional terms or conditions.
- Notwithstanding the above, nothing herein shall supersede or modify
- the terms of any separate license agreement you may have executed
- with Licensor regarding such Contributions.
-
-6. Trademarks. This License does not grant permission to use the trade
- names, trademarks, service marks, or product names of the Licensor,
- except as required for reasonable and customary use in describing the
- origin of the Work and reproducing the content of the NOTICE file.
-
-7. Disclaimer of Warranty. Unless required by applicable law or
- agreed to in writing, Licensor provides the Work (and each
- Contributor provides its Contributions) on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
- implied, including, without limitation, any warranties or conditions
- of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
- PARTICULAR PURPOSE. You are solely responsible for determining the
- appropriateness of using or redistributing the Work and assume any
- risks associated with Your exercise of permissions under this License.
-
-8. Limitation of Liability. In no event and under no legal theory,
- whether in tort (including negligence), contract, or otherwise,
- unless required by applicable law (such as deliberate and grossly
- negligent acts) or agreed to in writing, shall any Contributor be
- liable to You for damages, including any direct, indirect, special,
- incidental, or consequential damages of any character arising as a
- result of this License or out of the use or inability to use the
- Work (including but not limited to damages for loss of goodwill,
- work stoppage, computer failure or malfunction, or any and all
- other commercial damages or losses), even if such Contributor
- has been advised of the possibility of such damages.
-
-9. Accepting Warranty or Additional Liability. While redistributing
- the Work or Derivative Works thereof, You may choose to offer,
- and charge a fee for, acceptance of support, warranty, indemnity,
- or other liability obligations and/or rights consistent with this
- License. However, in accepting such obligations, You may act only
- on Your own behalf and on Your sole responsibility, not on behalf
- of any other Contributor, and only if You agree to indemnify,
- defend, and hold each Contributor harmless for any liability
- incurred by, or claims asserted against, such Contributor by reason
- of your accepting any such warranty or additional liability.
-
-END OF TERMS AND CONDITIONS
-
-APPENDIX: How to apply the Apache License to your work.
-
- To apply the Apache License to your work, attach the following
- boilerplate notice, with the fields enclosed by brackets "[]"
- replaced with your own identifying information. (Don't include
- the brackets!) The text should be enclosed in the appropriate
- comment syntax for the file format. We also recommend that a
- file or class name and description of purpose be included on the
- same "printed page" as the copyright notice for easier
- identification within third-party archives.
-
-Copyright [yyyy] [name of copyright owner]
-
-Licensed under the Apache License, Version 2.0 (the "License");
-you may not use this file except in compliance with the License.
-You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
-Unless required by applicable law or agreed to in writing, software
-distributed under the License is distributed on an "AS IS" BASIS,
-WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-See the License for the specific language governing permissions and
-limitations under the License.
diff --git a/vendor/github.com/masterzen/winrm/soap/header.go b/vendor/github.com/masterzen/winrm/soap/header.go
deleted file mode 100644
index 1a2ac088..00000000
--- a/vendor/github.com/masterzen/winrm/soap/header.go
+++ /dev/null
@@ -1,181 +0,0 @@
-package soap
-
-import (
- "github.com/masterzen/simplexml/dom"
- "strconv"
-)
-
-type HeaderOption struct {
- key string
- value string
-}
-
-func NewHeaderOption(name string, value string) *HeaderOption {
- return &HeaderOption{key: name, value: value}
-}
-
-type SoapHeader struct {
- to string
- replyTo string
- maxEnvelopeSize string
- timeout string
- locale string
- id string
- action string
- shellId string
- resourceURI string
- options []HeaderOption
- message *SoapMessage
-}
-
-type HeaderBuilder interface {
- To(string) *SoapHeader
- ReplyTo(string) *SoapHeader
- MaxEnvelopeSize(int) *SoapHeader
- Timeout(string) *SoapHeader
- Locale(string) *SoapHeader
- Id(string) *SoapHeader
- Action(string) *SoapHeader
- ShellId(string) *SoapHeader
- resourceURI(string) *SoapHeader
- AddOption(*HeaderOption) *SoapHeader
- Options([]HeaderOption) *SoapHeader
- Build(*SoapMessage) *SoapMessage
-}
-
-func (self *SoapHeader) To(uri string) *SoapHeader {
- self.to = uri
- return self
-}
-
-func (self *SoapHeader) ReplyTo(uri string) *SoapHeader {
- self.replyTo = uri
- return self
-}
-
-func (self *SoapHeader) MaxEnvelopeSize(size int) *SoapHeader {
- self.maxEnvelopeSize = strconv.Itoa(size)
- return self
-}
-
-func (self *SoapHeader) Timeout(timeout string) *SoapHeader {
- self.timeout = timeout
- return self
-}
-
-func (self *SoapHeader) Id(id string) *SoapHeader {
- self.id = id
- return self
-}
-
-func (self *SoapHeader) Action(action string) *SoapHeader {
- self.action = action
- return self
-}
-
-func (self *SoapHeader) Locale(locale string) *SoapHeader {
- self.locale = locale
- return self
-}
-
-func (self *SoapHeader) ShellId(shellId string) *SoapHeader {
- self.shellId = shellId
- return self
-}
-
-func (self *SoapHeader) ResourceURI(resourceURI string) *SoapHeader {
- self.resourceURI = resourceURI
- return self
-}
-
-func (self *SoapHeader) AddOption(option *HeaderOption) *SoapHeader {
- self.options = append(self.options, *option)
- return self
-}
-
-func (self *SoapHeader) Options(options []HeaderOption) *SoapHeader {
- self.options = options
- return self
-}
-
-func (self *SoapHeader) Build() *SoapMessage {
- header := self.createElement(self.message.envelope, "Header", NS_SOAP_ENV)
-
- if self.to != "" {
- to := self.createElement(header, "To", NS_ADDRESSING)
- to.SetContent(self.to)
- }
-
- if self.replyTo != "" {
- replyTo := self.createElement(header, "ReplyTo", NS_ADDRESSING)
- a := self.createMUElement(replyTo, "Address", NS_ADDRESSING, true)
- a.SetContent(self.replyTo)
- }
-
- if self.maxEnvelopeSize != "" {
- envelope := self.createMUElement(header, "MaxEnvelopeSize", NS_WSMAN_DMTF, true)
- envelope.SetContent(self.maxEnvelopeSize)
- }
-
- if self.timeout != "" {
- timeout := self.createElement(header, "OperationTimeout", NS_WSMAN_DMTF)
- timeout.SetContent(self.timeout)
- }
-
- if self.id != "" {
- id := self.createElement(header, "MessageID", NS_ADDRESSING)
- id.SetContent(self.id)
- }
-
- if self.locale != "" {
- locale := self.createMUElement(header, "Locale", NS_WSMAN_DMTF, false)
- locale.SetAttr("xml:lang", self.locale)
- datalocale := self.createMUElement(header, "DataLocale", NS_WSMAN_MSFT, false)
- datalocale.SetAttr("xml:lang", self.locale)
- }
-
- if self.action != "" {
- action := self.createMUElement(header, "Action", NS_ADDRESSING, true)
- action.SetContent(self.action)
- }
-
- if self.shellId != "" {
- selectorSet := self.createElement(header, "SelectorSet", NS_WSMAN_DMTF)
- selector := self.createElement(selectorSet, "Selector", NS_WSMAN_DMTF)
- selector.SetAttr("Name", "ShellId")
- selector.SetContent(self.shellId)
- }
-
- if self.resourceURI != "" {
- resource := self.createMUElement(header, "ResourceURI", NS_WSMAN_DMTF, true)
- resource.SetContent(self.resourceURI)
- }
-
- if len(self.options) > 0 {
- set := self.createElement(header, "OptionSet", NS_WSMAN_DMTF)
- for _, option := range self.options {
- e := self.createElement(set, "Option", NS_WSMAN_DMTF)
- e.SetAttr("Name", option.key)
- e.SetContent(option.value)
- }
- }
-
- return self.message
-}
-
-func (self *SoapHeader) createElement(parent *dom.Element, name string, ns dom.Namespace) (element *dom.Element) {
- element = dom.CreateElement(name)
- parent.AddChild(element)
- ns.SetTo(element)
- return
-}
-
-func (self *SoapHeader) createMUElement(parent *dom.Element, name string, ns dom.Namespace, mustUnderstand bool) (element *dom.Element) {
- element = self.createElement(parent, name, ns)
- value := "false"
- if mustUnderstand {
- value = "true"
- }
- element.SetAttr("mustUnderstand", value)
- return
-}
diff --git a/vendor/github.com/masterzen/winrm/soap/message.go b/vendor/github.com/masterzen/winrm/soap/message.go
deleted file mode 100644
index d06c3085..00000000
--- a/vendor/github.com/masterzen/winrm/soap/message.go
+++ /dev/null
@@ -1,74 +0,0 @@
-package soap
-
-import (
- "github.com/masterzen/simplexml/dom"
-)
-
-type SoapMessage struct {
- document *dom.Document
- envelope *dom.Element
- header *SoapHeader
- body *dom.Element
-}
-
-type MessageBuilder interface {
- SetBody(*dom.Element)
- NewBody() *dom.Element
- CreateElement(*dom.Element, string, dom.Namespace) *dom.Element
- CreateBodyElement(string, dom.Namespace) *dom.Element
- Header() *SoapHeader
- Doc() *dom.Document
- Free()
-
- String() string
-}
-
-func NewMessage() (message *SoapMessage) {
- doc := dom.CreateDocument()
- e := dom.CreateElement("Envelope")
- doc.SetRoot(e)
- AddUsualNamespaces(e)
- NS_SOAP_ENV.SetTo(e)
-
- message = &SoapMessage{document: doc, envelope: e}
- return
-}
-
-func (message *SoapMessage) NewBody() (body *dom.Element) {
- body = dom.CreateElement("Body")
- message.envelope.AddChild(body)
- NS_SOAP_ENV.SetTo(body)
- return
-}
-
-func (message *SoapMessage) String() string {
- return message.document.String()
-}
-
-func (message *SoapMessage) Doc() *dom.Document {
- return message.document
-}
-
-func (message *SoapMessage) Free() {
-}
-
-func (message *SoapMessage) CreateElement(parent *dom.Element, name string, ns dom.Namespace) (element *dom.Element) {
- element = dom.CreateElement(name)
- parent.AddChild(element)
- ns.SetTo(element)
- return
-}
-
-func (message *SoapMessage) CreateBodyElement(name string, ns dom.Namespace) (element *dom.Element) {
- if message.body == nil {
- message.body = message.NewBody()
- }
- return message.CreateElement(message.body, name, ns)
-}
-
-func (message *SoapMessage) Header() *SoapHeader {
- if message.header == nil {
- message.header = &SoapHeader{message: message}
- }
- return message.header
-}
diff --git a/vendor/github.com/masterzen/winrm/soap/namespaces.go b/vendor/github.com/masterzen/winrm/soap/namespaces.go
deleted file mode 100644
index fda49f49..00000000
--- a/vendor/github.com/masterzen/winrm/soap/namespaces.go
+++ /dev/null
@@ -1,37 +0,0 @@
-package soap
-
-import (
- "github.com/masterzen/simplexml/dom"
- "github.com/masterzen/xmlpath"
-)
-
-var (
- NS_SOAP_ENV = dom.Namespace{"env", "http://www.w3.org/2003/05/soap-envelope"}
- NS_ADDRESSING = dom.Namespace{"a", "http://schemas.xmlsoap.org/ws/2004/08/addressing"}
- NS_CIMBINDING = dom.Namespace{"b", "http://schemas.dmtf.org/wbem/wsman/1/cimbinding.xsd"}
- NS_ENUM = dom.Namespace{"n", "http://schemas.xmlsoap.org/ws/2004/09/enumeration"}
- NS_TRANSFER = dom.Namespace{"x", "http://schemas.xmlsoap.org/ws/2004/09/transfer"}
- NS_WSMAN_DMTF = dom.Namespace{"w", "http://schemas.dmtf.org/wbem/wsman/1/wsman.xsd"}
- NS_WSMAN_MSFT = dom.Namespace{"p", "http://schemas.microsoft.com/wbem/wsman/1/wsman.xsd"}
- NS_SCHEMA_INST = dom.Namespace{"xsi", "http://www.w3.org/2001/XMLSchema-instance"}
- NS_WIN_SHELL = dom.Namespace{"rsp", "http://schemas.microsoft.com/wbem/wsman/1/windows/shell"}
- NS_WSMAN_FAULT = dom.Namespace{"f", "http://schemas.microsoft.com/wbem/wsman/1/wsmanfault"}
-)
-
-var MostUsed = [...]dom.Namespace{NS_SOAP_ENV, NS_ADDRESSING, NS_WIN_SHELL, NS_WSMAN_DMTF, NS_WSMAN_MSFT}
-
-func AddUsualNamespaces(node *dom.Element) {
- for _, ns := range MostUsed {
- node.DeclareNamespace(ns)
- }
-}
-
-func GetAllNamespaces() []xmlpath.Namespace {
- var ns = []dom.Namespace{NS_WIN_SHELL, NS_ADDRESSING, NS_WSMAN_DMTF, NS_WSMAN_MSFT, NS_SOAP_ENV}
-
- var xmlpathNs = make([]xmlpath.Namespace, 0, 4)
- for _, namespace := range ns {
- xmlpathNs = append(xmlpathNs, xmlpath.Namespace{Prefix: namespace.Prefix, Uri: namespace.Uri})
- }
- return xmlpathNs
-}
diff --git a/vendor/github.com/masterzen/winrm/winrm/client.go b/vendor/github.com/masterzen/winrm/winrm/client.go
deleted file mode 100644
index a195b6ea..00000000
--- a/vendor/github.com/masterzen/winrm/winrm/client.go
+++ /dev/null
@@ -1,166 +0,0 @@
-package winrm
-
-import (
- "bytes"
- "crypto/tls"
- "crypto/x509"
- "fmt"
- "io"
- "net/http"
-
- "github.com/masterzen/winrm/soap"
-)
-
-type Client struct {
- Parameters
- username string
- password string
- useHTTPS bool
- url string
- http HttpPost
- transport http.RoundTripper
-}
-
-// NewClient will create a new remote client on url, connecting with user and password
-// This function doesn't connect (connection happens only when CreateShell is called)
-func NewClient(endpoint *Endpoint, user, password string) (client *Client, err error) {
- params := DefaultParameters()
- client, err = NewClientWithParameters(endpoint, user, password, params)
- return
-}
-
-// NewClient will create a new remote client on url, connecting with user and password
-// This function doesn't connect (connection happens only when CreateShell is called)
-func NewClientWithParameters(endpoint *Endpoint, user, password string, params *Parameters) (client *Client, err error) {
- transport, err := newTransport(endpoint)
-
- client = &Client{
- Parameters: *params,
- username: user,
- password: password,
- url: endpoint.url(),
- http: Http_post,
- useHTTPS: endpoint.HTTPS,
- transport: transport,
- }
-
- if params.TransportDecorator != nil {
- client.transport = params.TransportDecorator(transport)
- }
- return
-}
-
-// newTransport will create a new HTTP Transport, with options specified within the endpoint configuration
-func newTransport(endpoint *Endpoint) (*http.Transport, error) {
- transport := &http.Transport{
- TLSClientConfig: &tls.Config{
- InsecureSkipVerify: endpoint.Insecure,
- },
- }
-
- if endpoint.CACert != nil && len(*endpoint.CACert) > 0 {
- certPool, err := readCACerts(endpoint.CACert)
- if err != nil {
- return nil, err
- }
-
- transport.TLSClientConfig.RootCAs = certPool
- }
-
- return transport, nil
-}
-
-func readCACerts(certs *[]byte) (*x509.CertPool, error) {
- certPool := x509.NewCertPool()
-
- if !certPool.AppendCertsFromPEM(*certs) {
- return nil, fmt.Errorf("Unable to read certificates")
- }
-
- return certPool, nil
-}
-
-// CreateShell will create a WinRM Shell, which is the prealable for running
-// commands.
-func (client *Client) CreateShell() (shell *Shell, err error) {
- request := NewOpenShellRequest(client.url, &client.Parameters)
- defer request.Free()
-
- response, err := client.sendRequest(request)
- if err == nil {
- var shellId string
- if shellId, err = ParseOpenShellResponse(response); err == nil {
- shell = &Shell{client: client, ShellId: shellId}
- }
- }
- return
-}
-
-func (client *Client) sendRequest(request *soap.SoapMessage) (response string, err error) {
- return client.http(client, request)
-}
-
-// Run will run command on the the remote host, writing the process stdout and stderr to
-// the given writers. Note with this method it isn't possible to inject stdin.
-func (client *Client) Run(command string, stdout io.Writer, stderr io.Writer) (exitCode int, err error) {
- shell, err := client.CreateShell()
- if err != nil {
- return 0, err
- }
- var cmd *Command
- cmd, err = shell.Execute(command)
- if err != nil {
- return 0, err
- }
- go io.Copy(stdout, cmd.Stdout)
- go io.Copy(stderr, cmd.Stderr)
- cmd.Wait()
- shell.Close()
- return cmd.ExitCode(), cmd.err
-}
-
-// Run will run command on the the remote host, returning the process stdout and stderr
-// as strings, and using the input stdin string as the process input
-func (client *Client) RunWithString(command string, stdin string) (stdout string, stderr string, exitCode int, err error) {
- shell, err := client.CreateShell()
- if err != nil {
- return "", "", 0, err
- }
- defer shell.Close()
- var cmd *Command
- cmd, err = shell.Execute(command)
- if err != nil {
- return "", "", 0, err
- }
- if len(stdin) > 0 {
- cmd.Stdin.Write([]byte(stdin))
- }
- var outWriter, errWriter bytes.Buffer
- go io.Copy(&outWriter, cmd.Stdout)
- go io.Copy(&errWriter, cmd.Stderr)
- cmd.Wait()
- return outWriter.String(), errWriter.String(), cmd.ExitCode(), cmd.err
-}
-
-// Run will run command on the the remote host, writing the process stdout and stderr to
-// the given writers, and injecting the process stdin with the stdin reader.
-// Warning stdin (not stdout/stderr) are bufferized, which means reading only one byte in stdin will
-// send a winrm http packet to the remote host. If stdin is a pipe, it might be better for
-// performance reasons to buffer it.
-func (client *Client) RunWithInput(command string, stdout io.Writer, stderr io.Writer, stdin io.Reader) (exitCode int, err error) {
- shell, err := client.CreateShell()
- if err != nil {
- return 0, err
- }
- defer shell.Close()
- var cmd *Command
- cmd, err = shell.Execute(command)
- if err != nil {
- return 0, err
- }
- go io.Copy(cmd.Stdin, stdin)
- go io.Copy(stdout, cmd.Stdout)
- go io.Copy(stderr, cmd.Stderr)
- cmd.Wait()
- return cmd.ExitCode(), cmd.err
-}
diff --git a/vendor/github.com/masterzen/winrm/winrm/command.go b/vendor/github.com/masterzen/winrm/winrm/command.go
deleted file mode 100644
index d8c4a7d3..00000000
--- a/vendor/github.com/masterzen/winrm/winrm/command.go
+++ /dev/null
@@ -1,210 +0,0 @@
-package winrm
-
-import (
- "bytes"
- "errors"
- "io"
- "strings"
-)
-
-type commandWriter struct {
- *Command
- eof bool
-}
-
-type commandReader struct {
- *Command
- write *io.PipeWriter
- read *io.PipeReader
- stream string
-}
-
-// Command represents a given command running on a Shell. This structure allows to get access
-// to the various stdout, stderr and stdin pipes.
-type Command struct {
- client *Client
- shell *Shell
- commandId string
- exitCode int
- finished bool
- err error
-
- Stdin *commandWriter
- Stdout *commandReader
- Stderr *commandReader
-
- done chan struct{}
- cancel chan struct{}
-}
-
-func newCommand(shell *Shell, commandId string) *Command {
- command := &Command{shell: shell, client: shell.client, commandId: commandId, exitCode: 1, err: nil, done: make(chan struct{}), cancel: make(chan struct{})}
- command.Stdin = &commandWriter{Command: command, eof: false}
- command.Stdout = newCommandReader("stdout", command)
- command.Stderr = newCommandReader("stderr", command)
-
- go fetchOutput(command)
-
- return command
-}
-
-func newCommandReader(stream string, command *Command) *commandReader {
- read, write := io.Pipe()
- return &commandReader{Command: command, stream: stream, write: write, read: read}
-}
-
-func fetchOutput(command *Command) {
- for {
- select {
- case <-command.cancel:
- close(command.done)
- return
- default:
- finished, err := command.slurpAllOutput()
- if finished {
- command.err = err
- close(command.done)
- return
- }
- }
- }
-}
-
-func (command *Command) check() (err error) {
- if command.commandId == "" {
- return errors.New("Command has already been closed")
- }
- if command.shell == nil {
- return errors.New("Command has no associated shell")
- }
- if command.client == nil {
- return errors.New("Command has no associated client")
- }
- return
-}
-
-// Close will terminate the running command
-func (command *Command) Close() (err error) {
- if err = command.check(); err != nil {
- return err
- }
-
- select { // close cancel channel if it's still open
- case <-command.cancel:
- default:
- close(command.cancel)
- }
-
- request := NewSignalRequest(command.client.url, command.shell.ShellId, command.commandId, &command.client.Parameters)
- defer request.Free()
-
- _, err = command.client.sendRequest(request)
- return err
-}
-
-func (command *Command) slurpAllOutput() (finished bool, err error) {
- if err = command.check(); err != nil {
- command.Stderr.write.CloseWithError(err)
- command.Stdout.write.CloseWithError(err)
- return true, err
- }
-
- request := NewGetOutputRequest(command.client.url, command.shell.ShellId, command.commandId, "stdout stderr", &command.client.Parameters)
- defer request.Free()
-
- response, err := command.client.sendRequest(request)
- if err != nil {
- if strings.Contains(err.Error(), "OperationTimeout") {
- // Operation timeout because there was no command output
- return
- }
-
- command.Stderr.write.CloseWithError(err)
- command.Stdout.write.CloseWithError(err)
- return true, err
- }
-
- var exitCode int
- var stdout, stderr bytes.Buffer
- finished, exitCode, err = ParseSlurpOutputErrResponse(response, &stdout, &stderr)
- if err != nil {
- command.Stderr.write.CloseWithError(err)
- command.Stdout.write.CloseWithError(err)
- return true, err
- }
- if stdout.Len() > 0 {
- command.Stdout.write.Write(stdout.Bytes())
- }
- if stderr.Len() > 0 {
- command.Stderr.write.Write(stderr.Bytes())
- }
- if finished {
- command.exitCode = exitCode
- command.Stderr.write.Close()
- command.Stdout.write.Close()
- }
-
- return
-}
-
-func (command *Command) sendInput(data []byte) (err error) {
- if err = command.check(); err != nil {
- return err
- }
-
- request := NewSendInputRequest(command.client.url, command.shell.ShellId, command.commandId, data, &command.client.Parameters)
- defer request.Free()
-
- _, err = command.client.sendRequest(request)
- return
-}
-
-// ExitCode returns command exit code when it is finished. Before that the result is always 0.
-func (command *Command) ExitCode() int {
- return command.exitCode
-}
-
-// Calling this function will block the current goroutine until the remote command terminates.
-func (command *Command) Wait() {
- // block until finished
- <-command.done
-}
-
-// Write data to this Pipe
-func (w *commandWriter) Write(data []byte) (written int, err error) {
- for len(data) > 0 {
- if w.eof {
- err = io.EOF
- return
- }
- // never send more data than our EnvelopeSize.
- n := min(w.client.Parameters.EnvelopeSize-1000, len(data))
- if err = w.sendInput(data[:n]); err != nil {
- break
- }
- data = data[n:]
- written += int(n)
- }
- return
-}
-
-func min(a int, b int) int {
- if a < b {
- return a
- }
- return b
-}
-
-func (w *commandWriter) Close() error {
- w.eof = true
- return w.Close()
-}
-
-// Read data from this Pipe
-func (r *commandReader) Read(buf []byte) (int, error) {
- n, err := r.read.Read(buf)
- if err != nil && err != io.EOF {
- return 0, err
- }
- return n, err
-}
diff --git a/vendor/github.com/masterzen/winrm/winrm/endpoint.go b/vendor/github.com/masterzen/winrm/winrm/endpoint.go
deleted file mode 100644
index 93e255d5..00000000
--- a/vendor/github.com/masterzen/winrm/winrm/endpoint.go
+++ /dev/null
@@ -1,22 +0,0 @@
-package winrm
-
-import "fmt"
-
-type Endpoint struct {
- Host string
- Port int
- HTTPS bool
- Insecure bool
- CACert *[]byte
-}
-
-func (ep *Endpoint) url() string {
- var scheme string
- if ep.HTTPS {
- scheme = "https"
- } else {
- scheme = "http"
- }
-
- return fmt.Sprintf("%s://%s:%d/wsman", scheme, ep.Host, ep.Port)
-}
diff --git a/vendor/github.com/masterzen/winrm/winrm/http.go b/vendor/github.com/masterzen/winrm/winrm/http.go
deleted file mode 100644
index 7e191e36..00000000
--- a/vendor/github.com/masterzen/winrm/winrm/http.go
+++ /dev/null
@@ -1,60 +0,0 @@
-package winrm
-
-import (
- "fmt"
- "io/ioutil"
- "net/http"
- "strings"
-
- "github.com/masterzen/winrm/soap"
-)
-
-var soapXML string = "application/soap+xml"
-
-type HttpPost func(*Client, *soap.SoapMessage) (string, error)
-
-func body(response *http.Response) (content string, err error) {
- contentType := response.Header.Get("Content-Type")
- if strings.HasPrefix(contentType, soapXML) {
- var body []byte
- body, err = ioutil.ReadAll(response.Body)
- response.Body.Close()
- if err != nil {
- err = fmt.Errorf("error while reading request body %s", err)
- return
- }
-
- content = string(body)
- return
- } else {
- err = fmt.Errorf("invalid content-type: %s", contentType)
- return
- }
- return
-}
-
-func Http_post(client *Client, request *soap.SoapMessage) (response string, err error) {
- httpClient := &http.Client{Transport: client.transport}
-
- req, err := http.NewRequest("POST", client.url, strings.NewReader(request.String()))
- if err != nil {
- err = fmt.Errorf("impossible to create http request %s", err)
- return
- }
- req.Header.Set("Content-Type", soapXML+";charset=UTF-8")
- req.SetBasicAuth(client.username, client.password)
- resp, err := httpClient.Do(req)
- if err != nil {
- err = fmt.Errorf("unknown error %s", err)
- return
- }
-
- if resp.StatusCode == 200 {
- response, err = body(resp)
- } else {
- body, _ := ioutil.ReadAll(resp.Body)
- err = fmt.Errorf("http error: %d - %s", resp.StatusCode, body)
- }
-
- return
-}
diff --git a/vendor/github.com/masterzen/winrm/winrm/parameters.go b/vendor/github.com/masterzen/winrm/winrm/parameters.go
deleted file mode 100644
index 099863b4..00000000
--- a/vendor/github.com/masterzen/winrm/winrm/parameters.go
+++ /dev/null
@@ -1,20 +0,0 @@
-package winrm
-
-import (
- "net/http"
-)
-
-type Parameters struct {
- Timeout string
- Locale string
- EnvelopeSize int
- TransportDecorator func(*http.Transport) http.RoundTripper
-}
-
-func DefaultParameters() *Parameters {
- return NewParameters("PT60S", "en-US", 153600)
-}
-
-func NewParameters(timeout string, locale string, envelopeSize int) *Parameters {
- return &Parameters{Timeout: timeout, Locale: locale, EnvelopeSize: envelopeSize}
-}
diff --git a/vendor/github.com/masterzen/winrm/winrm/powershell.go b/vendor/github.com/masterzen/winrm/winrm/powershell.go
deleted file mode 100644
index 5544bc69..00000000
--- a/vendor/github.com/masterzen/winrm/winrm/powershell.go
+++ /dev/null
@@ -1,22 +0,0 @@
-package winrm
-
-import (
- "encoding/base64"
- "fmt"
-)
-
-// Wraps a PowerShell script and prepares it for execution by the winrm client
-func Powershell(psCmd string) string {
- // 2 byte chars to make PowerShell happy
- wideCmd := ""
- for _, b := range []byte(psCmd) {
- wideCmd += string(b) + "\x00"
- }
-
- // Base64 encode the command
- input := []uint8(wideCmd)
- encodedCmd := base64.StdEncoding.EncodeToString(input)
-
- // Create the powershell.exe command line to execute the script
- return fmt.Sprintf("powershell.exe -EncodedCommand %s", encodedCmd)
-}
diff --git a/vendor/github.com/masterzen/winrm/winrm/request.go b/vendor/github.com/masterzen/winrm/winrm/request.go
deleted file mode 100644
index f9ad8285..00000000
--- a/vendor/github.com/masterzen/winrm/winrm/request.go
+++ /dev/null
@@ -1,116 +0,0 @@
-package winrm
-
-import (
- "encoding/base64"
-
- "github.com/masterzen/winrm/soap"
- "github.com/nu7hatch/gouuid"
-)
-
-func genUUID() string {
- uuid, _ := uuid.NewV4()
- return "uuid:" + uuid.String()
-}
-
-func defaultHeaders(message *soap.SoapMessage, url string, params *Parameters) (h *soap.SoapHeader) {
- h = message.Header()
- h.To(url).ReplyTo("http://schemas.xmlsoap.org/ws/2004/08/addressing/role/anonymous").MaxEnvelopeSize(params.EnvelopeSize).Id(genUUID()).Locale(params.Locale).Timeout(params.Timeout)
- return
-}
-
-func NewOpenShellRequest(uri string, params *Parameters) (message *soap.SoapMessage) {
- if params == nil {
- params = DefaultParameters()
- }
- message = soap.NewMessage()
- defaultHeaders(message, uri, params).Action("http://schemas.xmlsoap.org/ws/2004/09/transfer/Create").ResourceURI("http://schemas.microsoft.com/wbem/wsman/1/windows/shell/cmd").AddOption(soap.NewHeaderOption("WINRS_NOPROFILE", "FALSE")).AddOption(soap.NewHeaderOption("WINRS_CODEPAGE", "65001")).Build()
-
- body := message.CreateBodyElement("Shell", soap.NS_WIN_SHELL)
- input := message.CreateElement(body, "InputStreams", soap.NS_WIN_SHELL)
- input.SetContent("stdin")
- output := message.CreateElement(body, "OutputStreams", soap.NS_WIN_SHELL)
- output.SetContent("stdout stderr")
- return
-}
-
-func NewDeleteShellRequest(uri string, shellId string, params *Parameters) (message *soap.SoapMessage) {
- if params == nil {
- params = DefaultParameters()
- }
- message = soap.NewMessage()
- defaultHeaders(message, uri, params).Action("http://schemas.xmlsoap.org/ws/2004/09/transfer/Delete").ShellId(shellId).ResourceURI("http://schemas.microsoft.com/wbem/wsman/1/windows/shell/cmd").Build()
-
- message.NewBody()
-
- return
-}
-
-func NewExecuteCommandRequest(uri, shellId, command string, arguments []string, params *Parameters) (message *soap.SoapMessage) {
- if params == nil {
- params = DefaultParameters()
- }
- message = soap.NewMessage()
- defaultHeaders(message, uri, params).Action("http://schemas.microsoft.com/wbem/wsman/1/windows/shell/Command").ResourceURI("http://schemas.microsoft.com/wbem/wsman/1/windows/shell/cmd").ShellId(shellId).AddOption(soap.NewHeaderOption("WINRS_CONSOLEMODE_STDIN", "TRUE")).AddOption(soap.NewHeaderOption("WINRS_SKIP_CMD_SHELL", "FALSE")).Build()
- body := message.CreateBodyElement("CommandLine", soap.NS_WIN_SHELL)
-
- // ensure special characters like & don't mangle the request XML
- command = ""
- commandElement := message.CreateElement(body, "Command", soap.NS_WIN_SHELL)
- commandElement.SetContent(command)
-
- for _, arg := range arguments {
- arg = ""
- argumentsElement := message.CreateElement(body, "Arguments", soap.NS_WIN_SHELL)
- argumentsElement.SetContent(arg)
- }
-
- return
-}
-
-func NewGetOutputRequest(uri string, shellId string, commandId string, streams string, params *Parameters) (message *soap.SoapMessage) {
- if params == nil {
- params = DefaultParameters()
- }
- message = soap.NewMessage()
- defaultHeaders(message, uri, params).Action("http://schemas.microsoft.com/wbem/wsman/1/windows/shell/Receive").ResourceURI("http://schemas.microsoft.com/wbem/wsman/1/windows/shell/cmd").ShellId(shellId).Build()
-
- receive := message.CreateBodyElement("Receive", soap.NS_WIN_SHELL)
- desiredStreams := message.CreateElement(receive, "DesiredStream", soap.NS_WIN_SHELL)
- desiredStreams.SetAttr("CommandId", commandId)
- desiredStreams.SetContent(streams)
- return
-}
-
-func NewSendInputRequest(uri string, shellId string, commandId string, input []byte, params *Parameters) (message *soap.SoapMessage) {
- if params == nil {
- params = DefaultParameters()
- }
- message = soap.NewMessage()
-
- defaultHeaders(message, uri, params).Action("http://schemas.microsoft.com/wbem/wsman/1/windows/shell/Send").ResourceURI("http://schemas.microsoft.com/wbem/wsman/1/windows/shell/cmd").ShellId(shellId).Build()
-
- content := base64.StdEncoding.EncodeToString(input)
-
- send := message.CreateBodyElement("Send", soap.NS_WIN_SHELL)
- streams := message.CreateElement(send, "Stream", soap.NS_WIN_SHELL)
- streams.SetAttr("Name", "stdin")
- streams.SetAttr("CommandId", commandId)
- streams.SetContent(content)
- return
-}
-
-func NewSignalRequest(uri string, shellId string, commandId string, params *Parameters) (message *soap.SoapMessage) {
- if params == nil {
- params = DefaultParameters()
- }
- message = soap.NewMessage()
-
- defaultHeaders(message, uri, params).Action("http://schemas.microsoft.com/wbem/wsman/1/windows/shell/Signal").ResourceURI("http://schemas.microsoft.com/wbem/wsman/1/windows/shell/cmd").ShellId(shellId).Build()
-
- signal := message.CreateBodyElement("Signal", soap.NS_WIN_SHELL)
- signal.SetAttr("CommandId", commandId)
- code := message.CreateElement(signal, "Code", soap.NS_WIN_SHELL)
- code.SetContent("http://schemas.microsoft.com/wbem/wsman/1/windows/shell/signal/terminate")
-
- return
-}
diff --git a/vendor/github.com/masterzen/winrm/winrm/response.go b/vendor/github.com/masterzen/winrm/winrm/response.go
deleted file mode 100644
index ea02a87a..00000000
--- a/vendor/github.com/masterzen/winrm/winrm/response.go
+++ /dev/null
@@ -1,111 +0,0 @@
-package winrm
-
-import (
- "encoding/base64"
- "fmt"
- "github.com/masterzen/winrm/soap"
- "github.com/masterzen/xmlpath"
- "io"
- "strconv"
- "strings"
-)
-
-func first(node *xmlpath.Node, xpath string) (content string, err error) {
- path, err := xmlpath.CompileWithNamespace(xpath, soap.GetAllNamespaces())
- if err != nil {
- return
- }
- content, _ = path.String(node)
- return
-}
-
-func any(node *xmlpath.Node, xpath string) (found bool, err error) {
- path, err := xmlpath.CompileWithNamespace(xpath, soap.GetAllNamespaces())
- if err != nil {
- return
- }
-
- found = path.Exists(node)
- return
-}
-
-func xpath(node *xmlpath.Node, xpath string) (nodes []xmlpath.Node, err error) {
- path, err := xmlpath.CompileWithNamespace(xpath, soap.GetAllNamespaces())
- if err != nil {
- return
- }
-
- nodes = make([]xmlpath.Node, 0, 1)
- iter := path.Iter(node)
- for iter.Next() {
- nodes = append(nodes, *(iter.Node()))
- }
- return
-}
-
-func ParseOpenShellResponse(response string) (shellId string, err error) {
- doc, err := xmlpath.Parse(strings.NewReader(response))
-
- shellId, err = first(doc, "//w:Selector[@Name='ShellId']")
- return
-}
-
-func ParseExecuteCommandResponse(response string) (commandId string, err error) {
- doc, err := xmlpath.Parse(strings.NewReader(response))
-
- commandId, err = first(doc, "//rsp:CommandId")
- return
-}
-
-func ParseSlurpOutputErrResponse(response string, stdout io.Writer, stderr io.Writer) (finished bool, exitCode int, err error) {
- doc, err := xmlpath.Parse(strings.NewReader(response))
-
- stdouts, _ := xpath(doc, "//rsp:Stream[@Name='stdout']")
- for _, node := range stdouts {
- content, _ := base64.StdEncoding.DecodeString(node.String())
- stdout.Write(content)
- }
- stderrs, _ := xpath(doc, "//rsp:Stream[@Name='stderr']")
- for _, node := range stderrs {
- content, _ := base64.StdEncoding.DecodeString(node.String())
- stderr.Write(content)
- }
-
- ended, _ := any(doc, "//*[@State='http://schemas.microsoft.com/wbem/wsman/1/windows/shell/CommandState/Done']")
-
- if ended {
- finished = ended
- if exitBool, _ := any(doc, "//rsp:ExitCode"); exitBool {
- exit, _ := first(doc, "//rsp:ExitCode")
- exitCode, _ = strconv.Atoi(exit)
- }
- } else {
- finished = false
- }
-
- return
-}
-
-func ParseSlurpOutputResponse(response string, stream io.Writer, streamType string) (finished bool, exitCode int, err error) {
- doc, err := xmlpath.Parse(strings.NewReader(response))
-
- nodes, _ := xpath(doc, fmt.Sprintf("//rsp:Stream[@Name='%s']", streamType))
- for _, node := range nodes {
- content, _ := base64.StdEncoding.DecodeString(node.String())
- stream.Write(content)
- }
-
- ended, _ := any(doc, "//*[@State='http://schemas.microsoft.com/wbem/wsman/1/windows/shell/CommandState/Done']")
-
- if ended {
- finished = ended
- if exitBool, _ := any(doc, "//rsp:ExitCode"); exitBool {
- exit, _ := first(doc, "//rsp:ExitCode")
- exitCode, _ = strconv.Atoi(exit)
- }
- } else {
- finished = false
- }
-
- return
-}
diff --git a/vendor/github.com/masterzen/winrm/winrm/shell.go b/vendor/github.com/masterzen/winrm/winrm/shell.go
deleted file mode 100644
index a1451828..00000000
--- a/vendor/github.com/masterzen/winrm/winrm/shell.go
+++ /dev/null
@@ -1,31 +0,0 @@
-package winrm
-
-// Shell is the local view of a WinRM Shell of a given Client
-type Shell struct {
- client *Client
- ShellId string
-}
-
-// Execute command on the given Shell, returning either an error or a Command
-func (shell *Shell) Execute(command string, arguments ...string) (cmd *Command, err error) {
- request := NewExecuteCommandRequest(shell.client.url, shell.ShellId, command, arguments, &shell.client.Parameters)
- defer request.Free()
-
- response, err := shell.client.sendRequest(request)
- if err == nil {
- var commandId string
- if commandId, err = ParseExecuteCommandResponse(response); err == nil {
- cmd = newCommand(shell, commandId)
- }
- }
- return
-}
-
-// Close will terminate this shell. No commands can be issued once the shell is closed.
-func (shell *Shell) Close() (err error) {
- request := NewDeleteShellRequest(shell.client.url, shell.ShellId, &shell.client.Parameters)
- defer request.Free()
-
- _, err = shell.client.sendRequest(request)
- return
-}
diff --git a/vendor/github.com/masterzen/xmlpath/LICENSE b/vendor/github.com/masterzen/xmlpath/LICENSE
deleted file mode 100644
index 53320c35..00000000
--- a/vendor/github.com/masterzen/xmlpath/LICENSE
+++ /dev/null
@@ -1,185 +0,0 @@
-This software is licensed under the LGPLv3, included below.
-
-As a special exception to the GNU Lesser General Public License version 3
-("LGPL3"), the copyright holders of this Library give you permission to
-convey to a third party a Combined Work that links statically or dynamically
-to this Library without providing any Minimal Corresponding Source or
-Minimal Application Code as set out in 4d or providing the installation
-information set out in section 4e, provided that you comply with the other
-provisions of LGPL3 and provided that you meet, for the Application the
-terms and conditions of the license(s) which apply to the Application.
-
-Except as stated in this special exception, the provisions of LGPL3 will
-continue to comply in full to this Library. If you modify this Library, you
-may apply this exception to your version of this Library, but you are not
-obliged to do so. If you do not wish to do so, delete this exception
-statement from your version. This exception does not (and cannot) modify any
-license terms which apply to the Application, with which you must still
-comply.
-
-
- GNU LESSER GENERAL PUBLIC LICENSE
- Version 3, 29 June 2007
-
- Copyright (C) 2007 Free Software Foundation, Inc.
- Everyone is permitted to copy and distribute verbatim copies
- of this license document, but changing it is not allowed.
-
-
- This version of the GNU Lesser General Public License incorporates
-the terms and conditions of version 3 of the GNU General Public
-License, supplemented by the additional permissions listed below.
-
- 0. Additional Definitions.
-
- As used herein, "this License" refers to version 3 of the GNU Lesser
-General Public License, and the "GNU GPL" refers to version 3 of the GNU
-General Public License.
-
- "The Library" refers to a covered work governed by this License,
-other than an Application or a Combined Work as defined below.
-
- An "Application" is any work that makes use of an interface provided
-by the Library, but which is not otherwise based on the Library.
-Defining a subclass of a class defined by the Library is deemed a mode
-of using an interface provided by the Library.
-
- A "Combined Work" is a work produced by combining or linking an
-Application with the Library. The particular version of the Library
-with which the Combined Work was made is also called the "Linked
-Version".
-
- The "Minimal Corresponding Source" for a Combined Work means the
-Corresponding Source for the Combined Work, excluding any source code
-for portions of the Combined Work that, considered in isolation, are
-based on the Application, and not on the Linked Version.
-
- The "Corresponding Application Code" for a Combined Work means the
-object code and/or source code for the Application, including any data
-and utility programs needed for reproducing the Combined Work from the
-Application, but excluding the System Libraries of the Combined Work.
-
- 1. Exception to Section 3 of the GNU GPL.
-
- You may convey a covered work under sections 3 and 4 of this License
-without being bound by section 3 of the GNU GPL.
-
- 2. Conveying Modified Versions.
-
- If you modify a copy of the Library, and, in your modifications, a
-facility refers to a function or data to be supplied by an Application
-that uses the facility (other than as an argument passed when the
-facility is invoked), then you may convey a copy of the modified
-version:
-
- a) under this License, provided that you make a good faith effort to
- ensure that, in the event an Application does not supply the
- function or data, the facility still operates, and performs
- whatever part of its purpose remains meaningful, or
-
- b) under the GNU GPL, with none of the additional permissions of
- this License applicable to that copy.
-
- 3. Object Code Incorporating Material from Library Header Files.
-
- The object code form of an Application may incorporate material from
-a header file that is part of the Library. You may convey such object
-code under terms of your choice, provided that, if the incorporated
-material is not limited to numerical parameters, data structure
-layouts and accessors, or small macros, inline functions and templates
-(ten or fewer lines in length), you do both of the following:
-
- a) Give prominent notice with each copy of the object code that the
- Library is used in it and that the Library and its use are
- covered by this License.
-
- b) Accompany the object code with a copy of the GNU GPL and this license
- document.
-
- 4. Combined Works.
-
- You may convey a Combined Work under terms of your choice that,
-taken together, effectively do not restrict modification of the
-portions of the Library contained in the Combined Work and reverse
-engineering for debugging such modifications, if you also do each of
-the following:
-
- a) Give prominent notice with each copy of the Combined Work that
- the Library is used in it and that the Library and its use are
- covered by this License.
-
- b) Accompany the Combined Work with a copy of the GNU GPL and this license
- document.
-
- c) For a Combined Work that displays copyright notices during
- execution, include the copyright notice for the Library among
- these notices, as well as a reference directing the user to the
- copies of the GNU GPL and this license document.
-
- d) Do one of the following:
-
- 0) Convey the Minimal Corresponding Source under the terms of this
- License, and the Corresponding Application Code in a form
- suitable for, and under terms that permit, the user to
- recombine or relink the Application with a modified version of
- the Linked Version to produce a modified Combined Work, in the
- manner specified by section 6 of the GNU GPL for conveying
- Corresponding Source.
-
- 1) Use a suitable shared library mechanism for linking with the
- Library. A suitable mechanism is one that (a) uses at run time
- a copy of the Library already present on the user's computer
- system, and (b) will operate properly with a modified version
- of the Library that is interface-compatible with the Linked
- Version.
-
- e) Provide Installation Information, but only if you would otherwise
- be required to provide such information under section 6 of the
- GNU GPL, and only to the extent that such information is
- necessary to install and execute a modified version of the
- Combined Work produced by recombining or relinking the
- Application with a modified version of the Linked Version. (If
- you use option 4d0, the Installation Information must accompany
- the Minimal Corresponding Source and Corresponding Application
- Code. If you use option 4d1, you must provide the Installation
- Information in the manner specified by section 6 of the GNU GPL
- for conveying Corresponding Source.)
-
- 5. Combined Libraries.
-
- You may place library facilities that are a work based on the
-Library side by side in a single library together with other library
-facilities that are not Applications and are not covered by this
-License, and convey such a combined library under terms of your
-choice, if you do both of the following:
-
- a) Accompany the combined library with a copy of the same work based
- on the Library, uncombined with any other library facilities,
- conveyed under the terms of this License.
-
- b) Give prominent notice with the combined library that part of it
- is a work based on the Library, and explaining where to find the
- accompanying uncombined form of the same work.
-
- 6. Revised Versions of the GNU Lesser General Public License.
-
- The Free Software Foundation may publish revised and/or new versions
-of the GNU Lesser General Public License from time to time. Such new
-versions will be similar in spirit to the present version, but may
-differ in detail to address new problems or concerns.
-
- Each version is given a distinguishing version number. If the
-Library as you received it specifies that a certain numbered version
-of the GNU Lesser General Public License "or any later version"
-applies to it, you have the option of following the terms and
-conditions either of that published version or of any later version
-published by the Free Software Foundation. If the Library as you
-received it does not specify a version number of the GNU Lesser
-General Public License, you may choose any version of the GNU Lesser
-General Public License ever published by the Free Software Foundation.
-
- If the Library as you received it specifies that a proxy can decide
-whether future versions of the GNU Lesser General Public License shall
-apply, that proxy's public statement of acceptance of any version is
-permanent authorization for you to choose that version for the
-Library.
diff --git a/vendor/github.com/masterzen/xmlpath/doc.go b/vendor/github.com/masterzen/xmlpath/doc.go
deleted file mode 100644
index 4d3dfc0b..00000000
--- a/vendor/github.com/masterzen/xmlpath/doc.go
+++ /dev/null
@@ -1,95 +0,0 @@
-// Package xmlpath implements a strict subset of the XPath specification for the Go language.
-//
-// The XPath specification is available at:
-//
-// http://www.w3.org/TR/xpath
-//
-// Path expressions supported by this package are in the following format,
-// with all components being optional:
-//
-// /axis-name::node-test[predicate]/axis-name::node-test[predicate]
-//
-// At the moment, xmlpath is compatible with the XPath specification
-// to the following extent:
-//
-// - All axes are supported ("child", "following-sibling", etc)
-// - All abbreviated forms are supported (".", "//", etc)
-// - All node types except for namespace are supported
-// - Predicates are restricted to [N], [path], and [path=literal] forms
-// - Only a single predicate is supported per path step
-// - Namespaces are experimentally supported
-// - Richer expressions
-//
-// For example, assuming the following document:
-//
-//
-//
-//
-// 0836217462
-// Being a Dog Is a Full-Time Job
-// I'd dog paddle the deepest ocean.
-//
-//
-// Charles M Schulz
-// 1922-11-26
-// 2000-02-12
-//
-//
-// Peppermint Patty
-// 1966-08-22
-// bold, brash and tomboyish
-//
-//
-// Snoopy
-// 1950-10-04
-// extroverted beagle
-//
-//
-//
-//
-// The following examples are valid path expressions, and the first
-// match has the indicated value:
-//
-// /library/book/isbn => "0836217462"
-// library/*/isbn => "0836217462"
-// /library/book/../book/./isbn => "0836217462"
-// /library/book/character[2]/name => "Snoopy"
-// /library/book/character[born='1950-10-04']/name => "Snoopy"
-// /library/book//node()[@id='PP']/name => "Peppermint Patty"
-// //book[author/@id='CMS']/title => "Being a Dog Is a Full-Time Job"},
-// /library/book/preceding::comment() => " Great book. "
-//
-// To run an expression, compile it, and then apply the compiled path to any
-// number of context nodes, from one or more parsed xml documents:
-//
-// path := xmlpath.MustCompile("/library/book/isbn")
-// root, err := xmlpath.Parse(file)
-// if err != nil {
-// log.Fatal(err)
-// }
-// if value, ok := path.String(root); ok {
-// fmt.Println("Found:", value)
-// }
-//
-// To use xmlpath with namespaces, it is required to give the supported set of namespace
-// when compiling:
-//
-//
-// var namespaces = []xmlpath.Namespace {
-// { "s", "http://www.w3.org/2003/05/soap-envelope" },
-// { "a", "http://schemas.xmlsoap.org/ws/2004/08/addressing" },
-// }
-// path, err := xmlpath.CompileWithNamespace("/s:Header/a:To", namespaces)
-// if err != nil {
-// log.Fatal(err)
-// }
-// root, err := xmlpath.Parse(file)
-// if err != nil {
-// log.Fatal(err)
-// }
-// if value, ok := path.String(root); ok {
-// fmt.Println("Found:", value)
-// }
-//
-
-package xmlpath
diff --git a/vendor/github.com/masterzen/xmlpath/parser.go b/vendor/github.com/masterzen/xmlpath/parser.go
deleted file mode 100644
index 88c1523a..00000000
--- a/vendor/github.com/masterzen/xmlpath/parser.go
+++ /dev/null
@@ -1,233 +0,0 @@
-package xmlpath
-
-import (
- "encoding/xml"
- "io"
-)
-
-// Node is an item in an xml tree that was compiled to
-// be processed via xml paths. A node may represent:
-//
-// - An element in the xml document ()
-// - An attribute of an element in the xml document (href="...")
-// - A comment in the xml document ()
-// - A processing instruction in the xml document (...?>)
-// - Some text within the xml document
-//
-type Node struct {
- kind nodeKind
- name xml.Name
- attr string
- text []byte
-
- nodes []Node
- pos int
- end int
-
- up *Node
- down []*Node
-}
-
-type nodeKind int
-
-const (
- anyNode nodeKind = iota
- startNode
- endNode
- attrNode
- textNode
- commentNode
- procInstNode
-)
-
-// String returns the string value of node.
-//
-// The string value of a node is:
-//
-// - For element nodes, the concatenation of all text nodes within the element.
-// - For text nodes, the text itself.
-// - For attribute nodes, the attribute value.
-// - For comment nodes, the text within the comment delimiters.
-// - For processing instruction nodes, the content of the instruction.
-//
-func (node *Node) String() string {
- if node.kind == attrNode {
- return node.attr
- }
- return string(node.Bytes())
-}
-
-// Bytes returns the string value of node as a byte slice.
-// See Node.String for a description of what the string value of a node is.
-func (node *Node) Bytes() []byte {
- if node.kind == attrNode {
- return []byte(node.attr)
- }
- if node.kind != startNode {
- return node.text
- }
- var text []byte
- for i := node.pos; i < node.end; i++ {
- if node.nodes[i].kind == textNode {
- text = append(text, node.nodes[i].text...)
- }
- }
- return text
-}
-
-// equals returns whether the string value of node is equal to s,
-// without allocating memory.
-func (node *Node) equals(s string) bool {
- if node.kind == attrNode {
- return s == node.attr
- }
- if node.kind != startNode {
- if len(s) != len(node.text) {
- return false
- }
- for i := range s {
- if s[i] != node.text[i] {
- return false
- }
- }
- return true
- }
- si := 0
- for i := node.pos; i < node.end; i++ {
- if node.nodes[i].kind == textNode {
- for _, c := range node.nodes[i].text {
- if si > len(s) {
- return false
- }
- if s[si] != c {
- return false
- }
- si++
- }
- }
- }
- return si == len(s)
-}
-
-// Parse reads an xml document from r, parses it, and returns its root node.
-func Parse(r io.Reader) (*Node, error) {
- return ParseDecoder(xml.NewDecoder(r))
-}
-
-// ParseHTML reads an HTML-like document from r, parses it, and returns
-// its root node.
-func ParseHTML(r io.Reader) (*Node, error) {
- d := xml.NewDecoder(r)
- d.Strict = false
- d.AutoClose = xml.HTMLAutoClose
- d.Entity = xml.HTMLEntity
- return ParseDecoder(d)
-}
-
-// ParseDecoder parses the xml document being decoded by d and returns
-// its root node.
-func ParseDecoder(d *xml.Decoder) (*Node, error) {
- var nodes []Node
- var text []byte
-
- // The root node.
- nodes = append(nodes, Node{kind: startNode})
-
- for {
- t, err := d.Token()
- if err == io.EOF {
- break
- }
- if err != nil {
- return nil, err
- }
- switch t := t.(type) {
- case xml.EndElement:
- nodes = append(nodes, Node{
- kind: endNode,
- })
- case xml.StartElement:
- nodes = append(nodes, Node{
- kind: startNode,
- name: t.Name,
- })
- for _, attr := range t.Attr {
- nodes = append(nodes, Node{
- kind: attrNode,
- name: attr.Name,
- attr: attr.Value,
- })
- }
- case xml.CharData:
- texti := len(text)
- text = append(text, t...)
- nodes = append(nodes, Node{
- kind: textNode,
- text: text[texti : texti+len(t)],
- })
- case xml.Comment:
- texti := len(text)
- text = append(text, t...)
- nodes = append(nodes, Node{
- kind: commentNode,
- text: text[texti : texti+len(t)],
- })
- case xml.ProcInst:
- texti := len(text)
- text = append(text, t.Inst...)
- nodes = append(nodes, Node{
- kind: procInstNode,
- name: xml.Name{Local: t.Target},
- text: text[texti : texti+len(t.Inst)],
- })
- }
- }
-
- // Close the root node.
- nodes = append(nodes, Node{kind: endNode})
-
- stack := make([]*Node, 0, len(nodes))
- downs := make([]*Node, len(nodes))
- downCount := 0
-
- for pos := range nodes {
-
- switch nodes[pos].kind {
-
- case startNode, attrNode, textNode, commentNode, procInstNode:
- node := &nodes[pos]
- node.nodes = nodes
- node.pos = pos
- if len(stack) > 0 {
- node.up = stack[len(stack)-1]
- }
- if node.kind == startNode {
- stack = append(stack, node)
- } else {
- node.end = pos + 1
- }
-
- case endNode:
- node := stack[len(stack)-1]
- node.end = pos
- stack = stack[:len(stack)-1]
-
- // Compute downs. Doing that here is what enables the
- // use of a slice of a contiguous pre-allocated block.
- node.down = downs[downCount:downCount]
- for i := node.pos + 1; i < node.end; i++ {
- if nodes[i].up == node {
- switch nodes[i].kind {
- case startNode, textNode, commentNode, procInstNode:
- node.down = append(node.down, &nodes[i])
- downCount++
- }
- }
- }
- if len(stack) == 0 {
- return node, nil
- }
- }
- }
- return nil, io.EOF
-}
diff --git a/vendor/github.com/masterzen/xmlpath/path.go b/vendor/github.com/masterzen/xmlpath/path.go
deleted file mode 100644
index 80aa70e9..00000000
--- a/vendor/github.com/masterzen/xmlpath/path.go
+++ /dev/null
@@ -1,642 +0,0 @@
-package xmlpath
-
-import (
- "fmt"
- "strconv"
- "unicode/utf8"
-)
-
-// Namespace represents a given XML Namespace
-type Namespace struct {
- Prefix string
- Uri string
-}
-
-// Path is a compiled path that can be applied to a context
-// node to obtain a matching node set.
-// A single Path can be applied concurrently to any number
-// of context nodes.
-type Path struct {
- path string
- steps []pathStep
-}
-
-// Iter returns an iterator that goes over the list of nodes
-// that p matches on the given context.
-func (p *Path) Iter(context *Node) *Iter {
- iter := Iter{
- make([]pathStepState, len(p.steps)),
- make([]bool, len(context.nodes)),
- }
- for i := range p.steps {
- iter.state[i].step = &p.steps[i]
- }
- iter.state[0].init(context)
- return &iter
-}
-
-// Exists returns whether any nodes match p on the given context.
-func (p *Path) Exists(context *Node) bool {
- return p.Iter(context).Next()
-}
-
-// String returns the string value of the first node matched
-// by p on the given context.
-//
-// See the documentation of Node.String.
-func (p *Path) String(context *Node) (s string, ok bool) {
- iter := p.Iter(context)
- if iter.Next() {
- return iter.Node().String(), true
- }
- return "", false
-}
-
-// Bytes returns as a byte slice the string value of the first
-// node matched by p on the given context.
-//
-// See the documentation of Node.String.
-func (p *Path) Bytes(node *Node) (b []byte, ok bool) {
- iter := p.Iter(node)
- if iter.Next() {
- return iter.Node().Bytes(), true
- }
- return nil, false
-}
-
-// Iter iterates over node sets.
-type Iter struct {
- state []pathStepState
- seen []bool
-}
-
-// Node returns the current node.
-// Must only be called after Iter.Next returns true.
-func (iter *Iter) Node() *Node {
- state := iter.state[len(iter.state)-1]
- if state.pos == 0 {
- panic("Iter.Node called before Iter.Next")
- }
- if state.node == nil {
- panic("Iter.Node called after Iter.Next false")
- }
- return state.node
-}
-
-// Next iterates to the next node in the set, if any, and
-// returns whether there is a node available.
-func (iter *Iter) Next() bool {
- tip := len(iter.state) - 1
-outer:
- for {
- for !iter.state[tip].next() {
- tip--
- if tip == -1 {
- return false
- }
- }
- for tip < len(iter.state)-1 {
- tip++
- iter.state[tip].init(iter.state[tip-1].node)
- if !iter.state[tip].next() {
- tip--
- continue outer
- }
- }
- if iter.seen[iter.state[tip].node.pos] {
- continue
- }
- iter.seen[iter.state[tip].node.pos] = true
- return true
- }
- panic("unreachable")
-}
-
-type pathStepState struct {
- step *pathStep
- node *Node
- pos int
- idx int
- aux int
-}
-
-func (s *pathStepState) init(node *Node) {
- s.node = node
- s.pos = 0
- s.idx = 0
- s.aux = 0
-}
-
-func (s *pathStepState) next() bool {
- for s._next() {
- s.pos++
- if s.step.pred == nil {
- return true
- }
- if s.step.pred.bval {
- if s.step.pred.path.Exists(s.node) {
- return true
- }
- } else if s.step.pred.path != nil {
- iter := s.step.pred.path.Iter(s.node)
- for iter.Next() {
- if iter.Node().equals(s.step.pred.sval) {
- return true
- }
- }
- } else {
- if s.step.pred.ival == s.pos {
- return true
- }
- }
- }
- return false
-}
-
-func (s *pathStepState) _next() bool {
- if s.node == nil {
- return false
- }
- if s.step.root && s.idx == 0 {
- for s.node.up != nil {
- s.node = s.node.up
- }
- }
-
- switch s.step.axis {
-
- case "self":
- if s.idx == 0 && s.step.match(s.node) {
- s.idx++
- return true
- }
-
- case "parent":
- if s.idx == 0 && s.node.up != nil && s.step.match(s.node.up) {
- s.idx++
- s.node = s.node.up
- return true
- }
-
- case "ancestor", "ancestor-or-self":
- if s.idx == 0 && s.step.axis == "ancestor-or-self" {
- s.idx++
- if s.step.match(s.node) {
- return true
- }
- }
- for s.node.up != nil {
- s.node = s.node.up
- s.idx++
- if s.step.match(s.node) {
- return true
- }
- }
-
- case "child":
- var down []*Node
- if s.idx == 0 {
- down = s.node.down
- } else {
- down = s.node.up.down
- }
- for s.idx < len(down) {
- node := down[s.idx]
- s.idx++
- if s.step.match(node) {
- s.node = node
- return true
- }
- }
-
- case "descendant", "descendant-or-self":
- if s.idx == 0 {
- s.idx = s.node.pos
- s.aux = s.node.end
- if s.step.axis == "descendant" {
- s.idx++
- }
- }
- for s.idx < s.aux {
- node := &s.node.nodes[s.idx]
- s.idx++
- if node.kind == attrNode {
- continue
- }
- if s.step.match(node) {
- s.node = node
- return true
- }
- }
-
- case "following":
- if s.idx == 0 {
- s.idx = s.node.end
- }
- for s.idx < len(s.node.nodes) {
- node := &s.node.nodes[s.idx]
- s.idx++
- if node.kind == attrNode {
- continue
- }
- if s.step.match(node) {
- s.node = node
- return true
- }
- }
-
- case "following-sibling":
- var down []*Node
- if s.node.up != nil {
- down = s.node.up.down
- if s.idx == 0 {
- for s.idx < len(down) {
- node := down[s.idx]
- s.idx++
- if node == s.node {
- break
- }
- }
- }
- }
- for s.idx < len(down) {
- node := down[s.idx]
- s.idx++
- if s.step.match(node) {
- s.node = node
- return true
- }
- }
-
- case "preceding":
- if s.idx == 0 {
- s.aux = s.node.pos // Detect ancestors.
- s.idx = s.node.pos - 1
- }
- for s.idx >= 0 {
- node := &s.node.nodes[s.idx]
- s.idx--
- if node.kind == attrNode {
- continue
- }
- if node == s.node.nodes[s.aux].up {
- s.aux = s.node.nodes[s.aux].up.pos
- continue
- }
- if s.step.match(node) {
- s.node = node
- return true
- }
- }
-
- case "preceding-sibling":
- var down []*Node
- if s.node.up != nil {
- down = s.node.up.down
- if s.aux == 0 {
- s.aux = 1
- for s.idx < len(down) {
- node := down[s.idx]
- s.idx++
- if node == s.node {
- s.idx--
- break
- }
- }
- }
- }
- for s.idx >= 0 {
- node := down[s.idx]
- s.idx--
- if s.step.match(node) {
- s.node = node
- return true
- }
- }
-
- case "attribute":
- if s.idx == 0 {
- s.idx = s.node.pos + 1
- s.aux = s.node.end
- }
- for s.idx < s.aux {
- node := &s.node.nodes[s.idx]
- s.idx++
- if node.kind != attrNode {
- break
- }
- if s.step.match(node) {
- s.node = node
- return true
- }
- }
-
- }
-
- s.node = nil
- return false
-}
-
-type pathPredicate struct {
- path *Path
- sval string
- ival int
- bval bool
-}
-
-type pathStep struct {
- root bool
- axis string
- name string
- prefix string
- uri string
- kind nodeKind
- pred *pathPredicate
-}
-
-func (step *pathStep) match(node *Node) bool {
- return node.kind != endNode &&
- (step.kind == anyNode || step.kind == node.kind) &&
- (step.name == "*" || (node.name.Local == step.name && (node.name.Space != "" && node.name.Space == step.uri || node.name.Space == "")))
-}
-
-// MustCompile returns the compiled path, and panics if
-// there are any errors.
-func MustCompile(path string) *Path {
- e, err := Compile(path)
- if err != nil {
- panic(err)
- }
- return e
-}
-
-// Compile returns the compiled path.
-func Compile(path string) (*Path, error) {
- c := pathCompiler{path, 0, []Namespace{}}
- if path == "" {
- return nil, c.errorf("empty path")
- }
- p, err := c.parsePath()
- if err != nil {
- return nil, err
- }
- return p, nil
-}
-
-// Compile the path with the knowledge of the given namespaces
-func CompileWithNamespace(path string, ns []Namespace) (*Path, error) {
- c := pathCompiler{path, 0, ns}
- if path == "" {
- return nil, c.errorf("empty path")
- }
- p, err := c.parsePath()
- if err != nil {
- return nil, err
- }
- return p, nil
-}
-
-type pathCompiler struct {
- path string
- i int
- ns []Namespace
-}
-
-func (c *pathCompiler) errorf(format string, args ...interface{}) error {
- return fmt.Errorf("compiling xml path %q:%d: %s", c.path, c.i, fmt.Sprintf(format, args...))
-}
-
-func (c *pathCompiler) parsePath() (path *Path, err error) {
- var steps []pathStep
- var start = c.i
- for {
- step := pathStep{axis: "child"}
-
- if c.i == 0 && c.skipByte('/') {
- step.root = true
- if len(c.path) == 1 {
- step.name = "*"
- }
- }
- if c.peekByte('/') {
- step.axis = "descendant-or-self"
- step.name = "*"
- } else if c.skipByte('@') {
- mark := c.i
- if !c.skipName() {
- return nil, c.errorf("missing name after @")
- }
- step.axis = "attribute"
- step.name = c.path[mark:c.i]
- step.kind = attrNode
- } else {
- mark := c.i
- if c.skipName() {
- step.name = c.path[mark:c.i]
- }
- if step.name == "" {
- return nil, c.errorf("missing name")
- } else if step.name == "*" {
- step.kind = startNode
- } else if step.name == "." {
- step.axis = "self"
- step.name = "*"
- } else if step.name == ".." {
- step.axis = "parent"
- step.name = "*"
- } else {
- if c.skipByte(':') {
- if !c.skipByte(':') {
- mark = c.i
- if c.skipName() {
- step.prefix = step.name
- step.name = c.path[mark:c.i]
- // check prefix
- found := false
- for _, ns := range c.ns {
- if ns.Prefix == step.prefix {
- step.uri = ns.Uri
- found = true
- break
- }
- }
- if !found {
- return nil, c.errorf("unknown namespace prefix: %s", step.prefix)
- }
- } else {
- return nil, c.errorf("missing name after namespace prefix")
- }
- } else {
- switch step.name {
- case "attribute":
- step.kind = attrNode
- case "self", "child", "parent":
- case "descendant", "descendant-or-self":
- case "ancestor", "ancestor-or-self":
- case "following", "following-sibling":
- case "preceding", "preceding-sibling":
- default:
- return nil, c.errorf("unsupported axis: %q", step.name)
- }
- step.axis = step.name
-
- mark = c.i
- if !c.skipName() {
- return nil, c.errorf("missing name")
- }
- step.name = c.path[mark:c.i]
- }
- }
- if c.skipByte('(') {
- conflict := step.kind != anyNode
- switch step.name {
- case "node":
- // must be anyNode
- case "text":
- step.kind = textNode
- case "comment":
- step.kind = commentNode
- case "processing-instruction":
- step.kind = procInstNode
- default:
- return nil, c.errorf("unsupported expression: %s()", step.name)
- }
- if conflict {
- return nil, c.errorf("%s() cannot succeed on axis %q", step.name, step.axis)
- }
-
- literal, err := c.parseLiteral()
- if err == errNoLiteral {
- step.name = "*"
- } else if err != nil {
- return nil, c.errorf("%v", err)
- } else if step.kind == procInstNode {
- step.name = literal
- } else {
- return nil, c.errorf("%s() has no arguments", step.name)
- }
- if !c.skipByte(')') {
- return nil, c.errorf("missing )")
- }
- } else if step.name == "*" && step.kind == anyNode {
- step.kind = startNode
- }
- }
- }
- if c.skipByte('[') {
- step.pred = &pathPredicate{}
- if ival, ok := c.parseInt(); ok {
- if ival == 0 {
- return nil, c.errorf("positions start at 1")
- }
- step.pred.ival = ival
- } else {
- path, err := c.parsePath()
- if err != nil {
- return nil, err
- }
- if path.path[0] == '-' {
- if _, err = strconv.Atoi(path.path); err == nil {
- return nil, c.errorf("positions must be positive")
- }
- }
- step.pred.path = path
- if c.skipByte('=') {
- sval, err := c.parseLiteral()
- if err != nil {
- return nil, c.errorf("%v", err)
- }
- step.pred.sval = sval
- } else {
- step.pred.bval = true
- }
- }
- if !c.skipByte(']') {
- return nil, c.errorf("expected ']'")
- }
- }
- steps = append(steps, step)
- //fmt.Printf("step: %#v\n", step)
- if !c.skipByte('/') {
- if (start == 0 || start == c.i) && c.i < len(c.path) {
- return nil, c.errorf("unexpected %q", c.path[c.i])
- }
- return &Path{steps: steps, path: c.path[start:c.i]}, nil
- }
- }
- panic("unreachable")
-}
-
-var errNoLiteral = fmt.Errorf("expected a literal string")
-
-func (c *pathCompiler) parseLiteral() (string, error) {
- if c.skipByte('"') {
- mark := c.i
- if !c.skipByteFind('"') {
- return "", fmt.Errorf(`missing '"'`)
- }
- return c.path[mark : c.i-1], nil
- }
- if c.skipByte('\'') {
- mark := c.i
- if !c.skipByteFind('\'') {
- return "", fmt.Errorf(`missing "'"`)
- }
- return c.path[mark : c.i-1], nil
- }
- return "", errNoLiteral
-}
-
-func (c *pathCompiler) parseInt() (v int, ok bool) {
- mark := c.i
- for c.i < len(c.path) && c.path[c.i] >= '0' && c.path[c.i] <= '9' {
- v *= 10
- v += int(c.path[c.i]) - '0'
- c.i++
- }
- if c.i == mark {
- return 0, false
- }
- return v, true
-}
-
-func (c *pathCompiler) skipByte(b byte) bool {
- if c.i < len(c.path) && c.path[c.i] == b {
- c.i++
- return true
- }
- return false
-}
-
-func (c *pathCompiler) skipByteFind(b byte) bool {
- for i := c.i; i < len(c.path); i++ {
- if c.path[i] == b {
- c.i = i + 1
- return true
- }
- }
- return false
-}
-
-func (c *pathCompiler) peekByte(b byte) bool {
- return c.i < len(c.path) && c.path[c.i] == b
-}
-
-func (c *pathCompiler) skipName() bool {
- if c.i >= len(c.path) {
- return false
- }
- if c.path[c.i] == '*' {
- c.i++
- return true
- }
- start := c.i
- for c.i < len(c.path) && (c.path[c.i] >= utf8.RuneSelf || isNameByte(c.path[c.i])) {
- c.i++
- }
- return c.i > start
-}
-
-func isNameByte(c byte) bool {
- return 'A' <= c && c <= 'Z' || 'a' <= c && c <= 'z' || '0' <= c && c <= '9' || c == '_' || c == '.' || c == '-'
-}
diff --git a/vendor/github.com/mitchellh/go-fs/LICENSE b/vendor/github.com/mitchellh/go-fs/LICENSE
deleted file mode 100644
index f9c841a5..00000000
--- a/vendor/github.com/mitchellh/go-fs/LICENSE
+++ /dev/null
@@ -1,21 +0,0 @@
-The MIT License (MIT)
-
-Copyright (c) 2013 Mitchell Hashimoto
-
-Permission is hereby granted, free of charge, to any person obtaining a copy
-of this software and associated documentation files (the "Software"), to deal
-in the Software without restriction, including without limitation the rights
-to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
-copies of the Software, and to permit persons to whom the Software is
-furnished to do so, subject to the following conditions:
-
-The above copyright notice and this permission notice shall be included in
-all copies or substantial portions of the Software.
-
-THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
-OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
-THE SOFTWARE.
diff --git a/vendor/github.com/mitchellh/go-fs/README.md b/vendor/github.com/mitchellh/go-fs/README.md
deleted file mode 100644
index 3cfaafa2..00000000
--- a/vendor/github.com/mitchellh/go-fs/README.md
+++ /dev/null
@@ -1,90 +0,0 @@
-# FAT Filesystem Library for Go
-
-This library implements the ability to create, read, and write
-FAT filesystems using pure Go.
-
-**WARNING:** While the implementation works (to some degree, see the
-limitations section below), I highly recommend you **don't** use this
-library, since it has many limitations and is generally a terrible
-implementation of FAT. For educational purposes, however, this library
-may be interesting.
-
-In this library's current state, it is very good for _reading_ FAT
-filesystems, and minimally useful for _creating_ FAT filesystems. See
-the features and limitations below.
-
-## Features & Limitations
-
-Features:
-
-* Format a brand new FAT filesystem on a file backed device
-* Create files and directories
-* Traverse filesystem
-
-Limitations:
-
-This library has several limitations. They're easily able to be overcome,
-but because I didn't need them for my use case, I didn't bother:
-
-* Files/directories cannot be deleted or renamed.
-* Files never shrink in size.
-* Deleted file/directory entries are never reclaimed, so fragmentation
- grows towards infinity. Eventually, your "disk" will become full even
- if you just create and delete a single file.
-* There are some serious corruption possibilities in error cases. Cleanup
- is not good.
-* Incomplete FAT32 implementation (although FAT12 and FAT16 are complete).
-
-## Usage
-
-Here is some example usage where an existing disk image is read and
-a file is created in the root directory:
-
-```go
-// Assume this file was created already with a FAT filesystem
-f, err := os.OpenFile("FLOPPY.dmg", os.O_RDWR|os.O_CREATE, 0666)
-if err != nil {
- panic(err)
-}
-defer f.Close()
-
-// BlockDevice backed by a file
-device, err := fs.NewFileDisk(f)
-if err != nil {
- panic(err)
-}
-
-filesys, err := fat.New(device)
-if err != nil {
- panic(err)
-}
-
-rootDir, err := filesys.RootDir()
-if err != nil {
- panic(err)
-}
-
-subEntry, err := rootDir.AddFile("HELLO_WORLD")
-if err != nil {
- panic(err)
-}
-
-file, err := subEntry.File()
-if err != nil {
- panic(err)
-}
-
-_, err = io.WriteString(file, "I am the contents of this file.")
-if err != nil {
- panic(err)
-}
-```
-
-## Thanks
-
-Thanks to the following resources which helped in the creation of this
-library:
-
-* [fat32-lib](https://code.google.com/p/fat32-lib/)
-* [File Allocation Table on Wikipedia](http://en.wikipedia.org/wiki/File_Allocation_Table)
-* Microsoft FAT filesystem specification
diff --git a/vendor/github.com/mitchellh/go-fs/block_device.go b/vendor/github.com/mitchellh/go-fs/block_device.go
deleted file mode 100644
index 2a82a43c..00000000
--- a/vendor/github.com/mitchellh/go-fs/block_device.go
+++ /dev/null
@@ -1,22 +0,0 @@
-package fs
-
-// A BlockDevice is the raw device that is meant to store a filesystem.
-type BlockDevice interface {
- // Closes this block device. No more methods may be called on a
- // closed device.
- Close() error
-
- // Len returns the number of bytes in this block device.
- Len() int64
-
- // SectorSize returns the size of a single sector on this device.
- SectorSize() int
-
- // ReadAt reads data from the block device from the given
- // offset. See io.ReaderAt for more information on this function.
- ReadAt(p []byte, off int64) (n int, err error)
-
- // WriteAt writes data to the block device at the given offset.
- // See io.WriterAt for more information on this function.
- WriteAt(p []byte, off int64) (n int, err error)
-}
diff --git a/vendor/github.com/mitchellh/go-fs/directory.go b/vendor/github.com/mitchellh/go-fs/directory.go
deleted file mode 100644
index 27476430..00000000
--- a/vendor/github.com/mitchellh/go-fs/directory.go
+++ /dev/null
@@ -1,18 +0,0 @@
-package fs
-
-// Directory is an entry in a filesystem that stores files.
-type Directory interface {
- Entry(name string) DirectoryEntry
- Entries() []DirectoryEntry
- AddDirectory(name string) (DirectoryEntry, error)
- AddFile(name string) (DirectoryEntry, error)
-}
-
-// DirectoryEntry represents a single entry within a directory,
-// which can be either another Directory or a File.
-type DirectoryEntry interface {
- Name() string
- IsDir() bool
- Dir() (Directory, error)
- File() (File, error)
-}
diff --git a/vendor/github.com/mitchellh/go-fs/fat/boot_sector.go b/vendor/github.com/mitchellh/go-fs/fat/boot_sector.go
deleted file mode 100644
index 689a6b75..00000000
--- a/vendor/github.com/mitchellh/go-fs/fat/boot_sector.go
+++ /dev/null
@@ -1,347 +0,0 @@
-package fat
-
-import (
- "encoding/binary"
- "errors"
- "fmt"
- "github.com/mitchellh/go-fs"
- "unicode"
-)
-
-type MediaType uint8
-
-// The standard value for "fixed", non-removable media, directly
-// from the FAT specification.
-const MediaFixed MediaType = 0xF8
-
-type BootSectorCommon struct {
- OEMName string
- BytesPerSector uint16
- SectorsPerCluster uint8
- ReservedSectorCount uint16
- NumFATs uint8
- RootEntryCount uint16
- TotalSectors uint32
- Media MediaType
- SectorsPerFat uint32
- SectorsPerTrack uint16
- NumHeads uint16
-}
-
-// DecodeBootSector takes a BlockDevice and decodes the FAT boot sector
-// from it.
-func DecodeBootSector(device fs.BlockDevice) (*BootSectorCommon, error) {
- var sector [512]byte
- if _, err := device.ReadAt(sector[:], 0); err != nil {
- return nil, err
- }
-
- if sector[510] != 0x55 || sector[511] != 0xAA {
- return nil, errors.New("corrupt boot sector signature")
- }
-
- result := new(BootSectorCommon)
-
- // BS_OEMName
- result.OEMName = string(sector[3:11])
-
- // BPB_BytsPerSec
- result.BytesPerSector = binary.LittleEndian.Uint16(sector[11:13])
-
- // BPB_SecPerClus
- result.SectorsPerCluster = sector[13]
-
- // BPB_RsvdSecCnt
- result.ReservedSectorCount = binary.LittleEndian.Uint16(sector[14:16])
-
- // BPB_NumFATs
- result.NumFATs = sector[16]
-
- // BPB_RootEntCnt
- result.RootEntryCount = binary.LittleEndian.Uint16(sector[17:19])
-
- // BPB_Media
- result.Media = MediaType(sector[21])
-
- // BPB_SecPerTrk
- result.SectorsPerTrack = binary.LittleEndian.Uint16(sector[24:26])
-
- // BPB_NumHeads
- result.NumHeads = binary.LittleEndian.Uint16(sector[26:28])
-
- // BPB_TotSec16 / BPB_TotSec32
- result.TotalSectors = uint32(binary.LittleEndian.Uint16(sector[19:21]))
- if result.TotalSectors == 0 {
- result.TotalSectors = binary.LittleEndian.Uint32(sector[32:36])
- }
-
- // BPB_FATSz16 / BPB_FATSz32
- result.SectorsPerFat = uint32(binary.LittleEndian.Uint16(sector[22:24]))
- if result.SectorsPerFat == 0 {
- result.SectorsPerFat = binary.LittleEndian.Uint32(sector[36:40])
- }
-
- return result, nil
-}
-
-func (b *BootSectorCommon) Bytes() ([]byte, error) {
- var sector [512]byte
-
- // BS_jmpBoot
- sector[0] = 0xEB
- sector[1] = 0x3C
- sector[2] = 0x90
-
- // BS_OEMName
- if len(b.OEMName) > 8 {
- return nil, errors.New("OEMName must be 8 bytes or less")
- }
-
- for i, r := range b.OEMName {
- if r > unicode.MaxASCII {
- return nil, fmt.Errorf("'%s' in OEM name not a valid ASCII char. Must be ASCII.", r)
- }
-
- sector[0x3+i] = byte(r)
- }
-
- // BPB_BytsPerSec
- binary.LittleEndian.PutUint16(sector[11:13], b.BytesPerSector)
-
- // BPB_SecPerClus
- sector[13] = uint8(b.SectorsPerCluster)
-
- // BPB_RsvdSecCnt
- binary.LittleEndian.PutUint16(sector[14:16], b.ReservedSectorCount)
-
- // BPB_NumFATs
- sector[16] = b.NumFATs
-
- // BPB_RootEntCnt
- binary.LittleEndian.PutUint16(sector[17:19], b.RootEntryCount)
-
- // BPB_Media
- sector[21] = byte(b.Media)
-
- // BPB_SecPerTrk
- binary.LittleEndian.PutUint16(sector[24:26], b.SectorsPerTrack)
-
- // BPB_Numheads
- binary.LittleEndian.PutUint16(sector[26:28], b.NumHeads)
-
- // BPB_Hiddsec
- // sector[28:32] - it is always set to 0 because we don't partition drives yet.
-
- // Important signature of every FAT boot sector
- sector[510] = 0x55
- sector[511] = 0xAA
-
- return sector[:], nil
-}
-
-// BytesPerCluster returns the number of bytes per cluster.
-func (b *BootSectorCommon) BytesPerCluster() uint32 {
- return uint32(b.SectorsPerCluster) * uint32(b.BytesPerSector)
-}
-
-// ClusterOffset returns the offset of the data section of a particular
-// cluster.
-func (b *BootSectorCommon) ClusterOffset(n int) uint32 {
- offset := b.DataOffset()
- offset += (uint32(n) - FirstCluster) * b.BytesPerCluster()
- return offset
-}
-
-// DataOffset returns the offset of the data section of the disk.
-func (b *BootSectorCommon) DataOffset() uint32 {
- offset := uint32(b.RootDirOffset())
- offset += uint32(b.RootEntryCount * DirectoryEntrySize)
- return offset
-}
-
-// FATOffset returns the offset in bytes for the given index of the FAT
-func (b *BootSectorCommon) FATOffset(n int) int {
- offset := uint32(b.ReservedSectorCount * b.BytesPerSector)
- offset += b.SectorsPerFat * uint32(b.BytesPerSector) * uint32(n)
- return int(offset)
-}
-
-// Calculates the FAT type that this boot sector represents.
-func (b *BootSectorCommon) FATType() FATType {
- var rootDirSectors uint32
- rootDirSectors = (uint32(b.RootEntryCount) * 32) + (uint32(b.BytesPerSector) - 1)
- rootDirSectors /= uint32(b.BytesPerSector)
- dataSectors := b.SectorsPerFat * uint32(b.NumFATs)
- dataSectors += uint32(b.ReservedSectorCount)
- dataSectors += rootDirSectors
- dataSectors = b.TotalSectors - dataSectors
- countClusters := dataSectors / uint32(b.SectorsPerCluster)
-
- switch {
- case countClusters < 4085:
- return FAT12
- case countClusters < 65525:
- return FAT16
- default:
- return FAT32
- }
-}
-
-// RootDirOffset returns the byte offset when the root directory
-// entries for FAT12/16 filesystems start. NOTE: This is absolutely useless
-// for FAT32 because the root directory is just the beginning of the data
-// region.
-func (b *BootSectorCommon) RootDirOffset() int {
- offset := b.FATOffset(0)
- offset += int(uint32(b.NumFATs) * b.SectorsPerFat * uint32(b.BytesPerSector))
- return offset
-}
-
-// BootSectorFat16 is the BootSector for FAT12 and FAT16 filesystems.
-// It contains the common fields to all FAT filesystems and also some
-// unique.
-type BootSectorFat16 struct {
- BootSectorCommon
-
- DriveNumber uint8
- VolumeID uint32
- VolumeLabel string
- FileSystemTypeLabel string
-}
-
-func (b *BootSectorFat16) Bytes() ([]byte, error) {
- sector, err := b.BootSectorCommon.Bytes()
- if err != nil {
- return nil, err
- }
-
- // BPB_TotSec16 AND BPB_TotSec32
- if b.TotalSectors < 0x10000 {
- binary.LittleEndian.PutUint16(sector[19:21], uint16(b.TotalSectors))
- } else {
- binary.LittleEndian.PutUint32(sector[32:36], b.TotalSectors)
- }
-
- // BPB_FATSz16
- if b.SectorsPerFat > 0x10000 {
- return nil, fmt.Errorf("SectorsPerFat value too big for non-FAT32: %d", b.SectorsPerFat)
- }
-
- binary.LittleEndian.PutUint16(sector[22:24], uint16(b.SectorsPerFat))
-
- // BS_DrvNum
- sector[36] = b.DriveNumber
-
- // BS_BootSig
- sector[38] = 0x29
-
- // BS_VolID
- binary.LittleEndian.PutUint32(sector[39:43], b.VolumeID)
-
- // BS_VolLab
- if len(b.VolumeLabel) > 11 {
- return nil, errors.New("VolumeLabel must be 11 bytes or less")
- }
-
- for i, r := range b.VolumeLabel {
- if r > unicode.MaxASCII {
- return nil, fmt.Errorf("'%s' in VolumeLabel not a valid ASCII char. Must be ASCII.", r)
- }
-
- sector[43+i] = byte(r)
- }
-
- // BS_FilSysType
- if len(b.FileSystemTypeLabel) > 8 {
- return nil, errors.New("FileSystemTypeLabel must be 8 bytes or less")
- }
-
- for i, r := range b.FileSystemTypeLabel {
- if r > unicode.MaxASCII {
- return nil, fmt.Errorf("'%s' in FileSystemTypeLabel not a valid ASCII char. Must be ASCII.", r)
- }
-
- sector[54+i] = byte(r)
- }
-
- return sector, nil
-}
-
-type BootSectorFat32 struct {
- BootSectorCommon
-
- RootCluster uint32
- FSInfoSector uint16
- BackupBootSector uint16
- DriveNumber uint8
- VolumeID uint32
- VolumeLabel string
- FileSystemTypeLabel string
-}
-
-func (b *BootSectorFat32) Bytes() ([]byte, error) {
- sector, err := b.BootSectorCommon.Bytes()
- if err != nil {
- return nil, err
- }
-
- // BPB_RootEntCount - must be 0
- sector[17] = 0
- sector[18] = 0
-
- // BPB_FATSz32
- binary.LittleEndian.PutUint32(sector[36:40], b.SectorsPerFat)
-
- // BPB_ExtFlags - Unused?
-
- // BPB_FSVer. Explicitly set to 0 because that is really important
- // to get correct.
- sector[42] = 0
- sector[43] = 0
-
- // BPB_RootClus
- binary.LittleEndian.PutUint32(sector[44:48], b.RootCluster)
-
- // BPB_FSInfo
- binary.LittleEndian.PutUint16(sector[48:50], b.FSInfoSector)
-
- // BPB_BkBootSec
- binary.LittleEndian.PutUint16(sector[50:52], b.BackupBootSector)
-
- // BS_DrvNum
- sector[64] = b.DriveNumber
-
- // BS_BootSig
- sector[66] = 0x29
-
- // BS_VolID
- binary.LittleEndian.PutUint32(sector[67:71], b.VolumeID)
-
- // BS_VolLab
- if len(b.VolumeLabel) > 11 {
- return nil, errors.New("VolumeLabel must be 11 bytes or less")
- }
-
- for i, r := range b.VolumeLabel {
- if r > unicode.MaxASCII {
- return nil, fmt.Errorf("'%s' in VolumeLabel not a valid ASCII char. Must be ASCII.", r)
- }
-
- sector[71+i] = byte(r)
- }
-
- // BS_FilSysType
- if len(b.FileSystemTypeLabel) > 8 {
- return nil, errors.New("FileSystemTypeLabel must be 8 bytes or less")
- }
-
- for i, r := range b.FileSystemTypeLabel {
- if r > unicode.MaxASCII {
- return nil, fmt.Errorf("'%s' in FileSystemTypeLabel not a valid ASCII char. Must be ASCII.", r)
- }
-
- sector[82+i] = byte(r)
- }
-
- return sector, nil
-}
diff --git a/vendor/github.com/mitchellh/go-fs/fat/cluster_chain.go b/vendor/github.com/mitchellh/go-fs/fat/cluster_chain.go
deleted file mode 100644
index a1f9161d..00000000
--- a/vendor/github.com/mitchellh/go-fs/fat/cluster_chain.go
+++ /dev/null
@@ -1,91 +0,0 @@
-package fat
-
-import (
- "github.com/mitchellh/go-fs"
- "io"
- "math"
-)
-
-type ClusterChain struct {
- device fs.BlockDevice
- fat *FAT
- startCluster uint32
- readOffset uint32
- writeOffset uint32
-}
-
-func (c *ClusterChain) Read(p []byte) (n int, err error) {
- bpc := c.fat.bs.BytesPerCluster()
- chain := c.fat.Chain(c.startCluster)
-
- dataOffset := uint32(0)
- for dataOffset < uint32(len(p)) {
- chainIdx := c.readOffset / bpc
- if int(chainIdx) >= len(chain) {
- err = io.EOF
- return
- }
-
- clusterOffset := c.fat.bs.ClusterOffset(int(chain[chainIdx]))
- clusterOffset += c.readOffset % bpc
- dataOffsetEnd := dataOffset + bpc
- dataOffsetEnd -= c.readOffset % bpc
- dataOffsetEnd = uint32(math.Min(float64(dataOffsetEnd), float64(len(p))))
-
- var nw int
- nw, err = c.device.ReadAt(p[dataOffset:dataOffsetEnd], int64(clusterOffset))
- if err != nil {
- return
- }
-
- c.readOffset += uint32(nw)
- dataOffset += uint32(nw)
- n += nw
- }
-
- return
-}
-
-// Write will write to the cluster chain, expanding it if necessary.
-func (c *ClusterChain) Write(p []byte) (n int, err error) {
- bpc := c.fat.bs.BytesPerCluster()
- chain := c.fat.Chain(c.startCluster)
- chainLength := uint32(len(chain)) * bpc
-
- if chainLength < c.writeOffset+uint32(len(p)) {
- // We need to grow the chain
- bytesNeeded := (c.writeOffset + uint32(len(p))) - chainLength
- clustersNeeded := int(math.Ceil(float64(bytesNeeded) / float64(bpc)))
- chain, err = c.fat.ResizeChain(c.startCluster, len(chain)+clustersNeeded)
- if err != nil {
- return
- }
-
- // Write the FAT out
- if err = c.fat.WriteToDevice(c.device); err != nil {
- return
- }
- }
-
- dataOffset := uint32(0)
- for dataOffset < uint32(len(p)) {
- chainIdx := c.writeOffset / bpc
- clusterOffset := c.fat.bs.ClusterOffset(int(chain[chainIdx]))
- clusterOffset += c.writeOffset % bpc
- dataOffsetEnd := dataOffset + bpc
- dataOffsetEnd -= c.writeOffset % bpc
- dataOffsetEnd = uint32(math.Min(float64(dataOffsetEnd), float64(len(p))))
-
- var nw int
- nw, err = c.device.WriteAt(p[dataOffset:dataOffsetEnd], int64(clusterOffset))
- if err != nil {
- return
- }
-
- c.writeOffset += uint32(nw)
- dataOffset += uint32(nw)
- n += nw
- }
-
- return
-}
diff --git a/vendor/github.com/mitchellh/go-fs/fat/directory.go b/vendor/github.com/mitchellh/go-fs/fat/directory.go
deleted file mode 100644
index ff62319f..00000000
--- a/vendor/github.com/mitchellh/go-fs/fat/directory.go
+++ /dev/null
@@ -1,278 +0,0 @@
-package fat
-
-import (
- "fmt"
- "github.com/mitchellh/go-fs"
- "strings"
- "time"
-)
-
-// Directory implements fs.Directory and is used to interface with
-// a directory on a FAT filesystem.
-type Directory struct {
- device fs.BlockDevice
- dirCluster *DirectoryCluster
- fat *FAT
-}
-
-// DirectoryEntry implements fs.DirectoryEntry and represents a single
-// file/folder within a directory in a FAT filesystem. Note that the
-// underlying directory entry data structures on the disk may be more
-// than one to accomodate for long filenames.
-type DirectoryEntry struct {
- dir *Directory
- lfnEntries []*DirectoryClusterEntry
- entry *DirectoryClusterEntry
-
- name string
-}
-
-// DecodeDirectoryEntry takes a list of entries, decodes the next full
-// DirectoryEntry, and returns the newly created entry, the remaining
-// entries, and an error, if there was one.
-func DecodeDirectoryEntry(d *Directory, entries []*DirectoryClusterEntry) (*DirectoryEntry, []*DirectoryClusterEntry, error) {
- var lfnEntries []*DirectoryClusterEntry
- var entry *DirectoryClusterEntry
- var name string
-
- // Skip all the deleted entries
- for len(entries) > 0 && entries[0].deleted {
- entries = entries[1:]
- }
-
- // Skip the volume ID
- if len(entries) > 0 && entries[0].IsVolumeId() {
- entries = entries[1:]
- }
-
- if len(entries) == 0 {
- return nil, entries, nil
- }
-
- // We have a long entry, so we have to traverse to the point where
- // we're done. Also, calculate out the name and such.
- if entries[0].IsLong() {
- lfnEntries := make([]*DirectoryClusterEntry, 0, 3)
- for entries[0].IsLong() {
- lfnEntries = append(lfnEntries, entries[0])
- entries = entries[1:]
- }
-
- var nameBytes []rune
- nameBytes = make([]rune, 13*len(lfnEntries))
- for i := len(lfnEntries) - 1; i >= 0; i-- {
- for _, char := range lfnEntries[i].longName {
- nameBytes = append(nameBytes, char)
- }
- }
-
- name = string(nameBytes)
- }
-
- // Get the short entry
- entry = entries[0]
- entries = entries[1:]
-
- // If the short entry is deleted, ignore everything
- if entry.deleted {
- return nil, entries, nil
- }
-
- if name == "" {
- name = strings.TrimSpace(entry.name)
- ext := strings.TrimSpace(entry.ext)
- if ext != "" {
- name = fmt.Sprintf("%s.%s", name, ext)
- }
- }
-
- result := &DirectoryEntry{
- dir: d,
- lfnEntries: lfnEntries,
- entry: entry,
- name: name,
- }
-
- return result, entries, nil
-}
-
-func (d *DirectoryEntry) Dir() (fs.Directory, error) {
- if !d.IsDir() {
- panic("not a directory")
- }
-
- dirCluster, err := DecodeDirectoryCluster(
- d.entry.cluster, d.dir.device, d.dir.fat)
- if err != nil {
- return nil, err
- }
-
- result := &Directory{
- device: d.dir.device,
- dirCluster: dirCluster,
- fat: d.dir.fat,
- }
-
- return result, nil
-}
-
-func (d *DirectoryEntry) File() (fs.File, error) {
- if d.IsDir() {
- panic("not a file")
- }
-
- result := &File{
- chain: &ClusterChain{
- device: d.dir.device,
- fat: d.dir.fat,
- startCluster: d.entry.cluster,
- },
- dir: d.dir,
- entry: d.entry,
- }
-
- return result, nil
-}
-
-func (d *DirectoryEntry) IsDir() bool {
- return (d.entry.attr & AttrDirectory) == AttrDirectory
-}
-
-func (d *DirectoryEntry) Name() string {
- return d.name
-}
-
-func (d *DirectoryEntry) ShortName() string {
- if d.entry.name == "." || d.entry.name == ".." {
- return d.entry.name
- }
-
- return fmt.Sprintf("%s.%s", d.entry.name, d.entry.ext)
-}
-
-func (d *Directory) AddDirectory(name string) (fs.DirectoryEntry, error) {
- entry, err := d.addEntry(name, AttrDirectory)
- if err != nil {
- return nil, err
- }
-
- // Create the new directory cluster
- newDirCluster := NewDirectoryCluster(
- entry.entry.cluster, d.dirCluster.startCluster, entry.entry.createTime)
-
- if err := newDirCluster.WriteToDevice(d.device, d.fat); err != nil {
- return nil, err
- }
-
- return entry, nil
-}
-
-func (d *Directory) AddFile(name string) (fs.DirectoryEntry, error) {
- entry, err := d.addEntry(name, DirectoryAttr(0))
- if err != nil {
- return nil, err
- }
-
- return entry, nil
-}
-
-func (d *Directory) Entries() []fs.DirectoryEntry {
- entries := d.dirCluster.entries
- result := make([]fs.DirectoryEntry, 0, len(entries)/2)
- for len(entries) > 0 {
- var entry *DirectoryEntry
- entry, entries, _ = DecodeDirectoryEntry(d, entries)
- if entry != nil {
- result = append(result, entry)
- }
- }
-
- return result
-}
-
-func (d *Directory) Entry(name string) fs.DirectoryEntry {
- name = strings.ToUpper(name)
-
- for _, entry := range d.Entries() {
- if strings.ToUpper(entry.Name()) == name {
- return entry
- }
- }
-
- return nil
-}
-
-func (d *Directory) addEntry(name string, attr DirectoryAttr) (*DirectoryEntry, error) {
- name = strings.TrimSpace(name)
-
- entries := d.Entries()
- usedNames := make([]string, 0, len(entries))
- for _, entry := range entries {
- if strings.ToUpper(entry.Name()) == strings.ToUpper(name) {
- return nil, fmt.Errorf("name already exists: %s", name)
- }
-
- // Add it to the list of used names
- dirEntry := entry.(*DirectoryEntry)
- usedNames = append(usedNames, dirEntry.ShortName())
- }
-
- shortName, err := generateShortName(name, usedNames)
- if err != nil {
- return nil, err
- }
-
- var lfnEntries []*DirectoryClusterEntry
- if shortName != strings.ToUpper(name) {
- lfnEntries, err = NewLongDirectoryClusterEntry(name, shortName)
- if err != nil {
- return nil, err
- }
- }
-
- // Allocate space for a cluster
- startCluster, err := d.fat.AllocChain()
- if err != nil {
- return nil, err
- }
-
- createTime := time.Now()
-
- // Create the entry for the short name
- shortParts := strings.Split(shortName, ".")
- if len(shortParts) == 1 {
- shortParts = append(shortParts, "")
- }
-
- shortEntry := new(DirectoryClusterEntry)
- shortEntry.attr = attr
- shortEntry.name = shortParts[0]
- shortEntry.ext = shortParts[1]
- shortEntry.cluster = startCluster
- shortEntry.accessTime = createTime
- shortEntry.createTime = createTime
- shortEntry.writeTime = createTime
-
- // Write the new FAT out
- if err := d.fat.WriteToDevice(d.device); err != nil {
- return nil, err
- }
-
- // Write the entries out in this directory
- if lfnEntries != nil {
- d.dirCluster.entries = append(d.dirCluster.entries, lfnEntries...)
- }
- d.dirCluster.entries = append(d.dirCluster.entries, shortEntry)
-
- if err := d.dirCluster.WriteToDevice(d.device, d.fat); err != nil {
- return nil, err
- }
-
- newEntry := &DirectoryEntry{
- dir: d,
- lfnEntries: lfnEntries,
- entry: shortEntry,
- }
-
- return newEntry, nil
-}
diff --git a/vendor/github.com/mitchellh/go-fs/fat/directory_cluster.go b/vendor/github.com/mitchellh/go-fs/fat/directory_cluster.go
deleted file mode 100644
index 58ae48e4..00000000
--- a/vendor/github.com/mitchellh/go-fs/fat/directory_cluster.go
+++ /dev/null
@@ -1,438 +0,0 @@
-package fat
-
-import (
- "bytes"
- "encoding/binary"
- "errors"
- "fmt"
- "github.com/mitchellh/go-fs"
- "math"
- "time"
- "unicode/utf16"
-)
-
-type DirectoryAttr uint8
-
-const (
- AttrReadOnly DirectoryAttr = 0x01
- AttrHidden = 0x02
- AttrSystem = 0x04
- AttrVolumeId = 0x08
- AttrDirectory = 0x10
- AttrArchive = 0x20
- AttrLongName = AttrReadOnly | AttrHidden | AttrSystem | AttrVolumeId
-)
-
-// The size in bytes of a single directory entry.
-const DirectoryEntrySize = 32
-
-// Mask applied to the ord of the last long entry.
-const LastLongEntryMask = 0x40
-
-// DirectoryCluster represents a cluster on the disk that contains
-// entries/contents.
-type DirectoryCluster struct {
- entries []*DirectoryClusterEntry
- fat16Root bool
- startCluster uint32
-}
-
-// DirectoryClusterEntry is a single 32-byte entry that is part of the
-// chain of entries in a directory cluster.
-type DirectoryClusterEntry struct {
- name string
- ext string
- attr DirectoryAttr
- createTime time.Time
- accessTime time.Time
- writeTime time.Time
- cluster uint32
- fileSize uint32
- deleted bool
-
- longOrd uint8
- longName string
- longChecksum uint8
-}
-
-func DecodeDirectoryCluster(startCluster uint32, device fs.BlockDevice, fat *FAT) (*DirectoryCluster, error) {
- bs := fat.bs
- chain := fat.Chain(startCluster)
- data := make([]byte, uint32(len(chain))*bs.BytesPerCluster())
- for i, clusterNumber := range chain {
- dataOffset := uint32(i) * bs.BytesPerCluster()
- devOffset := int64(bs.ClusterOffset(int(clusterNumber)))
- chainData := data[dataOffset : dataOffset+bs.BytesPerCluster()]
-
- if _, err := device.ReadAt(chainData, devOffset); err != nil {
- return nil, err
- }
- }
-
- result, err := decodeDirectoryCluster(data, bs)
- if err != nil {
- return nil, err
- }
-
- result.startCluster = startCluster
- return result, nil
-}
-
-// DecodeFAT16RootDirectory decodes the FAT16 root directory structure
-// from the device.
-func DecodeFAT16RootDirectoryCluster(device fs.BlockDevice, bs *BootSectorCommon) (*DirectoryCluster, error) {
- data := make([]byte, DirectoryEntrySize*bs.RootEntryCount)
- if _, err := device.ReadAt(data, int64(bs.RootDirOffset())); err != nil {
- return nil, err
- }
-
- result, err := decodeDirectoryCluster(data, bs)
- if err != nil {
- return nil, err
- }
-
- result.fat16Root = true
- return result, nil
-}
-
-func decodeDirectoryCluster(data []byte, bs *BootSectorCommon) (*DirectoryCluster, error) {
- entries := make([]*DirectoryClusterEntry, 0, bs.RootEntryCount)
- for i := uint16(0); i < uint16(len(data)/DirectoryEntrySize); i++ {
- offset := i * DirectoryEntrySize
- entryData := data[offset : offset+DirectoryEntrySize]
- if entryData[0] == 0 {
- break
- }
-
- entry, err := DecodeDirectoryClusterEntry(entryData)
- if err != nil {
- return nil, err
- }
-
- entries = append(entries, entry)
- }
-
- result := &DirectoryCluster{
- entries: entries,
- }
-
- return result, nil
-}
-
-func NewDirectoryCluster(start uint32, parent uint32, t time.Time) *DirectoryCluster {
- cluster := new(DirectoryCluster)
- cluster.startCluster = start
-
- // Create the "." and ".." entries
- cluster.entries = []*DirectoryClusterEntry{
- {
- accessTime: t,
- attr: AttrDirectory,
- cluster: start,
- createTime: t,
- name: ".",
- writeTime: t,
- },
- {
- accessTime: t,
- attr: AttrDirectory,
- cluster: parent,
- createTime: t,
- name: "..",
- writeTime: t,
- },
- }
-
- return cluster
-}
-
-// NewFat16RootDirectory creates a new DirectoryCluster that is meant only
-// to be the root directory of a FAT12/FAT16 filesystem.
-func NewFat16RootDirectoryCluster(bs *BootSectorCommon, label string) (*DirectoryCluster, error) {
- if bs.RootEntryCount == 0 {
- return nil, errors.New("root entry count is 0 in boot sector")
- }
-
- result := &DirectoryCluster{
- entries: make([]*DirectoryClusterEntry, 1, bs.RootEntryCount),
- }
-
- // Create the volume ID entry
- result.entries[0] = &DirectoryClusterEntry{
- attr: AttrVolumeId,
- name: label,
- cluster: 0,
- }
-
- return result, nil
-}
-
-// Bytes returns the on-disk byte data for this directory structure.
-func (d *DirectoryCluster) Bytes() []byte {
- result := make([]byte, cap(d.entries)*DirectoryEntrySize)
-
- for i, entry := range d.entries {
- offset := i * DirectoryEntrySize
- entryBytes := entry.Bytes()
- copy(result[offset:offset+DirectoryEntrySize], entryBytes)
- }
-
- return result
-}
-
-// WriteToDevice writes the cluster to the device.
-func (d *DirectoryCluster) WriteToDevice(device fs.BlockDevice, fat *FAT) error {
- if d.fat16Root {
- // Write the cluster to the FAT16 root directory location
- offset := int64(fat.bs.RootDirOffset())
- if _, err := device.WriteAt(d.Bytes(), offset); err != nil {
- return err
- }
- } else {
- chain := &ClusterChain{
- device: device,
- fat: fat,
- startCluster: d.startCluster,
- }
-
- if _, err := chain.Write(d.Bytes()); err != nil {
- return err
- }
- }
-
- return nil
-}
-
-// Bytes returns the on-disk byte data for this directory entry.
-func (d *DirectoryClusterEntry) Bytes() []byte {
- var result [DirectoryEntrySize]byte
-
- if d.longName != "" {
- runes := bytes.Runes([]byte(d.longName))
-
- // The name must be zero-terminated then padded with 0xFF
- // up to 13 characters
- if len(runes) < 13 {
- runes = append(runes, 0)
- for len(runes) < 13 {
- runes = append(runes, 0xFFFF)
- }
- }
-
- // LDIR_Ord
- result[0] = d.longOrd
-
- // LDIR_Name1
- for i := 0; i < int(math.Min(float64(len(runes)), 5)); i++ {
- offset := 1 + (i * 2)
- data := result[offset : offset+2]
- binary.LittleEndian.PutUint16(data, uint16(runes[i]))
- }
-
- // LDIR_Attr
- result[11] = byte(AttrLongName)
-
- // LDIR_Type
- result[12] = 0
-
- // LDIR_Chksum
- result[13] = d.longChecksum
-
- // LDIR_Name2
- for i := 0; i < 6; i++ {
- offset := 14 + (i * 2)
- data := result[offset : offset+2]
- binary.LittleEndian.PutUint16(data, uint16(runes[i+5]))
- }
-
- // LDIR_FstClusLO
- result[26] = 0
- result[27] = 0
-
- // LDIR_Name3
- for i := 0; i < 2; i++ {
- offset := 28 + (i * 2)
- data := result[offset : offset+2]
- binary.LittleEndian.PutUint16(data, uint16(runes[i+11]))
- }
- } else {
- // DIR_Name
- var simpleName string
- if d.name == "." || d.name == ".." {
- simpleName = d.name
- } else {
- simpleName = fmt.Sprintf("%s.%s", d.name, d.ext)
- }
- copy(result[0:11], shortNameEntryValue(simpleName))
-
- // DIR_Attr
- result[11] = byte(d.attr)
-
- // DIR_CrtTime
- crtDate, crtTime, crtTenths := encodeDOSTime(d.createTime)
- result[13] = crtTenths
- binary.LittleEndian.PutUint16(result[14:16], crtTime)
- binary.LittleEndian.PutUint16(result[16:18], crtDate)
-
- // DIR_LstAccDate
- accDate, _, _ := encodeDOSTime(d.accessTime)
- binary.LittleEndian.PutUint16(result[18:20], accDate)
-
- // DIR_FstClusHI
- binary.LittleEndian.PutUint16(result[20:22], uint16(d.cluster>>16))
-
- // DIR_WrtTime and DIR_WrtDate
- wrtDate, wrtTime, _ := encodeDOSTime(d.writeTime)
- binary.LittleEndian.PutUint16(result[22:24], wrtTime)
- binary.LittleEndian.PutUint16(result[24:26], wrtDate)
-
- // DIR_FstClusLO
- binary.LittleEndian.PutUint16(result[26:28], uint16(d.cluster&0xFFFF))
-
- // DIR_FileSize
- binary.LittleEndian.PutUint32(result[28:32], d.fileSize)
- }
-
- return result[:]
-}
-
-// IsLong returns true if this is a long entry.
-func (d *DirectoryClusterEntry) IsLong() bool {
- return (d.attr & AttrLongName) == AttrLongName
-}
-
-func (d *DirectoryClusterEntry) IsVolumeId() bool {
- return (d.attr & AttrVolumeId) == AttrVolumeId
-}
-
-// DecodeDirectoryClusterEntry decodes a single directory entry in the
-// Directory structure.
-func DecodeDirectoryClusterEntry(data []byte) (*DirectoryClusterEntry, error) {
- var result DirectoryClusterEntry
-
- // Do the attributes so we can determine if we're dealing with long names
- result.attr = DirectoryAttr(data[11])
- if (result.attr & AttrLongName) == AttrLongName {
- result.longOrd = data[0]
-
- chars := make([]uint16, 13)
- for i := 0; i < 5; i++ {
- offset := 1 + (i * 2)
- chars[i] = binary.LittleEndian.Uint16(data[offset : offset+2])
- }
-
- for i := 0; i < 6; i++ {
- offset := 14 + (i * 2)
- chars[i+5] = binary.LittleEndian.Uint16(data[offset : offset+2])
- }
-
- for i := 0; i < 2; i++ {
- offset := 28 + (i * 2)
- chars[i+11] = binary.LittleEndian.Uint16(data[offset : offset+2])
- }
-
- result.longName = string(utf16.Decode(chars))
- result.longChecksum = data[13]
- } else {
- result.deleted = data[0] == 0xE5
-
- // Basic attributes
- if data[0] == 0x05 {
- data[0] = 0xE5
- }
-
- result.name = string(data[0:8])
- result.ext = string(data[8:11])
-
- // Creation time
- createTimeTenths := data[13]
- createTimeWord := binary.LittleEndian.Uint16(data[14:16])
- createDateWord := binary.LittleEndian.Uint16(data[16:18])
- result.createTime = decodeDOSTime(createDateWord, createTimeWord, createTimeTenths)
-
- // Access time
- accessDateWord := binary.LittleEndian.Uint16(data[18:20])
- result.accessTime = decodeDOSTime(accessDateWord, 0, 0)
-
- // Write time
- writeTimeWord := binary.LittleEndian.Uint16(data[22:24])
- writeDateWord := binary.LittleEndian.Uint16(data[24:26])
- result.writeTime = decodeDOSTime(writeDateWord, writeTimeWord, 0)
-
- // Cluster
- result.cluster = uint32(binary.LittleEndian.Uint16(data[20:22]))
- result.cluster <<= 4
- result.cluster |= uint32(binary.LittleEndian.Uint16(data[26:28]))
-
- // File size
- result.fileSize = binary.LittleEndian.Uint32(data[28:32])
- }
-
- return &result, nil
-}
-
-// NewLongDirectoryClusterEntry returns the series of directory cluster
-// entries that need to be written for a long directory entry. This list
-// of entries does NOT contain the short name entry.
-func NewLongDirectoryClusterEntry(name string, shortName string) ([]*DirectoryClusterEntry, error) {
- // Split up the shortName properly
- checksum := checksumShortName(shortNameEntryValue(shortName))
-
- // Calcualte the number of entries we'll actually need to store
- // the long name.
- numLongEntries := len(name) / 13
- if len(name)%13 != 0 {
- numLongEntries++
- }
-
- entries := make([]*DirectoryClusterEntry, numLongEntries)
- for i := 0; i < numLongEntries; i++ {
- entries[i] = new(DirectoryClusterEntry)
- entry := entries[i]
- entry.attr = AttrLongName
- entry.longOrd = uint8(numLongEntries - i)
-
- if i == 0 {
- entry.longOrd |= LastLongEntryMask
- }
-
- // Calculate the offsets of the string for this entry
- j := (numLongEntries - i - 1) * 13
- k := j + 13
- if k > len(name) {
- k = len(name)
- }
-
- entry.longChecksum = checksum
- entry.longName = name[j:k]
- }
-
- return entries, nil
-}
-
-func decodeDOSTime(date, dosTime uint16, tenths uint8) time.Time {
- return time.Date(
- 1980+int(date>>9),
- time.Month((date>>5)&0x0F),
- int(date&0x1F),
- int(dosTime>>11),
- int((dosTime>>5)&0x3F),
- int((dosTime&0x1F)*2),
- int(tenths)*10*int(time.Millisecond),
- time.Local)
-}
-
-func encodeDOSTime(t time.Time) (uint16, uint16, uint8) {
- var date uint16 = uint16((t.Year() - 1980) << 9)
- date |= uint16(t.Month()) << 5
- date += uint16(t.Day() & 0xFF)
-
- var time uint16 = uint16(t.Hour() << 11)
- time |= uint16(t.Minute() << 5)
- time += uint16(t.Second() / 2)
-
- var tenths uint8
- // TODO(mitchellh): Do tenths
-
- return date, time, tenths
-}
diff --git a/vendor/github.com/mitchellh/go-fs/fat/fat.go b/vendor/github.com/mitchellh/go-fs/fat/fat.go
deleted file mode 100644
index 8597986f..00000000
--- a/vendor/github.com/mitchellh/go-fs/fat/fat.go
+++ /dev/null
@@ -1,268 +0,0 @@
-package fat
-
-import (
- "errors"
- "fmt"
- "github.com/mitchellh/go-fs"
- "math"
-)
-
-// The first cluster that can really hold user data is always 2
-const FirstCluster = 2
-
-// FAT is the actual file allocation table data structure that is
-// stored on disk to describe the various clusters on the disk.
-type FAT struct {
- bs *BootSectorCommon
- entries []uint32
-}
-
-func DecodeFAT(device fs.BlockDevice, bs *BootSectorCommon, n int) (*FAT, error) {
- if n > int(bs.NumFATs) {
- return nil, fmt.Errorf("FAT #%d greater than total FATs: %d", n, bs.NumFATs)
- }
-
- data := make([]byte, bs.SectorsPerFat*uint32(bs.BytesPerSector))
- if _, err := device.ReadAt(data, int64(bs.FATOffset(n))); err != nil {
- return nil, err
- }
-
- result := &FAT{
- bs: bs,
- entries: make([]uint32, FATEntryCount(bs)),
- }
-
- fatType := bs.FATType()
- for i := 0; i < int(FATEntryCount(bs)); i++ {
- var entryData uint32
- switch fatType {
- case FAT12:
- entryData = fatReadEntry12(data, i)
- case FAT16:
- entryData = fatReadEntry16(data, i)
- default:
- entryData = fatReadEntry32(data, i)
- }
-
- result.entries[i] = entryData
- }
-
- return result, nil
-}
-
-// NewFAT creates a new FAT data structure, properly initialized.
-func NewFAT(bs *BootSectorCommon) (*FAT, error) {
- result := &FAT{
- bs: bs,
- entries: make([]uint32, FATEntryCount(bs)),
- }
-
- // Set the initial two entries according to spec
- result.entries[0] = (uint32(bs.Media) & 0xFF) |
- (0xFFFFFF00 & result.entryMask())
- result.entries[1] = 0xFFFFFFFF & result.entryMask()
-
- return result, nil
-}
-
-// Bytes returns the raw bytes for the FAT that should be written to
-// the block device.
-func (f *FAT) Bytes() []byte {
- result := make([]byte, f.bs.SectorsPerFat*uint32(f.bs.BytesPerSector))
-
- for i, entry := range f.entries {
- switch f.bs.FATType() {
- case FAT12:
- f.writeEntry12(result, i, entry)
- case FAT16:
- f.writeEntry16(result, i, entry)
- default:
- f.writeEntry32(result, i, entry)
- }
- }
-
- return result
-}
-
-func (f *FAT) AllocChain() (uint32, error) {
- return f.allocNew()
-}
-
-func (f *FAT) allocNew() (uint32, error) {
- dataSize := (f.bs.TotalSectors * uint32(f.bs.BytesPerSector))
- dataSize -= f.bs.DataOffset()
- clusterCount := dataSize / f.bs.BytesPerCluster()
- lastClusterIndex := clusterCount + FirstCluster
-
- var availIdx uint32
- found := false
- for i := uint32(FirstCluster); i < lastClusterIndex; i++ {
- if f.entries[i] == 0 {
- availIdx = i
- found = true
- break
- }
- }
-
- if !found {
- return 0, errors.New("FAT FULL")
- }
-
- // Mark that this is now in use
- f.entries[availIdx] = 0xFFFFFFFF & f.entryMask()
-
- return availIdx, nil
-}
-
-// Chain returns the chain of clusters starting at a certain cluster.
-func (f *FAT) Chain(start uint32) []uint32 {
- chain := make([]uint32, 0, 2)
-
- cluster := start
- for {
- chain = append(chain, cluster)
- cluster = f.entries[cluster]
-
- if f.isEofCluster(cluster) || cluster == 0 {
- break
- }
- }
-
- return chain
-}
-
-// ResizeChain takes a given cluster number and resizes the chain
-// to the given length. It returns the new chain of clusters.
-func (f *FAT) ResizeChain(start uint32, length int) ([]uint32, error) {
- chain := f.Chain(start)
- if len(chain) == length {
- return chain, nil
- }
-
- change := int(math.Abs(float64(length - len(chain))))
- if length > len(chain) {
- var lastCluster uint32
-
- lastCluster = chain[0]
- for i := 1; i < len(chain); i++ {
- if f.isEofCluster(f.entries[lastCluster]) {
- break
- }
-
- lastCluster = chain[i]
- }
-
- for i := 0; i < change; i++ {
- newCluster, err := f.allocNew()
- if err != nil {
- return nil, err
- }
-
- f.entries[lastCluster] = newCluster
- lastCluster = newCluster
- }
- } else {
- panic("making chains smaller not implemented yet")
- }
-
- return f.Chain(start), nil
-}
-
-func (f *FAT) WriteToDevice(device fs.BlockDevice) error {
- fatBytes := f.Bytes()
- for i := 0; i < int(f.bs.NumFATs); i++ {
- offset := int64(f.bs.FATOffset(i))
- if _, err := device.WriteAt(fatBytes, offset); err != nil {
- return err
- }
- }
-
- return nil
-}
-
-func (f *FAT) entryMask() uint32 {
- switch f.bs.FATType() {
- case FAT12:
- return 0x0FFF
- case FAT16:
- return 0xFFFF
- default:
- return 0x0FFFFFFF
- }
-}
-
-func (f *FAT) isEofCluster(cluster uint32) bool {
- return cluster >= (0xFFFFFF8 & f.entryMask())
-}
-
-func (f *FAT) writeEntry12(data []byte, idx int, entry uint32) {
- dataIdx := idx + (idx / 2)
- data = data[dataIdx : dataIdx+2]
-
- if idx%2 == 1 {
- // ODD
- data[0] |= byte((entry & 0x0F) << 4)
- data[1] = byte((entry >> 4) & 0xFF)
- } else {
- // Even
- data[0] = byte(entry & 0xFF)
- data[1] = byte((entry >> 8) & 0x0F)
- }
-}
-
-func (f *FAT) writeEntry16(data []byte, idx int, entry uint32) {
- idx <<= 1
- data[idx] = byte(entry & 0xFF)
- data[idx+1] = byte((entry >> 8) & 0xFF)
-}
-
-func (f *FAT) writeEntry32(data []byte, idx int, entry uint32) {
- idx <<= 2
- data[idx] = byte(entry & 0xFF)
- data[idx+1] = byte((entry >> 8) & 0xFF)
- data[idx+2] = byte((entry >> 16) & 0xFF)
- data[idx+3] = byte((entry >> 24) & 0xFF)
-}
-
-// FATEntryCount returns the number of entries per fat for the given
-// boot sector.
-func FATEntryCount(bs *BootSectorCommon) uint32 {
- // Determine the number of entries that'll go in the FAT.
- var entryCount uint32 = bs.SectorsPerFat * uint32(bs.BytesPerSector)
- switch bs.FATType() {
- case FAT12:
- entryCount = uint32((uint64(entryCount) * 8) / 12)
- case FAT16:
- entryCount /= 2
- case FAT32:
- entryCount /= 4
- default:
- panic("impossible fat type")
- }
-
- return entryCount
-}
-
-func fatReadEntry12(data []byte, idx int) uint32 {
- idx += idx / 2
-
- var result uint32 = (uint32(data[idx+1]) << 8) | uint32(data[idx])
- if idx%2 == 0 {
- return result & 0xFFF
- } else {
- return result >> 4
- }
-}
-
-func fatReadEntry16(data []byte, idx int) uint32 {
- idx <<= 1
- return (uint32(data[idx+1]) << 8) | uint32(data[idx])
-}
-
-func fatReadEntry32(data []byte, idx int) uint32 {
- idx <<= 2
- return (uint32(data[idx+3]) << 24) |
- (uint32(data[idx+2]) << 16) |
- (uint32(data[idx+1]) << 8) |
- uint32(data[idx+0])
-}
diff --git a/vendor/github.com/mitchellh/go-fs/fat/file.go b/vendor/github.com/mitchellh/go-fs/fat/file.go
deleted file mode 100644
index 84d827e6..00000000
--- a/vendor/github.com/mitchellh/go-fs/fat/file.go
+++ /dev/null
@@ -1,26 +0,0 @@
-package fat
-
-type File struct {
- chain *ClusterChain
- dir *Directory
- entry *DirectoryClusterEntry
-}
-
-func (f *File) Read(p []byte) (n int, err error) {
- return f.chain.Read(p)
-}
-
-func (f *File) Write(p []byte) (n int, err error) {
- lastByte := f.chain.writeOffset + uint32(len(p))
- if lastByte > f.entry.fileSize {
- // Increase the file size since we're writing past the end of the file
- f.entry.fileSize = lastByte
-
- // Write the entry out
- if err := f.dir.dirCluster.WriteToDevice(f.dir.device, f.dir.fat); err != nil {
- return 0, err
- }
- }
-
- return f.chain.Write(p)
-}
diff --git a/vendor/github.com/mitchellh/go-fs/fat/filesystem.go b/vendor/github.com/mitchellh/go-fs/fat/filesystem.go
deleted file mode 100644
index 3102e0e6..00000000
--- a/vendor/github.com/mitchellh/go-fs/fat/filesystem.go
+++ /dev/null
@@ -1,57 +0,0 @@
-package fat
-
-import (
- "github.com/mitchellh/go-fs"
-)
-
-// FileSystem is the implementation of fs.FileSystem that can read a
-// FAT filesystem.
-type FileSystem struct {
- bs *BootSectorCommon
- device fs.BlockDevice
- fat *FAT
- rootDir *DirectoryCluster
-}
-
-// New returns a new FileSystem for accessing a previously created
-// FAT filesystem.
-func New(device fs.BlockDevice) (*FileSystem, error) {
- bs, err := DecodeBootSector(device)
- if err != nil {
- return nil, err
- }
-
- fat, err := DecodeFAT(device, bs, 0)
- if err != nil {
- return nil, err
- }
-
- var rootDir *DirectoryCluster
- if bs.FATType() == FAT32 {
- panic("FAT32 not implemented yet")
- } else {
- rootDir, err = DecodeFAT16RootDirectoryCluster(device, bs)
- if err != nil {
- return nil, err
- }
- }
-
- result := &FileSystem{
- bs: bs,
- device: device,
- fat: fat,
- rootDir: rootDir,
- }
-
- return result, nil
-}
-
-func (f *FileSystem) RootDir() (fs.Directory, error) {
- dir := &Directory{
- device: f.device,
- dirCluster: f.rootDir,
- fat: f.fat,
- }
-
- return dir, nil
-}
diff --git a/vendor/github.com/mitchellh/go-fs/fat/short_name.go b/vendor/github.com/mitchellh/go-fs/fat/short_name.go
deleted file mode 100644
index d4ca092e..00000000
--- a/vendor/github.com/mitchellh/go-fs/fat/short_name.go
+++ /dev/null
@@ -1,166 +0,0 @@
-package fat
-
-import (
- "bytes"
- "fmt"
- "strings"
-)
-
-// checksumShortName returns the checksum for the shortname that is used
-// for the long name entries.
-func checksumShortName(name string) uint8 {
- var sum uint8 = name[0]
- for i := uint8(1); i < 11; i++ {
- sum = name[i] + (((sum & 1) << 7) + ((sum & 0xFE) >> 1))
- }
-
- return sum
-}
-
-// generateShortName takes a list of existing short names and a long
-// name and generates the next valid short name. This process is done
-// according to the MS specification.
-func generateShortName(longName string, used []string) (string, error) {
- longName = strings.ToUpper(longName)
-
- // Split the string at the final "."
- dotIdx := strings.LastIndex(longName, ".")
-
- var ext string
- if dotIdx == -1 {
- dotIdx = len(longName)
- } else {
- ext = longName[dotIdx+1:]
- }
-
- ext = cleanShortString(ext)
- ext = ext[0:]
- rawName := longName[0:dotIdx]
- name := cleanShortString(rawName)
- simpleName := fmt.Sprintf("%s.%s", name, ext)
- if ext == "" {
- simpleName = simpleName[0 : len(simpleName)-1]
- }
-
- doSuffix := name != rawName || len(name) > 8
- if !doSuffix {
- for _, usedSingle := range used {
- if strings.ToUpper(usedSingle) == simpleName {
- doSuffix = true
- break
- }
- }
- }
-
- if doSuffix {
- found := false
- for i := 1; i < 99999; i++ {
- serial := fmt.Sprintf("~%d", i)
-
- nameOffset := 8 - len(serial)
- if len(name) < nameOffset {
- nameOffset = len(name)
- }
-
- serialName := fmt.Sprintf("%s%s", name[0:nameOffset], serial)
- simpleName = fmt.Sprintf("%s.%s", serialName, ext)
-
- exists := false
- for _, usedSingle := range used {
- if strings.ToUpper(usedSingle) == simpleName {
- exists = true
- break
- }
- }
-
- if !exists {
- found = true
- break
- }
- }
-
- if !found {
- return "", fmt.Errorf("could not generate short name for %s", longName)
- }
- }
-
- return simpleName, nil
-}
-
-// shortNameEntryValue returns the proper formatted short name value
-// for the directory cluster entry.
-func shortNameEntryValue(name string) string {
- var shortParts []string
- if name == "." || name == ".." {
- shortParts = []string{name, ""}
- } else {
- shortParts = strings.Split(name, ".")
- }
-
- if len(shortParts) == 1 {
- shortParts = append(shortParts, "")
- }
-
- if len(shortParts[0]) < 8 {
- var temp bytes.Buffer
- temp.WriteString(shortParts[0])
- for i := 0; i < 8-len(shortParts[0]); i++ {
- temp.WriteRune(' ')
- }
-
- shortParts[0] = temp.String()
- }
-
- if len(shortParts[1]) < 3 {
- var temp bytes.Buffer
- temp.WriteString(shortParts[1])
- for i := 0; i < 3-len(shortParts[1]); i++ {
- temp.WriteRune(' ')
- }
-
- shortParts[1] = temp.String()
- }
-
- return fmt.Sprintf("%s%s", shortParts[0], shortParts[1])
-}
-
-func cleanShortString(v string) string {
- var result bytes.Buffer
- for _, char := range v {
- // We skip these chars
- if char == '.' || char == ' ' {
- continue
- }
-
- if !validShortChar(char) {
- char = '_'
- }
-
- result.WriteRune(char)
- }
-
- return result.String()
-}
-
-func validShortChar(char rune) bool {
- if char >= 'A' && char <= 'Z' {
- return true
- }
-
- if char >= '0' && char <= '9' {
- return true
- }
-
- validShortSymbols := []rune{
- '_', '^', '$', '~', '!', '#', '%', '&', '-', '{', '}', '(',
- ')', '@', '\'', '`',
- }
-
- for _, valid := range validShortSymbols {
- if char == valid {
- return true
- }
- }
-
- return false
-}
diff --git a/vendor/github.com/mitchellh/go-fs/fat/super_floppy.go b/vendor/github.com/mitchellh/go-fs/fat/super_floppy.go
deleted file mode 100644
index acbcf259..00000000
--- a/vendor/github.com/mitchellh/go-fs/fat/super_floppy.go
+++ /dev/null
@@ -1,250 +0,0 @@
-package fat
-
-import (
- "errors"
- "fmt"
- "github.com/mitchellh/go-fs"
- "time"
-)
-
-// SuperFloppyConfig is the configuration for various properties of
-// a new super floppy formatted block device. Once this configuration is used
-// to format a device, it must not be modified.
-type SuperFloppyConfig struct {
- // The type of FAT filesystem to use.
- FATType FATType
-
- // The label of the drive. Defaults to "NONAME"
- Label string
-
- // The OEM name for the FAT filesystem. Defaults to "gofs" if not set.
- OEMName string
-}
-
-// Formats an fs.BlockDevice with the "super floppy" format according
-// to the given configuration. The "super floppy" standard means that the
-// device will be formatted so that it does not contain a partition table.
-// Instead, the entire device holds a single FAT file system.
-func FormatSuperFloppy(device fs.BlockDevice, config *SuperFloppyConfig) error {
- formatter := &superFloppyFormatter{
- config: config,
- device: device,
- }
-
- return formatter.format()
-}
-
-// An internal struct that helps maintain state and perform calculations
-// during a single formatting pass.
-type superFloppyFormatter struct {
- config *SuperFloppyConfig
- device fs.BlockDevice
-}
-
-func (f *superFloppyFormatter) format() error {
- // First, create the boot sector on the device. Start by configuring
- // the common elements of the boot sector.
- sectorsPerCluster, err := f.SectorsPerCluster()
- if err != nil {
- return err
- }
-
- bsCommon := BootSectorCommon{
- BytesPerSector: uint16(f.device.SectorSize()),
- Media: MediaFixed,
- NumFATs: 2,
- NumHeads: 16,
- OEMName: f.config.OEMName,
- ReservedSectorCount: f.ReservedSectorCount(),
- SectorsPerCluster: sectorsPerCluster,
- SectorsPerTrack: 32,
- TotalSectors: uint32(f.device.Len() / int64(f.device.SectorSize())),
- }
-
- // Next, fill in the FAT-type specific boot sector information
- switch f.config.FATType {
- case FAT12, FAT16:
- // Determine the filesystem type label, standard from the spec sheet
- var label string
- if f.config.FATType == FAT12 {
- label = "FAT12 "
- } else {
- label = "FAT16 "
- }
-
- // Determine the number of root directory entries
- if f.device.Len() > 512*5*32 {
- bsCommon.RootEntryCount = 512
- } else {
- bsCommon.RootEntryCount = uint16(f.device.Len() / (5 * 32))
- }
-
- bsCommon.SectorsPerFat = f.sectorsPerFat(bsCommon.RootEntryCount, sectorsPerCluster)
-
- bs := &BootSectorFat16{
- BootSectorCommon: bsCommon,
- FileSystemTypeLabel: label,
- VolumeLabel: f.config.Label,
- }
-
- // Write the boot sector
- bsBytes, err := bs.Bytes()
- if err != nil {
- return err
- }
-
- if _, err := f.device.WriteAt(bsBytes, 0); err != nil {
- return err
- }
- case FAT32:
- bsCommon.SectorsPerFat = f.sectorsPerFat(0, sectorsPerCluster)
-
- bs := &BootSectorFat32{
- BootSectorCommon: bsCommon,
- FileSystemTypeLabel: "FAT32 ",
- FSInfoSector: 1,
- VolumeID: uint32(time.Now().Unix()),
- VolumeLabel: f.config.Label,
- }
-
- // Write the boot sector
- bsBytes, err := bs.Bytes()
- if err != nil {
- return err
- }
-
- if _, err := f.device.WriteAt(bsBytes, 0); err != nil {
- return err
- }
-
- // TODO(mitchellh): Create the fsinfo structure
- // TODO(mitchellh): write the boot sector copy
- default:
- return fmt.Errorf("Unknown FAT type: %d", f.config.FATType)
- }
-
- // Create the FATs
- fat, err := NewFAT(&bsCommon)
- if err != nil {
- return err
- }
-
- // Write the FAT
- if err := fat.WriteToDevice(f.device); err != nil {
- return err
- }
-
- var rootDir *DirectoryCluster
- if f.config.FATType == FAT32 {
- panic("TODO")
- } else {
- rootDir, err = NewFat16RootDirectoryCluster(&bsCommon, f.config.Label)
- if err != nil {
- return err
- }
-
- offset := int64(bsCommon.RootDirOffset())
- if _, err := f.device.WriteAt(rootDir.Bytes(), offset); err != nil {
- return err
- }
- }
-
- return nil
-}
-
-func (f *superFloppyFormatter) ReservedSectorCount() uint16 {
- if f.config.FATType == FAT32 {
- return 32
- } else {
- return 1
- }
-}
-
-func (f *superFloppyFormatter) SectorsPerCluster() (uint8, error) {
- if f.config.FATType == FAT12 {
- return f.defaultSectorsPerCluster12()
- } else if f.config.FATType == FAT16 {
- return f.defaultSectorsPerCluster16()
- } else {
- return f.defaultSectorsPerCluster32()
- }
-}
-
-func (f *superFloppyFormatter) defaultSectorsPerCluster12() (uint8, error) {
- var result uint8 = 1
- sectors := f.device.Len() / int64(f.device.SectorSize())
-
- for (sectors / int64(result)) > 4084 {
- result *= 2
- if int(result)*f.device.SectorSize() > 4096 {
- return 0, errors.New("disk too large for FAT12")
- }
- }
-
- return result, nil
-}
-
-func (f *superFloppyFormatter) defaultSectorsPerCluster16() (uint8, error) {
- sectors := f.device.Len() / int64(f.device.SectorSize())
-
- if sectors <= 8400 {
- return 0, errors.New("disk too small for FAT16")
- } else if sectors > 4194304 {
- return 0, errors.New("disk too large for FAT16")
- }
-
- switch {
- case sectors > 2097152:
- return 64, nil
- case sectors > 1048576:
- return 32, nil
- case sectors > 524288:
- return 16, nil
- case sectors > 262144:
- return 8, nil
- case sectors > 32680:
- return 4, nil
- default:
- return 2, nil
- }
-}
-
-func (f *superFloppyFormatter) defaultSectorsPerCluster32() (uint8, error) {
- sectors := f.device.Len() / int64(f.device.SectorSize())
-
- if sectors <= 66600 {
- return 0, errors.New("disk too small for FAT32")
- }
-
- switch {
- case sectors > 67108864:
- return 64, nil
- case sectors > 33554432:
- return 32, nil
- case sectors > 16777216:
- return 16, nil
- case sectors > 532480:
- return 8, nil
- default:
- return 1, nil
- }
-}
-
-func (f *superFloppyFormatter) fatCount() uint8 {
- return 2
-}
-
-func (f *superFloppyFormatter) sectorsPerFat(rootEntCount uint16, sectorsPerCluster uint8) uint32 {
- bytesPerSec := f.device.SectorSize()
- totalSectors := int(f.device.Len()) / bytesPerSec
- rootDirSectors := ((int(rootEntCount) * 32) + (bytesPerSec - 1)) / bytesPerSec
-
- tmp1 := totalSectors - (int(f.ReservedSectorCount()) + rootDirSectors)
- tmp2 := (256 * int(sectorsPerCluster)) + int(f.fatCount())
-
- if f.config.FATType == FAT32 {
- tmp2 /= 2
- }
-
- return uint32((tmp1 + (tmp2 - 1)) / tmp2)
-}
diff --git a/vendor/github.com/mitchellh/go-fs/fat/type.go b/vendor/github.com/mitchellh/go-fs/fat/type.go
deleted file mode 100644
index 9fc5eda5..00000000
--- a/vendor/github.com/mitchellh/go-fs/fat/type.go
+++ /dev/null
@@ -1,26 +0,0 @@
-package fat
-
-import "github.com/mitchellh/go-fs"
-
-// FATType is a simple enum of the available FAT filesystem types.
-type FATType uint8
-
-const (
- FAT12 FATType = iota
- FAT16
- FAT32
-)
-
-// TypeForDevice determines the usable FAT type based solely on
-// size information about the block device.
-func TypeForDevice(device fs.BlockDevice) FATType {
- sizeInMB := device.Len() / (1024 * 1024)
- switch {
- case sizeInMB < 4:
- return FAT12
- case sizeInMB < 512:
- return FAT16
- default:
- return FAT32
- }
-}
diff --git a/vendor/github.com/mitchellh/go-fs/file.go b/vendor/github.com/mitchellh/go-fs/file.go
deleted file mode 100644
index a19eb376..00000000
--- a/vendor/github.com/mitchellh/go-fs/file.go
+++ /dev/null
@@ -1,9 +0,0 @@
-package fs
-
-import "io"
-
-// File is a single file within a filesystem.
-type File interface {
- io.Reader
- io.Writer
-}
diff --git a/vendor/github.com/mitchellh/go-fs/file_disk.go b/vendor/github.com/mitchellh/go-fs/file_disk.go
deleted file mode 100644
index da449730..00000000
--- a/vendor/github.com/mitchellh/go-fs/file_disk.go
+++ /dev/null
@@ -1,52 +0,0 @@
-package fs
-
-import (
- "errors"
- "os"
-)
-
-// A FileDisk is an implementation of a BlockDevice that uses a
-// *os.File as its backing store.
-type FileDisk struct {
- f *os.File
- size int64
-}
-
-// NewFileDisk creates a new FileDisk from the given *os.File. The
-// file must already be created and set the to the proper size.
-func NewFileDisk(f *os.File) (*FileDisk, error) {
- fi, err := f.Stat()
- if err != nil {
- return nil, err
- }
-
- if fi.IsDir() {
- return nil, errors.New("file is a directory")
- }
-
- return &FileDisk{
- f: f,
- size: fi.Size(),
- }, nil
-}
-
-func (f *FileDisk) Close() error {
- return f.f.Close()
-}
-
-func (f *FileDisk) Len() int64 {
- return f.size
-}
-
-func (f *FileDisk) ReadAt(p []byte, off int64) (int, error) {
- return f.f.ReadAt(p, off)
-}
-
-func (f *FileDisk) SectorSize() int {
- // Hardcoded for now, one day we may want to make this customizable
- return 512
-}
-
-func (f *FileDisk) WriteAt(p []byte, off int64) (int, error) {
- return f.f.WriteAt(p, off)
-}
diff --git a/vendor/github.com/mitchellh/go-fs/filesystem.go b/vendor/github.com/mitchellh/go-fs/filesystem.go
deleted file mode 100644
index 6cf91373..00000000
--- a/vendor/github.com/mitchellh/go-fs/filesystem.go
+++ /dev/null
@@ -1,8 +0,0 @@
-package fs
-
-// A FileSystem provides access to a tree hierarchy of directories
-// and files.
-type FileSystem interface {
- // RootDir returns the single root directory.
- RootDir() (Directory, error)
-}
diff --git a/vendor/github.com/mitchellh/iochan/LICENSE.md b/vendor/github.com/mitchellh/iochan/LICENSE.md
deleted file mode 100644
index 762008c2..00000000
--- a/vendor/github.com/mitchellh/iochan/LICENSE.md
+++ /dev/null
@@ -1,21 +0,0 @@
-The MIT License (MIT)
-
-Copyright (c) 2015 Mitchell Hashimoto
-
-Permission is hereby granted, free of charge, to any person obtaining a copy
-of this software and associated documentation files (the "Software"), to deal
-in the Software without restriction, including without limitation the rights
-to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
-copies of the Software, and to permit persons to whom the Software is
-furnished to do so, subject to the following conditions:
-
-The above copyright notice and this permission notice shall be included in
-all copies or substantial portions of the Software.
-
-THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
-OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
-THE SOFTWARE.
diff --git a/vendor/github.com/mitchellh/iochan/README.md b/vendor/github.com/mitchellh/iochan/README.md
deleted file mode 100644
index 23771b1b..00000000
--- a/vendor/github.com/mitchellh/iochan/README.md
+++ /dev/null
@@ -1,13 +0,0 @@
-# iochan
-
-iochan is a Go library for treating `io` readers and writers like channels.
-This is useful when sometimes you wish to use `io.Reader` and such in `select`
-statements.
-
-## Installation
-
-Standard `go get`:
-
-```
-$ go get github.com/mitchellh/iochan
-```
diff --git a/vendor/github.com/mitchellh/iochan/iochan.go b/vendor/github.com/mitchellh/iochan/iochan.go
deleted file mode 100644
index c10cef02..00000000
--- a/vendor/github.com/mitchellh/iochan/iochan.go
+++ /dev/null
@@ -1,41 +0,0 @@
-package iochan
-
-import (
- "bufio"
- "io"
-)
-
-// DelimReader takes an io.Reader and produces the contents of the reader
-// on the returned channel. The contents on the channel will be returned
-// on boundaries specified by the delim parameter, and will include this
-// delimiter.
-//
-// If an error occurs while reading from the reader, the reading will end.
-//
-// In the case of an EOF or error, the channel will be closed.
-//
-// This must only be called once for any individual reader. The behavior is
-// unknown and will be unexpected if this is called multiple times with the
-// same reader.
-func DelimReader(r io.Reader, delim byte) <-chan string {
- ch := make(chan string)
-
- go func() {
- buf := bufio.NewReader(r)
-
- for {
- line, err := buf.ReadString(delim)
- if line != "" {
- ch <- line
- }
-
- if err != nil {
- break
- }
- }
-
- close(ch)
- }()
-
- return ch
-}
diff --git a/vendor/github.com/mitchellh/mapstructure/.travis.yml b/vendor/github.com/mitchellh/mapstructure/.travis.yml
deleted file mode 100644
index 7f3fe9a9..00000000
--- a/vendor/github.com/mitchellh/mapstructure/.travis.yml
+++ /dev/null
@@ -1,7 +0,0 @@
-language: go
-
-go:
- - 1.4
-
-script:
- - go test
diff --git a/vendor/github.com/mitchellh/mapstructure/LICENSE b/vendor/github.com/mitchellh/mapstructure/LICENSE
deleted file mode 100644
index f9c841a5..00000000
--- a/vendor/github.com/mitchellh/mapstructure/LICENSE
+++ /dev/null
@@ -1,21 +0,0 @@
-The MIT License (MIT)
-
-Copyright (c) 2013 Mitchell Hashimoto
-
-Permission is hereby granted, free of charge, to any person obtaining a copy
-of this software and associated documentation files (the "Software"), to deal
-in the Software without restriction, including without limitation the rights
-to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
-copies of the Software, and to permit persons to whom the Software is
-furnished to do so, subject to the following conditions:
-
-The above copyright notice and this permission notice shall be included in
-all copies or substantial portions of the Software.
-
-THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
-OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
-THE SOFTWARE.
diff --git a/vendor/github.com/mitchellh/mapstructure/README.md b/vendor/github.com/mitchellh/mapstructure/README.md
deleted file mode 100644
index 659d6885..00000000
--- a/vendor/github.com/mitchellh/mapstructure/README.md
+++ /dev/null
@@ -1,46 +0,0 @@
-# mapstructure
-
-mapstructure is a Go library for decoding generic map values to structures
-and vice versa, while providing helpful error handling.
-
-This library is most useful when decoding values from some data stream (JSON,
-Gob, etc.) where you don't _quite_ know the structure of the underlying data
-until you read a part of it. You can therefore read a `map[string]interface{}`
-and use this library to decode it into the proper underlying native Go
-structure.
-
-## Installation
-
-Standard `go get`:
-
-```
-$ go get github.com/mitchellh/mapstructure
-```
-
-## Usage & Example
-
-For usage and examples see the [Godoc](http://godoc.org/github.com/mitchellh/mapstructure).
-
-The `Decode` function has examples associated with it there.
-
-## But Why?!
-
-Go offers fantastic standard libraries for decoding formats such as JSON.
-The standard method is to have a struct pre-created, and populate that struct
-from the bytes of the encoded format. This is great, but the problem is if
-you have configuration or an encoding that changes slightly depending on
-specific fields. For example, consider this JSON:
-
-```json
-{
- "type": "person",
- "name": "Mitchell"
-}
-```
-
-Perhaps we can't populate a specific structure without first reading
-the "type" field from the JSON. We could always do two passes over the
-decoding of the JSON (reading the "type" first, and the rest later).
-However, it is much simpler to just decode this into a `map[string]interface{}`
-structure, read the "type" key, then use something like this library
-to decode it into the proper structure.
diff --git a/vendor/github.com/mitchellh/mapstructure/decode_hooks.go b/vendor/github.com/mitchellh/mapstructure/decode_hooks.go
deleted file mode 100644
index aa91f76c..00000000
--- a/vendor/github.com/mitchellh/mapstructure/decode_hooks.go
+++ /dev/null
@@ -1,151 +0,0 @@
-package mapstructure
-
-import (
- "errors"
- "reflect"
- "strconv"
- "strings"
- "time"
-)
-
-// typedDecodeHook takes a raw DecodeHookFunc (an interface{}) and turns
-// it into the proper DecodeHookFunc type, such as DecodeHookFuncType.
-func typedDecodeHook(h DecodeHookFunc) DecodeHookFunc {
- // Create variables here so we can reference them with the reflect pkg
- var f1 DecodeHookFuncType
- var f2 DecodeHookFuncKind
-
- // Fill in the variables into this interface and the rest is done
- // automatically using the reflect package.
- potential := []interface{}{f1, f2}
-
- v := reflect.ValueOf(h)
- vt := v.Type()
- for _, raw := range potential {
- pt := reflect.ValueOf(raw).Type()
- if vt.ConvertibleTo(pt) {
- return v.Convert(pt).Interface()
- }
- }
-
- return nil
-}
-
-// DecodeHookExec executes the given decode hook. This should be used
-// since it'll naturally degrade to the older backwards compatible DecodeHookFunc
-// that took reflect.Kind instead of reflect.Type.
-func DecodeHookExec(
- raw DecodeHookFunc,
- from reflect.Type, to reflect.Type,
- data interface{}) (interface{}, error) {
- // Build our arguments that reflect expects
- argVals := make([]reflect.Value, 3)
- argVals[0] = reflect.ValueOf(from)
- argVals[1] = reflect.ValueOf(to)
- argVals[2] = reflect.ValueOf(data)
-
- switch f := typedDecodeHook(raw).(type) {
- case DecodeHookFuncType:
- return f(from, to, data)
- case DecodeHookFuncKind:
- return f(from.Kind(), to.Kind(), data)
- default:
- return nil, errors.New("invalid decode hook signature")
- }
-}
-
-// ComposeDecodeHookFunc creates a single DecodeHookFunc that
-// automatically composes multiple DecodeHookFuncs.
-//
-// The composed funcs are called in order, with the result of the
-// previous transformation.
-func ComposeDecodeHookFunc(fs ...DecodeHookFunc) DecodeHookFunc {
- return func(
- f reflect.Type,
- t reflect.Type,
- data interface{}) (interface{}, error) {
- var err error
- for _, f1 := range fs {
- data, err = DecodeHookExec(f1, f, t, data)
- if err != nil {
- return nil, err
- }
-
- // Modify the from kind to be correct with the new data
- f = reflect.ValueOf(data).Type()
- }
-
- return data, nil
- }
-}
-
-// StringToSliceHookFunc returns a DecodeHookFunc that converts
-// string to []string by splitting on the given sep.
-func StringToSliceHookFunc(sep string) DecodeHookFunc {
- return func(
- f reflect.Kind,
- t reflect.Kind,
- data interface{}) (interface{}, error) {
- if f != reflect.String || t != reflect.Slice {
- return data, nil
- }
-
- raw := data.(string)
- if raw == "" {
- return []string{}, nil
- }
-
- return strings.Split(raw, sep), nil
- }
-}
-
-// StringToTimeDurationHookFunc returns a DecodeHookFunc that converts
-// strings to time.Duration.
-func StringToTimeDurationHookFunc() DecodeHookFunc {
- return func(
- f reflect.Type,
- t reflect.Type,
- data interface{}) (interface{}, error) {
- if f.Kind() != reflect.String {
- return data, nil
- }
- if t != reflect.TypeOf(time.Duration(5)) {
- return data, nil
- }
-
- // Convert it by parsing
- return time.ParseDuration(data.(string))
- }
-}
-
-func WeaklyTypedHook(
- f reflect.Kind,
- t reflect.Kind,
- data interface{}) (interface{}, error) {
- dataVal := reflect.ValueOf(data)
- switch t {
- case reflect.String:
- switch f {
- case reflect.Bool:
- if dataVal.Bool() {
- return "1", nil
- } else {
- return "0", nil
- }
- case reflect.Float32:
- return strconv.FormatFloat(dataVal.Float(), 'f', -1, 64), nil
- case reflect.Int:
- return strconv.FormatInt(dataVal.Int(), 10), nil
- case reflect.Slice:
- dataType := dataVal.Type()
- elemKind := dataType.Elem().Kind()
- if elemKind == reflect.Uint8 {
- return string(dataVal.Interface().([]uint8)), nil
- }
- case reflect.Uint:
- return strconv.FormatUint(dataVal.Uint(), 10), nil
- }
- }
-
- return data, nil
-}
diff --git a/vendor/github.com/mitchellh/mapstructure/error.go b/vendor/github.com/mitchellh/mapstructure/error.go
deleted file mode 100644
index 47a99e5a..00000000
--- a/vendor/github.com/mitchellh/mapstructure/error.go
+++ /dev/null
@@ -1,50 +0,0 @@
-package mapstructure
-
-import (
- "errors"
- "fmt"
- "sort"
- "strings"
-)
-
-// Error implements the error interface and can represents multiple
-// errors that occur in the course of a single decode.
-type Error struct {
- Errors []string
-}
-
-func (e *Error) Error() string {
- points := make([]string, len(e.Errors))
- for i, err := range e.Errors {
- points[i] = fmt.Sprintf("* %s", err)
- }
-
- sort.Strings(points)
- return fmt.Sprintf(
- "%d error(s) decoding:\n\n%s",
- len(e.Errors), strings.Join(points, "\n"))
-}
-
-// WrappedErrors implements the errwrap.Wrapper interface to make this
-// return value more useful with the errwrap and go-multierror libraries.
-func (e *Error) WrappedErrors() []error {
- if e == nil {
- return nil
- }
-
- result := make([]error, len(e.Errors))
- for i, e := range e.Errors {
- result[i] = errors.New(e)
- }
-
- return result
-}
-
-func appendErrors(errors []string, err error) []string {
- switch e := err.(type) {
- case *Error:
- return append(errors, e.Errors...)
- default:
- return append(errors, e.Error())
- }
-}
diff --git a/vendor/github.com/mitchellh/mapstructure/mapstructure.go b/vendor/github.com/mitchellh/mapstructure/mapstructure.go
deleted file mode 100644
index 50d6b396..00000000
--- a/vendor/github.com/mitchellh/mapstructure/mapstructure.go
+++ /dev/null
@@ -1,745 +0,0 @@
-// The mapstructure package exposes functionality to convert an
-// abitrary map[string]interface{} into a native Go structure.
-//
-// The Go structure can be arbitrarily complex, containing slices,
-// other structs, etc. and the decoder will properly decode nested
-// maps and so on into the proper structures in the native Go struct.
-// See the examples to see what the decoder is capable of.
-package mapstructure
-
-import (
- "errors"
- "fmt"
- "reflect"
- "sort"
- "strconv"
- "strings"
-)
-
-// DecodeHookFunc is the callback function that can be used for
-// data transformations. See "DecodeHook" in the DecoderConfig
-// struct.
-//
-// The type should be DecodeHookFuncType or DecodeHookFuncKind.
-// Either is accepted. Types are a superset of Kinds (Types can return
-// Kinds) and are generally a richer thing to use, but Kinds are simpler
-// if you only need those.
-//
-// The reason DecodeHookFunc is multi-typed is for backwards compatibility:
-// we started with Kinds and then realized Types were the better solution,
-// but have a promise to not break backwards compat so we now support
-// both.
-type DecodeHookFunc interface{}
-
-type DecodeHookFuncType func(reflect.Type, reflect.Type, interface{}) (interface{}, error)
-type DecodeHookFuncKind func(reflect.Kind, reflect.Kind, interface{}) (interface{}, error)
-
-// DecoderConfig is the configuration that is used to create a new decoder
-// and allows customization of various aspects of decoding.
-type DecoderConfig struct {
- // DecodeHook, if set, will be called before any decoding and any
- // type conversion (if WeaklyTypedInput is on). This lets you modify
- // the values before they're set down onto the resulting struct.
- //
- // If an error is returned, the entire decode will fail with that
- // error.
- DecodeHook DecodeHookFunc
-
- // If ErrorUnused is true, then it is an error for there to exist
- // keys in the original map that were unused in the decoding process
- // (extra keys).
- ErrorUnused bool
-
- // ZeroFields, if set to true, will zero fields before writing them.
- // For example, a map will be emptied before decoded values are put in
- // it. If this is false, a map will be merged.
- ZeroFields bool
-
- // If WeaklyTypedInput is true, the decoder will make the following
- // "weak" conversions:
- //
- // - bools to string (true = "1", false = "0")
- // - numbers to string (base 10)
- // - bools to int/uint (true = 1, false = 0)
- // - strings to int/uint (base implied by prefix)
- // - int to bool (true if value != 0)
- // - string to bool (accepts: 1, t, T, TRUE, true, True, 0, f, F,
- // FALSE, false, False. Anything else is an error)
- // - empty array = empty map and vice versa
- // - negative numbers to overflowed uint values (base 10)
- //
- WeaklyTypedInput bool
-
- // Metadata is the struct that will contain extra metadata about
- // the decoding. If this is nil, then no metadata will be tracked.
- Metadata *Metadata
-
- // Result is a pointer to the struct that will contain the decoded
- // value.
- Result interface{}
-
- // The tag name that mapstructure reads for field names. This
- // defaults to "mapstructure"
- TagName string
-}
-
-// A Decoder takes a raw interface value and turns it into structured
-// data, keeping track of rich error information along the way in case
-// anything goes wrong. Unlike the basic top-level Decode method, you can
-// more finely control how the Decoder behaves using the DecoderConfig
-// structure. The top-level Decode method is just a convenience that sets
-// up the most basic Decoder.
-type Decoder struct {
- config *DecoderConfig
-}
-
-// Metadata contains information about decoding a structure that
-// is tedious or difficult to get otherwise.
-type Metadata struct {
- // Keys are the keys of the structure which were successfully decoded
- Keys []string
-
- // Unused is a slice of keys that were found in the raw value but
- // weren't decoded since there was no matching field in the result interface
- Unused []string
-}
-
-// Decode takes a map and uses reflection to convert it into the
-// given Go native structure. val must be a pointer to a struct.
-func Decode(m interface{}, rawVal interface{}) error {
- config := &DecoderConfig{
- Metadata: nil,
- Result: rawVal,
- }
-
- decoder, err := NewDecoder(config)
- if err != nil {
- return err
- }
-
- return decoder.Decode(m)
-}
-
-// WeakDecode is the same as Decode but is shorthand to enable
-// WeaklyTypedInput. See DecoderConfig for more info.
-func WeakDecode(input, output interface{}) error {
- config := &DecoderConfig{
- Metadata: nil,
- Result: output,
- WeaklyTypedInput: true,
- }
-
- decoder, err := NewDecoder(config)
- if err != nil {
- return err
- }
-
- return decoder.Decode(input)
-}
-
-// NewDecoder returns a new decoder for the given configuration. Once
-// a decoder has been returned, the same configuration must not be used
-// again.
-func NewDecoder(config *DecoderConfig) (*Decoder, error) {
- val := reflect.ValueOf(config.Result)
- if val.Kind() != reflect.Ptr {
- return nil, errors.New("result must be a pointer")
- }
-
- val = val.Elem()
- if !val.CanAddr() {
- return nil, errors.New("result must be addressable (a pointer)")
- }
-
- if config.Metadata != nil {
- if config.Metadata.Keys == nil {
- config.Metadata.Keys = make([]string, 0)
- }
-
- if config.Metadata.Unused == nil {
- config.Metadata.Unused = make([]string, 0)
- }
- }
-
- if config.TagName == "" {
- config.TagName = "mapstructure"
- }
-
- result := &Decoder{
- config: config,
- }
-
- return result, nil
-}
-
-// Decode decodes the given raw interface to the target pointer specified
-// by the configuration.
-func (d *Decoder) Decode(raw interface{}) error {
- return d.decode("", raw, reflect.ValueOf(d.config.Result).Elem())
-}
-
-// Decodes an unknown data type into a specific reflection value.
-func (d *Decoder) decode(name string, data interface{}, val reflect.Value) error {
- if data == nil {
- // If the data is nil, then we don't set anything.
- return nil
- }
-
- dataVal := reflect.ValueOf(data)
- if !dataVal.IsValid() {
- // If the data value is invalid, then we just set the value
- // to be the zero value.
- val.Set(reflect.Zero(val.Type()))
- return nil
- }
-
- if d.config.DecodeHook != nil {
- // We have a DecodeHook, so let's pre-process the data.
- var err error
- data, err = DecodeHookExec(
- d.config.DecodeHook,
- dataVal.Type(), val.Type(), data)
- if err != nil {
- return err
- }
- }
-
- var err error
- dataKind := getKind(val)
- switch dataKind {
- case reflect.Bool:
- err = d.decodeBool(name, data, val)
- case reflect.Interface:
- err = d.decodeBasic(name, data, val)
- case reflect.String:
- err = d.decodeString(name, data, val)
- case reflect.Int:
- err = d.decodeInt(name, data, val)
- case reflect.Uint:
- err = d.decodeUint(name, data, val)
- case reflect.Float32:
- err = d.decodeFloat(name, data, val)
- case reflect.Struct:
- err = d.decodeStruct(name, data, val)
- case reflect.Map:
- err = d.decodeMap(name, data, val)
- case reflect.Ptr:
- err = d.decodePtr(name, data, val)
- case reflect.Slice:
- err = d.decodeSlice(name, data, val)
- default:
- // If we reached this point then we weren't able to decode it
- return fmt.Errorf("%s: unsupported type: %s", name, dataKind)
- }
-
- // If we reached here, then we successfully decoded SOMETHING, so
- // mark the key as used if we're tracking metadata.
- if d.config.Metadata != nil && name != "" {
- d.config.Metadata.Keys = append(d.config.Metadata.Keys, name)
- }
-
- return err
-}
-
-// This decodes a basic type (bool, int, string, etc.) and sets the
-// value to "data" of that type.
-func (d *Decoder) decodeBasic(name string, data interface{}, val reflect.Value) error {
- dataVal := reflect.ValueOf(data)
- dataValType := dataVal.Type()
- if !dataValType.AssignableTo(val.Type()) {
- return fmt.Errorf(
- "'%s' expected type '%s', got '%s'",
- name, val.Type(), dataValType)
- }
-
- val.Set(dataVal)
- return nil
-}
-
-func (d *Decoder) decodeString(name string, data interface{}, val reflect.Value) error {
- dataVal := reflect.ValueOf(data)
- dataKind := getKind(dataVal)
-
- converted := true
- switch {
- case dataKind == reflect.String:
- val.SetString(dataVal.String())
- case dataKind == reflect.Bool && d.config.WeaklyTypedInput:
- if dataVal.Bool() {
- val.SetString("1")
- } else {
- val.SetString("0")
- }
- case dataKind == reflect.Int && d.config.WeaklyTypedInput:
- val.SetString(strconv.FormatInt(dataVal.Int(), 10))
- case dataKind == reflect.Uint && d.config.WeaklyTypedInput:
- val.SetString(strconv.FormatUint(dataVal.Uint(), 10))
- case dataKind == reflect.Float32 && d.config.WeaklyTypedInput:
- val.SetString(strconv.FormatFloat(dataVal.Float(), 'f', -1, 64))
- case dataKind == reflect.Slice && d.config.WeaklyTypedInput:
- dataType := dataVal.Type()
- elemKind := dataType.Elem().Kind()
- switch {
- case elemKind == reflect.Uint8:
- val.SetString(string(dataVal.Interface().([]uint8)))
- default:
- converted = false
- }
- default:
- converted = false
- }
-
- if !converted {
- return fmt.Errorf(
- "'%s' expected type '%s', got unconvertible type '%s'",
- name, val.Type(), dataVal.Type())
- }
-
- return nil
-}
-
-func (d *Decoder) decodeInt(name string, data interface{}, val reflect.Value) error {
- dataVal := reflect.ValueOf(data)
- dataKind := getKind(dataVal)
-
- switch {
- case dataKind == reflect.Int:
- val.SetInt(dataVal.Int())
- case dataKind == reflect.Uint:
- val.SetInt(int64(dataVal.Uint()))
- case dataKind == reflect.Float32:
- val.SetInt(int64(dataVal.Float()))
- case dataKind == reflect.Bool && d.config.WeaklyTypedInput:
- if dataVal.Bool() {
- val.SetInt(1)
- } else {
- val.SetInt(0)
- }
- case dataKind == reflect.String && d.config.WeaklyTypedInput:
- i, err := strconv.ParseInt(dataVal.String(), 0, val.Type().Bits())
- if err == nil {
- val.SetInt(i)
- } else {
- return fmt.Errorf("cannot parse '%s' as int: %s", name, err)
- }
- default:
- return fmt.Errorf(
- "'%s' expected type '%s', got unconvertible type '%s'",
- name, val.Type(), dataVal.Type())
- }
-
- return nil
-}
-
-func (d *Decoder) decodeUint(name string, data interface{}, val reflect.Value) error {
- dataVal := reflect.ValueOf(data)
- dataKind := getKind(dataVal)
-
- switch {
- case dataKind == reflect.Int:
- i := dataVal.Int()
- if i < 0 && !d.config.WeaklyTypedInput {
- return fmt.Errorf("cannot parse '%s', %d overflows uint",
- name, i)
- }
- val.SetUint(uint64(i))
- case dataKind == reflect.Uint:
- val.SetUint(dataVal.Uint())
- case dataKind == reflect.Float32:
- f := dataVal.Float()
- if f < 0 && !d.config.WeaklyTypedInput {
- return fmt.Errorf("cannot parse '%s', %f overflows uint",
- name, f)
- }
- val.SetUint(uint64(f))
- case dataKind == reflect.Bool && d.config.WeaklyTypedInput:
- if dataVal.Bool() {
- val.SetUint(1)
- } else {
- val.SetUint(0)
- }
- case dataKind == reflect.String && d.config.WeaklyTypedInput:
- i, err := strconv.ParseUint(dataVal.String(), 0, val.Type().Bits())
- if err == nil {
- val.SetUint(i)
- } else {
- return fmt.Errorf("cannot parse '%s' as uint: %s", name, err)
- }
- default:
- return fmt.Errorf(
- "'%s' expected type '%s', got unconvertible type '%s'",
- name, val.Type(), dataVal.Type())
- }
-
- return nil
-}
-
-func (d *Decoder) decodeBool(name string, data interface{}, val reflect.Value) error {
- dataVal := reflect.ValueOf(data)
- dataKind := getKind(dataVal)
-
- switch {
- case dataKind == reflect.Bool:
- val.SetBool(dataVal.Bool())
- case dataKind == reflect.Int && d.config.WeaklyTypedInput:
- val.SetBool(dataVal.Int() != 0)
- case dataKind == reflect.Uint && d.config.WeaklyTypedInput:
- val.SetBool(dataVal.Uint() != 0)
- case dataKind == reflect.Float32 && d.config.WeaklyTypedInput:
- val.SetBool(dataVal.Float() != 0)
- case dataKind == reflect.String && d.config.WeaklyTypedInput:
- b, err := strconv.ParseBool(dataVal.String())
- if err == nil {
- val.SetBool(b)
- } else if dataVal.String() == "" {
- val.SetBool(false)
- } else {
- return fmt.Errorf("cannot parse '%s' as bool: %s", name, err)
- }
- default:
- return fmt.Errorf(
- "'%s' expected type '%s', got unconvertible type '%s'",
- name, val.Type(), dataVal.Type())
- }
-
- return nil
-}
-
-func (d *Decoder) decodeFloat(name string, data interface{}, val reflect.Value) error {
- dataVal := reflect.ValueOf(data)
- dataKind := getKind(dataVal)
-
- switch {
- case dataKind == reflect.Int:
- val.SetFloat(float64(dataVal.Int()))
- case dataKind == reflect.Uint:
- val.SetFloat(float64(dataVal.Uint()))
- case dataKind == reflect.Float32:
- val.SetFloat(float64(dataVal.Float()))
- case dataKind == reflect.Bool && d.config.WeaklyTypedInput:
- if dataVal.Bool() {
- val.SetFloat(1)
- } else {
- val.SetFloat(0)
- }
- case dataKind == reflect.String && d.config.WeaklyTypedInput:
- f, err := strconv.ParseFloat(dataVal.String(), val.Type().Bits())
- if err == nil {
- val.SetFloat(f)
- } else {
- return fmt.Errorf("cannot parse '%s' as float: %s", name, err)
- }
- default:
- return fmt.Errorf(
- "'%s' expected type '%s', got unconvertible type '%s'",
- name, val.Type(), dataVal.Type())
- }
-
- return nil
-}
-
-func (d *Decoder) decodeMap(name string, data interface{}, val reflect.Value) error {
- valType := val.Type()
- valKeyType := valType.Key()
- valElemType := valType.Elem()
-
- // By default we overwrite keys in the current map
- valMap := val
-
- // If the map is nil or we're purposely zeroing fields, make a new map
- if valMap.IsNil() || d.config.ZeroFields {
- // Make a new map to hold our result
- mapType := reflect.MapOf(valKeyType, valElemType)
- valMap = reflect.MakeMap(mapType)
- }
-
- // Check input type
- dataVal := reflect.Indirect(reflect.ValueOf(data))
- if dataVal.Kind() != reflect.Map {
- // Accept empty array/slice instead of an empty map in weakly typed mode
- if d.config.WeaklyTypedInput &&
- (dataVal.Kind() == reflect.Slice || dataVal.Kind() == reflect.Array) &&
- dataVal.Len() == 0 {
- val.Set(valMap)
- return nil
- } else {
- return fmt.Errorf("'%s' expected a map, got '%s'", name, dataVal.Kind())
- }
- }
-
- // Accumulate errors
- errors := make([]string, 0)
-
- for _, k := range dataVal.MapKeys() {
- fieldName := fmt.Sprintf("%s[%s]", name, k)
-
- // First decode the key into the proper type
- currentKey := reflect.Indirect(reflect.New(valKeyType))
- if err := d.decode(fieldName, k.Interface(), currentKey); err != nil {
- errors = appendErrors(errors, err)
- continue
- }
-
- // Next decode the data into the proper type
- v := dataVal.MapIndex(k).Interface()
- currentVal := reflect.Indirect(reflect.New(valElemType))
- if err := d.decode(fieldName, v, currentVal); err != nil {
- errors = appendErrors(errors, err)
- continue
- }
-
- valMap.SetMapIndex(currentKey, currentVal)
- }
-
- // Set the built up map to the value
- val.Set(valMap)
-
- // If we had errors, return those
- if len(errors) > 0 {
- return &Error{errors}
- }
-
- return nil
-}
-
-func (d *Decoder) decodePtr(name string, data interface{}, val reflect.Value) error {
- // Create an element of the concrete (non pointer) type and decode
- // into that. Then set the value of the pointer to this type.
- valType := val.Type()
- valElemType := valType.Elem()
- realVal := reflect.New(valElemType)
- if err := d.decode(name, data, reflect.Indirect(realVal)); err != nil {
- return err
- }
-
- val.Set(realVal)
- return nil
-}
-
-func (d *Decoder) decodeSlice(name string, data interface{}, val reflect.Value) error {
- dataVal := reflect.Indirect(reflect.ValueOf(data))
- dataValKind := dataVal.Kind()
- valType := val.Type()
- valElemType := valType.Elem()
- sliceType := reflect.SliceOf(valElemType)
-
- // Check input type
- if dataValKind != reflect.Array && dataValKind != reflect.Slice {
- // Accept empty map instead of array/slice in weakly typed mode
- if d.config.WeaklyTypedInput && dataVal.Kind() == reflect.Map && dataVal.Len() == 0 {
- val.Set(reflect.MakeSlice(sliceType, 0, 0))
- return nil
- } else {
- return fmt.Errorf(
- "'%s': source data must be an array or slice, got %s", name, dataValKind)
- }
- }
-
- // Make a new slice to hold our result, same size as the original data.
- valSlice := reflect.MakeSlice(sliceType, dataVal.Len(), dataVal.Len())
-
- // Accumulate any errors
- errors := make([]string, 0)
-
- for i := 0; i < dataVal.Len(); i++ {
- currentData := dataVal.Index(i).Interface()
- currentField := valSlice.Index(i)
-
- fieldName := fmt.Sprintf("%s[%d]", name, i)
- if err := d.decode(fieldName, currentData, currentField); err != nil {
- errors = appendErrors(errors, err)
- }
- }
-
- // Finally, set the value to the slice we built up
- val.Set(valSlice)
-
- // If there were errors, we return those
- if len(errors) > 0 {
- return &Error{errors}
- }
-
- return nil
-}
-
-func (d *Decoder) decodeStruct(name string, data interface{}, val reflect.Value) error {
- dataVal := reflect.Indirect(reflect.ValueOf(data))
-
- // If the type of the value to write to and the data match directly,
- // then we just set it directly instead of recursing into the structure.
- if dataVal.Type() == val.Type() {
- val.Set(dataVal)
- return nil
- }
-
- dataValKind := dataVal.Kind()
- if dataValKind != reflect.Map {
- return fmt.Errorf("'%s' expected a map, got '%s'", name, dataValKind)
- }
-
- dataValType := dataVal.Type()
- if kind := dataValType.Key().Kind(); kind != reflect.String && kind != reflect.Interface {
- return fmt.Errorf(
- "'%s' needs a map with string keys, has '%s' keys",
- name, dataValType.Key().Kind())
- }
-
- dataValKeys := make(map[reflect.Value]struct{})
- dataValKeysUnused := make(map[interface{}]struct{})
- for _, dataValKey := range dataVal.MapKeys() {
- dataValKeys[dataValKey] = struct{}{}
- dataValKeysUnused[dataValKey.Interface()] = struct{}{}
- }
-
- errors := make([]string, 0)
-
- // This slice will keep track of all the structs we'll be decoding.
- // There can be more than one struct if there are embedded structs
- // that are squashed.
- structs := make([]reflect.Value, 1, 5)
- structs[0] = val
-
- // Compile the list of all the fields that we're going to be decoding
- // from all the structs.
- fields := make(map[*reflect.StructField]reflect.Value)
- for len(structs) > 0 {
- structVal := structs[0]
- structs = structs[1:]
-
- structType := structVal.Type()
- for i := 0; i < structType.NumField(); i++ {
- fieldType := structType.Field(i)
-
- if fieldType.Anonymous {
- fieldKind := fieldType.Type.Kind()
- if fieldKind != reflect.Struct {
- errors = appendErrors(errors,
- fmt.Errorf("%s: unsupported type: %s", fieldType.Name, fieldKind))
- continue
- }
- }
-
- // If "squash" is specified in the tag, we squash the field down.
- squash := false
- tagParts := strings.Split(fieldType.Tag.Get(d.config.TagName), ",")
- for _, tag := range tagParts[1:] {
- if tag == "squash" {
- squash = true
- break
- }
- }
-
- if squash {
- structs = append(structs, val.FieldByName(fieldType.Name))
- continue
- }
-
- // Normal struct field, store it away
- fields[&fieldType] = structVal.Field(i)
- }
- }
-
- for fieldType, field := range fields {
- fieldName := fieldType.Name
-
- tagValue := fieldType.Tag.Get(d.config.TagName)
- tagValue = strings.SplitN(tagValue, ",", 2)[0]
- if tagValue != "" {
- fieldName = tagValue
- }
-
- rawMapKey := reflect.ValueOf(fieldName)
- rawMapVal := dataVal.MapIndex(rawMapKey)
- if !rawMapVal.IsValid() {
- // Do a slower search by iterating over each key and
- // doing case-insensitive search.
- for dataValKey := range dataValKeys {
- mK, ok := dataValKey.Interface().(string)
- if !ok {
- // Not a string key
- continue
- }
-
- if strings.EqualFold(mK, fieldName) {
- rawMapKey = dataValKey
- rawMapVal = dataVal.MapIndex(dataValKey)
- break
- }
- }
-
- if !rawMapVal.IsValid() {
- // There was no matching key in the map for the value in
- // the struct. Just ignore.
- continue
- }
- }
-
- // Delete the key we're using from the unused map so we stop tracking
- delete(dataValKeysUnused, rawMapKey.Interface())
-
- if !field.IsValid() {
- // This should never happen
- panic("field is not valid")
- }
-
- // If we can't set the field, then it is unexported or something,
- // and we just continue onwards.
- if !field.CanSet() {
- continue
- }
-
- // If the name is empty string, then we're at the root, and we
- // don't dot-join the fields.
- if name != "" {
- fieldName = fmt.Sprintf("%s.%s", name, fieldName)
- }
-
- if err := d.decode(fieldName, rawMapVal.Interface(), field); err != nil {
- errors = appendErrors(errors, err)
- }
- }
-
- if d.config.ErrorUnused && len(dataValKeysUnused) > 0 {
- keys := make([]string, 0, len(dataValKeysUnused))
- for rawKey := range dataValKeysUnused {
- keys = append(keys, rawKey.(string))
- }
- sort.Strings(keys)
-
- err := fmt.Errorf("'%s' has invalid keys: %s", name, strings.Join(keys, ", "))
- errors = appendErrors(errors, err)
- }
-
- if len(errors) > 0 {
- return &Error{errors}
- }
-
- // Add the unused keys to the list of unused keys if we're tracking metadata
- if d.config.Metadata != nil {
- for rawKey := range dataValKeysUnused {
- key := rawKey.(string)
- if name != "" {
- key = fmt.Sprintf("%s.%s", name, key)
- }
-
- d.config.Metadata.Unused = append(d.config.Metadata.Unused, key)
- }
- }
-
- return nil
-}
-
-func getKind(val reflect.Value) reflect.Kind {
- kind := val.Kind()
-
- switch {
- case kind >= reflect.Int && kind <= reflect.Int64:
- return reflect.Int
- case kind >= reflect.Uint && kind <= reflect.Uint64:
- return reflect.Uint
- case kind >= reflect.Float32 && kind <= reflect.Float64:
- return reflect.Float32
- default:
- return kind
- }
-}
diff --git a/vendor/github.com/mitchellh/multistep/LICENSE.md b/vendor/github.com/mitchellh/multistep/LICENSE.md
deleted file mode 100644
index c9d6b768..00000000
--- a/vendor/github.com/mitchellh/multistep/LICENSE.md
+++ /dev/null
@@ -1,22 +0,0 @@
-Copyright (c) 2013 Mitchell Hashimoto
-
-MIT License
-
-Permission is hereby granted, free of charge, to any person obtaining
-a copy of this software and associated documentation files (the
-"Software"), to deal in the Software without restriction, including
-without limitation the rights to use, copy, modify, merge, publish,
-distribute, sublicense, and/or sell copies of the Software, and to
-permit persons to whom the Software is furnished to do so, subject to
-the following conditions:
-
-The above copyright notice and this permission notice shall be
-included in all copies or substantial portions of the Software.
-
-THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
-WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
diff --git a/vendor/github.com/mitchellh/multistep/README.md b/vendor/github.com/mitchellh/multistep/README.md
deleted file mode 100644
index 9ceae012..00000000
--- a/vendor/github.com/mitchellh/multistep/README.md
+++ /dev/null
@@ -1,59 +0,0 @@
-# multistep
-
-multistep is a Go library for building up complex actions using discrete,
-individual "steps." These steps are strung together and run in sequence
-to achieve a more complex goal. The runner handles cleanup, cancelling, etc.
-if necessary.
-
-## Basic Example
-
-Make a step to perform some action. The step can access your "state",
-which is passed between steps by the runner.
-
-```go
-type stepAdd struct{}
-
-func (s *stepAdd) Run(state multistep.StateBag) multistep.StepAction {
- // Read our value and assert that it is they type we want
- value := state.Get("value").(int)
- fmt.Printf("Value is %d\n", value)
-
- // Store some state back
- state.Put("value", value + 1)
- return multistep.ActionContinue
-}
-
-func (s *stepAdd) Cleanup(multistep.StateBag) {
- // This is called after all the steps have run or if the runner is
- // cancelled so that cleanup can be performed.
-}
-```
-
-Make a runner and call your array of Steps.
-
-```go
-func main() {
- // Our "bag of state" that we read the value from
- state := new(multistep.BasicStateBag)
- state.Put("value", 0)
-
- steps := []multistep.Step{
- &stepAdd{},
- &stepAdd{},
- &stepAdd{},
- }
-
- runner := &multistep.BasicRunner{Steps: steps}
-
- // Executes the steps
- runner.Run(state)
-}
-```
-
-This will produce:
-
-```
-Value is 0
-Value is 1
-Value is 2
-```
diff --git a/vendor/github.com/mitchellh/multistep/basic_runner.go b/vendor/github.com/mitchellh/multistep/basic_runner.go
deleted file mode 100644
index 35692a74..00000000
--- a/vendor/github.com/mitchellh/multistep/basic_runner.go
+++ /dev/null
@@ -1,102 +0,0 @@
-package multistep
-
-import (
- "sync"
- "sync/atomic"
-)
-
-type runState int32
-
-const (
- stateIdle runState = iota
- stateRunning
- stateCancelling
-)
-
-// BasicRunner is a Runner that just runs the given slice of steps.
-type BasicRunner struct {
- // Steps is a slice of steps to run. Once set, this should _not_ be
- // modified.
- Steps []Step
-
- cancelCh chan struct{}
- doneCh chan struct{}
- state runState
- l sync.Mutex
-}
-
-func (b *BasicRunner) Run(state StateBag) {
- b.l.Lock()
- if b.state != stateIdle {
- panic("already running")
- }
-
- cancelCh := make(chan struct{})
- doneCh := make(chan struct{})
- b.cancelCh = cancelCh
- b.doneCh = doneCh
- b.state = stateRunning
- b.l.Unlock()
-
- defer func() {
- b.l.Lock()
- b.cancelCh = nil
- b.doneCh = nil
- b.state = stateIdle
- close(doneCh)
- b.l.Unlock()
- }()
-
- // This goroutine listens for cancels and puts the StateCancelled key
- // as quickly as possible into the state bag to mark it.
- go func() {
- select {
- case <-cancelCh:
- // Flag cancel and wait for finish
- state.Put(StateCancelled, true)
- <-doneCh
- case <-doneCh:
- }
- }()
-
- for _, step := range b.Steps {
- // We also check for cancellation here since we can't be sure
- // the goroutine that is running to set it actually ran.
- if runState(atomic.LoadInt32((*int32)(&b.state))) == stateCancelling {
- state.Put(StateCancelled, true)
- break
- }
-
- action := step.Run(state)
- defer step.Cleanup(state)
-
- if _, ok := state.GetOk(StateCancelled); ok {
- break
- }
-
- if action == ActionHalt {
- state.Put(StateHalted, true)
- break
- }
- }
-}
-
-func (b *BasicRunner) Cancel() {
- b.l.Lock()
- switch b.state {
- case stateIdle:
- // Not running, so Cancel is... done.
- b.l.Unlock()
- return
- case stateRunning:
- // Running, so mark that we cancelled and set the state
- close(b.cancelCh)
- b.state = stateCancelling
- fallthrough
- case stateCancelling:
- // Already cancelling, so just wait until we're done
- ch := b.doneCh
- b.l.Unlock()
- <-ch
- }
-}
diff --git a/vendor/github.com/mitchellh/multistep/debug_runner.go b/vendor/github.com/mitchellh/multistep/debug_runner.go
deleted file mode 100644
index 42f68f24..00000000
--- a/vendor/github.com/mitchellh/multistep/debug_runner.go
+++ /dev/null
@@ -1,110 +0,0 @@
-package multistep
-
-import (
- "fmt"
- "reflect"
- "sync"
-)
-
-// DebugLocation is the location where the pause is occuring when debugging
-// a step sequence. "DebugLocationAfterRun" is after the run of the named
-// step. "DebugLocationBeforeCleanup" is before the cleanup of the named
-// step.
-type DebugLocation uint
-
-const (
- DebugLocationAfterRun DebugLocation = iota
- DebugLocationBeforeCleanup
-)
-
-// DebugPauseFn is the type signature for the function that is called
-// whenever the DebugRunner pauses. It allows the caller time to
-// inspect the state of the multi-step sequence at a given step.
-type DebugPauseFn func(DebugLocation, string, StateBag)
-
-// DebugRunner is a Runner that runs the given set of steps in order,
-// but pauses between each step until it is told to continue.
-type DebugRunner struct {
- // Steps is the steps to run. These will be run in order.
- Steps []Step
-
- // PauseFn is the function that is called whenever the debug runner
- // pauses. The debug runner continues when this function returns.
- // The function is given the state so that the state can be inspected.
- PauseFn DebugPauseFn
-
- l sync.Mutex
- runner *BasicRunner
-}
-
-func (r *DebugRunner) Run(state StateBag) {
- r.l.Lock()
- if r.runner != nil {
- panic("already running")
- }
- r.runner = new(BasicRunner)
- r.l.Unlock()
-
- pauseFn := r.PauseFn
-
- // If no PauseFn is specified, use the default
- if pauseFn == nil {
- pauseFn = DebugPauseDefault
- }
-
- // Rebuild the steps so that we insert the pause step after each
- steps := make([]Step, len(r.Steps)*2)
- for i, step := range r.Steps {
- steps[i*2] = step
- steps[(i*2)+1] = &debugStepPause{
- reflect.Indirect(reflect.ValueOf(step)).Type().Name(),
- pauseFn,
- }
- }
-
- // Then just use a basic runner to run it
- r.runner.Steps = steps
- r.runner.Run(state)
-}
-
-func (r *DebugRunner) Cancel() {
- r.l.Lock()
- defer r.l.Unlock()
-
- if r.runner != nil {
- r.runner.Cancel()
- }
-}
-
-// DebugPauseDefault is the default pause function when using the
-// DebugRunner if no PauseFn is specified. It outputs some information
-// to stderr about the step and waits for keyboard input on stdin before
-// continuing.
-func DebugPauseDefault(loc DebugLocation, name string, state StateBag) {
- var locationString string
- switch loc {
- case DebugLocationAfterRun:
- locationString = "after run of"
- case DebugLocationBeforeCleanup:
- locationString = "before cleanup of"
- }
-
- fmt.Printf("Pausing %s step '%s'. Press any key to continue.\n", locationString, name)
-
- var line string
- fmt.Scanln(&line)
-}
-
-type debugStepPause struct {
- StepName string
- PauseFn DebugPauseFn
-}
-
-func (s *debugStepPause) Run(state StateBag) StepAction {
- s.PauseFn(DebugLocationAfterRun, s.StepName, state)
- return ActionContinue
-}
-
-func (s *debugStepPause) Cleanup(state StateBag) {
- s.PauseFn(DebugLocationBeforeCleanup, s.StepName, state)
-}
diff --git a/vendor/github.com/mitchellh/multistep/multistep.go b/vendor/github.com/mitchellh/multistep/multistep.go
deleted file mode 100644
index feef1406..00000000
--- a/vendor/github.com/mitchellh/multistep/multistep.go
+++ /dev/null
@@ -1,48 +0,0 @@
-// multistep is a library for bulding up complex actions using individual,
-// discrete steps.
-package multistep
-
-// A StepAction determines the next step to take regarding multi-step actions.
-type StepAction uint
-
-const (
- ActionContinue StepAction = iota
- ActionHalt
-)
-
-// This is the key set in the state bag when using the basic runner to
-// signal that the step sequence was cancelled.
-const StateCancelled = "cancelled"
-
-// This is the key set in the state bag when a step halted the sequence.
-const StateHalted = "halted"
-
-// Step is a single step that is part of a potentially large sequence
-// of other steps, responsible for performing some specific action.
-type Step interface {
- // Run is called to perform the action. The parameter is a "state bag"
- // of untyped things. Please be very careful about type-checking the
- // items in this bag.
- //
- // The return value determines whether multi-step sequences continue
- // or should halt.
- Run(StateBag) StepAction
-
- // Cleanup is called in reverse order of the steps that have run
- // and allow steps to clean up after themselves. Do not assume if this
- // ran that the entire multi-step sequence completed successfully. This
- // method can be ran in the face of errors and cancellations as well.
- //
- // The parameter is the same "state bag" as Run, and represents the
- // state at the latest possible time prior to calling Cleanup.
- Cleanup(StateBag)
-}
-
-// Runner is a thing that runs one or more steps.
-type Runner interface {
- // Run runs the steps with the given initial state.
- Run(StateBag)
-
- // Cancel cancels a potentially running stack of steps.
- Cancel()
-}
diff --git a/vendor/github.com/mitchellh/multistep/statebag.go b/vendor/github.com/mitchellh/multistep/statebag.go
deleted file mode 100644
index dab71231..00000000
--- a/vendor/github.com/mitchellh/multistep/statebag.go
+++ /dev/null
@@ -1,47 +0,0 @@
-package multistep
-
-import (
- "sync"
-)
-
-// StateBag holds the state that is used by the Runner and Steps. The
-// StateBag implementation must be safe for concurrent access.
-type StateBag interface {
- Get(string) interface{}
- GetOk(string) (interface{}, bool)
- Put(string, interface{})
-}
-
-// BasicStateBag implements StateBag by using a normal map underneath
-// protected by a RWMutex.
-type BasicStateBag struct {
- data map[string]interface{}
- l sync.RWMutex
- once sync.Once
-}
-
-func (b *BasicStateBag) Get(k string) interface{} {
- result, _ := b.GetOk(k)
- return result
-}
-
-func (b *BasicStateBag) GetOk(k string) (interface{}, bool) {
- b.l.RLock()
- defer b.l.RUnlock()
-
- result, ok := b.data[k]
- return result, ok
-}
-
-func (b *BasicStateBag) Put(k string, v interface{}) {
- b.l.Lock()
- defer b.l.Unlock()
-
- // Make sure the map is initialized one time, on write
- b.once.Do(func() {
- b.data = make(map[string]interface{})
- })
-
- // Write the data
- b.data[k] = v
-}
diff --git a/vendor/github.com/mitchellh/osext/LICENSE b/vendor/github.com/mitchellh/osext/LICENSE
deleted file mode 100644
index 18527a28..00000000
--- a/vendor/github.com/mitchellh/osext/LICENSE
+++ /dev/null
@@ -1,20 +0,0 @@
-Copyright (c) 2012 Daniel Theophanes
-
-This software is provided 'as-is', without any express or implied
-warranty. In no event will the authors be held liable for any damages
-arising from the use of this software.
-
-Permission is granted to anyone to use this software for any purpose,
-including commercial applications, and to alter it and redistribute it
-freely, subject to the following restrictions:
-
- 1. The origin of this software must not be misrepresented; you must not
- claim that you wrote the original software. If you use this software
- in a product, an acknowledgment in the product documentation would be
- appreciated but is not required.
-
- 2. Altered source versions must be plainly marked as such, and must not be
- misrepresented as being the original software.
-
- 3. This notice may not be removed or altered from any source
- distribution.
diff --git a/vendor/github.com/mitchellh/osext/README.md b/vendor/github.com/mitchellh/osext/README.md
deleted file mode 100644
index 12f19cd4..00000000
--- a/vendor/github.com/mitchellh/osext/README.md
+++ /dev/null
@@ -1,3 +0,0 @@
-# osext
-
-**Don't use this anymore! Use the official library at: https://github.com/kardianos/osext**
diff --git a/vendor/github.com/mitchellh/osext/osext.go b/vendor/github.com/mitchellh/osext/osext.go
deleted file mode 100644
index 37efbb22..00000000
--- a/vendor/github.com/mitchellh/osext/osext.go
+++ /dev/null
@@ -1,32 +0,0 @@
-// Copyright 2012 The Go Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style
-// license that can be found in the LICENSE file.
-
-// Extensions to the standard "os" package.
-package osext
-
-import "path/filepath"
-
-// Executable returns an absolute path that can be used to
-// re-invoke the current program.
-// It may not be valid after the current program exits.
-func Executable() (string, error) {
- p, err := executable()
- return filepath.Clean(p), err
-}
-
-// Returns same path as Executable, returns just the folder
-// path. Excludes the executable name.
-func ExecutableFolder() (string, error) {
- p, err := Executable()
- if err != nil {
- return "", err
- }
- folder, _ := filepath.Split(p)
- return folder, nil
-}
-
-// Depricated. Same as Executable().
-func GetExePath() (exePath string, err error) {
- return Executable()
-}
diff --git a/vendor/github.com/mitchellh/osext/osext_plan9.go b/vendor/github.com/mitchellh/osext/osext_plan9.go
deleted file mode 100644
index e88c1e09..00000000
--- a/vendor/github.com/mitchellh/osext/osext_plan9.go
+++ /dev/null
@@ -1,16 +0,0 @@
-// Copyright 2012 The Go Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style
-// license that can be found in the LICENSE file.
-
-package osext
-
-import "syscall"
-
-func executable() (string, error) {
- f, err := Open("/proc/" + itoa(Getpid()) + "/text")
- if err != nil {
- return "", err
- }
- defer f.Close()
- return syscall.Fd2path(int(f.Fd()))
-}
diff --git a/vendor/github.com/mitchellh/osext/osext_procfs.go b/vendor/github.com/mitchellh/osext/osext_procfs.go
deleted file mode 100644
index 546fec91..00000000
--- a/vendor/github.com/mitchellh/osext/osext_procfs.go
+++ /dev/null
@@ -1,25 +0,0 @@
-// Copyright 2012 The Go Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style
-// license that can be found in the LICENSE file.
-
-// +build linux netbsd openbsd
-
-package osext
-
-import (
- "errors"
- "os"
- "runtime"
-)
-
-func executable() (string, error) {
- switch runtime.GOOS {
- case "linux":
- return os.Readlink("/proc/self/exe")
- case "netbsd":
- return os.Readlink("/proc/curproc/exe")
- case "openbsd":
- return os.Readlink("/proc/curproc/file")
- }
- return "", errors.New("ExecPath not implemented for " + runtime.GOOS)
-}
diff --git a/vendor/github.com/mitchellh/osext/osext_sysctl.go b/vendor/github.com/mitchellh/osext/osext_sysctl.go
deleted file mode 100644
index d7646462..00000000
--- a/vendor/github.com/mitchellh/osext/osext_sysctl.go
+++ /dev/null
@@ -1,64 +0,0 @@
-// Copyright 2012 The Go Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style
-// license that can be found in the LICENSE file.
-
-// +build darwin freebsd
-
-package osext
-
-import (
- "os"
- "runtime"
- "syscall"
- "unsafe"
-)
-
-var startUpcwd, getwdError = os.Getwd()
-
-func executable() (string, error) {
- var mib [4]int32
- switch runtime.GOOS {
- case "freebsd":
- mib = [4]int32{1 /* CTL_KERN */, 14 /* KERN_PROC */, 12 /* KERN_PROC_PATHNAME */, -1}
- case "darwin":
- mib = [4]int32{1 /* CTL_KERN */, 38 /* KERN_PROCARGS */, int32(os.Getpid()), -1}
- }
-
- n := uintptr(0)
- // get length
- _, _, err := syscall.Syscall6(syscall.SYS___SYSCTL, uintptr(unsafe.Pointer(&mib[0])), 4, 0, uintptr(unsafe.Pointer(&n)), 0, 0)
- if err != 0 {
- return "", err
- }
- if n == 0 { // shouldn't happen
- return "", nil
- }
- buf := make([]byte, n)
- _, _, err = syscall.Syscall6(syscall.SYS___SYSCTL, uintptr(unsafe.Pointer(&mib[0])), 4, uintptr(unsafe.Pointer(&buf[0])), uintptr(unsafe.Pointer(&n)), 0, 0)
- if err != 0 {
- return "", err
- }
- if n == 0 { // shouldn't happen
- return "", nil
- }
- for i, v := range buf {
- if v == 0 {
- buf = buf[:i]
- break
- }
- }
- if buf[0] != '/' {
- if getwdError != nil {
- return string(buf), getwdError
- } else {
- if buf[0] == '.' {
- buf = buf[1:]
- }
- if startUpcwd[len(startUpcwd)-1] != '/' {
- return startUpcwd + "/" + string(buf), nil
- }
- return startUpcwd + string(buf), nil
- }
- }
- return string(buf), nil
-}
diff --git a/vendor/github.com/mitchellh/osext/osext_windows.go b/vendor/github.com/mitchellh/osext/osext_windows.go
deleted file mode 100644
index 72d282cf..00000000
--- a/vendor/github.com/mitchellh/osext/osext_windows.go
+++ /dev/null
@@ -1,34 +0,0 @@
-// Copyright 2012 The Go Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style
-// license that can be found in the LICENSE file.
-
-package osext
-
-import (
- "syscall"
- "unicode/utf16"
- "unsafe"
-)
-
-var (
- kernel = syscall.MustLoadDLL("kernel32.dll")
- getModuleFileNameProc = kernel.MustFindProc("GetModuleFileNameW")
-)
-
-// GetModuleFileName() with hModule = NULL
-func executable() (exePath string, err error) {
- return getModuleFileName()
-}
-
-func getModuleFileName() (string, error) {
- var n uint32
- b := make([]uint16, syscall.MAX_PATH)
- size := uint32(len(b))
-
- r0, _, e1 := getModuleFileNameProc.Call(0, uintptr(unsafe.Pointer(&b[0])), uintptr(size))
- n = uint32(r0)
- if n == 0 {
- return "", e1
- }
- return string(utf16.Decode(b[0:n])), nil
-}
diff --git a/vendor/github.com/mitchellh/packer/LICENSE b/vendor/github.com/mitchellh/packer/LICENSE
deleted file mode 100644
index a612ad98..00000000
--- a/vendor/github.com/mitchellh/packer/LICENSE
+++ /dev/null
@@ -1,373 +0,0 @@
-Mozilla Public License Version 2.0
-==================================
-
-1. Definitions
---------------
-
-1.1. "Contributor"
- means each individual or legal entity that creates, contributes to
- the creation of, or owns Covered Software.
-
-1.2. "Contributor Version"
- means the combination of the Contributions of others (if any) used
- by a Contributor and that particular Contributor's Contribution.
-
-1.3. "Contribution"
- means Covered Software of a particular Contributor.
-
-1.4. "Covered Software"
- means Source Code Form to which the initial Contributor has attached
- the notice in Exhibit A, the Executable Form of such Source Code
- Form, and Modifications of such Source Code Form, in each case
- including portions thereof.
-
-1.5. "Incompatible With Secondary Licenses"
- means
-
- (a) that the initial Contributor has attached the notice described
- in Exhibit B to the Covered Software; or
-
- (b) that the Covered Software was made available under the terms of
- version 1.1 or earlier of the License, but not also under the
- terms of a Secondary License.
-
-1.6. "Executable Form"
- means any form of the work other than Source Code Form.
-
-1.7. "Larger Work"
- means a work that combines Covered Software with other material, in
- a separate file or files, that is not Covered Software.
-
-1.8. "License"
- means this document.
-
-1.9. "Licensable"
- means having the right to grant, to the maximum extent possible,
- whether at the time of the initial grant or subsequently, any and
- all of the rights conveyed by this License.
-
-1.10. "Modifications"
- means any of the following:
-
- (a) any file in Source Code Form that results from an addition to,
- deletion from, or modification of the contents of Covered
- Software; or
-
- (b) any new file in Source Code Form that contains any Covered
- Software.
-
-1.11. "Patent Claims" of a Contributor
- means any patent claim(s), including without limitation, method,
- process, and apparatus claims, in any patent Licensable by such
- Contributor that would be infringed, but for the grant of the
- License, by the making, using, selling, offering for sale, having
- made, import, or transfer of either its Contributions or its
- Contributor Version.
-
-1.12. "Secondary License"
- means either the GNU General Public License, Version 2.0, the GNU
- Lesser General Public License, Version 2.1, the GNU Affero General
- Public License, Version 3.0, or any later versions of those
- licenses.
-
-1.13. "Source Code Form"
- means the form of the work preferred for making modifications.
-
-1.14. "You" (or "Your")
- means an individual or a legal entity exercising rights under this
- License. For legal entities, "You" includes any entity that
- controls, is controlled by, or is under common control with You. For
- purposes of this definition, "control" means (a) the power, direct
- or indirect, to cause the direction or management of such entity,
- whether by contract or otherwise, or (b) ownership of more than
- fifty percent (50%) of the outstanding shares or beneficial
- ownership of such entity.
-
-2. License Grants and Conditions
---------------------------------
-
-2.1. Grants
-
-Each Contributor hereby grants You a world-wide, royalty-free,
-non-exclusive license:
-
-(a) under intellectual property rights (other than patent or trademark)
- Licensable by such Contributor to use, reproduce, make available,
- modify, display, perform, distribute, and otherwise exploit its
- Contributions, either on an unmodified basis, with Modifications, or
- as part of a Larger Work; and
-
-(b) under Patent Claims of such Contributor to make, use, sell, offer
- for sale, have made, import, and otherwise transfer either its
- Contributions or its Contributor Version.
-
-2.2. Effective Date
-
-The licenses granted in Section 2.1 with respect to any Contribution
-become effective for each Contribution on the date the Contributor first
-distributes such Contribution.
-
-2.3. Limitations on Grant Scope
-
-The licenses granted in this Section 2 are the only rights granted under
-this License. No additional rights or licenses will be implied from the
-distribution or licensing of Covered Software under this License.
-Notwithstanding Section 2.1(b) above, no patent license is granted by a
-Contributor:
-
-(a) for any code that a Contributor has removed from Covered Software;
- or
-
-(b) for infringements caused by: (i) Your and any other third party's
- modifications of Covered Software, or (ii) the combination of its
- Contributions with other software (except as part of its Contributor
- Version); or
-
-(c) under Patent Claims infringed by Covered Software in the absence of
- its Contributions.
-
-This License does not grant any rights in the trademarks, service marks,
-or logos of any Contributor (except as may be necessary to comply with
-the notice requirements in Section 3.4).
-
-2.4. Subsequent Licenses
-
-No Contributor makes additional grants as a result of Your choice to
-distribute the Covered Software under a subsequent version of this
-License (see Section 10.2) or under the terms of a Secondary License (if
-permitted under the terms of Section 3.3).
-
-2.5. Representation
-
-Each Contributor represents that the Contributor believes its
-Contributions are its original creation(s) or it has sufficient rights
-to grant the rights to its Contributions conveyed by this License.
-
-2.6. Fair Use
-
-This License is not intended to limit any rights You have under
-applicable copyright doctrines of fair use, fair dealing, or other
-equivalents.
-
-2.7. Conditions
-
-Sections 3.1, 3.2, 3.3, and 3.4 are conditions of the licenses granted
-in Section 2.1.
-
-3. Responsibilities
--------------------
-
-3.1. Distribution of Source Form
-
-All distribution of Covered Software in Source Code Form, including any
-Modifications that You create or to which You contribute, must be under
-the terms of this License. You must inform recipients that the Source
-Code Form of the Covered Software is governed by the terms of this
-License, and how they can obtain a copy of this License. You may not
-attempt to alter or restrict the recipients' rights in the Source Code
-Form.
-
-3.2. Distribution of Executable Form
-
-If You distribute Covered Software in Executable Form then:
-
-(a) such Covered Software must also be made available in Source Code
- Form, as described in Section 3.1, and You must inform recipients of
- the Executable Form how they can obtain a copy of such Source Code
- Form by reasonable means in a timely manner, at a charge no more
- than the cost of distribution to the recipient; and
-
-(b) You may distribute such Executable Form under the terms of this
- License, or sublicense it under different terms, provided that the
- license for the Executable Form does not attempt to limit or alter
- the recipients' rights in the Source Code Form under this License.
-
-3.3. Distribution of a Larger Work
-
-You may create and distribute a Larger Work under terms of Your choice,
-provided that You also comply with the requirements of this License for
-the Covered Software. If the Larger Work is a combination of Covered
-Software with a work governed by one or more Secondary Licenses, and the
-Covered Software is not Incompatible With Secondary Licenses, this
-License permits You to additionally distribute such Covered Software
-under the terms of such Secondary License(s), so that the recipient of
-the Larger Work may, at their option, further distribute the Covered
-Software under the terms of either this License or such Secondary
-License(s).
-
-3.4. Notices
-
-You may not remove or alter the substance of any license notices
-(including copyright notices, patent notices, disclaimers of warranty,
-or limitations of liability) contained within the Source Code Form of
-the Covered Software, except that You may alter any license notices to
-the extent required to remedy known factual inaccuracies.
-
-3.5. Application of Additional Terms
-
-You may choose to offer, and to charge a fee for, warranty, support,
-indemnity or liability obligations to one or more recipients of Covered
-Software. However, You may do so only on Your own behalf, and not on
-behalf of any Contributor. You must make it absolutely clear that any
-such warranty, support, indemnity, or liability obligation is offered by
-You alone, and You hereby agree to indemnify every Contributor for any
-liability incurred by such Contributor as a result of warranty, support,
-indemnity or liability terms You offer. You may include additional
-disclaimers of warranty and limitations of liability specific to any
-jurisdiction.
-
-4. Inability to Comply Due to Statute or Regulation
----------------------------------------------------
-
-If it is impossible for You to comply with any of the terms of this
-License with respect to some or all of the Covered Software due to
-statute, judicial order, or regulation then You must: (a) comply with
-the terms of this License to the maximum extent possible; and (b)
-describe the limitations and the code they affect. Such description must
-be placed in a text file included with all distributions of the Covered
-Software under this License. Except to the extent prohibited by statute
-or regulation, such description must be sufficiently detailed for a
-recipient of ordinary skill to be able to understand it.
-
-5. Termination
---------------
-
-5.1. The rights granted under this License will terminate automatically
-if You fail to comply with any of its terms. However, if You become
-compliant, then the rights granted under this License from a particular
-Contributor are reinstated (a) provisionally, unless and until such
-Contributor explicitly and finally terminates Your grants, and (b) on an
-ongoing basis, if such Contributor fails to notify You of the
-non-compliance by some reasonable means prior to 60 days after You have
-come back into compliance. Moreover, Your grants from a particular
-Contributor are reinstated on an ongoing basis if such Contributor
-notifies You of the non-compliance by some reasonable means, this is the
-first time You have received notice of non-compliance with this License
-from such Contributor, and You become compliant prior to 30 days after
-Your receipt of the notice.
-
-5.2. If You initiate litigation against any entity by asserting a patent
-infringement claim (excluding declaratory judgment actions,
-counter-claims, and cross-claims) alleging that a Contributor Version
-directly or indirectly infringes any patent, then the rights granted to
-You by any and all Contributors for the Covered Software under Section
-2.1 of this License shall terminate.
-
-5.3. In the event of termination under Sections 5.1 or 5.2 above, all
-end user license agreements (excluding distributors and resellers) which
-have been validly granted by You or Your distributors under this License
-prior to termination shall survive termination.
-
-************************************************************************
-* *
-* 6. Disclaimer of Warranty *
-* ------------------------- *
-* *
-* Covered Software is provided under this License on an "as is" *
-* basis, without warranty of any kind, either expressed, implied, or *
-* statutory, including, without limitation, warranties that the *
-* Covered Software is free of defects, merchantable, fit for a *
-* particular purpose or non-infringing. The entire risk as to the *
-* quality and performance of the Covered Software is with You. *
-* Should any Covered Software prove defective in any respect, You *
-* (not any Contributor) assume the cost of any necessary servicing, *
-* repair, or correction. This disclaimer of warranty constitutes an *
-* essential part of this License. No use of any Covered Software is *
-* authorized under this License except under this disclaimer. *
-* *
-************************************************************************
-
-************************************************************************
-* *
-* 7. Limitation of Liability *
-* -------------------------- *
-* *
-* Under no circumstances and under no legal theory, whether tort *
-* (including negligence), contract, or otherwise, shall any *
-* Contributor, or anyone who distributes Covered Software as *
-* permitted above, be liable to You for any direct, indirect, *
-* special, incidental, or consequential damages of any character *
-* including, without limitation, damages for lost profits, loss of *
-* goodwill, work stoppage, computer failure or malfunction, or any *
-* and all other commercial damages or losses, even if such party *
-* shall have been informed of the possibility of such damages. This *
-* limitation of liability shall not apply to liability for death or *
-* personal injury resulting from such party's negligence to the *
-* extent applicable law prohibits such limitation. Some *
-* jurisdictions do not allow the exclusion or limitation of *
-* incidental or consequential damages, so this exclusion and *
-* limitation may not apply to You. *
-* *
-************************************************************************
-
-8. Litigation
--------------
-
-Any litigation relating to this License may be brought only in the
-courts of a jurisdiction where the defendant maintains its principal
-place of business and such litigation shall be governed by laws of that
-jurisdiction, without reference to its conflict-of-law provisions.
-Nothing in this Section shall prevent a party's ability to bring
-cross-claims or counter-claims.
-
-9. Miscellaneous
-----------------
-
-This License represents the complete agreement concerning the subject
-matter hereof. If any provision of this License is held to be
-unenforceable, such provision shall be reformed only to the extent
-necessary to make it enforceable. Any law or regulation which provides
-that the language of a contract shall be construed against the drafter
-shall not be used to construe this License against a Contributor.
-
-10. Versions of the License
----------------------------
-
-10.1. New Versions
-
-Mozilla Foundation is the license steward. Except as provided in Section
-10.3, no one other than the license steward has the right to modify or
-publish new versions of this License. Each version will be given a
-distinguishing version number.
-
-10.2. Effect of New Versions
-
-You may distribute the Covered Software under the terms of the version
-of the License under which You originally received the Covered Software,
-or under the terms of any subsequent version published by the license
-steward.
-
-10.3. Modified Versions
-
-If you create software not governed by this License, and you want to
-create a new license for such software, you may create and use a
-modified version of this License if you rename the license and remove
-any references to the name of the license steward (except to note that
-such modified license differs from this License).
-
-10.4. Distributing Source Code Form that is Incompatible With Secondary
-Licenses
-
-If You choose to distribute Source Code Form that is Incompatible With
-Secondary Licenses under the terms of this version of the License, the
-notice described in Exhibit B of this License must be attached.
-
-Exhibit A - Source Code Form License Notice
--------------------------------------------
-
- This Source Code Form is subject to the terms of the Mozilla Public
- License, v. 2.0. If a copy of the MPL was not distributed with this
- file, You can obtain one at http://mozilla.org/MPL/2.0/.
-
-If it is not possible or desirable to put the notice in a particular
-file, then You may include the notice in a location (such as a LICENSE
-file in a relevant directory) where a recipient would be likely to look
-for such a notice.
-
-You may add additional accurate notices of copyright ownership.
-
-Exhibit B - "Incompatible With Secondary Licenses" Notice
----------------------------------------------------------
-
- This Source Code Form is "Incompatible With Secondary Licenses", as
- defined by the Mozilla Public License, v. 2.0.
diff --git a/vendor/github.com/mitchellh/packer/common/config.go b/vendor/github.com/mitchellh/packer/common/config.go
deleted file mode 100644
index e6c6477b..00000000
--- a/vendor/github.com/mitchellh/packer/common/config.go
+++ /dev/null
@@ -1,125 +0,0 @@
-package common
-
-import (
- "fmt"
- "net/url"
- "os"
- "path/filepath"
- "runtime"
- "strings"
-)
-
-// ScrubConfig is a helper that returns a string representation of
-// any struct with the given values stripped out.
-func ScrubConfig(target interface{}, values ...string) string {
- conf := fmt.Sprintf("Config: %+v", target)
- for _, value := range values {
- if value == "" {
- continue
- }
- conf = strings.Replace(conf, value, "", -1)
- }
- return conf
-}
-
-// ChooseString returns the first non-empty value.
-func ChooseString(vals ...string) string {
- for _, el := range vals {
- if el != "" {
- return el
- }
- }
-
- return ""
-}
-
-// DownloadableURL processes a URL that may also be a file path and returns
-// a completely valid URL. For example, the original URL might be "local/file.iso"
-// which isn't a valid URL. DownloadableURL will return "file:///local/file.iso"
-func DownloadableURL(original string) (string, error) {
- if runtime.GOOS == "windows" {
- // If the distance to the first ":" is just one character, assume
- // we're dealing with a drive letter and thus a file path.
- idx := strings.Index(original, ":")
- if idx == 1 {
- original = "file:///" + original
- }
- }
-
- url, err := url.Parse(original)
- if err != nil {
- return "", err
- }
-
- if url.Scheme == "" {
- url.Scheme = "file"
- }
-
- if url.Scheme == "file" {
- // Windows file handling is all sorts of tricky...
- if runtime.GOOS == "windows" {
- // If the path is using Windows-style slashes, URL parses
- // it into the host field.
- if url.Path == "" && strings.Contains(url.Host, `\`) {
- url.Path = url.Host
- url.Host = ""
- }
-
- // For Windows absolute file paths, remove leading / prior to processing
- // since net/url turns "C:/" into "/C:/"
- if len(url.Path) > 0 && url.Path[0] == '/' {
- url.Path = url.Path[1:len(url.Path)]
- }
- }
-
- // Only do the filepath transformations if the file appears
- // to actually exist.
- if _, err := os.Stat(url.Path); err == nil {
- url.Path, err = filepath.Abs(url.Path)
- if err != nil {
- return "", err
- }
-
- url.Path, err = filepath.EvalSymlinks(url.Path)
- if err != nil {
- return "", err
- }
-
- url.Path = filepath.Clean(url.Path)
- }
-
- if runtime.GOOS == "windows" {
- // Also replace all backslashes with forwardslashes since Windows
- // users are likely to do this but the URL should actually only
- // contain forward slashes.
- url.Path = strings.Replace(url.Path, `\`, `/`, -1)
- }
- }
-
- // Make sure it is lowercased
- url.Scheme = strings.ToLower(url.Scheme)
-
- // This is to work around issue #5927. This can safely be removed once
- // we distribute with a version of Go that fixes that bug.
- //
- // See: https://code.google.com/p/go/issues/detail?id=5927
- if url.Path != "" && url.Path[0] != '/' {
- url.Path = "/" + url.Path
- }
-
- // Verify that the scheme is something we support in our common downloader.
- supported := []string{"file", "http", "https"}
- found := false
- for _, s := range supported {
- if url.Scheme == s {
- found = true
- break
- }
- }
-
- if !found {
- return "", fmt.Errorf("Unsupported URL scheme: %s", url.Scheme)
- }
-
- return url.String(), nil
-}
diff --git a/vendor/github.com/mitchellh/packer/common/download.go b/vendor/github.com/mitchellh/packer/common/download.go
deleted file mode 100644
index 120e313e..00000000
--- a/vendor/github.com/mitchellh/packer/common/download.go
+++ /dev/null
@@ -1,291 +0,0 @@
-package common
-
-import (
- "bytes"
- "crypto/md5"
- "crypto/sha1"
- "crypto/sha256"
- "crypto/sha512"
- "encoding/hex"
- "errors"
- "fmt"
- "hash"
- "io"
- "log"
- "net/http"
- "net/url"
- "os"
- "runtime"
-)
-
-// DownloadConfig is the configuration given to instantiate a new
-// download instance. Once a configuration is used to instantiate
-// a download client, it must not be modified.
-type DownloadConfig struct {
- // The source URL in the form of a string.
- Url string
-
- // This is the path to download the file to.
- TargetPath string
-
- // DownloaderMap maps a schema to a Download.
- DownloaderMap map[string]Downloader
-
- // If true, this will copy even a local file to the target
- // location. If false, then it will "download" the file by just
- // returning the local path to the file.
- CopyFile bool
-
- // The hashing implementation to use to checksum the downloaded file.
- Hash hash.Hash
-
- // The checksum for the downloaded file. The hash implementation configuration
- // for the downloader will be used to verify with this checksum after
- // it is downloaded.
- Checksum []byte
-
- // What to use for the user agent for HTTP requests. If set to "", use the
- // default user agent provided by Go.
- UserAgent string
-}
-
-// A DownloadClient helps download, verify checksums, etc.
-type DownloadClient struct {
- config *DownloadConfig
- downloader Downloader
-}
-
-// HashForType returns the Hash implementation for the given string
-// type, or nil if the type is not supported.
-func HashForType(t string) hash.Hash {
- switch t {
- case "md5":
- return md5.New()
- case "sha1":
- return sha1.New()
- case "sha256":
- return sha256.New()
- case "sha512":
- return sha512.New()
- default:
- return nil
- }
-}
-
-// NewDownloadClient returns a new DownloadClient for the given
-// configuration.
-func NewDownloadClient(c *DownloadConfig) *DownloadClient {
- if c.DownloaderMap == nil {
- c.DownloaderMap = map[string]Downloader{
- "http": &HTTPDownloader{userAgent: c.UserAgent},
- "https": &HTTPDownloader{userAgent: c.UserAgent},
- }
- }
-
- return &DownloadClient{config: c}
-}
-
-// A downloader is responsible for actually taking a remote URL and
-// downloading it.
-type Downloader interface {
- Cancel()
- Download(*os.File, *url.URL) error
- Progress() uint
- Total() uint
-}
-
-func (d *DownloadClient) Cancel() {
- // TODO(mitchellh): Implement
-}
-
-func (d *DownloadClient) Get() (string, error) {
- // If we already have the file and it matches, then just return the target path.
- if verify, _ := d.VerifyChecksum(d.config.TargetPath); verify {
- log.Println("[DEBUG] Initial checksum matched, no download needed.")
- return d.config.TargetPath, nil
- }
-
- url, err := url.Parse(d.config.Url)
- if err != nil {
- return "", err
- }
-
- log.Printf("Parsed URL: %#v", url)
-
- // Files when we don't copy the file are special cased.
- var f *os.File
- var finalPath string
- sourcePath := ""
- if url.Scheme == "file" && !d.config.CopyFile {
- // This is a special case where we use a source file that already exists
- // locally and we don't make a copy. Normally we would copy or download.
- finalPath = url.Path
- log.Printf("[DEBUG] Using local file: %s", finalPath)
-
- // Remove forward slash on absolute Windows file URLs before processing
- if runtime.GOOS == "windows" && len(finalPath) > 0 && finalPath[0] == '/' {
- finalPath = finalPath[1:]
- }
- // Keep track of the source so we can make sure not to delete this later
- sourcePath = finalPath
- } else {
- finalPath = d.config.TargetPath
-
- var ok bool
- d.downloader, ok = d.config.DownloaderMap[url.Scheme]
- if !ok {
- return "", fmt.Errorf("No downloader for scheme: %s", url.Scheme)
- }
-
- // Otherwise, download using the downloader.
- f, err = os.OpenFile(finalPath, os.O_RDWR|os.O_CREATE, os.FileMode(0666))
- if err != nil {
- return "", err
- }
-
- log.Printf("[DEBUG] Downloading: %s", url.String())
- err = d.downloader.Download(f, url)
- f.Close()
- if err != nil {
- return "", err
- }
- }
-
- if d.config.Hash != nil {
- var verify bool
- verify, err = d.VerifyChecksum(finalPath)
- if err == nil && !verify {
- // Only delete the file if we made a copy or downloaded it
- if sourcePath != finalPath {
- os.Remove(finalPath)
- }
-
- err = fmt.Errorf(
- "checksums didn't match expected: %s",
- hex.EncodeToString(d.config.Checksum))
- }
- }
-
- return finalPath, err
-}
-
-// PercentProgress returns the download progress as a percentage.
-func (d *DownloadClient) PercentProgress() int {
- if d.downloader == nil {
- return -1
- }
-
- return int((float64(d.downloader.Progress()) / float64(d.downloader.Total())) * 100)
-}
-
-// VerifyChecksum tests that the path matches the checksum for the
-// download.
-func (d *DownloadClient) VerifyChecksum(path string) (bool, error) {
- if d.config.Checksum == nil || d.config.Hash == nil {
- return false, errors.New("Checksum or Hash isn't set on download.")
- }
-
- f, err := os.Open(path)
- if err != nil {
- return false, err
- }
- defer f.Close()
-
- log.Printf("Verifying checksum of %s", path)
- d.config.Hash.Reset()
- io.Copy(d.config.Hash, f)
- return bytes.Compare(d.config.Hash.Sum(nil), d.config.Checksum) == 0, nil
-}
-
-// HTTPDownloader is an implementation of Downloader that downloads
-// files over HTTP.
-type HTTPDownloader struct {
- progress uint
- total uint
- userAgent string
-}
-
-func (*HTTPDownloader) Cancel() {
- // TODO(mitchellh): Implement
-}
-
-func (d *HTTPDownloader) Download(dst *os.File, src *url.URL) error {
- log.Printf("Starting download: %s", src.String())
-
- // Seek to the beginning by default
- if _, err := dst.Seek(0, 0); err != nil {
- return err
- }
-
- // Reset our progress
- d.progress = 0
-
- // Make the request. We first make a HEAD request so we can check
- // if the server supports range queries. If the server/URL doesn't
- // support HEAD requests, we just fall back to GET.
- req, err := http.NewRequest("HEAD", src.String(), nil)
- if err != nil {
- return err
- }
-
- if d.userAgent != "" {
- req.Header.Set("User-Agent", d.userAgent)
- }
-
- httpClient := &http.Client{
- Transport: &http.Transport{
- Proxy: http.ProxyFromEnvironment,
- },
- }
-
- resp, err := httpClient.Do(req)
- if err == nil && (resp.StatusCode >= 200 && resp.StatusCode < 300) {
- // If the HEAD request succeeded, then attempt to set the range
- // query if we can.
- if resp.Header.Get("Accept-Ranges") == "bytes" {
- if fi, err := dst.Stat(); err == nil {
- if _, err = dst.Seek(0, os.SEEK_END); err == nil {
- req.Header.Set("Range", fmt.Sprintf("bytes=%d-", fi.Size()))
- d.progress = uint(fi.Size())
- }
- }
- }
- }
-
- // Set the request to GET now, and redo the query to download
- req.Method = "GET"
-
- resp, err = httpClient.Do(req)
- if err != nil {
- return err
- }
-
- d.total = d.progress + uint(resp.ContentLength)
- var buffer [4096]byte
- for {
- n, err := resp.Body.Read(buffer[:])
- if err != nil && err != io.EOF {
- return err
- }
-
- d.progress += uint(n)
-
- if _, werr := dst.Write(buffer[:n]); werr != nil {
- return werr
- }
-
- if err == io.EOF {
- break
- }
- }
-
- return nil
-}
-
-func (d *HTTPDownloader) Progress() uint {
- return d.progress
-}
-
-func (d *HTTPDownloader) Total() uint {
- return d.total
-}
diff --git a/vendor/github.com/mitchellh/packer/common/http_config.go b/vendor/github.com/mitchellh/packer/common/http_config.go
deleted file mode 100644
index 41381c2a..00000000
--- a/vendor/github.com/mitchellh/packer/common/http_config.go
+++ /dev/null
@@ -1,34 +0,0 @@
-package common
-
-import (
- "errors"
-
- "github.com/mitchellh/packer/template/interpolate"
-)
-
-// HTTPConfig contains configuration for the local HTTP Server
-type HTTPConfig struct {
- HTTPDir string `mapstructure:"http_directory"`
- HTTPPortMin uint `mapstructure:"http_port_min"`
- HTTPPortMax uint `mapstructure:"http_port_max"`
-}
-
-func (c *HTTPConfig) Prepare(ctx *interpolate.Context) []error {
- // Validation
- var errs []error
-
- if c.HTTPPortMin == 0 {
- c.HTTPPortMin = 8000
- }
-
- if c.HTTPPortMax == 0 {
- c.HTTPPortMax = 9000
- }
-
- if c.HTTPPortMin > c.HTTPPortMax {
- errs = append(errs,
- errors.New("http_port_min must be less than http_port_max"))
- }
-
- return errs
-}
diff --git a/vendor/github.com/mitchellh/packer/common/iso_config.go b/vendor/github.com/mitchellh/packer/common/iso_config.go
deleted file mode 100644
index fddea5bb..00000000
--- a/vendor/github.com/mitchellh/packer/common/iso_config.go
+++ /dev/null
@@ -1,160 +0,0 @@
-package common
-
-import (
- "bufio"
- "errors"
- "fmt"
- "io"
- "net/http"
- "net/url"
- "os"
- "path/filepath"
- "strings"
-
- "github.com/mitchellh/packer/template/interpolate"
-)
-
-// ISOConfig contains configuration for downloading ISO images.
-type ISOConfig struct {
- ISOChecksum string `mapstructure:"iso_checksum"`
- ISOChecksumURL string `mapstructure:"iso_checksum_url"`
- ISOChecksumType string `mapstructure:"iso_checksum_type"`
- ISOUrls []string `mapstructure:"iso_urls"`
- TargetPath string `mapstructure:"iso_target_path"`
- RawSingleISOUrl string `mapstructure:"iso_url"`
-}
-
-func (c *ISOConfig) Prepare(ctx *interpolate.Context) ([]string, []error) {
- // Validation
- var errs []error
- var err error
- var warnings []string
-
- if c.RawSingleISOUrl == "" && len(c.ISOUrls) == 0 {
- errs = append(
- errs, errors.New("One of iso_url or iso_urls must be specified."))
- } else if c.RawSingleISOUrl != "" && len(c.ISOUrls) > 0 {
- errs = append(
- errs, errors.New("Only one of iso_url or iso_urls may be specified."))
- } else if c.RawSingleISOUrl != "" {
- c.ISOUrls = []string{c.RawSingleISOUrl}
- }
-
- if c.ISOChecksumType == "" {
- errs = append(
- errs, errors.New("The iso_checksum_type must be specified."))
- } else {
- c.ISOChecksumType = strings.ToLower(c.ISOChecksumType)
- if c.ISOChecksumType != "none" {
- if c.ISOChecksum == "" && c.ISOChecksumURL == "" {
- errs = append(
- errs, errors.New("Due to large file sizes, an iso_checksum is required"))
- return warnings, errs
- } else {
- if h := HashForType(c.ISOChecksumType); h == nil {
- errs = append(
- errs, fmt.Errorf("Unsupported checksum type: %s", c.ISOChecksumType))
- return warnings, errs
- }
-
- // If iso_checksum has no value use iso_checksum_url instead.
- if c.ISOChecksum == "" {
- u, err := url.Parse(c.ISOChecksumURL)
- if err != nil {
- errs = append(errs,
- fmt.Errorf("Error parsing checksum: %s", err))
- return warnings, errs
- }
- switch u.Scheme {
- case "http", "https":
- res, err := http.Get(c.ISOChecksumURL)
- c.ISOChecksum = ""
- if err != nil {
- errs = append(errs,
- fmt.Errorf("Error getting checksum from url: %s", c.ISOChecksumURL))
- return warnings, errs
- }
- defer res.Body.Close()
- err = c.parseCheckSumFile(bufio.NewReader(res.Body))
- if err != nil {
- errs = append(errs, err)
- return warnings, errs
- }
- case "file":
- file, err := os.Open(u.Path)
- if err != nil {
- errs = append(errs, err)
- return warnings, errs
- }
- err = c.parseCheckSumFile(bufio.NewReader(file))
- if err != nil {
- errs = append(errs, err)
- return warnings, errs
- }
-
- case "":
- break
- default:
- errs = append(errs,
- fmt.Errorf("Error parsing checksum url: %s, scheme not supported: %s", c.ISOChecksumURL, u.Scheme))
- return warnings, errs
- }
- }
- }
- }
- }
-
- c.ISOChecksum = strings.ToLower(c.ISOChecksum)
-
- for i, url := range c.ISOUrls {
- c.ISOUrls[i], err = DownloadableURL(url)
- if err != nil {
- errs = append(
- errs, fmt.Errorf("Failed to parse iso_url %d: %s", i+1, err))
- }
- }
-
- // Warnings
- if c.ISOChecksumType == "none" {
- warnings = append(warnings,
- "A checksum type of 'none' was specified. Since ISO files are so big,\n"+
- "a checksum is highly recommended.")
- }
-
- return warnings, errs
-}
-
-func (c *ISOConfig) parseCheckSumFile(rd *bufio.Reader) error {
- for {
- line, err := rd.ReadString('\n')
- if err != nil {
- if err == io.EOF {
- return fmt.Errorf("No checksum for \"%s\" found at: %s", filepath.Base(c.ISOUrls[0]), c.ISOChecksumURL)
- } else {
- return fmt.Errorf("Error getting checksum from url: %s , %s", c.ISOChecksumURL, err.Error())
- }
- }
- parts := strings.Fields(line)
- if len(parts) < 2 {
- continue
- }
- if strings.ToLower(parts[0]) == c.ISOChecksumType {
- // BSD-style checksum
- if parts[1] == fmt.Sprintf("(%s)", filepath.Base(c.ISOUrls[0])) {
- c.ISOChecksum = parts[3]
- break
- }
- } else {
- // Standard checksum
- if parts[1][0] == '*' {
- // Binary mode
- parts[1] = parts[1][1:]
- }
- if parts[1] == filepath.Base(c.ISOUrls[0]) {
- c.ISOChecksum = parts[0]
- break
- }
- }
- }
- return nil
-}
diff --git a/vendor/github.com/mitchellh/packer/common/multistep_debug.go b/vendor/github.com/mitchellh/packer/common/multistep_debug.go
deleted file mode 100644
index 8de05c48..00000000
--- a/vendor/github.com/mitchellh/packer/common/multistep_debug.go
+++ /dev/null
@@ -1,50 +0,0 @@
-package common
-
-import (
- "fmt"
- "github.com/mitchellh/multistep"
- "github.com/mitchellh/packer/packer"
- "log"
- "time"
-)
-
-// MultistepDebugFn will return a proper multistep.DebugPauseFn to
-// use for debugging if you're using multistep in your builder.
-func MultistepDebugFn(ui packer.Ui) multistep.DebugPauseFn {
- return func(loc multistep.DebugLocation, name string, state multistep.StateBag) {
- var locationString string
- switch loc {
- case multistep.DebugLocationAfterRun:
- locationString = "after run of"
- case multistep.DebugLocationBeforeCleanup:
- locationString = "before cleanup of"
- default:
- locationString = "at"
- }
-
- message := fmt.Sprintf(
- "Pausing %s step '%s'. Press enter to continue.",
- locationString, name)
-
- result := make(chan string, 1)
- go func() {
- line, err := ui.Ask(message)
- if err != nil {
- log.Printf("Error asking for input: %s", err)
- }
-
- result <- line
- }()
-
- for {
- select {
- case <-result:
- return
- case <-time.After(100 * time.Millisecond):
- if _, ok := state.GetOk(multistep.StateCancelled); ok {
- return
- }
- }
- }
- }
-}
diff --git a/vendor/github.com/mitchellh/packer/common/packer_config.go b/vendor/github.com/mitchellh/packer/common/packer_config.go
deleted file mode 100644
index 2ef86e58..00000000
--- a/vendor/github.com/mitchellh/packer/common/packer_config.go
+++ /dev/null
@@ -1,12 +0,0 @@
-package common
-
-// PackerConfig is a struct that contains the configuration keys that
-// are sent by packer, properly tagged already so mapstructure can load
-// them. Embed this structure into your configuration class to get it.
-type PackerConfig struct {
- PackerBuildName string `mapstructure:"packer_build_name"`
- PackerBuilderType string `mapstructure:"packer_builder_type"`
- PackerDebug bool `mapstructure:"packer_debug"`
- PackerForce bool `mapstructure:"packer_force"`
- PackerUserVars map[string]string `mapstructure:"packer_user_variables"`
-}
diff --git a/vendor/github.com/mitchellh/packer/common/ssh/key.go b/vendor/github.com/mitchellh/packer/common/ssh/key.go
deleted file mode 100644
index 0de73b78..00000000
--- a/vendor/github.com/mitchellh/packer/common/ssh/key.go
+++ /dev/null
@@ -1,44 +0,0 @@
-package ssh
-
-import (
- "encoding/pem"
- "fmt"
- "io/ioutil"
- "os"
-
- "golang.org/x/crypto/ssh"
-)
-
-// FileSigner returns an ssh.Signer for a key file.
-func FileSigner(path string) (ssh.Signer, error) {
- f, err := os.Open(path)
- if err != nil {
- return nil, err
- }
- defer f.Close()
-
- keyBytes, err := ioutil.ReadAll(f)
- if err != nil {
- return nil, err
- }
-
- // We parse the private key on our own first so that we can
- // show a nicer error if the private key has a password.
- block, _ := pem.Decode(keyBytes)
- if block == nil {
- return nil, fmt.Errorf(
- "Failed to read key '%s': no key found", path)
- }
- if block.Headers["Proc-Type"] == "4,ENCRYPTED" {
- return nil, fmt.Errorf(
- "Failed to read key '%s': password protected keys are\n"+
- "not supported. Please decrypt the key prior to use.", path)
- }
-
- signer, err := ssh.ParsePrivateKey(keyBytes)
- if err != nil {
- return nil, fmt.Errorf("Error setting up SSH config: %s", err)
- }
-
- return signer, nil
-}
diff --git a/vendor/github.com/mitchellh/packer/common/step_create_floppy.go b/vendor/github.com/mitchellh/packer/common/step_create_floppy.go
deleted file mode 100644
index 7b9b8c53..00000000
--- a/vendor/github.com/mitchellh/packer/common/step_create_floppy.go
+++ /dev/null
@@ -1,198 +0,0 @@
-package common
-
-import (
- "fmt"
- "github.com/mitchellh/go-fs"
- "github.com/mitchellh/go-fs/fat"
- "github.com/mitchellh/multistep"
- "github.com/mitchellh/packer/packer"
- "io"
- "io/ioutil"
- "log"
- "os"
- "path/filepath"
- "strings"
-)
-
-// StepCreateFloppy will create a floppy disk with the given files.
-// The floppy disk doesn't support sub-directories. Only files at the
-// root level are supported.
-type StepCreateFloppy struct {
- Files []string
-
- floppyPath string
-
- FilesAdded map[string]bool
-}
-
-func (s *StepCreateFloppy) Run(state multistep.StateBag) multistep.StepAction {
- if len(s.Files) == 0 {
- log.Println("No floppy files specified. Floppy disk will not be made.")
- return multistep.ActionContinue
- }
-
- s.FilesAdded = make(map[string]bool)
-
- ui := state.Get("ui").(packer.Ui)
- ui.Say("Creating floppy disk...")
-
- // Create a temporary file to be our floppy drive
- floppyF, err := ioutil.TempFile("", "packer")
- if err != nil {
- state.Put("error",
- fmt.Errorf("Error creating temporary file for floppy: %s", err))
- return multistep.ActionHalt
- }
- defer floppyF.Close()
-
- // Set the path so we can remove it later
- s.floppyPath = floppyF.Name()
-
- log.Printf("Floppy path: %s", s.floppyPath)
-
- // Set the size of the file to be a floppy sized
- if err := floppyF.Truncate(1440 * 1024); err != nil {
- state.Put("error", fmt.Errorf("Error creating floppy: %s", err))
- return multistep.ActionHalt
- }
-
- // BlockDevice backed by the file for our filesystem
- log.Println("Initializing block device backed by temporary file")
- device, err := fs.NewFileDisk(floppyF)
- if err != nil {
- state.Put("error", fmt.Errorf("Error creating floppy: %s", err))
- return multistep.ActionHalt
- }
-
- // Format the block device so it contains a valid FAT filesystem
- log.Println("Formatting the block device with a FAT filesystem...")
- formatConfig := &fat.SuperFloppyConfig{
- FATType: fat.FAT12,
- Label: "packer",
- OEMName: "packer",
- }
- if err := fat.FormatSuperFloppy(device, formatConfig); err != nil {
- state.Put("error", fmt.Errorf("Error creating floppy: %s", err))
- return multistep.ActionHalt
- }
-
- // The actual FAT filesystem
- log.Println("Initializing FAT filesystem on block device")
- fatFs, err := fat.New(device)
- if err != nil {
- state.Put("error", fmt.Errorf("Error creating floppy: %s", err))
- return multistep.ActionHalt
- }
-
- // Get the root directory to the filesystem
- log.Println("Reading the root directory from the filesystem")
- rootDir, err := fatFs.RootDir()
- if err != nil {
- state.Put("error", fmt.Errorf("Error creating floppy: %s", err))
- return multistep.ActionHalt
- }
-
- // Go over each file and copy it.
- for _, filename := range s.Files {
- ui.Message(fmt.Sprintf("Copying: %s", filename))
- if err := s.addFilespec(rootDir, filename); err != nil {
- state.Put("error", fmt.Errorf("Error adding file to floppy: %s", err))
- return multistep.ActionHalt
- }
- }
-
- // Set the path to the floppy so it can be used later
- state.Put("floppy_path", s.floppyPath)
-
- return multistep.ActionContinue
-}
-
-func (s *StepCreateFloppy) Cleanup(multistep.StateBag) {
- if s.floppyPath != "" {
- log.Printf("Deleting floppy disk: %s", s.floppyPath)
- os.Remove(s.floppyPath)
- }
-}
-
-func (s *StepCreateFloppy) addFilespec(dir fs.Directory, src string) error {
- // same as http://golang.org/src/pkg/path/filepath/match.go#L308
- if strings.IndexAny(src, "*?[") >= 0 {
- matches, err := filepath.Glob(src)
- if err != nil {
- return err
- }
- return s.addFiles(dir, matches)
- }
-
- finfo, err := os.Stat(src)
- if err != nil {
- return err
- }
-
- if finfo.IsDir() {
- return s.addDirectory(dir, src)
- }
-
- return s.addSingleFile(dir, src)
-}
-
-func (s *StepCreateFloppy) addFiles(dir fs.Directory, files []string) error {
- for _, file := range files {
- err := s.addFilespec(dir, file)
- if err != nil {
- return err
- }
- }
-
- return nil
-}
-
-func (s *StepCreateFloppy) addDirectory(dir fs.Directory, src string) error {
- log.Printf("Adding directory to floppy: %s", src)
-
- walkFn := func(path string, finfo os.FileInfo, err error) error {
- if err != nil {
- return err
- }
-
- if path == src {
- return nil
- }
-
- if finfo.IsDir() {
- return s.addDirectory(dir, path)
- }
-
- return s.addSingleFile(dir, path)
- }
-
- return filepath.Walk(src, walkFn)
-}
-
-func (s *StepCreateFloppy) addSingleFile(dir fs.Directory, src string) error {
- log.Printf("Adding file to floppy: %s", src)
-
- inputF, err := os.Open(src)
- if err != nil {
- return err
- }
- defer inputF.Close()
-
- entry, err := dir.AddFile(filepath.Base(src))
- if err != nil {
- return err
- }
-
- fatFile, err := entry.File()
- if err != nil {
- return err
- }
-
- if _, err := io.Copy(fatFile, inputF); err != nil {
- return err
- }
-
- s.FilesAdded[src] = true
-
- return nil
-}
diff --git a/vendor/github.com/mitchellh/packer/common/step_download.go b/vendor/github.com/mitchellh/packer/common/step_download.go
deleted file mode 100644
index b8bd60b5..00000000
--- a/vendor/github.com/mitchellh/packer/common/step_download.go
+++ /dev/null
@@ -1,157 +0,0 @@
-package common
-
-import (
- "crypto/sha1"
- "encoding/hex"
- "fmt"
- "log"
- "time"
-
- "github.com/mitchellh/multistep"
- "github.com/mitchellh/packer/packer"
-)
-
-// StepDownload downloads a remote file using the download client within
-// this package. This step handles setting up the download configuration,
-// progress reporting, interrupt handling, etc.
-//
-// Uses:
-// cache packer.Cache
-// ui packer.Ui
-type StepDownload struct {
- // The checksum and the type of the checksum for the download
- Checksum string
- ChecksumType string
-
- // A short description of the type of download being done. Example:
- // "ISO" or "Guest Additions"
- Description string
-
- // The name of the key where the final path of the ISO will be put
- // into the state.
- ResultKey string
-
- // The path where the result should go, otherwise it goes to the
- // cache directory.
- TargetPath string
-
- // A list of URLs to attempt to download this thing.
- Url []string
-
- // Extension is the extension to force for the file that is downloaded.
- // Some systems require a certain extension. If this isn't set, the
- // extension on the URL is used. Otherwise, this will be forced
- // on the downloaded file for every URL.
- Extension string
-}
-
-func (s *StepDownload) Run(state multistep.StateBag) multistep.StepAction {
- cache := state.Get("cache").(packer.Cache)
- ui := state.Get("ui").(packer.Ui)
-
- var checksum []byte
- if s.Checksum != "" {
- var err error
- checksum, err = hex.DecodeString(s.Checksum)
- if err != nil {
- state.Put("error", fmt.Errorf("Error parsing checksum: %s", err))
- return multistep.ActionHalt
- }
- }
-
- ui.Say(fmt.Sprintf("Downloading or copying %s", s.Description))
-
- var finalPath string
- for _, url := range s.Url {
- ui.Message(fmt.Sprintf("Downloading or copying: %s", url))
-
- targetPath := s.TargetPath
- if targetPath == "" {
- // Determine a cache key. This is normally just the URL but
- // if we force a certain extension we hash the URL and add
- // the extension to force it.
- cacheKey := url
- if s.Extension != "" {
- hash := sha1.Sum([]byte(url))
- cacheKey = fmt.Sprintf(
- "%s.%s", hex.EncodeToString(hash[:]), s.Extension)
- }
-
- log.Printf("Acquiring lock to download: %s", url)
- targetPath = cache.Lock(cacheKey)
- defer cache.Unlock(cacheKey)
- }
-
- config := &DownloadConfig{
- Url: url,
- TargetPath: targetPath,
- CopyFile: false,
- Hash: HashForType(s.ChecksumType),
- Checksum: checksum,
- UserAgent: "Packer",
- }
-
- path, err, retry := s.download(config, state)
- if err != nil {
- ui.Message(fmt.Sprintf("Error downloading: %s", err))
- }
-
- if !retry {
- return multistep.ActionHalt
- }
-
- if err == nil {
- finalPath = path
- break
- }
- }
-
- if finalPath == "" {
- err := fmt.Errorf("%s download failed.", s.Description)
- state.Put("error", err)
- ui.Error(err.Error())
- return multistep.ActionHalt
- }
-
- state.Put(s.ResultKey, finalPath)
- return multistep.ActionContinue
-}
-
-func (s *StepDownload) Cleanup(multistep.StateBag) {}
-
-func (s *StepDownload) download(config *DownloadConfig, state multistep.StateBag) (string, error, bool) {
- var path string
- ui := state.Get("ui").(packer.Ui)
- download := NewDownloadClient(config)
-
- downloadCompleteCh := make(chan error, 1)
- go func() {
- var err error
- path, err = download.Get()
- downloadCompleteCh <- err
- }()
-
- progressTicker := time.NewTicker(5 * time.Second)
- defer progressTicker.Stop()
-
- for {
- select {
- case err := <-downloadCompleteCh:
- if err != nil {
- return "", err, true
- }
-
- return path, nil, true
- case <-progressTicker.C:
- progress := download.PercentProgress()
- if progress >= 0 {
- ui.Message(fmt.Sprintf("Download progress: %d%%", progress))
- }
- case <-time.After(1 * time.Second):
- if _, ok := state.GetOk(multistep.StateCancelled); ok {
- ui.Say("Interrupt received. Cancelling download...")
- return "", nil, false
- }
- }
- }
-}
diff --git a/vendor/github.com/mitchellh/packer/common/step_http_server.go b/vendor/github.com/mitchellh/packer/common/step_http_server.go
deleted file mode 100644
index 55874992..00000000
--- a/vendor/github.com/mitchellh/packer/common/step_http_server.go
+++ /dev/null
@@ -1,78 +0,0 @@
-package common
-
-import (
- "fmt"
- "github.com/mitchellh/multistep"
- "github.com/mitchellh/packer/packer"
- "log"
- "math/rand"
- "net"
- "net/http"
-)
-
-// This step creates and runs the HTTP server that is serving files from the
-// directory specified by the 'http_directory` configuration parameter in the
-// template.
-//
-// Uses:
-// ui packer.Ui
-//
-// Produces:
-// http_port int - The port the HTTP server started on.
-type StepHTTPServer struct {
- HTTPDir string
- HTTPPortMin uint
- HTTPPortMax uint
-
- l net.Listener
-}
-
-func (s *StepHTTPServer) Run(state multistep.StateBag) multistep.StepAction {
- ui := state.Get("ui").(packer.Ui)
-
- var httpPort uint = 0
- if s.HTTPDir == "" {
- state.Put("http_port", httpPort)
- return multistep.ActionContinue
- }
-
- // Find an available TCP port for our HTTP server
- var httpAddr string
- portRange := int(s.HTTPPortMax - s.HTTPPortMin)
- for {
- var err error
- var offset uint = 0
-
- if portRange > 0 {
- // Intn will panic if portRange == 0, so we do a check.
- offset = uint(rand.Intn(portRange))
- }
-
- httpPort = offset + s.HTTPPortMin
- httpAddr = fmt.Sprintf("0.0.0.0:%d", httpPort)
- log.Printf("Trying port: %d", httpPort)
- s.l, err = net.Listen("tcp", httpAddr)
- if err == nil {
- break
- }
- }
-
- ui.Say(fmt.Sprintf("Starting HTTP server on port %d", httpPort))
-
- // Start the HTTP server and run it in the background
- fileServer := http.FileServer(http.Dir(s.HTTPDir))
- server := &http.Server{Addr: httpAddr, Handler: fileServer}
- go server.Serve(s.l)
-
- // Save the address into the state so it can be accessed in the future
- state.Put("http_port", httpPort)
-
- return multistep.ActionContinue
-}
-
-func (s *StepHTTPServer) Cleanup(multistep.StateBag) {
- if s.l != nil {
- // Close the listener so that the HTTP server stops
- s.l.Close()
- }
-}
diff --git a/vendor/github.com/mitchellh/packer/common/step_provision.go b/vendor/github.com/mitchellh/packer/common/step_provision.go
deleted file mode 100644
index f40cfd89..00000000
--- a/vendor/github.com/mitchellh/packer/common/step_provision.go
+++ /dev/null
@@ -1,61 +0,0 @@
-package common
-
-import (
- "github.com/mitchellh/multistep"
- "github.com/mitchellh/packer/packer"
- "log"
- "time"
-)
-
-// StepProvision runs the provisioners.
-//
-// Uses:
-// communicator packer.Communicator
-// hook packer.Hook
-// ui packer.Ui
-//
-// Produces:
-//
-type StepProvision struct {
- Comm packer.Communicator
-}
-
-func (s *StepProvision) Run(state multistep.StateBag) multistep.StepAction {
- comm := s.Comm
- if comm == nil {
- raw, ok := state.Get("communicator").(packer.Communicator)
- if ok {
- comm = raw.(packer.Communicator)
- }
- }
- hook := state.Get("hook").(packer.Hook)
- ui := state.Get("ui").(packer.Ui)
-
- // Run the provisioner in a goroutine so we can continually check
- // for cancellations...
- log.Println("Running the provision hook")
- errCh := make(chan error, 1)
- go func() {
- errCh <- hook.Run(packer.HookProvision, ui, comm, nil)
- }()
-
- for {
- select {
- case err := <-errCh:
- if err != nil {
- state.Put("error", err)
- return multistep.ActionHalt
- }
-
- return multistep.ActionContinue
- case <-time.After(1 * time.Second):
- if _, ok := state.GetOk(multistep.StateCancelled); ok {
- log.Println("Cancelling provisioning due to interrupt...")
- hook.Cancel()
- return multistep.ActionHalt
- }
- }
- }
-}
-
-func (*StepProvision) Cleanup(multistep.StateBag) {}
diff --git a/vendor/github.com/mitchellh/packer/common/uuid/uuid.go b/vendor/github.com/mitchellh/packer/common/uuid/uuid.go
deleted file mode 100644
index d8b9830b..00000000
--- a/vendor/github.com/mitchellh/packer/common/uuid/uuid.go
+++ /dev/null
@@ -1,24 +0,0 @@
-package uuid
-
-import (
- "crypto/rand"
- "fmt"
- "time"
-)
-
-// Generates a time ordered UUID. Top 32 bits are a timestamp,
-// bottom 96 are random.
-func TimeOrderedUUID() string {
- unix := uint32(time.Now().UTC().Unix())
-
- b := make([]byte, 12)
- n, err := rand.Read(b)
- if n != len(b) {
- err = fmt.Errorf("Not enough entropy available")
- }
- if err != nil {
- panic(err)
- }
- return fmt.Sprintf("%08x-%04x-%04x-%04x-%04x%08x",
- unix, b[0:2], b[2:4], b[4:6], b[6:8], b[8:])
-}
diff --git a/vendor/github.com/mitchellh/packer/communicator/none/communicator.go b/vendor/github.com/mitchellh/packer/communicator/none/communicator.go
deleted file mode 100644
index d903f1c9..00000000
--- a/vendor/github.com/mitchellh/packer/communicator/none/communicator.go
+++ /dev/null
@@ -1,40 +0,0 @@
-package none
-
-import (
- "errors"
- "github.com/mitchellh/packer/packer"
- "io"
- "os"
-)
-
-type comm struct {
- config string
-}
-
-// Creates a null packer.Communicator implementation. This takes
-// an already existing configuration.
-func New(config string) (result *comm, err error) {
- // Establish an initial connection and connect
- result = &comm{
- config: config,
- }
-
- return
-}
-
-func (c *comm) Start(cmd *packer.RemoteCmd) (err error) {
- cmd.SetExited(0)
- return
-}
-
-func (c *comm) Upload(path string, input io.Reader, fi *os.FileInfo) error {
- return errors.New("Upload is not implemented when communicator = 'none'")
-}
-
-func (c *comm) UploadDir(dst string, src string, excl []string) error {
- return errors.New("UploadDir is not implemented when communicator = 'none'")
-}
-
-func (c *comm) Download(path string, output io.Writer) error {
- return errors.New("Download is not implemented when communicator = 'none'")
-}
diff --git a/vendor/github.com/mitchellh/packer/communicator/ssh/communicator.go b/vendor/github.com/mitchellh/packer/communicator/ssh/communicator.go
deleted file mode 100644
index 8bcf4ce7..00000000
--- a/vendor/github.com/mitchellh/packer/communicator/ssh/communicator.go
+++ /dev/null
@@ -1,901 +0,0 @@
-package ssh
-
-import (
- "bufio"
- "bytes"
- "errors"
- "fmt"
- "io"
- "io/ioutil"
- "log"
- "net"
- "os"
- "path/filepath"
- "strconv"
- "strings"
- "sync"
- "time"
-
- "github.com/mitchellh/packer/packer"
- "github.com/pkg/sftp"
- "golang.org/x/crypto/ssh"
- "golang.org/x/crypto/ssh/agent"
-)
-
-// ErrHandshakeTimeout is returned from New() whenever we're unable to establish
-// an ssh connection within a certain timeframe. By default the handshake time-
-// out period is 1 minute. You can change it with Config.HandshakeTimeout.
-var ErrHandshakeTimeout = fmt.Errorf("Timeout during SSH handshake")
-
-type comm struct {
- client *ssh.Client
- config *Config
- conn net.Conn
- address string
-}
-
-// Config is the structure used to configure the SSH communicator.
-type Config struct {
- // The configuration of the Go SSH connection
- SSHConfig *ssh.ClientConfig
-
- // Connection returns a new connection. The current connection
- // in use will be closed as part of the Close method, or in the
- // case an error occurs.
- Connection func() (net.Conn, error)
-
- // Pty, if true, will request a pty from the remote end.
- Pty bool
-
- // DisableAgent, if true, will not forward the SSH agent.
- DisableAgent bool
-
- // HandshakeTimeout limits the amount of time we'll wait to handshake before
- // saying the connection failed.
- HandshakeTimeout time.Duration
-
- // UseSftp, if true, sftp will be used instead of scp for file transfers
- UseSftp bool
-}
-
-// Creates a new packer.Communicator implementation over SSH. This takes
-// an already existing TCP connection and SSH configuration.
-func New(address string, config *Config) (result *comm, err error) {
- // Establish an initial connection and connect
- result = &comm{
- config: config,
- address: address,
- }
-
- if err = result.reconnect(); err != nil {
- result = nil
- return
- }
-
- return
-}
-
-func (c *comm) Start(cmd *packer.RemoteCmd) (err error) {
- session, err := c.newSession()
- if err != nil {
- return
- }
-
- // Setup our session
- session.Stdin = cmd.Stdin
- session.Stdout = cmd.Stdout
- session.Stderr = cmd.Stderr
-
- if c.config.Pty {
- // Request a PTY
- termModes := ssh.TerminalModes{
- ssh.ECHO: 0, // do not echo
- ssh.TTY_OP_ISPEED: 14400, // input speed = 14.4kbaud
- ssh.TTY_OP_OSPEED: 14400, // output speed = 14.4kbaud
- }
-
- if err = session.RequestPty("xterm", 40, 80, termModes); err != nil {
- return
- }
- }
-
- log.Printf("starting remote command: %s", cmd.Command)
- err = session.Start(cmd.Command + "\n")
- if err != nil {
- return
- }
-
- // A channel to keep track of our done state
- doneCh := make(chan struct{})
- sessionLock := new(sync.Mutex)
- timedOut := false
-
- // Start a goroutine to wait for the session to end and set the
- // exit boolean and status.
- go func() {
- defer session.Close()
-
- err := session.Wait()
- exitStatus := 0
- if err != nil {
- exitErr, ok := err.(*ssh.ExitError)
- if ok {
- exitStatus = exitErr.ExitStatus()
- }
- }
-
- sessionLock.Lock()
- defer sessionLock.Unlock()
-
- if timedOut {
- // We timed out, so set the exit status to -1
- exitStatus = -1
- }
-
- log.Printf("remote command exited with '%d': %s", exitStatus, cmd.Command)
- cmd.SetExited(exitStatus)
- close(doneCh)
- }()
-
- return
-}
-
-func (c *comm) Upload(path string, input io.Reader, fi *os.FileInfo) error {
- if c.config.UseSftp {
- return c.sftpUploadSession(path, input, fi)
- } else {
- return c.scpUploadSession(path, input, fi)
- }
-}
-
-func (c *comm) UploadDir(dst string, src string, excl []string) error {
- log.Printf("Upload dir '%s' to '%s'", src, dst)
- if c.config.UseSftp {
- return c.sftpUploadDirSession(dst, src, excl)
- } else {
- return c.scpUploadDirSession(dst, src, excl)
- }
-}
-
-func (c *comm) DownloadDir(src string, dst string, excl []string) error {
- log.Printf("Download dir '%s' to '%s'", src, dst)
- scpFunc := func(w io.Writer, stdoutR *bufio.Reader) error {
- for {
- fmt.Fprint(w, "\x00")
-
- // read file info
- fi, err := stdoutR.ReadString('\n')
- if err != nil {
- return err
- }
-
- if len(fi) < 0 {
- return fmt.Errorf("empty response from server")
- }
-
- switch fi[0] {
- case '\x01', '\x02':
- return fmt.Errorf("%s", fi[1:])
- case 'C', 'D':
- break
- default:
- return fmt.Errorf("unexpected server response (%x)", fi[0])
- }
-
- var mode string
- var size int64
- var name string
- log.Printf("Download dir str:%s", fi)
- n, err := fmt.Sscanf(fi, "%6s %d %s", &mode, &size, &name)
- if err != nil || n != 3 {
- return fmt.Errorf("can't parse server response (%s)", fi)
- }
- if size < 0 {
- return fmt.Errorf("negative file size")
- }
-
- log.Printf("Download dir mode:%s size:%d name:%s", mode, size, name)
- switch fi[0] {
- case 'D':
- err = os.MkdirAll(filepath.Join(dst, name), os.FileMode(0755))
- if err != nil {
- return err
- }
- fmt.Fprint(w, "\x00")
- return nil
- case 'C':
- fmt.Fprint(w, "\x00")
- err = scpDownloadFile(filepath.Join(dst, name), stdoutR, size, os.FileMode(0644))
- if err != nil {
- return err
- }
- }
-
- if err := checkSCPStatus(stdoutR); err != nil {
- return err
- }
- }
- }
- return c.scpSession("scp -vrf "+src, scpFunc)
-}
-
-func (c *comm) Download(path string, output io.Writer) error {
- if c.config.UseSftp {
- return c.sftpDownloadSession(path, output)
- }
- return c.scpDownloadSession(path, output)
-}
-
-func (c *comm) newSession() (session *ssh.Session, err error) {
- log.Println("opening new ssh session")
- if c.client == nil {
- err = errors.New("client not available")
- } else {
- session, err = c.client.NewSession()
- }
-
- if err != nil {
- log.Printf("ssh session open error: '%s', attempting reconnect", err)
- if err := c.reconnect(); err != nil {
- return nil, err
- }
-
- return c.client.NewSession()
- }
-
- return session, nil
-}
-
-func (c *comm) reconnect() (err error) {
- if c.conn != nil {
- c.conn.Close()
- }
-
- // Set the conn and client to nil since we'll recreate it
- c.conn = nil
- c.client = nil
-
- log.Printf("reconnecting to TCP connection for SSH")
- c.conn, err = c.config.Connection()
- if err != nil {
- // Explicitly set this to the REAL nil. Connection() can return
- // a nil implementation of net.Conn which will make the
- // "if c.conn == nil" check fail above. Read here for more information
- // on this psychotic language feature:
- //
- // http://golang.org/doc/faq#nil_error
- c.conn = nil
-
- log.Printf("reconnection error: %s", err)
- return
- }
-
- log.Printf("handshaking with SSH")
-
- // Default timeout to 1 minute if it wasn't specified (zero value). For
- // when you need to handshake from low orbit.
- var duration time.Duration
- if c.config.HandshakeTimeout == 0 {
- duration = 1 * time.Minute
- } else {
- duration = c.config.HandshakeTimeout
- }
-
- connectionEstablished := make(chan struct{}, 1)
-
- var sshConn ssh.Conn
- var sshChan <-chan ssh.NewChannel
- var req <-chan *ssh.Request
-
- go func() {
- sshConn, sshChan, req, err = ssh.NewClientConn(c.conn, c.address, c.config.SSHConfig)
- close(connectionEstablished)
- }()
-
- select {
- case <-connectionEstablished:
- // We don't need to do anything here. We just want select to block until
- // we connect or timeout.
- case <-time.After(duration):
- if c.conn != nil {
- c.conn.Close()
- }
- if sshConn != nil {
- sshConn.Close()
- }
- return ErrHandshakeTimeout
- }
-
- if err != nil {
- log.Printf("handshake error: %s", err)
- return
- }
- log.Printf("handshake complete!")
- if sshConn != nil {
- c.client = ssh.NewClient(sshConn, sshChan, req)
- }
- c.connectToAgent()
-
- return
-}
-
-func (c *comm) connectToAgent() {
- if c.client == nil {
- return
- }
-
- if c.config.DisableAgent {
- log.Printf("[INFO] SSH agent forwarding is disabled.")
- return
- }
-
- // open connection to the local agent
- socketLocation := os.Getenv("SSH_AUTH_SOCK")
- if socketLocation == "" {
- log.Printf("[INFO] no local agent socket, will not connect agent")
- return
- }
- agentConn, err := net.Dial("unix", socketLocation)
- if err != nil {
- log.Printf("[ERROR] could not connect to local agent socket: %s", socketLocation)
- return
- }
-
- // create agent and add in auth
- forwardingAgent := agent.NewClient(agentConn)
- if forwardingAgent == nil {
- log.Printf("[ERROR] Could not create agent client")
- agentConn.Close()
- return
- }
-
- // add callback for forwarding agent to SSH config
- // XXX - might want to handle reconnects appending multiple callbacks
- auth := ssh.PublicKeysCallback(forwardingAgent.Signers)
- c.config.SSHConfig.Auth = append(c.config.SSHConfig.Auth, auth)
- agent.ForwardToAgent(c.client, forwardingAgent)
-
- // Setup a session to request agent forwarding
- session, err := c.newSession()
- if err != nil {
- return
- }
- defer session.Close()
-
- err = agent.RequestAgentForwarding(session)
- if err != nil {
- log.Printf("[ERROR] RequestAgentForwarding: %#v", err)
- return
- }
-
- log.Printf("[INFO] agent forwarding enabled")
- return
-}
-
-func (c *comm) sftpUploadSession(path string, input io.Reader, fi *os.FileInfo) error {
- sftpFunc := func(client *sftp.Client) error {
- return sftpUploadFile(path, input, client, fi)
- }
-
- return c.sftpSession(sftpFunc)
-}
-
-func sftpUploadFile(path string, input io.Reader, client *sftp.Client, fi *os.FileInfo) error {
- log.Printf("[DEBUG] sftp: uploading %s", path)
-
- f, err := client.Create(path)
- if err != nil {
- return err
- }
- defer f.Close()
-
- if _, err = io.Copy(f, input); err != nil {
- return err
- }
-
- if fi != nil && (*fi).Mode().IsRegular() {
- mode := (*fi).Mode().Perm()
- err = client.Chmod(path, mode)
- if err != nil {
- return err
- }
- }
-
- return nil
-}
-
-func (c *comm) sftpUploadDirSession(dst string, src string, excl []string) error {
- sftpFunc := func(client *sftp.Client) error {
- rootDst := dst
- if src[len(src)-1] != '/' {
- log.Printf("No trailing slash, creating the source directory name")
- rootDst = filepath.Join(dst, filepath.Base(src))
- }
- walkFunc := func(path string, info os.FileInfo, err error) error {
- if err != nil {
- return err
- }
- // Calculate the final destination using the
- // base source and root destination
- relSrc, err := filepath.Rel(src, path)
- if err != nil {
- return err
- }
- finalDst := filepath.Join(rootDst, relSrc)
-
- // In Windows, Join uses backslashes which we don't want to get
- // to the sftp server
- finalDst = filepath.ToSlash(finalDst)
-
- // Skip the creation of the target destination directory since
- // it should exist and we might not even own it
- if finalDst == dst {
- return nil
- }
-
- return sftpVisitFile(finalDst, path, info, client)
- }
-
- return filepath.Walk(src, walkFunc)
- }
-
- return c.sftpSession(sftpFunc)
-}
-
-func sftpMkdir(path string, client *sftp.Client, fi os.FileInfo) error {
- log.Printf("[DEBUG] sftp: creating dir %s", path)
-
- if err := client.Mkdir(path); err != nil {
- // Do not consider it an error if the directory existed
- remoteFi, fiErr := client.Lstat(path)
- if fiErr != nil || !remoteFi.IsDir() {
- return err
- }
- }
-
- mode := fi.Mode().Perm()
- if err := client.Chmod(path, mode); err != nil {
- return err
- }
- return nil
-}
-
-func sftpVisitFile(dst string, src string, fi os.FileInfo, client *sftp.Client) error {
- if !fi.IsDir() {
- f, err := os.Open(src)
- if err != nil {
- return err
- }
- defer f.Close()
- return sftpUploadFile(dst, f, client, &fi)
- } else {
- err := sftpMkdir(dst, client, fi)
- return err
- }
-}
-
-func (c *comm) sftpDownloadSession(path string, output io.Writer) error {
- sftpFunc := func(client *sftp.Client) error {
- f, err := client.Open(path)
- if err != nil {
- return err
- }
- defer f.Close()
-
- if _, err = io.Copy(output, f); err != nil {
- return err
- }
-
- return nil
- }
-
- return c.sftpSession(sftpFunc)
-}
-
-func (c *comm) sftpSession(f func(*sftp.Client) error) error {
- client, err := c.newSftpClient()
- if err != nil {
- return err
- }
- defer client.Close()
-
- return f(client)
-}
-
-func (c *comm) newSftpClient() (*sftp.Client, error) {
- session, err := c.newSession()
- if err != nil {
- return nil, err
- }
-
- if err := session.RequestSubsystem("sftp"); err != nil {
- return nil, err
- }
-
- pw, err := session.StdinPipe()
- if err != nil {
- return nil, err
- }
- pr, err := session.StdoutPipe()
- if err != nil {
- return nil, err
- }
-
- return sftp.NewClientPipe(pr, pw)
-}
-
-func (c *comm) scpUploadSession(path string, input io.Reader, fi *os.FileInfo) error {
-
- // The target directory and file for talking the SCP protocol
- target_dir := filepath.Dir(path)
- target_file := filepath.Base(path)
-
- // On windows, filepath.Dir uses backslash seperators (ie. "\tmp").
- // This does not work when the target host is unix. Switch to forward slash
- // which works for unix and windows
- target_dir = filepath.ToSlash(target_dir)
-
- scpFunc := func(w io.Writer, stdoutR *bufio.Reader) error {
- return scpUploadFile(target_file, input, w, stdoutR, fi)
- }
-
- return c.scpSession("scp -vt "+target_dir, scpFunc)
-}
-
-func (c *comm) scpUploadDirSession(dst string, src string, excl []string) error {
- scpFunc := func(w io.Writer, r *bufio.Reader) error {
- uploadEntries := func() error {
- f, err := os.Open(src)
- if err != nil {
- return err
- }
- defer f.Close()
-
- entries, err := f.Readdir(-1)
- if err != nil {
- return err
- }
-
- return scpUploadDir(src, entries, w, r)
- }
-
- if src[len(src)-1] != '/' {
- log.Printf("No trailing slash, creating the source directory name")
- fi, err := os.Stat(src)
- if err != nil {
- return err
- }
- return scpUploadDirProtocol(filepath.Base(src), w, r, uploadEntries, fi)
- } else {
- // Trailing slash, so only upload the contents
- return uploadEntries()
- }
- }
-
- return c.scpSession("scp -rvt "+dst, scpFunc)
-}
-
-func (c *comm) scpDownloadSession(path string, output io.Writer) error {
- scpFunc := func(w io.Writer, stdoutR *bufio.Reader) error {
- fmt.Fprint(w, "\x00")
-
- // read file info
- fi, err := stdoutR.ReadString('\n')
- if err != nil {
- return err
- }
-
- if len(fi) < 0 {
- return fmt.Errorf("empty response from server")
- }
-
- switch fi[0] {
- case '\x01', '\x02':
- return fmt.Errorf("%s", fi[1:])
- case 'C':
- case 'D':
- return fmt.Errorf("remote file is directory")
- default:
- return fmt.Errorf("unexpected server response (%x)", fi[0])
- }
-
- var mode string
- var size int64
-
- n, err := fmt.Sscanf(fi, "%6s %d ", &mode, &size)
- if err != nil || n != 2 {
- return fmt.Errorf("can't parse server response (%s)", fi)
- }
- if size < 0 {
- return fmt.Errorf("negative file size")
- }
-
- fmt.Fprint(w, "\x00")
-
- if _, err := io.CopyN(output, stdoutR, size); err != nil {
- return err
- }
-
- fmt.Fprint(w, "\x00")
-
- if err := checkSCPStatus(stdoutR); err != nil {
- return err
- }
-
- return nil
- }
-
- if strings.Index(path, " ") == -1 {
- return c.scpSession("scp -vf "+path, scpFunc)
- }
- return c.scpSession("scp -vf "+strconv.Quote(path), scpFunc)
-}
-
-func (c *comm) scpSession(scpCommand string, f func(io.Writer, *bufio.Reader) error) error {
- session, err := c.newSession()
- if err != nil {
- return err
- }
- defer session.Close()
-
- // Get a pipe to stdin so that we can send data down
- stdinW, err := session.StdinPipe()
- if err != nil {
- return err
- }
-
- // We only want to close once, so we nil w after we close it,
- // and only close in the defer if it hasn't been closed already.
- defer func() {
- if stdinW != nil {
- stdinW.Close()
- }
- }()
-
- // Get a pipe to stdout so that we can get responses back
- stdoutPipe, err := session.StdoutPipe()
- if err != nil {
- return err
- }
- stdoutR := bufio.NewReader(stdoutPipe)
-
- // Set stderr to a bytes buffer
- stderr := new(bytes.Buffer)
- session.Stderr = stderr
-
- // Start the sink mode on the other side
- // TODO(mitchellh): There are probably issues with shell escaping the path
- log.Println("Starting remote scp process: ", scpCommand)
- if err := session.Start(scpCommand); err != nil {
- return err
- }
-
- // Call our callback that executes in the context of SCP. We ignore
- // EOF errors if they occur because it usually means that SCP prematurely
- // ended on the other side.
- log.Println("Started SCP session, beginning transfers...")
- if err := f(stdinW, stdoutR); err != nil && err != io.EOF {
- return err
- }
-
- // Close the stdin, which sends an EOF, and then set w to nil so that
- // our defer func doesn't close it again since that is unsafe with
- // the Go SSH package.
- log.Println("SCP session complete, closing stdin pipe.")
- stdinW.Close()
- stdinW = nil
-
- // Wait for the SCP connection to close, meaning it has consumed all
- // our data and has completed. Or has errored.
- log.Println("Waiting for SSH session to complete.")
- err = session.Wait()
- if err != nil {
- if exitErr, ok := err.(*ssh.ExitError); ok {
- // Otherwise, we have an ExitErorr, meaning we can just read
- // the exit status
- log.Printf("non-zero exit status: %d", exitErr.ExitStatus())
-
- // If we exited with status 127, it means SCP isn't available.
- // Return a more descriptive error for that.
- if exitErr.ExitStatus() == 127 {
- return errors.New(
- "SCP failed to start. This usually means that SCP is not\n" +
- "properly installed on the remote system.")
- }
- }
-
- return err
- }
-
- log.Printf("scp stderr (length %d): %s", stderr.Len(), stderr.String())
- return nil
-}
-
-// checkSCPStatus checks that a prior command sent to SCP completed
-// successfully. If it did not complete successfully, an error will
-// be returned.
-func checkSCPStatus(r *bufio.Reader) error {
- code, err := r.ReadByte()
- if err != nil {
- return err
- }
-
- if code != 0 {
- // Treat any non-zero (really 1 and 2) as fatal errors
- message, _, err := r.ReadLine()
- if err != nil {
- return fmt.Errorf("Error reading error message: %s", err)
- }
-
- return errors.New(string(message))
- }
-
- return nil
-}
-
-func scpDownloadFile(dst string, src io.Reader, size int64, mode os.FileMode) error {
- f, err := os.OpenFile(dst, os.O_WRONLY|os.O_CREATE|os.O_TRUNC, mode)
- if err != nil {
- return err
- }
- defer f.Close()
- if _, err := io.CopyN(f, src, size); err != nil {
- return err
- }
- return nil
-}
-
-func scpUploadFile(dst string, src io.Reader, w io.Writer, r *bufio.Reader, fi *os.FileInfo) error {
- var mode os.FileMode
- var size int64
-
- if fi != nil && (*fi).Mode().IsRegular() {
- mode = (*fi).Mode().Perm()
- size = (*fi).Size()
- } else {
- // Create a temporary file where we can copy the contents of the src
- // so that we can determine the length, since SCP is length-prefixed.
- tf, err := ioutil.TempFile("", "packer-upload")
- if err != nil {
- return fmt.Errorf("Error creating temporary file for upload: %s", err)
- }
- defer os.Remove(tf.Name())
- defer tf.Close()
-
- mode = 0644
-
- log.Println("Copying input data into temporary file so we can read the length")
- if _, err := io.Copy(tf, src); err != nil {
- return err
- }
-
- // Sync the file so that the contents are definitely on disk, then
- // read the length of it.
- if err := tf.Sync(); err != nil {
- return fmt.Errorf("Error creating temporary file for upload: %s", err)
- }
-
- // Seek the file to the beginning so we can re-read all of it
- if _, err := tf.Seek(0, 0); err != nil {
- return fmt.Errorf("Error creating temporary file for upload: %s", err)
- }
-
- tfi, err := tf.Stat()
- if err != nil {
- return fmt.Errorf("Error creating temporary file for upload: %s", err)
- }
-
- size = tfi.Size()
- src = tf
- }
-
- // Start the protocol
- perms := fmt.Sprintf("C%04o", mode)
- log.Printf("[DEBUG] scp: Uploading %s: perms=%s size=%d", dst, perms, size)
-
- fmt.Fprintln(w, perms, size, dst)
- if err := checkSCPStatus(r); err != nil {
- return err
- }
-
- if _, err := io.CopyN(w, src, size); err != nil {
- return err
- }
-
- fmt.Fprint(w, "\x00")
- if err := checkSCPStatus(r); err != nil {
- return err
- }
-
- return nil
-}
-
-func scpUploadDirProtocol(name string, w io.Writer, r *bufio.Reader, f func() error, fi os.FileInfo) error {
- log.Printf("SCP: starting directory upload: %s", name)
-
- mode := fi.Mode().Perm()
-
- perms := fmt.Sprintf("D%04o 0", mode)
-
- fmt.Fprintln(w, perms, name)
- err := checkSCPStatus(r)
- if err != nil {
- return err
- }
-
- if err := f(); err != nil {
- return err
- }
-
- fmt.Fprintln(w, "E")
- if err != nil {
- return err
- }
-
- return nil
-}
-
-func scpUploadDir(root string, fs []os.FileInfo, w io.Writer, r *bufio.Reader) error {
- for _, fi := range fs {
- realPath := filepath.Join(root, fi.Name())
-
- // Track if this is actually a symlink to a directory. If it is
- // a symlink to a file we don't do any special behavior because uploading
- // a file just works. If it is a directory, we need to know so we
- // treat it as such.
- isSymlinkToDir := false
- if fi.Mode()&os.ModeSymlink == os.ModeSymlink {
- symPath, err := filepath.EvalSymlinks(realPath)
- if err != nil {
- return err
- }
-
- symFi, err := os.Lstat(symPath)
- if err != nil {
- return err
- }
-
- isSymlinkToDir = symFi.IsDir()
- }
-
- if !fi.IsDir() && !isSymlinkToDir {
- // It is a regular file (or symlink to a file), just upload it
- f, err := os.Open(realPath)
- if err != nil {
- return err
- }
-
- err = func() error {
- defer f.Close()
- return scpUploadFile(fi.Name(), f, w, r, &fi)
- }()
-
- if err != nil {
- return err
- }
-
- continue
- }
-
- // It is a directory, recursively upload
- err := scpUploadDirProtocol(fi.Name(), w, r, func() error {
- f, err := os.Open(realPath)
- if err != nil {
- return err
- }
- defer f.Close()
-
- entries, err := f.Readdir(-1)
- if err != nil {
- return err
- }
-
- return scpUploadDir(realPath, entries, w, r)
- }, fi)
- if err != nil {
- return err
- }
- }
-
- return nil
-}
diff --git a/vendor/github.com/mitchellh/packer/communicator/ssh/connect.go b/vendor/github.com/mitchellh/packer/communicator/ssh/connect.go
deleted file mode 100644
index 43277595..00000000
--- a/vendor/github.com/mitchellh/packer/communicator/ssh/connect.go
+++ /dev/null
@@ -1,68 +0,0 @@
-package ssh
-
-import (
- "fmt"
- "net"
- "time"
-
- "golang.org/x/crypto/ssh"
-)
-
-// ConnectFunc is a convenience method for returning a function
-// that just uses net.Dial to communicate with the remote end that
-// is suitable for use with the SSH communicator configuration.
-func ConnectFunc(network, addr string) func() (net.Conn, error) {
- return func() (net.Conn, error) {
- c, err := net.DialTimeout(network, addr, 15*time.Second)
- if err != nil {
- return nil, err
- }
-
- if tcpConn, ok := c.(*net.TCPConn); ok {
- tcpConn.SetKeepAlive(true)
- tcpConn.SetKeepAlivePeriod(5 * time.Second)
- }
-
- return c, nil
- }
-}
-
-// BastionConnectFunc is a convenience method for returning a function
-// that connects to a host over a bastion connection.
-func BastionConnectFunc(
- bProto string,
- bAddr string,
- bConf *ssh.ClientConfig,
- proto string,
- addr string) func() (net.Conn, error) {
- return func() (net.Conn, error) {
- // Connect to the bastion
- bastion, err := ssh.Dial(bProto, bAddr, bConf)
- if err != nil {
- return nil, fmt.Errorf("Error connecting to bastion: %s", err)
- }
-
- // Connect through to the end host
- conn, err := bastion.Dial(proto, addr)
- if err != nil {
- bastion.Close()
- return nil, err
- }
-
- // Wrap it up so we close both things properly
- return &bastionConn{
- Conn: conn,
- Bastion: bastion,
- }, nil
- }
-}
-
-type bastionConn struct {
- net.Conn
- Bastion *ssh.Client
-}
-
-func (c *bastionConn) Close() error {
- c.Conn.Close()
- return c.Bastion.Close()
-}
diff --git a/vendor/github.com/mitchellh/packer/communicator/ssh/password.go b/vendor/github.com/mitchellh/packer/communicator/ssh/password.go
deleted file mode 100644
index 8db6f82d..00000000
--- a/vendor/github.com/mitchellh/packer/communicator/ssh/password.go
+++ /dev/null
@@ -1,27 +0,0 @@
-package ssh
-
-import (
- "golang.org/x/crypto/ssh"
- "log"
-)
-
-// An implementation of ssh.KeyboardInteractiveChallenge that simply sends
-// back the password for all questions. The questions are logged.
-func PasswordKeyboardInteractive(password string) ssh.KeyboardInteractiveChallenge {
- return func(user, instruction string, questions []string, echos []bool) ([]string, error) {
- log.Printf("Keyboard interactive challenge: ")
- log.Printf("-- User: %s", user)
- log.Printf("-- Instructions: %s", instruction)
- for i, question := range questions {
- log.Printf("-- Question %d: %s", i+1, question)
- }
-
- // Just send the password back for all questions
- answers := make([]string, len(questions))
- for i := range answers {
- answers[i] = string(password)
- }
-
- return answers, nil
- }
-}
diff --git a/vendor/github.com/mitchellh/packer/communicator/winrm/communicator.go b/vendor/github.com/mitchellh/packer/communicator/winrm/communicator.go
deleted file mode 100644
index 902211bd..00000000
--- a/vendor/github.com/mitchellh/packer/communicator/winrm/communicator.go
+++ /dev/null
@@ -1,165 +0,0 @@
-package winrm
-
-import (
- "fmt"
- "io"
- "log"
- "os"
- "sync"
-
- "github.com/masterzen/winrm/winrm"
- "github.com/mitchellh/packer/packer"
- "github.com/packer-community/winrmcp/winrmcp"
-
- // This import is a bit strange, but it's needed so `make updatedeps`
- // can see and download it
- _ "github.com/dylanmei/winrmtest"
-)
-
-// Communicator represents the WinRM communicator
-type Communicator struct {
- config *Config
- client *winrm.Client
- endpoint *winrm.Endpoint
-}
-
-// New creates a new communicator implementation over WinRM.
-func New(config *Config) (*Communicator, error) {
- endpoint := &winrm.Endpoint{
- Host: config.Host,
- Port: config.Port,
- HTTPS: config.Https,
- Insecure: config.Insecure,
-
- /*
- TODO
- HTTPS: connInfo.HTTPS,
- Insecure: connInfo.Insecure,
- CACert: connInfo.CACert,
- */
- }
-
- // Create the client
- params := winrm.DefaultParameters()
-
- if config.TransportDecorator != nil {
- params.TransportDecorator = config.TransportDecorator
- }
-
- params.Timeout = formatDuration(config.Timeout)
- client, err := winrm.NewClientWithParameters(
- endpoint, config.Username, config.Password, params)
- if err != nil {
- return nil, err
- }
-
- // Create the shell to verify the connection
- log.Printf("[DEBUG] connecting to remote shell using WinRM")
- shell, err := client.CreateShell()
- if err != nil {
- log.Printf("[ERROR] connection error: %s", err)
- return nil, err
- }
-
- if err := shell.Close(); err != nil {
- log.Printf("[ERROR] error closing connection: %s", err)
- return nil, err
- }
-
- return &Communicator{
- config: config,
- client: client,
- endpoint: endpoint,
- }, nil
-}
-
-// Start implementation of communicator.Communicator interface
-func (c *Communicator) Start(rc *packer.RemoteCmd) error {
- shell, err := c.client.CreateShell()
- if err != nil {
- return err
- }
-
- log.Printf("[INFO] starting remote command: %s", rc.Command)
- cmd, err := shell.Execute(rc.Command)
- if err != nil {
- return err
- }
-
- go runCommand(shell, cmd, rc)
- return nil
-}
-
-func runCommand(shell *winrm.Shell, cmd *winrm.Command, rc *packer.RemoteCmd) {
- defer shell.Close()
- var wg sync.WaitGroup
-
- copyFunc := func(w io.Writer, r io.Reader) {
- defer wg.Done()
- io.Copy(w, r)
- }
-
- if rc.Stdout != nil && cmd.Stdout != nil {
- wg.Add(1)
- go copyFunc(rc.Stdout, cmd.Stdout)
- } else {
- log.Printf("[WARN] Failed to read stdout for command '%s'", rc.Command)
- }
-
- if rc.Stderr != nil && cmd.Stderr != nil {
- wg.Add(1)
- go copyFunc(rc.Stderr, cmd.Stderr)
- } else {
- log.Printf("[WARN] Failed to read stderr for command '%s'", rc.Command)
- }
-
- cmd.Wait()
- wg.Wait()
-
- code := cmd.ExitCode()
- log.Printf("[INFO] command '%s' exited with code: %d", rc.Command, code)
- rc.SetExited(code)
-}
-
-// Upload implementation of communicator.Communicator interface
-func (c *Communicator) Upload(path string, input io.Reader, _ *os.FileInfo) error {
- wcp, err := c.newCopyClient()
- if err != nil {
- return err
- }
- log.Printf("Uploading file to '%s'", path)
- return wcp.Write(path, input)
-}
-
-// UploadDir implementation of communicator.Communicator interface
-func (c *Communicator) UploadDir(dst string, src string, exclude []string) error {
- log.Printf("Uploading dir '%s' to '%s'", src, dst)
- wcp, err := c.newCopyClient()
- if err != nil {
- return err
- }
- return wcp.Copy(src, dst)
-}
-
-func (c *Communicator) Download(src string, dst io.Writer) error {
- return fmt.Errorf("WinRM doesn't support download.")
-}
-
-func (c *Communicator) DownloadDir(src string, dst string, exclude []string) error {
- return fmt.Errorf("WinRM doesn't support download dir.")
-}
-
-func (c *Communicator) newCopyClient() (*winrmcp.Winrmcp, error) {
- addr := fmt.Sprintf("%s:%d", c.endpoint.Host, c.endpoint.Port)
- return winrmcp.New(addr, &winrmcp.Config{
- Auth: winrmcp.Auth{
- User: c.config.Username,
- Password: c.config.Password,
- },
- Https: c.config.Https,
- Insecure: c.config.Insecure,
- OperationTimeout: c.config.Timeout,
- MaxOperationsPerShell: 15, // lowest common denominator
- TransportDecorator: c.config.TransportDecorator,
- })
-}
diff --git a/vendor/github.com/mitchellh/packer/communicator/winrm/config.go b/vendor/github.com/mitchellh/packer/communicator/winrm/config.go
deleted file mode 100644
index f9c98902..00000000
--- a/vendor/github.com/mitchellh/packer/communicator/winrm/config.go
+++ /dev/null
@@ -1,18 +0,0 @@
-package winrm
-
-import (
- "net/http"
- "time"
-)
-
-// Config is used to configure the WinRM connection
-type Config struct {
- Host string
- Port int
- Username string
- Password string
- Timeout time.Duration
- Https bool
- Insecure bool
- TransportDecorator func(*http.Transport) http.RoundTripper
-}
diff --git a/vendor/github.com/mitchellh/packer/communicator/winrm/time.go b/vendor/github.com/mitchellh/packer/communicator/winrm/time.go
deleted file mode 100644
index f8fb6fe8..00000000
--- a/vendor/github.com/mitchellh/packer/communicator/winrm/time.go
+++ /dev/null
@@ -1,32 +0,0 @@
-package winrm
-
-import (
- "fmt"
- "time"
-)
-
-// formatDuration formats the given time.Duration into an ISO8601
-// duration string.
-func formatDuration(duration time.Duration) string {
- // We're not supporting negative durations
- if duration.Seconds() <= 0 {
- return "PT0S"
- }
-
- h := int(duration.Hours())
- m := int(duration.Minutes()) - (h * 60)
- s := int(duration.Seconds()) - (h*3600 + m*60)
-
- res := "PT"
- if h > 0 {
- res = fmt.Sprintf("%s%dH", res, h)
- }
- if m > 0 {
- res = fmt.Sprintf("%s%dM", res, m)
- }
- if s > 0 {
- res = fmt.Sprintf("%s%dS", res, s)
- }
-
- return res
-}
diff --git a/vendor/github.com/mitchellh/packer/helper/communicator/config.go b/vendor/github.com/mitchellh/packer/helper/communicator/config.go
deleted file mode 100644
index 7c36e70d..00000000
--- a/vendor/github.com/mitchellh/packer/helper/communicator/config.go
+++ /dev/null
@@ -1,194 +0,0 @@
-package communicator
-
-import (
- "errors"
- "fmt"
- "net/http"
- "os"
- "time"
-
- "github.com/mitchellh/packer/template/interpolate"
-)
-
-// Config is the common configuration that communicators allow within
-// a builder.
-type Config struct {
- Type string `mapstructure:"communicator"`
-
- // SSH
- SSHHost string `mapstructure:"ssh_host"`
- SSHPort int `mapstructure:"ssh_port"`
- SSHUsername string `mapstructure:"ssh_username"`
- SSHPassword string `mapstructure:"ssh_password"`
- SSHPrivateKey string `mapstructure:"ssh_private_key_file"`
- SSHPty bool `mapstructure:"ssh_pty"`
- SSHTimeout time.Duration `mapstructure:"ssh_timeout"`
- SSHDisableAgent bool `mapstructure:"ssh_disable_agent"`
- SSHHandshakeAttempts int `mapstructure:"ssh_handshake_attempts"`
- SSHBastionHost string `mapstructure:"ssh_bastion_host"`
- SSHBastionPort int `mapstructure:"ssh_bastion_port"`
- SSHBastionUsername string `mapstructure:"ssh_bastion_username"`
- SSHBastionPassword string `mapstructure:"ssh_bastion_password"`
- SSHBastionPrivateKey string `mapstructure:"ssh_bastion_private_key_file"`
- SSHFileTransferMethod string `mapstructure:"ssh_file_transfer_method"`
-
- // WinRM
- WinRMUser string `mapstructure:"winrm_username"`
- WinRMPassword string `mapstructure:"winrm_password"`
- WinRMHost string `mapstructure:"winrm_host"`
- WinRMPort int `mapstructure:"winrm_port"`
- WinRMTimeout time.Duration `mapstructure:"winrm_timeout"`
- WinRMUseSSL bool `mapstructure:"winrm_use_ssl"`
- WinRMInsecure bool `mapstructure:"winrm_insecure"`
- WinRMTransportDecorator func(*http.Transport) http.RoundTripper
-}
-
-// Port returns the port that will be used for access based on config.
-func (c *Config) Port() int {
- switch c.Type {
- case "ssh":
- return c.SSHPort
- case "winrm":
- return c.WinRMPort
- default:
- return 0
- }
-}
-
-// Host returns the port that will be used for access based on config.
-func (c *Config) Host() string {
- switch c.Type {
- case "ssh":
- return c.SSHHost
- case "winrm":
- return c.WinRMHost
- default:
- return ""
- }
-}
-
-// User returns the port that will be used for access based on config.
-func (c *Config) User() string {
- switch c.Type {
- case "ssh":
- return c.SSHUsername
- case "winrm":
- return c.WinRMUser
- default:
- return ""
- }
-}
-
-// Password returns the port that will be used for access based on config.
-func (c *Config) Password() string {
- switch c.Type {
- case "ssh":
- return c.SSHPassword
- case "winrm":
- return c.WinRMPassword
- default:
- return ""
- }
-}
-
-func (c *Config) Prepare(ctx *interpolate.Context) []error {
- if c.Type == "" {
- c.Type = "ssh"
- }
-
- var errs []error
- switch c.Type {
- case "ssh":
- if es := c.prepareSSH(ctx); len(es) > 0 {
- errs = append(errs, es...)
- }
- case "winrm":
- if es := c.prepareWinRM(ctx); len(es) > 0 {
- errs = append(errs, es...)
- }
- case "docker", "none":
- break
- default:
- return []error{fmt.Errorf("Communicator type %s is invalid", c.Type)}
- }
-
- return errs
-}
-
-func (c *Config) prepareSSH(ctx *interpolate.Context) []error {
- if c.SSHPort == 0 {
- c.SSHPort = 22
- }
-
- if c.SSHTimeout == 0 {
- c.SSHTimeout = 5 * time.Minute
- }
-
- if c.SSHHandshakeAttempts == 0 {
- c.SSHHandshakeAttempts = 10
- }
-
- if c.SSHBastionHost != "" {
- if c.SSHBastionPort == 0 {
- c.SSHBastionPort = 22
- }
-
- if c.SSHBastionPrivateKey == "" && c.SSHPrivateKey != "" {
- c.SSHBastionPrivateKey = c.SSHPrivateKey
- }
- }
-
- if c.SSHFileTransferMethod == "" {
- c.SSHFileTransferMethod = "scp"
- }
-
- // Validation
- var errs []error
- if c.SSHUsername == "" {
- errs = append(errs, errors.New("An ssh_username must be specified"))
- }
-
- if c.SSHPrivateKey != "" {
- if _, err := os.Stat(c.SSHPrivateKey); err != nil {
- errs = append(errs, fmt.Errorf(
- "ssh_private_key_file is invalid: %s", err))
- } else if _, err := SSHFileSigner(c.SSHPrivateKey); err != nil {
- errs = append(errs, fmt.Errorf(
- "ssh_private_key_file is invalid: %s", err))
- }
- }
-
- if c.SSHBastionHost != "" {
- if c.SSHBastionPassword == "" && c.SSHBastionPrivateKey == "" {
- errs = append(errs, errors.New(
- "ssh_bastion_password or ssh_bastion_private_key_file must be specified"))
- }
- }
-
- if c.SSHFileTransferMethod != "scp" && c.SSHFileTransferMethod != "sftp" {
- errs = append(errs, fmt.Errorf(
- "ssh_file_transfer_method ('%s') is invalid, valid methods: sftp, scp",
- c.SSHFileTransferMethod))
- }
-
- return errs
-}
-
-func (c *Config) prepareWinRM(ctx *interpolate.Context) []error {
- if c.WinRMPort == 0 && c.WinRMUseSSL {
- c.WinRMPort = 5986
- } else if c.WinRMPort == 0 {
- c.WinRMPort = 5985
- }
-
- if c.WinRMTimeout == 0 {
- c.WinRMTimeout = 30 * time.Minute
- }
-
- var errs []error
- if c.WinRMUser == "" {
- errs = append(errs, errors.New("winrm_username must be specified."))
- }
-
- return errs
-}
diff --git a/vendor/github.com/mitchellh/packer/helper/communicator/ssh.go b/vendor/github.com/mitchellh/packer/helper/communicator/ssh.go
deleted file mode 100644
index 831d620b..00000000
--- a/vendor/github.com/mitchellh/packer/helper/communicator/ssh.go
+++ /dev/null
@@ -1,44 +0,0 @@
-package communicator
-
-import (
- "encoding/pem"
- "fmt"
- "io/ioutil"
- "os"
-
- "golang.org/x/crypto/ssh"
-)
-
-// SSHFileSigner returns an ssh.Signer for a key file.
-func SSHFileSigner(path string) (ssh.Signer, error) {
- f, err := os.Open(path)
- if err != nil {
- return nil, err
- }
- defer f.Close()
-
- keyBytes, err := ioutil.ReadAll(f)
- if err != nil {
- return nil, err
- }
-
- // We parse the private key on our own first so that we can
- // show a nicer error if the private key has a password.
- block, _ := pem.Decode(keyBytes)
- if block == nil {
- return nil, fmt.Errorf(
- "Failed to read key '%s': no key found", path)
- }
- if block.Headers["Proc-Type"] == "4,ENCRYPTED" {
- return nil, fmt.Errorf(
- "Failed to read key '%s': password protected keys are\n"+
- "not supported. Please decrypt the key prior to use.", path)
- }
-
- signer, err := ssh.ParsePrivateKey(keyBytes)
- if err != nil {
- return nil, fmt.Errorf("Error setting up SSH config: %s", err)
- }
-
- return signer, nil
-}
diff --git a/vendor/github.com/mitchellh/packer/helper/communicator/step_connect.go b/vendor/github.com/mitchellh/packer/helper/communicator/step_connect.go
deleted file mode 100644
index f4d1499b..00000000
--- a/vendor/github.com/mitchellh/packer/helper/communicator/step_connect.go
+++ /dev/null
@@ -1,93 +0,0 @@
-package communicator
-
-import (
- "fmt"
- "log"
-
- "github.com/mitchellh/multistep"
- "github.com/mitchellh/packer/communicator/none"
- "github.com/mitchellh/packer/packer"
- gossh "golang.org/x/crypto/ssh"
-)
-
-// StepConnect is a multistep Step implementation that connects to
-// the proper communicator and stores it in the "communicator" key in the
-// state bag.
-type StepConnect struct {
- // Config is the communicator config struct
- Config *Config
-
- // Host should return a host that can be connected to for communicator
- // connections.
- Host func(multistep.StateBag) (string, error)
-
- // The fields below are callbacks to assist with connecting to SSH.
- //
- // SSHConfig should return the default configuration for
- // connecting via SSH.
- SSHConfig func(multistep.StateBag) (*gossh.ClientConfig, error)
- SSHPort func(multistep.StateBag) (int, error)
-
- // The fields below are callbacks to assist with connecting to WinRM.
- //
- // WinRMConfig should return the default configuration for
- // connecting via WinRM.
- WinRMConfig func(multistep.StateBag) (*WinRMConfig, error)
-
- // CustomConnect can be set to have custom connectors for specific
- // types. These take highest precedence so you can also override
- // existing types.
- CustomConnect map[string]multistep.Step
-
- substep multistep.Step
-}
-
-func (s *StepConnect) Run(state multistep.StateBag) multistep.StepAction {
- typeMap := map[string]multistep.Step{
- "none": nil,
- "ssh": &StepConnectSSH{
- Config: s.Config,
- Host: s.Host,
- SSHConfig: s.SSHConfig,
- SSHPort: s.SSHPort,
- },
- "winrm": &StepConnectWinRM{
- Config: s.Config,
- Host: s.Host,
- WinRMConfig: s.WinRMConfig,
- WinRMPort: s.SSHPort,
- },
- }
- for k, v := range s.CustomConnect {
- typeMap[k] = v
- }
-
- step, ok := typeMap[s.Config.Type]
- if !ok {
- state.Put("error", fmt.Errorf("unknown communicator type: %s", s.Config.Type))
- return multistep.ActionHalt
- }
-
- if step == nil {
- comm, err := none.New("none")
- if err != nil {
- err := fmt.Errorf("Failed to set communicator 'none': %s", err)
- state.Put("error", err)
- ui := state.Get("ui").(packer.Ui)
- ui.Error(err.Error())
- return multistep.ActionHalt
- }
- state.Put("communicator", comm)
- log.Printf("[INFO] communicator disabled, will not connect")
- return multistep.ActionContinue
- }
-
- s.substep = step
- return s.substep.Run(state)
-}
-
-func (s *StepConnect) Cleanup(state multistep.StateBag) {
- if s.substep != nil {
- s.substep.Cleanup(state)
- }
-}
diff --git a/vendor/github.com/mitchellh/packer/helper/communicator/step_connect_ssh.go b/vendor/github.com/mitchellh/packer/helper/communicator/step_connect_ssh.go
deleted file mode 100644
index 71a6d1a3..00000000
--- a/vendor/github.com/mitchellh/packer/helper/communicator/step_connect_ssh.go
+++ /dev/null
@@ -1,220 +0,0 @@
-package communicator
-
-import (
- "errors"
- "fmt"
- "log"
- "net"
- "strings"
- "time"
-
- "github.com/mitchellh/multistep"
- commonssh "github.com/mitchellh/packer/common/ssh"
- "github.com/mitchellh/packer/communicator/ssh"
- "github.com/mitchellh/packer/packer"
- gossh "golang.org/x/crypto/ssh"
-)
-
-// StepConnectSSH is a step that only connects to SSH.
-//
-// In general, you should use StepConnect.
-type StepConnectSSH struct {
- // All the fields below are documented on StepConnect
- Config *Config
- Host func(multistep.StateBag) (string, error)
- SSHConfig func(multistep.StateBag) (*gossh.ClientConfig, error)
- SSHPort func(multistep.StateBag) (int, error)
-}
-
-func (s *StepConnectSSH) Run(state multistep.StateBag) multistep.StepAction {
- ui := state.Get("ui").(packer.Ui)
-
- var comm packer.Communicator
- var err error
-
- cancel := make(chan struct{})
- waitDone := make(chan bool, 1)
- go func() {
- ui.Say("Waiting for SSH to become available...")
- comm, err = s.waitForSSH(state, cancel)
- waitDone <- true
- }()
-
- log.Printf("[INFO] Waiting for SSH, up to timeout: %s", s.Config.SSHTimeout)
- timeout := time.After(s.Config.SSHTimeout)
-WaitLoop:
- for {
- // Wait for either SSH to become available, a timeout to occur,
- // or an interrupt to come through.
- select {
- case <-waitDone:
- if err != nil {
- ui.Error(fmt.Sprintf("Error waiting for SSH: %s", err))
- state.Put("error", err)
- return multistep.ActionHalt
- }
-
- ui.Say("Connected to SSH!")
- state.Put("communicator", comm)
- break WaitLoop
- case <-timeout:
- err := fmt.Errorf("Timeout waiting for SSH.")
- state.Put("error", err)
- ui.Error(err.Error())
- close(cancel)
- return multistep.ActionHalt
- case <-time.After(1 * time.Second):
- if _, ok := state.GetOk(multistep.StateCancelled); ok {
- // The step sequence was cancelled, so cancel waiting for SSH
- // and just start the halting process.
- close(cancel)
- log.Println("[WARN] Interrupt detected, quitting waiting for SSH.")
- return multistep.ActionHalt
- }
- }
- }
-
- return multistep.ActionContinue
-}
-
-func (s *StepConnectSSH) Cleanup(multistep.StateBag) {
-}
-
-func (s *StepConnectSSH) waitForSSH(state multistep.StateBag, cancel <-chan struct{}) (packer.Communicator, error) {
- // Determine if we're using a bastion host, and if so, retrieve
- // that configuration. This configuration doesn't change so we
- // do this one before entering the retry loop.
- var bProto, bAddr string
- var bConf *gossh.ClientConfig
- if s.Config.SSHBastionHost != "" {
- // The protocol is hardcoded for now, but may be configurable one day
- bProto = "tcp"
- bAddr = fmt.Sprintf(
- "%s:%d", s.Config.SSHBastionHost, s.Config.SSHBastionPort)
-
- conf, err := sshBastionConfig(s.Config)
- if err != nil {
- return nil, fmt.Errorf("Error configuring bastion: %s", err)
- }
- bConf = conf
- }
-
- handshakeAttempts := 0
-
- var comm packer.Communicator
- first := true
- for {
- // Don't check for cancel or wait on first iteration
- if !first {
- select {
- case <-cancel:
- log.Println("[DEBUG] SSH wait cancelled. Exiting loop.")
- return nil, errors.New("SSH wait cancelled")
- case <-time.After(5 * time.Second):
- }
- }
- first = false
-
- // First we request the TCP connection information
- host, err := s.Host(state)
- if err != nil {
- log.Printf("[DEBUG] Error getting SSH address: %s", err)
- continue
- }
- port := s.Config.SSHPort
- if s.SSHPort != nil {
- port, err = s.SSHPort(state)
- if err != nil {
- log.Printf("[DEBUG] Error getting SSH port: %s", err)
- continue
- }
- }
-
- // Retrieve the SSH configuration
- sshConfig, err := s.SSHConfig(state)
- if err != nil {
- log.Printf("[DEBUG] Error getting SSH config: %s", err)
- continue
- }
-
- // Attempt to connect to SSH port
- var connFunc func() (net.Conn, error)
- address := fmt.Sprintf("%s:%d", host, port)
- if bAddr != "" {
- // We're using a bastion host, so use the bastion connfunc
- connFunc = ssh.BastionConnectFunc(
- bProto, bAddr, bConf, "tcp", address)
- } else {
- // No bastion host, connect directly
- connFunc = ssh.ConnectFunc("tcp", address)
- }
-
- nc, err := connFunc()
- if err != nil {
- log.Printf("[DEBUG] TCP connection to SSH ip/port failed: %s", err)
- continue
- }
- nc.Close()
-
- // Then we attempt to connect via SSH
- config := &ssh.Config{
- Connection: connFunc,
- SSHConfig: sshConfig,
- Pty: s.Config.SSHPty,
- DisableAgent: s.Config.SSHDisableAgent,
- UseSftp: s.Config.SSHFileTransferMethod == "sftp",
- }
-
- log.Println("[INFO] Attempting SSH connection...")
- comm, err = ssh.New(address, config)
- if err != nil {
- log.Printf("[DEBUG] SSH handshake err: %s", err)
-
- // Only count this as an attempt if we were able to attempt
- // to authenticate. Note this is very brittle since it depends
- // on the string of the error... but I don't see any other way.
- if strings.Contains(err.Error(), "authenticate") {
- log.Printf(
- "[DEBUG] Detected authentication error. Increasing handshake attempts.")
- handshakeAttempts += 1
- }
-
- if handshakeAttempts < s.Config.SSHHandshakeAttempts {
- // Try to connect via SSH a handful of times. We sleep here
- // so we don't get a ton of authentication errors back to back.
- time.Sleep(2 * time.Second)
- continue
- }
-
- return nil, err
- }
-
- break
- }
-
- return comm, nil
-}
-
-func sshBastionConfig(config *Config) (*gossh.ClientConfig, error) {
- auth := make([]gossh.AuthMethod, 0, 2)
- if config.SSHBastionPassword != "" {
- auth = append(auth,
- gossh.Password(config.SSHBastionPassword),
- gossh.KeyboardInteractive(
- ssh.PasswordKeyboardInteractive(config.SSHBastionPassword)))
- }
-
- if config.SSHBastionPrivateKey != "" {
- signer, err := commonssh.FileSigner(config.SSHBastionPrivateKey)
- if err != nil {
- return nil, err
- }
-
- auth = append(auth, gossh.PublicKeys(signer))
- }
-
- return &gossh.ClientConfig{
- User: config.SSHBastionUsername,
- Auth: auth,
- }, nil
-}
diff --git a/vendor/github.com/mitchellh/packer/helper/communicator/step_connect_winrm.go b/vendor/github.com/mitchellh/packer/helper/communicator/step_connect_winrm.go
deleted file mode 100644
index 49936ad7..00000000
--- a/vendor/github.com/mitchellh/packer/helper/communicator/step_connect_winrm.go
+++ /dev/null
@@ -1,145 +0,0 @@
-package communicator
-
-import (
- "errors"
- "fmt"
- "log"
- "time"
-
- "github.com/mitchellh/multistep"
- "github.com/mitchellh/packer/communicator/winrm"
- "github.com/mitchellh/packer/packer"
-)
-
-// StepConnectWinRM is a multistep Step implementation that waits for WinRM
-// to become available. It gets the connection information from a single
-// configuration when creating the step.
-//
-// Uses:
-// ui packer.Ui
-//
-// Produces:
-// communicator packer.Communicator
-type StepConnectWinRM struct {
- // All the fields below are documented on StepConnect
- Config *Config
- Host func(multistep.StateBag) (string, error)
- WinRMConfig func(multistep.StateBag) (*WinRMConfig, error)
- WinRMPort func(multistep.StateBag) (int, error)
-}
-
-func (s *StepConnectWinRM) Run(state multistep.StateBag) multistep.StepAction {
- ui := state.Get("ui").(packer.Ui)
-
- var comm packer.Communicator
- var err error
-
- cancel := make(chan struct{})
- waitDone := make(chan bool, 1)
- go func() {
- ui.Say("Waiting for WinRM to become available...")
- comm, err = s.waitForWinRM(state, cancel)
- waitDone <- true
- }()
-
- log.Printf("Waiting for WinRM, up to timeout: %s", s.Config.WinRMTimeout)
- timeout := time.After(s.Config.WinRMTimeout)
-WaitLoop:
- for {
- // Wait for either WinRM to become available, a timeout to occur,
- // or an interrupt to come through.
- select {
- case <-waitDone:
- if err != nil {
- ui.Error(fmt.Sprintf("Error waiting for WinRM: %s", err))
- return multistep.ActionHalt
- }
-
- ui.Say("Connected to WinRM!")
- state.Put("communicator", comm)
- break WaitLoop
- case <-timeout:
- err := fmt.Errorf("Timeout waiting for WinRM.")
- state.Put("error", err)
- ui.Error(err.Error())
- close(cancel)
- return multistep.ActionHalt
- case <-time.After(1 * time.Second):
- if _, ok := state.GetOk(multistep.StateCancelled); ok {
- // The step sequence was cancelled, so cancel waiting for WinRM
- // and just start the halting process.
- close(cancel)
- log.Println("Interrupt detected, quitting waiting for WinRM.")
- return multistep.ActionHalt
- }
- }
- }
-
- return multistep.ActionContinue
-}
-
-func (s *StepConnectWinRM) Cleanup(multistep.StateBag) {
-}
-
-func (s *StepConnectWinRM) waitForWinRM(state multistep.StateBag, cancel <-chan struct{}) (packer.Communicator, error) {
- var comm packer.Communicator
- for {
- select {
- case <-cancel:
- log.Println("[INFO] WinRM wait cancelled. Exiting loop.")
- return nil, errors.New("WinRM wait cancelled")
- case <-time.After(5 * time.Second):
- }
-
- host, err := s.Host(state)
- if err != nil {
- log.Printf("[DEBUG] Error getting WinRM host: %s", err)
- continue
- }
- port := s.Config.WinRMPort
- if s.WinRMPort != nil {
- port, err = s.WinRMPort(state)
- if err != nil {
- log.Printf("[DEBUG] Error getting WinRM port: %s", err)
- continue
- }
- }
-
- user := s.Config.WinRMUser
- password := s.Config.WinRMPassword
- if s.WinRMConfig != nil {
- config, err := s.WinRMConfig(state)
- if err != nil {
- log.Printf("[DEBUG] Error getting WinRM config: %s", err)
- continue
- }
-
- if config.Username != "" {
- user = config.Username
- }
- if config.Password != "" {
- password = config.Password
- }
- }
-
- log.Println("[INFO] Attempting WinRM connection...")
- comm, err = winrm.New(&winrm.Config{
- Host: host,
- Port: port,
- Username: user,
- Password: password,
- Timeout: s.Config.WinRMTimeout,
- Https: s.Config.WinRMUseSSL,
- Insecure: s.Config.WinRMInsecure,
- TransportDecorator: s.Config.WinRMTransportDecorator,
- })
- if err != nil {
- log.Printf("[ERROR] WinRM connection err: %s", err)
- continue
- }
-
- break
- }
-
- return comm, nil
-}
diff --git a/vendor/github.com/mitchellh/packer/helper/communicator/testing.go b/vendor/github.com/mitchellh/packer/helper/communicator/testing.go
deleted file mode 100644
index 1c89f15e..00000000
--- a/vendor/github.com/mitchellh/packer/helper/communicator/testing.go
+++ /dev/null
@@ -1,47 +0,0 @@
-package communicator
-
-import (
- "io/ioutil"
- "testing"
-)
-
-func TestPEM(t *testing.T) string {
- tf, err := ioutil.TempFile("", "packer")
- if err != nil {
- t.Fatalf("err: %s", err)
- }
- tf.Write([]byte(TestPEMContents))
- tf.Close()
-
- return tf.Name()
-}
-
-const TestPEMContents = `
------BEGIN RSA PRIVATE KEY-----
-MIIEpQIBAAKCAQEAxd4iamvrwRJvtNDGQSIbNvvIQN8imXTRWlRY62EvKov60vqu
-hh+rDzFYAIIzlmrJopvOe0clqmi3mIP9dtkjPFrYflq52a2CF5q+BdwsJXuRHbJW
-LmStZUwW1khSz93DhvhmK50nIaczW63u4EO/jJb3xj+wxR1Nkk9bxi3DDsYFt8SN
-AzYx9kjlEYQ/+sI4/ATfmdV9h78SVotjScupd9KFzzi76gWq9gwyCBLRynTUWlyD
-2UOfJRkOvhN6/jKzvYfVVwjPSfA9IMuooHdScmC4F6KBKJl/zf/zETM0XyzIDNmH
-uOPbCiljq2WoRM+rY6ET84EO0kVXbfx8uxUsqQIDAQABAoIBAQCkPj9TF0IagbM3
-5BSs/CKbAWS4dH/D4bPlxx4IRCNirc8GUg+MRb04Xz0tLuajdQDqeWpr6iLZ0RKV
-BvreLF+TOdV7DNQ4XE4gSdJyCtCaTHeort/aordL3l0WgfI7mVk0L/yfN1PEG4YG
-E9q1TYcyrB3/8d5JwIkjabxERLglCcP+geOEJp+QijbvFIaZR/n2irlKW4gSy6ko
-9B0fgUnhkHysSg49ChHQBPQ+o5BbpuLrPDFMiTPTPhdfsvGGcyCGeqfBA56oHcSF
-K02Fg8OM+Bd1lb48LAN9nWWY4WbwV+9bkN3Ym8hO4c3a/Dxf2N7LtAQqWZzFjvM3
-/AaDvAgBAoGBAPLD+Xn1IYQPMB2XXCXfOuJewRY7RzoVWvMffJPDfm16O7wOiW5+
-2FmvxUDayk4PZy6wQMzGeGKnhcMMZTyaq2g/QtGfrvy7q1Lw2fB1VFlVblvqhoJa
-nMJojjC4zgjBkXMHsRLeTmgUKyGs+fdFbfI6uejBnnf+eMVUMIdJ+6I9AoGBANCn
-kWO9640dttyXURxNJ3lBr2H3dJOkmD6XS+u+LWqCSKQe691Y/fZ/ZL0Oc4Mhy7I6
-hsy3kDQ5k2V0fkaNODQIFJvUqXw2pMewUk8hHc9403f4fe9cPrL12rQ8WlQw4yoC
-v2B61vNczCCUDtGxlAaw8jzSRaSI5s6ax3K7enbdAoGBAJB1WYDfA2CoAQO6y9Sl
-b07A/7kQ8SN5DbPaqrDrBdJziBQxukoMJQXJeGFNUFD/DXFU5Fp2R7C86vXT7HIR
-v6m66zH+CYzOx/YE6EsUJms6UP9VIVF0Rg/RU7teXQwM01ZV32LQ8mswhTH20o/3
-uqMHmxUMEhZpUMhrfq0isyApAoGAe1UxGTXfj9AqkIVYylPIq2HqGww7+jFmVEj1
-9Wi6S6Sq72ffnzzFEPkIQL/UA4TsdHMnzsYKFPSbbXLIWUeMGyVTmTDA5c0e5XIR
-lPhMOKCAzv8w4VUzMnEkTzkFY5JqFCD/ojW57KvDdNZPVB+VEcdxyAW6aKELXMAc
-eHLc1nkCgYEApm/motCTPN32nINZ+Vvywbv64ZD+gtpeMNP3CLrbe1X9O+H52AXa
-1jCoOldWR8i2bs2NVPcKZgdo6fFULqE4dBX7Te/uYEIuuZhYLNzRO1IKU/YaqsXG
-3bfQ8hKYcSnTfE0gPtLDnqCIxTocaGLSHeG3TH9fTw+dA8FvWpUztI4=
------END RSA PRIVATE KEY-----
-`
diff --git a/vendor/github.com/mitchellh/packer/helper/communicator/winrm.go b/vendor/github.com/mitchellh/packer/helper/communicator/winrm.go
deleted file mode 100644
index afdf2569..00000000
--- a/vendor/github.com/mitchellh/packer/helper/communicator/winrm.go
+++ /dev/null
@@ -1,8 +0,0 @@
-package communicator
-
-// WinRMConfig is configuration that can be returned at runtime to
-// dynamically configure WinRM.
-type WinRMConfig struct {
- Username string
- Password string
-}
diff --git a/vendor/github.com/mitchellh/packer/helper/config/decode.go b/vendor/github.com/mitchellh/packer/helper/config/decode.go
deleted file mode 100644
index 620198e3..00000000
--- a/vendor/github.com/mitchellh/packer/helper/config/decode.go
+++ /dev/null
@@ -1,145 +0,0 @@
-package config
-
-import (
- "fmt"
- "reflect"
- "sort"
- "strings"
-
- "github.com/hashicorp/go-multierror"
- "github.com/mitchellh/mapstructure"
- "github.com/mitchellh/packer/template/interpolate"
-)
-
-// DecodeOpts are the options for decoding configuration.
-type DecodeOpts struct {
- // Metadata, if non-nil, will be set to the metadata post-decode
- Metadata *mapstructure.Metadata
-
- // Interpolate, if true, will automatically interpolate the
- // configuration with the given InterpolateContext. User variables
- // will be automatically detected and added in-place to the given
- // context.
- Interpolate bool
- InterpolateContext *interpolate.Context
- InterpolateFilter *interpolate.RenderFilter
-}
-
-// Decode decodes the configuration into the target and optionally
-// automatically interpolates all the configuration as it goes.
-func Decode(target interface{}, config *DecodeOpts, raws ...interface{}) error {
- if config == nil {
- config = &DecodeOpts{Interpolate: true}
- }
-
- // Interpolate first
- if config.Interpolate {
- // Detect user variables from the raws and merge them into our context
- ctx, err := DetectContext(raws...)
- if err != nil {
- return err
- }
- if config.InterpolateContext == nil {
- config.InterpolateContext = ctx
- } else {
- config.InterpolateContext.BuildName = ctx.BuildName
- config.InterpolateContext.BuildType = ctx.BuildType
- config.InterpolateContext.TemplatePath = ctx.TemplatePath
- config.InterpolateContext.UserVariables = ctx.UserVariables
- }
- ctx = config.InterpolateContext
-
- // Render everything
- for i, raw := range raws {
- m, err := interpolate.RenderMap(raw, ctx, config.InterpolateFilter)
- if err != nil {
- return err
- }
-
- raws[i] = m
- }
- }
-
- // Build our decoder
- var md mapstructure.Metadata
- decoder, err := mapstructure.NewDecoder(&mapstructure.DecoderConfig{
- Result: target,
- Metadata: &md,
- WeaklyTypedInput: true,
- DecodeHook: mapstructure.ComposeDecodeHookFunc(
- uint8ToStringHook,
- mapstructure.StringToSliceHookFunc(","),
- mapstructure.StringToTimeDurationHookFunc(),
- ),
- })
- if err != nil {
- return err
- }
- for _, raw := range raws {
- if err := decoder.Decode(raw); err != nil {
- return err
- }
- }
-
- // Set the metadata if it is set
- if config.Metadata != nil {
- *config.Metadata = md
- }
-
- // If we have unused keys, it is an error
- if len(md.Unused) > 0 {
- var err error
- sort.Strings(md.Unused)
- for _, unused := range md.Unused {
- if unused != "type" && !strings.HasPrefix(unused, "packer_") {
- err = multierror.Append(err, fmt.Errorf(
- "unknown configuration key: %q", unused))
- }
- }
- if err != nil {
- return err
- }
- }
-
- return nil
-}
-
-// DetectContext builds a base interpolate.Context, automatically
-// detecting things like user variables from the raw configuration params.
-func DetectContext(raws ...interface{}) (*interpolate.Context, error) {
- var s struct {
- BuildName string `mapstructure:"packer_build_name"`
- BuildType string `mapstructure:"packer_builder_type"`
- TemplatePath string `mapstructure:"packer_template_path"`
- Vars map[string]string `mapstructure:"packer_user_variables"`
- }
-
- for _, r := range raws {
- if err := mapstructure.Decode(r, &s); err != nil {
- return nil, err
- }
- }
-
- return &interpolate.Context{
- BuildName: s.BuildName,
- BuildType: s.BuildType,
- TemplatePath: s.TemplatePath,
- UserVariables: s.Vars,
- }, nil
-}
-
-func uint8ToStringHook(f reflect.Kind, t reflect.Kind, v interface{}) (interface{}, error) {
- // We need to convert []uint8 to string. We have to do this
- // because internally Packer uses MsgPack for RPC and the MsgPack
- // codec turns strings into []uint8
- if f == reflect.Slice && t == reflect.String {
- dataVal := reflect.ValueOf(v)
- dataType := dataVal.Type()
- elemKind := dataType.Elem().Kind()
- if elemKind == reflect.Uint8 {
- v = string(dataVal.Interface().([]uint8))
- }
- }
-
- return v, nil
-}
diff --git a/vendor/github.com/mitchellh/packer/packer/artifact.go b/vendor/github.com/mitchellh/packer/packer/artifact.go
deleted file mode 100644
index 8eaf3bcd..00000000
--- a/vendor/github.com/mitchellh/packer/packer/artifact.go
+++ /dev/null
@@ -1,36 +0,0 @@
-package packer
-
-// An Artifact is the result of a build, and is the metadata that documents
-// what a builder actually created. The exact meaning of the contents is
-// specific to each builder, but this interface is used to communicate back
-// to the user the result of a build.
-type Artifact interface {
- // Returns the ID of the builder that was used to create this artifact.
- // This is the internal ID of the builder and should be unique to every
- // builder. This can be used to identify what the contents of the
- // artifact actually are.
- BuilderId() string
-
- // Returns the set of files that comprise this artifact. If an
- // artifact is not made up of files, then this will be empty.
- Files() []string
-
- // The ID for the artifact, if it has one. This is not guaranteed to
- // be unique every run (like a GUID), but simply provide an identifier
- // for the artifact that may be meaningful in some way. For example,
- // for Amazon EC2, this value might be the AMI ID.
- Id() string
-
- // Returns human-readable output that describes the artifact created.
- // This is used for UI output. It can be multiple lines.
- String() string
-
- // State allows the caller to ask for builder specific state information
- // relating to the artifact instance.
- State(name string) interface{}
-
- // Destroy deletes the artifact. Packer calls this for various reasons,
- // such as if a post-processor has processed this artifact and it is
- // no longer needed.
- Destroy() error
-}
diff --git a/vendor/github.com/mitchellh/packer/packer/artifact_mock.go b/vendor/github.com/mitchellh/packer/packer/artifact_mock.go
deleted file mode 100644
index 18f4e562..00000000
--- a/vendor/github.com/mitchellh/packer/packer/artifact_mock.go
+++ /dev/null
@@ -1,49 +0,0 @@
-package packer
-
-// MockArtifact is an implementation of Artifact that can be used for tests.
-type MockArtifact struct {
- BuilderIdValue string
- FilesValue []string
- IdValue string
- StateValues map[string]interface{}
- DestroyCalled bool
-}
-
-func (a *MockArtifact) BuilderId() string {
- if a.BuilderIdValue == "" {
- return "bid"
- }
-
- return a.BuilderIdValue
-}
-
-func (a *MockArtifact) Files() []string {
- if a.FilesValue == nil {
- return []string{"a", "b"}
- }
-
- return a.FilesValue
-}
-
-func (a *MockArtifact) Id() string {
- id := a.IdValue
- if id == "" {
- id = "id"
- }
-
- return id
-}
-
-func (*MockArtifact) String() string {
- return "string"
-}
-
-func (a *MockArtifact) State(name string) interface{} {
- value, _ := a.StateValues[name]
- return value
-}
-
-func (a *MockArtifact) Destroy() error {
- a.DestroyCalled = true
- return nil
-}
diff --git a/vendor/github.com/mitchellh/packer/packer/build.go b/vendor/github.com/mitchellh/packer/packer/build.go
deleted file mode 100644
index 757ef89e..00000000
--- a/vendor/github.com/mitchellh/packer/packer/build.go
+++ /dev/null
@@ -1,312 +0,0 @@
-package packer
-
-import (
- "fmt"
- "log"
- "sync"
-)
-
-const (
- // This is the key in configurations that is set to the name of the
- // build.
- BuildNameConfigKey = "packer_build_name"
-
- // This is the key in the configuration that is set to the type
- // of the builder that is run. This is useful for provisioners and
- // such who want to make use of this.
- BuilderTypeConfigKey = "packer_builder_type"
-
- // This is the key in configurations that is set to "true" when Packer
- // debugging is enabled.
- DebugConfigKey = "packer_debug"
-
- // This is the key in configurations that is set to "true" when Packer
- // force build is enabled.
- ForceConfigKey = "packer_force"
-
- // TemplatePathKey is the path to the template that configured this build
- TemplatePathKey = "packer_template_path"
-
- // This key contains a map[string]string of the user variables for
- // template processing.
- UserVariablesConfigKey = "packer_user_variables"
-)
-
-// A Build represents a single job within Packer that is responsible for
-// building some machine image artifact. Builds are meant to be parallelized.
-type Build interface {
- // Name is the name of the build. This is unique across a single template,
- // but not absolutely unique. This is meant more to describe to the user
- // what is being built rather than being a unique identifier.
- Name() string
-
- // Prepare configures the various components of this build and reports
- // any errors in doing so (such as syntax errors, validation errors, etc.).
- // It also reports any warnings.
- Prepare() ([]string, error)
-
- // Run runs the actual builder, returning an artifact implementation
- // of what is built. If anything goes wrong, an error is returned.
- Run(Ui, Cache) ([]Artifact, error)
-
- // Cancel will cancel a running build. This will block until the build
- // is actually completely cancelled.
- Cancel()
-
- // SetDebug will enable/disable debug mode. Debug mode is always
- // enabled by adding the additional key "packer_debug" to boolean
- // true in the configuration of the various components. This must
- // be called prior to Prepare.
- //
- // When SetDebug is set to true, parallelism between builds is
- // strictly prohibited.
- SetDebug(bool)
-
- // SetForce will enable/disable forcing a build when artifacts exist.
- //
- // When SetForce is set to true, existing artifacts from the build are
- // deleted prior to the build.
- SetForce(bool)
-}
-
-// A build struct represents a single build job, the result of which should
-// be a single machine image artifact. This artifact may be comprised of
-// multiple files, of course, but it should be for only a single provider
-// (such as VirtualBox, EC2, etc.).
-type coreBuild struct {
- name string
- builder Builder
- builderConfig interface{}
- builderType string
- hooks map[string][]Hook
- postProcessors [][]coreBuildPostProcessor
- provisioners []coreBuildProvisioner
- templatePath string
- variables map[string]string
-
- debug bool
- force bool
- l sync.Mutex
- prepareCalled bool
-}
-
-// Keeps track of the post-processor and the configuration of the
-// post-processor used within a build.
-type coreBuildPostProcessor struct {
- processor PostProcessor
- processorType string
- config map[string]interface{}
- keepInputArtifact bool
-}
-
-// Keeps track of the provisioner and the configuration of the provisioner
-// within the build.
-type coreBuildProvisioner struct {
- provisioner Provisioner
- config []interface{}
-}
-
-// Returns the name of the build.
-func (b *coreBuild) Name() string {
- return b.name
-}
-
-// Prepare prepares the build by doing some initialization for the builder
-// and any hooks. This _must_ be called prior to Run. The parameter is the
-// overrides for the variables within the template (if any).
-func (b *coreBuild) Prepare() (warn []string, err error) {
- b.l.Lock()
- defer b.l.Unlock()
-
- if b.prepareCalled {
- panic("prepare already called")
- }
-
- b.prepareCalled = true
-
- packerConfig := map[string]interface{}{
- BuildNameConfigKey: b.name,
- BuilderTypeConfigKey: b.builderType,
- DebugConfigKey: b.debug,
- ForceConfigKey: b.force,
- TemplatePathKey: b.templatePath,
- UserVariablesConfigKey: b.variables,
- }
-
- // Prepare the builder
- warn, err = b.builder.Prepare(b.builderConfig, packerConfig)
- if err != nil {
- log.Printf("Build '%s' prepare failure: %s\n", b.name, err)
- return
- }
-
- // Prepare the provisioners
- for _, coreProv := range b.provisioners {
- configs := make([]interface{}, len(coreProv.config), len(coreProv.config)+1)
- copy(configs, coreProv.config)
- configs = append(configs, packerConfig)
-
- if err = coreProv.provisioner.Prepare(configs...); err != nil {
- return
- }
- }
-
- // Prepare the post-processors
- for _, ppSeq := range b.postProcessors {
- for _, corePP := range ppSeq {
- err = corePP.processor.Configure(corePP.config, packerConfig)
- if err != nil {
- return
- }
- }
- }
-
- return
-}
-
-// Runs the actual build. Prepare must be called prior to running this.
-func (b *coreBuild) Run(originalUi Ui, cache Cache) ([]Artifact, error) {
- if !b.prepareCalled {
- panic("Prepare must be called first")
- }
-
- // Copy the hooks
- hooks := make(map[string][]Hook)
- for hookName, hookList := range b.hooks {
- hooks[hookName] = make([]Hook, len(hookList))
- copy(hooks[hookName], hookList)
- }
-
- // Add a hook for the provisioners if we have provisioners
- if len(b.provisioners) > 0 {
- provisioners := make([]Provisioner, len(b.provisioners))
- for i, p := range b.provisioners {
- provisioners[i] = p.provisioner
- }
-
- if _, ok := hooks[HookProvision]; !ok {
- hooks[HookProvision] = make([]Hook, 0, 1)
- }
-
- hooks[HookProvision] = append(hooks[HookProvision], &ProvisionHook{
- Provisioners: provisioners,
- })
- }
-
- hook := &DispatchHook{Mapping: hooks}
- artifacts := make([]Artifact, 0, 1)
-
- // The builder just has a normal Ui, but targetted
- builderUi := &TargettedUi{
- Target: b.Name(),
- Ui: originalUi,
- }
-
- log.Printf("Running builder: %s", b.builderType)
- builderArtifact, err := b.builder.Run(builderUi, hook, cache)
- if err != nil {
- return nil, err
- }
-
- // If there was no result, don't worry about running post-processors
- // because there is nothing they can do, just return.
- if builderArtifact == nil {
- return nil, nil
- }
-
- errors := make([]error, 0)
- keepOriginalArtifact := len(b.postProcessors) == 0
-
- // Run the post-processors
-PostProcessorRunSeqLoop:
- for _, ppSeq := range b.postProcessors {
- priorArtifact := builderArtifact
- for i, corePP := range ppSeq {
- ppUi := &TargettedUi{
- Target: fmt.Sprintf("%s (%s)", b.Name(), corePP.processorType),
- Ui: originalUi,
- }
-
- builderUi.Say(fmt.Sprintf("Running post-processor: %s", corePP.processorType))
- artifact, keep, err := corePP.processor.PostProcess(ppUi, priorArtifact)
- if err != nil {
- errors = append(errors, fmt.Errorf("Post-processor failed: %s", err))
- continue PostProcessorRunSeqLoop
- }
-
- if artifact == nil {
- log.Println("Nil artifact, halting post-processor chain.")
- continue PostProcessorRunSeqLoop
- }
-
- keep = keep || corePP.keepInputArtifact
- if i == 0 {
- // This is the first post-processor. We handle deleting
- // previous artifacts a bit different because multiple
- // post-processors may be using the original and need it.
- if !keepOriginalArtifact && keep {
- log.Printf(
- "Flagging to keep original artifact from post-processor '%s'",
- corePP.processorType)
- keepOriginalArtifact = true
- }
- } else {
- // We have a prior artifact. If we want to keep it, we append
- // it to the results list. Otherwise, we destroy it.
- if keep {
- artifacts = append(artifacts, priorArtifact)
- } else {
- log.Printf("Deleting prior artifact from post-processor '%s'", corePP.processorType)
- if err := priorArtifact.Destroy(); err != nil {
- errors = append(errors, fmt.Errorf("Failed cleaning up prior artifact: %s", err))
- }
- }
- }
-
- priorArtifact = artifact
- }
-
- // Add on the last artifact to the results
- if priorArtifact != nil {
- artifacts = append(artifacts, priorArtifact)
- }
- }
-
- if keepOriginalArtifact {
- artifacts = append(artifacts, nil)
- copy(artifacts[1:], artifacts)
- artifacts[0] = builderArtifact
- } else {
- log.Printf("Deleting original artifact for build '%s'", b.name)
- if err := builderArtifact.Destroy(); err != nil {
- errors = append(errors, fmt.Errorf("Error destroying builder artifact: %s", err))
- }
- }
-
- if len(errors) > 0 {
- err = &MultiError{errors}
- }
-
- return artifacts, err
-}
-
-func (b *coreBuild) SetDebug(val bool) {
- if b.prepareCalled {
- panic("prepare has already been called")
- }
-
- b.debug = val
-}
-
-func (b *coreBuild) SetForce(val bool) {
- if b.prepareCalled {
- panic("prepare has already been called")
- }
-
- b.force = val
-}
-
-// Cancels the build if it is running.
-func (b *coreBuild) Cancel() {
- b.builder.Cancel()
-}
diff --git a/vendor/github.com/mitchellh/packer/packer/builder.go b/vendor/github.com/mitchellh/packer/packer/builder.go
deleted file mode 100644
index 369b9a53..00000000
--- a/vendor/github.com/mitchellh/packer/packer/builder.go
+++ /dev/null
@@ -1,36 +0,0 @@
-package packer
-
-// Implementers of Builder are responsible for actually building images
-// on some platform given some configuration.
-//
-// In addition to the documentation on Prepare above: Prepare is sometimes
-// configured with a `map[string]interface{}` that has a key "packer_debug".
-// This is a boolean value. If it is set to true, then the builder should
-// enable a debug mode which allows builder developers and advanced users
-// to introspect what is going on during a build. During debug builds,
-// parallelism is strictly disabled, so it is safe to request input from
-// stdin and so on.
-type Builder interface {
- // Prepare is responsible for configuring the builder and validating
- // that configuration. Any setup should be done in this method. Note that
- // NO side effects should take place in prepare, it is meant as a state
- // setup only. Calling Prepare is not necessarilly followed by a Run.
- //
- // The parameters to Prepare are a set of interface{} values of the
- // configuration. These are almost always `map[string]interface{}`
- // parsed from a template, but no guarantee is made.
- //
- // Each of the configuration values should merge into the final
- // configuration.
- //
- // Prepare should return a list of warnings along with any errors
- // that occured while preparing.
- Prepare(...interface{}) ([]string, error)
-
- // Run is where the actual build should take place. It takes a Build and a Ui.
- Run(ui Ui, hook Hook, cache Cache) (Artifact, error)
-
- // Cancel cancels a possibly running Builder. This should block until
- // the builder actually cancels and cleans up after itself.
- Cancel()
-}
diff --git a/vendor/github.com/mitchellh/packer/packer/builder_mock.go b/vendor/github.com/mitchellh/packer/packer/builder_mock.go
deleted file mode 100644
index d8fd98e1..00000000
--- a/vendor/github.com/mitchellh/packer/packer/builder_mock.go
+++ /dev/null
@@ -1,58 +0,0 @@
-package packer
-
-import (
- "errors"
-)
-
-// MockBuilder is an implementation of Builder that can be used for tests.
-// You can set some fake return values and you can keep track of what
-// methods were called on the builder. It is fairly basic.
-type MockBuilder struct {
- ArtifactId string
- PrepareWarnings []string
- RunErrResult bool
- RunNilResult bool
-
- PrepareCalled bool
- PrepareConfig []interface{}
- RunCalled bool
- RunCache Cache
- RunHook Hook
- RunUi Ui
- CancelCalled bool
-}
-
-func (tb *MockBuilder) Prepare(config ...interface{}) ([]string, error) {
- tb.PrepareCalled = true
- tb.PrepareConfig = config
- return tb.PrepareWarnings, nil
-}
-
-func (tb *MockBuilder) Run(ui Ui, h Hook, c Cache) (Artifact, error) {
- tb.RunCalled = true
- tb.RunHook = h
- tb.RunUi = ui
- tb.RunCache = c
-
- if tb.RunErrResult {
- return nil, errors.New("foo")
- }
-
- if tb.RunNilResult {
- return nil, nil
- }
-
- if h != nil {
- if err := h.Run(HookProvision, ui, new(MockCommunicator), nil); err != nil {
- return nil, err
- }
- }
-
- return &MockArtifact{
- IdValue: tb.ArtifactId,
- }, nil
-}
-
-func (tb *MockBuilder) Cancel() {
- tb.CancelCalled = true
-}
diff --git a/vendor/github.com/mitchellh/packer/packer/cache.go b/vendor/github.com/mitchellh/packer/packer/cache.go
deleted file mode 100644
index d65b5b80..00000000
--- a/vendor/github.com/mitchellh/packer/packer/cache.go
+++ /dev/null
@@ -1,120 +0,0 @@
-package packer
-
-import (
- "crypto/sha256"
- "encoding/hex"
- "log"
- "os"
- "path/filepath"
- "strings"
- "sync"
-)
-
-// Cache implements a caching interface where files can be stored for
-// re-use between multiple runs.
-type Cache interface {
- // Lock takes a key and returns the path where the file can be written to.
- // Packer guarantees that no other process will write to this file while
- // the lock is held.
- //
- // If the key has an extension (e.g., file.ext), the resulting path
- // will have that extension as well.
- //
- // The cache will block and wait for the lock.
- Lock(string) string
-
- // Unlock will unlock a certain cache key. Be very careful that this
- // is only called once per lock obtained.
- Unlock(string)
-
- // RLock returns the path to a key in the cache and locks it for reading.
- // The second return parameter is whether the key existed or not.
- // This will block if any locks are held for writing. No lock will be
- // held if the key doesn't exist.
- RLock(string) (string, bool)
-
- // RUnlock will unlock a key for reading.
- RUnlock(string)
-}
-
-// FileCache implements a Cache by caching the data directly to a cache
-// directory.
-type FileCache struct {
- CacheDir string
- l sync.Mutex
- rw map[string]*sync.RWMutex
-}
-
-func (f *FileCache) Lock(key string) string {
- hashKey := f.hashKey(key)
- rw := f.rwLock(hashKey)
- rw.Lock()
-
- return f.cachePath(key, hashKey)
-}
-
-func (f *FileCache) Unlock(key string) {
- hashKey := f.hashKey(key)
- rw := f.rwLock(hashKey)
- rw.Unlock()
-}
-
-func (f *FileCache) RLock(key string) (string, bool) {
- hashKey := f.hashKey(key)
- rw := f.rwLock(hashKey)
- rw.RLock()
-
- return f.cachePath(key, hashKey), true
-}
-
-func (f *FileCache) RUnlock(key string) {
- hashKey := f.hashKey(key)
- rw := f.rwLock(hashKey)
- rw.RUnlock()
-}
-
-func (f *FileCache) cachePath(key string, hashKey string) string {
- if endIndex := strings.Index(key, "?"); endIndex > -1 {
- key = key[:endIndex]
- }
-
- suffix := ""
- dotIndex := strings.LastIndex(key, ".")
- if dotIndex > -1 {
- if slashIndex := strings.LastIndex(key, "/"); slashIndex <= dotIndex {
- suffix = key[dotIndex:]
- }
- }
-
- // Make the cache directory. We ignore errors here, but
- // log them in case something happens.
- if err := os.MkdirAll(f.CacheDir, 0755); err != nil {
- log.Printf(
- "[ERR] Error making cacheDir: %s %s", f.CacheDir, err)
- }
-
- return filepath.Join(f.CacheDir, hashKey+suffix)
-}
-
-func (f *FileCache) hashKey(key string) string {
- sha := sha256.New()
- sha.Write([]byte(key))
- return hex.EncodeToString(sha.Sum(nil))
-}
-
-func (f *FileCache) rwLock(hashKey string) *sync.RWMutex {
- f.l.Lock()
- defer f.l.Unlock()
-
- if f.rw == nil {
- f.rw = make(map[string]*sync.RWMutex)
- }
-
- if result, ok := f.rw[hashKey]; ok {
- return result
- }
-
- var result sync.RWMutex
- f.rw[hashKey] = &result
- return &result
-}
diff --git a/vendor/github.com/mitchellh/packer/packer/communicator.go b/vendor/github.com/mitchellh/packer/packer/communicator.go
deleted file mode 100644
index f989dbfc..00000000
--- a/vendor/github.com/mitchellh/packer/packer/communicator.go
+++ /dev/null
@@ -1,205 +0,0 @@
-package packer
-
-import (
- "io"
- "os"
- "strings"
- "sync"
-
- "github.com/mitchellh/iochan"
-)
-
-// RemoteCmd represents a remote command being prepared or run.
-type RemoteCmd struct {
- // Command is the command to run remotely. This is executed as if
- // it were a shell command, so you are expected to do any shell escaping
- // necessary.
- Command string
-
- // Stdin specifies the process's standard input. If Stdin is
- // nil, the process reads from an empty bytes.Buffer.
- Stdin io.Reader
-
- // Stdout and Stderr represent the process's standard output and
- // error.
- //
- // If either is nil, it will be set to ioutil.Discard.
- Stdout io.Writer
- Stderr io.Writer
-
- // This will be set to true when the remote command has exited. It
- // shouldn't be set manually by the user, but there is no harm in
- // doing so.
- Exited bool
-
- // Once Exited is true, this will contain the exit code of the process.
- ExitStatus int
-
- // Internal fields
- exitCh chan struct{}
-
- // This thing is a mutex, lock when making modifications concurrently
- sync.Mutex
-}
-
-// A Communicator is the interface used to communicate with the machine
-// that exists that will eventually be packaged into an image. Communicators
-// allow you to execute remote commands, upload files, etc.
-//
-// Communicators must be safe for concurrency, meaning multiple calls to
-// Start or any other method may be called at the same time.
-type Communicator interface {
- // Start takes a RemoteCmd and starts it. The RemoteCmd must not be
- // modified after being used with Start, and it must not be used with
- // Start again. The Start method returns immediately once the command
- // is started. It does not wait for the command to complete. The
- // RemoteCmd.Exited field should be used for this.
- Start(*RemoteCmd) error
-
- // Upload uploads a file to the machine to the given path with the
- // contents coming from the given reader. This method will block until
- // it completes.
- Upload(string, io.Reader, *os.FileInfo) error
-
- // UploadDir uploads the contents of a directory recursively to
- // the remote path. It also takes an optional slice of paths to
- // ignore when uploading.
- //
- // The folder name of the source folder should be created unless there
- // is a trailing slash on the source "/". For example: "/tmp/src" as
- // the source will create a "src" directory in the destination unless
- // a trailing slash is added. This is identical behavior to rsync(1).
- UploadDir(dst string, src string, exclude []string) error
-
- // Download downloads a file from the machine from the given remote path
- // with the contents writing to the given writer. This method will
- // block until it completes.
- Download(string, io.Writer) error
-
- DownloadDir(src string, dst string, exclude []string) error
-}
-
-// StartWithUi runs the remote command and streams the output to any
-// configured Writers for stdout/stderr, while also writing each line
-// as it comes to a Ui.
-func (r *RemoteCmd) StartWithUi(c Communicator, ui Ui) error {
- stdout_r, stdout_w := io.Pipe()
- stderr_r, stderr_w := io.Pipe()
- defer stdout_w.Close()
- defer stderr_w.Close()
-
- // Retain the original stdout/stderr that we can replace back in.
- originalStdout := r.Stdout
- originalStderr := r.Stderr
- defer func() {
- r.Lock()
- defer r.Unlock()
-
- r.Stdout = originalStdout
- r.Stderr = originalStderr
- }()
-
- // Set the writers for the output so that we get it streamed to us
- if r.Stdout == nil {
- r.Stdout = stdout_w
- } else {
- r.Stdout = io.MultiWriter(r.Stdout, stdout_w)
- }
-
- if r.Stderr == nil {
- r.Stderr = stderr_w
- } else {
- r.Stderr = io.MultiWriter(r.Stderr, stderr_w)
- }
-
- // Start the command
- if err := c.Start(r); err != nil {
- return err
- }
-
- // Create the channels we'll use for data
- exitCh := make(chan struct{})
- stdoutCh := iochan.DelimReader(stdout_r, '\n')
- stderrCh := iochan.DelimReader(stderr_r, '\n')
-
- // Start the goroutine to watch for the exit
- go func() {
- defer close(exitCh)
- defer stdout_w.Close()
- defer stderr_w.Close()
- r.Wait()
- }()
-
- // Loop and get all our output
-OutputLoop:
- for {
- select {
- case output := <-stderrCh:
- if output != "" {
- ui.Message(r.cleanOutputLine(output))
- }
- case output := <-stdoutCh:
- if output != "" {
- ui.Message(r.cleanOutputLine(output))
- }
- case <-exitCh:
- break OutputLoop
- }
- }
-
- // Make sure we finish off stdout/stderr because we may have gotten
- // a message from the exit channel before finishing these first.
- for output := range stdoutCh {
- ui.Message(strings.TrimSpace(output))
- }
-
- for output := range stderrCh {
- ui.Message(strings.TrimSpace(output))
- }
-
- return nil
-}
-
-// SetExited is a helper for setting that this process is exited. This
-// should be called by communicators who are running a remote command in
-// order to set that the command is done.
-func (r *RemoteCmd) SetExited(status int) {
- r.Lock()
- defer r.Unlock()
-
- if r.exitCh == nil {
- r.exitCh = make(chan struct{})
- }
-
- r.Exited = true
- r.ExitStatus = status
- close(r.exitCh)
-}
-
-// Wait waits for the remote command to complete.
-func (r *RemoteCmd) Wait() {
- // Make sure our condition variable is initialized.
- r.Lock()
- if r.exitCh == nil {
- r.exitCh = make(chan struct{})
- }
- r.Unlock()
-
- <-r.exitCh
-}
-
-// cleanOutputLine cleans up a line so that '\r' don't muck up the
-// UI output when we're reading from a remote command.
-func (r *RemoteCmd) cleanOutputLine(line string) string {
- // Trim surrounding whitespace
- line = strings.TrimSpace(line)
-
- // Trim up to the first carriage return, since that text would be
- // lost anyways.
- idx := strings.LastIndex(line, "\r")
- if idx > -1 {
- line = line[idx+1:]
- }
-
- return line
-}
diff --git a/vendor/github.com/mitchellh/packer/packer/communicator_mock.go b/vendor/github.com/mitchellh/packer/packer/communicator_mock.go
deleted file mode 100644
index 1d158c51..00000000
--- a/vendor/github.com/mitchellh/packer/packer/communicator_mock.go
+++ /dev/null
@@ -1,112 +0,0 @@
-package packer
-
-import (
- "bytes"
- "io"
- "os"
- "sync"
-)
-
-// MockCommunicator is a valid Communicator implementation that can be
-// used for tests.
-type MockCommunicator struct {
- StartCalled bool
- StartCmd *RemoteCmd
- StartStderr string
- StartStdout string
- StartStdin string
- StartExitStatus int
-
- UploadCalled bool
- UploadPath string
- UploadData string
-
- UploadDirDst string
- UploadDirSrc string
- UploadDirExclude []string
-
- DownloadDirDst string
- DownloadDirSrc string
- DownloadDirExclude []string
-
- DownloadCalled bool
- DownloadPath string
- DownloadData string
-}
-
-func (c *MockCommunicator) Start(rc *RemoteCmd) error {
- c.StartCalled = true
- c.StartCmd = rc
-
- go func() {
- var wg sync.WaitGroup
- if rc.Stdout != nil && c.StartStdout != "" {
- wg.Add(1)
- go func() {
- rc.Stdout.Write([]byte(c.StartStdout))
- wg.Done()
- }()
- }
-
- if rc.Stderr != nil && c.StartStderr != "" {
- wg.Add(1)
- go func() {
- rc.Stderr.Write([]byte(c.StartStderr))
- wg.Done()
- }()
- }
-
- if rc.Stdin != nil {
- wg.Add(1)
- go func() {
- defer wg.Done()
- var data bytes.Buffer
- io.Copy(&data, rc.Stdin)
- c.StartStdin = data.String()
- }()
- }
-
- wg.Wait()
- rc.SetExited(c.StartExitStatus)
- }()
-
- return nil
-}
-
-func (c *MockCommunicator) Upload(path string, r io.Reader, fi *os.FileInfo) error {
- c.UploadCalled = true
- c.UploadPath = path
-
- var data bytes.Buffer
- if _, err := io.Copy(&data, r); err != nil {
- panic(err)
- }
-
- c.UploadData = data.String()
-
- return nil
-}
-
-func (c *MockCommunicator) UploadDir(dst string, src string, excl []string) error {
- c.UploadDirDst = dst
- c.UploadDirSrc = src
- c.UploadDirExclude = excl
-
- return nil
-}
-
-func (c *MockCommunicator) Download(path string, w io.Writer) error {
- c.DownloadCalled = true
- c.DownloadPath = path
- w.Write([]byte(c.DownloadData))
-
- return nil
-}
-
-func (c *MockCommunicator) DownloadDir(src string, dst string, excl []string) error {
- c.DownloadDirDst = dst
- c.DownloadDirSrc = src
- c.DownloadDirExclude = excl
-
- return nil
-}
diff --git a/vendor/github.com/mitchellh/packer/packer/config_file.go b/vendor/github.com/mitchellh/packer/packer/config_file.go
deleted file mode 100644
index edd10ede..00000000
--- a/vendor/github.com/mitchellh/packer/packer/config_file.go
+++ /dev/null
@@ -1,40 +0,0 @@
-package packer
-
-import (
- "os"
- "path/filepath"
-)
-
-// ConfigFile returns the default path to the configuration file. On
-// Unix-like systems this is the ".packerconfig" file in the home directory.
-// On Windows, this is the "packer.config" file in the application data
-// directory.
-func ConfigFile() (string, error) {
- return configFile()
-}
-
-// ConfigDir returns the configuration directory for Packer.
-func ConfigDir() (string, error) {
- return configDir()
-}
-
-// ConfigTmpDir returns the configuration tmp directory for Packer
-func ConfigTmpDir() (string, error) {
- if tmpdir := os.Getenv("PACKER_TMP_DIR"); tmpdir != "" {
- return filepath.Abs(tmpdir)
- }
- configdir, err := configDir()
- if err != nil {
- return "", err
- }
- td := filepath.Join(configdir, "tmp")
- _, err = os.Stat(td)
- if os.IsNotExist(err) {
- if err = os.MkdirAll(td, 0755); err != nil {
- return "", err
- }
- } else if err != nil {
- return "", err
- }
- return td, nil
-}
diff --git a/vendor/github.com/mitchellh/packer/packer/config_file_unix.go b/vendor/github.com/mitchellh/packer/packer/config_file_unix.go
deleted file mode 100644
index 82260c2a..00000000
--- a/vendor/github.com/mitchellh/packer/packer/config_file_unix.go
+++ /dev/null
@@ -1,54 +0,0 @@
-// +build darwin freebsd linux netbsd openbsd
-
-package packer
-
-import (
- "bytes"
- "errors"
- "log"
- "os"
- "os/exec"
- "path/filepath"
- "strings"
-)
-
-func configFile() (string, error) {
- dir, err := homeDir()
- if err != nil {
- return "", err
- }
-
- return filepath.Join(dir, ".packerconfig"), nil
-}
-
-func configDir() (string, error) {
- dir, err := homeDir()
- if err != nil {
- return "", err
- }
-
- return filepath.Join(dir, ".packer.d"), nil
-}
-
-func homeDir() (string, error) {
- // First prefer the HOME environmental variable
- if home := os.Getenv("HOME"); home != "" {
- log.Printf("Detected home directory from env var: %s", home)
- return home, nil
- }
-
- // If that fails, try the shell
- var stdout bytes.Buffer
- cmd := exec.Command("sh", "-c", "eval echo ~$USER")
- cmd.Stdout = &stdout
- if err := cmd.Run(); err != nil {
- return "", err
- }
-
- result := strings.TrimSpace(stdout.String())
- if result == "" {
- return "", errors.New("blank output")
- }
-
- return result, nil
-}
diff --git a/vendor/github.com/mitchellh/packer/packer/config_file_windows.go b/vendor/github.com/mitchellh/packer/packer/config_file_windows.go
deleted file mode 100644
index d0bcc1c5..00000000
--- a/vendor/github.com/mitchellh/packer/packer/config_file_windows.go
+++ /dev/null
@@ -1,46 +0,0 @@
-// +build windows
-
-package packer
-
-import (
- "path/filepath"
- "syscall"
- "unsafe"
-)
-
-var (
- shell = syscall.MustLoadDLL("Shell32.dll")
- getFolderPath = shell.MustFindProc("SHGetFolderPathW")
-)
-
-const CSIDL_APPDATA = 26
-
-func configFile() (string, error) {
- dir, err := homeDir()
- if err != nil {
- return "", err
- }
-
- return filepath.Join(dir, "packer.config"), nil
-}
-
-func configDir() (string, error) {
- dir, err := homeDir()
- if err != nil {
- return "", err
- }
-
- return filepath.Join(dir, "packer.d"), nil
-}
-
-func homeDir() (string, error) {
- b := make([]uint16, syscall.MAX_PATH)
-
- // See: http://msdn.microsoft.com/en-us/library/windows/desktop/bb762181(v=vs.85).aspx
- r, _, err := getFolderPath.Call(0, CSIDL_APPDATA, 0, 0, uintptr(unsafe.Pointer(&b[0])))
- if uint32(r) != 0 {
- return "", err
- }
-
- return syscall.UTF16ToString(b), nil
-}
diff --git a/vendor/github.com/mitchellh/packer/packer/core.go b/vendor/github.com/mitchellh/packer/packer/core.go
deleted file mode 100644
index 860e1808..00000000
--- a/vendor/github.com/mitchellh/packer/packer/core.go
+++ /dev/null
@@ -1,310 +0,0 @@
-package packer
-
-import (
- "fmt"
- "sort"
-
- "github.com/hashicorp/go-multierror"
- "github.com/hashicorp/go-version"
- "github.com/mitchellh/packer/template"
- "github.com/mitchellh/packer/template/interpolate"
-)
-
-// Core is the main executor of Packer. If Packer is being used as a
-// library, this is the struct you'll want to instantiate to get anything done.
-type Core struct {
- Template *template.Template
-
- components ComponentFinder
- variables map[string]string
- builds map[string]*template.Builder
- version string
-}
-
-// CoreConfig is the structure for initializing a new Core. Once a CoreConfig
-// is used to initialize a Core, it shouldn't be re-used or modified again.
-type CoreConfig struct {
- Components ComponentFinder
- Template *template.Template
- Variables map[string]string
- Version string
-}
-
-// The function type used to lookup Builder implementations.
-type BuilderFunc func(name string) (Builder, error)
-
-// The function type used to lookup Hook implementations.
-type HookFunc func(name string) (Hook, error)
-
-// The function type used to lookup PostProcessor implementations.
-type PostProcessorFunc func(name string) (PostProcessor, error)
-
-// The function type used to lookup Provisioner implementations.
-type ProvisionerFunc func(name string) (Provisioner, error)
-
-// ComponentFinder is a struct that contains the various function
-// pointers necessary to look up components of Packer such as builders,
-// commands, etc.
-type ComponentFinder struct {
- Builder BuilderFunc
- Hook HookFunc
- PostProcessor PostProcessorFunc
- Provisioner ProvisionerFunc
-}
-
-// NewCore creates a new Core.
-func NewCore(c *CoreConfig) (*Core, error) {
- result := &Core{
- Template: c.Template,
- components: c.Components,
- variables: c.Variables,
- version: c.Version,
- }
- if err := result.validate(); err != nil {
- return nil, err
- }
- if err := result.init(); err != nil {
- return nil, err
- }
-
- // Go through and interpolate all the build names. We shuld be able
- // to do this at this point with the variables.
- result.builds = make(map[string]*template.Builder)
- for _, b := range c.Template.Builders {
- v, err := interpolate.Render(b.Name, result.Context())
- if err != nil {
- return nil, fmt.Errorf(
- "Error interpolating builder '%s': %s",
- b.Name, err)
- }
-
- result.builds[v] = b
- }
-
- return result, nil
-}
-
-// BuildNames returns the builds that are available in this configured core.
-func (c *Core) BuildNames() []string {
- r := make([]string, 0, len(c.builds))
- for n := range c.builds {
- r = append(r, n)
- }
- sort.Strings(r)
-
- return r
-}
-
-// Build returns the Build object for the given name.
-func (c *Core) Build(n string) (Build, error) {
- // Setup the builder
- configBuilder, ok := c.builds[n]
- if !ok {
- return nil, fmt.Errorf("no such build found: %s", n)
- }
- builder, err := c.components.Builder(configBuilder.Type)
- if err != nil {
- return nil, fmt.Errorf(
- "error initializing builder '%s': %s",
- configBuilder.Type, err)
- }
- if builder == nil {
- return nil, fmt.Errorf(
- "builder type not found: %s", configBuilder.Type)
- }
-
- // rawName is the uninterpolated name that we use for various lookups
- rawName := configBuilder.Name
-
- // Setup the provisioners for this build
- provisioners := make([]coreBuildProvisioner, 0, len(c.Template.Provisioners))
- for _, rawP := range c.Template.Provisioners {
- // If we're skipping this, then ignore it
- if rawP.Skip(rawName) {
- continue
- }
-
- // Get the provisioner
- provisioner, err := c.components.Provisioner(rawP.Type)
- if err != nil {
- return nil, fmt.Errorf(
- "error initializing provisioner '%s': %s",
- rawP.Type, err)
- }
- if provisioner == nil {
- return nil, fmt.Errorf(
- "provisioner type not found: %s", rawP.Type)
- }
-
- // Get the configuration
- config := make([]interface{}, 1, 2)
- config[0] = rawP.Config
- if rawP.Override != nil {
- if override, ok := rawP.Override[rawName]; ok {
- config = append(config, override)
- }
- }
-
- // If we're pausing, we wrap the provisioner in a special pauser.
- if rawP.PauseBefore > 0 {
- provisioner = &PausedProvisioner{
- PauseBefore: rawP.PauseBefore,
- Provisioner: provisioner,
- }
- }
-
- provisioners = append(provisioners, coreBuildProvisioner{
- provisioner: provisioner,
- config: config,
- })
- }
-
- // Setup the post-processors
- postProcessors := make([][]coreBuildPostProcessor, 0, len(c.Template.PostProcessors))
- for _, rawPs := range c.Template.PostProcessors {
- current := make([]coreBuildPostProcessor, 0, len(rawPs))
- for _, rawP := range rawPs {
- // If we skip, ignore
- if rawP.Skip(rawName) {
- continue
- }
-
- // Get the post-processor
- postProcessor, err := c.components.PostProcessor(rawP.Type)
- if err != nil {
- return nil, fmt.Errorf(
- "error initializing post-processor '%s': %s",
- rawP.Type, err)
- }
- if postProcessor == nil {
- return nil, fmt.Errorf(
- "post-processor type not found: %s", rawP.Type)
- }
-
- current = append(current, coreBuildPostProcessor{
- processor: postProcessor,
- processorType: rawP.Type,
- config: rawP.Config,
- keepInputArtifact: rawP.KeepInputArtifact,
- })
- }
-
- // If we have no post-processors in this chain, just continue.
- if len(current) == 0 {
- continue
- }
-
- postProcessors = append(postProcessors, current)
- }
-
- // TODO hooks one day
-
- return &coreBuild{
- name: n,
- builder: builder,
- builderConfig: configBuilder.Config,
- builderType: configBuilder.Type,
- postProcessors: postProcessors,
- provisioners: provisioners,
- templatePath: c.Template.Path,
- variables: c.variables,
- }, nil
-}
-
-// Context returns an interpolation context.
-func (c *Core) Context() *interpolate.Context {
- return &interpolate.Context{
- TemplatePath: c.Template.Path,
- UserVariables: c.variables,
- }
-}
-
-// validate does a full validation of the template.
-//
-// This will automatically call template.validate() in addition to doing
-// richer semantic checks around variables and so on.
-func (c *Core) validate() error {
- // First validate the template in general, we can't do anything else
- // unless the template itself is valid.
- if err := c.Template.Validate(); err != nil {
- return err
- }
-
- // Validate the minimum version is satisfied
- if c.Template.MinVersion != "" {
- versionActual, err := version.NewVersion(c.version)
- if err != nil {
- // This shouldn't happen since we set it via the compiler
- panic(err)
- }
-
- versionMin, err := version.NewVersion(c.Template.MinVersion)
- if err != nil {
- return fmt.Errorf(
- "min_version is invalid: %s", err)
- }
-
- if versionActual.LessThan(versionMin) {
- return fmt.Errorf(
- "This template requires Packer version %s or higher; using %s",
- versionMin,
- versionActual)
- }
- }
-
- // Validate variables are set
- var err error
- for n, v := range c.Template.Variables {
- if v.Required {
- if _, ok := c.variables[n]; !ok {
- err = multierror.Append(err, fmt.Errorf(
- "required variable not set: %s", n))
- }
- }
- }
-
- // TODO: validate all builders exist
- // TODO: ^^ provisioner
- // TODO: ^^ post-processor
-
- return err
-}
-
-func (c *Core) init() error {
- if c.variables == nil {
- c.variables = make(map[string]string)
- }
-
- // Go through the variables and interpolate the environment variables
- ctx := c.Context()
- ctx.EnableEnv = true
- ctx.UserVariables = nil
- for k, v := range c.Template.Variables {
- // Ignore variables that are required
- if v.Required {
- continue
- }
-
- // Ignore variables that have a value
- if _, ok := c.variables[k]; ok {
- continue
- }
-
- // Interpolate the default
- def, err := interpolate.Render(v.Default, ctx)
- if err != nil {
- return fmt.Errorf(
- "error interpolating default value for '%s': %s",
- k, err)
- }
-
- c.variables[k] = def
- }
-
- // Interpolate the push configuration
- if _, err := interpolate.RenderInterface(&c.Template.Push, c.Context()); err != nil {
- return fmt.Errorf("Error interpolating 'push': %s", err)
- }
-
- return nil
-}
diff --git a/vendor/github.com/mitchellh/packer/packer/hook.go b/vendor/github.com/mitchellh/packer/packer/hook.go
deleted file mode 100644
index e5e7ad8a..00000000
--- a/vendor/github.com/mitchellh/packer/packer/hook.go
+++ /dev/null
@@ -1,87 +0,0 @@
-package packer
-
-import (
- "sync"
-)
-
-// This is the hook that should be fired for provisioners to run.
-const HookProvision = "packer_provision"
-
-// A Hook is used to hook into an arbitrarily named location in a build,
-// allowing custom behavior to run at certain points along a build.
-//
-// Run is called when the hook is called, with the name of the hook and
-// arbitrary data associated with it. To know what format the data is in,
-// you must reference the documentation for the specific hook you're interested
-// in. In addition to that, the Hook is given access to a UI so that it can
-// output things to the user.
-//
-// Cancel is called when the hook needs to be cancelled. This will usually
-// be called when Run is still in progress so the mechanism that handles this
-// must be race-free. Cancel should attempt to cancel the hook in the
-// quickest, safest way possible.
-type Hook interface {
- Run(string, Ui, Communicator, interface{}) error
- Cancel()
-}
-
-// A Hook implementation that dispatches based on an internal mapping.
-type DispatchHook struct {
- Mapping map[string][]Hook
-
- l sync.Mutex
- cancelled bool
- runningHook Hook
-}
-
-// Runs the hook with the given name by dispatching it to the proper
-// hooks if a mapping exists. If a mapping doesn't exist, then nothing
-// happens.
-func (h *DispatchHook) Run(name string, ui Ui, comm Communicator, data interface{}) error {
- h.l.Lock()
- h.cancelled = false
- h.l.Unlock()
-
- // Make sure when we exit that we reset the running hook.
- defer func() {
- h.l.Lock()
- defer h.l.Unlock()
- h.runningHook = nil
- }()
-
- hooks, ok := h.Mapping[name]
- if !ok {
- // No hooks for that name. No problem.
- return nil
- }
-
- for _, hook := range hooks {
- h.l.Lock()
- if h.cancelled {
- h.l.Unlock()
- return nil
- }
-
- h.runningHook = hook
- h.l.Unlock()
-
- if err := hook.Run(name, ui, comm, data); err != nil {
- return err
- }
- }
-
- return nil
-}
-
-// Cancels all the hooks that are currently in-flight, if any. This will
-// block until the hooks are all cancelled.
-func (h *DispatchHook) Cancel() {
- h.l.Lock()
- defer h.l.Unlock()
-
- if h.runningHook != nil {
- h.runningHook.Cancel()
- }
-
- h.cancelled = true
-}
diff --git a/vendor/github.com/mitchellh/packer/packer/hook_mock.go b/vendor/github.com/mitchellh/packer/packer/hook_mock.go
deleted file mode 100644
index 7177329e..00000000
--- a/vendor/github.com/mitchellh/packer/packer/hook_mock.go
+++ /dev/null
@@ -1,31 +0,0 @@
-package packer
-
-// MockHook is an implementation of Hook that can be used for tests.
-type MockHook struct {
- RunFunc func() error
-
- RunCalled bool
- RunComm Communicator
- RunData interface{}
- RunName string
- RunUi Ui
- CancelCalled bool
-}
-
-func (t *MockHook) Run(name string, ui Ui, comm Communicator, data interface{}) error {
- t.RunCalled = true
- t.RunComm = comm
- t.RunData = data
- t.RunName = name
- t.RunUi = ui
-
- if t.RunFunc == nil {
- return nil
- }
-
- return t.RunFunc()
-}
-
-func (t *MockHook) Cancel() {
- t.CancelCalled = true
-}
diff --git a/vendor/github.com/mitchellh/packer/packer/multi_error.go b/vendor/github.com/mitchellh/packer/packer/multi_error.go
deleted file mode 100644
index 4a7a3784..00000000
--- a/vendor/github.com/mitchellh/packer/packer/multi_error.go
+++ /dev/null
@@ -1,50 +0,0 @@
-package packer
-
-import (
- "fmt"
- "strings"
-)
-
-// MultiError is an error type to track multiple errors. This is used to
-// accumulate errors in cases such as configuration parsing, and returning
-// them as a single error.
-type MultiError struct {
- Errors []error
-}
-
-func (e *MultiError) Error() string {
- points := make([]string, len(e.Errors))
- for i, err := range e.Errors {
- points[i] = fmt.Sprintf("* %s", err)
- }
-
- return fmt.Sprintf(
- "%d error(s) occurred:\n\n%s",
- len(e.Errors), strings.Join(points, "\n"))
-}
-
-// MultiErrorAppend is a helper function that will append more errors
-// onto a MultiError in order to create a larger multi-error. If the
-// original error is not a MultiError, it will be turned into one.
-func MultiErrorAppend(err error, errs ...error) *MultiError {
- if err == nil {
- err = new(MultiError)
- }
-
- switch err := err.(type) {
- case *MultiError:
- if err == nil {
- err = new(MultiError)
- }
-
- err.Errors = append(err.Errors, errs...)
- return err
- default:
- newErrs := make([]error, len(errs)+1)
- newErrs[0] = err
- copy(newErrs[1:], errs)
- return &MultiError{
- Errors: newErrs,
- }
- }
-}
diff --git a/vendor/github.com/mitchellh/packer/packer/plugin/builder.go b/vendor/github.com/mitchellh/packer/packer/plugin/builder.go
deleted file mode 100644
index a0a89d57..00000000
--- a/vendor/github.com/mitchellh/packer/packer/plugin/builder.go
+++ /dev/null
@@ -1,46 +0,0 @@
-package plugin
-
-import (
- "github.com/mitchellh/packer/packer"
- "log"
-)
-
-type cmdBuilder struct {
- builder packer.Builder
- client *Client
-}
-
-func (b *cmdBuilder) Prepare(config ...interface{}) ([]string, error) {
- defer func() {
- r := recover()
- b.checkExit(r, nil)
- }()
-
- return b.builder.Prepare(config...)
-}
-
-func (b *cmdBuilder) Run(ui packer.Ui, hook packer.Hook, cache packer.Cache) (packer.Artifact, error) {
- defer func() {
- r := recover()
- b.checkExit(r, nil)
- }()
-
- return b.builder.Run(ui, hook, cache)
-}
-
-func (b *cmdBuilder) Cancel() {
- defer func() {
- r := recover()
- b.checkExit(r, nil)
- }()
-
- b.builder.Cancel()
-}
-
-func (c *cmdBuilder) checkExit(p interface{}, cb func()) {
- if c.client.Exited() && cb != nil {
- cb()
- } else if p != nil && !Killed {
- log.Panic(p)
- }
-}
diff --git a/vendor/github.com/mitchellh/packer/packer/plugin/client.go b/vendor/github.com/mitchellh/packer/packer/plugin/client.go
deleted file mode 100644
index e4eabfa3..00000000
--- a/vendor/github.com/mitchellh/packer/packer/plugin/client.go
+++ /dev/null
@@ -1,383 +0,0 @@
-package plugin
-
-import (
- "bufio"
- "errors"
- "fmt"
- "github.com/mitchellh/packer/packer"
- packrpc "github.com/mitchellh/packer/packer/rpc"
- "io"
- "io/ioutil"
- "log"
- "net"
- "os"
- "os/exec"
- "path/filepath"
- "strings"
- "sync"
- "time"
- "unicode"
-)
-
-// If this is true, then the "unexpected EOF" panic will not be
-// raised throughout the clients.
-var Killed = false
-
-// This is a slice of the "managed" clients which are cleaned up when
-// calling Cleanup
-var managedClients = make([]*Client, 0, 5)
-
-// Client handles the lifecycle of a plugin application, determining its
-// RPC address, and returning various types of packer interface implementations
-// across the multi-process communication layer.
-type Client struct {
- config *ClientConfig
- exited bool
- doneLogging chan struct{}
- l sync.Mutex
- address net.Addr
-}
-
-// ClientConfig is the configuration used to initialize a new
-// plugin client. After being used to initialize a plugin client,
-// that configuration must not be modified again.
-type ClientConfig struct {
- // The unstarted subprocess for starting the plugin.
- Cmd *exec.Cmd
-
- // Managed represents if the client should be managed by the
- // plugin package or not. If true, then by calling CleanupClients,
- // it will automatically be cleaned up. Otherwise, the client
- // user is fully responsible for making sure to Kill all plugin
- // clients. By default the client is _not_ managed.
- Managed bool
-
- // The minimum and maximum port to use for communicating with
- // the subprocess. If not set, this defaults to 10,000 and 25,000
- // respectively.
- MinPort, MaxPort uint
-
- // StartTimeout is the timeout to wait for the plugin to say it
- // has started successfully.
- StartTimeout time.Duration
-
- // If non-nil, then the stderr of the client will be written to here
- // (as well as the log).
- Stderr io.Writer
-}
-
-// This makes sure all the managed subprocesses are killed and properly
-// logged. This should be called before the parent process running the
-// plugins exits.
-//
-// This must only be called _once_.
-func CleanupClients() {
- // Set the killed to true so that we don't get unexpected panics
- Killed = true
-
- // Kill all the managed clients in parallel and use a WaitGroup
- // to wait for them all to finish up.
- var wg sync.WaitGroup
- for _, client := range managedClients {
- wg.Add(1)
-
- go func(client *Client) {
- client.Kill()
- wg.Done()
- }(client)
- }
-
- log.Println("waiting for all plugin processes to complete...")
- wg.Wait()
-}
-
-// Creates a new plugin client which manages the lifecycle of an external
-// plugin and gets the address for the RPC connection.
-//
-// The client must be cleaned up at some point by calling Kill(). If
-// the client is a managed client (created with NewManagedClient) you
-// can just call CleanupClients at the end of your program and they will
-// be properly cleaned.
-func NewClient(config *ClientConfig) (c *Client) {
- if config.MinPort == 0 && config.MaxPort == 0 {
- config.MinPort = 10000
- config.MaxPort = 25000
- }
-
- if config.StartTimeout == 0 {
- config.StartTimeout = 1 * time.Minute
- }
-
- if config.Stderr == nil {
- config.Stderr = ioutil.Discard
- }
-
- c = &Client{config: config}
- if config.Managed {
- managedClients = append(managedClients, c)
- }
-
- return
-}
-
-// Tells whether or not the underlying process has exited.
-func (c *Client) Exited() bool {
- c.l.Lock()
- defer c.l.Unlock()
- return c.exited
-}
-
-// Returns a builder implementation that is communicating over this
-// client. If the client hasn't been started, this will start it.
-func (c *Client) Builder() (packer.Builder, error) {
- client, err := c.packrpcClient()
- if err != nil {
- return nil, err
- }
-
- return &cmdBuilder{client.Builder(), c}, nil
-}
-
-// Returns a hook implementation that is communicating over this
-// client. If the client hasn't been started, this will start it.
-func (c *Client) Hook() (packer.Hook, error) {
- client, err := c.packrpcClient()
- if err != nil {
- return nil, err
- }
-
- return &cmdHook{client.Hook(), c}, nil
-}
-
-// Returns a post-processor implementation that is communicating over
-// this client. If the client hasn't been started, this will start it.
-func (c *Client) PostProcessor() (packer.PostProcessor, error) {
- client, err := c.packrpcClient()
- if err != nil {
- return nil, err
- }
-
- return &cmdPostProcessor{client.PostProcessor(), c}, nil
-}
-
-// Returns a provisioner implementation that is communicating over this
-// client. If the client hasn't been started, this will start it.
-func (c *Client) Provisioner() (packer.Provisioner, error) {
- client, err := c.packrpcClient()
- if err != nil {
- return nil, err
- }
-
- return &cmdProvisioner{client.Provisioner(), c}, nil
-}
-
-// End the executing subprocess (if it is running) and perform any cleanup
-// tasks necessary such as capturing any remaining logs and so on.
-//
-// This method blocks until the process successfully exits.
-//
-// This method can safely be called multiple times.
-func (c *Client) Kill() {
- cmd := c.config.Cmd
-
- if cmd.Process == nil {
- return
- }
-
- cmd.Process.Kill()
-
- // Wait for the client to finish logging so we have a complete log
- <-c.doneLogging
-}
-
-// Starts the underlying subprocess, communicating with it to negotiate
-// a port for RPC connections, and returning the address to connect via RPC.
-//
-// This method is safe to call multiple times. Subsequent calls have no effect.
-// Once a client has been started once, it cannot be started again, even if
-// it was killed.
-func (c *Client) Start() (addr net.Addr, err error) {
- c.l.Lock()
- defer c.l.Unlock()
-
- if c.address != nil {
- return c.address, nil
- }
-
- c.doneLogging = make(chan struct{})
-
- env := []string{
- fmt.Sprintf("%s=%s", MagicCookieKey, MagicCookieValue),
- fmt.Sprintf("PACKER_PLUGIN_MIN_PORT=%d", c.config.MinPort),
- fmt.Sprintf("PACKER_PLUGIN_MAX_PORT=%d", c.config.MaxPort),
- }
-
- stdout_r, stdout_w := io.Pipe()
- stderr_r, stderr_w := io.Pipe()
-
- cmd := c.config.Cmd
- cmd.Env = append(cmd.Env, os.Environ()...)
- cmd.Env = append(cmd.Env, env...)
- cmd.Stdin = os.Stdin
- cmd.Stderr = stderr_w
- cmd.Stdout = stdout_w
-
- log.Printf("Starting plugin: %s %#v", cmd.Path, cmd.Args)
- err = cmd.Start()
- if err != nil {
- return
- }
-
- // Make sure the command is properly cleaned up if there is an error
- defer func() {
- r := recover()
-
- if err != nil || r != nil {
- cmd.Process.Kill()
- }
-
- if r != nil {
- panic(r)
- }
- }()
-
- // Start goroutine to wait for process to exit
- exitCh := make(chan struct{})
- go func() {
- // Make sure we close the write end of our stderr/stdout so
- // that the readers send EOF properly.
- defer stderr_w.Close()
- defer stdout_w.Close()
-
- // Wait for the command to end.
- cmd.Wait()
-
- // Log and make sure to flush the logs write away
- log.Printf("%s: plugin process exited\n", cmd.Path)
- os.Stderr.Sync()
-
- // Mark that we exited
- close(exitCh)
-
- // Set that we exited, which takes a lock
- c.l.Lock()
- defer c.l.Unlock()
- c.exited = true
- }()
-
- // Start goroutine that logs the stderr
- go c.logStderr(stderr_r)
-
- // Start a goroutine that is going to be reading the lines
- // out of stdout
- linesCh := make(chan []byte)
- go func() {
- defer close(linesCh)
-
- buf := bufio.NewReader(stdout_r)
- for {
- line, err := buf.ReadBytes('\n')
- if line != nil {
- linesCh <- line
- }
-
- if err == io.EOF {
- return
- }
- }
- }()
-
- // Make sure after we exit we read the lines from stdout forever
- // so they dont' block since it is an io.Pipe
- defer func() {
- go func() {
- for range linesCh {
- }
- }()
- }()
-
- // Some channels for the next step
- timeout := time.After(c.config.StartTimeout)
-
- // Start looking for the address
- log.Printf("Waiting for RPC address for: %s", cmd.Path)
- select {
- case <-timeout:
- err = errors.New("timeout while waiting for plugin to start")
- case <-exitCh:
- err = errors.New("plugin exited before we could connect")
- case lineBytes := <-linesCh:
- // Trim the line and split by "|" in order to get the parts of
- // the output.
- line := strings.TrimSpace(string(lineBytes))
- parts := strings.SplitN(line, "|", 3)
- if len(parts) < 3 {
- err = fmt.Errorf("Unrecognized remote plugin message: %s", line)
- return
- }
-
- // Test the API version
- if parts[0] != APIVersion {
- err = fmt.Errorf("Incompatible API version with plugin. "+
- "Plugin version: %s, Ours: %s", parts[0], APIVersion)
- return
- }
-
- switch parts[1] {
- case "tcp":
- addr, err = net.ResolveTCPAddr("tcp", parts[2])
- case "unix":
- addr, err = net.ResolveUnixAddr("unix", parts[2])
- default:
- err = fmt.Errorf("Unknown address type: %s", parts[1])
- }
- }
-
- c.address = addr
- return
-}
-
-func (c *Client) logStderr(r io.Reader) {
- bufR := bufio.NewReader(r)
- for {
- line, err := bufR.ReadString('\n')
- if line != "" {
- c.config.Stderr.Write([]byte(line))
-
- line = strings.TrimRightFunc(line, unicode.IsSpace)
- log.Printf("%s: %s", filepath.Base(c.config.Cmd.Path), line)
- }
-
- if err == io.EOF {
- break
- }
- }
-
- // Flag that we've completed logging for others
- close(c.doneLogging)
-}
-
-func (c *Client) packrpcClient() (*packrpc.Client, error) {
- addr, err := c.Start()
- if err != nil {
- return nil, err
- }
-
- conn, err := net.Dial(addr.Network(), addr.String())
- if err != nil {
- return nil, err
- }
-
- if tcpConn, ok := conn.(*net.TCPConn); ok {
- // Make sure to set keep alive so that the connection doesn't die
- tcpConn.SetKeepAlive(true)
- }
-
- client, err := packrpc.NewClient(conn)
- if err != nil {
- conn.Close()
- return nil, err
- }
-
- return client, nil
-}
diff --git a/vendor/github.com/mitchellh/packer/packer/plugin/hook.go b/vendor/github.com/mitchellh/packer/packer/plugin/hook.go
deleted file mode 100644
index 5d4dbf06..00000000
--- a/vendor/github.com/mitchellh/packer/packer/plugin/hook.go
+++ /dev/null
@@ -1,37 +0,0 @@
-package plugin
-
-import (
- "github.com/mitchellh/packer/packer"
- "log"
-)
-
-type cmdHook struct {
- hook packer.Hook
- client *Client
-}
-
-func (c *cmdHook) Run(name string, ui packer.Ui, comm packer.Communicator, data interface{}) error {
- defer func() {
- r := recover()
- c.checkExit(r, nil)
- }()
-
- return c.hook.Run(name, ui, comm, data)
-}
-
-func (c *cmdHook) Cancel() {
- defer func() {
- r := recover()
- c.checkExit(r, nil)
- }()
-
- c.hook.Cancel()
-}
-
-func (c *cmdHook) checkExit(p interface{}, cb func()) {
- if c.client.Exited() && cb != nil {
- cb()
- } else if p != nil && !Killed {
- log.Panic(p)
- }
-}
diff --git a/vendor/github.com/mitchellh/packer/packer/plugin/post_processor.go b/vendor/github.com/mitchellh/packer/packer/plugin/post_processor.go
deleted file mode 100644
index 48314056..00000000
--- a/vendor/github.com/mitchellh/packer/packer/plugin/post_processor.go
+++ /dev/null
@@ -1,37 +0,0 @@
-package plugin
-
-import (
- "github.com/mitchellh/packer/packer"
- "log"
-)
-
-type cmdPostProcessor struct {
- p packer.PostProcessor
- client *Client
-}
-
-func (c *cmdPostProcessor) Configure(config ...interface{}) error {
- defer func() {
- r := recover()
- c.checkExit(r, nil)
- }()
-
- return c.p.Configure(config...)
-}
-
-func (c *cmdPostProcessor) PostProcess(ui packer.Ui, a packer.Artifact) (packer.Artifact, bool, error) {
- defer func() {
- r := recover()
- c.checkExit(r, nil)
- }()
-
- return c.p.PostProcess(ui, a)
-}
-
-func (c *cmdPostProcessor) checkExit(p interface{}, cb func()) {
- if c.client.Exited() && cb != nil {
- cb()
- } else if p != nil && !Killed {
- log.Panic(p)
- }
-}
diff --git a/vendor/github.com/mitchellh/packer/packer/plugin/provisioner.go b/vendor/github.com/mitchellh/packer/packer/plugin/provisioner.go
deleted file mode 100644
index 0feb9d72..00000000
--- a/vendor/github.com/mitchellh/packer/packer/plugin/provisioner.go
+++ /dev/null
@@ -1,46 +0,0 @@
-package plugin
-
-import (
- "github.com/mitchellh/packer/packer"
- "log"
-)
-
-type cmdProvisioner struct {
- p packer.Provisioner
- client *Client
-}
-
-func (c *cmdProvisioner) Prepare(configs ...interface{}) error {
- defer func() {
- r := recover()
- c.checkExit(r, nil)
- }()
-
- return c.p.Prepare(configs...)
-}
-
-func (c *cmdProvisioner) Provision(ui packer.Ui, comm packer.Communicator) error {
- defer func() {
- r := recover()
- c.checkExit(r, nil)
- }()
-
- return c.p.Provision(ui, comm)
-}
-
-func (c *cmdProvisioner) Cancel() {
- defer func() {
- r := recover()
- c.checkExit(r, nil)
- }()
-
- c.p.Cancel()
-}
-
-func (c *cmdProvisioner) checkExit(p interface{}, cb func()) {
- if c.client.Exited() && cb != nil {
- cb()
- } else if p != nil && !Killed {
- log.Panic(p)
- }
-}
diff --git a/vendor/github.com/mitchellh/packer/packer/plugin/server.go b/vendor/github.com/mitchellh/packer/packer/plugin/server.go
deleted file mode 100644
index 191b8ba3..00000000
--- a/vendor/github.com/mitchellh/packer/packer/plugin/server.go
+++ /dev/null
@@ -1,147 +0,0 @@
-// The plugin package provides the functionality to both expose a Packer
-// plugin binary and to connect to an existing Packer plugin binary.
-//
-// Packer supports plugins in the form of self-contained external static
-// Go binaries. These binaries behave in a certain way (enforced by this
-// package) and are connected to in a certain way (also enforced by this
-// package).
-package plugin
-
-import (
- "errors"
- "fmt"
- packrpc "github.com/mitchellh/packer/packer/rpc"
- "io/ioutil"
- "log"
- "math/rand"
- "net"
- "os"
- "os/signal"
- "runtime"
- "strconv"
- "sync/atomic"
- "time"
-)
-
-// This is a count of the number of interrupts the process has received.
-// This is updated with sync/atomic whenever a SIGINT is received and can
-// be checked by the plugin safely to take action.
-var Interrupts int32 = 0
-
-const MagicCookieKey = "PACKER_PLUGIN_MAGIC_COOKIE"
-const MagicCookieValue = "d602bf8f470bc67ca7faa0386276bbdd4330efaf76d1a219cb4d6991ca9872b2"
-
-// The APIVersion is outputted along with the RPC address. The plugin
-// client validates this API version and will show an error if it doesn't
-// know how to speak it.
-const APIVersion = "4"
-
-// Server waits for a connection to this plugin and returns a Packer
-// RPC server that you can use to register components and serve them.
-func Server() (*packrpc.Server, error) {
- if os.Getenv(MagicCookieKey) != MagicCookieValue {
- return nil, errors.New(
- "Please do not execute plugins directly. Packer will execute these for you.")
- }
-
- // If there is no explicit number of Go threads to use, then set it
- if os.Getenv("GOMAXPROCS") == "" {
- runtime.GOMAXPROCS(runtime.NumCPU())
- }
-
- minPort, err := strconv.ParseInt(os.Getenv("PACKER_PLUGIN_MIN_PORT"), 10, 32)
- if err != nil {
- return nil, err
- }
-
- maxPort, err := strconv.ParseInt(os.Getenv("PACKER_PLUGIN_MAX_PORT"), 10, 32)
- if err != nil {
- return nil, err
- }
-
- log.Printf("Plugin minimum port: %d\n", minPort)
- log.Printf("Plugin maximum port: %d\n", maxPort)
-
- listener, err := serverListener(minPort, maxPort)
- if err != nil {
- return nil, err
- }
- defer listener.Close()
-
- // Output the address to stdout
- log.Printf("Plugin address: %s %s\n",
- listener.Addr().Network(), listener.Addr().String())
- fmt.Printf("%s|%s|%s\n",
- APIVersion,
- listener.Addr().Network(),
- listener.Addr().String())
- os.Stdout.Sync()
-
- // Accept a connection
- log.Println("Waiting for connection...")
- conn, err := listener.Accept()
- if err != nil {
- log.Printf("Error accepting connection: %s\n", err.Error())
- return nil, err
- }
-
- // Eat the interrupts
- ch := make(chan os.Signal, 1)
- signal.Notify(ch, os.Interrupt)
- go func() {
- var count int32 = 0
- for {
- <-ch
- newCount := atomic.AddInt32(&count, 1)
- log.Printf("Received interrupt signal (count: %d). Ignoring.", newCount)
- }
- }()
-
- // Serve a single connection
- log.Println("Serving a plugin connection...")
- return packrpc.NewServer(conn), nil
-}
-
-func serverListener(minPort, maxPort int64) (net.Listener, error) {
- if runtime.GOOS == "windows" {
- return serverListener_tcp(minPort, maxPort)
- }
-
- return serverListener_unix()
-}
-
-func serverListener_tcp(minPort, maxPort int64) (net.Listener, error) {
- for port := minPort; port <= maxPort; port++ {
- address := fmt.Sprintf("127.0.0.1:%d", port)
- listener, err := net.Listen("tcp", address)
- if err == nil {
- return listener, nil
- }
- }
-
- return nil, errors.New("Couldn't bind plugin TCP listener")
-}
-
-func serverListener_unix() (net.Listener, error) {
- tf, err := ioutil.TempFile("", "packer-plugin")
- if err != nil {
- return nil, err
- }
- path := tf.Name()
-
- // Close the file and remove it because it has to not exist for
- // the domain socket.
- if err := tf.Close(); err != nil {
- return nil, err
- }
- if err := os.Remove(path); err != nil {
- return nil, err
- }
-
- return net.Listen("unix", path)
-}
-
-func init() {
- // Seed the random number generator
- rand.Seed(time.Now().UTC().UnixNano())
-}
diff --git a/vendor/github.com/mitchellh/packer/packer/post_processor.go b/vendor/github.com/mitchellh/packer/packer/post_processor.go
deleted file mode 100644
index 3def4a0d..00000000
--- a/vendor/github.com/mitchellh/packer/packer/post_processor.go
+++ /dev/null
@@ -1,18 +0,0 @@
-package packer
-
-// A PostProcessor is responsible for taking an artifact of a build
-// and doing some sort of post-processing to turn this into another
-// artifact. An example of a post-processor would be something that takes
-// the result of a build, compresses it, and returns a new artifact containing
-// a single file of the prior artifact compressed.
-type PostProcessor interface {
- // Configure is responsible for setting up configuration, storing
- // the state for later, and returning and errors, such as validation
- // errors.
- Configure(...interface{}) error
-
- // PostProcess takes a previously created Artifact and produces another
- // Artifact. If an error occurs, it should return that error. If `keep`
- // is to true, then the previous artifact is forcibly kept.
- PostProcess(Ui, Artifact) (a Artifact, keep bool, err error)
-}
diff --git a/vendor/github.com/mitchellh/packer/packer/post_processor_mock.go b/vendor/github.com/mitchellh/packer/packer/post_processor_mock.go
deleted file mode 100644
index 591e4b87..00000000
--- a/vendor/github.com/mitchellh/packer/packer/post_processor_mock.go
+++ /dev/null
@@ -1,33 +0,0 @@
-package packer
-
-// MockPostProcessor is an implementation of PostProcessor that can be
-// used for tests.
-type MockPostProcessor struct {
- ArtifactId string
- Keep bool
- Error error
-
- ConfigureCalled bool
- ConfigureConfigs []interface{}
- ConfigureError error
-
- PostProcessCalled bool
- PostProcessArtifact Artifact
- PostProcessUi Ui
-}
-
-func (t *MockPostProcessor) Configure(configs ...interface{}) error {
- t.ConfigureCalled = true
- t.ConfigureConfigs = configs
- return t.ConfigureError
-}
-
-func (t *MockPostProcessor) PostProcess(ui Ui, a Artifact) (Artifact, bool, error) {
- t.PostProcessCalled = true
- t.PostProcessArtifact = a
- t.PostProcessUi = ui
-
- return &MockArtifact{
- IdValue: t.ArtifactId,
- }, t.Keep, t.Error
-}
diff --git a/vendor/github.com/mitchellh/packer/packer/provisioner.go b/vendor/github.com/mitchellh/packer/packer/provisioner.go
deleted file mode 100644
index f4f3fce1..00000000
--- a/vendor/github.com/mitchellh/packer/packer/provisioner.go
+++ /dev/null
@@ -1,158 +0,0 @@
-package packer
-
-import (
- "fmt"
- "sync"
- "time"
-)
-
-// A provisioner is responsible for installing and configuring software
-// on a machine prior to building the actual image.
-type Provisioner interface {
- // Prepare is called with a set of configurations to setup the
- // internal state of the provisioner. The multiple configurations
- // should be merged in some sane way.
- Prepare(...interface{}) error
-
- // Provision is called to actually provision the machine. A UI is
- // given to communicate with the user, and a communicator is given that
- // is guaranteed to be connected to some machine so that provisioning
- // can be done.
- Provision(Ui, Communicator) error
-
- // Cancel is called to cancel the provisioning. This is usually called
- // while Provision is still being called. The Provisioner should act
- // to stop its execution as quickly as possible in a race-free way.
- Cancel()
-}
-
-// A Hook implementation that runs the given provisioners.
-type ProvisionHook struct {
- // The provisioners to run as part of the hook. These should already
- // be prepared (by calling Prepare) at some earlier stage.
- Provisioners []Provisioner
-
- lock sync.Mutex
- runningProvisioner Provisioner
-}
-
-// Runs the provisioners in order.
-func (h *ProvisionHook) Run(name string, ui Ui, comm Communicator, data interface{}) error {
- // Shortcut
- if len(h.Provisioners) == 0 {
- return nil
- }
-
- if comm == nil {
- return fmt.Errorf(
- "No communicator found for provisioners! This is usually because the\n" +
- "`communicator` config was set to \"none\". If you have any provisioners\n" +
- "then a communicator is required. Please fix this to continue.")
- }
-
- defer func() {
- h.lock.Lock()
- defer h.lock.Unlock()
-
- h.runningProvisioner = nil
- }()
-
- for _, p := range h.Provisioners {
- h.lock.Lock()
- h.runningProvisioner = p
- h.lock.Unlock()
-
- if err := p.Provision(ui, comm); err != nil {
- return err
- }
- }
-
- return nil
-}
-
-// Cancels the privisioners that are still running.
-func (h *ProvisionHook) Cancel() {
- h.lock.Lock()
- defer h.lock.Unlock()
-
- if h.runningProvisioner != nil {
- h.runningProvisioner.Cancel()
- }
-}
-
-// PausedProvisioner is a Provisioner implementation that pauses before
-// the provisioner is actually run.
-type PausedProvisioner struct {
- PauseBefore time.Duration
- Provisioner Provisioner
-
- cancelCh chan struct{}
- doneCh chan struct{}
- lock sync.Mutex
-}
-
-func (p *PausedProvisioner) Prepare(raws ...interface{}) error {
- return p.Provisioner.Prepare(raws...)
-}
-
-func (p *PausedProvisioner) Provision(ui Ui, comm Communicator) error {
- p.lock.Lock()
- cancelCh := make(chan struct{})
- p.cancelCh = cancelCh
-
- // Setup the done channel, which is trigger when we're done
- doneCh := make(chan struct{})
- defer close(doneCh)
- p.doneCh = doneCh
- p.lock.Unlock()
-
- defer func() {
- p.lock.Lock()
- defer p.lock.Unlock()
- if p.cancelCh == cancelCh {
- p.cancelCh = nil
- }
- if p.doneCh == doneCh {
- p.doneCh = nil
- }
- }()
-
- // Use a select to determine if we get cancelled during the wait
- ui.Say(fmt.Sprintf("Pausing %s before the next provisioner...", p.PauseBefore))
- select {
- case <-time.After(p.PauseBefore):
- case <-cancelCh:
- return nil
- }
-
- provDoneCh := make(chan error, 1)
- go p.provision(provDoneCh, ui, comm)
-
- select {
- case err := <-provDoneCh:
- return err
- case <-cancelCh:
- p.Provisioner.Cancel()
- return <-provDoneCh
- }
-}
-
-func (p *PausedProvisioner) Cancel() {
- var doneCh chan struct{}
-
- p.lock.Lock()
- if p.cancelCh != nil {
- close(p.cancelCh)
- p.cancelCh = nil
- }
- if p.doneCh != nil {
- doneCh = p.doneCh
- }
- p.lock.Unlock()
-
- <-doneCh
-}
-
-func (p *PausedProvisioner) provision(result chan<- error, ui Ui, comm Communicator) {
- result <- p.Provisioner.Provision(ui, comm)
-}
diff --git a/vendor/github.com/mitchellh/packer/packer/provisioner_mock.go b/vendor/github.com/mitchellh/packer/packer/provisioner_mock.go
deleted file mode 100644
index 62b304cc..00000000
--- a/vendor/github.com/mitchellh/packer/packer/provisioner_mock.go
+++ /dev/null
@@ -1,36 +0,0 @@
-package packer
-
-// MockProvisioner is an implementation of Provisioner that can be
-// used for tests.
-type MockProvisioner struct {
- ProvFunc func() error
-
- PrepCalled bool
- PrepConfigs []interface{}
- ProvCalled bool
- ProvCommunicator Communicator
- ProvUi Ui
- CancelCalled bool
-}
-
-func (t *MockProvisioner) Prepare(configs ...interface{}) error {
- t.PrepCalled = true
- t.PrepConfigs = configs
- return nil
-}
-
-func (t *MockProvisioner) Provision(ui Ui, comm Communicator) error {
- t.ProvCalled = true
- t.ProvCommunicator = comm
- t.ProvUi = ui
-
- if t.ProvFunc == nil {
- return nil
- }
-
- return t.ProvFunc()
-}
-
-func (t *MockProvisioner) Cancel() {
- t.CancelCalled = true
-}
diff --git a/vendor/github.com/mitchellh/packer/packer/rpc/artifact.go b/vendor/github.com/mitchellh/packer/packer/rpc/artifact.go
deleted file mode 100644
index 3532cfba..00000000
--- a/vendor/github.com/mitchellh/packer/packer/rpc/artifact.go
+++ /dev/null
@@ -1,88 +0,0 @@
-package rpc
-
-import (
- "github.com/mitchellh/packer/packer"
- "net/rpc"
-)
-
-// An implementation of packer.Artifact where the artifact is actually
-// available over an RPC connection.
-type artifact struct {
- client *rpc.Client
- endpoint string
-}
-
-// ArtifactServer wraps a packer.Artifact implementation and makes it
-// exportable as part of a Golang RPC server.
-type ArtifactServer struct {
- artifact packer.Artifact
-}
-
-func (a *artifact) BuilderId() (result string) {
- a.client.Call(a.endpoint+".BuilderId", new(interface{}), &result)
- return
-}
-
-func (a *artifact) Files() (result []string) {
- a.client.Call(a.endpoint+".Files", new(interface{}), &result)
- return
-}
-
-func (a *artifact) Id() (result string) {
- a.client.Call(a.endpoint+".Id", new(interface{}), &result)
- return
-}
-
-func (a *artifact) String() (result string) {
- a.client.Call(a.endpoint+".String", new(interface{}), &result)
- return
-}
-
-func (a *artifact) State(name string) (result interface{}) {
- a.client.Call(a.endpoint+".State", name, &result)
- return
-}
-
-func (a *artifact) Destroy() error {
- var result error
- if err := a.client.Call(a.endpoint+".Destroy", new(interface{}), &result); err != nil {
- return err
- }
-
- return result
-}
-
-func (s *ArtifactServer) BuilderId(args *interface{}, reply *string) error {
- *reply = s.artifact.BuilderId()
- return nil
-}
-
-func (s *ArtifactServer) Files(args *interface{}, reply *[]string) error {
- *reply = s.artifact.Files()
- return nil
-}
-
-func (s *ArtifactServer) Id(args *interface{}, reply *string) error {
- *reply = s.artifact.Id()
- return nil
-}
-
-func (s *ArtifactServer) String(args *interface{}, reply *string) error {
- *reply = s.artifact.String()
- return nil
-}
-
-func (s *ArtifactServer) State(name string, reply *interface{}) error {
- *reply = s.artifact.State(name)
- return nil
-}
-
-func (s *ArtifactServer) Destroy(args *interface{}, reply *error) error {
- err := s.artifact.Destroy()
- if err != nil {
- err = NewBasicError(err)
- }
-
- *reply = err
- return nil
-}
diff --git a/vendor/github.com/mitchellh/packer/packer/rpc/build.go b/vendor/github.com/mitchellh/packer/packer/rpc/build.go
deleted file mode 100644
index 4d0b7edf..00000000
--- a/vendor/github.com/mitchellh/packer/packer/rpc/build.go
+++ /dev/null
@@ -1,140 +0,0 @@
-package rpc
-
-import (
- "github.com/mitchellh/packer/packer"
- "net/rpc"
-)
-
-// An implementation of packer.Build where the build is actually executed
-// over an RPC connection.
-type build struct {
- client *rpc.Client
- mux *muxBroker
-}
-
-// BuildServer wraps a packer.Build implementation and makes it exportable
-// as part of a Golang RPC server.
-type BuildServer struct {
- build packer.Build
- mux *muxBroker
-}
-
-type BuildPrepareResponse struct {
- Warnings []string
- Error *BasicError
-}
-
-func (b *build) Name() (result string) {
- b.client.Call("Build.Name", new(interface{}), &result)
- return
-}
-
-func (b *build) Prepare() ([]string, error) {
- var resp BuildPrepareResponse
- if cerr := b.client.Call("Build.Prepare", new(interface{}), &resp); cerr != nil {
- return nil, cerr
- }
- var err error = nil
- if resp.Error != nil {
- err = resp.Error
- }
-
- return resp.Warnings, err
-}
-
-func (b *build) Run(ui packer.Ui, cache packer.Cache) ([]packer.Artifact, error) {
- nextId := b.mux.NextId()
- server := newServerWithMux(b.mux, nextId)
- server.RegisterCache(cache)
- server.RegisterUi(ui)
- go server.Serve()
-
- var result []uint32
- if err := b.client.Call("Build.Run", nextId, &result); err != nil {
- return nil, err
- }
-
- artifacts := make([]packer.Artifact, len(result))
- for i, streamId := range result {
- client, err := newClientWithMux(b.mux, streamId)
- if err != nil {
- return nil, err
- }
-
- artifacts[i] = client.Artifact()
- }
-
- return artifacts, nil
-}
-
-func (b *build) SetDebug(val bool) {
- if err := b.client.Call("Build.SetDebug", val, new(interface{})); err != nil {
- panic(err)
- }
-}
-
-func (b *build) SetForce(val bool) {
- if err := b.client.Call("Build.SetForce", val, new(interface{})); err != nil {
- panic(err)
- }
-}
-
-func (b *build) Cancel() {
- if err := b.client.Call("Build.Cancel", new(interface{}), new(interface{})); err != nil {
- panic(err)
- }
-}
-
-func (b *BuildServer) Name(args *interface{}, reply *string) error {
- *reply = b.build.Name()
- return nil
-}
-
-func (b *BuildServer) Prepare(args *interface{}, resp *BuildPrepareResponse) error {
- warnings, err := b.build.Prepare()
- *resp = BuildPrepareResponse{
- Warnings: warnings,
- Error: NewBasicError(err),
- }
- return nil
-}
-
-func (b *BuildServer) Run(streamId uint32, reply *[]uint32) error {
- client, err := newClientWithMux(b.mux, streamId)
- if err != nil {
- return NewBasicError(err)
- }
- defer client.Close()
-
- artifacts, err := b.build.Run(client.Ui(), client.Cache())
- if err != nil {
- return NewBasicError(err)
- }
-
- *reply = make([]uint32, len(artifacts))
- for i, artifact := range artifacts {
- streamId := b.mux.NextId()
- server := newServerWithMux(b.mux, streamId)
- server.RegisterArtifact(artifact)
- go server.Serve()
-
- (*reply)[i] = streamId
- }
-
- return nil
-}
-
-func (b *BuildServer) SetDebug(val *bool, reply *interface{}) error {
- b.build.SetDebug(*val)
- return nil
-}
-
-func (b *BuildServer) SetForce(val *bool, reply *interface{}) error {
- b.build.SetForce(*val)
- return nil
-}
-
-func (b *BuildServer) Cancel(args *interface{}, reply *interface{}) error {
- b.build.Cancel()
- return nil
-}
diff --git a/vendor/github.com/mitchellh/packer/packer/rpc/builder.go b/vendor/github.com/mitchellh/packer/packer/rpc/builder.go
deleted file mode 100644
index 0e2464bd..00000000
--- a/vendor/github.com/mitchellh/packer/packer/rpc/builder.go
+++ /dev/null
@@ -1,113 +0,0 @@
-package rpc
-
-import (
- "github.com/mitchellh/packer/packer"
- "log"
- "net/rpc"
-)
-
-// An implementation of packer.Builder where the builder is actually executed
-// over an RPC connection.
-type builder struct {
- client *rpc.Client
- mux *muxBroker
-}
-
-// BuilderServer wraps a packer.Builder implementation and makes it exportable
-// as part of a Golang RPC server.
-type BuilderServer struct {
- builder packer.Builder
- mux *muxBroker
-}
-
-type BuilderPrepareArgs struct {
- Configs []interface{}
-}
-
-type BuilderPrepareResponse struct {
- Warnings []string
- Error *BasicError
-}
-
-func (b *builder) Prepare(config ...interface{}) ([]string, error) {
- var resp BuilderPrepareResponse
- cerr := b.client.Call("Builder.Prepare", &BuilderPrepareArgs{config}, &resp)
- if cerr != nil {
- return nil, cerr
- }
- var err error = nil
- if resp.Error != nil {
- err = resp.Error
- }
-
- return resp.Warnings, err
-}
-
-func (b *builder) Run(ui packer.Ui, hook packer.Hook, cache packer.Cache) (packer.Artifact, error) {
- nextId := b.mux.NextId()
- server := newServerWithMux(b.mux, nextId)
- server.RegisterCache(cache)
- server.RegisterHook(hook)
- server.RegisterUi(ui)
- go server.Serve()
-
- var responseId uint32
- if err := b.client.Call("Builder.Run", nextId, &responseId); err != nil {
- return nil, err
- }
-
- if responseId == 0 {
- return nil, nil
- }
-
- client, err := newClientWithMux(b.mux, responseId)
- if err != nil {
- return nil, err
- }
-
- return client.Artifact(), nil
-}
-
-func (b *builder) Cancel() {
- if err := b.client.Call("Builder.Cancel", new(interface{}), new(interface{})); err != nil {
- log.Printf("Error cancelling builder: %s", err)
- }
-}
-
-func (b *BuilderServer) Prepare(args *BuilderPrepareArgs, reply *BuilderPrepareResponse) error {
- warnings, err := b.builder.Prepare(args.Configs...)
- *reply = BuilderPrepareResponse{
- Warnings: warnings,
- Error: NewBasicError(err),
- }
- return nil
-}
-
-func (b *BuilderServer) Run(streamId uint32, reply *uint32) error {
- client, err := newClientWithMux(b.mux, streamId)
- if err != nil {
- return NewBasicError(err)
- }
- defer client.Close()
-
- artifact, err := b.builder.Run(client.Ui(), client.Hook(), client.Cache())
- if err != nil {
- return NewBasicError(err)
- }
-
- *reply = 0
- if artifact != nil {
- streamId = b.mux.NextId()
- server := newServerWithMux(b.mux, streamId)
- server.RegisterArtifact(artifact)
- go server.Serve()
- *reply = streamId
- }
-
- return nil
-}
-
-func (b *BuilderServer) Cancel(args *interface{}, reply *interface{}) error {
- b.builder.Cancel()
- return nil
-}
diff --git a/vendor/github.com/mitchellh/packer/packer/rpc/cache.go b/vendor/github.com/mitchellh/packer/packer/rpc/cache.go
deleted file mode 100644
index a4539ae6..00000000
--- a/vendor/github.com/mitchellh/packer/packer/rpc/cache.go
+++ /dev/null
@@ -1,78 +0,0 @@
-package rpc
-
-import (
- "github.com/mitchellh/packer/packer"
- "log"
- "net/rpc"
-)
-
-// An implementation of packer.Cache where the cache is actually executed
-// over an RPC connection.
-type cache struct {
- client *rpc.Client
-}
-
-// CacheServer wraps a packer.Cache implementation and makes it exportable
-// as part of a Golang RPC server.
-type CacheServer struct {
- cache packer.Cache
-}
-
-type CacheRLockResponse struct {
- Path string
- Exists bool
-}
-
-func (c *cache) Lock(key string) (result string) {
- if err := c.client.Call("Cache.Lock", key, &result); err != nil {
- log.Printf("[ERR] Cache.Lock error: %s", err)
- return
- }
-
- return
-}
-
-func (c *cache) RLock(key string) (string, bool) {
- var result CacheRLockResponse
- if err := c.client.Call("Cache.RLock", key, &result); err != nil {
- log.Printf("[ERR] Cache.RLock error: %s", err)
- return "", false
- }
-
- return result.Path, result.Exists
-}
-
-func (c *cache) Unlock(key string) {
- if err := c.client.Call("Cache.Unlock", key, new(interface{})); err != nil {
- log.Printf("[ERR] Cache.Unlock error: %s", err)
- return
- }
-}
-
-func (c *cache) RUnlock(key string) {
- if err := c.client.Call("Cache.RUnlock", key, new(interface{})); err != nil {
- log.Printf("[ERR] Cache.RUnlock error: %s", err)
- return
- }
-}
-
-func (c *CacheServer) Lock(key string, result *string) error {
- *result = c.cache.Lock(key)
- return nil
-}
-
-func (c *CacheServer) Unlock(key string, result *interface{}) error {
- c.cache.Unlock(key)
- return nil
-}
-
-func (c *CacheServer) RLock(key string, result *CacheRLockResponse) error {
- path, exists := c.cache.RLock(key)
- *result = CacheRLockResponse{path, exists}
- return nil
-}
-
-func (c *CacheServer) RUnlock(key string, result *interface{}) error {
- c.cache.RUnlock(key)
- return nil
-}
diff --git a/vendor/github.com/mitchellh/packer/packer/rpc/client.go b/vendor/github.com/mitchellh/packer/packer/rpc/client.go
deleted file mode 100644
index 85d1ff55..00000000
--- a/vendor/github.com/mitchellh/packer/packer/rpc/client.go
+++ /dev/null
@@ -1,130 +0,0 @@
-package rpc
-
-import (
- "io"
- "log"
- "net/rpc"
-
- "github.com/mitchellh/packer/packer"
- "github.com/ugorji/go/codec"
-)
-
-// Client is the client end that communicates with a Packer RPC server.
-// Establishing a connection is up to the user, the Client can just
-// communicate over any ReadWriteCloser.
-type Client struct {
- mux *muxBroker
- client *rpc.Client
- closeMux bool
-}
-
-func NewClient(rwc io.ReadWriteCloser) (*Client, error) {
- mux, err := newMuxBrokerClient(rwc)
- if err != nil {
- return nil, err
- }
- go mux.Run()
-
- result, err := newClientWithMux(mux, 0)
- if err != nil {
- mux.Close()
- return nil, err
- }
-
- result.closeMux = true
- return result, err
-}
-
-func newClientWithMux(mux *muxBroker, streamId uint32) (*Client, error) {
- clientConn, err := mux.Dial(streamId)
- if err != nil {
- return nil, err
- }
-
- h := &codec.MsgpackHandle{
- RawToString: true,
- WriteExt: true,
- }
- clientCodec := codec.GoRpc.ClientCodec(clientConn, h)
-
- return &Client{
- mux: mux,
- client: rpc.NewClientWithCodec(clientCodec),
- closeMux: false,
- }, nil
-}
-
-func (c *Client) Close() error {
- if err := c.client.Close(); err != nil {
- return err
- }
-
- if c.closeMux {
- log.Printf("[WARN] Client is closing mux")
- return c.mux.Close()
- }
-
- return nil
-}
-
-func (c *Client) Artifact() packer.Artifact {
- return &artifact{
- client: c.client,
- endpoint: DefaultArtifactEndpoint,
- }
-}
-
-func (c *Client) Build() packer.Build {
- return &build{
- client: c.client,
- mux: c.mux,
- }
-}
-
-func (c *Client) Builder() packer.Builder {
- return &builder{
- client: c.client,
- mux: c.mux,
- }
-}
-
-func (c *Client) Cache() packer.Cache {
- return &cache{
- client: c.client,
- }
-}
-
-func (c *Client) Communicator() packer.Communicator {
- return &communicator{
- client: c.client,
- mux: c.mux,
- }
-}
-
-func (c *Client) Hook() packer.Hook {
- return &hook{
- client: c.client,
- mux: c.mux,
- }
-}
-
-func (c *Client) PostProcessor() packer.PostProcessor {
- return &postProcessor{
- client: c.client,
- mux: c.mux,
- }
-}
-
-func (c *Client) Provisioner() packer.Provisioner {
- return &provisioner{
- client: c.client,
- mux: c.mux,
- }
-}
-
-func (c *Client) Ui() packer.Ui {
- return &Ui{
- client: c.client,
- endpoint: DefaultUiEndpoint,
- }
-}
diff --git a/vendor/github.com/mitchellh/packer/packer/rpc/communicator.go b/vendor/github.com/mitchellh/packer/packer/rpc/communicator.go
deleted file mode 100644
index 8e1852cf..00000000
--- a/vendor/github.com/mitchellh/packer/packer/rpc/communicator.go
+++ /dev/null
@@ -1,316 +0,0 @@
-package rpc
-
-import (
- "encoding/gob"
- "io"
- "log"
- "net/rpc"
- "os"
-
- "github.com/mitchellh/packer/packer"
-)
-
-// An implementation of packer.Communicator where the communicator is actually
-// executed over an RPC connection.
-type communicator struct {
- client *rpc.Client
- mux *muxBroker
-}
-
-// CommunicatorServer wraps a packer.Communicator implementation and makes
-// it exportable as part of a Golang RPC server.
-type CommunicatorServer struct {
- c packer.Communicator
- mux *muxBroker
-}
-
-type CommandFinished struct {
- ExitStatus int
-}
-
-type CommunicatorStartArgs struct {
- Command string
- StdinStreamId uint32
- StdoutStreamId uint32
- StderrStreamId uint32
- ResponseStreamId uint32
-}
-
-type CommunicatorDownloadArgs struct {
- Path string
- WriterStreamId uint32
-}
-
-type CommunicatorUploadArgs struct {
- Path string
- ReaderStreamId uint32
-}
-
-type CommunicatorUploadDirArgs struct {
- Dst string
- Src string
- Exclude []string
-}
-
-type CommunicatorDownloadDirArgs struct {
- Dst string
- Src string
- Exclude []string
-}
-
-func Communicator(client *rpc.Client) *communicator {
- return &communicator{client: client}
-}
-
-func (c *communicator) Start(cmd *packer.RemoteCmd) (err error) {
- var args CommunicatorStartArgs
- args.Command = cmd.Command
-
- if cmd.Stdin != nil {
- args.StdinStreamId = c.mux.NextId()
- go serveSingleCopy("stdin", c.mux, args.StdinStreamId, nil, cmd.Stdin)
- }
-
- if cmd.Stdout != nil {
- args.StdoutStreamId = c.mux.NextId()
- go serveSingleCopy("stdout", c.mux, args.StdoutStreamId, cmd.Stdout, nil)
- }
-
- if cmd.Stderr != nil {
- args.StderrStreamId = c.mux.NextId()
- go serveSingleCopy("stderr", c.mux, args.StderrStreamId, cmd.Stderr, nil)
- }
-
- responseStreamId := c.mux.NextId()
- args.ResponseStreamId = responseStreamId
-
- go func() {
- conn, err := c.mux.Accept(responseStreamId)
- if err != nil {
- log.Printf("[ERR] Error accepting response stream %d: %s",
- responseStreamId, err)
- cmd.SetExited(123)
- return
- }
- defer conn.Close()
-
- var finished CommandFinished
- decoder := gob.NewDecoder(conn)
- if err := decoder.Decode(&finished); err != nil {
- log.Printf("[ERR] Error decoding response stream %d: %s",
- responseStreamId, err)
- cmd.SetExited(123)
- return
- }
-
- log.Printf("[INFO] RPC client: Communicator ended with: %d", finished.ExitStatus)
- cmd.SetExited(finished.ExitStatus)
- }()
-
- err = c.client.Call("Communicator.Start", &args, new(interface{}))
- return
-}
-
-func (c *communicator) Upload(path string, r io.Reader, fi *os.FileInfo) (err error) {
- // Pipe the reader through to the connection
- streamId := c.mux.NextId()
- go serveSingleCopy("uploadData", c.mux, streamId, nil, r)
-
- args := CommunicatorUploadArgs{
- Path: path,
- ReaderStreamId: streamId,
- }
-
- err = c.client.Call("Communicator.Upload", &args, new(interface{}))
- return
-}
-
-func (c *communicator) UploadDir(dst string, src string, exclude []string) error {
- args := &CommunicatorUploadDirArgs{
- Dst: dst,
- Src: src,
- Exclude: exclude,
- }
-
- var reply error
- err := c.client.Call("Communicator.UploadDir", args, &reply)
- if err == nil {
- err = reply
- }
-
- return err
-}
-
-func (c *communicator) DownloadDir(src string, dst string, exclude []string) error {
- args := &CommunicatorDownloadDirArgs{
- Dst: dst,
- Src: src,
- Exclude: exclude,
- }
-
- var reply error
- err := c.client.Call("Communicator.DownloadDir", args, &reply)
- if err == nil {
- err = reply
- }
-
- return err
-}
-
-func (c *communicator) Download(path string, w io.Writer) (err error) {
- // Serve a single connection and a single copy
- streamId := c.mux.NextId()
-
- waitServer := make(chan struct{})
- go func() {
- serveSingleCopy("downloadWriter", c.mux, streamId, w, nil)
- close(waitServer)
- }()
-
- args := CommunicatorDownloadArgs{
- Path: path,
- WriterStreamId: streamId,
- }
-
- // Start sending data to the RPC server
- err = c.client.Call("Communicator.Download", &args, new(interface{}))
-
- // Wait for the RPC server to finish receiving the data before we return
- <-waitServer
-
- return
-}
-
-func (c *CommunicatorServer) Start(args *CommunicatorStartArgs, reply *interface{}) error {
- // Build the RemoteCmd on this side so that it all pipes over
- // to the remote side.
- var cmd packer.RemoteCmd
- cmd.Command = args.Command
-
- // Create a channel to signal we're done so that we can close
- // our stdin/stdout/stderr streams
- toClose := make([]io.Closer, 0)
- doneCh := make(chan struct{})
- go func() {
- <-doneCh
- for _, conn := range toClose {
- defer conn.Close()
- }
- }()
-
- if args.StdinStreamId > 0 {
- conn, err := c.mux.Dial(args.StdinStreamId)
- if err != nil {
- close(doneCh)
- return NewBasicError(err)
- }
-
- toClose = append(toClose, conn)
- cmd.Stdin = conn
- }
-
- if args.StdoutStreamId > 0 {
- conn, err := c.mux.Dial(args.StdoutStreamId)
- if err != nil {
- close(doneCh)
- return NewBasicError(err)
- }
-
- toClose = append(toClose, conn)
- cmd.Stdout = conn
- }
-
- if args.StderrStreamId > 0 {
- conn, err := c.mux.Dial(args.StderrStreamId)
- if err != nil {
- close(doneCh)
- return NewBasicError(err)
- }
-
- toClose = append(toClose, conn)
- cmd.Stderr = conn
- }
-
- // Connect to the response address so we can write our result to it
- // when ready.
- responseC, err := c.mux.Dial(args.ResponseStreamId)
- if err != nil {
- close(doneCh)
- return NewBasicError(err)
- }
- responseWriter := gob.NewEncoder(responseC)
-
- // Start the actual command
- err = c.c.Start(&cmd)
- if err != nil {
- close(doneCh)
- return NewBasicError(err)
- }
-
- // Start a goroutine to spin and wait for the process to actual
- // exit. When it does, report it back to caller...
- go func() {
- defer close(doneCh)
- defer responseC.Close()
- cmd.Wait()
- log.Printf("[INFO] RPC endpoint: Communicator ended with: %d", cmd.ExitStatus)
- responseWriter.Encode(&CommandFinished{cmd.ExitStatus})
- }()
-
- return nil
-}
-
-func (c *CommunicatorServer) Upload(args *CommunicatorUploadArgs, reply *interface{}) (err error) {
- readerC, err := c.mux.Dial(args.ReaderStreamId)
- if err != nil {
- return
- }
- defer readerC.Close()
-
- err = c.c.Upload(args.Path, readerC, nil)
- return
-}
-
-func (c *CommunicatorServer) UploadDir(args *CommunicatorUploadDirArgs, reply *error) error {
- return c.c.UploadDir(args.Dst, args.Src, args.Exclude)
-}
-
-func (c *CommunicatorServer) DownloadDir(args *CommunicatorUploadDirArgs, reply *error) error {
- return c.c.DownloadDir(args.Src, args.Dst, args.Exclude)
-}
-
-func (c *CommunicatorServer) Download(args *CommunicatorDownloadArgs, reply *interface{}) (err error) {
- writerC, err := c.mux.Dial(args.WriterStreamId)
- if err != nil {
- return
- }
- defer writerC.Close()
-
- err = c.c.Download(args.Path, writerC)
- return
-}
-
-func serveSingleCopy(name string, mux *muxBroker, id uint32, dst io.Writer, src io.Reader) {
- conn, err := mux.Accept(id)
- if err != nil {
- log.Printf("[ERR] '%s' accept error: %s", name, err)
- return
- }
-
- // Be sure to close the connection after we're done copying so
- // that an EOF will successfully be sent to the remote side
- defer conn.Close()
-
- // The connection is the destination/source that is nil
- if dst == nil {
- dst = conn
- } else {
- src = conn
- }
-
- written, err := io.Copy(dst, src)
- log.Printf("[INFO] %d bytes written for '%s'", written, name)
- if err != nil {
- log.Printf("[ERR] '%s' copy error: %s", name, err)
- }
-}
diff --git a/vendor/github.com/mitchellh/packer/packer/rpc/dial.go b/vendor/github.com/mitchellh/packer/packer/rpc/dial.go
deleted file mode 100644
index 10e2cad1..00000000
--- a/vendor/github.com/mitchellh/packer/packer/rpc/dial.go
+++ /dev/null
@@ -1,33 +0,0 @@
-package rpc
-
-import (
- "net"
- "net/rpc"
-)
-
-// rpcDial makes a TCP connection to a remote RPC server and returns
-// the client. This will set the connection up properly so that keep-alives
-// are set and so on and should be used to make all RPC connections within
-// this package.
-func rpcDial(address string) (*rpc.Client, error) {
- tcpConn, err := tcpDial(address)
- if err != nil {
- return nil, err
- }
-
- // Create an RPC client around our connection
- return rpc.NewClient(tcpConn), nil
-}
-
-// tcpDial connects via TCP to the designated address.
-func tcpDial(address string) (*net.TCPConn, error) {
- conn, err := net.Dial("tcp", address)
- if err != nil {
- return nil, err
- }
-
- // Set a keep-alive so that the connection stays alive even when idle
- tcpConn := conn.(*net.TCPConn)
- tcpConn.SetKeepAlive(true)
- return tcpConn, nil
-}
diff --git a/vendor/github.com/mitchellh/packer/packer/rpc/error.go b/vendor/github.com/mitchellh/packer/packer/rpc/error.go
deleted file mode 100644
index c3ab7b1a..00000000
--- a/vendor/github.com/mitchellh/packer/packer/rpc/error.go
+++ /dev/null
@@ -1,21 +0,0 @@
-package rpc
-
-// This is a type that wraps error types so that they can be messaged
-// across RPC channels. Since "error" is an interface, we can't always
-// gob-encode the underlying structure. This is a valid error interface
-// implementer that we will push across.
-type BasicError struct {
- Message string
-}
-
-func NewBasicError(err error) *BasicError {
- if err == nil {
- return nil
- }
-
- return &BasicError{err.Error()}
-}
-
-func (e *BasicError) Error() string {
- return e.Message
-}
diff --git a/vendor/github.com/mitchellh/packer/packer/rpc/hook.go b/vendor/github.com/mitchellh/packer/packer/rpc/hook.go
deleted file mode 100644
index 4aa7d75b..00000000
--- a/vendor/github.com/mitchellh/packer/packer/rpc/hook.go
+++ /dev/null
@@ -1,70 +0,0 @@
-package rpc
-
-import (
- "github.com/mitchellh/packer/packer"
- "log"
- "net/rpc"
-)
-
-// An implementation of packer.Hook where the hook is actually executed
-// over an RPC connection.
-type hook struct {
- client *rpc.Client
- mux *muxBroker
-}
-
-// HookServer wraps a packer.Hook implementation and makes it exportable
-// as part of a Golang RPC server.
-type HookServer struct {
- hook packer.Hook
- mux *muxBroker
-}
-
-type HookRunArgs struct {
- Name string
- Data interface{}
- StreamId uint32
-}
-
-func (h *hook) Run(name string, ui packer.Ui, comm packer.Communicator, data interface{}) error {
- nextId := h.mux.NextId()
- server := newServerWithMux(h.mux, nextId)
- server.RegisterCommunicator(comm)
- server.RegisterUi(ui)
- go server.Serve()
-
- args := HookRunArgs{
- Name: name,
- Data: data,
- StreamId: nextId,
- }
-
- return h.client.Call("Hook.Run", &args, new(interface{}))
-}
-
-func (h *hook) Cancel() {
- err := h.client.Call("Hook.Cancel", new(interface{}), new(interface{}))
- if err != nil {
- log.Printf("Hook.Cancel error: %s", err)
- }
-}
-
-func (h *HookServer) Run(args *HookRunArgs, reply *interface{}) error {
- client, err := newClientWithMux(h.mux, args.StreamId)
- if err != nil {
- return NewBasicError(err)
- }
- defer client.Close()
-
- if err := h.hook.Run(args.Name, client.Ui(), client.Communicator(), args.Data); err != nil {
- return NewBasicError(err)
- }
-
- *reply = nil
- return nil
-}
-
-func (h *HookServer) Cancel(args *interface{}, reply *interface{}) error {
- h.hook.Cancel()
- return nil
-}
diff --git a/vendor/github.com/mitchellh/packer/packer/rpc/init.go b/vendor/github.com/mitchellh/packer/packer/rpc/init.go
deleted file mode 100644
index 2d763d83..00000000
--- a/vendor/github.com/mitchellh/packer/packer/rpc/init.go
+++ /dev/null
@@ -1,10 +0,0 @@
-package rpc
-
-import "encoding/gob"
-
-func init() {
- gob.Register(new(map[string]interface{}))
- gob.Register(new(map[string]string))
- gob.Register(make([]interface{}, 0))
- gob.Register(new(BasicError))
-}
diff --git a/vendor/github.com/mitchellh/packer/packer/rpc/mux_broker.go b/vendor/github.com/mitchellh/packer/packer/rpc/mux_broker.go
deleted file mode 100644
index 7af76f64..00000000
--- a/vendor/github.com/mitchellh/packer/packer/rpc/mux_broker.go
+++ /dev/null
@@ -1,191 +0,0 @@
-package rpc
-
-import (
- "encoding/binary"
- "fmt"
- "io"
- "net"
- "sync"
- "sync/atomic"
- "time"
-
- "github.com/hashicorp/yamux"
-)
-
-// muxBroker is responsible for brokering multiplexed connections by unique ID.
-//
-// This allows a plugin to request a channel with a specific ID to connect to
-// or accept a connection from, and the broker handles the details of
-// holding these channels open while they're being negotiated.
-type muxBroker struct {
- nextId uint32
- session *yamux.Session
- streams map[uint32]*muxBrokerPending
-
- sync.Mutex
-}
-
-type muxBrokerPending struct {
- ch chan net.Conn
- doneCh chan struct{}
-}
-
-func newMuxBroker(s *yamux.Session) *muxBroker {
- return &muxBroker{
- session: s,
- streams: make(map[uint32]*muxBrokerPending),
- }
-}
-
-func newMuxBrokerClient(rwc io.ReadWriteCloser) (*muxBroker, error) {
- s, err := yamux.Client(rwc, nil)
- if err != nil {
- return nil, err
- }
-
- return newMuxBroker(s), nil
-}
-
-func newMuxBrokerServer(rwc io.ReadWriteCloser) (*muxBroker, error) {
- s, err := yamux.Server(rwc, nil)
- if err != nil {
- return nil, err
- }
-
- return newMuxBroker(s), nil
-}
-
-// Accept accepts a connection by ID.
-//
-// This should not be called multiple times with the same ID at one time.
-func (m *muxBroker) Accept(id uint32) (net.Conn, error) {
- var c net.Conn
- p := m.getStream(id)
- select {
- case c = <-p.ch:
- close(p.doneCh)
- case <-time.After(5 * time.Second):
- m.Lock()
- defer m.Unlock()
- delete(m.streams, id)
-
- return nil, fmt.Errorf("timeout waiting for accept")
- }
-
- // Ack our connection
- if err := binary.Write(c, binary.LittleEndian, id); err != nil {
- c.Close()
- return nil, err
- }
-
- return c, nil
-}
-
-// Close closes the connection and all sub-connections.
-func (m *muxBroker) Close() error {
- return m.session.Close()
-}
-
-// Dial opens a connection by ID.
-func (m *muxBroker) Dial(id uint32) (net.Conn, error) {
- // Open the stream
- stream, err := m.session.OpenStream()
- if err != nil {
- return nil, err
- }
-
- // Write the stream ID onto the wire.
- if err := binary.Write(stream, binary.LittleEndian, id); err != nil {
- stream.Close()
- return nil, err
- }
-
- // Read the ack that we connected. Then we're off!
- var ack uint32
- if err := binary.Read(stream, binary.LittleEndian, &ack); err != nil {
- stream.Close()
- return nil, err
- }
- if ack != id {
- stream.Close()
- return nil, fmt.Errorf("bad ack: %d (expected %d)", ack, id)
- }
-
- return stream, nil
-}
-
-// NextId returns a unique ID to use next.
-func (m *muxBroker) NextId() uint32 {
- return atomic.AddUint32(&m.nextId, 1)
-}
-
-// Run starts the brokering and should be executed in a goroutine, since it
-// blocks forever, or until the session closes.
-func (m *muxBroker) Run() {
- for {
- stream, err := m.session.AcceptStream()
- if err != nil {
- // Once we receive an error, just exit
- break
- }
-
- // Read the stream ID from the stream
- var id uint32
- if err := binary.Read(stream, binary.LittleEndian, &id); err != nil {
- stream.Close()
- continue
- }
-
- // Initialize the waiter
- p := m.getStream(id)
- select {
- case p.ch <- stream:
- default:
- }
-
- // Wait for a timeout
- go m.timeoutWait(id, p)
- }
-}
-
-func (m *muxBroker) getStream(id uint32) *muxBrokerPending {
- m.Lock()
- defer m.Unlock()
-
- p, ok := m.streams[id]
- if ok {
- return p
- }
-
- m.streams[id] = &muxBrokerPending{
- ch: make(chan net.Conn, 1),
- doneCh: make(chan struct{}),
- }
- return m.streams[id]
-}
-
-func (m *muxBroker) timeoutWait(id uint32, p *muxBrokerPending) {
- // Wait for the stream to either be picked up and connected, or
- // for a timeout.
- timeout := false
- select {
- case <-p.doneCh:
- case <-time.After(5 * time.Second):
- timeout = true
- }
-
- m.Lock()
- defer m.Unlock()
-
- // Delete the stream so no one else can grab it
- delete(m.streams, id)
-
- // If we timed out, then check if we have a channel in the buffer,
- // and if so, close it.
- if timeout {
- select {
- case s := <-p.ch:
- s.Close()
- }
- }
-}
diff --git a/vendor/github.com/mitchellh/packer/packer/rpc/post_processor.go b/vendor/github.com/mitchellh/packer/packer/rpc/post_processor.go
deleted file mode 100644
index b183780b..00000000
--- a/vendor/github.com/mitchellh/packer/packer/rpc/post_processor.go
+++ /dev/null
@@ -1,98 +0,0 @@
-package rpc
-
-import (
- "github.com/mitchellh/packer/packer"
- "net/rpc"
-)
-
-// An implementation of packer.PostProcessor where the PostProcessor is actually
-// executed over an RPC connection.
-type postProcessor struct {
- client *rpc.Client
- mux *muxBroker
-}
-
-// PostProcessorServer wraps a packer.PostProcessor implementation and makes it
-// exportable as part of a Golang RPC server.
-type PostProcessorServer struct {
- client *rpc.Client
- mux *muxBroker
- p packer.PostProcessor
-}
-
-type PostProcessorConfigureArgs struct {
- Configs []interface{}
-}
-
-type PostProcessorProcessResponse struct {
- Err *BasicError
- Keep bool
- StreamId uint32
-}
-
-func (p *postProcessor) Configure(raw ...interface{}) (err error) {
- args := &PostProcessorConfigureArgs{Configs: raw}
- if cerr := p.client.Call("PostProcessor.Configure", args, new(interface{})); cerr != nil {
- err = cerr
- }
-
- return
-}
-
-func (p *postProcessor) PostProcess(ui packer.Ui, a packer.Artifact) (packer.Artifact, bool, error) {
- nextId := p.mux.NextId()
- server := newServerWithMux(p.mux, nextId)
- server.RegisterArtifact(a)
- server.RegisterUi(ui)
- go server.Serve()
-
- var response PostProcessorProcessResponse
- if err := p.client.Call("PostProcessor.PostProcess", nextId, &response); err != nil {
- return nil, false, err
- }
-
- if response.Err != nil {
- return nil, false, response.Err
- }
-
- if response.StreamId == 0 {
- return nil, false, nil
- }
-
- client, err := newClientWithMux(p.mux, response.StreamId)
- if err != nil {
- return nil, false, err
- }
-
- return client.Artifact(), response.Keep, nil
-}
-
-func (p *PostProcessorServer) Configure(args *PostProcessorConfigureArgs, reply *interface{}) error {
- err := p.p.Configure(args.Configs...)
- return err
-}
-
-func (p *PostProcessorServer) PostProcess(streamId uint32, reply *PostProcessorProcessResponse) error {
- client, err := newClientWithMux(p.mux, streamId)
- if err != nil {
- return NewBasicError(err)
- }
- defer client.Close()
-
- streamId = 0
- artifactResult, keep, err := p.p.PostProcess(client.Ui(), client.Artifact())
- if err == nil && artifactResult != nil {
- streamId = p.mux.NextId()
- server := newServerWithMux(p.mux, streamId)
- server.RegisterArtifact(artifactResult)
- go server.Serve()
- }
-
- *reply = PostProcessorProcessResponse{
- Err: NewBasicError(err),
- Keep: keep,
- StreamId: streamId,
- }
-
- return nil
-}
diff --git a/vendor/github.com/mitchellh/packer/packer/rpc/provisioner.go b/vendor/github.com/mitchellh/packer/packer/rpc/provisioner.go
deleted file mode 100644
index 08d31700..00000000
--- a/vendor/github.com/mitchellh/packer/packer/rpc/provisioner.go
+++ /dev/null
@@ -1,74 +0,0 @@
-package rpc
-
-import (
- "github.com/mitchellh/packer/packer"
- "log"
- "net/rpc"
-)
-
-// An implementation of packer.Provisioner where the provisioner is actually
-// executed over an RPC connection.
-type provisioner struct {
- client *rpc.Client
- mux *muxBroker
-}
-
-// ProvisionerServer wraps a packer.Provisioner implementation and makes it
-// exportable as part of a Golang RPC server.
-type ProvisionerServer struct {
- p packer.Provisioner
- mux *muxBroker
-}
-
-type ProvisionerPrepareArgs struct {
- Configs []interface{}
-}
-
-func (p *provisioner) Prepare(configs ...interface{}) (err error) {
- args := &ProvisionerPrepareArgs{configs}
- if cerr := p.client.Call("Provisioner.Prepare", args, new(interface{})); cerr != nil {
- err = cerr
- }
-
- return
-}
-
-func (p *provisioner) Provision(ui packer.Ui, comm packer.Communicator) error {
- nextId := p.mux.NextId()
- server := newServerWithMux(p.mux, nextId)
- server.RegisterCommunicator(comm)
- server.RegisterUi(ui)
- go server.Serve()
-
- return p.client.Call("Provisioner.Provision", nextId, new(interface{}))
-}
-
-func (p *provisioner) Cancel() {
- err := p.client.Call("Provisioner.Cancel", new(interface{}), new(interface{}))
- if err != nil {
- log.Printf("Provisioner.Cancel err: %s", err)
- }
-}
-
-func (p *ProvisionerServer) Prepare(args *ProvisionerPrepareArgs, reply *interface{}) error {
- return p.p.Prepare(args.Configs...)
-}
-
-func (p *ProvisionerServer) Provision(streamId uint32, reply *interface{}) error {
- client, err := newClientWithMux(p.mux, streamId)
- if err != nil {
- return NewBasicError(err)
- }
- defer client.Close()
-
- if err := p.p.Provision(client.Ui(), client.Communicator()); err != nil {
- return NewBasicError(err)
- }
-
- return nil
-}
-
-func (p *ProvisionerServer) Cancel(args *interface{}, reply *interface{}) error {
- p.p.Cancel()
- return nil
-}
diff --git a/vendor/github.com/mitchellh/packer/packer/rpc/server.go b/vendor/github.com/mitchellh/packer/packer/rpc/server.go
deleted file mode 100644
index c8277204..00000000
--- a/vendor/github.com/mitchellh/packer/packer/rpc/server.go
+++ /dev/null
@@ -1,157 +0,0 @@
-package rpc
-
-import (
- "io"
- "log"
- "net/rpc"
- "sync/atomic"
-
- "github.com/mitchellh/packer/packer"
- "github.com/ugorji/go/codec"
-)
-
-var endpointId uint64
-
-const (
- DefaultArtifactEndpoint string = "Artifact"
- DefaultBuildEndpoint = "Build"
- DefaultBuilderEndpoint = "Builder"
- DefaultCacheEndpoint = "Cache"
- DefaultCommandEndpoint = "Command"
- DefaultCommunicatorEndpoint = "Communicator"
- DefaultHookEndpoint = "Hook"
- DefaultPostProcessorEndpoint = "PostProcessor"
- DefaultProvisionerEndpoint = "Provisioner"
- DefaultUiEndpoint = "Ui"
-)
-
-// Server represents an RPC server for Packer. This must be paired on
-// the other side with a Client.
-type Server struct {
- mux *muxBroker
- streamId uint32
- server *rpc.Server
- closeMux bool
-}
-
-// NewServer returns a new Packer RPC server.
-func NewServer(conn io.ReadWriteCloser) *Server {
- mux, _ := newMuxBrokerServer(conn)
- result := newServerWithMux(mux, 0)
- result.closeMux = true
- go mux.Run()
- return result
-}
-
-func newServerWithMux(mux *muxBroker, streamId uint32) *Server {
- return &Server{
- mux: mux,
- streamId: streamId,
- server: rpc.NewServer(),
- closeMux: false,
- }
-}
-
-func (s *Server) Close() error {
- if s.closeMux {
- log.Printf("[WARN] Shutting down mux conn in Server")
- return s.mux.Close()
- }
-
- return nil
-}
-
-func (s *Server) RegisterArtifact(a packer.Artifact) {
- s.server.RegisterName(DefaultArtifactEndpoint, &ArtifactServer{
- artifact: a,
- })
-}
-
-func (s *Server) RegisterBuild(b packer.Build) {
- s.server.RegisterName(DefaultBuildEndpoint, &BuildServer{
- build: b,
- mux: s.mux,
- })
-}
-
-func (s *Server) RegisterBuilder(b packer.Builder) {
- s.server.RegisterName(DefaultBuilderEndpoint, &BuilderServer{
- builder: b,
- mux: s.mux,
- })
-}
-
-func (s *Server) RegisterCache(c packer.Cache) {
- s.server.RegisterName(DefaultCacheEndpoint, &CacheServer{
- cache: c,
- })
-}
-
-func (s *Server) RegisterCommunicator(c packer.Communicator) {
- s.server.RegisterName(DefaultCommunicatorEndpoint, &CommunicatorServer{
- c: c,
- mux: s.mux,
- })
-}
-
-func (s *Server) RegisterHook(h packer.Hook) {
- s.server.RegisterName(DefaultHookEndpoint, &HookServer{
- hook: h,
- mux: s.mux,
- })
-}
-
-func (s *Server) RegisterPostProcessor(p packer.PostProcessor) {
- s.server.RegisterName(DefaultPostProcessorEndpoint, &PostProcessorServer{
- mux: s.mux,
- p: p,
- })
-}
-
-func (s *Server) RegisterProvisioner(p packer.Provisioner) {
- s.server.RegisterName(DefaultProvisionerEndpoint, &ProvisionerServer{
- mux: s.mux,
- p: p,
- })
-}
-
-func (s *Server) RegisterUi(ui packer.Ui) {
- s.server.RegisterName(DefaultUiEndpoint, &UiServer{
- ui: ui,
- })
-}
-
-// ServeConn serves a single connection over the RPC server. It is up
-// to the caller to obtain a proper io.ReadWriteCloser.
-func (s *Server) Serve() {
- // Accept a connection on stream ID 0, which is always used for
- // normal client to server connections.
- stream, err := s.mux.Accept(s.streamId)
- if err != nil {
- log.Printf("[ERR] Error retrieving stream for serving: %s", err)
- return
- }
- defer stream.Close()
-
- h := &codec.MsgpackHandle{
- RawToString: true,
- WriteExt: true,
- }
- rpcCodec := codec.GoRpc.ServerCodec(stream, h)
- s.server.ServeCodec(rpcCodec)
-}
-
-// registerComponent registers a single Packer RPC component onto
-// the RPC server. If id is true, then a unique ID number will be appended
-// onto the end of the endpoint.
-//
-// The endpoint name is returned.
-func registerComponent(server *rpc.Server, name string, rcvr interface{}, id bool) string {
- endpoint := name
- if id {
- log.Printf("%s.%d", endpoint, atomic.AddUint64(&endpointId, 1))
- }
-
- server.RegisterName(endpoint, rcvr)
- return endpoint
-}
diff --git a/vendor/github.com/mitchellh/packer/packer/rpc/ui.go b/vendor/github.com/mitchellh/packer/packer/rpc/ui.go
deleted file mode 100644
index da032160..00000000
--- a/vendor/github.com/mitchellh/packer/packer/rpc/ui.go
+++ /dev/null
@@ -1,92 +0,0 @@
-package rpc
-
-import (
- "github.com/mitchellh/packer/packer"
- "log"
- "net/rpc"
-)
-
-// An implementation of packer.Ui where the Ui is actually executed
-// over an RPC connection.
-type Ui struct {
- client *rpc.Client
- endpoint string
-}
-
-// UiServer wraps a packer.Ui implementation and makes it exportable
-// as part of a Golang RPC server.
-type UiServer struct {
- ui packer.Ui
-}
-
-// The arguments sent to Ui.Machine
-type UiMachineArgs struct {
- Category string
- Args []string
-}
-
-func (u *Ui) Ask(query string) (result string, err error) {
- err = u.client.Call("Ui.Ask", query, &result)
- return
-}
-
-func (u *Ui) Error(message string) {
- if err := u.client.Call("Ui.Error", message, new(interface{})); err != nil {
- log.Printf("Error in Ui RPC call: %s", err)
- }
-}
-
-func (u *Ui) Machine(t string, args ...string) {
- rpcArgs := &UiMachineArgs{
- Category: t,
- Args: args,
- }
-
- if err := u.client.Call("Ui.Machine", rpcArgs, new(interface{})); err != nil {
- log.Printf("Error in Ui RPC call: %s", err)
- }
-}
-
-func (u *Ui) Message(message string) {
- if err := u.client.Call("Ui.Message", message, new(interface{})); err != nil {
- log.Printf("Error in Ui RPC call: %s", err)
- }
-}
-
-func (u *Ui) Say(message string) {
- if err := u.client.Call("Ui.Say", message, new(interface{})); err != nil {
- log.Printf("Error in Ui RPC call: %s", err)
- }
-}
-
-func (u *UiServer) Ask(query string, reply *string) (err error) {
- *reply, err = u.ui.Ask(query)
- return
-}
-
-func (u *UiServer) Error(message *string, reply *interface{}) error {
- u.ui.Error(*message)
-
- *reply = nil
- return nil
-}
-
-func (u *UiServer) Machine(args *UiMachineArgs, reply *interface{}) error {
- u.ui.Machine(args.Category, args.Args...)
-
- *reply = nil
- return nil
-}
-
-func (u *UiServer) Message(message *string, reply *interface{}) error {
- u.ui.Message(*message)
- *reply = nil
- return nil
-}
-
-func (u *UiServer) Say(message *string, reply *interface{}) error {
- u.ui.Say(*message)
-
- *reply = nil
- return nil
-}
diff --git a/vendor/github.com/mitchellh/packer/packer/testing.go b/vendor/github.com/mitchellh/packer/packer/testing.go
deleted file mode 100644
index 7217a508..00000000
--- a/vendor/github.com/mitchellh/packer/packer/testing.go
+++ /dev/null
@@ -1,90 +0,0 @@
-package packer
-
-import (
- "bytes"
- "io/ioutil"
- "testing"
-)
-
-func TestCoreConfig(t *testing.T) *CoreConfig {
- // Create some test components
- components := ComponentFinder{
- Builder: func(n string) (Builder, error) {
- if n != "test" {
- return nil, nil
- }
-
- return &MockBuilder{}, nil
- },
- }
-
- return &CoreConfig{
- Components: components,
- }
-}
-
-func TestCore(t *testing.T, c *CoreConfig) *Core {
- core, err := NewCore(c)
- if err != nil {
- t.Fatalf("err: %s", err)
- }
-
- return core
-}
-
-func TestUi(t *testing.T) Ui {
- var buf bytes.Buffer
- return &BasicUi{
- Reader: &buf,
- Writer: ioutil.Discard,
- ErrorWriter: ioutil.Discard,
- }
-}
-
-// TestBuilder sets the builder with the name n to the component finder
-// and returns the mock.
-func TestBuilder(t *testing.T, c *CoreConfig, n string) *MockBuilder {
- var b MockBuilder
-
- c.Components.Builder = func(actual string) (Builder, error) {
- if actual != n {
- return nil, nil
- }
-
- return &b, nil
- }
-
- return &b
-}
-
-// TestProvisioner sets the prov. with the name n to the component finder
-// and returns the mock.
-func TestProvisioner(t *testing.T, c *CoreConfig, n string) *MockProvisioner {
- var b MockProvisioner
-
- c.Components.Provisioner = func(actual string) (Provisioner, error) {
- if actual != n {
- return nil, nil
- }
-
- return &b, nil
- }
-
- return &b
-}
-
-// TestPostProcessor sets the prov. with the name n to the component finder
-// and returns the mock.
-func TestPostProcessor(t *testing.T, c *CoreConfig, n string) *MockPostProcessor {
- var b MockPostProcessor
-
- c.Components.PostProcessor = func(actual string) (PostProcessor, error) {
- if actual != n {
- return nil, nil
- }
-
- return &b, nil
- }
-
- return &b
-}
diff --git a/vendor/github.com/mitchellh/packer/packer/ui.go b/vendor/github.com/mitchellh/packer/packer/ui.go
deleted file mode 100644
index afd21a48..00000000
--- a/vendor/github.com/mitchellh/packer/packer/ui.go
+++ /dev/null
@@ -1,299 +0,0 @@
-package packer
-
-import (
- "bytes"
- "errors"
- "fmt"
- "io"
- "log"
- "os"
- "os/signal"
- "runtime"
- "strings"
- "sync"
- "syscall"
- "time"
- "unicode"
-)
-
-type UiColor uint
-
-const (
- UiColorRed UiColor = 31
- UiColorGreen = 32
- UiColorYellow = 33
- UiColorBlue = 34
- UiColorMagenta = 35
- UiColorCyan = 36
-)
-
-// The Ui interface handles all communication for Packer with the outside
-// world. This sort of control allows us to strictly control how output
-// is formatted and various levels of output.
-type Ui interface {
- Ask(string) (string, error)
- Say(string)
- Message(string)
- Error(string)
- Machine(string, ...string)
-}
-
-// ColoredUi is a UI that is colored using terminal colors.
-type ColoredUi struct {
- Color UiColor
- ErrorColor UiColor
- Ui Ui
-}
-
-// TargettedUi is a UI that wraps another UI implementation and modifies
-// the output to indicate a specific target. Specifically, all Say output
-// is prefixed with the target name. Message output is not prefixed but
-// is offset by the length of the target so that output is lined up properly
-// with Say output. Machine-readable output has the proper target set.
-type TargettedUi struct {
- Target string
- Ui Ui
-}
-
-// The BasicUI is a UI that reads and writes from a standard Go reader
-// and writer. It is safe to be called from multiple goroutines. Machine
-// readable output is simply logged for this UI.
-type BasicUi struct {
- Reader io.Reader
- Writer io.Writer
- ErrorWriter io.Writer
- l sync.Mutex
- interrupted bool
-}
-
-// MachineReadableUi is a UI that only outputs machine-readable output
-// to the given Writer.
-type MachineReadableUi struct {
- Writer io.Writer
-}
-
-func (u *ColoredUi) Ask(query string) (string, error) {
- return u.Ui.Ask(u.colorize(query, u.Color, true))
-}
-
-func (u *ColoredUi) Say(message string) {
- u.Ui.Say(u.colorize(message, u.Color, true))
-}
-
-func (u *ColoredUi) Message(message string) {
- u.Ui.Message(u.colorize(message, u.Color, false))
-}
-
-func (u *ColoredUi) Error(message string) {
- color := u.ErrorColor
- if color == 0 {
- color = UiColorRed
- }
-
- u.Ui.Error(u.colorize(message, color, true))
-}
-
-func (u *ColoredUi) Machine(t string, args ...string) {
- // Don't colorize machine-readable output
- u.Ui.Machine(t, args...)
-}
-
-func (u *ColoredUi) colorize(message string, color UiColor, bold bool) string {
- if !u.supportsColors() {
- return message
- }
-
- attr := 0
- if bold {
- attr = 1
- }
-
- return fmt.Sprintf("\033[%d;%dm%s\033[0m", attr, color, message)
-}
-
-func (u *ColoredUi) supportsColors() bool {
- // Never use colors if we have this environmental variable
- if os.Getenv("PACKER_NO_COLOR") != "" {
- return false
- }
-
- // For now, on non-Windows machine, just assume it does
- if runtime.GOOS != "windows" {
- return true
- }
-
- // On Windows, if we appear to be in Cygwin, then it does
- cygwin := os.Getenv("CYGWIN") != "" ||
- os.Getenv("OSTYPE") == "cygwin" ||
- os.Getenv("TERM") == "cygwin"
-
- return cygwin
-}
-
-func (u *TargettedUi) Ask(query string) (string, error) {
- return u.Ui.Ask(u.prefixLines(true, query))
-}
-
-func (u *TargettedUi) Say(message string) {
- u.Ui.Say(u.prefixLines(true, message))
-}
-
-func (u *TargettedUi) Message(message string) {
- u.Ui.Message(u.prefixLines(false, message))
-}
-
-func (u *TargettedUi) Error(message string) {
- u.Ui.Error(u.prefixLines(true, message))
-}
-
-func (u *TargettedUi) Machine(t string, args ...string) {
- // Prefix in the target, then pass through
- u.Ui.Machine(fmt.Sprintf("%s,%s", u.Target, t), args...)
-}
-
-func (u *TargettedUi) prefixLines(arrow bool, message string) string {
- arrowText := "==>"
- if !arrow {
- arrowText = strings.Repeat(" ", len(arrowText))
- }
-
- var result bytes.Buffer
-
- for _, line := range strings.Split(message, "\n") {
- result.WriteString(fmt.Sprintf("%s %s: %s\n", arrowText, u.Target, line))
- }
-
- return strings.TrimRightFunc(result.String(), unicode.IsSpace)
-}
-
-func (rw *BasicUi) Ask(query string) (string, error) {
- rw.l.Lock()
- defer rw.l.Unlock()
-
- if rw.interrupted {
- return "", errors.New("interrupted")
- }
-
- sigCh := make(chan os.Signal, 1)
- signal.Notify(sigCh, os.Interrupt)
- defer signal.Stop(sigCh)
-
- log.Printf("ui: ask: %s", query)
- if query != "" {
- if _, err := fmt.Fprint(rw.Writer, query+" "); err != nil {
- return "", err
- }
- }
-
- result := make(chan string, 1)
- go func() {
- var line string
- if _, err := fmt.Fscanln(rw.Reader, &line); err != nil {
- log.Printf("ui: scan err: %s", err)
- }
-
- result <- line
- }()
-
- select {
- case line := <-result:
- return line, nil
- case <-sigCh:
- // Print a newline so that any further output starts properly
- // on a new line.
- fmt.Fprintln(rw.Writer)
-
- // Mark that we were interrupted so future Ask calls fail.
- rw.interrupted = true
-
- return "", errors.New("interrupted")
- }
-}
-
-func (rw *BasicUi) Say(message string) {
- rw.l.Lock()
- defer rw.l.Unlock()
-
- log.Printf("ui: %s", message)
- _, err := fmt.Fprint(rw.Writer, message+"\n")
- if err != nil {
- log.Printf("[ERR] Failed to write to UI: %s", err)
- }
-}
-
-func (rw *BasicUi) Message(message string) {
- rw.l.Lock()
- defer rw.l.Unlock()
-
- log.Printf("ui: %s", message)
- _, err := fmt.Fprint(rw.Writer, message+"\n")
- if err != nil {
- log.Printf("[ERR] Failed to write to UI: %s", err)
- }
-}
-
-func (rw *BasicUi) Error(message string) {
- rw.l.Lock()
- defer rw.l.Unlock()
-
- writer := rw.ErrorWriter
- if writer == nil {
- writer = rw.Writer
- }
-
- log.Printf("ui error: %s", message)
- _, err := fmt.Fprint(writer, message+"\n")
- if err != nil {
- log.Printf("[ERR] Failed to write to UI: %s", err)
- }
-}
-
-func (rw *BasicUi) Machine(t string, args ...string) {
- log.Printf("machine readable: %s %#v", t, args)
-}
-
-func (u *MachineReadableUi) Ask(query string) (string, error) {
- return "", errors.New("machine-readable UI can't ask")
-}
-
-func (u *MachineReadableUi) Say(message string) {
- u.Machine("ui", "say", message)
-}
-
-func (u *MachineReadableUi) Message(message string) {
- u.Machine("ui", "message", message)
-}
-
-func (u *MachineReadableUi) Error(message string) {
- u.Machine("ui", "error", message)
-}
-
-func (u *MachineReadableUi) Machine(category string, args ...string) {
- now := time.Now().UTC()
-
- // Determine if we have a target, and set it
- target := ""
- commaIdx := strings.Index(category, ",")
- if commaIdx > -1 {
- target = category[0:commaIdx]
- category = category[commaIdx+1:]
- }
-
- // Prepare the args
- for i, v := range args {
- args[i] = strings.Replace(v, ",", "%!(PACKER_COMMA)", -1)
- args[i] = strings.Replace(args[i], "\r", "\\r", -1)
- args[i] = strings.Replace(args[i], "\n", "\\n", -1)
- }
- argsString := strings.Join(args, ",")
-
- _, err := fmt.Fprintf(u.Writer, "%d,%s,%s,%s\n", now.Unix(), target, category, argsString)
- if err != nil {
- if err == syscall.EPIPE || strings.Contains(err.Error(), "broken pipe") {
- // Ignore epipe errors because that just means that the file
- // is probably closed or going to /dev/null or something.
- } else {
- panic(err)
- }
- }
-}
diff --git a/vendor/github.com/mitchellh/packer/template/interpolate/funcs.go b/vendor/github.com/mitchellh/packer/template/interpolate/funcs.go
deleted file mode 100644
index 92c3ce5c..00000000
--- a/vendor/github.com/mitchellh/packer/template/interpolate/funcs.go
+++ /dev/null
@@ -1,154 +0,0 @@
-package interpolate
-
-import (
- "errors"
- "fmt"
- "os"
- "path/filepath"
- "strconv"
- "strings"
- "text/template"
- "time"
-
- "github.com/mitchellh/packer/common/uuid"
-)
-
-// InitTime is the UTC time when this package was initialized. It is
-// used as the timestamp for all configuration templates so that they
-// match for a single build.
-var InitTime time.Time
-
-func init() {
- InitTime = time.Now().UTC()
-}
-
-// Funcs are the interpolation funcs that are available within interpolations.
-var FuncGens = map[string]FuncGenerator{
- "build_name": funcGenBuildName,
- "build_type": funcGenBuildType,
- "env": funcGenEnv,
- "isotime": funcGenIsotime,
- "pwd": funcGenPwd,
- "template_dir": funcGenTemplateDir,
- "timestamp": funcGenTimestamp,
- "uuid": funcGenUuid,
- "user": funcGenUser,
-
- "upper": funcGenPrimitive(strings.ToUpper),
- "lower": funcGenPrimitive(strings.ToLower),
-}
-
-// FuncGenerator is a function that given a context generates a template
-// function for the template.
-type FuncGenerator func(*Context) interface{}
-
-// Funcs returns the functions that can be used for interpolation given
-// a context.
-func Funcs(ctx *Context) template.FuncMap {
- result := make(map[string]interface{})
- for k, v := range FuncGens {
- result[k] = v(ctx)
- }
- if ctx != nil {
- for k, v := range ctx.Funcs {
- result[k] = v
- }
- }
-
- return template.FuncMap(result)
-}
-
-func funcGenBuildName(ctx *Context) interface{} {
- return func() (string, error) {
- if ctx == nil || ctx.BuildName == "" {
- return "", errors.New("build_name not available")
- }
-
- return ctx.BuildName, nil
- }
-}
-
-func funcGenBuildType(ctx *Context) interface{} {
- return func() (string, error) {
- if ctx == nil || ctx.BuildType == "" {
- return "", errors.New("build_type not available")
- }
-
- return ctx.BuildType, nil
- }
-}
-
-func funcGenEnv(ctx *Context) interface{} {
- return func(k string) (string, error) {
- if !ctx.EnableEnv {
- // The error message doesn't have to be that detailed since
- // semantic checks should catch this.
- return "", errors.New("env vars are not allowed here")
- }
-
- return os.Getenv(k), nil
- }
-}
-
-func funcGenIsotime(ctx *Context) interface{} {
- return func(format ...string) (string, error) {
- if len(format) == 0 {
- return InitTime.Format(time.RFC3339), nil
- }
-
- if len(format) > 1 {
- return "", fmt.Errorf("too many values, 1 needed: %v", format)
- }
-
- return InitTime.Format(format[0]), nil
- }
-}
-
-func funcGenPrimitive(value interface{}) FuncGenerator {
- return func(ctx *Context) interface{} {
- return value
- }
-}
-
-func funcGenPwd(ctx *Context) interface{} {
- return func() (string, error) {
- return os.Getwd()
- }
-}
-
-func funcGenTemplateDir(ctx *Context) interface{} {
- return func() (string, error) {
- if ctx == nil || ctx.TemplatePath == "" {
- return "", errors.New("template path not available")
- }
-
- path, err := filepath.Abs(filepath.Dir(ctx.TemplatePath))
- if err != nil {
- return "", err
- }
-
- return path, nil
- }
-}
-
-func funcGenTimestamp(ctx *Context) interface{} {
- return func() string {
- return strconv.FormatInt(InitTime.Unix(), 10)
- }
-}
-
-func funcGenUser(ctx *Context) interface{} {
- return func(k string) string {
- if ctx == nil || ctx.UserVariables == nil {
- return ""
- }
-
- return ctx.UserVariables[k]
- }
-}
-
-func funcGenUuid(ctx *Context) interface{} {
- return func() string {
- return uuid.TimeOrderedUUID()
- }
-}
diff --git a/vendor/github.com/mitchellh/packer/template/interpolate/i.go b/vendor/github.com/mitchellh/packer/template/interpolate/i.go
deleted file mode 100644
index 02f56197..00000000
--- a/vendor/github.com/mitchellh/packer/template/interpolate/i.go
+++ /dev/null
@@ -1,79 +0,0 @@
-package interpolate
-
-import (
- "bytes"
- "text/template"
-)
-
-// Context is the context that an interpolation is done in. This defines
-// things such as available variables.
-type Context struct {
- // Data is the data for the template that is available
- Data interface{}
-
- // Funcs are extra functions available in the template
- Funcs map[string]interface{}
-
- // UserVariables is the mapping of user variables that the
- // "user" function reads from.
- UserVariables map[string]string
-
- // EnableEnv enables the env function
- EnableEnv bool
-
- // All the fields below are used for built-in functions.
- //
- // BuildName and BuildType are the name and type, respectively,
- // of the builder being used.
- //
- // TemplatePath is the path to the template that this is being
- // rendered within.
- BuildName string
- BuildType string
- TemplatePath string
-}
-
-// Render is shorthand for constructing an I and calling Render.
-func Render(v string, ctx *Context) (string, error) {
- return (&I{Value: v}).Render(ctx)
-}
-
-// Validate is shorthand for constructing an I and calling Validate.
-func Validate(v string, ctx *Context) error {
- return (&I{Value: v}).Validate(ctx)
-}
-
-// I stands for "interpolation" and is the main interpolation struct
-// in order to render values.
-type I struct {
- Value string
-}
-
-// Render renders the interpolation with the given context.
-func (i *I) Render(ctx *Context) (string, error) {
- tpl, err := i.template(ctx)
- if err != nil {
- return "", err
- }
-
- var result bytes.Buffer
- var data interface{}
- if ctx != nil {
- data = ctx.Data
- }
- if err := tpl.Execute(&result, data); err != nil {
- return "", err
- }
-
- return result.String(), nil
-}
-
-// Validate validates that the template is syntactically valid.
-func (i *I) Validate(ctx *Context) error {
- _, err := i.template(ctx)
- return err
-}
-
-func (i *I) template(ctx *Context) (*template.Template, error) {
- return template.New("root").Funcs(Funcs(ctx)).Parse(i.Value)
-}
diff --git a/vendor/github.com/mitchellh/packer/template/interpolate/parse.go b/vendor/github.com/mitchellh/packer/template/interpolate/parse.go
deleted file mode 100644
index b1807951..00000000
--- a/vendor/github.com/mitchellh/packer/template/interpolate/parse.go
+++ /dev/null
@@ -1,42 +0,0 @@
-package interpolate
-
-import (
- "fmt"
- "text/template"
- "text/template/parse"
-)
-
-// functionsCalled returns a map (to be used as a set) of the functions
-// that are called from the given text template.
-func functionsCalled(t *template.Template) map[string]struct{} {
- result := make(map[string]struct{})
- functionsCalledWalk(t.Tree.Root, result)
- return result
-}
-
-func functionsCalledWalk(raw parse.Node, r map[string]struct{}) {
- switch node := raw.(type) {
- case *parse.ActionNode:
- functionsCalledWalk(node.Pipe, r)
- case *parse.CommandNode:
- if in, ok := node.Args[0].(*parse.IdentifierNode); ok {
- r[in.Ident] = struct{}{}
- }
-
- for _, n := range node.Args[1:] {
- functionsCalledWalk(n, r)
- }
- case *parse.ListNode:
- for _, n := range node.Nodes {
- functionsCalledWalk(n, r)
- }
- case *parse.PipeNode:
- for _, n := range node.Cmds {
- functionsCalledWalk(n, r)
- }
- case *parse.StringNode, *parse.TextNode:
- // Ignore
- default:
- panic(fmt.Sprintf("unknown type: %T", node))
- }
-}
diff --git a/vendor/github.com/mitchellh/packer/template/interpolate/render.go b/vendor/github.com/mitchellh/packer/template/interpolate/render.go
deleted file mode 100644
index 2120c171..00000000
--- a/vendor/github.com/mitchellh/packer/template/interpolate/render.go
+++ /dev/null
@@ -1,314 +0,0 @@
-package interpolate
-
-import (
- "fmt"
- "reflect"
- "strings"
- "sync"
-
- "github.com/mitchellh/mapstructure"
- "github.com/mitchellh/reflectwalk"
-)
-
-// RenderFilter is an option for filtering what gets rendered and
-// doesn't within an interface.
-type RenderFilter struct {
- Include []string
- Exclude []string
-
- once sync.Once
- excludeSet map[string]struct{}
- includeSet map[string]struct{}
-}
-
-// RenderMap renders all the strings in the given interface. The
-// interface must decode into a map[string]interface{}, but is left
-// as an interface{} type to ease backwards compatibility with the way
-// arguments are passed around in Packer.
-func RenderMap(v interface{}, ctx *Context, f *RenderFilter) (map[string]interface{}, error) {
- // First decode it into the map
- var m map[string]interface{}
- if err := mapstructure.Decode(v, &m); err != nil {
- return nil, err
- }
-
- // Now go through each value and render it
- for k, raw := range m {
- // Always validate every field
- if err := ValidateInterface(raw, ctx); err != nil {
- return nil, fmt.Errorf("invalid '%s': %s", k, err)
- }
-
- if !f.include(k) {
- continue
- }
-
- raw, err := RenderInterface(raw, ctx)
- if err != nil {
- return nil, fmt.Errorf("render '%s': %s", k, err)
- }
-
- m[k] = raw
- }
-
- return m, nil
-}
-
-// RenderInterface renders any value and returns the resulting value.
-func RenderInterface(v interface{}, ctx *Context) (interface{}, error) {
- f := func(v string) (string, error) {
- return Render(v, ctx)
- }
-
- walker := &renderWalker{
- F: f,
- Replace: true,
- }
- err := reflectwalk.Walk(v, walker)
- if err != nil {
- return nil, err
- }
-
- if walker.Top != nil {
- v = walker.Top
- }
- return v, nil
-}
-
-// ValidateInterface renders any value and returns the resulting value.
-func ValidateInterface(v interface{}, ctx *Context) error {
- f := func(v string) (string, error) {
- return v, Validate(v, ctx)
- }
-
- walker := &renderWalker{
- F: f,
- Replace: false,
- }
- err := reflectwalk.Walk(v, walker)
- if err != nil {
- return err
- }
-
- return nil
-}
-
-// Include checks whether a key should be included.
-func (f *RenderFilter) include(k string) bool {
- if f == nil {
- return true
- }
-
- k = strings.ToLower(k)
-
- f.once.Do(f.init)
- if len(f.includeSet) > 0 {
- _, ok := f.includeSet[k]
- return ok
- }
- if len(f.excludeSet) > 0 {
- _, ok := f.excludeSet[k]
- return !ok
- }
-
- return true
-}
-
-func (f *RenderFilter) init() {
- f.includeSet = make(map[string]struct{})
- for _, v := range f.Include {
- f.includeSet[strings.ToLower(v)] = struct{}{}
- }
-
- f.excludeSet = make(map[string]struct{})
- for _, v := range f.Exclude {
- f.excludeSet[strings.ToLower(v)] = struct{}{}
- }
-}
-
-// renderWalker implements interfaces for the reflectwalk package
-// (github.com/mitchellh/reflectwalk) that can be used to automatically
-// execute a callback for an interpolation.
-type renderWalker struct {
- // F is the function to call for every interpolation. It can be nil.
- //
- // If Replace is true, then the return value of F will be used to
- // replace the interpolation.
- F renderWalkerFunc
- Replace bool
-
- // ContextF is an advanced version of F that also receives the
- // location of where it is in the structure. This lets you do
- // context-aware validation.
- ContextF renderWalkerContextFunc
-
- // Top is the top value of the walk. This might get replaced if the
- // top value needs to be modified. It is valid to read after any walk.
- // If it is nil, it means the top wasn't replaced.
- Top interface{}
-
- key []string
- lastValue reflect.Value
- loc reflectwalk.Location
- cs []reflect.Value
- csKey []reflect.Value
- csData interface{}
- sliceIndex int
- unknownKeys []string
-}
-
-// renderWalkerFunc is the callback called by interpolationWalk.
-// It is called with any interpolation found. It should return a value
-// to replace the interpolation with, along with any errors.
-//
-// If Replace is set to false in renderWalker, then the replace
-// value can be anything as it will have no effect.
-type renderWalkerFunc func(string) (string, error)
-
-// renderWalkerContextFunc is called by interpolationWalk if
-// ContextF is set. This receives both the interpolation and the location
-// where the interpolation is.
-//
-// This callback can be used to validate the location of the interpolation
-// within the configuration.
-type renderWalkerContextFunc func(reflectwalk.Location, string)
-
-func (w *renderWalker) Enter(loc reflectwalk.Location) error {
- w.loc = loc
- return nil
-}
-
-func (w *renderWalker) Exit(loc reflectwalk.Location) error {
- w.loc = reflectwalk.None
-
- switch loc {
- case reflectwalk.Map:
- w.cs = w.cs[:len(w.cs)-1]
- case reflectwalk.MapValue:
- w.key = w.key[:len(w.key)-1]
- w.csKey = w.csKey[:len(w.csKey)-1]
- case reflectwalk.Slice:
- // Split any values that need to be split
- w.cs = w.cs[:len(w.cs)-1]
- case reflectwalk.SliceElem:
- w.csKey = w.csKey[:len(w.csKey)-1]
- }
-
- return nil
-}
-
-func (w *renderWalker) Map(m reflect.Value) error {
- w.cs = append(w.cs, m)
- return nil
-}
-
-func (w *renderWalker) MapElem(m, k, v reflect.Value) error {
- w.csData = k
- w.csKey = append(w.csKey, k)
- w.key = append(w.key, k.String())
- w.lastValue = v
- return nil
-}
-
-func (w *renderWalker) Slice(s reflect.Value) error {
- w.cs = append(w.cs, s)
- return nil
-}
-
-func (w *renderWalker) SliceElem(i int, elem reflect.Value) error {
- w.csKey = append(w.csKey, reflect.ValueOf(i))
- w.sliceIndex = i
- return nil
-}
-
-func (w *renderWalker) Primitive(v reflect.Value) error {
- setV := v
-
- // We only care about strings
- if v.Kind() == reflect.Interface {
- setV = v
- v = v.Elem()
- }
- if v.Kind() != reflect.String {
- return nil
- }
-
- strV := v.String()
- if w.ContextF != nil {
- w.ContextF(w.loc, strV)
- }
-
- if w.F == nil {
- return nil
- }
-
- replaceVal, err := w.F(strV)
- if err != nil {
- return fmt.Errorf(
- "%s in:\n\n%s",
- err, v.String())
- }
-
- if w.Replace {
- resultVal := reflect.ValueOf(replaceVal)
- switch w.loc {
- case reflectwalk.MapKey:
- m := w.cs[len(w.cs)-1]
-
- // Delete the old value
- var zero reflect.Value
- m.SetMapIndex(w.csData.(reflect.Value), zero)
-
- // Set the new key with the existing value
- m.SetMapIndex(resultVal, w.lastValue)
-
- // Set the key to be the new key
- w.csData = resultVal
- case reflectwalk.MapValue:
- // If we're in a map, then the only way to set a map value is
- // to set it directly.
- m := w.cs[len(w.cs)-1]
- mk := w.csData.(reflect.Value)
- m.SetMapIndex(mk, resultVal)
- case reflectwalk.WalkLoc:
- // At the root element, we can't write that, so we just save it
- w.Top = resultVal.Interface()
- default:
- // Otherwise, we should be addressable
- setV.Set(resultVal)
- }
- }
-
- return nil
-}
-
-func (w *renderWalker) removeCurrent() {
- // Append the key to the unknown keys
- w.unknownKeys = append(w.unknownKeys, strings.Join(w.key, "."))
-
- for i := 1; i <= len(w.cs); i++ {
- c := w.cs[len(w.cs)-i]
- switch c.Kind() {
- case reflect.Map:
- // Zero value so that we delete the map key
- var val reflect.Value
-
- // Get the key and delete it
- k := w.csData.(reflect.Value)
- c.SetMapIndex(k, val)
- return
- }
- }
-
- panic("No container found for removeCurrent")
-}
-
-func (w *renderWalker) replaceCurrent(v reflect.Value) {
- c := w.cs[len(w.cs)-2]
- switch c.Kind() {
- case reflect.Map:
- // Get the key and delete it
- k := w.csKey[len(w.csKey)-1]
- c.SetMapIndex(k, v)
- }
-}
diff --git a/vendor/github.com/mitchellh/packer/template/parse.go b/vendor/github.com/mitchellh/packer/template/parse.go
deleted file mode 100644
index 779886df..00000000
--- a/vendor/github.com/mitchellh/packer/template/parse.go
+++ /dev/null
@@ -1,403 +0,0 @@
-package template
-
-import (
- "bufio"
- "bytes"
- "encoding/json"
- "fmt"
- "io"
- "io/ioutil"
- "os"
- "path/filepath"
- "sort"
- "strings"
-
- "github.com/hashicorp/go-multierror"
- "github.com/mitchellh/mapstructure"
-)
-
-// rawTemplate is the direct JSON document format of the template file.
-// This is what is decoded directly from the file, and then it is turned
-// into a Template object thereafter.
-type rawTemplate struct {
- MinVersion string `mapstructure:"min_packer_version"`
- Description string
-
- Builders []map[string]interface{}
- Push map[string]interface{}
- PostProcessors []interface{} `mapstructure:"post-processors"`
- Provisioners []map[string]interface{}
- Variables map[string]interface{}
-
- RawContents []byte
-}
-
-// Template returns the actual Template object built from this raw
-// structure.
-func (r *rawTemplate) Template() (*Template, error) {
- var result Template
- var errs error
-
- // Copy some literals
- result.Description = r.Description
- result.MinVersion = r.MinVersion
- result.RawContents = r.RawContents
-
- // Gather the variables
- if len(r.Variables) > 0 {
- result.Variables = make(map[string]*Variable, len(r.Variables))
- }
- for k, rawV := range r.Variables {
- var v Variable
-
- // Variable is required if the value is exactly nil
- v.Required = rawV == nil
-
- // Weak decode the default if we have one
- if err := r.decoder(&v.Default, nil).Decode(rawV); err != nil {
- errs = multierror.Append(errs, fmt.Errorf(
- "variable %s: %s", k, err))
- continue
- }
-
- result.Variables[k] = &v
- }
-
- // Let's start by gathering all the builders
- if len(r.Builders) > 0 {
- result.Builders = make(map[string]*Builder, len(r.Builders))
- }
- for i, rawB := range r.Builders {
- var b Builder
- if err := mapstructure.WeakDecode(rawB, &b); err != nil {
- errs = multierror.Append(errs, fmt.Errorf(
- "builder %d: %s", i+1, err))
- continue
- }
-
- // Set the raw configuration and delete any special keys
- b.Config = rawB
- delete(b.Config, "name")
- delete(b.Config, "type")
- if len(b.Config) == 0 {
- b.Config = nil
- }
-
- // If there is no type set, it is an error
- if b.Type == "" {
- errs = multierror.Append(errs, fmt.Errorf(
- "builder %d: missing 'type'", i+1))
- continue
- }
-
- // The name defaults to the type if it isn't set
- if b.Name == "" {
- b.Name = b.Type
- }
-
- // If this builder already exists, it is an error
- if _, ok := result.Builders[b.Name]; ok {
- errs = multierror.Append(errs, fmt.Errorf(
- "builder %d: builder with name '%s' already exists",
- i+1, b.Name))
- continue
- }
-
- // Append the builders
- result.Builders[b.Name] = &b
- }
-
- // Gather all the post-processors
- if len(r.PostProcessors) > 0 {
- result.PostProcessors = make([][]*PostProcessor, 0, len(r.PostProcessors))
- }
- for i, v := range r.PostProcessors {
- // Parse the configurations. We need to do this because post-processors
- // can take three different formats.
- configs, err := r.parsePostProcessor(i, v)
- if err != nil {
- errs = multierror.Append(errs, err)
- continue
- }
-
- // Parse the PostProcessors out of the configs
- pps := make([]*PostProcessor, 0, len(configs))
- for j, c := range configs {
- var pp PostProcessor
- if err := r.decoder(&pp, nil).Decode(c); err != nil {
- errs = multierror.Append(errs, fmt.Errorf(
- "post-processor %d.%d: %s", i+1, j+1, err))
- continue
- }
-
- // Type is required
- if pp.Type == "" {
- errs = multierror.Append(errs, fmt.Errorf(
- "post-processor %d.%d: type is required", i+1, j+1))
- continue
- }
-
- // Set the configuration
- delete(c, "except")
- delete(c, "only")
- delete(c, "keep_input_artifact")
- delete(c, "type")
- if len(c) > 0 {
- pp.Config = c
- }
-
- pps = append(pps, &pp)
- }
-
- result.PostProcessors = append(result.PostProcessors, pps)
- }
-
- // Gather all the provisioners
- if len(r.Provisioners) > 0 {
- result.Provisioners = make([]*Provisioner, 0, len(r.Provisioners))
- }
- for i, v := range r.Provisioners {
- var p Provisioner
- if err := r.decoder(&p, nil).Decode(v); err != nil {
- errs = multierror.Append(errs, fmt.Errorf(
- "provisioner %d: %s", i+1, err))
- continue
- }
-
- // Type is required before any richer validation
- if p.Type == "" {
- errs = multierror.Append(errs, fmt.Errorf(
- "provisioner %d: missing 'type'", i+1))
- continue
- }
-
- // Copy the configuration
- delete(v, "except")
- delete(v, "only")
- delete(v, "override")
- delete(v, "pause_before")
- delete(v, "type")
- if len(v) > 0 {
- p.Config = v
- }
-
- // TODO: stuff
- result.Provisioners = append(result.Provisioners, &p)
- }
-
- // Push
- if len(r.Push) > 0 {
- var p Push
- if err := r.decoder(&p, nil).Decode(r.Push); err != nil {
- errs = multierror.Append(errs, fmt.Errorf(
- "push: %s", err))
- }
-
- result.Push = p
- }
-
- // If we have errors, return those with a nil result
- if errs != nil {
- return nil, errs
- }
-
- return &result, nil
-}
-
-func (r *rawTemplate) decoder(
- result interface{},
- md *mapstructure.Metadata) *mapstructure.Decoder {
- d, err := mapstructure.NewDecoder(&mapstructure.DecoderConfig{
- DecodeHook: mapstructure.StringToTimeDurationHookFunc(),
- Metadata: md,
- Result: result,
- })
- if err != nil {
- // This really shouldn't happen since we have firm control over
- // all the arguments and they're all unit tested. So we use a
- // panic here to note this would definitely be a bug.
- panic(err)
- }
- return d
-}
-
-func (r *rawTemplate) parsePostProcessor(
- i int, raw interface{}) ([]map[string]interface{}, error) {
- switch v := raw.(type) {
- case string:
- return []map[string]interface{}{
- {"type": v},
- }, nil
- case map[string]interface{}:
- return []map[string]interface{}{v}, nil
- case []interface{}:
- var err error
- result := make([]map[string]interface{}, len(v))
- for j, innerRaw := range v {
- switch innerV := innerRaw.(type) {
- case string:
- result[j] = map[string]interface{}{"type": innerV}
- case map[string]interface{}:
- result[j] = innerV
- case []interface{}:
- err = multierror.Append(err, fmt.Errorf(
- "post-processor %d.%d: sequence not allowed to be nested in a sequence",
- i+1, j+1))
- default:
- err = multierror.Append(err, fmt.Errorf(
- "post-processor %d.%d: unknown format",
- i+1, j+1))
- }
- }
-
- if err != nil {
- return nil, err
- }
-
- return result, nil
- default:
- return nil, fmt.Errorf("post-processor %d: bad format", i+1)
- }
-}
-
-// Parse takes the given io.Reader and parses a Template object out of it.
-func Parse(r io.Reader) (*Template, error) {
- // Create a buffer to copy what we read
- var buf bytes.Buffer
- r = io.TeeReader(r, &buf)
-
- // First, decode the object into an interface{}. We do this instead of
- // the rawTemplate directly because we'd rather use mapstructure to
- // decode since it has richer errors.
- var raw interface{}
- if err := json.NewDecoder(r).Decode(&raw); err != nil {
- return nil, err
- }
-
- // Create our decoder
- var md mapstructure.Metadata
- var rawTpl rawTemplate
- rawTpl.RawContents = buf.Bytes()
- decoder, err := mapstructure.NewDecoder(&mapstructure.DecoderConfig{
- Metadata: &md,
- Result: &rawTpl,
- })
- if err != nil {
- return nil, err
- }
-
- // Do the actual decode into our structure
- if err := decoder.Decode(raw); err != nil {
- return nil, err
- }
-
- // Build an error if there are unused root level keys
- if len(md.Unused) > 0 {
- sort.Strings(md.Unused)
- for _, unused := range md.Unused {
- // Ignore keys starting with '_' as comments
- if unused[0] == '_' {
- continue
- }
-
- err = multierror.Append(err, fmt.Errorf(
- "Unknown root level key in template: '%s'", unused))
- }
- }
- if err != nil {
- return nil, err
- }
-
- // Return the template parsed from the raw structure
- return rawTpl.Template()
-}
-
-// ParseFile is the same as Parse but is a helper to automatically open
-// a file for parsing.
-func ParseFile(path string) (*Template, error) {
- var f *os.File
- var err error
- if path == "-" {
- // Create a temp file for stdin in case of errors
- f, err = ioutil.TempFile(os.TempDir(), "packer")
- if err != nil {
- return nil, err
- }
- defer os.Remove(f.Name())
- defer f.Close()
- io.Copy(f, os.Stdin)
- f.Seek(0, os.SEEK_SET)
- } else {
- f, err = os.Open(path)
- if err != nil {
- return nil, err
- }
- defer f.Close()
- }
- tpl, err := Parse(f)
- if err != nil {
- syntaxErr, ok := err.(*json.SyntaxError)
- if !ok {
- return nil, err
- }
- // Rewind the file and get a better error
- f.Seek(0, os.SEEK_SET)
- // Grab the error location, and return a string to point to offending syntax error
- line, col, highlight := highlightPosition(f, syntaxErr.Offset)
- err = fmt.Errorf("Error parsing JSON: %s\nAt line %d, column %d (offset %d):\n%s", err, line, col, syntaxErr.Offset, highlight)
- return nil, err
- }
-
- if !filepath.IsAbs(path) {
- path, err = filepath.Abs(path)
- if err != nil {
- return nil, err
- }
- }
-
- tpl.Path = path
- return tpl, nil
-}
-
-// Takes a file and the location in bytes of a parse error
-// from json.SyntaxError.Offset and returns the line, column,
-// and pretty-printed context around the error with an arrow indicating the exact
-// position of the syntax error.
-func highlightPosition(f *os.File, pos int64) (line, col int, highlight string) {
- // Modified version of the function in Camlistore by Brad Fitzpatrick
- // https://github.com/camlistore/camlistore/blob/4b5403dd5310cf6e1ae8feb8533fd59262701ebc/vendor/go4.org/errorutil/highlight.go
- line = 1
- // New io.Reader for file
- br := bufio.NewReader(f)
- // Initialize lines
- lastLine := ""
- thisLine := new(bytes.Buffer)
- // Loop through template to find line, column
- for n := int64(0); n < pos; n++ {
- // read byte from io.Reader
- b, err := br.ReadByte()
- if err != nil {
- break
- }
- // If end of line, save line as previous line in case next line is offender
- if b == '\n' {
- lastLine = thisLine.String()
- thisLine.Reset()
- line++
- col = 1
- } else {
- // Write current line, until line is safe, or error point is encountered
- col++
- thisLine.WriteByte(b)
- }
- }
-
- // Populate highlight string to place a '^' char at offending column
- if line > 1 {
- highlight += fmt.Sprintf("%5d: %s\n", line-1, lastLine)
- }
-
- highlight += fmt.Sprintf("%5d: %s\n", line, thisLine.String())
- highlight += fmt.Sprintf("%s^\n", strings.Repeat(" ", col+5))
- return
-}
diff --git a/vendor/github.com/mitchellh/packer/template/template.go b/vendor/github.com/mitchellh/packer/template/template.go
deleted file mode 100644
index 389320c7..00000000
--- a/vendor/github.com/mitchellh/packer/template/template.go
+++ /dev/null
@@ -1,201 +0,0 @@
-package template
-
-import (
- "errors"
- "fmt"
- "time"
-
- "github.com/hashicorp/go-multierror"
-)
-
-// Template represents the parsed template that is used to configure
-// Packer builds.
-type Template struct {
- // Path is the path to the template. This will be blank if Parse is
- // used, but will be automatically populated by ParseFile.
- Path string
-
- Description string
- MinVersion string
-
- Variables map[string]*Variable
- Builders map[string]*Builder
- Provisioners []*Provisioner
- PostProcessors [][]*PostProcessor
- Push Push
-
- // RawContents is just the raw data for this template
- RawContents []byte
-}
-
-// Builder represents a builder configured in the template
-type Builder struct {
- Name string
- Type string
- Config map[string]interface{}
-}
-
-// PostProcessor represents a post-processor within the template.
-type PostProcessor struct {
- OnlyExcept `mapstructure:",squash"`
-
- Type string
- KeepInputArtifact bool `mapstructure:"keep_input_artifact"`
- Config map[string]interface{}
-}
-
-// Provisioner represents a provisioner within the template.
-type Provisioner struct {
- OnlyExcept `mapstructure:",squash"`
-
- Type string
- Config map[string]interface{}
- Override map[string]interface{}
- PauseBefore time.Duration `mapstructure:"pause_before"`
-}
-
-// Push represents the configuration for pushing the template to Atlas.
-type Push struct {
- Name string
- Address string
- BaseDir string `mapstructure:"base_dir"`
- Include []string
- Exclude []string
- Token string
- VCS bool
-}
-
-// Variable represents a variable within the template
-type Variable struct {
- Default string
- Required bool
-}
-
-// OnlyExcept is a struct that is meant to be embedded that contains the
-// logic required for "only" and "except" meta-parameters.
-type OnlyExcept struct {
- Only []string
- Except []string
-}
-
-//-------------------------------------------------------------------
-// Functions
-//-------------------------------------------------------------------
-
-// Validate does some basic validation of the template on top of the
-// validation that occurs while parsing. If possible, we try to defer
-// validation to here. The validation errors that occur during parsing
-// are the minimal necessary to make sure parsing builds a reasonable
-// Template structure.
-func (t *Template) Validate() error {
- var err error
-
- // At least one builder must be defined
- if len(t.Builders) == 0 {
- err = multierror.Append(err, errors.New(
- "at least one builder must be defined"))
- }
-
- // Verify that the provisioner overrides target builders that exist
- for i, p := range t.Provisioners {
- // Validate only/except
- if verr := p.OnlyExcept.Validate(t); verr != nil {
- for _, e := range multierror.Append(verr).Errors {
- err = multierror.Append(err, fmt.Errorf(
- "provisioner %d: %s", i+1, e))
- }
- }
-
- // Validate overrides
- for name := range p.Override {
- if _, ok := t.Builders[name]; !ok {
- err = multierror.Append(err, fmt.Errorf(
- "provisioner %d: override '%s' doesn't exist",
- i+1, name))
- }
- }
- }
-
- // Verify post-processors
- for i, chain := range t.PostProcessors {
- for j, p := range chain {
- // Validate only/except
- if verr := p.OnlyExcept.Validate(t); verr != nil {
- for _, e := range multierror.Append(verr).Errors {
- err = multierror.Append(err, fmt.Errorf(
- "post-processor %d.%d: %s", i+1, j+1, e))
- }
- }
- }
- }
-
- return err
-}
-
-// Skip says whether or not to skip the build with the given name.
-func (o *OnlyExcept) Skip(n string) bool {
- if len(o.Only) > 0 {
- for _, v := range o.Only {
- if v == n {
- return false
- }
- }
-
- return true
- }
-
- if len(o.Except) > 0 {
- for _, v := range o.Except {
- if v == n {
- return true
- }
- }
-
- return false
- }
-
- return false
-}
-
-// Validate validates that the OnlyExcept settings are correct for a thing.
-func (o *OnlyExcept) Validate(t *Template) error {
- if len(o.Only) > 0 && len(o.Except) > 0 {
- return errors.New("only one of 'only' or 'except' may be specified")
- }
-
- var err error
- for _, n := range o.Only {
- if _, ok := t.Builders[n]; !ok {
- err = multierror.Append(err, fmt.Errorf(
- "'only' specified builder '%s' not found", n))
- }
- }
- for _, n := range o.Except {
- if _, ok := t.Builders[n]; !ok {
- err = multierror.Append(err, fmt.Errorf(
- "'except' specified builder '%s' not found", n))
- }
- }
-
- return err
-}
-
-//-------------------------------------------------------------------
-// GoStringer
-//-------------------------------------------------------------------
-
-func (b *Builder) GoString() string {
- return fmt.Sprintf("*%#v", *b)
-}
-
-func (p *Provisioner) GoString() string {
- return fmt.Sprintf("*%#v", *p)
-}
-
-func (p *PostProcessor) GoString() string {
- return fmt.Sprintf("*%#v", *p)
-}
-
-func (v *Variable) GoString() string {
- return fmt.Sprintf("*%#v", *v)
-}
diff --git a/vendor/github.com/mitchellh/reflectwalk/LICENSE b/vendor/github.com/mitchellh/reflectwalk/LICENSE
deleted file mode 100644
index f9c841a5..00000000
--- a/vendor/github.com/mitchellh/reflectwalk/LICENSE
+++ /dev/null
@@ -1,21 +0,0 @@
-The MIT License (MIT)
-
-Copyright (c) 2013 Mitchell Hashimoto
-
-Permission is hereby granted, free of charge, to any person obtaining a copy
-of this software and associated documentation files (the "Software"), to deal
-in the Software without restriction, including without limitation the rights
-to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
-copies of the Software, and to permit persons to whom the Software is
-furnished to do so, subject to the following conditions:
-
-The above copyright notice and this permission notice shall be included in
-all copies or substantial portions of the Software.
-
-THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
-OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
-THE SOFTWARE.
diff --git a/vendor/github.com/mitchellh/reflectwalk/README.md b/vendor/github.com/mitchellh/reflectwalk/README.md
deleted file mode 100644
index ac82cd2e..00000000
--- a/vendor/github.com/mitchellh/reflectwalk/README.md
+++ /dev/null
@@ -1,6 +0,0 @@
-# reflectwalk
-
-reflectwalk is a Go library for "walking" a value in Go using reflection,
-in the same way a directory tree can be "walked" on the filesystem. Walking
-a complex structure can allow you to do manipulations on unknown structures
-such as those decoded from JSON.
diff --git a/vendor/github.com/mitchellh/reflectwalk/location.go b/vendor/github.com/mitchellh/reflectwalk/location.go
deleted file mode 100644
index 7c59d764..00000000
--- a/vendor/github.com/mitchellh/reflectwalk/location.go
+++ /dev/null
@@ -1,17 +0,0 @@
-package reflectwalk
-
-//go:generate stringer -type=Location location.go
-
-type Location uint
-
-const (
- None Location = iota
- Map
- MapKey
- MapValue
- Slice
- SliceElem
- Struct
- StructField
- WalkLoc
-)
diff --git a/vendor/github.com/mitchellh/reflectwalk/location_string.go b/vendor/github.com/mitchellh/reflectwalk/location_string.go
deleted file mode 100644
index d3cfe854..00000000
--- a/vendor/github.com/mitchellh/reflectwalk/location_string.go
+++ /dev/null
@@ -1,16 +0,0 @@
-// generated by stringer -type=Location location.go; DO NOT EDIT
-
-package reflectwalk
-
-import "fmt"
-
-const _Location_name = "NoneMapMapKeyMapValueSliceSliceElemStructStructFieldWalkLoc"
-
-var _Location_index = [...]uint8{0, 4, 7, 13, 21, 26, 35, 41, 52, 59}
-
-func (i Location) String() string {
- if i+1 >= Location(len(_Location_index)) {
- return fmt.Sprintf("Location(%d)", i)
- }
- return _Location_name[_Location_index[i]:_Location_index[i+1]]
-}
diff --git a/vendor/github.com/mitchellh/reflectwalk/reflectwalk.go b/vendor/github.com/mitchellh/reflectwalk/reflectwalk.go
deleted file mode 100644
index 1f206659..00000000
--- a/vendor/github.com/mitchellh/reflectwalk/reflectwalk.go
+++ /dev/null
@@ -1,279 +0,0 @@
-// reflectwalk is a package that allows you to "walk" complex structures
-// similar to how you may "walk" a filesystem: visiting every element one
-// by one and calling callback functions allowing you to handle and manipulate
-// those elements.
-package reflectwalk
-
-import (
- "reflect"
-)
-
-// PrimitiveWalker implementations are able to handle primitive values
-// within complex structures. Primitive values are numbers, strings,
-// booleans, funcs, chans.
-//
-// These primitive values are often members of more complex
-// structures (slices, maps, etc.) that are walkable by other interfaces.
-type PrimitiveWalker interface {
- Primitive(reflect.Value) error
-}
-
-// MapWalker implementations are able to handle individual elements
-// found within a map structure.
-type MapWalker interface {
- Map(m reflect.Value) error
- MapElem(m, k, v reflect.Value) error
-}
-
-// SliceWalker implementations are able to handle slice elements found
-// within complex structures.
-type SliceWalker interface {
- Slice(reflect.Value) error
- SliceElem(int, reflect.Value) error
-}
-
-// StructWalker is an interface that has methods that are called for
-// structs when a Walk is done.
-type StructWalker interface {
- Struct(reflect.Value) error
- StructField(reflect.StructField, reflect.Value) error
-}
-
-// EnterExitWalker implementations are notified before and after
-// they walk deeper into complex structures (into struct fields,
-// into slice elements, etc.)
-type EnterExitWalker interface {
- Enter(Location) error
- Exit(Location) error
-}
-
-// PointerWalker implementations are notified when the value they're
-// walking is a pointer or not. Pointer is called for _every_ value whether
-// it is a pointer or not.
-type PointerWalker interface {
- PointerEnter(bool) error
- PointerExit(bool) error
-}
-
-// Walk takes an arbitrary value and an interface and traverses the
-// value, calling callbacks on the interface if they are supported.
-// The interface should implement one or more of the walker interfaces
-// in this package, such as PrimitiveWalker, StructWalker, etc.
-func Walk(data, walker interface{}) (err error) {
- v := reflect.ValueOf(data)
- ew, ok := walker.(EnterExitWalker)
- if ok {
- err = ew.Enter(WalkLoc)
- }
-
- if err == nil {
- err = walk(v, walker)
- }
-
- if ok && err == nil {
- err = ew.Exit(WalkLoc)
- }
-
- return
-}
-
-func walk(v reflect.Value, w interface{}) (err error) {
- // Determine if we're receiving a pointer and if so notify the walker.
- pointer := false
- if v.Kind() == reflect.Ptr {
- pointer = true
- v = reflect.Indirect(v)
- }
- if pw, ok := w.(PointerWalker); ok {
- if err = pw.PointerEnter(pointer); err != nil {
- return
- }
-
- defer func() {
- if err != nil {
- return
- }
-
- err = pw.PointerExit(pointer)
- }()
- }
-
- // We preserve the original value here because if it is an interface
- // type, we want to pass that directly into the walkPrimitive, so that
- // we can set it.
- originalV := v
- if v.Kind() == reflect.Interface {
- v = v.Elem()
- }
-
- k := v.Kind()
- if k >= reflect.Int && k <= reflect.Complex128 {
- k = reflect.Int
- }
-
- switch k {
- // Primitives
- case reflect.Bool, reflect.Chan, reflect.Func, reflect.Int, reflect.String, reflect.Invalid:
- err = walkPrimitive(originalV, w)
- return
- case reflect.Map:
- err = walkMap(v, w)
- return
- case reflect.Slice:
- err = walkSlice(v, w)
- return
- case reflect.Struct:
- err = walkStruct(v, w)
- return
- default:
- panic("unsupported type: " + k.String())
- }
-}
-
-func walkMap(v reflect.Value, w interface{}) error {
- ew, ewok := w.(EnterExitWalker)
- if ewok {
- ew.Enter(Map)
- }
-
- if mw, ok := w.(MapWalker); ok {
- if err := mw.Map(v); err != nil {
- return err
- }
- }
-
- for _, k := range v.MapKeys() {
- kv := v.MapIndex(k)
-
- if mw, ok := w.(MapWalker); ok {
- if err := mw.MapElem(v, k, kv); err != nil {
- return err
- }
- }
-
- ew, ok := w.(EnterExitWalker)
- if ok {
- ew.Enter(MapKey)
- }
-
- if err := walk(k, w); err != nil {
- return err
- }
-
- if ok {
- ew.Exit(MapKey)
- ew.Enter(MapValue)
- }
-
- if err := walk(kv, w); err != nil {
- return err
- }
-
- if ok {
- ew.Exit(MapValue)
- }
- }
-
- if ewok {
- ew.Exit(Map)
- }
-
- return nil
-}
-
-func walkPrimitive(v reflect.Value, w interface{}) error {
- if pw, ok := w.(PrimitiveWalker); ok {
- return pw.Primitive(v)
- }
-
- return nil
-}
-
-func walkSlice(v reflect.Value, w interface{}) (err error) {
- ew, ok := w.(EnterExitWalker)
- if ok {
- ew.Enter(Slice)
- }
-
- if sw, ok := w.(SliceWalker); ok {
- if err := sw.Slice(v); err != nil {
- return err
- }
- }
-
- for i := 0; i < v.Len(); i++ {
- elem := v.Index(i)
-
- if sw, ok := w.(SliceWalker); ok {
- if err := sw.SliceElem(i, elem); err != nil {
- return err
- }
- }
-
- ew, ok := w.(EnterExitWalker)
- if ok {
- ew.Enter(SliceElem)
- }
-
- if err := walk(elem, w); err != nil {
- return err
- }
-
- if ok {
- ew.Exit(SliceElem)
- }
- }
-
- ew, ok = w.(EnterExitWalker)
- if ok {
- ew.Exit(Slice)
- }
-
- return nil
-}
-
-func walkStruct(v reflect.Value, w interface{}) (err error) {
- ew, ewok := w.(EnterExitWalker)
- if ewok {
- ew.Enter(Struct)
- }
-
- if sw, ok := w.(StructWalker); ok {
- if err = sw.Struct(v); err != nil {
- return
- }
- }
-
- vt := v.Type()
- for i := 0; i < vt.NumField(); i++ {
- sf := vt.Field(i)
- f := v.FieldByIndex([]int{i})
-
- if sw, ok := w.(StructWalker); ok {
- err = sw.StructField(sf, f)
- if err != nil {
- return
- }
- }
-
- ew, ok := w.(EnterExitWalker)
- if ok {
- ew.Enter(StructField)
- }
-
- err = walk(f, w)
- if err != nil {
- return
- }
-
- if ok {
- ew.Exit(StructField)
- }
- }
-
- if ewok {
- ew.Exit(Struct)
- }
-
- return nil
-}
diff --git a/vendor/github.com/nilshell/xmlrpc/.gitignore b/vendor/github.com/nilshell/xmlrpc/.gitignore
deleted file mode 100644
index 528cd5b3..00000000
--- a/vendor/github.com/nilshell/xmlrpc/.gitignore
+++ /dev/null
@@ -1 +0,0 @@
-example/example
diff --git a/vendor/github.com/nilshell/xmlrpc/client.go b/vendor/github.com/nilshell/xmlrpc/client.go
deleted file mode 100644
index 24f93d66..00000000
--- a/vendor/github.com/nilshell/xmlrpc/client.go
+++ /dev/null
@@ -1,134 +0,0 @@
-package xmlrpc
-
-import (
- "fmt"
- "io/ioutil"
- "net/http"
- "net/rpc"
- "reflect"
-)
-
-type Client struct {
- *rpc.Client
-}
-
-// clientCodec is rpc.ClientCodec interface implementation.
-type clientCodec struct {
- // url presents url of xmlrpc service
- url string
-
- // httpClient works with HTTP protocol
- httpClient *http.Client
-
- // cookies stores cookies received on last request
- cookies []*http.Cookie
-
- // responses presents map of active requests. It is required to return request id, that
- // rpc.Client can mark them as done.
- responses map[uint64]*http.Response
-
- // responseBody holds response body of last request.
- responseBody []byte
-
- // ready presents channel, that is used to link request and it`s response.
- ready chan uint64
-}
-
-func (codec *clientCodec) WriteRequest(request *rpc.Request, params interface{}) (err error) {
- httpRequest, err := newRequest(codec.url, request.ServiceMethod, params)
-
- if codec.cookies != nil {
- for _, cookie := range codec.cookies {
- httpRequest.AddCookie(cookie)
- }
- }
-
- if err != nil {
- return err
- }
-
- var httpResponse *http.Response
- httpResponse, err = codec.httpClient.Do(httpRequest)
-
- if err != nil {
- return err
- }
-
- if codec.cookies == nil {
- codec.cookies = httpResponse.Cookies()
- }
-
- codec.responses[request.Seq] = httpResponse
- codec.ready <- request.Seq
-
- return nil
-}
-
-func (codec *clientCodec) ReadResponseHeader(response *rpc.Response) (err error) {
- seq := <-codec.ready
- httpResponse := codec.responses[seq]
-
- codec.responseBody, err = ioutil.ReadAll(httpResponse.Body)
-
- if err != nil {
- return err
- }
-
- httpResponse.Body.Close()
-
- if fault, _ := responseFailed(codec.responseBody); fault {
- response.Error = fmt.Sprintf("%v", parseFailedResponse(codec.responseBody))
- }
-
- response.Seq = seq
- delete(codec.responses, seq)
-
- return nil
-}
-
-func (codec *clientCodec) ReadResponseBody(x interface{}) (err error) {
- if x == nil {
- return nil
- }
-
- var result interface{}
- result, err = parseSuccessfulResponse(codec.responseBody)
-
- if err != nil {
- return err
- }
-
- v := reflect.ValueOf(x)
-
- if v.Kind() == reflect.Ptr {
- v = v.Elem()
- }
-
- v.Set(reflect.ValueOf(result))
-
- return nil
-}
-
-func (codec *clientCodec) Close() error {
- transport := codec.httpClient.Transport.(*http.Transport)
- transport.CloseIdleConnections()
- return nil
-}
-
-// NewClient returns instance of rpc.Client object, that is used to send request to xmlrpc service.
-func NewClient(url string, transport *http.Transport) (*Client, error) {
- if transport == nil {
- transport = &http.Transport{}
- }
-
- httpClient := &http.Client{Transport: transport}
-
- codec := clientCodec{
- url: url,
- httpClient: httpClient,
- ready: make(chan uint64),
- responses: make(map[uint64]*http.Response),
- }
-
- return &Client{rpc.NewClientWithCodec(&codec)}, nil
-}
diff --git a/vendor/github.com/nilshell/xmlrpc/doc.go b/vendor/github.com/nilshell/xmlrpc/doc.go
deleted file mode 100644
index 380f17ce..00000000
--- a/vendor/github.com/nilshell/xmlrpc/doc.go
+++ /dev/null
@@ -1,7 +0,0 @@
-/*
-Package xmlrpc implements the XML-RPC specification:
-http://xmlrpc.scripting.com/spec.html
-
-TODO: Actual usage documentation here
-*/
-package xmlrpc
diff --git a/vendor/github.com/nilshell/xmlrpc/request.go b/vendor/github.com/nilshell/xmlrpc/request.go
deleted file mode 100644
index 33857110..00000000
--- a/vendor/github.com/nilshell/xmlrpc/request.go
+++ /dev/null
@@ -1,142 +0,0 @@
-package xmlrpc
-
-import (
- "bytes"
- "encoding/xml"
- "fmt"
- "net/http"
- "reflect"
- "strings"
- "time"
-)
-
-func newRequest(url string, method string, params ...interface{}) (*http.Request, error) {
- body := buildRequestBody(method, params)
- request, err := http.NewRequest("POST", url, strings.NewReader(body))
-
- if err != nil {
- return nil, err
- }
-
- request.Header.Set("Content-Type", "text/xml")
- request.Header.Set("Content-Length", fmt.Sprintf("%d", len(body)))
-
- return request, nil
-}
-
-func buildRequestBody(method string, params []interface{}) (buffer string) {
- buffer += ``
- buffer += fmt.Sprintf("%s", method)
-
- if params != nil && len(params) > 0 {
- for _, value := range params {
- if value != nil {
- switch ps := value.(type) {
- case Params:
- for _, p := range ps.Params {
- if p != nil {
- buffer += buildParamElement(p)
- }
- }
- default:
- buffer += buildParamElement(ps)
- }
- }
- }
- }
-
- buffer += ""
-
- return
-}
-
-func buildParamElement(value interface{}) string {
- return fmt.Sprintf("%s", buildValueElement(value))
-}
-
-func buildValueElement(value interface{}) (buffer string) {
- buffer = ``
-
- switch v := value.(type) {
- case Struct:
- buffer += buildStructElement(v)
- case Base64:
- escaped := escapeString(string(v))
- buffer += fmt.Sprintf("%s", escaped)
- case string:
- escaped := escapeString(value.(string))
- buffer += fmt.Sprintf("%s", escaped)
- case int, int8, int16, int32, int64:
- buffer += fmt.Sprintf("%d", v)
- case float32, float64:
- buffer += fmt.Sprintf("%f", v)
- case bool:
- buffer += buildBooleanElement(v)
- case time.Time:
- buffer += buildTimeElement(v)
- default:
- rv := reflect.ValueOf(value)
-
- if rv.Kind() == reflect.Slice || rv.Kind() == reflect.Array {
- buffer += buildArrayElement(v)
- } else {
- fmt.Errorf("Unsupported value type")
- }
- }
-
- buffer += ``
-
- return
-}
-
-func buildStructElement(param Struct) (buffer string) {
- buffer = ``
-
- for name, value := range param {
- buffer += fmt.Sprintf("%s", name)
- buffer += buildValueElement(value)
- buffer += ``
- }
-
- buffer += ``
-
- return
-}
-
-func buildBooleanElement(value bool) (buffer string) {
- if value {
- buffer = `1`
- } else {
- buffer = `0`
- }
-
- return
-}
-
-func buildTimeElement(t time.Time) string {
- return fmt.Sprintf(
- "%d%d%dT%d:%d:%d",
- t.Year(), t.Month(), t.Day(),
- t.Hour(), t.Minute(), t.Second(),
- )
-}
-
-func buildArrayElement(array interface{}) string {
- buffer := ``
-
- a := reflect.ValueOf(array)
- for i := 0; i < a.Len(); i++ {
- buffer += buildValueElement(a.Index(i).Interface())
- }
-
- buffer += ``
-
- return buffer
-}
-
-func escapeString(s string) string {
- buffer := bytes.NewBuffer([]byte{})
- xml.Escape(buffer, []byte(s))
-
- return fmt.Sprintf("%v", buffer)
-}
diff --git a/vendor/github.com/nilshell/xmlrpc/response.go b/vendor/github.com/nilshell/xmlrpc/response.go
deleted file mode 100644
index 4309de23..00000000
--- a/vendor/github.com/nilshell/xmlrpc/response.go
+++ /dev/null
@@ -1,47 +0,0 @@
-package xmlrpc
-
-import (
- "fmt"
- "regexp"
-)
-
-// responseFailed checks whether response failed or not. Response defined as failed if it
-// contains ... section.
-func responseFailed(response []byte) (bool, error) {
- fault := true
- faultRegexp, err := regexp.Compile(`(\s|\S)+`)
-
- if err == nil {
- fault = faultRegexp.Match(response)
- }
-
- return fault, err
-}
-
-func parseSuccessfulResponse(response []byte) (interface{}, error) {
- valueXml := getValueXml(response)
- return parseValue(valueXml)
-}
-
-func parseFailedResponse(response []byte) (err error) {
- var valueXml []byte
- valueXml = getValueXml(response)
-
- value, err := parseValue(valueXml)
- faultDetails := value.(Struct)
-
- if err != nil {
- return err
- }
-
- return &(xmlrpcError{
- code: fmt.Sprintf("%v", faultDetails["faultCode"]),
- message: faultDetails["faultString"].(string),
- })
-}
-
-func getValueXml(rawXml []byte) []byte {
- expr, _ := regexp.Compile(`(\s|\S)+`)
- return expr.Find(rawXml)
-
-}
diff --git a/vendor/github.com/nilshell/xmlrpc/result.go b/vendor/github.com/nilshell/xmlrpc/result.go
deleted file mode 100644
index be0650c1..00000000
--- a/vendor/github.com/nilshell/xmlrpc/result.go
+++ /dev/null
@@ -1,216 +0,0 @@
-package xmlrpc
-
-import (
- "bytes"
- "encoding/xml"
- "fmt"
- "strconv"
- "strings"
- "time"
-)
-
-// TIME_LAYOUT defines time template defined by iso8601, used to encode/decode time values.
-const TIME_LAYOUT = "20060102T15:04:05"
-
-func parseValue(valueXml []byte) (result interface{}, err error) {
- parser := xml.NewDecoder(bytes.NewReader(valueXml))
- result, err = getValue(parser)
-
- return
-}
-
-func getValue(parser *xml.Decoder) (result interface{}, err error) {
- var token xml.Token
-
- token, err = parser.Token()
-
- if err != nil {
- return nil, err
- }
-
- for {
- switch t := token.(type) {
- case xml.StartElement:
- switch t.Name.Local {
- case "boolean":
- return getBooleanValue(parser)
- case "dateTime.iso8601":
- return getDateValue(parser)
- case "double":
- return getDoubleValue(parser)
- case "int", "i4", "i8":
- return getIntValue(parser)
- case "base64":
- return getBase64Value(parser)
- case "string":
- return getStringValue(parser)
- case "struct":
- result, err = getStructValue(parser)
- case "array":
- result, err = getArrayValue(parser)
- default:
- // Move on
- }
- case xml.EndElement:
- if t.Name.Local == "value" {
- return result, nil
- }
- case xml.CharData:
- cdata := strings.TrimSpace(string(t))
- if cdata != "" {
- result = cdata
- }
- }
-
- token, err = parser.Token()
-
- if err != nil {
- return nil, err
- }
- }
-
- return
-}
-
-func getBooleanValue(parser *xml.Decoder) (result interface{}, err error) {
- var value string
- value, err = getElementValue(parser)
-
- switch value {
- case "0":
- return false, nil
- case "1":
- return true, nil
- }
-
- return nil, fmt.Errorf("Parse error: invalid boolean value (%s).", value)
-}
-
-func getDateValue(parser *xml.Decoder) (result interface{}, err error) {
- var value string
- value, err = getElementValue(parser)
- result, err = time.Parse(TIME_LAYOUT, value)
-
- return
-}
-
-func getDoubleValue(parser *xml.Decoder) (interface{}, error) {
- value, _ := getElementValue(parser)
- return strconv.ParseFloat(value, 64)
-}
-
-func getIntValue(parser *xml.Decoder) (interface{}, error) {
- value, _ := getElementValue(parser)
- var number int64
- number, err := strconv.ParseInt(value, 0, 64)
-
- return number, err
-}
-
-func getBase64Value(parser *xml.Decoder) (string, error) {
- return getElementValue(parser)
-}
-
-func getStringValue(parser *xml.Decoder) (string, error) {
- return getElementValue(parser)
-}
-
-func getStructValue(parser *xml.Decoder) (result interface{}, err error) {
- var token xml.Token
- token, err = parser.Token()
-
- result = Struct{}
-
- for {
- switch t := token.(type) {
- case xml.StartElement:
- member := getStructMember(parser)
- result.(Struct)[member["name"].(string)] = member["value"]
- case xml.EndElement:
- if t.Name.Local == "struct" {
- return result, err
- }
- }
-
- token, err = parser.Token()
- }
-
- return
-}
-
-func getStructMember(parser *xml.Decoder) (member Struct) {
- var token xml.Token
- token, _ = parser.Token()
-
- member = Struct{}
-
- for {
- switch t := token.(type) {
- case xml.StartElement:
- if t.Name.Local == "name" {
- member["name"], _ = getElementValue(parser)
- }
-
- if t.Name.Local == "value" {
- member["value"], _ = getValue(parser)
- }
- case xml.EndElement:
- if t.Name.Local == "member" {
- return member
- }
- }
-
- token, _ = parser.Token()
- }
-
- return
-}
-
-func getElementValue(parser *xml.Decoder) (value string, err error) {
- var token xml.Token
- token, err = parser.Token()
-
- processing := true
-
- for processing {
- switch token.(type) {
- case xml.CharData:
- value = strings.TrimSpace(string(token.(xml.CharData)))
- if value != "" {
- processing = false
- }
- case xml.EndElement:
- processing = false
- }
- token, err = parser.Token()
- }
-
- return
-}
-
-func getArrayValue(parser *xml.Decoder) (result interface{}, err error) {
- var token xml.Token
- token, err = parser.Token()
-
- result = []interface{}{}
-
- for {
- switch t := token.(type) {
- case xml.StartElement:
- if t.Name.Local == "value" {
- var value interface{}
- value, err = getValue(parser)
-
- result = append(result.([]interface{}), value)
- }
- case xml.EndElement:
- if t.Name.Local == "array" {
- return result, err
- }
- }
-
- token, err = parser.Token()
- }
-
- return
-}
diff --git a/vendor/github.com/nilshell/xmlrpc/xmlrpc.go b/vendor/github.com/nilshell/xmlrpc/xmlrpc.go
deleted file mode 100644
index f433cea6..00000000
--- a/vendor/github.com/nilshell/xmlrpc/xmlrpc.go
+++ /dev/null
@@ -1,27 +0,0 @@
-package xmlrpc
-
-import (
- "fmt"
-)
-
-// Struct presents hash type used in xmlprc requests and responses.
-type Struct map[string]interface{}
-
-// Base64 represents base64 data
-type Base64 string
-
-// Params represents a list of parameters to a method.
-type Params struct {
- Params []interface{}
-}
-
-// xmlrpcError represents errors returned on xmlrpc request.
-type xmlrpcError struct {
- code string
- message string
-}
-
-// Error() method implements Error interface
-func (e *xmlrpcError) Error() string {
- return fmt.Sprintf("Error: \"%s\" Code: %s", e.message, e.code)
-}
diff --git a/vendor/github.com/nu7hatch/gouuid/.gitignore b/vendor/github.com/nu7hatch/gouuid/.gitignore
deleted file mode 100644
index f9d9cd8a..00000000
--- a/vendor/github.com/nu7hatch/gouuid/.gitignore
+++ /dev/null
@@ -1,11 +0,0 @@
-_obj
-_test
-*.6
-*.out
-_testmain.go
-\#*
-.\#*
-*.log
-_cgo*
-*.o
-*.a
diff --git a/vendor/github.com/nu7hatch/gouuid/COPYING b/vendor/github.com/nu7hatch/gouuid/COPYING
deleted file mode 100644
index d7849fd8..00000000
--- a/vendor/github.com/nu7hatch/gouuid/COPYING
+++ /dev/null
@@ -1,19 +0,0 @@
-Copyright (C) 2011 by Krzysztof Kowalik
-
-Permission is hereby granted, free of charge, to any person obtaining a copy of
-this software and associated documentation files (the "Software"), to deal in
-the Software without restriction, including without limitation the rights to
-use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
-of the Software, and to permit persons to whom the Software is furnished to do
-so, subject to the following conditions:
-
-The above copyright notice and this permission notice shall be included in all
-copies or substantial portions of the Software.
-
-THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
-OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
-SOFTWARE.
\ No newline at end of file
diff --git a/vendor/github.com/nu7hatch/gouuid/README.md b/vendor/github.com/nu7hatch/gouuid/README.md
deleted file mode 100644
index e3d025d5..00000000
--- a/vendor/github.com/nu7hatch/gouuid/README.md
+++ /dev/null
@@ -1,21 +0,0 @@
-# Pure Go UUID implementation
-
-This package provides immutable UUID structs and the functions
-NewV3, NewV4, NewV5 and Parse() for generating versions 3, 4
-and 5 UUIDs as specified in [RFC 4122](http://www.ietf.org/rfc/rfc4122.txt).
-
-## Installation
-
-Use the `go` tool:
-
- $ go get github.com/nu7hatch/gouuid
-
-## Usage
-
-See [documentation and examples](http://godoc.org/github.com/nu7hatch/gouuid)
-for more information.
-
-## Copyright
-
-Copyright (C) 2011 by Krzysztof Kowalik . See [COPYING](https://github.com/nu7hatch/gouuid/tree/master/COPYING)
-file for details.
diff --git a/vendor/github.com/nu7hatch/gouuid/uuid.go b/vendor/github.com/nu7hatch/gouuid/uuid.go
deleted file mode 100644
index ca960aa9..00000000
--- a/vendor/github.com/nu7hatch/gouuid/uuid.go
+++ /dev/null
@@ -1,173 +0,0 @@
-// This package provides immutable UUID structs and the functions
-// NewV3, NewV4, NewV5 and Parse() for generating versions 3, 4
-// and 5 UUIDs as specified in RFC 4122.
-//
-// Copyright (C) 2011 by Krzysztof Kowalik
-package uuid
-
-import (
- "crypto/md5"
- "crypto/rand"
- "crypto/sha1"
- "encoding/hex"
- "errors"
- "fmt"
- "hash"
- "regexp"
-)
-
-// The UUID reserved variants.
-const (
- ReservedNCS byte = 0x80
- ReservedRFC4122 byte = 0x40
- ReservedMicrosoft byte = 0x20
- ReservedFuture byte = 0x00
-)
-
-// The following standard UUIDs are for use with NewV3() or NewV5().
-var (
- NamespaceDNS, _ = ParseHex("6ba7b810-9dad-11d1-80b4-00c04fd430c8")
- NamespaceURL, _ = ParseHex("6ba7b811-9dad-11d1-80b4-00c04fd430c8")
- NamespaceOID, _ = ParseHex("6ba7b812-9dad-11d1-80b4-00c04fd430c8")
- NamespaceX500, _ = ParseHex("6ba7b814-9dad-11d1-80b4-00c04fd430c8")
-)
-
-// Pattern used to parse hex string representation of the UUID.
-// FIXME: do something to consider both brackets at one time,
-// current one allows to parse string with only one opening
-// or closing bracket.
-const hexPattern = "^(urn\\:uuid\\:)?\\{?([a-z0-9]{8})-([a-z0-9]{4})-" +
- "([1-5][a-z0-9]{3})-([a-z0-9]{4})-([a-z0-9]{12})\\}?$"
-
-var re = regexp.MustCompile(hexPattern)
-
-// A UUID representation compliant with specification in
-// RFC 4122 document.
-type UUID [16]byte
-
-// ParseHex creates a UUID object from given hex string
-// representation. Function accepts UUID string in following
-// formats:
-//
-// uuid.ParseHex("6ba7b814-9dad-11d1-80b4-00c04fd430c8")
-// uuid.ParseHex("{6ba7b814-9dad-11d1-80b4-00c04fd430c8}")
-// uuid.ParseHex("urn:uuid:6ba7b814-9dad-11d1-80b4-00c04fd430c8")
-//
-func ParseHex(s string) (u *UUID, err error) {
- md := re.FindStringSubmatch(s)
- if md == nil {
- err = errors.New("Invalid UUID string")
- return
- }
- hash := md[2] + md[3] + md[4] + md[5] + md[6]
- b, err := hex.DecodeString(hash)
- if err != nil {
- return
- }
- u = new(UUID)
- copy(u[:], b)
- return
-}
-
-// Parse creates a UUID object from given bytes slice.
-func Parse(b []byte) (u *UUID, err error) {
- if len(b) != 16 {
- err = errors.New("Given slice is not valid UUID sequence")
- return
- }
- u = new(UUID)
- copy(u[:], b)
- return
-}
-
-// Generate a UUID based on the MD5 hash of a namespace identifier
-// and a name.
-func NewV3(ns *UUID, name []byte) (u *UUID, err error) {
- if ns == nil {
- err = errors.New("Invalid namespace UUID")
- return
- }
- u = new(UUID)
- // Set all bits to MD5 hash generated from namespace and name.
- u.setBytesFromHash(md5.New(), ns[:], name)
- u.setVariant(ReservedRFC4122)
- u.setVersion(3)
- return
-}
-
-// Generate a random UUID.
-func NewV4() (u *UUID, err error) {
- u = new(UUID)
- // Set all bits to randomly (or pseudo-randomly) chosen values.
- _, err = rand.Read(u[:])
- if err != nil {
- return
- }
- u.setVariant(ReservedRFC4122)
- u.setVersion(4)
- return
-}
-
-// Generate a UUID based on the SHA-1 hash of a namespace identifier
-// and a name.
-func NewV5(ns *UUID, name []byte) (u *UUID, err error) {
- u = new(UUID)
- // Set all bits to truncated SHA1 hash generated from namespace
- // and name.
- u.setBytesFromHash(sha1.New(), ns[:], name)
- u.setVariant(ReservedRFC4122)
- u.setVersion(5)
- return
-}
-
-// Generate a MD5 hash of a namespace and a name, and copy it to the
-// UUID slice.
-func (u *UUID) setBytesFromHash(hash hash.Hash, ns, name []byte) {
- hash.Write(ns[:])
- hash.Write(name)
- copy(u[:], hash.Sum([]byte{})[:16])
-}
-
-// Set the two most significant bits (bits 6 and 7) of the
-// clock_seq_hi_and_reserved to zero and one, respectively.
-func (u *UUID) setVariant(v byte) {
- switch v {
- case ReservedNCS:
- u[8] = (u[8] | ReservedNCS) & 0xBF
- case ReservedRFC4122:
- u[8] = (u[8] | ReservedRFC4122) & 0x7F
- case ReservedMicrosoft:
- u[8] = (u[8] | ReservedMicrosoft) & 0x3F
- }
-}
-
-// Variant returns the UUID Variant, which determines the internal
-// layout of the UUID. This will be one of the constants: RESERVED_NCS,
-// RFC_4122, RESERVED_MICROSOFT, RESERVED_FUTURE.
-func (u *UUID) Variant() byte {
- if u[8]&ReservedNCS == ReservedNCS {
- return ReservedNCS
- } else if u[8]&ReservedRFC4122 == ReservedRFC4122 {
- return ReservedRFC4122
- } else if u[8]&ReservedMicrosoft == ReservedMicrosoft {
- return ReservedMicrosoft
- }
- return ReservedFuture
-}
-
-// Set the four most significant bits (bits 12 through 15) of the
-// time_hi_and_version field to the 4-bit version number.
-func (u *UUID) setVersion(v byte) {
- u[6] = (u[6] & 0xF) | (v << 4)
-}
-
-// Version returns a version number of the algorithm used to
-// generate the UUID sequence.
-func (u *UUID) Version() uint {
- return uint(u[6] >> 4)
-}
-
-// Returns unparsed version of the generated UUID sequence.
-func (u *UUID) String() string {
- return fmt.Sprintf("%x-%x-%x-%x-%x", u[0:4], u[4:6], u[6:8], u[8:10], u[10:])
-}
diff --git a/vendor/github.com/packer-community/winrmcp/LICENSE b/vendor/github.com/packer-community/winrmcp/LICENSE
deleted file mode 100644
index 22a81f8c..00000000
--- a/vendor/github.com/packer-community/winrmcp/LICENSE
+++ /dev/null
@@ -1,22 +0,0 @@
-Copyright (c) 2015 Dylan Meissner
-
-MIT License
-
-Permission is hereby granted, free of charge, to any person obtaining
-a copy of this software and associated documentation files (the
-"Software"), to deal in the Software without restriction, including
-without limitation the rights to use, copy, modify, merge, publish,
-distribute, sublicense, and/or sell copies of the Software, and to
-permit persons to whom the Software is furnished to do so, subject to
-the following conditions:
-
-The above copyright notice and this permission notice shall be
-included in all copies or substantial portions of the Software.
-
-THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
-WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
diff --git a/vendor/github.com/packer-community/winrmcp/winrmcp/cp.go b/vendor/github.com/packer-community/winrmcp/winrmcp/cp.go
deleted file mode 100644
index 1065e452..00000000
--- a/vendor/github.com/packer-community/winrmcp/winrmcp/cp.go
+++ /dev/null
@@ -1,200 +0,0 @@
-package winrmcp
-
-import (
- "encoding/base64"
- "errors"
- "fmt"
- "io"
- "log"
- "os"
- "sync"
-
- "github.com/masterzen/winrm/winrm"
- "github.com/mitchellh/packer/common/uuid"
-)
-
-func doCopy(client *winrm.Client, config *Config, in io.Reader, toPath string) error {
- tempFile := fmt.Sprintf("winrmcp-%s.tmp", uuid.TimeOrderedUUID())
- tempPath := "$env:TEMP\\" + tempFile
-
- if os.Getenv("WINRMCP_DEBUG") != "" {
- log.Printf("Copying file to %s\n", tempPath)
- }
-
- err := uploadContent(client, config.MaxOperationsPerShell, "%TEMP%\\"+tempFile, in)
- if err != nil {
- return errors.New(fmt.Sprintf("Error uploading file to %s: %v", tempPath, err))
- }
-
- if os.Getenv("WINRMCP_DEBUG") != "" {
- log.Printf("Moving file from %s to %s", tempPath, toPath)
- }
-
- err = restoreContent(client, tempPath, toPath)
- if err != nil {
- return errors.New(fmt.Sprintf("Error restoring file from %s to %s: %v", tempPath, toPath, err))
- }
-
- if os.Getenv("WINRMCP_DEBUG") != "" {
- log.Printf("Removing temporary file %s", tempPath)
- }
-
- err = cleanupContent(client, tempPath)
- if err != nil {
- return errors.New(fmt.Sprintf("Error removing temporary file %s: %v", tempPath, err))
- }
-
- return nil
-}
-
-func uploadContent(client *winrm.Client, maxChunks int, filePath string, reader io.Reader) error {
- var err error
- done := false
- for !done {
- done, err = uploadChunks(client, filePath, maxChunks, reader)
- if err != nil {
- return err
- }
- }
-
- return nil
-}
-
-func uploadChunks(client *winrm.Client, filePath string, maxChunks int, reader io.Reader) (bool, error) {
- shell, err := client.CreateShell()
- if err != nil {
- return false, errors.New(fmt.Sprintf("Couldn't create shell: %v", err))
- }
- defer shell.Close()
-
- // Upload the file in chunks to get around the Windows command line size limit.
- // Base64 encodes each set of three bytes into four bytes. In addition the output
- // is padded to always be a multiple of four.
- //
- // ceil(n / 3) * 4 = m1 - m2
- //
- // where:
- // n = bytes
- // m1 = max (8192 character command limit.)
- // m2 = len(filePath)
-
- chunkSize := ((8000 - len(filePath)) / 4) * 3
- chunk := make([]byte, chunkSize)
-
- if maxChunks == 0 {
- maxChunks = 1
- }
-
- for i := 0; i < maxChunks; i++ {
- n, err := reader.Read(chunk)
-
- if err != nil && err != io.EOF {
- return false, err
- }
- if n == 0 {
- return true, nil
- }
-
- content := base64.StdEncoding.EncodeToString(chunk[:n])
- if err = appendContent(shell, filePath, content); err != nil {
- return false, err
- }
- }
-
- return false, nil
-}
-
-func restoreContent(client *winrm.Client, fromPath, toPath string) error {
- shell, err := client.CreateShell()
- if err != nil {
- return err
- }
-
- defer shell.Close()
- script := fmt.Sprintf(`
- $tmp_file_path = [System.IO.Path]::GetFullPath("%s")
- $dest_file_path = [System.IO.Path]::GetFullPath("%s")
- if (Test-Path $dest_file_path) {
- rm $dest_file_path
- }
- else {
- $dest_dir = ([System.IO.Path]::GetDirectoryName($dest_file_path))
- New-Item -ItemType directory -Force -ErrorAction SilentlyContinue -Path $dest_dir | Out-Null
- }
-
- if (Test-Path $tmp_file_path) {
- $base64_lines = Get-Content $tmp_file_path
- $base64_string = [string]::join("",$base64_lines)
- $bytes = [System.Convert]::FromBase64String($base64_string)
- [System.IO.File]::WriteAllBytes($dest_file_path, $bytes)
- } else {
- echo $null > $dest_file_path
- }
- `, fromPath, toPath)
-
- cmd, err := shell.Execute(winrm.Powershell(script))
- if err != nil {
- return err
- }
- defer cmd.Close()
-
- var wg sync.WaitGroup
- copyFunc := func(w io.Writer, r io.Reader) {
- defer wg.Done()
- io.Copy(w, r)
- }
-
- wg.Add(2)
- go copyFunc(os.Stdout, cmd.Stdout)
- go copyFunc(os.Stderr, cmd.Stderr)
-
- cmd.Wait()
- wg.Wait()
-
- if cmd.ExitCode() != 0 {
- return errors.New(fmt.Sprintf("restore operation returned code=%d", cmd.ExitCode()))
- }
- return nil
-}
-
-func cleanupContent(client *winrm.Client, filePath string) error {
- shell, err := client.CreateShell()
- if err != nil {
- return err
- }
-
- defer shell.Close()
- cmd, _ := shell.Execute("powershell", "Remove-Item", filePath, "-ErrorAction SilentlyContinue")
-
- cmd.Wait()
- cmd.Close()
- return nil
-}
-
-func appendContent(shell *winrm.Shell, filePath, content string) error {
- cmd, err := shell.Execute(fmt.Sprintf("echo %s >> \"%s\"", content, filePath))
-
- if err != nil {
- return err
- }
-
- defer cmd.Close()
- var wg sync.WaitGroup
- copyFunc := func(w io.Writer, r io.Reader) {
- defer wg.Done()
- io.Copy(w, r)
- }
-
- wg.Add(2)
- go copyFunc(os.Stdout, cmd.Stdout)
- go copyFunc(os.Stderr, cmd.Stderr)
-
- cmd.Wait()
- wg.Wait()
-
- if cmd.ExitCode() != 0 {
- return errors.New(fmt.Sprintf("upload operation returned code=%d", cmd.ExitCode()))
- }
-
- return nil
-}
diff --git a/vendor/github.com/packer-community/winrmcp/winrmcp/endpoint.go b/vendor/github.com/packer-community/winrmcp/winrmcp/endpoint.go
deleted file mode 100644
index ccd7d0d1..00000000
--- a/vendor/github.com/packer-community/winrmcp/winrmcp/endpoint.go
+++ /dev/null
@@ -1,42 +0,0 @@
-package winrmcp
-
-import (
- "errors"
- "fmt"
- "net"
- "strconv"
- "strings"
-
- "github.com/masterzen/winrm/winrm"
-)
-
-func parseEndpoint(addr string, https bool, insecure bool, caCert []byte) (*winrm.Endpoint, error) {
- var host string
- var port int
-
- if addr == "" {
- return nil, errors.New("Couldn't convert \"\" to an address.")
- }
- if !strings.Contains(addr, ":") {
- host = addr
- port = 5985
- } else {
- shost, sport, err := net.SplitHostPort(addr)
- if err != nil {
- return nil, errors.New(fmt.Sprintf("Couldn't convert \"%s\" to an address.", addr))
- }
- host = shost
- port, err = strconv.Atoi(sport)
- if err != nil {
- return nil, errors.New("Couldn't convert \"%s\" to a port number.")
- }
- }
-
- return &winrm.Endpoint{
- Host: host,
- Port: port,
- HTTPS: https,
- Insecure: insecure,
- CACert: &caCert,
- }, nil
-}
diff --git a/vendor/github.com/packer-community/winrmcp/winrmcp/ls.go b/vendor/github.com/packer-community/winrmcp/winrmcp/ls.go
deleted file mode 100644
index 1a6cbaf5..00000000
--- a/vendor/github.com/packer-community/winrmcp/winrmcp/ls.go
+++ /dev/null
@@ -1,71 +0,0 @@
-package winrmcp
-
-import (
- "encoding/xml"
- "errors"
- "fmt"
- "log"
- "os"
- "strconv"
-
- "github.com/masterzen/winrm/winrm"
-)
-
-type FileItem struct {
- Name string
- Path string
- Mode string
- LastWriteTime string
- Length int
-}
-
-func fetchList(client *winrm.Client, remotePath string) ([]FileItem, error) {
- script := fmt.Sprintf("Get-ChildItem %s", remotePath)
- stdout, stderr, _, err := client.RunWithString("powershell -Command \""+script+" | ConvertTo-Xml -NoTypeInformation -As String\"", "")
- if err != nil {
- return nil, errors.New(fmt.Sprintf("Couldn't execute script %s: %v", script, err))
- }
-
- if stderr != "" {
- if os.Getenv("WINRMCP_DEBUG") != "" {
- log.Printf("STDERR returned: %s\n", stderr)
- }
- }
-
- if stdout != "" {
- doc := pslist{}
- err := xml.Unmarshal([]byte(stdout), &doc)
- if err != nil {
- return nil, errors.New(fmt.Sprintf("Couldn't parse results: %v", err))
- }
-
- return convertFileItems(doc.Objects), nil
- }
-
- return []FileItem{}, nil
-}
-
-func convertFileItems(objects []psobject) []FileItem {
- items := make([]FileItem, len(objects))
-
- for i, object := range objects {
- for _, property := range object.Properties {
- switch property.Name {
- case "Name":
- items[i].Name = property.Value
- case "Mode":
- items[i].Mode = property.Value
- case "FullName":
- items[i].Path = property.Value
- case "Length":
- if n, err := strconv.Atoi(property.Value); err == nil {
- items[i].Length = n
- }
- case "LastWriteTime":
- items[i].LastWriteTime = property.Value
- }
- }
- }
-
- return items
-}
diff --git a/vendor/github.com/packer-community/winrmcp/winrmcp/path.go b/vendor/github.com/packer-community/winrmcp/winrmcp/path.go
deleted file mode 100644
index c35cc072..00000000
--- a/vendor/github.com/packer-community/winrmcp/winrmcp/path.go
+++ /dev/null
@@ -1,18 +0,0 @@
-package winrmcp
-
-import (
- "fmt"
- "strings"
-)
-
-func winPath(path string) string {
- if len(path) == 0 {
- return path
- }
-
- if strings.Contains(path, " ") {
- path = fmt.Sprintf("'%s'", strings.Trim(path, "'\""))
- }
-
- return strings.Replace(path, "/", "\\", -1)
-}
diff --git a/vendor/github.com/packer-community/winrmcp/winrmcp/psobject.go b/vendor/github.com/packer-community/winrmcp/winrmcp/psobject.go
deleted file mode 100644
index 88a7ef1b..00000000
--- a/vendor/github.com/packer-community/winrmcp/winrmcp/psobject.go
+++ /dev/null
@@ -1,15 +0,0 @@
-package winrmcp
-
-type pslist struct {
- Objects []psobject `xml:"Object"`
-}
-
-type psobject struct {
- Properties []psproperty `xml:"Property"`
- Value string `xml:",innerxml"`
-}
-
-type psproperty struct {
- Name string `xml:"Name,attr"`
- Value string `xml:",innerxml"`
-}
diff --git a/vendor/github.com/packer-community/winrmcp/winrmcp/winrmcp.go b/vendor/github.com/packer-community/winrmcp/winrmcp/winrmcp.go
deleted file mode 100644
index d41061b4..00000000
--- a/vendor/github.com/packer-community/winrmcp/winrmcp/winrmcp.go
+++ /dev/null
@@ -1,123 +0,0 @@
-package winrmcp
-
-import (
- "errors"
- "fmt"
- "io"
- "net/http"
- "os"
- "path/filepath"
- "time"
-
- "github.com/dylanmei/iso8601"
- "github.com/masterzen/winrm/winrm"
-)
-
-type Winrmcp struct {
- client *winrm.Client
- config *Config
-}
-
-type Config struct {
- Auth Auth
- Https bool
- Insecure bool
- CACertBytes []byte
- OperationTimeout time.Duration
- MaxOperationsPerShell int
- TransportDecorator func(*http.Transport) http.RoundTripper
-}
-
-type Auth struct {
- User string
- Password string
-}
-
-func New(addr string, config *Config) (*Winrmcp, error) {
- endpoint, err := parseEndpoint(addr, config.Https, config.Insecure, config.CACertBytes)
- if err != nil {
- return nil, err
- }
- if config == nil {
- config = &Config{}
- }
-
- params := winrm.DefaultParameters()
- if config.TransportDecorator != nil {
- params.TransportDecorator = config.TransportDecorator
- }
-
- if config.OperationTimeout.Seconds() > 0 {
- params.Timeout = iso8601.FormatDuration(config.OperationTimeout)
- }
- client, err := winrm.NewClientWithParameters(
- endpoint, config.Auth.User, config.Auth.Password, params)
- return &Winrmcp{client, config}, err
-}
-
-func (fs *Winrmcp) Copy(fromPath, toPath string) error {
- f, err := os.Open(fromPath)
- if err != nil {
- return errors.New(fmt.Sprintf("Couldn't read file %s: %v", fromPath, err))
- }
-
- defer f.Close()
- fi, err := f.Stat()
- if err != nil {
- return errors.New(fmt.Sprintf("Couldn't stat file %s: %v", fromPath, err))
- }
-
- if !fi.IsDir() {
- return fs.Write(toPath, f)
- } else {
- fw := fileWalker{
- client: fs.client,
- config: fs.config,
- toDir: toPath,
- fromDir: fromPath,
- }
- return filepath.Walk(fromPath, fw.copyFile)
- }
-}
-
-func (fs *Winrmcp) Write(toPath string, src io.Reader) error {
- return doCopy(fs.client, fs.config, src, winPath(toPath))
-}
-
-func (fs *Winrmcp) List(remotePath string) ([]FileItem, error) {
- return fetchList(fs.client, winPath(remotePath))
-}
-
-type fileWalker struct {
- client *winrm.Client
- config *Config
- toDir string
- fromDir string
-}
-
-func (fw *fileWalker) copyFile(fromPath string, fi os.FileInfo, err error) error {
- if err != nil {
- return err
- }
-
- if !shouldUploadFile(fi) {
- return nil
- }
-
- hostPath, _ := filepath.Abs(fromPath)
- fromDir, _ := filepath.Abs(fw.fromDir)
- relPath, _ := filepath.Rel(fromDir, hostPath)
- toPath := filepath.Join(fw.toDir, relPath)
-
- f, err := os.Open(hostPath)
- if err != nil {
- return errors.New(fmt.Sprintf("Couldn't read file %s: %v", fromPath, err))
- }
-
- return doCopy(fw.client, fw.config, f, winPath(toPath))
-}
-
-func shouldUploadFile(fi os.FileInfo) bool {
- // Ignore dir entries and OS X special hidden file
- return !fi.IsDir() && ".DS_Store" != fi.Name()
-}
diff --git a/vendor/github.com/pkg/errors/.gitignore b/vendor/github.com/pkg/errors/.gitignore
deleted file mode 100644
index daf913b1..00000000
--- a/vendor/github.com/pkg/errors/.gitignore
+++ /dev/null
@@ -1,24 +0,0 @@
-# Compiled Object files, Static and Dynamic libs (Shared Objects)
-*.o
-*.a
-*.so
-
-# Folders
-_obj
-_test
-
-# Architecture specific extensions/prefixes
-*.[568vq]
-[568vq].out
-
-*.cgo1.go
-*.cgo2.c
-_cgo_defun.c
-_cgo_gotypes.go
-_cgo_export.*
-
-_testmain.go
-
-*.exe
-*.test
-*.prof
diff --git a/vendor/github.com/pkg/errors/.travis.yml b/vendor/github.com/pkg/errors/.travis.yml
deleted file mode 100644
index 024e2846..00000000
--- a/vendor/github.com/pkg/errors/.travis.yml
+++ /dev/null
@@ -1,10 +0,0 @@
-language: go
-go_import_path: github.com/pkg/errors
-go:
- - 1.4.3
- - 1.5.4
- - 1.6.2
- - tip
-
-script:
- - go test -v ./...
diff --git a/vendor/github.com/pkg/errors/LICENSE b/vendor/github.com/pkg/errors/LICENSE
deleted file mode 100644
index 835ba3e7..00000000
--- a/vendor/github.com/pkg/errors/LICENSE
+++ /dev/null
@@ -1,23 +0,0 @@
-Copyright (c) 2015, Dave Cheney
-All rights reserved.
-
-Redistribution and use in source and binary forms, with or without
-modification, are permitted provided that the following conditions are met:
-
-* Redistributions of source code must retain the above copyright notice, this
- list of conditions and the following disclaimer.
-
-* Redistributions in binary form must reproduce the above copyright notice,
- this list of conditions and the following disclaimer in the documentation
- and/or other materials provided with the distribution.
-
-THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
-AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
-DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
-FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
-DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
-SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
-CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
-OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
diff --git a/vendor/github.com/pkg/errors/README.md b/vendor/github.com/pkg/errors/README.md
deleted file mode 100644
index 6ea6422e..00000000
--- a/vendor/github.com/pkg/errors/README.md
+++ /dev/null
@@ -1,50 +0,0 @@
-# errors [![Travis-CI](https://travis-ci.org/pkg/errors.svg)](https://travis-ci.org/pkg/errors) [![AppVeyor](https://ci.appveyor.com/api/projects/status/b98mptawhudj53ep/branch/master?svg=true)](https://ci.appveyor.com/project/davecheney/errors/branch/master) [![GoDoc](https://godoc.org/github.com/pkg/errors?status.svg)](http://godoc.org/github.com/pkg/errors) [![Report card](https://goreportcard.com/badge/github.com/pkg/errors)](https://goreportcard.com/report/github.com/pkg/errors)
-
-Package errors provides simple error handling primitives.
-
-The traditional error handling idiom in Go is roughly akin to
-```go
-if err != nil {
- return err
-}
-```
-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.
-
-## Adding context to an error
-
-The errors.Wrap function returns a new error that adds context to the original error. For example
-```go
-_, err := ioutil.ReadAll(r)
-if err != nil {
- return errors.Wrap(err, "read failed")
-}
-```
-## Retrieving the cause of an error
-
-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`.
-```go
-type causer interface {
- Cause() error
-}
-```
-`errors.Cause` will recursively retrieve the topmost error which does not implement `causer`, which is assumed to be the original cause. For example:
-```go
-switch err := errors.Cause(err).(type) {
-case *MyError:
- // handle specifically
-default:
- // unknown error
-}
-```
-
-[Read the package documentation for more information](https://godoc.org/github.com/pkg/errors).
-
-## Contributing
-
-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.
-
-Before proposing a change, please discuss your change by raising an issue.
-
-## Licence
-
-BSD-2-Clause
diff --git a/vendor/github.com/pkg/errors/appveyor.yml b/vendor/github.com/pkg/errors/appveyor.yml
deleted file mode 100644
index a932eade..00000000
--- a/vendor/github.com/pkg/errors/appveyor.yml
+++ /dev/null
@@ -1,32 +0,0 @@
-version: build-{build}.{branch}
-
-clone_folder: C:\gopath\src\github.com\pkg\errors
-shallow_clone: true # for startup speed
-
-environment:
- GOPATH: C:\gopath
-
-platform:
- - x64
-
-# http://www.appveyor.com/docs/installed-software
-install:
- # some helpful output for debugging builds
- - go version
- - go env
- # pre-installed MinGW at C:\MinGW is 32bit only
- # but MSYS2 at C:\msys64 has mingw64
- - set PATH=C:\msys64\mingw64\bin;%PATH%
- - gcc --version
- - g++ --version
-
-build_script:
- - go install -v ./...
-
-test_script:
- - set PATH=C:\gopath\bin;%PATH%
- - go test -v ./...
-
-#artifacts:
-# - path: '%GOPATH%\bin\*.exe'
-deploy: off
diff --git a/vendor/github.com/pkg/errors/errors.go b/vendor/github.com/pkg/errors/errors.go
deleted file mode 100644
index 6c45c8dc..00000000
--- a/vendor/github.com/pkg/errors/errors.go
+++ /dev/null
@@ -1,214 +0,0 @@
-// Package errors provides simple error handling primitives.
-//
-// The traditional error handling idiom in Go is roughly akin to
-//
-// if err != nil {
-// return err
-// }
-//
-// 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.
-//
-// Adding context to an error
-//
-// The errors.Wrap function returns a new error that adds context to the
-// original error. For example
-//
-// _, err := ioutil.ReadAll(r)
-// if err != nil {
-// return errors.Wrap(err, "read failed")
-// }
-//
-// Retrieving the cause of an error
-//
-// 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
-//
-// type Causer interface {
-// Cause() error
-// }
-//
-// can be inspected by errors.Cause. errors.Cause will recursively retrieve
-// the topmost error which does not implement causer, which is assumed to be
-// the original cause. For example:
-//
-// switch err := errors.Cause(err).(type) {
-// case *MyError:
-// // handle specifically
-// default:
-// // unknown error
-// }
-//
-// Formatted printing of errors
-//
-// All error values returned from this package implement fmt.Formatter and can
-// be formatted by the fmt package. The following verbs are supported
-//
-// %s print the error. If the error has a Cause it will be
-// printed recursively
-// %v see %s
-// %+v extended format. Each Frame of the error's StackTrace will
-// be printed in detail.
-//
-// Retrieving the stack trace of an error or wrapper
-//
-// New, Errorf, Wrap, and Wrapf record a stack trace at the point they are
-// invoked. This information can be retrieved with the following interface.
-//
-// type stackTracer interface {
-// StackTrace() errors.StackTrace
-// }
-//
-// Where errors.StackTrace is defined as
-//
-// type StackTrace []Frame
-//
-// The Frame type represents a call site in the stack trace. Frame supports
-// the fmt.Formatter interface that can be used for printing information about
-// the stack trace of this error. For example:
-//
-// if err, ok := err.(stackTracer); ok {
-// for _, f := range err.StackTrace() {
-// fmt.Printf("%+s:%d", f)
-// }
-// }
-//
-// See the documentation for Frame.Format for more details.
-package errors
-
-import (
- "fmt"
- "io"
-)
-
-// _error is an error implementation returned by New and Errorf
-// that implements its own fmt.Formatter.
-type _error struct {
- msg string
- *stack
-}
-
-func (e _error) Error() string { return e.msg }
-
-func (e _error) Format(s fmt.State, verb rune) {
- switch verb {
- case 'v':
- if s.Flag('+') {
- io.WriteString(s, e.msg)
- fmt.Fprintf(s, "%+v", e.StackTrace())
- return
- }
- fallthrough
- case 's':
- io.WriteString(s, e.msg)
- }
-}
-
-// New returns an error with the supplied message.
-func New(message string) error {
- return _error{
- message,
- callers(),
- }
-}
-
-// Errorf formats according to a format specifier and returns the string
-// as a value that satisfies error.
-func Errorf(format string, args ...interface{}) error {
- return _error{
- fmt.Sprintf(format, args...),
- callers(),
- }
-}
-
-type cause struct {
- cause error
- msg string
-}
-
-func (c cause) Error() string { return fmt.Sprintf("%s: %v", c.msg, c.Cause()) }
-func (c cause) Cause() error { return c.cause }
-
-// wrapper is an error implementation returned by Wrap and Wrapf
-// that implements its own fmt.Formatter.
-type wrapper struct {
- cause
- *stack
-}
-
-func (w wrapper) Format(s fmt.State, verb rune) {
- switch verb {
- case 'v':
- if s.Flag('+') {
- fmt.Fprintf(s, "%+v\n", w.Cause())
- io.WriteString(s, w.msg)
- fmt.Fprintf(s, "%+v", w.StackTrace())
- return
- }
- fallthrough
- case 's':
- io.WriteString(s, w.Error())
- case 'q':
- fmt.Fprintf(s, "%q", w.Error())
- }
-}
-
-// Wrap returns an error annotating err with message.
-// If err is nil, Wrap returns nil.
-func Wrap(err error, message string) error {
- if err == nil {
- return nil
- }
- return wrapper{
- cause: cause{
- cause: err,
- msg: message,
- },
- stack: callers(),
- }
-}
-
-// Wrapf returns an error annotating err with the format specifier.
-// If err is nil, Wrapf returns nil.
-func Wrapf(err error, format string, args ...interface{}) error {
- if err == nil {
- return nil
- }
- return wrapper{
- cause: cause{
- cause: err,
- msg: fmt.Sprintf(format, args...),
- },
- stack: callers(),
- }
-}
-
-// Cause returns the underlying cause of the error, if possible.
-// An error value has a cause if it implements the following
-// interface:
-//
-// type Causer interface {
-// Cause() error
-// }
-//
-// If the error does not implement Cause, the original error will
-// be returned. If the error is nil, nil will be returned without further
-// investigation.
-func Cause(err error) error {
- type causer interface {
- Cause() error
- }
-
- for err != nil {
- cause, ok := err.(causer)
- if !ok {
- break
- }
- err = cause.Cause()
- }
- return err
-}
diff --git a/vendor/github.com/pkg/errors/errors_test.go b/vendor/github.com/pkg/errors/errors_test.go
deleted file mode 100644
index 11d45554..00000000
--- a/vendor/github.com/pkg/errors/errors_test.go
+++ /dev/null
@@ -1,159 +0,0 @@
-package errors
-
-import (
- "errors"
- "fmt"
- "io"
- "reflect"
- "testing"
-)
-
-func TestNew(t *testing.T) {
- tests := []struct {
- err string
- want error
- }{
- {"", fmt.Errorf("")},
- {"foo", fmt.Errorf("foo")},
- {"foo", New("foo")},
- {"string with format specifiers: %v", errors.New("string with format specifiers: %v")},
- }
-
- for _, tt := range tests {
- got := New(tt.err)
- if got.Error() != tt.want.Error() {
- t.Errorf("New.Error(): got: %q, want %q", got, tt.want)
- }
- }
-}
-
-func TestWrapNil(t *testing.T) {
- got := Wrap(nil, "no error")
- if got != nil {
- t.Errorf("Wrap(nil, \"no error\"): got %#v, expected nil", got)
- }
-}
-
-func TestWrap(t *testing.T) {
- tests := []struct {
- err error
- message string
- want string
- }{
- {io.EOF, "read error", "read error: EOF"},
- {Wrap(io.EOF, "read error"), "client error", "client error: read error: EOF"},
- }
-
- for _, tt := range tests {
- got := Wrap(tt.err, tt.message).Error()
- if got != tt.want {
- t.Errorf("Wrap(%v, %q): got: %v, want %v", tt.err, tt.message, got, tt.want)
- }
- }
-}
-
-type nilError struct{}
-
-func (nilError) Error() string { return "nil error" }
-
-func TestCause(t *testing.T) {
- x := New("error")
- tests := []struct {
- err error
- want error
- }{{
- // nil error is nil
- err: nil,
- want: nil,
- }, {
- // explicit nil error is nil
- err: (error)(nil),
- want: nil,
- }, {
- // typed nil is nil
- err: (*nilError)(nil),
- want: (*nilError)(nil),
- }, {
- // uncaused error is unaffected
- err: io.EOF,
- want: io.EOF,
- }, {
- // caused error returns cause
- err: Wrap(io.EOF, "ignored"),
- want: io.EOF,
- }, {
- err: x, // return from errors.New
- want: x,
- }}
-
- for i, tt := range tests {
- got := Cause(tt.err)
- if !reflect.DeepEqual(got, tt.want) {
- t.Errorf("test %d: got %#v, want %#v", i+1, got, tt.want)
- }
- }
-}
-
-func TestWrapfNil(t *testing.T) {
- got := Wrapf(nil, "no error")
- if got != nil {
- t.Errorf("Wrapf(nil, \"no error\"): got %#v, expected nil", got)
- }
-}
-
-func TestWrapf(t *testing.T) {
- tests := []struct {
- err error
- message string
- want string
- }{
- {io.EOF, "read error", "read error: EOF"},
- {Wrapf(io.EOF, "read error without format specifiers"), "client error", "client error: read error without format specifiers: EOF"},
- {Wrapf(io.EOF, "read error with %d format specifier", 1), "client error", "client error: read error with 1 format specifier: EOF"},
- }
-
- for _, tt := range tests {
- got := Wrapf(tt.err, tt.message).Error()
- if got != tt.want {
- t.Errorf("Wrapf(%v, %q): got: %v, want %v", tt.err, tt.message, got, tt.want)
- }
- }
-}
-
-func TestErrorf(t *testing.T) {
- tests := []struct {
- err error
- want string
- }{
- {Errorf("read error without format specifiers"), "read error without format specifiers"},
- {Errorf("read error with %d format specifier", 1), "read error with 1 format specifier"},
- }
-
- for _, tt := range tests {
- got := tt.err.Error()
- if got != tt.want {
- t.Errorf("Errorf(%v): got: %q, want %q", tt.err, got, tt.want)
- }
- }
-}
-
-// errors.New, etc values are not expected to be compared by value
-// but the change in errors#27 made them incomparable. Assert that
-// various kinds of errors have a functional equality operator, even
-// if the result of that equality is always false.
-func TestErrorEquality(t *testing.T) {
- tests := []struct {
- err1, err2 error
- }{
- {io.EOF, io.EOF},
- {io.EOF, nil},
- {io.EOF, errors.New("EOF")},
- {io.EOF, New("EOF")},
- {New("EOF"), New("EOF")},
- {New("EOF"), Errorf("EOF")},
- {New("EOF"), Wrap(io.EOF, "EOF")},
- }
- for _, tt := range tests {
- _ = tt.err1 == tt.err2 // mustn't panic
- }
-}
diff --git a/vendor/github.com/pkg/errors/example_test.go b/vendor/github.com/pkg/errors/example_test.go
deleted file mode 100644
index 5bec3ad4..00000000
--- a/vendor/github.com/pkg/errors/example_test.go
+++ /dev/null
@@ -1,152 +0,0 @@
-package errors_test
-
-import (
- "fmt"
-
- "github.com/pkg/errors"
-)
-
-func ExampleNew() {
- err := errors.New("whoops")
- fmt.Println(err)
-
- // Output: whoops
-}
-
-func ExampleNew_printf() {
- err := errors.New("whoops")
- fmt.Printf("%+v", err)
-
- // Example output:
- // whoops
- // github.com/pkg/errors_test.ExampleNew_printf
- // /home/dfc/src/github.com/pkg/errors/example_test.go:17
- // testing.runExample
- // /home/dfc/go/src/testing/example.go:114
- // testing.RunExamples
- // /home/dfc/go/src/testing/example.go:38
- // testing.(*M).Run
- // /home/dfc/go/src/testing/testing.go:744
- // main.main
- // /github.com/pkg/errors/_test/_testmain.go:106
- // runtime.main
- // /home/dfc/go/src/runtime/proc.go:183
- // runtime.goexit
- // /home/dfc/go/src/runtime/asm_amd64.s:2059
-}
-
-func ExampleWrap() {
- cause := errors.New("whoops")
- err := errors.Wrap(cause, "oh noes")
- fmt.Println(err)
-
- // Output: oh noes: whoops
-}
-
-func fn() error {
- e1 := errors.New("error")
- e2 := errors.Wrap(e1, "inner")
- e3 := errors.Wrap(e2, "middle")
- return errors.Wrap(e3, "outer")
-}
-
-func ExampleCause() {
- err := fn()
- fmt.Println(err)
- fmt.Println(errors.Cause(err))
-
- // Output: outer: middle: inner: error
- // error
-}
-
-func ExampleWrap_extended() {
- err := fn()
- fmt.Printf("%+v\n", err)
-
- // Example output:
- // error
- // github.com/pkg/errors_test.fn
- // /home/dfc/src/github.com/pkg/errors/example_test.go:47
- // github.com/pkg/errors_test.ExampleCause_printf
- // /home/dfc/src/github.com/pkg/errors/example_test.go:63
- // testing.runExample
- // /home/dfc/go/src/testing/example.go:114
- // testing.RunExamples
- // /home/dfc/go/src/testing/example.go:38
- // testing.(*M).Run
- // /home/dfc/go/src/testing/testing.go:744
- // main.main
- // /github.com/pkg/errors/_test/_testmain.go:104
- // runtime.main
- // /home/dfc/go/src/runtime/proc.go:183
- // runtime.goexit
- // /home/dfc/go/src/runtime/asm_amd64.s:2059
- // github.com/pkg/errors_test.fn
- // /home/dfc/src/github.com/pkg/errors/example_test.go:48: inner
- // github.com/pkg/errors_test.fn
- // /home/dfc/src/github.com/pkg/errors/example_test.go:49: middle
- // github.com/pkg/errors_test.fn
- // /home/dfc/src/github.com/pkg/errors/example_test.go:50: outer
-}
-
-func ExampleWrapf() {
- cause := errors.New("whoops")
- err := errors.Wrapf(cause, "oh noes #%d", 2)
- fmt.Println(err)
-
- // Output: oh noes #2: whoops
-}
-
-func ExampleErrorf_extended() {
- err := errors.Errorf("whoops: %s", "foo")
- fmt.Printf("%+v", err)
-
- // Example output:
- // whoops: foo
- // github.com/pkg/errors_test.ExampleErrorf
- // /home/dfc/src/github.com/pkg/errors/example_test.go:101
- // testing.runExample
- // /home/dfc/go/src/testing/example.go:114
- // testing.RunExamples
- // /home/dfc/go/src/testing/example.go:38
- // testing.(*M).Run
- // /home/dfc/go/src/testing/testing.go:744
- // main.main
- // /github.com/pkg/errors/_test/_testmain.go:102
- // runtime.main
- // /home/dfc/go/src/runtime/proc.go:183
- // runtime.goexit
- // /home/dfc/go/src/runtime/asm_amd64.s:2059
-}
-
-func Example_stackTrace() {
- type stackTracer interface {
- StackTrace() errors.StackTrace
- }
-
- err, ok := errors.Cause(fn()).(stackTracer)
- if !ok {
- panic("oops, err does not implement stackTracer")
- }
-
- st := err.StackTrace()
- fmt.Printf("%+v", st[0:2]) // top two frames
-
- // Example output:
- // github.com/pkg/errors_test.fn
- // /home/dfc/src/github.com/pkg/errors/example_test.go:47
- // github.com/pkg/errors_test.Example_stackTrace
- // /home/dfc/src/github.com/pkg/errors/example_test.go:127
-}
-
-func ExampleCause_printf() {
- err := errors.Wrap(func() error {
- return func() error {
- return errors.Errorf("hello %s", fmt.Sprintf("world"))
- }()
- }(), "failed")
-
- fmt.Printf("%v", err)
-
- // Output: failed: hello world
-}
diff --git a/vendor/github.com/pkg/errors/format_test.go b/vendor/github.com/pkg/errors/format_test.go
deleted file mode 100644
index d1b2f1b3..00000000
--- a/vendor/github.com/pkg/errors/format_test.go
+++ /dev/null
@@ -1,153 +0,0 @@
-package errors
-
-import (
- "fmt"
- "io"
- "regexp"
- "strings"
- "testing"
-)
-
-func TestFormatNew(t *testing.T) {
- tests := []struct {
- error
- format string
- want string
- }{{
- New("error"),
- "%s",
- "error",
- }, {
- New("error"),
- "%v",
- "error",
- }, {
- New("error"),
- "%+v",
- "error\n" +
- "github.com/pkg/errors.TestFormatNew\n" +
- "\t.+/github.com/pkg/errors/format_test.go:25",
- }}
-
- for _, tt := range tests {
- testFormatRegexp(t, tt.error, tt.format, tt.want)
- }
-}
-
-func TestFormatErrorf(t *testing.T) {
- tests := []struct {
- error
- format string
- want string
- }{{
- Errorf("%s", "error"),
- "%s",
- "error",
- }, {
- Errorf("%s", "error"),
- "%v",
- "error",
- }, {
- Errorf("%s", "error"),
- "%+v",
- "error\n" +
- "github.com/pkg/errors.TestFormatErrorf\n" +
- "\t.+/github.com/pkg/errors/format_test.go:51",
- }}
-
- for _, tt := range tests {
- testFormatRegexp(t, tt.error, tt.format, tt.want)
- }
-}
-
-func TestFormatWrap(t *testing.T) {
- tests := []struct {
- error
- format string
- want string
- }{{
- Wrap(New("error"), "error2"),
- "%s",
- "error2: error",
- }, {
- Wrap(New("error"), "error2"),
- "%v",
- "error2: error",
- }, {
- Wrap(New("error"), "error2"),
- "%+v",
- "error\n" +
- "github.com/pkg/errors.TestFormatWrap\n" +
- "\t.+/github.com/pkg/errors/format_test.go:77",
- }, {
- Wrap(io.EOF, "error"),
- "%s",
- "error: EOF",
- }, {
- Wrap(New("error with space"), "context"),
- "%q",
- `"context: error with space"`,
- }}
-
- for _, tt := range tests {
- testFormatRegexp(t, tt.error, tt.format, tt.want)
- }
-}
-
-func TestFormatWrapf(t *testing.T) {
- tests := []struct {
- error
- format string
- want string
- }{{
- Wrapf(New("error"), "error%d", 2),
- "%s",
- "error2: error",
- }, {
- Wrap(io.EOF, "error"),
- "%v",
- "error: EOF",
- }, {
- Wrap(io.EOF, "error"),
- "%+v",
- "EOF\n" +
- "error\n" +
- "github.com/pkg/errors.TestFormatWrapf\n" +
- "\t.+/github.com/pkg/errors/format_test.go:111",
- }, {
- Wrapf(New("error"), "error%d", 2),
- "%v",
- "error2: error",
- }, {
- Wrapf(New("error"), "error%d", 2),
- "%+v",
- "error\n" +
- "github.com/pkg/errors.TestFormatWrapf\n" +
- "\t.+/github.com/pkg/errors/format_test.go:122",
- }, {
- Wrap(Wrap(io.EOF, "error1"), "error2"),
- "%+v",
- "EOF\n" +
- "error1\n" +
- "github.com/pkg/errors.TestFormatWrapf\n" +
- "\t.+/github.com/pkg/errors/format_test.go:128\n",
- }}
-
- for _, tt := range tests {
- testFormatRegexp(t, tt.error, tt.format, tt.want)
- }
-}
-
-func testFormatRegexp(t *testing.T, arg interface{}, format, want string) {
- got := fmt.Sprintf(format, arg)
- lines := strings.SplitN(got, "\n", -1)
- for i, w := range strings.SplitN(want, "\n", -1) {
- match, err := regexp.MatchString(w, lines[i])
- if err != nil {
- t.Fatal(err)
- }
- if !match {
- t.Errorf("fmt.Sprintf(%q, err): got: %q, want: %q", format, got, want)
- }
- }
-}
diff --git a/vendor/github.com/pkg/errors/stack.go b/vendor/github.com/pkg/errors/stack.go
deleted file mode 100644
index 243a64a2..00000000
--- a/vendor/github.com/pkg/errors/stack.go
+++ /dev/null
@@ -1,165 +0,0 @@
-package errors
-
-import (
- "fmt"
- "io"
- "path"
- "runtime"
- "strings"
-)
-
-// Frame represents a program counter inside a stack frame.
-type Frame uintptr
-
-// pc returns the program counter for this frame;
-// multiple frames may have the same PC value.
-func (f Frame) pc() uintptr { return uintptr(f) - 1 }
-
-// file returns the full path to the file that contains the
-// function for this Frame's pc.
-func (f Frame) file() string {
- fn := runtime.FuncForPC(f.pc())
- if fn == nil {
- return "unknown"
- }
- file, _ := fn.FileLine(f.pc())
- return file
-}
-
-// line returns the line number of source code of the
-// function for this Frame's pc.
-func (f Frame) line() int {
- fn := runtime.FuncForPC(f.pc())
- if fn == nil {
- return 0
- }
- _, line := fn.FileLine(f.pc())
- return line
-}
-
-// Format formats the frame according to the fmt.Formatter interface.
-//
-// %s source file
-// %d source line
-// %n function name
-// %v equivalent to %s:%d
-//
-// Format accepts flags that alter the printing of some verbs, as follows:
-//
-// %+s path of source file relative to the compile time GOPATH
-// %+v equivalent to %+s:%d
-func (f Frame) Format(s fmt.State, verb rune) {
- switch verb {
- case 's':
- switch {
- case s.Flag('+'):
- pc := f.pc()
- fn := runtime.FuncForPC(pc)
- if fn == nil {
- io.WriteString(s, "unknown")
- } else {
- file, _ := fn.FileLine(pc)
- fmt.Fprintf(s, "%s\n\t%s", fn.Name(), file)
- }
- default:
- io.WriteString(s, path.Base(f.file()))
- }
- case 'd':
- fmt.Fprintf(s, "%d", f.line())
- case 'n':
- name := runtime.FuncForPC(f.pc()).Name()
- io.WriteString(s, funcname(name))
- case 'v':
- f.Format(s, 's')
- io.WriteString(s, ":")
- f.Format(s, 'd')
- }
-}
-
-// StackTrace is stack of Frames from innermost (newest) to outermost (oldest).
-type StackTrace []Frame
-
-func (st StackTrace) Format(s fmt.State, verb rune) {
- switch verb {
- case 'v':
- switch {
- case s.Flag('+'):
- for _, f := range st {
- fmt.Fprintf(s, "\n%+v", f)
- }
- case s.Flag('#'):
- fmt.Fprintf(s, "%#v", []Frame(st))
- default:
- fmt.Fprintf(s, "%v", []Frame(st))
- }
- case 's':
- fmt.Fprintf(s, "%s", []Frame(st))
- }
-}
-
-// stack represents a stack of program counters.
-type stack []uintptr
-
-func (s *stack) StackTrace() StackTrace {
- f := make([]Frame, len(*s))
- for i := 0; i < len(f); i++ {
- f[i] = Frame((*s)[i])
- }
- return f
-}
-
-func callers() *stack {
- const depth = 32
- var pcs [depth]uintptr
- n := runtime.Callers(3, pcs[:])
- var st stack = pcs[0:n]
- return &st
-}
-
-// funcname removes the path prefix component of a function's name reported by func.Name().
-func funcname(name string) string {
- i := strings.LastIndex(name, "/")
- name = name[i+1:]
- i = strings.Index(name, ".")
- return name[i+1:]
-}
-
-func trimGOPATH(name, file string) string {
- // Here we want to get the source file path relative to the compile time
- // GOPATH. As of Go 1.6.x there is no direct way to know the compiled
- // GOPATH at runtime, but we can infer the number of path segments in the
- // GOPATH. We note that fn.Name() returns the function name qualified by
- // the import path, which does not include the GOPATH. Thus we can trim
- // segments from the beginning of the file path until the number of path
- // separators remaining is one more than the number of path separators in
- // the function name. For example, given:
- //
- // GOPATH /home/user
- // file /home/user/src/pkg/sub/file.go
- // fn.Name() pkg/sub.Type.Method
- //
- // We want to produce:
- //
- // pkg/sub/file.go
- //
- // From this we can easily see that fn.Name() has one less path separator
- // than our desired output. We count separators from the end of the file
- // path until it finds two more than in the function name and then move
- // one character forward to preserve the initial path segment without a
- // leading separator.
- const sep = "/"
- goal := strings.Count(name, sep) + 2
- i := len(file)
- for n := 0; n < goal; n++ {
- i = strings.LastIndex(file[:i], sep)
- if i == -1 {
- // not enough separators found, set i so that the slice expression
- // below leaves file unmodified
- i = -len(sep)
- break
- }
- }
- // get back to 0 or trim the leading separator
- file = file[i+len(sep):]
- return file
-}
diff --git a/vendor/github.com/pkg/errors/stack_test.go b/vendor/github.com/pkg/errors/stack_test.go
deleted file mode 100644
index cd7827bf..00000000
--- a/vendor/github.com/pkg/errors/stack_test.go
+++ /dev/null
@@ -1,295 +0,0 @@
-package errors
-
-import (
- "fmt"
- "runtime"
- "testing"
-)
-
-var initpc, _, _, _ = runtime.Caller(0)
-
-func TestFrameLine(t *testing.T) {
- var tests = []struct {
- Frame
- want int
- }{{
- Frame(initpc),
- 9,
- }, {
- func() Frame {
- var pc, _, _, _ = runtime.Caller(0)
- return Frame(pc)
- }(),
- 20,
- }, {
- func() Frame {
- var pc, _, _, _ = runtime.Caller(1)
- return Frame(pc)
- }(),
- 28,
- }, {
- Frame(0), // invalid PC
- 0,
- }}
-
- for _, tt := range tests {
- got := tt.Frame.line()
- want := tt.want
- if want != got {
- t.Errorf("Frame(%v): want: %v, got: %v", uintptr(tt.Frame), want, got)
- }
- }
-}
-
-type X struct{}
-
-func (x X) val() Frame {
- var pc, _, _, _ = runtime.Caller(0)
- return Frame(pc)
-}
-
-func (x *X) ptr() Frame {
- var pc, _, _, _ = runtime.Caller(0)
- return Frame(pc)
-}
-
-func TestFrameFormat(t *testing.T) {
- var tests = []struct {
- Frame
- format string
- want string
- }{{
- Frame(initpc),
- "%s",
- "stack_test.go",
- }, {
- Frame(initpc),
- "%+s",
- "github.com/pkg/errors.init\n" +
- "\t.+/github.com/pkg/errors/stack_test.go",
- }, {
- Frame(0),
- "%s",
- "unknown",
- }, {
- Frame(0),
- "%+s",
- "unknown",
- }, {
- Frame(initpc),
- "%d",
- "9",
- }, {
- Frame(0),
- "%d",
- "0",
- }, {
- Frame(initpc),
- "%n",
- "init",
- }, {
- func() Frame {
- var x X
- return x.ptr()
- }(),
- "%n",
- `\(\*X\).ptr`,
- }, {
- func() Frame {
- var x X
- return x.val()
- }(),
- "%n",
- "X.val",
- }, {
- Frame(0),
- "%n",
- "",
- }, {
- Frame(initpc),
- "%v",
- "stack_test.go:9",
- }, {
- Frame(initpc),
- "%+v",
- "github.com/pkg/errors.init\n" +
- "\t.+/github.com/pkg/errors/stack_test.go:9",
- }, {
- Frame(0),
- "%v",
- "unknown:0",
- }}
-
- for _, tt := range tests {
- testFormatRegexp(t, tt.Frame, tt.format, tt.want)
- }
-}
-
-func TestFuncname(t *testing.T) {
- tests := []struct {
- name, want string
- }{
- {"", ""},
- {"runtime.main", "main"},
- {"github.com/pkg/errors.funcname", "funcname"},
- {"funcname", "funcname"},
- {"io.copyBuffer", "copyBuffer"},
- {"main.(*R).Write", "(*R).Write"},
- }
-
- for _, tt := range tests {
- got := funcname(tt.name)
- want := tt.want
- if got != want {
- t.Errorf("funcname(%q): want: %q, got %q", tt.name, want, got)
- }
- }
-}
-
-func TestTrimGOPATH(t *testing.T) {
- var tests = []struct {
- Frame
- want string
- }{{
- Frame(initpc),
- "github.com/pkg/errors/stack_test.go",
- }}
-
- for _, tt := range tests {
- pc := tt.Frame.pc()
- fn := runtime.FuncForPC(pc)
- file, _ := fn.FileLine(pc)
- got := trimGOPATH(fn.Name(), file)
- want := tt.want
- if want != got {
- t.Errorf("%v: want %q, got %q", tt.Frame, want, got)
- }
- }
-}
-
-func TestStackTrace(t *testing.T) {
- tests := []struct {
- err error
- want []string
- }{{
- New("ooh"), []string{
- "github.com/pkg/errors.TestStackTrace\n" +
- "\t.+/github.com/pkg/errors/stack_test.go:175",
- },
- }, {
- Wrap(New("ooh"), "ahh"), []string{
- "github.com/pkg/errors.TestStackTrace\n" +
- "\t.+/github.com/pkg/errors/stack_test.go:180", // this is the stack of Wrap, not New
- },
- }, {
- Cause(Wrap(New("ooh"), "ahh")), []string{
- "github.com/pkg/errors.TestStackTrace\n" +
- "\t.+/github.com/pkg/errors/stack_test.go:185", // this is the stack of New
- },
- }, {
- func() error { return New("ooh") }(), []string{
- `github.com/pkg/errors.(func·005|TestStackTrace.func1)` +
- "\n\t.+/github.com/pkg/errors/stack_test.go:190", // this is the stack of New
- "github.com/pkg/errors.TestStackTrace\n" +
- "\t.+/github.com/pkg/errors/stack_test.go:190", // this is the stack of New's caller
- },
- }, {
- Cause(func() error {
- return func() error {
- return Errorf("hello %s", fmt.Sprintf("world"))
- }()
- }()), []string{
- `github.com/pkg/errors.(func·006|TestStackTrace.func2.1)` +
- "\n\t.+/github.com/pkg/errors/stack_test.go:199", // this is the stack of Errorf
- `github.com/pkg/errors.(func·007|TestStackTrace.func2)` +
- "\n\t.+/github.com/pkg/errors/stack_test.go:200", // this is the stack of Errorf's caller
- "github.com/pkg/errors.TestStackTrace\n" +
- "\t.+/github.com/pkg/errors/stack_test.go:201", // this is the stack of Errorf's caller's caller
- },
- }}
- for _, tt := range tests {
- x, ok := tt.err.(interface {
- StackTrace() StackTrace
- })
- if !ok {
- t.Errorf("expected %#v to implement StackTrace() StackTrace", tt.err)
- continue
- }
- st := x.StackTrace()
- for j, want := range tt.want {
- testFormatRegexp(t, st[j], "%+v", want)
- }
- }
-}
-
-func stackTrace() StackTrace {
- const depth = 8
- var pcs [depth]uintptr
- n := runtime.Callers(1, pcs[:])
- var st stack = pcs[0:n]
- return st.StackTrace()
-}
-
-func TestStackTraceFormat(t *testing.T) {
- tests := []struct {
- StackTrace
- format string
- want string
- }{{
- nil,
- "%s",
- `\[\]`,
- }, {
- nil,
- "%v",
- `\[\]`,
- }, {
- nil,
- "%+v",
- "",
- }, {
- nil,
- "%#v",
- `\[\]errors.Frame\(nil\)`,
- }, {
- make(StackTrace, 0),
- "%s",
- `\[\]`,
- }, {
- make(StackTrace, 0),
- "%v",
- `\[\]`,
- }, {
- make(StackTrace, 0),
- "%+v",
- "",
- }, {
- make(StackTrace, 0),
- "%#v",
- `\[\]errors.Frame{}`,
- }, {
- stackTrace()[:2],
- "%s",
- `\[stack_test.go stack_test.go\]`,
- }, {
- stackTrace()[:2],
- "%v",
- `\[stack_test.go:228 stack_test.go:275\]`,
- }, {
- stackTrace()[:2],
- "%+v",
- "\n" +
- "github.com/pkg/errors.stackTrace\n" +
- "\t.+/github.com/pkg/errors/stack_test.go:228\n" +
- "github.com/pkg/errors.TestStackTraceFormat\n" +
- "\t.+/github.com/pkg/errors/stack_test.go:279",
- }, {
- stackTrace()[:2],
- "%#v",
- `\[\]errors.Frame{stack_test.go:228, stack_test.go:287}`,
- }}
-
- for _, tt := range tests {
- testFormatRegexp(t, tt.StackTrace, tt.format, tt.want)
- }
-}
diff --git a/vendor/github.com/pkg/sftp/CONTRIBUTORS b/vendor/github.com/pkg/sftp/CONTRIBUTORS
deleted file mode 100644
index 7eff8236..00000000
--- a/vendor/github.com/pkg/sftp/CONTRIBUTORS
+++ /dev/null
@@ -1,2 +0,0 @@
-Dave Cheney
-Saulius Gurklys
diff --git a/vendor/github.com/pkg/sftp/LICENSE b/vendor/github.com/pkg/sftp/LICENSE
deleted file mode 100644
index b7b53921..00000000
--- a/vendor/github.com/pkg/sftp/LICENSE
+++ /dev/null
@@ -1,9 +0,0 @@
-Copyright (c) 2013, Dave Cheney
-All rights reserved.
-
-Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
-
- * Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
- * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
-
-THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
diff --git a/vendor/github.com/pkg/sftp/README.md b/vendor/github.com/pkg/sftp/README.md
deleted file mode 100644
index e406b1e5..00000000
--- a/vendor/github.com/pkg/sftp/README.md
+++ /dev/null
@@ -1,27 +0,0 @@
-sftp
-----
-
-The `sftp` package provides support for file system operations on remote ssh servers using the SFTP subsystem.
-
-[![UNIX Build Status](https://travis-ci.org/pkg/sftp.svg?branch=master)](https://travis-ci.org/pkg/sftp) [![GoDoc](http://godoc.org/github.com/pkg/sftp?status.svg)](http://godoc.org/github.com/pkg/sftp)
-
-usage and examples
-------------------
-
-See [godoc.org/github.com/pkg/sftp](http://godoc.org/github.com/pkg/sftp) for examples and usage.
-
-The basic operation of the package mirrors the facilities of the [os](http://golang.org/pkg/os) package.
-
-The Walker interface for directory traversal is heavily inspired by Keith Rarick's [fs](http://godoc.org/github.com/kr/fs) package.
-
-roadmap
--------
-
- * There is way too much duplication in the Client methods. If there was an unmarshal(interface{}) method this would reduce a heap of the duplication.
-
-contributing
-------------
-
-We welcome pull requests, bug fixes and issue reports.
-
-Before proposing a large change, first please discuss your change by raising an issue.
diff --git a/vendor/github.com/pkg/sftp/attrs.go b/vendor/github.com/pkg/sftp/attrs.go
deleted file mode 100644
index 3e4c2912..00000000
--- a/vendor/github.com/pkg/sftp/attrs.go
+++ /dev/null
@@ -1,237 +0,0 @@
-package sftp
-
-// ssh_FXP_ATTRS support
-// see http://tools.ietf.org/html/draft-ietf-secsh-filexfer-02#section-5
-
-import (
- "os"
- "syscall"
- "time"
-)
-
-const (
- ssh_FILEXFER_ATTR_SIZE = 0x00000001
- ssh_FILEXFER_ATTR_UIDGID = 0x00000002
- ssh_FILEXFER_ATTR_PERMISSIONS = 0x00000004
- ssh_FILEXFER_ATTR_ACMODTIME = 0x00000008
- ssh_FILEXFER_ATTR_EXTENDED = 0x80000000
-)
-
-// fileInfo is an artificial type designed to satisfy os.FileInfo.
-type fileInfo struct {
- name string
- size int64
- mode os.FileMode
- mtime time.Time
- sys interface{}
-}
-
-// Name returns the base name of the file.
-func (fi *fileInfo) Name() string { return fi.name }
-
-// Size returns the length in bytes for regular files; system-dependent for others.
-func (fi *fileInfo) Size() int64 { return fi.size }
-
-// Mode returns file mode bits.
-func (fi *fileInfo) Mode() os.FileMode { return fi.mode }
-
-// ModTime returns the last modification time of the file.
-func (fi *fileInfo) ModTime() time.Time { return fi.mtime }
-
-// IsDir returns true if the file is a directory.
-func (fi *fileInfo) IsDir() bool { return fi.Mode().IsDir() }
-
-func (fi *fileInfo) Sys() interface{} { return fi.sys }
-
-// FileStat holds the original unmarshalled values from a call to READDIR or *STAT.
-// It is exported for the purposes of accessing the raw values via os.FileInfo.Sys()
-type FileStat struct {
- Size uint64
- Mode uint32
- Mtime uint32
- Atime uint32
- UID uint32
- GID uint32
- Extended []StatExtended
-}
-
-// StatExtended contains additional, extended information for a FileStat.
-type StatExtended struct {
- ExtType string
- ExtData string
-}
-
-func fileInfoFromStat(st *FileStat, name string) os.FileInfo {
- fs := &fileInfo{
- name: name,
- size: int64(st.Size),
- mode: toFileMode(st.Mode),
- mtime: time.Unix(int64(st.Mtime), 0),
- sys: st,
- }
- return fs
-}
-
-func fileStatFromInfo(fi os.FileInfo) (uint32, FileStat) {
- mtime := fi.ModTime().Unix()
- atime := mtime
- var flags uint32 = ssh_FILEXFER_ATTR_SIZE |
- ssh_FILEXFER_ATTR_PERMISSIONS |
- ssh_FILEXFER_ATTR_ACMODTIME
-
- fileStat := FileStat{
- Size: uint64(fi.Size()),
- Mode: fromFileMode(fi.Mode()),
- Mtime: uint32(mtime),
- Atime: uint32(atime),
- }
-
- // os specific file stat decoding
- fileStatFromInfoOs(fi, &flags, &fileStat)
-
- return flags, fileStat
-}
-
-func unmarshalAttrs(b []byte) (*FileStat, []byte) {
- flags, b := unmarshalUint32(b)
- var fs FileStat
- if flags&ssh_FILEXFER_ATTR_SIZE == ssh_FILEXFER_ATTR_SIZE {
- fs.Size, b = unmarshalUint64(b)
- }
- if flags&ssh_FILEXFER_ATTR_UIDGID == ssh_FILEXFER_ATTR_UIDGID {
- fs.UID, b = unmarshalUint32(b)
- }
- if flags&ssh_FILEXFER_ATTR_UIDGID == ssh_FILEXFER_ATTR_UIDGID {
- fs.GID, b = unmarshalUint32(b)
- }
- if flags&ssh_FILEXFER_ATTR_PERMISSIONS == ssh_FILEXFER_ATTR_PERMISSIONS {
- fs.Mode, b = unmarshalUint32(b)
- }
- if flags&ssh_FILEXFER_ATTR_ACMODTIME == ssh_FILEXFER_ATTR_ACMODTIME {
- fs.Atime, b = unmarshalUint32(b)
- fs.Mtime, b = unmarshalUint32(b)
- }
- if flags&ssh_FILEXFER_ATTR_EXTENDED == ssh_FILEXFER_ATTR_EXTENDED {
- var count uint32
- count, b = unmarshalUint32(b)
- ext := make([]StatExtended, count, count)
- for i := uint32(0); i < count; i++ {
- var typ string
- var data string
- typ, b = unmarshalString(b)
- data, b = unmarshalString(b)
- ext[i] = StatExtended{typ, data}
- }
- fs.Extended = ext
- }
- return &fs, b
-}
-
-func marshalFileInfo(b []byte, fi os.FileInfo) []byte {
- // attributes variable struct, and also variable per protocol version
- // spec version 3 attributes:
- // uint32 flags
- // uint64 size present only if flag SSH_FILEXFER_ATTR_SIZE
- // uint32 uid present only if flag SSH_FILEXFER_ATTR_UIDGID
- // uint32 gid present only if flag SSH_FILEXFER_ATTR_UIDGID
- // uint32 permissions present only if flag SSH_FILEXFER_ATTR_PERMISSIONS
- // uint32 atime present only if flag SSH_FILEXFER_ACMODTIME
- // uint32 mtime present only if flag SSH_FILEXFER_ACMODTIME
- // uint32 extended_count present only if flag SSH_FILEXFER_ATTR_EXTENDED
- // string extended_type
- // string extended_data
- // ... more extended data (extended_type - extended_data pairs),
- // so that number of pairs equals extended_count
-
- flags, fileStat := fileStatFromInfo(fi)
-
- b = marshalUint32(b, flags)
- if flags&ssh_FILEXFER_ATTR_SIZE != 0 {
- b = marshalUint64(b, fileStat.Size)
- }
- if flags&ssh_FILEXFER_ATTR_UIDGID != 0 {
- b = marshalUint32(b, fileStat.UID)
- b = marshalUint32(b, fileStat.GID)
- }
- if flags&ssh_FILEXFER_ATTR_PERMISSIONS != 0 {
- b = marshalUint32(b, fileStat.Mode)
- }
- if flags&ssh_FILEXFER_ATTR_ACMODTIME != 0 {
- b = marshalUint32(b, fileStat.Atime)
- b = marshalUint32(b, fileStat.Mtime)
- }
-
- return b
-}
-
-// toFileMode converts sftp filemode bits to the os.FileMode specification
-func toFileMode(mode uint32) os.FileMode {
- var fm = os.FileMode(mode & 0777)
- switch mode & syscall.S_IFMT {
- case syscall.S_IFBLK:
- fm |= os.ModeDevice
- case syscall.S_IFCHR:
- fm |= os.ModeDevice | os.ModeCharDevice
- case syscall.S_IFDIR:
- fm |= os.ModeDir
- case syscall.S_IFIFO:
- fm |= os.ModeNamedPipe
- case syscall.S_IFLNK:
- fm |= os.ModeSymlink
- case syscall.S_IFREG:
- // nothing to do
- case syscall.S_IFSOCK:
- fm |= os.ModeSocket
- }
- if mode&syscall.S_ISGID != 0 {
- fm |= os.ModeSetgid
- }
- if mode&syscall.S_ISUID != 0 {
- fm |= os.ModeSetuid
- }
- if mode&syscall.S_ISVTX != 0 {
- fm |= os.ModeSticky
- }
- return fm
-}
-
-// fromFileMode converts from the os.FileMode specification to sftp filemode bits
-func fromFileMode(mode os.FileMode) uint32 {
- ret := uint32(0)
-
- if mode&os.ModeDevice != 0 {
- if mode&os.ModeCharDevice != 0 {
- ret |= syscall.S_IFCHR
- } else {
- ret |= syscall.S_IFBLK
- }
- }
- if mode&os.ModeDir != 0 {
- ret |= syscall.S_IFDIR
- }
- if mode&os.ModeSymlink != 0 {
- ret |= syscall.S_IFLNK
- }
- if mode&os.ModeNamedPipe != 0 {
- ret |= syscall.S_IFIFO
- }
- if mode&os.ModeSetgid != 0 {
- ret |= syscall.S_ISGID
- }
- if mode&os.ModeSetuid != 0 {
- ret |= syscall.S_ISUID
- }
- if mode&os.ModeSticky != 0 {
- ret |= syscall.S_ISVTX
- }
- if mode&os.ModeSocket != 0 {
- ret |= syscall.S_IFSOCK
- }
-
- if mode&os.ModeType == 0 {
- ret |= syscall.S_IFREG
- }
- ret |= uint32(mode & os.ModePerm)
-
- return ret
-}
diff --git a/vendor/github.com/pkg/sftp/attrs_stubs.go b/vendor/github.com/pkg/sftp/attrs_stubs.go
deleted file mode 100644
index 81cf3eac..00000000
--- a/vendor/github.com/pkg/sftp/attrs_stubs.go
+++ /dev/null
@@ -1,11 +0,0 @@
-// +build !cgo,!plan9 windows android
-
-package sftp
-
-import (
- "os"
-)
-
-func fileStatFromInfoOs(fi os.FileInfo, flags *uint32, fileStat *FileStat) {
- // todo
-}
diff --git a/vendor/github.com/pkg/sftp/attrs_test.go b/vendor/github.com/pkg/sftp/attrs_test.go
deleted file mode 100644
index e234649c..00000000
--- a/vendor/github.com/pkg/sftp/attrs_test.go
+++ /dev/null
@@ -1,45 +0,0 @@
-package sftp
-
-import (
- "bytes"
- "os"
- "reflect"
- "testing"
- "time"
-)
-
-// ensure that attrs implemenst os.FileInfo
-var _ os.FileInfo = new(fileInfo)
-
-var unmarshalAttrsTests = []struct {
- b []byte
- want *fileInfo
- rest []byte
-}{
- {marshal(nil, struct{ Flags uint32 }{}), &fileInfo{mtime: time.Unix(int64(0), 0)}, nil},
- {marshal(nil, struct {
- Flags uint32
- Size uint64
- }{ssh_FILEXFER_ATTR_SIZE, 20}), &fileInfo{size: 20, mtime: time.Unix(int64(0), 0)}, nil},
- {marshal(nil, struct {
- Flags uint32
- Size uint64
- Permissions uint32
- }{ssh_FILEXFER_ATTR_SIZE | ssh_FILEXFER_ATTR_PERMISSIONS, 20, 0644}), &fileInfo{size: 20, mode: os.FileMode(0644), mtime: time.Unix(int64(0), 0)}, nil},
- {marshal(nil, struct {
- Flags uint32
- Size uint64
- UID, GID, Permissions uint32
- }{ssh_FILEXFER_ATTR_SIZE | ssh_FILEXFER_ATTR_UIDGID | ssh_FILEXFER_ATTR_UIDGID | ssh_FILEXFER_ATTR_PERMISSIONS, 20, 1000, 1000, 0644}), &fileInfo{size: 20, mode: os.FileMode(0644), mtime: time.Unix(int64(0), 0)}, nil},
-}
-
-func TestUnmarshalAttrs(t *testing.T) {
- for _, tt := range unmarshalAttrsTests {
- stat, rest := unmarshalAttrs(tt.b)
- got := fileInfoFromStat(stat, "")
- tt.want.sys = got.Sys()
- if !reflect.DeepEqual(got, tt.want) || !bytes.Equal(tt.rest, rest) {
- t.Errorf("unmarshalAttrs(%#v): want %#v, %#v, got: %#v, %#v", tt.b, tt.want, tt.rest, got, rest)
- }
- }
-}
diff --git a/vendor/github.com/pkg/sftp/attrs_unix.go b/vendor/github.com/pkg/sftp/attrs_unix.go
deleted file mode 100644
index ab6ecdea..00000000
--- a/vendor/github.com/pkg/sftp/attrs_unix.go
+++ /dev/null
@@ -1,17 +0,0 @@
-// +build darwin dragonfly freebsd !android,linux netbsd openbsd solaris
-// +build cgo
-
-package sftp
-
-import (
- "os"
- "syscall"
-)
-
-func fileStatFromInfoOs(fi os.FileInfo, flags *uint32, fileStat *FileStat) {
- if statt, ok := fi.Sys().(*syscall.Stat_t); ok {
- *flags |= ssh_FILEXFER_ATTR_UIDGID
- fileStat.UID = statt.Uid
- fileStat.GID = statt.Gid
- }
-}
diff --git a/vendor/github.com/pkg/sftp/client.go b/vendor/github.com/pkg/sftp/client.go
deleted file mode 100644
index 41f10639..00000000
--- a/vendor/github.com/pkg/sftp/client.go
+++ /dev/null
@@ -1,1133 +0,0 @@
-package sftp
-
-import (
- "bytes"
- "encoding/binary"
- "io"
- "os"
- "path"
- "sync/atomic"
- "time"
-
- "github.com/kr/fs"
- "github.com/pkg/errors"
- "golang.org/x/crypto/ssh"
-)
-
-// MaxPacket sets the maximum size of the payload.
-func MaxPacket(size int) func(*Client) error {
- return func(c *Client) error {
- if size < 1<<15 {
- return errors.Errorf("size must be greater or equal to 32k")
- }
- c.maxPacket = size
- return nil
- }
-}
-
-// NewClient creates a new SFTP client on conn, using zero or more option
-// functions.
-func NewClient(conn *ssh.Client, opts ...func(*Client) error) (*Client, error) {
- s, err := conn.NewSession()
- if err != nil {
- return nil, err
- }
- if err := s.RequestSubsystem("sftp"); err != nil {
- return nil, err
- }
- pw, err := s.StdinPipe()
- if err != nil {
- return nil, err
- }
- pr, err := s.StdoutPipe()
- if err != nil {
- return nil, err
- }
-
- return NewClientPipe(pr, pw, opts...)
-}
-
-// NewClientPipe creates a new SFTP client given a Reader and a WriteCloser.
-// This can be used for connecting to an SFTP server over TCP/TLS or by using
-// the system's ssh client program (e.g. via exec.Command).
-func NewClientPipe(rd io.Reader, wr io.WriteCloser, opts ...func(*Client) error) (*Client, error) {
- sftp := &Client{
- clientConn: clientConn{
- conn: conn{
- Reader: rd,
- WriteCloser: wr,
- },
- inflight: make(map[uint32]chan<- result),
- },
- maxPacket: 1 << 15,
- }
- if err := sftp.applyOptions(opts...); err != nil {
- wr.Close()
- return nil, err
- }
- if err := sftp.sendInit(); err != nil {
- wr.Close()
- return nil, err
- }
- if err := sftp.recvVersion(); err != nil {
- wr.Close()
- return nil, err
- }
- sftp.clientConn.wg.Add(1)
- go sftp.loop()
- return sftp, nil
-}
-
-// Client represents an SFTP session on a *ssh.ClientConn SSH connection.
-// Multiple Clients can be active on a single SSH connection, and a Client
-// may be called concurrently from multiple Goroutines.
-//
-// Client implements the github.com/kr/fs.FileSystem interface.
-type Client struct {
- clientConn
-
- maxPacket int // max packet size read or written.
- nextid uint32
-}
-
-// Create creates the named file mode 0666 (before umask), truncating it if
-// it already exists. If successful, methods on the returned File can be
-// used for I/O; the associated file descriptor has mode O_RDWR.
-func (c *Client) Create(path string) (*File, error) {
- return c.open(path, flags(os.O_RDWR|os.O_CREATE|os.O_TRUNC))
-}
-
-const sftpProtocolVersion = 3 // http://tools.ietf.org/html/draft-ietf-secsh-filexfer-02
-
-func (c *Client) sendInit() error {
- return c.clientConn.conn.sendPacket(sshFxInitPacket{
- Version: sftpProtocolVersion, // http://tools.ietf.org/html/draft-ietf-secsh-filexfer-02
- })
-}
-
-// returns the next value of c.nextid
-func (c *Client) nextID() uint32 {
- return atomic.AddUint32(&c.nextid, 1)
-}
-
-func (c *Client) recvVersion() error {
- typ, data, err := c.recvPacket()
- if err != nil {
- return err
- }
- if typ != ssh_FXP_VERSION {
- return &unexpectedPacketErr{ssh_FXP_VERSION, typ}
- }
-
- version, _ := unmarshalUint32(data)
- if version != sftpProtocolVersion {
- return &unexpectedVersionErr{sftpProtocolVersion, version}
- }
-
- return nil
-}
-
-// Walk returns a new Walker rooted at root.
-func (c *Client) Walk(root string) *fs.Walker {
- return fs.WalkFS(root, c)
-}
-
-// ReadDir reads the directory named by dirname and returns a list of
-// directory entries.
-func (c *Client) ReadDir(p string) ([]os.FileInfo, error) {
- handle, err := c.opendir(p)
- if err != nil {
- return nil, err
- }
- defer c.close(handle) // this has to defer earlier than the lock below
- var attrs []os.FileInfo
- var done = false
- for !done {
- id := c.nextID()
- typ, data, err1 := c.sendPacket(sshFxpReaddirPacket{
- ID: id,
- Handle: handle,
- })
- if err1 != nil {
- err = err1
- done = true
- break
- }
- switch typ {
- case ssh_FXP_NAME:
- sid, data := unmarshalUint32(data)
- if sid != id {
- return nil, &unexpectedIDErr{id, sid}
- }
- count, data := unmarshalUint32(data)
- for i := uint32(0); i < count; i++ {
- var filename string
- filename, data = unmarshalString(data)
- _, data = unmarshalString(data) // discard longname
- var attr *FileStat
- attr, data = unmarshalAttrs(data)
- if filename == "." || filename == ".." {
- continue
- }
- attrs = append(attrs, fileInfoFromStat(attr, path.Base(filename)))
- }
- case ssh_FXP_STATUS:
- // TODO(dfc) scope warning!
- err = normaliseError(unmarshalStatus(id, data))
- done = true
- default:
- return nil, unimplementedPacketErr(typ)
- }
- }
- if err == io.EOF {
- err = nil
- }
- return attrs, err
-}
-
-func (c *Client) opendir(path string) (string, error) {
- id := c.nextID()
- typ, data, err := c.sendPacket(sshFxpOpendirPacket{
- ID: id,
- Path: path,
- })
- if err != nil {
- return "", err
- }
- switch typ {
- case ssh_FXP_HANDLE:
- sid, data := unmarshalUint32(data)
- if sid != id {
- return "", &unexpectedIDErr{id, sid}
- }
- handle, _ := unmarshalString(data)
- return handle, nil
- case ssh_FXP_STATUS:
- return "", unmarshalStatus(id, data)
- default:
- return "", unimplementedPacketErr(typ)
- }
-}
-
-// Stat returns a FileInfo structure describing the file specified by path 'p'.
-// If 'p' is a symbolic link, the returned FileInfo structure describes the referent file.
-func (c *Client) Stat(p string) (os.FileInfo, error) {
- id := c.nextID()
- typ, data, err := c.sendPacket(sshFxpStatPacket{
- ID: id,
- Path: p,
- })
- if err != nil {
- return nil, err
- }
- switch typ {
- case ssh_FXP_ATTRS:
- sid, data := unmarshalUint32(data)
- if sid != id {
- return nil, &unexpectedIDErr{id, sid}
- }
- attr, _ := unmarshalAttrs(data)
- return fileInfoFromStat(attr, path.Base(p)), nil
- case ssh_FXP_STATUS:
- return nil, normaliseError(unmarshalStatus(id, data))
- default:
- return nil, unimplementedPacketErr(typ)
- }
-}
-
-// Lstat returns a FileInfo structure describing the file specified by path 'p'.
-// If 'p' is a symbolic link, the returned FileInfo structure describes the symbolic link.
-func (c *Client) Lstat(p string) (os.FileInfo, error) {
- id := c.nextID()
- typ, data, err := c.sendPacket(sshFxpLstatPacket{
- ID: id,
- Path: p,
- })
- if err != nil {
- return nil, err
- }
- switch typ {
- case ssh_FXP_ATTRS:
- sid, data := unmarshalUint32(data)
- if sid != id {
- return nil, &unexpectedIDErr{id, sid}
- }
- attr, _ := unmarshalAttrs(data)
- return fileInfoFromStat(attr, path.Base(p)), nil
- case ssh_FXP_STATUS:
- return nil, normaliseError(unmarshalStatus(id, data))
- default:
- return nil, unimplementedPacketErr(typ)
- }
-}
-
-// ReadLink reads the target of a symbolic link.
-func (c *Client) ReadLink(p string) (string, error) {
- id := c.nextID()
- typ, data, err := c.sendPacket(sshFxpReadlinkPacket{
- ID: id,
- Path: p,
- })
- if err != nil {
- return "", err
- }
- switch typ {
- case ssh_FXP_NAME:
- sid, data := unmarshalUint32(data)
- if sid != id {
- return "", &unexpectedIDErr{id, sid}
- }
- count, data := unmarshalUint32(data)
- if count != 1 {
- return "", unexpectedCount(1, count)
- }
- filename, _ := unmarshalString(data) // ignore dummy attributes
- return filename, nil
- case ssh_FXP_STATUS:
- return "", unmarshalStatus(id, data)
- default:
- return "", unimplementedPacketErr(typ)
- }
-}
-
-// Symlink creates a symbolic link at 'newname', pointing at target 'oldname'
-func (c *Client) Symlink(oldname, newname string) error {
- id := c.nextID()
- typ, data, err := c.sendPacket(sshFxpSymlinkPacket{
- ID: id,
- Linkpath: newname,
- Targetpath: oldname,
- })
- if err != nil {
- return err
- }
- switch typ {
- case ssh_FXP_STATUS:
- return normaliseError(unmarshalStatus(id, data))
- default:
- return unimplementedPacketErr(typ)
- }
-}
-
-// setstat is a convience wrapper to allow for changing of various parts of the file descriptor.
-func (c *Client) setstat(path string, flags uint32, attrs interface{}) error {
- id := c.nextID()
- typ, data, err := c.sendPacket(sshFxpSetstatPacket{
- ID: id,
- Path: path,
- Flags: flags,
- Attrs: attrs,
- })
- if err != nil {
- return err
- }
- switch typ {
- case ssh_FXP_STATUS:
- return normaliseError(unmarshalStatus(id, data))
- default:
- return unimplementedPacketErr(typ)
- }
-}
-
-// Chtimes changes the access and modification times of the named file.
-func (c *Client) Chtimes(path string, atime time.Time, mtime time.Time) error {
- type times struct {
- Atime uint32
- Mtime uint32
- }
- attrs := times{uint32(atime.Unix()), uint32(mtime.Unix())}
- return c.setstat(path, ssh_FILEXFER_ATTR_ACMODTIME, attrs)
-}
-
-// Chown changes the user and group owners of the named file.
-func (c *Client) Chown(path string, uid, gid int) error {
- type owner struct {
- UID uint32
- GID uint32
- }
- attrs := owner{uint32(uid), uint32(gid)}
- return c.setstat(path, ssh_FILEXFER_ATTR_UIDGID, attrs)
-}
-
-// Chmod changes the permissions of the named file.
-func (c *Client) Chmod(path string, mode os.FileMode) error {
- return c.setstat(path, ssh_FILEXFER_ATTR_PERMISSIONS, uint32(mode))
-}
-
-// Truncate sets the size of the named file. Although it may be safely assumed
-// that if the size is less than its current size it will be truncated to fit,
-// the SFTP protocol does not specify what behavior the server should do when setting
-// size greater than the current size.
-func (c *Client) Truncate(path string, size int64) error {
- return c.setstat(path, ssh_FILEXFER_ATTR_SIZE, uint64(size))
-}
-
-// Open opens the named file for reading. If successful, methods on the
-// returned file can be used for reading; the associated file descriptor
-// has mode O_RDONLY.
-func (c *Client) Open(path string) (*File, error) {
- return c.open(path, flags(os.O_RDONLY))
-}
-
-// OpenFile is the generalized open call; most users will use Open or
-// Create instead. It opens the named file with specified flag (O_RDONLY
-// etc.). If successful, methods on the returned File can be used for I/O.
-func (c *Client) OpenFile(path string, f int) (*File, error) {
- return c.open(path, flags(f))
-}
-
-func (c *Client) open(path string, pflags uint32) (*File, error) {
- id := c.nextID()
- typ, data, err := c.sendPacket(sshFxpOpenPacket{
- ID: id,
- Path: path,
- Pflags: pflags,
- })
- if err != nil {
- return nil, err
- }
- switch typ {
- case ssh_FXP_HANDLE:
- sid, data := unmarshalUint32(data)
- if sid != id {
- return nil, &unexpectedIDErr{id, sid}
- }
- handle, _ := unmarshalString(data)
- return &File{c: c, path: path, handle: handle}, nil
- case ssh_FXP_STATUS:
- return nil, normaliseError(unmarshalStatus(id, data))
- default:
- return nil, unimplementedPacketErr(typ)
- }
-}
-
-// close closes a handle handle previously returned in the response
-// to SSH_FXP_OPEN or SSH_FXP_OPENDIR. The handle becomes invalid
-// immediately after this request has been sent.
-func (c *Client) close(handle string) error {
- id := c.nextID()
- typ, data, err := c.sendPacket(sshFxpClosePacket{
- ID: id,
- Handle: handle,
- })
- if err != nil {
- return err
- }
- switch typ {
- case ssh_FXP_STATUS:
- return normaliseError(unmarshalStatus(id, data))
- default:
- return unimplementedPacketErr(typ)
- }
-}
-
-func (c *Client) fstat(handle string) (*FileStat, error) {
- id := c.nextID()
- typ, data, err := c.sendPacket(sshFxpFstatPacket{
- ID: id,
- Handle: handle,
- })
- if err != nil {
- return nil, err
- }
- switch typ {
- case ssh_FXP_ATTRS:
- sid, data := unmarshalUint32(data)
- if sid != id {
- return nil, &unexpectedIDErr{id, sid}
- }
- attr, _ := unmarshalAttrs(data)
- return attr, nil
- case ssh_FXP_STATUS:
- return nil, unmarshalStatus(id, data)
- default:
- return nil, unimplementedPacketErr(typ)
- }
-}
-
-// StatVFS retrieves VFS statistics from a remote host.
-//
-// It implements the statvfs@openssh.com SSH_FXP_EXTENDED feature
-// from http://www.opensource.apple.com/source/OpenSSH/OpenSSH-175/openssh/PROTOCOL?txt.
-func (c *Client) StatVFS(path string) (*StatVFS, error) {
- // send the StatVFS packet to the server
- id := c.nextID()
- typ, data, err := c.sendPacket(sshFxpStatvfsPacket{
- ID: id,
- Path: path,
- })
- if err != nil {
- return nil, err
- }
-
- switch typ {
- // server responded with valid data
- case ssh_FXP_EXTENDED_REPLY:
- var response StatVFS
- err = binary.Read(bytes.NewReader(data), binary.BigEndian, &response)
- if err != nil {
- return nil, errors.New("can not parse reply")
- }
-
- return &response, nil
-
- // the resquest failed
- case ssh_FXP_STATUS:
- return nil, errors.New(fxp(ssh_FXP_STATUS).String())
-
- default:
- return nil, unimplementedPacketErr(typ)
- }
-}
-
-// Join joins any number of path elements into a single path, adding a
-// separating slash if necessary. The result is Cleaned; in particular, all
-// empty strings are ignored.
-func (c *Client) Join(elem ...string) string { return path.Join(elem...) }
-
-// Remove removes the specified file or directory. An error will be returned if no
-// file or directory with the specified path exists, or if the specified directory
-// is not empty.
-func (c *Client) Remove(path string) error {
- err := c.removeFile(path)
- switch err := err.(type) {
- case *StatusError:
- switch err.Code {
- // some servers, *cough* osx *cough*, return EPERM, not ENODIR.
- // serv-u returns ssh_FX_FILE_IS_A_DIRECTORY
- case ssh_FX_PERMISSION_DENIED, ssh_FX_FAILURE, ssh_FX_FILE_IS_A_DIRECTORY:
- return c.removeDirectory(path)
- default:
- return err
- }
- default:
- return err
- }
- return err
-}
-
-func (c *Client) removeFile(path string) error {
- id := c.nextID()
- typ, data, err := c.sendPacket(sshFxpRemovePacket{
- ID: id,
- Filename: path,
- })
- if err != nil {
- return err
- }
- switch typ {
- case ssh_FXP_STATUS:
- return normaliseError(unmarshalStatus(id, data))
- default:
- return unimplementedPacketErr(typ)
- }
-}
-
-func (c *Client) removeDirectory(path string) error {
- id := c.nextID()
- typ, data, err := c.sendPacket(sshFxpRmdirPacket{
- ID: id,
- Path: path,
- })
- if err != nil {
- return err
- }
- switch typ {
- case ssh_FXP_STATUS:
- return normaliseError(unmarshalStatus(id, data))
- default:
- return unimplementedPacketErr(typ)
- }
-}
-
-// Rename renames a file.
-func (c *Client) Rename(oldname, newname string) error {
- id := c.nextID()
- typ, data, err := c.sendPacket(sshFxpRenamePacket{
- ID: id,
- Oldpath: oldname,
- Newpath: newname,
- })
- if err != nil {
- return err
- }
- switch typ {
- case ssh_FXP_STATUS:
- return normaliseError(unmarshalStatus(id, data))
- default:
- return unimplementedPacketErr(typ)
- }
-}
-
-func (c *Client) realpath(path string) (string, error) {
- id := c.nextID()
- typ, data, err := c.sendPacket(sshFxpRealpathPacket{
- ID: id,
- Path: path,
- })
- if err != nil {
- return "", err
- }
- switch typ {
- case ssh_FXP_NAME:
- sid, data := unmarshalUint32(data)
- if sid != id {
- return "", &unexpectedIDErr{id, sid}
- }
- count, data := unmarshalUint32(data)
- if count != 1 {
- return "", unexpectedCount(1, count)
- }
- filename, _ := unmarshalString(data) // ignore attributes
- return filename, nil
- case ssh_FXP_STATUS:
- return "", normaliseError(unmarshalStatus(id, data))
- default:
- return "", unimplementedPacketErr(typ)
- }
-}
-
-// Getwd returns the current working directory of the server. Operations
-// involving relative paths will be based at this location.
-func (c *Client) Getwd() (string, error) {
- return c.realpath(".")
-}
-
-// Mkdir creates the specified directory. An error will be returned if a file or
-// directory with the specified path already exists, or if the directory's
-// parent folder does not exist (the method cannot create complete paths).
-func (c *Client) Mkdir(path string) error {
- id := c.nextID()
- typ, data, err := c.sendPacket(sshFxpMkdirPacket{
- ID: id,
- Path: path,
- })
- if err != nil {
- return err
- }
- switch typ {
- case ssh_FXP_STATUS:
- return normaliseError(unmarshalStatus(id, data))
- default:
- return unimplementedPacketErr(typ)
- }
-}
-
-// applyOptions applies options functions to the Client.
-// If an error is encountered, option processing ceases.
-func (c *Client) applyOptions(opts ...func(*Client) error) error {
- for _, f := range opts {
- if err := f(c); err != nil {
- return err
- }
- }
- return nil
-}
-
-// File represents a remote file.
-type File struct {
- c *Client
- path string
- handle string
- offset uint64 // current offset within remote file
-}
-
-// Close closes the File, rendering it unusable for I/O. It returns an
-// error, if any.
-func (f *File) Close() error {
- return f.c.close(f.handle)
-}
-
-// Name returns the name of the file as presented to Open or Create.
-func (f *File) Name() string {
- return f.path
-}
-
-const maxConcurrentRequests = 64
-
-// Read reads up to len(b) bytes from the File. It returns the number of
-// bytes read and an error, if any. EOF is signaled by a zero count with
-// err set to io.EOF.
-func (f *File) Read(b []byte) (int, error) {
- // Split the read into multiple maxPacket sized concurrent reads
- // bounded by maxConcurrentRequests. This allows reads with a suitably
- // large buffer to transfer data at a much faster rate due to
- // overlapping round trip times.
- inFlight := 0
- desiredInFlight := 1
- offset := f.offset
- ch := make(chan result, 1)
- type inflightRead struct {
- b []byte
- offset uint64
- }
- reqs := map[uint32]inflightRead{}
- type offsetErr struct {
- offset uint64
- err error
- }
- var firstErr offsetErr
-
- sendReq := func(b []byte, offset uint64) {
- reqID := f.c.nextID()
- f.c.dispatchRequest(ch, sshFxpReadPacket{
- ID: reqID,
- Handle: f.handle,
- Offset: offset,
- Len: uint32(len(b)),
- })
- inFlight++
- reqs[reqID] = inflightRead{b: b, offset: offset}
- }
-
- var read int
- for len(b) > 0 || inFlight > 0 {
- for inFlight < desiredInFlight && len(b) > 0 && firstErr.err == nil {
- l := min(len(b), f.c.maxPacket)
- rb := b[:l]
- sendReq(rb, offset)
- offset += uint64(l)
- b = b[l:]
- }
-
- if inFlight == 0 {
- break
- }
- select {
- case res := <-ch:
- inFlight--
- if res.err != nil {
- firstErr = offsetErr{offset: 0, err: res.err}
- break
- }
- reqID, data := unmarshalUint32(res.data)
- req, ok := reqs[reqID]
- if !ok {
- firstErr = offsetErr{offset: 0, err: errors.Errorf("sid: %v not found", reqID)}
- break
- }
- delete(reqs, reqID)
- switch res.typ {
- case ssh_FXP_STATUS:
- if firstErr.err == nil || req.offset < firstErr.offset {
- firstErr = offsetErr{
- offset: req.offset,
- err: normaliseError(unmarshalStatus(reqID, res.data)),
- }
- break
- }
- case ssh_FXP_DATA:
- l, data := unmarshalUint32(data)
- n := copy(req.b, data[:l])
- read += n
- if n < len(req.b) {
- sendReq(req.b[l:], req.offset+uint64(l))
- }
- if desiredInFlight < maxConcurrentRequests {
- desiredInFlight++
- }
- default:
- firstErr = offsetErr{offset: 0, err: unimplementedPacketErr(res.typ)}
- break
- }
- }
- }
- // If the error is anything other than EOF, then there
- // may be gaps in the data copied to the buffer so it's
- // best to return 0 so the caller can't make any
- // incorrect assumptions about the state of the buffer.
- if firstErr.err != nil && firstErr.err != io.EOF {
- read = 0
- }
- f.offset += uint64(read)
- return read, firstErr.err
-}
-
-// WriteTo writes the file to w. The return value is the number of bytes
-// written. Any error encountered during the write is also returned.
-func (f *File) WriteTo(w io.Writer) (int64, error) {
- fi, err := f.Stat()
- if err != nil {
- return 0, err
- }
- inFlight := 0
- desiredInFlight := 1
- offset := f.offset
- writeOffset := offset
- fileSize := uint64(fi.Size())
- ch := make(chan result, 1)
- type inflightRead struct {
- b []byte
- offset uint64
- }
- reqs := map[uint32]inflightRead{}
- pendingWrites := map[uint64][]byte{}
- type offsetErr struct {
- offset uint64
- err error
- }
- var firstErr offsetErr
-
- sendReq := func(b []byte, offset uint64) {
- reqID := f.c.nextID()
- f.c.dispatchRequest(ch, sshFxpReadPacket{
- ID: reqID,
- Handle: f.handle,
- Offset: offset,
- Len: uint32(len(b)),
- })
- inFlight++
- reqs[reqID] = inflightRead{b: b, offset: offset}
- }
-
- var copied int64
- for firstErr.err == nil || inFlight > 0 {
- for inFlight < desiredInFlight && firstErr.err == nil {
- b := make([]byte, f.c.maxPacket)
- sendReq(b, offset)
- offset += uint64(f.c.maxPacket)
- if offset > fileSize {
- desiredInFlight = 1
- }
- }
-
- if inFlight == 0 {
- break
- }
- select {
- case res := <-ch:
- inFlight--
- if res.err != nil {
- firstErr = offsetErr{offset: 0, err: res.err}
- break
- }
- reqID, data := unmarshalUint32(res.data)
- req, ok := reqs[reqID]
- if !ok {
- firstErr = offsetErr{offset: 0, err: errors.Errorf("sid: %v not found", reqID)}
- break
- }
- delete(reqs, reqID)
- switch res.typ {
- case ssh_FXP_STATUS:
- if firstErr.err == nil || req.offset < firstErr.offset {
- firstErr = offsetErr{offset: req.offset, err: normaliseError(unmarshalStatus(reqID, res.data))}
- break
- }
- case ssh_FXP_DATA:
- l, data := unmarshalUint32(data)
- if req.offset == writeOffset {
- nbytes, err := w.Write(data)
- copied += int64(nbytes)
- if err != nil {
- firstErr = offsetErr{offset: req.offset + uint64(nbytes), err: err}
- break
- }
- if nbytes < int(l) {
- firstErr = offsetErr{offset: req.offset + uint64(nbytes), err: io.ErrShortWrite}
- break
- }
- switch {
- case offset > fileSize:
- desiredInFlight = 1
- case desiredInFlight < maxConcurrentRequests:
- desiredInFlight++
- }
- writeOffset += uint64(nbytes)
- for pendingData, ok := pendingWrites[writeOffset]; ok; pendingData, ok = pendingWrites[writeOffset] {
- nbytes, err := w.Write(pendingData)
- if err != nil {
- firstErr = offsetErr{offset: writeOffset + uint64(nbytes), err: err}
- break
- }
- if nbytes < len(pendingData) {
- firstErr = offsetErr{offset: writeOffset + uint64(nbytes), err: io.ErrShortWrite}
- break
- }
- writeOffset += uint64(nbytes)
- inFlight--
- }
- } else {
- // Don't write the data yet because
- // this response came in out of order
- // and we need to wait for responses
- // for earlier segments of the file.
- inFlight++ // Pending writes should still be considered inFlight.
- pendingWrites[req.offset] = data
- }
- default:
- firstErr = offsetErr{offset: 0, err: unimplementedPacketErr(res.typ)}
- break
- }
- }
- }
- if firstErr.err != io.EOF {
- return copied, firstErr.err
- }
- return copied, nil
-}
-
-// Stat returns the FileInfo structure describing file. If there is an
-// error.
-func (f *File) Stat() (os.FileInfo, error) {
- fs, err := f.c.fstat(f.handle)
- if err != nil {
- return nil, err
- }
- return fileInfoFromStat(fs, path.Base(f.path)), nil
-}
-
-// Write writes len(b) bytes to the File. It returns the number of bytes
-// written and an error, if any. Write returns a non-nil error when n !=
-// len(b).
-func (f *File) Write(b []byte) (int, error) {
- // Split the write into multiple maxPacket sized concurrent writes
- // bounded by maxConcurrentRequests. This allows writes with a suitably
- // large buffer to transfer data at a much faster rate due to
- // overlapping round trip times.
- inFlight := 0
- desiredInFlight := 1
- offset := f.offset
- ch := make(chan result, 1)
- var firstErr error
- written := len(b)
- for len(b) > 0 || inFlight > 0 {
- for inFlight < desiredInFlight && len(b) > 0 && firstErr == nil {
- l := min(len(b), f.c.maxPacket)
- rb := b[:l]
- f.c.dispatchRequest(ch, sshFxpWritePacket{
- ID: f.c.nextID(),
- Handle: f.handle,
- Offset: offset,
- Length: uint32(len(rb)),
- Data: rb,
- })
- inFlight++
- offset += uint64(l)
- b = b[l:]
- }
-
- if inFlight == 0 {
- break
- }
- select {
- case res := <-ch:
- inFlight--
- if res.err != nil {
- firstErr = res.err
- break
- }
- switch res.typ {
- case ssh_FXP_STATUS:
- id, _ := unmarshalUint32(res.data)
- err := normaliseError(unmarshalStatus(id, res.data))
- if err != nil && firstErr == nil {
- firstErr = err
- break
- }
- if desiredInFlight < maxConcurrentRequests {
- desiredInFlight++
- }
- default:
- firstErr = unimplementedPacketErr(res.typ)
- break
- }
- }
- }
- // If error is non-nil, then there may be gaps in the data written to
- // the file so it's best to return 0 so the caller can't make any
- // incorrect assumptions about the state of the file.
- if firstErr != nil {
- written = 0
- }
- f.offset += uint64(written)
- return written, firstErr
-}
-
-// ReadFrom reads data from r until EOF and writes it to the file. The return
-// value is the number of bytes read. Any error except io.EOF encountered
-// during the read is also returned.
-func (f *File) ReadFrom(r io.Reader) (int64, error) {
- inFlight := 0
- desiredInFlight := 1
- offset := f.offset
- ch := make(chan result, 1)
- var firstErr error
- read := int64(0)
- b := make([]byte, f.c.maxPacket)
- for inFlight > 0 || firstErr == nil {
- for inFlight < desiredInFlight && firstErr == nil {
- n, err := r.Read(b)
- if err != nil {
- firstErr = err
- }
- f.c.dispatchRequest(ch, sshFxpWritePacket{
- ID: f.c.nextID(),
- Handle: f.handle,
- Offset: offset,
- Length: uint32(n),
- Data: b[:n],
- })
- inFlight++
- offset += uint64(n)
- read += int64(n)
- }
-
- if inFlight == 0 {
- break
- }
- select {
- case res := <-ch:
- inFlight--
- if res.err != nil {
- firstErr = res.err
- break
- }
- switch res.typ {
- case ssh_FXP_STATUS:
- id, _ := unmarshalUint32(res.data)
- err := normaliseError(unmarshalStatus(id, res.data))
- if err != nil && firstErr == nil {
- firstErr = err
- break
- }
- if desiredInFlight < maxConcurrentRequests {
- desiredInFlight++
- }
- default:
- firstErr = unimplementedPacketErr(res.typ)
- break
- }
- }
- }
- if firstErr == io.EOF {
- firstErr = nil
- }
- // If error is non-nil, then there may be gaps in the data written to
- // the file so it's best to return 0 so the caller can't make any
- // incorrect assumptions about the state of the file.
- if firstErr != nil {
- read = 0
- }
- f.offset += uint64(read)
- return read, firstErr
-}
-
-// Seek implements io.Seeker by setting the client offset for the next Read or
-// Write. It returns the next offset read. Seeking before or after the end of
-// the file is undefined. Seeking relative to the end calls Stat.
-func (f *File) Seek(offset int64, whence int) (int64, error) {
- switch whence {
- case os.SEEK_SET:
- f.offset = uint64(offset)
- case os.SEEK_CUR:
- f.offset = uint64(int64(f.offset) + offset)
- case os.SEEK_END:
- fi, err := f.Stat()
- if err != nil {
- return int64(f.offset), err
- }
- f.offset = uint64(fi.Size() + offset)
- default:
- return int64(f.offset), unimplementedSeekWhence(whence)
- }
- return int64(f.offset), nil
-}
-
-// Chown changes the uid/gid of the current file.
-func (f *File) Chown(uid, gid int) error {
- return f.c.Chown(f.path, uid, gid)
-}
-
-// Chmod changes the permissions of the current file.
-func (f *File) Chmod(mode os.FileMode) error {
- return f.c.Chmod(f.path, mode)
-}
-
-// Truncate sets the size of the current file. Although it may be safely assumed
-// that if the size is less than its current size it will be truncated to fit,
-// the SFTP protocol does not specify what behavior the server should do when setting
-// size greater than the current size.
-func (f *File) Truncate(size int64) error {
- return f.c.Truncate(f.path, size)
-}
-
-func min(a, b int) int {
- if a > b {
- return b
- }
- return a
-}
-
-// normaliseError normalises an error into a more standard form that can be
-// checked against stdlib errors like io.EOF or os.ErrNotExist.
-func normaliseError(err error) error {
- switch err := err.(type) {
- case *StatusError:
- switch err.Code {
- case ssh_FX_EOF:
- return io.EOF
- case ssh_FX_NO_SUCH_FILE:
- return os.ErrNotExist
- case ssh_FX_OK:
- return nil
- default:
- return err
- }
- default:
- return err
- }
-}
-
-func unmarshalStatus(id uint32, data []byte) error {
- sid, data := unmarshalUint32(data)
- if sid != id {
- return &unexpectedIDErr{id, sid}
- }
- code, data := unmarshalUint32(data)
- msg, data, err := unmarshalStringSafe(data)
- if err != nil {
- return err
- }
- lang, _, _ := unmarshalStringSafe(data)
- return &StatusError{
- Code: code,
- msg: msg,
- lang: lang,
- }
-}
-
-func marshalStatus(b []byte, err StatusError) []byte {
- b = marshalUint32(b, err.Code)
- b = marshalString(b, err.msg)
- b = marshalString(b, err.lang)
- return b
-}
-
-// flags converts the flags passed to OpenFile into ssh flags.
-// Unsupported flags are ignored.
-func flags(f int) uint32 {
- var out uint32
- switch f & os.O_WRONLY {
- case os.O_WRONLY:
- out |= ssh_FXF_WRITE
- case os.O_RDONLY:
- out |= ssh_FXF_READ
- }
- if f&os.O_RDWR == os.O_RDWR {
- out |= ssh_FXF_READ | ssh_FXF_WRITE
- }
- if f&os.O_APPEND == os.O_APPEND {
- out |= ssh_FXF_APPEND
- }
- if f&os.O_CREATE == os.O_CREATE {
- out |= ssh_FXF_CREAT
- }
- if f&os.O_TRUNC == os.O_TRUNC {
- out |= ssh_FXF_TRUNC
- }
- if f&os.O_EXCL == os.O_EXCL {
- out |= ssh_FXF_EXCL
- }
- return out
-}
diff --git a/vendor/github.com/pkg/sftp/client_integration_darwin_test.go b/vendor/github.com/pkg/sftp/client_integration_darwin_test.go
deleted file mode 100644
index 6c72536f..00000000
--- a/vendor/github.com/pkg/sftp/client_integration_darwin_test.go
+++ /dev/null
@@ -1,42 +0,0 @@
-package sftp
-
-import (
- "syscall"
- "testing"
-)
-
-const sftpServer = "/usr/libexec/sftp-server"
-
-func TestClientStatVFS(t *testing.T) {
- if *testServerImpl {
- t.Skipf("go server does not support FXP_EXTENDED")
- }
- sftp, cmd := testClient(t, READWRITE, NO_DELAY)
- defer cmd.Wait()
- defer sftp.Close()
-
- vfs, err := sftp.StatVFS("/")
- if err != nil {
- t.Fatal(err)
- }
-
- // get system stats
- s := syscall.Statfs_t{}
- err = syscall.Statfs("/", &s)
- if err != nil {
- t.Fatal(err)
- }
-
- // check some stats
- if vfs.Files != uint64(s.Files) {
- t.Fatal("fr_size does not match")
- }
-
- if vfs.Bfree != uint64(s.Bfree) {
- t.Fatal("f_bsize does not match")
- }
-
- if vfs.Favail != uint64(s.Ffree) {
- t.Fatal("f_namemax does not match")
- }
-}
diff --git a/vendor/github.com/pkg/sftp/client_integration_linux_test.go b/vendor/github.com/pkg/sftp/client_integration_linux_test.go
deleted file mode 100644
index aeca7978..00000000
--- a/vendor/github.com/pkg/sftp/client_integration_linux_test.go
+++ /dev/null
@@ -1,42 +0,0 @@
-package sftp
-
-import (
- "syscall"
- "testing"
-)
-
-const sftpServer = "/usr/lib/openssh/sftp-server"
-
-func TestClientStatVFS(t *testing.T) {
- if *testServerImpl {
- t.Skipf("go server does not support FXP_EXTENDED")
- }
- sftp, cmd := testClient(t, READWRITE, NO_DELAY)
- defer cmd.Wait()
- defer sftp.Close()
-
- vfs, err := sftp.StatVFS("/")
- if err != nil {
- t.Fatal(err)
- }
-
- // get system stats
- s := syscall.Statfs_t{}
- err = syscall.Statfs("/", &s)
- if err != nil {
- t.Fatal(err)
- }
-
- // check some stats
- if vfs.Frsize != uint64(s.Frsize) {
- t.Fatal("fr_size does not match, expected: %v, got: %v", s.Frsize, vfs.Frsize)
- }
-
- if vfs.Bsize != uint64(s.Bsize) {
- t.Fatal("f_bsize does not match, expected: %v, got: %v", s.Bsize, vfs.Bsize)
- }
-
- if vfs.Namemax != uint64(s.Namelen) {
- t.Fatal("f_namemax does not match, expected: %v, got: %v", s.Namelen, vfs.Namemax)
- }
-}
diff --git a/vendor/github.com/pkg/sftp/client_integration_test.go b/vendor/github.com/pkg/sftp/client_integration_test.go
deleted file mode 100644
index be16add8..00000000
--- a/vendor/github.com/pkg/sftp/client_integration_test.go
+++ /dev/null
@@ -1,1697 +0,0 @@
-package sftp
-
-// sftp integration tests
-// enable with -integration
-
-import (
- "crypto/sha1"
- "flag"
- "io"
- "io/ioutil"
- "math/rand"
- "net"
- "os"
- "os/exec"
- "os/user"
- "path"
- "path/filepath"
- "reflect"
- "regexp"
- "strconv"
- "testing"
- "testing/quick"
- "time"
-
- "github.com/kr/fs"
-)
-
-const (
- READONLY = true
- READWRITE = false
- NO_DELAY time.Duration = 0
-
- debuglevel = "ERROR" // set to "DEBUG" for debugging
-)
-
-var testServerImpl = flag.Bool("testserver", false, "perform integration tests against sftp package server instance")
-var testIntegration = flag.Bool("integration", false, "perform integration tests against sftp server process")
-var testSftp = flag.String("sftp", sftpServer, "location of the sftp server binary")
-
-type delayedWrite struct {
- t time.Time
- b []byte
-}
-
-// delayedWriter wraps a writer and artificially delays the write. This is
-// meant to mimic connections with various latencies. Error's returned from the
-// underlying writer will panic so this should only be used over reliable
-// connections.
-type delayedWriter struct {
- w io.WriteCloser
- ch chan delayedWrite
- closed chan struct{}
-}
-
-func newDelayedWriter(w io.WriteCloser, delay time.Duration) io.WriteCloser {
- ch := make(chan delayedWrite, 128)
- closed := make(chan struct{})
- go func() {
- for writeMsg := range ch {
- time.Sleep(writeMsg.t.Add(delay).Sub(time.Now()))
- n, err := w.Write(writeMsg.b)
- if err != nil {
- panic("write error")
- }
- if n < len(writeMsg.b) {
- panic("showrt write")
- }
- }
- w.Close()
- close(closed)
- }()
- return delayedWriter{w: w, ch: ch, closed: closed}
-}
-
-func (w delayedWriter) Write(b []byte) (int, error) {
- bcopy := make([]byte, len(b))
- copy(bcopy, b)
- w.ch <- delayedWrite{t: time.Now(), b: bcopy}
- return len(b), nil
-}
-
-func (w delayedWriter) Close() error {
- close(w.ch)
- <-w.closed
- return nil
-}
-
-// netPipe provides a pair of io.ReadWriteClosers connected to each other.
-// The functions is identical to os.Pipe with the exception that netPipe
-// provides the Read/Close guarentees that os.File derrived pipes do not.
-func netPipe(t testing.TB) (io.ReadWriteCloser, io.ReadWriteCloser) {
- type result struct {
- net.Conn
- error
- }
-
- l, err := net.Listen("tcp", "127.0.0.1:0")
- if err != nil {
- t.Fatal(err)
- }
-
- ch := make(chan result, 1)
- go func() {
- conn, err := l.Accept()
- ch <- result{conn, err}
- err = l.Close()
- if err != nil {
- t.Error(err)
- }
- }()
- c1, err := net.Dial("tcp", l.Addr().String())
- if err != nil {
- l.Close() // might cause another in the listening goroutine, but too bad
- t.Fatal(err)
- }
- r := <-ch
- if r.error != nil {
- t.Fatal(err)
- }
- return c1, r.Conn
-}
-
-func testClientGoSvr(t testing.TB, readonly bool, delay time.Duration) (*Client, *exec.Cmd) {
- c1, c2 := netPipe(t)
-
- options := []ServerOption{WithDebug(os.Stderr)}
- if readonly {
- options = append(options, ReadOnly())
- }
-
- server, err := NewServer(c1, options...)
- if err != nil {
- t.Fatal(err)
- }
- go server.Serve()
-
- var ctx io.WriteCloser = c2
- if delay > NO_DELAY {
- ctx = newDelayedWriter(ctx, delay)
- }
-
- client, err := NewClientPipe(c2, ctx)
- if err != nil {
- t.Fatal(err)
- }
-
- // dummy command...
- return client, exec.Command("true")
-}
-
-// testClient returns a *Client connected to a localy running sftp-server
-// the *exec.Cmd returned must be defer Wait'd.
-func testClient(t testing.TB, readonly bool, delay time.Duration) (*Client, *exec.Cmd) {
- if !*testIntegration {
- t.Skip("skipping intergration test")
- }
-
- if *testServerImpl {
- return testClientGoSvr(t, readonly, delay)
- }
-
- cmd := exec.Command(*testSftp, "-e", "-R", "-l", debuglevel) // log to stderr, read only
- if !readonly {
- cmd = exec.Command(*testSftp, "-e", "-l", debuglevel) // log to stderr
- }
- cmd.Stderr = os.Stdout
- pw, err := cmd.StdinPipe()
- if err != nil {
- t.Fatal(err)
- }
- if delay > NO_DELAY {
- pw = newDelayedWriter(pw, delay)
- }
- pr, err := cmd.StdoutPipe()
- if err != nil {
- t.Fatal(err)
- }
- if err := cmd.Start(); err != nil {
- t.Skipf("could not start sftp-server process: %v", err)
- }
-
- sftp, err := NewClientPipe(pr, pw)
- if err != nil {
- t.Fatal(err)
- }
-
- return sftp, cmd
-}
-
-func TestNewClient(t *testing.T) {
- sftp, cmd := testClient(t, READONLY, NO_DELAY)
- defer cmd.Wait()
-
- if err := sftp.Close(); err != nil {
- t.Fatal(err)
- }
-}
-
-func TestClientLstat(t *testing.T) {
- sftp, cmd := testClient(t, READONLY, NO_DELAY)
- defer cmd.Wait()
- defer sftp.Close()
-
- f, err := ioutil.TempFile("", "sftptest")
- if err != nil {
- t.Fatal(err)
- }
- defer os.Remove(f.Name())
-
- want, err := os.Lstat(f.Name())
- if err != nil {
- t.Fatal(err)
- }
-
- got, err := sftp.Lstat(f.Name())
- if err != nil {
- t.Fatal(err)
- }
-
- if !sameFile(want, got) {
- t.Fatalf("Lstat(%q): want %#v, got %#v", f.Name(), want, got)
- }
-}
-
-func TestClientLstatIsNotExist(t *testing.T) {
- sftp, cmd := testClient(t, READONLY, NO_DELAY)
- defer cmd.Wait()
- defer sftp.Close()
-
- f, err := ioutil.TempFile("", "sftptest")
- if err != nil {
- t.Fatal(err)
- }
- os.Remove(f.Name())
-
- if _, err := sftp.Lstat(f.Name()); !os.IsNotExist(err) {
- t.Errorf("os.IsNotExist(%v) = false, want true", err)
- }
-}
-
-func TestClientMkdir(t *testing.T) {
- sftp, cmd := testClient(t, READWRITE, NO_DELAY)
- defer cmd.Wait()
- defer sftp.Close()
-
- dir, err := ioutil.TempDir("", "sftptest")
- if err != nil {
- t.Fatal(err)
- }
- sub := path.Join(dir, "mkdir1")
- if err := sftp.Mkdir(sub); err != nil {
- t.Fatal(err)
- }
- if _, err := os.Lstat(sub); err != nil {
- t.Fatal(err)
- }
-}
-
-func TestClientOpen(t *testing.T) {
- sftp, cmd := testClient(t, READONLY, NO_DELAY)
- defer cmd.Wait()
- defer sftp.Close()
-
- f, err := ioutil.TempFile("", "sftptest")
- if err != nil {
- t.Fatal(err)
- }
- defer os.Remove(f.Name())
-
- got, err := sftp.Open(f.Name())
- if err != nil {
- t.Fatal(err)
- }
- if err := got.Close(); err != nil {
- t.Fatal(err)
- }
-}
-
-func TestClientOpenIsNotExist(t *testing.T) {
- sftp, cmd := testClient(t, READONLY, NO_DELAY)
- defer cmd.Wait()
- defer sftp.Close()
-
- if _, err := sftp.Open("/doesnt/exist/"); !os.IsNotExist(err) {
- t.Errorf("os.IsNotExist(%v) = false, want true", err)
- }
-}
-
-func TestClientStatIsNotExist(t *testing.T) {
- sftp, cmd := testClient(t, READONLY, NO_DELAY)
- defer cmd.Wait()
- defer sftp.Close()
-
- if _, err := sftp.Stat("/doesnt/exist/"); !os.IsNotExist(err) {
- t.Errorf("os.IsNotExist(%v) = false, want true", err)
- }
-}
-
-const seekBytes = 128 * 1024
-
-type seek struct {
- offset int64
-}
-
-func (s seek) Generate(r *rand.Rand, _ int) reflect.Value {
- s.offset = int64(r.Int31n(seekBytes))
- return reflect.ValueOf(s)
-}
-
-func (s seek) set(t *testing.T, r io.ReadSeeker) {
- if _, err := r.Seek(s.offset, os.SEEK_SET); err != nil {
- t.Fatalf("error while seeking with %+v: %v", s, err)
- }
-}
-
-func (s seek) current(t *testing.T, r io.ReadSeeker) {
- const mid = seekBytes / 2
-
- skip := s.offset / 2
- if s.offset > mid {
- skip = -skip
- }
-
- if _, err := r.Seek(mid, os.SEEK_SET); err != nil {
- t.Fatalf("error seeking to midpoint with %+v: %v", s, err)
- }
- if _, err := r.Seek(skip, os.SEEK_CUR); err != nil {
- t.Fatalf("error seeking from %d with %+v: %v", mid, s, err)
- }
-}
-
-func (s seek) end(t *testing.T, r io.ReadSeeker) {
- if _, err := r.Seek(-s.offset, os.SEEK_END); err != nil {
- t.Fatalf("error seeking from end with %+v: %v", s, err)
- }
-}
-
-func TestClientSeek(t *testing.T) {
- sftp, cmd := testClient(t, READONLY, NO_DELAY)
- defer cmd.Wait()
- defer sftp.Close()
-
- fOS, err := ioutil.TempFile("", "seek-test")
- if err != nil {
- t.Fatal(err)
- }
- defer fOS.Close()
-
- fSFTP, err := sftp.Open(fOS.Name())
- if err != nil {
- t.Fatal(err)
- }
- defer fSFTP.Close()
-
- writeN(t, fOS, seekBytes)
-
- if err := quick.CheckEqual(
- func(s seek) (string, int64) { s.set(t, fOS); return readHash(t, fOS) },
- func(s seek) (string, int64) { s.set(t, fSFTP); return readHash(t, fSFTP) },
- nil,
- ); err != nil {
- t.Errorf("Seek: expected equal absolute seeks: %v", err)
- }
-
- if err := quick.CheckEqual(
- func(s seek) (string, int64) { s.current(t, fOS); return readHash(t, fOS) },
- func(s seek) (string, int64) { s.current(t, fSFTP); return readHash(t, fSFTP) },
- nil,
- ); err != nil {
- t.Errorf("Seek: expected equal seeks from middle: %v", err)
- }
-
- if err := quick.CheckEqual(
- func(s seek) (string, int64) { s.end(t, fOS); return readHash(t, fOS) },
- func(s seek) (string, int64) { s.end(t, fSFTP); return readHash(t, fSFTP) },
- nil,
- ); err != nil {
- t.Errorf("Seek: expected equal seeks from end: %v", err)
- }
-}
-
-func TestClientCreate(t *testing.T) {
- sftp, cmd := testClient(t, READWRITE, NO_DELAY)
- defer cmd.Wait()
- defer sftp.Close()
-
- f, err := ioutil.TempFile("", "sftptest")
- if err != nil {
- t.Fatal(err)
- }
- defer f.Close()
- defer os.Remove(f.Name())
-
- f2, err := sftp.Create(f.Name())
- if err != nil {
- t.Fatal(err)
- }
- defer f2.Close()
-}
-
-func TestClientAppend(t *testing.T) {
- sftp, cmd := testClient(t, READWRITE, NO_DELAY)
- defer cmd.Wait()
- defer sftp.Close()
-
- f, err := ioutil.TempFile("", "sftptest")
- if err != nil {
- t.Fatal(err)
- }
- defer f.Close()
- defer os.Remove(f.Name())
-
- f2, err := sftp.OpenFile(f.Name(), os.O_RDWR|os.O_APPEND)
- if err != nil {
- t.Fatal(err)
- }
- defer f2.Close()
-}
-
-func TestClientCreateFailed(t *testing.T) {
- sftp, cmd := testClient(t, READONLY, NO_DELAY)
- defer cmd.Wait()
- defer sftp.Close()
-
- f, err := ioutil.TempFile("", "sftptest")
- if err != nil {
- t.Fatal(err)
- }
- defer f.Close()
- defer os.Remove(f.Name())
-
- f2, err := sftp.Create(f.Name())
- if err1, ok := err.(*StatusError); !ok || err1.Code != ssh_FX_PERMISSION_DENIED {
- t.Fatalf("Create: want: %v, got %#v", ssh_FX_PERMISSION_DENIED, err)
- }
- if err == nil {
- f2.Close()
- }
-}
-
-func TestClientFileName(t *testing.T) {
- sftp, cmd := testClient(t, READONLY, NO_DELAY)
- defer cmd.Wait()
- defer sftp.Close()
-
- f, err := ioutil.TempFile("", "sftptest")
- if err != nil {
- t.Fatal(err)
- }
- defer os.Remove(f.Name())
-
- f2, err := sftp.Open(f.Name())
- if err != nil {
- t.Fatal(err)
- }
-
- if got, want := f2.Name(), f.Name(); got != want {
- t.Fatalf("Name: got %q want %q", want, got)
- }
-}
-
-func TestClientFileStat(t *testing.T) {
- sftp, cmd := testClient(t, READONLY, NO_DELAY)
- defer cmd.Wait()
- defer sftp.Close()
-
- f, err := ioutil.TempFile("", "sftptest")
- if err != nil {
- t.Fatal(err)
- }
- defer os.Remove(f.Name())
-
- want, err := os.Lstat(f.Name())
- if err != nil {
- t.Fatal(err)
- }
-
- f2, err := sftp.Open(f.Name())
- if err != nil {
- t.Fatal(err)
- }
-
- got, err := f2.Stat()
- if err != nil {
- t.Fatal(err)
- }
-
- if !sameFile(want, got) {
- t.Fatalf("Lstat(%q): want %#v, got %#v", f.Name(), want, got)
- }
-}
-
-func TestClientStatLink(t *testing.T) {
- sftp, cmd := testClient(t, READONLY, NO_DELAY)
- defer cmd.Wait()
- defer sftp.Close()
-
- f, err := ioutil.TempFile("", "sftptest")
- if err != nil {
- t.Fatal(err)
- }
- defer os.Remove(f.Name())
-
- realName := f.Name()
- linkName := f.Name() + ".softlink"
-
- // create a symlink that points at sftptest
- if err := os.Symlink(realName, linkName); err != nil {
- t.Fatal(err)
- }
- defer os.Remove(linkName)
-
- // compare Lstat of links
- wantLstat, err := os.Lstat(linkName)
- if err != nil {
- t.Fatal(err)
- }
- wantStat, err := os.Stat(linkName)
- if err != nil {
- t.Fatal(err)
- }
-
- gotLstat, err := sftp.Lstat(linkName)
- if err != nil {
- t.Fatal(err)
- }
- gotStat, err := sftp.Stat(linkName)
- if err != nil {
- t.Fatal(err)
- }
-
- // check that stat is not lstat from os package
- if sameFile(wantLstat, wantStat) {
- t.Fatalf("Lstat / Stat(%q): both %#v %#v", f.Name(), wantLstat, wantStat)
- }
-
- // compare Lstat of links
- if !sameFile(wantLstat, gotLstat) {
- t.Fatalf("Lstat(%q): want %#v, got %#v", f.Name(), wantLstat, gotLstat)
- }
-
- // compare Stat of links
- if !sameFile(wantStat, gotStat) {
- t.Fatalf("Stat(%q): want %#v, got %#v", f.Name(), wantStat, gotStat)
- }
-
- // check that stat is not lstat
- if sameFile(gotLstat, gotStat) {
- t.Fatalf("Lstat / Stat(%q): both %#v %#v", f.Name(), gotLstat, gotStat)
- }
-}
-
-func TestClientRemove(t *testing.T) {
- sftp, cmd := testClient(t, READWRITE, NO_DELAY)
- defer cmd.Wait()
- defer sftp.Close()
-
- f, err := ioutil.TempFile("", "sftptest")
- if err != nil {
- t.Fatal(err)
- }
- if err := sftp.Remove(f.Name()); err != nil {
- t.Fatal(err)
- }
- if _, err := os.Lstat(f.Name()); !os.IsNotExist(err) {
- t.Fatal(err)
- }
-}
-
-func TestClientRemoveDir(t *testing.T) {
- sftp, cmd := testClient(t, READWRITE, NO_DELAY)
- defer cmd.Wait()
- defer sftp.Close()
-
- dir, err := ioutil.TempDir("", "sftptest")
- if err != nil {
- t.Fatal(err)
- }
- if err := sftp.Remove(dir); err != nil {
- t.Fatal(err)
- }
- if _, err := os.Lstat(dir); !os.IsNotExist(err) {
- t.Fatal(err)
- }
-}
-
-func TestClientRemoveFailed(t *testing.T) {
- sftp, cmd := testClient(t, READONLY, NO_DELAY)
- defer cmd.Wait()
- defer sftp.Close()
-
- f, err := ioutil.TempFile("", "sftptest")
- if err != nil {
- t.Fatal(err)
- }
- if err := sftp.Remove(f.Name()); err == nil {
- t.Fatalf("Remove(%v): want: permission denied, got %v", f.Name(), err)
- }
- if _, err := os.Lstat(f.Name()); err != nil {
- t.Fatal(err)
- }
-}
-
-func TestClientRename(t *testing.T) {
- sftp, cmd := testClient(t, READWRITE, NO_DELAY)
- defer cmd.Wait()
- defer sftp.Close()
-
- f, err := ioutil.TempFile("", "sftptest")
- if err != nil {
- t.Fatal(err)
- }
- f2 := f.Name() + ".new"
- if err := sftp.Rename(f.Name(), f2); err != nil {
- t.Fatal(err)
- }
- if _, err := os.Lstat(f.Name()); !os.IsNotExist(err) {
- t.Fatal(err)
- }
- if _, err := os.Lstat(f2); err != nil {
- t.Fatal(err)
- }
-}
-
-func TestClientGetwd(t *testing.T) {
- sftp, cmd := testClient(t, READONLY, NO_DELAY)
- defer cmd.Wait()
- defer sftp.Close()
-
- lwd, err := os.Getwd()
- if err != nil {
- t.Fatal(err)
- }
- rwd, err := sftp.Getwd()
- if err != nil {
- t.Fatal(err)
- }
- if !path.IsAbs(rwd) {
- t.Fatalf("Getwd: wanted absolute path, got %q", rwd)
- }
- if lwd != rwd {
- t.Fatalf("Getwd: want %q, got %q", lwd, rwd)
- }
-}
-
-func TestClientReadLink(t *testing.T) {
- sftp, cmd := testClient(t, READWRITE, NO_DELAY)
- defer cmd.Wait()
- defer sftp.Close()
-
- f, err := ioutil.TempFile("", "sftptest")
- if err != nil {
- t.Fatal(err)
- }
- f2 := f.Name() + ".sym"
- if err := os.Symlink(f.Name(), f2); err != nil {
- t.Fatal(err)
- }
- if rl, err := sftp.ReadLink(f2); err != nil {
- t.Fatal(err)
- } else if rl != f.Name() {
- t.Fatalf("unexpected link target: %v, not %v", rl, f.Name())
- }
-}
-
-func TestClientSymlink(t *testing.T) {
- sftp, cmd := testClient(t, READWRITE, NO_DELAY)
- defer cmd.Wait()
- defer sftp.Close()
-
- f, err := ioutil.TempFile("", "sftptest")
- if err != nil {
- t.Fatal(err)
- }
- f2 := f.Name() + ".sym"
- if err := sftp.Symlink(f.Name(), f2); err != nil {
- t.Fatal(err)
- }
- if rl, err := sftp.ReadLink(f2); err != nil {
- t.Fatal(err)
- } else if rl != f.Name() {
- t.Fatalf("unexpected link target: %v, not %v", rl, f.Name())
- }
-}
-
-func TestClientChmod(t *testing.T) {
- sftp, cmd := testClient(t, READWRITE, NO_DELAY)
- defer cmd.Wait()
- defer sftp.Close()
-
- f, err := ioutil.TempFile("", "sftptest")
- if err != nil {
- t.Fatal(err)
- }
- if err := sftp.Chmod(f.Name(), 0531); err != nil {
- t.Fatal(err)
- }
- if stat, err := os.Stat(f.Name()); err != nil {
- t.Fatal(err)
- } else if stat.Mode()&os.ModePerm != 0531 {
- t.Fatalf("invalid perm %o\n", stat.Mode())
- }
-}
-
-func TestClientChmodReadonly(t *testing.T) {
- sftp, cmd := testClient(t, READONLY, NO_DELAY)
- defer cmd.Wait()
- defer sftp.Close()
-
- f, err := ioutil.TempFile("", "sftptest")
- if err != nil {
- t.Fatal(err)
- }
- if err := sftp.Chmod(f.Name(), 0531); err == nil {
- t.Fatal("expected error")
- }
-}
-
-func TestClientChown(t *testing.T) {
- sftp, cmd := testClient(t, READWRITE, NO_DELAY)
- defer cmd.Wait()
- defer sftp.Close()
-
- usr, err := user.Current()
- if err != nil {
- t.Fatal(err)
- }
- chownto, err := user.Lookup("daemon") // seems common-ish...
- if err != nil {
- t.Fatal(err)
- }
-
- if usr.Uid != "0" {
- t.Log("must be root to run chown tests")
- t.Skip()
- }
- toUID, err := strconv.Atoi(chownto.Uid)
- if err != nil {
- t.Fatal(err)
- }
- toGID, err := strconv.Atoi(chownto.Gid)
- if err != nil {
- t.Fatal(err)
- }
-
- f, err := ioutil.TempFile("", "sftptest")
- if err != nil {
- t.Fatal(err)
- }
- before, err := exec.Command("ls", "-nl", f.Name()).Output()
- if err != nil {
- t.Fatal(err)
- }
- if err := sftp.Chown(f.Name(), toUID, toGID); err != nil {
- t.Fatal(err)
- }
- after, err := exec.Command("ls", "-nl", f.Name()).Output()
- if err != nil {
- t.Fatal(err)
- }
-
- spaceRegex := regexp.MustCompile(`\s+`)
-
- beforeWords := spaceRegex.Split(string(before), -1)
- if beforeWords[2] != "0" {
- t.Fatalf("bad previous user? should be root")
- }
- afterWords := spaceRegex.Split(string(after), -1)
- if afterWords[2] != chownto.Uid || afterWords[3] != chownto.Gid {
- t.Fatalf("bad chown: %#v", afterWords)
- }
- t.Logf("before: %v", string(before))
- t.Logf(" after: %v", string(after))
-}
-
-func TestClientChownReadonly(t *testing.T) {
- sftp, cmd := testClient(t, READONLY, NO_DELAY)
- defer cmd.Wait()
- defer sftp.Close()
-
- usr, err := user.Current()
- if err != nil {
- t.Fatal(err)
- }
- chownto, err := user.Lookup("daemon") // seems common-ish...
- if err != nil {
- t.Fatal(err)
- }
-
- if usr.Uid != "0" {
- t.Log("must be root to run chown tests")
- t.Skip()
- }
- toUID, err := strconv.Atoi(chownto.Uid)
- if err != nil {
- t.Fatal(err)
- }
- toGID, err := strconv.Atoi(chownto.Gid)
- if err != nil {
- t.Fatal(err)
- }
-
- f, err := ioutil.TempFile("", "sftptest")
- if err != nil {
- t.Fatal(err)
- }
- if err := sftp.Chown(f.Name(), toUID, toGID); err == nil {
- t.Fatal("expected error")
- }
-}
-
-func TestClientChtimes(t *testing.T) {
- sftp, cmd := testClient(t, READWRITE, NO_DELAY)
- defer cmd.Wait()
- defer sftp.Close()
-
- f, err := ioutil.TempFile("", "sftptest")
- if err != nil {
- t.Fatal(err)
- }
-
- atime := time.Date(2013, 2, 23, 13, 24, 35, 0, time.UTC)
- mtime := time.Date(1985, 6, 12, 6, 6, 6, 0, time.UTC)
- if err := sftp.Chtimes(f.Name(), atime, mtime); err != nil {
- t.Fatal(err)
- }
- if stat, err := os.Stat(f.Name()); err != nil {
- t.Fatal(err)
- } else if stat.ModTime().Sub(mtime) != 0 {
- t.Fatalf("incorrect mtime: %v vs %v", stat.ModTime(), mtime)
- }
-}
-
-func TestClientChtimesReadonly(t *testing.T) {
- sftp, cmd := testClient(t, READONLY, NO_DELAY)
- defer cmd.Wait()
- defer sftp.Close()
-
- f, err := ioutil.TempFile("", "sftptest")
- if err != nil {
- t.Fatal(err)
- }
-
- atime := time.Date(2013, 2, 23, 13, 24, 35, 0, time.UTC)
- mtime := time.Date(1985, 6, 12, 6, 6, 6, 0, time.UTC)
- if err := sftp.Chtimes(f.Name(), atime, mtime); err == nil {
- t.Fatal("expected error")
- }
-}
-
-func TestClientTruncate(t *testing.T) {
- sftp, cmd := testClient(t, READWRITE, NO_DELAY)
- defer cmd.Wait()
- defer sftp.Close()
-
- f, err := ioutil.TempFile("", "sftptest")
- if err != nil {
- t.Fatal(err)
- }
- fname := f.Name()
-
- if n, err := f.Write([]byte("hello world")); n != 11 || err != nil {
- t.Fatal(err)
- }
- f.Close()
-
- if err := sftp.Truncate(fname, 5); err != nil {
- t.Fatal(err)
- }
- if stat, err := os.Stat(fname); err != nil {
- t.Fatal(err)
- } else if stat.Size() != 5 {
- t.Fatalf("unexpected size: %d", stat.Size())
- }
-}
-
-func TestClientTruncateReadonly(t *testing.T) {
- sftp, cmd := testClient(t, READONLY, NO_DELAY)
- defer cmd.Wait()
- defer sftp.Close()
-
- f, err := ioutil.TempFile("", "sftptest")
- if err != nil {
- t.Fatal(err)
- }
- fname := f.Name()
-
- if n, err := f.Write([]byte("hello world")); n != 11 || err != nil {
- t.Fatal(err)
- }
- f.Close()
-
- if err := sftp.Truncate(fname, 5); err == nil {
- t.Fatal("expected error")
- }
- if stat, err := os.Stat(fname); err != nil {
- t.Fatal(err)
- } else if stat.Size() != 11 {
- t.Fatalf("unexpected size: %d", stat.Size())
- }
-}
-
-func sameFile(want, got os.FileInfo) bool {
- return want.Name() == got.Name() &&
- want.Size() == got.Size()
-}
-
-func TestClientReadSimple(t *testing.T) {
- sftp, cmd := testClient(t, READONLY, NO_DELAY)
- defer cmd.Wait()
- defer sftp.Close()
-
- d, err := ioutil.TempDir("", "sftptest")
- if err != nil {
- t.Fatal(err)
- }
- defer os.RemoveAll(d)
-
- f, err := ioutil.TempFile(d, "read-test")
- if err != nil {
- t.Fatal(err)
- }
- fname := f.Name()
- f.Write([]byte("hello"))
- f.Close()
-
- f2, err := sftp.Open(fname)
- if err != nil {
- t.Fatal(err)
- }
- defer f2.Close()
- stuff := make([]byte, 32)
- n, err := f2.Read(stuff)
- if err != nil && err != io.EOF {
- t.Fatalf("err: %v", err)
- }
- if n != 5 {
- t.Fatalf("n should be 5, is %v", n)
- }
- if string(stuff[0:5]) != "hello" {
- t.Fatalf("invalid contents")
- }
-}
-
-func TestClientReadDir(t *testing.T) {
- sftp1, cmd1 := testClient(t, READONLY, NO_DELAY)
- sftp2, cmd2 := testClientGoSvr(t, READONLY, NO_DELAY)
- defer cmd1.Wait()
- defer cmd2.Wait()
- defer sftp1.Close()
- defer sftp2.Close()
-
- dir := "/dev/"
-
- d, err := os.Open(dir)
- if err != nil {
- t.Fatal(err)
- }
- defer d.Close()
- osfiles, err := d.Readdir(4096)
- if err != nil {
- t.Fatal(err)
- }
-
- sftp1Files, err := sftp1.ReadDir(dir)
- if err != nil {
- t.Fatal(err)
- }
- sftp2Files, err := sftp2.ReadDir(dir)
- if err != nil {
- t.Fatal(err)
- }
-
- osFilesByName := map[string]os.FileInfo{}
- for _, f := range osfiles {
- osFilesByName[f.Name()] = f
- }
- sftp1FilesByName := map[string]os.FileInfo{}
- for _, f := range sftp1Files {
- sftp1FilesByName[f.Name()] = f
- }
- sftp2FilesByName := map[string]os.FileInfo{}
- for _, f := range sftp2Files {
- sftp2FilesByName[f.Name()] = f
- }
-
- if len(osFilesByName) != len(sftp1FilesByName) || len(sftp1FilesByName) != len(sftp2FilesByName) {
- t.Fatalf("os gives %v, sftp1 gives %v, sftp2 gives %v", len(osFilesByName), len(sftp1FilesByName), len(sftp2FilesByName))
- }
-
- for name, osF := range osFilesByName {
- sftp1F, ok := sftp1FilesByName[name]
- if !ok {
- t.Fatalf("%v present in os but not sftp1", name)
- }
- sftp2F, ok := sftp2FilesByName[name]
- if !ok {
- t.Fatalf("%v present in os but not sftp2", name)
- }
-
- //t.Logf("%v: %v %v %v", name, osF, sftp1F, sftp2F)
- if osF.Size() != sftp1F.Size() || sftp1F.Size() != sftp2F.Size() {
- t.Fatalf("size %v %v %v", osF.Size(), sftp1F.Size(), sftp2F.Size())
- }
- if osF.IsDir() != sftp1F.IsDir() || sftp1F.IsDir() != sftp2F.IsDir() {
- t.Fatalf("isdir %v %v %v", osF.IsDir(), sftp1F.IsDir(), sftp2F.IsDir())
- }
- if osF.ModTime().Sub(sftp1F.ModTime()) > time.Second || sftp1F.ModTime() != sftp2F.ModTime() {
- t.Fatalf("modtime %v %v %v", osF.ModTime(), sftp1F.ModTime(), sftp2F.ModTime())
- }
- if osF.Mode() != sftp1F.Mode() || sftp1F.Mode() != sftp2F.Mode() {
- t.Fatalf("mode %x %x %x", osF.Mode(), sftp1F.Mode(), sftp2F.Mode())
- }
- }
-}
-
-var clientReadTests = []struct {
- n int64
-}{
- {0},
- {1},
- {1000},
- {1024},
- {1025},
- {2048},
- {4096},
- {1 << 12},
- {1 << 13},
- {1 << 14},
- {1 << 15},
- {1 << 16},
- {1 << 17},
- {1 << 18},
- {1 << 19},
- {1 << 20},
-}
-
-func TestClientRead(t *testing.T) {
- sftp, cmd := testClient(t, READONLY, NO_DELAY)
- defer cmd.Wait()
- defer sftp.Close()
-
- d, err := ioutil.TempDir("", "sftptest")
- if err != nil {
- t.Fatal(err)
- }
- defer os.RemoveAll(d)
-
- for _, tt := range clientReadTests {
- f, err := ioutil.TempFile(d, "read-test")
- if err != nil {
- t.Fatal(err)
- }
- defer f.Close()
- hash := writeN(t, f, tt.n)
- f2, err := sftp.Open(f.Name())
- if err != nil {
- t.Fatal(err)
- }
- defer f2.Close()
- hash2, n := readHash(t, f2)
- if hash != hash2 || tt.n != n {
- t.Errorf("Read: hash: want: %q, got %q, read: want: %v, got %v", hash, hash2, tt.n, n)
- }
- }
-}
-
-// readHash reads r until EOF returning the number of bytes read
-// and the hash of the contents.
-func readHash(t *testing.T, r io.Reader) (string, int64) {
- h := sha1.New()
- tr := io.TeeReader(r, h)
- read, err := io.Copy(ioutil.Discard, tr)
- if err != nil {
- t.Fatal(err)
- }
- return string(h.Sum(nil)), read
-}
-
-// writeN writes n bytes of random data to w and returns the
-// hash of that data.
-func writeN(t *testing.T, w io.Writer, n int64) string {
- rand, err := os.Open("/dev/urandom")
- if err != nil {
- t.Fatal(err)
- }
- defer rand.Close()
-
- h := sha1.New()
-
- mw := io.MultiWriter(w, h)
-
- written, err := io.CopyN(mw, rand, n)
- if err != nil {
- t.Fatal(err)
- }
- if written != n {
- t.Fatalf("CopyN(%v): wrote: %v", n, written)
- }
- return string(h.Sum(nil))
-}
-
-var clientWriteTests = []struct {
- n int
- total int64 // cumulative file size
-}{
- {0, 0},
- {1, 1},
- {0, 1},
- {999, 1000},
- {24, 1024},
- {1023, 2047},
- {2048, 4095},
- {1 << 12, 8191},
- {1 << 13, 16383},
- {1 << 14, 32767},
- {1 << 15, 65535},
- {1 << 16, 131071},
- {1 << 17, 262143},
- {1 << 18, 524287},
- {1 << 19, 1048575},
- {1 << 20, 2097151},
- {1 << 21, 4194303},
-}
-
-func TestClientWrite(t *testing.T) {
- sftp, cmd := testClient(t, READWRITE, NO_DELAY)
- defer cmd.Wait()
- defer sftp.Close()
-
- d, err := ioutil.TempDir("", "sftptest")
- if err != nil {
- t.Fatal(err)
- }
- defer os.RemoveAll(d)
-
- f := path.Join(d, "writeTest")
- w, err := sftp.Create(f)
- if err != nil {
- t.Fatal(err)
- }
- defer w.Close()
-
- for _, tt := range clientWriteTests {
- got, err := w.Write(make([]byte, tt.n))
- if err != nil {
- t.Fatal(err)
- }
- if got != tt.n {
- t.Errorf("Write(%v): wrote: want: %v, got %v", tt.n, tt.n, got)
- }
- fi, err := os.Stat(f)
- if err != nil {
- t.Fatal(err)
- }
- if total := fi.Size(); total != tt.total {
- t.Errorf("Write(%v): size: want: %v, got %v", tt.n, tt.total, total)
- }
- }
-}
-
-// taken from github.com/kr/fs/walk_test.go
-
-type Node struct {
- name string
- entries []*Node // nil if the entry is a file
- mark int
-}
-
-var tree = &Node{
- "testdata",
- []*Node{
- {"a", nil, 0},
- {"b", []*Node{}, 0},
- {"c", nil, 0},
- {
- "d",
- []*Node{
- {"x", nil, 0},
- {"y", []*Node{}, 0},
- {
- "z",
- []*Node{
- {"u", nil, 0},
- {"v", nil, 0},
- },
- 0,
- },
- },
- 0,
- },
- },
- 0,
-}
-
-func walkTree(n *Node, path string, f func(path string, n *Node)) {
- f(path, n)
- for _, e := range n.entries {
- walkTree(e, filepath.Join(path, e.name), f)
- }
-}
-
-func makeTree(t *testing.T) {
- walkTree(tree, tree.name, func(path string, n *Node) {
- if n.entries == nil {
- fd, err := os.Create(path)
- if err != nil {
- t.Errorf("makeTree: %v", err)
- return
- }
- fd.Close()
- } else {
- os.Mkdir(path, 0770)
- }
- })
-}
-
-func markTree(n *Node) { walkTree(n, "", func(path string, n *Node) { n.mark++ }) }
-
-func checkMarks(t *testing.T, report bool) {
- walkTree(tree, tree.name, func(path string, n *Node) {
- if n.mark != 1 && report {
- t.Errorf("node %s mark = %d; expected 1", path, n.mark)
- }
- n.mark = 0
- })
-}
-
-// Assumes that each node name is unique. Good enough for a test.
-// If clear is true, any incoming error is cleared before return. The errors
-// are always accumulated, though.
-func mark(path string, info os.FileInfo, err error, errors *[]error, clear bool) error {
- if err != nil {
- *errors = append(*errors, err)
- if clear {
- return nil
- }
- return err
- }
- name := info.Name()
- walkTree(tree, tree.name, func(path string, n *Node) {
- if n.name == name {
- n.mark++
- }
- })
- return nil
-}
-
-func TestClientWalk(t *testing.T) {
- sftp, cmd := testClient(t, READONLY, NO_DELAY)
- defer cmd.Wait()
- defer sftp.Close()
-
- makeTree(t)
- errors := make([]error, 0, 10)
- clear := true
- markFn := func(walker *fs.Walker) error {
- for walker.Step() {
- err := mark(walker.Path(), walker.Stat(), walker.Err(), &errors, clear)
- if err != nil {
- return err
- }
- }
- return nil
- }
- // Expect no errors.
- err := markFn(sftp.Walk(tree.name))
- if err != nil {
- t.Fatalf("no error expected, found: %s", err)
- }
- if len(errors) != 0 {
- t.Fatalf("unexpected errors: %s", errors)
- }
- checkMarks(t, true)
- errors = errors[0:0]
-
- // Test permission errors. Only possible if we're not root
- // and only on some file systems (AFS, FAT). To avoid errors during
- // all.bash on those file systems, skip during go test -short.
- if os.Getuid() > 0 && !testing.Short() {
- // introduce 2 errors: chmod top-level directories to 0
- os.Chmod(filepath.Join(tree.name, tree.entries[1].name), 0)
- os.Chmod(filepath.Join(tree.name, tree.entries[3].name), 0)
-
- // 3) capture errors, expect two.
- // mark respective subtrees manually
- markTree(tree.entries[1])
- markTree(tree.entries[3])
- // correct double-marking of directory itself
- tree.entries[1].mark--
- tree.entries[3].mark--
- err := markFn(sftp.Walk(tree.name))
- if err != nil {
- t.Fatalf("expected no error return from Walk, got %s", err)
- }
- if len(errors) != 2 {
- t.Errorf("expected 2 errors, got %d: %s", len(errors), errors)
- }
- // the inaccessible subtrees were marked manually
- checkMarks(t, true)
- errors = errors[0:0]
-
- // 4) capture errors, stop after first error.
- // mark respective subtrees manually
- markTree(tree.entries[1])
- markTree(tree.entries[3])
- // correct double-marking of directory itself
- tree.entries[1].mark--
- tree.entries[3].mark--
- clear = false // error will stop processing
- err = markFn(sftp.Walk(tree.name))
- if err == nil {
- t.Fatalf("expected error return from Walk")
- }
- if len(errors) != 1 {
- t.Errorf("expected 1 error, got %d: %s", len(errors), errors)
- }
- // the inaccessible subtrees were marked manually
- checkMarks(t, false)
- errors = errors[0:0]
-
- // restore permissions
- os.Chmod(filepath.Join(tree.name, tree.entries[1].name), 0770)
- os.Chmod(filepath.Join(tree.name, tree.entries[3].name), 0770)
- }
-
- // cleanup
- if err := os.RemoveAll(tree.name); err != nil {
- t.Errorf("removeTree: %v", err)
- }
-}
-
-// sftp/issue/42, abrupt server hangup would result in client hangs.
-func TestServerRoughDisconnect(t *testing.T) {
- if *testServerImpl {
- t.Skipf("skipping with -testserver")
- }
- sftp, cmd := testClient(t, READONLY, NO_DELAY)
- defer cmd.Wait()
- defer sftp.Close()
-
- f, err := sftp.Open("/dev/zero")
- if err != nil {
- t.Fatal(err)
- }
- defer f.Close()
- go func() {
- time.Sleep(100 * time.Millisecond)
- cmd.Process.Kill()
- }()
-
- io.Copy(ioutil.Discard, f)
-}
-
-// sftp/issue/26 writing to a read only file caused client to loop.
-func TestClientWriteToROFile(t *testing.T) {
- sftp, cmd := testClient(t, READWRITE, NO_DELAY)
- defer cmd.Wait()
- defer sftp.Close()
-
- f, err := sftp.Open("/dev/zero")
- if err != nil {
- t.Fatal(err)
- }
- defer f.Close()
- _, err = f.Write([]byte("hello"))
- if err == nil {
- t.Fatal("expected error, got", err)
- }
-}
-
-func benchmarkRead(b *testing.B, bufsize int, delay time.Duration) {
- size := 10*1024*1024 + 123 // ~10MiB
-
- // open sftp client
- sftp, cmd := testClient(b, READONLY, delay)
- defer cmd.Wait()
- defer sftp.Close()
-
- buf := make([]byte, bufsize)
-
- b.ResetTimer()
- b.SetBytes(int64(size))
-
- for i := 0; i < b.N; i++ {
- offset := 0
-
- f2, err := sftp.Open("/dev/zero")
- if err != nil {
- b.Fatal(err)
- }
- defer f2.Close()
-
- for offset < size {
- n, err := io.ReadFull(f2, buf)
- offset += n
- if err == io.ErrUnexpectedEOF && offset != size {
- b.Fatalf("read too few bytes! want: %d, got: %d", size, n)
- }
-
- if err != nil {
- b.Fatal(err)
- }
-
- offset += n
- }
- }
-}
-
-func BenchmarkRead1k(b *testing.B) {
- benchmarkRead(b, 1*1024, NO_DELAY)
-}
-
-func BenchmarkRead16k(b *testing.B) {
- benchmarkRead(b, 16*1024, NO_DELAY)
-}
-
-func BenchmarkRead32k(b *testing.B) {
- benchmarkRead(b, 32*1024, NO_DELAY)
-}
-
-func BenchmarkRead128k(b *testing.B) {
- benchmarkRead(b, 128*1024, NO_DELAY)
-}
-
-func BenchmarkRead512k(b *testing.B) {
- benchmarkRead(b, 512*1024, NO_DELAY)
-}
-
-func BenchmarkRead1MiB(b *testing.B) {
- benchmarkRead(b, 1024*1024, NO_DELAY)
-}
-
-func BenchmarkRead4MiB(b *testing.B) {
- benchmarkRead(b, 4*1024*1024, NO_DELAY)
-}
-
-func BenchmarkRead4MiBDelay10Msec(b *testing.B) {
- benchmarkRead(b, 4*1024*1024, 10*time.Millisecond)
-}
-
-func BenchmarkRead4MiBDelay50Msec(b *testing.B) {
- benchmarkRead(b, 4*1024*1024, 50*time.Millisecond)
-}
-
-func BenchmarkRead4MiBDelay150Msec(b *testing.B) {
- benchmarkRead(b, 4*1024*1024, 150*time.Millisecond)
-}
-
-func benchmarkWrite(b *testing.B, bufsize int, delay time.Duration) {
- size := 10*1024*1024 + 123 // ~10MiB
-
- // open sftp client
- sftp, cmd := testClient(b, false, delay)
- defer cmd.Wait()
- defer sftp.Close()
-
- data := make([]byte, size)
-
- b.ResetTimer()
- b.SetBytes(int64(size))
-
- for i := 0; i < b.N; i++ {
- offset := 0
-
- f, err := ioutil.TempFile("", "sftptest")
- if err != nil {
- b.Fatal(err)
- }
- defer os.Remove(f.Name())
-
- f2, err := sftp.Create(f.Name())
- if err != nil {
- b.Fatal(err)
- }
- defer f2.Close()
-
- for offset < size {
- n, err := f2.Write(data[offset:min(len(data), offset+bufsize)])
- if err != nil {
- b.Fatal(err)
- }
-
- if offset+n < size && n != bufsize {
- b.Fatalf("wrote too few bytes! want: %d, got: %d", size, n)
- }
-
- offset += n
- }
-
- f2.Close()
-
- fi, err := os.Stat(f.Name())
- if err != nil {
- b.Fatal(err)
- }
-
- if fi.Size() != int64(size) {
- b.Fatalf("wrong file size: want %d, got %d", size, fi.Size())
- }
-
- os.Remove(f.Name())
- }
-}
-
-func BenchmarkWrite1k(b *testing.B) {
- benchmarkWrite(b, 1*1024, NO_DELAY)
-}
-
-func BenchmarkWrite16k(b *testing.B) {
- benchmarkWrite(b, 16*1024, NO_DELAY)
-}
-
-func BenchmarkWrite32k(b *testing.B) {
- benchmarkWrite(b, 32*1024, NO_DELAY)
-}
-
-func BenchmarkWrite128k(b *testing.B) {
- benchmarkWrite(b, 128*1024, NO_DELAY)
-}
-
-func BenchmarkWrite512k(b *testing.B) {
- benchmarkWrite(b, 512*1024, NO_DELAY)
-}
-
-func BenchmarkWrite1MiB(b *testing.B) {
- benchmarkWrite(b, 1024*1024, NO_DELAY)
-}
-
-func BenchmarkWrite4MiB(b *testing.B) {
- benchmarkWrite(b, 4*1024*1024, NO_DELAY)
-}
-
-func BenchmarkWrite4MiBDelay10Msec(b *testing.B) {
- benchmarkWrite(b, 4*1024*1024, 10*time.Millisecond)
-}
-
-func BenchmarkWrite4MiBDelay50Msec(b *testing.B) {
- benchmarkWrite(b, 4*1024*1024, 50*time.Millisecond)
-}
-
-func BenchmarkWrite4MiBDelay150Msec(b *testing.B) {
- benchmarkWrite(b, 4*1024*1024, 150*time.Millisecond)
-}
-
-func benchmarkCopyDown(b *testing.B, fileSize int64, delay time.Duration) {
- // Create a temp file and fill it with zero's.
- src, err := ioutil.TempFile("", "sftptest")
- if err != nil {
- b.Fatal(err)
- }
- defer src.Close()
- srcFilename := src.Name()
- defer os.Remove(srcFilename)
- zero, err := os.Open("/dev/zero")
- if err != nil {
- b.Fatal(err)
- }
- n, err := io.Copy(src, io.LimitReader(zero, fileSize))
- if err != nil {
- b.Fatal(err)
- }
- if n < fileSize {
- b.Fatal("short copy")
- }
- zero.Close()
- src.Close()
-
- sftp, cmd := testClient(b, READONLY, delay)
- defer cmd.Wait()
- defer sftp.Close()
- b.ResetTimer()
- b.SetBytes(fileSize)
-
- for i := 0; i < b.N; i++ {
- dst, err := ioutil.TempFile("", "sftptest")
- if err != nil {
- b.Fatal(err)
- }
- defer os.Remove(dst.Name())
-
- src, err := sftp.Open(srcFilename)
- if err != nil {
- b.Fatal(err)
- }
- defer src.Close()
- n, err := io.Copy(dst, src)
- if err != nil {
- b.Fatalf("copy error: %v", err)
- }
- if n < fileSize {
- b.Fatal("unable to copy all bytes")
- }
- dst.Close()
- fi, err := os.Stat(dst.Name())
- if err != nil {
- b.Fatal(err)
- }
-
- if fi.Size() != fileSize {
- b.Fatalf("wrong file size: want %d, got %d", fileSize, fi.Size())
- }
- os.Remove(dst.Name())
- }
-}
-
-func BenchmarkCopyDown10MiBDelay10Msec(b *testing.B) {
- benchmarkCopyDown(b, 10*1024*1024, 10*time.Millisecond)
-}
-
-func BenchmarkCopyDown10MiBDelay50Msec(b *testing.B) {
- benchmarkCopyDown(b, 10*1024*1024, 50*time.Millisecond)
-}
-
-func BenchmarkCopyDown10MiBDelay150Msec(b *testing.B) {
- benchmarkCopyDown(b, 10*1024*1024, 150*time.Millisecond)
-}
-
-func benchmarkCopyUp(b *testing.B, fileSize int64, delay time.Duration) {
- // Create a temp file and fill it with zero's.
- src, err := ioutil.TempFile("", "sftptest")
- if err != nil {
- b.Fatal(err)
- }
- defer src.Close()
- srcFilename := src.Name()
- defer os.Remove(srcFilename)
- zero, err := os.Open("/dev/zero")
- if err != nil {
- b.Fatal(err)
- }
- n, err := io.Copy(src, io.LimitReader(zero, fileSize))
- if err != nil {
- b.Fatal(err)
- }
- if n < fileSize {
- b.Fatal("short copy")
- }
- zero.Close()
- src.Close()
-
- sftp, cmd := testClient(b, false, delay)
- defer cmd.Wait()
- defer sftp.Close()
-
- b.ResetTimer()
- b.SetBytes(fileSize)
-
- for i := 0; i < b.N; i++ {
- tmp, err := ioutil.TempFile("", "sftptest")
- if err != nil {
- b.Fatal(err)
- }
- tmp.Close()
- defer os.Remove(tmp.Name())
-
- dst, err := sftp.Create(tmp.Name())
- if err != nil {
- b.Fatal(err)
- }
- defer dst.Close()
- src, err := os.Open(srcFilename)
- if err != nil {
- b.Fatal(err)
- }
- defer src.Close()
- n, err := io.Copy(dst, src)
- if err != nil {
- b.Fatalf("copy error: %v", err)
- }
- if n < fileSize {
- b.Fatal("unable to copy all bytes")
- }
-
- fi, err := os.Stat(tmp.Name())
- if err != nil {
- b.Fatal(err)
- }
-
- if fi.Size() != fileSize {
- b.Fatalf("wrong file size: want %d, got %d", fileSize, fi.Size())
- }
- os.Remove(tmp.Name())
- }
-}
-
-func BenchmarkCopyUp10MiBDelay10Msec(b *testing.B) {
- benchmarkCopyUp(b, 10*1024*1024, 10*time.Millisecond)
-}
-
-func BenchmarkCopyUp10MiBDelay50Msec(b *testing.B) {
- benchmarkCopyUp(b, 10*1024*1024, 50*time.Millisecond)
-}
-
-func BenchmarkCopyUp10MiBDelay150Msec(b *testing.B) {
- benchmarkCopyUp(b, 10*1024*1024, 150*time.Millisecond)
-}
diff --git a/vendor/github.com/pkg/sftp/client_test.go b/vendor/github.com/pkg/sftp/client_test.go
deleted file mode 100644
index 597fdb8e..00000000
--- a/vendor/github.com/pkg/sftp/client_test.go
+++ /dev/null
@@ -1,145 +0,0 @@
-package sftp
-
-import (
- "errors"
- "io"
- "os"
- "reflect"
- "testing"
-
- "github.com/kr/fs"
-)
-
-// assert that *Client implements fs.FileSystem
-var _ fs.FileSystem = new(Client)
-
-// assert that *File implements io.ReadWriteCloser
-var _ io.ReadWriteCloser = new(File)
-
-func TestNormaliseError(t *testing.T) {
- var (
- ok = &StatusError{Code: ssh_FX_OK}
- eof = &StatusError{Code: ssh_FX_EOF}
- fail = &StatusError{Code: ssh_FX_FAILURE}
- noSuchFile = &StatusError{Code: ssh_FX_NO_SUCH_FILE}
- foo = errors.New("foo")
- )
-
- var tests = []struct {
- desc string
- err error
- want error
- }{
- {
- desc: "nil error",
- },
- {
- desc: "not *StatusError",
- err: foo,
- want: foo,
- },
- {
- desc: "*StatusError with ssh_FX_EOF",
- err: eof,
- want: io.EOF,
- },
- {
- desc: "*StatusError with ssh_FX_NO_SUCH_FILE",
- err: noSuchFile,
- want: os.ErrNotExist,
- },
- {
- desc: "*StatusError with ssh_FX_OK",
- err: ok,
- },
- {
- desc: "*StatusError with ssh_FX_FAILURE",
- err: fail,
- want: fail,
- },
- }
-
- for _, tt := range tests {
- got := normaliseError(tt.err)
- if got != tt.want {
- t.Errorf("normaliseError(%#v), test %q\n- want: %#v\n- got: %#v",
- tt.err, tt.desc, tt.want, got)
- }
- }
-}
-
-var flagsTests = []struct {
- flags int
- want uint32
-}{
- {os.O_RDONLY, ssh_FXF_READ},
- {os.O_WRONLY, ssh_FXF_WRITE},
- {os.O_RDWR, ssh_FXF_READ | ssh_FXF_WRITE},
- {os.O_RDWR | os.O_CREATE | os.O_TRUNC, ssh_FXF_READ | ssh_FXF_WRITE | ssh_FXF_CREAT | ssh_FXF_TRUNC},
- {os.O_WRONLY | os.O_APPEND, ssh_FXF_WRITE | ssh_FXF_APPEND},
-}
-
-func TestFlags(t *testing.T) {
- for i, tt := range flagsTests {
- got := flags(tt.flags)
- if got != tt.want {
- t.Errorf("test %v: flags(%x): want: %x, got: %x", i, tt.flags, tt.want, got)
- }
- }
-}
-
-func TestUnmarshalStatus(t *testing.T) {
- requestID := uint32(1)
-
- id := marshalUint32([]byte{}, requestID)
- idCode := marshalUint32(id, ssh_FX_FAILURE)
- idCodeMsg := marshalString(idCode, "err msg")
- idCodeMsgLang := marshalString(idCodeMsg, "lang tag")
-
- var tests = []struct {
- desc string
- reqID uint32
- status []byte
- want error
- }{
- {
- desc: "well-formed status",
- reqID: 1,
- status: idCodeMsgLang,
- want: &StatusError{
- Code: ssh_FX_FAILURE,
- msg: "err msg",
- lang: "lang tag",
- },
- },
- {
- desc: "missing error message and language tag",
- reqID: 1,
- status: idCode,
- want: errShortPacket,
- },
- {
- desc: "missing language tag",
- reqID: 1,
- status: idCodeMsg,
- want: &StatusError{
- Code: ssh_FX_FAILURE,
- msg: "err msg",
- },
- },
- {
- desc: "request identifier mismatch",
- reqID: 2,
- status: idCodeMsgLang,
- want: &unexpectedIDErr{2, requestID},
- },
- }
-
- for _, tt := range tests {
- got := unmarshalStatus(tt.reqID, tt.status)
- if !reflect.DeepEqual(got, tt.want) {
- t.Errorf("unmarshalStatus(%v, %v), test %q\n- want: %#v\n- got: %#v",
- requestID, tt.status, tt.desc, tt.want, got)
- }
- }
-}
diff --git a/vendor/github.com/pkg/sftp/conn.go b/vendor/github.com/pkg/sftp/conn.go
deleted file mode 100644
index 9b03d112..00000000
--- a/vendor/github.com/pkg/sftp/conn.go
+++ /dev/null
@@ -1,122 +0,0 @@
-package sftp
-
-import (
- "encoding"
- "io"
- "sync"
-
- "github.com/pkg/errors"
-)
-
-// conn implements a bidirectional channel on which client and server
-// connections are multiplexed.
-type conn struct {
- io.Reader
- io.WriteCloser
- sync.Mutex // used to serialise writes to sendPacket
-}
-
-func (c *conn) recvPacket() (uint8, []byte, error) {
- return recvPacket(c)
-}
-
-func (c *conn) sendPacket(m encoding.BinaryMarshaler) error {
- c.Lock()
- defer c.Unlock()
- return sendPacket(c, m)
-}
-
-type clientConn struct {
- conn
- wg sync.WaitGroup
- sync.Mutex // protects inflight
- inflight map[uint32]chan<- result // outstanding requests
-}
-
-// Close closes the SFTP session.
-func (c *clientConn) Close() error {
- defer c.wg.Wait()
- return c.conn.Close()
-}
-
-func (c *clientConn) loop() {
- defer c.wg.Done()
- err := c.recv()
- if err != nil {
- c.broadcastErr(err)
- }
-}
-
-// recv continuously reads from the server and forwards responses to the
-// appropriate channel.
-func (c *clientConn) recv() error {
- defer c.conn.Close()
- for {
- typ, data, err := c.recvPacket()
- if err != nil {
- return err
- }
- sid, _ := unmarshalUint32(data)
- c.Lock()
- ch, ok := c.inflight[sid]
- delete(c.inflight, sid)
- c.Unlock()
- if !ok {
- // This is an unexpected occurrence. Send the error
- // back to all listeners so that they terminate
- // gracefully.
- return errors.Errorf("sid: %v not fond", sid)
- }
- ch <- result{typ: typ, data: data}
- }
-}
-
-// result captures the result of receiving the a packet from the server
-type result struct {
- typ byte
- data []byte
- err error
-}
-
-type idmarshaler interface {
- id() uint32
- encoding.BinaryMarshaler
-}
-
-func (c *clientConn) sendPacket(p idmarshaler) (byte, []byte, error) {
- ch := make(chan result, 1)
- c.dispatchRequest(ch, p)
- s := <-ch
- return s.typ, s.data, s.err
-}
-
-func (c *clientConn) dispatchRequest(ch chan<- result, p idmarshaler) {
- c.Lock()
- c.inflight[p.id()] = ch
- if err := c.conn.sendPacket(p); err != nil {
- delete(c.inflight, p.id())
- ch <- result{err: err}
- }
- c.Unlock()
-}
-
-// broadcastErr sends an error to all goroutines waiting for a response.
-func (c *clientConn) broadcastErr(err error) {
- c.Lock()
- listeners := make([]chan<- result, 0, len(c.inflight))
- for _, ch := range c.inflight {
- listeners = append(listeners, ch)
- }
- c.Unlock()
- for _, ch := range listeners {
- ch <- result{err: err}
- }
-}
-
-type serverConn struct {
- conn
-}
-
-func (s *serverConn) sendError(p id, err error) error {
- return s.sendPacket(statusFromError(p, err))
-}
diff --git a/vendor/github.com/pkg/sftp/debug.go b/vendor/github.com/pkg/sftp/debug.go
deleted file mode 100644
index 3e264abe..00000000
--- a/vendor/github.com/pkg/sftp/debug.go
+++ /dev/null
@@ -1,9 +0,0 @@
-// +build debug
-
-package sftp
-
-import "log"
-
-func debug(fmt string, args ...interface{}) {
- log.Printf(fmt, args...)
-}
diff --git a/vendor/github.com/pkg/sftp/example_test.go b/vendor/github.com/pkg/sftp/example_test.go
deleted file mode 100644
index 11dc1e12..00000000
--- a/vendor/github.com/pkg/sftp/example_test.go
+++ /dev/null
@@ -1,90 +0,0 @@
-package sftp_test
-
-import (
- "fmt"
- "log"
- "os"
- "os/exec"
-
- "github.com/pkg/sftp"
- "golang.org/x/crypto/ssh"
-)
-
-func Example(conn *ssh.Client) {
- // open an SFTP session over an existing ssh connection.
- sftp, err := sftp.NewClient(conn)
- if err != nil {
- log.Fatal(err)
- }
- defer sftp.Close()
-
- // walk a directory
- w := sftp.Walk("/home/user")
- for w.Step() {
- if w.Err() != nil {
- continue
- }
- log.Println(w.Path())
- }
-
- // leave your mark
- f, err := sftp.Create("hello.txt")
- if err != nil {
- log.Fatal(err)
- }
- if _, err := f.Write([]byte("Hello world!")); err != nil {
- log.Fatal(err)
- }
-
- // check it's there
- fi, err := sftp.Lstat("hello.txt")
- if err != nil {
- log.Fatal(err)
- }
- log.Println(fi)
-}
-
-func ExampleNewClientPipe() {
- // Connect to a remote host and request the sftp subsystem via the 'ssh'
- // command. This assumes that passwordless login is correctly configured.
- cmd := exec.Command("ssh", "example.com", "-s", "sftp")
-
- // send errors from ssh to stderr
- cmd.Stderr = os.Stderr
-
- // get stdin and stdout
- wr, err := cmd.StdinPipe()
- if err != nil {
- log.Fatal(err)
- }
- rd, err := cmd.StdoutPipe()
- if err != nil {
- log.Fatal(err)
- }
-
- // start the process
- if err := cmd.Start(); err != nil {
- log.Fatal(err)
- }
- defer cmd.Wait()
-
- // open the SFTP session
- client, err := sftp.NewClientPipe(rd, wr)
- if err != nil {
- log.Fatal(err)
- }
-
- // read a directory
- list, err := client.ReadDir("/")
- if err != nil {
- log.Fatal(err)
- }
-
- // print contents
- for _, item := range list {
- fmt.Println(item.Name())
- }
-
- // close the connection
- client.Close()
-}
diff --git a/vendor/github.com/pkg/sftp/other_test.go b/vendor/github.com/pkg/sftp/other_test.go
deleted file mode 100644
index 1b84ccfa..00000000
--- a/vendor/github.com/pkg/sftp/other_test.go
+++ /dev/null
@@ -1,5 +0,0 @@
-// +build !linux,!darwin
-
-package sftp
-
-const sftpServer = "/usr/bin/false" // unsupported
diff --git a/vendor/github.com/pkg/sftp/packet.go b/vendor/github.com/pkg/sftp/packet.go
deleted file mode 100644
index fba41599..00000000
--- a/vendor/github.com/pkg/sftp/packet.go
+++ /dev/null
@@ -1,901 +0,0 @@
-package sftp
-
-import (
- "bytes"
- "encoding"
- "encoding/binary"
- "fmt"
- "io"
- "os"
- "reflect"
-
- "github.com/pkg/errors"
-)
-
-var (
- errShortPacket = errors.New("packet too short")
- errUnknownExtendedPacket = errors.New("unknown extended packet")
-)
-
-const (
- debugDumpTxPacket = false
- debugDumpRxPacket = false
- debugDumpTxPacketBytes = false
- debugDumpRxPacketBytes = false
-)
-
-func marshalUint32(b []byte, v uint32) []byte {
- return append(b, byte(v>>24), byte(v>>16), byte(v>>8), byte(v))
-}
-
-func marshalUint64(b []byte, v uint64) []byte {
- return marshalUint32(marshalUint32(b, uint32(v>>32)), uint32(v))
-}
-
-func marshalString(b []byte, v string) []byte {
- return append(marshalUint32(b, uint32(len(v))), v...)
-}
-
-func marshal(b []byte, v interface{}) []byte {
- if v == nil {
- return b
- }
- switch v := v.(type) {
- case uint8:
- return append(b, v)
- case uint32:
- return marshalUint32(b, v)
- case uint64:
- return marshalUint64(b, v)
- case string:
- return marshalString(b, v)
- case os.FileInfo:
- return marshalFileInfo(b, v)
- default:
- switch d := reflect.ValueOf(v); d.Kind() {
- case reflect.Struct:
- for i, n := 0, d.NumField(); i < n; i++ {
- b = append(marshal(b, d.Field(i).Interface()))
- }
- return b
- case reflect.Slice:
- for i, n := 0, d.Len(); i < n; i++ {
- b = append(marshal(b, d.Index(i).Interface()))
- }
- return b
- default:
- panic(fmt.Sprintf("marshal(%#v): cannot handle type %T", v, v))
- }
- }
-}
-
-func unmarshalUint32(b []byte) (uint32, []byte) {
- v := uint32(b[3]) | uint32(b[2])<<8 | uint32(b[1])<<16 | uint32(b[0])<<24
- return v, b[4:]
-}
-
-func unmarshalUint32Safe(b []byte) (uint32, []byte, error) {
- var v uint32
- if len(b) < 4 {
- return 0, nil, errShortPacket
- }
- v, b = unmarshalUint32(b)
- return v, b, nil
-}
-
-func unmarshalUint64(b []byte) (uint64, []byte) {
- h, b := unmarshalUint32(b)
- l, b := unmarshalUint32(b)
- return uint64(h)<<32 | uint64(l), b
-}
-
-func unmarshalUint64Safe(b []byte) (uint64, []byte, error) {
- var v uint64
- if len(b) < 8 {
- return 0, nil, errShortPacket
- }
- v, b = unmarshalUint64(b)
- return v, b, nil
-}
-
-func unmarshalString(b []byte) (string, []byte) {
- n, b := unmarshalUint32(b)
- return string(b[:n]), b[n:]
-}
-
-func unmarshalStringSafe(b []byte) (string, []byte, error) {
- n, b, err := unmarshalUint32Safe(b)
- if err != nil {
- return "", nil, err
- }
- if int64(n) > int64(len(b)) {
- return "", nil, errShortPacket
- }
- return string(b[:n]), b[n:], nil
-}
-
-// sendPacket marshals p according to RFC 4234.
-func sendPacket(w io.Writer, m encoding.BinaryMarshaler) error {
- bb, err := m.MarshalBinary()
- if err != nil {
- return errors.Errorf("binary marshaller failed: %v", err)
- }
- if debugDumpTxPacketBytes {
- debug("send packet: %s %d bytes %x", fxp(bb[0]), len(bb), bb[1:])
- } else if debugDumpTxPacket {
- debug("send packet: %s %d bytes", fxp(bb[0]), len(bb))
- }
- l := uint32(len(bb))
- hdr := []byte{byte(l >> 24), byte(l >> 16), byte(l >> 8), byte(l)}
- _, err = w.Write(hdr)
- if err != nil {
- return errors.Errorf("failed to send packet header: %v", err)
- }
- _, err = w.Write(bb)
- if err != nil {
- return errors.Errorf("failed to send packet body: %v", err)
- }
- return nil
-}
-
-func recvPacket(r io.Reader) (uint8, []byte, error) {
- var b = []byte{0, 0, 0, 0}
- if _, err := io.ReadFull(r, b); err != nil {
- return 0, nil, err
- }
- l, _ := unmarshalUint32(b)
- b = make([]byte, l)
- if _, err := io.ReadFull(r, b); err != nil {
- debug("recv packet %d bytes: err %v", l, err)
- return 0, nil, err
- }
- if debugDumpRxPacketBytes {
- debug("recv packet: %s %d bytes %x", fxp(b[0]), l, b[1:])
- } else if debugDumpRxPacket {
- debug("recv packet: %s %d bytes", fxp(b[0]), l)
- }
- return b[0], b[1:], nil
-}
-
-type extensionPair struct {
- Name string
- Data string
-}
-
-func unmarshalExtensionPair(b []byte) (extensionPair, []byte, error) {
- var ep extensionPair
- var err error
- ep.Name, b, err = unmarshalStringSafe(b)
- if err != nil {
- return ep, b, err
- }
- ep.Data, b, err = unmarshalStringSafe(b)
- if err != nil {
- return ep, b, err
- }
- return ep, b, err
-}
-
-// Here starts the definition of packets along with their MarshalBinary
-// implementations.
-// Manually writing the marshalling logic wins us a lot of time and
-// allocation.
-
-type sshFxInitPacket struct {
- Version uint32
- Extensions []extensionPair
-}
-
-func (p sshFxInitPacket) MarshalBinary() ([]byte, error) {
- l := 1 + 4 // byte + uint32
- for _, e := range p.Extensions {
- l += 4 + len(e.Name) + 4 + len(e.Data)
- }
-
- b := make([]byte, 0, l)
- b = append(b, ssh_FXP_INIT)
- b = marshalUint32(b, p.Version)
- for _, e := range p.Extensions {
- b = marshalString(b, e.Name)
- b = marshalString(b, e.Data)
- }
- return b, nil
-}
-
-func (p *sshFxInitPacket) UnmarshalBinary(b []byte) error {
- var err error
- if p.Version, b, err = unmarshalUint32Safe(b); err != nil {
- return err
- }
- for len(b) > 0 {
- var ep extensionPair
- ep, b, err = unmarshalExtensionPair(b)
- if err != nil {
- return err
- }
- p.Extensions = append(p.Extensions, ep)
- }
- return nil
-}
-
-type sshFxVersionPacket struct {
- Version uint32
- Extensions []struct {
- Name, Data string
- }
-}
-
-func (p sshFxVersionPacket) MarshalBinary() ([]byte, error) {
- l := 1 + 4 // byte + uint32
- for _, e := range p.Extensions {
- l += 4 + len(e.Name) + 4 + len(e.Data)
- }
-
- b := make([]byte, 0, l)
- b = append(b, ssh_FXP_VERSION)
- b = marshalUint32(b, p.Version)
- for _, e := range p.Extensions {
- b = marshalString(b, e.Name)
- b = marshalString(b, e.Data)
- }
- return b, nil
-}
-
-func marshalIDString(packetType byte, id uint32, str string) ([]byte, error) {
- l := 1 + 4 + // type(byte) + uint32
- 4 + len(str)
-
- b := make([]byte, 0, l)
- b = append(b, packetType)
- b = marshalUint32(b, id)
- b = marshalString(b, str)
- return b, nil
-}
-
-func unmarshalIDString(b []byte, id *uint32, str *string) error {
- var err error
- *id, b, err = unmarshalUint32Safe(b)
- if err != nil {
- return err
- }
- *str, b, err = unmarshalStringSafe(b)
- return err
-}
-
-type sshFxpReaddirPacket struct {
- ID uint32
- Handle string
-}
-
-func (p sshFxpReaddirPacket) id() uint32 { return p.ID }
-
-func (p sshFxpReaddirPacket) MarshalBinary() ([]byte, error) {
- return marshalIDString(ssh_FXP_READDIR, p.ID, p.Handle)
-}
-
-func (p *sshFxpReaddirPacket) UnmarshalBinary(b []byte) error {
- return unmarshalIDString(b, &p.ID, &p.Handle)
-}
-
-type sshFxpOpendirPacket struct {
- ID uint32
- Path string
-}
-
-func (p sshFxpOpendirPacket) id() uint32 { return p.ID }
-
-func (p sshFxpOpendirPacket) MarshalBinary() ([]byte, error) {
- return marshalIDString(ssh_FXP_OPENDIR, p.ID, p.Path)
-}
-
-func (p *sshFxpOpendirPacket) UnmarshalBinary(b []byte) error {
- return unmarshalIDString(b, &p.ID, &p.Path)
-}
-
-type sshFxpLstatPacket struct {
- ID uint32
- Path string
-}
-
-func (p sshFxpLstatPacket) id() uint32 { return p.ID }
-
-func (p sshFxpLstatPacket) MarshalBinary() ([]byte, error) {
- return marshalIDString(ssh_FXP_LSTAT, p.ID, p.Path)
-}
-
-func (p *sshFxpLstatPacket) UnmarshalBinary(b []byte) error {
- return unmarshalIDString(b, &p.ID, &p.Path)
-}
-
-type sshFxpStatPacket struct {
- ID uint32
- Path string
-}
-
-func (p sshFxpStatPacket) id() uint32 { return p.ID }
-
-func (p sshFxpStatPacket) MarshalBinary() ([]byte, error) {
- return marshalIDString(ssh_FXP_STAT, p.ID, p.Path)
-}
-
-func (p *sshFxpStatPacket) UnmarshalBinary(b []byte) error {
- return unmarshalIDString(b, &p.ID, &p.Path)
-}
-
-type sshFxpFstatPacket struct {
- ID uint32
- Handle string
-}
-
-func (p sshFxpFstatPacket) id() uint32 { return p.ID }
-
-func (p sshFxpFstatPacket) MarshalBinary() ([]byte, error) {
- return marshalIDString(ssh_FXP_FSTAT, p.ID, p.Handle)
-}
-
-func (p *sshFxpFstatPacket) UnmarshalBinary(b []byte) error {
- return unmarshalIDString(b, &p.ID, &p.Handle)
-}
-
-type sshFxpClosePacket struct {
- ID uint32
- Handle string
-}
-
-func (p sshFxpClosePacket) id() uint32 { return p.ID }
-
-func (p sshFxpClosePacket) MarshalBinary() ([]byte, error) {
- return marshalIDString(ssh_FXP_CLOSE, p.ID, p.Handle)
-}
-
-func (p *sshFxpClosePacket) UnmarshalBinary(b []byte) error {
- return unmarshalIDString(b, &p.ID, &p.Handle)
-}
-
-type sshFxpRemovePacket struct {
- ID uint32
- Filename string
-}
-
-func (p sshFxpRemovePacket) id() uint32 { return p.ID }
-
-func (p sshFxpRemovePacket) MarshalBinary() ([]byte, error) {
- return marshalIDString(ssh_FXP_REMOVE, p.ID, p.Filename)
-}
-
-func (p *sshFxpRemovePacket) UnmarshalBinary(b []byte) error {
- return unmarshalIDString(b, &p.ID, &p.Filename)
-}
-
-type sshFxpRmdirPacket struct {
- ID uint32
- Path string
-}
-
-func (p sshFxpRmdirPacket) id() uint32 { return p.ID }
-
-func (p sshFxpRmdirPacket) MarshalBinary() ([]byte, error) {
- return marshalIDString(ssh_FXP_RMDIR, p.ID, p.Path)
-}
-
-func (p *sshFxpRmdirPacket) UnmarshalBinary(b []byte) error {
- return unmarshalIDString(b, &p.ID, &p.Path)
-}
-
-type sshFxpSymlinkPacket struct {
- ID uint32
- Targetpath string
- Linkpath string
-}
-
-func (p sshFxpSymlinkPacket) id() uint32 { return p.ID }
-
-func (p sshFxpSymlinkPacket) MarshalBinary() ([]byte, error) {
- l := 1 + 4 + // type(byte) + uint32
- 4 + len(p.Targetpath) +
- 4 + len(p.Linkpath)
-
- b := make([]byte, 0, l)
- b = append(b, ssh_FXP_SYMLINK)
- b = marshalUint32(b, p.ID)
- b = marshalString(b, p.Targetpath)
- b = marshalString(b, p.Linkpath)
- return b, nil
-}
-
-func (p *sshFxpSymlinkPacket) UnmarshalBinary(b []byte) error {
- var err error
- if p.ID, b, err = unmarshalUint32Safe(b); err != nil {
- return err
- } else if p.Targetpath, b, err = unmarshalStringSafe(b); err != nil {
- return err
- } else if p.Linkpath, b, err = unmarshalStringSafe(b); err != nil {
- return err
- }
- return nil
-}
-
-type sshFxpReadlinkPacket struct {
- ID uint32
- Path string
-}
-
-func (p sshFxpReadlinkPacket) id() uint32 { return p.ID }
-
-func (p sshFxpReadlinkPacket) MarshalBinary() ([]byte, error) {
- return marshalIDString(ssh_FXP_READLINK, p.ID, p.Path)
-}
-
-func (p *sshFxpReadlinkPacket) UnmarshalBinary(b []byte) error {
- return unmarshalIDString(b, &p.ID, &p.Path)
-}
-
-type sshFxpRealpathPacket struct {
- ID uint32
- Path string
-}
-
-func (p sshFxpRealpathPacket) id() uint32 { return p.ID }
-
-func (p sshFxpRealpathPacket) MarshalBinary() ([]byte, error) {
- return marshalIDString(ssh_FXP_REALPATH, p.ID, p.Path)
-}
-
-func (p *sshFxpRealpathPacket) UnmarshalBinary(b []byte) error {
- return unmarshalIDString(b, &p.ID, &p.Path)
-}
-
-type sshFxpNameAttr struct {
- Name string
- LongName string
- Attrs []interface{}
-}
-
-func (p sshFxpNameAttr) MarshalBinary() ([]byte, error) {
- b := []byte{}
- b = marshalString(b, p.Name)
- b = marshalString(b, p.LongName)
- for _, attr := range p.Attrs {
- b = marshal(b, attr)
- }
- return b, nil
-}
-
-type sshFxpNamePacket struct {
- ID uint32
- NameAttrs []sshFxpNameAttr
-}
-
-func (p sshFxpNamePacket) MarshalBinary() ([]byte, error) {
- b := []byte{}
- b = append(b, ssh_FXP_NAME)
- b = marshalUint32(b, p.ID)
- b = marshalUint32(b, uint32(len(p.NameAttrs)))
- for _, na := range p.NameAttrs {
- ab, err := na.MarshalBinary()
- if err != nil {
- return nil, err
- }
-
- b = append(b, ab...)
- }
- return b, nil
-}
-
-type sshFxpOpenPacket struct {
- ID uint32
- Path string
- Pflags uint32
- Flags uint32 // ignored
-}
-
-func (p sshFxpOpenPacket) id() uint32 { return p.ID }
-
-func (p sshFxpOpenPacket) MarshalBinary() ([]byte, error) {
- l := 1 + 4 +
- 4 + len(p.Path) +
- 4 + 4
-
- b := make([]byte, 0, l)
- b = append(b, ssh_FXP_OPEN)
- b = marshalUint32(b, p.ID)
- b = marshalString(b, p.Path)
- b = marshalUint32(b, p.Pflags)
- b = marshalUint32(b, p.Flags)
- return b, nil
-}
-
-func (p *sshFxpOpenPacket) UnmarshalBinary(b []byte) error {
- var err error
- if p.ID, b, err = unmarshalUint32Safe(b); err != nil {
- return err
- } else if p.Path, b, err = unmarshalStringSafe(b); err != nil {
- return err
- } else if p.Pflags, b, err = unmarshalUint32Safe(b); err != nil {
- return err
- } else if p.Flags, b, err = unmarshalUint32Safe(b); err != nil {
- return err
- }
- return nil
-}
-
-type sshFxpReadPacket struct {
- ID uint32
- Handle string
- Offset uint64
- Len uint32
-}
-
-func (p sshFxpReadPacket) id() uint32 { return p.ID }
-
-func (p sshFxpReadPacket) MarshalBinary() ([]byte, error) {
- l := 1 + 4 + // type(byte) + uint32
- 4 + len(p.Handle) +
- 8 + 4 // uint64 + uint32
-
- b := make([]byte, 0, l)
- b = append(b, ssh_FXP_READ)
- b = marshalUint32(b, p.ID)
- b = marshalString(b, p.Handle)
- b = marshalUint64(b, p.Offset)
- b = marshalUint32(b, p.Len)
- return b, nil
-}
-
-func (p *sshFxpReadPacket) UnmarshalBinary(b []byte) error {
- var err error
- if p.ID, b, err = unmarshalUint32Safe(b); err != nil {
- return err
- } else if p.Handle, b, err = unmarshalStringSafe(b); err != nil {
- return err
- } else if p.Offset, b, err = unmarshalUint64Safe(b); err != nil {
- return err
- } else if p.Len, b, err = unmarshalUint32Safe(b); err != nil {
- return err
- }
- return nil
-}
-
-type sshFxpRenamePacket struct {
- ID uint32
- Oldpath string
- Newpath string
-}
-
-func (p sshFxpRenamePacket) id() uint32 { return p.ID }
-
-func (p sshFxpRenamePacket) MarshalBinary() ([]byte, error) {
- l := 1 + 4 + // type(byte) + uint32
- 4 + len(p.Oldpath) +
- 4 + len(p.Newpath)
-
- b := make([]byte, 0, l)
- b = append(b, ssh_FXP_RENAME)
- b = marshalUint32(b, p.ID)
- b = marshalString(b, p.Oldpath)
- b = marshalString(b, p.Newpath)
- return b, nil
-}
-
-func (p *sshFxpRenamePacket) UnmarshalBinary(b []byte) error {
- var err error
- if p.ID, b, err = unmarshalUint32Safe(b); err != nil {
- return err
- } else if p.Oldpath, b, err = unmarshalStringSafe(b); err != nil {
- return err
- } else if p.Newpath, b, err = unmarshalStringSafe(b); err != nil {
- return err
- }
- return nil
-}
-
-type sshFxpWritePacket struct {
- ID uint32
- Handle string
- Offset uint64
- Length uint32
- Data []byte
-}
-
-func (p sshFxpWritePacket) id() uint32 { return p.ID }
-
-func (p sshFxpWritePacket) MarshalBinary() ([]byte, error) {
- l := 1 + 4 + // type(byte) + uint32
- 4 + len(p.Handle) +
- 8 + 4 + // uint64 + uint32
- len(p.Data)
-
- b := make([]byte, 0, l)
- b = append(b, ssh_FXP_WRITE)
- b = marshalUint32(b, p.ID)
- b = marshalString(b, p.Handle)
- b = marshalUint64(b, p.Offset)
- b = marshalUint32(b, p.Length)
- b = append(b, p.Data...)
- return b, nil
-}
-
-func (p *sshFxpWritePacket) UnmarshalBinary(b []byte) error {
- var err error
- if p.ID, b, err = unmarshalUint32Safe(b); err != nil {
- return err
- } else if p.Handle, b, err = unmarshalStringSafe(b); err != nil {
- return err
- } else if p.Offset, b, err = unmarshalUint64Safe(b); err != nil {
- return err
- } else if p.Length, b, err = unmarshalUint32Safe(b); err != nil {
- return err
- } else if uint32(len(b)) < p.Length {
- return errShortPacket
- }
-
- p.Data = append([]byte{}, b[:p.Length]...)
- return nil
-}
-
-type sshFxpMkdirPacket struct {
- ID uint32
- Path string
- Flags uint32 // ignored
-}
-
-func (p sshFxpMkdirPacket) id() uint32 { return p.ID }
-
-func (p sshFxpMkdirPacket) MarshalBinary() ([]byte, error) {
- l := 1 + 4 + // type(byte) + uint32
- 4 + len(p.Path) +
- 4 // uint32
-
- b := make([]byte, 0, l)
- b = append(b, ssh_FXP_MKDIR)
- b = marshalUint32(b, p.ID)
- b = marshalString(b, p.Path)
- b = marshalUint32(b, p.Flags)
- return b, nil
-}
-
-func (p *sshFxpMkdirPacket) UnmarshalBinary(b []byte) error {
- var err error
- if p.ID, b, err = unmarshalUint32Safe(b); err != nil {
- return err
- } else if p.Path, b, err = unmarshalStringSafe(b); err != nil {
- return err
- } else if p.Flags, b, err = unmarshalUint32Safe(b); err != nil {
- return err
- }
- return nil
-}
-
-type sshFxpSetstatPacket struct {
- ID uint32
- Path string
- Flags uint32
- Attrs interface{}
-}
-
-type sshFxpFsetstatPacket struct {
- ID uint32
- Handle string
- Flags uint32
- Attrs interface{}
-}
-
-func (p sshFxpSetstatPacket) id() uint32 { return p.ID }
-func (p sshFxpFsetstatPacket) id() uint32 { return p.ID }
-
-func (p sshFxpSetstatPacket) MarshalBinary() ([]byte, error) {
- l := 1 + 4 + // type(byte) + uint32
- 4 + len(p.Path) +
- 4 // uint32 + uint64
-
- b := make([]byte, 0, l)
- b = append(b, ssh_FXP_SETSTAT)
- b = marshalUint32(b, p.ID)
- b = marshalString(b, p.Path)
- b = marshalUint32(b, p.Flags)
- b = marshal(b, p.Attrs)
- return b, nil
-}
-
-func (p sshFxpFsetstatPacket) MarshalBinary() ([]byte, error) {
- l := 1 + 4 + // type(byte) + uint32
- 4 + len(p.Handle) +
- 4 // uint32 + uint64
-
- b := make([]byte, 0, l)
- b = append(b, ssh_FXP_FSETSTAT)
- b = marshalUint32(b, p.ID)
- b = marshalString(b, p.Handle)
- b = marshalUint32(b, p.Flags)
- b = marshal(b, p.Attrs)
- return b, nil
-}
-
-func (p *sshFxpSetstatPacket) UnmarshalBinary(b []byte) error {
- var err error
- if p.ID, b, err = unmarshalUint32Safe(b); err != nil {
- return err
- } else if p.Path, b, err = unmarshalStringSafe(b); err != nil {
- return err
- } else if p.Flags, b, err = unmarshalUint32Safe(b); err != nil {
- return err
- }
- p.Attrs = b
- return nil
-}
-
-func (p *sshFxpFsetstatPacket) UnmarshalBinary(b []byte) error {
- var err error
- if p.ID, b, err = unmarshalUint32Safe(b); err != nil {
- return err
- } else if p.Handle, b, err = unmarshalStringSafe(b); err != nil {
- return err
- } else if p.Flags, b, err = unmarshalUint32Safe(b); err != nil {
- return err
- }
- p.Attrs = b
- return nil
-}
-
-type sshFxpHandlePacket struct {
- ID uint32
- Handle string
-}
-
-func (p sshFxpHandlePacket) MarshalBinary() ([]byte, error) {
- b := []byte{ssh_FXP_HANDLE}
- b = marshalUint32(b, p.ID)
- b = marshalString(b, p.Handle)
- return b, nil
-}
-
-type sshFxpStatusPacket struct {
- ID uint32
- StatusError
-}
-
-func (p sshFxpStatusPacket) MarshalBinary() ([]byte, error) {
- b := []byte{ssh_FXP_STATUS}
- b = marshalUint32(b, p.ID)
- b = marshalStatus(b, p.StatusError)
- return b, nil
-}
-
-type sshFxpDataPacket struct {
- ID uint32
- Length uint32
- Data []byte
-}
-
-func (p sshFxpDataPacket) MarshalBinary() ([]byte, error) {
- b := []byte{ssh_FXP_DATA}
- b = marshalUint32(b, p.ID)
- b = marshalUint32(b, p.Length)
- b = append(b, p.Data[:p.Length]...)
- return b, nil
-}
-
-func (p *sshFxpDataPacket) UnmarshalBinary(b []byte) error {
- var err error
- if p.ID, b, err = unmarshalUint32Safe(b); err != nil {
- return err
- } else if p.Length, b, err = unmarshalUint32Safe(b); err != nil {
- return err
- } else if uint32(len(b)) < p.Length {
- return errors.New("truncated packet")
- }
-
- p.Data = make([]byte, p.Length)
- copy(p.Data, b)
- return nil
-}
-
-type sshFxpStatvfsPacket struct {
- ID uint32
- Path string
-}
-
-func (p sshFxpStatvfsPacket) id() uint32 { return p.ID }
-
-func (p sshFxpStatvfsPacket) MarshalBinary() ([]byte, error) {
- l := 1 + 4 + // type(byte) + uint32
- len(p.Path) +
- len("statvfs@openssh.com")
-
- b := make([]byte, 0, l)
- b = append(b, ssh_FXP_EXTENDED)
- b = marshalUint32(b, p.ID)
- b = marshalString(b, "statvfs@openssh.com")
- b = marshalString(b, p.Path)
- return b, nil
-}
-
-// A StatVFS contains statistics about a filesystem.
-type StatVFS struct {
- ID uint32
- Bsize uint64 /* file system block size */
- Frsize uint64 /* fundamental fs block size */
- Blocks uint64 /* number of blocks (unit f_frsize) */
- Bfree uint64 /* free blocks in file system */
- Bavail uint64 /* free blocks for non-root */
- Files uint64 /* total file inodes */
- Ffree uint64 /* free file inodes */
- Favail uint64 /* free file inodes for to non-root */
- Fsid uint64 /* file system id */
- Flag uint64 /* bit mask of f_flag values */
- Namemax uint64 /* maximum filename length */
-}
-
-// TotalSpace calculates the amount of total space in a filesystem.
-func (p *StatVFS) TotalSpace() uint64 {
- return p.Frsize * p.Blocks
-}
-
-// FreeSpace calculates the amount of free space in a filesystem.
-func (p *StatVFS) FreeSpace() uint64 {
- return p.Frsize * p.Bfree
-}
-
-// Convert to ssh_FXP_EXTENDED_REPLY packet binary format
-func (p *StatVFS) MarshalBinary() ([]byte, error) {
- var buf bytes.Buffer
- buf.Write([]byte{ssh_FXP_EXTENDED_REPLY})
- err := binary.Write(&buf, binary.BigEndian, p)
- return buf.Bytes(), err
-}
-
-type sshFxpExtendedPacket struct {
- ID uint32
- ExtendedRequest string
- SpecificPacket interface {
- serverRespondablePacket
- readonly() bool
- }
-}
-
-func (p sshFxpExtendedPacket) id() uint32 { return p.ID }
-func (p sshFxpExtendedPacket) readonly() bool { return p.SpecificPacket.readonly() }
-
-func (p sshFxpExtendedPacket) respond(svr *Server) error {
- return p.SpecificPacket.respond(svr)
-}
-
-func (p *sshFxpExtendedPacket) UnmarshalBinary(b []byte) error {
- var err error
- bOrig := b
- if p.ID, b, err = unmarshalUint32Safe(b); err != nil {
- return err
- } else if p.ExtendedRequest, b, err = unmarshalStringSafe(b); err != nil {
- return err
- }
-
- // specific unmarshalling
- switch p.ExtendedRequest {
- case "statvfs@openssh.com":
- p.SpecificPacket = &sshFxpExtendedPacketStatVFS{}
- default:
- return errUnknownExtendedPacket
- }
-
- return p.SpecificPacket.UnmarshalBinary(bOrig)
-}
-
-type sshFxpExtendedPacketStatVFS struct {
- ID uint32
- ExtendedRequest string
- Path string
-}
-
-func (p sshFxpExtendedPacketStatVFS) id() uint32 { return p.ID }
-func (p sshFxpExtendedPacketStatVFS) readonly() bool { return true }
-func (p *sshFxpExtendedPacketStatVFS) UnmarshalBinary(b []byte) error {
- var err error
- if p.ID, b, err = unmarshalUint32Safe(b); err != nil {
- return err
- } else if p.ExtendedRequest, b, err = unmarshalStringSafe(b); err != nil {
- return err
- } else if p.Path, b, err = unmarshalStringSafe(b); err != nil {
- return err
- }
- return nil
-}
diff --git a/vendor/github.com/pkg/sftp/packet_test.go b/vendor/github.com/pkg/sftp/packet_test.go
deleted file mode 100644
index 2a948dbd..00000000
--- a/vendor/github.com/pkg/sftp/packet_test.go
+++ /dev/null
@@ -1,345 +0,0 @@
-package sftp
-
-import (
- "bytes"
- "encoding"
- "os"
- "testing"
-)
-
-var marshalUint32Tests = []struct {
- v uint32
- want []byte
-}{
- {1, []byte{0, 0, 0, 1}},
- {256, []byte{0, 0, 1, 0}},
- {^uint32(0), []byte{255, 255, 255, 255}},
-}
-
-func TestMarshalUint32(t *testing.T) {
- for _, tt := range marshalUint32Tests {
- got := marshalUint32(nil, tt.v)
- if !bytes.Equal(tt.want, got) {
- t.Errorf("marshalUint32(%d): want %v, got %v", tt.v, tt.want, got)
- }
- }
-}
-
-var marshalUint64Tests = []struct {
- v uint64
- want []byte
-}{
- {1, []byte{0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x1}},
- {256, []byte{0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x1, 0x0}},
- {^uint64(0), []byte{0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff}},
- {1 << 32, []byte{0x0, 0x0, 0x0, 0x1, 0x0, 0x0, 0x0, 0x0}},
-}
-
-func TestMarshalUint64(t *testing.T) {
- for _, tt := range marshalUint64Tests {
- got := marshalUint64(nil, tt.v)
- if !bytes.Equal(tt.want, got) {
- t.Errorf("marshalUint64(%d): want %#v, got %#v", tt.v, tt.want, got)
- }
- }
-}
-
-var marshalStringTests = []struct {
- v string
- want []byte
-}{
- {"", []byte{0, 0, 0, 0}},
- {"/foo", []byte{0x0, 0x0, 0x0, 0x4, 0x2f, 0x66, 0x6f, 0x6f}},
-}
-
-func TestMarshalString(t *testing.T) {
- for _, tt := range marshalStringTests {
- got := marshalString(nil, tt.v)
- if !bytes.Equal(tt.want, got) {
- t.Errorf("marshalString(%q): want %#v, got %#v", tt.v, tt.want, got)
- }
- }
-}
-
-var marshalTests = []struct {
- v interface{}
- want []byte
-}{
- {uint8(1), []byte{1}},
- {byte(1), []byte{1}},
- {uint32(1), []byte{0, 0, 0, 1}},
- {uint64(1), []byte{0, 0, 0, 0, 0, 0, 0, 1}},
- {"foo", []byte{0x0, 0x0, 0x0, 0x3, 0x66, 0x6f, 0x6f}},
- {[]uint32{1, 2, 3, 4}, []byte{0x0, 0x0, 0x0, 0x1, 0x0, 0x0, 0x0, 0x2, 0x0, 0x0, 0x0, 0x3, 0x0, 0x0, 0x0, 0x4}},
-}
-
-func TestMarshal(t *testing.T) {
- for _, tt := range marshalTests {
- got := marshal(nil, tt.v)
- if !bytes.Equal(tt.want, got) {
- t.Errorf("marshal(%v): want %#v, got %#v", tt.v, tt.want, got)
- }
- }
-}
-
-var unmarshalUint32Tests = []struct {
- b []byte
- want uint32
- rest []byte
-}{
- {[]byte{0, 0, 0, 0}, 0, nil},
- {[]byte{0, 0, 1, 0}, 256, nil},
- {[]byte{255, 0, 0, 255}, 4278190335, nil},
-}
-
-func TestUnmarshalUint32(t *testing.T) {
- for _, tt := range unmarshalUint32Tests {
- got, rest := unmarshalUint32(tt.b)
- if got != tt.want || !bytes.Equal(rest, tt.rest) {
- t.Errorf("unmarshalUint32(%v): want %v, %#v, got %v, %#v", tt.b, tt.want, tt.rest, got, rest)
- }
- }
-}
-
-var unmarshalUint64Tests = []struct {
- b []byte
- want uint64
- rest []byte
-}{
- {[]byte{0, 0, 0, 0, 0, 0, 0, 0}, 0, nil},
- {[]byte{0, 0, 0, 0, 0, 0, 1, 0}, 256, nil},
- {[]byte{255, 0, 0, 0, 0, 0, 0, 255}, 18374686479671623935, nil},
-}
-
-func TestUnmarshalUint64(t *testing.T) {
- for _, tt := range unmarshalUint64Tests {
- got, rest := unmarshalUint64(tt.b)
- if got != tt.want || !bytes.Equal(rest, tt.rest) {
- t.Errorf("unmarshalUint64(%v): want %v, %#v, got %v, %#v", tt.b, tt.want, tt.rest, got, rest)
- }
- }
-}
-
-var unmarshalStringTests = []struct {
- b []byte
- want string
- rest []byte
-}{
- {marshalString(nil, ""), "", nil},
- {marshalString(nil, "blah"), "blah", nil},
-}
-
-func TestUnmarshalString(t *testing.T) {
- for _, tt := range unmarshalStringTests {
- got, rest := unmarshalString(tt.b)
- if got != tt.want || !bytes.Equal(rest, tt.rest) {
- t.Errorf("unmarshalUint64(%v): want %q, %#v, got %q, %#v", tt.b, tt.want, tt.rest, got, rest)
- }
- }
-}
-
-var sendPacketTests = []struct {
- p encoding.BinaryMarshaler
- want []byte
-}{
- {sshFxInitPacket{
- Version: 3,
- Extensions: []extensionPair{
- {"posix-rename@openssh.com", "1"},
- },
- }, []byte{0x0, 0x0, 0x0, 0x26, 0x1, 0x0, 0x0, 0x0, 0x3, 0x0, 0x0, 0x0, 0x18, 0x70, 0x6f, 0x73, 0x69, 0x78, 0x2d, 0x72, 0x65, 0x6e, 0x61, 0x6d, 0x65, 0x40, 0x6f, 0x70, 0x65, 0x6e, 0x73, 0x73, 0x68, 0x2e, 0x63, 0x6f, 0x6d, 0x0, 0x0, 0x0, 0x1, 0x31}},
-
- {sshFxpOpenPacket{
- ID: 1,
- Path: "/foo",
- Pflags: flags(os.O_RDONLY),
- }, []byte{0x0, 0x0, 0x0, 0x15, 0x3, 0x0, 0x0, 0x0, 0x1, 0x0, 0x0, 0x0, 0x4, 0x2f, 0x66, 0x6f, 0x6f, 0x0, 0x0, 0x0, 0x1, 0x0, 0x0, 0x0, 0x0}},
-
- {sshFxpWritePacket{
- ID: 124,
- Handle: "foo",
- Offset: 13,
- Length: uint32(len([]byte("bar"))),
- Data: []byte("bar"),
- }, []byte{0x0, 0x0, 0x0, 0x1b, 0x6, 0x0, 0x0, 0x0, 0x7c, 0x0, 0x0, 0x0, 0x3, 0x66, 0x6f, 0x6f, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0xd, 0x0, 0x0, 0x0, 0x3, 0x62, 0x61, 0x72}},
-
- {sshFxpSetstatPacket{
- ID: 31,
- Path: "/bar",
- Flags: flags(os.O_WRONLY),
- Attrs: struct {
- UID uint32
- GID uint32
- }{1000, 100},
- }, []byte{0x0, 0x0, 0x0, 0x19, 0x9, 0x0, 0x0, 0x0, 0x1f, 0x0, 0x0, 0x0, 0x4, 0x2f, 0x62, 0x61, 0x72, 0x0, 0x0, 0x0, 0x2, 0x0, 0x0, 0x3, 0xe8, 0x0, 0x0, 0x0, 0x64}},
-}
-
-func TestSendPacket(t *testing.T) {
- for _, tt := range sendPacketTests {
- var w bytes.Buffer
- sendPacket(&w, tt.p)
- if got := w.Bytes(); !bytes.Equal(tt.want, got) {
- t.Errorf("sendPacket(%v): want %#v, got %#v", tt.p, tt.want, got)
- }
- }
-}
-
-func sp(p encoding.BinaryMarshaler) []byte {
- var w bytes.Buffer
- sendPacket(&w, p)
- return w.Bytes()
-}
-
-var recvPacketTests = []struct {
- b []byte
- want uint8
- rest []byte
-}{
- {sp(sshFxInitPacket{
- Version: 3,
- Extensions: []extensionPair{
- {"posix-rename@openssh.com", "1"},
- },
- }), ssh_FXP_INIT, []byte{0x0, 0x0, 0x0, 0x3, 0x0, 0x0, 0x0, 0x18, 0x70, 0x6f, 0x73, 0x69, 0x78, 0x2d, 0x72, 0x65, 0x6e, 0x61, 0x6d, 0x65, 0x40, 0x6f, 0x70, 0x65, 0x6e, 0x73, 0x73, 0x68, 0x2e, 0x63, 0x6f, 0x6d, 0x0, 0x0, 0x0, 0x1, 0x31}},
-}
-
-func TestRecvPacket(t *testing.T) {
- for _, tt := range recvPacketTests {
- r := bytes.NewReader(tt.b)
- got, rest, _ := recvPacket(r)
- if got != tt.want || !bytes.Equal(rest, tt.rest) {
- t.Errorf("recvPacket(%#v): want %v, %#v, got %v, %#v", tt.b, tt.want, tt.rest, got, rest)
- }
- }
-}
-
-func TestSSHFxpOpenPacketreadonly(t *testing.T) {
- var tests = []struct {
- pflags uint32
- ok bool
- }{
- {
- pflags: ssh_FXF_READ,
- ok: true,
- },
- {
- pflags: ssh_FXF_WRITE,
- ok: false,
- },
- {
- pflags: ssh_FXF_READ | ssh_FXF_WRITE,
- ok: false,
- },
- }
-
- for _, tt := range tests {
- p := &sshFxpOpenPacket{
- Pflags: tt.pflags,
- }
-
- if want, got := tt.ok, p.readonly(); want != got {
- t.Errorf("unexpected value for p.readonly(): want: %v, got: %v",
- want, got)
- }
- }
-}
-
-func TestSSHFxpOpenPackethasPflags(t *testing.T) {
- var tests = []struct {
- desc string
- haveFlags uint32
- testFlags []uint32
- ok bool
- }{
- {
- desc: "have read, test against write",
- haveFlags: ssh_FXF_READ,
- testFlags: []uint32{ssh_FXF_WRITE},
- ok: false,
- },
- {
- desc: "have write, test against read",
- haveFlags: ssh_FXF_WRITE,
- testFlags: []uint32{ssh_FXF_READ},
- ok: false,
- },
- {
- desc: "have read+write, test against read",
- haveFlags: ssh_FXF_READ | ssh_FXF_WRITE,
- testFlags: []uint32{ssh_FXF_READ},
- ok: true,
- },
- {
- desc: "have read+write, test against write",
- haveFlags: ssh_FXF_READ | ssh_FXF_WRITE,
- testFlags: []uint32{ssh_FXF_WRITE},
- ok: true,
- },
- {
- desc: "have read+write, test against read+write",
- haveFlags: ssh_FXF_READ | ssh_FXF_WRITE,
- testFlags: []uint32{ssh_FXF_READ, ssh_FXF_WRITE},
- ok: true,
- },
- }
-
- for _, tt := range tests {
- t.Log(tt.desc)
-
- p := &sshFxpOpenPacket{
- Pflags: tt.haveFlags,
- }
-
- if want, got := tt.ok, p.hasPflags(tt.testFlags...); want != got {
- t.Errorf("unexpected value for p.hasPflags(%#v): want: %v, got: %v",
- tt.testFlags, want, got)
- }
- }
-}
-
-func BenchmarkMarshalInit(b *testing.B) {
- for i := 0; i < b.N; i++ {
- sp(sshFxInitPacket{
- Version: 3,
- Extensions: []extensionPair{
- {"posix-rename@openssh.com", "1"},
- },
- })
- }
-}
-
-func BenchmarkMarshalOpen(b *testing.B) {
- for i := 0; i < b.N; i++ {
- sp(sshFxpOpenPacket{
- ID: 1,
- Path: "/home/test/some/random/path",
- Pflags: flags(os.O_RDONLY),
- })
- }
-}
-
-func BenchmarkMarshalWriteWorstCase(b *testing.B) {
- data := make([]byte, 32*1024)
- for i := 0; i < b.N; i++ {
- sp(sshFxpWritePacket{
- ID: 1,
- Handle: "someopaquehandle",
- Offset: 0,
- Length: uint32(len(data)),
- Data: data,
- })
- }
-}
-
-func BenchmarkMarshalWrite1k(b *testing.B) {
- data := make([]byte, 1024)
- for i := 0; i < b.N; i++ {
- sp(sshFxpWritePacket{
- ID: 1,
- Handle: "someopaquehandle",
- Offset: 0,
- Length: uint32(len(data)),
- Data: data,
- })
- }
-}
diff --git a/vendor/github.com/pkg/sftp/release.go b/vendor/github.com/pkg/sftp/release.go
deleted file mode 100644
index b695528f..00000000
--- a/vendor/github.com/pkg/sftp/release.go
+++ /dev/null
@@ -1,5 +0,0 @@
-// +build !debug
-
-package sftp
-
-func debug(fmt string, args ...interface{}) {}
diff --git a/vendor/github.com/pkg/sftp/server.go b/vendor/github.com/pkg/sftp/server.go
deleted file mode 100644
index e097bda3..00000000
--- a/vendor/github.com/pkg/sftp/server.go
+++ /dev/null
@@ -1,607 +0,0 @@
-package sftp
-
-// sftp server counterpart
-
-import (
- "encoding"
- "fmt"
- "io"
- "io/ioutil"
- "os"
- "path/filepath"
- "strconv"
- "sync"
- "syscall"
- "time"
-
- "github.com/pkg/errors"
-)
-
-const (
- sftpServerWorkerCount = 8
-)
-
-// Server is an SSH File Transfer Protocol (sftp) server.
-// This is intended to provide the sftp subsystem to an ssh server daemon.
-// This implementation currently supports most of sftp server protocol version 3,
-// as specified at http://tools.ietf.org/html/draft-ietf-secsh-filexfer-02
-type Server struct {
- serverConn
- debugStream io.Writer
- readOnly bool
- pktChan chan rxPacket
- openFiles map[string]*os.File
- openFilesLock sync.RWMutex
- handleCount int
- maxTxPacket uint32
-}
-
-func (svr *Server) nextHandle(f *os.File) string {
- svr.openFilesLock.Lock()
- defer svr.openFilesLock.Unlock()
- svr.handleCount++
- handle := strconv.Itoa(svr.handleCount)
- svr.openFiles[handle] = f
- return handle
-}
-
-func (svr *Server) closeHandle(handle string) error {
- svr.openFilesLock.Lock()
- defer svr.openFilesLock.Unlock()
- if f, ok := svr.openFiles[handle]; ok {
- delete(svr.openFiles, handle)
- return f.Close()
- }
-
- return syscall.EBADF
-}
-
-func (svr *Server) getHandle(handle string) (*os.File, bool) {
- svr.openFilesLock.RLock()
- defer svr.openFilesLock.RUnlock()
- f, ok := svr.openFiles[handle]
- return f, ok
-}
-
-type serverRespondablePacket interface {
- encoding.BinaryUnmarshaler
- id() uint32
- respond(svr *Server) error
-}
-
-// NewServer creates a new Server instance around the provided streams, serving
-// content from the root of the filesystem. Optionally, ServerOption
-// functions may be specified to further configure the Server.
-//
-// A subsequent call to Serve() is required to begin serving files over SFTP.
-func NewServer(rwc io.ReadWriteCloser, options ...ServerOption) (*Server, error) {
- s := &Server{
- serverConn: serverConn{
- conn: conn{
- Reader: rwc,
- WriteCloser: rwc,
- },
- },
- debugStream: ioutil.Discard,
- pktChan: make(chan rxPacket, sftpServerWorkerCount),
- openFiles: make(map[string]*os.File),
- maxTxPacket: 1 << 15,
- }
-
- for _, o := range options {
- if err := o(s); err != nil {
- return nil, err
- }
- }
-
- return s, nil
-}
-
-// A ServerOption is a function which applies configuration to a Server.
-type ServerOption func(*Server) error
-
-// WithDebug enables Server debugging output to the supplied io.Writer.
-func WithDebug(w io.Writer) ServerOption {
- return func(s *Server) error {
- s.debugStream = w
- return nil
- }
-}
-
-// ReadOnly configures a Server to serve files in read-only mode.
-func ReadOnly() ServerOption {
- return func(s *Server) error {
- s.readOnly = true
- return nil
- }
-}
-
-type rxPacket struct {
- pktType fxp
- pktBytes []byte
-}
-
-// Up to N parallel servers
-func (svr *Server) sftpServerWorker() error {
- for p := range svr.pktChan {
- var pkt interface {
- encoding.BinaryUnmarshaler
- id() uint32
- }
- var readonly = true
- switch p.pktType {
- case ssh_FXP_INIT:
- pkt = &sshFxInitPacket{}
- case ssh_FXP_LSTAT:
- pkt = &sshFxpLstatPacket{}
- case ssh_FXP_OPEN:
- pkt = &sshFxpOpenPacket{}
- // readonly handled specially below
- case ssh_FXP_CLOSE:
- pkt = &sshFxpClosePacket{}
- case ssh_FXP_READ:
- pkt = &sshFxpReadPacket{}
- case ssh_FXP_WRITE:
- pkt = &sshFxpWritePacket{}
- readonly = false
- case ssh_FXP_FSTAT:
- pkt = &sshFxpFstatPacket{}
- case ssh_FXP_SETSTAT:
- pkt = &sshFxpSetstatPacket{}
- readonly = false
- case ssh_FXP_FSETSTAT:
- pkt = &sshFxpFsetstatPacket{}
- readonly = false
- case ssh_FXP_OPENDIR:
- pkt = &sshFxpOpendirPacket{}
- case ssh_FXP_READDIR:
- pkt = &sshFxpReaddirPacket{}
- case ssh_FXP_REMOVE:
- pkt = &sshFxpRemovePacket{}
- readonly = false
- case ssh_FXP_MKDIR:
- pkt = &sshFxpMkdirPacket{}
- readonly = false
- case ssh_FXP_RMDIR:
- pkt = &sshFxpRmdirPacket{}
- readonly = false
- case ssh_FXP_REALPATH:
- pkt = &sshFxpRealpathPacket{}
- case ssh_FXP_STAT:
- pkt = &sshFxpStatPacket{}
- case ssh_FXP_RENAME:
- pkt = &sshFxpRenamePacket{}
- readonly = false
- case ssh_FXP_READLINK:
- pkt = &sshFxpReadlinkPacket{}
- case ssh_FXP_SYMLINK:
- pkt = &sshFxpSymlinkPacket{}
- readonly = false
- case ssh_FXP_EXTENDED:
- pkt = &sshFxpExtendedPacket{}
- default:
- return errors.Errorf("unhandled packet type: %s", p.pktType)
- }
- if err := pkt.UnmarshalBinary(p.pktBytes); err != nil {
- return err
- }
-
- // handle FXP_OPENDIR specially
- switch pkt := pkt.(type) {
- case *sshFxpOpenPacket:
- readonly = pkt.readonly()
- case *sshFxpExtendedPacket:
- readonly = pkt.SpecificPacket.readonly()
- }
-
- // If server is operating read-only and a write operation is requested,
- // return permission denied
- if !readonly && svr.readOnly {
- if err := svr.sendError(pkt, syscall.EPERM); err != nil {
- return errors.Wrap(err, "failed to send read only packet response")
- }
- continue
- }
-
- if err := handlePacket(svr, pkt); err != nil {
- return err
- }
- }
- return nil
-}
-
-func handlePacket(s *Server, p interface{}) error {
- switch p := p.(type) {
- case *sshFxInitPacket:
- return s.sendPacket(sshFxVersionPacket{sftpProtocolVersion, nil})
- case *sshFxpStatPacket:
- // stat the requested file
- info, err := os.Stat(p.Path)
- if err != nil {
- return s.sendError(p, err)
- }
- return s.sendPacket(sshFxpStatResponse{
- ID: p.ID,
- info: info,
- })
- case *sshFxpLstatPacket:
- // stat the requested file
- info, err := os.Lstat(p.Path)
- if err != nil {
- return s.sendError(p, err)
- }
- return s.sendPacket(sshFxpStatResponse{
- ID: p.ID,
- info: info,
- })
- case *sshFxpFstatPacket:
- f, ok := s.getHandle(p.Handle)
- if !ok {
- return s.sendError(p, syscall.EBADF)
- }
-
- info, err := f.Stat()
- if err != nil {
- return s.sendError(p, err)
- }
-
- return s.sendPacket(sshFxpStatResponse{
- ID: p.ID,
- info: info,
- })
- case *sshFxpMkdirPacket:
- // TODO FIXME: ignore flags field
- err := os.Mkdir(p.Path, 0755)
- return s.sendError(p, err)
- case *sshFxpRmdirPacket:
- err := os.Remove(p.Path)
- return s.sendError(p, err)
- case *sshFxpRemovePacket:
- err := os.Remove(p.Filename)
- return s.sendError(p, err)
- case *sshFxpRenamePacket:
- err := os.Rename(p.Oldpath, p.Newpath)
- return s.sendError(p, err)
- case *sshFxpSymlinkPacket:
- err := os.Symlink(p.Targetpath, p.Linkpath)
- return s.sendError(p, err)
- case *sshFxpClosePacket:
- return s.sendError(p, s.closeHandle(p.Handle))
- case *sshFxpReadlinkPacket:
- f, err := os.Readlink(p.Path)
- if err != nil {
- return s.sendError(p, err)
- }
-
- return s.sendPacket(sshFxpNamePacket{
- ID: p.ID,
- NameAttrs: []sshFxpNameAttr{{
- Name: f,
- LongName: f,
- Attrs: emptyFileStat,
- }},
- })
-
- case *sshFxpRealpathPacket:
- f, err := filepath.Abs(p.Path)
- if err != nil {
- return s.sendError(p, err)
- }
- f = filepath.Clean(f)
- return s.sendPacket(sshFxpNamePacket{
- ID: p.ID,
- NameAttrs: []sshFxpNameAttr{{
- Name: f,
- LongName: f,
- Attrs: emptyFileStat,
- }},
- })
- case *sshFxpOpendirPacket:
- return sshFxpOpenPacket{
- ID: p.ID,
- Path: p.Path,
- Pflags: ssh_FXF_READ,
- }.respond(s)
- case *sshFxpReadPacket:
- f, ok := s.getHandle(p.Handle)
- if !ok {
- return s.sendError(p, syscall.EBADF)
- }
-
- data := make([]byte, clamp(p.Len, s.maxTxPacket))
- n, err := f.ReadAt(data, int64(p.Offset))
- if err != nil && (err != io.EOF || n == 0) {
- return s.sendError(p, err)
- }
- return s.sendPacket(sshFxpDataPacket{
- ID: p.ID,
- Length: uint32(n),
- Data: data[:n],
- })
- case *sshFxpWritePacket:
- f, ok := s.getHandle(p.Handle)
- if !ok {
- return s.sendError(p, syscall.EBADF)
- }
-
- _, err := f.WriteAt(p.Data, int64(p.Offset))
- return s.sendError(p, err)
- case serverRespondablePacket:
- err := p.respond(s)
- return errors.Wrap(err, "pkt.respond failed")
- default:
- return errors.Errorf("unexpected packet type %T", p)
- }
-}
-
-// Serve serves SFTP connections until the streams stop or the SFTP subsystem
-// is stopped.
-func (svr *Server) Serve() error {
- var wg sync.WaitGroup
- wg.Add(sftpServerWorkerCount)
- for i := 0; i < sftpServerWorkerCount; i++ {
- go func() {
- defer wg.Done()
- if err := svr.sftpServerWorker(); err != nil {
- svr.conn.Close() // shuts down recvPacket
- }
- }()
- }
-
- var err error
- var pktType uint8
- var pktBytes []byte
- for {
- pktType, pktBytes, err = svr.recvPacket()
- if err != nil {
- break
- }
- svr.pktChan <- rxPacket{fxp(pktType), pktBytes}
- }
-
- close(svr.pktChan) // shuts down sftpServerWorkers
- wg.Wait() // wait for all workers to exit
-
- // close any still-open files
- for handle, file := range svr.openFiles {
- fmt.Fprintf(svr.debugStream, "sftp server file with handle %q left open: %v\n", handle, file.Name())
- file.Close()
- }
- return err // error from recvPacket
-}
-
-type id interface {
- id() uint32
-}
-
-// The init packet has no ID, so we just return a zero-value ID
-func (p sshFxInitPacket) id() uint32 { return 0 }
-
-type sshFxpStatResponse struct {
- ID uint32
- info os.FileInfo
-}
-
-func (p sshFxpStatResponse) MarshalBinary() ([]byte, error) {
- b := []byte{ssh_FXP_ATTRS}
- b = marshalUint32(b, p.ID)
- b = marshalFileInfo(b, p.info)
- return b, nil
-}
-
-var emptyFileStat = []interface{}{uint32(0)}
-
-func (p sshFxpOpenPacket) readonly() bool {
- return !p.hasPflags(ssh_FXF_WRITE)
-}
-
-func (p sshFxpOpenPacket) hasPflags(flags ...uint32) bool {
- for _, f := range flags {
- if p.Pflags&f == 0 {
- return false
- }
- }
- return true
-}
-
-func (p sshFxpOpenPacket) respond(svr *Server) error {
- var osFlags int
- if p.hasPflags(ssh_FXF_READ, ssh_FXF_WRITE) {
- osFlags |= os.O_RDWR
- } else if p.hasPflags(ssh_FXF_WRITE) {
- osFlags |= os.O_WRONLY
- } else if p.hasPflags(ssh_FXF_READ) {
- osFlags |= os.O_RDONLY
- } else {
- // how are they opening?
- return svr.sendError(p, syscall.EINVAL)
- }
-
- if p.hasPflags(ssh_FXF_APPEND) {
- osFlags |= os.O_APPEND
- }
- if p.hasPflags(ssh_FXF_CREAT) {
- osFlags |= os.O_CREATE
- }
- if p.hasPflags(ssh_FXF_TRUNC) {
- osFlags |= os.O_TRUNC
- }
- if p.hasPflags(ssh_FXF_EXCL) {
- osFlags |= os.O_EXCL
- }
-
- f, err := os.OpenFile(p.Path, osFlags, 0644)
- if err != nil {
- return svr.sendError(p, err)
- }
-
- handle := svr.nextHandle(f)
- return svr.sendPacket(sshFxpHandlePacket{p.ID, handle})
-}
-
-func (p sshFxpReaddirPacket) respond(svr *Server) error {
- f, ok := svr.getHandle(p.Handle)
- if !ok {
- return svr.sendError(p, syscall.EBADF)
- }
-
- dirname := f.Name()
- dirents, err := f.Readdir(128)
- if err != nil {
- return svr.sendError(p, err)
- }
-
- ret := sshFxpNamePacket{ID: p.ID}
- for _, dirent := range dirents {
- ret.NameAttrs = append(ret.NameAttrs, sshFxpNameAttr{
- Name: dirent.Name(),
- LongName: runLs(dirname, dirent),
- Attrs: []interface{}{dirent},
- })
- }
- return svr.sendPacket(ret)
-}
-
-func (p sshFxpSetstatPacket) respond(svr *Server) error {
- // additional unmarshalling is required for each possibility here
- b := p.Attrs.([]byte)
- var err error
-
- debug("setstat name \"%s\"", p.Path)
- if (p.Flags & ssh_FILEXFER_ATTR_SIZE) != 0 {
- var size uint64
- if size, b, err = unmarshalUint64Safe(b); err == nil {
- err = os.Truncate(p.Path, int64(size))
- }
- }
- if (p.Flags & ssh_FILEXFER_ATTR_PERMISSIONS) != 0 {
- var mode uint32
- if mode, b, err = unmarshalUint32Safe(b); err == nil {
- err = os.Chmod(p.Path, os.FileMode(mode))
- }
- }
- if (p.Flags & ssh_FILEXFER_ATTR_ACMODTIME) != 0 {
- var atime uint32
- var mtime uint32
- if atime, b, err = unmarshalUint32Safe(b); err != nil {
- } else if mtime, b, err = unmarshalUint32Safe(b); err != nil {
- } else {
- atimeT := time.Unix(int64(atime), 0)
- mtimeT := time.Unix(int64(mtime), 0)
- err = os.Chtimes(p.Path, atimeT, mtimeT)
- }
- }
- if (p.Flags & ssh_FILEXFER_ATTR_UIDGID) != 0 {
- var uid uint32
- var gid uint32
- if uid, b, err = unmarshalUint32Safe(b); err != nil {
- } else if gid, b, err = unmarshalUint32Safe(b); err != nil {
- } else {
- err = os.Chown(p.Path, int(uid), int(gid))
- }
- }
-
- return svr.sendError(p, err)
-}
-
-func (p sshFxpFsetstatPacket) respond(svr *Server) error {
- f, ok := svr.getHandle(p.Handle)
- if !ok {
- return svr.sendError(p, syscall.EBADF)
- }
-
- // additional unmarshalling is required for each possibility here
- b := p.Attrs.([]byte)
- var err error
-
- debug("fsetstat name \"%s\"", f.Name())
- if (p.Flags & ssh_FILEXFER_ATTR_SIZE) != 0 {
- var size uint64
- if size, b, err = unmarshalUint64Safe(b); err == nil {
- err = f.Truncate(int64(size))
- }
- }
- if (p.Flags & ssh_FILEXFER_ATTR_PERMISSIONS) != 0 {
- var mode uint32
- if mode, b, err = unmarshalUint32Safe(b); err == nil {
- err = f.Chmod(os.FileMode(mode))
- }
- }
- if (p.Flags & ssh_FILEXFER_ATTR_ACMODTIME) != 0 {
- var atime uint32
- var mtime uint32
- if atime, b, err = unmarshalUint32Safe(b); err != nil {
- } else if mtime, b, err = unmarshalUint32Safe(b); err != nil {
- } else {
- atimeT := time.Unix(int64(atime), 0)
- mtimeT := time.Unix(int64(mtime), 0)
- err = os.Chtimes(f.Name(), atimeT, mtimeT)
- }
- }
- if (p.Flags & ssh_FILEXFER_ATTR_UIDGID) != 0 {
- var uid uint32
- var gid uint32
- if uid, b, err = unmarshalUint32Safe(b); err != nil {
- } else if gid, b, err = unmarshalUint32Safe(b); err != nil {
- } else {
- err = f.Chown(int(uid), int(gid))
- }
- }
-
- return svr.sendError(p, err)
-}
-
-// translateErrno translates a syscall error number to a SFTP error code.
-func translateErrno(errno syscall.Errno) uint32 {
- switch errno {
- case 0:
- return ssh_FX_OK
- case syscall.ENOENT:
- return ssh_FX_NO_SUCH_FILE
- case syscall.EPERM:
- return ssh_FX_PERMISSION_DENIED
- }
-
- return ssh_FX_FAILURE
-}
-
-func statusFromError(p id, err error) sshFxpStatusPacket {
- ret := sshFxpStatusPacket{
- ID: p.id(),
- StatusError: StatusError{
- // ssh_FX_OK = 0
- // ssh_FX_EOF = 1
- // ssh_FX_NO_SUCH_FILE = 2 ENOENT
- // ssh_FX_PERMISSION_DENIED = 3
- // ssh_FX_FAILURE = 4
- // ssh_FX_BAD_MESSAGE = 5
- // ssh_FX_NO_CONNECTION = 6
- // ssh_FX_CONNECTION_LOST = 7
- // ssh_FX_OP_UNSUPPORTED = 8
- Code: ssh_FX_OK,
- },
- }
- if err != nil {
- debug("statusFromError: error is %T %#v", err, err)
- ret.StatusError.Code = ssh_FX_FAILURE
- ret.StatusError.msg = err.Error()
- if err == io.EOF {
- ret.StatusError.Code = ssh_FX_EOF
- } else if errno, ok := err.(syscall.Errno); ok {
- ret.StatusError.Code = translateErrno(errno)
- } else if pathError, ok := err.(*os.PathError); ok {
- debug("statusFromError: error is %T %#v", pathError.Err, pathError.Err)
- if errno, ok := pathError.Err.(syscall.Errno); ok {
- ret.StatusError.Code = translateErrno(errno)
- }
- }
- }
- return ret
-}
-
-func clamp(v, max uint32) uint32 {
- if v > max {
- return max
- }
- return v
-}
diff --git a/vendor/github.com/pkg/sftp/server_integration_test.go b/vendor/github.com/pkg/sftp/server_integration_test.go
deleted file mode 100644
index c5786074..00000000
--- a/vendor/github.com/pkg/sftp/server_integration_test.go
+++ /dev/null
@@ -1,671 +0,0 @@
-package sftp
-
-// sftp server integration tests
-// enable with -integration
-// example invokation (darwin): gofmt -w `find . -name \*.go` && (cd server_standalone/ ; go build -tags debug) && go test -tags debug github.com/pkg/sftp -integration -v -sftp /usr/libexec/sftp-server -run ServerCompareSubsystems
-
-import (
- "bytes"
- "encoding/hex"
- "flag"
- "fmt"
- "io/ioutil"
- "math/rand"
- "net"
- "os"
- "os/exec"
- "path"
- "path/filepath"
- "regexp"
- "strconv"
- "strings"
- "testing"
- "time"
-
- "github.com/kr/fs"
- "golang.org/x/crypto/ssh"
-)
-
-var testSftpClientBin = flag.String("sftp_client", "/usr/bin/sftp", "location of the sftp client binary")
-var sshServerDebugStream = ioutil.Discard
-var sftpServerDebugStream = ioutil.Discard
-var sftpClientDebugStream = ioutil.Discard
-
-const (
- GOLANG_SFTP = true
- OPENSSH_SFTP = false
-)
-
-var (
- hostPrivateKeySigner ssh.Signer
- privKey = []byte(`
------BEGIN RSA PRIVATE KEY-----
-MIIEowIBAAKCAQEArhp7SqFnXVZAgWREL9Ogs+miy4IU/m0vmdkoK6M97G9NX/Pj
-wf8I/3/ynxmcArbt8Rc4JgkjT2uxx/NqR0yN42N1PjO5Czu0dms1PSqcKIJdeUBV
-7gdrKSm9Co4d2vwfQp5mg47eG4w63pz7Drk9+VIyi9YiYH4bve7WnGDswn4ycvYZ
-slV5kKnjlfCdPig+g5P7yQYud0cDWVwyA0+kxvL6H3Ip+Fu8rLDZn4/P1WlFAIuc
-PAf4uEKDGGmC2URowi5eesYR7f6GN/HnBs2776laNlAVXZUmYTUfOGagwLsEkx8x
-XdNqntfbs2MOOoK+myJrNtcB9pCrM0H6um19uQIDAQABAoIBABkWr9WdVKvalgkP
-TdQmhu3mKRNyd1wCl+1voZ5IM9Ayac/98UAvZDiNU4Uhx52MhtVLJ0gz4Oa8+i16
-IkKMAZZW6ro/8dZwkBzQbieWUFJ2Fso2PyvB3etcnGU8/Yhk9IxBDzy+BbuqhYE2
-1ebVQtz+v1HvVZzaD11bYYm/Xd7Y28QREVfFen30Q/v3dv7dOteDE/RgDS8Czz7w
-jMW32Q8JL5grz7zPkMK39BLXsTcSYcaasT2ParROhGJZDmbgd3l33zKCVc1zcj9B
-SA47QljGd09Tys958WWHgtj2o7bp9v1Ufs4LnyKgzrB80WX1ovaSQKvd5THTLchO
-kLIhUAECgYEA2doGXy9wMBmTn/hjiVvggR1aKiBwUpnB87Hn5xCMgoECVhFZlT6l
-WmZe7R2klbtG1aYlw+y+uzHhoVDAJW9AUSV8qoDUwbRXvBVlp+In5wIqJ+VjfivK
-zgIfzomL5NvDz37cvPmzqIeySTowEfbQyq7CUQSoDtE9H97E2wWZhDkCgYEAzJdJ
-k+NSFoTkHhfD3L0xCDHpRV3gvaOeew8524fVtVUq53X8m91ng4AX1r74dCUYwwiF
-gqTtSSJfx2iH1xKnNq28M9uKg7wOrCKrRqNPnYUO3LehZEC7rwUr26z4iJDHjjoB
-uBcS7nw0LJ+0Zeg1IF+aIdZGV3MrAKnrzWPixYECgYBsffX6ZWebrMEmQ89eUtFF
-u9ZxcGI/4K8ErC7vlgBD5ffB4TYZ627xzFWuBLs4jmHCeNIJ9tct5rOVYN+wRO1k
-/CRPzYUnSqb+1jEgILL6istvvv+DkE+ZtNkeRMXUndWwel94BWsBnUKe0UmrSJ3G
-sq23J3iCmJW2T3z+DpXbkQKBgQCK+LUVDNPE0i42NsRnm+fDfkvLP7Kafpr3Umdl
-tMY474o+QYn+wg0/aPJIf9463rwMNyyhirBX/k57IIktUdFdtfPicd2MEGETElWv
-nN1GzYxD50Rs2f/jKisZhEwqT9YNyV9DkgDdGGdEbJNYqbv0qpwDIg8T9foe8E1p
-bdErgQKBgAt290I3L316cdxIQTkJh1DlScN/unFffITwu127WMr28Jt3mq3cZpuM
-Aecey/eEKCj+Rlas5NDYKsB18QIuAw+qqWyq0LAKLiAvP1965Rkc4PLScl3MgJtO
-QYa37FK0p8NcDeUuF86zXBVutwS5nJLchHhKfd590ks57OROtm29
------END RSA PRIVATE KEY-----
-`)
-)
-
-func init() {
- var err error
- hostPrivateKeySigner, err = ssh.ParsePrivateKey(privKey)
- if err != nil {
- panic(err)
- }
-}
-
-func keyAuth(conn ssh.ConnMetadata, key ssh.PublicKey) (*ssh.Permissions, error) {
- permissions := &ssh.Permissions{
- CriticalOptions: map[string]string{},
- Extensions: map[string]string{},
- }
- return permissions, nil
-}
-
-func pwAuth(conn ssh.ConnMetadata, pw []byte) (*ssh.Permissions, error) {
- permissions := &ssh.Permissions{
- CriticalOptions: map[string]string{},
- Extensions: map[string]string{},
- }
- return permissions, nil
-}
-
-func basicServerConfig() *ssh.ServerConfig {
- config := ssh.ServerConfig{
- Config: ssh.Config{
- MACs: []string{"hmac-sha1"},
- },
- PasswordCallback: pwAuth,
- PublicKeyCallback: keyAuth,
- }
- config.AddHostKey(hostPrivateKeySigner)
- return &config
-}
-
-type sshServer struct {
- useSubsystem bool
- conn net.Conn
- config *ssh.ServerConfig
- sshConn *ssh.ServerConn
- newChans <-chan ssh.NewChannel
- newReqs <-chan *ssh.Request
-}
-
-func sshServerFromConn(conn net.Conn, useSubsystem bool, config *ssh.ServerConfig) (*sshServer, error) {
- // From a standard TCP connection to an encrypted SSH connection
- sshConn, newChans, newReqs, err := ssh.NewServerConn(conn, config)
- if err != nil {
- return nil, err
- }
-
- svr := &sshServer{useSubsystem, conn, config, sshConn, newChans, newReqs}
- svr.listenChannels()
- return svr, nil
-}
-
-func (svr *sshServer) Wait() error {
- return svr.sshConn.Wait()
-}
-
-func (svr *sshServer) Close() error {
- return svr.sshConn.Close()
-}
-
-func (svr *sshServer) listenChannels() {
- go func() {
- for chanReq := range svr.newChans {
- go svr.handleChanReq(chanReq)
- }
- }()
- go func() {
- for req := range svr.newReqs {
- go svr.handleReq(req)
- }
- }()
-}
-
-func (svr *sshServer) handleReq(req *ssh.Request) {
- switch req.Type {
- default:
- rejectRequest(req)
- }
-}
-
-type sshChannelServer struct {
- svr *sshServer
- chanReq ssh.NewChannel
- ch ssh.Channel
- newReqs <-chan *ssh.Request
-}
-
-type sshSessionChannelServer struct {
- *sshChannelServer
- env []string
-}
-
-func (svr *sshServer) handleChanReq(chanReq ssh.NewChannel) {
- fmt.Fprintf(sshServerDebugStream, "channel request: %v, extra: '%v'\n", chanReq.ChannelType(), hex.EncodeToString(chanReq.ExtraData()))
- switch chanReq.ChannelType() {
- case "session":
- if ch, reqs, err := chanReq.Accept(); err != nil {
- fmt.Fprintf(sshServerDebugStream, "fail to accept channel request: %v\n", err)
- chanReq.Reject(ssh.ResourceShortage, "channel accept failure")
- } else {
- chsvr := &sshSessionChannelServer{
- sshChannelServer: &sshChannelServer{svr, chanReq, ch, reqs},
- env: append([]string{}, os.Environ()...),
- }
- chsvr.handle()
- }
- default:
- chanReq.Reject(ssh.UnknownChannelType, "channel type is not a session")
- }
-}
-
-func (chsvr *sshSessionChannelServer) handle() {
- // should maybe do something here...
- go chsvr.handleReqs()
-}
-
-func (chsvr *sshSessionChannelServer) handleReqs() {
- for req := range chsvr.newReqs {
- chsvr.handleReq(req)
- }
- fmt.Fprintf(sshServerDebugStream, "ssh server session channel complete\n")
-}
-
-func (chsvr *sshSessionChannelServer) handleReq(req *ssh.Request) {
- switch req.Type {
- case "env":
- chsvr.handleEnv(req)
- case "subsystem":
- chsvr.handleSubsystem(req)
- default:
- rejectRequest(req)
- }
-}
-
-func rejectRequest(req *ssh.Request) error {
- fmt.Fprintf(sshServerDebugStream, "ssh rejecting request, type: %s\n", req.Type)
- err := req.Reply(false, []byte{})
- if err != nil {
- fmt.Fprintf(sshServerDebugStream, "ssh request reply had error: %v\n", err)
- }
- return err
-}
-
-func rejectRequestUnmarshalError(req *ssh.Request, s interface{}, err error) error {
- fmt.Fprintf(sshServerDebugStream, "ssh request unmarshaling error, type '%T': %v\n", s, err)
- rejectRequest(req)
- return err
-}
-
-// env request form:
-type sshEnvRequest struct {
- Envvar string
- Value string
-}
-
-func (chsvr *sshSessionChannelServer) handleEnv(req *ssh.Request) error {
- envReq := &sshEnvRequest{}
- if err := ssh.Unmarshal(req.Payload, envReq); err != nil {
- return rejectRequestUnmarshalError(req, envReq, err)
- }
- req.Reply(true, nil)
-
- found := false
- for i, envstr := range chsvr.env {
- if strings.HasPrefix(envstr, envReq.Envvar+"=") {
- found = true
- chsvr.env[i] = envReq.Envvar + "=" + envReq.Value
- }
- }
- if !found {
- chsvr.env = append(chsvr.env, envReq.Envvar+"="+envReq.Value)
- }
-
- return nil
-}
-
-// Payload: int: command size, string: command
-type sshSubsystemRequest struct {
- Name string
-}
-
-type sshSubsystemExitStatus struct {
- Status uint32
-}
-
-func (chsvr *sshSessionChannelServer) handleSubsystem(req *ssh.Request) error {
- defer func() {
- err1 := chsvr.ch.CloseWrite()
- err2 := chsvr.ch.Close()
- fmt.Fprintf(sshServerDebugStream, "ssh server subsystem request complete, err: %v %v\n", err1, err2)
- }()
-
- subsystemReq := &sshSubsystemRequest{}
- if err := ssh.Unmarshal(req.Payload, subsystemReq); err != nil {
- return rejectRequestUnmarshalError(req, subsystemReq, err)
- }
-
- // reply to the ssh client
-
- // no idea if this is actually correct spec-wise.
- // just enough for an sftp server to start.
- if subsystemReq.Name != "sftp" {
- return req.Reply(false, nil)
- }
-
- req.Reply(true, nil)
-
- if !chsvr.svr.useSubsystem {
- // use the openssh sftp server backend; this is to test the ssh code, not the sftp code,
- // or is used for comparison between our sftp subsystem and the openssh sftp subsystem
- cmd := exec.Command(*testSftp, "-e", "-l", "DEBUG") // log to stderr
- cmd.Stdin = chsvr.ch
- cmd.Stdout = chsvr.ch
- cmd.Stderr = sftpServerDebugStream
- if err := cmd.Start(); err != nil {
- return err
- }
- return cmd.Wait()
- }
-
- sftpServer, err := NewServer(
- chsvr.ch,
- WithDebug(sftpServerDebugStream),
- )
- if err != nil {
- return err
- }
-
- // wait for the session to close
- runErr := sftpServer.Serve()
- exitStatus := uint32(1)
- if runErr == nil {
- exitStatus = uint32(0)
- }
-
- _, exitStatusErr := chsvr.ch.SendRequest("exit-status", false, ssh.Marshal(sshSubsystemExitStatus{exitStatus}))
- return exitStatusErr
-}
-
-// starts an ssh server to test. returns: host string and port
-func testServer(t *testing.T, useSubsystem bool, readonly bool) (net.Listener, string, int) {
- if !*testIntegration {
- t.Skip("skipping intergration test")
- }
-
- listener, err := net.Listen("tcp", "127.0.0.1:0")
- if err != nil {
- t.Fatal(err)
- }
-
- host, portStr, err := net.SplitHostPort(listener.Addr().String())
- if err != nil {
- t.Fatal(err)
- }
- port, err := strconv.Atoi(portStr)
- if err != nil {
- t.Fatal(err)
- }
-
- go func() {
- for {
- conn, err := listener.Accept()
- if err != nil {
- fmt.Fprintf(sshServerDebugStream, "ssh server socket closed: %v\n", err)
- break
- }
-
- go func() {
- defer conn.Close()
- sshSvr, err := sshServerFromConn(conn, useSubsystem, basicServerConfig())
- if err != nil {
- t.Error(err)
- return
- }
- err = sshSvr.Wait()
- fmt.Fprintf(sshServerDebugStream, "ssh server finished, err: %v\n", err)
- }()
- }
- }()
-
- return listener, host, port
-}
-
-func runSftpClient(t *testing.T, script string, path string, host string, port int) (string, error) {
- // if sftp client binary is unavailable, skip test
- if _, err := os.Stat(*testSftpClientBin); err != nil {
- t.Skip("sftp client binary unavailable")
- }
- args := []string{
- // "-vvvv",
- "-b", "-",
- "-o", "StrictHostKeyChecking=no",
- "-o", "LogLevel=ERROR",
- "-o", "UserKnownHostsFile /dev/null",
- "-P", fmt.Sprintf("%d", port), fmt.Sprintf("%s:%s", host, path),
- }
- cmd := exec.Command(*testSftpClientBin, args...)
- var stdout bytes.Buffer
- cmd.Stdin = bytes.NewBufferString(script)
- cmd.Stdout = &stdout
- cmd.Stderr = sftpClientDebugStream
- if err := cmd.Start(); err != nil {
- return "", err
- }
- err := cmd.Wait()
- return string(stdout.Bytes()), err
-}
-
-func TestServerCompareSubsystems(t *testing.T) {
- listenerGo, hostGo, portGo := testServer(t, GOLANG_SFTP, READONLY)
- listenerOp, hostOp, portOp := testServer(t, OPENSSH_SFTP, READONLY)
- defer listenerGo.Close()
- defer listenerOp.Close()
-
- script := `
-ls /
-ls -l /
-ls /dev/
-ls -l /dev/
-ls -l /etc/
-ls -l /bin/
-ls -l /usr/bin/
-`
- outputGo, err := runSftpClient(t, script, "/", hostGo, portGo)
- if err != nil {
- t.Fatal(err)
- }
-
- outputOp, err := runSftpClient(t, script, "/", hostOp, portOp)
- if err != nil {
- t.Fatal(err)
- }
-
- newlineRegex := regexp.MustCompile(`\r*\n`)
- spaceRegex := regexp.MustCompile(`\s+`)
- outputGoLines := newlineRegex.Split(outputGo, -1)
- outputOpLines := newlineRegex.Split(outputOp, -1)
-
- for i, goLine := range outputGoLines {
- if i > len(outputOpLines) {
- t.Fatalf("output line count differs")
- }
- opLine := outputOpLines[i]
- bad := false
- if goLine != opLine {
- goWords := spaceRegex.Split(goLine, -1)
- opWords := spaceRegex.Split(opLine, -1)
- // allow words[2] and [3] to be different as these are users & groups
- // also allow words[1] to differ as the link count for directories like
- // proc is unstable during testing as processes are created/destroyed.
- for j, goWord := range goWords {
- if j > len(opWords) {
- bad = true
- }
- opWord := opWords[j]
- if goWord != opWord && j != 1 && j != 2 && j != 3 {
- bad = true
- }
- }
- }
-
- if bad {
- t.Errorf("outputs differ, go:\n%v\nopenssh:\n%v\n", goLine, opLine)
- }
- }
-}
-
-var rng = rand.New(rand.NewSource(time.Now().Unix()))
-
-func randData(length int) []byte {
- data := make([]byte, length)
- for i := 0; i < length; i++ {
- data[i] = byte(rng.Uint32())
- }
- return data
-}
-
-func randName() string {
- return "sftp." + hex.EncodeToString(randData(16))
-}
-
-func TestServerMkdirRmdir(t *testing.T) {
- listenerGo, hostGo, portGo := testServer(t, GOLANG_SFTP, READONLY)
- defer listenerGo.Close()
-
- tmpDir := "/tmp/" + randName()
- defer os.RemoveAll(tmpDir)
-
- // mkdir remote
- if _, err := runSftpClient(t, "mkdir "+tmpDir, "/", hostGo, portGo); err != nil {
- t.Fatal(err)
- }
-
- // directory should now exist
- if _, err := os.Stat(tmpDir); err != nil {
- t.Fatal(err)
- }
-
- // now remove the directory
- if _, err := runSftpClient(t, "rmdir "+tmpDir, "/", hostGo, portGo); err != nil {
- t.Fatal(err)
- }
-
- if _, err := os.Stat(tmpDir); err == nil {
- t.Fatal("should have error after deleting the directory")
- }
-}
-
-func TestServerSymlink(t *testing.T) {
- listenerGo, hostGo, portGo := testServer(t, GOLANG_SFTP, READONLY)
- defer listenerGo.Close()
-
- link := "/tmp/" + randName()
- defer os.RemoveAll(link)
-
- // now create a symbolic link within the new directory
- if output, err := runSftpClient(t, "symlink /bin/sh "+link, "/", hostGo, portGo); err != nil {
- t.Fatalf("failed: %v %v", err, string(output))
- }
-
- // symlink should now exist
- if stat, err := os.Lstat(link); err != nil {
- t.Fatal(err)
- } else if (stat.Mode() & os.ModeSymlink) != os.ModeSymlink {
- t.Fatalf("is not a symlink: %v", stat.Mode())
- }
-}
-
-func TestServerPut(t *testing.T) {
- listenerGo, hostGo, portGo := testServer(t, GOLANG_SFTP, READONLY)
- defer listenerGo.Close()
-
- tmpFileLocal := "/tmp/" + randName()
- tmpFileRemote := "/tmp/" + randName()
- defer os.RemoveAll(tmpFileLocal)
- defer os.RemoveAll(tmpFileRemote)
-
- t.Logf("put: local %v remote %v", tmpFileLocal, tmpFileRemote)
-
- // create a file with random contents. This will be the local file pushed to the server
- tmpFileLocalData := randData(10 * 1024 * 1024)
- if err := ioutil.WriteFile(tmpFileLocal, tmpFileLocalData, 0644); err != nil {
- t.Fatal(err)
- }
-
- // sftp the file to the server
- if output, err := runSftpClient(t, "put "+tmpFileLocal+" "+tmpFileRemote, "/", hostGo, portGo); err != nil {
- t.Fatalf("runSftpClient failed: %v, output\n%v\n", err, output)
- }
-
- // tmpFile2 should now exist, with the same contents
- if tmpFileRemoteData, err := ioutil.ReadFile(tmpFileRemote); err != nil {
- t.Fatal(err)
- } else if string(tmpFileLocalData) != string(tmpFileRemoteData) {
- t.Fatal("contents of file incorrect after put")
- }
-}
-
-func TestServerGet(t *testing.T) {
- listenerGo, hostGo, portGo := testServer(t, GOLANG_SFTP, READONLY)
- defer listenerGo.Close()
-
- tmpFileLocal := "/tmp/" + randName()
- tmpFileRemote := "/tmp/" + randName()
- defer os.RemoveAll(tmpFileLocal)
- defer os.RemoveAll(tmpFileRemote)
-
- t.Logf("get: local %v remote %v", tmpFileLocal, tmpFileRemote)
-
- // create a file with random contents. This will be the remote file pulled from the server
- tmpFileRemoteData := randData(10 * 1024 * 1024)
- if err := ioutil.WriteFile(tmpFileRemote, tmpFileRemoteData, 0644); err != nil {
- t.Fatal(err)
- }
-
- // sftp the file to the server
- if output, err := runSftpClient(t, "get "+tmpFileRemote+" "+tmpFileLocal, "/", hostGo, portGo); err != nil {
- t.Fatalf("runSftpClient failed: %v, output\n%v\n", err, output)
- }
-
- // tmpFile2 should now exist, with the same contents
- if tmpFileLocalData, err := ioutil.ReadFile(tmpFileLocal); err != nil {
- t.Fatal(err)
- } else if string(tmpFileLocalData) != string(tmpFileRemoteData) {
- t.Fatal("contents of file incorrect after put")
- }
-}
-
-func compareDirectoriesRecursive(t *testing.T, aroot, broot string) {
- walker := fs.Walk(aroot)
- for walker.Step() {
- if err := walker.Err(); err != nil {
- t.Fatal(err)
- }
- // find paths
- aPath := walker.Path()
- aRel, err := filepath.Rel(aroot, aPath)
- if err != nil {
- t.Fatalf("could not find relative path for %v: %v", aPath, err)
- }
- bPath := path.Join(broot, aRel)
-
- if aRel == "." {
- continue
- }
-
- //t.Logf("comparing: %v a: %v b %v", aRel, aPath, bPath)
-
- // if a is a link, the sftp recursive copy won't have copied it. ignore
- aLink, err := os.Lstat(aPath)
- if err != nil {
- t.Fatalf("could not lstat %v: %v", aPath, err)
- }
- if aLink.Mode()&os.ModeSymlink != 0 {
- continue
- }
-
- // stat the files
- aFile, err := os.Stat(aPath)
- if err != nil {
- t.Fatalf("could not stat %v: %v", aPath, err)
- }
- bFile, err := os.Stat(bPath)
- if err != nil {
- t.Fatalf("could not stat %v: %v", bPath, err)
- }
-
- // compare stats, with some leniency for the timestamp
- if aFile.Mode() != bFile.Mode() {
- t.Fatalf("modes different for %v: %v vs %v", aRel, aFile.Mode(), bFile.Mode())
- }
- if !aFile.IsDir() {
- if aFile.Size() != bFile.Size() {
- t.Fatalf("sizes different for %v: %v vs %v", aRel, aFile.Size(), bFile.Size())
- }
- }
- timeDiff := aFile.ModTime().Sub(bFile.ModTime())
- if timeDiff > time.Second || timeDiff < -time.Second {
- t.Fatalf("mtimes different for %v: %v vs %v", aRel, aFile.ModTime(), bFile.ModTime())
- }
-
- // compare contents
- if !aFile.IsDir() {
- if aContents, err := ioutil.ReadFile(aPath); err != nil {
- t.Fatal(err)
- } else if bContents, err := ioutil.ReadFile(bPath); err != nil {
- t.Fatal(err)
- } else if string(aContents) != string(bContents) {
- t.Fatalf("contents different for %v", aRel)
- }
- }
- }
-}
-
-func TestServerPutRecursive(t *testing.T) {
- listenerGo, hostGo, portGo := testServer(t, GOLANG_SFTP, READONLY)
- defer listenerGo.Close()
-
- dirLocal, err := os.Getwd()
- if err != nil {
- t.Fatal(err)
- }
- tmpDirRemote := "/tmp/" + randName()
- defer os.RemoveAll(tmpDirRemote)
-
- t.Logf("put recursive: local %v remote %v", dirLocal, tmpDirRemote)
-
- // push this directory (source code etc) recursively to the server
- if output, err := runSftpClient(t, "mkdir "+tmpDirRemote+"\r\nput -r -P "+dirLocal+"/ "+tmpDirRemote+"/", "/", hostGo, portGo); err != nil {
- t.Fatalf("runSftpClient failed: %v, output\n%v\n", err, output)
- }
-
- compareDirectoriesRecursive(t, dirLocal, path.Join(tmpDirRemote, path.Base(dirLocal)))
-}
-
-func TestServerGetRecursive(t *testing.T) {
- listenerGo, hostGo, portGo := testServer(t, GOLANG_SFTP, READONLY)
- defer listenerGo.Close()
-
- dirRemote, err := os.Getwd()
- if err != nil {
- t.Fatal(err)
- }
- tmpDirLocal := "/tmp/" + randName()
- defer os.RemoveAll(tmpDirLocal)
-
- t.Logf("get recursive: local %v remote %v", tmpDirLocal, dirRemote)
-
- // pull this directory (source code etc) recursively from the server
- if output, err := runSftpClient(t, "lmkdir "+tmpDirLocal+"\r\nget -r -P "+dirRemote+"/ "+tmpDirLocal+"/", "/", hostGo, portGo); err != nil {
- t.Fatalf("runSftpClient failed: %v, output\n%v\n", err, output)
- }
-
- compareDirectoriesRecursive(t, dirRemote, path.Join(tmpDirLocal, path.Base(dirRemote)))
-}
diff --git a/vendor/github.com/pkg/sftp/server_statvfs_darwin.go b/vendor/github.com/pkg/sftp/server_statvfs_darwin.go
deleted file mode 100644
index 8c01dac5..00000000
--- a/vendor/github.com/pkg/sftp/server_statvfs_darwin.go
+++ /dev/null
@@ -1,21 +0,0 @@
-package sftp
-
-import (
- "syscall"
-)
-
-func statvfsFromStatfst(stat *syscall.Statfs_t) (*StatVFS, error) {
- return &StatVFS{
- Bsize: uint64(stat.Bsize),
- Frsize: uint64(stat.Bsize), // fragment size is a linux thing; use block size here
- Blocks: stat.Blocks,
- Bfree: stat.Bfree,
- Bavail: stat.Bavail,
- Files: stat.Files,
- Ffree: stat.Ffree,
- Favail: stat.Ffree, // not sure how to calculate Favail
- Fsid: uint64(uint64(stat.Fsid.Val[1])<<32 | uint64(stat.Fsid.Val[0])), // endianness?
- Flag: uint64(stat.Flags), // assuming POSIX?
- Namemax: 1024, // man 2 statfs shows: #define MAXPATHLEN 1024
- }, nil
-}
diff --git a/vendor/github.com/pkg/sftp/server_statvfs_impl.go b/vendor/github.com/pkg/sftp/server_statvfs_impl.go
deleted file mode 100644
index c37a34ac..00000000
--- a/vendor/github.com/pkg/sftp/server_statvfs_impl.go
+++ /dev/null
@@ -1,25 +0,0 @@
-// +build darwin linux
-
-// fill in statvfs structure with OS specific values
-// Statfs_t is different per-kernel, and only exists on some unixes (not Solaris for instance)
-
-package sftp
-
-import (
- "syscall"
-)
-
-func (p sshFxpExtendedPacketStatVFS) respond(svr *Server) error {
- stat := &syscall.Statfs_t{}
- if err := syscall.Statfs(p.Path, stat); err != nil {
- return svr.sendPacket(statusFromError(p, err))
- }
-
- retPkt, err := statvfsFromStatfst(stat)
- if err != nil {
- return svr.sendPacket(statusFromError(p, err))
- }
- retPkt.ID = p.ID
-
- return svr.sendPacket(retPkt)
-}
diff --git a/vendor/github.com/pkg/sftp/server_statvfs_linux.go b/vendor/github.com/pkg/sftp/server_statvfs_linux.go
deleted file mode 100644
index 77fd1bf4..00000000
--- a/vendor/github.com/pkg/sftp/server_statvfs_linux.go
+++ /dev/null
@@ -1,23 +0,0 @@
-// +build !gccgo,linux
-
-package sftp
-
-import (
- "syscall"
-)
-
-func statvfsFromStatfst(stat *syscall.Statfs_t) (*StatVFS, error) {
- return &StatVFS{
- Bsize: uint64(stat.Bsize),
- Frsize: uint64(stat.Frsize),
- Blocks: stat.Blocks,
- Bfree: stat.Bfree,
- Bavail: stat.Bavail,
- Files: stat.Files,
- Ffree: stat.Ffree,
- Favail: stat.Ffree, // not sure how to calculate Favail
- Fsid: uint64(uint64(stat.Fsid.X__val[1])<<32 | uint64(stat.Fsid.X__val[0])), // endianness?
- Flag: uint64(stat.Flags), // assuming POSIX?
- Namemax: uint64(stat.Namelen),
- }, nil
-}
diff --git a/vendor/github.com/pkg/sftp/server_statvfs_stubs.go b/vendor/github.com/pkg/sftp/server_statvfs_stubs.go
deleted file mode 100644
index 1512a132..00000000
--- a/vendor/github.com/pkg/sftp/server_statvfs_stubs.go
+++ /dev/null
@@ -1,11 +0,0 @@
-// +build !darwin,!linux gccgo
-
-package sftp
-
-import (
- "syscall"
-)
-
-func (p sshFxpExtendedPacketStatVFS) respond(svr *Server) error {
- return syscall.ENOTSUP
-}
diff --git a/vendor/github.com/pkg/sftp/server_stubs.go b/vendor/github.com/pkg/sftp/server_stubs.go
deleted file mode 100644
index 3b1ddbdb..00000000
--- a/vendor/github.com/pkg/sftp/server_stubs.go
+++ /dev/null
@@ -1,12 +0,0 @@
-// +build !cgo,!plan9 windows android
-
-package sftp
-
-import (
- "os"
- "path"
-)
-
-func runLs(dirname string, dirent os.FileInfo) string {
- return path.Join(dirname, dirent.Name())
-}
diff --git a/vendor/github.com/pkg/sftp/server_test.go b/vendor/github.com/pkg/sftp/server_test.go
deleted file mode 100644
index 2ff02ea2..00000000
--- a/vendor/github.com/pkg/sftp/server_test.go
+++ /dev/null
@@ -1,64 +0,0 @@
-package sftp
-
-import (
- "io"
- "testing"
-)
-
-func clientServerPair(t *testing.T) (*Client, *Server) {
- cr, sw := io.Pipe()
- sr, cw := io.Pipe()
- server, err := NewServer(struct {
- io.Reader
- io.WriteCloser
- }{sr, sw})
- if err != nil {
- t.Fatal(err)
- }
- go server.Serve()
- client, err := NewClientPipe(cr, cw)
- if err != nil {
- t.Fatalf("%+v\n", err)
- }
- return client, server
-}
-
-type sshFxpTestBadExtendedPacket struct {
- ID uint32
- Extension string
- Data string
-}
-
-func (p sshFxpTestBadExtendedPacket) id() uint32 { return p.ID }
-
-func (p sshFxpTestBadExtendedPacket) MarshalBinary() ([]byte, error) {
- l := 1 + 4 + 4 + // type(byte) + uint32 + uint32
- len(p.Extension) +
- len(p.Data)
-
- b := make([]byte, 0, l)
- b = append(b, ssh_FXP_EXTENDED)
- b = marshalUint32(b, p.ID)
- b = marshalString(b, p.Extension)
- b = marshalString(b, p.Data)
- return b, nil
-}
-
-// test that errors are sent back when we request an invalid extended packet operation
-func TestInvalidExtendedPacket(t *testing.T) {
- client, _ := clientServerPair(t)
- defer client.Close()
- badPacket := sshFxpTestBadExtendedPacket{client.nextID(), "thisDoesn'tExist", "foobar"}
- _, _, err := client.clientConn.sendPacket(badPacket)
- if err == nil {
- t.Fatal("expected error from bad packet")
- }
-
- // try to stat a file; the client should have shut down.
- filePath := "/etc/passwd"
- _, err = client.Stat(filePath)
- if err == nil {
- t.Fatal("expected error from closed connection")
- }
-
-}
diff --git a/vendor/github.com/pkg/sftp/server_unix.go b/vendor/github.com/pkg/sftp/server_unix.go
deleted file mode 100644
index 8c3f0b44..00000000
--- a/vendor/github.com/pkg/sftp/server_unix.go
+++ /dev/null
@@ -1,143 +0,0 @@
-// +build darwin dragonfly freebsd !android,linux netbsd openbsd solaris
-// +build cgo
-
-package sftp
-
-import (
- "fmt"
- "os"
- "path"
- "syscall"
- "time"
-)
-
-func runLsTypeWord(dirent os.FileInfo) string {
- // find first character, the type char
- // b Block special file.
- // c Character special file.
- // d Directory.
- // l Symbolic link.
- // s Socket link.
- // p FIFO.
- // - Regular file.
- tc := '-'
- mode := dirent.Mode()
- if (mode & os.ModeDir) != 0 {
- tc = 'd'
- } else if (mode & os.ModeDevice) != 0 {
- tc = 'b'
- if (mode & os.ModeCharDevice) != 0 {
- tc = 'c'
- }
- } else if (mode & os.ModeSymlink) != 0 {
- tc = 'l'
- } else if (mode & os.ModeSocket) != 0 {
- tc = 's'
- } else if (mode & os.ModeNamedPipe) != 0 {
- tc = 'p'
- }
-
- // owner
- orc := '-'
- if (mode & 0400) != 0 {
- orc = 'r'
- }
- owc := '-'
- if (mode & 0200) != 0 {
- owc = 'w'
- }
- oxc := '-'
- ox := (mode & 0100) != 0
- setuid := (mode & os.ModeSetuid) != 0
- if ox && setuid {
- oxc = 's'
- } else if setuid {
- oxc = 'S'
- } else if ox {
- oxc = 'x'
- }
-
- // group
- grc := '-'
- if (mode & 040) != 0 {
- grc = 'r'
- }
- gwc := '-'
- if (mode & 020) != 0 {
- gwc = 'w'
- }
- gxc := '-'
- gx := (mode & 010) != 0
- setgid := (mode & os.ModeSetgid) != 0
- if gx && setgid {
- gxc = 's'
- } else if setgid {
- gxc = 'S'
- } else if gx {
- gxc = 'x'
- }
-
- // all / others
- arc := '-'
- if (mode & 04) != 0 {
- arc = 'r'
- }
- awc := '-'
- if (mode & 02) != 0 {
- awc = 'w'
- }
- axc := '-'
- ax := (mode & 01) != 0
- sticky := (mode & os.ModeSticky) != 0
- if ax && sticky {
- axc = 't'
- } else if sticky {
- axc = 'T'
- } else if ax {
- axc = 'x'
- }
-
- return fmt.Sprintf("%c%c%c%c%c%c%c%c%c%c", tc, orc, owc, oxc, grc, gwc, gxc, arc, awc, axc)
-}
-
-func runLsStatt(dirname string, dirent os.FileInfo, statt *syscall.Stat_t) string {
- // example from openssh sftp server:
- // crw-rw-rw- 1 root wheel 0 Jul 31 20:52 ttyvd
- // format:
- // {directory / char device / etc}{rwxrwxrwx} {number of links} owner group size month day [time (this year) | year (otherwise)] name
-
- typeword := runLsTypeWord(dirent)
- numLinks := statt.Nlink
- uid := statt.Uid
- gid := statt.Gid
- username := fmt.Sprintf("%d", uid)
- groupname := fmt.Sprintf("%d", gid)
- // TODO FIXME: uid -> username, gid -> groupname lookup for ls -l format output
-
- mtime := dirent.ModTime()
- monthStr := mtime.Month().String()[0:3]
- day := mtime.Day()
- year := mtime.Year()
- now := time.Now()
- isOld := mtime.Before(now.Add(-time.Hour * 24 * 365 / 2))
-
- yearOrTime := fmt.Sprintf("%02d:%02d", mtime.Hour(), mtime.Minute())
- if isOld {
- yearOrTime = fmt.Sprintf("%d", year)
- }
-
- return fmt.Sprintf("%s %4d %-8s %-8s %8d %s %2d %5s %s", typeword, numLinks, username, groupname, dirent.Size(), monthStr, day, yearOrTime, dirent.Name())
-}
-
-// ls -l style output for a file, which is in the 'long output' section of a readdir response packet
-// this is a very simple (lazy) implementation, just enough to look almost like openssh in a few basic cases
-func runLs(dirname string, dirent os.FileInfo) string {
- dsys := dirent.Sys()
- if dsys == nil {
- } else if statt, ok := dsys.(*syscall.Stat_t); !ok {
- } else {
- return runLsStatt(dirname, dirent, statt)
- }
-
- return path.Join(dirname, dirent.Name())
-}
diff --git a/vendor/github.com/pkg/sftp/sftp.go b/vendor/github.com/pkg/sftp/sftp.go
deleted file mode 100644
index 22184afe..00000000
--- a/vendor/github.com/pkg/sftp/sftp.go
+++ /dev/null
@@ -1,217 +0,0 @@
-// Package sftp implements the SSH File Transfer Protocol as described in
-// https://filezilla-project.org/specs/draft-ietf-secsh-filexfer-02.txt
-package sftp
-
-import (
- "fmt"
-
- "github.com/pkg/errors"
-)
-
-const (
- ssh_FXP_INIT = 1
- ssh_FXP_VERSION = 2
- ssh_FXP_OPEN = 3
- ssh_FXP_CLOSE = 4
- ssh_FXP_READ = 5
- ssh_FXP_WRITE = 6
- ssh_FXP_LSTAT = 7
- ssh_FXP_FSTAT = 8
- ssh_FXP_SETSTAT = 9
- ssh_FXP_FSETSTAT = 10
- ssh_FXP_OPENDIR = 11
- ssh_FXP_READDIR = 12
- ssh_FXP_REMOVE = 13
- ssh_FXP_MKDIR = 14
- ssh_FXP_RMDIR = 15
- ssh_FXP_REALPATH = 16
- ssh_FXP_STAT = 17
- ssh_FXP_RENAME = 18
- ssh_FXP_READLINK = 19
- ssh_FXP_SYMLINK = 20
- ssh_FXP_STATUS = 101
- ssh_FXP_HANDLE = 102
- ssh_FXP_DATA = 103
- ssh_FXP_NAME = 104
- ssh_FXP_ATTRS = 105
- ssh_FXP_EXTENDED = 200
- ssh_FXP_EXTENDED_REPLY = 201
-)
-
-const (
- ssh_FX_OK = 0
- ssh_FX_EOF = 1
- ssh_FX_NO_SUCH_FILE = 2
- ssh_FX_PERMISSION_DENIED = 3
- ssh_FX_FAILURE = 4
- ssh_FX_BAD_MESSAGE = 5
- ssh_FX_NO_CONNECTION = 6
- ssh_FX_CONNECTION_LOST = 7
- ssh_FX_OP_UNSUPPORTED = 8
-
- // see draft-ietf-secsh-filexfer-13
- // https://tools.ietf.org/html/draft-ietf-secsh-filexfer-13#section-9.1
- ssh_FX_INVALID_HANDLE = 9
- ssh_FX_NO_SUCH_PATH = 10
- ssh_FX_FILE_ALREADY_EXISTS = 11
- ssh_FX_WRITE_PROTECT = 12
- ssh_FX_NO_MEDIA = 13
- ssh_FX_NO_SPACE_ON_FILESYSTEM = 14
- ssh_FX_QUOTA_EXCEEDED = 15
- ssh_FX_UNKNOWN_PRINCIPAL = 16
- ssh_FX_LOCK_CONFLICT = 17
- ssh_FX_DIR_NOT_EMPTY = 18
- ssh_FX_NOT_A_DIRECTORY = 19
- ssh_FX_INVALID_FILENAME = 20
- ssh_FX_LINK_LOOP = 21
- ssh_FX_CANNOT_DELETE = 22
- ssh_FX_INVALID_PARAMETER = 23
- ssh_FX_FILE_IS_A_DIRECTORY = 24
- ssh_FX_BYTE_RANGE_LOCK_CONFLICT = 25
- ssh_FX_BYTE_RANGE_LOCK_REFUSED = 26
- ssh_FX_DELETE_PENDING = 27
- ssh_FX_FILE_CORRUPT = 28
- ssh_FX_OWNER_INVALID = 29
- ssh_FX_GROUP_INVALID = 30
- ssh_FX_NO_MATCHING_BYTE_RANGE_LOCK = 31
-)
-
-const (
- ssh_FXF_READ = 0x00000001
- ssh_FXF_WRITE = 0x00000002
- ssh_FXF_APPEND = 0x00000004
- ssh_FXF_CREAT = 0x00000008
- ssh_FXF_TRUNC = 0x00000010
- ssh_FXF_EXCL = 0x00000020
-)
-
-type fxp uint8
-
-func (f fxp) String() string {
- switch f {
- case ssh_FXP_INIT:
- return "SSH_FXP_INIT"
- case ssh_FXP_VERSION:
- return "SSH_FXP_VERSION"
- case ssh_FXP_OPEN:
- return "SSH_FXP_OPEN"
- case ssh_FXP_CLOSE:
- return "SSH_FXP_CLOSE"
- case ssh_FXP_READ:
- return "SSH_FXP_READ"
- case ssh_FXP_WRITE:
- return "SSH_FXP_WRITE"
- case ssh_FXP_LSTAT:
- return "SSH_FXP_LSTAT"
- case ssh_FXP_FSTAT:
- return "SSH_FXP_FSTAT"
- case ssh_FXP_SETSTAT:
- return "SSH_FXP_SETSTAT"
- case ssh_FXP_FSETSTAT:
- return "SSH_FXP_FSETSTAT"
- case ssh_FXP_OPENDIR:
- return "SSH_FXP_OPENDIR"
- case ssh_FXP_READDIR:
- return "SSH_FXP_READDIR"
- case ssh_FXP_REMOVE:
- return "SSH_FXP_REMOVE"
- case ssh_FXP_MKDIR:
- return "SSH_FXP_MKDIR"
- case ssh_FXP_RMDIR:
- return "SSH_FXP_RMDIR"
- case ssh_FXP_REALPATH:
- return "SSH_FXP_REALPATH"
- case ssh_FXP_STAT:
- return "SSH_FXP_STAT"
- case ssh_FXP_RENAME:
- return "SSH_FXP_RENAME"
- case ssh_FXP_READLINK:
- return "SSH_FXP_READLINK"
- case ssh_FXP_SYMLINK:
- return "SSH_FXP_SYMLINK"
- case ssh_FXP_STATUS:
- return "SSH_FXP_STATUS"
- case ssh_FXP_HANDLE:
- return "SSH_FXP_HANDLE"
- case ssh_FXP_DATA:
- return "SSH_FXP_DATA"
- case ssh_FXP_NAME:
- return "SSH_FXP_NAME"
- case ssh_FXP_ATTRS:
- return "SSH_FXP_ATTRS"
- case ssh_FXP_EXTENDED:
- return "SSH_FXP_EXTENDED"
- case ssh_FXP_EXTENDED_REPLY:
- return "SSH_FXP_EXTENDED_REPLY"
- default:
- return "unknown"
- }
-}
-
-type fx uint8
-
-func (f fx) String() string {
- switch f {
- case ssh_FX_OK:
- return "SSH_FX_OK"
- case ssh_FX_EOF:
- return "SSH_FX_EOF"
- case ssh_FX_NO_SUCH_FILE:
- return "SSH_FX_NO_SUCH_FILE"
- case ssh_FX_PERMISSION_DENIED:
- return "SSH_FX_PERMISSION_DENIED"
- case ssh_FX_FAILURE:
- return "SSH_FX_FAILURE"
- case ssh_FX_BAD_MESSAGE:
- return "SSH_FX_BAD_MESSAGE"
- case ssh_FX_NO_CONNECTION:
- return "SSH_FX_NO_CONNECTION"
- case ssh_FX_CONNECTION_LOST:
- return "SSH_FX_CONNECTION_LOST"
- case ssh_FX_OP_UNSUPPORTED:
- return "SSH_FX_OP_UNSUPPORTED"
- default:
- return "unknown"
- }
-}
-
-type unexpectedPacketErr struct {
- want, got uint8
-}
-
-func (u *unexpectedPacketErr) Error() string {
- return fmt.Sprintf("sftp: unexpected packet: want %v, got %v", fxp(u.want), fxp(u.got))
-}
-
-func unimplementedPacketErr(u uint8) error {
- return errors.Errorf("sftp: unimplemented packet type: got %v", fxp(u))
-}
-
-type unexpectedIDErr struct{ want, got uint32 }
-
-func (u *unexpectedIDErr) Error() string {
- return fmt.Sprintf("sftp: unexpected id: want %v, got %v", u.want, u.got)
-}
-
-func unimplementedSeekWhence(whence int) error {
- return errors.Errorf("sftp: unimplemented seek whence %v", whence)
-}
-
-func unexpectedCount(want, got uint32) error {
- return errors.Errorf("sftp: unexpected count: want %v, got %v", want, got)
-}
-
-type unexpectedVersionErr struct{ want, got uint32 }
-
-func (u *unexpectedVersionErr) Error() string {
- return fmt.Sprintf("sftp: unexpected server version: want %v, got %v", u.want, u.got)
-}
-
-// A StatusError is returned when an SFTP operation fails, and provides
-// additional information about the failure.
-type StatusError struct {
- Code uint32
- msg, lang string
-}
-
-func (s *StatusError) Error() string { return fmt.Sprintf("sftp: %q (%v)", s.msg, fx(s.Code)) }
diff --git a/vendor/github.com/satori/go.uuid/.travis.yml b/vendor/github.com/satori/go.uuid/.travis.yml
deleted file mode 100644
index 2199ce90..00000000
--- a/vendor/github.com/satori/go.uuid/.travis.yml
+++ /dev/null
@@ -1,11 +0,0 @@
-language: go
-go:
- - 1.0
- - 1.1
- - 1.2
- - 1.3
- - 1.4
- - 1.5
-sudo: false
-notifications:
- email: false
diff --git a/vendor/github.com/satori/go.uuid/LICENSE b/vendor/github.com/satori/go.uuid/LICENSE
deleted file mode 100644
index 6a1fb910..00000000
--- a/vendor/github.com/satori/go.uuid/LICENSE
+++ /dev/null
@@ -1,20 +0,0 @@
-Copyright (C) 2013-2015 by Maxim Bublis
-
-Permission is hereby granted, free of charge, to any person obtaining
-a copy of this software and associated documentation files (the
-"Software"), to deal in the Software without restriction, including
-without limitation the rights to use, copy, modify, merge, publish,
-distribute, sublicense, and/or sell copies of the Software, and to
-permit persons to whom the Software is furnished to do so, subject to
-the following conditions:
-
-The above copyright notice and this permission notice shall be
-included in all copies or substantial portions of the Software.
-
-THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
-WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
diff --git a/vendor/github.com/satori/go.uuid/README.md b/vendor/github.com/satori/go.uuid/README.md
deleted file mode 100644
index 48d4937f..00000000
--- a/vendor/github.com/satori/go.uuid/README.md
+++ /dev/null
@@ -1,66 +0,0 @@
-# UUID package for Go language
-
-[![Build Status](https://travis-ci.org/satori/go.uuid.png?branch=master)](https://travis-ci.org/satori/go.uuid)
-[![GoDoc](http://godoc.org/github.com/satori/go.uuid?status.png)](http://godoc.org/github.com/satori/go.uuid)
-
-This package provides pure Go implementation of Universally Unique Identifier (UUID). Supported both creation and parsing of UUIDs.
-
-With 100% test coverage and benchmarks out of box.
-
-Supported versions:
-* Version 1, based on timestamp and MAC address (RFC 4122)
-* Version 2, based on timestamp, MAC address and POSIX UID/GID (DCE 1.1)
-* Version 3, based on MD5 hashing (RFC 4122)
-* Version 4, based on random numbers (RFC 4122)
-* Version 5, based on SHA-1 hashing (RFC 4122)
-
-## Installation
-
-Use the `go` command:
-
- $ go get github.com/satori/go.uuid
-
-## Requirements
-
-UUID package requires any stable version of Go Programming Language.
-
-It is tested against following versions of Go: 1.0-1.5
-
-## Example
-
-```go
-package main
-
-import (
- "fmt"
- "github.com/satori/go.uuid"
-)
-
-func main() {
- // Creating UUID Version 4
- u1 := uuid.NewV4()
- fmt.Printf("UUIDv4: %s\n", u1)
-
- // Parsing UUID from string input
- u2, err := uuid.FromString("6ba7b810-9dad-11d1-80b4-00c04fd430c8")
- if err != nil {
- fmt.Printf("Something gone wrong: %s", err)
- }
- fmt.Printf("Successfully parsed: %s", u2)
-}
-```
-
-## Documentation
-
-[Documentation](http://godoc.org/github.com/satori/go.uuid) is hosted at GoDoc project.
-
-## Links
-* [RFC 4122](http://tools.ietf.org/html/rfc4122)
-* [DCE 1.1: Authentication and Security Services](http://pubs.opengroup.org/onlinepubs/9696989899/chap5.htm#tagcjh_08_02_01_01)
-
-## Copyright
-
-Copyright (C) 2013-2015 by Maxim Bublis .
-
-UUID package released under MIT License.
-See [LICENSE](https://github.com/satori/go.uuid/blob/master/LICENSE) for details.
diff --git a/vendor/github.com/satori/go.uuid/uuid.go b/vendor/github.com/satori/go.uuid/uuid.go
deleted file mode 100644
index 03841d86..00000000
--- a/vendor/github.com/satori/go.uuid/uuid.go
+++ /dev/null
@@ -1,435 +0,0 @@
-// Copyright (C) 2013-2015 by Maxim Bublis
-//
-// Permission is hereby granted, free of charge, to any person obtaining
-// a copy of this software and associated documentation files (the
-// "Software"), to deal in the Software without restriction, including
-// without limitation the rights to use, copy, modify, merge, publish,
-// distribute, sublicense, and/or sell copies of the Software, and to
-// permit persons to whom the Software is furnished to do so, subject to
-// the following conditions:
-//
-// The above copyright notice and this permission notice shall be
-// included in all copies or substantial portions of the Software.
-//
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
-// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-
-// Package uuid provides implementation of Universally Unique Identifier (UUID).
-// Supported versions are 1, 3, 4 and 5 (as specified in RFC 4122) and
-// version 2 (as specified in DCE 1.1).
-package uuid
-
-import (
- "bytes"
- "crypto/md5"
- "crypto/rand"
- "crypto/sha1"
- "database/sql/driver"
- "encoding/binary"
- "encoding/hex"
- "fmt"
- "hash"
- "net"
- "os"
- "sync"
- "time"
-)
-
-// UUID layout variants.
-const (
- VariantNCS = iota
- VariantRFC4122
- VariantMicrosoft
- VariantFuture
-)
-
-// UUID DCE domains.
-const (
- DomainPerson = iota
- DomainGroup
- DomainOrg
-)
-
-// Difference in 100-nanosecond intervals between
-// UUID epoch (October 15, 1582) and Unix epoch (January 1, 1970).
-const epochStart = 122192928000000000
-
-// Used in string method conversion
-const dash byte = '-'
-
-// UUID v1/v2 storage.
-var (
- storageMutex sync.Mutex
- storageOnce sync.Once
- epochFunc = unixTimeFunc
- clockSequence uint16
- lastTime uint64
- hardwareAddr [6]byte
- posixUID = uint32(os.Getuid())
- posixGID = uint32(os.Getgid())
-)
-
-// String parse helpers.
-var (
- urnPrefix = []byte("urn:uuid:")
- byteGroups = []int{8, 4, 4, 4, 12}
-)
-
-func initClockSequence() {
- buf := make([]byte, 2)
- safeRandom(buf)
- clockSequence = binary.BigEndian.Uint16(buf)
-}
-
-func initHardwareAddr() {
- interfaces, err := net.Interfaces()
- if err == nil {
- for _, iface := range interfaces {
- if len(iface.HardwareAddr) >= 6 {
- copy(hardwareAddr[:], iface.HardwareAddr)
- return
- }
- }
- }
-
- // Initialize hardwareAddr randomly in case
- // of real network interfaces absence
- safeRandom(hardwareAddr[:])
-
- // Set multicast bit as recommended in RFC 4122
- hardwareAddr[0] |= 0x01
-}
-
-func initStorage() {
- initClockSequence()
- initHardwareAddr()
-}
-
-func safeRandom(dest []byte) {
- if _, err := rand.Read(dest); err != nil {
- panic(err)
- }
-}
-
-// Returns difference in 100-nanosecond intervals between
-// UUID epoch (October 15, 1582) and current time.
-// This is default epoch calculation function.
-func unixTimeFunc() uint64 {
- return epochStart + uint64(time.Now().UnixNano()/100)
-}
-
-// UUID representation compliant with specification
-// described in RFC 4122.
-type UUID [16]byte
-
-// The nil UUID is special form of UUID that is specified to have all
-// 128 bits set to zero.
-var Nil = UUID{}
-
-// Predefined namespace UUIDs.
-var (
- NamespaceDNS, _ = FromString("6ba7b810-9dad-11d1-80b4-00c04fd430c8")
- NamespaceURL, _ = FromString("6ba7b811-9dad-11d1-80b4-00c04fd430c8")
- NamespaceOID, _ = FromString("6ba7b812-9dad-11d1-80b4-00c04fd430c8")
- NamespaceX500, _ = FromString("6ba7b814-9dad-11d1-80b4-00c04fd430c8")
-)
-
-// And returns result of binary AND of two UUIDs.
-func And(u1 UUID, u2 UUID) UUID {
- u := UUID{}
- for i := 0; i < 16; i++ {
- u[i] = u1[i] & u2[i]
- }
- return u
-}
-
-// Or returns result of binary OR of two UUIDs.
-func Or(u1 UUID, u2 UUID) UUID {
- u := UUID{}
- for i := 0; i < 16; i++ {
- u[i] = u1[i] | u2[i]
- }
- return u
-}
-
-// Equal returns true if u1 and u2 equals, otherwise returns false.
-func Equal(u1 UUID, u2 UUID) bool {
- return bytes.Equal(u1[:], u2[:])
-}
-
-// Version returns algorithm version used to generate UUID.
-func (u UUID) Version() uint {
- return uint(u[6] >> 4)
-}
-
-// Variant returns UUID layout variant.
-func (u UUID) Variant() uint {
- switch {
- case (u[8] & 0x80) == 0x00:
- return VariantNCS
- case (u[8]&0xc0)|0x80 == 0x80:
- return VariantRFC4122
- case (u[8]&0xe0)|0xc0 == 0xc0:
- return VariantMicrosoft
- }
- return VariantFuture
-}
-
-// Bytes returns bytes slice representation of UUID.
-func (u UUID) Bytes() []byte {
- return u[:]
-}
-
-// Returns canonical string representation of UUID:
-// xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx.
-func (u UUID) String() string {
- buf := make([]byte, 36)
-
- hex.Encode(buf[0:8], u[0:4])
- buf[8] = dash
- hex.Encode(buf[9:13], u[4:6])
- buf[13] = dash
- hex.Encode(buf[14:18], u[6:8])
- buf[18] = dash
- hex.Encode(buf[19:23], u[8:10])
- buf[23] = dash
- hex.Encode(buf[24:], u[10:])
-
- return string(buf)
-}
-
-// SetVersion sets version bits.
-func (u *UUID) SetVersion(v byte) {
- u[6] = (u[6] & 0x0f) | (v << 4)
-}
-
-// SetVariant sets variant bits as described in RFC 4122.
-func (u *UUID) SetVariant() {
- u[8] = (u[8] & 0xbf) | 0x80
-}
-
-// MarshalText implements the encoding.TextMarshaler interface.
-// The encoding is the same as returned by String.
-func (u UUID) MarshalText() (text []byte, err error) {
- text = []byte(u.String())
- return
-}
-
-// UnmarshalText implements the encoding.TextUnmarshaler interface.
-// Following formats are supported:
-// "6ba7b810-9dad-11d1-80b4-00c04fd430c8",
-// "{6ba7b810-9dad-11d1-80b4-00c04fd430c8}",
-// "urn:uuid:6ba7b810-9dad-11d1-80b4-00c04fd430c8"
-func (u *UUID) UnmarshalText(text []byte) (err error) {
- if len(text) < 32 {
- err = fmt.Errorf("uuid: invalid UUID string: %s", text)
- return
- }
-
- if bytes.Equal(text[:9], urnPrefix) {
- text = text[9:]
- } else if text[0] == '{' {
- text = text[1:]
- }
-
- b := u[:]
-
- for _, byteGroup := range byteGroups {
- if text[0] == '-' {
- text = text[1:]
- }
-
- _, err = hex.Decode(b[:byteGroup/2], text[:byteGroup])
-
- if err != nil {
- return
- }
-
- text = text[byteGroup:]
- b = b[byteGroup/2:]
- }
-
- return
-}
-
-// MarshalBinary implements the encoding.BinaryMarshaler interface.
-func (u UUID) MarshalBinary() (data []byte, err error) {
- data = u.Bytes()
- return
-}
-
-// UnmarshalBinary implements the encoding.BinaryUnmarshaler interface.
-// It will return error if the slice isn't 16 bytes long.
-func (u *UUID) UnmarshalBinary(data []byte) (err error) {
- if len(data) != 16 {
- err = fmt.Errorf("uuid: UUID must be exactly 16 bytes long, got %d bytes", len(data))
- return
- }
- copy(u[:], data)
-
- return
-}
-
-// Value implements the driver.Valuer interface.
-func (u UUID) Value() (driver.Value, error) {
- return u.String(), nil
-}
-
-// Scan implements the sql.Scanner interface.
-// A 16-byte slice is handled by UnmarshalBinary, while
-// a longer byte slice or a string is handled by UnmarshalText.
-func (u *UUID) Scan(src interface{}) error {
- switch src := src.(type) {
- case []byte:
- if len(src) == 16 {
- return u.UnmarshalBinary(src)
- }
- return u.UnmarshalText(src)
-
- case string:
- return u.UnmarshalText([]byte(src))
- }
-
- return fmt.Errorf("uuid: cannot convert %T to UUID", src)
-}
-
-// FromBytes returns UUID converted from raw byte slice input.
-// It will return error if the slice isn't 16 bytes long.
-func FromBytes(input []byte) (u UUID, err error) {
- err = u.UnmarshalBinary(input)
- return
-}
-
-// FromBytesOrNil returns UUID converted from raw byte slice input.
-// Same behavior as FromBytes, but returns a Nil UUID on error.
-func FromBytesOrNil(input []byte) UUID {
- uuid, err := FromBytes(input)
- if err != nil {
- return Nil
- }
- return uuid
-}
-
-// FromString returns UUID parsed from string input.
-// Input is expected in a form accepted by UnmarshalText.
-func FromString(input string) (u UUID, err error) {
- err = u.UnmarshalText([]byte(input))
- return
-}
-
-// FromStringOrNil returns UUID parsed from string input.
-// Same behavior as FromString, but returns a Nil UUID on error.
-func FromStringOrNil(input string) UUID {
- uuid, err := FromString(input)
- if err != nil {
- return Nil
- }
- return uuid
-}
-
-// Returns UUID v1/v2 storage state.
-// Returns epoch timestamp, clock sequence, and hardware address.
-func getStorage() (uint64, uint16, []byte) {
- storageOnce.Do(initStorage)
-
- storageMutex.Lock()
- defer storageMutex.Unlock()
-
- timeNow := epochFunc()
- // Clock changed backwards since last UUID generation.
- // Should increase clock sequence.
- if timeNow <= lastTime {
- clockSequence++
- }
- lastTime = timeNow
-
- return timeNow, clockSequence, hardwareAddr[:]
-}
-
-// NewV1 returns UUID based on current timestamp and MAC address.
-func NewV1() UUID {
- u := UUID{}
-
- timeNow, clockSeq, hardwareAddr := getStorage()
-
- binary.BigEndian.PutUint32(u[0:], uint32(timeNow))
- binary.BigEndian.PutUint16(u[4:], uint16(timeNow>>32))
- binary.BigEndian.PutUint16(u[6:], uint16(timeNow>>48))
- binary.BigEndian.PutUint16(u[8:], clockSeq)
-
- copy(u[10:], hardwareAddr)
-
- u.SetVersion(1)
- u.SetVariant()
-
- return u
-}
-
-// NewV2 returns DCE Security UUID based on POSIX UID/GID.
-func NewV2(domain byte) UUID {
- u := UUID{}
-
- timeNow, clockSeq, hardwareAddr := getStorage()
-
- switch domain {
- case DomainPerson:
- binary.BigEndian.PutUint32(u[0:], posixUID)
- case DomainGroup:
- binary.BigEndian.PutUint32(u[0:], posixGID)
- }
-
- binary.BigEndian.PutUint16(u[4:], uint16(timeNow>>32))
- binary.BigEndian.PutUint16(u[6:], uint16(timeNow>>48))
- binary.BigEndian.PutUint16(u[8:], clockSeq)
- u[9] = domain
-
- copy(u[10:], hardwareAddr)
-
- u.SetVersion(2)
- u.SetVariant()
-
- return u
-}
-
-// NewV3 returns UUID based on MD5 hash of namespace UUID and name.
-func NewV3(ns UUID, name string) UUID {
- u := newFromHash(md5.New(), ns, name)
- u.SetVersion(3)
- u.SetVariant()
-
- return u
-}
-
-// NewV4 returns random generated UUID.
-func NewV4() UUID {
- u := UUID{}
- safeRandom(u[:])
- u.SetVersion(4)
- u.SetVariant()
-
- return u
-}
-
-// NewV5 returns UUID based on SHA-1 hash of namespace UUID and name.
-func NewV5(ns UUID, name string) UUID {
- u := newFromHash(sha1.New(), ns, name)
- u.SetVersion(5)
- u.SetVariant()
-
- return u
-}
-
-// Returns UUID based on hashing of namespace UUID and name.
-func newFromHash(h hash.Hash, ns UUID, name string) UUID {
- u := UUID{}
- h.Write(ns[:])
- h.Write([]byte(name))
- copy(u[:], h.Sum(nil))
-
- return u
-}
diff --git a/vendor/github.com/svanharmelen/gocs/.gitignore b/vendor/github.com/svanharmelen/gocs/.gitignore
deleted file mode 100644
index 00268614..00000000
--- a/vendor/github.com/svanharmelen/gocs/.gitignore
+++ /dev/null
@@ -1,22 +0,0 @@
-# Compiled Object files, Static and Dynamic libs (Shared Objects)
-*.o
-*.a
-*.so
-
-# Folders
-_obj
-_test
-
-# Architecture specific extensions/prefixes
-*.[568vq]
-[568vq].out
-
-*.cgo1.go
-*.cgo2.c
-_cgo_defun.c
-_cgo_gotypes.go
-_cgo_export.*
-
-_testmain.go
-
-*.exe
diff --git a/vendor/github.com/svanharmelen/gocs/LICENSE b/vendor/github.com/svanharmelen/gocs/LICENSE
deleted file mode 100644
index e06d2081..00000000
--- a/vendor/github.com/svanharmelen/gocs/LICENSE
+++ /dev/null
@@ -1,202 +0,0 @@
-Apache License
- Version 2.0, January 2004
- http://www.apache.org/licenses/
-
- TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
-
- 1. Definitions.
-
- "License" shall mean the terms and conditions for use, reproduction,
- and distribution as defined by Sections 1 through 9 of this document.
-
- "Licensor" shall mean the copyright owner or entity authorized by
- the copyright owner that is granting the License.
-
- "Legal Entity" shall mean the union of the acting entity and all
- other entities that control, are controlled by, or are under common
- control with that entity. For the purposes of this definition,
- "control" means (i) the power, direct or indirect, to cause the
- direction or management of such entity, whether by contract or
- otherwise, or (ii) ownership of fifty percent (50%) or more of the
- outstanding shares, or (iii) beneficial ownership of such entity.
-
- "You" (or "Your") shall mean an individual or Legal Entity
- exercising permissions granted by this License.
-
- "Source" form shall mean the preferred form for making modifications,
- including but not limited to software source code, documentation
- source, and configuration files.
-
- "Object" form shall mean any form resulting from mechanical
- transformation or translation of a Source form, including but
- not limited to compiled object code, generated documentation,
- and conversions to other media types.
-
- "Work" shall mean the work of authorship, whether in Source or
- Object form, made available under the License, as indicated by a
- copyright notice that is included in or attached to the work
- (an example is provided in the Appendix below).
-
- "Derivative Works" shall mean any work, whether in Source or Object
- form, that is based on (or derived from) the Work and for which the
- editorial revisions, annotations, elaborations, or other modifications
- represent, as a whole, an original work of authorship. For the purposes
- of this License, Derivative Works shall not include works that remain
- separable from, or merely link (or bind by name) to the interfaces of,
- the Work and Derivative Works thereof.
-
- "Contribution" shall mean any work of authorship, including
- the original version of the Work and any modifications or additions
- to that Work or Derivative Works thereof, that is intentionally
- submitted to Licensor for inclusion in the Work by the copyright owner
- or by an individual or Legal Entity authorized to submit on behalf of
- the copyright owner. For the purposes of this definition, "submitted"
- means any form of electronic, verbal, or written communication sent
- to the Licensor or its representatives, including but not limited to
- communication on electronic mailing lists, source code control systems,
- and issue tracking systems that are managed by, or on behalf of, the
- Licensor for the purpose of discussing and improving the Work, but
- excluding communication that is conspicuously marked or otherwise
- designated in writing by the copyright owner as "Not a Contribution."
-
- "Contributor" shall mean Licensor and any individual or Legal Entity
- on behalf of whom a Contribution has been received by Licensor and
- subsequently incorporated within the Work.
-
- 2. Grant of Copyright License. Subject to the terms and conditions of
- this License, each Contributor hereby grants to You a perpetual,
- worldwide, non-exclusive, no-charge, royalty-free, irrevocable
- copyright license to reproduce, prepare Derivative Works of,
- publicly display, publicly perform, sublicense, and distribute the
- Work and such Derivative Works in Source or Object form.
-
- 3. Grant of Patent License. Subject to the terms and conditions of
- this License, each Contributor hereby grants to You a perpetual,
- worldwide, non-exclusive, no-charge, royalty-free, irrevocable
- (except as stated in this section) patent license to make, have made,
- use, offer to sell, sell, import, and otherwise transfer the Work,
- where such license applies only to those patent claims licensable
- by such Contributor that are necessarily infringed by their
- Contribution(s) alone or by combination of their Contribution(s)
- with the Work to which such Contribution(s) was submitted. If You
- institute patent litigation against any entity (including a
- cross-claim or counterclaim in a lawsuit) alleging that the Work
- or a Contribution incorporated within the Work constitutes direct
- or contributory patent infringement, then any patent licenses
- granted to You under this License for that Work shall terminate
- as of the date such litigation is filed.
-
- 4. Redistribution. You may reproduce and distribute copies of the
- Work or Derivative Works thereof in any medium, with or without
- modifications, and in Source or Object form, provided that You
- meet the following conditions:
-
- (a) You must give any other recipients of the Work or
- Derivative Works a copy of this License; and
-
- (b) You must cause any modified files to carry prominent notices
- stating that You changed the files; and
-
- (c) You must retain, in the Source form of any Derivative Works
- that You distribute, all copyright, patent, trademark, and
- attribution notices from the Source form of the Work,
- excluding those notices that do not pertain to any part of
- the Derivative Works; and
-
- (d) If the Work includes a "NOTICE" text file as part of its
- distribution, then any Derivative Works that You distribute must
- include a readable copy of the attribution notices contained
- within such NOTICE file, excluding those notices that do not
- pertain to any part of the Derivative Works, in at least one
- of the following places: within a NOTICE text file distributed
- as part of the Derivative Works; within the Source form or
- documentation, if provided along with the Derivative Works; or,
- within a display generated by the Derivative Works, if and
- wherever such third-party notices normally appear. The contents
- of the NOTICE file are for informational purposes only and
- do not modify the License. You may add Your own attribution
- notices within Derivative Works that You distribute, alongside
- or as an addendum to the NOTICE text from the Work, provided
- that such additional attribution notices cannot be construed
- as modifying the License.
-
- You may add Your own copyright statement to Your modifications and
- may provide additional or different license terms and conditions
- for use, reproduction, or distribution of Your modifications, or
- for any such Derivative Works as a whole, provided Your use,
- reproduction, and distribution of the Work otherwise complies with
- the conditions stated in this License.
-
- 5. Submission of Contributions. Unless You explicitly state otherwise,
- any Contribution intentionally submitted for inclusion in the Work
- by You to the Licensor shall be under the terms and conditions of
- this License, without any additional terms or conditions.
- Notwithstanding the above, nothing herein shall supersede or modify
- the terms of any separate license agreement you may have executed
- with Licensor regarding such Contributions.
-
- 6. Trademarks. This License does not grant permission to use the trade
- names, trademarks, service marks, or product names of the Licensor,
- except as required for reasonable and customary use in describing the
- origin of the Work and reproducing the content of the NOTICE file.
-
- 7. Disclaimer of Warranty. Unless required by applicable law or
- agreed to in writing, Licensor provides the Work (and each
- Contributor provides its Contributions) on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
- implied, including, without limitation, any warranties or conditions
- of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
- PARTICULAR PURPOSE. You are solely responsible for determining the
- appropriateness of using or redistributing the Work and assume any
- risks associated with Your exercise of permissions under this License.
-
- 8. Limitation of Liability. In no event and under no legal theory,
- whether in tort (including negligence), contract, or otherwise,
- unless required by applicable law (such as deliberate and grossly
- negligent acts) or agreed to in writing, shall any Contributor be
- liable to You for damages, including any direct, indirect, special,
- incidental, or consequential damages of any character arising as a
- result of this License or out of the use or inability to use the
- Work (including but not limited to damages for loss of goodwill,
- work stoppage, computer failure or malfunction, or any and all
- other commercial damages or losses), even if such Contributor
- has been advised of the possibility of such damages.
-
- 9. Accepting Warranty or Additional Liability. While redistributing
- the Work or Derivative Works thereof, You may choose to offer,
- and charge a fee for, acceptance of support, warranty, indemnity,
- or other liability obligations and/or rights consistent with this
- License. However, in accepting such obligations, You may act only
- on Your own behalf and on Your sole responsibility, not on behalf
- of any other Contributor, and only if You agree to indemnify,
- defend, and hold each Contributor harmless for any liability
- incurred by, or claims asserted against, such Contributor by reason
- of your accepting any such warranty or additional liability.
-
- END OF TERMS AND CONDITIONS
-
- APPENDIX: How to apply the Apache License to your work.
-
- To apply the Apache License to your work, attach the following
- boilerplate notice, with the fields enclosed by brackets "{}"
- replaced with your own identifying information. (Don't include
- the brackets!) The text should be enclosed in the appropriate
- comment syntax for the file format. We also recommend that a
- file or class name and description of purpose be included on the
- same "printed page" as the copyright notice for easier
- identification within third-party archives.
-
- Copyright {yyyy} {name of copyright owner}
-
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
-
diff --git a/vendor/github.com/svanharmelen/gocs/README.md b/vendor/github.com/svanharmelen/gocs/README.md
deleted file mode 100644
index 33e46f7e..00000000
--- a/vendor/github.com/svanharmelen/gocs/README.md
+++ /dev/null
@@ -1,30 +0,0 @@
-# gocs
-
-gocs is a CloudStack client that enables Go programs to interact with the CloudStack API in a simple and uniform way.
-The package itself is smart enough to learn the available CloudStack API commands and the required and optional
-parameters of all available commands (using the listApis command), so it can be used with any given version of
-CloudStack.
-
-Based on the processed info about all available commands and their details, the request functions will check
-if all required parameters have a value and if all other used parameters are valid parameters for the requested
-command before actually passing the request to the API. In case of any errors during this validation or when
-executing the actual request, detailed error info will be returned to the requesting function making it very
-easy to understand and fix the problem.
-
-
-## Usage
-
-Install/Update the Go package:
-```
-go get -u github.com/svanharmelen/gocs
-```
-
-Add this to your Go program:
-```
-import "github.com/svanharmelen/gocs"
-```
-
-
-## Documentation
-
-Package documentation is dynamically generated from the source code at [GoDoc](http://godoc.org/github.com/svanharmelen/gocs)
diff --git a/vendor/github.com/svanharmelen/gocs/cache.go b/vendor/github.com/svanharmelen/gocs/cache.go
deleted file mode 100644
index 8f99293a..00000000
--- a/vendor/github.com/svanharmelen/gocs/cache.go
+++ /dev/null
@@ -1,103 +0,0 @@
-//
-// Copyright 2014, Sander van Harmelen
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-//
-
-package gocs
-
-import (
- "encoding/gob"
- "net/url"
- "os"
- "path"
- "strings"
- "time"
-
- "github.com/mitchellh/osext"
-)
-
-var cacheFile string
-
-func setCacheFile() error {
- if cacheFile == "" {
- exe, err := osext.Executable()
- if err != nil {
- return err
- }
- strings.TrimSuffix(exe, path.Ext(exe))
- cacheFile = exe + ".cache"
- }
- return nil
-}
-
-// Updates (or creates) a cache containing the API's structure
-func cacheAPICommands(cs *CloudStackClient, cacheExpirationInDays int) (err error) {
- if cacheExpirationInDays > 0 {
- if err := setCacheFile(); err != nil {
- return err
- }
- beforeDate := time.Date(time.Now().Year(), time.Now().Month(), time.Now().Day()-cacheExpirationInDays, time.Now().Hour(), time.Now().Minute(), time.Now().Second(), time.Now().Nanosecond(), time.Local)
- if fileInfo, err := os.Stat(cacheFile); err != nil || fileInfo.ModTime().Before(beforeDate) {
- if err := updateAPICommandFile(cs); err != nil {
- return err
- }
- }
- cs.apiCommands, err = readAPICommandFile(cs)
- } else {
- cs.apiCommands, err = requestAPICommands(cs)
- }
- return
-}
-
-func readAPICommandFile(cs *CloudStackClient) (commands, error) {
- reader, err := os.Open(cacheFile)
- if err != nil {
- return nil, err
- }
- defer reader.Close()
-
- decoder := gob.NewDecoder(reader)
- var apiCommands commands
- if err := decoder.Decode(&apiCommands); err != nil {
- return nil, err
- }
- return apiCommands, nil
-}
-
-// Calls newRequest() directly as there is no cache yet, so it's not
-// possible to check and verify this call which is done by the exported
-// request functions
-func requestAPICommands(cs *CloudStackClient) (commands, error) {
- rawJSON, err := newRequest(cs, &command{Name: "listApis"}, url.Values{})
- if err != nil {
- return nil, err
- }
- return unmarshalApiCommands(rawJSON)
-}
-
-func updateAPICommandFile(cs *CloudStackClient) error {
- result, err := requestAPICommands(cs)
- if err != nil {
- return err
- }
-
- writer, err := os.Create(cacheFile)
- if err != nil {
- return err
- }
- defer writer.Close()
-
- encoder := gob.NewEncoder(writer)
- return encoder.Encode(result)
-}
diff --git a/vendor/github.com/svanharmelen/gocs/doc.go b/vendor/github.com/svanharmelen/gocs/doc.go
deleted file mode 100644
index f84ab394..00000000
--- a/vendor/github.com/svanharmelen/gocs/doc.go
+++ /dev/null
@@ -1,108 +0,0 @@
-//gocs is a CloudStack client that enables Go programs to interact with the CloudStack API in a simple and uniform way.
-//The package itself is smart enough to learn the available CloudStack API commands and the required and optional
-//parameters of all available commands (using the listApis command), so it can be used with any given version of
-//CloudStack.
-//
-//Based on the processed info about all available commands and their details, the request functions will check
-//if all required parameters have a value and if all other used parameters are valid parameters for the requested
-//command before actually passing the request to the API. In case of any errors during this validation or when
-//executing the actual request, detailed error info will be returned to the requesting function making it very
-//easy to understand and fix the problem.
-//
-//A usefull (BETA!) feature when making API requests is that the request functions are able to retieve ID's for parameters
-//that need an ID of some kind (e.g. virtualmachine, zone) instead of a name. Every parameter that ends with 'id' can also
-//be used as a parameter without the 'id' and a value that is a name rather than an ID. In those cases the request
-//functions will take care of retrieving all the needed ID's for you.
-//
-//NOTE: This only works when the list command for the needed ID (e.g. listVirtualMachines, listZones) doesn't require
-//additional parameters like the listTemplates does, and (again) it's still a BETA functionality. When the list command
-//contains required parameters you would still need to make a call yourself supplying the correct values. And again, this
-//is still, and it's still BETA functionality
-//
-//See these two small snippets that show two ways to make the same call. Starting with the more elaborate one:
-//
-// // Original call using ID's, so need to retrieve all ID's first
-// serviceofferingid, err := cs.Request("listServiceOfferings", "name:small")
-// if err =! nil {
-// return err
-// }
-// templateid, err := cs.Request("listTemplates", "templatefilter:featured, name:Centos 6 x64")
-// if err =! nil {
-// return err
-// }
-// zoneid, err := cs.Request("listZones", "name:myzone")
-// if err =! nil {
-// return err
-// }
-// if id, err := cs.Request("deployVirtualMachine", fmt.Sprintf("serviceofferingid:%s, templateid:%s, zoneid:%s",
-// serviceofferingid, templateid, zoneid); err != nil {
-// return err
-// }
-// return id
-//
-//Followed by the easier one:
-//
-// // Easier call using only one additional call to retrieve the templateid
-// zoneid, err := cs.Request("listTemplates", "templatefilter:featured, name:Centos 6 x64")
-// if err =! nil {
-// return err
-// }
-// if id, err := cs.Request("deployVirtualMachine", fmt.Sprintf("serviceoffering:small, templateid:%s,
-// zone:my zone", id)); err != nil {
-// return err
-// }
-// return id
-//
-//
-//The response you get from a request is determined by the type of request you are using. When using a normal
-//request the function returns only an ID (if the command itself returns an ID of course) or an empty string.
-//Additionally you can use a 'raw' request to get the complete raw JSON received from the API. In the latter
-//case unmarshalling can be done using a custom struct that matches the response of the called command that
-//fits the needs of the program using this package.
-//
-//The example below shows how to use the package in a very simple commandline utility. The demo utility
-//uses a caching client and a raw synced request which waits for async calls to finish and returns the raw
-//JSON response as output:
-//
-// package main
-//
-// import (
-// "github.com/svanharmelen/gocs"
-// "fmt"
-// "log"
-// "os"
-// "path"
-// "strings"
-// )
-//
-// // Off course you better not do this in an actual program :)
-// const (
-// apiurl = "https://cloudstack.url/client/api"
-// apikey = "xxx"
-// secret = "xxx"
-// )
-//
-// func main() {
-// if len(os.Args) == 1 || os.Args[1] == "-h" || os.Args[1] == "--help" {
-// fmt.Printf("Usage: %s command \n", path.Base(os.Args[0]))
-// os.Exit(1)
-// }
-//
-// // Create a new caching client
-// cs, err := gocs.NewCachingClient(apiurl, apikey, secret, 1, false)
-// if err != nil {
-// log.Fatal(err)
-// }
-//
-// // Get the command and join all 'parameter:value' pairs into one comma separated string
-// command := os.Args[1]
-// params := strings.Join(os.Args[2:], ",")
-//
-// // Make a raw, but synced request
-// response, err := cs.RawSyncedRequest(command, params)
-// if err != nil {
-// log.Fatal(err)
-// }
-// fmt.Println(string(response))
-// }
-package gocs
diff --git a/vendor/github.com/svanharmelen/gocs/gocs.go b/vendor/github.com/svanharmelen/gocs/gocs.go
deleted file mode 100644
index aae994b2..00000000
--- a/vendor/github.com/svanharmelen/gocs/gocs.go
+++ /dev/null
@@ -1,252 +0,0 @@
-//
-// Copyright 2014, Sander van Harmelen
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-//
-
-package gocs
-
-import (
- "crypto/hmac"
- "crypto/sha1"
- "crypto/tls"
- "encoding/base64"
- "encoding/json"
- "fmt"
- "io/ioutil"
- "net/http"
- "net/url"
- "strings"
- "time"
-)
-
-type commands map[string]*command
-
-type CloudStackClient struct {
- client *http.Client // The http client for communicating
- apiCommands commands // All available API commands
- baseURL string // The base URL of the API
- apiKey string // Api key
- secret string // Secret key
- timeout int64 // Max waiting timeout in seconds for async jobs to finish; defaults to 60 seconds
-}
-
-// Creates a new client for communicating with CloudStack
-func newClient(apiurl string, apikey string, secret string, verifyssl bool) *CloudStackClient {
- cs := CloudStackClient{
- client: &http.Client{
- Transport: &http.Transport{
- Proxy: http.ProxyFromEnvironment,
- TLSClientConfig: &tls.Config{InsecureSkipVerify: !verifyssl}, // If verifyssl is true, skipping the verify should be false and vice versa
- },
- },
- baseURL: apiurl,
- apiKey: apikey,
- secret: secret,
- timeout: 60,
- }
- return &cs
-}
-
-// Creates a new non-caching CloudStack client that doesn't use any local cache for the API command info. This means that every request
-// made using this client will result in (at least) 2 calls to the API. The first one will retrieve and process all available commands
-// (including their details like required and optional parameters) and the second one will be the actual request. In between the
-// retrieved API command info will be used to validate the request before actually executing it.
-//
-// When using HTTPS with a self-signed certificate to connect to your CloudStack API, you would probably want to set 'verifyssl' to
-// false so the call ignores the SSL errors/warnings.
-func NewClient(apiurl string, apikey string, secret string, verifyssl bool) (*CloudStackClient, error) {
- cs := newClient(apiurl, apikey, secret, verifyssl)
- err := cacheAPICommands(cs, 0)
- return cs, err
-}
-
-// Creates a new caching CloudStack client which uses a local cache file for the API command info which in turn is used to validate a
-// request before executing it. The 'cacheExpirationInDays' parameter is used to determine when the cache needs to be updated. It's
-// recommended to always use this client when working with a (more or less) stable CloudStack environment as using this client will speed
-// up requests considerably and will prevent unnecessary load on the API server. When you are developing agains multiple versions of
-// CloudStack or if you are using this package as part of a tool/program to migrate or update CloudStack, it's probably a good idea to
-// use the non-caching client instead.
-//
-// When using HTTPS with a self-signed certificate to connect to your CloudStack API, you would probably want to set 'verifyssl' to
-// false so the call ignores the SSL errors/warnings.
-func NewCachingClient(apiurl string, apikey string, secret string, cacheExpirationInDays int, verifyssl bool) (*CloudStackClient, error) {
- cs := newClient(apiurl, apikey, secret, verifyssl)
- err := cacheAPICommands(cs, cacheExpirationInDays)
- return cs, err
-}
-
-// When using a synced request the function will wait for the async call to finish before returning. The default is to poll for 60
-// seconds, to check if the async job is finished. If the job is not finished within this time, the async job details will be returned
-// instead of the actual result of the async command requested. Using this method you can tweak the timeout to fit your needs.
-func (cs *CloudStackClient) AsyncTimeout(timeoutInSeconds int64) {
- cs.timeout = timeoutInSeconds
-}
-
-// Executes a raw request after checking and verifing the command and parameters first. The parameters can be passed as a string or
-// as a map[string]string. In the latter case the keys of the map are treated as the parameter names and the values as, well, the values :)
-// When sending the parameters as a single string, it needs to have the following format: "param1:value1, param2:value with space2,
-// param3:value3". The return value of a successful raw request is always the raw JSON that is received as response from the API and nil.
-// The return value of a failed raw request is nil and a detailed error describing the problem.
-func (cs *CloudStackClient) RawRequest(command string, params interface{}) (json.RawMessage, error) {
- cmd, found := cs.apiCommands[strings.ToLower(command)]
- if !found {
- return nil, fmt.Errorf("'%s' is not a valid CloudStack command", command)
- }
- parms, err := processParams(cs, cmd, params)
- if err != nil {
- return nil, err
- }
- return newRequest(cs, cmd, parms)
-}
-
-// Executes a request after checking and verifing the command and parameters first. The parameters can be passed as a string or
-// as a map[string]string. In the latter case the keys of the map are treated as the parameter names and the values as, well,
-// the values :) When sending the parameters as a single string, it needs to have the following format: "param1:value1,
-// param2:value with space2, param3:value3". The return value of a successful request is either a single string representing the
-// returned ID or an empty string when the requested command doesn't return an ID and nil. The return value of a failed request
-// is an empty string and a detailed error describing the problem. So you would definitely want to check the returned error
-// value here to determine if the call was successful or not.
-func (cs *CloudStackClient) Request(command string, params interface{}) (string, error) {
- rawJSON, err := cs.RawRequest(command, params)
- if err != nil {
- return "", err
- }
- cmd := cs.apiCommands[strings.ToLower(command)]
- if strings.HasPrefix(strings.ToLower(cmd.Name), "list") {
- return unmarshalListId(strings.TrimSuffix(strings.TrimPrefix(strings.ToLower(cmd.Name), "list"), "s"), rawJSON)
- }
- if cmd.ReturnsAnId {
- return unmarshalId(strings.ToLower(cmd.Name), rawJSON)
- }
- return "", nil
-}
-
-// For sync API commands this function behaves exactly the same as a standard RawRequest() call, but for async API commands
-// this function will wait until the async job is finished or until the configured AsyncTimeout is reached. When the async
-// job finishes successfully it will return the raw JSON response received from the API and nil, but when the timout is
-// reached it will return nil and an error containing the async job ID for the running job.
-func (cs *CloudStackClient) RawSyncedRequest(command string, params interface{}) (json.RawMessage, error) {
- rawJSON, err := cs.RawRequest(command, params)
- if err != nil {
- return nil, err
- }
- cmd := cs.apiCommands[strings.ToLower(command)]
- if cmd.Isasync {
- asyncJobResult, err := getAsyncJobResult(cs, rawJSON)
- if err != nil {
- return nil, err
- }
- if asyncJobResult.Jobstatus == 2 {
- if asyncJobResult.Jobresulttype == "text" {
- return nil, fmt.Errorf(string(asyncJobResult.Jobresult))
- } else {
- return nil, fmt.Errorf("Undefined error: %s", string(asyncJobResult.Jobresult))
- }
- }
- return asyncJobResult.Jobresult, nil
- }
- return rawJSON, nil
-}
-
-// For sync API commands this function behaves exactly the same as a standard Request() call, but for async API commands
-// this function will wait until the async job is finished or until the configured AsyncTimeout is reached. When the async
-// job finishes successfully it will return the ID or an empty string when the requested command doesn't return an ID and
-// nil. When the timout is reached it will return an empty string and an error containing the async job ID for the running job.
-func (cs *CloudStackClient) SyncedRequest(command string, params interface{}) (string, error) {
- rawJSON, err := cs.RawSyncedRequest(command, params)
- if err != nil {
- return "", err
- }
- cmd := cs.apiCommands[strings.ToLower(command)]
- if strings.HasPrefix(strings.ToLower(cmd.Name), "list") {
- return unmarshalListId(strings.TrimSuffix(strings.TrimPrefix(strings.ToLower(cmd.Name), "list"), "s"), rawJSON)
- }
- if cmd.ReturnsAnId {
- return unmarshalId(strings.ToLower(cmd.Name), rawJSON)
- }
- return "", nil
-}
-
-func getAsyncJobResult(cs *CloudStackClient, rawJSON json.RawMessage) (*asyncJobResult, error) {
- result, err := unmarshalAsyncResponse(rawJSON)
- if err != nil {
- return nil, err
- }
- currentTime := time.Now().Unix()
- for {
- rawJSON, err := cs.RawRequest("queryAsyncJobResult", fmt.Sprintf("jobid:%s", result.Jobid))
- if err != nil {
- return nil, err
- }
- jobResult, err := unmarshalAsyncJobResponse(rawJSON)
- if err != nil {
- return nil, err
- }
- if jobResult.Jobstatus > 0 {
- return jobResult, nil
- }
- if time.Now().Unix()-currentTime > cs.timeout {
- return nil, fmt.Errorf("Timeout while waiting for async job to finish (jobid:%s)", result.Jobid)
- }
- time.Sleep(3 * time.Second)
- }
-}
-
-// Execute the request against a CS API. Will return the raw JSON data returned by the API and nil if
-// no error occured. If the API returns an error the result will be nil and the HTTP error code and CS
-// error details. If a processing (code) error occurs the result will be nil and the generated error
-func newRequest(cs *CloudStackClient, cmd *command, params url.Values) (json.RawMessage, error) {
- client := cs.client
-
- params.Set("apikey", cs.apiKey)
- params.Set("command", cmd.Name)
- params.Set("response", "json")
-
- // Generate signature for API call
- // * Serialize parameters and sort them by key, done by Encode
- // * Convert the entire argument string to lowercase
- // * Replace all instances of '+' to '%20'
- // * Calculate HMAC SHA1 of argument string with CloudStack secret
- // * URL encode the string and convert to base64
- s := params.Encode()
- s2 := strings.ToLower(s)
- s3 := strings.Replace(s2, "+", "%20", -1)
- mac := hmac.New(sha1.New, []byte(cs.secret))
- mac.Write([]byte(s3))
- signature := base64.StdEncoding.EncodeToString(mac.Sum(nil))
- signature = url.QueryEscape(signature)
-
- // Create the final URL before we issue the request
- url := cs.baseURL + "?" + s + "&signature=" + signature
-
- resp, err := client.Get(url)
- if err != nil {
- return nil, err
- }
-
- rawJSON, err := ioutil.ReadAll(resp.Body)
- resp.Body.Close()
- if err != nil {
- return nil, err
- }
-
- if resp.StatusCode != 200 {
- errorInfo, err := unmarshalCsError(rawJSON)
- if err != nil {
- return nil, err
- }
- return nil, fmt.Errorf("CloudStack API error %d (CSExceptionErrorCode: %d): %s", errorInfo.Errorcode, errorInfo.CsErrorcode, errorInfo.Errortext)
- }
- return rawJSON, nil
-}
diff --git a/vendor/github.com/svanharmelen/gocs/params.go b/vendor/github.com/svanharmelen/gocs/params.go
deleted file mode 100644
index 36f9ee3b..00000000
--- a/vendor/github.com/svanharmelen/gocs/params.go
+++ /dev/null
@@ -1,134 +0,0 @@
-//
-// Copyright 2014, Sander van Harmelen
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-//
-
-package gocs
-
-import (
- "fmt"
- "net/url"
- "strings"
-)
-
-const (
- key = iota
- value
-)
-
-type csparams map[string]string
-
-// Return a checked url.Values value
-func processParams(cs *CloudStackClient, cmd *command, rawParams interface{}) (url.Values, error) {
- params, err := convertType(rawParams)
- if err != nil {
- return nil, err
- }
- if err := verifyRequiredParams(cs, cmd, ¶ms); err != nil {
- return nil, err
- }
- if err := verifyAllUsedParams(cs, cmd, ¶ms); err != nil {
- return nil, err
- }
- urlValues := url.Values{}
- for key, value := range params {
- urlValues.Set(key, value)
- }
- return urlValues, nil
-}
-
-func convertType(rawParams interface{}) (params csparams, err error) {
- switch rawParams.(type) {
- case string:
- params, err = parseParams(rawParams.(string))
- case map[string]string:
- params = csparams(rawParams.(map[string]string))
- default:
- return nil, fmt.Errorf("Wrong type: '%T'; only 'string' and 'map[string]string' are valid rawParams types", rawParams)
- }
- return
-}
-
-func parseParams(rawParams string) (csparams, error) {
- params := csparams{}
- if len(rawParams) == 0 {
- return params, nil
- }
- paramSlice := strings.Split(rawParams, ",")
- for _, paramSet := range paramSlice {
- keyValue := strings.SplitN(paramSet, ":", 2)
- if len(keyValue) != 2 || len(keyValue[value]) == 0 {
- return nil, fmt.Errorf("Error processing parameters around: ... %s ...", paramSet)
- }
- params[strings.ToLower(strings.Trim(strings.TrimSpace(keyValue[key]), `"`))] = strings.Trim(strings.TrimSpace(keyValue[value]), `"`)
- }
- return params, nil
-}
-
-// Test to see of all the required parameters are set
-func verifyRequiredParams(cs *CloudStackClient, cmd *command, rawParams *csparams) error {
- params := *rawParams
- for key := range cmd.RequiredParams {
- if _, found := params[key]; !found {
- if _, found := params[strings.TrimSuffix(key, "id")]; found {
- if err := convertToId(cs, strings.TrimSuffix(key, "id"), ¶ms); err != nil {
- return err
- }
- } else {
- return fmt.Errorf("Missing required parameter: %s", key)
- }
- }
- }
- return nil
-}
-
-// Test to see is all used parameters are valid parameters for the requested command
-func verifyAllUsedParams(cs *CloudStackClient, cmd *command, rawParams *csparams) error {
- params := *rawParams
- // Make a slice of keys to walk over, as we could be changing the params value
- // during the loop, if we find a key that needs to be resolved to an id
- keys := []string{}
- for key := range params {
- keys = append(keys, key)
- }
- for _, key := range keys {
- if _, found := cmd.RequiredParams[key]; !found {
- if _, found := cmd.OptionalParams[key]; !found {
- if _, found := cmd.OptionalParams[fmt.Sprintf("%sid", key)]; found {
- if err := convertToId(cs, key, ¶ms); err != nil {
- return err
- }
- } else {
- return fmt.Errorf("Parameter '%s' is not a valid parameter", key)
- }
- }
- }
- }
- return nil
-}
-
-func convertToId(cs *CloudStackClient, key string, rawParams *csparams) error {
- params := *rawParams
- rawJSON, err := cs.RawRequest(fmt.Sprintf("list%ss", key), fmt.Sprintf("name:%s", params[key]))
- if err != nil {
- return fmt.Errorf("Error trying to resolve the id for %s %s: %s", key, params[key], err)
- }
- id, err := unmarshalListId(key, rawJSON)
- if err != nil {
- return fmt.Errorf("Error trying to resolve the id for %s %s: %s", key, params[key], err)
- }
- delete(params, key)
- params[fmt.Sprintf("%sid", key)] = id
- return nil
-}
diff --git a/vendor/github.com/svanharmelen/gocs/unmarshaler.go b/vendor/github.com/svanharmelen/gocs/unmarshaler.go
deleted file mode 100644
index a261909b..00000000
--- a/vendor/github.com/svanharmelen/gocs/unmarshaler.go
+++ /dev/null
@@ -1,253 +0,0 @@
-//
-// Copyright 2014, Sander van Harmelen
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-//
-
-package gocs
-
-import (
- "encoding/json"
- "fmt"
- "strings"
-)
-
-type command struct {
- Name string
- Isasync bool
- ReturnsAnId bool
- RequiredParams map[string]*apiParam
- OptionalParams map[string]*apiParam
-}
-
-type apiCommand struct {
- Name string
- Isasync bool
- Params []*apiParam
- Response []*apiResponse
-}
-
-type apiParam struct {
- Name string
- Type string
- Required bool
-}
-
-type apiResponse struct {
- Name string
- Type string
- Value string
-}
-
-type csError struct {
- Errorcode int
- CsErrorcode int
- Errortext string
-}
-
-type asyncResult struct {
- Id string
- Jobid string
-}
-
-type asyncJobResult struct {
- Jobstatus float64
- Jobresulttype string
- Jobresult json.RawMessage
-}
-
-// Generic function to get the first value of a response as json.RawMessage
-func getRawValue(rawJSON json.RawMessage) (json.RawMessage, error) {
- var rawData map[string]json.RawMessage
- if err := json.Unmarshal(rawJSON, &rawData); err != nil {
- return nil, err
- }
- for _, rawValue := range rawData {
- return rawValue, nil
- }
- return nil, fmt.Errorf("Unable to extract the raw value from:\n\n%s\n\n", string(rawJSON))
-}
-
-func unmarshalCsError(rawJSON json.RawMessage) (*csError, error) {
- rawError, err := getRawValue(rawJSON)
- if err != nil {
- return nil, err
- }
- var errorInfo csError
- if err := json.Unmarshal(rawError, &errorInfo); err != nil {
- return nil, err
- }
- return &errorInfo, nil
-}
-
-func unmarshalListId(key string, rawJSON json.RawMessage) (string, error) {
- rawResponse, err := getRawValue(rawJSON)
- if err != nil {
- return "", err
- }
-
- var result map[string]json.RawMessage
- if err := json.Unmarshal(rawResponse, &result); err != nil {
- return "", err
- }
- rawResponse, found := result[key]
- if !found {
- return "", fmt.Errorf("Unable to find id in result: %v", result)
- }
-
- var id []struct{ Id string }
- if err := json.Unmarshal(rawResponse, &id); err != nil {
- return "", err
- }
- if len(id) > 1 {
- return "", fmt.Errorf("Multiple id's found in result: %s", string(rawResponse))
- }
- return id[0].Id, nil
-}
-
-func unmarshalId(key string, rawJSON json.RawMessage) (string, error) {
-
- // strip out the message header since we know what type of response we have
- rawResponse, err := getRawValue(rawJSON)
- if err != nil {
- return "", err
- }
-
- // we should now have something which contains a "count" and an object based on the key
- var result map[string]json.RawMessage
- if err := json.Unmarshal(rawResponse, &result); err != nil {
- return "", err
- }
-
- // if we're lucky, the input key (found during Api enumeration) will be present
- rawResult, found := result[key]
- if !found {
- // ok so this isn't good, but it doens't mean the end of the world
- // go find that response key and see if it pattern matches the input key
- for responseKey, value := range result {
- if strings.Contains(strings.ToLower(key), strings.ToLower(responseKey)) {
- found = true
- key = responseKey
- rawResult = value
- break
- }
- }
-
- if !found {
- return "", fmt.Errorf("Unable to find key '%s' in result: %v", key, result)
- }
- }
-
- var id []struct{ Id string }
- if err := json.Unmarshal(rawResult, &id); err != nil {
- return "", err
- }
- if len(id) > 1 {
- return "", fmt.Errorf("Multiple id's found in result: %s", string(rawResponse))
- }
- return id[0].Id, nil
-}
-
-// this one is exported to allow for callers to readily obtain the real response data
-func UnmarshalResponse(key string, rawJSON json.RawMessage) (json.RawMessage, error) {
-
- // strip out the message header since we know what type of response we have
- rawResponse, err := getRawValue(rawJSON)
- if err != nil {
- return nil, err
- }
-
- // we should now have something which contains a "count" and an object based on the key
- var result map[string]json.RawMessage
- if err := json.Unmarshal(rawResponse, &result); err != nil {
- return nil, err
- }
-
- // if we're lucky, the input key (found during Api enumeration) will be present
- rawResult, found := result[key]
- if !found {
- // ok so this isn't good, but it doens't mean the end of the world
- // go find that response key and see if it pattern matches the input key
- for responseKey, value := range result {
- if strings.Contains(strings.ToLower(key), strings.ToLower(responseKey)) {
- found = true
- key = responseKey
- rawResult = value
- break
- }
- }
-
- if !found {
- return nil, fmt.Errorf("Unable to find key '%s' in result: %v", key, result)
- }
- }
-
- return rawResult, nil
-}
-
-func unmarshalAsyncResponse(rawJSON json.RawMessage) (*asyncResult, error) {
- rawResponse, err := getRawValue(rawJSON)
- if err != nil {
- return nil, err
- }
- var result asyncResult
- if err := json.Unmarshal(rawResponse, &result); err != nil {
- return nil, err
- }
- return &result, nil
-}
-
-func unmarshalAsyncJobResponse(rawJSON json.RawMessage) (*asyncJobResult, error) {
- rawResponse, err := getRawValue(rawJSON)
- if err != nil {
- return nil, err
- }
- var result asyncJobResult
- if err := json.Unmarshal(rawResponse, &result); err != nil {
- return nil, err
- }
- return &result, nil
-}
-
-func unmarshalApiCommands(rawJSON json.RawMessage) (commands, error) {
- var apisResult struct {
- Listapis struct {
- Count int
- Api []*apiCommand
- } `json:"listapisresponse"`
- }
- if err := json.Unmarshal(rawJSON, &apisResult); err != nil {
- return nil, err
- }
- apiCommands := make(commands, apisResult.Listapis.Count)
- for _, apiCmd := range apisResult.Listapis.Api {
- cmd := command{apiCmd.Name, apiCmd.Isasync, false, map[string]*apiParam{}, map[string]*apiParam{}}
- for _, apiParam := range apiCmd.Params {
- if apiParam.Required {
- cmd.RequiredParams[strings.ToLower(apiParam.Name)] = apiParam
- } else {
- cmd.OptionalParams[strings.ToLower(apiParam.Name)] = apiParam
- }
- }
- if !strings.HasPrefix(apiCmd.Name, "list") {
- for _, apiResp := range apiCmd.Response {
- if strings.ToLower(apiResp.Name) == "id" {
- cmd.ReturnsAnId = true
- break
- }
- }
- }
- apiCommands[strings.ToLower(apiCmd.Name)] = &cmd
- }
- return apiCommands, nil
-}
diff --git a/vendor/github.com/ugorji/go/LICENSE b/vendor/github.com/ugorji/go/LICENSE
deleted file mode 100644
index 95a0f054..00000000
--- a/vendor/github.com/ugorji/go/LICENSE
+++ /dev/null
@@ -1,22 +0,0 @@
-The MIT License (MIT)
-
-Copyright (c) 2012-2015 Ugorji Nwoke.
-All rights reserved.
-
-Permission is hereby granted, free of charge, to any person obtaining a copy
-of this software and associated documentation files (the "Software"), to deal
-in the Software without restriction, including without limitation the rights
-to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
-copies of the Software, and to permit persons to whom the Software is
-furnished to do so, subject to the following conditions:
-
-The above copyright notice and this permission notice shall be included in all
-copies or substantial portions of the Software.
-
-THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
-OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
-SOFTWARE.
diff --git a/vendor/github.com/ugorji/go/codec/0doc.go b/vendor/github.com/ugorji/go/codec/0doc.go
deleted file mode 100644
index 5286c7d4..00000000
--- a/vendor/github.com/ugorji/go/codec/0doc.go
+++ /dev/null
@@ -1,199 +0,0 @@
-// Copyright (c) 2012-2015 Ugorji Nwoke. All rights reserved.
-// Use of this source code is governed by a MIT license found in the LICENSE file.
-
-/*
-High Performance, Feature-Rich Idiomatic Go codec/encoding library for
-binc, msgpack, cbor, json.
-
-Supported Serialization formats are:
-
- - msgpack: https://github.com/msgpack/msgpack
- - binc: http://github.com/ugorji/binc
- - cbor: http://cbor.io http://tools.ietf.org/html/rfc7049
- - json: http://json.org http://tools.ietf.org/html/rfc7159
- - simple:
-
-To install:
-
- go get github.com/ugorji/go/codec
-
-This package understands the 'unsafe' tag, to allow using unsafe semantics:
-
- - When decoding into a struct, you need to read the field name as a string
- so you can find the struct field it is mapped to.
- Using `unsafe` will bypass the allocation and copying overhead of []byte->string conversion.
-
-To install using unsafe, pass the 'unsafe' tag:
-
- go get -tags=unsafe github.com/ugorji/go/codec
-
-For detailed usage information, read the primer at http://ugorji.net/blog/go-codec-primer .
-
-The idiomatic Go support is as seen in other encoding packages in
-the standard library (ie json, xml, gob, etc).
-
-Rich Feature Set includes:
-
- - Simple but extremely powerful and feature-rich API
- - Very High Performance.
- Our extensive benchmarks show us outperforming Gob, Json, Bson, etc by 2-4X.
- - Multiple conversions:
- Package coerces types where appropriate
- e.g. decode an int in the stream into a float, etc.
- - Corner Cases:
- Overflows, nil maps/slices, nil values in streams are handled correctly
- - Standard field renaming via tags
- - Support for omitting empty fields during an encoding
- - Encoding from any value and decoding into pointer to any value
- (struct, slice, map, primitives, pointers, interface{}, etc)
- - Extensions to support efficient encoding/decoding of any named types
- - Support encoding.(Binary|Text)(M|Unm)arshaler interfaces
- - Decoding without a schema (into a interface{}).
- Includes Options to configure what specific map or slice type to use
- when decoding an encoded list or map into a nil interface{}
- - Encode a struct as an array, and decode struct from an array in the data stream
- - Comprehensive support for anonymous fields
- - Fast (no-reflection) encoding/decoding of common maps and slices
- - Code-generation for faster performance.
- - Support binary (e.g. messagepack, cbor) and text (e.g. json) formats
- - Support indefinite-length formats to enable true streaming
- (for formats which support it e.g. json, cbor)
- - Support canonical encoding, where a value is ALWAYS encoded as same sequence of bytes.
- This mostly applies to maps, where iteration order is non-deterministic.
- - NIL in data stream decoded as zero value
- - Never silently skip data when decoding.
- User decides whether to return an error or silently skip data when keys or indexes
- in the data stream do not map to fields in the struct.
- - Detect and error when encoding a cyclic reference (instead of stack overflow shutdown)
- - Encode/Decode from/to chan types (for iterative streaming support)
- - Drop-in replacement for encoding/json. `json:` key in struct tag supported.
- - Provides a RPC Server and Client Codec for net/rpc communication protocol.
- - Handle unique idiosynchracies of codecs e.g.
- - For messagepack, configure how ambiguities in handling raw bytes are resolved
- - For messagepack, provide rpc server/client codec to support
- msgpack-rpc protocol defined at:
- https://github.com/msgpack-rpc/msgpack-rpc/blob/master/spec.md
-
-Extension Support
-
-Users can register a function to handle the encoding or decoding of
-their custom types.
-
-There are no restrictions on what the custom type can be. Some examples:
-
- type BisSet []int
- type BitSet64 uint64
- type UUID string
- type MyStructWithUnexportedFields struct { a int; b bool; c []int; }
- type GifImage struct { ... }
-
-As an illustration, MyStructWithUnexportedFields would normally be
-encoded as an empty map because it has no exported fields, while UUID
-would be encoded as a string. However, with extension support, you can
-encode any of these however you like.
-
-RPC
-
-RPC Client and Server Codecs are implemented, so the codecs can be used
-with the standard net/rpc package.
-
-Usage
-
-The Handle is SAFE for concurrent READ, but NOT SAFE for concurrent modification.
-
-The Encoder and Decoder are NOT safe for concurrent use.
-
-Consequently, the usage model is basically:
-
- - Create and initialize the Handle before any use.
- Once created, DO NOT modify it.
- - Multiple Encoders or Decoders can now use the Handle concurrently.
- They only read information off the Handle (never write).
- - However, each Encoder or Decoder MUST not be used concurrently
- - To re-use an Encoder/Decoder, call Reset(...) on it first.
- This allows you use state maintained on the Encoder/Decoder.
-
-Sample usage model:
-
- // create and configure Handle
- var (
- bh codec.BincHandle
- mh codec.MsgpackHandle
- ch codec.CborHandle
- )
-
- mh.MapType = reflect.TypeOf(map[string]interface{}(nil))
-
- // configure extensions
- // e.g. for msgpack, define functions and enable Time support for tag 1
- // mh.SetExt(reflect.TypeOf(time.Time{}), 1, myExt)
-
- // create and use decoder/encoder
- var (
- r io.Reader
- w io.Writer
- b []byte
- h = &bh // or mh to use msgpack
- )
-
- dec = codec.NewDecoder(r, h)
- dec = codec.NewDecoderBytes(b, h)
- err = dec.Decode(&v)
-
- enc = codec.NewEncoder(w, h)
- enc = codec.NewEncoderBytes(&b, h)
- err = enc.Encode(v)
-
- //RPC Server
- go func() {
- for {
- conn, err := listener.Accept()
- rpcCodec := codec.GoRpc.ServerCodec(conn, h)
- //OR rpcCodec := codec.MsgpackSpecRpc.ServerCodec(conn, h)
- rpc.ServeCodec(rpcCodec)
- }
- }()
-
- //RPC Communication (client side)
- conn, err = net.Dial("tcp", "localhost:5555")
- rpcCodec := codec.GoRpc.ClientCodec(conn, h)
- //OR rpcCodec := codec.MsgpackSpecRpc.ClientCodec(conn, h)
- client := rpc.NewClientWithCodec(rpcCodec)
-
-*/
-package codec
-
-// Benefits of go-codec:
-//
-// - encoding/json always reads whole file into memory first.
-// This makes it unsuitable for parsing very large files.
-// - encoding/xml cannot parse into a map[string]interface{}
-// I found this out on reading https://github.com/clbanning/mxj
-
-// TODO:
-//
-// - optimization for codecgen:
-// if len of entity is <= 3 words, then support a value receiver for encode.
-// - (En|De)coder should store an error when it occurs.
-// Until reset, subsequent calls return that error that was stored.
-// This means that free panics must go away.
-// All errors must be raised through errorf method.
-// - Decoding using a chan is good, but incurs concurrency costs.
-// This is because there's no fast way to use a channel without it
-// having to switch goroutines constantly.
-// Callback pattern is still the best. Maybe cnsider supporting something like:
-// type X struct {
-// Name string
-// Ys []Y
-// Ys chan <- Y
-// Ys func(Y) -> call this function for each entry
-// }
-// - Consider adding a isZeroer interface { isZero() bool }
-// It is used within isEmpty, for omitEmpty support.
-// - Consider making Handle used AS-IS within the encoding/decoding session.
-// This means that we don't cache Handle information within the (En|De)coder,
-// except we really need it at Reset(...)
-// - Consider adding math/big support
-// - Consider reducing the size of the generated functions:
-// Maybe use one loop, and put the conditionals in the loop.
-// for ... { if cLen > 0 { if j == cLen { break } } else if dd.CheckBreak() { break } }
diff --git a/vendor/github.com/ugorji/go/codec/README.md b/vendor/github.com/ugorji/go/codec/README.md
deleted file mode 100644
index a790a52b..00000000
--- a/vendor/github.com/ugorji/go/codec/README.md
+++ /dev/null
@@ -1,148 +0,0 @@
-# Codec
-
-High Performance, Feature-Rich Idiomatic Go codec/encoding library for
-binc, msgpack, cbor, json.
-
-Supported Serialization formats are:
-
- - msgpack: https://github.com/msgpack/msgpack
- - binc: http://github.com/ugorji/binc
- - cbor: http://cbor.io http://tools.ietf.org/html/rfc7049
- - json: http://json.org http://tools.ietf.org/html/rfc7159
- - simple:
-
-To install:
-
- go get github.com/ugorji/go/codec
-
-This package understands the `unsafe` tag, to allow using unsafe semantics:
-
- - When decoding into a struct, you need to read the field name as a string
- so you can find the struct field it is mapped to.
- Using `unsafe` will bypass the allocation and copying overhead of `[]byte->string` conversion.
-
-To use it, you must pass the `unsafe` tag during install:
-
-```
-go install -tags=unsafe github.com/ugorji/go/codec
-```
-
-Online documentation: http://godoc.org/github.com/ugorji/go/codec
-Detailed Usage/How-to Primer: http://ugorji.net/blog/go-codec-primer
-
-The idiomatic Go support is as seen in other encoding packages in
-the standard library (ie json, xml, gob, etc).
-
-Rich Feature Set includes:
-
- - Simple but extremely powerful and feature-rich API
- - Very High Performance.
- Our extensive benchmarks show us outperforming Gob, Json, Bson, etc by 2-4X.
- - Multiple conversions:
- Package coerces types where appropriate
- e.g. decode an int in the stream into a float, etc.
- - Corner Cases:
- Overflows, nil maps/slices, nil values in streams are handled correctly
- - Standard field renaming via tags
- - Support for omitting empty fields during an encoding
- - Encoding from any value and decoding into pointer to any value
- (struct, slice, map, primitives, pointers, interface{}, etc)
- - Extensions to support efficient encoding/decoding of any named types
- - Support encoding.(Binary|Text)(M|Unm)arshaler interfaces
- - Decoding without a schema (into a interface{}).
- Includes Options to configure what specific map or slice type to use
- when decoding an encoded list or map into a nil interface{}
- - Encode a struct as an array, and decode struct from an array in the data stream
- - Comprehensive support for anonymous fields
- - Fast (no-reflection) encoding/decoding of common maps and slices
- - Code-generation for faster performance.
- - Support binary (e.g. messagepack, cbor) and text (e.g. json) formats
- - Support indefinite-length formats to enable true streaming
- (for formats which support it e.g. json, cbor)
- - Support canonical encoding, where a value is ALWAYS encoded as same sequence of bytes.
- This mostly applies to maps, where iteration order is non-deterministic.
- - NIL in data stream decoded as zero value
- - Never silently skip data when decoding.
- User decides whether to return an error or silently skip data when keys or indexes
- in the data stream do not map to fields in the struct.
- - Encode/Decode from/to chan types (for iterative streaming support)
- - Drop-in replacement for encoding/json. `json:` key in struct tag supported.
- - Provides a RPC Server and Client Codec for net/rpc communication protocol.
- - Handle unique idiosynchracies of codecs e.g.
- - For messagepack, configure how ambiguities in handling raw bytes are resolved
- - For messagepack, provide rpc server/client codec to support
- msgpack-rpc protocol defined at:
- https://github.com/msgpack-rpc/msgpack-rpc/blob/master/spec.md
-
-## Extension Support
-
-Users can register a function to handle the encoding or decoding of
-their custom types.
-
-There are no restrictions on what the custom type can be. Some examples:
-
- type BisSet []int
- type BitSet64 uint64
- type UUID string
- type MyStructWithUnexportedFields struct { a int; b bool; c []int; }
- type GifImage struct { ... }
-
-As an illustration, MyStructWithUnexportedFields would normally be
-encoded as an empty map because it has no exported fields, while UUID
-would be encoded as a string. However, with extension support, you can
-encode any of these however you like.
-
-## RPC
-
-RPC Client and Server Codecs are implemented, so the codecs can be used
-with the standard net/rpc package.
-
-## Usage
-
-Typical usage model:
-
- // create and configure Handle
- var (
- bh codec.BincHandle
- mh codec.MsgpackHandle
- ch codec.CborHandle
- )
-
- mh.MapType = reflect.TypeOf(map[string]interface{}(nil))
-
- // configure extensions
- // e.g. for msgpack, define functions and enable Time support for tag 1
- // mh.SetExt(reflect.TypeOf(time.Time{}), 1, myExt)
-
- // create and use decoder/encoder
- var (
- r io.Reader
- w io.Writer
- b []byte
- h = &bh // or mh to use msgpack
- )
-
- dec = codec.NewDecoder(r, h)
- dec = codec.NewDecoderBytes(b, h)
- err = dec.Decode(&v)
-
- enc = codec.NewEncoder(w, h)
- enc = codec.NewEncoderBytes(&b, h)
- err = enc.Encode(v)
-
- //RPC Server
- go func() {
- for {
- conn, err := listener.Accept()
- rpcCodec := codec.GoRpc.ServerCodec(conn, h)
- //OR rpcCodec := codec.MsgpackSpecRpc.ServerCodec(conn, h)
- rpc.ServeCodec(rpcCodec)
- }
- }()
-
- //RPC Communication (client side)
- conn, err = net.Dial("tcp", "localhost:5555")
- rpcCodec := codec.GoRpc.ClientCodec(conn, h)
- //OR rpcCodec := codec.MsgpackSpecRpc.ClientCodec(conn, h)
- client := rpc.NewClientWithCodec(rpcCodec)
-
diff --git a/vendor/github.com/ugorji/go/codec/binc.go b/vendor/github.com/ugorji/go/codec/binc.go
deleted file mode 100644
index 766d26cf..00000000
--- a/vendor/github.com/ugorji/go/codec/binc.go
+++ /dev/null
@@ -1,922 +0,0 @@
-// Copyright (c) 2012-2015 Ugorji Nwoke. All rights reserved.
-// Use of this source code is governed by a MIT license found in the LICENSE file.
-
-package codec
-
-import (
- "math"
- "reflect"
- "time"
-)
-
-const bincDoPrune = true // No longer needed. Needed before as C lib did not support pruning.
-
-// vd as low 4 bits (there are 16 slots)
-const (
- bincVdSpecial byte = iota
- bincVdPosInt
- bincVdNegInt
- bincVdFloat
-
- bincVdString
- bincVdByteArray
- bincVdArray
- bincVdMap
-
- bincVdTimestamp
- bincVdSmallInt
- bincVdUnicodeOther
- bincVdSymbol
-
- bincVdDecimal
- _ // open slot
- _ // open slot
- bincVdCustomExt = 0x0f
-)
-
-const (
- bincSpNil byte = iota
- bincSpFalse
- bincSpTrue
- bincSpNan
- bincSpPosInf
- bincSpNegInf
- bincSpZeroFloat
- bincSpZero
- bincSpNegOne
-)
-
-const (
- bincFlBin16 byte = iota
- bincFlBin32
- _ // bincFlBin32e
- bincFlBin64
- _ // bincFlBin64e
- // others not currently supported
-)
-
-type bincEncDriver struct {
- e *Encoder
- w encWriter
- m map[string]uint16 // symbols
- b [scratchByteArrayLen]byte
- s uint16 // symbols sequencer
- encNoSeparator
-}
-
-func (e *bincEncDriver) IsBuiltinType(rt uintptr) bool {
- return rt == timeTypId
-}
-
-func (e *bincEncDriver) EncodeBuiltin(rt uintptr, v interface{}) {
- if rt == timeTypId {
- var bs []byte
- switch x := v.(type) {
- case time.Time:
- bs = encodeTime(x)
- case *time.Time:
- bs = encodeTime(*x)
- default:
- e.e.errorf("binc error encoding builtin: expect time.Time, received %T", v)
- }
- e.w.writen1(bincVdTimestamp<<4 | uint8(len(bs)))
- e.w.writeb(bs)
- }
-}
-
-func (e *bincEncDriver) EncodeNil() {
- e.w.writen1(bincVdSpecial<<4 | bincSpNil)
-}
-
-func (e *bincEncDriver) EncodeBool(b bool) {
- if b {
- e.w.writen1(bincVdSpecial<<4 | bincSpTrue)
- } else {
- e.w.writen1(bincVdSpecial<<4 | bincSpFalse)
- }
-}
-
-func (e *bincEncDriver) EncodeFloat32(f float32) {
- if f == 0 {
- e.w.writen1(bincVdSpecial<<4 | bincSpZeroFloat)
- return
- }
- e.w.writen1(bincVdFloat<<4 | bincFlBin32)
- bigenHelper{e.b[:4], e.w}.writeUint32(math.Float32bits(f))
-}
-
-func (e *bincEncDriver) EncodeFloat64(f float64) {
- if f == 0 {
- e.w.writen1(bincVdSpecial<<4 | bincSpZeroFloat)
- return
- }
- bigen.PutUint64(e.b[:8], math.Float64bits(f))
- if bincDoPrune {
- i := 7
- for ; i >= 0 && (e.b[i] == 0); i-- {
- }
- i++
- if i <= 6 {
- e.w.writen1(bincVdFloat<<4 | 0x8 | bincFlBin64)
- e.w.writen1(byte(i))
- e.w.writeb(e.b[:i])
- return
- }
- }
- e.w.writen1(bincVdFloat<<4 | bincFlBin64)
- e.w.writeb(e.b[:8])
-}
-
-func (e *bincEncDriver) encIntegerPrune(bd byte, pos bool, v uint64, lim uint8) {
- if lim == 4 {
- bigen.PutUint32(e.b[:lim], uint32(v))
- } else {
- bigen.PutUint64(e.b[:lim], v)
- }
- if bincDoPrune {
- i := pruneSignExt(e.b[:lim], pos)
- e.w.writen1(bd | lim - 1 - byte(i))
- e.w.writeb(e.b[i:lim])
- } else {
- e.w.writen1(bd | lim - 1)
- e.w.writeb(e.b[:lim])
- }
-}
-
-func (e *bincEncDriver) EncodeInt(v int64) {
- const nbd byte = bincVdNegInt << 4
- if v >= 0 {
- e.encUint(bincVdPosInt<<4, true, uint64(v))
- } else if v == -1 {
- e.w.writen1(bincVdSpecial<<4 | bincSpNegOne)
- } else {
- e.encUint(bincVdNegInt<<4, false, uint64(-v))
- }
-}
-
-func (e *bincEncDriver) EncodeUint(v uint64) {
- e.encUint(bincVdPosInt<<4, true, v)
-}
-
-func (e *bincEncDriver) encUint(bd byte, pos bool, v uint64) {
- if v == 0 {
- e.w.writen1(bincVdSpecial<<4 | bincSpZero)
- } else if pos && v >= 1 && v <= 16 {
- e.w.writen1(bincVdSmallInt<<4 | byte(v-1))
- } else if v <= math.MaxUint8 {
- e.w.writen2(bd|0x0, byte(v))
- } else if v <= math.MaxUint16 {
- e.w.writen1(bd | 0x01)
- bigenHelper{e.b[:2], e.w}.writeUint16(uint16(v))
- } else if v <= math.MaxUint32 {
- e.encIntegerPrune(bd, pos, v, 4)
- } else {
- e.encIntegerPrune(bd, pos, v, 8)
- }
-}
-
-func (e *bincEncDriver) EncodeExt(rv interface{}, xtag uint64, ext Ext, _ *Encoder) {
- bs := ext.WriteExt(rv)
- if bs == nil {
- e.EncodeNil()
- return
- }
- e.encodeExtPreamble(uint8(xtag), len(bs))
- e.w.writeb(bs)
-}
-
-func (e *bincEncDriver) EncodeRawExt(re *RawExt, _ *Encoder) {
- e.encodeExtPreamble(uint8(re.Tag), len(re.Data))
- e.w.writeb(re.Data)
-}
-
-func (e *bincEncDriver) encodeExtPreamble(xtag byte, length int) {
- e.encLen(bincVdCustomExt<<4, uint64(length))
- e.w.writen1(xtag)
-}
-
-func (e *bincEncDriver) EncodeArrayStart(length int) {
- e.encLen(bincVdArray<<4, uint64(length))
-}
-
-func (e *bincEncDriver) EncodeMapStart(length int) {
- e.encLen(bincVdMap<<4, uint64(length))
-}
-
-func (e *bincEncDriver) EncodeString(c charEncoding, v string) {
- l := uint64(len(v))
- e.encBytesLen(c, l)
- if l > 0 {
- e.w.writestr(v)
- }
-}
-
-func (e *bincEncDriver) EncodeSymbol(v string) {
- // if WriteSymbolsNoRefs {
- // e.encodeString(c_UTF8, v)
- // return
- // }
-
- //symbols only offer benefit when string length > 1.
- //This is because strings with length 1 take only 2 bytes to store
- //(bd with embedded length, and single byte for string val).
-
- l := len(v)
- if l == 0 {
- e.encBytesLen(c_UTF8, 0)
- return
- } else if l == 1 {
- e.encBytesLen(c_UTF8, 1)
- e.w.writen1(v[0])
- return
- }
- if e.m == nil {
- e.m = make(map[string]uint16, 16)
- }
- ui, ok := e.m[v]
- if ok {
- if ui <= math.MaxUint8 {
- e.w.writen2(bincVdSymbol<<4, byte(ui))
- } else {
- e.w.writen1(bincVdSymbol<<4 | 0x8)
- bigenHelper{e.b[:2], e.w}.writeUint16(ui)
- }
- } else {
- e.s++
- ui = e.s
- //ui = uint16(atomic.AddUint32(&e.s, 1))
- e.m[v] = ui
- var lenprec uint8
- if l <= math.MaxUint8 {
- // lenprec = 0
- } else if l <= math.MaxUint16 {
- lenprec = 1
- } else if int64(l) <= math.MaxUint32 {
- lenprec = 2
- } else {
- lenprec = 3
- }
- if ui <= math.MaxUint8 {
- e.w.writen2(bincVdSymbol<<4|0x0|0x4|lenprec, byte(ui))
- } else {
- e.w.writen1(bincVdSymbol<<4 | 0x8 | 0x4 | lenprec)
- bigenHelper{e.b[:2], e.w}.writeUint16(ui)
- }
- if lenprec == 0 {
- e.w.writen1(byte(l))
- } else if lenprec == 1 {
- bigenHelper{e.b[:2], e.w}.writeUint16(uint16(l))
- } else if lenprec == 2 {
- bigenHelper{e.b[:4], e.w}.writeUint32(uint32(l))
- } else {
- bigenHelper{e.b[:8], e.w}.writeUint64(uint64(l))
- }
- e.w.writestr(v)
- }
-}
-
-func (e *bincEncDriver) EncodeStringBytes(c charEncoding, v []byte) {
- l := uint64(len(v))
- e.encBytesLen(c, l)
- if l > 0 {
- e.w.writeb(v)
- }
-}
-
-func (e *bincEncDriver) encBytesLen(c charEncoding, length uint64) {
- //TODO: support bincUnicodeOther (for now, just use string or bytearray)
- if c == c_RAW {
- e.encLen(bincVdByteArray<<4, length)
- } else {
- e.encLen(bincVdString<<4, length)
- }
-}
-
-func (e *bincEncDriver) encLen(bd byte, l uint64) {
- if l < 12 {
- e.w.writen1(bd | uint8(l+4))
- } else {
- e.encLenNumber(bd, l)
- }
-}
-
-func (e *bincEncDriver) encLenNumber(bd byte, v uint64) {
- if v <= math.MaxUint8 {
- e.w.writen2(bd, byte(v))
- } else if v <= math.MaxUint16 {
- e.w.writen1(bd | 0x01)
- bigenHelper{e.b[:2], e.w}.writeUint16(uint16(v))
- } else if v <= math.MaxUint32 {
- e.w.writen1(bd | 0x02)
- bigenHelper{e.b[:4], e.w}.writeUint32(uint32(v))
- } else {
- e.w.writen1(bd | 0x03)
- bigenHelper{e.b[:8], e.w}.writeUint64(uint64(v))
- }
-}
-
-//------------------------------------
-
-type bincDecSymbol struct {
- s string
- b []byte
- i uint16
-}
-
-type bincDecDriver struct {
- d *Decoder
- h *BincHandle
- r decReader
- br bool // bytes reader
- bdRead bool
- bd byte
- vd byte
- vs byte
- noStreamingCodec
- decNoSeparator
- b [scratchByteArrayLen]byte
-
- // linear searching on this slice is ok,
- // because we typically expect < 32 symbols in each stream.
- s []bincDecSymbol
-}
-
-func (d *bincDecDriver) readNextBd() {
- d.bd = d.r.readn1()
- d.vd = d.bd >> 4
- d.vs = d.bd & 0x0f
- d.bdRead = true
-}
-
-func (d *bincDecDriver) ContainerType() (vt valueType) {
- if d.vd == bincVdSpecial && d.vs == bincSpNil {
- return valueTypeNil
- } else if d.vd == bincVdByteArray {
- return valueTypeBytes
- } else if d.vd == bincVdString {
- return valueTypeString
- } else if d.vd == bincVdArray {
- return valueTypeArray
- } else if d.vd == bincVdMap {
- return valueTypeMap
- } else {
- // d.d.errorf("isContainerType: unsupported parameter: %v", vt)
- }
- return valueTypeUnset
-}
-
-func (d *bincDecDriver) TryDecodeAsNil() bool {
- if !d.bdRead {
- d.readNextBd()
- }
- if d.bd == bincVdSpecial<<4|bincSpNil {
- d.bdRead = false
- return true
- }
- return false
-}
-
-func (d *bincDecDriver) IsBuiltinType(rt uintptr) bool {
- return rt == timeTypId
-}
-
-func (d *bincDecDriver) DecodeBuiltin(rt uintptr, v interface{}) {
- if !d.bdRead {
- d.readNextBd()
- }
- if rt == timeTypId {
- if d.vd != bincVdTimestamp {
- d.d.errorf("Invalid d.vd. Expecting 0x%x. Received: 0x%x", bincVdTimestamp, d.vd)
- return
- }
- tt, err := decodeTime(d.r.readx(int(d.vs)))
- if err != nil {
- panic(err)
- }
- var vt *time.Time = v.(*time.Time)
- *vt = tt
- d.bdRead = false
- }
-}
-
-func (d *bincDecDriver) decFloatPre(vs, defaultLen byte) {
- if vs&0x8 == 0 {
- d.r.readb(d.b[0:defaultLen])
- } else {
- l := d.r.readn1()
- if l > 8 {
- d.d.errorf("At most 8 bytes used to represent float. Received: %v bytes", l)
- return
- }
- for i := l; i < 8; i++ {
- d.b[i] = 0
- }
- d.r.readb(d.b[0:l])
- }
-}
-
-func (d *bincDecDriver) decFloat() (f float64) {
- //if true { f = math.Float64frombits(bigen.Uint64(d.r.readx(8))); break; }
- if x := d.vs & 0x7; x == bincFlBin32 {
- d.decFloatPre(d.vs, 4)
- f = float64(math.Float32frombits(bigen.Uint32(d.b[0:4])))
- } else if x == bincFlBin64 {
- d.decFloatPre(d.vs, 8)
- f = math.Float64frombits(bigen.Uint64(d.b[0:8]))
- } else {
- d.d.errorf("only float32 and float64 are supported. d.vd: 0x%x, d.vs: 0x%x", d.vd, d.vs)
- return
- }
- return
-}
-
-func (d *bincDecDriver) decUint() (v uint64) {
- // need to inline the code (interface conversion and type assertion expensive)
- switch d.vs {
- case 0:
- v = uint64(d.r.readn1())
- case 1:
- d.r.readb(d.b[6:8])
- v = uint64(bigen.Uint16(d.b[6:8]))
- case 2:
- d.b[4] = 0
- d.r.readb(d.b[5:8])
- v = uint64(bigen.Uint32(d.b[4:8]))
- case 3:
- d.r.readb(d.b[4:8])
- v = uint64(bigen.Uint32(d.b[4:8]))
- case 4, 5, 6:
- lim := int(7 - d.vs)
- d.r.readb(d.b[lim:8])
- for i := 0; i < lim; i++ {
- d.b[i] = 0
- }
- v = uint64(bigen.Uint64(d.b[:8]))
- case 7:
- d.r.readb(d.b[:8])
- v = uint64(bigen.Uint64(d.b[:8]))
- default:
- d.d.errorf("unsigned integers with greater than 64 bits of precision not supported")
- return
- }
- return
-}
-
-func (d *bincDecDriver) decCheckInteger() (ui uint64, neg bool) {
- if !d.bdRead {
- d.readNextBd()
- }
- vd, vs := d.vd, d.vs
- if vd == bincVdPosInt {
- ui = d.decUint()
- } else if vd == bincVdNegInt {
- ui = d.decUint()
- neg = true
- } else if vd == bincVdSmallInt {
- ui = uint64(d.vs) + 1
- } else if vd == bincVdSpecial {
- if vs == bincSpZero {
- //i = 0
- } else if vs == bincSpNegOne {
- neg = true
- ui = 1
- } else {
- d.d.errorf("numeric decode fails for special value: d.vs: 0x%x", d.vs)
- return
- }
- } else {
- d.d.errorf("number can only be decoded from uint or int values. d.bd: 0x%x, d.vd: 0x%x", d.bd, d.vd)
- return
- }
- return
-}
-
-func (d *bincDecDriver) DecodeInt(bitsize uint8) (i int64) {
- ui, neg := d.decCheckInteger()
- i, overflow := chkOvf.SignedInt(ui)
- if overflow {
- d.d.errorf("simple: overflow converting %v to signed integer", ui)
- return
- }
- if neg {
- i = -i
- }
- if chkOvf.Int(i, bitsize) {
- d.d.errorf("binc: overflow integer: %v", i)
- return
- }
- d.bdRead = false
- return
-}
-
-func (d *bincDecDriver) DecodeUint(bitsize uint8) (ui uint64) {
- ui, neg := d.decCheckInteger()
- if neg {
- d.d.errorf("Assigning negative signed value to unsigned type")
- return
- }
- if chkOvf.Uint(ui, bitsize) {
- d.d.errorf("binc: overflow integer: %v", ui)
- return
- }
- d.bdRead = false
- return
-}
-
-func (d *bincDecDriver) DecodeFloat(chkOverflow32 bool) (f float64) {
- if !d.bdRead {
- d.readNextBd()
- }
- vd, vs := d.vd, d.vs
- if vd == bincVdSpecial {
- d.bdRead = false
- if vs == bincSpNan {
- return math.NaN()
- } else if vs == bincSpPosInf {
- return math.Inf(1)
- } else if vs == bincSpZeroFloat || vs == bincSpZero {
- return
- } else if vs == bincSpNegInf {
- return math.Inf(-1)
- } else {
- d.d.errorf("Invalid d.vs decoding float where d.vd=bincVdSpecial: %v", d.vs)
- return
- }
- } else if vd == bincVdFloat {
- f = d.decFloat()
- } else {
- f = float64(d.DecodeInt(64))
- }
- if chkOverflow32 && chkOvf.Float32(f) {
- d.d.errorf("binc: float32 overflow: %v", f)
- return
- }
- d.bdRead = false
- return
-}
-
-// bool can be decoded from bool only (single byte).
-func (d *bincDecDriver) DecodeBool() (b bool) {
- if !d.bdRead {
- d.readNextBd()
- }
- if bd := d.bd; bd == (bincVdSpecial | bincSpFalse) {
- // b = false
- } else if bd == (bincVdSpecial | bincSpTrue) {
- b = true
- } else {
- d.d.errorf("Invalid single-byte value for bool: %s: %x", msgBadDesc, d.bd)
- return
- }
- d.bdRead = false
- return
-}
-
-func (d *bincDecDriver) ReadMapStart() (length int) {
- if d.vd != bincVdMap {
- d.d.errorf("Invalid d.vd for map. Expecting 0x%x. Got: 0x%x", bincVdMap, d.vd)
- return
- }
- length = d.decLen()
- d.bdRead = false
- return
-}
-
-func (d *bincDecDriver) ReadArrayStart() (length int) {
- if d.vd != bincVdArray {
- d.d.errorf("Invalid d.vd for array. Expecting 0x%x. Got: 0x%x", bincVdArray, d.vd)
- return
- }
- length = d.decLen()
- d.bdRead = false
- return
-}
-
-func (d *bincDecDriver) decLen() int {
- if d.vs > 3 {
- return int(d.vs - 4)
- }
- return int(d.decLenNumber())
-}
-
-func (d *bincDecDriver) decLenNumber() (v uint64) {
- if x := d.vs; x == 0 {
- v = uint64(d.r.readn1())
- } else if x == 1 {
- d.r.readb(d.b[6:8])
- v = uint64(bigen.Uint16(d.b[6:8]))
- } else if x == 2 {
- d.r.readb(d.b[4:8])
- v = uint64(bigen.Uint32(d.b[4:8]))
- } else {
- d.r.readb(d.b[:8])
- v = bigen.Uint64(d.b[:8])
- }
- return
-}
-
-func (d *bincDecDriver) decStringAndBytes(bs []byte, withString, zerocopy bool) (bs2 []byte, s string) {
- if !d.bdRead {
- d.readNextBd()
- }
- if d.bd == bincVdSpecial<<4|bincSpNil {
- d.bdRead = false
- return
- }
- var slen int = -1
- // var ok bool
- switch d.vd {
- case bincVdString, bincVdByteArray:
- slen = d.decLen()
- if zerocopy {
- if d.br {
- bs2 = d.r.readx(slen)
- } else if len(bs) == 0 {
- bs2 = decByteSlice(d.r, slen, d.b[:])
- } else {
- bs2 = decByteSlice(d.r, slen, bs)
- }
- } else {
- bs2 = decByteSlice(d.r, slen, bs)
- }
- if withString {
- s = string(bs2)
- }
- case bincVdSymbol:
- // zerocopy doesn't apply for symbols,
- // as the values must be stored in a table for later use.
- //
- //from vs: extract numSymbolBytes, containsStringVal, strLenPrecision,
- //extract symbol
- //if containsStringVal, read it and put in map
- //else look in map for string value
- var symbol uint16
- vs := d.vs
- if vs&0x8 == 0 {
- symbol = uint16(d.r.readn1())
- } else {
- symbol = uint16(bigen.Uint16(d.r.readx(2)))
- }
- if d.s == nil {
- d.s = make([]bincDecSymbol, 0, 16)
- }
-
- if vs&0x4 == 0 {
- for i := range d.s {
- j := &d.s[i]
- if j.i == symbol {
- bs2 = j.b
- if withString {
- if j.s == "" && bs2 != nil {
- j.s = string(bs2)
- }
- s = j.s
- }
- break
- }
- }
- } else {
- switch vs & 0x3 {
- case 0:
- slen = int(d.r.readn1())
- case 1:
- slen = int(bigen.Uint16(d.r.readx(2)))
- case 2:
- slen = int(bigen.Uint32(d.r.readx(4)))
- case 3:
- slen = int(bigen.Uint64(d.r.readx(8)))
- }
- // since using symbols, do not store any part of
- // the parameter bs in the map, as it might be a shared buffer.
- // bs2 = decByteSlice(d.r, slen, bs)
- bs2 = decByteSlice(d.r, slen, nil)
- if withString {
- s = string(bs2)
- }
- d.s = append(d.s, bincDecSymbol{i: symbol, s: s, b: bs2})
- }
- default:
- d.d.errorf("Invalid d.vd. Expecting string:0x%x, bytearray:0x%x or symbol: 0x%x. Got: 0x%x",
- bincVdString, bincVdByteArray, bincVdSymbol, d.vd)
- return
- }
- d.bdRead = false
- return
-}
-
-func (d *bincDecDriver) DecodeString() (s string) {
- // DecodeBytes does not accomodate symbols, whose impl stores string version in map.
- // Use decStringAndBytes directly.
- // return string(d.DecodeBytes(d.b[:], true, true))
- _, s = d.decStringAndBytes(d.b[:], true, true)
- return
-}
-
-func (d *bincDecDriver) DecodeBytes(bs []byte, isstring, zerocopy bool) (bsOut []byte) {
- if isstring {
- bsOut, _ = d.decStringAndBytes(bs, false, zerocopy)
- return
- }
- if !d.bdRead {
- d.readNextBd()
- }
- if d.bd == bincVdSpecial<<4|bincSpNil {
- d.bdRead = false
- return nil
- }
- var clen int
- if d.vd == bincVdString || d.vd == bincVdByteArray {
- clen = d.decLen()
- } else {
- d.d.errorf("Invalid d.vd for bytes. Expecting string:0x%x or bytearray:0x%x. Got: 0x%x",
- bincVdString, bincVdByteArray, d.vd)
- return
- }
- d.bdRead = false
- if zerocopy {
- if d.br {
- return d.r.readx(clen)
- } else if len(bs) == 0 {
- bs = d.b[:]
- }
- }
- return decByteSlice(d.r, clen, bs)
-}
-
-func (d *bincDecDriver) DecodeExt(rv interface{}, xtag uint64, ext Ext) (realxtag uint64) {
- if xtag > 0xff {
- d.d.errorf("decodeExt: tag must be <= 0xff; got: %v", xtag)
- return
- }
- realxtag1, xbs := d.decodeExtV(ext != nil, uint8(xtag))
- realxtag = uint64(realxtag1)
- if ext == nil {
- re := rv.(*RawExt)
- re.Tag = realxtag
- re.Data = detachZeroCopyBytes(d.br, re.Data, xbs)
- } else {
- ext.ReadExt(rv, xbs)
- }
- return
-}
-
-func (d *bincDecDriver) decodeExtV(verifyTag bool, tag byte) (xtag byte, xbs []byte) {
- if !d.bdRead {
- d.readNextBd()
- }
- if d.vd == bincVdCustomExt {
- l := d.decLen()
- xtag = d.r.readn1()
- if verifyTag && xtag != tag {
- d.d.errorf("Wrong extension tag. Got %b. Expecting: %v", xtag, tag)
- return
- }
- xbs = d.r.readx(l)
- } else if d.vd == bincVdByteArray {
- xbs = d.DecodeBytes(nil, false, true)
- } else {
- d.d.errorf("Invalid d.vd for extensions (Expecting extensions or byte array). Got: 0x%x", d.vd)
- return
- }
- d.bdRead = false
- return
-}
-
-func (d *bincDecDriver) DecodeNaked() {
- if !d.bdRead {
- d.readNextBd()
- }
-
- n := &d.d.n
- var decodeFurther bool
-
- switch d.vd {
- case bincVdSpecial:
- switch d.vs {
- case bincSpNil:
- n.v = valueTypeNil
- case bincSpFalse:
- n.v = valueTypeBool
- n.b = false
- case bincSpTrue:
- n.v = valueTypeBool
- n.b = true
- case bincSpNan:
- n.v = valueTypeFloat
- n.f = math.NaN()
- case bincSpPosInf:
- n.v = valueTypeFloat
- n.f = math.Inf(1)
- case bincSpNegInf:
- n.v = valueTypeFloat
- n.f = math.Inf(-1)
- case bincSpZeroFloat:
- n.v = valueTypeFloat
- n.f = float64(0)
- case bincSpZero:
- n.v = valueTypeUint
- n.u = uint64(0) // int8(0)
- case bincSpNegOne:
- n.v = valueTypeInt
- n.i = int64(-1) // int8(-1)
- default:
- d.d.errorf("decodeNaked: Unrecognized special value 0x%x", d.vs)
- }
- case bincVdSmallInt:
- n.v = valueTypeUint
- n.u = uint64(int8(d.vs)) + 1 // int8(d.vs) + 1
- case bincVdPosInt:
- n.v = valueTypeUint
- n.u = d.decUint()
- case bincVdNegInt:
- n.v = valueTypeInt
- n.i = -(int64(d.decUint()))
- case bincVdFloat:
- n.v = valueTypeFloat
- n.f = d.decFloat()
- case bincVdSymbol:
- n.v = valueTypeSymbol
- n.s = d.DecodeString()
- case bincVdString:
- n.v = valueTypeString
- n.s = d.DecodeString()
- case bincVdByteArray:
- n.v = valueTypeBytes
- n.l = d.DecodeBytes(nil, false, false)
- case bincVdTimestamp:
- n.v = valueTypeTimestamp
- tt, err := decodeTime(d.r.readx(int(d.vs)))
- if err != nil {
- panic(err)
- }
- n.t = tt
- case bincVdCustomExt:
- n.v = valueTypeExt
- l := d.decLen()
- n.u = uint64(d.r.readn1())
- n.l = d.r.readx(l)
- case bincVdArray:
- n.v = valueTypeArray
- decodeFurther = true
- case bincVdMap:
- n.v = valueTypeMap
- decodeFurther = true
- default:
- d.d.errorf("decodeNaked: Unrecognized d.vd: 0x%x", d.vd)
- }
-
- if !decodeFurther {
- d.bdRead = false
- }
- if n.v == valueTypeUint && d.h.SignedInteger {
- n.v = valueTypeInt
- n.i = int64(n.u)
- }
- return
-}
-
-//------------------------------------
-
-//BincHandle is a Handle for the Binc Schema-Free Encoding Format
-//defined at https://github.com/ugorji/binc .
-//
-//BincHandle currently supports all Binc features with the following EXCEPTIONS:
-// - only integers up to 64 bits of precision are supported.
-// big integers are unsupported.
-// - Only IEEE 754 binary32 and binary64 floats are supported (ie Go float32 and float64 types).
-// extended precision and decimal IEEE 754 floats are unsupported.
-// - Only UTF-8 strings supported.
-// Unicode_Other Binc types (UTF16, UTF32) are currently unsupported.
-//
-//Note that these EXCEPTIONS are temporary and full support is possible and may happen soon.
-type BincHandle struct {
- BasicHandle
- binaryEncodingType
-}
-
-func (h *BincHandle) SetBytesExt(rt reflect.Type, tag uint64, ext BytesExt) (err error) {
- return h.SetExt(rt, tag, &setExtWrapper{b: ext})
-}
-
-func (h *BincHandle) newEncDriver(e *Encoder) encDriver {
- return &bincEncDriver{e: e, w: e.w}
-}
-
-func (h *BincHandle) newDecDriver(d *Decoder) decDriver {
- return &bincDecDriver{d: d, r: d.r, h: h, br: d.bytes}
-}
-
-func (e *bincEncDriver) reset() {
- e.w = e.e.w
- e.s = 0
- e.m = nil
-}
-
-func (d *bincDecDriver) reset() {
- d.r = d.d.r
- d.s = nil
- d.bd, d.bdRead, d.vd, d.vs = 0, false, 0, 0
-}
-
-var _ decDriver = (*bincDecDriver)(nil)
-var _ encDriver = (*bincEncDriver)(nil)
diff --git a/vendor/github.com/ugorji/go/codec/cbor.go b/vendor/github.com/ugorji/go/codec/cbor.go
deleted file mode 100644
index a224cd3a..00000000
--- a/vendor/github.com/ugorji/go/codec/cbor.go
+++ /dev/null
@@ -1,585 +0,0 @@
-// Copyright (c) 2012-2015 Ugorji Nwoke. All rights reserved.
-// Use of this source code is governed by a MIT license found in the LICENSE file.
-
-package codec
-
-import (
- "math"
- "reflect"
-)
-
-const (
- cborMajorUint byte = iota
- cborMajorNegInt
- cborMajorBytes
- cborMajorText
- cborMajorArray
- cborMajorMap
- cborMajorTag
- cborMajorOther
-)
-
-const (
- cborBdFalse byte = 0xf4 + iota
- cborBdTrue
- cborBdNil
- cborBdUndefined
- cborBdExt
- cborBdFloat16
- cborBdFloat32
- cborBdFloat64
-)
-
-const (
- cborBdIndefiniteBytes byte = 0x5f
- cborBdIndefiniteString = 0x7f
- cborBdIndefiniteArray = 0x9f
- cborBdIndefiniteMap = 0xbf
- cborBdBreak = 0xff
-)
-
-const (
- CborStreamBytes byte = 0x5f
- CborStreamString = 0x7f
- CborStreamArray = 0x9f
- CborStreamMap = 0xbf
- CborStreamBreak = 0xff
-)
-
-const (
- cborBaseUint byte = 0x00
- cborBaseNegInt = 0x20
- cborBaseBytes = 0x40
- cborBaseString = 0x60
- cborBaseArray = 0x80
- cborBaseMap = 0xa0
- cborBaseTag = 0xc0
- cborBaseSimple = 0xe0
-)
-
-// -------------------
-
-type cborEncDriver struct {
- noBuiltInTypes
- encNoSeparator
- e *Encoder
- w encWriter
- h *CborHandle
- x [8]byte
-}
-
-func (e *cborEncDriver) EncodeNil() {
- e.w.writen1(cborBdNil)
-}
-
-func (e *cborEncDriver) EncodeBool(b bool) {
- if b {
- e.w.writen1(cborBdTrue)
- } else {
- e.w.writen1(cborBdFalse)
- }
-}
-
-func (e *cborEncDriver) EncodeFloat32(f float32) {
- e.w.writen1(cborBdFloat32)
- bigenHelper{e.x[:4], e.w}.writeUint32(math.Float32bits(f))
-}
-
-func (e *cborEncDriver) EncodeFloat64(f float64) {
- e.w.writen1(cborBdFloat64)
- bigenHelper{e.x[:8], e.w}.writeUint64(math.Float64bits(f))
-}
-
-func (e *cborEncDriver) encUint(v uint64, bd byte) {
- if v <= 0x17 {
- e.w.writen1(byte(v) + bd)
- } else if v <= math.MaxUint8 {
- e.w.writen2(bd+0x18, uint8(v))
- } else if v <= math.MaxUint16 {
- e.w.writen1(bd + 0x19)
- bigenHelper{e.x[:2], e.w}.writeUint16(uint16(v))
- } else if v <= math.MaxUint32 {
- e.w.writen1(bd + 0x1a)
- bigenHelper{e.x[:4], e.w}.writeUint32(uint32(v))
- } else { // if v <= math.MaxUint64 {
- e.w.writen1(bd + 0x1b)
- bigenHelper{e.x[:8], e.w}.writeUint64(v)
- }
-}
-
-func (e *cborEncDriver) EncodeInt(v int64) {
- if v < 0 {
- e.encUint(uint64(-1-v), cborBaseNegInt)
- } else {
- e.encUint(uint64(v), cborBaseUint)
- }
-}
-
-func (e *cborEncDriver) EncodeUint(v uint64) {
- e.encUint(v, cborBaseUint)
-}
-
-func (e *cborEncDriver) encLen(bd byte, length int) {
- e.encUint(uint64(length), bd)
-}
-
-func (e *cborEncDriver) EncodeExt(rv interface{}, xtag uint64, ext Ext, en *Encoder) {
- e.encUint(uint64(xtag), cborBaseTag)
- if v := ext.ConvertExt(rv); v == nil {
- e.EncodeNil()
- } else {
- en.encode(v)
- }
-}
-
-func (e *cborEncDriver) EncodeRawExt(re *RawExt, en *Encoder) {
- e.encUint(uint64(re.Tag), cborBaseTag)
- if re.Data != nil {
- en.encode(re.Data)
- } else if re.Value == nil {
- e.EncodeNil()
- } else {
- en.encode(re.Value)
- }
-}
-
-func (e *cborEncDriver) EncodeArrayStart(length int) {
- e.encLen(cborBaseArray, length)
-}
-
-func (e *cborEncDriver) EncodeMapStart(length int) {
- e.encLen(cborBaseMap, length)
-}
-
-func (e *cborEncDriver) EncodeString(c charEncoding, v string) {
- e.encLen(cborBaseString, len(v))
- e.w.writestr(v)
-}
-
-func (e *cborEncDriver) EncodeSymbol(v string) {
- e.EncodeString(c_UTF8, v)
-}
-
-func (e *cborEncDriver) EncodeStringBytes(c charEncoding, v []byte) {
- if c == c_RAW {
- e.encLen(cborBaseBytes, len(v))
- } else {
- e.encLen(cborBaseString, len(v))
- }
- e.w.writeb(v)
-}
-
-// ----------------------
-
-type cborDecDriver struct {
- d *Decoder
- h *CborHandle
- r decReader
- b [scratchByteArrayLen]byte
- br bool // bytes reader
- bdRead bool
- bd byte
- noBuiltInTypes
- decNoSeparator
-}
-
-func (d *cborDecDriver) readNextBd() {
- d.bd = d.r.readn1()
- d.bdRead = true
-}
-
-func (d *cborDecDriver) ContainerType() (vt valueType) {
- if d.bd == cborBdNil {
- return valueTypeNil
- } else if d.bd == cborBdIndefiniteBytes || (d.bd >= cborBaseBytes && d.bd < cborBaseString) {
- return valueTypeBytes
- } else if d.bd == cborBdIndefiniteString || (d.bd >= cborBaseString && d.bd < cborBaseArray) {
- return valueTypeString
- } else if d.bd == cborBdIndefiniteArray || (d.bd >= cborBaseArray && d.bd < cborBaseMap) {
- return valueTypeArray
- } else if d.bd == cborBdIndefiniteMap || (d.bd >= cborBaseMap && d.bd < cborBaseTag) {
- return valueTypeMap
- } else {
- // d.d.errorf("isContainerType: unsupported parameter: %v", vt)
- }
- return valueTypeUnset
-}
-
-func (d *cborDecDriver) TryDecodeAsNil() bool {
- if !d.bdRead {
- d.readNextBd()
- }
- // treat Nil and Undefined as nil values
- if d.bd == cborBdNil || d.bd == cborBdUndefined {
- d.bdRead = false
- return true
- }
- return false
-}
-
-func (d *cborDecDriver) CheckBreak() bool {
- if !d.bdRead {
- d.readNextBd()
- }
- if d.bd == cborBdBreak {
- d.bdRead = false
- return true
- }
- return false
-}
-
-func (d *cborDecDriver) decUint() (ui uint64) {
- v := d.bd & 0x1f
- if v <= 0x17 {
- ui = uint64(v)
- } else {
- if v == 0x18 {
- ui = uint64(d.r.readn1())
- } else if v == 0x19 {
- ui = uint64(bigen.Uint16(d.r.readx(2)))
- } else if v == 0x1a {
- ui = uint64(bigen.Uint32(d.r.readx(4)))
- } else if v == 0x1b {
- ui = uint64(bigen.Uint64(d.r.readx(8)))
- } else {
- d.d.errorf("decUint: Invalid descriptor: %v", d.bd)
- return
- }
- }
- return
-}
-
-func (d *cborDecDriver) decCheckInteger() (neg bool) {
- if !d.bdRead {
- d.readNextBd()
- }
- major := d.bd >> 5
- if major == cborMajorUint {
- } else if major == cborMajorNegInt {
- neg = true
- } else {
- d.d.errorf("invalid major: %v (bd: %v)", major, d.bd)
- return
- }
- return
-}
-
-func (d *cborDecDriver) DecodeInt(bitsize uint8) (i int64) {
- neg := d.decCheckInteger()
- ui := d.decUint()
- // check if this number can be converted to an int without overflow
- var overflow bool
- if neg {
- if i, overflow = chkOvf.SignedInt(ui + 1); overflow {
- d.d.errorf("cbor: overflow converting %v to signed integer", ui+1)
- return
- }
- i = -i
- } else {
- if i, overflow = chkOvf.SignedInt(ui); overflow {
- d.d.errorf("cbor: overflow converting %v to signed integer", ui)
- return
- }
- }
- if chkOvf.Int(i, bitsize) {
- d.d.errorf("cbor: overflow integer: %v", i)
- return
- }
- d.bdRead = false
- return
-}
-
-func (d *cborDecDriver) DecodeUint(bitsize uint8) (ui uint64) {
- if d.decCheckInteger() {
- d.d.errorf("Assigning negative signed value to unsigned type")
- return
- }
- ui = d.decUint()
- if chkOvf.Uint(ui, bitsize) {
- d.d.errorf("cbor: overflow integer: %v", ui)
- return
- }
- d.bdRead = false
- return
-}
-
-func (d *cborDecDriver) DecodeFloat(chkOverflow32 bool) (f float64) {
- if !d.bdRead {
- d.readNextBd()
- }
- if bd := d.bd; bd == cborBdFloat16 {
- f = float64(math.Float32frombits(halfFloatToFloatBits(bigen.Uint16(d.r.readx(2)))))
- } else if bd == cborBdFloat32 {
- f = float64(math.Float32frombits(bigen.Uint32(d.r.readx(4))))
- } else if bd == cborBdFloat64 {
- f = math.Float64frombits(bigen.Uint64(d.r.readx(8)))
- } else if bd >= cborBaseUint && bd < cborBaseBytes {
- f = float64(d.DecodeInt(64))
- } else {
- d.d.errorf("Float only valid from float16/32/64: Invalid descriptor: %v", bd)
- return
- }
- if chkOverflow32 && chkOvf.Float32(f) {
- d.d.errorf("cbor: float32 overflow: %v", f)
- return
- }
- d.bdRead = false
- return
-}
-
-// bool can be decoded from bool only (single byte).
-func (d *cborDecDriver) DecodeBool() (b bool) {
- if !d.bdRead {
- d.readNextBd()
- }
- if bd := d.bd; bd == cborBdTrue {
- b = true
- } else if bd == cborBdFalse {
- } else {
- d.d.errorf("Invalid single-byte value for bool: %s: %x", msgBadDesc, d.bd)
- return
- }
- d.bdRead = false
- return
-}
-
-func (d *cborDecDriver) ReadMapStart() (length int) {
- d.bdRead = false
- if d.bd == cborBdIndefiniteMap {
- return -1
- }
- return d.decLen()
-}
-
-func (d *cborDecDriver) ReadArrayStart() (length int) {
- d.bdRead = false
- if d.bd == cborBdIndefiniteArray {
- return -1
- }
- return d.decLen()
-}
-
-func (d *cborDecDriver) decLen() int {
- return int(d.decUint())
-}
-
-func (d *cborDecDriver) decAppendIndefiniteBytes(bs []byte) []byte {
- d.bdRead = false
- for {
- if d.CheckBreak() {
- break
- }
- if major := d.bd >> 5; major != cborMajorBytes && major != cborMajorText {
- d.d.errorf("cbor: expect bytes or string major type in indefinite string/bytes; got: %v, byte: %v", major, d.bd)
- return nil
- }
- n := d.decLen()
- oldLen := len(bs)
- newLen := oldLen + n
- if newLen > cap(bs) {
- bs2 := make([]byte, newLen, 2*cap(bs)+n)
- copy(bs2, bs)
- bs = bs2
- } else {
- bs = bs[:newLen]
- }
- d.r.readb(bs[oldLen:newLen])
- // bs = append(bs, d.r.readn()...)
- d.bdRead = false
- }
- d.bdRead = false
- return bs
-}
-
-func (d *cborDecDriver) DecodeBytes(bs []byte, isstring, zerocopy bool) (bsOut []byte) {
- if !d.bdRead {
- d.readNextBd()
- }
- if d.bd == cborBdNil || d.bd == cborBdUndefined {
- d.bdRead = false
- return nil
- }
- if d.bd == cborBdIndefiniteBytes || d.bd == cborBdIndefiniteString {
- if bs == nil {
- return d.decAppendIndefiniteBytes(nil)
- }
- return d.decAppendIndefiniteBytes(bs[:0])
- }
- clen := d.decLen()
- d.bdRead = false
- if zerocopy {
- if d.br {
- return d.r.readx(clen)
- } else if len(bs) == 0 {
- bs = d.b[:]
- }
- }
- return decByteSlice(d.r, clen, bs)
-}
-
-func (d *cborDecDriver) DecodeString() (s string) {
- return string(d.DecodeBytes(d.b[:], true, true))
-}
-
-func (d *cborDecDriver) DecodeExt(rv interface{}, xtag uint64, ext Ext) (realxtag uint64) {
- if !d.bdRead {
- d.readNextBd()
- }
- u := d.decUint()
- d.bdRead = false
- realxtag = u
- if ext == nil {
- re := rv.(*RawExt)
- re.Tag = realxtag
- d.d.decode(&re.Value)
- } else if xtag != realxtag {
- d.d.errorf("Wrong extension tag. Got %b. Expecting: %v", realxtag, xtag)
- return
- } else {
- var v interface{}
- d.d.decode(&v)
- ext.UpdateExt(rv, v)
- }
- d.bdRead = false
- return
-}
-
-func (d *cborDecDriver) DecodeNaked() {
- if !d.bdRead {
- d.readNextBd()
- }
-
- n := &d.d.n
- var decodeFurther bool
-
- switch d.bd {
- case cborBdNil:
- n.v = valueTypeNil
- case cborBdFalse:
- n.v = valueTypeBool
- n.b = false
- case cborBdTrue:
- n.v = valueTypeBool
- n.b = true
- case cborBdFloat16, cborBdFloat32:
- n.v = valueTypeFloat
- n.f = d.DecodeFloat(true)
- case cborBdFloat64:
- n.v = valueTypeFloat
- n.f = d.DecodeFloat(false)
- case cborBdIndefiniteBytes:
- n.v = valueTypeBytes
- n.l = d.DecodeBytes(nil, false, false)
- case cborBdIndefiniteString:
- n.v = valueTypeString
- n.s = d.DecodeString()
- case cborBdIndefiniteArray:
- n.v = valueTypeArray
- decodeFurther = true
- case cborBdIndefiniteMap:
- n.v = valueTypeMap
- decodeFurther = true
- default:
- switch {
- case d.bd >= cborBaseUint && d.bd < cborBaseNegInt:
- if d.h.SignedInteger {
- n.v = valueTypeInt
- n.i = d.DecodeInt(64)
- } else {
- n.v = valueTypeUint
- n.u = d.DecodeUint(64)
- }
- case d.bd >= cborBaseNegInt && d.bd < cborBaseBytes:
- n.v = valueTypeInt
- n.i = d.DecodeInt(64)
- case d.bd >= cborBaseBytes && d.bd < cborBaseString:
- n.v = valueTypeBytes
- n.l = d.DecodeBytes(nil, false, false)
- case d.bd >= cborBaseString && d.bd < cborBaseArray:
- n.v = valueTypeString
- n.s = d.DecodeString()
- case d.bd >= cborBaseArray && d.bd < cborBaseMap:
- n.v = valueTypeArray
- decodeFurther = true
- case d.bd >= cborBaseMap && d.bd < cborBaseTag:
- n.v = valueTypeMap
- decodeFurther = true
- case d.bd >= cborBaseTag && d.bd < cborBaseSimple:
- n.v = valueTypeExt
- n.u = d.decUint()
- n.l = nil
- // d.bdRead = false
- // d.d.decode(&re.Value) // handled by decode itself.
- // decodeFurther = true
- default:
- d.d.errorf("decodeNaked: Unrecognized d.bd: 0x%x", d.bd)
- return
- }
- }
-
- if !decodeFurther {
- d.bdRead = false
- }
- return
-}
-
-// -------------------------
-
-// CborHandle is a Handle for the CBOR encoding format,
-// defined at http://tools.ietf.org/html/rfc7049 and documented further at http://cbor.io .
-//
-// CBOR is comprehensively supported, including support for:
-// - indefinite-length arrays/maps/bytes/strings
-// - (extension) tags in range 0..0xffff (0 .. 65535)
-// - half, single and double-precision floats
-// - all numbers (1, 2, 4 and 8-byte signed and unsigned integers)
-// - nil, true, false, ...
-// - arrays and maps, bytes and text strings
-//
-// None of the optional extensions (with tags) defined in the spec are supported out-of-the-box.
-// Users can implement them as needed (using SetExt), including spec-documented ones:
-// - timestamp, BigNum, BigFloat, Decimals, Encoded Text (e.g. URL, regexp, base64, MIME Message), etc.
-//
-// To encode with indefinite lengths (streaming), users will use
-// (Must)Encode methods of *Encoder, along with writing CborStreamXXX constants.
-//
-// For example, to encode "one-byte" as an indefinite length string:
-// var buf bytes.Buffer
-// e := NewEncoder(&buf, new(CborHandle))
-// buf.WriteByte(CborStreamString)
-// e.MustEncode("one-")
-// e.MustEncode("byte")
-// buf.WriteByte(CborStreamBreak)
-// encodedBytes := buf.Bytes()
-// var vv interface{}
-// NewDecoderBytes(buf.Bytes(), new(CborHandle)).MustDecode(&vv)
-// // Now, vv contains the same string "one-byte"
-//
-type CborHandle struct {
- binaryEncodingType
- BasicHandle
-}
-
-func (h *CborHandle) SetInterfaceExt(rt reflect.Type, tag uint64, ext InterfaceExt) (err error) {
- return h.SetExt(rt, tag, &setExtWrapper{i: ext})
-}
-
-func (h *CborHandle) newEncDriver(e *Encoder) encDriver {
- return &cborEncDriver{e: e, w: e.w, h: h}
-}
-
-func (h *CborHandle) newDecDriver(d *Decoder) decDriver {
- return &cborDecDriver{d: d, r: d.r, h: h, br: d.bytes}
-}
-
-func (e *cborEncDriver) reset() {
- e.w = e.e.w
-}
-
-func (d *cborDecDriver) reset() {
- d.r = d.d.r
- d.bd, d.bdRead = 0, false
-}
-
-var _ decDriver = (*cborDecDriver)(nil)
-var _ encDriver = (*cborEncDriver)(nil)
diff --git a/vendor/github.com/ugorji/go/codec/decode.go b/vendor/github.com/ugorji/go/codec/decode.go
deleted file mode 100644
index 7e56f1ec..00000000
--- a/vendor/github.com/ugorji/go/codec/decode.go
+++ /dev/null
@@ -1,2019 +0,0 @@
-// Copyright (c) 2012-2015 Ugorji Nwoke. All rights reserved.
-// Use of this source code is governed by a MIT license found in the LICENSE file.
-
-package codec
-
-import (
- "encoding"
- "errors"
- "fmt"
- "io"
- "reflect"
- "time"
-)
-
-// Some tagging information for error messages.
-const (
- msgBadDesc = "Unrecognized descriptor byte"
- msgDecCannotExpandArr = "cannot expand go array from %v to stream length: %v"
-)
-
-var (
- onlyMapOrArrayCanDecodeIntoStructErr = errors.New("only encoded map or array can be decoded into a struct")
- cannotDecodeIntoNilErr = errors.New("cannot decode into nil")
-)
-
-// decReader abstracts the reading source, allowing implementations that can
-// read from an io.Reader or directly off a byte slice with zero-copying.
-type decReader interface {
- unreadn1()
-
- // readx will use the implementation scratch buffer if possible i.e. n < len(scratchbuf), OR
- // just return a view of the []byte being decoded from.
- // Ensure you call detachZeroCopyBytes later if this needs to be sent outside codec control.
- readx(n int) []byte
- readb([]byte)
- readn1() uint8
- readn1eof() (v uint8, eof bool)
- numread() int // number of bytes read
- track()
- stopTrack() []byte
-}
-
-type decReaderByteScanner interface {
- io.Reader
- io.ByteScanner
-}
-
-type decDriver interface {
- // this will check if the next token is a break.
- CheckBreak() bool
- TryDecodeAsNil() bool
- // vt is one of: Bytes, String, Nil, Slice or Map. Return unSet if not known.
- ContainerType() (vt valueType)
- IsBuiltinType(rt uintptr) bool
- DecodeBuiltin(rt uintptr, v interface{})
-
- // DecodeNaked will decode primitives (number, bool, string, []byte) and RawExt.
- // For maps and arrays, it will not do the decoding in-band, but will signal
- // the decoder, so that is done later, by setting the decNaked.valueType field.
- //
- // Note: Numbers are decoded as int64, uint64, float64 only (no smaller sized number types).
- // for extensions, DecodeNaked must read the tag and the []byte if it exists.
- // if the []byte is not read, then kInterfaceNaked will treat it as a Handle
- // that stores the subsequent value in-band, and complete reading the RawExt.
- //
- // extensions should also use readx to decode them, for efficiency.
- // kInterface will extract the detached byte slice if it has to pass it outside its realm.
- DecodeNaked()
- DecodeInt(bitsize uint8) (i int64)
- DecodeUint(bitsize uint8) (ui uint64)
- DecodeFloat(chkOverflow32 bool) (f float64)
- DecodeBool() (b bool)
- // DecodeString can also decode symbols.
- // It looks redundant as DecodeBytes is available.
- // However, some codecs (e.g. binc) support symbols and can
- // return a pre-stored string value, meaning that it can bypass
- // the cost of []byte->string conversion.
- DecodeString() (s string)
-
- // DecodeBytes may be called directly, without going through reflection.
- // Consequently, it must be designed to handle possible nil.
- DecodeBytes(bs []byte, isstring, zerocopy bool) (bsOut []byte)
-
- // decodeExt will decode into a *RawExt or into an extension.
- DecodeExt(v interface{}, xtag uint64, ext Ext) (realxtag uint64)
- // decodeExt(verifyTag bool, tag byte) (xtag byte, xbs []byte)
- ReadMapStart() int
- ReadArrayStart() int
-
- reset()
- uncacheRead()
-}
-
-type decNoSeparator struct{}
-
-func (_ decNoSeparator) ReadEnd() {}
-func (_ decNoSeparator) uncacheRead() {}
-
-type DecodeOptions struct {
- // MapType specifies type to use during schema-less decoding of a map in the stream.
- // If nil, we use map[interface{}]interface{}
- MapType reflect.Type
-
- // SliceType specifies type to use during schema-less decoding of an array in the stream.
- // If nil, we use []interface{}
- SliceType reflect.Type
-
- // MaxInitLen defines the initial length that we "make" a collection (slice, chan or map) with.
- // If 0 or negative, we default to a sensible value based on the size of an element in the collection.
- //
- // For example, when decoding, a stream may say that it has MAX_UINT elements.
- // We should not auto-matically provision a slice of that length, to prevent Out-Of-Memory crash.
- // Instead, we provision up to MaxInitLen, fill that up, and start appending after that.
- MaxInitLen int
-
- // If ErrorIfNoField, return an error when decoding a map
- // from a codec stream into a struct, and no matching struct field is found.
- ErrorIfNoField bool
-
- // If ErrorIfNoArrayExpand, return an error when decoding a slice/array that cannot be expanded.
- // For example, the stream contains an array of 8 items, but you are decoding into a [4]T array,
- // or you are decoding into a slice of length 4 which is non-addressable (and so cannot be set).
- ErrorIfNoArrayExpand bool
-
- // If SignedInteger, use the int64 during schema-less decoding of unsigned values (not uint64).
- SignedInteger bool
-
- // MapValueReset controls how we decode into a map value.
- //
- // By default, we MAY retrieve the mapping for a key, and then decode into that.
- // However, especially with big maps, that retrieval may be expensive and unnecessary
- // if the stream already contains all that is necessary to recreate the value.
- //
- // If true, we will never retrieve the previous mapping,
- // but rather decode into a new value and set that in the map.
- //
- // If false, we will retrieve the previous mapping if necessary e.g.
- // the previous mapping is a pointer, or is a struct or array with pre-set state,
- // or is an interface.
- MapValueReset bool
-
- // InterfaceReset controls how we decode into an interface.
- //
- // By default, when we see a field that is an interface{...},
- // or a map with interface{...} value, we will attempt decoding into the
- // "contained" value.
- //
- // However, this prevents us from reading a string into an interface{}
- // that formerly contained a number.
- //
- // If true, we will decode into a new "blank" value, and set that in the interface.
- // If false, we will decode into whatever is contained in the interface.
- InterfaceReset bool
-
- // InternString controls interning of strings during decoding.
- //
- // Some handles, e.g. json, typically will read map keys as strings.
- // If the set of keys are finite, it may help reduce allocation to
- // look them up from a map (than to allocate them afresh).
- //
- // Note: Handles will be smart when using the intern functionality.
- // So everything will not be interned.
- InternString bool
-}
-
-// ------------------------------------
-
-// ioDecByteScanner implements Read(), ReadByte(...), UnreadByte(...) methods
-// of io.Reader, io.ByteScanner.
-type ioDecByteScanner struct {
- r io.Reader
- l byte // last byte
- ls byte // last byte status. 0: init-canDoNothing, 1: canRead, 2: canUnread
- b [1]byte // tiny buffer for reading single bytes
-}
-
-func (z *ioDecByteScanner) Read(p []byte) (n int, err error) {
- var firstByte bool
- if z.ls == 1 {
- z.ls = 2
- p[0] = z.l
- if len(p) == 1 {
- n = 1
- return
- }
- firstByte = true
- p = p[1:]
- }
- n, err = z.r.Read(p)
- if n > 0 {
- if err == io.EOF && n == len(p) {
- err = nil // read was successful, so postpone EOF (till next time)
- }
- z.l = p[n-1]
- z.ls = 2
- }
- if firstByte {
- n++
- }
- return
-}
-
-func (z *ioDecByteScanner) ReadByte() (c byte, err error) {
- n, err := z.Read(z.b[:])
- if n == 1 {
- c = z.b[0]
- if err == io.EOF {
- err = nil // read was successful, so postpone EOF (till next time)
- }
- }
- return
-}
-
-func (z *ioDecByteScanner) UnreadByte() (err error) {
- x := z.ls
- if x == 0 {
- err = errors.New("cannot unread - nothing has been read")
- } else if x == 1 {
- err = errors.New("cannot unread - last byte has not been read")
- } else if x == 2 {
- z.ls = 1
- }
- return
-}
-
-// ioDecReader is a decReader that reads off an io.Reader
-type ioDecReader struct {
- br decReaderByteScanner
- // temp byte array re-used internally for efficiency during read.
- // shares buffer with Decoder, so we keep size of struct within 8 words.
- x *[scratchByteArrayLen]byte
- bs ioDecByteScanner
- n int // num read
- tr []byte // tracking bytes read
- trb bool
-}
-
-func (z *ioDecReader) numread() int {
- return z.n
-}
-
-func (z *ioDecReader) readx(n int) (bs []byte) {
- if n <= 0 {
- return
- }
- if n < len(z.x) {
- bs = z.x[:n]
- } else {
- bs = make([]byte, n)
- }
- if _, err := io.ReadAtLeast(z.br, bs, n); err != nil {
- panic(err)
- }
- z.n += len(bs)
- if z.trb {
- z.tr = append(z.tr, bs...)
- }
- return
-}
-
-func (z *ioDecReader) readb(bs []byte) {
- if len(bs) == 0 {
- return
- }
- n, err := io.ReadAtLeast(z.br, bs, len(bs))
- z.n += n
- if err != nil {
- panic(err)
- }
- if z.trb {
- z.tr = append(z.tr, bs...)
- }
-}
-
-func (z *ioDecReader) readn1() (b uint8) {
- b, err := z.br.ReadByte()
- if err != nil {
- panic(err)
- }
- z.n++
- if z.trb {
- z.tr = append(z.tr, b)
- }
- return b
-}
-
-func (z *ioDecReader) readn1eof() (b uint8, eof bool) {
- b, err := z.br.ReadByte()
- if err == nil {
- z.n++
- if z.trb {
- z.tr = append(z.tr, b)
- }
- } else if err == io.EOF {
- eof = true
- } else {
- panic(err)
- }
- return
-}
-
-func (z *ioDecReader) unreadn1() {
- err := z.br.UnreadByte()
- if err != nil {
- panic(err)
- }
- z.n--
- if z.trb {
- if l := len(z.tr) - 1; l >= 0 {
- z.tr = z.tr[:l]
- }
- }
-}
-
-func (z *ioDecReader) track() {
- if z.tr != nil {
- z.tr = z.tr[:0]
- }
- z.trb = true
-}
-
-func (z *ioDecReader) stopTrack() (bs []byte) {
- z.trb = false
- return z.tr
-}
-
-// ------------------------------------
-
-var bytesDecReaderCannotUnreadErr = errors.New("cannot unread last byte read")
-
-// bytesDecReader is a decReader that reads off a byte slice with zero copying
-type bytesDecReader struct {
- b []byte // data
- c int // cursor
- a int // available
- t int // track start
-}
-
-func (z *bytesDecReader) reset(in []byte) {
- z.b = in
- z.a = len(in)
- z.c = 0
- z.t = 0
-}
-
-func (z *bytesDecReader) numread() int {
- return z.c
-}
-
-func (z *bytesDecReader) unreadn1() {
- if z.c == 0 || len(z.b) == 0 {
- panic(bytesDecReaderCannotUnreadErr)
- }
- z.c--
- z.a++
- return
-}
-
-func (z *bytesDecReader) readx(n int) (bs []byte) {
- // slicing from a non-constant start position is more expensive,
- // as more computation is required to decipher the pointer start position.
- // However, we do it only once, and it's better than reslicing both z.b and return value.
-
- if n <= 0 {
- } else if z.a == 0 {
- panic(io.EOF)
- } else if n > z.a {
- panic(io.ErrUnexpectedEOF)
- } else {
- c0 := z.c
- z.c = c0 + n
- z.a = z.a - n
- bs = z.b[c0:z.c]
- }
- return
-}
-
-func (z *bytesDecReader) readn1() (v uint8) {
- if z.a == 0 {
- panic(io.EOF)
- }
- v = z.b[z.c]
- z.c++
- z.a--
- return
-}
-
-func (z *bytesDecReader) readn1eof() (v uint8, eof bool) {
- if z.a == 0 {
- eof = true
- return
- }
- v = z.b[z.c]
- z.c++
- z.a--
- return
-}
-
-func (z *bytesDecReader) readb(bs []byte) {
- copy(bs, z.readx(len(bs)))
-}
-
-func (z *bytesDecReader) track() {
- z.t = z.c
-}
-
-func (z *bytesDecReader) stopTrack() (bs []byte) {
- return z.b[z.t:z.c]
-}
-
-// ------------------------------------
-
-type decFnInfo struct {
- d *Decoder
- ti *typeInfo
- xfFn Ext
- xfTag uint64
- seq seqType
-}
-
-// ----------------------------------------
-
-type decFn struct {
- i decFnInfo
- f func(*decFnInfo, reflect.Value)
-}
-
-func (f *decFnInfo) builtin(rv reflect.Value) {
- f.d.d.DecodeBuiltin(f.ti.rtid, rv.Addr().Interface())
-}
-
-func (f *decFnInfo) rawExt(rv reflect.Value) {
- f.d.d.DecodeExt(rv.Addr().Interface(), 0, nil)
-}
-
-func (f *decFnInfo) ext(rv reflect.Value) {
- f.d.d.DecodeExt(rv.Addr().Interface(), f.xfTag, f.xfFn)
-}
-
-func (f *decFnInfo) getValueForUnmarshalInterface(rv reflect.Value, indir int8) (v interface{}) {
- if indir == -1 {
- v = rv.Addr().Interface()
- } else if indir == 0 {
- v = rv.Interface()
- } else {
- for j := int8(0); j < indir; j++ {
- if rv.IsNil() {
- rv.Set(reflect.New(rv.Type().Elem()))
- }
- rv = rv.Elem()
- }
- v = rv.Interface()
- }
- return
-}
-
-func (f *decFnInfo) selferUnmarshal(rv reflect.Value) {
- f.getValueForUnmarshalInterface(rv, f.ti.csIndir).(Selfer).CodecDecodeSelf(f.d)
-}
-
-func (f *decFnInfo) binaryUnmarshal(rv reflect.Value) {
- bm := f.getValueForUnmarshalInterface(rv, f.ti.bunmIndir).(encoding.BinaryUnmarshaler)
- xbs := f.d.d.DecodeBytes(nil, false, true)
- if fnerr := bm.UnmarshalBinary(xbs); fnerr != nil {
- panic(fnerr)
- }
-}
-
-func (f *decFnInfo) textUnmarshal(rv reflect.Value) {
- tm := f.getValueForUnmarshalInterface(rv, f.ti.tunmIndir).(encoding.TextUnmarshaler)
- fnerr := tm.UnmarshalText(f.d.d.DecodeBytes(f.d.b[:], true, true))
- if fnerr != nil {
- panic(fnerr)
- }
-}
-
-func (f *decFnInfo) jsonUnmarshal(rv reflect.Value) {
- tm := f.getValueForUnmarshalInterface(rv, f.ti.junmIndir).(jsonUnmarshaler)
- // bs := f.d.d.DecodeBytes(f.d.b[:], true, true)
- // grab the bytes to be read, as UnmarshalJSON needs the full JSON so as to unmarshal it itself.
- fnerr := tm.UnmarshalJSON(f.d.nextValueBytes())
- if fnerr != nil {
- panic(fnerr)
- }
-}
-
-func (f *decFnInfo) kErr(rv reflect.Value) {
- f.d.errorf("no decoding function defined for kind %v", rv.Kind())
-}
-
-func (f *decFnInfo) kString(rv reflect.Value) {
- rv.SetString(f.d.d.DecodeString())
-}
-
-func (f *decFnInfo) kBool(rv reflect.Value) {
- rv.SetBool(f.d.d.DecodeBool())
-}
-
-func (f *decFnInfo) kInt(rv reflect.Value) {
- rv.SetInt(f.d.d.DecodeInt(intBitsize))
-}
-
-func (f *decFnInfo) kInt64(rv reflect.Value) {
- rv.SetInt(f.d.d.DecodeInt(64))
-}
-
-func (f *decFnInfo) kInt32(rv reflect.Value) {
- rv.SetInt(f.d.d.DecodeInt(32))
-}
-
-func (f *decFnInfo) kInt8(rv reflect.Value) {
- rv.SetInt(f.d.d.DecodeInt(8))
-}
-
-func (f *decFnInfo) kInt16(rv reflect.Value) {
- rv.SetInt(f.d.d.DecodeInt(16))
-}
-
-func (f *decFnInfo) kFloat32(rv reflect.Value) {
- rv.SetFloat(f.d.d.DecodeFloat(true))
-}
-
-func (f *decFnInfo) kFloat64(rv reflect.Value) {
- rv.SetFloat(f.d.d.DecodeFloat(false))
-}
-
-func (f *decFnInfo) kUint8(rv reflect.Value) {
- rv.SetUint(f.d.d.DecodeUint(8))
-}
-
-func (f *decFnInfo) kUint64(rv reflect.Value) {
- rv.SetUint(f.d.d.DecodeUint(64))
-}
-
-func (f *decFnInfo) kUint(rv reflect.Value) {
- rv.SetUint(f.d.d.DecodeUint(uintBitsize))
-}
-
-func (f *decFnInfo) kUintptr(rv reflect.Value) {
- rv.SetUint(f.d.d.DecodeUint(uintBitsize))
-}
-
-func (f *decFnInfo) kUint32(rv reflect.Value) {
- rv.SetUint(f.d.d.DecodeUint(32))
-}
-
-func (f *decFnInfo) kUint16(rv reflect.Value) {
- rv.SetUint(f.d.d.DecodeUint(16))
-}
-
-// func (f *decFnInfo) kPtr(rv reflect.Value) {
-// debugf(">>>>>>> ??? decode kPtr called - shouldn't get called")
-// if rv.IsNil() {
-// rv.Set(reflect.New(rv.Type().Elem()))
-// }
-// f.d.decodeValue(rv.Elem())
-// }
-
-// var kIntfCtr uint64
-
-func (f *decFnInfo) kInterfaceNaked() (rvn reflect.Value) {
- // nil interface:
- // use some hieristics to decode it appropriately
- // based on the detected next value in the stream.
- d := f.d
- d.d.DecodeNaked()
- n := &d.n
- if n.v == valueTypeNil {
- return
- }
- // We cannot decode non-nil stream value into nil interface with methods (e.g. io.Reader).
- // if num := f.ti.rt.NumMethod(); num > 0 {
- if f.ti.numMeth > 0 {
- d.errorf("cannot decode non-nil codec value into nil %v (%v methods)", f.ti.rt, f.ti.numMeth)
- return
- }
- // var useRvn bool
- switch n.v {
- case valueTypeMap:
- // if d.h.MapType == nil || d.h.MapType == mapIntfIntfTyp {
- // } else if d.h.MapType == mapStrIntfTyp { // for json performance
- // }
- if d.mtid == 0 || d.mtid == mapIntfIntfTypId {
- l := len(n.ms)
- n.ms = append(n.ms, nil)
- var v2 interface{} = &n.ms[l]
- d.decode(v2)
- rvn = reflect.ValueOf(v2).Elem()
- n.ms = n.ms[:l]
- } else if d.mtid == mapStrIntfTypId { // for json performance
- l := len(n.ns)
- n.ns = append(n.ns, nil)
- var v2 interface{} = &n.ns[l]
- d.decode(v2)
- rvn = reflect.ValueOf(v2).Elem()
- n.ns = n.ns[:l]
- } else {
- rvn = reflect.New(d.h.MapType).Elem()
- d.decodeValue(rvn, nil)
- }
- case valueTypeArray:
- // if d.h.SliceType == nil || d.h.SliceType == intfSliceTyp {
- if d.stid == 0 || d.stid == intfSliceTypId {
- l := len(n.ss)
- n.ss = append(n.ss, nil)
- var v2 interface{} = &n.ss[l]
- d.decode(v2)
- rvn = reflect.ValueOf(v2).Elem()
- n.ss = n.ss[:l]
- } else {
- rvn = reflect.New(d.h.SliceType).Elem()
- d.decodeValue(rvn, nil)
- }
- case valueTypeExt:
- var v interface{}
- tag, bytes := n.u, n.l // calling decode below might taint the values
- if bytes == nil {
- l := len(n.is)
- n.is = append(n.is, nil)
- v2 := &n.is[l]
- d.decode(v2)
- v = *v2
- n.is = n.is[:l]
- }
- bfn := d.h.getExtForTag(tag)
- if bfn == nil {
- var re RawExt
- re.Tag = tag
- re.Data = detachZeroCopyBytes(d.bytes, nil, bytes)
- rvn = reflect.ValueOf(re)
- } else {
- rvnA := reflect.New(bfn.rt)
- rvn = rvnA.Elem()
- if bytes != nil {
- bfn.ext.ReadExt(rvnA.Interface(), bytes)
- } else {
- bfn.ext.UpdateExt(rvnA.Interface(), v)
- }
- }
- case valueTypeNil:
- // no-op
- case valueTypeInt:
- rvn = reflect.ValueOf(&n.i).Elem()
- case valueTypeUint:
- rvn = reflect.ValueOf(&n.u).Elem()
- case valueTypeFloat:
- rvn = reflect.ValueOf(&n.f).Elem()
- case valueTypeBool:
- rvn = reflect.ValueOf(&n.b).Elem()
- case valueTypeString, valueTypeSymbol:
- rvn = reflect.ValueOf(&n.s).Elem()
- case valueTypeBytes:
- rvn = reflect.ValueOf(&n.l).Elem()
- case valueTypeTimestamp:
- rvn = reflect.ValueOf(&n.t).Elem()
- default:
- panic(fmt.Errorf("kInterfaceNaked: unexpected valueType: %d", n.v))
- }
- return
-}
-
-func (f *decFnInfo) kInterface(rv reflect.Value) {
- // debugf("\t===> kInterface")
-
- // Note:
- // A consequence of how kInterface works, is that
- // if an interface already contains something, we try
- // to decode into what was there before.
- // We do not replace with a generic value (as got from decodeNaked).
-
- var rvn reflect.Value
- if rv.IsNil() {
- rvn = f.kInterfaceNaked()
- if rvn.IsValid() {
- rv.Set(rvn)
- }
- } else if f.d.h.InterfaceReset {
- rvn = f.kInterfaceNaked()
- if rvn.IsValid() {
- rv.Set(rvn)
- } else {
- // reset to zero value based on current type in there.
- rv.Set(reflect.Zero(rv.Elem().Type()))
- }
- } else {
- rvn = rv.Elem()
- // Note: interface{} is settable, but underlying type may not be.
- // Consequently, we have to set the reflect.Value directly.
- // if underlying type is settable (e.g. ptr or interface),
- // we just decode into it.
- // Else we create a settable value, decode into it, and set on the interface.
- if rvn.CanSet() {
- f.d.decodeValue(rvn, nil)
- } else {
- rvn2 := reflect.New(rvn.Type()).Elem()
- rvn2.Set(rvn)
- f.d.decodeValue(rvn2, nil)
- rv.Set(rvn2)
- }
- }
-}
-
-func (f *decFnInfo) kStruct(rv reflect.Value) {
- fti := f.ti
- d := f.d
- dd := d.d
- cr := d.cr
- ctyp := dd.ContainerType()
- if ctyp == valueTypeMap {
- containerLen := dd.ReadMapStart()
- if containerLen == 0 {
- if cr != nil {
- cr.sendContainerState(containerMapEnd)
- }
- return
- }
- tisfi := fti.sfi
- hasLen := containerLen >= 0
- if hasLen {
- for j := 0; j < containerLen; j++ {
- // rvkencname := dd.DecodeString()
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- rvkencname := stringView(dd.DecodeBytes(f.d.b[:], true, true))
- // rvksi := ti.getForEncName(rvkencname)
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- if k := fti.indexForEncName(rvkencname); k > -1 {
- si := tisfi[k]
- if dd.TryDecodeAsNil() {
- si.setToZeroValue(rv)
- } else {
- d.decodeValue(si.field(rv, true), nil)
- }
- } else {
- d.structFieldNotFound(-1, rvkencname)
- }
- }
- } else {
- for j := 0; !dd.CheckBreak(); j++ {
- // rvkencname := dd.DecodeString()
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- rvkencname := stringView(dd.DecodeBytes(f.d.b[:], true, true))
- // rvksi := ti.getForEncName(rvkencname)
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- if k := fti.indexForEncName(rvkencname); k > -1 {
- si := tisfi[k]
- if dd.TryDecodeAsNil() {
- si.setToZeroValue(rv)
- } else {
- d.decodeValue(si.field(rv, true), nil)
- }
- } else {
- d.structFieldNotFound(-1, rvkencname)
- }
- }
- }
- if cr != nil {
- cr.sendContainerState(containerMapEnd)
- }
- } else if ctyp == valueTypeArray {
- containerLen := dd.ReadArrayStart()
- if containerLen == 0 {
- if cr != nil {
- cr.sendContainerState(containerArrayEnd)
- }
- return
- }
- // Not much gain from doing it two ways for array.
- // Arrays are not used as much for structs.
- hasLen := containerLen >= 0
- for j, si := range fti.sfip {
- if hasLen {
- if j == containerLen {
- break
- }
- } else if dd.CheckBreak() {
- break
- }
- if cr != nil {
- cr.sendContainerState(containerArrayElem)
- }
- if dd.TryDecodeAsNil() {
- si.setToZeroValue(rv)
- } else {
- d.decodeValue(si.field(rv, true), nil)
- }
- }
- if containerLen > len(fti.sfip) {
- // read remaining values and throw away
- for j := len(fti.sfip); j < containerLen; j++ {
- if cr != nil {
- cr.sendContainerState(containerArrayElem)
- }
- d.structFieldNotFound(j, "")
- }
- }
- if cr != nil {
- cr.sendContainerState(containerArrayEnd)
- }
- } else {
- f.d.error(onlyMapOrArrayCanDecodeIntoStructErr)
- return
- }
-}
-
-func (f *decFnInfo) kSlice(rv reflect.Value) {
- // A slice can be set from a map or array in stream.
- // This way, the order can be kept (as order is lost with map).
- ti := f.ti
- d := f.d
- dd := d.d
- rtelem0 := ti.rt.Elem()
- ctyp := dd.ContainerType()
- if ctyp == valueTypeBytes || ctyp == valueTypeString {
- // you can only decode bytes or string in the stream into a slice or array of bytes
- if !(ti.rtid == uint8SliceTypId || rtelem0.Kind() == reflect.Uint8) {
- f.d.errorf("bytes or string in the stream must be decoded into a slice or array of bytes, not %v", ti.rt)
- }
- if f.seq == seqTypeChan {
- bs2 := dd.DecodeBytes(nil, false, true)
- ch := rv.Interface().(chan<- byte)
- for _, b := range bs2 {
- ch <- b
- }
- } else {
- rvbs := rv.Bytes()
- bs2 := dd.DecodeBytes(rvbs, false, false)
- if rvbs == nil && bs2 != nil || rvbs != nil && bs2 == nil || len(bs2) != len(rvbs) {
- if rv.CanSet() {
- rv.SetBytes(bs2)
- } else {
- copy(rvbs, bs2)
- }
- }
- }
- return
- }
-
- // array := f.seq == seqTypeChan
-
- slh, containerLenS := d.decSliceHelperStart() // only expects valueType(Array|Map)
-
- // // an array can never return a nil slice. so no need to check f.array here.
- if containerLenS == 0 {
- if f.seq == seqTypeSlice {
- if rv.IsNil() {
- rv.Set(reflect.MakeSlice(ti.rt, 0, 0))
- } else {
- rv.SetLen(0)
- }
- } else if f.seq == seqTypeChan {
- if rv.IsNil() {
- rv.Set(reflect.MakeChan(ti.rt, 0))
- }
- }
- slh.End()
- return
- }
-
- rtelem := rtelem0
- for rtelem.Kind() == reflect.Ptr {
- rtelem = rtelem.Elem()
- }
- fn := d.getDecFn(rtelem, true, true)
-
- var rv0, rv9 reflect.Value
- rv0 = rv
- rvChanged := false
-
- // for j := 0; j < containerLenS; j++ {
- var rvlen int
- if containerLenS > 0 { // hasLen
- if f.seq == seqTypeChan {
- if rv.IsNil() {
- rvlen, _ = decInferLen(containerLenS, f.d.h.MaxInitLen, int(rtelem0.Size()))
- rv.Set(reflect.MakeChan(ti.rt, rvlen))
- }
- // handle chan specially:
- for j := 0; j < containerLenS; j++ {
- rv9 = reflect.New(rtelem0).Elem()
- slh.ElemContainerState(j)
- d.decodeValue(rv9, fn)
- rv.Send(rv9)
- }
- } else { // slice or array
- var truncated bool // says len of sequence is not same as expected number of elements
- numToRead := containerLenS // if truncated, reset numToRead
-
- rvcap := rv.Cap()
- rvlen = rv.Len()
- if containerLenS > rvcap {
- if f.seq == seqTypeArray {
- d.arrayCannotExpand(rvlen, containerLenS)
- } else {
- oldRvlenGtZero := rvlen > 0
- rvlen, truncated = decInferLen(containerLenS, f.d.h.MaxInitLen, int(rtelem0.Size()))
- if truncated {
- if rvlen <= rvcap {
- rv.SetLen(rvlen)
- } else {
- rv = reflect.MakeSlice(ti.rt, rvlen, rvlen)
- rvChanged = true
- }
- } else {
- rv = reflect.MakeSlice(ti.rt, rvlen, rvlen)
- rvChanged = true
- }
- if rvChanged && oldRvlenGtZero && !isImmutableKind(rtelem0.Kind()) {
- reflect.Copy(rv, rv0) // only copy up to length NOT cap i.e. rv0.Slice(0, rvcap)
- }
- rvcap = rvlen
- }
- numToRead = rvlen
- } else if containerLenS != rvlen {
- if f.seq == seqTypeSlice {
- rv.SetLen(containerLenS)
- rvlen = containerLenS
- }
- }
- j := 0
- // we read up to the numToRead
- for ; j < numToRead; j++ {
- slh.ElemContainerState(j)
- d.decodeValue(rv.Index(j), fn)
- }
-
- // if slice, expand and read up to containerLenS (or EOF) iff truncated
- // if array, swallow all the rest.
-
- if f.seq == seqTypeArray {
- for ; j < containerLenS; j++ {
- slh.ElemContainerState(j)
- d.swallow()
- }
- } else if truncated { // slice was truncated, as chan NOT in this block
- for ; j < containerLenS; j++ {
- rv = expandSliceValue(rv, 1)
- rv9 = rv.Index(j)
- if resetSliceElemToZeroValue {
- rv9.Set(reflect.Zero(rtelem0))
- }
- slh.ElemContainerState(j)
- d.decodeValue(rv9, fn)
- }
- }
- }
- } else {
- rvlen = rv.Len()
- j := 0
- for ; !dd.CheckBreak(); j++ {
- if f.seq == seqTypeChan {
- slh.ElemContainerState(j)
- rv9 = reflect.New(rtelem0).Elem()
- d.decodeValue(rv9, fn)
- rv.Send(rv9)
- } else {
- // if indefinite, etc, then expand the slice if necessary
- var decodeIntoBlank bool
- if j >= rvlen {
- if f.seq == seqTypeArray {
- d.arrayCannotExpand(rvlen, j+1)
- decodeIntoBlank = true
- } else { // if f.seq == seqTypeSlice
- // rv = reflect.Append(rv, reflect.Zero(rtelem0)) // uses append logic, plus varargs
- rv = expandSliceValue(rv, 1)
- rv9 = rv.Index(j)
- // rv.Index(rv.Len() - 1).Set(reflect.Zero(rtelem0))
- if resetSliceElemToZeroValue {
- rv9.Set(reflect.Zero(rtelem0))
- }
- rvlen++
- rvChanged = true
- }
- } else { // slice or array
- rv9 = rv.Index(j)
- }
- slh.ElemContainerState(j)
- if decodeIntoBlank {
- d.swallow()
- } else { // seqTypeSlice
- d.decodeValue(rv9, fn)
- }
- }
- }
- if f.seq == seqTypeSlice {
- if j < rvlen {
- rv.SetLen(j)
- } else if j == 0 && rv.IsNil() {
- rv = reflect.MakeSlice(ti.rt, 0, 0)
- rvChanged = true
- }
- }
- }
- slh.End()
-
- if rvChanged {
- rv0.Set(rv)
- }
-}
-
-func (f *decFnInfo) kArray(rv reflect.Value) {
- // f.d.decodeValue(rv.Slice(0, rv.Len()))
- f.kSlice(rv.Slice(0, rv.Len()))
-}
-
-func (f *decFnInfo) kMap(rv reflect.Value) {
- d := f.d
- dd := d.d
- containerLen := dd.ReadMapStart()
- cr := d.cr
- ti := f.ti
- if rv.IsNil() {
- rv.Set(reflect.MakeMap(ti.rt))
- }
-
- if containerLen == 0 {
- if cr != nil {
- cr.sendContainerState(containerMapEnd)
- }
- return
- }
-
- ktype, vtype := ti.rt.Key(), ti.rt.Elem()
- ktypeId := reflect.ValueOf(ktype).Pointer()
- vtypeKind := vtype.Kind()
- var keyFn, valFn *decFn
- var xtyp reflect.Type
- for xtyp = ktype; xtyp.Kind() == reflect.Ptr; xtyp = xtyp.Elem() {
- }
- keyFn = d.getDecFn(xtyp, true, true)
- for xtyp = vtype; xtyp.Kind() == reflect.Ptr; xtyp = xtyp.Elem() {
- }
- valFn = d.getDecFn(xtyp, true, true)
- var mapGet, mapSet bool
- if !f.d.h.MapValueReset {
- // if pointer, mapGet = true
- // if interface, mapGet = true if !DecodeNakedAlways (else false)
- // if builtin, mapGet = false
- // else mapGet = true
- if vtypeKind == reflect.Ptr {
- mapGet = true
- } else if vtypeKind == reflect.Interface {
- if !f.d.h.InterfaceReset {
- mapGet = true
- }
- } else if !isImmutableKind(vtypeKind) {
- mapGet = true
- }
- }
-
- var rvk, rvv, rvz reflect.Value
-
- // for j := 0; j < containerLen; j++ {
- if containerLen > 0 {
- for j := 0; j < containerLen; j++ {
- rvk = reflect.New(ktype).Elem()
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- d.decodeValue(rvk, keyFn)
-
- // special case if a byte array.
- if ktypeId == intfTypId {
- rvk = rvk.Elem()
- if rvk.Type() == uint8SliceTyp {
- rvk = reflect.ValueOf(d.string(rvk.Bytes()))
- }
- }
- mapSet = true // set to false if u do a get, and its a pointer, and exists
- if mapGet {
- rvv = rv.MapIndex(rvk)
- if rvv.IsValid() {
- if vtypeKind == reflect.Ptr {
- mapSet = false
- }
- } else {
- if rvz.IsValid() {
- rvz.Set(reflect.Zero(vtype))
- } else {
- rvz = reflect.New(vtype).Elem()
- }
- rvv = rvz
- }
- } else {
- if rvz.IsValid() {
- rvz.Set(reflect.Zero(vtype))
- } else {
- rvz = reflect.New(vtype).Elem()
- }
- rvv = rvz
- }
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- d.decodeValue(rvv, valFn)
- if mapSet {
- rv.SetMapIndex(rvk, rvv)
- }
- }
- } else {
- for j := 0; !dd.CheckBreak(); j++ {
- rvk = reflect.New(ktype).Elem()
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- d.decodeValue(rvk, keyFn)
-
- // special case if a byte array.
- if ktypeId == intfTypId {
- rvk = rvk.Elem()
- if rvk.Type() == uint8SliceTyp {
- rvk = reflect.ValueOf(d.string(rvk.Bytes()))
- }
- }
- mapSet = true // set to false if u do a get, and its a pointer, and exists
- if mapGet {
- rvv = rv.MapIndex(rvk)
- if rvv.IsValid() {
- if vtypeKind == reflect.Ptr {
- mapSet = false
- }
- } else {
- if rvz.IsValid() {
- rvz.Set(reflect.Zero(vtype))
- } else {
- rvz = reflect.New(vtype).Elem()
- }
- rvv = rvz
- }
- } else {
- if rvz.IsValid() {
- rvz.Set(reflect.Zero(vtype))
- } else {
- rvz = reflect.New(vtype).Elem()
- }
- rvv = rvz
- }
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- d.decodeValue(rvv, valFn)
- if mapSet {
- rv.SetMapIndex(rvk, rvv)
- }
- }
- }
- if cr != nil {
- cr.sendContainerState(containerMapEnd)
- }
-}
-
-type decRtidFn struct {
- rtid uintptr
- fn decFn
-}
-
-// decNaked is used to keep track of the primitives decoded.
-// Without it, we would have to decode each primitive and wrap it
-// in an interface{}, causing an allocation.
-// In this model, the primitives are decoded in a "pseudo-atomic" fashion,
-// so we can rest assured that no other decoding happens while these
-// primitives are being decoded.
-//
-// maps and arrays are not handled by this mechanism.
-// However, RawExt is, and we accomodate for extensions that decode
-// RawExt from DecodeNaked, but need to decode the value subsequently.
-// kInterfaceNaked and swallow, which call DecodeNaked, handle this caveat.
-//
-// However, decNaked also keeps some arrays of default maps and slices
-// used in DecodeNaked. This way, we can get a pointer to it
-// without causing a new heap allocation.
-//
-// kInterfaceNaked will ensure that there is no allocation for the common
-// uses.
-type decNaked struct {
- // r RawExt // used for RawExt, uint, []byte.
- u uint64
- i int64
- f float64
- l []byte
- s string
- t time.Time
- b bool
- v valueType
-
- // stacks for reducing allocation
- is []interface{}
- ms []map[interface{}]interface{}
- ns []map[string]interface{}
- ss [][]interface{}
- // rs []RawExt
-
- // keep arrays at the bottom? Chance is that they are not used much.
- ia [4]interface{}
- ma [4]map[interface{}]interface{}
- na [4]map[string]interface{}
- sa [4][]interface{}
- // ra [2]RawExt
-}
-
-func (n *decNaked) reset() {
- if n.ss != nil {
- n.ss = n.ss[:0]
- }
- if n.is != nil {
- n.is = n.is[:0]
- }
- if n.ms != nil {
- n.ms = n.ms[:0]
- }
- if n.ns != nil {
- n.ns = n.ns[:0]
- }
-}
-
-// A Decoder reads and decodes an object from an input stream in the codec format.
-type Decoder struct {
- // hopefully, reduce derefencing cost by laying the decReader inside the Decoder.
- // Try to put things that go together to fit within a cache line (8 words).
-
- d decDriver
- // NOTE: Decoder shouldn't call it's read methods,
- // as the handler MAY need to do some coordination.
- r decReader
- // sa [initCollectionCap]decRtidFn
- h *BasicHandle
- hh Handle
-
- be bool // is binary encoding
- bytes bool // is bytes reader
- js bool // is json handle
-
- rb bytesDecReader
- ri ioDecReader
- cr containerStateRecv
-
- s []decRtidFn
- f map[uintptr]*decFn
-
- // _ uintptr // for alignment purposes, so next one starts from a cache line
-
- // cache the mapTypeId and sliceTypeId for faster comparisons
- mtid uintptr
- stid uintptr
-
- n decNaked
- b [scratchByteArrayLen]byte
- is map[string]string // used for interning strings
-}
-
-// NewDecoder returns a Decoder for decoding a stream of bytes from an io.Reader.
-//
-// For efficiency, Users are encouraged to pass in a memory buffered reader
-// (eg bufio.Reader, bytes.Buffer).
-func NewDecoder(r io.Reader, h Handle) *Decoder {
- d := newDecoder(h)
- d.Reset(r)
- return d
-}
-
-// NewDecoderBytes returns a Decoder which efficiently decodes directly
-// from a byte slice with zero copying.
-func NewDecoderBytes(in []byte, h Handle) *Decoder {
- d := newDecoder(h)
- d.ResetBytes(in)
- return d
-}
-
-func newDecoder(h Handle) *Decoder {
- d := &Decoder{hh: h, h: h.getBasicHandle(), be: h.isBinary()}
- n := &d.n
- // n.rs = n.ra[:0]
- n.ms = n.ma[:0]
- n.is = n.ia[:0]
- n.ns = n.na[:0]
- n.ss = n.sa[:0]
- _, d.js = h.(*JsonHandle)
- if d.h.InternString {
- d.is = make(map[string]string, 32)
- }
- d.d = h.newDecDriver(d)
- d.cr, _ = d.d.(containerStateRecv)
- // d.d = h.newDecDriver(decReaderT{true, &d.rb, &d.ri})
- return d
-}
-
-func (d *Decoder) resetCommon() {
- d.n.reset()
- d.d.reset()
- // reset all things which were cached from the Handle,
- // but could be changed.
- d.mtid, d.stid = 0, 0
- if d.h.MapType != nil {
- d.mtid = reflect.ValueOf(d.h.MapType).Pointer()
- }
- if d.h.SliceType != nil {
- d.stid = reflect.ValueOf(d.h.SliceType).Pointer()
- }
-}
-
-func (d *Decoder) Reset(r io.Reader) {
- d.ri.x = &d.b
- // d.s = d.sa[:0]
- d.ri.bs.r = r
- var ok bool
- d.ri.br, ok = r.(decReaderByteScanner)
- if !ok {
- d.ri.br = &d.ri.bs
- }
- d.r = &d.ri
- d.resetCommon()
-}
-
-func (d *Decoder) ResetBytes(in []byte) {
- // d.s = d.sa[:0]
- d.rb.reset(in)
- d.r = &d.rb
- d.resetCommon()
-}
-
-// func (d *Decoder) sendContainerState(c containerState) {
-// if d.cr != nil {
-// d.cr.sendContainerState(c)
-// }
-// }
-
-// Decode decodes the stream from reader and stores the result in the
-// value pointed to by v. v cannot be a nil pointer. v can also be
-// a reflect.Value of a pointer.
-//
-// Note that a pointer to a nil interface is not a nil pointer.
-// If you do not know what type of stream it is, pass in a pointer to a nil interface.
-// We will decode and store a value in that nil interface.
-//
-// Sample usages:
-// // Decoding into a non-nil typed value
-// var f float32
-// err = codec.NewDecoder(r, handle).Decode(&f)
-//
-// // Decoding into nil interface
-// var v interface{}
-// dec := codec.NewDecoder(r, handle)
-// err = dec.Decode(&v)
-//
-// When decoding into a nil interface{}, we will decode into an appropriate value based
-// on the contents of the stream:
-// - Numbers are decoded as float64, int64 or uint64.
-// - Other values are decoded appropriately depending on the type:
-// bool, string, []byte, time.Time, etc
-// - Extensions are decoded as RawExt (if no ext function registered for the tag)
-// Configurations exist on the Handle to override defaults
-// (e.g. for MapType, SliceType and how to decode raw bytes).
-//
-// When decoding into a non-nil interface{} value, the mode of encoding is based on the
-// type of the value. When a value is seen:
-// - If an extension is registered for it, call that extension function
-// - If it implements BinaryUnmarshaler, call its UnmarshalBinary(data []byte) error
-// - Else decode it based on its reflect.Kind
-//
-// There are some special rules when decoding into containers (slice/array/map/struct).
-// Decode will typically use the stream contents to UPDATE the container.
-// - A map can be decoded from a stream map, by updating matching keys.
-// - A slice can be decoded from a stream array,
-// by updating the first n elements, where n is length of the stream.
-// - A slice can be decoded from a stream map, by decoding as if
-// it contains a sequence of key-value pairs.
-// - A struct can be decoded from a stream map, by updating matching fields.
-// - A struct can be decoded from a stream array,
-// by updating fields as they occur in the struct (by index).
-//
-// When decoding a stream map or array with length of 0 into a nil map or slice,
-// we reset the destination map or slice to a zero-length value.
-//
-// However, when decoding a stream nil, we reset the destination container
-// to its "zero" value (e.g. nil for slice/map, etc).
-//
-func (d *Decoder) Decode(v interface{}) (err error) {
- defer panicToErr(&err)
- d.decode(v)
- return
-}
-
-// this is not a smart swallow, as it allocates objects and does unnecessary work.
-func (d *Decoder) swallowViaHammer() {
- var blank interface{}
- d.decodeValue(reflect.ValueOf(&blank).Elem(), nil)
-}
-
-func (d *Decoder) swallow() {
- // smarter decode that just swallows the content
- dd := d.d
- if dd.TryDecodeAsNil() {
- return
- }
- cr := d.cr
- switch dd.ContainerType() {
- case valueTypeMap:
- containerLen := dd.ReadMapStart()
- clenGtEqualZero := containerLen >= 0
- for j := 0; ; j++ {
- if clenGtEqualZero {
- if j >= containerLen {
- break
- }
- } else if dd.CheckBreak() {
- break
- }
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- d.swallow()
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- d.swallow()
- }
- if cr != nil {
- cr.sendContainerState(containerMapEnd)
- }
- case valueTypeArray:
- containerLenS := dd.ReadArrayStart()
- clenGtEqualZero := containerLenS >= 0
- for j := 0; ; j++ {
- if clenGtEqualZero {
- if j >= containerLenS {
- break
- }
- } else if dd.CheckBreak() {
- break
- }
- if cr != nil {
- cr.sendContainerState(containerArrayElem)
- }
- d.swallow()
- }
- if cr != nil {
- cr.sendContainerState(containerArrayEnd)
- }
- case valueTypeBytes:
- dd.DecodeBytes(d.b[:], false, true)
- case valueTypeString:
- dd.DecodeBytes(d.b[:], true, true)
- // dd.DecodeStringAsBytes(d.b[:])
- default:
- // these are all primitives, which we can get from decodeNaked
- // if RawExt using Value, complete the processing.
- dd.DecodeNaked()
- if n := &d.n; n.v == valueTypeExt && n.l == nil {
- l := len(n.is)
- n.is = append(n.is, nil)
- v2 := &n.is[l]
- d.decode(v2)
- n.is = n.is[:l]
- }
- }
-}
-
-// MustDecode is like Decode, but panics if unable to Decode.
-// This provides insight to the code location that triggered the error.
-func (d *Decoder) MustDecode(v interface{}) {
- d.decode(v)
-}
-
-func (d *Decoder) decode(iv interface{}) {
- // if ics, ok := iv.(Selfer); ok {
- // ics.CodecDecodeSelf(d)
- // return
- // }
-
- if d.d.TryDecodeAsNil() {
- switch v := iv.(type) {
- case nil:
- case *string:
- *v = ""
- case *bool:
- *v = false
- case *int:
- *v = 0
- case *int8:
- *v = 0
- case *int16:
- *v = 0
- case *int32:
- *v = 0
- case *int64:
- *v = 0
- case *uint:
- *v = 0
- case *uint8:
- *v = 0
- case *uint16:
- *v = 0
- case *uint32:
- *v = 0
- case *uint64:
- *v = 0
- case *float32:
- *v = 0
- case *float64:
- *v = 0
- case *[]uint8:
- *v = nil
- case reflect.Value:
- if v.Kind() != reflect.Ptr || v.IsNil() {
- d.errNotValidPtrValue(v)
- }
- // d.chkPtrValue(v)
- v = v.Elem()
- if v.IsValid() {
- v.Set(reflect.Zero(v.Type()))
- }
- default:
- rv := reflect.ValueOf(iv)
- if rv.Kind() != reflect.Ptr || rv.IsNil() {
- d.errNotValidPtrValue(rv)
- }
- // d.chkPtrValue(rv)
- rv = rv.Elem()
- if rv.IsValid() {
- rv.Set(reflect.Zero(rv.Type()))
- }
- }
- return
- }
-
- switch v := iv.(type) {
- case nil:
- d.error(cannotDecodeIntoNilErr)
- return
-
- case Selfer:
- v.CodecDecodeSelf(d)
-
- case reflect.Value:
- if v.Kind() != reflect.Ptr || v.IsNil() {
- d.errNotValidPtrValue(v)
- }
- // d.chkPtrValue(v)
- d.decodeValueNotNil(v.Elem(), nil)
-
- case *string:
-
- *v = d.d.DecodeString()
- case *bool:
- *v = d.d.DecodeBool()
- case *int:
- *v = int(d.d.DecodeInt(intBitsize))
- case *int8:
- *v = int8(d.d.DecodeInt(8))
- case *int16:
- *v = int16(d.d.DecodeInt(16))
- case *int32:
- *v = int32(d.d.DecodeInt(32))
- case *int64:
- *v = d.d.DecodeInt(64)
- case *uint:
- *v = uint(d.d.DecodeUint(uintBitsize))
- case *uint8:
- *v = uint8(d.d.DecodeUint(8))
- case *uint16:
- *v = uint16(d.d.DecodeUint(16))
- case *uint32:
- *v = uint32(d.d.DecodeUint(32))
- case *uint64:
- *v = d.d.DecodeUint(64)
- case *float32:
- *v = float32(d.d.DecodeFloat(true))
- case *float64:
- *v = d.d.DecodeFloat(false)
- case *[]uint8:
- *v = d.d.DecodeBytes(*v, false, false)
-
- case *interface{}:
- d.decodeValueNotNil(reflect.ValueOf(iv).Elem(), nil)
-
- default:
- if !fastpathDecodeTypeSwitch(iv, d) {
- d.decodeI(iv, true, false, false, false)
- }
- }
-}
-
-func (d *Decoder) preDecodeValue(rv reflect.Value, tryNil bool) (rv2 reflect.Value, proceed bool) {
- if tryNil && d.d.TryDecodeAsNil() {
- // No need to check if a ptr, recursively, to determine
- // whether to set value to nil.
- // Just always set value to its zero type.
- if rv.IsValid() { // rv.CanSet() // always settable, except it's invalid
- rv.Set(reflect.Zero(rv.Type()))
- }
- return
- }
-
- // If stream is not containing a nil value, then we can deref to the base
- // non-pointer value, and decode into that.
- for rv.Kind() == reflect.Ptr {
- if rv.IsNil() {
- rv.Set(reflect.New(rv.Type().Elem()))
- }
- rv = rv.Elem()
- }
- return rv, true
-}
-
-func (d *Decoder) decodeI(iv interface{}, checkPtr, tryNil, checkFastpath, checkCodecSelfer bool) {
- rv := reflect.ValueOf(iv)
- if checkPtr {
- if rv.Kind() != reflect.Ptr || rv.IsNil() {
- d.errNotValidPtrValue(rv)
- }
- // d.chkPtrValue(rv)
- }
- rv, proceed := d.preDecodeValue(rv, tryNil)
- if proceed {
- fn := d.getDecFn(rv.Type(), checkFastpath, checkCodecSelfer)
- fn.f(&fn.i, rv)
- }
-}
-
-func (d *Decoder) decodeValue(rv reflect.Value, fn *decFn) {
- if rv, proceed := d.preDecodeValue(rv, true); proceed {
- if fn == nil {
- fn = d.getDecFn(rv.Type(), true, true)
- }
- fn.f(&fn.i, rv)
- }
-}
-
-func (d *Decoder) decodeValueNotNil(rv reflect.Value, fn *decFn) {
- if rv, proceed := d.preDecodeValue(rv, false); proceed {
- if fn == nil {
- fn = d.getDecFn(rv.Type(), true, true)
- }
- fn.f(&fn.i, rv)
- }
-}
-
-func (d *Decoder) getDecFn(rt reflect.Type, checkFastpath, checkCodecSelfer bool) (fn *decFn) {
- rtid := reflect.ValueOf(rt).Pointer()
-
- // retrieve or register a focus'ed function for this type
- // to eliminate need to do the retrieval multiple times
-
- // if d.f == nil && d.s == nil { debugf("---->Creating new dec f map for type: %v\n", rt) }
- var ok bool
- if useMapForCodecCache {
- fn, ok = d.f[rtid]
- } else {
- for i := range d.s {
- v := &(d.s[i])
- if v.rtid == rtid {
- fn, ok = &(v.fn), true
- break
- }
- }
- }
- if ok {
- return
- }
-
- if useMapForCodecCache {
- if d.f == nil {
- d.f = make(map[uintptr]*decFn, initCollectionCap)
- }
- fn = new(decFn)
- d.f[rtid] = fn
- } else {
- if d.s == nil {
- d.s = make([]decRtidFn, 0, initCollectionCap)
- }
- d.s = append(d.s, decRtidFn{rtid: rtid})
- fn = &(d.s[len(d.s)-1]).fn
- }
-
- // debugf("\tCreating new dec fn for type: %v\n", rt)
- ti := d.h.getTypeInfo(rtid, rt)
- fi := &(fn.i)
- fi.d = d
- fi.ti = ti
-
- // An extension can be registered for any type, regardless of the Kind
- // (e.g. type BitSet int64, type MyStruct { / * unexported fields * / }, type X []int, etc.
- //
- // We can't check if it's an extension byte here first, because the user may have
- // registered a pointer or non-pointer type, meaning we may have to recurse first
- // before matching a mapped type, even though the extension byte is already detected.
- //
- // NOTE: if decoding into a nil interface{}, we return a non-nil
- // value except even if the container registers a length of 0.
- if checkCodecSelfer && ti.cs {
- fn.f = (*decFnInfo).selferUnmarshal
- } else if rtid == rawExtTypId {
- fn.f = (*decFnInfo).rawExt
- } else if d.d.IsBuiltinType(rtid) {
- fn.f = (*decFnInfo).builtin
- } else if xfFn := d.h.getExt(rtid); xfFn != nil {
- fi.xfTag, fi.xfFn = xfFn.tag, xfFn.ext
- fn.f = (*decFnInfo).ext
- } else if supportMarshalInterfaces && d.be && ti.bunm {
- fn.f = (*decFnInfo).binaryUnmarshal
- } else if supportMarshalInterfaces && !d.be && d.js && ti.junm {
- //If JSON, we should check JSONUnmarshal before textUnmarshal
- fn.f = (*decFnInfo).jsonUnmarshal
- } else if supportMarshalInterfaces && !d.be && ti.tunm {
- fn.f = (*decFnInfo).textUnmarshal
- } else {
- rk := rt.Kind()
- if fastpathEnabled && checkFastpath && (rk == reflect.Map || rk == reflect.Slice) {
- if rt.PkgPath() == "" {
- if idx := fastpathAV.index(rtid); idx != -1 {
- fn.f = fastpathAV[idx].decfn
- }
- } else {
- // use mapping for underlying type if there
- ok = false
- var rtu reflect.Type
- if rk == reflect.Map {
- rtu = reflect.MapOf(rt.Key(), rt.Elem())
- } else {
- rtu = reflect.SliceOf(rt.Elem())
- }
- rtuid := reflect.ValueOf(rtu).Pointer()
- if idx := fastpathAV.index(rtuid); idx != -1 {
- xfnf := fastpathAV[idx].decfn
- xrt := fastpathAV[idx].rt
- fn.f = func(xf *decFnInfo, xrv reflect.Value) {
- // xfnf(xf, xrv.Convert(xrt))
- xfnf(xf, xrv.Addr().Convert(reflect.PtrTo(xrt)).Elem())
- }
- }
- }
- }
- if fn.f == nil {
- switch rk {
- case reflect.String:
- fn.f = (*decFnInfo).kString
- case reflect.Bool:
- fn.f = (*decFnInfo).kBool
- case reflect.Int:
- fn.f = (*decFnInfo).kInt
- case reflect.Int64:
- fn.f = (*decFnInfo).kInt64
- case reflect.Int32:
- fn.f = (*decFnInfo).kInt32
- case reflect.Int8:
- fn.f = (*decFnInfo).kInt8
- case reflect.Int16:
- fn.f = (*decFnInfo).kInt16
- case reflect.Float32:
- fn.f = (*decFnInfo).kFloat32
- case reflect.Float64:
- fn.f = (*decFnInfo).kFloat64
- case reflect.Uint8:
- fn.f = (*decFnInfo).kUint8
- case reflect.Uint64:
- fn.f = (*decFnInfo).kUint64
- case reflect.Uint:
- fn.f = (*decFnInfo).kUint
- case reflect.Uint32:
- fn.f = (*decFnInfo).kUint32
- case reflect.Uint16:
- fn.f = (*decFnInfo).kUint16
- // case reflect.Ptr:
- // fn.f = (*decFnInfo).kPtr
- case reflect.Uintptr:
- fn.f = (*decFnInfo).kUintptr
- case reflect.Interface:
- fn.f = (*decFnInfo).kInterface
- case reflect.Struct:
- fn.f = (*decFnInfo).kStruct
- case reflect.Chan:
- fi.seq = seqTypeChan
- fn.f = (*decFnInfo).kSlice
- case reflect.Slice:
- fi.seq = seqTypeSlice
- fn.f = (*decFnInfo).kSlice
- case reflect.Array:
- fi.seq = seqTypeArray
- fn.f = (*decFnInfo).kArray
- case reflect.Map:
- fn.f = (*decFnInfo).kMap
- default:
- fn.f = (*decFnInfo).kErr
- }
- }
- }
-
- return
-}
-
-func (d *Decoder) structFieldNotFound(index int, rvkencname string) {
- if d.h.ErrorIfNoField {
- if index >= 0 {
- d.errorf("no matching struct field found when decoding stream array at index %v", index)
- return
- } else if rvkencname != "" {
- d.errorf("no matching struct field found when decoding stream map with key %s", rvkencname)
- return
- }
- }
- d.swallow()
-}
-
-func (d *Decoder) arrayCannotExpand(sliceLen, streamLen int) {
- if d.h.ErrorIfNoArrayExpand {
- d.errorf("cannot expand array len during decode from %v to %v", sliceLen, streamLen)
- }
-}
-
-func (d *Decoder) chkPtrValue(rv reflect.Value) {
- // We can only decode into a non-nil pointer
- if rv.Kind() == reflect.Ptr && !rv.IsNil() {
- return
- }
- d.errNotValidPtrValue(rv)
-}
-
-func (d *Decoder) errNotValidPtrValue(rv reflect.Value) {
- if !rv.IsValid() {
- d.error(cannotDecodeIntoNilErr)
- return
- }
- if !rv.CanInterface() {
- d.errorf("cannot decode into a value without an interface: %v", rv)
- return
- }
- rvi := rv.Interface()
- d.errorf("cannot decode into non-pointer or nil pointer. Got: %v, %T, %v", rv.Kind(), rvi, rvi)
-}
-
-func (d *Decoder) error(err error) {
- panic(err)
-}
-
-func (d *Decoder) errorf(format string, params ...interface{}) {
- params2 := make([]interface{}, len(params)+1)
- params2[0] = d.r.numread()
- copy(params2[1:], params)
- err := fmt.Errorf("[pos %d]: "+format, params2...)
- panic(err)
-}
-
-func (d *Decoder) string(v []byte) (s string) {
- if d.is != nil {
- s, ok := d.is[string(v)] // no allocation here.
- if !ok {
- s = string(v)
- d.is[s] = s
- }
- return s
- }
- return string(v) // don't return stringView, as we need a real string here.
-}
-
-func (d *Decoder) intern(s string) {
- if d.is != nil {
- d.is[s] = s
- }
-}
-
-// nextValueBytes returns the next value in the stream as a set of bytes.
-func (d *Decoder) nextValueBytes() []byte {
- d.d.uncacheRead()
- d.r.track()
- d.swallow()
- return d.r.stopTrack()
-}
-
-// --------------------------------------------------
-
-// decSliceHelper assists when decoding into a slice, from a map or an array in the stream.
-// A slice can be set from a map or array in stream. This supports the MapBySlice interface.
-type decSliceHelper struct {
- d *Decoder
- // ct valueType
- array bool
-}
-
-func (d *Decoder) decSliceHelperStart() (x decSliceHelper, clen int) {
- dd := d.d
- ctyp := dd.ContainerType()
- if ctyp == valueTypeArray {
- x.array = true
- clen = dd.ReadArrayStart()
- } else if ctyp == valueTypeMap {
- clen = dd.ReadMapStart() * 2
- } else {
- d.errorf("only encoded map or array can be decoded into a slice (%d)", ctyp)
- }
- // x.ct = ctyp
- x.d = d
- return
-}
-
-func (x decSliceHelper) End() {
- cr := x.d.cr
- if cr == nil {
- return
- }
- if x.array {
- cr.sendContainerState(containerArrayEnd)
- } else {
- cr.sendContainerState(containerMapEnd)
- }
-}
-
-func (x decSliceHelper) ElemContainerState(index int) {
- cr := x.d.cr
- if cr == nil {
- return
- }
- if x.array {
- cr.sendContainerState(containerArrayElem)
- } else {
- if index%2 == 0 {
- cr.sendContainerState(containerMapKey)
- } else {
- cr.sendContainerState(containerMapValue)
- }
- }
-}
-
-func decByteSlice(r decReader, clen int, bs []byte) (bsOut []byte) {
- if clen == 0 {
- return zeroByteSlice
- }
- if len(bs) == clen {
- bsOut = bs
- } else if cap(bs) >= clen {
- bsOut = bs[:clen]
- } else {
- bsOut = make([]byte, clen)
- }
- r.readb(bsOut)
- return
-}
-
-func detachZeroCopyBytes(isBytesReader bool, dest []byte, in []byte) (out []byte) {
- if xlen := len(in); xlen > 0 {
- if isBytesReader || xlen <= scratchByteArrayLen {
- if cap(dest) >= xlen {
- out = dest[:xlen]
- } else {
- out = make([]byte, xlen)
- }
- copy(out, in)
- return
- }
- }
- return in
-}
-
-// decInferLen will infer a sensible length, given the following:
-// - clen: length wanted.
-// - maxlen: max length to be returned.
-// if <= 0, it is unset, and we infer it based on the unit size
-// - unit: number of bytes for each element of the collection
-func decInferLen(clen, maxlen, unit int) (rvlen int, truncated bool) {
- // handle when maxlen is not set i.e. <= 0
- if clen <= 0 {
- return
- }
- if maxlen <= 0 {
- // no maxlen defined. Use maximum of 256K memory, with a floor of 4K items.
- // maxlen = 256 * 1024 / unit
- // if maxlen < (4 * 1024) {
- // maxlen = 4 * 1024
- // }
- if unit < (256 / 4) {
- maxlen = 256 * 1024 / unit
- } else {
- maxlen = 4 * 1024
- }
- }
- if clen > maxlen {
- rvlen = maxlen
- truncated = true
- } else {
- rvlen = clen
- }
- return
- // if clen <= 0 {
- // rvlen = 0
- // } else if maxlen > 0 && clen > maxlen {
- // rvlen = maxlen
- // truncated = true
- // } else {
- // rvlen = clen
- // }
- // return
-}
-
-// // implement overall decReader wrapping both, for possible use inline:
-// type decReaderT struct {
-// bytes bool
-// rb *bytesDecReader
-// ri *ioDecReader
-// }
-//
-// // implement *Decoder as a decReader.
-// // Using decReaderT (defined just above) caused performance degradation
-// // possibly because of constant copying the value,
-// // and some value->interface conversion causing allocation.
-// func (d *Decoder) unreadn1() {
-// if d.bytes {
-// d.rb.unreadn1()
-// } else {
-// d.ri.unreadn1()
-// }
-// }
-// ... for other methods of decReader.
-// Testing showed that performance improvement was negligible.
diff --git a/vendor/github.com/ugorji/go/codec/encode.go b/vendor/github.com/ugorji/go/codec/encode.go
deleted file mode 100644
index a874c744..00000000
--- a/vendor/github.com/ugorji/go/codec/encode.go
+++ /dev/null
@@ -1,1419 +0,0 @@
-// Copyright (c) 2012-2015 Ugorji Nwoke. All rights reserved.
-// Use of this source code is governed by a MIT license found in the LICENSE file.
-
-package codec
-
-import (
- "encoding"
- "fmt"
- "io"
- "reflect"
- "sort"
- "sync"
-)
-
-const (
- defEncByteBufSize = 1 << 6 // 4:16, 6:64, 8:256, 10:1024
-)
-
-// AsSymbolFlag defines what should be encoded as symbols.
-type AsSymbolFlag uint8
-
-const (
- // AsSymbolDefault is default.
- // Currently, this means only encode struct field names as symbols.
- // The default is subject to change.
- AsSymbolDefault AsSymbolFlag = iota
-
- // AsSymbolAll means encode anything which could be a symbol as a symbol.
- AsSymbolAll = 0xfe
-
- // AsSymbolNone means do not encode anything as a symbol.
- AsSymbolNone = 1 << iota
-
- // AsSymbolMapStringKeys means encode keys in map[string]XXX as symbols.
- AsSymbolMapStringKeysFlag
-
- // AsSymbolStructFieldName means encode struct field names as symbols.
- AsSymbolStructFieldNameFlag
-)
-
-// encWriter abstracts writing to a byte array or to an io.Writer.
-type encWriter interface {
- writeb([]byte)
- writestr(string)
- writen1(byte)
- writen2(byte, byte)
- atEndOfEncode()
-}
-
-// encDriver abstracts the actual codec (binc vs msgpack, etc)
-type encDriver interface {
- IsBuiltinType(rt uintptr) bool
- EncodeBuiltin(rt uintptr, v interface{})
- EncodeNil()
- EncodeInt(i int64)
- EncodeUint(i uint64)
- EncodeBool(b bool)
- EncodeFloat32(f float32)
- EncodeFloat64(f float64)
- // encodeExtPreamble(xtag byte, length int)
- EncodeRawExt(re *RawExt, e *Encoder)
- EncodeExt(v interface{}, xtag uint64, ext Ext, e *Encoder)
- EncodeArrayStart(length int)
- EncodeMapStart(length int)
- EncodeString(c charEncoding, v string)
- EncodeSymbol(v string)
- EncodeStringBytes(c charEncoding, v []byte)
- //TODO
- //encBignum(f *big.Int)
- //encStringRunes(c charEncoding, v []rune)
-
- reset()
-}
-
-type encDriverAsis interface {
- EncodeAsis(v []byte)
-}
-
-type encNoSeparator struct{}
-
-func (_ encNoSeparator) EncodeEnd() {}
-
-type ioEncWriterWriter interface {
- WriteByte(c byte) error
- WriteString(s string) (n int, err error)
- Write(p []byte) (n int, err error)
-}
-
-type ioEncStringWriter interface {
- WriteString(s string) (n int, err error)
-}
-
-type EncodeOptions struct {
- // Encode a struct as an array, and not as a map
- StructToArray bool
-
- // Canonical representation means that encoding a value will always result in the same
- // sequence of bytes.
- //
- // This only affects maps, as the iteration order for maps is random.
- //
- // The implementation MAY use the natural sort order for the map keys if possible:
- //
- // - If there is a natural sort order (ie for number, bool, string or []byte keys),
- // then the map keys are first sorted in natural order and then written
- // with corresponding map values to the strema.
- // - If there is no natural sort order, then the map keys will first be
- // encoded into []byte, and then sorted,
- // before writing the sorted keys and the corresponding map values to the stream.
- //
- Canonical bool
-
- // CheckCircularRef controls whether we check for circular references
- // and error fast during an encode.
- //
- // If enabled, an error is received if a pointer to a struct
- // references itself either directly or through one of its fields (iteratively).
- //
- // This is opt-in, as there may be a performance hit to checking circular references.
- CheckCircularRef bool
-
- // AsSymbols defines what should be encoded as symbols.
- //
- // Encoding as symbols can reduce the encoded size significantly.
- //
- // However, during decoding, each string to be encoded as a symbol must
- // be checked to see if it has been seen before. Consequently, encoding time
- // will increase if using symbols, because string comparisons has a clear cost.
- //
- // Sample values:
- // AsSymbolNone
- // AsSymbolAll
- // AsSymbolMapStringKeys
- // AsSymbolMapStringKeysFlag | AsSymbolStructFieldNameFlag
- AsSymbols AsSymbolFlag
-}
-
-// ---------------------------------------------
-
-type simpleIoEncWriterWriter struct {
- w io.Writer
- bw io.ByteWriter
- sw ioEncStringWriter
-}
-
-func (o *simpleIoEncWriterWriter) WriteByte(c byte) (err error) {
- if o.bw != nil {
- return o.bw.WriteByte(c)
- }
- _, err = o.w.Write([]byte{c})
- return
-}
-
-func (o *simpleIoEncWriterWriter) WriteString(s string) (n int, err error) {
- if o.sw != nil {
- return o.sw.WriteString(s)
- }
- // return o.w.Write([]byte(s))
- return o.w.Write(bytesView(s))
-}
-
-func (o *simpleIoEncWriterWriter) Write(p []byte) (n int, err error) {
- return o.w.Write(p)
-}
-
-// ----------------------------------------
-
-// ioEncWriter implements encWriter and can write to an io.Writer implementation
-type ioEncWriter struct {
- w ioEncWriterWriter
- s simpleIoEncWriterWriter
- // x [8]byte // temp byte array re-used internally for efficiency
-}
-
-func (z *ioEncWriter) writeb(bs []byte) {
- if len(bs) == 0 {
- return
- }
- n, err := z.w.Write(bs)
- if err != nil {
- panic(err)
- }
- if n != len(bs) {
- panic(fmt.Errorf("incorrect num bytes written. Expecting: %v, Wrote: %v", len(bs), n))
- }
-}
-
-func (z *ioEncWriter) writestr(s string) {
- n, err := z.w.WriteString(s)
- if err != nil {
- panic(err)
- }
- if n != len(s) {
- panic(fmt.Errorf("incorrect num bytes written. Expecting: %v, Wrote: %v", len(s), n))
- }
-}
-
-func (z *ioEncWriter) writen1(b byte) {
- if err := z.w.WriteByte(b); err != nil {
- panic(err)
- }
-}
-
-func (z *ioEncWriter) writen2(b1 byte, b2 byte) {
- z.writen1(b1)
- z.writen1(b2)
-}
-
-func (z *ioEncWriter) atEndOfEncode() {}
-
-// ----------------------------------------
-
-// bytesEncWriter implements encWriter and can write to an byte slice.
-// It is used by Marshal function.
-type bytesEncWriter struct {
- b []byte
- c int // cursor
- out *[]byte // write out on atEndOfEncode
-}
-
-func (z *bytesEncWriter) writeb(s []byte) {
- if len(s) > 0 {
- c := z.grow(len(s))
- copy(z.b[c:], s)
- }
-}
-
-func (z *bytesEncWriter) writestr(s string) {
- if len(s) > 0 {
- c := z.grow(len(s))
- copy(z.b[c:], s)
- }
-}
-
-func (z *bytesEncWriter) writen1(b1 byte) {
- c := z.grow(1)
- z.b[c] = b1
-}
-
-func (z *bytesEncWriter) writen2(b1 byte, b2 byte) {
- c := z.grow(2)
- z.b[c] = b1
- z.b[c+1] = b2
-}
-
-func (z *bytesEncWriter) atEndOfEncode() {
- *(z.out) = z.b[:z.c]
-}
-
-func (z *bytesEncWriter) grow(n int) (oldcursor int) {
- oldcursor = z.c
- z.c = oldcursor + n
- if z.c > len(z.b) {
- if z.c > cap(z.b) {
- // appendslice logic (if cap < 1024, *2, else *1.25): more expensive. many copy calls.
- // bytes.Buffer model (2*cap + n): much better
- // bs := make([]byte, 2*cap(z.b)+n)
- bs := make([]byte, growCap(cap(z.b), 1, n))
- copy(bs, z.b[:oldcursor])
- z.b = bs
- } else {
- z.b = z.b[:cap(z.b)]
- }
- }
- return
-}
-
-// ---------------------------------------------
-
-type encFnInfo struct {
- e *Encoder
- ti *typeInfo
- xfFn Ext
- xfTag uint64
- seq seqType
-}
-
-func (f *encFnInfo) builtin(rv reflect.Value) {
- f.e.e.EncodeBuiltin(f.ti.rtid, rv.Interface())
-}
-
-func (f *encFnInfo) rawExt(rv reflect.Value) {
- // rev := rv.Interface().(RawExt)
- // f.e.e.EncodeRawExt(&rev, f.e)
- var re *RawExt
- if rv.CanAddr() {
- re = rv.Addr().Interface().(*RawExt)
- } else {
- rev := rv.Interface().(RawExt)
- re = &rev
- }
- f.e.e.EncodeRawExt(re, f.e)
-}
-
-func (f *encFnInfo) ext(rv reflect.Value) {
- // if this is a struct|array and it was addressable, then pass the address directly (not the value)
- if k := rv.Kind(); (k == reflect.Struct || k == reflect.Array) && rv.CanAddr() {
- rv = rv.Addr()
- }
- f.e.e.EncodeExt(rv.Interface(), f.xfTag, f.xfFn, f.e)
-}
-
-func (f *encFnInfo) getValueForMarshalInterface(rv reflect.Value, indir int8) (v interface{}, proceed bool) {
- if indir == 0 {
- v = rv.Interface()
- } else if indir == -1 {
- // If a non-pointer was passed to Encode(), then that value is not addressable.
- // Take addr if addresable, else copy value to an addressable value.
- if rv.CanAddr() {
- v = rv.Addr().Interface()
- } else {
- rv2 := reflect.New(rv.Type())
- rv2.Elem().Set(rv)
- v = rv2.Interface()
- // fmt.Printf("rv.Type: %v, rv2.Type: %v, v: %v\n", rv.Type(), rv2.Type(), v)
- }
- } else {
- for j := int8(0); j < indir; j++ {
- if rv.IsNil() {
- f.e.e.EncodeNil()
- return
- }
- rv = rv.Elem()
- }
- v = rv.Interface()
- }
- return v, true
-}
-
-func (f *encFnInfo) selferMarshal(rv reflect.Value) {
- if v, proceed := f.getValueForMarshalInterface(rv, f.ti.csIndir); proceed {
- v.(Selfer).CodecEncodeSelf(f.e)
- }
-}
-
-func (f *encFnInfo) binaryMarshal(rv reflect.Value) {
- if v, proceed := f.getValueForMarshalInterface(rv, f.ti.bmIndir); proceed {
- bs, fnerr := v.(encoding.BinaryMarshaler).MarshalBinary()
- f.e.marshal(bs, fnerr, false, c_RAW)
- }
-}
-
-func (f *encFnInfo) textMarshal(rv reflect.Value) {
- if v, proceed := f.getValueForMarshalInterface(rv, f.ti.tmIndir); proceed {
- // debugf(">>>> encoding.TextMarshaler: %T", rv.Interface())
- bs, fnerr := v.(encoding.TextMarshaler).MarshalText()
- f.e.marshal(bs, fnerr, false, c_UTF8)
- }
-}
-
-func (f *encFnInfo) jsonMarshal(rv reflect.Value) {
- if v, proceed := f.getValueForMarshalInterface(rv, f.ti.jmIndir); proceed {
- bs, fnerr := v.(jsonMarshaler).MarshalJSON()
- f.e.marshal(bs, fnerr, true, c_UTF8)
- }
-}
-
-func (f *encFnInfo) kBool(rv reflect.Value) {
- f.e.e.EncodeBool(rv.Bool())
-}
-
-func (f *encFnInfo) kString(rv reflect.Value) {
- f.e.e.EncodeString(c_UTF8, rv.String())
-}
-
-func (f *encFnInfo) kFloat64(rv reflect.Value) {
- f.e.e.EncodeFloat64(rv.Float())
-}
-
-func (f *encFnInfo) kFloat32(rv reflect.Value) {
- f.e.e.EncodeFloat32(float32(rv.Float()))
-}
-
-func (f *encFnInfo) kInt(rv reflect.Value) {
- f.e.e.EncodeInt(rv.Int())
-}
-
-func (f *encFnInfo) kUint(rv reflect.Value) {
- f.e.e.EncodeUint(rv.Uint())
-}
-
-func (f *encFnInfo) kInvalid(rv reflect.Value) {
- f.e.e.EncodeNil()
-}
-
-func (f *encFnInfo) kErr(rv reflect.Value) {
- f.e.errorf("unsupported kind %s, for %#v", rv.Kind(), rv)
-}
-
-func (f *encFnInfo) kSlice(rv reflect.Value) {
- ti := f.ti
- // array may be non-addressable, so we have to manage with care
- // (don't call rv.Bytes, rv.Slice, etc).
- // E.g. type struct S{B [2]byte};
- // Encode(S{}) will bomb on "panic: slice of unaddressable array".
- e := f.e
- if f.seq != seqTypeArray {
- if rv.IsNil() {
- e.e.EncodeNil()
- return
- }
- // If in this method, then there was no extension function defined.
- // So it's okay to treat as []byte.
- if ti.rtid == uint8SliceTypId {
- e.e.EncodeStringBytes(c_RAW, rv.Bytes())
- return
- }
- }
- cr := e.cr
- rtelem := ti.rt.Elem()
- l := rv.Len()
- if ti.rtid == uint8SliceTypId || rtelem.Kind() == reflect.Uint8 {
- switch f.seq {
- case seqTypeArray:
- // if l == 0 { e.e.encodeStringBytes(c_RAW, nil) } else
- if rv.CanAddr() {
- e.e.EncodeStringBytes(c_RAW, rv.Slice(0, l).Bytes())
- } else {
- var bs []byte
- if l <= cap(e.b) {
- bs = e.b[:l]
- } else {
- bs = make([]byte, l)
- }
- reflect.Copy(reflect.ValueOf(bs), rv)
- // TODO: Test that reflect.Copy works instead of manual one-by-one
- // for i := 0; i < l; i++ {
- // bs[i] = byte(rv.Index(i).Uint())
- // }
- e.e.EncodeStringBytes(c_RAW, bs)
- }
- case seqTypeSlice:
- e.e.EncodeStringBytes(c_RAW, rv.Bytes())
- case seqTypeChan:
- bs := e.b[:0]
- // do not use range, so that the number of elements encoded
- // does not change, and encoding does not hang waiting on someone to close chan.
- // for b := range rv.Interface().(<-chan byte) {
- // bs = append(bs, b)
- // }
- ch := rv.Interface().(<-chan byte)
- for i := 0; i < l; i++ {
- bs = append(bs, <-ch)
- }
- e.e.EncodeStringBytes(c_RAW, bs)
- }
- return
- }
-
- if ti.mbs {
- if l%2 == 1 {
- e.errorf("mapBySlice requires even slice length, but got %v", l)
- return
- }
- e.e.EncodeMapStart(l / 2)
- } else {
- e.e.EncodeArrayStart(l)
- }
-
- if l > 0 {
- for rtelem.Kind() == reflect.Ptr {
- rtelem = rtelem.Elem()
- }
- // if kind is reflect.Interface, do not pre-determine the
- // encoding type, because preEncodeValue may break it down to
- // a concrete type and kInterface will bomb.
- var fn *encFn
- if rtelem.Kind() != reflect.Interface {
- rtelemid := reflect.ValueOf(rtelem).Pointer()
- fn = e.getEncFn(rtelemid, rtelem, true, true)
- }
- // TODO: Consider perf implication of encoding odd index values as symbols if type is string
- for j := 0; j < l; j++ {
- if cr != nil {
- if ti.mbs {
- if j%2 == 0 {
- cr.sendContainerState(containerMapKey)
- } else {
- cr.sendContainerState(containerMapValue)
- }
- } else {
- cr.sendContainerState(containerArrayElem)
- }
- }
- if f.seq == seqTypeChan {
- if rv2, ok2 := rv.Recv(); ok2 {
- e.encodeValue(rv2, fn)
- } else {
- e.encode(nil) // WE HAVE TO DO SOMETHING, so nil if nothing received.
- }
- } else {
- e.encodeValue(rv.Index(j), fn)
- }
- }
- }
-
- if cr != nil {
- if ti.mbs {
- cr.sendContainerState(containerMapEnd)
- } else {
- cr.sendContainerState(containerArrayEnd)
- }
- }
-}
-
-func (f *encFnInfo) kStruct(rv reflect.Value) {
- fti := f.ti
- e := f.e
- cr := e.cr
- tisfi := fti.sfip
- toMap := !(fti.toArray || e.h.StructToArray)
- newlen := len(fti.sfi)
-
- // Use sync.Pool to reduce allocating slices unnecessarily.
- // The cost of sync.Pool is less than the cost of new allocation.
- pool, poolv, fkvs := encStructPoolGet(newlen)
-
- // if toMap, use the sorted array. If toArray, use unsorted array (to match sequence in struct)
- if toMap {
- tisfi = fti.sfi
- }
- newlen = 0
- var kv stringRv
- for _, si := range tisfi {
- kv.r = si.field(rv, false)
- if toMap {
- if si.omitEmpty && isEmptyValue(kv.r) {
- continue
- }
- kv.v = si.encName
- } else {
- // use the zero value.
- // if a reference or struct, set to nil (so you do not output too much)
- if si.omitEmpty && isEmptyValue(kv.r) {
- switch kv.r.Kind() {
- case reflect.Struct, reflect.Interface, reflect.Ptr, reflect.Array,
- reflect.Map, reflect.Slice:
- kv.r = reflect.Value{} //encode as nil
- }
- }
- }
- fkvs[newlen] = kv
- newlen++
- }
-
- // debugf(">>>> kStruct: newlen: %v", newlen)
- // sep := !e.be
- ee := e.e //don't dereference everytime
-
- if toMap {
- ee.EncodeMapStart(newlen)
- // asSymbols := e.h.AsSymbols&AsSymbolStructFieldNameFlag != 0
- asSymbols := e.h.AsSymbols == AsSymbolDefault || e.h.AsSymbols&AsSymbolStructFieldNameFlag != 0
- for j := 0; j < newlen; j++ {
- kv = fkvs[j]
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- if asSymbols {
- ee.EncodeSymbol(kv.v)
- } else {
- ee.EncodeString(c_UTF8, kv.v)
- }
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- e.encodeValue(kv.r, nil)
- }
- if cr != nil {
- cr.sendContainerState(containerMapEnd)
- }
- } else {
- ee.EncodeArrayStart(newlen)
- for j := 0; j < newlen; j++ {
- kv = fkvs[j]
- if cr != nil {
- cr.sendContainerState(containerArrayElem)
- }
- e.encodeValue(kv.r, nil)
- }
- if cr != nil {
- cr.sendContainerState(containerArrayEnd)
- }
- }
-
- // do not use defer. Instead, use explicit pool return at end of function.
- // defer has a cost we are trying to avoid.
- // If there is a panic and these slices are not returned, it is ok.
- if pool != nil {
- pool.Put(poolv)
- }
-}
-
-// func (f *encFnInfo) kPtr(rv reflect.Value) {
-// debugf(">>>>>>> ??? encode kPtr called - shouldn't get called")
-// if rv.IsNil() {
-// f.e.e.encodeNil()
-// return
-// }
-// f.e.encodeValue(rv.Elem())
-// }
-
-// func (f *encFnInfo) kInterface(rv reflect.Value) {
-// println("kInterface called")
-// debug.PrintStack()
-// if rv.IsNil() {
-// f.e.e.EncodeNil()
-// return
-// }
-// f.e.encodeValue(rv.Elem(), nil)
-// }
-
-func (f *encFnInfo) kMap(rv reflect.Value) {
- ee := f.e.e
- if rv.IsNil() {
- ee.EncodeNil()
- return
- }
-
- l := rv.Len()
- ee.EncodeMapStart(l)
- e := f.e
- cr := e.cr
- if l == 0 {
- if cr != nil {
- cr.sendContainerState(containerMapEnd)
- }
- return
- }
- var asSymbols bool
- // determine the underlying key and val encFn's for the map.
- // This eliminates some work which is done for each loop iteration i.e.
- // rv.Type(), ref.ValueOf(rt).Pointer(), then check map/list for fn.
- //
- // However, if kind is reflect.Interface, do not pre-determine the
- // encoding type, because preEncodeValue may break it down to
- // a concrete type and kInterface will bomb.
- var keyFn, valFn *encFn
- ti := f.ti
- rtkey := ti.rt.Key()
- rtval := ti.rt.Elem()
- rtkeyid := reflect.ValueOf(rtkey).Pointer()
- // keyTypeIsString := f.ti.rt.Key().Kind() == reflect.String
- var keyTypeIsString = rtkeyid == stringTypId
- if keyTypeIsString {
- asSymbols = e.h.AsSymbols&AsSymbolMapStringKeysFlag != 0
- } else {
- for rtkey.Kind() == reflect.Ptr {
- rtkey = rtkey.Elem()
- }
- if rtkey.Kind() != reflect.Interface {
- rtkeyid = reflect.ValueOf(rtkey).Pointer()
- keyFn = e.getEncFn(rtkeyid, rtkey, true, true)
- }
- }
- for rtval.Kind() == reflect.Ptr {
- rtval = rtval.Elem()
- }
- if rtval.Kind() != reflect.Interface {
- rtvalid := reflect.ValueOf(rtval).Pointer()
- valFn = e.getEncFn(rtvalid, rtval, true, true)
- }
- mks := rv.MapKeys()
- // for j, lmks := 0, len(mks); j < lmks; j++ {
-
- if e.h.Canonical {
- e.kMapCanonical(rtkeyid, rtkey, rv, mks, valFn, asSymbols)
- } else {
- for j := range mks {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- if keyTypeIsString {
- if asSymbols {
- ee.EncodeSymbol(mks[j].String())
- } else {
- ee.EncodeString(c_UTF8, mks[j].String())
- }
- } else {
- e.encodeValue(mks[j], keyFn)
- }
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- e.encodeValue(rv.MapIndex(mks[j]), valFn)
- }
- }
- if cr != nil {
- cr.sendContainerState(containerMapEnd)
- }
-}
-
-func (e *Encoder) kMapCanonical(rtkeyid uintptr, rtkey reflect.Type, rv reflect.Value, mks []reflect.Value, valFn *encFn, asSymbols bool) {
- ee := e.e
- cr := e.cr
- // we previously did out-of-band if an extension was registered.
- // This is not necessary, as the natural kind is sufficient for ordering.
-
- if rtkeyid == uint8SliceTypId {
- mksv := make([]bytesRv, len(mks))
- for i, k := range mks {
- v := &mksv[i]
- v.r = k
- v.v = k.Bytes()
- }
- sort.Sort(bytesRvSlice(mksv))
- for i := range mksv {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- ee.EncodeStringBytes(c_RAW, mksv[i].v)
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- e.encodeValue(rv.MapIndex(mksv[i].r), valFn)
- }
- } else {
- switch rtkey.Kind() {
- case reflect.Bool:
- mksv := make([]boolRv, len(mks))
- for i, k := range mks {
- v := &mksv[i]
- v.r = k
- v.v = k.Bool()
- }
- sort.Sort(boolRvSlice(mksv))
- for i := range mksv {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- ee.EncodeBool(mksv[i].v)
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- e.encodeValue(rv.MapIndex(mksv[i].r), valFn)
- }
- case reflect.String:
- mksv := make([]stringRv, len(mks))
- for i, k := range mks {
- v := &mksv[i]
- v.r = k
- v.v = k.String()
- }
- sort.Sort(stringRvSlice(mksv))
- for i := range mksv {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- if asSymbols {
- ee.EncodeSymbol(mksv[i].v)
- } else {
- ee.EncodeString(c_UTF8, mksv[i].v)
- }
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- e.encodeValue(rv.MapIndex(mksv[i].r), valFn)
- }
- case reflect.Uint8, reflect.Uint16, reflect.Uint32, reflect.Uint64, reflect.Uint, reflect.Uintptr:
- mksv := make([]uintRv, len(mks))
- for i, k := range mks {
- v := &mksv[i]
- v.r = k
- v.v = k.Uint()
- }
- sort.Sort(uintRvSlice(mksv))
- for i := range mksv {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- ee.EncodeUint(mksv[i].v)
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- e.encodeValue(rv.MapIndex(mksv[i].r), valFn)
- }
- case reflect.Int8, reflect.Int16, reflect.Int32, reflect.Int64, reflect.Int:
- mksv := make([]intRv, len(mks))
- for i, k := range mks {
- v := &mksv[i]
- v.r = k
- v.v = k.Int()
- }
- sort.Sort(intRvSlice(mksv))
- for i := range mksv {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- ee.EncodeInt(mksv[i].v)
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- e.encodeValue(rv.MapIndex(mksv[i].r), valFn)
- }
- case reflect.Float32:
- mksv := make([]floatRv, len(mks))
- for i, k := range mks {
- v := &mksv[i]
- v.r = k
- v.v = k.Float()
- }
- sort.Sort(floatRvSlice(mksv))
- for i := range mksv {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- ee.EncodeFloat32(float32(mksv[i].v))
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- e.encodeValue(rv.MapIndex(mksv[i].r), valFn)
- }
- case reflect.Float64:
- mksv := make([]floatRv, len(mks))
- for i, k := range mks {
- v := &mksv[i]
- v.r = k
- v.v = k.Float()
- }
- sort.Sort(floatRvSlice(mksv))
- for i := range mksv {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- ee.EncodeFloat64(mksv[i].v)
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- e.encodeValue(rv.MapIndex(mksv[i].r), valFn)
- }
- default:
- // out-of-band
- // first encode each key to a []byte first, then sort them, then record
- var mksv []byte = make([]byte, 0, len(mks)*16) // temporary byte slice for the encoding
- e2 := NewEncoderBytes(&mksv, e.hh)
- mksbv := make([]bytesRv, len(mks))
- for i, k := range mks {
- v := &mksbv[i]
- l := len(mksv)
- e2.MustEncode(k)
- v.r = k
- v.v = mksv[l:]
- // fmt.Printf(">>>>> %s\n", mksv[l:])
- }
- sort.Sort(bytesRvSlice(mksbv))
- for j := range mksbv {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- e.asis(mksbv[j].v)
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- e.encodeValue(rv.MapIndex(mksbv[j].r), valFn)
- }
- }
- }
-}
-
-// --------------------------------------------------
-
-// encFn encapsulates the captured variables and the encode function.
-// This way, we only do some calculations one times, and pass to the
-// code block that should be called (encapsulated in a function)
-// instead of executing the checks every time.
-type encFn struct {
- i encFnInfo
- f func(*encFnInfo, reflect.Value)
-}
-
-// --------------------------------------------------
-
-type encRtidFn struct {
- rtid uintptr
- fn encFn
-}
-
-// An Encoder writes an object to an output stream in the codec format.
-type Encoder struct {
- // hopefully, reduce derefencing cost by laying the encWriter inside the Encoder
- e encDriver
- // NOTE: Encoder shouldn't call it's write methods,
- // as the handler MAY need to do some coordination.
- w encWriter
- s []encRtidFn
- ci set
- be bool // is binary encoding
- js bool // is json handle
-
- wi ioEncWriter
- wb bytesEncWriter
-
- h *BasicHandle
- hh Handle
-
- cr containerStateRecv
- as encDriverAsis
-
- f map[uintptr]*encFn
- b [scratchByteArrayLen]byte
-}
-
-// NewEncoder returns an Encoder for encoding into an io.Writer.
-//
-// For efficiency, Users are encouraged to pass in a memory buffered writer
-// (eg bufio.Writer, bytes.Buffer).
-func NewEncoder(w io.Writer, h Handle) *Encoder {
- e := newEncoder(h)
- e.Reset(w)
- return e
-}
-
-// NewEncoderBytes returns an encoder for encoding directly and efficiently
-// into a byte slice, using zero-copying to temporary slices.
-//
-// It will potentially replace the output byte slice pointed to.
-// After encoding, the out parameter contains the encoded contents.
-func NewEncoderBytes(out *[]byte, h Handle) *Encoder {
- e := newEncoder(h)
- e.ResetBytes(out)
- return e
-}
-
-func newEncoder(h Handle) *Encoder {
- e := &Encoder{hh: h, h: h.getBasicHandle(), be: h.isBinary()}
- _, e.js = h.(*JsonHandle)
- e.e = h.newEncDriver(e)
- e.as, _ = e.e.(encDriverAsis)
- e.cr, _ = e.e.(containerStateRecv)
- return e
-}
-
-// Reset the Encoder with a new output stream.
-//
-// This accomodates using the state of the Encoder,
-// where it has "cached" information about sub-engines.
-func (e *Encoder) Reset(w io.Writer) {
- ww, ok := w.(ioEncWriterWriter)
- if ok {
- e.wi.w = ww
- } else {
- sww := &e.wi.s
- sww.w = w
- sww.bw, _ = w.(io.ByteWriter)
- sww.sw, _ = w.(ioEncStringWriter)
- e.wi.w = sww
- //ww = bufio.NewWriterSize(w, defEncByteBufSize)
- }
- e.w = &e.wi
- e.e.reset()
-}
-
-func (e *Encoder) ResetBytes(out *[]byte) {
- in := *out
- if in == nil {
- in = make([]byte, defEncByteBufSize)
- }
- e.wb.b, e.wb.out, e.wb.c = in, out, 0
- e.w = &e.wb
- e.e.reset()
-}
-
-// func (e *Encoder) sendContainerState(c containerState) {
-// if e.cr != nil {
-// e.cr.sendContainerState(c)
-// }
-// }
-
-// Encode writes an object into a stream.
-//
-// Encoding can be configured via the struct tag for the fields.
-// The "codec" key in struct field's tag value is the key name,
-// followed by an optional comma and options.
-// Note that the "json" key is used in the absence of the "codec" key.
-//
-// To set an option on all fields (e.g. omitempty on all fields), you
-// can create a field called _struct, and set flags on it.
-//
-// Struct values "usually" encode as maps. Each exported struct field is encoded unless:
-// - the field's tag is "-", OR
-// - the field is empty (empty or the zero value) and its tag specifies the "omitempty" option.
-//
-// When encoding as a map, the first string in the tag (before the comma)
-// is the map key string to use when encoding.
-//
-// However, struct values may encode as arrays. This happens when:
-// - StructToArray Encode option is set, OR
-// - the tag on the _struct field sets the "toarray" option
-//
-// Values with types that implement MapBySlice are encoded as stream maps.
-//
-// The empty values (for omitempty option) are false, 0, any nil pointer
-// or interface value, and any array, slice, map, or string of length zero.
-//
-// Anonymous fields are encoded inline except:
-// - the struct tag specifies a replacement name (first value)
-// - the field is of an interface type
-//
-// Examples:
-//
-// // NOTE: 'json:' can be used as struct tag key, in place 'codec:' below.
-// type MyStruct struct {
-// _struct bool `codec:",omitempty"` //set omitempty for every field
-// Field1 string `codec:"-"` //skip this field
-// Field2 int `codec:"myName"` //Use key "myName" in encode stream
-// Field3 int32 `codec:",omitempty"` //use key "Field3". Omit if empty.
-// Field4 bool `codec:"f4,omitempty"` //use key "f4". Omit if empty.
-// io.Reader //use key "Reader".
-// MyStruct `codec:"my1" //use key "my1".
-// MyStruct //inline it
-// ...
-// }
-//
-// type MyStruct struct {
-// _struct bool `codec:",omitempty,toarray"` //set omitempty for every field
-// //and encode struct as an array
-// }
-//
-// The mode of encoding is based on the type of the value. When a value is seen:
-// - If a Selfer, call its CodecEncodeSelf method
-// - If an extension is registered for it, call that extension function
-// - If it implements encoding.(Binary|Text|JSON)Marshaler, call its Marshal(Binary|Text|JSON) method
-// - Else encode it based on its reflect.Kind
-//
-// Note that struct field names and keys in map[string]XXX will be treated as symbols.
-// Some formats support symbols (e.g. binc) and will properly encode the string
-// only once in the stream, and use a tag to refer to it thereafter.
-func (e *Encoder) Encode(v interface{}) (err error) {
- defer panicToErr(&err)
- e.encode(v)
- e.w.atEndOfEncode()
- return
-}
-
-// MustEncode is like Encode, but panics if unable to Encode.
-// This provides insight to the code location that triggered the error.
-func (e *Encoder) MustEncode(v interface{}) {
- e.encode(v)
- e.w.atEndOfEncode()
-}
-
-// comment out these (Must)Write methods. They were only put there to support cbor.
-// However, users already have access to the streams, and can write directly.
-//
-// // Write allows users write to the Encoder stream directly.
-// func (e *Encoder) Write(bs []byte) (err error) {
-// defer panicToErr(&err)
-// e.w.writeb(bs)
-// return
-// }
-// // MustWrite is like write, but panics if unable to Write.
-// func (e *Encoder) MustWrite(bs []byte) {
-// e.w.writeb(bs)
-// }
-
-func (e *Encoder) encode(iv interface{}) {
- // if ics, ok := iv.(Selfer); ok {
- // ics.CodecEncodeSelf(e)
- // return
- // }
-
- switch v := iv.(type) {
- case nil:
- e.e.EncodeNil()
- case Selfer:
- v.CodecEncodeSelf(e)
-
- case reflect.Value:
- e.encodeValue(v, nil)
-
- case string:
- e.e.EncodeString(c_UTF8, v)
- case bool:
- e.e.EncodeBool(v)
- case int:
- e.e.EncodeInt(int64(v))
- case int8:
- e.e.EncodeInt(int64(v))
- case int16:
- e.e.EncodeInt(int64(v))
- case int32:
- e.e.EncodeInt(int64(v))
- case int64:
- e.e.EncodeInt(v)
- case uint:
- e.e.EncodeUint(uint64(v))
- case uint8:
- e.e.EncodeUint(uint64(v))
- case uint16:
- e.e.EncodeUint(uint64(v))
- case uint32:
- e.e.EncodeUint(uint64(v))
- case uint64:
- e.e.EncodeUint(v)
- case float32:
- e.e.EncodeFloat32(v)
- case float64:
- e.e.EncodeFloat64(v)
-
- case []uint8:
- e.e.EncodeStringBytes(c_RAW, v)
-
- case *string:
- e.e.EncodeString(c_UTF8, *v)
- case *bool:
- e.e.EncodeBool(*v)
- case *int:
- e.e.EncodeInt(int64(*v))
- case *int8:
- e.e.EncodeInt(int64(*v))
- case *int16:
- e.e.EncodeInt(int64(*v))
- case *int32:
- e.e.EncodeInt(int64(*v))
- case *int64:
- e.e.EncodeInt(*v)
- case *uint:
- e.e.EncodeUint(uint64(*v))
- case *uint8:
- e.e.EncodeUint(uint64(*v))
- case *uint16:
- e.e.EncodeUint(uint64(*v))
- case *uint32:
- e.e.EncodeUint(uint64(*v))
- case *uint64:
- e.e.EncodeUint(*v)
- case *float32:
- e.e.EncodeFloat32(*v)
- case *float64:
- e.e.EncodeFloat64(*v)
-
- case *[]uint8:
- e.e.EncodeStringBytes(c_RAW, *v)
-
- default:
- const checkCodecSelfer1 = true // in case T is passed, where *T is a Selfer, still checkCodecSelfer
- if !fastpathEncodeTypeSwitch(iv, e) {
- e.encodeI(iv, false, checkCodecSelfer1)
- }
- }
-}
-
-func (e *Encoder) preEncodeValue(rv reflect.Value) (rv2 reflect.Value, sptr uintptr, proceed bool) {
- // use a goto statement instead of a recursive function for ptr/interface.
-TOP:
- switch rv.Kind() {
- case reflect.Ptr:
- if rv.IsNil() {
- e.e.EncodeNil()
- return
- }
- rv = rv.Elem()
- if e.h.CheckCircularRef && rv.Kind() == reflect.Struct {
- // TODO: Movable pointers will be an issue here. Future problem.
- sptr = rv.UnsafeAddr()
- break TOP
- }
- goto TOP
- case reflect.Interface:
- if rv.IsNil() {
- e.e.EncodeNil()
- return
- }
- rv = rv.Elem()
- goto TOP
- case reflect.Slice, reflect.Map:
- if rv.IsNil() {
- e.e.EncodeNil()
- return
- }
- case reflect.Invalid, reflect.Func:
- e.e.EncodeNil()
- return
- }
-
- proceed = true
- rv2 = rv
- return
-}
-
-func (e *Encoder) doEncodeValue(rv reflect.Value, fn *encFn, sptr uintptr,
- checkFastpath, checkCodecSelfer bool) {
- if sptr != 0 {
- if (&e.ci).add(sptr) {
- e.errorf("circular reference found: # %d", sptr)
- }
- }
- if fn == nil {
- rt := rv.Type()
- rtid := reflect.ValueOf(rt).Pointer()
- // fn = e.getEncFn(rtid, rt, true, true)
- fn = e.getEncFn(rtid, rt, checkFastpath, checkCodecSelfer)
- }
- fn.f(&fn.i, rv)
- if sptr != 0 {
- (&e.ci).remove(sptr)
- }
-}
-
-func (e *Encoder) encodeI(iv interface{}, checkFastpath, checkCodecSelfer bool) {
- if rv, sptr, proceed := e.preEncodeValue(reflect.ValueOf(iv)); proceed {
- e.doEncodeValue(rv, nil, sptr, checkFastpath, checkCodecSelfer)
- }
-}
-
-func (e *Encoder) encodeValue(rv reflect.Value, fn *encFn) {
- // if a valid fn is passed, it MUST BE for the dereferenced type of rv
- if rv, sptr, proceed := e.preEncodeValue(rv); proceed {
- e.doEncodeValue(rv, fn, sptr, true, true)
- }
-}
-
-func (e *Encoder) getEncFn(rtid uintptr, rt reflect.Type, checkFastpath, checkCodecSelfer bool) (fn *encFn) {
- // rtid := reflect.ValueOf(rt).Pointer()
- var ok bool
- if useMapForCodecCache {
- fn, ok = e.f[rtid]
- } else {
- for i := range e.s {
- v := &(e.s[i])
- if v.rtid == rtid {
- fn, ok = &(v.fn), true
- break
- }
- }
- }
- if ok {
- return
- }
-
- if useMapForCodecCache {
- if e.f == nil {
- e.f = make(map[uintptr]*encFn, initCollectionCap)
- }
- fn = new(encFn)
- e.f[rtid] = fn
- } else {
- if e.s == nil {
- e.s = make([]encRtidFn, 0, initCollectionCap)
- }
- e.s = append(e.s, encRtidFn{rtid: rtid})
- fn = &(e.s[len(e.s)-1]).fn
- }
-
- ti := e.h.getTypeInfo(rtid, rt)
- fi := &(fn.i)
- fi.e = e
- fi.ti = ti
-
- if checkCodecSelfer && ti.cs {
- fn.f = (*encFnInfo).selferMarshal
- } else if rtid == rawExtTypId {
- fn.f = (*encFnInfo).rawExt
- } else if e.e.IsBuiltinType(rtid) {
- fn.f = (*encFnInfo).builtin
- } else if xfFn := e.h.getExt(rtid); xfFn != nil {
- fi.xfTag, fi.xfFn = xfFn.tag, xfFn.ext
- fn.f = (*encFnInfo).ext
- } else if supportMarshalInterfaces && e.be && ti.bm {
- fn.f = (*encFnInfo).binaryMarshal
- } else if supportMarshalInterfaces && !e.be && e.js && ti.jm {
- //If JSON, we should check JSONMarshal before textMarshal
- fn.f = (*encFnInfo).jsonMarshal
- } else if supportMarshalInterfaces && !e.be && ti.tm {
- fn.f = (*encFnInfo).textMarshal
- } else {
- rk := rt.Kind()
- if fastpathEnabled && checkFastpath && (rk == reflect.Map || rk == reflect.Slice) {
- if rt.PkgPath() == "" { // un-named slice or map
- if idx := fastpathAV.index(rtid); idx != -1 {
- fn.f = fastpathAV[idx].encfn
- }
- } else {
- ok = false
- // use mapping for underlying type if there
- var rtu reflect.Type
- if rk == reflect.Map {
- rtu = reflect.MapOf(rt.Key(), rt.Elem())
- } else {
- rtu = reflect.SliceOf(rt.Elem())
- }
- rtuid := reflect.ValueOf(rtu).Pointer()
- if idx := fastpathAV.index(rtuid); idx != -1 {
- xfnf := fastpathAV[idx].encfn
- xrt := fastpathAV[idx].rt
- fn.f = func(xf *encFnInfo, xrv reflect.Value) {
- xfnf(xf, xrv.Convert(xrt))
- }
- }
- }
- }
- if fn.f == nil {
- switch rk {
- case reflect.Bool:
- fn.f = (*encFnInfo).kBool
- case reflect.String:
- fn.f = (*encFnInfo).kString
- case reflect.Float64:
- fn.f = (*encFnInfo).kFloat64
- case reflect.Float32:
- fn.f = (*encFnInfo).kFloat32
- case reflect.Int, reflect.Int8, reflect.Int64, reflect.Int32, reflect.Int16:
- fn.f = (*encFnInfo).kInt
- case reflect.Uint8, reflect.Uint64, reflect.Uint, reflect.Uint32, reflect.Uint16, reflect.Uintptr:
- fn.f = (*encFnInfo).kUint
- case reflect.Invalid:
- fn.f = (*encFnInfo).kInvalid
- case reflect.Chan:
- fi.seq = seqTypeChan
- fn.f = (*encFnInfo).kSlice
- case reflect.Slice:
- fi.seq = seqTypeSlice
- fn.f = (*encFnInfo).kSlice
- case reflect.Array:
- fi.seq = seqTypeArray
- fn.f = (*encFnInfo).kSlice
- case reflect.Struct:
- fn.f = (*encFnInfo).kStruct
- // reflect.Ptr and reflect.Interface are handled already by preEncodeValue
- // case reflect.Ptr:
- // fn.f = (*encFnInfo).kPtr
- // case reflect.Interface:
- // fn.f = (*encFnInfo).kInterface
- case reflect.Map:
- fn.f = (*encFnInfo).kMap
- default:
- fn.f = (*encFnInfo).kErr
- }
- }
- }
-
- return
-}
-
-func (e *Encoder) marshal(bs []byte, fnerr error, asis bool, c charEncoding) {
- if fnerr != nil {
- panic(fnerr)
- }
- if bs == nil {
- e.e.EncodeNil()
- } else if asis {
- e.asis(bs)
- } else {
- e.e.EncodeStringBytes(c, bs)
- }
-}
-
-func (e *Encoder) asis(v []byte) {
- if e.as == nil {
- e.w.writeb(v)
- } else {
- e.as.EncodeAsis(v)
- }
-}
-
-func (e *Encoder) errorf(format string, params ...interface{}) {
- err := fmt.Errorf(format, params...)
- panic(err)
-}
-
-// ----------------------------------------
-
-const encStructPoolLen = 5
-
-// encStructPool is an array of sync.Pool.
-// Each element of the array pools one of encStructPool(8|16|32|64).
-// It allows the re-use of slices up to 64 in length.
-// A performance cost of encoding structs was collecting
-// which values were empty and should be omitted.
-// We needed slices of reflect.Value and string to collect them.
-// This shared pool reduces the amount of unnecessary creation we do.
-// The cost is that of locking sometimes, but sync.Pool is efficient
-// enough to reduce thread contention.
-var encStructPool [encStructPoolLen]sync.Pool
-
-func init() {
- encStructPool[0].New = func() interface{} { return new([8]stringRv) }
- encStructPool[1].New = func() interface{} { return new([16]stringRv) }
- encStructPool[2].New = func() interface{} { return new([32]stringRv) }
- encStructPool[3].New = func() interface{} { return new([64]stringRv) }
- encStructPool[4].New = func() interface{} { return new([128]stringRv) }
-}
-
-func encStructPoolGet(newlen int) (p *sync.Pool, v interface{}, s []stringRv) {
- // if encStructPoolLen != 5 { // constant chec, so removed at build time.
- // panic(errors.New("encStructPoolLen must be equal to 4")) // defensive, in case it is changed
- // }
- // idxpool := newlen / 8
- if newlen <= 8 {
- p = &encStructPool[0]
- v = p.Get()
- s = v.(*[8]stringRv)[:newlen]
- } else if newlen <= 16 {
- p = &encStructPool[1]
- v = p.Get()
- s = v.(*[16]stringRv)[:newlen]
- } else if newlen <= 32 {
- p = &encStructPool[2]
- v = p.Get()
- s = v.(*[32]stringRv)[:newlen]
- } else if newlen <= 64 {
- p = &encStructPool[3]
- v = p.Get()
- s = v.(*[64]stringRv)[:newlen]
- } else if newlen <= 128 {
- p = &encStructPool[4]
- v = p.Get()
- s = v.(*[128]stringRv)[:newlen]
- } else {
- s = make([]stringRv, newlen)
- }
- return
-}
-
-// ----------------------------------------
-
-// func encErr(format string, params ...interface{}) {
-// doPanic(msgTagEnc, format, params...)
-// }
diff --git a/vendor/github.com/ugorji/go/codec/fast-path.generated.go b/vendor/github.com/ugorji/go/codec/fast-path.generated.go
deleted file mode 100644
index 2039c354..00000000
--- a/vendor/github.com/ugorji/go/codec/fast-path.generated.go
+++ /dev/null
@@ -1,39365 +0,0 @@
-// +build !notfastpath
-
-// Copyright (c) 2012-2015 Ugorji Nwoke. All rights reserved.
-// Use of this source code is governed by a MIT license found in the LICENSE file.
-
-// ************************************************************
-// DO NOT EDIT.
-// THIS FILE IS AUTO-GENERATED from fast-path.go.tmpl
-// ************************************************************
-
-package codec
-
-// Fast path functions try to create a fast path encode or decode implementation
-// for common maps and slices.
-//
-// We define the functions and register then in this single file
-// so as not to pollute the encode.go and decode.go, and create a dependency in there.
-// This file can be omitted without causing a build failure.
-//
-// The advantage of fast paths is:
-// - Many calls bypass reflection altogether
-//
-// Currently support
-// - slice of all builtin types,
-// - map of all builtin types to string or interface value
-// - symetrical maps of all builtin types (e.g. str-str, uint8-uint8)
-// This should provide adequate "typical" implementations.
-//
-// Note that fast track decode functions must handle values for which an address cannot be obtained.
-// For example:
-// m2 := map[string]int{}
-// p2 := []interface{}{m2}
-// // decoding into p2 will bomb if fast track functions do not treat like unaddressable.
-//
-
-import (
- "reflect"
- "sort"
-)
-
-const fastpathCheckNilFalse = false // for reflect
-const fastpathCheckNilTrue = true // for type switch
-
-type fastpathT struct{}
-
-var fastpathTV fastpathT
-
-type fastpathE struct {
- rtid uintptr
- rt reflect.Type
- encfn func(*encFnInfo, reflect.Value)
- decfn func(*decFnInfo, reflect.Value)
-}
-
-type fastpathA [271]fastpathE
-
-func (x *fastpathA) index(rtid uintptr) int {
- // use binary search to grab the index (adapted from sort/search.go)
- h, i, j := 0, 0, 271 // len(x)
- for i < j {
- h = i + (j-i)/2
- if x[h].rtid < rtid {
- i = h + 1
- } else {
- j = h
- }
- }
- if i < 271 && x[i].rtid == rtid {
- return i
- }
- return -1
-}
-
-type fastpathAslice []fastpathE
-
-func (x fastpathAslice) Len() int { return len(x) }
-func (x fastpathAslice) Less(i, j int) bool { return x[i].rtid < x[j].rtid }
-func (x fastpathAslice) Swap(i, j int) { x[i], x[j] = x[j], x[i] }
-
-var fastpathAV fastpathA
-
-// due to possible initialization loop error, make fastpath in an init()
-func init() {
- if !fastpathEnabled {
- return
- }
- i := 0
- fn := func(v interface{}, fe func(*encFnInfo, reflect.Value), fd func(*decFnInfo, reflect.Value)) (f fastpathE) {
- xrt := reflect.TypeOf(v)
- xptr := reflect.ValueOf(xrt).Pointer()
- fastpathAV[i] = fastpathE{xptr, xrt, fe, fd}
- i++
- return
- }
-
- fn([]interface{}(nil), (*encFnInfo).fastpathEncSliceIntfR, (*decFnInfo).fastpathDecSliceIntfR)
- fn([]string(nil), (*encFnInfo).fastpathEncSliceStringR, (*decFnInfo).fastpathDecSliceStringR)
- fn([]float32(nil), (*encFnInfo).fastpathEncSliceFloat32R, (*decFnInfo).fastpathDecSliceFloat32R)
- fn([]float64(nil), (*encFnInfo).fastpathEncSliceFloat64R, (*decFnInfo).fastpathDecSliceFloat64R)
- fn([]uint(nil), (*encFnInfo).fastpathEncSliceUintR, (*decFnInfo).fastpathDecSliceUintR)
- fn([]uint16(nil), (*encFnInfo).fastpathEncSliceUint16R, (*decFnInfo).fastpathDecSliceUint16R)
- fn([]uint32(nil), (*encFnInfo).fastpathEncSliceUint32R, (*decFnInfo).fastpathDecSliceUint32R)
- fn([]uint64(nil), (*encFnInfo).fastpathEncSliceUint64R, (*decFnInfo).fastpathDecSliceUint64R)
- fn([]uintptr(nil), (*encFnInfo).fastpathEncSliceUintptrR, (*decFnInfo).fastpathDecSliceUintptrR)
- fn([]int(nil), (*encFnInfo).fastpathEncSliceIntR, (*decFnInfo).fastpathDecSliceIntR)
- fn([]int8(nil), (*encFnInfo).fastpathEncSliceInt8R, (*decFnInfo).fastpathDecSliceInt8R)
- fn([]int16(nil), (*encFnInfo).fastpathEncSliceInt16R, (*decFnInfo).fastpathDecSliceInt16R)
- fn([]int32(nil), (*encFnInfo).fastpathEncSliceInt32R, (*decFnInfo).fastpathDecSliceInt32R)
- fn([]int64(nil), (*encFnInfo).fastpathEncSliceInt64R, (*decFnInfo).fastpathDecSliceInt64R)
- fn([]bool(nil), (*encFnInfo).fastpathEncSliceBoolR, (*decFnInfo).fastpathDecSliceBoolR)
-
- fn(map[interface{}]interface{}(nil), (*encFnInfo).fastpathEncMapIntfIntfR, (*decFnInfo).fastpathDecMapIntfIntfR)
- fn(map[interface{}]string(nil), (*encFnInfo).fastpathEncMapIntfStringR, (*decFnInfo).fastpathDecMapIntfStringR)
- fn(map[interface{}]uint(nil), (*encFnInfo).fastpathEncMapIntfUintR, (*decFnInfo).fastpathDecMapIntfUintR)
- fn(map[interface{}]uint8(nil), (*encFnInfo).fastpathEncMapIntfUint8R, (*decFnInfo).fastpathDecMapIntfUint8R)
- fn(map[interface{}]uint16(nil), (*encFnInfo).fastpathEncMapIntfUint16R, (*decFnInfo).fastpathDecMapIntfUint16R)
- fn(map[interface{}]uint32(nil), (*encFnInfo).fastpathEncMapIntfUint32R, (*decFnInfo).fastpathDecMapIntfUint32R)
- fn(map[interface{}]uint64(nil), (*encFnInfo).fastpathEncMapIntfUint64R, (*decFnInfo).fastpathDecMapIntfUint64R)
- fn(map[interface{}]uintptr(nil), (*encFnInfo).fastpathEncMapIntfUintptrR, (*decFnInfo).fastpathDecMapIntfUintptrR)
- fn(map[interface{}]int(nil), (*encFnInfo).fastpathEncMapIntfIntR, (*decFnInfo).fastpathDecMapIntfIntR)
- fn(map[interface{}]int8(nil), (*encFnInfo).fastpathEncMapIntfInt8R, (*decFnInfo).fastpathDecMapIntfInt8R)
- fn(map[interface{}]int16(nil), (*encFnInfo).fastpathEncMapIntfInt16R, (*decFnInfo).fastpathDecMapIntfInt16R)
- fn(map[interface{}]int32(nil), (*encFnInfo).fastpathEncMapIntfInt32R, (*decFnInfo).fastpathDecMapIntfInt32R)
- fn(map[interface{}]int64(nil), (*encFnInfo).fastpathEncMapIntfInt64R, (*decFnInfo).fastpathDecMapIntfInt64R)
- fn(map[interface{}]float32(nil), (*encFnInfo).fastpathEncMapIntfFloat32R, (*decFnInfo).fastpathDecMapIntfFloat32R)
- fn(map[interface{}]float64(nil), (*encFnInfo).fastpathEncMapIntfFloat64R, (*decFnInfo).fastpathDecMapIntfFloat64R)
- fn(map[interface{}]bool(nil), (*encFnInfo).fastpathEncMapIntfBoolR, (*decFnInfo).fastpathDecMapIntfBoolR)
- fn(map[string]interface{}(nil), (*encFnInfo).fastpathEncMapStringIntfR, (*decFnInfo).fastpathDecMapStringIntfR)
- fn(map[string]string(nil), (*encFnInfo).fastpathEncMapStringStringR, (*decFnInfo).fastpathDecMapStringStringR)
- fn(map[string]uint(nil), (*encFnInfo).fastpathEncMapStringUintR, (*decFnInfo).fastpathDecMapStringUintR)
- fn(map[string]uint8(nil), (*encFnInfo).fastpathEncMapStringUint8R, (*decFnInfo).fastpathDecMapStringUint8R)
- fn(map[string]uint16(nil), (*encFnInfo).fastpathEncMapStringUint16R, (*decFnInfo).fastpathDecMapStringUint16R)
- fn(map[string]uint32(nil), (*encFnInfo).fastpathEncMapStringUint32R, (*decFnInfo).fastpathDecMapStringUint32R)
- fn(map[string]uint64(nil), (*encFnInfo).fastpathEncMapStringUint64R, (*decFnInfo).fastpathDecMapStringUint64R)
- fn(map[string]uintptr(nil), (*encFnInfo).fastpathEncMapStringUintptrR, (*decFnInfo).fastpathDecMapStringUintptrR)
- fn(map[string]int(nil), (*encFnInfo).fastpathEncMapStringIntR, (*decFnInfo).fastpathDecMapStringIntR)
- fn(map[string]int8(nil), (*encFnInfo).fastpathEncMapStringInt8R, (*decFnInfo).fastpathDecMapStringInt8R)
- fn(map[string]int16(nil), (*encFnInfo).fastpathEncMapStringInt16R, (*decFnInfo).fastpathDecMapStringInt16R)
- fn(map[string]int32(nil), (*encFnInfo).fastpathEncMapStringInt32R, (*decFnInfo).fastpathDecMapStringInt32R)
- fn(map[string]int64(nil), (*encFnInfo).fastpathEncMapStringInt64R, (*decFnInfo).fastpathDecMapStringInt64R)
- fn(map[string]float32(nil), (*encFnInfo).fastpathEncMapStringFloat32R, (*decFnInfo).fastpathDecMapStringFloat32R)
- fn(map[string]float64(nil), (*encFnInfo).fastpathEncMapStringFloat64R, (*decFnInfo).fastpathDecMapStringFloat64R)
- fn(map[string]bool(nil), (*encFnInfo).fastpathEncMapStringBoolR, (*decFnInfo).fastpathDecMapStringBoolR)
- fn(map[float32]interface{}(nil), (*encFnInfo).fastpathEncMapFloat32IntfR, (*decFnInfo).fastpathDecMapFloat32IntfR)
- fn(map[float32]string(nil), (*encFnInfo).fastpathEncMapFloat32StringR, (*decFnInfo).fastpathDecMapFloat32StringR)
- fn(map[float32]uint(nil), (*encFnInfo).fastpathEncMapFloat32UintR, (*decFnInfo).fastpathDecMapFloat32UintR)
- fn(map[float32]uint8(nil), (*encFnInfo).fastpathEncMapFloat32Uint8R, (*decFnInfo).fastpathDecMapFloat32Uint8R)
- fn(map[float32]uint16(nil), (*encFnInfo).fastpathEncMapFloat32Uint16R, (*decFnInfo).fastpathDecMapFloat32Uint16R)
- fn(map[float32]uint32(nil), (*encFnInfo).fastpathEncMapFloat32Uint32R, (*decFnInfo).fastpathDecMapFloat32Uint32R)
- fn(map[float32]uint64(nil), (*encFnInfo).fastpathEncMapFloat32Uint64R, (*decFnInfo).fastpathDecMapFloat32Uint64R)
- fn(map[float32]uintptr(nil), (*encFnInfo).fastpathEncMapFloat32UintptrR, (*decFnInfo).fastpathDecMapFloat32UintptrR)
- fn(map[float32]int(nil), (*encFnInfo).fastpathEncMapFloat32IntR, (*decFnInfo).fastpathDecMapFloat32IntR)
- fn(map[float32]int8(nil), (*encFnInfo).fastpathEncMapFloat32Int8R, (*decFnInfo).fastpathDecMapFloat32Int8R)
- fn(map[float32]int16(nil), (*encFnInfo).fastpathEncMapFloat32Int16R, (*decFnInfo).fastpathDecMapFloat32Int16R)
- fn(map[float32]int32(nil), (*encFnInfo).fastpathEncMapFloat32Int32R, (*decFnInfo).fastpathDecMapFloat32Int32R)
- fn(map[float32]int64(nil), (*encFnInfo).fastpathEncMapFloat32Int64R, (*decFnInfo).fastpathDecMapFloat32Int64R)
- fn(map[float32]float32(nil), (*encFnInfo).fastpathEncMapFloat32Float32R, (*decFnInfo).fastpathDecMapFloat32Float32R)
- fn(map[float32]float64(nil), (*encFnInfo).fastpathEncMapFloat32Float64R, (*decFnInfo).fastpathDecMapFloat32Float64R)
- fn(map[float32]bool(nil), (*encFnInfo).fastpathEncMapFloat32BoolR, (*decFnInfo).fastpathDecMapFloat32BoolR)
- fn(map[float64]interface{}(nil), (*encFnInfo).fastpathEncMapFloat64IntfR, (*decFnInfo).fastpathDecMapFloat64IntfR)
- fn(map[float64]string(nil), (*encFnInfo).fastpathEncMapFloat64StringR, (*decFnInfo).fastpathDecMapFloat64StringR)
- fn(map[float64]uint(nil), (*encFnInfo).fastpathEncMapFloat64UintR, (*decFnInfo).fastpathDecMapFloat64UintR)
- fn(map[float64]uint8(nil), (*encFnInfo).fastpathEncMapFloat64Uint8R, (*decFnInfo).fastpathDecMapFloat64Uint8R)
- fn(map[float64]uint16(nil), (*encFnInfo).fastpathEncMapFloat64Uint16R, (*decFnInfo).fastpathDecMapFloat64Uint16R)
- fn(map[float64]uint32(nil), (*encFnInfo).fastpathEncMapFloat64Uint32R, (*decFnInfo).fastpathDecMapFloat64Uint32R)
- fn(map[float64]uint64(nil), (*encFnInfo).fastpathEncMapFloat64Uint64R, (*decFnInfo).fastpathDecMapFloat64Uint64R)
- fn(map[float64]uintptr(nil), (*encFnInfo).fastpathEncMapFloat64UintptrR, (*decFnInfo).fastpathDecMapFloat64UintptrR)
- fn(map[float64]int(nil), (*encFnInfo).fastpathEncMapFloat64IntR, (*decFnInfo).fastpathDecMapFloat64IntR)
- fn(map[float64]int8(nil), (*encFnInfo).fastpathEncMapFloat64Int8R, (*decFnInfo).fastpathDecMapFloat64Int8R)
- fn(map[float64]int16(nil), (*encFnInfo).fastpathEncMapFloat64Int16R, (*decFnInfo).fastpathDecMapFloat64Int16R)
- fn(map[float64]int32(nil), (*encFnInfo).fastpathEncMapFloat64Int32R, (*decFnInfo).fastpathDecMapFloat64Int32R)
- fn(map[float64]int64(nil), (*encFnInfo).fastpathEncMapFloat64Int64R, (*decFnInfo).fastpathDecMapFloat64Int64R)
- fn(map[float64]float32(nil), (*encFnInfo).fastpathEncMapFloat64Float32R, (*decFnInfo).fastpathDecMapFloat64Float32R)
- fn(map[float64]float64(nil), (*encFnInfo).fastpathEncMapFloat64Float64R, (*decFnInfo).fastpathDecMapFloat64Float64R)
- fn(map[float64]bool(nil), (*encFnInfo).fastpathEncMapFloat64BoolR, (*decFnInfo).fastpathDecMapFloat64BoolR)
- fn(map[uint]interface{}(nil), (*encFnInfo).fastpathEncMapUintIntfR, (*decFnInfo).fastpathDecMapUintIntfR)
- fn(map[uint]string(nil), (*encFnInfo).fastpathEncMapUintStringR, (*decFnInfo).fastpathDecMapUintStringR)
- fn(map[uint]uint(nil), (*encFnInfo).fastpathEncMapUintUintR, (*decFnInfo).fastpathDecMapUintUintR)
- fn(map[uint]uint8(nil), (*encFnInfo).fastpathEncMapUintUint8R, (*decFnInfo).fastpathDecMapUintUint8R)
- fn(map[uint]uint16(nil), (*encFnInfo).fastpathEncMapUintUint16R, (*decFnInfo).fastpathDecMapUintUint16R)
- fn(map[uint]uint32(nil), (*encFnInfo).fastpathEncMapUintUint32R, (*decFnInfo).fastpathDecMapUintUint32R)
- fn(map[uint]uint64(nil), (*encFnInfo).fastpathEncMapUintUint64R, (*decFnInfo).fastpathDecMapUintUint64R)
- fn(map[uint]uintptr(nil), (*encFnInfo).fastpathEncMapUintUintptrR, (*decFnInfo).fastpathDecMapUintUintptrR)
- fn(map[uint]int(nil), (*encFnInfo).fastpathEncMapUintIntR, (*decFnInfo).fastpathDecMapUintIntR)
- fn(map[uint]int8(nil), (*encFnInfo).fastpathEncMapUintInt8R, (*decFnInfo).fastpathDecMapUintInt8R)
- fn(map[uint]int16(nil), (*encFnInfo).fastpathEncMapUintInt16R, (*decFnInfo).fastpathDecMapUintInt16R)
- fn(map[uint]int32(nil), (*encFnInfo).fastpathEncMapUintInt32R, (*decFnInfo).fastpathDecMapUintInt32R)
- fn(map[uint]int64(nil), (*encFnInfo).fastpathEncMapUintInt64R, (*decFnInfo).fastpathDecMapUintInt64R)
- fn(map[uint]float32(nil), (*encFnInfo).fastpathEncMapUintFloat32R, (*decFnInfo).fastpathDecMapUintFloat32R)
- fn(map[uint]float64(nil), (*encFnInfo).fastpathEncMapUintFloat64R, (*decFnInfo).fastpathDecMapUintFloat64R)
- fn(map[uint]bool(nil), (*encFnInfo).fastpathEncMapUintBoolR, (*decFnInfo).fastpathDecMapUintBoolR)
- fn(map[uint8]interface{}(nil), (*encFnInfo).fastpathEncMapUint8IntfR, (*decFnInfo).fastpathDecMapUint8IntfR)
- fn(map[uint8]string(nil), (*encFnInfo).fastpathEncMapUint8StringR, (*decFnInfo).fastpathDecMapUint8StringR)
- fn(map[uint8]uint(nil), (*encFnInfo).fastpathEncMapUint8UintR, (*decFnInfo).fastpathDecMapUint8UintR)
- fn(map[uint8]uint8(nil), (*encFnInfo).fastpathEncMapUint8Uint8R, (*decFnInfo).fastpathDecMapUint8Uint8R)
- fn(map[uint8]uint16(nil), (*encFnInfo).fastpathEncMapUint8Uint16R, (*decFnInfo).fastpathDecMapUint8Uint16R)
- fn(map[uint8]uint32(nil), (*encFnInfo).fastpathEncMapUint8Uint32R, (*decFnInfo).fastpathDecMapUint8Uint32R)
- fn(map[uint8]uint64(nil), (*encFnInfo).fastpathEncMapUint8Uint64R, (*decFnInfo).fastpathDecMapUint8Uint64R)
- fn(map[uint8]uintptr(nil), (*encFnInfo).fastpathEncMapUint8UintptrR, (*decFnInfo).fastpathDecMapUint8UintptrR)
- fn(map[uint8]int(nil), (*encFnInfo).fastpathEncMapUint8IntR, (*decFnInfo).fastpathDecMapUint8IntR)
- fn(map[uint8]int8(nil), (*encFnInfo).fastpathEncMapUint8Int8R, (*decFnInfo).fastpathDecMapUint8Int8R)
- fn(map[uint8]int16(nil), (*encFnInfo).fastpathEncMapUint8Int16R, (*decFnInfo).fastpathDecMapUint8Int16R)
- fn(map[uint8]int32(nil), (*encFnInfo).fastpathEncMapUint8Int32R, (*decFnInfo).fastpathDecMapUint8Int32R)
- fn(map[uint8]int64(nil), (*encFnInfo).fastpathEncMapUint8Int64R, (*decFnInfo).fastpathDecMapUint8Int64R)
- fn(map[uint8]float32(nil), (*encFnInfo).fastpathEncMapUint8Float32R, (*decFnInfo).fastpathDecMapUint8Float32R)
- fn(map[uint8]float64(nil), (*encFnInfo).fastpathEncMapUint8Float64R, (*decFnInfo).fastpathDecMapUint8Float64R)
- fn(map[uint8]bool(nil), (*encFnInfo).fastpathEncMapUint8BoolR, (*decFnInfo).fastpathDecMapUint8BoolR)
- fn(map[uint16]interface{}(nil), (*encFnInfo).fastpathEncMapUint16IntfR, (*decFnInfo).fastpathDecMapUint16IntfR)
- fn(map[uint16]string(nil), (*encFnInfo).fastpathEncMapUint16StringR, (*decFnInfo).fastpathDecMapUint16StringR)
- fn(map[uint16]uint(nil), (*encFnInfo).fastpathEncMapUint16UintR, (*decFnInfo).fastpathDecMapUint16UintR)
- fn(map[uint16]uint8(nil), (*encFnInfo).fastpathEncMapUint16Uint8R, (*decFnInfo).fastpathDecMapUint16Uint8R)
- fn(map[uint16]uint16(nil), (*encFnInfo).fastpathEncMapUint16Uint16R, (*decFnInfo).fastpathDecMapUint16Uint16R)
- fn(map[uint16]uint32(nil), (*encFnInfo).fastpathEncMapUint16Uint32R, (*decFnInfo).fastpathDecMapUint16Uint32R)
- fn(map[uint16]uint64(nil), (*encFnInfo).fastpathEncMapUint16Uint64R, (*decFnInfo).fastpathDecMapUint16Uint64R)
- fn(map[uint16]uintptr(nil), (*encFnInfo).fastpathEncMapUint16UintptrR, (*decFnInfo).fastpathDecMapUint16UintptrR)
- fn(map[uint16]int(nil), (*encFnInfo).fastpathEncMapUint16IntR, (*decFnInfo).fastpathDecMapUint16IntR)
- fn(map[uint16]int8(nil), (*encFnInfo).fastpathEncMapUint16Int8R, (*decFnInfo).fastpathDecMapUint16Int8R)
- fn(map[uint16]int16(nil), (*encFnInfo).fastpathEncMapUint16Int16R, (*decFnInfo).fastpathDecMapUint16Int16R)
- fn(map[uint16]int32(nil), (*encFnInfo).fastpathEncMapUint16Int32R, (*decFnInfo).fastpathDecMapUint16Int32R)
- fn(map[uint16]int64(nil), (*encFnInfo).fastpathEncMapUint16Int64R, (*decFnInfo).fastpathDecMapUint16Int64R)
- fn(map[uint16]float32(nil), (*encFnInfo).fastpathEncMapUint16Float32R, (*decFnInfo).fastpathDecMapUint16Float32R)
- fn(map[uint16]float64(nil), (*encFnInfo).fastpathEncMapUint16Float64R, (*decFnInfo).fastpathDecMapUint16Float64R)
- fn(map[uint16]bool(nil), (*encFnInfo).fastpathEncMapUint16BoolR, (*decFnInfo).fastpathDecMapUint16BoolR)
- fn(map[uint32]interface{}(nil), (*encFnInfo).fastpathEncMapUint32IntfR, (*decFnInfo).fastpathDecMapUint32IntfR)
- fn(map[uint32]string(nil), (*encFnInfo).fastpathEncMapUint32StringR, (*decFnInfo).fastpathDecMapUint32StringR)
- fn(map[uint32]uint(nil), (*encFnInfo).fastpathEncMapUint32UintR, (*decFnInfo).fastpathDecMapUint32UintR)
- fn(map[uint32]uint8(nil), (*encFnInfo).fastpathEncMapUint32Uint8R, (*decFnInfo).fastpathDecMapUint32Uint8R)
- fn(map[uint32]uint16(nil), (*encFnInfo).fastpathEncMapUint32Uint16R, (*decFnInfo).fastpathDecMapUint32Uint16R)
- fn(map[uint32]uint32(nil), (*encFnInfo).fastpathEncMapUint32Uint32R, (*decFnInfo).fastpathDecMapUint32Uint32R)
- fn(map[uint32]uint64(nil), (*encFnInfo).fastpathEncMapUint32Uint64R, (*decFnInfo).fastpathDecMapUint32Uint64R)
- fn(map[uint32]uintptr(nil), (*encFnInfo).fastpathEncMapUint32UintptrR, (*decFnInfo).fastpathDecMapUint32UintptrR)
- fn(map[uint32]int(nil), (*encFnInfo).fastpathEncMapUint32IntR, (*decFnInfo).fastpathDecMapUint32IntR)
- fn(map[uint32]int8(nil), (*encFnInfo).fastpathEncMapUint32Int8R, (*decFnInfo).fastpathDecMapUint32Int8R)
- fn(map[uint32]int16(nil), (*encFnInfo).fastpathEncMapUint32Int16R, (*decFnInfo).fastpathDecMapUint32Int16R)
- fn(map[uint32]int32(nil), (*encFnInfo).fastpathEncMapUint32Int32R, (*decFnInfo).fastpathDecMapUint32Int32R)
- fn(map[uint32]int64(nil), (*encFnInfo).fastpathEncMapUint32Int64R, (*decFnInfo).fastpathDecMapUint32Int64R)
- fn(map[uint32]float32(nil), (*encFnInfo).fastpathEncMapUint32Float32R, (*decFnInfo).fastpathDecMapUint32Float32R)
- fn(map[uint32]float64(nil), (*encFnInfo).fastpathEncMapUint32Float64R, (*decFnInfo).fastpathDecMapUint32Float64R)
- fn(map[uint32]bool(nil), (*encFnInfo).fastpathEncMapUint32BoolR, (*decFnInfo).fastpathDecMapUint32BoolR)
- fn(map[uint64]interface{}(nil), (*encFnInfo).fastpathEncMapUint64IntfR, (*decFnInfo).fastpathDecMapUint64IntfR)
- fn(map[uint64]string(nil), (*encFnInfo).fastpathEncMapUint64StringR, (*decFnInfo).fastpathDecMapUint64StringR)
- fn(map[uint64]uint(nil), (*encFnInfo).fastpathEncMapUint64UintR, (*decFnInfo).fastpathDecMapUint64UintR)
- fn(map[uint64]uint8(nil), (*encFnInfo).fastpathEncMapUint64Uint8R, (*decFnInfo).fastpathDecMapUint64Uint8R)
- fn(map[uint64]uint16(nil), (*encFnInfo).fastpathEncMapUint64Uint16R, (*decFnInfo).fastpathDecMapUint64Uint16R)
- fn(map[uint64]uint32(nil), (*encFnInfo).fastpathEncMapUint64Uint32R, (*decFnInfo).fastpathDecMapUint64Uint32R)
- fn(map[uint64]uint64(nil), (*encFnInfo).fastpathEncMapUint64Uint64R, (*decFnInfo).fastpathDecMapUint64Uint64R)
- fn(map[uint64]uintptr(nil), (*encFnInfo).fastpathEncMapUint64UintptrR, (*decFnInfo).fastpathDecMapUint64UintptrR)
- fn(map[uint64]int(nil), (*encFnInfo).fastpathEncMapUint64IntR, (*decFnInfo).fastpathDecMapUint64IntR)
- fn(map[uint64]int8(nil), (*encFnInfo).fastpathEncMapUint64Int8R, (*decFnInfo).fastpathDecMapUint64Int8R)
- fn(map[uint64]int16(nil), (*encFnInfo).fastpathEncMapUint64Int16R, (*decFnInfo).fastpathDecMapUint64Int16R)
- fn(map[uint64]int32(nil), (*encFnInfo).fastpathEncMapUint64Int32R, (*decFnInfo).fastpathDecMapUint64Int32R)
- fn(map[uint64]int64(nil), (*encFnInfo).fastpathEncMapUint64Int64R, (*decFnInfo).fastpathDecMapUint64Int64R)
- fn(map[uint64]float32(nil), (*encFnInfo).fastpathEncMapUint64Float32R, (*decFnInfo).fastpathDecMapUint64Float32R)
- fn(map[uint64]float64(nil), (*encFnInfo).fastpathEncMapUint64Float64R, (*decFnInfo).fastpathDecMapUint64Float64R)
- fn(map[uint64]bool(nil), (*encFnInfo).fastpathEncMapUint64BoolR, (*decFnInfo).fastpathDecMapUint64BoolR)
- fn(map[uintptr]interface{}(nil), (*encFnInfo).fastpathEncMapUintptrIntfR, (*decFnInfo).fastpathDecMapUintptrIntfR)
- fn(map[uintptr]string(nil), (*encFnInfo).fastpathEncMapUintptrStringR, (*decFnInfo).fastpathDecMapUintptrStringR)
- fn(map[uintptr]uint(nil), (*encFnInfo).fastpathEncMapUintptrUintR, (*decFnInfo).fastpathDecMapUintptrUintR)
- fn(map[uintptr]uint8(nil), (*encFnInfo).fastpathEncMapUintptrUint8R, (*decFnInfo).fastpathDecMapUintptrUint8R)
- fn(map[uintptr]uint16(nil), (*encFnInfo).fastpathEncMapUintptrUint16R, (*decFnInfo).fastpathDecMapUintptrUint16R)
- fn(map[uintptr]uint32(nil), (*encFnInfo).fastpathEncMapUintptrUint32R, (*decFnInfo).fastpathDecMapUintptrUint32R)
- fn(map[uintptr]uint64(nil), (*encFnInfo).fastpathEncMapUintptrUint64R, (*decFnInfo).fastpathDecMapUintptrUint64R)
- fn(map[uintptr]uintptr(nil), (*encFnInfo).fastpathEncMapUintptrUintptrR, (*decFnInfo).fastpathDecMapUintptrUintptrR)
- fn(map[uintptr]int(nil), (*encFnInfo).fastpathEncMapUintptrIntR, (*decFnInfo).fastpathDecMapUintptrIntR)
- fn(map[uintptr]int8(nil), (*encFnInfo).fastpathEncMapUintptrInt8R, (*decFnInfo).fastpathDecMapUintptrInt8R)
- fn(map[uintptr]int16(nil), (*encFnInfo).fastpathEncMapUintptrInt16R, (*decFnInfo).fastpathDecMapUintptrInt16R)
- fn(map[uintptr]int32(nil), (*encFnInfo).fastpathEncMapUintptrInt32R, (*decFnInfo).fastpathDecMapUintptrInt32R)
- fn(map[uintptr]int64(nil), (*encFnInfo).fastpathEncMapUintptrInt64R, (*decFnInfo).fastpathDecMapUintptrInt64R)
- fn(map[uintptr]float32(nil), (*encFnInfo).fastpathEncMapUintptrFloat32R, (*decFnInfo).fastpathDecMapUintptrFloat32R)
- fn(map[uintptr]float64(nil), (*encFnInfo).fastpathEncMapUintptrFloat64R, (*decFnInfo).fastpathDecMapUintptrFloat64R)
- fn(map[uintptr]bool(nil), (*encFnInfo).fastpathEncMapUintptrBoolR, (*decFnInfo).fastpathDecMapUintptrBoolR)
- fn(map[int]interface{}(nil), (*encFnInfo).fastpathEncMapIntIntfR, (*decFnInfo).fastpathDecMapIntIntfR)
- fn(map[int]string(nil), (*encFnInfo).fastpathEncMapIntStringR, (*decFnInfo).fastpathDecMapIntStringR)
- fn(map[int]uint(nil), (*encFnInfo).fastpathEncMapIntUintR, (*decFnInfo).fastpathDecMapIntUintR)
- fn(map[int]uint8(nil), (*encFnInfo).fastpathEncMapIntUint8R, (*decFnInfo).fastpathDecMapIntUint8R)
- fn(map[int]uint16(nil), (*encFnInfo).fastpathEncMapIntUint16R, (*decFnInfo).fastpathDecMapIntUint16R)
- fn(map[int]uint32(nil), (*encFnInfo).fastpathEncMapIntUint32R, (*decFnInfo).fastpathDecMapIntUint32R)
- fn(map[int]uint64(nil), (*encFnInfo).fastpathEncMapIntUint64R, (*decFnInfo).fastpathDecMapIntUint64R)
- fn(map[int]uintptr(nil), (*encFnInfo).fastpathEncMapIntUintptrR, (*decFnInfo).fastpathDecMapIntUintptrR)
- fn(map[int]int(nil), (*encFnInfo).fastpathEncMapIntIntR, (*decFnInfo).fastpathDecMapIntIntR)
- fn(map[int]int8(nil), (*encFnInfo).fastpathEncMapIntInt8R, (*decFnInfo).fastpathDecMapIntInt8R)
- fn(map[int]int16(nil), (*encFnInfo).fastpathEncMapIntInt16R, (*decFnInfo).fastpathDecMapIntInt16R)
- fn(map[int]int32(nil), (*encFnInfo).fastpathEncMapIntInt32R, (*decFnInfo).fastpathDecMapIntInt32R)
- fn(map[int]int64(nil), (*encFnInfo).fastpathEncMapIntInt64R, (*decFnInfo).fastpathDecMapIntInt64R)
- fn(map[int]float32(nil), (*encFnInfo).fastpathEncMapIntFloat32R, (*decFnInfo).fastpathDecMapIntFloat32R)
- fn(map[int]float64(nil), (*encFnInfo).fastpathEncMapIntFloat64R, (*decFnInfo).fastpathDecMapIntFloat64R)
- fn(map[int]bool(nil), (*encFnInfo).fastpathEncMapIntBoolR, (*decFnInfo).fastpathDecMapIntBoolR)
- fn(map[int8]interface{}(nil), (*encFnInfo).fastpathEncMapInt8IntfR, (*decFnInfo).fastpathDecMapInt8IntfR)
- fn(map[int8]string(nil), (*encFnInfo).fastpathEncMapInt8StringR, (*decFnInfo).fastpathDecMapInt8StringR)
- fn(map[int8]uint(nil), (*encFnInfo).fastpathEncMapInt8UintR, (*decFnInfo).fastpathDecMapInt8UintR)
- fn(map[int8]uint8(nil), (*encFnInfo).fastpathEncMapInt8Uint8R, (*decFnInfo).fastpathDecMapInt8Uint8R)
- fn(map[int8]uint16(nil), (*encFnInfo).fastpathEncMapInt8Uint16R, (*decFnInfo).fastpathDecMapInt8Uint16R)
- fn(map[int8]uint32(nil), (*encFnInfo).fastpathEncMapInt8Uint32R, (*decFnInfo).fastpathDecMapInt8Uint32R)
- fn(map[int8]uint64(nil), (*encFnInfo).fastpathEncMapInt8Uint64R, (*decFnInfo).fastpathDecMapInt8Uint64R)
- fn(map[int8]uintptr(nil), (*encFnInfo).fastpathEncMapInt8UintptrR, (*decFnInfo).fastpathDecMapInt8UintptrR)
- fn(map[int8]int(nil), (*encFnInfo).fastpathEncMapInt8IntR, (*decFnInfo).fastpathDecMapInt8IntR)
- fn(map[int8]int8(nil), (*encFnInfo).fastpathEncMapInt8Int8R, (*decFnInfo).fastpathDecMapInt8Int8R)
- fn(map[int8]int16(nil), (*encFnInfo).fastpathEncMapInt8Int16R, (*decFnInfo).fastpathDecMapInt8Int16R)
- fn(map[int8]int32(nil), (*encFnInfo).fastpathEncMapInt8Int32R, (*decFnInfo).fastpathDecMapInt8Int32R)
- fn(map[int8]int64(nil), (*encFnInfo).fastpathEncMapInt8Int64R, (*decFnInfo).fastpathDecMapInt8Int64R)
- fn(map[int8]float32(nil), (*encFnInfo).fastpathEncMapInt8Float32R, (*decFnInfo).fastpathDecMapInt8Float32R)
- fn(map[int8]float64(nil), (*encFnInfo).fastpathEncMapInt8Float64R, (*decFnInfo).fastpathDecMapInt8Float64R)
- fn(map[int8]bool(nil), (*encFnInfo).fastpathEncMapInt8BoolR, (*decFnInfo).fastpathDecMapInt8BoolR)
- fn(map[int16]interface{}(nil), (*encFnInfo).fastpathEncMapInt16IntfR, (*decFnInfo).fastpathDecMapInt16IntfR)
- fn(map[int16]string(nil), (*encFnInfo).fastpathEncMapInt16StringR, (*decFnInfo).fastpathDecMapInt16StringR)
- fn(map[int16]uint(nil), (*encFnInfo).fastpathEncMapInt16UintR, (*decFnInfo).fastpathDecMapInt16UintR)
- fn(map[int16]uint8(nil), (*encFnInfo).fastpathEncMapInt16Uint8R, (*decFnInfo).fastpathDecMapInt16Uint8R)
- fn(map[int16]uint16(nil), (*encFnInfo).fastpathEncMapInt16Uint16R, (*decFnInfo).fastpathDecMapInt16Uint16R)
- fn(map[int16]uint32(nil), (*encFnInfo).fastpathEncMapInt16Uint32R, (*decFnInfo).fastpathDecMapInt16Uint32R)
- fn(map[int16]uint64(nil), (*encFnInfo).fastpathEncMapInt16Uint64R, (*decFnInfo).fastpathDecMapInt16Uint64R)
- fn(map[int16]uintptr(nil), (*encFnInfo).fastpathEncMapInt16UintptrR, (*decFnInfo).fastpathDecMapInt16UintptrR)
- fn(map[int16]int(nil), (*encFnInfo).fastpathEncMapInt16IntR, (*decFnInfo).fastpathDecMapInt16IntR)
- fn(map[int16]int8(nil), (*encFnInfo).fastpathEncMapInt16Int8R, (*decFnInfo).fastpathDecMapInt16Int8R)
- fn(map[int16]int16(nil), (*encFnInfo).fastpathEncMapInt16Int16R, (*decFnInfo).fastpathDecMapInt16Int16R)
- fn(map[int16]int32(nil), (*encFnInfo).fastpathEncMapInt16Int32R, (*decFnInfo).fastpathDecMapInt16Int32R)
- fn(map[int16]int64(nil), (*encFnInfo).fastpathEncMapInt16Int64R, (*decFnInfo).fastpathDecMapInt16Int64R)
- fn(map[int16]float32(nil), (*encFnInfo).fastpathEncMapInt16Float32R, (*decFnInfo).fastpathDecMapInt16Float32R)
- fn(map[int16]float64(nil), (*encFnInfo).fastpathEncMapInt16Float64R, (*decFnInfo).fastpathDecMapInt16Float64R)
- fn(map[int16]bool(nil), (*encFnInfo).fastpathEncMapInt16BoolR, (*decFnInfo).fastpathDecMapInt16BoolR)
- fn(map[int32]interface{}(nil), (*encFnInfo).fastpathEncMapInt32IntfR, (*decFnInfo).fastpathDecMapInt32IntfR)
- fn(map[int32]string(nil), (*encFnInfo).fastpathEncMapInt32StringR, (*decFnInfo).fastpathDecMapInt32StringR)
- fn(map[int32]uint(nil), (*encFnInfo).fastpathEncMapInt32UintR, (*decFnInfo).fastpathDecMapInt32UintR)
- fn(map[int32]uint8(nil), (*encFnInfo).fastpathEncMapInt32Uint8R, (*decFnInfo).fastpathDecMapInt32Uint8R)
- fn(map[int32]uint16(nil), (*encFnInfo).fastpathEncMapInt32Uint16R, (*decFnInfo).fastpathDecMapInt32Uint16R)
- fn(map[int32]uint32(nil), (*encFnInfo).fastpathEncMapInt32Uint32R, (*decFnInfo).fastpathDecMapInt32Uint32R)
- fn(map[int32]uint64(nil), (*encFnInfo).fastpathEncMapInt32Uint64R, (*decFnInfo).fastpathDecMapInt32Uint64R)
- fn(map[int32]uintptr(nil), (*encFnInfo).fastpathEncMapInt32UintptrR, (*decFnInfo).fastpathDecMapInt32UintptrR)
- fn(map[int32]int(nil), (*encFnInfo).fastpathEncMapInt32IntR, (*decFnInfo).fastpathDecMapInt32IntR)
- fn(map[int32]int8(nil), (*encFnInfo).fastpathEncMapInt32Int8R, (*decFnInfo).fastpathDecMapInt32Int8R)
- fn(map[int32]int16(nil), (*encFnInfo).fastpathEncMapInt32Int16R, (*decFnInfo).fastpathDecMapInt32Int16R)
- fn(map[int32]int32(nil), (*encFnInfo).fastpathEncMapInt32Int32R, (*decFnInfo).fastpathDecMapInt32Int32R)
- fn(map[int32]int64(nil), (*encFnInfo).fastpathEncMapInt32Int64R, (*decFnInfo).fastpathDecMapInt32Int64R)
- fn(map[int32]float32(nil), (*encFnInfo).fastpathEncMapInt32Float32R, (*decFnInfo).fastpathDecMapInt32Float32R)
- fn(map[int32]float64(nil), (*encFnInfo).fastpathEncMapInt32Float64R, (*decFnInfo).fastpathDecMapInt32Float64R)
- fn(map[int32]bool(nil), (*encFnInfo).fastpathEncMapInt32BoolR, (*decFnInfo).fastpathDecMapInt32BoolR)
- fn(map[int64]interface{}(nil), (*encFnInfo).fastpathEncMapInt64IntfR, (*decFnInfo).fastpathDecMapInt64IntfR)
- fn(map[int64]string(nil), (*encFnInfo).fastpathEncMapInt64StringR, (*decFnInfo).fastpathDecMapInt64StringR)
- fn(map[int64]uint(nil), (*encFnInfo).fastpathEncMapInt64UintR, (*decFnInfo).fastpathDecMapInt64UintR)
- fn(map[int64]uint8(nil), (*encFnInfo).fastpathEncMapInt64Uint8R, (*decFnInfo).fastpathDecMapInt64Uint8R)
- fn(map[int64]uint16(nil), (*encFnInfo).fastpathEncMapInt64Uint16R, (*decFnInfo).fastpathDecMapInt64Uint16R)
- fn(map[int64]uint32(nil), (*encFnInfo).fastpathEncMapInt64Uint32R, (*decFnInfo).fastpathDecMapInt64Uint32R)
- fn(map[int64]uint64(nil), (*encFnInfo).fastpathEncMapInt64Uint64R, (*decFnInfo).fastpathDecMapInt64Uint64R)
- fn(map[int64]uintptr(nil), (*encFnInfo).fastpathEncMapInt64UintptrR, (*decFnInfo).fastpathDecMapInt64UintptrR)
- fn(map[int64]int(nil), (*encFnInfo).fastpathEncMapInt64IntR, (*decFnInfo).fastpathDecMapInt64IntR)
- fn(map[int64]int8(nil), (*encFnInfo).fastpathEncMapInt64Int8R, (*decFnInfo).fastpathDecMapInt64Int8R)
- fn(map[int64]int16(nil), (*encFnInfo).fastpathEncMapInt64Int16R, (*decFnInfo).fastpathDecMapInt64Int16R)
- fn(map[int64]int32(nil), (*encFnInfo).fastpathEncMapInt64Int32R, (*decFnInfo).fastpathDecMapInt64Int32R)
- fn(map[int64]int64(nil), (*encFnInfo).fastpathEncMapInt64Int64R, (*decFnInfo).fastpathDecMapInt64Int64R)
- fn(map[int64]float32(nil), (*encFnInfo).fastpathEncMapInt64Float32R, (*decFnInfo).fastpathDecMapInt64Float32R)
- fn(map[int64]float64(nil), (*encFnInfo).fastpathEncMapInt64Float64R, (*decFnInfo).fastpathDecMapInt64Float64R)
- fn(map[int64]bool(nil), (*encFnInfo).fastpathEncMapInt64BoolR, (*decFnInfo).fastpathDecMapInt64BoolR)
- fn(map[bool]interface{}(nil), (*encFnInfo).fastpathEncMapBoolIntfR, (*decFnInfo).fastpathDecMapBoolIntfR)
- fn(map[bool]string(nil), (*encFnInfo).fastpathEncMapBoolStringR, (*decFnInfo).fastpathDecMapBoolStringR)
- fn(map[bool]uint(nil), (*encFnInfo).fastpathEncMapBoolUintR, (*decFnInfo).fastpathDecMapBoolUintR)
- fn(map[bool]uint8(nil), (*encFnInfo).fastpathEncMapBoolUint8R, (*decFnInfo).fastpathDecMapBoolUint8R)
- fn(map[bool]uint16(nil), (*encFnInfo).fastpathEncMapBoolUint16R, (*decFnInfo).fastpathDecMapBoolUint16R)
- fn(map[bool]uint32(nil), (*encFnInfo).fastpathEncMapBoolUint32R, (*decFnInfo).fastpathDecMapBoolUint32R)
- fn(map[bool]uint64(nil), (*encFnInfo).fastpathEncMapBoolUint64R, (*decFnInfo).fastpathDecMapBoolUint64R)
- fn(map[bool]uintptr(nil), (*encFnInfo).fastpathEncMapBoolUintptrR, (*decFnInfo).fastpathDecMapBoolUintptrR)
- fn(map[bool]int(nil), (*encFnInfo).fastpathEncMapBoolIntR, (*decFnInfo).fastpathDecMapBoolIntR)
- fn(map[bool]int8(nil), (*encFnInfo).fastpathEncMapBoolInt8R, (*decFnInfo).fastpathDecMapBoolInt8R)
- fn(map[bool]int16(nil), (*encFnInfo).fastpathEncMapBoolInt16R, (*decFnInfo).fastpathDecMapBoolInt16R)
- fn(map[bool]int32(nil), (*encFnInfo).fastpathEncMapBoolInt32R, (*decFnInfo).fastpathDecMapBoolInt32R)
- fn(map[bool]int64(nil), (*encFnInfo).fastpathEncMapBoolInt64R, (*decFnInfo).fastpathDecMapBoolInt64R)
- fn(map[bool]float32(nil), (*encFnInfo).fastpathEncMapBoolFloat32R, (*decFnInfo).fastpathDecMapBoolFloat32R)
- fn(map[bool]float64(nil), (*encFnInfo).fastpathEncMapBoolFloat64R, (*decFnInfo).fastpathDecMapBoolFloat64R)
- fn(map[bool]bool(nil), (*encFnInfo).fastpathEncMapBoolBoolR, (*decFnInfo).fastpathDecMapBoolBoolR)
-
- sort.Sort(fastpathAslice(fastpathAV[:]))
-}
-
-// -- encode
-
-// -- -- fast path type switch
-func fastpathEncodeTypeSwitch(iv interface{}, e *Encoder) bool {
- if !fastpathEnabled {
- return false
- }
- switch v := iv.(type) {
-
- case []interface{}:
- fastpathTV.EncSliceIntfV(v, fastpathCheckNilTrue, e)
- case *[]interface{}:
- fastpathTV.EncSliceIntfV(*v, fastpathCheckNilTrue, e)
-
- case map[interface{}]interface{}:
- fastpathTV.EncMapIntfIntfV(v, fastpathCheckNilTrue, e)
- case *map[interface{}]interface{}:
- fastpathTV.EncMapIntfIntfV(*v, fastpathCheckNilTrue, e)
-
- case map[interface{}]string:
- fastpathTV.EncMapIntfStringV(v, fastpathCheckNilTrue, e)
- case *map[interface{}]string:
- fastpathTV.EncMapIntfStringV(*v, fastpathCheckNilTrue, e)
-
- case map[interface{}]uint:
- fastpathTV.EncMapIntfUintV(v, fastpathCheckNilTrue, e)
- case *map[interface{}]uint:
- fastpathTV.EncMapIntfUintV(*v, fastpathCheckNilTrue, e)
-
- case map[interface{}]uint8:
- fastpathTV.EncMapIntfUint8V(v, fastpathCheckNilTrue, e)
- case *map[interface{}]uint8:
- fastpathTV.EncMapIntfUint8V(*v, fastpathCheckNilTrue, e)
-
- case map[interface{}]uint16:
- fastpathTV.EncMapIntfUint16V(v, fastpathCheckNilTrue, e)
- case *map[interface{}]uint16:
- fastpathTV.EncMapIntfUint16V(*v, fastpathCheckNilTrue, e)
-
- case map[interface{}]uint32:
- fastpathTV.EncMapIntfUint32V(v, fastpathCheckNilTrue, e)
- case *map[interface{}]uint32:
- fastpathTV.EncMapIntfUint32V(*v, fastpathCheckNilTrue, e)
-
- case map[interface{}]uint64:
- fastpathTV.EncMapIntfUint64V(v, fastpathCheckNilTrue, e)
- case *map[interface{}]uint64:
- fastpathTV.EncMapIntfUint64V(*v, fastpathCheckNilTrue, e)
-
- case map[interface{}]uintptr:
- fastpathTV.EncMapIntfUintptrV(v, fastpathCheckNilTrue, e)
- case *map[interface{}]uintptr:
- fastpathTV.EncMapIntfUintptrV(*v, fastpathCheckNilTrue, e)
-
- case map[interface{}]int:
- fastpathTV.EncMapIntfIntV(v, fastpathCheckNilTrue, e)
- case *map[interface{}]int:
- fastpathTV.EncMapIntfIntV(*v, fastpathCheckNilTrue, e)
-
- case map[interface{}]int8:
- fastpathTV.EncMapIntfInt8V(v, fastpathCheckNilTrue, e)
- case *map[interface{}]int8:
- fastpathTV.EncMapIntfInt8V(*v, fastpathCheckNilTrue, e)
-
- case map[interface{}]int16:
- fastpathTV.EncMapIntfInt16V(v, fastpathCheckNilTrue, e)
- case *map[interface{}]int16:
- fastpathTV.EncMapIntfInt16V(*v, fastpathCheckNilTrue, e)
-
- case map[interface{}]int32:
- fastpathTV.EncMapIntfInt32V(v, fastpathCheckNilTrue, e)
- case *map[interface{}]int32:
- fastpathTV.EncMapIntfInt32V(*v, fastpathCheckNilTrue, e)
-
- case map[interface{}]int64:
- fastpathTV.EncMapIntfInt64V(v, fastpathCheckNilTrue, e)
- case *map[interface{}]int64:
- fastpathTV.EncMapIntfInt64V(*v, fastpathCheckNilTrue, e)
-
- case map[interface{}]float32:
- fastpathTV.EncMapIntfFloat32V(v, fastpathCheckNilTrue, e)
- case *map[interface{}]float32:
- fastpathTV.EncMapIntfFloat32V(*v, fastpathCheckNilTrue, e)
-
- case map[interface{}]float64:
- fastpathTV.EncMapIntfFloat64V(v, fastpathCheckNilTrue, e)
- case *map[interface{}]float64:
- fastpathTV.EncMapIntfFloat64V(*v, fastpathCheckNilTrue, e)
-
- case map[interface{}]bool:
- fastpathTV.EncMapIntfBoolV(v, fastpathCheckNilTrue, e)
- case *map[interface{}]bool:
- fastpathTV.EncMapIntfBoolV(*v, fastpathCheckNilTrue, e)
-
- case []string:
- fastpathTV.EncSliceStringV(v, fastpathCheckNilTrue, e)
- case *[]string:
- fastpathTV.EncSliceStringV(*v, fastpathCheckNilTrue, e)
-
- case map[string]interface{}:
- fastpathTV.EncMapStringIntfV(v, fastpathCheckNilTrue, e)
- case *map[string]interface{}:
- fastpathTV.EncMapStringIntfV(*v, fastpathCheckNilTrue, e)
-
- case map[string]string:
- fastpathTV.EncMapStringStringV(v, fastpathCheckNilTrue, e)
- case *map[string]string:
- fastpathTV.EncMapStringStringV(*v, fastpathCheckNilTrue, e)
-
- case map[string]uint:
- fastpathTV.EncMapStringUintV(v, fastpathCheckNilTrue, e)
- case *map[string]uint:
- fastpathTV.EncMapStringUintV(*v, fastpathCheckNilTrue, e)
-
- case map[string]uint8:
- fastpathTV.EncMapStringUint8V(v, fastpathCheckNilTrue, e)
- case *map[string]uint8:
- fastpathTV.EncMapStringUint8V(*v, fastpathCheckNilTrue, e)
-
- case map[string]uint16:
- fastpathTV.EncMapStringUint16V(v, fastpathCheckNilTrue, e)
- case *map[string]uint16:
- fastpathTV.EncMapStringUint16V(*v, fastpathCheckNilTrue, e)
-
- case map[string]uint32:
- fastpathTV.EncMapStringUint32V(v, fastpathCheckNilTrue, e)
- case *map[string]uint32:
- fastpathTV.EncMapStringUint32V(*v, fastpathCheckNilTrue, e)
-
- case map[string]uint64:
- fastpathTV.EncMapStringUint64V(v, fastpathCheckNilTrue, e)
- case *map[string]uint64:
- fastpathTV.EncMapStringUint64V(*v, fastpathCheckNilTrue, e)
-
- case map[string]uintptr:
- fastpathTV.EncMapStringUintptrV(v, fastpathCheckNilTrue, e)
- case *map[string]uintptr:
- fastpathTV.EncMapStringUintptrV(*v, fastpathCheckNilTrue, e)
-
- case map[string]int:
- fastpathTV.EncMapStringIntV(v, fastpathCheckNilTrue, e)
- case *map[string]int:
- fastpathTV.EncMapStringIntV(*v, fastpathCheckNilTrue, e)
-
- case map[string]int8:
- fastpathTV.EncMapStringInt8V(v, fastpathCheckNilTrue, e)
- case *map[string]int8:
- fastpathTV.EncMapStringInt8V(*v, fastpathCheckNilTrue, e)
-
- case map[string]int16:
- fastpathTV.EncMapStringInt16V(v, fastpathCheckNilTrue, e)
- case *map[string]int16:
- fastpathTV.EncMapStringInt16V(*v, fastpathCheckNilTrue, e)
-
- case map[string]int32:
- fastpathTV.EncMapStringInt32V(v, fastpathCheckNilTrue, e)
- case *map[string]int32:
- fastpathTV.EncMapStringInt32V(*v, fastpathCheckNilTrue, e)
-
- case map[string]int64:
- fastpathTV.EncMapStringInt64V(v, fastpathCheckNilTrue, e)
- case *map[string]int64:
- fastpathTV.EncMapStringInt64V(*v, fastpathCheckNilTrue, e)
-
- case map[string]float32:
- fastpathTV.EncMapStringFloat32V(v, fastpathCheckNilTrue, e)
- case *map[string]float32:
- fastpathTV.EncMapStringFloat32V(*v, fastpathCheckNilTrue, e)
-
- case map[string]float64:
- fastpathTV.EncMapStringFloat64V(v, fastpathCheckNilTrue, e)
- case *map[string]float64:
- fastpathTV.EncMapStringFloat64V(*v, fastpathCheckNilTrue, e)
-
- case map[string]bool:
- fastpathTV.EncMapStringBoolV(v, fastpathCheckNilTrue, e)
- case *map[string]bool:
- fastpathTV.EncMapStringBoolV(*v, fastpathCheckNilTrue, e)
-
- case []float32:
- fastpathTV.EncSliceFloat32V(v, fastpathCheckNilTrue, e)
- case *[]float32:
- fastpathTV.EncSliceFloat32V(*v, fastpathCheckNilTrue, e)
-
- case map[float32]interface{}:
- fastpathTV.EncMapFloat32IntfV(v, fastpathCheckNilTrue, e)
- case *map[float32]interface{}:
- fastpathTV.EncMapFloat32IntfV(*v, fastpathCheckNilTrue, e)
-
- case map[float32]string:
- fastpathTV.EncMapFloat32StringV(v, fastpathCheckNilTrue, e)
- case *map[float32]string:
- fastpathTV.EncMapFloat32StringV(*v, fastpathCheckNilTrue, e)
-
- case map[float32]uint:
- fastpathTV.EncMapFloat32UintV(v, fastpathCheckNilTrue, e)
- case *map[float32]uint:
- fastpathTV.EncMapFloat32UintV(*v, fastpathCheckNilTrue, e)
-
- case map[float32]uint8:
- fastpathTV.EncMapFloat32Uint8V(v, fastpathCheckNilTrue, e)
- case *map[float32]uint8:
- fastpathTV.EncMapFloat32Uint8V(*v, fastpathCheckNilTrue, e)
-
- case map[float32]uint16:
- fastpathTV.EncMapFloat32Uint16V(v, fastpathCheckNilTrue, e)
- case *map[float32]uint16:
- fastpathTV.EncMapFloat32Uint16V(*v, fastpathCheckNilTrue, e)
-
- case map[float32]uint32:
- fastpathTV.EncMapFloat32Uint32V(v, fastpathCheckNilTrue, e)
- case *map[float32]uint32:
- fastpathTV.EncMapFloat32Uint32V(*v, fastpathCheckNilTrue, e)
-
- case map[float32]uint64:
- fastpathTV.EncMapFloat32Uint64V(v, fastpathCheckNilTrue, e)
- case *map[float32]uint64:
- fastpathTV.EncMapFloat32Uint64V(*v, fastpathCheckNilTrue, e)
-
- case map[float32]uintptr:
- fastpathTV.EncMapFloat32UintptrV(v, fastpathCheckNilTrue, e)
- case *map[float32]uintptr:
- fastpathTV.EncMapFloat32UintptrV(*v, fastpathCheckNilTrue, e)
-
- case map[float32]int:
- fastpathTV.EncMapFloat32IntV(v, fastpathCheckNilTrue, e)
- case *map[float32]int:
- fastpathTV.EncMapFloat32IntV(*v, fastpathCheckNilTrue, e)
-
- case map[float32]int8:
- fastpathTV.EncMapFloat32Int8V(v, fastpathCheckNilTrue, e)
- case *map[float32]int8:
- fastpathTV.EncMapFloat32Int8V(*v, fastpathCheckNilTrue, e)
-
- case map[float32]int16:
- fastpathTV.EncMapFloat32Int16V(v, fastpathCheckNilTrue, e)
- case *map[float32]int16:
- fastpathTV.EncMapFloat32Int16V(*v, fastpathCheckNilTrue, e)
-
- case map[float32]int32:
- fastpathTV.EncMapFloat32Int32V(v, fastpathCheckNilTrue, e)
- case *map[float32]int32:
- fastpathTV.EncMapFloat32Int32V(*v, fastpathCheckNilTrue, e)
-
- case map[float32]int64:
- fastpathTV.EncMapFloat32Int64V(v, fastpathCheckNilTrue, e)
- case *map[float32]int64:
- fastpathTV.EncMapFloat32Int64V(*v, fastpathCheckNilTrue, e)
-
- case map[float32]float32:
- fastpathTV.EncMapFloat32Float32V(v, fastpathCheckNilTrue, e)
- case *map[float32]float32:
- fastpathTV.EncMapFloat32Float32V(*v, fastpathCheckNilTrue, e)
-
- case map[float32]float64:
- fastpathTV.EncMapFloat32Float64V(v, fastpathCheckNilTrue, e)
- case *map[float32]float64:
- fastpathTV.EncMapFloat32Float64V(*v, fastpathCheckNilTrue, e)
-
- case map[float32]bool:
- fastpathTV.EncMapFloat32BoolV(v, fastpathCheckNilTrue, e)
- case *map[float32]bool:
- fastpathTV.EncMapFloat32BoolV(*v, fastpathCheckNilTrue, e)
-
- case []float64:
- fastpathTV.EncSliceFloat64V(v, fastpathCheckNilTrue, e)
- case *[]float64:
- fastpathTV.EncSliceFloat64V(*v, fastpathCheckNilTrue, e)
-
- case map[float64]interface{}:
- fastpathTV.EncMapFloat64IntfV(v, fastpathCheckNilTrue, e)
- case *map[float64]interface{}:
- fastpathTV.EncMapFloat64IntfV(*v, fastpathCheckNilTrue, e)
-
- case map[float64]string:
- fastpathTV.EncMapFloat64StringV(v, fastpathCheckNilTrue, e)
- case *map[float64]string:
- fastpathTV.EncMapFloat64StringV(*v, fastpathCheckNilTrue, e)
-
- case map[float64]uint:
- fastpathTV.EncMapFloat64UintV(v, fastpathCheckNilTrue, e)
- case *map[float64]uint:
- fastpathTV.EncMapFloat64UintV(*v, fastpathCheckNilTrue, e)
-
- case map[float64]uint8:
- fastpathTV.EncMapFloat64Uint8V(v, fastpathCheckNilTrue, e)
- case *map[float64]uint8:
- fastpathTV.EncMapFloat64Uint8V(*v, fastpathCheckNilTrue, e)
-
- case map[float64]uint16:
- fastpathTV.EncMapFloat64Uint16V(v, fastpathCheckNilTrue, e)
- case *map[float64]uint16:
- fastpathTV.EncMapFloat64Uint16V(*v, fastpathCheckNilTrue, e)
-
- case map[float64]uint32:
- fastpathTV.EncMapFloat64Uint32V(v, fastpathCheckNilTrue, e)
- case *map[float64]uint32:
- fastpathTV.EncMapFloat64Uint32V(*v, fastpathCheckNilTrue, e)
-
- case map[float64]uint64:
- fastpathTV.EncMapFloat64Uint64V(v, fastpathCheckNilTrue, e)
- case *map[float64]uint64:
- fastpathTV.EncMapFloat64Uint64V(*v, fastpathCheckNilTrue, e)
-
- case map[float64]uintptr:
- fastpathTV.EncMapFloat64UintptrV(v, fastpathCheckNilTrue, e)
- case *map[float64]uintptr:
- fastpathTV.EncMapFloat64UintptrV(*v, fastpathCheckNilTrue, e)
-
- case map[float64]int:
- fastpathTV.EncMapFloat64IntV(v, fastpathCheckNilTrue, e)
- case *map[float64]int:
- fastpathTV.EncMapFloat64IntV(*v, fastpathCheckNilTrue, e)
-
- case map[float64]int8:
- fastpathTV.EncMapFloat64Int8V(v, fastpathCheckNilTrue, e)
- case *map[float64]int8:
- fastpathTV.EncMapFloat64Int8V(*v, fastpathCheckNilTrue, e)
-
- case map[float64]int16:
- fastpathTV.EncMapFloat64Int16V(v, fastpathCheckNilTrue, e)
- case *map[float64]int16:
- fastpathTV.EncMapFloat64Int16V(*v, fastpathCheckNilTrue, e)
-
- case map[float64]int32:
- fastpathTV.EncMapFloat64Int32V(v, fastpathCheckNilTrue, e)
- case *map[float64]int32:
- fastpathTV.EncMapFloat64Int32V(*v, fastpathCheckNilTrue, e)
-
- case map[float64]int64:
- fastpathTV.EncMapFloat64Int64V(v, fastpathCheckNilTrue, e)
- case *map[float64]int64:
- fastpathTV.EncMapFloat64Int64V(*v, fastpathCheckNilTrue, e)
-
- case map[float64]float32:
- fastpathTV.EncMapFloat64Float32V(v, fastpathCheckNilTrue, e)
- case *map[float64]float32:
- fastpathTV.EncMapFloat64Float32V(*v, fastpathCheckNilTrue, e)
-
- case map[float64]float64:
- fastpathTV.EncMapFloat64Float64V(v, fastpathCheckNilTrue, e)
- case *map[float64]float64:
- fastpathTV.EncMapFloat64Float64V(*v, fastpathCheckNilTrue, e)
-
- case map[float64]bool:
- fastpathTV.EncMapFloat64BoolV(v, fastpathCheckNilTrue, e)
- case *map[float64]bool:
- fastpathTV.EncMapFloat64BoolV(*v, fastpathCheckNilTrue, e)
-
- case []uint:
- fastpathTV.EncSliceUintV(v, fastpathCheckNilTrue, e)
- case *[]uint:
- fastpathTV.EncSliceUintV(*v, fastpathCheckNilTrue, e)
-
- case map[uint]interface{}:
- fastpathTV.EncMapUintIntfV(v, fastpathCheckNilTrue, e)
- case *map[uint]interface{}:
- fastpathTV.EncMapUintIntfV(*v, fastpathCheckNilTrue, e)
-
- case map[uint]string:
- fastpathTV.EncMapUintStringV(v, fastpathCheckNilTrue, e)
- case *map[uint]string:
- fastpathTV.EncMapUintStringV(*v, fastpathCheckNilTrue, e)
-
- case map[uint]uint:
- fastpathTV.EncMapUintUintV(v, fastpathCheckNilTrue, e)
- case *map[uint]uint:
- fastpathTV.EncMapUintUintV(*v, fastpathCheckNilTrue, e)
-
- case map[uint]uint8:
- fastpathTV.EncMapUintUint8V(v, fastpathCheckNilTrue, e)
- case *map[uint]uint8:
- fastpathTV.EncMapUintUint8V(*v, fastpathCheckNilTrue, e)
-
- case map[uint]uint16:
- fastpathTV.EncMapUintUint16V(v, fastpathCheckNilTrue, e)
- case *map[uint]uint16:
- fastpathTV.EncMapUintUint16V(*v, fastpathCheckNilTrue, e)
-
- case map[uint]uint32:
- fastpathTV.EncMapUintUint32V(v, fastpathCheckNilTrue, e)
- case *map[uint]uint32:
- fastpathTV.EncMapUintUint32V(*v, fastpathCheckNilTrue, e)
-
- case map[uint]uint64:
- fastpathTV.EncMapUintUint64V(v, fastpathCheckNilTrue, e)
- case *map[uint]uint64:
- fastpathTV.EncMapUintUint64V(*v, fastpathCheckNilTrue, e)
-
- case map[uint]uintptr:
- fastpathTV.EncMapUintUintptrV(v, fastpathCheckNilTrue, e)
- case *map[uint]uintptr:
- fastpathTV.EncMapUintUintptrV(*v, fastpathCheckNilTrue, e)
-
- case map[uint]int:
- fastpathTV.EncMapUintIntV(v, fastpathCheckNilTrue, e)
- case *map[uint]int:
- fastpathTV.EncMapUintIntV(*v, fastpathCheckNilTrue, e)
-
- case map[uint]int8:
- fastpathTV.EncMapUintInt8V(v, fastpathCheckNilTrue, e)
- case *map[uint]int8:
- fastpathTV.EncMapUintInt8V(*v, fastpathCheckNilTrue, e)
-
- case map[uint]int16:
- fastpathTV.EncMapUintInt16V(v, fastpathCheckNilTrue, e)
- case *map[uint]int16:
- fastpathTV.EncMapUintInt16V(*v, fastpathCheckNilTrue, e)
-
- case map[uint]int32:
- fastpathTV.EncMapUintInt32V(v, fastpathCheckNilTrue, e)
- case *map[uint]int32:
- fastpathTV.EncMapUintInt32V(*v, fastpathCheckNilTrue, e)
-
- case map[uint]int64:
- fastpathTV.EncMapUintInt64V(v, fastpathCheckNilTrue, e)
- case *map[uint]int64:
- fastpathTV.EncMapUintInt64V(*v, fastpathCheckNilTrue, e)
-
- case map[uint]float32:
- fastpathTV.EncMapUintFloat32V(v, fastpathCheckNilTrue, e)
- case *map[uint]float32:
- fastpathTV.EncMapUintFloat32V(*v, fastpathCheckNilTrue, e)
-
- case map[uint]float64:
- fastpathTV.EncMapUintFloat64V(v, fastpathCheckNilTrue, e)
- case *map[uint]float64:
- fastpathTV.EncMapUintFloat64V(*v, fastpathCheckNilTrue, e)
-
- case map[uint]bool:
- fastpathTV.EncMapUintBoolV(v, fastpathCheckNilTrue, e)
- case *map[uint]bool:
- fastpathTV.EncMapUintBoolV(*v, fastpathCheckNilTrue, e)
-
- case map[uint8]interface{}:
- fastpathTV.EncMapUint8IntfV(v, fastpathCheckNilTrue, e)
- case *map[uint8]interface{}:
- fastpathTV.EncMapUint8IntfV(*v, fastpathCheckNilTrue, e)
-
- case map[uint8]string:
- fastpathTV.EncMapUint8StringV(v, fastpathCheckNilTrue, e)
- case *map[uint8]string:
- fastpathTV.EncMapUint8StringV(*v, fastpathCheckNilTrue, e)
-
- case map[uint8]uint:
- fastpathTV.EncMapUint8UintV(v, fastpathCheckNilTrue, e)
- case *map[uint8]uint:
- fastpathTV.EncMapUint8UintV(*v, fastpathCheckNilTrue, e)
-
- case map[uint8]uint8:
- fastpathTV.EncMapUint8Uint8V(v, fastpathCheckNilTrue, e)
- case *map[uint8]uint8:
- fastpathTV.EncMapUint8Uint8V(*v, fastpathCheckNilTrue, e)
-
- case map[uint8]uint16:
- fastpathTV.EncMapUint8Uint16V(v, fastpathCheckNilTrue, e)
- case *map[uint8]uint16:
- fastpathTV.EncMapUint8Uint16V(*v, fastpathCheckNilTrue, e)
-
- case map[uint8]uint32:
- fastpathTV.EncMapUint8Uint32V(v, fastpathCheckNilTrue, e)
- case *map[uint8]uint32:
- fastpathTV.EncMapUint8Uint32V(*v, fastpathCheckNilTrue, e)
-
- case map[uint8]uint64:
- fastpathTV.EncMapUint8Uint64V(v, fastpathCheckNilTrue, e)
- case *map[uint8]uint64:
- fastpathTV.EncMapUint8Uint64V(*v, fastpathCheckNilTrue, e)
-
- case map[uint8]uintptr:
- fastpathTV.EncMapUint8UintptrV(v, fastpathCheckNilTrue, e)
- case *map[uint8]uintptr:
- fastpathTV.EncMapUint8UintptrV(*v, fastpathCheckNilTrue, e)
-
- case map[uint8]int:
- fastpathTV.EncMapUint8IntV(v, fastpathCheckNilTrue, e)
- case *map[uint8]int:
- fastpathTV.EncMapUint8IntV(*v, fastpathCheckNilTrue, e)
-
- case map[uint8]int8:
- fastpathTV.EncMapUint8Int8V(v, fastpathCheckNilTrue, e)
- case *map[uint8]int8:
- fastpathTV.EncMapUint8Int8V(*v, fastpathCheckNilTrue, e)
-
- case map[uint8]int16:
- fastpathTV.EncMapUint8Int16V(v, fastpathCheckNilTrue, e)
- case *map[uint8]int16:
- fastpathTV.EncMapUint8Int16V(*v, fastpathCheckNilTrue, e)
-
- case map[uint8]int32:
- fastpathTV.EncMapUint8Int32V(v, fastpathCheckNilTrue, e)
- case *map[uint8]int32:
- fastpathTV.EncMapUint8Int32V(*v, fastpathCheckNilTrue, e)
-
- case map[uint8]int64:
- fastpathTV.EncMapUint8Int64V(v, fastpathCheckNilTrue, e)
- case *map[uint8]int64:
- fastpathTV.EncMapUint8Int64V(*v, fastpathCheckNilTrue, e)
-
- case map[uint8]float32:
- fastpathTV.EncMapUint8Float32V(v, fastpathCheckNilTrue, e)
- case *map[uint8]float32:
- fastpathTV.EncMapUint8Float32V(*v, fastpathCheckNilTrue, e)
-
- case map[uint8]float64:
- fastpathTV.EncMapUint8Float64V(v, fastpathCheckNilTrue, e)
- case *map[uint8]float64:
- fastpathTV.EncMapUint8Float64V(*v, fastpathCheckNilTrue, e)
-
- case map[uint8]bool:
- fastpathTV.EncMapUint8BoolV(v, fastpathCheckNilTrue, e)
- case *map[uint8]bool:
- fastpathTV.EncMapUint8BoolV(*v, fastpathCheckNilTrue, e)
-
- case []uint16:
- fastpathTV.EncSliceUint16V(v, fastpathCheckNilTrue, e)
- case *[]uint16:
- fastpathTV.EncSliceUint16V(*v, fastpathCheckNilTrue, e)
-
- case map[uint16]interface{}:
- fastpathTV.EncMapUint16IntfV(v, fastpathCheckNilTrue, e)
- case *map[uint16]interface{}:
- fastpathTV.EncMapUint16IntfV(*v, fastpathCheckNilTrue, e)
-
- case map[uint16]string:
- fastpathTV.EncMapUint16StringV(v, fastpathCheckNilTrue, e)
- case *map[uint16]string:
- fastpathTV.EncMapUint16StringV(*v, fastpathCheckNilTrue, e)
-
- case map[uint16]uint:
- fastpathTV.EncMapUint16UintV(v, fastpathCheckNilTrue, e)
- case *map[uint16]uint:
- fastpathTV.EncMapUint16UintV(*v, fastpathCheckNilTrue, e)
-
- case map[uint16]uint8:
- fastpathTV.EncMapUint16Uint8V(v, fastpathCheckNilTrue, e)
- case *map[uint16]uint8:
- fastpathTV.EncMapUint16Uint8V(*v, fastpathCheckNilTrue, e)
-
- case map[uint16]uint16:
- fastpathTV.EncMapUint16Uint16V(v, fastpathCheckNilTrue, e)
- case *map[uint16]uint16:
- fastpathTV.EncMapUint16Uint16V(*v, fastpathCheckNilTrue, e)
-
- case map[uint16]uint32:
- fastpathTV.EncMapUint16Uint32V(v, fastpathCheckNilTrue, e)
- case *map[uint16]uint32:
- fastpathTV.EncMapUint16Uint32V(*v, fastpathCheckNilTrue, e)
-
- case map[uint16]uint64:
- fastpathTV.EncMapUint16Uint64V(v, fastpathCheckNilTrue, e)
- case *map[uint16]uint64:
- fastpathTV.EncMapUint16Uint64V(*v, fastpathCheckNilTrue, e)
-
- case map[uint16]uintptr:
- fastpathTV.EncMapUint16UintptrV(v, fastpathCheckNilTrue, e)
- case *map[uint16]uintptr:
- fastpathTV.EncMapUint16UintptrV(*v, fastpathCheckNilTrue, e)
-
- case map[uint16]int:
- fastpathTV.EncMapUint16IntV(v, fastpathCheckNilTrue, e)
- case *map[uint16]int:
- fastpathTV.EncMapUint16IntV(*v, fastpathCheckNilTrue, e)
-
- case map[uint16]int8:
- fastpathTV.EncMapUint16Int8V(v, fastpathCheckNilTrue, e)
- case *map[uint16]int8:
- fastpathTV.EncMapUint16Int8V(*v, fastpathCheckNilTrue, e)
-
- case map[uint16]int16:
- fastpathTV.EncMapUint16Int16V(v, fastpathCheckNilTrue, e)
- case *map[uint16]int16:
- fastpathTV.EncMapUint16Int16V(*v, fastpathCheckNilTrue, e)
-
- case map[uint16]int32:
- fastpathTV.EncMapUint16Int32V(v, fastpathCheckNilTrue, e)
- case *map[uint16]int32:
- fastpathTV.EncMapUint16Int32V(*v, fastpathCheckNilTrue, e)
-
- case map[uint16]int64:
- fastpathTV.EncMapUint16Int64V(v, fastpathCheckNilTrue, e)
- case *map[uint16]int64:
- fastpathTV.EncMapUint16Int64V(*v, fastpathCheckNilTrue, e)
-
- case map[uint16]float32:
- fastpathTV.EncMapUint16Float32V(v, fastpathCheckNilTrue, e)
- case *map[uint16]float32:
- fastpathTV.EncMapUint16Float32V(*v, fastpathCheckNilTrue, e)
-
- case map[uint16]float64:
- fastpathTV.EncMapUint16Float64V(v, fastpathCheckNilTrue, e)
- case *map[uint16]float64:
- fastpathTV.EncMapUint16Float64V(*v, fastpathCheckNilTrue, e)
-
- case map[uint16]bool:
- fastpathTV.EncMapUint16BoolV(v, fastpathCheckNilTrue, e)
- case *map[uint16]bool:
- fastpathTV.EncMapUint16BoolV(*v, fastpathCheckNilTrue, e)
-
- case []uint32:
- fastpathTV.EncSliceUint32V(v, fastpathCheckNilTrue, e)
- case *[]uint32:
- fastpathTV.EncSliceUint32V(*v, fastpathCheckNilTrue, e)
-
- case map[uint32]interface{}:
- fastpathTV.EncMapUint32IntfV(v, fastpathCheckNilTrue, e)
- case *map[uint32]interface{}:
- fastpathTV.EncMapUint32IntfV(*v, fastpathCheckNilTrue, e)
-
- case map[uint32]string:
- fastpathTV.EncMapUint32StringV(v, fastpathCheckNilTrue, e)
- case *map[uint32]string:
- fastpathTV.EncMapUint32StringV(*v, fastpathCheckNilTrue, e)
-
- case map[uint32]uint:
- fastpathTV.EncMapUint32UintV(v, fastpathCheckNilTrue, e)
- case *map[uint32]uint:
- fastpathTV.EncMapUint32UintV(*v, fastpathCheckNilTrue, e)
-
- case map[uint32]uint8:
- fastpathTV.EncMapUint32Uint8V(v, fastpathCheckNilTrue, e)
- case *map[uint32]uint8:
- fastpathTV.EncMapUint32Uint8V(*v, fastpathCheckNilTrue, e)
-
- case map[uint32]uint16:
- fastpathTV.EncMapUint32Uint16V(v, fastpathCheckNilTrue, e)
- case *map[uint32]uint16:
- fastpathTV.EncMapUint32Uint16V(*v, fastpathCheckNilTrue, e)
-
- case map[uint32]uint32:
- fastpathTV.EncMapUint32Uint32V(v, fastpathCheckNilTrue, e)
- case *map[uint32]uint32:
- fastpathTV.EncMapUint32Uint32V(*v, fastpathCheckNilTrue, e)
-
- case map[uint32]uint64:
- fastpathTV.EncMapUint32Uint64V(v, fastpathCheckNilTrue, e)
- case *map[uint32]uint64:
- fastpathTV.EncMapUint32Uint64V(*v, fastpathCheckNilTrue, e)
-
- case map[uint32]uintptr:
- fastpathTV.EncMapUint32UintptrV(v, fastpathCheckNilTrue, e)
- case *map[uint32]uintptr:
- fastpathTV.EncMapUint32UintptrV(*v, fastpathCheckNilTrue, e)
-
- case map[uint32]int:
- fastpathTV.EncMapUint32IntV(v, fastpathCheckNilTrue, e)
- case *map[uint32]int:
- fastpathTV.EncMapUint32IntV(*v, fastpathCheckNilTrue, e)
-
- case map[uint32]int8:
- fastpathTV.EncMapUint32Int8V(v, fastpathCheckNilTrue, e)
- case *map[uint32]int8:
- fastpathTV.EncMapUint32Int8V(*v, fastpathCheckNilTrue, e)
-
- case map[uint32]int16:
- fastpathTV.EncMapUint32Int16V(v, fastpathCheckNilTrue, e)
- case *map[uint32]int16:
- fastpathTV.EncMapUint32Int16V(*v, fastpathCheckNilTrue, e)
-
- case map[uint32]int32:
- fastpathTV.EncMapUint32Int32V(v, fastpathCheckNilTrue, e)
- case *map[uint32]int32:
- fastpathTV.EncMapUint32Int32V(*v, fastpathCheckNilTrue, e)
-
- case map[uint32]int64:
- fastpathTV.EncMapUint32Int64V(v, fastpathCheckNilTrue, e)
- case *map[uint32]int64:
- fastpathTV.EncMapUint32Int64V(*v, fastpathCheckNilTrue, e)
-
- case map[uint32]float32:
- fastpathTV.EncMapUint32Float32V(v, fastpathCheckNilTrue, e)
- case *map[uint32]float32:
- fastpathTV.EncMapUint32Float32V(*v, fastpathCheckNilTrue, e)
-
- case map[uint32]float64:
- fastpathTV.EncMapUint32Float64V(v, fastpathCheckNilTrue, e)
- case *map[uint32]float64:
- fastpathTV.EncMapUint32Float64V(*v, fastpathCheckNilTrue, e)
-
- case map[uint32]bool:
- fastpathTV.EncMapUint32BoolV(v, fastpathCheckNilTrue, e)
- case *map[uint32]bool:
- fastpathTV.EncMapUint32BoolV(*v, fastpathCheckNilTrue, e)
-
- case []uint64:
- fastpathTV.EncSliceUint64V(v, fastpathCheckNilTrue, e)
- case *[]uint64:
- fastpathTV.EncSliceUint64V(*v, fastpathCheckNilTrue, e)
-
- case map[uint64]interface{}:
- fastpathTV.EncMapUint64IntfV(v, fastpathCheckNilTrue, e)
- case *map[uint64]interface{}:
- fastpathTV.EncMapUint64IntfV(*v, fastpathCheckNilTrue, e)
-
- case map[uint64]string:
- fastpathTV.EncMapUint64StringV(v, fastpathCheckNilTrue, e)
- case *map[uint64]string:
- fastpathTV.EncMapUint64StringV(*v, fastpathCheckNilTrue, e)
-
- case map[uint64]uint:
- fastpathTV.EncMapUint64UintV(v, fastpathCheckNilTrue, e)
- case *map[uint64]uint:
- fastpathTV.EncMapUint64UintV(*v, fastpathCheckNilTrue, e)
-
- case map[uint64]uint8:
- fastpathTV.EncMapUint64Uint8V(v, fastpathCheckNilTrue, e)
- case *map[uint64]uint8:
- fastpathTV.EncMapUint64Uint8V(*v, fastpathCheckNilTrue, e)
-
- case map[uint64]uint16:
- fastpathTV.EncMapUint64Uint16V(v, fastpathCheckNilTrue, e)
- case *map[uint64]uint16:
- fastpathTV.EncMapUint64Uint16V(*v, fastpathCheckNilTrue, e)
-
- case map[uint64]uint32:
- fastpathTV.EncMapUint64Uint32V(v, fastpathCheckNilTrue, e)
- case *map[uint64]uint32:
- fastpathTV.EncMapUint64Uint32V(*v, fastpathCheckNilTrue, e)
-
- case map[uint64]uint64:
- fastpathTV.EncMapUint64Uint64V(v, fastpathCheckNilTrue, e)
- case *map[uint64]uint64:
- fastpathTV.EncMapUint64Uint64V(*v, fastpathCheckNilTrue, e)
-
- case map[uint64]uintptr:
- fastpathTV.EncMapUint64UintptrV(v, fastpathCheckNilTrue, e)
- case *map[uint64]uintptr:
- fastpathTV.EncMapUint64UintptrV(*v, fastpathCheckNilTrue, e)
-
- case map[uint64]int:
- fastpathTV.EncMapUint64IntV(v, fastpathCheckNilTrue, e)
- case *map[uint64]int:
- fastpathTV.EncMapUint64IntV(*v, fastpathCheckNilTrue, e)
-
- case map[uint64]int8:
- fastpathTV.EncMapUint64Int8V(v, fastpathCheckNilTrue, e)
- case *map[uint64]int8:
- fastpathTV.EncMapUint64Int8V(*v, fastpathCheckNilTrue, e)
-
- case map[uint64]int16:
- fastpathTV.EncMapUint64Int16V(v, fastpathCheckNilTrue, e)
- case *map[uint64]int16:
- fastpathTV.EncMapUint64Int16V(*v, fastpathCheckNilTrue, e)
-
- case map[uint64]int32:
- fastpathTV.EncMapUint64Int32V(v, fastpathCheckNilTrue, e)
- case *map[uint64]int32:
- fastpathTV.EncMapUint64Int32V(*v, fastpathCheckNilTrue, e)
-
- case map[uint64]int64:
- fastpathTV.EncMapUint64Int64V(v, fastpathCheckNilTrue, e)
- case *map[uint64]int64:
- fastpathTV.EncMapUint64Int64V(*v, fastpathCheckNilTrue, e)
-
- case map[uint64]float32:
- fastpathTV.EncMapUint64Float32V(v, fastpathCheckNilTrue, e)
- case *map[uint64]float32:
- fastpathTV.EncMapUint64Float32V(*v, fastpathCheckNilTrue, e)
-
- case map[uint64]float64:
- fastpathTV.EncMapUint64Float64V(v, fastpathCheckNilTrue, e)
- case *map[uint64]float64:
- fastpathTV.EncMapUint64Float64V(*v, fastpathCheckNilTrue, e)
-
- case map[uint64]bool:
- fastpathTV.EncMapUint64BoolV(v, fastpathCheckNilTrue, e)
- case *map[uint64]bool:
- fastpathTV.EncMapUint64BoolV(*v, fastpathCheckNilTrue, e)
-
- case []uintptr:
- fastpathTV.EncSliceUintptrV(v, fastpathCheckNilTrue, e)
- case *[]uintptr:
- fastpathTV.EncSliceUintptrV(*v, fastpathCheckNilTrue, e)
-
- case map[uintptr]interface{}:
- fastpathTV.EncMapUintptrIntfV(v, fastpathCheckNilTrue, e)
- case *map[uintptr]interface{}:
- fastpathTV.EncMapUintptrIntfV(*v, fastpathCheckNilTrue, e)
-
- case map[uintptr]string:
- fastpathTV.EncMapUintptrStringV(v, fastpathCheckNilTrue, e)
- case *map[uintptr]string:
- fastpathTV.EncMapUintptrStringV(*v, fastpathCheckNilTrue, e)
-
- case map[uintptr]uint:
- fastpathTV.EncMapUintptrUintV(v, fastpathCheckNilTrue, e)
- case *map[uintptr]uint:
- fastpathTV.EncMapUintptrUintV(*v, fastpathCheckNilTrue, e)
-
- case map[uintptr]uint8:
- fastpathTV.EncMapUintptrUint8V(v, fastpathCheckNilTrue, e)
- case *map[uintptr]uint8:
- fastpathTV.EncMapUintptrUint8V(*v, fastpathCheckNilTrue, e)
-
- case map[uintptr]uint16:
- fastpathTV.EncMapUintptrUint16V(v, fastpathCheckNilTrue, e)
- case *map[uintptr]uint16:
- fastpathTV.EncMapUintptrUint16V(*v, fastpathCheckNilTrue, e)
-
- case map[uintptr]uint32:
- fastpathTV.EncMapUintptrUint32V(v, fastpathCheckNilTrue, e)
- case *map[uintptr]uint32:
- fastpathTV.EncMapUintptrUint32V(*v, fastpathCheckNilTrue, e)
-
- case map[uintptr]uint64:
- fastpathTV.EncMapUintptrUint64V(v, fastpathCheckNilTrue, e)
- case *map[uintptr]uint64:
- fastpathTV.EncMapUintptrUint64V(*v, fastpathCheckNilTrue, e)
-
- case map[uintptr]uintptr:
- fastpathTV.EncMapUintptrUintptrV(v, fastpathCheckNilTrue, e)
- case *map[uintptr]uintptr:
- fastpathTV.EncMapUintptrUintptrV(*v, fastpathCheckNilTrue, e)
-
- case map[uintptr]int:
- fastpathTV.EncMapUintptrIntV(v, fastpathCheckNilTrue, e)
- case *map[uintptr]int:
- fastpathTV.EncMapUintptrIntV(*v, fastpathCheckNilTrue, e)
-
- case map[uintptr]int8:
- fastpathTV.EncMapUintptrInt8V(v, fastpathCheckNilTrue, e)
- case *map[uintptr]int8:
- fastpathTV.EncMapUintptrInt8V(*v, fastpathCheckNilTrue, e)
-
- case map[uintptr]int16:
- fastpathTV.EncMapUintptrInt16V(v, fastpathCheckNilTrue, e)
- case *map[uintptr]int16:
- fastpathTV.EncMapUintptrInt16V(*v, fastpathCheckNilTrue, e)
-
- case map[uintptr]int32:
- fastpathTV.EncMapUintptrInt32V(v, fastpathCheckNilTrue, e)
- case *map[uintptr]int32:
- fastpathTV.EncMapUintptrInt32V(*v, fastpathCheckNilTrue, e)
-
- case map[uintptr]int64:
- fastpathTV.EncMapUintptrInt64V(v, fastpathCheckNilTrue, e)
- case *map[uintptr]int64:
- fastpathTV.EncMapUintptrInt64V(*v, fastpathCheckNilTrue, e)
-
- case map[uintptr]float32:
- fastpathTV.EncMapUintptrFloat32V(v, fastpathCheckNilTrue, e)
- case *map[uintptr]float32:
- fastpathTV.EncMapUintptrFloat32V(*v, fastpathCheckNilTrue, e)
-
- case map[uintptr]float64:
- fastpathTV.EncMapUintptrFloat64V(v, fastpathCheckNilTrue, e)
- case *map[uintptr]float64:
- fastpathTV.EncMapUintptrFloat64V(*v, fastpathCheckNilTrue, e)
-
- case map[uintptr]bool:
- fastpathTV.EncMapUintptrBoolV(v, fastpathCheckNilTrue, e)
- case *map[uintptr]bool:
- fastpathTV.EncMapUintptrBoolV(*v, fastpathCheckNilTrue, e)
-
- case []int:
- fastpathTV.EncSliceIntV(v, fastpathCheckNilTrue, e)
- case *[]int:
- fastpathTV.EncSliceIntV(*v, fastpathCheckNilTrue, e)
-
- case map[int]interface{}:
- fastpathTV.EncMapIntIntfV(v, fastpathCheckNilTrue, e)
- case *map[int]interface{}:
- fastpathTV.EncMapIntIntfV(*v, fastpathCheckNilTrue, e)
-
- case map[int]string:
- fastpathTV.EncMapIntStringV(v, fastpathCheckNilTrue, e)
- case *map[int]string:
- fastpathTV.EncMapIntStringV(*v, fastpathCheckNilTrue, e)
-
- case map[int]uint:
- fastpathTV.EncMapIntUintV(v, fastpathCheckNilTrue, e)
- case *map[int]uint:
- fastpathTV.EncMapIntUintV(*v, fastpathCheckNilTrue, e)
-
- case map[int]uint8:
- fastpathTV.EncMapIntUint8V(v, fastpathCheckNilTrue, e)
- case *map[int]uint8:
- fastpathTV.EncMapIntUint8V(*v, fastpathCheckNilTrue, e)
-
- case map[int]uint16:
- fastpathTV.EncMapIntUint16V(v, fastpathCheckNilTrue, e)
- case *map[int]uint16:
- fastpathTV.EncMapIntUint16V(*v, fastpathCheckNilTrue, e)
-
- case map[int]uint32:
- fastpathTV.EncMapIntUint32V(v, fastpathCheckNilTrue, e)
- case *map[int]uint32:
- fastpathTV.EncMapIntUint32V(*v, fastpathCheckNilTrue, e)
-
- case map[int]uint64:
- fastpathTV.EncMapIntUint64V(v, fastpathCheckNilTrue, e)
- case *map[int]uint64:
- fastpathTV.EncMapIntUint64V(*v, fastpathCheckNilTrue, e)
-
- case map[int]uintptr:
- fastpathTV.EncMapIntUintptrV(v, fastpathCheckNilTrue, e)
- case *map[int]uintptr:
- fastpathTV.EncMapIntUintptrV(*v, fastpathCheckNilTrue, e)
-
- case map[int]int:
- fastpathTV.EncMapIntIntV(v, fastpathCheckNilTrue, e)
- case *map[int]int:
- fastpathTV.EncMapIntIntV(*v, fastpathCheckNilTrue, e)
-
- case map[int]int8:
- fastpathTV.EncMapIntInt8V(v, fastpathCheckNilTrue, e)
- case *map[int]int8:
- fastpathTV.EncMapIntInt8V(*v, fastpathCheckNilTrue, e)
-
- case map[int]int16:
- fastpathTV.EncMapIntInt16V(v, fastpathCheckNilTrue, e)
- case *map[int]int16:
- fastpathTV.EncMapIntInt16V(*v, fastpathCheckNilTrue, e)
-
- case map[int]int32:
- fastpathTV.EncMapIntInt32V(v, fastpathCheckNilTrue, e)
- case *map[int]int32:
- fastpathTV.EncMapIntInt32V(*v, fastpathCheckNilTrue, e)
-
- case map[int]int64:
- fastpathTV.EncMapIntInt64V(v, fastpathCheckNilTrue, e)
- case *map[int]int64:
- fastpathTV.EncMapIntInt64V(*v, fastpathCheckNilTrue, e)
-
- case map[int]float32:
- fastpathTV.EncMapIntFloat32V(v, fastpathCheckNilTrue, e)
- case *map[int]float32:
- fastpathTV.EncMapIntFloat32V(*v, fastpathCheckNilTrue, e)
-
- case map[int]float64:
- fastpathTV.EncMapIntFloat64V(v, fastpathCheckNilTrue, e)
- case *map[int]float64:
- fastpathTV.EncMapIntFloat64V(*v, fastpathCheckNilTrue, e)
-
- case map[int]bool:
- fastpathTV.EncMapIntBoolV(v, fastpathCheckNilTrue, e)
- case *map[int]bool:
- fastpathTV.EncMapIntBoolV(*v, fastpathCheckNilTrue, e)
-
- case []int8:
- fastpathTV.EncSliceInt8V(v, fastpathCheckNilTrue, e)
- case *[]int8:
- fastpathTV.EncSliceInt8V(*v, fastpathCheckNilTrue, e)
-
- case map[int8]interface{}:
- fastpathTV.EncMapInt8IntfV(v, fastpathCheckNilTrue, e)
- case *map[int8]interface{}:
- fastpathTV.EncMapInt8IntfV(*v, fastpathCheckNilTrue, e)
-
- case map[int8]string:
- fastpathTV.EncMapInt8StringV(v, fastpathCheckNilTrue, e)
- case *map[int8]string:
- fastpathTV.EncMapInt8StringV(*v, fastpathCheckNilTrue, e)
-
- case map[int8]uint:
- fastpathTV.EncMapInt8UintV(v, fastpathCheckNilTrue, e)
- case *map[int8]uint:
- fastpathTV.EncMapInt8UintV(*v, fastpathCheckNilTrue, e)
-
- case map[int8]uint8:
- fastpathTV.EncMapInt8Uint8V(v, fastpathCheckNilTrue, e)
- case *map[int8]uint8:
- fastpathTV.EncMapInt8Uint8V(*v, fastpathCheckNilTrue, e)
-
- case map[int8]uint16:
- fastpathTV.EncMapInt8Uint16V(v, fastpathCheckNilTrue, e)
- case *map[int8]uint16:
- fastpathTV.EncMapInt8Uint16V(*v, fastpathCheckNilTrue, e)
-
- case map[int8]uint32:
- fastpathTV.EncMapInt8Uint32V(v, fastpathCheckNilTrue, e)
- case *map[int8]uint32:
- fastpathTV.EncMapInt8Uint32V(*v, fastpathCheckNilTrue, e)
-
- case map[int8]uint64:
- fastpathTV.EncMapInt8Uint64V(v, fastpathCheckNilTrue, e)
- case *map[int8]uint64:
- fastpathTV.EncMapInt8Uint64V(*v, fastpathCheckNilTrue, e)
-
- case map[int8]uintptr:
- fastpathTV.EncMapInt8UintptrV(v, fastpathCheckNilTrue, e)
- case *map[int8]uintptr:
- fastpathTV.EncMapInt8UintptrV(*v, fastpathCheckNilTrue, e)
-
- case map[int8]int:
- fastpathTV.EncMapInt8IntV(v, fastpathCheckNilTrue, e)
- case *map[int8]int:
- fastpathTV.EncMapInt8IntV(*v, fastpathCheckNilTrue, e)
-
- case map[int8]int8:
- fastpathTV.EncMapInt8Int8V(v, fastpathCheckNilTrue, e)
- case *map[int8]int8:
- fastpathTV.EncMapInt8Int8V(*v, fastpathCheckNilTrue, e)
-
- case map[int8]int16:
- fastpathTV.EncMapInt8Int16V(v, fastpathCheckNilTrue, e)
- case *map[int8]int16:
- fastpathTV.EncMapInt8Int16V(*v, fastpathCheckNilTrue, e)
-
- case map[int8]int32:
- fastpathTV.EncMapInt8Int32V(v, fastpathCheckNilTrue, e)
- case *map[int8]int32:
- fastpathTV.EncMapInt8Int32V(*v, fastpathCheckNilTrue, e)
-
- case map[int8]int64:
- fastpathTV.EncMapInt8Int64V(v, fastpathCheckNilTrue, e)
- case *map[int8]int64:
- fastpathTV.EncMapInt8Int64V(*v, fastpathCheckNilTrue, e)
-
- case map[int8]float32:
- fastpathTV.EncMapInt8Float32V(v, fastpathCheckNilTrue, e)
- case *map[int8]float32:
- fastpathTV.EncMapInt8Float32V(*v, fastpathCheckNilTrue, e)
-
- case map[int8]float64:
- fastpathTV.EncMapInt8Float64V(v, fastpathCheckNilTrue, e)
- case *map[int8]float64:
- fastpathTV.EncMapInt8Float64V(*v, fastpathCheckNilTrue, e)
-
- case map[int8]bool:
- fastpathTV.EncMapInt8BoolV(v, fastpathCheckNilTrue, e)
- case *map[int8]bool:
- fastpathTV.EncMapInt8BoolV(*v, fastpathCheckNilTrue, e)
-
- case []int16:
- fastpathTV.EncSliceInt16V(v, fastpathCheckNilTrue, e)
- case *[]int16:
- fastpathTV.EncSliceInt16V(*v, fastpathCheckNilTrue, e)
-
- case map[int16]interface{}:
- fastpathTV.EncMapInt16IntfV(v, fastpathCheckNilTrue, e)
- case *map[int16]interface{}:
- fastpathTV.EncMapInt16IntfV(*v, fastpathCheckNilTrue, e)
-
- case map[int16]string:
- fastpathTV.EncMapInt16StringV(v, fastpathCheckNilTrue, e)
- case *map[int16]string:
- fastpathTV.EncMapInt16StringV(*v, fastpathCheckNilTrue, e)
-
- case map[int16]uint:
- fastpathTV.EncMapInt16UintV(v, fastpathCheckNilTrue, e)
- case *map[int16]uint:
- fastpathTV.EncMapInt16UintV(*v, fastpathCheckNilTrue, e)
-
- case map[int16]uint8:
- fastpathTV.EncMapInt16Uint8V(v, fastpathCheckNilTrue, e)
- case *map[int16]uint8:
- fastpathTV.EncMapInt16Uint8V(*v, fastpathCheckNilTrue, e)
-
- case map[int16]uint16:
- fastpathTV.EncMapInt16Uint16V(v, fastpathCheckNilTrue, e)
- case *map[int16]uint16:
- fastpathTV.EncMapInt16Uint16V(*v, fastpathCheckNilTrue, e)
-
- case map[int16]uint32:
- fastpathTV.EncMapInt16Uint32V(v, fastpathCheckNilTrue, e)
- case *map[int16]uint32:
- fastpathTV.EncMapInt16Uint32V(*v, fastpathCheckNilTrue, e)
-
- case map[int16]uint64:
- fastpathTV.EncMapInt16Uint64V(v, fastpathCheckNilTrue, e)
- case *map[int16]uint64:
- fastpathTV.EncMapInt16Uint64V(*v, fastpathCheckNilTrue, e)
-
- case map[int16]uintptr:
- fastpathTV.EncMapInt16UintptrV(v, fastpathCheckNilTrue, e)
- case *map[int16]uintptr:
- fastpathTV.EncMapInt16UintptrV(*v, fastpathCheckNilTrue, e)
-
- case map[int16]int:
- fastpathTV.EncMapInt16IntV(v, fastpathCheckNilTrue, e)
- case *map[int16]int:
- fastpathTV.EncMapInt16IntV(*v, fastpathCheckNilTrue, e)
-
- case map[int16]int8:
- fastpathTV.EncMapInt16Int8V(v, fastpathCheckNilTrue, e)
- case *map[int16]int8:
- fastpathTV.EncMapInt16Int8V(*v, fastpathCheckNilTrue, e)
-
- case map[int16]int16:
- fastpathTV.EncMapInt16Int16V(v, fastpathCheckNilTrue, e)
- case *map[int16]int16:
- fastpathTV.EncMapInt16Int16V(*v, fastpathCheckNilTrue, e)
-
- case map[int16]int32:
- fastpathTV.EncMapInt16Int32V(v, fastpathCheckNilTrue, e)
- case *map[int16]int32:
- fastpathTV.EncMapInt16Int32V(*v, fastpathCheckNilTrue, e)
-
- case map[int16]int64:
- fastpathTV.EncMapInt16Int64V(v, fastpathCheckNilTrue, e)
- case *map[int16]int64:
- fastpathTV.EncMapInt16Int64V(*v, fastpathCheckNilTrue, e)
-
- case map[int16]float32:
- fastpathTV.EncMapInt16Float32V(v, fastpathCheckNilTrue, e)
- case *map[int16]float32:
- fastpathTV.EncMapInt16Float32V(*v, fastpathCheckNilTrue, e)
-
- case map[int16]float64:
- fastpathTV.EncMapInt16Float64V(v, fastpathCheckNilTrue, e)
- case *map[int16]float64:
- fastpathTV.EncMapInt16Float64V(*v, fastpathCheckNilTrue, e)
-
- case map[int16]bool:
- fastpathTV.EncMapInt16BoolV(v, fastpathCheckNilTrue, e)
- case *map[int16]bool:
- fastpathTV.EncMapInt16BoolV(*v, fastpathCheckNilTrue, e)
-
- case []int32:
- fastpathTV.EncSliceInt32V(v, fastpathCheckNilTrue, e)
- case *[]int32:
- fastpathTV.EncSliceInt32V(*v, fastpathCheckNilTrue, e)
-
- case map[int32]interface{}:
- fastpathTV.EncMapInt32IntfV(v, fastpathCheckNilTrue, e)
- case *map[int32]interface{}:
- fastpathTV.EncMapInt32IntfV(*v, fastpathCheckNilTrue, e)
-
- case map[int32]string:
- fastpathTV.EncMapInt32StringV(v, fastpathCheckNilTrue, e)
- case *map[int32]string:
- fastpathTV.EncMapInt32StringV(*v, fastpathCheckNilTrue, e)
-
- case map[int32]uint:
- fastpathTV.EncMapInt32UintV(v, fastpathCheckNilTrue, e)
- case *map[int32]uint:
- fastpathTV.EncMapInt32UintV(*v, fastpathCheckNilTrue, e)
-
- case map[int32]uint8:
- fastpathTV.EncMapInt32Uint8V(v, fastpathCheckNilTrue, e)
- case *map[int32]uint8:
- fastpathTV.EncMapInt32Uint8V(*v, fastpathCheckNilTrue, e)
-
- case map[int32]uint16:
- fastpathTV.EncMapInt32Uint16V(v, fastpathCheckNilTrue, e)
- case *map[int32]uint16:
- fastpathTV.EncMapInt32Uint16V(*v, fastpathCheckNilTrue, e)
-
- case map[int32]uint32:
- fastpathTV.EncMapInt32Uint32V(v, fastpathCheckNilTrue, e)
- case *map[int32]uint32:
- fastpathTV.EncMapInt32Uint32V(*v, fastpathCheckNilTrue, e)
-
- case map[int32]uint64:
- fastpathTV.EncMapInt32Uint64V(v, fastpathCheckNilTrue, e)
- case *map[int32]uint64:
- fastpathTV.EncMapInt32Uint64V(*v, fastpathCheckNilTrue, e)
-
- case map[int32]uintptr:
- fastpathTV.EncMapInt32UintptrV(v, fastpathCheckNilTrue, e)
- case *map[int32]uintptr:
- fastpathTV.EncMapInt32UintptrV(*v, fastpathCheckNilTrue, e)
-
- case map[int32]int:
- fastpathTV.EncMapInt32IntV(v, fastpathCheckNilTrue, e)
- case *map[int32]int:
- fastpathTV.EncMapInt32IntV(*v, fastpathCheckNilTrue, e)
-
- case map[int32]int8:
- fastpathTV.EncMapInt32Int8V(v, fastpathCheckNilTrue, e)
- case *map[int32]int8:
- fastpathTV.EncMapInt32Int8V(*v, fastpathCheckNilTrue, e)
-
- case map[int32]int16:
- fastpathTV.EncMapInt32Int16V(v, fastpathCheckNilTrue, e)
- case *map[int32]int16:
- fastpathTV.EncMapInt32Int16V(*v, fastpathCheckNilTrue, e)
-
- case map[int32]int32:
- fastpathTV.EncMapInt32Int32V(v, fastpathCheckNilTrue, e)
- case *map[int32]int32:
- fastpathTV.EncMapInt32Int32V(*v, fastpathCheckNilTrue, e)
-
- case map[int32]int64:
- fastpathTV.EncMapInt32Int64V(v, fastpathCheckNilTrue, e)
- case *map[int32]int64:
- fastpathTV.EncMapInt32Int64V(*v, fastpathCheckNilTrue, e)
-
- case map[int32]float32:
- fastpathTV.EncMapInt32Float32V(v, fastpathCheckNilTrue, e)
- case *map[int32]float32:
- fastpathTV.EncMapInt32Float32V(*v, fastpathCheckNilTrue, e)
-
- case map[int32]float64:
- fastpathTV.EncMapInt32Float64V(v, fastpathCheckNilTrue, e)
- case *map[int32]float64:
- fastpathTV.EncMapInt32Float64V(*v, fastpathCheckNilTrue, e)
-
- case map[int32]bool:
- fastpathTV.EncMapInt32BoolV(v, fastpathCheckNilTrue, e)
- case *map[int32]bool:
- fastpathTV.EncMapInt32BoolV(*v, fastpathCheckNilTrue, e)
-
- case []int64:
- fastpathTV.EncSliceInt64V(v, fastpathCheckNilTrue, e)
- case *[]int64:
- fastpathTV.EncSliceInt64V(*v, fastpathCheckNilTrue, e)
-
- case map[int64]interface{}:
- fastpathTV.EncMapInt64IntfV(v, fastpathCheckNilTrue, e)
- case *map[int64]interface{}:
- fastpathTV.EncMapInt64IntfV(*v, fastpathCheckNilTrue, e)
-
- case map[int64]string:
- fastpathTV.EncMapInt64StringV(v, fastpathCheckNilTrue, e)
- case *map[int64]string:
- fastpathTV.EncMapInt64StringV(*v, fastpathCheckNilTrue, e)
-
- case map[int64]uint:
- fastpathTV.EncMapInt64UintV(v, fastpathCheckNilTrue, e)
- case *map[int64]uint:
- fastpathTV.EncMapInt64UintV(*v, fastpathCheckNilTrue, e)
-
- case map[int64]uint8:
- fastpathTV.EncMapInt64Uint8V(v, fastpathCheckNilTrue, e)
- case *map[int64]uint8:
- fastpathTV.EncMapInt64Uint8V(*v, fastpathCheckNilTrue, e)
-
- case map[int64]uint16:
- fastpathTV.EncMapInt64Uint16V(v, fastpathCheckNilTrue, e)
- case *map[int64]uint16:
- fastpathTV.EncMapInt64Uint16V(*v, fastpathCheckNilTrue, e)
-
- case map[int64]uint32:
- fastpathTV.EncMapInt64Uint32V(v, fastpathCheckNilTrue, e)
- case *map[int64]uint32:
- fastpathTV.EncMapInt64Uint32V(*v, fastpathCheckNilTrue, e)
-
- case map[int64]uint64:
- fastpathTV.EncMapInt64Uint64V(v, fastpathCheckNilTrue, e)
- case *map[int64]uint64:
- fastpathTV.EncMapInt64Uint64V(*v, fastpathCheckNilTrue, e)
-
- case map[int64]uintptr:
- fastpathTV.EncMapInt64UintptrV(v, fastpathCheckNilTrue, e)
- case *map[int64]uintptr:
- fastpathTV.EncMapInt64UintptrV(*v, fastpathCheckNilTrue, e)
-
- case map[int64]int:
- fastpathTV.EncMapInt64IntV(v, fastpathCheckNilTrue, e)
- case *map[int64]int:
- fastpathTV.EncMapInt64IntV(*v, fastpathCheckNilTrue, e)
-
- case map[int64]int8:
- fastpathTV.EncMapInt64Int8V(v, fastpathCheckNilTrue, e)
- case *map[int64]int8:
- fastpathTV.EncMapInt64Int8V(*v, fastpathCheckNilTrue, e)
-
- case map[int64]int16:
- fastpathTV.EncMapInt64Int16V(v, fastpathCheckNilTrue, e)
- case *map[int64]int16:
- fastpathTV.EncMapInt64Int16V(*v, fastpathCheckNilTrue, e)
-
- case map[int64]int32:
- fastpathTV.EncMapInt64Int32V(v, fastpathCheckNilTrue, e)
- case *map[int64]int32:
- fastpathTV.EncMapInt64Int32V(*v, fastpathCheckNilTrue, e)
-
- case map[int64]int64:
- fastpathTV.EncMapInt64Int64V(v, fastpathCheckNilTrue, e)
- case *map[int64]int64:
- fastpathTV.EncMapInt64Int64V(*v, fastpathCheckNilTrue, e)
-
- case map[int64]float32:
- fastpathTV.EncMapInt64Float32V(v, fastpathCheckNilTrue, e)
- case *map[int64]float32:
- fastpathTV.EncMapInt64Float32V(*v, fastpathCheckNilTrue, e)
-
- case map[int64]float64:
- fastpathTV.EncMapInt64Float64V(v, fastpathCheckNilTrue, e)
- case *map[int64]float64:
- fastpathTV.EncMapInt64Float64V(*v, fastpathCheckNilTrue, e)
-
- case map[int64]bool:
- fastpathTV.EncMapInt64BoolV(v, fastpathCheckNilTrue, e)
- case *map[int64]bool:
- fastpathTV.EncMapInt64BoolV(*v, fastpathCheckNilTrue, e)
-
- case []bool:
- fastpathTV.EncSliceBoolV(v, fastpathCheckNilTrue, e)
- case *[]bool:
- fastpathTV.EncSliceBoolV(*v, fastpathCheckNilTrue, e)
-
- case map[bool]interface{}:
- fastpathTV.EncMapBoolIntfV(v, fastpathCheckNilTrue, e)
- case *map[bool]interface{}:
- fastpathTV.EncMapBoolIntfV(*v, fastpathCheckNilTrue, e)
-
- case map[bool]string:
- fastpathTV.EncMapBoolStringV(v, fastpathCheckNilTrue, e)
- case *map[bool]string:
- fastpathTV.EncMapBoolStringV(*v, fastpathCheckNilTrue, e)
-
- case map[bool]uint:
- fastpathTV.EncMapBoolUintV(v, fastpathCheckNilTrue, e)
- case *map[bool]uint:
- fastpathTV.EncMapBoolUintV(*v, fastpathCheckNilTrue, e)
-
- case map[bool]uint8:
- fastpathTV.EncMapBoolUint8V(v, fastpathCheckNilTrue, e)
- case *map[bool]uint8:
- fastpathTV.EncMapBoolUint8V(*v, fastpathCheckNilTrue, e)
-
- case map[bool]uint16:
- fastpathTV.EncMapBoolUint16V(v, fastpathCheckNilTrue, e)
- case *map[bool]uint16:
- fastpathTV.EncMapBoolUint16V(*v, fastpathCheckNilTrue, e)
-
- case map[bool]uint32:
- fastpathTV.EncMapBoolUint32V(v, fastpathCheckNilTrue, e)
- case *map[bool]uint32:
- fastpathTV.EncMapBoolUint32V(*v, fastpathCheckNilTrue, e)
-
- case map[bool]uint64:
- fastpathTV.EncMapBoolUint64V(v, fastpathCheckNilTrue, e)
- case *map[bool]uint64:
- fastpathTV.EncMapBoolUint64V(*v, fastpathCheckNilTrue, e)
-
- case map[bool]uintptr:
- fastpathTV.EncMapBoolUintptrV(v, fastpathCheckNilTrue, e)
- case *map[bool]uintptr:
- fastpathTV.EncMapBoolUintptrV(*v, fastpathCheckNilTrue, e)
-
- case map[bool]int:
- fastpathTV.EncMapBoolIntV(v, fastpathCheckNilTrue, e)
- case *map[bool]int:
- fastpathTV.EncMapBoolIntV(*v, fastpathCheckNilTrue, e)
-
- case map[bool]int8:
- fastpathTV.EncMapBoolInt8V(v, fastpathCheckNilTrue, e)
- case *map[bool]int8:
- fastpathTV.EncMapBoolInt8V(*v, fastpathCheckNilTrue, e)
-
- case map[bool]int16:
- fastpathTV.EncMapBoolInt16V(v, fastpathCheckNilTrue, e)
- case *map[bool]int16:
- fastpathTV.EncMapBoolInt16V(*v, fastpathCheckNilTrue, e)
-
- case map[bool]int32:
- fastpathTV.EncMapBoolInt32V(v, fastpathCheckNilTrue, e)
- case *map[bool]int32:
- fastpathTV.EncMapBoolInt32V(*v, fastpathCheckNilTrue, e)
-
- case map[bool]int64:
- fastpathTV.EncMapBoolInt64V(v, fastpathCheckNilTrue, e)
- case *map[bool]int64:
- fastpathTV.EncMapBoolInt64V(*v, fastpathCheckNilTrue, e)
-
- case map[bool]float32:
- fastpathTV.EncMapBoolFloat32V(v, fastpathCheckNilTrue, e)
- case *map[bool]float32:
- fastpathTV.EncMapBoolFloat32V(*v, fastpathCheckNilTrue, e)
-
- case map[bool]float64:
- fastpathTV.EncMapBoolFloat64V(v, fastpathCheckNilTrue, e)
- case *map[bool]float64:
- fastpathTV.EncMapBoolFloat64V(*v, fastpathCheckNilTrue, e)
-
- case map[bool]bool:
- fastpathTV.EncMapBoolBoolV(v, fastpathCheckNilTrue, e)
- case *map[bool]bool:
- fastpathTV.EncMapBoolBoolV(*v, fastpathCheckNilTrue, e)
-
- default:
- _ = v // TODO: workaround https://github.com/golang/go/issues/12927 (remove after go 1.6 release)
- return false
- }
- return true
-}
-
-func fastpathEncodeTypeSwitchSlice(iv interface{}, e *Encoder) bool {
- if !fastpathEnabled {
- return false
- }
- switch v := iv.(type) {
-
- case []interface{}:
- fastpathTV.EncSliceIntfV(v, fastpathCheckNilTrue, e)
- case *[]interface{}:
- fastpathTV.EncSliceIntfV(*v, fastpathCheckNilTrue, e)
-
- case []string:
- fastpathTV.EncSliceStringV(v, fastpathCheckNilTrue, e)
- case *[]string:
- fastpathTV.EncSliceStringV(*v, fastpathCheckNilTrue, e)
-
- case []float32:
- fastpathTV.EncSliceFloat32V(v, fastpathCheckNilTrue, e)
- case *[]float32:
- fastpathTV.EncSliceFloat32V(*v, fastpathCheckNilTrue, e)
-
- case []float64:
- fastpathTV.EncSliceFloat64V(v, fastpathCheckNilTrue, e)
- case *[]float64:
- fastpathTV.EncSliceFloat64V(*v, fastpathCheckNilTrue, e)
-
- case []uint:
- fastpathTV.EncSliceUintV(v, fastpathCheckNilTrue, e)
- case *[]uint:
- fastpathTV.EncSliceUintV(*v, fastpathCheckNilTrue, e)
-
- case []uint16:
- fastpathTV.EncSliceUint16V(v, fastpathCheckNilTrue, e)
- case *[]uint16:
- fastpathTV.EncSliceUint16V(*v, fastpathCheckNilTrue, e)
-
- case []uint32:
- fastpathTV.EncSliceUint32V(v, fastpathCheckNilTrue, e)
- case *[]uint32:
- fastpathTV.EncSliceUint32V(*v, fastpathCheckNilTrue, e)
-
- case []uint64:
- fastpathTV.EncSliceUint64V(v, fastpathCheckNilTrue, e)
- case *[]uint64:
- fastpathTV.EncSliceUint64V(*v, fastpathCheckNilTrue, e)
-
- case []uintptr:
- fastpathTV.EncSliceUintptrV(v, fastpathCheckNilTrue, e)
- case *[]uintptr:
- fastpathTV.EncSliceUintptrV(*v, fastpathCheckNilTrue, e)
-
- case []int:
- fastpathTV.EncSliceIntV(v, fastpathCheckNilTrue, e)
- case *[]int:
- fastpathTV.EncSliceIntV(*v, fastpathCheckNilTrue, e)
-
- case []int8:
- fastpathTV.EncSliceInt8V(v, fastpathCheckNilTrue, e)
- case *[]int8:
- fastpathTV.EncSliceInt8V(*v, fastpathCheckNilTrue, e)
-
- case []int16:
- fastpathTV.EncSliceInt16V(v, fastpathCheckNilTrue, e)
- case *[]int16:
- fastpathTV.EncSliceInt16V(*v, fastpathCheckNilTrue, e)
-
- case []int32:
- fastpathTV.EncSliceInt32V(v, fastpathCheckNilTrue, e)
- case *[]int32:
- fastpathTV.EncSliceInt32V(*v, fastpathCheckNilTrue, e)
-
- case []int64:
- fastpathTV.EncSliceInt64V(v, fastpathCheckNilTrue, e)
- case *[]int64:
- fastpathTV.EncSliceInt64V(*v, fastpathCheckNilTrue, e)
-
- case []bool:
- fastpathTV.EncSliceBoolV(v, fastpathCheckNilTrue, e)
- case *[]bool:
- fastpathTV.EncSliceBoolV(*v, fastpathCheckNilTrue, e)
-
- default:
- _ = v // TODO: workaround https://github.com/golang/go/issues/12927 (remove after go 1.6 release)
- return false
- }
- return true
-}
-
-func fastpathEncodeTypeSwitchMap(iv interface{}, e *Encoder) bool {
- if !fastpathEnabled {
- return false
- }
- switch v := iv.(type) {
-
- case map[interface{}]interface{}:
- fastpathTV.EncMapIntfIntfV(v, fastpathCheckNilTrue, e)
- case *map[interface{}]interface{}:
- fastpathTV.EncMapIntfIntfV(*v, fastpathCheckNilTrue, e)
-
- case map[interface{}]string:
- fastpathTV.EncMapIntfStringV(v, fastpathCheckNilTrue, e)
- case *map[interface{}]string:
- fastpathTV.EncMapIntfStringV(*v, fastpathCheckNilTrue, e)
-
- case map[interface{}]uint:
- fastpathTV.EncMapIntfUintV(v, fastpathCheckNilTrue, e)
- case *map[interface{}]uint:
- fastpathTV.EncMapIntfUintV(*v, fastpathCheckNilTrue, e)
-
- case map[interface{}]uint8:
- fastpathTV.EncMapIntfUint8V(v, fastpathCheckNilTrue, e)
- case *map[interface{}]uint8:
- fastpathTV.EncMapIntfUint8V(*v, fastpathCheckNilTrue, e)
-
- case map[interface{}]uint16:
- fastpathTV.EncMapIntfUint16V(v, fastpathCheckNilTrue, e)
- case *map[interface{}]uint16:
- fastpathTV.EncMapIntfUint16V(*v, fastpathCheckNilTrue, e)
-
- case map[interface{}]uint32:
- fastpathTV.EncMapIntfUint32V(v, fastpathCheckNilTrue, e)
- case *map[interface{}]uint32:
- fastpathTV.EncMapIntfUint32V(*v, fastpathCheckNilTrue, e)
-
- case map[interface{}]uint64:
- fastpathTV.EncMapIntfUint64V(v, fastpathCheckNilTrue, e)
- case *map[interface{}]uint64:
- fastpathTV.EncMapIntfUint64V(*v, fastpathCheckNilTrue, e)
-
- case map[interface{}]uintptr:
- fastpathTV.EncMapIntfUintptrV(v, fastpathCheckNilTrue, e)
- case *map[interface{}]uintptr:
- fastpathTV.EncMapIntfUintptrV(*v, fastpathCheckNilTrue, e)
-
- case map[interface{}]int:
- fastpathTV.EncMapIntfIntV(v, fastpathCheckNilTrue, e)
- case *map[interface{}]int:
- fastpathTV.EncMapIntfIntV(*v, fastpathCheckNilTrue, e)
-
- case map[interface{}]int8:
- fastpathTV.EncMapIntfInt8V(v, fastpathCheckNilTrue, e)
- case *map[interface{}]int8:
- fastpathTV.EncMapIntfInt8V(*v, fastpathCheckNilTrue, e)
-
- case map[interface{}]int16:
- fastpathTV.EncMapIntfInt16V(v, fastpathCheckNilTrue, e)
- case *map[interface{}]int16:
- fastpathTV.EncMapIntfInt16V(*v, fastpathCheckNilTrue, e)
-
- case map[interface{}]int32:
- fastpathTV.EncMapIntfInt32V(v, fastpathCheckNilTrue, e)
- case *map[interface{}]int32:
- fastpathTV.EncMapIntfInt32V(*v, fastpathCheckNilTrue, e)
-
- case map[interface{}]int64:
- fastpathTV.EncMapIntfInt64V(v, fastpathCheckNilTrue, e)
- case *map[interface{}]int64:
- fastpathTV.EncMapIntfInt64V(*v, fastpathCheckNilTrue, e)
-
- case map[interface{}]float32:
- fastpathTV.EncMapIntfFloat32V(v, fastpathCheckNilTrue, e)
- case *map[interface{}]float32:
- fastpathTV.EncMapIntfFloat32V(*v, fastpathCheckNilTrue, e)
-
- case map[interface{}]float64:
- fastpathTV.EncMapIntfFloat64V(v, fastpathCheckNilTrue, e)
- case *map[interface{}]float64:
- fastpathTV.EncMapIntfFloat64V(*v, fastpathCheckNilTrue, e)
-
- case map[interface{}]bool:
- fastpathTV.EncMapIntfBoolV(v, fastpathCheckNilTrue, e)
- case *map[interface{}]bool:
- fastpathTV.EncMapIntfBoolV(*v, fastpathCheckNilTrue, e)
-
- case map[string]interface{}:
- fastpathTV.EncMapStringIntfV(v, fastpathCheckNilTrue, e)
- case *map[string]interface{}:
- fastpathTV.EncMapStringIntfV(*v, fastpathCheckNilTrue, e)
-
- case map[string]string:
- fastpathTV.EncMapStringStringV(v, fastpathCheckNilTrue, e)
- case *map[string]string:
- fastpathTV.EncMapStringStringV(*v, fastpathCheckNilTrue, e)
-
- case map[string]uint:
- fastpathTV.EncMapStringUintV(v, fastpathCheckNilTrue, e)
- case *map[string]uint:
- fastpathTV.EncMapStringUintV(*v, fastpathCheckNilTrue, e)
-
- case map[string]uint8:
- fastpathTV.EncMapStringUint8V(v, fastpathCheckNilTrue, e)
- case *map[string]uint8:
- fastpathTV.EncMapStringUint8V(*v, fastpathCheckNilTrue, e)
-
- case map[string]uint16:
- fastpathTV.EncMapStringUint16V(v, fastpathCheckNilTrue, e)
- case *map[string]uint16:
- fastpathTV.EncMapStringUint16V(*v, fastpathCheckNilTrue, e)
-
- case map[string]uint32:
- fastpathTV.EncMapStringUint32V(v, fastpathCheckNilTrue, e)
- case *map[string]uint32:
- fastpathTV.EncMapStringUint32V(*v, fastpathCheckNilTrue, e)
-
- case map[string]uint64:
- fastpathTV.EncMapStringUint64V(v, fastpathCheckNilTrue, e)
- case *map[string]uint64:
- fastpathTV.EncMapStringUint64V(*v, fastpathCheckNilTrue, e)
-
- case map[string]uintptr:
- fastpathTV.EncMapStringUintptrV(v, fastpathCheckNilTrue, e)
- case *map[string]uintptr:
- fastpathTV.EncMapStringUintptrV(*v, fastpathCheckNilTrue, e)
-
- case map[string]int:
- fastpathTV.EncMapStringIntV(v, fastpathCheckNilTrue, e)
- case *map[string]int:
- fastpathTV.EncMapStringIntV(*v, fastpathCheckNilTrue, e)
-
- case map[string]int8:
- fastpathTV.EncMapStringInt8V(v, fastpathCheckNilTrue, e)
- case *map[string]int8:
- fastpathTV.EncMapStringInt8V(*v, fastpathCheckNilTrue, e)
-
- case map[string]int16:
- fastpathTV.EncMapStringInt16V(v, fastpathCheckNilTrue, e)
- case *map[string]int16:
- fastpathTV.EncMapStringInt16V(*v, fastpathCheckNilTrue, e)
-
- case map[string]int32:
- fastpathTV.EncMapStringInt32V(v, fastpathCheckNilTrue, e)
- case *map[string]int32:
- fastpathTV.EncMapStringInt32V(*v, fastpathCheckNilTrue, e)
-
- case map[string]int64:
- fastpathTV.EncMapStringInt64V(v, fastpathCheckNilTrue, e)
- case *map[string]int64:
- fastpathTV.EncMapStringInt64V(*v, fastpathCheckNilTrue, e)
-
- case map[string]float32:
- fastpathTV.EncMapStringFloat32V(v, fastpathCheckNilTrue, e)
- case *map[string]float32:
- fastpathTV.EncMapStringFloat32V(*v, fastpathCheckNilTrue, e)
-
- case map[string]float64:
- fastpathTV.EncMapStringFloat64V(v, fastpathCheckNilTrue, e)
- case *map[string]float64:
- fastpathTV.EncMapStringFloat64V(*v, fastpathCheckNilTrue, e)
-
- case map[string]bool:
- fastpathTV.EncMapStringBoolV(v, fastpathCheckNilTrue, e)
- case *map[string]bool:
- fastpathTV.EncMapStringBoolV(*v, fastpathCheckNilTrue, e)
-
- case map[float32]interface{}:
- fastpathTV.EncMapFloat32IntfV(v, fastpathCheckNilTrue, e)
- case *map[float32]interface{}:
- fastpathTV.EncMapFloat32IntfV(*v, fastpathCheckNilTrue, e)
-
- case map[float32]string:
- fastpathTV.EncMapFloat32StringV(v, fastpathCheckNilTrue, e)
- case *map[float32]string:
- fastpathTV.EncMapFloat32StringV(*v, fastpathCheckNilTrue, e)
-
- case map[float32]uint:
- fastpathTV.EncMapFloat32UintV(v, fastpathCheckNilTrue, e)
- case *map[float32]uint:
- fastpathTV.EncMapFloat32UintV(*v, fastpathCheckNilTrue, e)
-
- case map[float32]uint8:
- fastpathTV.EncMapFloat32Uint8V(v, fastpathCheckNilTrue, e)
- case *map[float32]uint8:
- fastpathTV.EncMapFloat32Uint8V(*v, fastpathCheckNilTrue, e)
-
- case map[float32]uint16:
- fastpathTV.EncMapFloat32Uint16V(v, fastpathCheckNilTrue, e)
- case *map[float32]uint16:
- fastpathTV.EncMapFloat32Uint16V(*v, fastpathCheckNilTrue, e)
-
- case map[float32]uint32:
- fastpathTV.EncMapFloat32Uint32V(v, fastpathCheckNilTrue, e)
- case *map[float32]uint32:
- fastpathTV.EncMapFloat32Uint32V(*v, fastpathCheckNilTrue, e)
-
- case map[float32]uint64:
- fastpathTV.EncMapFloat32Uint64V(v, fastpathCheckNilTrue, e)
- case *map[float32]uint64:
- fastpathTV.EncMapFloat32Uint64V(*v, fastpathCheckNilTrue, e)
-
- case map[float32]uintptr:
- fastpathTV.EncMapFloat32UintptrV(v, fastpathCheckNilTrue, e)
- case *map[float32]uintptr:
- fastpathTV.EncMapFloat32UintptrV(*v, fastpathCheckNilTrue, e)
-
- case map[float32]int:
- fastpathTV.EncMapFloat32IntV(v, fastpathCheckNilTrue, e)
- case *map[float32]int:
- fastpathTV.EncMapFloat32IntV(*v, fastpathCheckNilTrue, e)
-
- case map[float32]int8:
- fastpathTV.EncMapFloat32Int8V(v, fastpathCheckNilTrue, e)
- case *map[float32]int8:
- fastpathTV.EncMapFloat32Int8V(*v, fastpathCheckNilTrue, e)
-
- case map[float32]int16:
- fastpathTV.EncMapFloat32Int16V(v, fastpathCheckNilTrue, e)
- case *map[float32]int16:
- fastpathTV.EncMapFloat32Int16V(*v, fastpathCheckNilTrue, e)
-
- case map[float32]int32:
- fastpathTV.EncMapFloat32Int32V(v, fastpathCheckNilTrue, e)
- case *map[float32]int32:
- fastpathTV.EncMapFloat32Int32V(*v, fastpathCheckNilTrue, e)
-
- case map[float32]int64:
- fastpathTV.EncMapFloat32Int64V(v, fastpathCheckNilTrue, e)
- case *map[float32]int64:
- fastpathTV.EncMapFloat32Int64V(*v, fastpathCheckNilTrue, e)
-
- case map[float32]float32:
- fastpathTV.EncMapFloat32Float32V(v, fastpathCheckNilTrue, e)
- case *map[float32]float32:
- fastpathTV.EncMapFloat32Float32V(*v, fastpathCheckNilTrue, e)
-
- case map[float32]float64:
- fastpathTV.EncMapFloat32Float64V(v, fastpathCheckNilTrue, e)
- case *map[float32]float64:
- fastpathTV.EncMapFloat32Float64V(*v, fastpathCheckNilTrue, e)
-
- case map[float32]bool:
- fastpathTV.EncMapFloat32BoolV(v, fastpathCheckNilTrue, e)
- case *map[float32]bool:
- fastpathTV.EncMapFloat32BoolV(*v, fastpathCheckNilTrue, e)
-
- case map[float64]interface{}:
- fastpathTV.EncMapFloat64IntfV(v, fastpathCheckNilTrue, e)
- case *map[float64]interface{}:
- fastpathTV.EncMapFloat64IntfV(*v, fastpathCheckNilTrue, e)
-
- case map[float64]string:
- fastpathTV.EncMapFloat64StringV(v, fastpathCheckNilTrue, e)
- case *map[float64]string:
- fastpathTV.EncMapFloat64StringV(*v, fastpathCheckNilTrue, e)
-
- case map[float64]uint:
- fastpathTV.EncMapFloat64UintV(v, fastpathCheckNilTrue, e)
- case *map[float64]uint:
- fastpathTV.EncMapFloat64UintV(*v, fastpathCheckNilTrue, e)
-
- case map[float64]uint8:
- fastpathTV.EncMapFloat64Uint8V(v, fastpathCheckNilTrue, e)
- case *map[float64]uint8:
- fastpathTV.EncMapFloat64Uint8V(*v, fastpathCheckNilTrue, e)
-
- case map[float64]uint16:
- fastpathTV.EncMapFloat64Uint16V(v, fastpathCheckNilTrue, e)
- case *map[float64]uint16:
- fastpathTV.EncMapFloat64Uint16V(*v, fastpathCheckNilTrue, e)
-
- case map[float64]uint32:
- fastpathTV.EncMapFloat64Uint32V(v, fastpathCheckNilTrue, e)
- case *map[float64]uint32:
- fastpathTV.EncMapFloat64Uint32V(*v, fastpathCheckNilTrue, e)
-
- case map[float64]uint64:
- fastpathTV.EncMapFloat64Uint64V(v, fastpathCheckNilTrue, e)
- case *map[float64]uint64:
- fastpathTV.EncMapFloat64Uint64V(*v, fastpathCheckNilTrue, e)
-
- case map[float64]uintptr:
- fastpathTV.EncMapFloat64UintptrV(v, fastpathCheckNilTrue, e)
- case *map[float64]uintptr:
- fastpathTV.EncMapFloat64UintptrV(*v, fastpathCheckNilTrue, e)
-
- case map[float64]int:
- fastpathTV.EncMapFloat64IntV(v, fastpathCheckNilTrue, e)
- case *map[float64]int:
- fastpathTV.EncMapFloat64IntV(*v, fastpathCheckNilTrue, e)
-
- case map[float64]int8:
- fastpathTV.EncMapFloat64Int8V(v, fastpathCheckNilTrue, e)
- case *map[float64]int8:
- fastpathTV.EncMapFloat64Int8V(*v, fastpathCheckNilTrue, e)
-
- case map[float64]int16:
- fastpathTV.EncMapFloat64Int16V(v, fastpathCheckNilTrue, e)
- case *map[float64]int16:
- fastpathTV.EncMapFloat64Int16V(*v, fastpathCheckNilTrue, e)
-
- case map[float64]int32:
- fastpathTV.EncMapFloat64Int32V(v, fastpathCheckNilTrue, e)
- case *map[float64]int32:
- fastpathTV.EncMapFloat64Int32V(*v, fastpathCheckNilTrue, e)
-
- case map[float64]int64:
- fastpathTV.EncMapFloat64Int64V(v, fastpathCheckNilTrue, e)
- case *map[float64]int64:
- fastpathTV.EncMapFloat64Int64V(*v, fastpathCheckNilTrue, e)
-
- case map[float64]float32:
- fastpathTV.EncMapFloat64Float32V(v, fastpathCheckNilTrue, e)
- case *map[float64]float32:
- fastpathTV.EncMapFloat64Float32V(*v, fastpathCheckNilTrue, e)
-
- case map[float64]float64:
- fastpathTV.EncMapFloat64Float64V(v, fastpathCheckNilTrue, e)
- case *map[float64]float64:
- fastpathTV.EncMapFloat64Float64V(*v, fastpathCheckNilTrue, e)
-
- case map[float64]bool:
- fastpathTV.EncMapFloat64BoolV(v, fastpathCheckNilTrue, e)
- case *map[float64]bool:
- fastpathTV.EncMapFloat64BoolV(*v, fastpathCheckNilTrue, e)
-
- case map[uint]interface{}:
- fastpathTV.EncMapUintIntfV(v, fastpathCheckNilTrue, e)
- case *map[uint]interface{}:
- fastpathTV.EncMapUintIntfV(*v, fastpathCheckNilTrue, e)
-
- case map[uint]string:
- fastpathTV.EncMapUintStringV(v, fastpathCheckNilTrue, e)
- case *map[uint]string:
- fastpathTV.EncMapUintStringV(*v, fastpathCheckNilTrue, e)
-
- case map[uint]uint:
- fastpathTV.EncMapUintUintV(v, fastpathCheckNilTrue, e)
- case *map[uint]uint:
- fastpathTV.EncMapUintUintV(*v, fastpathCheckNilTrue, e)
-
- case map[uint]uint8:
- fastpathTV.EncMapUintUint8V(v, fastpathCheckNilTrue, e)
- case *map[uint]uint8:
- fastpathTV.EncMapUintUint8V(*v, fastpathCheckNilTrue, e)
-
- case map[uint]uint16:
- fastpathTV.EncMapUintUint16V(v, fastpathCheckNilTrue, e)
- case *map[uint]uint16:
- fastpathTV.EncMapUintUint16V(*v, fastpathCheckNilTrue, e)
-
- case map[uint]uint32:
- fastpathTV.EncMapUintUint32V(v, fastpathCheckNilTrue, e)
- case *map[uint]uint32:
- fastpathTV.EncMapUintUint32V(*v, fastpathCheckNilTrue, e)
-
- case map[uint]uint64:
- fastpathTV.EncMapUintUint64V(v, fastpathCheckNilTrue, e)
- case *map[uint]uint64:
- fastpathTV.EncMapUintUint64V(*v, fastpathCheckNilTrue, e)
-
- case map[uint]uintptr:
- fastpathTV.EncMapUintUintptrV(v, fastpathCheckNilTrue, e)
- case *map[uint]uintptr:
- fastpathTV.EncMapUintUintptrV(*v, fastpathCheckNilTrue, e)
-
- case map[uint]int:
- fastpathTV.EncMapUintIntV(v, fastpathCheckNilTrue, e)
- case *map[uint]int:
- fastpathTV.EncMapUintIntV(*v, fastpathCheckNilTrue, e)
-
- case map[uint]int8:
- fastpathTV.EncMapUintInt8V(v, fastpathCheckNilTrue, e)
- case *map[uint]int8:
- fastpathTV.EncMapUintInt8V(*v, fastpathCheckNilTrue, e)
-
- case map[uint]int16:
- fastpathTV.EncMapUintInt16V(v, fastpathCheckNilTrue, e)
- case *map[uint]int16:
- fastpathTV.EncMapUintInt16V(*v, fastpathCheckNilTrue, e)
-
- case map[uint]int32:
- fastpathTV.EncMapUintInt32V(v, fastpathCheckNilTrue, e)
- case *map[uint]int32:
- fastpathTV.EncMapUintInt32V(*v, fastpathCheckNilTrue, e)
-
- case map[uint]int64:
- fastpathTV.EncMapUintInt64V(v, fastpathCheckNilTrue, e)
- case *map[uint]int64:
- fastpathTV.EncMapUintInt64V(*v, fastpathCheckNilTrue, e)
-
- case map[uint]float32:
- fastpathTV.EncMapUintFloat32V(v, fastpathCheckNilTrue, e)
- case *map[uint]float32:
- fastpathTV.EncMapUintFloat32V(*v, fastpathCheckNilTrue, e)
-
- case map[uint]float64:
- fastpathTV.EncMapUintFloat64V(v, fastpathCheckNilTrue, e)
- case *map[uint]float64:
- fastpathTV.EncMapUintFloat64V(*v, fastpathCheckNilTrue, e)
-
- case map[uint]bool:
- fastpathTV.EncMapUintBoolV(v, fastpathCheckNilTrue, e)
- case *map[uint]bool:
- fastpathTV.EncMapUintBoolV(*v, fastpathCheckNilTrue, e)
-
- case map[uint8]interface{}:
- fastpathTV.EncMapUint8IntfV(v, fastpathCheckNilTrue, e)
- case *map[uint8]interface{}:
- fastpathTV.EncMapUint8IntfV(*v, fastpathCheckNilTrue, e)
-
- case map[uint8]string:
- fastpathTV.EncMapUint8StringV(v, fastpathCheckNilTrue, e)
- case *map[uint8]string:
- fastpathTV.EncMapUint8StringV(*v, fastpathCheckNilTrue, e)
-
- case map[uint8]uint:
- fastpathTV.EncMapUint8UintV(v, fastpathCheckNilTrue, e)
- case *map[uint8]uint:
- fastpathTV.EncMapUint8UintV(*v, fastpathCheckNilTrue, e)
-
- case map[uint8]uint8:
- fastpathTV.EncMapUint8Uint8V(v, fastpathCheckNilTrue, e)
- case *map[uint8]uint8:
- fastpathTV.EncMapUint8Uint8V(*v, fastpathCheckNilTrue, e)
-
- case map[uint8]uint16:
- fastpathTV.EncMapUint8Uint16V(v, fastpathCheckNilTrue, e)
- case *map[uint8]uint16:
- fastpathTV.EncMapUint8Uint16V(*v, fastpathCheckNilTrue, e)
-
- case map[uint8]uint32:
- fastpathTV.EncMapUint8Uint32V(v, fastpathCheckNilTrue, e)
- case *map[uint8]uint32:
- fastpathTV.EncMapUint8Uint32V(*v, fastpathCheckNilTrue, e)
-
- case map[uint8]uint64:
- fastpathTV.EncMapUint8Uint64V(v, fastpathCheckNilTrue, e)
- case *map[uint8]uint64:
- fastpathTV.EncMapUint8Uint64V(*v, fastpathCheckNilTrue, e)
-
- case map[uint8]uintptr:
- fastpathTV.EncMapUint8UintptrV(v, fastpathCheckNilTrue, e)
- case *map[uint8]uintptr:
- fastpathTV.EncMapUint8UintptrV(*v, fastpathCheckNilTrue, e)
-
- case map[uint8]int:
- fastpathTV.EncMapUint8IntV(v, fastpathCheckNilTrue, e)
- case *map[uint8]int:
- fastpathTV.EncMapUint8IntV(*v, fastpathCheckNilTrue, e)
-
- case map[uint8]int8:
- fastpathTV.EncMapUint8Int8V(v, fastpathCheckNilTrue, e)
- case *map[uint8]int8:
- fastpathTV.EncMapUint8Int8V(*v, fastpathCheckNilTrue, e)
-
- case map[uint8]int16:
- fastpathTV.EncMapUint8Int16V(v, fastpathCheckNilTrue, e)
- case *map[uint8]int16:
- fastpathTV.EncMapUint8Int16V(*v, fastpathCheckNilTrue, e)
-
- case map[uint8]int32:
- fastpathTV.EncMapUint8Int32V(v, fastpathCheckNilTrue, e)
- case *map[uint8]int32:
- fastpathTV.EncMapUint8Int32V(*v, fastpathCheckNilTrue, e)
-
- case map[uint8]int64:
- fastpathTV.EncMapUint8Int64V(v, fastpathCheckNilTrue, e)
- case *map[uint8]int64:
- fastpathTV.EncMapUint8Int64V(*v, fastpathCheckNilTrue, e)
-
- case map[uint8]float32:
- fastpathTV.EncMapUint8Float32V(v, fastpathCheckNilTrue, e)
- case *map[uint8]float32:
- fastpathTV.EncMapUint8Float32V(*v, fastpathCheckNilTrue, e)
-
- case map[uint8]float64:
- fastpathTV.EncMapUint8Float64V(v, fastpathCheckNilTrue, e)
- case *map[uint8]float64:
- fastpathTV.EncMapUint8Float64V(*v, fastpathCheckNilTrue, e)
-
- case map[uint8]bool:
- fastpathTV.EncMapUint8BoolV(v, fastpathCheckNilTrue, e)
- case *map[uint8]bool:
- fastpathTV.EncMapUint8BoolV(*v, fastpathCheckNilTrue, e)
-
- case map[uint16]interface{}:
- fastpathTV.EncMapUint16IntfV(v, fastpathCheckNilTrue, e)
- case *map[uint16]interface{}:
- fastpathTV.EncMapUint16IntfV(*v, fastpathCheckNilTrue, e)
-
- case map[uint16]string:
- fastpathTV.EncMapUint16StringV(v, fastpathCheckNilTrue, e)
- case *map[uint16]string:
- fastpathTV.EncMapUint16StringV(*v, fastpathCheckNilTrue, e)
-
- case map[uint16]uint:
- fastpathTV.EncMapUint16UintV(v, fastpathCheckNilTrue, e)
- case *map[uint16]uint:
- fastpathTV.EncMapUint16UintV(*v, fastpathCheckNilTrue, e)
-
- case map[uint16]uint8:
- fastpathTV.EncMapUint16Uint8V(v, fastpathCheckNilTrue, e)
- case *map[uint16]uint8:
- fastpathTV.EncMapUint16Uint8V(*v, fastpathCheckNilTrue, e)
-
- case map[uint16]uint16:
- fastpathTV.EncMapUint16Uint16V(v, fastpathCheckNilTrue, e)
- case *map[uint16]uint16:
- fastpathTV.EncMapUint16Uint16V(*v, fastpathCheckNilTrue, e)
-
- case map[uint16]uint32:
- fastpathTV.EncMapUint16Uint32V(v, fastpathCheckNilTrue, e)
- case *map[uint16]uint32:
- fastpathTV.EncMapUint16Uint32V(*v, fastpathCheckNilTrue, e)
-
- case map[uint16]uint64:
- fastpathTV.EncMapUint16Uint64V(v, fastpathCheckNilTrue, e)
- case *map[uint16]uint64:
- fastpathTV.EncMapUint16Uint64V(*v, fastpathCheckNilTrue, e)
-
- case map[uint16]uintptr:
- fastpathTV.EncMapUint16UintptrV(v, fastpathCheckNilTrue, e)
- case *map[uint16]uintptr:
- fastpathTV.EncMapUint16UintptrV(*v, fastpathCheckNilTrue, e)
-
- case map[uint16]int:
- fastpathTV.EncMapUint16IntV(v, fastpathCheckNilTrue, e)
- case *map[uint16]int:
- fastpathTV.EncMapUint16IntV(*v, fastpathCheckNilTrue, e)
-
- case map[uint16]int8:
- fastpathTV.EncMapUint16Int8V(v, fastpathCheckNilTrue, e)
- case *map[uint16]int8:
- fastpathTV.EncMapUint16Int8V(*v, fastpathCheckNilTrue, e)
-
- case map[uint16]int16:
- fastpathTV.EncMapUint16Int16V(v, fastpathCheckNilTrue, e)
- case *map[uint16]int16:
- fastpathTV.EncMapUint16Int16V(*v, fastpathCheckNilTrue, e)
-
- case map[uint16]int32:
- fastpathTV.EncMapUint16Int32V(v, fastpathCheckNilTrue, e)
- case *map[uint16]int32:
- fastpathTV.EncMapUint16Int32V(*v, fastpathCheckNilTrue, e)
-
- case map[uint16]int64:
- fastpathTV.EncMapUint16Int64V(v, fastpathCheckNilTrue, e)
- case *map[uint16]int64:
- fastpathTV.EncMapUint16Int64V(*v, fastpathCheckNilTrue, e)
-
- case map[uint16]float32:
- fastpathTV.EncMapUint16Float32V(v, fastpathCheckNilTrue, e)
- case *map[uint16]float32:
- fastpathTV.EncMapUint16Float32V(*v, fastpathCheckNilTrue, e)
-
- case map[uint16]float64:
- fastpathTV.EncMapUint16Float64V(v, fastpathCheckNilTrue, e)
- case *map[uint16]float64:
- fastpathTV.EncMapUint16Float64V(*v, fastpathCheckNilTrue, e)
-
- case map[uint16]bool:
- fastpathTV.EncMapUint16BoolV(v, fastpathCheckNilTrue, e)
- case *map[uint16]bool:
- fastpathTV.EncMapUint16BoolV(*v, fastpathCheckNilTrue, e)
-
- case map[uint32]interface{}:
- fastpathTV.EncMapUint32IntfV(v, fastpathCheckNilTrue, e)
- case *map[uint32]interface{}:
- fastpathTV.EncMapUint32IntfV(*v, fastpathCheckNilTrue, e)
-
- case map[uint32]string:
- fastpathTV.EncMapUint32StringV(v, fastpathCheckNilTrue, e)
- case *map[uint32]string:
- fastpathTV.EncMapUint32StringV(*v, fastpathCheckNilTrue, e)
-
- case map[uint32]uint:
- fastpathTV.EncMapUint32UintV(v, fastpathCheckNilTrue, e)
- case *map[uint32]uint:
- fastpathTV.EncMapUint32UintV(*v, fastpathCheckNilTrue, e)
-
- case map[uint32]uint8:
- fastpathTV.EncMapUint32Uint8V(v, fastpathCheckNilTrue, e)
- case *map[uint32]uint8:
- fastpathTV.EncMapUint32Uint8V(*v, fastpathCheckNilTrue, e)
-
- case map[uint32]uint16:
- fastpathTV.EncMapUint32Uint16V(v, fastpathCheckNilTrue, e)
- case *map[uint32]uint16:
- fastpathTV.EncMapUint32Uint16V(*v, fastpathCheckNilTrue, e)
-
- case map[uint32]uint32:
- fastpathTV.EncMapUint32Uint32V(v, fastpathCheckNilTrue, e)
- case *map[uint32]uint32:
- fastpathTV.EncMapUint32Uint32V(*v, fastpathCheckNilTrue, e)
-
- case map[uint32]uint64:
- fastpathTV.EncMapUint32Uint64V(v, fastpathCheckNilTrue, e)
- case *map[uint32]uint64:
- fastpathTV.EncMapUint32Uint64V(*v, fastpathCheckNilTrue, e)
-
- case map[uint32]uintptr:
- fastpathTV.EncMapUint32UintptrV(v, fastpathCheckNilTrue, e)
- case *map[uint32]uintptr:
- fastpathTV.EncMapUint32UintptrV(*v, fastpathCheckNilTrue, e)
-
- case map[uint32]int:
- fastpathTV.EncMapUint32IntV(v, fastpathCheckNilTrue, e)
- case *map[uint32]int:
- fastpathTV.EncMapUint32IntV(*v, fastpathCheckNilTrue, e)
-
- case map[uint32]int8:
- fastpathTV.EncMapUint32Int8V(v, fastpathCheckNilTrue, e)
- case *map[uint32]int8:
- fastpathTV.EncMapUint32Int8V(*v, fastpathCheckNilTrue, e)
-
- case map[uint32]int16:
- fastpathTV.EncMapUint32Int16V(v, fastpathCheckNilTrue, e)
- case *map[uint32]int16:
- fastpathTV.EncMapUint32Int16V(*v, fastpathCheckNilTrue, e)
-
- case map[uint32]int32:
- fastpathTV.EncMapUint32Int32V(v, fastpathCheckNilTrue, e)
- case *map[uint32]int32:
- fastpathTV.EncMapUint32Int32V(*v, fastpathCheckNilTrue, e)
-
- case map[uint32]int64:
- fastpathTV.EncMapUint32Int64V(v, fastpathCheckNilTrue, e)
- case *map[uint32]int64:
- fastpathTV.EncMapUint32Int64V(*v, fastpathCheckNilTrue, e)
-
- case map[uint32]float32:
- fastpathTV.EncMapUint32Float32V(v, fastpathCheckNilTrue, e)
- case *map[uint32]float32:
- fastpathTV.EncMapUint32Float32V(*v, fastpathCheckNilTrue, e)
-
- case map[uint32]float64:
- fastpathTV.EncMapUint32Float64V(v, fastpathCheckNilTrue, e)
- case *map[uint32]float64:
- fastpathTV.EncMapUint32Float64V(*v, fastpathCheckNilTrue, e)
-
- case map[uint32]bool:
- fastpathTV.EncMapUint32BoolV(v, fastpathCheckNilTrue, e)
- case *map[uint32]bool:
- fastpathTV.EncMapUint32BoolV(*v, fastpathCheckNilTrue, e)
-
- case map[uint64]interface{}:
- fastpathTV.EncMapUint64IntfV(v, fastpathCheckNilTrue, e)
- case *map[uint64]interface{}:
- fastpathTV.EncMapUint64IntfV(*v, fastpathCheckNilTrue, e)
-
- case map[uint64]string:
- fastpathTV.EncMapUint64StringV(v, fastpathCheckNilTrue, e)
- case *map[uint64]string:
- fastpathTV.EncMapUint64StringV(*v, fastpathCheckNilTrue, e)
-
- case map[uint64]uint:
- fastpathTV.EncMapUint64UintV(v, fastpathCheckNilTrue, e)
- case *map[uint64]uint:
- fastpathTV.EncMapUint64UintV(*v, fastpathCheckNilTrue, e)
-
- case map[uint64]uint8:
- fastpathTV.EncMapUint64Uint8V(v, fastpathCheckNilTrue, e)
- case *map[uint64]uint8:
- fastpathTV.EncMapUint64Uint8V(*v, fastpathCheckNilTrue, e)
-
- case map[uint64]uint16:
- fastpathTV.EncMapUint64Uint16V(v, fastpathCheckNilTrue, e)
- case *map[uint64]uint16:
- fastpathTV.EncMapUint64Uint16V(*v, fastpathCheckNilTrue, e)
-
- case map[uint64]uint32:
- fastpathTV.EncMapUint64Uint32V(v, fastpathCheckNilTrue, e)
- case *map[uint64]uint32:
- fastpathTV.EncMapUint64Uint32V(*v, fastpathCheckNilTrue, e)
-
- case map[uint64]uint64:
- fastpathTV.EncMapUint64Uint64V(v, fastpathCheckNilTrue, e)
- case *map[uint64]uint64:
- fastpathTV.EncMapUint64Uint64V(*v, fastpathCheckNilTrue, e)
-
- case map[uint64]uintptr:
- fastpathTV.EncMapUint64UintptrV(v, fastpathCheckNilTrue, e)
- case *map[uint64]uintptr:
- fastpathTV.EncMapUint64UintptrV(*v, fastpathCheckNilTrue, e)
-
- case map[uint64]int:
- fastpathTV.EncMapUint64IntV(v, fastpathCheckNilTrue, e)
- case *map[uint64]int:
- fastpathTV.EncMapUint64IntV(*v, fastpathCheckNilTrue, e)
-
- case map[uint64]int8:
- fastpathTV.EncMapUint64Int8V(v, fastpathCheckNilTrue, e)
- case *map[uint64]int8:
- fastpathTV.EncMapUint64Int8V(*v, fastpathCheckNilTrue, e)
-
- case map[uint64]int16:
- fastpathTV.EncMapUint64Int16V(v, fastpathCheckNilTrue, e)
- case *map[uint64]int16:
- fastpathTV.EncMapUint64Int16V(*v, fastpathCheckNilTrue, e)
-
- case map[uint64]int32:
- fastpathTV.EncMapUint64Int32V(v, fastpathCheckNilTrue, e)
- case *map[uint64]int32:
- fastpathTV.EncMapUint64Int32V(*v, fastpathCheckNilTrue, e)
-
- case map[uint64]int64:
- fastpathTV.EncMapUint64Int64V(v, fastpathCheckNilTrue, e)
- case *map[uint64]int64:
- fastpathTV.EncMapUint64Int64V(*v, fastpathCheckNilTrue, e)
-
- case map[uint64]float32:
- fastpathTV.EncMapUint64Float32V(v, fastpathCheckNilTrue, e)
- case *map[uint64]float32:
- fastpathTV.EncMapUint64Float32V(*v, fastpathCheckNilTrue, e)
-
- case map[uint64]float64:
- fastpathTV.EncMapUint64Float64V(v, fastpathCheckNilTrue, e)
- case *map[uint64]float64:
- fastpathTV.EncMapUint64Float64V(*v, fastpathCheckNilTrue, e)
-
- case map[uint64]bool:
- fastpathTV.EncMapUint64BoolV(v, fastpathCheckNilTrue, e)
- case *map[uint64]bool:
- fastpathTV.EncMapUint64BoolV(*v, fastpathCheckNilTrue, e)
-
- case map[uintptr]interface{}:
- fastpathTV.EncMapUintptrIntfV(v, fastpathCheckNilTrue, e)
- case *map[uintptr]interface{}:
- fastpathTV.EncMapUintptrIntfV(*v, fastpathCheckNilTrue, e)
-
- case map[uintptr]string:
- fastpathTV.EncMapUintptrStringV(v, fastpathCheckNilTrue, e)
- case *map[uintptr]string:
- fastpathTV.EncMapUintptrStringV(*v, fastpathCheckNilTrue, e)
-
- case map[uintptr]uint:
- fastpathTV.EncMapUintptrUintV(v, fastpathCheckNilTrue, e)
- case *map[uintptr]uint:
- fastpathTV.EncMapUintptrUintV(*v, fastpathCheckNilTrue, e)
-
- case map[uintptr]uint8:
- fastpathTV.EncMapUintptrUint8V(v, fastpathCheckNilTrue, e)
- case *map[uintptr]uint8:
- fastpathTV.EncMapUintptrUint8V(*v, fastpathCheckNilTrue, e)
-
- case map[uintptr]uint16:
- fastpathTV.EncMapUintptrUint16V(v, fastpathCheckNilTrue, e)
- case *map[uintptr]uint16:
- fastpathTV.EncMapUintptrUint16V(*v, fastpathCheckNilTrue, e)
-
- case map[uintptr]uint32:
- fastpathTV.EncMapUintptrUint32V(v, fastpathCheckNilTrue, e)
- case *map[uintptr]uint32:
- fastpathTV.EncMapUintptrUint32V(*v, fastpathCheckNilTrue, e)
-
- case map[uintptr]uint64:
- fastpathTV.EncMapUintptrUint64V(v, fastpathCheckNilTrue, e)
- case *map[uintptr]uint64:
- fastpathTV.EncMapUintptrUint64V(*v, fastpathCheckNilTrue, e)
-
- case map[uintptr]uintptr:
- fastpathTV.EncMapUintptrUintptrV(v, fastpathCheckNilTrue, e)
- case *map[uintptr]uintptr:
- fastpathTV.EncMapUintptrUintptrV(*v, fastpathCheckNilTrue, e)
-
- case map[uintptr]int:
- fastpathTV.EncMapUintptrIntV(v, fastpathCheckNilTrue, e)
- case *map[uintptr]int:
- fastpathTV.EncMapUintptrIntV(*v, fastpathCheckNilTrue, e)
-
- case map[uintptr]int8:
- fastpathTV.EncMapUintptrInt8V(v, fastpathCheckNilTrue, e)
- case *map[uintptr]int8:
- fastpathTV.EncMapUintptrInt8V(*v, fastpathCheckNilTrue, e)
-
- case map[uintptr]int16:
- fastpathTV.EncMapUintptrInt16V(v, fastpathCheckNilTrue, e)
- case *map[uintptr]int16:
- fastpathTV.EncMapUintptrInt16V(*v, fastpathCheckNilTrue, e)
-
- case map[uintptr]int32:
- fastpathTV.EncMapUintptrInt32V(v, fastpathCheckNilTrue, e)
- case *map[uintptr]int32:
- fastpathTV.EncMapUintptrInt32V(*v, fastpathCheckNilTrue, e)
-
- case map[uintptr]int64:
- fastpathTV.EncMapUintptrInt64V(v, fastpathCheckNilTrue, e)
- case *map[uintptr]int64:
- fastpathTV.EncMapUintptrInt64V(*v, fastpathCheckNilTrue, e)
-
- case map[uintptr]float32:
- fastpathTV.EncMapUintptrFloat32V(v, fastpathCheckNilTrue, e)
- case *map[uintptr]float32:
- fastpathTV.EncMapUintptrFloat32V(*v, fastpathCheckNilTrue, e)
-
- case map[uintptr]float64:
- fastpathTV.EncMapUintptrFloat64V(v, fastpathCheckNilTrue, e)
- case *map[uintptr]float64:
- fastpathTV.EncMapUintptrFloat64V(*v, fastpathCheckNilTrue, e)
-
- case map[uintptr]bool:
- fastpathTV.EncMapUintptrBoolV(v, fastpathCheckNilTrue, e)
- case *map[uintptr]bool:
- fastpathTV.EncMapUintptrBoolV(*v, fastpathCheckNilTrue, e)
-
- case map[int]interface{}:
- fastpathTV.EncMapIntIntfV(v, fastpathCheckNilTrue, e)
- case *map[int]interface{}:
- fastpathTV.EncMapIntIntfV(*v, fastpathCheckNilTrue, e)
-
- case map[int]string:
- fastpathTV.EncMapIntStringV(v, fastpathCheckNilTrue, e)
- case *map[int]string:
- fastpathTV.EncMapIntStringV(*v, fastpathCheckNilTrue, e)
-
- case map[int]uint:
- fastpathTV.EncMapIntUintV(v, fastpathCheckNilTrue, e)
- case *map[int]uint:
- fastpathTV.EncMapIntUintV(*v, fastpathCheckNilTrue, e)
-
- case map[int]uint8:
- fastpathTV.EncMapIntUint8V(v, fastpathCheckNilTrue, e)
- case *map[int]uint8:
- fastpathTV.EncMapIntUint8V(*v, fastpathCheckNilTrue, e)
-
- case map[int]uint16:
- fastpathTV.EncMapIntUint16V(v, fastpathCheckNilTrue, e)
- case *map[int]uint16:
- fastpathTV.EncMapIntUint16V(*v, fastpathCheckNilTrue, e)
-
- case map[int]uint32:
- fastpathTV.EncMapIntUint32V(v, fastpathCheckNilTrue, e)
- case *map[int]uint32:
- fastpathTV.EncMapIntUint32V(*v, fastpathCheckNilTrue, e)
-
- case map[int]uint64:
- fastpathTV.EncMapIntUint64V(v, fastpathCheckNilTrue, e)
- case *map[int]uint64:
- fastpathTV.EncMapIntUint64V(*v, fastpathCheckNilTrue, e)
-
- case map[int]uintptr:
- fastpathTV.EncMapIntUintptrV(v, fastpathCheckNilTrue, e)
- case *map[int]uintptr:
- fastpathTV.EncMapIntUintptrV(*v, fastpathCheckNilTrue, e)
-
- case map[int]int:
- fastpathTV.EncMapIntIntV(v, fastpathCheckNilTrue, e)
- case *map[int]int:
- fastpathTV.EncMapIntIntV(*v, fastpathCheckNilTrue, e)
-
- case map[int]int8:
- fastpathTV.EncMapIntInt8V(v, fastpathCheckNilTrue, e)
- case *map[int]int8:
- fastpathTV.EncMapIntInt8V(*v, fastpathCheckNilTrue, e)
-
- case map[int]int16:
- fastpathTV.EncMapIntInt16V(v, fastpathCheckNilTrue, e)
- case *map[int]int16:
- fastpathTV.EncMapIntInt16V(*v, fastpathCheckNilTrue, e)
-
- case map[int]int32:
- fastpathTV.EncMapIntInt32V(v, fastpathCheckNilTrue, e)
- case *map[int]int32:
- fastpathTV.EncMapIntInt32V(*v, fastpathCheckNilTrue, e)
-
- case map[int]int64:
- fastpathTV.EncMapIntInt64V(v, fastpathCheckNilTrue, e)
- case *map[int]int64:
- fastpathTV.EncMapIntInt64V(*v, fastpathCheckNilTrue, e)
-
- case map[int]float32:
- fastpathTV.EncMapIntFloat32V(v, fastpathCheckNilTrue, e)
- case *map[int]float32:
- fastpathTV.EncMapIntFloat32V(*v, fastpathCheckNilTrue, e)
-
- case map[int]float64:
- fastpathTV.EncMapIntFloat64V(v, fastpathCheckNilTrue, e)
- case *map[int]float64:
- fastpathTV.EncMapIntFloat64V(*v, fastpathCheckNilTrue, e)
-
- case map[int]bool:
- fastpathTV.EncMapIntBoolV(v, fastpathCheckNilTrue, e)
- case *map[int]bool:
- fastpathTV.EncMapIntBoolV(*v, fastpathCheckNilTrue, e)
-
- case map[int8]interface{}:
- fastpathTV.EncMapInt8IntfV(v, fastpathCheckNilTrue, e)
- case *map[int8]interface{}:
- fastpathTV.EncMapInt8IntfV(*v, fastpathCheckNilTrue, e)
-
- case map[int8]string:
- fastpathTV.EncMapInt8StringV(v, fastpathCheckNilTrue, e)
- case *map[int8]string:
- fastpathTV.EncMapInt8StringV(*v, fastpathCheckNilTrue, e)
-
- case map[int8]uint:
- fastpathTV.EncMapInt8UintV(v, fastpathCheckNilTrue, e)
- case *map[int8]uint:
- fastpathTV.EncMapInt8UintV(*v, fastpathCheckNilTrue, e)
-
- case map[int8]uint8:
- fastpathTV.EncMapInt8Uint8V(v, fastpathCheckNilTrue, e)
- case *map[int8]uint8:
- fastpathTV.EncMapInt8Uint8V(*v, fastpathCheckNilTrue, e)
-
- case map[int8]uint16:
- fastpathTV.EncMapInt8Uint16V(v, fastpathCheckNilTrue, e)
- case *map[int8]uint16:
- fastpathTV.EncMapInt8Uint16V(*v, fastpathCheckNilTrue, e)
-
- case map[int8]uint32:
- fastpathTV.EncMapInt8Uint32V(v, fastpathCheckNilTrue, e)
- case *map[int8]uint32:
- fastpathTV.EncMapInt8Uint32V(*v, fastpathCheckNilTrue, e)
-
- case map[int8]uint64:
- fastpathTV.EncMapInt8Uint64V(v, fastpathCheckNilTrue, e)
- case *map[int8]uint64:
- fastpathTV.EncMapInt8Uint64V(*v, fastpathCheckNilTrue, e)
-
- case map[int8]uintptr:
- fastpathTV.EncMapInt8UintptrV(v, fastpathCheckNilTrue, e)
- case *map[int8]uintptr:
- fastpathTV.EncMapInt8UintptrV(*v, fastpathCheckNilTrue, e)
-
- case map[int8]int:
- fastpathTV.EncMapInt8IntV(v, fastpathCheckNilTrue, e)
- case *map[int8]int:
- fastpathTV.EncMapInt8IntV(*v, fastpathCheckNilTrue, e)
-
- case map[int8]int8:
- fastpathTV.EncMapInt8Int8V(v, fastpathCheckNilTrue, e)
- case *map[int8]int8:
- fastpathTV.EncMapInt8Int8V(*v, fastpathCheckNilTrue, e)
-
- case map[int8]int16:
- fastpathTV.EncMapInt8Int16V(v, fastpathCheckNilTrue, e)
- case *map[int8]int16:
- fastpathTV.EncMapInt8Int16V(*v, fastpathCheckNilTrue, e)
-
- case map[int8]int32:
- fastpathTV.EncMapInt8Int32V(v, fastpathCheckNilTrue, e)
- case *map[int8]int32:
- fastpathTV.EncMapInt8Int32V(*v, fastpathCheckNilTrue, e)
-
- case map[int8]int64:
- fastpathTV.EncMapInt8Int64V(v, fastpathCheckNilTrue, e)
- case *map[int8]int64:
- fastpathTV.EncMapInt8Int64V(*v, fastpathCheckNilTrue, e)
-
- case map[int8]float32:
- fastpathTV.EncMapInt8Float32V(v, fastpathCheckNilTrue, e)
- case *map[int8]float32:
- fastpathTV.EncMapInt8Float32V(*v, fastpathCheckNilTrue, e)
-
- case map[int8]float64:
- fastpathTV.EncMapInt8Float64V(v, fastpathCheckNilTrue, e)
- case *map[int8]float64:
- fastpathTV.EncMapInt8Float64V(*v, fastpathCheckNilTrue, e)
-
- case map[int8]bool:
- fastpathTV.EncMapInt8BoolV(v, fastpathCheckNilTrue, e)
- case *map[int8]bool:
- fastpathTV.EncMapInt8BoolV(*v, fastpathCheckNilTrue, e)
-
- case map[int16]interface{}:
- fastpathTV.EncMapInt16IntfV(v, fastpathCheckNilTrue, e)
- case *map[int16]interface{}:
- fastpathTV.EncMapInt16IntfV(*v, fastpathCheckNilTrue, e)
-
- case map[int16]string:
- fastpathTV.EncMapInt16StringV(v, fastpathCheckNilTrue, e)
- case *map[int16]string:
- fastpathTV.EncMapInt16StringV(*v, fastpathCheckNilTrue, e)
-
- case map[int16]uint:
- fastpathTV.EncMapInt16UintV(v, fastpathCheckNilTrue, e)
- case *map[int16]uint:
- fastpathTV.EncMapInt16UintV(*v, fastpathCheckNilTrue, e)
-
- case map[int16]uint8:
- fastpathTV.EncMapInt16Uint8V(v, fastpathCheckNilTrue, e)
- case *map[int16]uint8:
- fastpathTV.EncMapInt16Uint8V(*v, fastpathCheckNilTrue, e)
-
- case map[int16]uint16:
- fastpathTV.EncMapInt16Uint16V(v, fastpathCheckNilTrue, e)
- case *map[int16]uint16:
- fastpathTV.EncMapInt16Uint16V(*v, fastpathCheckNilTrue, e)
-
- case map[int16]uint32:
- fastpathTV.EncMapInt16Uint32V(v, fastpathCheckNilTrue, e)
- case *map[int16]uint32:
- fastpathTV.EncMapInt16Uint32V(*v, fastpathCheckNilTrue, e)
-
- case map[int16]uint64:
- fastpathTV.EncMapInt16Uint64V(v, fastpathCheckNilTrue, e)
- case *map[int16]uint64:
- fastpathTV.EncMapInt16Uint64V(*v, fastpathCheckNilTrue, e)
-
- case map[int16]uintptr:
- fastpathTV.EncMapInt16UintptrV(v, fastpathCheckNilTrue, e)
- case *map[int16]uintptr:
- fastpathTV.EncMapInt16UintptrV(*v, fastpathCheckNilTrue, e)
-
- case map[int16]int:
- fastpathTV.EncMapInt16IntV(v, fastpathCheckNilTrue, e)
- case *map[int16]int:
- fastpathTV.EncMapInt16IntV(*v, fastpathCheckNilTrue, e)
-
- case map[int16]int8:
- fastpathTV.EncMapInt16Int8V(v, fastpathCheckNilTrue, e)
- case *map[int16]int8:
- fastpathTV.EncMapInt16Int8V(*v, fastpathCheckNilTrue, e)
-
- case map[int16]int16:
- fastpathTV.EncMapInt16Int16V(v, fastpathCheckNilTrue, e)
- case *map[int16]int16:
- fastpathTV.EncMapInt16Int16V(*v, fastpathCheckNilTrue, e)
-
- case map[int16]int32:
- fastpathTV.EncMapInt16Int32V(v, fastpathCheckNilTrue, e)
- case *map[int16]int32:
- fastpathTV.EncMapInt16Int32V(*v, fastpathCheckNilTrue, e)
-
- case map[int16]int64:
- fastpathTV.EncMapInt16Int64V(v, fastpathCheckNilTrue, e)
- case *map[int16]int64:
- fastpathTV.EncMapInt16Int64V(*v, fastpathCheckNilTrue, e)
-
- case map[int16]float32:
- fastpathTV.EncMapInt16Float32V(v, fastpathCheckNilTrue, e)
- case *map[int16]float32:
- fastpathTV.EncMapInt16Float32V(*v, fastpathCheckNilTrue, e)
-
- case map[int16]float64:
- fastpathTV.EncMapInt16Float64V(v, fastpathCheckNilTrue, e)
- case *map[int16]float64:
- fastpathTV.EncMapInt16Float64V(*v, fastpathCheckNilTrue, e)
-
- case map[int16]bool:
- fastpathTV.EncMapInt16BoolV(v, fastpathCheckNilTrue, e)
- case *map[int16]bool:
- fastpathTV.EncMapInt16BoolV(*v, fastpathCheckNilTrue, e)
-
- case map[int32]interface{}:
- fastpathTV.EncMapInt32IntfV(v, fastpathCheckNilTrue, e)
- case *map[int32]interface{}:
- fastpathTV.EncMapInt32IntfV(*v, fastpathCheckNilTrue, e)
-
- case map[int32]string:
- fastpathTV.EncMapInt32StringV(v, fastpathCheckNilTrue, e)
- case *map[int32]string:
- fastpathTV.EncMapInt32StringV(*v, fastpathCheckNilTrue, e)
-
- case map[int32]uint:
- fastpathTV.EncMapInt32UintV(v, fastpathCheckNilTrue, e)
- case *map[int32]uint:
- fastpathTV.EncMapInt32UintV(*v, fastpathCheckNilTrue, e)
-
- case map[int32]uint8:
- fastpathTV.EncMapInt32Uint8V(v, fastpathCheckNilTrue, e)
- case *map[int32]uint8:
- fastpathTV.EncMapInt32Uint8V(*v, fastpathCheckNilTrue, e)
-
- case map[int32]uint16:
- fastpathTV.EncMapInt32Uint16V(v, fastpathCheckNilTrue, e)
- case *map[int32]uint16:
- fastpathTV.EncMapInt32Uint16V(*v, fastpathCheckNilTrue, e)
-
- case map[int32]uint32:
- fastpathTV.EncMapInt32Uint32V(v, fastpathCheckNilTrue, e)
- case *map[int32]uint32:
- fastpathTV.EncMapInt32Uint32V(*v, fastpathCheckNilTrue, e)
-
- case map[int32]uint64:
- fastpathTV.EncMapInt32Uint64V(v, fastpathCheckNilTrue, e)
- case *map[int32]uint64:
- fastpathTV.EncMapInt32Uint64V(*v, fastpathCheckNilTrue, e)
-
- case map[int32]uintptr:
- fastpathTV.EncMapInt32UintptrV(v, fastpathCheckNilTrue, e)
- case *map[int32]uintptr:
- fastpathTV.EncMapInt32UintptrV(*v, fastpathCheckNilTrue, e)
-
- case map[int32]int:
- fastpathTV.EncMapInt32IntV(v, fastpathCheckNilTrue, e)
- case *map[int32]int:
- fastpathTV.EncMapInt32IntV(*v, fastpathCheckNilTrue, e)
-
- case map[int32]int8:
- fastpathTV.EncMapInt32Int8V(v, fastpathCheckNilTrue, e)
- case *map[int32]int8:
- fastpathTV.EncMapInt32Int8V(*v, fastpathCheckNilTrue, e)
-
- case map[int32]int16:
- fastpathTV.EncMapInt32Int16V(v, fastpathCheckNilTrue, e)
- case *map[int32]int16:
- fastpathTV.EncMapInt32Int16V(*v, fastpathCheckNilTrue, e)
-
- case map[int32]int32:
- fastpathTV.EncMapInt32Int32V(v, fastpathCheckNilTrue, e)
- case *map[int32]int32:
- fastpathTV.EncMapInt32Int32V(*v, fastpathCheckNilTrue, e)
-
- case map[int32]int64:
- fastpathTV.EncMapInt32Int64V(v, fastpathCheckNilTrue, e)
- case *map[int32]int64:
- fastpathTV.EncMapInt32Int64V(*v, fastpathCheckNilTrue, e)
-
- case map[int32]float32:
- fastpathTV.EncMapInt32Float32V(v, fastpathCheckNilTrue, e)
- case *map[int32]float32:
- fastpathTV.EncMapInt32Float32V(*v, fastpathCheckNilTrue, e)
-
- case map[int32]float64:
- fastpathTV.EncMapInt32Float64V(v, fastpathCheckNilTrue, e)
- case *map[int32]float64:
- fastpathTV.EncMapInt32Float64V(*v, fastpathCheckNilTrue, e)
-
- case map[int32]bool:
- fastpathTV.EncMapInt32BoolV(v, fastpathCheckNilTrue, e)
- case *map[int32]bool:
- fastpathTV.EncMapInt32BoolV(*v, fastpathCheckNilTrue, e)
-
- case map[int64]interface{}:
- fastpathTV.EncMapInt64IntfV(v, fastpathCheckNilTrue, e)
- case *map[int64]interface{}:
- fastpathTV.EncMapInt64IntfV(*v, fastpathCheckNilTrue, e)
-
- case map[int64]string:
- fastpathTV.EncMapInt64StringV(v, fastpathCheckNilTrue, e)
- case *map[int64]string:
- fastpathTV.EncMapInt64StringV(*v, fastpathCheckNilTrue, e)
-
- case map[int64]uint:
- fastpathTV.EncMapInt64UintV(v, fastpathCheckNilTrue, e)
- case *map[int64]uint:
- fastpathTV.EncMapInt64UintV(*v, fastpathCheckNilTrue, e)
-
- case map[int64]uint8:
- fastpathTV.EncMapInt64Uint8V(v, fastpathCheckNilTrue, e)
- case *map[int64]uint8:
- fastpathTV.EncMapInt64Uint8V(*v, fastpathCheckNilTrue, e)
-
- case map[int64]uint16:
- fastpathTV.EncMapInt64Uint16V(v, fastpathCheckNilTrue, e)
- case *map[int64]uint16:
- fastpathTV.EncMapInt64Uint16V(*v, fastpathCheckNilTrue, e)
-
- case map[int64]uint32:
- fastpathTV.EncMapInt64Uint32V(v, fastpathCheckNilTrue, e)
- case *map[int64]uint32:
- fastpathTV.EncMapInt64Uint32V(*v, fastpathCheckNilTrue, e)
-
- case map[int64]uint64:
- fastpathTV.EncMapInt64Uint64V(v, fastpathCheckNilTrue, e)
- case *map[int64]uint64:
- fastpathTV.EncMapInt64Uint64V(*v, fastpathCheckNilTrue, e)
-
- case map[int64]uintptr:
- fastpathTV.EncMapInt64UintptrV(v, fastpathCheckNilTrue, e)
- case *map[int64]uintptr:
- fastpathTV.EncMapInt64UintptrV(*v, fastpathCheckNilTrue, e)
-
- case map[int64]int:
- fastpathTV.EncMapInt64IntV(v, fastpathCheckNilTrue, e)
- case *map[int64]int:
- fastpathTV.EncMapInt64IntV(*v, fastpathCheckNilTrue, e)
-
- case map[int64]int8:
- fastpathTV.EncMapInt64Int8V(v, fastpathCheckNilTrue, e)
- case *map[int64]int8:
- fastpathTV.EncMapInt64Int8V(*v, fastpathCheckNilTrue, e)
-
- case map[int64]int16:
- fastpathTV.EncMapInt64Int16V(v, fastpathCheckNilTrue, e)
- case *map[int64]int16:
- fastpathTV.EncMapInt64Int16V(*v, fastpathCheckNilTrue, e)
-
- case map[int64]int32:
- fastpathTV.EncMapInt64Int32V(v, fastpathCheckNilTrue, e)
- case *map[int64]int32:
- fastpathTV.EncMapInt64Int32V(*v, fastpathCheckNilTrue, e)
-
- case map[int64]int64:
- fastpathTV.EncMapInt64Int64V(v, fastpathCheckNilTrue, e)
- case *map[int64]int64:
- fastpathTV.EncMapInt64Int64V(*v, fastpathCheckNilTrue, e)
-
- case map[int64]float32:
- fastpathTV.EncMapInt64Float32V(v, fastpathCheckNilTrue, e)
- case *map[int64]float32:
- fastpathTV.EncMapInt64Float32V(*v, fastpathCheckNilTrue, e)
-
- case map[int64]float64:
- fastpathTV.EncMapInt64Float64V(v, fastpathCheckNilTrue, e)
- case *map[int64]float64:
- fastpathTV.EncMapInt64Float64V(*v, fastpathCheckNilTrue, e)
-
- case map[int64]bool:
- fastpathTV.EncMapInt64BoolV(v, fastpathCheckNilTrue, e)
- case *map[int64]bool:
- fastpathTV.EncMapInt64BoolV(*v, fastpathCheckNilTrue, e)
-
- case map[bool]interface{}:
- fastpathTV.EncMapBoolIntfV(v, fastpathCheckNilTrue, e)
- case *map[bool]interface{}:
- fastpathTV.EncMapBoolIntfV(*v, fastpathCheckNilTrue, e)
-
- case map[bool]string:
- fastpathTV.EncMapBoolStringV(v, fastpathCheckNilTrue, e)
- case *map[bool]string:
- fastpathTV.EncMapBoolStringV(*v, fastpathCheckNilTrue, e)
-
- case map[bool]uint:
- fastpathTV.EncMapBoolUintV(v, fastpathCheckNilTrue, e)
- case *map[bool]uint:
- fastpathTV.EncMapBoolUintV(*v, fastpathCheckNilTrue, e)
-
- case map[bool]uint8:
- fastpathTV.EncMapBoolUint8V(v, fastpathCheckNilTrue, e)
- case *map[bool]uint8:
- fastpathTV.EncMapBoolUint8V(*v, fastpathCheckNilTrue, e)
-
- case map[bool]uint16:
- fastpathTV.EncMapBoolUint16V(v, fastpathCheckNilTrue, e)
- case *map[bool]uint16:
- fastpathTV.EncMapBoolUint16V(*v, fastpathCheckNilTrue, e)
-
- case map[bool]uint32:
- fastpathTV.EncMapBoolUint32V(v, fastpathCheckNilTrue, e)
- case *map[bool]uint32:
- fastpathTV.EncMapBoolUint32V(*v, fastpathCheckNilTrue, e)
-
- case map[bool]uint64:
- fastpathTV.EncMapBoolUint64V(v, fastpathCheckNilTrue, e)
- case *map[bool]uint64:
- fastpathTV.EncMapBoolUint64V(*v, fastpathCheckNilTrue, e)
-
- case map[bool]uintptr:
- fastpathTV.EncMapBoolUintptrV(v, fastpathCheckNilTrue, e)
- case *map[bool]uintptr:
- fastpathTV.EncMapBoolUintptrV(*v, fastpathCheckNilTrue, e)
-
- case map[bool]int:
- fastpathTV.EncMapBoolIntV(v, fastpathCheckNilTrue, e)
- case *map[bool]int:
- fastpathTV.EncMapBoolIntV(*v, fastpathCheckNilTrue, e)
-
- case map[bool]int8:
- fastpathTV.EncMapBoolInt8V(v, fastpathCheckNilTrue, e)
- case *map[bool]int8:
- fastpathTV.EncMapBoolInt8V(*v, fastpathCheckNilTrue, e)
-
- case map[bool]int16:
- fastpathTV.EncMapBoolInt16V(v, fastpathCheckNilTrue, e)
- case *map[bool]int16:
- fastpathTV.EncMapBoolInt16V(*v, fastpathCheckNilTrue, e)
-
- case map[bool]int32:
- fastpathTV.EncMapBoolInt32V(v, fastpathCheckNilTrue, e)
- case *map[bool]int32:
- fastpathTV.EncMapBoolInt32V(*v, fastpathCheckNilTrue, e)
-
- case map[bool]int64:
- fastpathTV.EncMapBoolInt64V(v, fastpathCheckNilTrue, e)
- case *map[bool]int64:
- fastpathTV.EncMapBoolInt64V(*v, fastpathCheckNilTrue, e)
-
- case map[bool]float32:
- fastpathTV.EncMapBoolFloat32V(v, fastpathCheckNilTrue, e)
- case *map[bool]float32:
- fastpathTV.EncMapBoolFloat32V(*v, fastpathCheckNilTrue, e)
-
- case map[bool]float64:
- fastpathTV.EncMapBoolFloat64V(v, fastpathCheckNilTrue, e)
- case *map[bool]float64:
- fastpathTV.EncMapBoolFloat64V(*v, fastpathCheckNilTrue, e)
-
- case map[bool]bool:
- fastpathTV.EncMapBoolBoolV(v, fastpathCheckNilTrue, e)
- case *map[bool]bool:
- fastpathTV.EncMapBoolBoolV(*v, fastpathCheckNilTrue, e)
-
- default:
- _ = v // TODO: workaround https://github.com/golang/go/issues/12927 (remove after go 1.6 release)
- return false
- }
- return true
-}
-
-// -- -- fast path functions
-
-func (f *encFnInfo) fastpathEncSliceIntfR(rv reflect.Value) {
- if f.ti.mbs {
- fastpathTV.EncAsMapSliceIntfV(rv.Interface().([]interface{}), fastpathCheckNilFalse, f.e)
- } else {
- fastpathTV.EncSliceIntfV(rv.Interface().([]interface{}), fastpathCheckNilFalse, f.e)
- }
-}
-func (_ fastpathT) EncSliceIntfV(v []interface{}, checkNil bool, e *Encoder) {
- ee := e.e
- cr := e.cr
- if checkNil && v == nil {
- ee.EncodeNil()
- return
- }
- ee.EncodeArrayStart(len(v))
- for _, v2 := range v {
- if cr != nil {
- cr.sendContainerState(containerArrayElem)
- }
- e.encode(v2)
- }
- if cr != nil {
- cr.sendContainerState(containerArrayEnd)
- }
-}
-
-func (_ fastpathT) EncAsMapSliceIntfV(v []interface{}, checkNil bool, e *Encoder) {
- ee := e.e
- cr := e.cr
- if checkNil && v == nil {
- ee.EncodeNil()
- return
- }
- if len(v)%2 == 1 {
- e.errorf("mapBySlice requires even slice length, but got %v", len(v))
- return
- }
- ee.EncodeMapStart(len(v) / 2)
- for j, v2 := range v {
- if cr != nil {
- if j%2 == 0 {
- cr.sendContainerState(containerMapKey)
- } else {
- cr.sendContainerState(containerMapValue)
- }
- }
- e.encode(v2)
- }
- if cr != nil {
- cr.sendContainerState(containerMapEnd)
- }
-}
-
-func (f *encFnInfo) fastpathEncSliceStringR(rv reflect.Value) {
- if f.ti.mbs {
- fastpathTV.EncAsMapSliceStringV(rv.Interface().([]string), fastpathCheckNilFalse, f.e)
- } else {
- fastpathTV.EncSliceStringV(rv.Interface().([]string), fastpathCheckNilFalse, f.e)
- }
-}
-func (_ fastpathT) EncSliceStringV(v []string, checkNil bool, e *Encoder) {
- ee := e.e
- cr := e.cr
- if checkNil && v == nil {
- ee.EncodeNil()
- return
- }
- ee.EncodeArrayStart(len(v))
- for _, v2 := range v {
- if cr != nil {
- cr.sendContainerState(containerArrayElem)
- }
- ee.EncodeString(c_UTF8, v2)
- }
- if cr != nil {
- cr.sendContainerState(containerArrayEnd)
- }
-}
-
-func (_ fastpathT) EncAsMapSliceStringV(v []string, checkNil bool, e *Encoder) {
- ee := e.e
- cr := e.cr
- if checkNil && v == nil {
- ee.EncodeNil()
- return
- }
- if len(v)%2 == 1 {
- e.errorf("mapBySlice requires even slice length, but got %v", len(v))
- return
- }
- ee.EncodeMapStart(len(v) / 2)
- for j, v2 := range v {
- if cr != nil {
- if j%2 == 0 {
- cr.sendContainerState(containerMapKey)
- } else {
- cr.sendContainerState(containerMapValue)
- }
- }
- ee.EncodeString(c_UTF8, v2)
- }
- if cr != nil {
- cr.sendContainerState(containerMapEnd)
- }
-}
-
-func (f *encFnInfo) fastpathEncSliceFloat32R(rv reflect.Value) {
- if f.ti.mbs {
- fastpathTV.EncAsMapSliceFloat32V(rv.Interface().([]float32), fastpathCheckNilFalse, f.e)
- } else {
- fastpathTV.EncSliceFloat32V(rv.Interface().([]float32), fastpathCheckNilFalse, f.e)
- }
-}
-func (_ fastpathT) EncSliceFloat32V(v []float32, checkNil bool, e *Encoder) {
- ee := e.e
- cr := e.cr
- if checkNil && v == nil {
- ee.EncodeNil()
- return
- }
- ee.EncodeArrayStart(len(v))
- for _, v2 := range v {
- if cr != nil {
- cr.sendContainerState(containerArrayElem)
- }
- ee.EncodeFloat32(v2)
- }
- if cr != nil {
- cr.sendContainerState(containerArrayEnd)
- }
-}
-
-func (_ fastpathT) EncAsMapSliceFloat32V(v []float32, checkNil bool, e *Encoder) {
- ee := e.e
- cr := e.cr
- if checkNil && v == nil {
- ee.EncodeNil()
- return
- }
- if len(v)%2 == 1 {
- e.errorf("mapBySlice requires even slice length, but got %v", len(v))
- return
- }
- ee.EncodeMapStart(len(v) / 2)
- for j, v2 := range v {
- if cr != nil {
- if j%2 == 0 {
- cr.sendContainerState(containerMapKey)
- } else {
- cr.sendContainerState(containerMapValue)
- }
- }
- ee.EncodeFloat32(v2)
- }
- if cr != nil {
- cr.sendContainerState(containerMapEnd)
- }
-}
-
-func (f *encFnInfo) fastpathEncSliceFloat64R(rv reflect.Value) {
- if f.ti.mbs {
- fastpathTV.EncAsMapSliceFloat64V(rv.Interface().([]float64), fastpathCheckNilFalse, f.e)
- } else {
- fastpathTV.EncSliceFloat64V(rv.Interface().([]float64), fastpathCheckNilFalse, f.e)
- }
-}
-func (_ fastpathT) EncSliceFloat64V(v []float64, checkNil bool, e *Encoder) {
- ee := e.e
- cr := e.cr
- if checkNil && v == nil {
- ee.EncodeNil()
- return
- }
- ee.EncodeArrayStart(len(v))
- for _, v2 := range v {
- if cr != nil {
- cr.sendContainerState(containerArrayElem)
- }
- ee.EncodeFloat64(v2)
- }
- if cr != nil {
- cr.sendContainerState(containerArrayEnd)
- }
-}
-
-func (_ fastpathT) EncAsMapSliceFloat64V(v []float64, checkNil bool, e *Encoder) {
- ee := e.e
- cr := e.cr
- if checkNil && v == nil {
- ee.EncodeNil()
- return
- }
- if len(v)%2 == 1 {
- e.errorf("mapBySlice requires even slice length, but got %v", len(v))
- return
- }
- ee.EncodeMapStart(len(v) / 2)
- for j, v2 := range v {
- if cr != nil {
- if j%2 == 0 {
- cr.sendContainerState(containerMapKey)
- } else {
- cr.sendContainerState(containerMapValue)
- }
- }
- ee.EncodeFloat64(v2)
- }
- if cr != nil {
- cr.sendContainerState(containerMapEnd)
- }
-}
-
-func (f *encFnInfo) fastpathEncSliceUintR(rv reflect.Value) {
- if f.ti.mbs {
- fastpathTV.EncAsMapSliceUintV(rv.Interface().([]uint), fastpathCheckNilFalse, f.e)
- } else {
- fastpathTV.EncSliceUintV(rv.Interface().([]uint), fastpathCheckNilFalse, f.e)
- }
-}
-func (_ fastpathT) EncSliceUintV(v []uint, checkNil bool, e *Encoder) {
- ee := e.e
- cr := e.cr
- if checkNil && v == nil {
- ee.EncodeNil()
- return
- }
- ee.EncodeArrayStart(len(v))
- for _, v2 := range v {
- if cr != nil {
- cr.sendContainerState(containerArrayElem)
- }
- ee.EncodeUint(uint64(v2))
- }
- if cr != nil {
- cr.sendContainerState(containerArrayEnd)
- }
-}
-
-func (_ fastpathT) EncAsMapSliceUintV(v []uint, checkNil bool, e *Encoder) {
- ee := e.e
- cr := e.cr
- if checkNil && v == nil {
- ee.EncodeNil()
- return
- }
- if len(v)%2 == 1 {
- e.errorf("mapBySlice requires even slice length, but got %v", len(v))
- return
- }
- ee.EncodeMapStart(len(v) / 2)
- for j, v2 := range v {
- if cr != nil {
- if j%2 == 0 {
- cr.sendContainerState(containerMapKey)
- } else {
- cr.sendContainerState(containerMapValue)
- }
- }
- ee.EncodeUint(uint64(v2))
- }
- if cr != nil {
- cr.sendContainerState(containerMapEnd)
- }
-}
-
-func (f *encFnInfo) fastpathEncSliceUint16R(rv reflect.Value) {
- if f.ti.mbs {
- fastpathTV.EncAsMapSliceUint16V(rv.Interface().([]uint16), fastpathCheckNilFalse, f.e)
- } else {
- fastpathTV.EncSliceUint16V(rv.Interface().([]uint16), fastpathCheckNilFalse, f.e)
- }
-}
-func (_ fastpathT) EncSliceUint16V(v []uint16, checkNil bool, e *Encoder) {
- ee := e.e
- cr := e.cr
- if checkNil && v == nil {
- ee.EncodeNil()
- return
- }
- ee.EncodeArrayStart(len(v))
- for _, v2 := range v {
- if cr != nil {
- cr.sendContainerState(containerArrayElem)
- }
- ee.EncodeUint(uint64(v2))
- }
- if cr != nil {
- cr.sendContainerState(containerArrayEnd)
- }
-}
-
-func (_ fastpathT) EncAsMapSliceUint16V(v []uint16, checkNil bool, e *Encoder) {
- ee := e.e
- cr := e.cr
- if checkNil && v == nil {
- ee.EncodeNil()
- return
- }
- if len(v)%2 == 1 {
- e.errorf("mapBySlice requires even slice length, but got %v", len(v))
- return
- }
- ee.EncodeMapStart(len(v) / 2)
- for j, v2 := range v {
- if cr != nil {
- if j%2 == 0 {
- cr.sendContainerState(containerMapKey)
- } else {
- cr.sendContainerState(containerMapValue)
- }
- }
- ee.EncodeUint(uint64(v2))
- }
- if cr != nil {
- cr.sendContainerState(containerMapEnd)
- }
-}
-
-func (f *encFnInfo) fastpathEncSliceUint32R(rv reflect.Value) {
- if f.ti.mbs {
- fastpathTV.EncAsMapSliceUint32V(rv.Interface().([]uint32), fastpathCheckNilFalse, f.e)
- } else {
- fastpathTV.EncSliceUint32V(rv.Interface().([]uint32), fastpathCheckNilFalse, f.e)
- }
-}
-func (_ fastpathT) EncSliceUint32V(v []uint32, checkNil bool, e *Encoder) {
- ee := e.e
- cr := e.cr
- if checkNil && v == nil {
- ee.EncodeNil()
- return
- }
- ee.EncodeArrayStart(len(v))
- for _, v2 := range v {
- if cr != nil {
- cr.sendContainerState(containerArrayElem)
- }
- ee.EncodeUint(uint64(v2))
- }
- if cr != nil {
- cr.sendContainerState(containerArrayEnd)
- }
-}
-
-func (_ fastpathT) EncAsMapSliceUint32V(v []uint32, checkNil bool, e *Encoder) {
- ee := e.e
- cr := e.cr
- if checkNil && v == nil {
- ee.EncodeNil()
- return
- }
- if len(v)%2 == 1 {
- e.errorf("mapBySlice requires even slice length, but got %v", len(v))
- return
- }
- ee.EncodeMapStart(len(v) / 2)
- for j, v2 := range v {
- if cr != nil {
- if j%2 == 0 {
- cr.sendContainerState(containerMapKey)
- } else {
- cr.sendContainerState(containerMapValue)
- }
- }
- ee.EncodeUint(uint64(v2))
- }
- if cr != nil {
- cr.sendContainerState(containerMapEnd)
- }
-}
-
-func (f *encFnInfo) fastpathEncSliceUint64R(rv reflect.Value) {
- if f.ti.mbs {
- fastpathTV.EncAsMapSliceUint64V(rv.Interface().([]uint64), fastpathCheckNilFalse, f.e)
- } else {
- fastpathTV.EncSliceUint64V(rv.Interface().([]uint64), fastpathCheckNilFalse, f.e)
- }
-}
-func (_ fastpathT) EncSliceUint64V(v []uint64, checkNil bool, e *Encoder) {
- ee := e.e
- cr := e.cr
- if checkNil && v == nil {
- ee.EncodeNil()
- return
- }
- ee.EncodeArrayStart(len(v))
- for _, v2 := range v {
- if cr != nil {
- cr.sendContainerState(containerArrayElem)
- }
- ee.EncodeUint(uint64(v2))
- }
- if cr != nil {
- cr.sendContainerState(containerArrayEnd)
- }
-}
-
-func (_ fastpathT) EncAsMapSliceUint64V(v []uint64, checkNil bool, e *Encoder) {
- ee := e.e
- cr := e.cr
- if checkNil && v == nil {
- ee.EncodeNil()
- return
- }
- if len(v)%2 == 1 {
- e.errorf("mapBySlice requires even slice length, but got %v", len(v))
- return
- }
- ee.EncodeMapStart(len(v) / 2)
- for j, v2 := range v {
- if cr != nil {
- if j%2 == 0 {
- cr.sendContainerState(containerMapKey)
- } else {
- cr.sendContainerState(containerMapValue)
- }
- }
- ee.EncodeUint(uint64(v2))
- }
- if cr != nil {
- cr.sendContainerState(containerMapEnd)
- }
-}
-
-func (f *encFnInfo) fastpathEncSliceUintptrR(rv reflect.Value) {
- if f.ti.mbs {
- fastpathTV.EncAsMapSliceUintptrV(rv.Interface().([]uintptr), fastpathCheckNilFalse, f.e)
- } else {
- fastpathTV.EncSliceUintptrV(rv.Interface().([]uintptr), fastpathCheckNilFalse, f.e)
- }
-}
-func (_ fastpathT) EncSliceUintptrV(v []uintptr, checkNil bool, e *Encoder) {
- ee := e.e
- cr := e.cr
- if checkNil && v == nil {
- ee.EncodeNil()
- return
- }
- ee.EncodeArrayStart(len(v))
- for _, v2 := range v {
- if cr != nil {
- cr.sendContainerState(containerArrayElem)
- }
- e.encode(v2)
- }
- if cr != nil {
- cr.sendContainerState(containerArrayEnd)
- }
-}
-
-func (_ fastpathT) EncAsMapSliceUintptrV(v []uintptr, checkNil bool, e *Encoder) {
- ee := e.e
- cr := e.cr
- if checkNil && v == nil {
- ee.EncodeNil()
- return
- }
- if len(v)%2 == 1 {
- e.errorf("mapBySlice requires even slice length, but got %v", len(v))
- return
- }
- ee.EncodeMapStart(len(v) / 2)
- for j, v2 := range v {
- if cr != nil {
- if j%2 == 0 {
- cr.sendContainerState(containerMapKey)
- } else {
- cr.sendContainerState(containerMapValue)
- }
- }
- e.encode(v2)
- }
- if cr != nil {
- cr.sendContainerState(containerMapEnd)
- }
-}
-
-func (f *encFnInfo) fastpathEncSliceIntR(rv reflect.Value) {
- if f.ti.mbs {
- fastpathTV.EncAsMapSliceIntV(rv.Interface().([]int), fastpathCheckNilFalse, f.e)
- } else {
- fastpathTV.EncSliceIntV(rv.Interface().([]int), fastpathCheckNilFalse, f.e)
- }
-}
-func (_ fastpathT) EncSliceIntV(v []int, checkNil bool, e *Encoder) {
- ee := e.e
- cr := e.cr
- if checkNil && v == nil {
- ee.EncodeNil()
- return
- }
- ee.EncodeArrayStart(len(v))
- for _, v2 := range v {
- if cr != nil {
- cr.sendContainerState(containerArrayElem)
- }
- ee.EncodeInt(int64(v2))
- }
- if cr != nil {
- cr.sendContainerState(containerArrayEnd)
- }
-}
-
-func (_ fastpathT) EncAsMapSliceIntV(v []int, checkNil bool, e *Encoder) {
- ee := e.e
- cr := e.cr
- if checkNil && v == nil {
- ee.EncodeNil()
- return
- }
- if len(v)%2 == 1 {
- e.errorf("mapBySlice requires even slice length, but got %v", len(v))
- return
- }
- ee.EncodeMapStart(len(v) / 2)
- for j, v2 := range v {
- if cr != nil {
- if j%2 == 0 {
- cr.sendContainerState(containerMapKey)
- } else {
- cr.sendContainerState(containerMapValue)
- }
- }
- ee.EncodeInt(int64(v2))
- }
- if cr != nil {
- cr.sendContainerState(containerMapEnd)
- }
-}
-
-func (f *encFnInfo) fastpathEncSliceInt8R(rv reflect.Value) {
- if f.ti.mbs {
- fastpathTV.EncAsMapSliceInt8V(rv.Interface().([]int8), fastpathCheckNilFalse, f.e)
- } else {
- fastpathTV.EncSliceInt8V(rv.Interface().([]int8), fastpathCheckNilFalse, f.e)
- }
-}
-func (_ fastpathT) EncSliceInt8V(v []int8, checkNil bool, e *Encoder) {
- ee := e.e
- cr := e.cr
- if checkNil && v == nil {
- ee.EncodeNil()
- return
- }
- ee.EncodeArrayStart(len(v))
- for _, v2 := range v {
- if cr != nil {
- cr.sendContainerState(containerArrayElem)
- }
- ee.EncodeInt(int64(v2))
- }
- if cr != nil {
- cr.sendContainerState(containerArrayEnd)
- }
-}
-
-func (_ fastpathT) EncAsMapSliceInt8V(v []int8, checkNil bool, e *Encoder) {
- ee := e.e
- cr := e.cr
- if checkNil && v == nil {
- ee.EncodeNil()
- return
- }
- if len(v)%2 == 1 {
- e.errorf("mapBySlice requires even slice length, but got %v", len(v))
- return
- }
- ee.EncodeMapStart(len(v) / 2)
- for j, v2 := range v {
- if cr != nil {
- if j%2 == 0 {
- cr.sendContainerState(containerMapKey)
- } else {
- cr.sendContainerState(containerMapValue)
- }
- }
- ee.EncodeInt(int64(v2))
- }
- if cr != nil {
- cr.sendContainerState(containerMapEnd)
- }
-}
-
-func (f *encFnInfo) fastpathEncSliceInt16R(rv reflect.Value) {
- if f.ti.mbs {
- fastpathTV.EncAsMapSliceInt16V(rv.Interface().([]int16), fastpathCheckNilFalse, f.e)
- } else {
- fastpathTV.EncSliceInt16V(rv.Interface().([]int16), fastpathCheckNilFalse, f.e)
- }
-}
-func (_ fastpathT) EncSliceInt16V(v []int16, checkNil bool, e *Encoder) {
- ee := e.e
- cr := e.cr
- if checkNil && v == nil {
- ee.EncodeNil()
- return
- }
- ee.EncodeArrayStart(len(v))
- for _, v2 := range v {
- if cr != nil {
- cr.sendContainerState(containerArrayElem)
- }
- ee.EncodeInt(int64(v2))
- }
- if cr != nil {
- cr.sendContainerState(containerArrayEnd)
- }
-}
-
-func (_ fastpathT) EncAsMapSliceInt16V(v []int16, checkNil bool, e *Encoder) {
- ee := e.e
- cr := e.cr
- if checkNil && v == nil {
- ee.EncodeNil()
- return
- }
- if len(v)%2 == 1 {
- e.errorf("mapBySlice requires even slice length, but got %v", len(v))
- return
- }
- ee.EncodeMapStart(len(v) / 2)
- for j, v2 := range v {
- if cr != nil {
- if j%2 == 0 {
- cr.sendContainerState(containerMapKey)
- } else {
- cr.sendContainerState(containerMapValue)
- }
- }
- ee.EncodeInt(int64(v2))
- }
- if cr != nil {
- cr.sendContainerState(containerMapEnd)
- }
-}
-
-func (f *encFnInfo) fastpathEncSliceInt32R(rv reflect.Value) {
- if f.ti.mbs {
- fastpathTV.EncAsMapSliceInt32V(rv.Interface().([]int32), fastpathCheckNilFalse, f.e)
- } else {
- fastpathTV.EncSliceInt32V(rv.Interface().([]int32), fastpathCheckNilFalse, f.e)
- }
-}
-func (_ fastpathT) EncSliceInt32V(v []int32, checkNil bool, e *Encoder) {
- ee := e.e
- cr := e.cr
- if checkNil && v == nil {
- ee.EncodeNil()
- return
- }
- ee.EncodeArrayStart(len(v))
- for _, v2 := range v {
- if cr != nil {
- cr.sendContainerState(containerArrayElem)
- }
- ee.EncodeInt(int64(v2))
- }
- if cr != nil {
- cr.sendContainerState(containerArrayEnd)
- }
-}
-
-func (_ fastpathT) EncAsMapSliceInt32V(v []int32, checkNil bool, e *Encoder) {
- ee := e.e
- cr := e.cr
- if checkNil && v == nil {
- ee.EncodeNil()
- return
- }
- if len(v)%2 == 1 {
- e.errorf("mapBySlice requires even slice length, but got %v", len(v))
- return
- }
- ee.EncodeMapStart(len(v) / 2)
- for j, v2 := range v {
- if cr != nil {
- if j%2 == 0 {
- cr.sendContainerState(containerMapKey)
- } else {
- cr.sendContainerState(containerMapValue)
- }
- }
- ee.EncodeInt(int64(v2))
- }
- if cr != nil {
- cr.sendContainerState(containerMapEnd)
- }
-}
-
-func (f *encFnInfo) fastpathEncSliceInt64R(rv reflect.Value) {
- if f.ti.mbs {
- fastpathTV.EncAsMapSliceInt64V(rv.Interface().([]int64), fastpathCheckNilFalse, f.e)
- } else {
- fastpathTV.EncSliceInt64V(rv.Interface().([]int64), fastpathCheckNilFalse, f.e)
- }
-}
-func (_ fastpathT) EncSliceInt64V(v []int64, checkNil bool, e *Encoder) {
- ee := e.e
- cr := e.cr
- if checkNil && v == nil {
- ee.EncodeNil()
- return
- }
- ee.EncodeArrayStart(len(v))
- for _, v2 := range v {
- if cr != nil {
- cr.sendContainerState(containerArrayElem)
- }
- ee.EncodeInt(int64(v2))
- }
- if cr != nil {
- cr.sendContainerState(containerArrayEnd)
- }
-}
-
-func (_ fastpathT) EncAsMapSliceInt64V(v []int64, checkNil bool, e *Encoder) {
- ee := e.e
- cr := e.cr
- if checkNil && v == nil {
- ee.EncodeNil()
- return
- }
- if len(v)%2 == 1 {
- e.errorf("mapBySlice requires even slice length, but got %v", len(v))
- return
- }
- ee.EncodeMapStart(len(v) / 2)
- for j, v2 := range v {
- if cr != nil {
- if j%2 == 0 {
- cr.sendContainerState(containerMapKey)
- } else {
- cr.sendContainerState(containerMapValue)
- }
- }
- ee.EncodeInt(int64(v2))
- }
- if cr != nil {
- cr.sendContainerState(containerMapEnd)
- }
-}
-
-func (f *encFnInfo) fastpathEncSliceBoolR(rv reflect.Value) {
- if f.ti.mbs {
- fastpathTV.EncAsMapSliceBoolV(rv.Interface().([]bool), fastpathCheckNilFalse, f.e)
- } else {
- fastpathTV.EncSliceBoolV(rv.Interface().([]bool), fastpathCheckNilFalse, f.e)
- }
-}
-func (_ fastpathT) EncSliceBoolV(v []bool, checkNil bool, e *Encoder) {
- ee := e.e
- cr := e.cr
- if checkNil && v == nil {
- ee.EncodeNil()
- return
- }
- ee.EncodeArrayStart(len(v))
- for _, v2 := range v {
- if cr != nil {
- cr.sendContainerState(containerArrayElem)
- }
- ee.EncodeBool(v2)
- }
- if cr != nil {
- cr.sendContainerState(containerArrayEnd)
- }
-}
-
-func (_ fastpathT) EncAsMapSliceBoolV(v []bool, checkNil bool, e *Encoder) {
- ee := e.e
- cr := e.cr
- if checkNil && v == nil {
- ee.EncodeNil()
- return
- }
- if len(v)%2 == 1 {
- e.errorf("mapBySlice requires even slice length, but got %v", len(v))
- return
- }
- ee.EncodeMapStart(len(v) / 2)
- for j, v2 := range v {
- if cr != nil {
- if j%2 == 0 {
- cr.sendContainerState(containerMapKey)
- } else {
- cr.sendContainerState(containerMapValue)
- }
- }
- ee.EncodeBool(v2)
- }
- if cr != nil {
- cr.sendContainerState(containerMapEnd)
- }
-}
-
-func (f *encFnInfo) fastpathEncMapIntfIntfR(rv reflect.Value) {
- fastpathTV.EncMapIntfIntfV(rv.Interface().(map[interface{}]interface{}), fastpathCheckNilFalse, f.e)
-}
-func (_ fastpathT) EncMapIntfIntfV(v map[interface{}]interface{}, checkNil bool, e *Encoder) {
- ee := e.e
- cr := e.cr
- if checkNil && v == nil {
- ee.EncodeNil()
- return
- }
- ee.EncodeMapStart(len(v))
- if e.h.Canonical {
- var mksv []byte = make([]byte, 0, len(v)*16) // temporary byte slice for the encoding
- e2 := NewEncoderBytes(&mksv, e.hh)
- v2 := make([]bytesI, len(v))
- var i, l int
- var vp *bytesI
- for k2 := range v {
- l = len(mksv)
- e2.MustEncode(k2)
- vp = &v2[i]
- vp.v = mksv[l:]
- vp.i = k2
- i++
- }
- sort.Sort(bytesISlice(v2))
- for j := range v2 {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- e.asis(v2[j].v)
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- e.encode(v[v2[j].i])
- }
- } else {
- for k2, v2 := range v {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- e.encode(k2)
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- e.encode(v2)
- }
- }
- if cr != nil {
- cr.sendContainerState(containerMapEnd)
- }
-}
-
-func (f *encFnInfo) fastpathEncMapIntfStringR(rv reflect.Value) {
- fastpathTV.EncMapIntfStringV(rv.Interface().(map[interface{}]string), fastpathCheckNilFalse, f.e)
-}
-func (_ fastpathT) EncMapIntfStringV(v map[interface{}]string, checkNil bool, e *Encoder) {
- ee := e.e
- cr := e.cr
- if checkNil && v == nil {
- ee.EncodeNil()
- return
- }
- ee.EncodeMapStart(len(v))
- if e.h.Canonical {
- var mksv []byte = make([]byte, 0, len(v)*16) // temporary byte slice for the encoding
- e2 := NewEncoderBytes(&mksv, e.hh)
- v2 := make([]bytesI, len(v))
- var i, l int
- var vp *bytesI
- for k2 := range v {
- l = len(mksv)
- e2.MustEncode(k2)
- vp = &v2[i]
- vp.v = mksv[l:]
- vp.i = k2
- i++
- }
- sort.Sort(bytesISlice(v2))
- for j := range v2 {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- e.asis(v2[j].v)
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- e.encode(v[v2[j].i])
- }
- } else {
- for k2, v2 := range v {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- e.encode(k2)
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- ee.EncodeString(c_UTF8, v2)
- }
- }
- if cr != nil {
- cr.sendContainerState(containerMapEnd)
- }
-}
-
-func (f *encFnInfo) fastpathEncMapIntfUintR(rv reflect.Value) {
- fastpathTV.EncMapIntfUintV(rv.Interface().(map[interface{}]uint), fastpathCheckNilFalse, f.e)
-}
-func (_ fastpathT) EncMapIntfUintV(v map[interface{}]uint, checkNil bool, e *Encoder) {
- ee := e.e
- cr := e.cr
- if checkNil && v == nil {
- ee.EncodeNil()
- return
- }
- ee.EncodeMapStart(len(v))
- if e.h.Canonical {
- var mksv []byte = make([]byte, 0, len(v)*16) // temporary byte slice for the encoding
- e2 := NewEncoderBytes(&mksv, e.hh)
- v2 := make([]bytesI, len(v))
- var i, l int
- var vp *bytesI
- for k2 := range v {
- l = len(mksv)
- e2.MustEncode(k2)
- vp = &v2[i]
- vp.v = mksv[l:]
- vp.i = k2
- i++
- }
- sort.Sort(bytesISlice(v2))
- for j := range v2 {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- e.asis(v2[j].v)
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- e.encode(v[v2[j].i])
- }
- } else {
- for k2, v2 := range v {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- e.encode(k2)
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- ee.EncodeUint(uint64(v2))
- }
- }
- if cr != nil {
- cr.sendContainerState(containerMapEnd)
- }
-}
-
-func (f *encFnInfo) fastpathEncMapIntfUint8R(rv reflect.Value) {
- fastpathTV.EncMapIntfUint8V(rv.Interface().(map[interface{}]uint8), fastpathCheckNilFalse, f.e)
-}
-func (_ fastpathT) EncMapIntfUint8V(v map[interface{}]uint8, checkNil bool, e *Encoder) {
- ee := e.e
- cr := e.cr
- if checkNil && v == nil {
- ee.EncodeNil()
- return
- }
- ee.EncodeMapStart(len(v))
- if e.h.Canonical {
- var mksv []byte = make([]byte, 0, len(v)*16) // temporary byte slice for the encoding
- e2 := NewEncoderBytes(&mksv, e.hh)
- v2 := make([]bytesI, len(v))
- var i, l int
- var vp *bytesI
- for k2 := range v {
- l = len(mksv)
- e2.MustEncode(k2)
- vp = &v2[i]
- vp.v = mksv[l:]
- vp.i = k2
- i++
- }
- sort.Sort(bytesISlice(v2))
- for j := range v2 {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- e.asis(v2[j].v)
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- e.encode(v[v2[j].i])
- }
- } else {
- for k2, v2 := range v {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- e.encode(k2)
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- ee.EncodeUint(uint64(v2))
- }
- }
- if cr != nil {
- cr.sendContainerState(containerMapEnd)
- }
-}
-
-func (f *encFnInfo) fastpathEncMapIntfUint16R(rv reflect.Value) {
- fastpathTV.EncMapIntfUint16V(rv.Interface().(map[interface{}]uint16), fastpathCheckNilFalse, f.e)
-}
-func (_ fastpathT) EncMapIntfUint16V(v map[interface{}]uint16, checkNil bool, e *Encoder) {
- ee := e.e
- cr := e.cr
- if checkNil && v == nil {
- ee.EncodeNil()
- return
- }
- ee.EncodeMapStart(len(v))
- if e.h.Canonical {
- var mksv []byte = make([]byte, 0, len(v)*16) // temporary byte slice for the encoding
- e2 := NewEncoderBytes(&mksv, e.hh)
- v2 := make([]bytesI, len(v))
- var i, l int
- var vp *bytesI
- for k2 := range v {
- l = len(mksv)
- e2.MustEncode(k2)
- vp = &v2[i]
- vp.v = mksv[l:]
- vp.i = k2
- i++
- }
- sort.Sort(bytesISlice(v2))
- for j := range v2 {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- e.asis(v2[j].v)
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- e.encode(v[v2[j].i])
- }
- } else {
- for k2, v2 := range v {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- e.encode(k2)
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- ee.EncodeUint(uint64(v2))
- }
- }
- if cr != nil {
- cr.sendContainerState(containerMapEnd)
- }
-}
-
-func (f *encFnInfo) fastpathEncMapIntfUint32R(rv reflect.Value) {
- fastpathTV.EncMapIntfUint32V(rv.Interface().(map[interface{}]uint32), fastpathCheckNilFalse, f.e)
-}
-func (_ fastpathT) EncMapIntfUint32V(v map[interface{}]uint32, checkNil bool, e *Encoder) {
- ee := e.e
- cr := e.cr
- if checkNil && v == nil {
- ee.EncodeNil()
- return
- }
- ee.EncodeMapStart(len(v))
- if e.h.Canonical {
- var mksv []byte = make([]byte, 0, len(v)*16) // temporary byte slice for the encoding
- e2 := NewEncoderBytes(&mksv, e.hh)
- v2 := make([]bytesI, len(v))
- var i, l int
- var vp *bytesI
- for k2 := range v {
- l = len(mksv)
- e2.MustEncode(k2)
- vp = &v2[i]
- vp.v = mksv[l:]
- vp.i = k2
- i++
- }
- sort.Sort(bytesISlice(v2))
- for j := range v2 {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- e.asis(v2[j].v)
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- e.encode(v[v2[j].i])
- }
- } else {
- for k2, v2 := range v {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- e.encode(k2)
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- ee.EncodeUint(uint64(v2))
- }
- }
- if cr != nil {
- cr.sendContainerState(containerMapEnd)
- }
-}
-
-func (f *encFnInfo) fastpathEncMapIntfUint64R(rv reflect.Value) {
- fastpathTV.EncMapIntfUint64V(rv.Interface().(map[interface{}]uint64), fastpathCheckNilFalse, f.e)
-}
-func (_ fastpathT) EncMapIntfUint64V(v map[interface{}]uint64, checkNil bool, e *Encoder) {
- ee := e.e
- cr := e.cr
- if checkNil && v == nil {
- ee.EncodeNil()
- return
- }
- ee.EncodeMapStart(len(v))
- if e.h.Canonical {
- var mksv []byte = make([]byte, 0, len(v)*16) // temporary byte slice for the encoding
- e2 := NewEncoderBytes(&mksv, e.hh)
- v2 := make([]bytesI, len(v))
- var i, l int
- var vp *bytesI
- for k2 := range v {
- l = len(mksv)
- e2.MustEncode(k2)
- vp = &v2[i]
- vp.v = mksv[l:]
- vp.i = k2
- i++
- }
- sort.Sort(bytesISlice(v2))
- for j := range v2 {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- e.asis(v2[j].v)
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- e.encode(v[v2[j].i])
- }
- } else {
- for k2, v2 := range v {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- e.encode(k2)
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- ee.EncodeUint(uint64(v2))
- }
- }
- if cr != nil {
- cr.sendContainerState(containerMapEnd)
- }
-}
-
-func (f *encFnInfo) fastpathEncMapIntfUintptrR(rv reflect.Value) {
- fastpathTV.EncMapIntfUintptrV(rv.Interface().(map[interface{}]uintptr), fastpathCheckNilFalse, f.e)
-}
-func (_ fastpathT) EncMapIntfUintptrV(v map[interface{}]uintptr, checkNil bool, e *Encoder) {
- ee := e.e
- cr := e.cr
- if checkNil && v == nil {
- ee.EncodeNil()
- return
- }
- ee.EncodeMapStart(len(v))
- if e.h.Canonical {
- var mksv []byte = make([]byte, 0, len(v)*16) // temporary byte slice for the encoding
- e2 := NewEncoderBytes(&mksv, e.hh)
- v2 := make([]bytesI, len(v))
- var i, l int
- var vp *bytesI
- for k2 := range v {
- l = len(mksv)
- e2.MustEncode(k2)
- vp = &v2[i]
- vp.v = mksv[l:]
- vp.i = k2
- i++
- }
- sort.Sort(bytesISlice(v2))
- for j := range v2 {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- e.asis(v2[j].v)
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- e.encode(v[v2[j].i])
- }
- } else {
- for k2, v2 := range v {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- e.encode(k2)
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- e.encode(v2)
- }
- }
- if cr != nil {
- cr.sendContainerState(containerMapEnd)
- }
-}
-
-func (f *encFnInfo) fastpathEncMapIntfIntR(rv reflect.Value) {
- fastpathTV.EncMapIntfIntV(rv.Interface().(map[interface{}]int), fastpathCheckNilFalse, f.e)
-}
-func (_ fastpathT) EncMapIntfIntV(v map[interface{}]int, checkNil bool, e *Encoder) {
- ee := e.e
- cr := e.cr
- if checkNil && v == nil {
- ee.EncodeNil()
- return
- }
- ee.EncodeMapStart(len(v))
- if e.h.Canonical {
- var mksv []byte = make([]byte, 0, len(v)*16) // temporary byte slice for the encoding
- e2 := NewEncoderBytes(&mksv, e.hh)
- v2 := make([]bytesI, len(v))
- var i, l int
- var vp *bytesI
- for k2 := range v {
- l = len(mksv)
- e2.MustEncode(k2)
- vp = &v2[i]
- vp.v = mksv[l:]
- vp.i = k2
- i++
- }
- sort.Sort(bytesISlice(v2))
- for j := range v2 {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- e.asis(v2[j].v)
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- e.encode(v[v2[j].i])
- }
- } else {
- for k2, v2 := range v {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- e.encode(k2)
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- ee.EncodeInt(int64(v2))
- }
- }
- if cr != nil {
- cr.sendContainerState(containerMapEnd)
- }
-}
-
-func (f *encFnInfo) fastpathEncMapIntfInt8R(rv reflect.Value) {
- fastpathTV.EncMapIntfInt8V(rv.Interface().(map[interface{}]int8), fastpathCheckNilFalse, f.e)
-}
-func (_ fastpathT) EncMapIntfInt8V(v map[interface{}]int8, checkNil bool, e *Encoder) {
- ee := e.e
- cr := e.cr
- if checkNil && v == nil {
- ee.EncodeNil()
- return
- }
- ee.EncodeMapStart(len(v))
- if e.h.Canonical {
- var mksv []byte = make([]byte, 0, len(v)*16) // temporary byte slice for the encoding
- e2 := NewEncoderBytes(&mksv, e.hh)
- v2 := make([]bytesI, len(v))
- var i, l int
- var vp *bytesI
- for k2 := range v {
- l = len(mksv)
- e2.MustEncode(k2)
- vp = &v2[i]
- vp.v = mksv[l:]
- vp.i = k2
- i++
- }
- sort.Sort(bytesISlice(v2))
- for j := range v2 {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- e.asis(v2[j].v)
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- e.encode(v[v2[j].i])
- }
- } else {
- for k2, v2 := range v {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- e.encode(k2)
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- ee.EncodeInt(int64(v2))
- }
- }
- if cr != nil {
- cr.sendContainerState(containerMapEnd)
- }
-}
-
-func (f *encFnInfo) fastpathEncMapIntfInt16R(rv reflect.Value) {
- fastpathTV.EncMapIntfInt16V(rv.Interface().(map[interface{}]int16), fastpathCheckNilFalse, f.e)
-}
-func (_ fastpathT) EncMapIntfInt16V(v map[interface{}]int16, checkNil bool, e *Encoder) {
- ee := e.e
- cr := e.cr
- if checkNil && v == nil {
- ee.EncodeNil()
- return
- }
- ee.EncodeMapStart(len(v))
- if e.h.Canonical {
- var mksv []byte = make([]byte, 0, len(v)*16) // temporary byte slice for the encoding
- e2 := NewEncoderBytes(&mksv, e.hh)
- v2 := make([]bytesI, len(v))
- var i, l int
- var vp *bytesI
- for k2 := range v {
- l = len(mksv)
- e2.MustEncode(k2)
- vp = &v2[i]
- vp.v = mksv[l:]
- vp.i = k2
- i++
- }
- sort.Sort(bytesISlice(v2))
- for j := range v2 {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- e.asis(v2[j].v)
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- e.encode(v[v2[j].i])
- }
- } else {
- for k2, v2 := range v {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- e.encode(k2)
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- ee.EncodeInt(int64(v2))
- }
- }
- if cr != nil {
- cr.sendContainerState(containerMapEnd)
- }
-}
-
-func (f *encFnInfo) fastpathEncMapIntfInt32R(rv reflect.Value) {
- fastpathTV.EncMapIntfInt32V(rv.Interface().(map[interface{}]int32), fastpathCheckNilFalse, f.e)
-}
-func (_ fastpathT) EncMapIntfInt32V(v map[interface{}]int32, checkNil bool, e *Encoder) {
- ee := e.e
- cr := e.cr
- if checkNil && v == nil {
- ee.EncodeNil()
- return
- }
- ee.EncodeMapStart(len(v))
- if e.h.Canonical {
- var mksv []byte = make([]byte, 0, len(v)*16) // temporary byte slice for the encoding
- e2 := NewEncoderBytes(&mksv, e.hh)
- v2 := make([]bytesI, len(v))
- var i, l int
- var vp *bytesI
- for k2 := range v {
- l = len(mksv)
- e2.MustEncode(k2)
- vp = &v2[i]
- vp.v = mksv[l:]
- vp.i = k2
- i++
- }
- sort.Sort(bytesISlice(v2))
- for j := range v2 {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- e.asis(v2[j].v)
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- e.encode(v[v2[j].i])
- }
- } else {
- for k2, v2 := range v {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- e.encode(k2)
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- ee.EncodeInt(int64(v2))
- }
- }
- if cr != nil {
- cr.sendContainerState(containerMapEnd)
- }
-}
-
-func (f *encFnInfo) fastpathEncMapIntfInt64R(rv reflect.Value) {
- fastpathTV.EncMapIntfInt64V(rv.Interface().(map[interface{}]int64), fastpathCheckNilFalse, f.e)
-}
-func (_ fastpathT) EncMapIntfInt64V(v map[interface{}]int64, checkNil bool, e *Encoder) {
- ee := e.e
- cr := e.cr
- if checkNil && v == nil {
- ee.EncodeNil()
- return
- }
- ee.EncodeMapStart(len(v))
- if e.h.Canonical {
- var mksv []byte = make([]byte, 0, len(v)*16) // temporary byte slice for the encoding
- e2 := NewEncoderBytes(&mksv, e.hh)
- v2 := make([]bytesI, len(v))
- var i, l int
- var vp *bytesI
- for k2 := range v {
- l = len(mksv)
- e2.MustEncode(k2)
- vp = &v2[i]
- vp.v = mksv[l:]
- vp.i = k2
- i++
- }
- sort.Sort(bytesISlice(v2))
- for j := range v2 {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- e.asis(v2[j].v)
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- e.encode(v[v2[j].i])
- }
- } else {
- for k2, v2 := range v {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- e.encode(k2)
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- ee.EncodeInt(int64(v2))
- }
- }
- if cr != nil {
- cr.sendContainerState(containerMapEnd)
- }
-}
-
-func (f *encFnInfo) fastpathEncMapIntfFloat32R(rv reflect.Value) {
- fastpathTV.EncMapIntfFloat32V(rv.Interface().(map[interface{}]float32), fastpathCheckNilFalse, f.e)
-}
-func (_ fastpathT) EncMapIntfFloat32V(v map[interface{}]float32, checkNil bool, e *Encoder) {
- ee := e.e
- cr := e.cr
- if checkNil && v == nil {
- ee.EncodeNil()
- return
- }
- ee.EncodeMapStart(len(v))
- if e.h.Canonical {
- var mksv []byte = make([]byte, 0, len(v)*16) // temporary byte slice for the encoding
- e2 := NewEncoderBytes(&mksv, e.hh)
- v2 := make([]bytesI, len(v))
- var i, l int
- var vp *bytesI
- for k2 := range v {
- l = len(mksv)
- e2.MustEncode(k2)
- vp = &v2[i]
- vp.v = mksv[l:]
- vp.i = k2
- i++
- }
- sort.Sort(bytesISlice(v2))
- for j := range v2 {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- e.asis(v2[j].v)
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- e.encode(v[v2[j].i])
- }
- } else {
- for k2, v2 := range v {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- e.encode(k2)
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- ee.EncodeFloat32(v2)
- }
- }
- if cr != nil {
- cr.sendContainerState(containerMapEnd)
- }
-}
-
-func (f *encFnInfo) fastpathEncMapIntfFloat64R(rv reflect.Value) {
- fastpathTV.EncMapIntfFloat64V(rv.Interface().(map[interface{}]float64), fastpathCheckNilFalse, f.e)
-}
-func (_ fastpathT) EncMapIntfFloat64V(v map[interface{}]float64, checkNil bool, e *Encoder) {
- ee := e.e
- cr := e.cr
- if checkNil && v == nil {
- ee.EncodeNil()
- return
- }
- ee.EncodeMapStart(len(v))
- if e.h.Canonical {
- var mksv []byte = make([]byte, 0, len(v)*16) // temporary byte slice for the encoding
- e2 := NewEncoderBytes(&mksv, e.hh)
- v2 := make([]bytesI, len(v))
- var i, l int
- var vp *bytesI
- for k2 := range v {
- l = len(mksv)
- e2.MustEncode(k2)
- vp = &v2[i]
- vp.v = mksv[l:]
- vp.i = k2
- i++
- }
- sort.Sort(bytesISlice(v2))
- for j := range v2 {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- e.asis(v2[j].v)
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- e.encode(v[v2[j].i])
- }
- } else {
- for k2, v2 := range v {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- e.encode(k2)
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- ee.EncodeFloat64(v2)
- }
- }
- if cr != nil {
- cr.sendContainerState(containerMapEnd)
- }
-}
-
-func (f *encFnInfo) fastpathEncMapIntfBoolR(rv reflect.Value) {
- fastpathTV.EncMapIntfBoolV(rv.Interface().(map[interface{}]bool), fastpathCheckNilFalse, f.e)
-}
-func (_ fastpathT) EncMapIntfBoolV(v map[interface{}]bool, checkNil bool, e *Encoder) {
- ee := e.e
- cr := e.cr
- if checkNil && v == nil {
- ee.EncodeNil()
- return
- }
- ee.EncodeMapStart(len(v))
- if e.h.Canonical {
- var mksv []byte = make([]byte, 0, len(v)*16) // temporary byte slice for the encoding
- e2 := NewEncoderBytes(&mksv, e.hh)
- v2 := make([]bytesI, len(v))
- var i, l int
- var vp *bytesI
- for k2 := range v {
- l = len(mksv)
- e2.MustEncode(k2)
- vp = &v2[i]
- vp.v = mksv[l:]
- vp.i = k2
- i++
- }
- sort.Sort(bytesISlice(v2))
- for j := range v2 {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- e.asis(v2[j].v)
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- e.encode(v[v2[j].i])
- }
- } else {
- for k2, v2 := range v {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- e.encode(k2)
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- ee.EncodeBool(v2)
- }
- }
- if cr != nil {
- cr.sendContainerState(containerMapEnd)
- }
-}
-
-func (f *encFnInfo) fastpathEncMapStringIntfR(rv reflect.Value) {
- fastpathTV.EncMapStringIntfV(rv.Interface().(map[string]interface{}), fastpathCheckNilFalse, f.e)
-}
-func (_ fastpathT) EncMapStringIntfV(v map[string]interface{}, checkNil bool, e *Encoder) {
- ee := e.e
- cr := e.cr
- if checkNil && v == nil {
- ee.EncodeNil()
- return
- }
- ee.EncodeMapStart(len(v))
- asSymbols := e.h.AsSymbols&AsSymbolMapStringKeysFlag != 0
- if e.h.Canonical {
- v2 := make([]string, len(v))
- var i int
- for k := range v {
- v2[i] = string(k)
- i++
- }
- sort.Sort(stringSlice(v2))
- for _, k2 := range v2 {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- if asSymbols {
- ee.EncodeSymbol(k2)
- } else {
- ee.EncodeString(c_UTF8, k2)
- }
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- e.encode(v[string(k2)])
- }
- } else {
- for k2, v2 := range v {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- if asSymbols {
- ee.EncodeSymbol(k2)
- } else {
- ee.EncodeString(c_UTF8, k2)
- }
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- e.encode(v2)
- }
- }
- if cr != nil {
- cr.sendContainerState(containerMapEnd)
- }
-}
-
-func (f *encFnInfo) fastpathEncMapStringStringR(rv reflect.Value) {
- fastpathTV.EncMapStringStringV(rv.Interface().(map[string]string), fastpathCheckNilFalse, f.e)
-}
-func (_ fastpathT) EncMapStringStringV(v map[string]string, checkNil bool, e *Encoder) {
- ee := e.e
- cr := e.cr
- if checkNil && v == nil {
- ee.EncodeNil()
- return
- }
- ee.EncodeMapStart(len(v))
- asSymbols := e.h.AsSymbols&AsSymbolMapStringKeysFlag != 0
- if e.h.Canonical {
- v2 := make([]string, len(v))
- var i int
- for k := range v {
- v2[i] = string(k)
- i++
- }
- sort.Sort(stringSlice(v2))
- for _, k2 := range v2 {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- if asSymbols {
- ee.EncodeSymbol(k2)
- } else {
- ee.EncodeString(c_UTF8, k2)
- }
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- ee.EncodeString(c_UTF8, v[string(k2)])
- }
- } else {
- for k2, v2 := range v {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- if asSymbols {
- ee.EncodeSymbol(k2)
- } else {
- ee.EncodeString(c_UTF8, k2)
- }
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- ee.EncodeString(c_UTF8, v2)
- }
- }
- if cr != nil {
- cr.sendContainerState(containerMapEnd)
- }
-}
-
-func (f *encFnInfo) fastpathEncMapStringUintR(rv reflect.Value) {
- fastpathTV.EncMapStringUintV(rv.Interface().(map[string]uint), fastpathCheckNilFalse, f.e)
-}
-func (_ fastpathT) EncMapStringUintV(v map[string]uint, checkNil bool, e *Encoder) {
- ee := e.e
- cr := e.cr
- if checkNil && v == nil {
- ee.EncodeNil()
- return
- }
- ee.EncodeMapStart(len(v))
- asSymbols := e.h.AsSymbols&AsSymbolMapStringKeysFlag != 0
- if e.h.Canonical {
- v2 := make([]string, len(v))
- var i int
- for k := range v {
- v2[i] = string(k)
- i++
- }
- sort.Sort(stringSlice(v2))
- for _, k2 := range v2 {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- if asSymbols {
- ee.EncodeSymbol(k2)
- } else {
- ee.EncodeString(c_UTF8, k2)
- }
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- ee.EncodeUint(uint64(v[string(k2)]))
- }
- } else {
- for k2, v2 := range v {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- if asSymbols {
- ee.EncodeSymbol(k2)
- } else {
- ee.EncodeString(c_UTF8, k2)
- }
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- ee.EncodeUint(uint64(v2))
- }
- }
- if cr != nil {
- cr.sendContainerState(containerMapEnd)
- }
-}
-
-func (f *encFnInfo) fastpathEncMapStringUint8R(rv reflect.Value) {
- fastpathTV.EncMapStringUint8V(rv.Interface().(map[string]uint8), fastpathCheckNilFalse, f.e)
-}
-func (_ fastpathT) EncMapStringUint8V(v map[string]uint8, checkNil bool, e *Encoder) {
- ee := e.e
- cr := e.cr
- if checkNil && v == nil {
- ee.EncodeNil()
- return
- }
- ee.EncodeMapStart(len(v))
- asSymbols := e.h.AsSymbols&AsSymbolMapStringKeysFlag != 0
- if e.h.Canonical {
- v2 := make([]string, len(v))
- var i int
- for k := range v {
- v2[i] = string(k)
- i++
- }
- sort.Sort(stringSlice(v2))
- for _, k2 := range v2 {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- if asSymbols {
- ee.EncodeSymbol(k2)
- } else {
- ee.EncodeString(c_UTF8, k2)
- }
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- ee.EncodeUint(uint64(v[string(k2)]))
- }
- } else {
- for k2, v2 := range v {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- if asSymbols {
- ee.EncodeSymbol(k2)
- } else {
- ee.EncodeString(c_UTF8, k2)
- }
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- ee.EncodeUint(uint64(v2))
- }
- }
- if cr != nil {
- cr.sendContainerState(containerMapEnd)
- }
-}
-
-func (f *encFnInfo) fastpathEncMapStringUint16R(rv reflect.Value) {
- fastpathTV.EncMapStringUint16V(rv.Interface().(map[string]uint16), fastpathCheckNilFalse, f.e)
-}
-func (_ fastpathT) EncMapStringUint16V(v map[string]uint16, checkNil bool, e *Encoder) {
- ee := e.e
- cr := e.cr
- if checkNil && v == nil {
- ee.EncodeNil()
- return
- }
- ee.EncodeMapStart(len(v))
- asSymbols := e.h.AsSymbols&AsSymbolMapStringKeysFlag != 0
- if e.h.Canonical {
- v2 := make([]string, len(v))
- var i int
- for k := range v {
- v2[i] = string(k)
- i++
- }
- sort.Sort(stringSlice(v2))
- for _, k2 := range v2 {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- if asSymbols {
- ee.EncodeSymbol(k2)
- } else {
- ee.EncodeString(c_UTF8, k2)
- }
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- ee.EncodeUint(uint64(v[string(k2)]))
- }
- } else {
- for k2, v2 := range v {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- if asSymbols {
- ee.EncodeSymbol(k2)
- } else {
- ee.EncodeString(c_UTF8, k2)
- }
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- ee.EncodeUint(uint64(v2))
- }
- }
- if cr != nil {
- cr.sendContainerState(containerMapEnd)
- }
-}
-
-func (f *encFnInfo) fastpathEncMapStringUint32R(rv reflect.Value) {
- fastpathTV.EncMapStringUint32V(rv.Interface().(map[string]uint32), fastpathCheckNilFalse, f.e)
-}
-func (_ fastpathT) EncMapStringUint32V(v map[string]uint32, checkNil bool, e *Encoder) {
- ee := e.e
- cr := e.cr
- if checkNil && v == nil {
- ee.EncodeNil()
- return
- }
- ee.EncodeMapStart(len(v))
- asSymbols := e.h.AsSymbols&AsSymbolMapStringKeysFlag != 0
- if e.h.Canonical {
- v2 := make([]string, len(v))
- var i int
- for k := range v {
- v2[i] = string(k)
- i++
- }
- sort.Sort(stringSlice(v2))
- for _, k2 := range v2 {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- if asSymbols {
- ee.EncodeSymbol(k2)
- } else {
- ee.EncodeString(c_UTF8, k2)
- }
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- ee.EncodeUint(uint64(v[string(k2)]))
- }
- } else {
- for k2, v2 := range v {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- if asSymbols {
- ee.EncodeSymbol(k2)
- } else {
- ee.EncodeString(c_UTF8, k2)
- }
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- ee.EncodeUint(uint64(v2))
- }
- }
- if cr != nil {
- cr.sendContainerState(containerMapEnd)
- }
-}
-
-func (f *encFnInfo) fastpathEncMapStringUint64R(rv reflect.Value) {
- fastpathTV.EncMapStringUint64V(rv.Interface().(map[string]uint64), fastpathCheckNilFalse, f.e)
-}
-func (_ fastpathT) EncMapStringUint64V(v map[string]uint64, checkNil bool, e *Encoder) {
- ee := e.e
- cr := e.cr
- if checkNil && v == nil {
- ee.EncodeNil()
- return
- }
- ee.EncodeMapStart(len(v))
- asSymbols := e.h.AsSymbols&AsSymbolMapStringKeysFlag != 0
- if e.h.Canonical {
- v2 := make([]string, len(v))
- var i int
- for k := range v {
- v2[i] = string(k)
- i++
- }
- sort.Sort(stringSlice(v2))
- for _, k2 := range v2 {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- if asSymbols {
- ee.EncodeSymbol(k2)
- } else {
- ee.EncodeString(c_UTF8, k2)
- }
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- ee.EncodeUint(uint64(v[string(k2)]))
- }
- } else {
- for k2, v2 := range v {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- if asSymbols {
- ee.EncodeSymbol(k2)
- } else {
- ee.EncodeString(c_UTF8, k2)
- }
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- ee.EncodeUint(uint64(v2))
- }
- }
- if cr != nil {
- cr.sendContainerState(containerMapEnd)
- }
-}
-
-func (f *encFnInfo) fastpathEncMapStringUintptrR(rv reflect.Value) {
- fastpathTV.EncMapStringUintptrV(rv.Interface().(map[string]uintptr), fastpathCheckNilFalse, f.e)
-}
-func (_ fastpathT) EncMapStringUintptrV(v map[string]uintptr, checkNil bool, e *Encoder) {
- ee := e.e
- cr := e.cr
- if checkNil && v == nil {
- ee.EncodeNil()
- return
- }
- ee.EncodeMapStart(len(v))
- asSymbols := e.h.AsSymbols&AsSymbolMapStringKeysFlag != 0
- if e.h.Canonical {
- v2 := make([]string, len(v))
- var i int
- for k := range v {
- v2[i] = string(k)
- i++
- }
- sort.Sort(stringSlice(v2))
- for _, k2 := range v2 {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- if asSymbols {
- ee.EncodeSymbol(k2)
- } else {
- ee.EncodeString(c_UTF8, k2)
- }
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- e.encode(v[string(k2)])
- }
- } else {
- for k2, v2 := range v {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- if asSymbols {
- ee.EncodeSymbol(k2)
- } else {
- ee.EncodeString(c_UTF8, k2)
- }
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- e.encode(v2)
- }
- }
- if cr != nil {
- cr.sendContainerState(containerMapEnd)
- }
-}
-
-func (f *encFnInfo) fastpathEncMapStringIntR(rv reflect.Value) {
- fastpathTV.EncMapStringIntV(rv.Interface().(map[string]int), fastpathCheckNilFalse, f.e)
-}
-func (_ fastpathT) EncMapStringIntV(v map[string]int, checkNil bool, e *Encoder) {
- ee := e.e
- cr := e.cr
- if checkNil && v == nil {
- ee.EncodeNil()
- return
- }
- ee.EncodeMapStart(len(v))
- asSymbols := e.h.AsSymbols&AsSymbolMapStringKeysFlag != 0
- if e.h.Canonical {
- v2 := make([]string, len(v))
- var i int
- for k := range v {
- v2[i] = string(k)
- i++
- }
- sort.Sort(stringSlice(v2))
- for _, k2 := range v2 {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- if asSymbols {
- ee.EncodeSymbol(k2)
- } else {
- ee.EncodeString(c_UTF8, k2)
- }
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- ee.EncodeInt(int64(v[string(k2)]))
- }
- } else {
- for k2, v2 := range v {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- if asSymbols {
- ee.EncodeSymbol(k2)
- } else {
- ee.EncodeString(c_UTF8, k2)
- }
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- ee.EncodeInt(int64(v2))
- }
- }
- if cr != nil {
- cr.sendContainerState(containerMapEnd)
- }
-}
-
-func (f *encFnInfo) fastpathEncMapStringInt8R(rv reflect.Value) {
- fastpathTV.EncMapStringInt8V(rv.Interface().(map[string]int8), fastpathCheckNilFalse, f.e)
-}
-func (_ fastpathT) EncMapStringInt8V(v map[string]int8, checkNil bool, e *Encoder) {
- ee := e.e
- cr := e.cr
- if checkNil && v == nil {
- ee.EncodeNil()
- return
- }
- ee.EncodeMapStart(len(v))
- asSymbols := e.h.AsSymbols&AsSymbolMapStringKeysFlag != 0
- if e.h.Canonical {
- v2 := make([]string, len(v))
- var i int
- for k := range v {
- v2[i] = string(k)
- i++
- }
- sort.Sort(stringSlice(v2))
- for _, k2 := range v2 {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- if asSymbols {
- ee.EncodeSymbol(k2)
- } else {
- ee.EncodeString(c_UTF8, k2)
- }
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- ee.EncodeInt(int64(v[string(k2)]))
- }
- } else {
- for k2, v2 := range v {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- if asSymbols {
- ee.EncodeSymbol(k2)
- } else {
- ee.EncodeString(c_UTF8, k2)
- }
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- ee.EncodeInt(int64(v2))
- }
- }
- if cr != nil {
- cr.sendContainerState(containerMapEnd)
- }
-}
-
-func (f *encFnInfo) fastpathEncMapStringInt16R(rv reflect.Value) {
- fastpathTV.EncMapStringInt16V(rv.Interface().(map[string]int16), fastpathCheckNilFalse, f.e)
-}
-func (_ fastpathT) EncMapStringInt16V(v map[string]int16, checkNil bool, e *Encoder) {
- ee := e.e
- cr := e.cr
- if checkNil && v == nil {
- ee.EncodeNil()
- return
- }
- ee.EncodeMapStart(len(v))
- asSymbols := e.h.AsSymbols&AsSymbolMapStringKeysFlag != 0
- if e.h.Canonical {
- v2 := make([]string, len(v))
- var i int
- for k := range v {
- v2[i] = string(k)
- i++
- }
- sort.Sort(stringSlice(v2))
- for _, k2 := range v2 {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- if asSymbols {
- ee.EncodeSymbol(k2)
- } else {
- ee.EncodeString(c_UTF8, k2)
- }
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- ee.EncodeInt(int64(v[string(k2)]))
- }
- } else {
- for k2, v2 := range v {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- if asSymbols {
- ee.EncodeSymbol(k2)
- } else {
- ee.EncodeString(c_UTF8, k2)
- }
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- ee.EncodeInt(int64(v2))
- }
- }
- if cr != nil {
- cr.sendContainerState(containerMapEnd)
- }
-}
-
-func (f *encFnInfo) fastpathEncMapStringInt32R(rv reflect.Value) {
- fastpathTV.EncMapStringInt32V(rv.Interface().(map[string]int32), fastpathCheckNilFalse, f.e)
-}
-func (_ fastpathT) EncMapStringInt32V(v map[string]int32, checkNil bool, e *Encoder) {
- ee := e.e
- cr := e.cr
- if checkNil && v == nil {
- ee.EncodeNil()
- return
- }
- ee.EncodeMapStart(len(v))
- asSymbols := e.h.AsSymbols&AsSymbolMapStringKeysFlag != 0
- if e.h.Canonical {
- v2 := make([]string, len(v))
- var i int
- for k := range v {
- v2[i] = string(k)
- i++
- }
- sort.Sort(stringSlice(v2))
- for _, k2 := range v2 {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- if asSymbols {
- ee.EncodeSymbol(k2)
- } else {
- ee.EncodeString(c_UTF8, k2)
- }
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- ee.EncodeInt(int64(v[string(k2)]))
- }
- } else {
- for k2, v2 := range v {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- if asSymbols {
- ee.EncodeSymbol(k2)
- } else {
- ee.EncodeString(c_UTF8, k2)
- }
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- ee.EncodeInt(int64(v2))
- }
- }
- if cr != nil {
- cr.sendContainerState(containerMapEnd)
- }
-}
-
-func (f *encFnInfo) fastpathEncMapStringInt64R(rv reflect.Value) {
- fastpathTV.EncMapStringInt64V(rv.Interface().(map[string]int64), fastpathCheckNilFalse, f.e)
-}
-func (_ fastpathT) EncMapStringInt64V(v map[string]int64, checkNil bool, e *Encoder) {
- ee := e.e
- cr := e.cr
- if checkNil && v == nil {
- ee.EncodeNil()
- return
- }
- ee.EncodeMapStart(len(v))
- asSymbols := e.h.AsSymbols&AsSymbolMapStringKeysFlag != 0
- if e.h.Canonical {
- v2 := make([]string, len(v))
- var i int
- for k := range v {
- v2[i] = string(k)
- i++
- }
- sort.Sort(stringSlice(v2))
- for _, k2 := range v2 {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- if asSymbols {
- ee.EncodeSymbol(k2)
- } else {
- ee.EncodeString(c_UTF8, k2)
- }
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- ee.EncodeInt(int64(v[string(k2)]))
- }
- } else {
- for k2, v2 := range v {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- if asSymbols {
- ee.EncodeSymbol(k2)
- } else {
- ee.EncodeString(c_UTF8, k2)
- }
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- ee.EncodeInt(int64(v2))
- }
- }
- if cr != nil {
- cr.sendContainerState(containerMapEnd)
- }
-}
-
-func (f *encFnInfo) fastpathEncMapStringFloat32R(rv reflect.Value) {
- fastpathTV.EncMapStringFloat32V(rv.Interface().(map[string]float32), fastpathCheckNilFalse, f.e)
-}
-func (_ fastpathT) EncMapStringFloat32V(v map[string]float32, checkNil bool, e *Encoder) {
- ee := e.e
- cr := e.cr
- if checkNil && v == nil {
- ee.EncodeNil()
- return
- }
- ee.EncodeMapStart(len(v))
- asSymbols := e.h.AsSymbols&AsSymbolMapStringKeysFlag != 0
- if e.h.Canonical {
- v2 := make([]string, len(v))
- var i int
- for k := range v {
- v2[i] = string(k)
- i++
- }
- sort.Sort(stringSlice(v2))
- for _, k2 := range v2 {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- if asSymbols {
- ee.EncodeSymbol(k2)
- } else {
- ee.EncodeString(c_UTF8, k2)
- }
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- ee.EncodeFloat32(v[string(k2)])
- }
- } else {
- for k2, v2 := range v {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- if asSymbols {
- ee.EncodeSymbol(k2)
- } else {
- ee.EncodeString(c_UTF8, k2)
- }
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- ee.EncodeFloat32(v2)
- }
- }
- if cr != nil {
- cr.sendContainerState(containerMapEnd)
- }
-}
-
-func (f *encFnInfo) fastpathEncMapStringFloat64R(rv reflect.Value) {
- fastpathTV.EncMapStringFloat64V(rv.Interface().(map[string]float64), fastpathCheckNilFalse, f.e)
-}
-func (_ fastpathT) EncMapStringFloat64V(v map[string]float64, checkNil bool, e *Encoder) {
- ee := e.e
- cr := e.cr
- if checkNil && v == nil {
- ee.EncodeNil()
- return
- }
- ee.EncodeMapStart(len(v))
- asSymbols := e.h.AsSymbols&AsSymbolMapStringKeysFlag != 0
- if e.h.Canonical {
- v2 := make([]string, len(v))
- var i int
- for k := range v {
- v2[i] = string(k)
- i++
- }
- sort.Sort(stringSlice(v2))
- for _, k2 := range v2 {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- if asSymbols {
- ee.EncodeSymbol(k2)
- } else {
- ee.EncodeString(c_UTF8, k2)
- }
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- ee.EncodeFloat64(v[string(k2)])
- }
- } else {
- for k2, v2 := range v {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- if asSymbols {
- ee.EncodeSymbol(k2)
- } else {
- ee.EncodeString(c_UTF8, k2)
- }
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- ee.EncodeFloat64(v2)
- }
- }
- if cr != nil {
- cr.sendContainerState(containerMapEnd)
- }
-}
-
-func (f *encFnInfo) fastpathEncMapStringBoolR(rv reflect.Value) {
- fastpathTV.EncMapStringBoolV(rv.Interface().(map[string]bool), fastpathCheckNilFalse, f.e)
-}
-func (_ fastpathT) EncMapStringBoolV(v map[string]bool, checkNil bool, e *Encoder) {
- ee := e.e
- cr := e.cr
- if checkNil && v == nil {
- ee.EncodeNil()
- return
- }
- ee.EncodeMapStart(len(v))
- asSymbols := e.h.AsSymbols&AsSymbolMapStringKeysFlag != 0
- if e.h.Canonical {
- v2 := make([]string, len(v))
- var i int
- for k := range v {
- v2[i] = string(k)
- i++
- }
- sort.Sort(stringSlice(v2))
- for _, k2 := range v2 {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- if asSymbols {
- ee.EncodeSymbol(k2)
- } else {
- ee.EncodeString(c_UTF8, k2)
- }
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- ee.EncodeBool(v[string(k2)])
- }
- } else {
- for k2, v2 := range v {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- if asSymbols {
- ee.EncodeSymbol(k2)
- } else {
- ee.EncodeString(c_UTF8, k2)
- }
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- ee.EncodeBool(v2)
- }
- }
- if cr != nil {
- cr.sendContainerState(containerMapEnd)
- }
-}
-
-func (f *encFnInfo) fastpathEncMapFloat32IntfR(rv reflect.Value) {
- fastpathTV.EncMapFloat32IntfV(rv.Interface().(map[float32]interface{}), fastpathCheckNilFalse, f.e)
-}
-func (_ fastpathT) EncMapFloat32IntfV(v map[float32]interface{}, checkNil bool, e *Encoder) {
- ee := e.e
- cr := e.cr
- if checkNil && v == nil {
- ee.EncodeNil()
- return
- }
- ee.EncodeMapStart(len(v))
- if e.h.Canonical {
- v2 := make([]float64, len(v))
- var i int
- for k := range v {
- v2[i] = float64(k)
- i++
- }
- sort.Sort(floatSlice(v2))
- for _, k2 := range v2 {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- ee.EncodeFloat32(float32(k2))
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- e.encode(v[float32(k2)])
- }
- } else {
- for k2, v2 := range v {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- ee.EncodeFloat32(k2)
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- e.encode(v2)
- }
- }
- if cr != nil {
- cr.sendContainerState(containerMapEnd)
- }
-}
-
-func (f *encFnInfo) fastpathEncMapFloat32StringR(rv reflect.Value) {
- fastpathTV.EncMapFloat32StringV(rv.Interface().(map[float32]string), fastpathCheckNilFalse, f.e)
-}
-func (_ fastpathT) EncMapFloat32StringV(v map[float32]string, checkNil bool, e *Encoder) {
- ee := e.e
- cr := e.cr
- if checkNil && v == nil {
- ee.EncodeNil()
- return
- }
- ee.EncodeMapStart(len(v))
- if e.h.Canonical {
- v2 := make([]float64, len(v))
- var i int
- for k := range v {
- v2[i] = float64(k)
- i++
- }
- sort.Sort(floatSlice(v2))
- for _, k2 := range v2 {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- ee.EncodeFloat32(float32(k2))
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- ee.EncodeString(c_UTF8, v[float32(k2)])
- }
- } else {
- for k2, v2 := range v {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- ee.EncodeFloat32(k2)
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- ee.EncodeString(c_UTF8, v2)
- }
- }
- if cr != nil {
- cr.sendContainerState(containerMapEnd)
- }
-}
-
-func (f *encFnInfo) fastpathEncMapFloat32UintR(rv reflect.Value) {
- fastpathTV.EncMapFloat32UintV(rv.Interface().(map[float32]uint), fastpathCheckNilFalse, f.e)
-}
-func (_ fastpathT) EncMapFloat32UintV(v map[float32]uint, checkNil bool, e *Encoder) {
- ee := e.e
- cr := e.cr
- if checkNil && v == nil {
- ee.EncodeNil()
- return
- }
- ee.EncodeMapStart(len(v))
- if e.h.Canonical {
- v2 := make([]float64, len(v))
- var i int
- for k := range v {
- v2[i] = float64(k)
- i++
- }
- sort.Sort(floatSlice(v2))
- for _, k2 := range v2 {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- ee.EncodeFloat32(float32(k2))
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- ee.EncodeUint(uint64(v[float32(k2)]))
- }
- } else {
- for k2, v2 := range v {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- ee.EncodeFloat32(k2)
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- ee.EncodeUint(uint64(v2))
- }
- }
- if cr != nil {
- cr.sendContainerState(containerMapEnd)
- }
-}
-
-func (f *encFnInfo) fastpathEncMapFloat32Uint8R(rv reflect.Value) {
- fastpathTV.EncMapFloat32Uint8V(rv.Interface().(map[float32]uint8), fastpathCheckNilFalse, f.e)
-}
-func (_ fastpathT) EncMapFloat32Uint8V(v map[float32]uint8, checkNil bool, e *Encoder) {
- ee := e.e
- cr := e.cr
- if checkNil && v == nil {
- ee.EncodeNil()
- return
- }
- ee.EncodeMapStart(len(v))
- if e.h.Canonical {
- v2 := make([]float64, len(v))
- var i int
- for k := range v {
- v2[i] = float64(k)
- i++
- }
- sort.Sort(floatSlice(v2))
- for _, k2 := range v2 {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- ee.EncodeFloat32(float32(k2))
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- ee.EncodeUint(uint64(v[float32(k2)]))
- }
- } else {
- for k2, v2 := range v {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- ee.EncodeFloat32(k2)
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- ee.EncodeUint(uint64(v2))
- }
- }
- if cr != nil {
- cr.sendContainerState(containerMapEnd)
- }
-}
-
-func (f *encFnInfo) fastpathEncMapFloat32Uint16R(rv reflect.Value) {
- fastpathTV.EncMapFloat32Uint16V(rv.Interface().(map[float32]uint16), fastpathCheckNilFalse, f.e)
-}
-func (_ fastpathT) EncMapFloat32Uint16V(v map[float32]uint16, checkNil bool, e *Encoder) {
- ee := e.e
- cr := e.cr
- if checkNil && v == nil {
- ee.EncodeNil()
- return
- }
- ee.EncodeMapStart(len(v))
- if e.h.Canonical {
- v2 := make([]float64, len(v))
- var i int
- for k := range v {
- v2[i] = float64(k)
- i++
- }
- sort.Sort(floatSlice(v2))
- for _, k2 := range v2 {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- ee.EncodeFloat32(float32(k2))
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- ee.EncodeUint(uint64(v[float32(k2)]))
- }
- } else {
- for k2, v2 := range v {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- ee.EncodeFloat32(k2)
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- ee.EncodeUint(uint64(v2))
- }
- }
- if cr != nil {
- cr.sendContainerState(containerMapEnd)
- }
-}
-
-func (f *encFnInfo) fastpathEncMapFloat32Uint32R(rv reflect.Value) {
- fastpathTV.EncMapFloat32Uint32V(rv.Interface().(map[float32]uint32), fastpathCheckNilFalse, f.e)
-}
-func (_ fastpathT) EncMapFloat32Uint32V(v map[float32]uint32, checkNil bool, e *Encoder) {
- ee := e.e
- cr := e.cr
- if checkNil && v == nil {
- ee.EncodeNil()
- return
- }
- ee.EncodeMapStart(len(v))
- if e.h.Canonical {
- v2 := make([]float64, len(v))
- var i int
- for k := range v {
- v2[i] = float64(k)
- i++
- }
- sort.Sort(floatSlice(v2))
- for _, k2 := range v2 {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- ee.EncodeFloat32(float32(k2))
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- ee.EncodeUint(uint64(v[float32(k2)]))
- }
- } else {
- for k2, v2 := range v {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- ee.EncodeFloat32(k2)
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- ee.EncodeUint(uint64(v2))
- }
- }
- if cr != nil {
- cr.sendContainerState(containerMapEnd)
- }
-}
-
-func (f *encFnInfo) fastpathEncMapFloat32Uint64R(rv reflect.Value) {
- fastpathTV.EncMapFloat32Uint64V(rv.Interface().(map[float32]uint64), fastpathCheckNilFalse, f.e)
-}
-func (_ fastpathT) EncMapFloat32Uint64V(v map[float32]uint64, checkNil bool, e *Encoder) {
- ee := e.e
- cr := e.cr
- if checkNil && v == nil {
- ee.EncodeNil()
- return
- }
- ee.EncodeMapStart(len(v))
- if e.h.Canonical {
- v2 := make([]float64, len(v))
- var i int
- for k := range v {
- v2[i] = float64(k)
- i++
- }
- sort.Sort(floatSlice(v2))
- for _, k2 := range v2 {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- ee.EncodeFloat32(float32(k2))
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- ee.EncodeUint(uint64(v[float32(k2)]))
- }
- } else {
- for k2, v2 := range v {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- ee.EncodeFloat32(k2)
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- ee.EncodeUint(uint64(v2))
- }
- }
- if cr != nil {
- cr.sendContainerState(containerMapEnd)
- }
-}
-
-func (f *encFnInfo) fastpathEncMapFloat32UintptrR(rv reflect.Value) {
- fastpathTV.EncMapFloat32UintptrV(rv.Interface().(map[float32]uintptr), fastpathCheckNilFalse, f.e)
-}
-func (_ fastpathT) EncMapFloat32UintptrV(v map[float32]uintptr, checkNil bool, e *Encoder) {
- ee := e.e
- cr := e.cr
- if checkNil && v == nil {
- ee.EncodeNil()
- return
- }
- ee.EncodeMapStart(len(v))
- if e.h.Canonical {
- v2 := make([]float64, len(v))
- var i int
- for k := range v {
- v2[i] = float64(k)
- i++
- }
- sort.Sort(floatSlice(v2))
- for _, k2 := range v2 {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- ee.EncodeFloat32(float32(k2))
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- e.encode(v[float32(k2)])
- }
- } else {
- for k2, v2 := range v {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- ee.EncodeFloat32(k2)
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- e.encode(v2)
- }
- }
- if cr != nil {
- cr.sendContainerState(containerMapEnd)
- }
-}
-
-func (f *encFnInfo) fastpathEncMapFloat32IntR(rv reflect.Value) {
- fastpathTV.EncMapFloat32IntV(rv.Interface().(map[float32]int), fastpathCheckNilFalse, f.e)
-}
-func (_ fastpathT) EncMapFloat32IntV(v map[float32]int, checkNil bool, e *Encoder) {
- ee := e.e
- cr := e.cr
- if checkNil && v == nil {
- ee.EncodeNil()
- return
- }
- ee.EncodeMapStart(len(v))
- if e.h.Canonical {
- v2 := make([]float64, len(v))
- var i int
- for k := range v {
- v2[i] = float64(k)
- i++
- }
- sort.Sort(floatSlice(v2))
- for _, k2 := range v2 {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- ee.EncodeFloat32(float32(k2))
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- ee.EncodeInt(int64(v[float32(k2)]))
- }
- } else {
- for k2, v2 := range v {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- ee.EncodeFloat32(k2)
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- ee.EncodeInt(int64(v2))
- }
- }
- if cr != nil {
- cr.sendContainerState(containerMapEnd)
- }
-}
-
-func (f *encFnInfo) fastpathEncMapFloat32Int8R(rv reflect.Value) {
- fastpathTV.EncMapFloat32Int8V(rv.Interface().(map[float32]int8), fastpathCheckNilFalse, f.e)
-}
-func (_ fastpathT) EncMapFloat32Int8V(v map[float32]int8, checkNil bool, e *Encoder) {
- ee := e.e
- cr := e.cr
- if checkNil && v == nil {
- ee.EncodeNil()
- return
- }
- ee.EncodeMapStart(len(v))
- if e.h.Canonical {
- v2 := make([]float64, len(v))
- var i int
- for k := range v {
- v2[i] = float64(k)
- i++
- }
- sort.Sort(floatSlice(v2))
- for _, k2 := range v2 {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- ee.EncodeFloat32(float32(k2))
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- ee.EncodeInt(int64(v[float32(k2)]))
- }
- } else {
- for k2, v2 := range v {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- ee.EncodeFloat32(k2)
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- ee.EncodeInt(int64(v2))
- }
- }
- if cr != nil {
- cr.sendContainerState(containerMapEnd)
- }
-}
-
-func (f *encFnInfo) fastpathEncMapFloat32Int16R(rv reflect.Value) {
- fastpathTV.EncMapFloat32Int16V(rv.Interface().(map[float32]int16), fastpathCheckNilFalse, f.e)
-}
-func (_ fastpathT) EncMapFloat32Int16V(v map[float32]int16, checkNil bool, e *Encoder) {
- ee := e.e
- cr := e.cr
- if checkNil && v == nil {
- ee.EncodeNil()
- return
- }
- ee.EncodeMapStart(len(v))
- if e.h.Canonical {
- v2 := make([]float64, len(v))
- var i int
- for k := range v {
- v2[i] = float64(k)
- i++
- }
- sort.Sort(floatSlice(v2))
- for _, k2 := range v2 {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- ee.EncodeFloat32(float32(k2))
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- ee.EncodeInt(int64(v[float32(k2)]))
- }
- } else {
- for k2, v2 := range v {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- ee.EncodeFloat32(k2)
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- ee.EncodeInt(int64(v2))
- }
- }
- if cr != nil {
- cr.sendContainerState(containerMapEnd)
- }
-}
-
-func (f *encFnInfo) fastpathEncMapFloat32Int32R(rv reflect.Value) {
- fastpathTV.EncMapFloat32Int32V(rv.Interface().(map[float32]int32), fastpathCheckNilFalse, f.e)
-}
-func (_ fastpathT) EncMapFloat32Int32V(v map[float32]int32, checkNil bool, e *Encoder) {
- ee := e.e
- cr := e.cr
- if checkNil && v == nil {
- ee.EncodeNil()
- return
- }
- ee.EncodeMapStart(len(v))
- if e.h.Canonical {
- v2 := make([]float64, len(v))
- var i int
- for k := range v {
- v2[i] = float64(k)
- i++
- }
- sort.Sort(floatSlice(v2))
- for _, k2 := range v2 {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- ee.EncodeFloat32(float32(k2))
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- ee.EncodeInt(int64(v[float32(k2)]))
- }
- } else {
- for k2, v2 := range v {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- ee.EncodeFloat32(k2)
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- ee.EncodeInt(int64(v2))
- }
- }
- if cr != nil {
- cr.sendContainerState(containerMapEnd)
- }
-}
-
-func (f *encFnInfo) fastpathEncMapFloat32Int64R(rv reflect.Value) {
- fastpathTV.EncMapFloat32Int64V(rv.Interface().(map[float32]int64), fastpathCheckNilFalse, f.e)
-}
-func (_ fastpathT) EncMapFloat32Int64V(v map[float32]int64, checkNil bool, e *Encoder) {
- ee := e.e
- cr := e.cr
- if checkNil && v == nil {
- ee.EncodeNil()
- return
- }
- ee.EncodeMapStart(len(v))
- if e.h.Canonical {
- v2 := make([]float64, len(v))
- var i int
- for k := range v {
- v2[i] = float64(k)
- i++
- }
- sort.Sort(floatSlice(v2))
- for _, k2 := range v2 {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- ee.EncodeFloat32(float32(k2))
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- ee.EncodeInt(int64(v[float32(k2)]))
- }
- } else {
- for k2, v2 := range v {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- ee.EncodeFloat32(k2)
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- ee.EncodeInt(int64(v2))
- }
- }
- if cr != nil {
- cr.sendContainerState(containerMapEnd)
- }
-}
-
-func (f *encFnInfo) fastpathEncMapFloat32Float32R(rv reflect.Value) {
- fastpathTV.EncMapFloat32Float32V(rv.Interface().(map[float32]float32), fastpathCheckNilFalse, f.e)
-}
-func (_ fastpathT) EncMapFloat32Float32V(v map[float32]float32, checkNil bool, e *Encoder) {
- ee := e.e
- cr := e.cr
- if checkNil && v == nil {
- ee.EncodeNil()
- return
- }
- ee.EncodeMapStart(len(v))
- if e.h.Canonical {
- v2 := make([]float64, len(v))
- var i int
- for k := range v {
- v2[i] = float64(k)
- i++
- }
- sort.Sort(floatSlice(v2))
- for _, k2 := range v2 {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- ee.EncodeFloat32(float32(k2))
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- ee.EncodeFloat32(v[float32(k2)])
- }
- } else {
- for k2, v2 := range v {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- ee.EncodeFloat32(k2)
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- ee.EncodeFloat32(v2)
- }
- }
- if cr != nil {
- cr.sendContainerState(containerMapEnd)
- }
-}
-
-func (f *encFnInfo) fastpathEncMapFloat32Float64R(rv reflect.Value) {
- fastpathTV.EncMapFloat32Float64V(rv.Interface().(map[float32]float64), fastpathCheckNilFalse, f.e)
-}
-func (_ fastpathT) EncMapFloat32Float64V(v map[float32]float64, checkNil bool, e *Encoder) {
- ee := e.e
- cr := e.cr
- if checkNil && v == nil {
- ee.EncodeNil()
- return
- }
- ee.EncodeMapStart(len(v))
- if e.h.Canonical {
- v2 := make([]float64, len(v))
- var i int
- for k := range v {
- v2[i] = float64(k)
- i++
- }
- sort.Sort(floatSlice(v2))
- for _, k2 := range v2 {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- ee.EncodeFloat32(float32(k2))
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- ee.EncodeFloat64(v[float32(k2)])
- }
- } else {
- for k2, v2 := range v {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- ee.EncodeFloat32(k2)
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- ee.EncodeFloat64(v2)
- }
- }
- if cr != nil {
- cr.sendContainerState(containerMapEnd)
- }
-}
-
-func (f *encFnInfo) fastpathEncMapFloat32BoolR(rv reflect.Value) {
- fastpathTV.EncMapFloat32BoolV(rv.Interface().(map[float32]bool), fastpathCheckNilFalse, f.e)
-}
-func (_ fastpathT) EncMapFloat32BoolV(v map[float32]bool, checkNil bool, e *Encoder) {
- ee := e.e
- cr := e.cr
- if checkNil && v == nil {
- ee.EncodeNil()
- return
- }
- ee.EncodeMapStart(len(v))
- if e.h.Canonical {
- v2 := make([]float64, len(v))
- var i int
- for k := range v {
- v2[i] = float64(k)
- i++
- }
- sort.Sort(floatSlice(v2))
- for _, k2 := range v2 {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- ee.EncodeFloat32(float32(k2))
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- ee.EncodeBool(v[float32(k2)])
- }
- } else {
- for k2, v2 := range v {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- ee.EncodeFloat32(k2)
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- ee.EncodeBool(v2)
- }
- }
- if cr != nil {
- cr.sendContainerState(containerMapEnd)
- }
-}
-
-func (f *encFnInfo) fastpathEncMapFloat64IntfR(rv reflect.Value) {
- fastpathTV.EncMapFloat64IntfV(rv.Interface().(map[float64]interface{}), fastpathCheckNilFalse, f.e)
-}
-func (_ fastpathT) EncMapFloat64IntfV(v map[float64]interface{}, checkNil bool, e *Encoder) {
- ee := e.e
- cr := e.cr
- if checkNil && v == nil {
- ee.EncodeNil()
- return
- }
- ee.EncodeMapStart(len(v))
- if e.h.Canonical {
- v2 := make([]float64, len(v))
- var i int
- for k := range v {
- v2[i] = float64(k)
- i++
- }
- sort.Sort(floatSlice(v2))
- for _, k2 := range v2 {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- ee.EncodeFloat64(float64(k2))
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- e.encode(v[float64(k2)])
- }
- } else {
- for k2, v2 := range v {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- ee.EncodeFloat64(k2)
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- e.encode(v2)
- }
- }
- if cr != nil {
- cr.sendContainerState(containerMapEnd)
- }
-}
-
-func (f *encFnInfo) fastpathEncMapFloat64StringR(rv reflect.Value) {
- fastpathTV.EncMapFloat64StringV(rv.Interface().(map[float64]string), fastpathCheckNilFalse, f.e)
-}
-func (_ fastpathT) EncMapFloat64StringV(v map[float64]string, checkNil bool, e *Encoder) {
- ee := e.e
- cr := e.cr
- if checkNil && v == nil {
- ee.EncodeNil()
- return
- }
- ee.EncodeMapStart(len(v))
- if e.h.Canonical {
- v2 := make([]float64, len(v))
- var i int
- for k := range v {
- v2[i] = float64(k)
- i++
- }
- sort.Sort(floatSlice(v2))
- for _, k2 := range v2 {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- ee.EncodeFloat64(float64(k2))
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- ee.EncodeString(c_UTF8, v[float64(k2)])
- }
- } else {
- for k2, v2 := range v {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- ee.EncodeFloat64(k2)
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- ee.EncodeString(c_UTF8, v2)
- }
- }
- if cr != nil {
- cr.sendContainerState(containerMapEnd)
- }
-}
-
-func (f *encFnInfo) fastpathEncMapFloat64UintR(rv reflect.Value) {
- fastpathTV.EncMapFloat64UintV(rv.Interface().(map[float64]uint), fastpathCheckNilFalse, f.e)
-}
-func (_ fastpathT) EncMapFloat64UintV(v map[float64]uint, checkNil bool, e *Encoder) {
- ee := e.e
- cr := e.cr
- if checkNil && v == nil {
- ee.EncodeNil()
- return
- }
- ee.EncodeMapStart(len(v))
- if e.h.Canonical {
- v2 := make([]float64, len(v))
- var i int
- for k := range v {
- v2[i] = float64(k)
- i++
- }
- sort.Sort(floatSlice(v2))
- for _, k2 := range v2 {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- ee.EncodeFloat64(float64(k2))
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- ee.EncodeUint(uint64(v[float64(k2)]))
- }
- } else {
- for k2, v2 := range v {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- ee.EncodeFloat64(k2)
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- ee.EncodeUint(uint64(v2))
- }
- }
- if cr != nil {
- cr.sendContainerState(containerMapEnd)
- }
-}
-
-func (f *encFnInfo) fastpathEncMapFloat64Uint8R(rv reflect.Value) {
- fastpathTV.EncMapFloat64Uint8V(rv.Interface().(map[float64]uint8), fastpathCheckNilFalse, f.e)
-}
-func (_ fastpathT) EncMapFloat64Uint8V(v map[float64]uint8, checkNil bool, e *Encoder) {
- ee := e.e
- cr := e.cr
- if checkNil && v == nil {
- ee.EncodeNil()
- return
- }
- ee.EncodeMapStart(len(v))
- if e.h.Canonical {
- v2 := make([]float64, len(v))
- var i int
- for k := range v {
- v2[i] = float64(k)
- i++
- }
- sort.Sort(floatSlice(v2))
- for _, k2 := range v2 {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- ee.EncodeFloat64(float64(k2))
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- ee.EncodeUint(uint64(v[float64(k2)]))
- }
- } else {
- for k2, v2 := range v {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- ee.EncodeFloat64(k2)
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- ee.EncodeUint(uint64(v2))
- }
- }
- if cr != nil {
- cr.sendContainerState(containerMapEnd)
- }
-}
-
-func (f *encFnInfo) fastpathEncMapFloat64Uint16R(rv reflect.Value) {
- fastpathTV.EncMapFloat64Uint16V(rv.Interface().(map[float64]uint16), fastpathCheckNilFalse, f.e)
-}
-func (_ fastpathT) EncMapFloat64Uint16V(v map[float64]uint16, checkNil bool, e *Encoder) {
- ee := e.e
- cr := e.cr
- if checkNil && v == nil {
- ee.EncodeNil()
- return
- }
- ee.EncodeMapStart(len(v))
- if e.h.Canonical {
- v2 := make([]float64, len(v))
- var i int
- for k := range v {
- v2[i] = float64(k)
- i++
- }
- sort.Sort(floatSlice(v2))
- for _, k2 := range v2 {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- ee.EncodeFloat64(float64(k2))
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- ee.EncodeUint(uint64(v[float64(k2)]))
- }
- } else {
- for k2, v2 := range v {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- ee.EncodeFloat64(k2)
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- ee.EncodeUint(uint64(v2))
- }
- }
- if cr != nil {
- cr.sendContainerState(containerMapEnd)
- }
-}
-
-func (f *encFnInfo) fastpathEncMapFloat64Uint32R(rv reflect.Value) {
- fastpathTV.EncMapFloat64Uint32V(rv.Interface().(map[float64]uint32), fastpathCheckNilFalse, f.e)
-}
-func (_ fastpathT) EncMapFloat64Uint32V(v map[float64]uint32, checkNil bool, e *Encoder) {
- ee := e.e
- cr := e.cr
- if checkNil && v == nil {
- ee.EncodeNil()
- return
- }
- ee.EncodeMapStart(len(v))
- if e.h.Canonical {
- v2 := make([]float64, len(v))
- var i int
- for k := range v {
- v2[i] = float64(k)
- i++
- }
- sort.Sort(floatSlice(v2))
- for _, k2 := range v2 {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- ee.EncodeFloat64(float64(k2))
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- ee.EncodeUint(uint64(v[float64(k2)]))
- }
- } else {
- for k2, v2 := range v {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- ee.EncodeFloat64(k2)
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- ee.EncodeUint(uint64(v2))
- }
- }
- if cr != nil {
- cr.sendContainerState(containerMapEnd)
- }
-}
-
-func (f *encFnInfo) fastpathEncMapFloat64Uint64R(rv reflect.Value) {
- fastpathTV.EncMapFloat64Uint64V(rv.Interface().(map[float64]uint64), fastpathCheckNilFalse, f.e)
-}
-func (_ fastpathT) EncMapFloat64Uint64V(v map[float64]uint64, checkNil bool, e *Encoder) {
- ee := e.e
- cr := e.cr
- if checkNil && v == nil {
- ee.EncodeNil()
- return
- }
- ee.EncodeMapStart(len(v))
- if e.h.Canonical {
- v2 := make([]float64, len(v))
- var i int
- for k := range v {
- v2[i] = float64(k)
- i++
- }
- sort.Sort(floatSlice(v2))
- for _, k2 := range v2 {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- ee.EncodeFloat64(float64(k2))
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- ee.EncodeUint(uint64(v[float64(k2)]))
- }
- } else {
- for k2, v2 := range v {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- ee.EncodeFloat64(k2)
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- ee.EncodeUint(uint64(v2))
- }
- }
- if cr != nil {
- cr.sendContainerState(containerMapEnd)
- }
-}
-
-func (f *encFnInfo) fastpathEncMapFloat64UintptrR(rv reflect.Value) {
- fastpathTV.EncMapFloat64UintptrV(rv.Interface().(map[float64]uintptr), fastpathCheckNilFalse, f.e)
-}
-func (_ fastpathT) EncMapFloat64UintptrV(v map[float64]uintptr, checkNil bool, e *Encoder) {
- ee := e.e
- cr := e.cr
- if checkNil && v == nil {
- ee.EncodeNil()
- return
- }
- ee.EncodeMapStart(len(v))
- if e.h.Canonical {
- v2 := make([]float64, len(v))
- var i int
- for k := range v {
- v2[i] = float64(k)
- i++
- }
- sort.Sort(floatSlice(v2))
- for _, k2 := range v2 {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- ee.EncodeFloat64(float64(k2))
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- e.encode(v[float64(k2)])
- }
- } else {
- for k2, v2 := range v {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- ee.EncodeFloat64(k2)
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- e.encode(v2)
- }
- }
- if cr != nil {
- cr.sendContainerState(containerMapEnd)
- }
-}
-
-func (f *encFnInfo) fastpathEncMapFloat64IntR(rv reflect.Value) {
- fastpathTV.EncMapFloat64IntV(rv.Interface().(map[float64]int), fastpathCheckNilFalse, f.e)
-}
-func (_ fastpathT) EncMapFloat64IntV(v map[float64]int, checkNil bool, e *Encoder) {
- ee := e.e
- cr := e.cr
- if checkNil && v == nil {
- ee.EncodeNil()
- return
- }
- ee.EncodeMapStart(len(v))
- if e.h.Canonical {
- v2 := make([]float64, len(v))
- var i int
- for k := range v {
- v2[i] = float64(k)
- i++
- }
- sort.Sort(floatSlice(v2))
- for _, k2 := range v2 {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- ee.EncodeFloat64(float64(k2))
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- ee.EncodeInt(int64(v[float64(k2)]))
- }
- } else {
- for k2, v2 := range v {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- ee.EncodeFloat64(k2)
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- ee.EncodeInt(int64(v2))
- }
- }
- if cr != nil {
- cr.sendContainerState(containerMapEnd)
- }
-}
-
-func (f *encFnInfo) fastpathEncMapFloat64Int8R(rv reflect.Value) {
- fastpathTV.EncMapFloat64Int8V(rv.Interface().(map[float64]int8), fastpathCheckNilFalse, f.e)
-}
-func (_ fastpathT) EncMapFloat64Int8V(v map[float64]int8, checkNil bool, e *Encoder) {
- ee := e.e
- cr := e.cr
- if checkNil && v == nil {
- ee.EncodeNil()
- return
- }
- ee.EncodeMapStart(len(v))
- if e.h.Canonical {
- v2 := make([]float64, len(v))
- var i int
- for k := range v {
- v2[i] = float64(k)
- i++
- }
- sort.Sort(floatSlice(v2))
- for _, k2 := range v2 {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- ee.EncodeFloat64(float64(k2))
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- ee.EncodeInt(int64(v[float64(k2)]))
- }
- } else {
- for k2, v2 := range v {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- ee.EncodeFloat64(k2)
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- ee.EncodeInt(int64(v2))
- }
- }
- if cr != nil {
- cr.sendContainerState(containerMapEnd)
- }
-}
-
-func (f *encFnInfo) fastpathEncMapFloat64Int16R(rv reflect.Value) {
- fastpathTV.EncMapFloat64Int16V(rv.Interface().(map[float64]int16), fastpathCheckNilFalse, f.e)
-}
-func (_ fastpathT) EncMapFloat64Int16V(v map[float64]int16, checkNil bool, e *Encoder) {
- ee := e.e
- cr := e.cr
- if checkNil && v == nil {
- ee.EncodeNil()
- return
- }
- ee.EncodeMapStart(len(v))
- if e.h.Canonical {
- v2 := make([]float64, len(v))
- var i int
- for k := range v {
- v2[i] = float64(k)
- i++
- }
- sort.Sort(floatSlice(v2))
- for _, k2 := range v2 {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- ee.EncodeFloat64(float64(k2))
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- ee.EncodeInt(int64(v[float64(k2)]))
- }
- } else {
- for k2, v2 := range v {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- ee.EncodeFloat64(k2)
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- ee.EncodeInt(int64(v2))
- }
- }
- if cr != nil {
- cr.sendContainerState(containerMapEnd)
- }
-}
-
-func (f *encFnInfo) fastpathEncMapFloat64Int32R(rv reflect.Value) {
- fastpathTV.EncMapFloat64Int32V(rv.Interface().(map[float64]int32), fastpathCheckNilFalse, f.e)
-}
-func (_ fastpathT) EncMapFloat64Int32V(v map[float64]int32, checkNil bool, e *Encoder) {
- ee := e.e
- cr := e.cr
- if checkNil && v == nil {
- ee.EncodeNil()
- return
- }
- ee.EncodeMapStart(len(v))
- if e.h.Canonical {
- v2 := make([]float64, len(v))
- var i int
- for k := range v {
- v2[i] = float64(k)
- i++
- }
- sort.Sort(floatSlice(v2))
- for _, k2 := range v2 {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- ee.EncodeFloat64(float64(k2))
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- ee.EncodeInt(int64(v[float64(k2)]))
- }
- } else {
- for k2, v2 := range v {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- ee.EncodeFloat64(k2)
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- ee.EncodeInt(int64(v2))
- }
- }
- if cr != nil {
- cr.sendContainerState(containerMapEnd)
- }
-}
-
-func (f *encFnInfo) fastpathEncMapFloat64Int64R(rv reflect.Value) {
- fastpathTV.EncMapFloat64Int64V(rv.Interface().(map[float64]int64), fastpathCheckNilFalse, f.e)
-}
-func (_ fastpathT) EncMapFloat64Int64V(v map[float64]int64, checkNil bool, e *Encoder) {
- ee := e.e
- cr := e.cr
- if checkNil && v == nil {
- ee.EncodeNil()
- return
- }
- ee.EncodeMapStart(len(v))
- if e.h.Canonical {
- v2 := make([]float64, len(v))
- var i int
- for k := range v {
- v2[i] = float64(k)
- i++
- }
- sort.Sort(floatSlice(v2))
- for _, k2 := range v2 {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- ee.EncodeFloat64(float64(k2))
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- ee.EncodeInt(int64(v[float64(k2)]))
- }
- } else {
- for k2, v2 := range v {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- ee.EncodeFloat64(k2)
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- ee.EncodeInt(int64(v2))
- }
- }
- if cr != nil {
- cr.sendContainerState(containerMapEnd)
- }
-}
-
-func (f *encFnInfo) fastpathEncMapFloat64Float32R(rv reflect.Value) {
- fastpathTV.EncMapFloat64Float32V(rv.Interface().(map[float64]float32), fastpathCheckNilFalse, f.e)
-}
-func (_ fastpathT) EncMapFloat64Float32V(v map[float64]float32, checkNil bool, e *Encoder) {
- ee := e.e
- cr := e.cr
- if checkNil && v == nil {
- ee.EncodeNil()
- return
- }
- ee.EncodeMapStart(len(v))
- if e.h.Canonical {
- v2 := make([]float64, len(v))
- var i int
- for k := range v {
- v2[i] = float64(k)
- i++
- }
- sort.Sort(floatSlice(v2))
- for _, k2 := range v2 {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- ee.EncodeFloat64(float64(k2))
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- ee.EncodeFloat32(v[float64(k2)])
- }
- } else {
- for k2, v2 := range v {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- ee.EncodeFloat64(k2)
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- ee.EncodeFloat32(v2)
- }
- }
- if cr != nil {
- cr.sendContainerState(containerMapEnd)
- }
-}
-
-func (f *encFnInfo) fastpathEncMapFloat64Float64R(rv reflect.Value) {
- fastpathTV.EncMapFloat64Float64V(rv.Interface().(map[float64]float64), fastpathCheckNilFalse, f.e)
-}
-func (_ fastpathT) EncMapFloat64Float64V(v map[float64]float64, checkNil bool, e *Encoder) {
- ee := e.e
- cr := e.cr
- if checkNil && v == nil {
- ee.EncodeNil()
- return
- }
- ee.EncodeMapStart(len(v))
- if e.h.Canonical {
- v2 := make([]float64, len(v))
- var i int
- for k := range v {
- v2[i] = float64(k)
- i++
- }
- sort.Sort(floatSlice(v2))
- for _, k2 := range v2 {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- ee.EncodeFloat64(float64(k2))
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- ee.EncodeFloat64(v[float64(k2)])
- }
- } else {
- for k2, v2 := range v {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- ee.EncodeFloat64(k2)
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- ee.EncodeFloat64(v2)
- }
- }
- if cr != nil {
- cr.sendContainerState(containerMapEnd)
- }
-}
-
-func (f *encFnInfo) fastpathEncMapFloat64BoolR(rv reflect.Value) {
- fastpathTV.EncMapFloat64BoolV(rv.Interface().(map[float64]bool), fastpathCheckNilFalse, f.e)
-}
-func (_ fastpathT) EncMapFloat64BoolV(v map[float64]bool, checkNil bool, e *Encoder) {
- ee := e.e
- cr := e.cr
- if checkNil && v == nil {
- ee.EncodeNil()
- return
- }
- ee.EncodeMapStart(len(v))
- if e.h.Canonical {
- v2 := make([]float64, len(v))
- var i int
- for k := range v {
- v2[i] = float64(k)
- i++
- }
- sort.Sort(floatSlice(v2))
- for _, k2 := range v2 {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- ee.EncodeFloat64(float64(k2))
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- ee.EncodeBool(v[float64(k2)])
- }
- } else {
- for k2, v2 := range v {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- ee.EncodeFloat64(k2)
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- ee.EncodeBool(v2)
- }
- }
- if cr != nil {
- cr.sendContainerState(containerMapEnd)
- }
-}
-
-func (f *encFnInfo) fastpathEncMapUintIntfR(rv reflect.Value) {
- fastpathTV.EncMapUintIntfV(rv.Interface().(map[uint]interface{}), fastpathCheckNilFalse, f.e)
-}
-func (_ fastpathT) EncMapUintIntfV(v map[uint]interface{}, checkNil bool, e *Encoder) {
- ee := e.e
- cr := e.cr
- if checkNil && v == nil {
- ee.EncodeNil()
- return
- }
- ee.EncodeMapStart(len(v))
- if e.h.Canonical {
- v2 := make([]uint64, len(v))
- var i int
- for k := range v {
- v2[i] = uint64(k)
- i++
- }
- sort.Sort(uintSlice(v2))
- for _, k2 := range v2 {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- ee.EncodeUint(uint64(uint(k2)))
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- e.encode(v[uint(k2)])
- }
- } else {
- for k2, v2 := range v {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- ee.EncodeUint(uint64(k2))
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- e.encode(v2)
- }
- }
- if cr != nil {
- cr.sendContainerState(containerMapEnd)
- }
-}
-
-func (f *encFnInfo) fastpathEncMapUintStringR(rv reflect.Value) {
- fastpathTV.EncMapUintStringV(rv.Interface().(map[uint]string), fastpathCheckNilFalse, f.e)
-}
-func (_ fastpathT) EncMapUintStringV(v map[uint]string, checkNil bool, e *Encoder) {
- ee := e.e
- cr := e.cr
- if checkNil && v == nil {
- ee.EncodeNil()
- return
- }
- ee.EncodeMapStart(len(v))
- if e.h.Canonical {
- v2 := make([]uint64, len(v))
- var i int
- for k := range v {
- v2[i] = uint64(k)
- i++
- }
- sort.Sort(uintSlice(v2))
- for _, k2 := range v2 {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- ee.EncodeUint(uint64(uint(k2)))
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- ee.EncodeString(c_UTF8, v[uint(k2)])
- }
- } else {
- for k2, v2 := range v {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- ee.EncodeUint(uint64(k2))
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- ee.EncodeString(c_UTF8, v2)
- }
- }
- if cr != nil {
- cr.sendContainerState(containerMapEnd)
- }
-}
-
-func (f *encFnInfo) fastpathEncMapUintUintR(rv reflect.Value) {
- fastpathTV.EncMapUintUintV(rv.Interface().(map[uint]uint), fastpathCheckNilFalse, f.e)
-}
-func (_ fastpathT) EncMapUintUintV(v map[uint]uint, checkNil bool, e *Encoder) {
- ee := e.e
- cr := e.cr
- if checkNil && v == nil {
- ee.EncodeNil()
- return
- }
- ee.EncodeMapStart(len(v))
- if e.h.Canonical {
- v2 := make([]uint64, len(v))
- var i int
- for k := range v {
- v2[i] = uint64(k)
- i++
- }
- sort.Sort(uintSlice(v2))
- for _, k2 := range v2 {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- ee.EncodeUint(uint64(uint(k2)))
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- ee.EncodeUint(uint64(v[uint(k2)]))
- }
- } else {
- for k2, v2 := range v {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- ee.EncodeUint(uint64(k2))
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- ee.EncodeUint(uint64(v2))
- }
- }
- if cr != nil {
- cr.sendContainerState(containerMapEnd)
- }
-}
-
-func (f *encFnInfo) fastpathEncMapUintUint8R(rv reflect.Value) {
- fastpathTV.EncMapUintUint8V(rv.Interface().(map[uint]uint8), fastpathCheckNilFalse, f.e)
-}
-func (_ fastpathT) EncMapUintUint8V(v map[uint]uint8, checkNil bool, e *Encoder) {
- ee := e.e
- cr := e.cr
- if checkNil && v == nil {
- ee.EncodeNil()
- return
- }
- ee.EncodeMapStart(len(v))
- if e.h.Canonical {
- v2 := make([]uint64, len(v))
- var i int
- for k := range v {
- v2[i] = uint64(k)
- i++
- }
- sort.Sort(uintSlice(v2))
- for _, k2 := range v2 {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- ee.EncodeUint(uint64(uint(k2)))
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- ee.EncodeUint(uint64(v[uint(k2)]))
- }
- } else {
- for k2, v2 := range v {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- ee.EncodeUint(uint64(k2))
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- ee.EncodeUint(uint64(v2))
- }
- }
- if cr != nil {
- cr.sendContainerState(containerMapEnd)
- }
-}
-
-func (f *encFnInfo) fastpathEncMapUintUint16R(rv reflect.Value) {
- fastpathTV.EncMapUintUint16V(rv.Interface().(map[uint]uint16), fastpathCheckNilFalse, f.e)
-}
-func (_ fastpathT) EncMapUintUint16V(v map[uint]uint16, checkNil bool, e *Encoder) {
- ee := e.e
- cr := e.cr
- if checkNil && v == nil {
- ee.EncodeNil()
- return
- }
- ee.EncodeMapStart(len(v))
- if e.h.Canonical {
- v2 := make([]uint64, len(v))
- var i int
- for k := range v {
- v2[i] = uint64(k)
- i++
- }
- sort.Sort(uintSlice(v2))
- for _, k2 := range v2 {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- ee.EncodeUint(uint64(uint(k2)))
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- ee.EncodeUint(uint64(v[uint(k2)]))
- }
- } else {
- for k2, v2 := range v {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- ee.EncodeUint(uint64(k2))
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- ee.EncodeUint(uint64(v2))
- }
- }
- if cr != nil {
- cr.sendContainerState(containerMapEnd)
- }
-}
-
-func (f *encFnInfo) fastpathEncMapUintUint32R(rv reflect.Value) {
- fastpathTV.EncMapUintUint32V(rv.Interface().(map[uint]uint32), fastpathCheckNilFalse, f.e)
-}
-func (_ fastpathT) EncMapUintUint32V(v map[uint]uint32, checkNil bool, e *Encoder) {
- ee := e.e
- cr := e.cr
- if checkNil && v == nil {
- ee.EncodeNil()
- return
- }
- ee.EncodeMapStart(len(v))
- if e.h.Canonical {
- v2 := make([]uint64, len(v))
- var i int
- for k := range v {
- v2[i] = uint64(k)
- i++
- }
- sort.Sort(uintSlice(v2))
- for _, k2 := range v2 {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- ee.EncodeUint(uint64(uint(k2)))
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- ee.EncodeUint(uint64(v[uint(k2)]))
- }
- } else {
- for k2, v2 := range v {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- ee.EncodeUint(uint64(k2))
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- ee.EncodeUint(uint64(v2))
- }
- }
- if cr != nil {
- cr.sendContainerState(containerMapEnd)
- }
-}
-
-func (f *encFnInfo) fastpathEncMapUintUint64R(rv reflect.Value) {
- fastpathTV.EncMapUintUint64V(rv.Interface().(map[uint]uint64), fastpathCheckNilFalse, f.e)
-}
-func (_ fastpathT) EncMapUintUint64V(v map[uint]uint64, checkNil bool, e *Encoder) {
- ee := e.e
- cr := e.cr
- if checkNil && v == nil {
- ee.EncodeNil()
- return
- }
- ee.EncodeMapStart(len(v))
- if e.h.Canonical {
- v2 := make([]uint64, len(v))
- var i int
- for k := range v {
- v2[i] = uint64(k)
- i++
- }
- sort.Sort(uintSlice(v2))
- for _, k2 := range v2 {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- ee.EncodeUint(uint64(uint(k2)))
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- ee.EncodeUint(uint64(v[uint(k2)]))
- }
- } else {
- for k2, v2 := range v {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- ee.EncodeUint(uint64(k2))
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- ee.EncodeUint(uint64(v2))
- }
- }
- if cr != nil {
- cr.sendContainerState(containerMapEnd)
- }
-}
-
-func (f *encFnInfo) fastpathEncMapUintUintptrR(rv reflect.Value) {
- fastpathTV.EncMapUintUintptrV(rv.Interface().(map[uint]uintptr), fastpathCheckNilFalse, f.e)
-}
-func (_ fastpathT) EncMapUintUintptrV(v map[uint]uintptr, checkNil bool, e *Encoder) {
- ee := e.e
- cr := e.cr
- if checkNil && v == nil {
- ee.EncodeNil()
- return
- }
- ee.EncodeMapStart(len(v))
- if e.h.Canonical {
- v2 := make([]uint64, len(v))
- var i int
- for k := range v {
- v2[i] = uint64(k)
- i++
- }
- sort.Sort(uintSlice(v2))
- for _, k2 := range v2 {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- ee.EncodeUint(uint64(uint(k2)))
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- e.encode(v[uint(k2)])
- }
- } else {
- for k2, v2 := range v {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- ee.EncodeUint(uint64(k2))
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- e.encode(v2)
- }
- }
- if cr != nil {
- cr.sendContainerState(containerMapEnd)
- }
-}
-
-func (f *encFnInfo) fastpathEncMapUintIntR(rv reflect.Value) {
- fastpathTV.EncMapUintIntV(rv.Interface().(map[uint]int), fastpathCheckNilFalse, f.e)
-}
-func (_ fastpathT) EncMapUintIntV(v map[uint]int, checkNil bool, e *Encoder) {
- ee := e.e
- cr := e.cr
- if checkNil && v == nil {
- ee.EncodeNil()
- return
- }
- ee.EncodeMapStart(len(v))
- if e.h.Canonical {
- v2 := make([]uint64, len(v))
- var i int
- for k := range v {
- v2[i] = uint64(k)
- i++
- }
- sort.Sort(uintSlice(v2))
- for _, k2 := range v2 {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- ee.EncodeUint(uint64(uint(k2)))
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- ee.EncodeInt(int64(v[uint(k2)]))
- }
- } else {
- for k2, v2 := range v {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- ee.EncodeUint(uint64(k2))
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- ee.EncodeInt(int64(v2))
- }
- }
- if cr != nil {
- cr.sendContainerState(containerMapEnd)
- }
-}
-
-func (f *encFnInfo) fastpathEncMapUintInt8R(rv reflect.Value) {
- fastpathTV.EncMapUintInt8V(rv.Interface().(map[uint]int8), fastpathCheckNilFalse, f.e)
-}
-func (_ fastpathT) EncMapUintInt8V(v map[uint]int8, checkNil bool, e *Encoder) {
- ee := e.e
- cr := e.cr
- if checkNil && v == nil {
- ee.EncodeNil()
- return
- }
- ee.EncodeMapStart(len(v))
- if e.h.Canonical {
- v2 := make([]uint64, len(v))
- var i int
- for k := range v {
- v2[i] = uint64(k)
- i++
- }
- sort.Sort(uintSlice(v2))
- for _, k2 := range v2 {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- ee.EncodeUint(uint64(uint(k2)))
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- ee.EncodeInt(int64(v[uint(k2)]))
- }
- } else {
- for k2, v2 := range v {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- ee.EncodeUint(uint64(k2))
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- ee.EncodeInt(int64(v2))
- }
- }
- if cr != nil {
- cr.sendContainerState(containerMapEnd)
- }
-}
-
-func (f *encFnInfo) fastpathEncMapUintInt16R(rv reflect.Value) {
- fastpathTV.EncMapUintInt16V(rv.Interface().(map[uint]int16), fastpathCheckNilFalse, f.e)
-}
-func (_ fastpathT) EncMapUintInt16V(v map[uint]int16, checkNil bool, e *Encoder) {
- ee := e.e
- cr := e.cr
- if checkNil && v == nil {
- ee.EncodeNil()
- return
- }
- ee.EncodeMapStart(len(v))
- if e.h.Canonical {
- v2 := make([]uint64, len(v))
- var i int
- for k := range v {
- v2[i] = uint64(k)
- i++
- }
- sort.Sort(uintSlice(v2))
- for _, k2 := range v2 {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- ee.EncodeUint(uint64(uint(k2)))
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- ee.EncodeInt(int64(v[uint(k2)]))
- }
- } else {
- for k2, v2 := range v {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- ee.EncodeUint(uint64(k2))
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- ee.EncodeInt(int64(v2))
- }
- }
- if cr != nil {
- cr.sendContainerState(containerMapEnd)
- }
-}
-
-func (f *encFnInfo) fastpathEncMapUintInt32R(rv reflect.Value) {
- fastpathTV.EncMapUintInt32V(rv.Interface().(map[uint]int32), fastpathCheckNilFalse, f.e)
-}
-func (_ fastpathT) EncMapUintInt32V(v map[uint]int32, checkNil bool, e *Encoder) {
- ee := e.e
- cr := e.cr
- if checkNil && v == nil {
- ee.EncodeNil()
- return
- }
- ee.EncodeMapStart(len(v))
- if e.h.Canonical {
- v2 := make([]uint64, len(v))
- var i int
- for k := range v {
- v2[i] = uint64(k)
- i++
- }
- sort.Sort(uintSlice(v2))
- for _, k2 := range v2 {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- ee.EncodeUint(uint64(uint(k2)))
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- ee.EncodeInt(int64(v[uint(k2)]))
- }
- } else {
- for k2, v2 := range v {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- ee.EncodeUint(uint64(k2))
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- ee.EncodeInt(int64(v2))
- }
- }
- if cr != nil {
- cr.sendContainerState(containerMapEnd)
- }
-}
-
-func (f *encFnInfo) fastpathEncMapUintInt64R(rv reflect.Value) {
- fastpathTV.EncMapUintInt64V(rv.Interface().(map[uint]int64), fastpathCheckNilFalse, f.e)
-}
-func (_ fastpathT) EncMapUintInt64V(v map[uint]int64, checkNil bool, e *Encoder) {
- ee := e.e
- cr := e.cr
- if checkNil && v == nil {
- ee.EncodeNil()
- return
- }
- ee.EncodeMapStart(len(v))
- if e.h.Canonical {
- v2 := make([]uint64, len(v))
- var i int
- for k := range v {
- v2[i] = uint64(k)
- i++
- }
- sort.Sort(uintSlice(v2))
- for _, k2 := range v2 {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- ee.EncodeUint(uint64(uint(k2)))
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- ee.EncodeInt(int64(v[uint(k2)]))
- }
- } else {
- for k2, v2 := range v {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- ee.EncodeUint(uint64(k2))
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- ee.EncodeInt(int64(v2))
- }
- }
- if cr != nil {
- cr.sendContainerState(containerMapEnd)
- }
-}
-
-func (f *encFnInfo) fastpathEncMapUintFloat32R(rv reflect.Value) {
- fastpathTV.EncMapUintFloat32V(rv.Interface().(map[uint]float32), fastpathCheckNilFalse, f.e)
-}
-func (_ fastpathT) EncMapUintFloat32V(v map[uint]float32, checkNil bool, e *Encoder) {
- ee := e.e
- cr := e.cr
- if checkNil && v == nil {
- ee.EncodeNil()
- return
- }
- ee.EncodeMapStart(len(v))
- if e.h.Canonical {
- v2 := make([]uint64, len(v))
- var i int
- for k := range v {
- v2[i] = uint64(k)
- i++
- }
- sort.Sort(uintSlice(v2))
- for _, k2 := range v2 {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- ee.EncodeUint(uint64(uint(k2)))
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- ee.EncodeFloat32(v[uint(k2)])
- }
- } else {
- for k2, v2 := range v {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- ee.EncodeUint(uint64(k2))
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- ee.EncodeFloat32(v2)
- }
- }
- if cr != nil {
- cr.sendContainerState(containerMapEnd)
- }
-}
-
-func (f *encFnInfo) fastpathEncMapUintFloat64R(rv reflect.Value) {
- fastpathTV.EncMapUintFloat64V(rv.Interface().(map[uint]float64), fastpathCheckNilFalse, f.e)
-}
-func (_ fastpathT) EncMapUintFloat64V(v map[uint]float64, checkNil bool, e *Encoder) {
- ee := e.e
- cr := e.cr
- if checkNil && v == nil {
- ee.EncodeNil()
- return
- }
- ee.EncodeMapStart(len(v))
- if e.h.Canonical {
- v2 := make([]uint64, len(v))
- var i int
- for k := range v {
- v2[i] = uint64(k)
- i++
- }
- sort.Sort(uintSlice(v2))
- for _, k2 := range v2 {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- ee.EncodeUint(uint64(uint(k2)))
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- ee.EncodeFloat64(v[uint(k2)])
- }
- } else {
- for k2, v2 := range v {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- ee.EncodeUint(uint64(k2))
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- ee.EncodeFloat64(v2)
- }
- }
- if cr != nil {
- cr.sendContainerState(containerMapEnd)
- }
-}
-
-func (f *encFnInfo) fastpathEncMapUintBoolR(rv reflect.Value) {
- fastpathTV.EncMapUintBoolV(rv.Interface().(map[uint]bool), fastpathCheckNilFalse, f.e)
-}
-func (_ fastpathT) EncMapUintBoolV(v map[uint]bool, checkNil bool, e *Encoder) {
- ee := e.e
- cr := e.cr
- if checkNil && v == nil {
- ee.EncodeNil()
- return
- }
- ee.EncodeMapStart(len(v))
- if e.h.Canonical {
- v2 := make([]uint64, len(v))
- var i int
- for k := range v {
- v2[i] = uint64(k)
- i++
- }
- sort.Sort(uintSlice(v2))
- for _, k2 := range v2 {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- ee.EncodeUint(uint64(uint(k2)))
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- ee.EncodeBool(v[uint(k2)])
- }
- } else {
- for k2, v2 := range v {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- ee.EncodeUint(uint64(k2))
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- ee.EncodeBool(v2)
- }
- }
- if cr != nil {
- cr.sendContainerState(containerMapEnd)
- }
-}
-
-func (f *encFnInfo) fastpathEncMapUint8IntfR(rv reflect.Value) {
- fastpathTV.EncMapUint8IntfV(rv.Interface().(map[uint8]interface{}), fastpathCheckNilFalse, f.e)
-}
-func (_ fastpathT) EncMapUint8IntfV(v map[uint8]interface{}, checkNil bool, e *Encoder) {
- ee := e.e
- cr := e.cr
- if checkNil && v == nil {
- ee.EncodeNil()
- return
- }
- ee.EncodeMapStart(len(v))
- if e.h.Canonical {
- v2 := make([]uint64, len(v))
- var i int
- for k := range v {
- v2[i] = uint64(k)
- i++
- }
- sort.Sort(uintSlice(v2))
- for _, k2 := range v2 {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- ee.EncodeUint(uint64(uint8(k2)))
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- e.encode(v[uint8(k2)])
- }
- } else {
- for k2, v2 := range v {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- ee.EncodeUint(uint64(k2))
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- e.encode(v2)
- }
- }
- if cr != nil {
- cr.sendContainerState(containerMapEnd)
- }
-}
-
-func (f *encFnInfo) fastpathEncMapUint8StringR(rv reflect.Value) {
- fastpathTV.EncMapUint8StringV(rv.Interface().(map[uint8]string), fastpathCheckNilFalse, f.e)
-}
-func (_ fastpathT) EncMapUint8StringV(v map[uint8]string, checkNil bool, e *Encoder) {
- ee := e.e
- cr := e.cr
- if checkNil && v == nil {
- ee.EncodeNil()
- return
- }
- ee.EncodeMapStart(len(v))
- if e.h.Canonical {
- v2 := make([]uint64, len(v))
- var i int
- for k := range v {
- v2[i] = uint64(k)
- i++
- }
- sort.Sort(uintSlice(v2))
- for _, k2 := range v2 {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- ee.EncodeUint(uint64(uint8(k2)))
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- ee.EncodeString(c_UTF8, v[uint8(k2)])
- }
- } else {
- for k2, v2 := range v {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- ee.EncodeUint(uint64(k2))
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- ee.EncodeString(c_UTF8, v2)
- }
- }
- if cr != nil {
- cr.sendContainerState(containerMapEnd)
- }
-}
-
-func (f *encFnInfo) fastpathEncMapUint8UintR(rv reflect.Value) {
- fastpathTV.EncMapUint8UintV(rv.Interface().(map[uint8]uint), fastpathCheckNilFalse, f.e)
-}
-func (_ fastpathT) EncMapUint8UintV(v map[uint8]uint, checkNil bool, e *Encoder) {
- ee := e.e
- cr := e.cr
- if checkNil && v == nil {
- ee.EncodeNil()
- return
- }
- ee.EncodeMapStart(len(v))
- if e.h.Canonical {
- v2 := make([]uint64, len(v))
- var i int
- for k := range v {
- v2[i] = uint64(k)
- i++
- }
- sort.Sort(uintSlice(v2))
- for _, k2 := range v2 {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- ee.EncodeUint(uint64(uint8(k2)))
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- ee.EncodeUint(uint64(v[uint8(k2)]))
- }
- } else {
- for k2, v2 := range v {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- ee.EncodeUint(uint64(k2))
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- ee.EncodeUint(uint64(v2))
- }
- }
- if cr != nil {
- cr.sendContainerState(containerMapEnd)
- }
-}
-
-func (f *encFnInfo) fastpathEncMapUint8Uint8R(rv reflect.Value) {
- fastpathTV.EncMapUint8Uint8V(rv.Interface().(map[uint8]uint8), fastpathCheckNilFalse, f.e)
-}
-func (_ fastpathT) EncMapUint8Uint8V(v map[uint8]uint8, checkNil bool, e *Encoder) {
- ee := e.e
- cr := e.cr
- if checkNil && v == nil {
- ee.EncodeNil()
- return
- }
- ee.EncodeMapStart(len(v))
- if e.h.Canonical {
- v2 := make([]uint64, len(v))
- var i int
- for k := range v {
- v2[i] = uint64(k)
- i++
- }
- sort.Sort(uintSlice(v2))
- for _, k2 := range v2 {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- ee.EncodeUint(uint64(uint8(k2)))
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- ee.EncodeUint(uint64(v[uint8(k2)]))
- }
- } else {
- for k2, v2 := range v {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- ee.EncodeUint(uint64(k2))
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- ee.EncodeUint(uint64(v2))
- }
- }
- if cr != nil {
- cr.sendContainerState(containerMapEnd)
- }
-}
-
-func (f *encFnInfo) fastpathEncMapUint8Uint16R(rv reflect.Value) {
- fastpathTV.EncMapUint8Uint16V(rv.Interface().(map[uint8]uint16), fastpathCheckNilFalse, f.e)
-}
-func (_ fastpathT) EncMapUint8Uint16V(v map[uint8]uint16, checkNil bool, e *Encoder) {
- ee := e.e
- cr := e.cr
- if checkNil && v == nil {
- ee.EncodeNil()
- return
- }
- ee.EncodeMapStart(len(v))
- if e.h.Canonical {
- v2 := make([]uint64, len(v))
- var i int
- for k := range v {
- v2[i] = uint64(k)
- i++
- }
- sort.Sort(uintSlice(v2))
- for _, k2 := range v2 {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- ee.EncodeUint(uint64(uint8(k2)))
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- ee.EncodeUint(uint64(v[uint8(k2)]))
- }
- } else {
- for k2, v2 := range v {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- ee.EncodeUint(uint64(k2))
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- ee.EncodeUint(uint64(v2))
- }
- }
- if cr != nil {
- cr.sendContainerState(containerMapEnd)
- }
-}
-
-func (f *encFnInfo) fastpathEncMapUint8Uint32R(rv reflect.Value) {
- fastpathTV.EncMapUint8Uint32V(rv.Interface().(map[uint8]uint32), fastpathCheckNilFalse, f.e)
-}
-func (_ fastpathT) EncMapUint8Uint32V(v map[uint8]uint32, checkNil bool, e *Encoder) {
- ee := e.e
- cr := e.cr
- if checkNil && v == nil {
- ee.EncodeNil()
- return
- }
- ee.EncodeMapStart(len(v))
- if e.h.Canonical {
- v2 := make([]uint64, len(v))
- var i int
- for k := range v {
- v2[i] = uint64(k)
- i++
- }
- sort.Sort(uintSlice(v2))
- for _, k2 := range v2 {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- ee.EncodeUint(uint64(uint8(k2)))
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- ee.EncodeUint(uint64(v[uint8(k2)]))
- }
- } else {
- for k2, v2 := range v {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- ee.EncodeUint(uint64(k2))
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- ee.EncodeUint(uint64(v2))
- }
- }
- if cr != nil {
- cr.sendContainerState(containerMapEnd)
- }
-}
-
-func (f *encFnInfo) fastpathEncMapUint8Uint64R(rv reflect.Value) {
- fastpathTV.EncMapUint8Uint64V(rv.Interface().(map[uint8]uint64), fastpathCheckNilFalse, f.e)
-}
-func (_ fastpathT) EncMapUint8Uint64V(v map[uint8]uint64, checkNil bool, e *Encoder) {
- ee := e.e
- cr := e.cr
- if checkNil && v == nil {
- ee.EncodeNil()
- return
- }
- ee.EncodeMapStart(len(v))
- if e.h.Canonical {
- v2 := make([]uint64, len(v))
- var i int
- for k := range v {
- v2[i] = uint64(k)
- i++
- }
- sort.Sort(uintSlice(v2))
- for _, k2 := range v2 {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- ee.EncodeUint(uint64(uint8(k2)))
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- ee.EncodeUint(uint64(v[uint8(k2)]))
- }
- } else {
- for k2, v2 := range v {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- ee.EncodeUint(uint64(k2))
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- ee.EncodeUint(uint64(v2))
- }
- }
- if cr != nil {
- cr.sendContainerState(containerMapEnd)
- }
-}
-
-func (f *encFnInfo) fastpathEncMapUint8UintptrR(rv reflect.Value) {
- fastpathTV.EncMapUint8UintptrV(rv.Interface().(map[uint8]uintptr), fastpathCheckNilFalse, f.e)
-}
-func (_ fastpathT) EncMapUint8UintptrV(v map[uint8]uintptr, checkNil bool, e *Encoder) {
- ee := e.e
- cr := e.cr
- if checkNil && v == nil {
- ee.EncodeNil()
- return
- }
- ee.EncodeMapStart(len(v))
- if e.h.Canonical {
- v2 := make([]uint64, len(v))
- var i int
- for k := range v {
- v2[i] = uint64(k)
- i++
- }
- sort.Sort(uintSlice(v2))
- for _, k2 := range v2 {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- ee.EncodeUint(uint64(uint8(k2)))
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- e.encode(v[uint8(k2)])
- }
- } else {
- for k2, v2 := range v {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- ee.EncodeUint(uint64(k2))
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- e.encode(v2)
- }
- }
- if cr != nil {
- cr.sendContainerState(containerMapEnd)
- }
-}
-
-func (f *encFnInfo) fastpathEncMapUint8IntR(rv reflect.Value) {
- fastpathTV.EncMapUint8IntV(rv.Interface().(map[uint8]int), fastpathCheckNilFalse, f.e)
-}
-func (_ fastpathT) EncMapUint8IntV(v map[uint8]int, checkNil bool, e *Encoder) {
- ee := e.e
- cr := e.cr
- if checkNil && v == nil {
- ee.EncodeNil()
- return
- }
- ee.EncodeMapStart(len(v))
- if e.h.Canonical {
- v2 := make([]uint64, len(v))
- var i int
- for k := range v {
- v2[i] = uint64(k)
- i++
- }
- sort.Sort(uintSlice(v2))
- for _, k2 := range v2 {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- ee.EncodeUint(uint64(uint8(k2)))
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- ee.EncodeInt(int64(v[uint8(k2)]))
- }
- } else {
- for k2, v2 := range v {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- ee.EncodeUint(uint64(k2))
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- ee.EncodeInt(int64(v2))
- }
- }
- if cr != nil {
- cr.sendContainerState(containerMapEnd)
- }
-}
-
-func (f *encFnInfo) fastpathEncMapUint8Int8R(rv reflect.Value) {
- fastpathTV.EncMapUint8Int8V(rv.Interface().(map[uint8]int8), fastpathCheckNilFalse, f.e)
-}
-func (_ fastpathT) EncMapUint8Int8V(v map[uint8]int8, checkNil bool, e *Encoder) {
- ee := e.e
- cr := e.cr
- if checkNil && v == nil {
- ee.EncodeNil()
- return
- }
- ee.EncodeMapStart(len(v))
- if e.h.Canonical {
- v2 := make([]uint64, len(v))
- var i int
- for k := range v {
- v2[i] = uint64(k)
- i++
- }
- sort.Sort(uintSlice(v2))
- for _, k2 := range v2 {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- ee.EncodeUint(uint64(uint8(k2)))
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- ee.EncodeInt(int64(v[uint8(k2)]))
- }
- } else {
- for k2, v2 := range v {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- ee.EncodeUint(uint64(k2))
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- ee.EncodeInt(int64(v2))
- }
- }
- if cr != nil {
- cr.sendContainerState(containerMapEnd)
- }
-}
-
-func (f *encFnInfo) fastpathEncMapUint8Int16R(rv reflect.Value) {
- fastpathTV.EncMapUint8Int16V(rv.Interface().(map[uint8]int16), fastpathCheckNilFalse, f.e)
-}
-func (_ fastpathT) EncMapUint8Int16V(v map[uint8]int16, checkNil bool, e *Encoder) {
- ee := e.e
- cr := e.cr
- if checkNil && v == nil {
- ee.EncodeNil()
- return
- }
- ee.EncodeMapStart(len(v))
- if e.h.Canonical {
- v2 := make([]uint64, len(v))
- var i int
- for k := range v {
- v2[i] = uint64(k)
- i++
- }
- sort.Sort(uintSlice(v2))
- for _, k2 := range v2 {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- ee.EncodeUint(uint64(uint8(k2)))
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- ee.EncodeInt(int64(v[uint8(k2)]))
- }
- } else {
- for k2, v2 := range v {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- ee.EncodeUint(uint64(k2))
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- ee.EncodeInt(int64(v2))
- }
- }
- if cr != nil {
- cr.sendContainerState(containerMapEnd)
- }
-}
-
-func (f *encFnInfo) fastpathEncMapUint8Int32R(rv reflect.Value) {
- fastpathTV.EncMapUint8Int32V(rv.Interface().(map[uint8]int32), fastpathCheckNilFalse, f.e)
-}
-func (_ fastpathT) EncMapUint8Int32V(v map[uint8]int32, checkNil bool, e *Encoder) {
- ee := e.e
- cr := e.cr
- if checkNil && v == nil {
- ee.EncodeNil()
- return
- }
- ee.EncodeMapStart(len(v))
- if e.h.Canonical {
- v2 := make([]uint64, len(v))
- var i int
- for k := range v {
- v2[i] = uint64(k)
- i++
- }
- sort.Sort(uintSlice(v2))
- for _, k2 := range v2 {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- ee.EncodeUint(uint64(uint8(k2)))
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- ee.EncodeInt(int64(v[uint8(k2)]))
- }
- } else {
- for k2, v2 := range v {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- ee.EncodeUint(uint64(k2))
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- ee.EncodeInt(int64(v2))
- }
- }
- if cr != nil {
- cr.sendContainerState(containerMapEnd)
- }
-}
-
-func (f *encFnInfo) fastpathEncMapUint8Int64R(rv reflect.Value) {
- fastpathTV.EncMapUint8Int64V(rv.Interface().(map[uint8]int64), fastpathCheckNilFalse, f.e)
-}
-func (_ fastpathT) EncMapUint8Int64V(v map[uint8]int64, checkNil bool, e *Encoder) {
- ee := e.e
- cr := e.cr
- if checkNil && v == nil {
- ee.EncodeNil()
- return
- }
- ee.EncodeMapStart(len(v))
- if e.h.Canonical {
- v2 := make([]uint64, len(v))
- var i int
- for k := range v {
- v2[i] = uint64(k)
- i++
- }
- sort.Sort(uintSlice(v2))
- for _, k2 := range v2 {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- ee.EncodeUint(uint64(uint8(k2)))
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- ee.EncodeInt(int64(v[uint8(k2)]))
- }
- } else {
- for k2, v2 := range v {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- ee.EncodeUint(uint64(k2))
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- ee.EncodeInt(int64(v2))
- }
- }
- if cr != nil {
- cr.sendContainerState(containerMapEnd)
- }
-}
-
-func (f *encFnInfo) fastpathEncMapUint8Float32R(rv reflect.Value) {
- fastpathTV.EncMapUint8Float32V(rv.Interface().(map[uint8]float32), fastpathCheckNilFalse, f.e)
-}
-func (_ fastpathT) EncMapUint8Float32V(v map[uint8]float32, checkNil bool, e *Encoder) {
- ee := e.e
- cr := e.cr
- if checkNil && v == nil {
- ee.EncodeNil()
- return
- }
- ee.EncodeMapStart(len(v))
- if e.h.Canonical {
- v2 := make([]uint64, len(v))
- var i int
- for k := range v {
- v2[i] = uint64(k)
- i++
- }
- sort.Sort(uintSlice(v2))
- for _, k2 := range v2 {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- ee.EncodeUint(uint64(uint8(k2)))
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- ee.EncodeFloat32(v[uint8(k2)])
- }
- } else {
- for k2, v2 := range v {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- ee.EncodeUint(uint64(k2))
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- ee.EncodeFloat32(v2)
- }
- }
- if cr != nil {
- cr.sendContainerState(containerMapEnd)
- }
-}
-
-func (f *encFnInfo) fastpathEncMapUint8Float64R(rv reflect.Value) {
- fastpathTV.EncMapUint8Float64V(rv.Interface().(map[uint8]float64), fastpathCheckNilFalse, f.e)
-}
-func (_ fastpathT) EncMapUint8Float64V(v map[uint8]float64, checkNil bool, e *Encoder) {
- ee := e.e
- cr := e.cr
- if checkNil && v == nil {
- ee.EncodeNil()
- return
- }
- ee.EncodeMapStart(len(v))
- if e.h.Canonical {
- v2 := make([]uint64, len(v))
- var i int
- for k := range v {
- v2[i] = uint64(k)
- i++
- }
- sort.Sort(uintSlice(v2))
- for _, k2 := range v2 {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- ee.EncodeUint(uint64(uint8(k2)))
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- ee.EncodeFloat64(v[uint8(k2)])
- }
- } else {
- for k2, v2 := range v {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- ee.EncodeUint(uint64(k2))
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- ee.EncodeFloat64(v2)
- }
- }
- if cr != nil {
- cr.sendContainerState(containerMapEnd)
- }
-}
-
-func (f *encFnInfo) fastpathEncMapUint8BoolR(rv reflect.Value) {
- fastpathTV.EncMapUint8BoolV(rv.Interface().(map[uint8]bool), fastpathCheckNilFalse, f.e)
-}
-func (_ fastpathT) EncMapUint8BoolV(v map[uint8]bool, checkNil bool, e *Encoder) {
- ee := e.e
- cr := e.cr
- if checkNil && v == nil {
- ee.EncodeNil()
- return
- }
- ee.EncodeMapStart(len(v))
- if e.h.Canonical {
- v2 := make([]uint64, len(v))
- var i int
- for k := range v {
- v2[i] = uint64(k)
- i++
- }
- sort.Sort(uintSlice(v2))
- for _, k2 := range v2 {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- ee.EncodeUint(uint64(uint8(k2)))
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- ee.EncodeBool(v[uint8(k2)])
- }
- } else {
- for k2, v2 := range v {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- ee.EncodeUint(uint64(k2))
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- ee.EncodeBool(v2)
- }
- }
- if cr != nil {
- cr.sendContainerState(containerMapEnd)
- }
-}
-
-func (f *encFnInfo) fastpathEncMapUint16IntfR(rv reflect.Value) {
- fastpathTV.EncMapUint16IntfV(rv.Interface().(map[uint16]interface{}), fastpathCheckNilFalse, f.e)
-}
-func (_ fastpathT) EncMapUint16IntfV(v map[uint16]interface{}, checkNil bool, e *Encoder) {
- ee := e.e
- cr := e.cr
- if checkNil && v == nil {
- ee.EncodeNil()
- return
- }
- ee.EncodeMapStart(len(v))
- if e.h.Canonical {
- v2 := make([]uint64, len(v))
- var i int
- for k := range v {
- v2[i] = uint64(k)
- i++
- }
- sort.Sort(uintSlice(v2))
- for _, k2 := range v2 {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- ee.EncodeUint(uint64(uint16(k2)))
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- e.encode(v[uint16(k2)])
- }
- } else {
- for k2, v2 := range v {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- ee.EncodeUint(uint64(k2))
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- e.encode(v2)
- }
- }
- if cr != nil {
- cr.sendContainerState(containerMapEnd)
- }
-}
-
-func (f *encFnInfo) fastpathEncMapUint16StringR(rv reflect.Value) {
- fastpathTV.EncMapUint16StringV(rv.Interface().(map[uint16]string), fastpathCheckNilFalse, f.e)
-}
-func (_ fastpathT) EncMapUint16StringV(v map[uint16]string, checkNil bool, e *Encoder) {
- ee := e.e
- cr := e.cr
- if checkNil && v == nil {
- ee.EncodeNil()
- return
- }
- ee.EncodeMapStart(len(v))
- if e.h.Canonical {
- v2 := make([]uint64, len(v))
- var i int
- for k := range v {
- v2[i] = uint64(k)
- i++
- }
- sort.Sort(uintSlice(v2))
- for _, k2 := range v2 {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- ee.EncodeUint(uint64(uint16(k2)))
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- ee.EncodeString(c_UTF8, v[uint16(k2)])
- }
- } else {
- for k2, v2 := range v {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- ee.EncodeUint(uint64(k2))
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- ee.EncodeString(c_UTF8, v2)
- }
- }
- if cr != nil {
- cr.sendContainerState(containerMapEnd)
- }
-}
-
-func (f *encFnInfo) fastpathEncMapUint16UintR(rv reflect.Value) {
- fastpathTV.EncMapUint16UintV(rv.Interface().(map[uint16]uint), fastpathCheckNilFalse, f.e)
-}
-func (_ fastpathT) EncMapUint16UintV(v map[uint16]uint, checkNil bool, e *Encoder) {
- ee := e.e
- cr := e.cr
- if checkNil && v == nil {
- ee.EncodeNil()
- return
- }
- ee.EncodeMapStart(len(v))
- if e.h.Canonical {
- v2 := make([]uint64, len(v))
- var i int
- for k := range v {
- v2[i] = uint64(k)
- i++
- }
- sort.Sort(uintSlice(v2))
- for _, k2 := range v2 {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- ee.EncodeUint(uint64(uint16(k2)))
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- ee.EncodeUint(uint64(v[uint16(k2)]))
- }
- } else {
- for k2, v2 := range v {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- ee.EncodeUint(uint64(k2))
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- ee.EncodeUint(uint64(v2))
- }
- }
- if cr != nil {
- cr.sendContainerState(containerMapEnd)
- }
-}
-
-func (f *encFnInfo) fastpathEncMapUint16Uint8R(rv reflect.Value) {
- fastpathTV.EncMapUint16Uint8V(rv.Interface().(map[uint16]uint8), fastpathCheckNilFalse, f.e)
-}
-func (_ fastpathT) EncMapUint16Uint8V(v map[uint16]uint8, checkNil bool, e *Encoder) {
- ee := e.e
- cr := e.cr
- if checkNil && v == nil {
- ee.EncodeNil()
- return
- }
- ee.EncodeMapStart(len(v))
- if e.h.Canonical {
- v2 := make([]uint64, len(v))
- var i int
- for k := range v {
- v2[i] = uint64(k)
- i++
- }
- sort.Sort(uintSlice(v2))
- for _, k2 := range v2 {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- ee.EncodeUint(uint64(uint16(k2)))
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- ee.EncodeUint(uint64(v[uint16(k2)]))
- }
- } else {
- for k2, v2 := range v {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- ee.EncodeUint(uint64(k2))
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- ee.EncodeUint(uint64(v2))
- }
- }
- if cr != nil {
- cr.sendContainerState(containerMapEnd)
- }
-}
-
-func (f *encFnInfo) fastpathEncMapUint16Uint16R(rv reflect.Value) {
- fastpathTV.EncMapUint16Uint16V(rv.Interface().(map[uint16]uint16), fastpathCheckNilFalse, f.e)
-}
-func (_ fastpathT) EncMapUint16Uint16V(v map[uint16]uint16, checkNil bool, e *Encoder) {
- ee := e.e
- cr := e.cr
- if checkNil && v == nil {
- ee.EncodeNil()
- return
- }
- ee.EncodeMapStart(len(v))
- if e.h.Canonical {
- v2 := make([]uint64, len(v))
- var i int
- for k := range v {
- v2[i] = uint64(k)
- i++
- }
- sort.Sort(uintSlice(v2))
- for _, k2 := range v2 {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- ee.EncodeUint(uint64(uint16(k2)))
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- ee.EncodeUint(uint64(v[uint16(k2)]))
- }
- } else {
- for k2, v2 := range v {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- ee.EncodeUint(uint64(k2))
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- ee.EncodeUint(uint64(v2))
- }
- }
- if cr != nil {
- cr.sendContainerState(containerMapEnd)
- }
-}
-
-func (f *encFnInfo) fastpathEncMapUint16Uint32R(rv reflect.Value) {
- fastpathTV.EncMapUint16Uint32V(rv.Interface().(map[uint16]uint32), fastpathCheckNilFalse, f.e)
-}
-func (_ fastpathT) EncMapUint16Uint32V(v map[uint16]uint32, checkNil bool, e *Encoder) {
- ee := e.e
- cr := e.cr
- if checkNil && v == nil {
- ee.EncodeNil()
- return
- }
- ee.EncodeMapStart(len(v))
- if e.h.Canonical {
- v2 := make([]uint64, len(v))
- var i int
- for k := range v {
- v2[i] = uint64(k)
- i++
- }
- sort.Sort(uintSlice(v2))
- for _, k2 := range v2 {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- ee.EncodeUint(uint64(uint16(k2)))
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- ee.EncodeUint(uint64(v[uint16(k2)]))
- }
- } else {
- for k2, v2 := range v {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- ee.EncodeUint(uint64(k2))
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- ee.EncodeUint(uint64(v2))
- }
- }
- if cr != nil {
- cr.sendContainerState(containerMapEnd)
- }
-}
-
-func (f *encFnInfo) fastpathEncMapUint16Uint64R(rv reflect.Value) {
- fastpathTV.EncMapUint16Uint64V(rv.Interface().(map[uint16]uint64), fastpathCheckNilFalse, f.e)
-}
-func (_ fastpathT) EncMapUint16Uint64V(v map[uint16]uint64, checkNil bool, e *Encoder) {
- ee := e.e
- cr := e.cr
- if checkNil && v == nil {
- ee.EncodeNil()
- return
- }
- ee.EncodeMapStart(len(v))
- if e.h.Canonical {
- v2 := make([]uint64, len(v))
- var i int
- for k := range v {
- v2[i] = uint64(k)
- i++
- }
- sort.Sort(uintSlice(v2))
- for _, k2 := range v2 {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- ee.EncodeUint(uint64(uint16(k2)))
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- ee.EncodeUint(uint64(v[uint16(k2)]))
- }
- } else {
- for k2, v2 := range v {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- ee.EncodeUint(uint64(k2))
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- ee.EncodeUint(uint64(v2))
- }
- }
- if cr != nil {
- cr.sendContainerState(containerMapEnd)
- }
-}
-
-func (f *encFnInfo) fastpathEncMapUint16UintptrR(rv reflect.Value) {
- fastpathTV.EncMapUint16UintptrV(rv.Interface().(map[uint16]uintptr), fastpathCheckNilFalse, f.e)
-}
-func (_ fastpathT) EncMapUint16UintptrV(v map[uint16]uintptr, checkNil bool, e *Encoder) {
- ee := e.e
- cr := e.cr
- if checkNil && v == nil {
- ee.EncodeNil()
- return
- }
- ee.EncodeMapStart(len(v))
- if e.h.Canonical {
- v2 := make([]uint64, len(v))
- var i int
- for k := range v {
- v2[i] = uint64(k)
- i++
- }
- sort.Sort(uintSlice(v2))
- for _, k2 := range v2 {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- ee.EncodeUint(uint64(uint16(k2)))
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- e.encode(v[uint16(k2)])
- }
- } else {
- for k2, v2 := range v {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- ee.EncodeUint(uint64(k2))
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- e.encode(v2)
- }
- }
- if cr != nil {
- cr.sendContainerState(containerMapEnd)
- }
-}
-
-func (f *encFnInfo) fastpathEncMapUint16IntR(rv reflect.Value) {
- fastpathTV.EncMapUint16IntV(rv.Interface().(map[uint16]int), fastpathCheckNilFalse, f.e)
-}
-func (_ fastpathT) EncMapUint16IntV(v map[uint16]int, checkNil bool, e *Encoder) {
- ee := e.e
- cr := e.cr
- if checkNil && v == nil {
- ee.EncodeNil()
- return
- }
- ee.EncodeMapStart(len(v))
- if e.h.Canonical {
- v2 := make([]uint64, len(v))
- var i int
- for k := range v {
- v2[i] = uint64(k)
- i++
- }
- sort.Sort(uintSlice(v2))
- for _, k2 := range v2 {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- ee.EncodeUint(uint64(uint16(k2)))
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- ee.EncodeInt(int64(v[uint16(k2)]))
- }
- } else {
- for k2, v2 := range v {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- ee.EncodeUint(uint64(k2))
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- ee.EncodeInt(int64(v2))
- }
- }
- if cr != nil {
- cr.sendContainerState(containerMapEnd)
- }
-}
-
-func (f *encFnInfo) fastpathEncMapUint16Int8R(rv reflect.Value) {
- fastpathTV.EncMapUint16Int8V(rv.Interface().(map[uint16]int8), fastpathCheckNilFalse, f.e)
-}
-func (_ fastpathT) EncMapUint16Int8V(v map[uint16]int8, checkNil bool, e *Encoder) {
- ee := e.e
- cr := e.cr
- if checkNil && v == nil {
- ee.EncodeNil()
- return
- }
- ee.EncodeMapStart(len(v))
- if e.h.Canonical {
- v2 := make([]uint64, len(v))
- var i int
- for k := range v {
- v2[i] = uint64(k)
- i++
- }
- sort.Sort(uintSlice(v2))
- for _, k2 := range v2 {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- ee.EncodeUint(uint64(uint16(k2)))
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- ee.EncodeInt(int64(v[uint16(k2)]))
- }
- } else {
- for k2, v2 := range v {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- ee.EncodeUint(uint64(k2))
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- ee.EncodeInt(int64(v2))
- }
- }
- if cr != nil {
- cr.sendContainerState(containerMapEnd)
- }
-}
-
-func (f *encFnInfo) fastpathEncMapUint16Int16R(rv reflect.Value) {
- fastpathTV.EncMapUint16Int16V(rv.Interface().(map[uint16]int16), fastpathCheckNilFalse, f.e)
-}
-func (_ fastpathT) EncMapUint16Int16V(v map[uint16]int16, checkNil bool, e *Encoder) {
- ee := e.e
- cr := e.cr
- if checkNil && v == nil {
- ee.EncodeNil()
- return
- }
- ee.EncodeMapStart(len(v))
- if e.h.Canonical {
- v2 := make([]uint64, len(v))
- var i int
- for k := range v {
- v2[i] = uint64(k)
- i++
- }
- sort.Sort(uintSlice(v2))
- for _, k2 := range v2 {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- ee.EncodeUint(uint64(uint16(k2)))
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- ee.EncodeInt(int64(v[uint16(k2)]))
- }
- } else {
- for k2, v2 := range v {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- ee.EncodeUint(uint64(k2))
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- ee.EncodeInt(int64(v2))
- }
- }
- if cr != nil {
- cr.sendContainerState(containerMapEnd)
- }
-}
-
-func (f *encFnInfo) fastpathEncMapUint16Int32R(rv reflect.Value) {
- fastpathTV.EncMapUint16Int32V(rv.Interface().(map[uint16]int32), fastpathCheckNilFalse, f.e)
-}
-func (_ fastpathT) EncMapUint16Int32V(v map[uint16]int32, checkNil bool, e *Encoder) {
- ee := e.e
- cr := e.cr
- if checkNil && v == nil {
- ee.EncodeNil()
- return
- }
- ee.EncodeMapStart(len(v))
- if e.h.Canonical {
- v2 := make([]uint64, len(v))
- var i int
- for k := range v {
- v2[i] = uint64(k)
- i++
- }
- sort.Sort(uintSlice(v2))
- for _, k2 := range v2 {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- ee.EncodeUint(uint64(uint16(k2)))
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- ee.EncodeInt(int64(v[uint16(k2)]))
- }
- } else {
- for k2, v2 := range v {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- ee.EncodeUint(uint64(k2))
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- ee.EncodeInt(int64(v2))
- }
- }
- if cr != nil {
- cr.sendContainerState(containerMapEnd)
- }
-}
-
-func (f *encFnInfo) fastpathEncMapUint16Int64R(rv reflect.Value) {
- fastpathTV.EncMapUint16Int64V(rv.Interface().(map[uint16]int64), fastpathCheckNilFalse, f.e)
-}
-func (_ fastpathT) EncMapUint16Int64V(v map[uint16]int64, checkNil bool, e *Encoder) {
- ee := e.e
- cr := e.cr
- if checkNil && v == nil {
- ee.EncodeNil()
- return
- }
- ee.EncodeMapStart(len(v))
- if e.h.Canonical {
- v2 := make([]uint64, len(v))
- var i int
- for k := range v {
- v2[i] = uint64(k)
- i++
- }
- sort.Sort(uintSlice(v2))
- for _, k2 := range v2 {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- ee.EncodeUint(uint64(uint16(k2)))
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- ee.EncodeInt(int64(v[uint16(k2)]))
- }
- } else {
- for k2, v2 := range v {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- ee.EncodeUint(uint64(k2))
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- ee.EncodeInt(int64(v2))
- }
- }
- if cr != nil {
- cr.sendContainerState(containerMapEnd)
- }
-}
-
-func (f *encFnInfo) fastpathEncMapUint16Float32R(rv reflect.Value) {
- fastpathTV.EncMapUint16Float32V(rv.Interface().(map[uint16]float32), fastpathCheckNilFalse, f.e)
-}
-func (_ fastpathT) EncMapUint16Float32V(v map[uint16]float32, checkNil bool, e *Encoder) {
- ee := e.e
- cr := e.cr
- if checkNil && v == nil {
- ee.EncodeNil()
- return
- }
- ee.EncodeMapStart(len(v))
- if e.h.Canonical {
- v2 := make([]uint64, len(v))
- var i int
- for k := range v {
- v2[i] = uint64(k)
- i++
- }
- sort.Sort(uintSlice(v2))
- for _, k2 := range v2 {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- ee.EncodeUint(uint64(uint16(k2)))
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- ee.EncodeFloat32(v[uint16(k2)])
- }
- } else {
- for k2, v2 := range v {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- ee.EncodeUint(uint64(k2))
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- ee.EncodeFloat32(v2)
- }
- }
- if cr != nil {
- cr.sendContainerState(containerMapEnd)
- }
-}
-
-func (f *encFnInfo) fastpathEncMapUint16Float64R(rv reflect.Value) {
- fastpathTV.EncMapUint16Float64V(rv.Interface().(map[uint16]float64), fastpathCheckNilFalse, f.e)
-}
-func (_ fastpathT) EncMapUint16Float64V(v map[uint16]float64, checkNil bool, e *Encoder) {
- ee := e.e
- cr := e.cr
- if checkNil && v == nil {
- ee.EncodeNil()
- return
- }
- ee.EncodeMapStart(len(v))
- if e.h.Canonical {
- v2 := make([]uint64, len(v))
- var i int
- for k := range v {
- v2[i] = uint64(k)
- i++
- }
- sort.Sort(uintSlice(v2))
- for _, k2 := range v2 {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- ee.EncodeUint(uint64(uint16(k2)))
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- ee.EncodeFloat64(v[uint16(k2)])
- }
- } else {
- for k2, v2 := range v {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- ee.EncodeUint(uint64(k2))
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- ee.EncodeFloat64(v2)
- }
- }
- if cr != nil {
- cr.sendContainerState(containerMapEnd)
- }
-}
-
-func (f *encFnInfo) fastpathEncMapUint16BoolR(rv reflect.Value) {
- fastpathTV.EncMapUint16BoolV(rv.Interface().(map[uint16]bool), fastpathCheckNilFalse, f.e)
-}
-func (_ fastpathT) EncMapUint16BoolV(v map[uint16]bool, checkNil bool, e *Encoder) {
- ee := e.e
- cr := e.cr
- if checkNil && v == nil {
- ee.EncodeNil()
- return
- }
- ee.EncodeMapStart(len(v))
- if e.h.Canonical {
- v2 := make([]uint64, len(v))
- var i int
- for k := range v {
- v2[i] = uint64(k)
- i++
- }
- sort.Sort(uintSlice(v2))
- for _, k2 := range v2 {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- ee.EncodeUint(uint64(uint16(k2)))
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- ee.EncodeBool(v[uint16(k2)])
- }
- } else {
- for k2, v2 := range v {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- ee.EncodeUint(uint64(k2))
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- ee.EncodeBool(v2)
- }
- }
- if cr != nil {
- cr.sendContainerState(containerMapEnd)
- }
-}
-
-func (f *encFnInfo) fastpathEncMapUint32IntfR(rv reflect.Value) {
- fastpathTV.EncMapUint32IntfV(rv.Interface().(map[uint32]interface{}), fastpathCheckNilFalse, f.e)
-}
-func (_ fastpathT) EncMapUint32IntfV(v map[uint32]interface{}, checkNil bool, e *Encoder) {
- ee := e.e
- cr := e.cr
- if checkNil && v == nil {
- ee.EncodeNil()
- return
- }
- ee.EncodeMapStart(len(v))
- if e.h.Canonical {
- v2 := make([]uint64, len(v))
- var i int
- for k := range v {
- v2[i] = uint64(k)
- i++
- }
- sort.Sort(uintSlice(v2))
- for _, k2 := range v2 {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- ee.EncodeUint(uint64(uint32(k2)))
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- e.encode(v[uint32(k2)])
- }
- } else {
- for k2, v2 := range v {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- ee.EncodeUint(uint64(k2))
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- e.encode(v2)
- }
- }
- if cr != nil {
- cr.sendContainerState(containerMapEnd)
- }
-}
-
-func (f *encFnInfo) fastpathEncMapUint32StringR(rv reflect.Value) {
- fastpathTV.EncMapUint32StringV(rv.Interface().(map[uint32]string), fastpathCheckNilFalse, f.e)
-}
-func (_ fastpathT) EncMapUint32StringV(v map[uint32]string, checkNil bool, e *Encoder) {
- ee := e.e
- cr := e.cr
- if checkNil && v == nil {
- ee.EncodeNil()
- return
- }
- ee.EncodeMapStart(len(v))
- if e.h.Canonical {
- v2 := make([]uint64, len(v))
- var i int
- for k := range v {
- v2[i] = uint64(k)
- i++
- }
- sort.Sort(uintSlice(v2))
- for _, k2 := range v2 {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- ee.EncodeUint(uint64(uint32(k2)))
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- ee.EncodeString(c_UTF8, v[uint32(k2)])
- }
- } else {
- for k2, v2 := range v {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- ee.EncodeUint(uint64(k2))
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- ee.EncodeString(c_UTF8, v2)
- }
- }
- if cr != nil {
- cr.sendContainerState(containerMapEnd)
- }
-}
-
-func (f *encFnInfo) fastpathEncMapUint32UintR(rv reflect.Value) {
- fastpathTV.EncMapUint32UintV(rv.Interface().(map[uint32]uint), fastpathCheckNilFalse, f.e)
-}
-func (_ fastpathT) EncMapUint32UintV(v map[uint32]uint, checkNil bool, e *Encoder) {
- ee := e.e
- cr := e.cr
- if checkNil && v == nil {
- ee.EncodeNil()
- return
- }
- ee.EncodeMapStart(len(v))
- if e.h.Canonical {
- v2 := make([]uint64, len(v))
- var i int
- for k := range v {
- v2[i] = uint64(k)
- i++
- }
- sort.Sort(uintSlice(v2))
- for _, k2 := range v2 {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- ee.EncodeUint(uint64(uint32(k2)))
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- ee.EncodeUint(uint64(v[uint32(k2)]))
- }
- } else {
- for k2, v2 := range v {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- ee.EncodeUint(uint64(k2))
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- ee.EncodeUint(uint64(v2))
- }
- }
- if cr != nil {
- cr.sendContainerState(containerMapEnd)
- }
-}
-
-func (f *encFnInfo) fastpathEncMapUint32Uint8R(rv reflect.Value) {
- fastpathTV.EncMapUint32Uint8V(rv.Interface().(map[uint32]uint8), fastpathCheckNilFalse, f.e)
-}
-func (_ fastpathT) EncMapUint32Uint8V(v map[uint32]uint8, checkNil bool, e *Encoder) {
- ee := e.e
- cr := e.cr
- if checkNil && v == nil {
- ee.EncodeNil()
- return
- }
- ee.EncodeMapStart(len(v))
- if e.h.Canonical {
- v2 := make([]uint64, len(v))
- var i int
- for k := range v {
- v2[i] = uint64(k)
- i++
- }
- sort.Sort(uintSlice(v2))
- for _, k2 := range v2 {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- ee.EncodeUint(uint64(uint32(k2)))
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- ee.EncodeUint(uint64(v[uint32(k2)]))
- }
- } else {
- for k2, v2 := range v {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- ee.EncodeUint(uint64(k2))
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- ee.EncodeUint(uint64(v2))
- }
- }
- if cr != nil {
- cr.sendContainerState(containerMapEnd)
- }
-}
-
-func (f *encFnInfo) fastpathEncMapUint32Uint16R(rv reflect.Value) {
- fastpathTV.EncMapUint32Uint16V(rv.Interface().(map[uint32]uint16), fastpathCheckNilFalse, f.e)
-}
-func (_ fastpathT) EncMapUint32Uint16V(v map[uint32]uint16, checkNil bool, e *Encoder) {
- ee := e.e
- cr := e.cr
- if checkNil && v == nil {
- ee.EncodeNil()
- return
- }
- ee.EncodeMapStart(len(v))
- if e.h.Canonical {
- v2 := make([]uint64, len(v))
- var i int
- for k := range v {
- v2[i] = uint64(k)
- i++
- }
- sort.Sort(uintSlice(v2))
- for _, k2 := range v2 {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- ee.EncodeUint(uint64(uint32(k2)))
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- ee.EncodeUint(uint64(v[uint32(k2)]))
- }
- } else {
- for k2, v2 := range v {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- ee.EncodeUint(uint64(k2))
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- ee.EncodeUint(uint64(v2))
- }
- }
- if cr != nil {
- cr.sendContainerState(containerMapEnd)
- }
-}
-
-func (f *encFnInfo) fastpathEncMapUint32Uint32R(rv reflect.Value) {
- fastpathTV.EncMapUint32Uint32V(rv.Interface().(map[uint32]uint32), fastpathCheckNilFalse, f.e)
-}
-func (_ fastpathT) EncMapUint32Uint32V(v map[uint32]uint32, checkNil bool, e *Encoder) {
- ee := e.e
- cr := e.cr
- if checkNil && v == nil {
- ee.EncodeNil()
- return
- }
- ee.EncodeMapStart(len(v))
- if e.h.Canonical {
- v2 := make([]uint64, len(v))
- var i int
- for k := range v {
- v2[i] = uint64(k)
- i++
- }
- sort.Sort(uintSlice(v2))
- for _, k2 := range v2 {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- ee.EncodeUint(uint64(uint32(k2)))
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- ee.EncodeUint(uint64(v[uint32(k2)]))
- }
- } else {
- for k2, v2 := range v {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- ee.EncodeUint(uint64(k2))
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- ee.EncodeUint(uint64(v2))
- }
- }
- if cr != nil {
- cr.sendContainerState(containerMapEnd)
- }
-}
-
-func (f *encFnInfo) fastpathEncMapUint32Uint64R(rv reflect.Value) {
- fastpathTV.EncMapUint32Uint64V(rv.Interface().(map[uint32]uint64), fastpathCheckNilFalse, f.e)
-}
-func (_ fastpathT) EncMapUint32Uint64V(v map[uint32]uint64, checkNil bool, e *Encoder) {
- ee := e.e
- cr := e.cr
- if checkNil && v == nil {
- ee.EncodeNil()
- return
- }
- ee.EncodeMapStart(len(v))
- if e.h.Canonical {
- v2 := make([]uint64, len(v))
- var i int
- for k := range v {
- v2[i] = uint64(k)
- i++
- }
- sort.Sort(uintSlice(v2))
- for _, k2 := range v2 {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- ee.EncodeUint(uint64(uint32(k2)))
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- ee.EncodeUint(uint64(v[uint32(k2)]))
- }
- } else {
- for k2, v2 := range v {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- ee.EncodeUint(uint64(k2))
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- ee.EncodeUint(uint64(v2))
- }
- }
- if cr != nil {
- cr.sendContainerState(containerMapEnd)
- }
-}
-
-func (f *encFnInfo) fastpathEncMapUint32UintptrR(rv reflect.Value) {
- fastpathTV.EncMapUint32UintptrV(rv.Interface().(map[uint32]uintptr), fastpathCheckNilFalse, f.e)
-}
-func (_ fastpathT) EncMapUint32UintptrV(v map[uint32]uintptr, checkNil bool, e *Encoder) {
- ee := e.e
- cr := e.cr
- if checkNil && v == nil {
- ee.EncodeNil()
- return
- }
- ee.EncodeMapStart(len(v))
- if e.h.Canonical {
- v2 := make([]uint64, len(v))
- var i int
- for k := range v {
- v2[i] = uint64(k)
- i++
- }
- sort.Sort(uintSlice(v2))
- for _, k2 := range v2 {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- ee.EncodeUint(uint64(uint32(k2)))
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- e.encode(v[uint32(k2)])
- }
- } else {
- for k2, v2 := range v {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- ee.EncodeUint(uint64(k2))
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- e.encode(v2)
- }
- }
- if cr != nil {
- cr.sendContainerState(containerMapEnd)
- }
-}
-
-func (f *encFnInfo) fastpathEncMapUint32IntR(rv reflect.Value) {
- fastpathTV.EncMapUint32IntV(rv.Interface().(map[uint32]int), fastpathCheckNilFalse, f.e)
-}
-func (_ fastpathT) EncMapUint32IntV(v map[uint32]int, checkNil bool, e *Encoder) {
- ee := e.e
- cr := e.cr
- if checkNil && v == nil {
- ee.EncodeNil()
- return
- }
- ee.EncodeMapStart(len(v))
- if e.h.Canonical {
- v2 := make([]uint64, len(v))
- var i int
- for k := range v {
- v2[i] = uint64(k)
- i++
- }
- sort.Sort(uintSlice(v2))
- for _, k2 := range v2 {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- ee.EncodeUint(uint64(uint32(k2)))
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- ee.EncodeInt(int64(v[uint32(k2)]))
- }
- } else {
- for k2, v2 := range v {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- ee.EncodeUint(uint64(k2))
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- ee.EncodeInt(int64(v2))
- }
- }
- if cr != nil {
- cr.sendContainerState(containerMapEnd)
- }
-}
-
-func (f *encFnInfo) fastpathEncMapUint32Int8R(rv reflect.Value) {
- fastpathTV.EncMapUint32Int8V(rv.Interface().(map[uint32]int8), fastpathCheckNilFalse, f.e)
-}
-func (_ fastpathT) EncMapUint32Int8V(v map[uint32]int8, checkNil bool, e *Encoder) {
- ee := e.e
- cr := e.cr
- if checkNil && v == nil {
- ee.EncodeNil()
- return
- }
- ee.EncodeMapStart(len(v))
- if e.h.Canonical {
- v2 := make([]uint64, len(v))
- var i int
- for k := range v {
- v2[i] = uint64(k)
- i++
- }
- sort.Sort(uintSlice(v2))
- for _, k2 := range v2 {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- ee.EncodeUint(uint64(uint32(k2)))
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- ee.EncodeInt(int64(v[uint32(k2)]))
- }
- } else {
- for k2, v2 := range v {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- ee.EncodeUint(uint64(k2))
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- ee.EncodeInt(int64(v2))
- }
- }
- if cr != nil {
- cr.sendContainerState(containerMapEnd)
- }
-}
-
-func (f *encFnInfo) fastpathEncMapUint32Int16R(rv reflect.Value) {
- fastpathTV.EncMapUint32Int16V(rv.Interface().(map[uint32]int16), fastpathCheckNilFalse, f.e)
-}
-func (_ fastpathT) EncMapUint32Int16V(v map[uint32]int16, checkNil bool, e *Encoder) {
- ee := e.e
- cr := e.cr
- if checkNil && v == nil {
- ee.EncodeNil()
- return
- }
- ee.EncodeMapStart(len(v))
- if e.h.Canonical {
- v2 := make([]uint64, len(v))
- var i int
- for k := range v {
- v2[i] = uint64(k)
- i++
- }
- sort.Sort(uintSlice(v2))
- for _, k2 := range v2 {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- ee.EncodeUint(uint64(uint32(k2)))
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- ee.EncodeInt(int64(v[uint32(k2)]))
- }
- } else {
- for k2, v2 := range v {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- ee.EncodeUint(uint64(k2))
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- ee.EncodeInt(int64(v2))
- }
- }
- if cr != nil {
- cr.sendContainerState(containerMapEnd)
- }
-}
-
-func (f *encFnInfo) fastpathEncMapUint32Int32R(rv reflect.Value) {
- fastpathTV.EncMapUint32Int32V(rv.Interface().(map[uint32]int32), fastpathCheckNilFalse, f.e)
-}
-func (_ fastpathT) EncMapUint32Int32V(v map[uint32]int32, checkNil bool, e *Encoder) {
- ee := e.e
- cr := e.cr
- if checkNil && v == nil {
- ee.EncodeNil()
- return
- }
- ee.EncodeMapStart(len(v))
- if e.h.Canonical {
- v2 := make([]uint64, len(v))
- var i int
- for k := range v {
- v2[i] = uint64(k)
- i++
- }
- sort.Sort(uintSlice(v2))
- for _, k2 := range v2 {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- ee.EncodeUint(uint64(uint32(k2)))
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- ee.EncodeInt(int64(v[uint32(k2)]))
- }
- } else {
- for k2, v2 := range v {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- ee.EncodeUint(uint64(k2))
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- ee.EncodeInt(int64(v2))
- }
- }
- if cr != nil {
- cr.sendContainerState(containerMapEnd)
- }
-}
-
-func (f *encFnInfo) fastpathEncMapUint32Int64R(rv reflect.Value) {
- fastpathTV.EncMapUint32Int64V(rv.Interface().(map[uint32]int64), fastpathCheckNilFalse, f.e)
-}
-func (_ fastpathT) EncMapUint32Int64V(v map[uint32]int64, checkNil bool, e *Encoder) {
- ee := e.e
- cr := e.cr
- if checkNil && v == nil {
- ee.EncodeNil()
- return
- }
- ee.EncodeMapStart(len(v))
- if e.h.Canonical {
- v2 := make([]uint64, len(v))
- var i int
- for k := range v {
- v2[i] = uint64(k)
- i++
- }
- sort.Sort(uintSlice(v2))
- for _, k2 := range v2 {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- ee.EncodeUint(uint64(uint32(k2)))
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- ee.EncodeInt(int64(v[uint32(k2)]))
- }
- } else {
- for k2, v2 := range v {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- ee.EncodeUint(uint64(k2))
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- ee.EncodeInt(int64(v2))
- }
- }
- if cr != nil {
- cr.sendContainerState(containerMapEnd)
- }
-}
-
-func (f *encFnInfo) fastpathEncMapUint32Float32R(rv reflect.Value) {
- fastpathTV.EncMapUint32Float32V(rv.Interface().(map[uint32]float32), fastpathCheckNilFalse, f.e)
-}
-func (_ fastpathT) EncMapUint32Float32V(v map[uint32]float32, checkNil bool, e *Encoder) {
- ee := e.e
- cr := e.cr
- if checkNil && v == nil {
- ee.EncodeNil()
- return
- }
- ee.EncodeMapStart(len(v))
- if e.h.Canonical {
- v2 := make([]uint64, len(v))
- var i int
- for k := range v {
- v2[i] = uint64(k)
- i++
- }
- sort.Sort(uintSlice(v2))
- for _, k2 := range v2 {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- ee.EncodeUint(uint64(uint32(k2)))
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- ee.EncodeFloat32(v[uint32(k2)])
- }
- } else {
- for k2, v2 := range v {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- ee.EncodeUint(uint64(k2))
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- ee.EncodeFloat32(v2)
- }
- }
- if cr != nil {
- cr.sendContainerState(containerMapEnd)
- }
-}
-
-func (f *encFnInfo) fastpathEncMapUint32Float64R(rv reflect.Value) {
- fastpathTV.EncMapUint32Float64V(rv.Interface().(map[uint32]float64), fastpathCheckNilFalse, f.e)
-}
-func (_ fastpathT) EncMapUint32Float64V(v map[uint32]float64, checkNil bool, e *Encoder) {
- ee := e.e
- cr := e.cr
- if checkNil && v == nil {
- ee.EncodeNil()
- return
- }
- ee.EncodeMapStart(len(v))
- if e.h.Canonical {
- v2 := make([]uint64, len(v))
- var i int
- for k := range v {
- v2[i] = uint64(k)
- i++
- }
- sort.Sort(uintSlice(v2))
- for _, k2 := range v2 {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- ee.EncodeUint(uint64(uint32(k2)))
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- ee.EncodeFloat64(v[uint32(k2)])
- }
- } else {
- for k2, v2 := range v {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- ee.EncodeUint(uint64(k2))
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- ee.EncodeFloat64(v2)
- }
- }
- if cr != nil {
- cr.sendContainerState(containerMapEnd)
- }
-}
-
-func (f *encFnInfo) fastpathEncMapUint32BoolR(rv reflect.Value) {
- fastpathTV.EncMapUint32BoolV(rv.Interface().(map[uint32]bool), fastpathCheckNilFalse, f.e)
-}
-func (_ fastpathT) EncMapUint32BoolV(v map[uint32]bool, checkNil bool, e *Encoder) {
- ee := e.e
- cr := e.cr
- if checkNil && v == nil {
- ee.EncodeNil()
- return
- }
- ee.EncodeMapStart(len(v))
- if e.h.Canonical {
- v2 := make([]uint64, len(v))
- var i int
- for k := range v {
- v2[i] = uint64(k)
- i++
- }
- sort.Sort(uintSlice(v2))
- for _, k2 := range v2 {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- ee.EncodeUint(uint64(uint32(k2)))
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- ee.EncodeBool(v[uint32(k2)])
- }
- } else {
- for k2, v2 := range v {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- ee.EncodeUint(uint64(k2))
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- ee.EncodeBool(v2)
- }
- }
- if cr != nil {
- cr.sendContainerState(containerMapEnd)
- }
-}
-
-func (f *encFnInfo) fastpathEncMapUint64IntfR(rv reflect.Value) {
- fastpathTV.EncMapUint64IntfV(rv.Interface().(map[uint64]interface{}), fastpathCheckNilFalse, f.e)
-}
-func (_ fastpathT) EncMapUint64IntfV(v map[uint64]interface{}, checkNil bool, e *Encoder) {
- ee := e.e
- cr := e.cr
- if checkNil && v == nil {
- ee.EncodeNil()
- return
- }
- ee.EncodeMapStart(len(v))
- if e.h.Canonical {
- v2 := make([]uint64, len(v))
- var i int
- for k := range v {
- v2[i] = uint64(k)
- i++
- }
- sort.Sort(uintSlice(v2))
- for _, k2 := range v2 {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- ee.EncodeUint(uint64(uint64(k2)))
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- e.encode(v[uint64(k2)])
- }
- } else {
- for k2, v2 := range v {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- ee.EncodeUint(uint64(k2))
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- e.encode(v2)
- }
- }
- if cr != nil {
- cr.sendContainerState(containerMapEnd)
- }
-}
-
-func (f *encFnInfo) fastpathEncMapUint64StringR(rv reflect.Value) {
- fastpathTV.EncMapUint64StringV(rv.Interface().(map[uint64]string), fastpathCheckNilFalse, f.e)
-}
-func (_ fastpathT) EncMapUint64StringV(v map[uint64]string, checkNil bool, e *Encoder) {
- ee := e.e
- cr := e.cr
- if checkNil && v == nil {
- ee.EncodeNil()
- return
- }
- ee.EncodeMapStart(len(v))
- if e.h.Canonical {
- v2 := make([]uint64, len(v))
- var i int
- for k := range v {
- v2[i] = uint64(k)
- i++
- }
- sort.Sort(uintSlice(v2))
- for _, k2 := range v2 {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- ee.EncodeUint(uint64(uint64(k2)))
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- ee.EncodeString(c_UTF8, v[uint64(k2)])
- }
- } else {
- for k2, v2 := range v {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- ee.EncodeUint(uint64(k2))
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- ee.EncodeString(c_UTF8, v2)
- }
- }
- if cr != nil {
- cr.sendContainerState(containerMapEnd)
- }
-}
-
-func (f *encFnInfo) fastpathEncMapUint64UintR(rv reflect.Value) {
- fastpathTV.EncMapUint64UintV(rv.Interface().(map[uint64]uint), fastpathCheckNilFalse, f.e)
-}
-func (_ fastpathT) EncMapUint64UintV(v map[uint64]uint, checkNil bool, e *Encoder) {
- ee := e.e
- cr := e.cr
- if checkNil && v == nil {
- ee.EncodeNil()
- return
- }
- ee.EncodeMapStart(len(v))
- if e.h.Canonical {
- v2 := make([]uint64, len(v))
- var i int
- for k := range v {
- v2[i] = uint64(k)
- i++
- }
- sort.Sort(uintSlice(v2))
- for _, k2 := range v2 {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- ee.EncodeUint(uint64(uint64(k2)))
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- ee.EncodeUint(uint64(v[uint64(k2)]))
- }
- } else {
- for k2, v2 := range v {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- ee.EncodeUint(uint64(k2))
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- ee.EncodeUint(uint64(v2))
- }
- }
- if cr != nil {
- cr.sendContainerState(containerMapEnd)
- }
-}
-
-func (f *encFnInfo) fastpathEncMapUint64Uint8R(rv reflect.Value) {
- fastpathTV.EncMapUint64Uint8V(rv.Interface().(map[uint64]uint8), fastpathCheckNilFalse, f.e)
-}
-func (_ fastpathT) EncMapUint64Uint8V(v map[uint64]uint8, checkNil bool, e *Encoder) {
- ee := e.e
- cr := e.cr
- if checkNil && v == nil {
- ee.EncodeNil()
- return
- }
- ee.EncodeMapStart(len(v))
- if e.h.Canonical {
- v2 := make([]uint64, len(v))
- var i int
- for k := range v {
- v2[i] = uint64(k)
- i++
- }
- sort.Sort(uintSlice(v2))
- for _, k2 := range v2 {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- ee.EncodeUint(uint64(uint64(k2)))
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- ee.EncodeUint(uint64(v[uint64(k2)]))
- }
- } else {
- for k2, v2 := range v {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- ee.EncodeUint(uint64(k2))
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- ee.EncodeUint(uint64(v2))
- }
- }
- if cr != nil {
- cr.sendContainerState(containerMapEnd)
- }
-}
-
-func (f *encFnInfo) fastpathEncMapUint64Uint16R(rv reflect.Value) {
- fastpathTV.EncMapUint64Uint16V(rv.Interface().(map[uint64]uint16), fastpathCheckNilFalse, f.e)
-}
-func (_ fastpathT) EncMapUint64Uint16V(v map[uint64]uint16, checkNil bool, e *Encoder) {
- ee := e.e
- cr := e.cr
- if checkNil && v == nil {
- ee.EncodeNil()
- return
- }
- ee.EncodeMapStart(len(v))
- if e.h.Canonical {
- v2 := make([]uint64, len(v))
- var i int
- for k := range v {
- v2[i] = uint64(k)
- i++
- }
- sort.Sort(uintSlice(v2))
- for _, k2 := range v2 {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- ee.EncodeUint(uint64(uint64(k2)))
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- ee.EncodeUint(uint64(v[uint64(k2)]))
- }
- } else {
- for k2, v2 := range v {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- ee.EncodeUint(uint64(k2))
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- ee.EncodeUint(uint64(v2))
- }
- }
- if cr != nil {
- cr.sendContainerState(containerMapEnd)
- }
-}
-
-func (f *encFnInfo) fastpathEncMapUint64Uint32R(rv reflect.Value) {
- fastpathTV.EncMapUint64Uint32V(rv.Interface().(map[uint64]uint32), fastpathCheckNilFalse, f.e)
-}
-func (_ fastpathT) EncMapUint64Uint32V(v map[uint64]uint32, checkNil bool, e *Encoder) {
- ee := e.e
- cr := e.cr
- if checkNil && v == nil {
- ee.EncodeNil()
- return
- }
- ee.EncodeMapStart(len(v))
- if e.h.Canonical {
- v2 := make([]uint64, len(v))
- var i int
- for k := range v {
- v2[i] = uint64(k)
- i++
- }
- sort.Sort(uintSlice(v2))
- for _, k2 := range v2 {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- ee.EncodeUint(uint64(uint64(k2)))
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- ee.EncodeUint(uint64(v[uint64(k2)]))
- }
- } else {
- for k2, v2 := range v {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- ee.EncodeUint(uint64(k2))
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- ee.EncodeUint(uint64(v2))
- }
- }
- if cr != nil {
- cr.sendContainerState(containerMapEnd)
- }
-}
-
-func (f *encFnInfo) fastpathEncMapUint64Uint64R(rv reflect.Value) {
- fastpathTV.EncMapUint64Uint64V(rv.Interface().(map[uint64]uint64), fastpathCheckNilFalse, f.e)
-}
-func (_ fastpathT) EncMapUint64Uint64V(v map[uint64]uint64, checkNil bool, e *Encoder) {
- ee := e.e
- cr := e.cr
- if checkNil && v == nil {
- ee.EncodeNil()
- return
- }
- ee.EncodeMapStart(len(v))
- if e.h.Canonical {
- v2 := make([]uint64, len(v))
- var i int
- for k := range v {
- v2[i] = uint64(k)
- i++
- }
- sort.Sort(uintSlice(v2))
- for _, k2 := range v2 {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- ee.EncodeUint(uint64(uint64(k2)))
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- ee.EncodeUint(uint64(v[uint64(k2)]))
- }
- } else {
- for k2, v2 := range v {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- ee.EncodeUint(uint64(k2))
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- ee.EncodeUint(uint64(v2))
- }
- }
- if cr != nil {
- cr.sendContainerState(containerMapEnd)
- }
-}
-
-func (f *encFnInfo) fastpathEncMapUint64UintptrR(rv reflect.Value) {
- fastpathTV.EncMapUint64UintptrV(rv.Interface().(map[uint64]uintptr), fastpathCheckNilFalse, f.e)
-}
-func (_ fastpathT) EncMapUint64UintptrV(v map[uint64]uintptr, checkNil bool, e *Encoder) {
- ee := e.e
- cr := e.cr
- if checkNil && v == nil {
- ee.EncodeNil()
- return
- }
- ee.EncodeMapStart(len(v))
- if e.h.Canonical {
- v2 := make([]uint64, len(v))
- var i int
- for k := range v {
- v2[i] = uint64(k)
- i++
- }
- sort.Sort(uintSlice(v2))
- for _, k2 := range v2 {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- ee.EncodeUint(uint64(uint64(k2)))
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- e.encode(v[uint64(k2)])
- }
- } else {
- for k2, v2 := range v {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- ee.EncodeUint(uint64(k2))
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- e.encode(v2)
- }
- }
- if cr != nil {
- cr.sendContainerState(containerMapEnd)
- }
-}
-
-func (f *encFnInfo) fastpathEncMapUint64IntR(rv reflect.Value) {
- fastpathTV.EncMapUint64IntV(rv.Interface().(map[uint64]int), fastpathCheckNilFalse, f.e)
-}
-func (_ fastpathT) EncMapUint64IntV(v map[uint64]int, checkNil bool, e *Encoder) {
- ee := e.e
- cr := e.cr
- if checkNil && v == nil {
- ee.EncodeNil()
- return
- }
- ee.EncodeMapStart(len(v))
- if e.h.Canonical {
- v2 := make([]uint64, len(v))
- var i int
- for k := range v {
- v2[i] = uint64(k)
- i++
- }
- sort.Sort(uintSlice(v2))
- for _, k2 := range v2 {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- ee.EncodeUint(uint64(uint64(k2)))
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- ee.EncodeInt(int64(v[uint64(k2)]))
- }
- } else {
- for k2, v2 := range v {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- ee.EncodeUint(uint64(k2))
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- ee.EncodeInt(int64(v2))
- }
- }
- if cr != nil {
- cr.sendContainerState(containerMapEnd)
- }
-}
-
-func (f *encFnInfo) fastpathEncMapUint64Int8R(rv reflect.Value) {
- fastpathTV.EncMapUint64Int8V(rv.Interface().(map[uint64]int8), fastpathCheckNilFalse, f.e)
-}
-func (_ fastpathT) EncMapUint64Int8V(v map[uint64]int8, checkNil bool, e *Encoder) {
- ee := e.e
- cr := e.cr
- if checkNil && v == nil {
- ee.EncodeNil()
- return
- }
- ee.EncodeMapStart(len(v))
- if e.h.Canonical {
- v2 := make([]uint64, len(v))
- var i int
- for k := range v {
- v2[i] = uint64(k)
- i++
- }
- sort.Sort(uintSlice(v2))
- for _, k2 := range v2 {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- ee.EncodeUint(uint64(uint64(k2)))
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- ee.EncodeInt(int64(v[uint64(k2)]))
- }
- } else {
- for k2, v2 := range v {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- ee.EncodeUint(uint64(k2))
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- ee.EncodeInt(int64(v2))
- }
- }
- if cr != nil {
- cr.sendContainerState(containerMapEnd)
- }
-}
-
-func (f *encFnInfo) fastpathEncMapUint64Int16R(rv reflect.Value) {
- fastpathTV.EncMapUint64Int16V(rv.Interface().(map[uint64]int16), fastpathCheckNilFalse, f.e)
-}
-func (_ fastpathT) EncMapUint64Int16V(v map[uint64]int16, checkNil bool, e *Encoder) {
- ee := e.e
- cr := e.cr
- if checkNil && v == nil {
- ee.EncodeNil()
- return
- }
- ee.EncodeMapStart(len(v))
- if e.h.Canonical {
- v2 := make([]uint64, len(v))
- var i int
- for k := range v {
- v2[i] = uint64(k)
- i++
- }
- sort.Sort(uintSlice(v2))
- for _, k2 := range v2 {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- ee.EncodeUint(uint64(uint64(k2)))
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- ee.EncodeInt(int64(v[uint64(k2)]))
- }
- } else {
- for k2, v2 := range v {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- ee.EncodeUint(uint64(k2))
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- ee.EncodeInt(int64(v2))
- }
- }
- if cr != nil {
- cr.sendContainerState(containerMapEnd)
- }
-}
-
-func (f *encFnInfo) fastpathEncMapUint64Int32R(rv reflect.Value) {
- fastpathTV.EncMapUint64Int32V(rv.Interface().(map[uint64]int32), fastpathCheckNilFalse, f.e)
-}
-func (_ fastpathT) EncMapUint64Int32V(v map[uint64]int32, checkNil bool, e *Encoder) {
- ee := e.e
- cr := e.cr
- if checkNil && v == nil {
- ee.EncodeNil()
- return
- }
- ee.EncodeMapStart(len(v))
- if e.h.Canonical {
- v2 := make([]uint64, len(v))
- var i int
- for k := range v {
- v2[i] = uint64(k)
- i++
- }
- sort.Sort(uintSlice(v2))
- for _, k2 := range v2 {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- ee.EncodeUint(uint64(uint64(k2)))
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- ee.EncodeInt(int64(v[uint64(k2)]))
- }
- } else {
- for k2, v2 := range v {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- ee.EncodeUint(uint64(k2))
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- ee.EncodeInt(int64(v2))
- }
- }
- if cr != nil {
- cr.sendContainerState(containerMapEnd)
- }
-}
-
-func (f *encFnInfo) fastpathEncMapUint64Int64R(rv reflect.Value) {
- fastpathTV.EncMapUint64Int64V(rv.Interface().(map[uint64]int64), fastpathCheckNilFalse, f.e)
-}
-func (_ fastpathT) EncMapUint64Int64V(v map[uint64]int64, checkNil bool, e *Encoder) {
- ee := e.e
- cr := e.cr
- if checkNil && v == nil {
- ee.EncodeNil()
- return
- }
- ee.EncodeMapStart(len(v))
- if e.h.Canonical {
- v2 := make([]uint64, len(v))
- var i int
- for k := range v {
- v2[i] = uint64(k)
- i++
- }
- sort.Sort(uintSlice(v2))
- for _, k2 := range v2 {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- ee.EncodeUint(uint64(uint64(k2)))
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- ee.EncodeInt(int64(v[uint64(k2)]))
- }
- } else {
- for k2, v2 := range v {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- ee.EncodeUint(uint64(k2))
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- ee.EncodeInt(int64(v2))
- }
- }
- if cr != nil {
- cr.sendContainerState(containerMapEnd)
- }
-}
-
-func (f *encFnInfo) fastpathEncMapUint64Float32R(rv reflect.Value) {
- fastpathTV.EncMapUint64Float32V(rv.Interface().(map[uint64]float32), fastpathCheckNilFalse, f.e)
-}
-func (_ fastpathT) EncMapUint64Float32V(v map[uint64]float32, checkNil bool, e *Encoder) {
- ee := e.e
- cr := e.cr
- if checkNil && v == nil {
- ee.EncodeNil()
- return
- }
- ee.EncodeMapStart(len(v))
- if e.h.Canonical {
- v2 := make([]uint64, len(v))
- var i int
- for k := range v {
- v2[i] = uint64(k)
- i++
- }
- sort.Sort(uintSlice(v2))
- for _, k2 := range v2 {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- ee.EncodeUint(uint64(uint64(k2)))
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- ee.EncodeFloat32(v[uint64(k2)])
- }
- } else {
- for k2, v2 := range v {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- ee.EncodeUint(uint64(k2))
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- ee.EncodeFloat32(v2)
- }
- }
- if cr != nil {
- cr.sendContainerState(containerMapEnd)
- }
-}
-
-func (f *encFnInfo) fastpathEncMapUint64Float64R(rv reflect.Value) {
- fastpathTV.EncMapUint64Float64V(rv.Interface().(map[uint64]float64), fastpathCheckNilFalse, f.e)
-}
-func (_ fastpathT) EncMapUint64Float64V(v map[uint64]float64, checkNil bool, e *Encoder) {
- ee := e.e
- cr := e.cr
- if checkNil && v == nil {
- ee.EncodeNil()
- return
- }
- ee.EncodeMapStart(len(v))
- if e.h.Canonical {
- v2 := make([]uint64, len(v))
- var i int
- for k := range v {
- v2[i] = uint64(k)
- i++
- }
- sort.Sort(uintSlice(v2))
- for _, k2 := range v2 {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- ee.EncodeUint(uint64(uint64(k2)))
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- ee.EncodeFloat64(v[uint64(k2)])
- }
- } else {
- for k2, v2 := range v {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- ee.EncodeUint(uint64(k2))
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- ee.EncodeFloat64(v2)
- }
- }
- if cr != nil {
- cr.sendContainerState(containerMapEnd)
- }
-}
-
-func (f *encFnInfo) fastpathEncMapUint64BoolR(rv reflect.Value) {
- fastpathTV.EncMapUint64BoolV(rv.Interface().(map[uint64]bool), fastpathCheckNilFalse, f.e)
-}
-func (_ fastpathT) EncMapUint64BoolV(v map[uint64]bool, checkNil bool, e *Encoder) {
- ee := e.e
- cr := e.cr
- if checkNil && v == nil {
- ee.EncodeNil()
- return
- }
- ee.EncodeMapStart(len(v))
- if e.h.Canonical {
- v2 := make([]uint64, len(v))
- var i int
- for k := range v {
- v2[i] = uint64(k)
- i++
- }
- sort.Sort(uintSlice(v2))
- for _, k2 := range v2 {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- ee.EncodeUint(uint64(uint64(k2)))
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- ee.EncodeBool(v[uint64(k2)])
- }
- } else {
- for k2, v2 := range v {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- ee.EncodeUint(uint64(k2))
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- ee.EncodeBool(v2)
- }
- }
- if cr != nil {
- cr.sendContainerState(containerMapEnd)
- }
-}
-
-func (f *encFnInfo) fastpathEncMapUintptrIntfR(rv reflect.Value) {
- fastpathTV.EncMapUintptrIntfV(rv.Interface().(map[uintptr]interface{}), fastpathCheckNilFalse, f.e)
-}
-func (_ fastpathT) EncMapUintptrIntfV(v map[uintptr]interface{}, checkNil bool, e *Encoder) {
- ee := e.e
- cr := e.cr
- if checkNil && v == nil {
- ee.EncodeNil()
- return
- }
- ee.EncodeMapStart(len(v))
- if e.h.Canonical {
- v2 := make([]uint64, len(v))
- var i int
- for k := range v {
- v2[i] = uint64(k)
- i++
- }
- sort.Sort(uintSlice(v2))
- for _, k2 := range v2 {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- e.encode(uintptr(k2))
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- e.encode(v[uintptr(k2)])
- }
- } else {
- for k2, v2 := range v {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- e.encode(k2)
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- e.encode(v2)
- }
- }
- if cr != nil {
- cr.sendContainerState(containerMapEnd)
- }
-}
-
-func (f *encFnInfo) fastpathEncMapUintptrStringR(rv reflect.Value) {
- fastpathTV.EncMapUintptrStringV(rv.Interface().(map[uintptr]string), fastpathCheckNilFalse, f.e)
-}
-func (_ fastpathT) EncMapUintptrStringV(v map[uintptr]string, checkNil bool, e *Encoder) {
- ee := e.e
- cr := e.cr
- if checkNil && v == nil {
- ee.EncodeNil()
- return
- }
- ee.EncodeMapStart(len(v))
- if e.h.Canonical {
- v2 := make([]uint64, len(v))
- var i int
- for k := range v {
- v2[i] = uint64(k)
- i++
- }
- sort.Sort(uintSlice(v2))
- for _, k2 := range v2 {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- e.encode(uintptr(k2))
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- ee.EncodeString(c_UTF8, v[uintptr(k2)])
- }
- } else {
- for k2, v2 := range v {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- e.encode(k2)
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- ee.EncodeString(c_UTF8, v2)
- }
- }
- if cr != nil {
- cr.sendContainerState(containerMapEnd)
- }
-}
-
-func (f *encFnInfo) fastpathEncMapUintptrUintR(rv reflect.Value) {
- fastpathTV.EncMapUintptrUintV(rv.Interface().(map[uintptr]uint), fastpathCheckNilFalse, f.e)
-}
-func (_ fastpathT) EncMapUintptrUintV(v map[uintptr]uint, checkNil bool, e *Encoder) {
- ee := e.e
- cr := e.cr
- if checkNil && v == nil {
- ee.EncodeNil()
- return
- }
- ee.EncodeMapStart(len(v))
- if e.h.Canonical {
- v2 := make([]uint64, len(v))
- var i int
- for k := range v {
- v2[i] = uint64(k)
- i++
- }
- sort.Sort(uintSlice(v2))
- for _, k2 := range v2 {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- e.encode(uintptr(k2))
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- ee.EncodeUint(uint64(v[uintptr(k2)]))
- }
- } else {
- for k2, v2 := range v {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- e.encode(k2)
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- ee.EncodeUint(uint64(v2))
- }
- }
- if cr != nil {
- cr.sendContainerState(containerMapEnd)
- }
-}
-
-func (f *encFnInfo) fastpathEncMapUintptrUint8R(rv reflect.Value) {
- fastpathTV.EncMapUintptrUint8V(rv.Interface().(map[uintptr]uint8), fastpathCheckNilFalse, f.e)
-}
-func (_ fastpathT) EncMapUintptrUint8V(v map[uintptr]uint8, checkNil bool, e *Encoder) {
- ee := e.e
- cr := e.cr
- if checkNil && v == nil {
- ee.EncodeNil()
- return
- }
- ee.EncodeMapStart(len(v))
- if e.h.Canonical {
- v2 := make([]uint64, len(v))
- var i int
- for k := range v {
- v2[i] = uint64(k)
- i++
- }
- sort.Sort(uintSlice(v2))
- for _, k2 := range v2 {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- e.encode(uintptr(k2))
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- ee.EncodeUint(uint64(v[uintptr(k2)]))
- }
- } else {
- for k2, v2 := range v {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- e.encode(k2)
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- ee.EncodeUint(uint64(v2))
- }
- }
- if cr != nil {
- cr.sendContainerState(containerMapEnd)
- }
-}
-
-func (f *encFnInfo) fastpathEncMapUintptrUint16R(rv reflect.Value) {
- fastpathTV.EncMapUintptrUint16V(rv.Interface().(map[uintptr]uint16), fastpathCheckNilFalse, f.e)
-}
-func (_ fastpathT) EncMapUintptrUint16V(v map[uintptr]uint16, checkNil bool, e *Encoder) {
- ee := e.e
- cr := e.cr
- if checkNil && v == nil {
- ee.EncodeNil()
- return
- }
- ee.EncodeMapStart(len(v))
- if e.h.Canonical {
- v2 := make([]uint64, len(v))
- var i int
- for k := range v {
- v2[i] = uint64(k)
- i++
- }
- sort.Sort(uintSlice(v2))
- for _, k2 := range v2 {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- e.encode(uintptr(k2))
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- ee.EncodeUint(uint64(v[uintptr(k2)]))
- }
- } else {
- for k2, v2 := range v {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- e.encode(k2)
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- ee.EncodeUint(uint64(v2))
- }
- }
- if cr != nil {
- cr.sendContainerState(containerMapEnd)
- }
-}
-
-func (f *encFnInfo) fastpathEncMapUintptrUint32R(rv reflect.Value) {
- fastpathTV.EncMapUintptrUint32V(rv.Interface().(map[uintptr]uint32), fastpathCheckNilFalse, f.e)
-}
-func (_ fastpathT) EncMapUintptrUint32V(v map[uintptr]uint32, checkNil bool, e *Encoder) {
- ee := e.e
- cr := e.cr
- if checkNil && v == nil {
- ee.EncodeNil()
- return
- }
- ee.EncodeMapStart(len(v))
- if e.h.Canonical {
- v2 := make([]uint64, len(v))
- var i int
- for k := range v {
- v2[i] = uint64(k)
- i++
- }
- sort.Sort(uintSlice(v2))
- for _, k2 := range v2 {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- e.encode(uintptr(k2))
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- ee.EncodeUint(uint64(v[uintptr(k2)]))
- }
- } else {
- for k2, v2 := range v {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- e.encode(k2)
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- ee.EncodeUint(uint64(v2))
- }
- }
- if cr != nil {
- cr.sendContainerState(containerMapEnd)
- }
-}
-
-func (f *encFnInfo) fastpathEncMapUintptrUint64R(rv reflect.Value) {
- fastpathTV.EncMapUintptrUint64V(rv.Interface().(map[uintptr]uint64), fastpathCheckNilFalse, f.e)
-}
-func (_ fastpathT) EncMapUintptrUint64V(v map[uintptr]uint64, checkNil bool, e *Encoder) {
- ee := e.e
- cr := e.cr
- if checkNil && v == nil {
- ee.EncodeNil()
- return
- }
- ee.EncodeMapStart(len(v))
- if e.h.Canonical {
- v2 := make([]uint64, len(v))
- var i int
- for k := range v {
- v2[i] = uint64(k)
- i++
- }
- sort.Sort(uintSlice(v2))
- for _, k2 := range v2 {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- e.encode(uintptr(k2))
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- ee.EncodeUint(uint64(v[uintptr(k2)]))
- }
- } else {
- for k2, v2 := range v {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- e.encode(k2)
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- ee.EncodeUint(uint64(v2))
- }
- }
- if cr != nil {
- cr.sendContainerState(containerMapEnd)
- }
-}
-
-func (f *encFnInfo) fastpathEncMapUintptrUintptrR(rv reflect.Value) {
- fastpathTV.EncMapUintptrUintptrV(rv.Interface().(map[uintptr]uintptr), fastpathCheckNilFalse, f.e)
-}
-func (_ fastpathT) EncMapUintptrUintptrV(v map[uintptr]uintptr, checkNil bool, e *Encoder) {
- ee := e.e
- cr := e.cr
- if checkNil && v == nil {
- ee.EncodeNil()
- return
- }
- ee.EncodeMapStart(len(v))
- if e.h.Canonical {
- v2 := make([]uint64, len(v))
- var i int
- for k := range v {
- v2[i] = uint64(k)
- i++
- }
- sort.Sort(uintSlice(v2))
- for _, k2 := range v2 {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- e.encode(uintptr(k2))
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- e.encode(v[uintptr(k2)])
- }
- } else {
- for k2, v2 := range v {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- e.encode(k2)
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- e.encode(v2)
- }
- }
- if cr != nil {
- cr.sendContainerState(containerMapEnd)
- }
-}
-
-func (f *encFnInfo) fastpathEncMapUintptrIntR(rv reflect.Value) {
- fastpathTV.EncMapUintptrIntV(rv.Interface().(map[uintptr]int), fastpathCheckNilFalse, f.e)
-}
-func (_ fastpathT) EncMapUintptrIntV(v map[uintptr]int, checkNil bool, e *Encoder) {
- ee := e.e
- cr := e.cr
- if checkNil && v == nil {
- ee.EncodeNil()
- return
- }
- ee.EncodeMapStart(len(v))
- if e.h.Canonical {
- v2 := make([]uint64, len(v))
- var i int
- for k := range v {
- v2[i] = uint64(k)
- i++
- }
- sort.Sort(uintSlice(v2))
- for _, k2 := range v2 {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- e.encode(uintptr(k2))
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- ee.EncodeInt(int64(v[uintptr(k2)]))
- }
- } else {
- for k2, v2 := range v {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- e.encode(k2)
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- ee.EncodeInt(int64(v2))
- }
- }
- if cr != nil {
- cr.sendContainerState(containerMapEnd)
- }
-}
-
-func (f *encFnInfo) fastpathEncMapUintptrInt8R(rv reflect.Value) {
- fastpathTV.EncMapUintptrInt8V(rv.Interface().(map[uintptr]int8), fastpathCheckNilFalse, f.e)
-}
-func (_ fastpathT) EncMapUintptrInt8V(v map[uintptr]int8, checkNil bool, e *Encoder) {
- ee := e.e
- cr := e.cr
- if checkNil && v == nil {
- ee.EncodeNil()
- return
- }
- ee.EncodeMapStart(len(v))
- if e.h.Canonical {
- v2 := make([]uint64, len(v))
- var i int
- for k := range v {
- v2[i] = uint64(k)
- i++
- }
- sort.Sort(uintSlice(v2))
- for _, k2 := range v2 {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- e.encode(uintptr(k2))
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- ee.EncodeInt(int64(v[uintptr(k2)]))
- }
- } else {
- for k2, v2 := range v {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- e.encode(k2)
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- ee.EncodeInt(int64(v2))
- }
- }
- if cr != nil {
- cr.sendContainerState(containerMapEnd)
- }
-}
-
-func (f *encFnInfo) fastpathEncMapUintptrInt16R(rv reflect.Value) {
- fastpathTV.EncMapUintptrInt16V(rv.Interface().(map[uintptr]int16), fastpathCheckNilFalse, f.e)
-}
-func (_ fastpathT) EncMapUintptrInt16V(v map[uintptr]int16, checkNil bool, e *Encoder) {
- ee := e.e
- cr := e.cr
- if checkNil && v == nil {
- ee.EncodeNil()
- return
- }
- ee.EncodeMapStart(len(v))
- if e.h.Canonical {
- v2 := make([]uint64, len(v))
- var i int
- for k := range v {
- v2[i] = uint64(k)
- i++
- }
- sort.Sort(uintSlice(v2))
- for _, k2 := range v2 {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- e.encode(uintptr(k2))
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- ee.EncodeInt(int64(v[uintptr(k2)]))
- }
- } else {
- for k2, v2 := range v {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- e.encode(k2)
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- ee.EncodeInt(int64(v2))
- }
- }
- if cr != nil {
- cr.sendContainerState(containerMapEnd)
- }
-}
-
-func (f *encFnInfo) fastpathEncMapUintptrInt32R(rv reflect.Value) {
- fastpathTV.EncMapUintptrInt32V(rv.Interface().(map[uintptr]int32), fastpathCheckNilFalse, f.e)
-}
-func (_ fastpathT) EncMapUintptrInt32V(v map[uintptr]int32, checkNil bool, e *Encoder) {
- ee := e.e
- cr := e.cr
- if checkNil && v == nil {
- ee.EncodeNil()
- return
- }
- ee.EncodeMapStart(len(v))
- if e.h.Canonical {
- v2 := make([]uint64, len(v))
- var i int
- for k := range v {
- v2[i] = uint64(k)
- i++
- }
- sort.Sort(uintSlice(v2))
- for _, k2 := range v2 {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- e.encode(uintptr(k2))
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- ee.EncodeInt(int64(v[uintptr(k2)]))
- }
- } else {
- for k2, v2 := range v {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- e.encode(k2)
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- ee.EncodeInt(int64(v2))
- }
- }
- if cr != nil {
- cr.sendContainerState(containerMapEnd)
- }
-}
-
-func (f *encFnInfo) fastpathEncMapUintptrInt64R(rv reflect.Value) {
- fastpathTV.EncMapUintptrInt64V(rv.Interface().(map[uintptr]int64), fastpathCheckNilFalse, f.e)
-}
-func (_ fastpathT) EncMapUintptrInt64V(v map[uintptr]int64, checkNil bool, e *Encoder) {
- ee := e.e
- cr := e.cr
- if checkNil && v == nil {
- ee.EncodeNil()
- return
- }
- ee.EncodeMapStart(len(v))
- if e.h.Canonical {
- v2 := make([]uint64, len(v))
- var i int
- for k := range v {
- v2[i] = uint64(k)
- i++
- }
- sort.Sort(uintSlice(v2))
- for _, k2 := range v2 {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- e.encode(uintptr(k2))
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- ee.EncodeInt(int64(v[uintptr(k2)]))
- }
- } else {
- for k2, v2 := range v {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- e.encode(k2)
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- ee.EncodeInt(int64(v2))
- }
- }
- if cr != nil {
- cr.sendContainerState(containerMapEnd)
- }
-}
-
-func (f *encFnInfo) fastpathEncMapUintptrFloat32R(rv reflect.Value) {
- fastpathTV.EncMapUintptrFloat32V(rv.Interface().(map[uintptr]float32), fastpathCheckNilFalse, f.e)
-}
-func (_ fastpathT) EncMapUintptrFloat32V(v map[uintptr]float32, checkNil bool, e *Encoder) {
- ee := e.e
- cr := e.cr
- if checkNil && v == nil {
- ee.EncodeNil()
- return
- }
- ee.EncodeMapStart(len(v))
- if e.h.Canonical {
- v2 := make([]uint64, len(v))
- var i int
- for k := range v {
- v2[i] = uint64(k)
- i++
- }
- sort.Sort(uintSlice(v2))
- for _, k2 := range v2 {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- e.encode(uintptr(k2))
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- ee.EncodeFloat32(v[uintptr(k2)])
- }
- } else {
- for k2, v2 := range v {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- e.encode(k2)
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- ee.EncodeFloat32(v2)
- }
- }
- if cr != nil {
- cr.sendContainerState(containerMapEnd)
- }
-}
-
-func (f *encFnInfo) fastpathEncMapUintptrFloat64R(rv reflect.Value) {
- fastpathTV.EncMapUintptrFloat64V(rv.Interface().(map[uintptr]float64), fastpathCheckNilFalse, f.e)
-}
-func (_ fastpathT) EncMapUintptrFloat64V(v map[uintptr]float64, checkNil bool, e *Encoder) {
- ee := e.e
- cr := e.cr
- if checkNil && v == nil {
- ee.EncodeNil()
- return
- }
- ee.EncodeMapStart(len(v))
- if e.h.Canonical {
- v2 := make([]uint64, len(v))
- var i int
- for k := range v {
- v2[i] = uint64(k)
- i++
- }
- sort.Sort(uintSlice(v2))
- for _, k2 := range v2 {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- e.encode(uintptr(k2))
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- ee.EncodeFloat64(v[uintptr(k2)])
- }
- } else {
- for k2, v2 := range v {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- e.encode(k2)
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- ee.EncodeFloat64(v2)
- }
- }
- if cr != nil {
- cr.sendContainerState(containerMapEnd)
- }
-}
-
-func (f *encFnInfo) fastpathEncMapUintptrBoolR(rv reflect.Value) {
- fastpathTV.EncMapUintptrBoolV(rv.Interface().(map[uintptr]bool), fastpathCheckNilFalse, f.e)
-}
-func (_ fastpathT) EncMapUintptrBoolV(v map[uintptr]bool, checkNil bool, e *Encoder) {
- ee := e.e
- cr := e.cr
- if checkNil && v == nil {
- ee.EncodeNil()
- return
- }
- ee.EncodeMapStart(len(v))
- if e.h.Canonical {
- v2 := make([]uint64, len(v))
- var i int
- for k := range v {
- v2[i] = uint64(k)
- i++
- }
- sort.Sort(uintSlice(v2))
- for _, k2 := range v2 {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- e.encode(uintptr(k2))
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- ee.EncodeBool(v[uintptr(k2)])
- }
- } else {
- for k2, v2 := range v {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- e.encode(k2)
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- ee.EncodeBool(v2)
- }
- }
- if cr != nil {
- cr.sendContainerState(containerMapEnd)
- }
-}
-
-func (f *encFnInfo) fastpathEncMapIntIntfR(rv reflect.Value) {
- fastpathTV.EncMapIntIntfV(rv.Interface().(map[int]interface{}), fastpathCheckNilFalse, f.e)
-}
-func (_ fastpathT) EncMapIntIntfV(v map[int]interface{}, checkNil bool, e *Encoder) {
- ee := e.e
- cr := e.cr
- if checkNil && v == nil {
- ee.EncodeNil()
- return
- }
- ee.EncodeMapStart(len(v))
- if e.h.Canonical {
- v2 := make([]int64, len(v))
- var i int
- for k := range v {
- v2[i] = int64(k)
- i++
- }
- sort.Sort(intSlice(v2))
- for _, k2 := range v2 {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- ee.EncodeInt(int64(int(k2)))
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- e.encode(v[int(k2)])
- }
- } else {
- for k2, v2 := range v {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- ee.EncodeInt(int64(k2))
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- e.encode(v2)
- }
- }
- if cr != nil {
- cr.sendContainerState(containerMapEnd)
- }
-}
-
-func (f *encFnInfo) fastpathEncMapIntStringR(rv reflect.Value) {
- fastpathTV.EncMapIntStringV(rv.Interface().(map[int]string), fastpathCheckNilFalse, f.e)
-}
-func (_ fastpathT) EncMapIntStringV(v map[int]string, checkNil bool, e *Encoder) {
- ee := e.e
- cr := e.cr
- if checkNil && v == nil {
- ee.EncodeNil()
- return
- }
- ee.EncodeMapStart(len(v))
- if e.h.Canonical {
- v2 := make([]int64, len(v))
- var i int
- for k := range v {
- v2[i] = int64(k)
- i++
- }
- sort.Sort(intSlice(v2))
- for _, k2 := range v2 {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- ee.EncodeInt(int64(int(k2)))
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- ee.EncodeString(c_UTF8, v[int(k2)])
- }
- } else {
- for k2, v2 := range v {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- ee.EncodeInt(int64(k2))
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- ee.EncodeString(c_UTF8, v2)
- }
- }
- if cr != nil {
- cr.sendContainerState(containerMapEnd)
- }
-}
-
-func (f *encFnInfo) fastpathEncMapIntUintR(rv reflect.Value) {
- fastpathTV.EncMapIntUintV(rv.Interface().(map[int]uint), fastpathCheckNilFalse, f.e)
-}
-func (_ fastpathT) EncMapIntUintV(v map[int]uint, checkNil bool, e *Encoder) {
- ee := e.e
- cr := e.cr
- if checkNil && v == nil {
- ee.EncodeNil()
- return
- }
- ee.EncodeMapStart(len(v))
- if e.h.Canonical {
- v2 := make([]int64, len(v))
- var i int
- for k := range v {
- v2[i] = int64(k)
- i++
- }
- sort.Sort(intSlice(v2))
- for _, k2 := range v2 {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- ee.EncodeInt(int64(int(k2)))
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- ee.EncodeUint(uint64(v[int(k2)]))
- }
- } else {
- for k2, v2 := range v {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- ee.EncodeInt(int64(k2))
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- ee.EncodeUint(uint64(v2))
- }
- }
- if cr != nil {
- cr.sendContainerState(containerMapEnd)
- }
-}
-
-func (f *encFnInfo) fastpathEncMapIntUint8R(rv reflect.Value) {
- fastpathTV.EncMapIntUint8V(rv.Interface().(map[int]uint8), fastpathCheckNilFalse, f.e)
-}
-func (_ fastpathT) EncMapIntUint8V(v map[int]uint8, checkNil bool, e *Encoder) {
- ee := e.e
- cr := e.cr
- if checkNil && v == nil {
- ee.EncodeNil()
- return
- }
- ee.EncodeMapStart(len(v))
- if e.h.Canonical {
- v2 := make([]int64, len(v))
- var i int
- for k := range v {
- v2[i] = int64(k)
- i++
- }
- sort.Sort(intSlice(v2))
- for _, k2 := range v2 {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- ee.EncodeInt(int64(int(k2)))
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- ee.EncodeUint(uint64(v[int(k2)]))
- }
- } else {
- for k2, v2 := range v {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- ee.EncodeInt(int64(k2))
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- ee.EncodeUint(uint64(v2))
- }
- }
- if cr != nil {
- cr.sendContainerState(containerMapEnd)
- }
-}
-
-func (f *encFnInfo) fastpathEncMapIntUint16R(rv reflect.Value) {
- fastpathTV.EncMapIntUint16V(rv.Interface().(map[int]uint16), fastpathCheckNilFalse, f.e)
-}
-func (_ fastpathT) EncMapIntUint16V(v map[int]uint16, checkNil bool, e *Encoder) {
- ee := e.e
- cr := e.cr
- if checkNil && v == nil {
- ee.EncodeNil()
- return
- }
- ee.EncodeMapStart(len(v))
- if e.h.Canonical {
- v2 := make([]int64, len(v))
- var i int
- for k := range v {
- v2[i] = int64(k)
- i++
- }
- sort.Sort(intSlice(v2))
- for _, k2 := range v2 {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- ee.EncodeInt(int64(int(k2)))
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- ee.EncodeUint(uint64(v[int(k2)]))
- }
- } else {
- for k2, v2 := range v {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- ee.EncodeInt(int64(k2))
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- ee.EncodeUint(uint64(v2))
- }
- }
- if cr != nil {
- cr.sendContainerState(containerMapEnd)
- }
-}
-
-func (f *encFnInfo) fastpathEncMapIntUint32R(rv reflect.Value) {
- fastpathTV.EncMapIntUint32V(rv.Interface().(map[int]uint32), fastpathCheckNilFalse, f.e)
-}
-func (_ fastpathT) EncMapIntUint32V(v map[int]uint32, checkNil bool, e *Encoder) {
- ee := e.e
- cr := e.cr
- if checkNil && v == nil {
- ee.EncodeNil()
- return
- }
- ee.EncodeMapStart(len(v))
- if e.h.Canonical {
- v2 := make([]int64, len(v))
- var i int
- for k := range v {
- v2[i] = int64(k)
- i++
- }
- sort.Sort(intSlice(v2))
- for _, k2 := range v2 {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- ee.EncodeInt(int64(int(k2)))
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- ee.EncodeUint(uint64(v[int(k2)]))
- }
- } else {
- for k2, v2 := range v {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- ee.EncodeInt(int64(k2))
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- ee.EncodeUint(uint64(v2))
- }
- }
- if cr != nil {
- cr.sendContainerState(containerMapEnd)
- }
-}
-
-func (f *encFnInfo) fastpathEncMapIntUint64R(rv reflect.Value) {
- fastpathTV.EncMapIntUint64V(rv.Interface().(map[int]uint64), fastpathCheckNilFalse, f.e)
-}
-func (_ fastpathT) EncMapIntUint64V(v map[int]uint64, checkNil bool, e *Encoder) {
- ee := e.e
- cr := e.cr
- if checkNil && v == nil {
- ee.EncodeNil()
- return
- }
- ee.EncodeMapStart(len(v))
- if e.h.Canonical {
- v2 := make([]int64, len(v))
- var i int
- for k := range v {
- v2[i] = int64(k)
- i++
- }
- sort.Sort(intSlice(v2))
- for _, k2 := range v2 {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- ee.EncodeInt(int64(int(k2)))
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- ee.EncodeUint(uint64(v[int(k2)]))
- }
- } else {
- for k2, v2 := range v {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- ee.EncodeInt(int64(k2))
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- ee.EncodeUint(uint64(v2))
- }
- }
- if cr != nil {
- cr.sendContainerState(containerMapEnd)
- }
-}
-
-func (f *encFnInfo) fastpathEncMapIntUintptrR(rv reflect.Value) {
- fastpathTV.EncMapIntUintptrV(rv.Interface().(map[int]uintptr), fastpathCheckNilFalse, f.e)
-}
-func (_ fastpathT) EncMapIntUintptrV(v map[int]uintptr, checkNil bool, e *Encoder) {
- ee := e.e
- cr := e.cr
- if checkNil && v == nil {
- ee.EncodeNil()
- return
- }
- ee.EncodeMapStart(len(v))
- if e.h.Canonical {
- v2 := make([]int64, len(v))
- var i int
- for k := range v {
- v2[i] = int64(k)
- i++
- }
- sort.Sort(intSlice(v2))
- for _, k2 := range v2 {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- ee.EncodeInt(int64(int(k2)))
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- e.encode(v[int(k2)])
- }
- } else {
- for k2, v2 := range v {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- ee.EncodeInt(int64(k2))
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- e.encode(v2)
- }
- }
- if cr != nil {
- cr.sendContainerState(containerMapEnd)
- }
-}
-
-func (f *encFnInfo) fastpathEncMapIntIntR(rv reflect.Value) {
- fastpathTV.EncMapIntIntV(rv.Interface().(map[int]int), fastpathCheckNilFalse, f.e)
-}
-func (_ fastpathT) EncMapIntIntV(v map[int]int, checkNil bool, e *Encoder) {
- ee := e.e
- cr := e.cr
- if checkNil && v == nil {
- ee.EncodeNil()
- return
- }
- ee.EncodeMapStart(len(v))
- if e.h.Canonical {
- v2 := make([]int64, len(v))
- var i int
- for k := range v {
- v2[i] = int64(k)
- i++
- }
- sort.Sort(intSlice(v2))
- for _, k2 := range v2 {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- ee.EncodeInt(int64(int(k2)))
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- ee.EncodeInt(int64(v[int(k2)]))
- }
- } else {
- for k2, v2 := range v {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- ee.EncodeInt(int64(k2))
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- ee.EncodeInt(int64(v2))
- }
- }
- if cr != nil {
- cr.sendContainerState(containerMapEnd)
- }
-}
-
-func (f *encFnInfo) fastpathEncMapIntInt8R(rv reflect.Value) {
- fastpathTV.EncMapIntInt8V(rv.Interface().(map[int]int8), fastpathCheckNilFalse, f.e)
-}
-func (_ fastpathT) EncMapIntInt8V(v map[int]int8, checkNil bool, e *Encoder) {
- ee := e.e
- cr := e.cr
- if checkNil && v == nil {
- ee.EncodeNil()
- return
- }
- ee.EncodeMapStart(len(v))
- if e.h.Canonical {
- v2 := make([]int64, len(v))
- var i int
- for k := range v {
- v2[i] = int64(k)
- i++
- }
- sort.Sort(intSlice(v2))
- for _, k2 := range v2 {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- ee.EncodeInt(int64(int(k2)))
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- ee.EncodeInt(int64(v[int(k2)]))
- }
- } else {
- for k2, v2 := range v {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- ee.EncodeInt(int64(k2))
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- ee.EncodeInt(int64(v2))
- }
- }
- if cr != nil {
- cr.sendContainerState(containerMapEnd)
- }
-}
-
-func (f *encFnInfo) fastpathEncMapIntInt16R(rv reflect.Value) {
- fastpathTV.EncMapIntInt16V(rv.Interface().(map[int]int16), fastpathCheckNilFalse, f.e)
-}
-func (_ fastpathT) EncMapIntInt16V(v map[int]int16, checkNil bool, e *Encoder) {
- ee := e.e
- cr := e.cr
- if checkNil && v == nil {
- ee.EncodeNil()
- return
- }
- ee.EncodeMapStart(len(v))
- if e.h.Canonical {
- v2 := make([]int64, len(v))
- var i int
- for k := range v {
- v2[i] = int64(k)
- i++
- }
- sort.Sort(intSlice(v2))
- for _, k2 := range v2 {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- ee.EncodeInt(int64(int(k2)))
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- ee.EncodeInt(int64(v[int(k2)]))
- }
- } else {
- for k2, v2 := range v {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- ee.EncodeInt(int64(k2))
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- ee.EncodeInt(int64(v2))
- }
- }
- if cr != nil {
- cr.sendContainerState(containerMapEnd)
- }
-}
-
-func (f *encFnInfo) fastpathEncMapIntInt32R(rv reflect.Value) {
- fastpathTV.EncMapIntInt32V(rv.Interface().(map[int]int32), fastpathCheckNilFalse, f.e)
-}
-func (_ fastpathT) EncMapIntInt32V(v map[int]int32, checkNil bool, e *Encoder) {
- ee := e.e
- cr := e.cr
- if checkNil && v == nil {
- ee.EncodeNil()
- return
- }
- ee.EncodeMapStart(len(v))
- if e.h.Canonical {
- v2 := make([]int64, len(v))
- var i int
- for k := range v {
- v2[i] = int64(k)
- i++
- }
- sort.Sort(intSlice(v2))
- for _, k2 := range v2 {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- ee.EncodeInt(int64(int(k2)))
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- ee.EncodeInt(int64(v[int(k2)]))
- }
- } else {
- for k2, v2 := range v {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- ee.EncodeInt(int64(k2))
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- ee.EncodeInt(int64(v2))
- }
- }
- if cr != nil {
- cr.sendContainerState(containerMapEnd)
- }
-}
-
-func (f *encFnInfo) fastpathEncMapIntInt64R(rv reflect.Value) {
- fastpathTV.EncMapIntInt64V(rv.Interface().(map[int]int64), fastpathCheckNilFalse, f.e)
-}
-func (_ fastpathT) EncMapIntInt64V(v map[int]int64, checkNil bool, e *Encoder) {
- ee := e.e
- cr := e.cr
- if checkNil && v == nil {
- ee.EncodeNil()
- return
- }
- ee.EncodeMapStart(len(v))
- if e.h.Canonical {
- v2 := make([]int64, len(v))
- var i int
- for k := range v {
- v2[i] = int64(k)
- i++
- }
- sort.Sort(intSlice(v2))
- for _, k2 := range v2 {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- ee.EncodeInt(int64(int(k2)))
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- ee.EncodeInt(int64(v[int(k2)]))
- }
- } else {
- for k2, v2 := range v {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- ee.EncodeInt(int64(k2))
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- ee.EncodeInt(int64(v2))
- }
- }
- if cr != nil {
- cr.sendContainerState(containerMapEnd)
- }
-}
-
-func (f *encFnInfo) fastpathEncMapIntFloat32R(rv reflect.Value) {
- fastpathTV.EncMapIntFloat32V(rv.Interface().(map[int]float32), fastpathCheckNilFalse, f.e)
-}
-func (_ fastpathT) EncMapIntFloat32V(v map[int]float32, checkNil bool, e *Encoder) {
- ee := e.e
- cr := e.cr
- if checkNil && v == nil {
- ee.EncodeNil()
- return
- }
- ee.EncodeMapStart(len(v))
- if e.h.Canonical {
- v2 := make([]int64, len(v))
- var i int
- for k := range v {
- v2[i] = int64(k)
- i++
- }
- sort.Sort(intSlice(v2))
- for _, k2 := range v2 {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- ee.EncodeInt(int64(int(k2)))
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- ee.EncodeFloat32(v[int(k2)])
- }
- } else {
- for k2, v2 := range v {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- ee.EncodeInt(int64(k2))
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- ee.EncodeFloat32(v2)
- }
- }
- if cr != nil {
- cr.sendContainerState(containerMapEnd)
- }
-}
-
-func (f *encFnInfo) fastpathEncMapIntFloat64R(rv reflect.Value) {
- fastpathTV.EncMapIntFloat64V(rv.Interface().(map[int]float64), fastpathCheckNilFalse, f.e)
-}
-func (_ fastpathT) EncMapIntFloat64V(v map[int]float64, checkNil bool, e *Encoder) {
- ee := e.e
- cr := e.cr
- if checkNil && v == nil {
- ee.EncodeNil()
- return
- }
- ee.EncodeMapStart(len(v))
- if e.h.Canonical {
- v2 := make([]int64, len(v))
- var i int
- for k := range v {
- v2[i] = int64(k)
- i++
- }
- sort.Sort(intSlice(v2))
- for _, k2 := range v2 {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- ee.EncodeInt(int64(int(k2)))
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- ee.EncodeFloat64(v[int(k2)])
- }
- } else {
- for k2, v2 := range v {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- ee.EncodeInt(int64(k2))
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- ee.EncodeFloat64(v2)
- }
- }
- if cr != nil {
- cr.sendContainerState(containerMapEnd)
- }
-}
-
-func (f *encFnInfo) fastpathEncMapIntBoolR(rv reflect.Value) {
- fastpathTV.EncMapIntBoolV(rv.Interface().(map[int]bool), fastpathCheckNilFalse, f.e)
-}
-func (_ fastpathT) EncMapIntBoolV(v map[int]bool, checkNil bool, e *Encoder) {
- ee := e.e
- cr := e.cr
- if checkNil && v == nil {
- ee.EncodeNil()
- return
- }
- ee.EncodeMapStart(len(v))
- if e.h.Canonical {
- v2 := make([]int64, len(v))
- var i int
- for k := range v {
- v2[i] = int64(k)
- i++
- }
- sort.Sort(intSlice(v2))
- for _, k2 := range v2 {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- ee.EncodeInt(int64(int(k2)))
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- ee.EncodeBool(v[int(k2)])
- }
- } else {
- for k2, v2 := range v {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- ee.EncodeInt(int64(k2))
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- ee.EncodeBool(v2)
- }
- }
- if cr != nil {
- cr.sendContainerState(containerMapEnd)
- }
-}
-
-func (f *encFnInfo) fastpathEncMapInt8IntfR(rv reflect.Value) {
- fastpathTV.EncMapInt8IntfV(rv.Interface().(map[int8]interface{}), fastpathCheckNilFalse, f.e)
-}
-func (_ fastpathT) EncMapInt8IntfV(v map[int8]interface{}, checkNil bool, e *Encoder) {
- ee := e.e
- cr := e.cr
- if checkNil && v == nil {
- ee.EncodeNil()
- return
- }
- ee.EncodeMapStart(len(v))
- if e.h.Canonical {
- v2 := make([]int64, len(v))
- var i int
- for k := range v {
- v2[i] = int64(k)
- i++
- }
- sort.Sort(intSlice(v2))
- for _, k2 := range v2 {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- ee.EncodeInt(int64(int8(k2)))
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- e.encode(v[int8(k2)])
- }
- } else {
- for k2, v2 := range v {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- ee.EncodeInt(int64(k2))
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- e.encode(v2)
- }
- }
- if cr != nil {
- cr.sendContainerState(containerMapEnd)
- }
-}
-
-func (f *encFnInfo) fastpathEncMapInt8StringR(rv reflect.Value) {
- fastpathTV.EncMapInt8StringV(rv.Interface().(map[int8]string), fastpathCheckNilFalse, f.e)
-}
-func (_ fastpathT) EncMapInt8StringV(v map[int8]string, checkNil bool, e *Encoder) {
- ee := e.e
- cr := e.cr
- if checkNil && v == nil {
- ee.EncodeNil()
- return
- }
- ee.EncodeMapStart(len(v))
- if e.h.Canonical {
- v2 := make([]int64, len(v))
- var i int
- for k := range v {
- v2[i] = int64(k)
- i++
- }
- sort.Sort(intSlice(v2))
- for _, k2 := range v2 {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- ee.EncodeInt(int64(int8(k2)))
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- ee.EncodeString(c_UTF8, v[int8(k2)])
- }
- } else {
- for k2, v2 := range v {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- ee.EncodeInt(int64(k2))
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- ee.EncodeString(c_UTF8, v2)
- }
- }
- if cr != nil {
- cr.sendContainerState(containerMapEnd)
- }
-}
-
-func (f *encFnInfo) fastpathEncMapInt8UintR(rv reflect.Value) {
- fastpathTV.EncMapInt8UintV(rv.Interface().(map[int8]uint), fastpathCheckNilFalse, f.e)
-}
-func (_ fastpathT) EncMapInt8UintV(v map[int8]uint, checkNil bool, e *Encoder) {
- ee := e.e
- cr := e.cr
- if checkNil && v == nil {
- ee.EncodeNil()
- return
- }
- ee.EncodeMapStart(len(v))
- if e.h.Canonical {
- v2 := make([]int64, len(v))
- var i int
- for k := range v {
- v2[i] = int64(k)
- i++
- }
- sort.Sort(intSlice(v2))
- for _, k2 := range v2 {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- ee.EncodeInt(int64(int8(k2)))
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- ee.EncodeUint(uint64(v[int8(k2)]))
- }
- } else {
- for k2, v2 := range v {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- ee.EncodeInt(int64(k2))
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- ee.EncodeUint(uint64(v2))
- }
- }
- if cr != nil {
- cr.sendContainerState(containerMapEnd)
- }
-}
-
-func (f *encFnInfo) fastpathEncMapInt8Uint8R(rv reflect.Value) {
- fastpathTV.EncMapInt8Uint8V(rv.Interface().(map[int8]uint8), fastpathCheckNilFalse, f.e)
-}
-func (_ fastpathT) EncMapInt8Uint8V(v map[int8]uint8, checkNil bool, e *Encoder) {
- ee := e.e
- cr := e.cr
- if checkNil && v == nil {
- ee.EncodeNil()
- return
- }
- ee.EncodeMapStart(len(v))
- if e.h.Canonical {
- v2 := make([]int64, len(v))
- var i int
- for k := range v {
- v2[i] = int64(k)
- i++
- }
- sort.Sort(intSlice(v2))
- for _, k2 := range v2 {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- ee.EncodeInt(int64(int8(k2)))
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- ee.EncodeUint(uint64(v[int8(k2)]))
- }
- } else {
- for k2, v2 := range v {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- ee.EncodeInt(int64(k2))
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- ee.EncodeUint(uint64(v2))
- }
- }
- if cr != nil {
- cr.sendContainerState(containerMapEnd)
- }
-}
-
-func (f *encFnInfo) fastpathEncMapInt8Uint16R(rv reflect.Value) {
- fastpathTV.EncMapInt8Uint16V(rv.Interface().(map[int8]uint16), fastpathCheckNilFalse, f.e)
-}
-func (_ fastpathT) EncMapInt8Uint16V(v map[int8]uint16, checkNil bool, e *Encoder) {
- ee := e.e
- cr := e.cr
- if checkNil && v == nil {
- ee.EncodeNil()
- return
- }
- ee.EncodeMapStart(len(v))
- if e.h.Canonical {
- v2 := make([]int64, len(v))
- var i int
- for k := range v {
- v2[i] = int64(k)
- i++
- }
- sort.Sort(intSlice(v2))
- for _, k2 := range v2 {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- ee.EncodeInt(int64(int8(k2)))
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- ee.EncodeUint(uint64(v[int8(k2)]))
- }
- } else {
- for k2, v2 := range v {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- ee.EncodeInt(int64(k2))
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- ee.EncodeUint(uint64(v2))
- }
- }
- if cr != nil {
- cr.sendContainerState(containerMapEnd)
- }
-}
-
-func (f *encFnInfo) fastpathEncMapInt8Uint32R(rv reflect.Value) {
- fastpathTV.EncMapInt8Uint32V(rv.Interface().(map[int8]uint32), fastpathCheckNilFalse, f.e)
-}
-func (_ fastpathT) EncMapInt8Uint32V(v map[int8]uint32, checkNil bool, e *Encoder) {
- ee := e.e
- cr := e.cr
- if checkNil && v == nil {
- ee.EncodeNil()
- return
- }
- ee.EncodeMapStart(len(v))
- if e.h.Canonical {
- v2 := make([]int64, len(v))
- var i int
- for k := range v {
- v2[i] = int64(k)
- i++
- }
- sort.Sort(intSlice(v2))
- for _, k2 := range v2 {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- ee.EncodeInt(int64(int8(k2)))
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- ee.EncodeUint(uint64(v[int8(k2)]))
- }
- } else {
- for k2, v2 := range v {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- ee.EncodeInt(int64(k2))
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- ee.EncodeUint(uint64(v2))
- }
- }
- if cr != nil {
- cr.sendContainerState(containerMapEnd)
- }
-}
-
-func (f *encFnInfo) fastpathEncMapInt8Uint64R(rv reflect.Value) {
- fastpathTV.EncMapInt8Uint64V(rv.Interface().(map[int8]uint64), fastpathCheckNilFalse, f.e)
-}
-func (_ fastpathT) EncMapInt8Uint64V(v map[int8]uint64, checkNil bool, e *Encoder) {
- ee := e.e
- cr := e.cr
- if checkNil && v == nil {
- ee.EncodeNil()
- return
- }
- ee.EncodeMapStart(len(v))
- if e.h.Canonical {
- v2 := make([]int64, len(v))
- var i int
- for k := range v {
- v2[i] = int64(k)
- i++
- }
- sort.Sort(intSlice(v2))
- for _, k2 := range v2 {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- ee.EncodeInt(int64(int8(k2)))
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- ee.EncodeUint(uint64(v[int8(k2)]))
- }
- } else {
- for k2, v2 := range v {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- ee.EncodeInt(int64(k2))
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- ee.EncodeUint(uint64(v2))
- }
- }
- if cr != nil {
- cr.sendContainerState(containerMapEnd)
- }
-}
-
-func (f *encFnInfo) fastpathEncMapInt8UintptrR(rv reflect.Value) {
- fastpathTV.EncMapInt8UintptrV(rv.Interface().(map[int8]uintptr), fastpathCheckNilFalse, f.e)
-}
-func (_ fastpathT) EncMapInt8UintptrV(v map[int8]uintptr, checkNil bool, e *Encoder) {
- ee := e.e
- cr := e.cr
- if checkNil && v == nil {
- ee.EncodeNil()
- return
- }
- ee.EncodeMapStart(len(v))
- if e.h.Canonical {
- v2 := make([]int64, len(v))
- var i int
- for k := range v {
- v2[i] = int64(k)
- i++
- }
- sort.Sort(intSlice(v2))
- for _, k2 := range v2 {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- ee.EncodeInt(int64(int8(k2)))
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- e.encode(v[int8(k2)])
- }
- } else {
- for k2, v2 := range v {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- ee.EncodeInt(int64(k2))
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- e.encode(v2)
- }
- }
- if cr != nil {
- cr.sendContainerState(containerMapEnd)
- }
-}
-
-func (f *encFnInfo) fastpathEncMapInt8IntR(rv reflect.Value) {
- fastpathTV.EncMapInt8IntV(rv.Interface().(map[int8]int), fastpathCheckNilFalse, f.e)
-}
-func (_ fastpathT) EncMapInt8IntV(v map[int8]int, checkNil bool, e *Encoder) {
- ee := e.e
- cr := e.cr
- if checkNil && v == nil {
- ee.EncodeNil()
- return
- }
- ee.EncodeMapStart(len(v))
- if e.h.Canonical {
- v2 := make([]int64, len(v))
- var i int
- for k := range v {
- v2[i] = int64(k)
- i++
- }
- sort.Sort(intSlice(v2))
- for _, k2 := range v2 {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- ee.EncodeInt(int64(int8(k2)))
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- ee.EncodeInt(int64(v[int8(k2)]))
- }
- } else {
- for k2, v2 := range v {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- ee.EncodeInt(int64(k2))
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- ee.EncodeInt(int64(v2))
- }
- }
- if cr != nil {
- cr.sendContainerState(containerMapEnd)
- }
-}
-
-func (f *encFnInfo) fastpathEncMapInt8Int8R(rv reflect.Value) {
- fastpathTV.EncMapInt8Int8V(rv.Interface().(map[int8]int8), fastpathCheckNilFalse, f.e)
-}
-func (_ fastpathT) EncMapInt8Int8V(v map[int8]int8, checkNil bool, e *Encoder) {
- ee := e.e
- cr := e.cr
- if checkNil && v == nil {
- ee.EncodeNil()
- return
- }
- ee.EncodeMapStart(len(v))
- if e.h.Canonical {
- v2 := make([]int64, len(v))
- var i int
- for k := range v {
- v2[i] = int64(k)
- i++
- }
- sort.Sort(intSlice(v2))
- for _, k2 := range v2 {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- ee.EncodeInt(int64(int8(k2)))
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- ee.EncodeInt(int64(v[int8(k2)]))
- }
- } else {
- for k2, v2 := range v {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- ee.EncodeInt(int64(k2))
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- ee.EncodeInt(int64(v2))
- }
- }
- if cr != nil {
- cr.sendContainerState(containerMapEnd)
- }
-}
-
-func (f *encFnInfo) fastpathEncMapInt8Int16R(rv reflect.Value) {
- fastpathTV.EncMapInt8Int16V(rv.Interface().(map[int8]int16), fastpathCheckNilFalse, f.e)
-}
-func (_ fastpathT) EncMapInt8Int16V(v map[int8]int16, checkNil bool, e *Encoder) {
- ee := e.e
- cr := e.cr
- if checkNil && v == nil {
- ee.EncodeNil()
- return
- }
- ee.EncodeMapStart(len(v))
- if e.h.Canonical {
- v2 := make([]int64, len(v))
- var i int
- for k := range v {
- v2[i] = int64(k)
- i++
- }
- sort.Sort(intSlice(v2))
- for _, k2 := range v2 {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- ee.EncodeInt(int64(int8(k2)))
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- ee.EncodeInt(int64(v[int8(k2)]))
- }
- } else {
- for k2, v2 := range v {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- ee.EncodeInt(int64(k2))
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- ee.EncodeInt(int64(v2))
- }
- }
- if cr != nil {
- cr.sendContainerState(containerMapEnd)
- }
-}
-
-func (f *encFnInfo) fastpathEncMapInt8Int32R(rv reflect.Value) {
- fastpathTV.EncMapInt8Int32V(rv.Interface().(map[int8]int32), fastpathCheckNilFalse, f.e)
-}
-func (_ fastpathT) EncMapInt8Int32V(v map[int8]int32, checkNil bool, e *Encoder) {
- ee := e.e
- cr := e.cr
- if checkNil && v == nil {
- ee.EncodeNil()
- return
- }
- ee.EncodeMapStart(len(v))
- if e.h.Canonical {
- v2 := make([]int64, len(v))
- var i int
- for k := range v {
- v2[i] = int64(k)
- i++
- }
- sort.Sort(intSlice(v2))
- for _, k2 := range v2 {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- ee.EncodeInt(int64(int8(k2)))
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- ee.EncodeInt(int64(v[int8(k2)]))
- }
- } else {
- for k2, v2 := range v {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- ee.EncodeInt(int64(k2))
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- ee.EncodeInt(int64(v2))
- }
- }
- if cr != nil {
- cr.sendContainerState(containerMapEnd)
- }
-}
-
-func (f *encFnInfo) fastpathEncMapInt8Int64R(rv reflect.Value) {
- fastpathTV.EncMapInt8Int64V(rv.Interface().(map[int8]int64), fastpathCheckNilFalse, f.e)
-}
-func (_ fastpathT) EncMapInt8Int64V(v map[int8]int64, checkNil bool, e *Encoder) {
- ee := e.e
- cr := e.cr
- if checkNil && v == nil {
- ee.EncodeNil()
- return
- }
- ee.EncodeMapStart(len(v))
- if e.h.Canonical {
- v2 := make([]int64, len(v))
- var i int
- for k := range v {
- v2[i] = int64(k)
- i++
- }
- sort.Sort(intSlice(v2))
- for _, k2 := range v2 {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- ee.EncodeInt(int64(int8(k2)))
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- ee.EncodeInt(int64(v[int8(k2)]))
- }
- } else {
- for k2, v2 := range v {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- ee.EncodeInt(int64(k2))
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- ee.EncodeInt(int64(v2))
- }
- }
- if cr != nil {
- cr.sendContainerState(containerMapEnd)
- }
-}
-
-func (f *encFnInfo) fastpathEncMapInt8Float32R(rv reflect.Value) {
- fastpathTV.EncMapInt8Float32V(rv.Interface().(map[int8]float32), fastpathCheckNilFalse, f.e)
-}
-func (_ fastpathT) EncMapInt8Float32V(v map[int8]float32, checkNil bool, e *Encoder) {
- ee := e.e
- cr := e.cr
- if checkNil && v == nil {
- ee.EncodeNil()
- return
- }
- ee.EncodeMapStart(len(v))
- if e.h.Canonical {
- v2 := make([]int64, len(v))
- var i int
- for k := range v {
- v2[i] = int64(k)
- i++
- }
- sort.Sort(intSlice(v2))
- for _, k2 := range v2 {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- ee.EncodeInt(int64(int8(k2)))
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- ee.EncodeFloat32(v[int8(k2)])
- }
- } else {
- for k2, v2 := range v {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- ee.EncodeInt(int64(k2))
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- ee.EncodeFloat32(v2)
- }
- }
- if cr != nil {
- cr.sendContainerState(containerMapEnd)
- }
-}
-
-func (f *encFnInfo) fastpathEncMapInt8Float64R(rv reflect.Value) {
- fastpathTV.EncMapInt8Float64V(rv.Interface().(map[int8]float64), fastpathCheckNilFalse, f.e)
-}
-func (_ fastpathT) EncMapInt8Float64V(v map[int8]float64, checkNil bool, e *Encoder) {
- ee := e.e
- cr := e.cr
- if checkNil && v == nil {
- ee.EncodeNil()
- return
- }
- ee.EncodeMapStart(len(v))
- if e.h.Canonical {
- v2 := make([]int64, len(v))
- var i int
- for k := range v {
- v2[i] = int64(k)
- i++
- }
- sort.Sort(intSlice(v2))
- for _, k2 := range v2 {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- ee.EncodeInt(int64(int8(k2)))
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- ee.EncodeFloat64(v[int8(k2)])
- }
- } else {
- for k2, v2 := range v {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- ee.EncodeInt(int64(k2))
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- ee.EncodeFloat64(v2)
- }
- }
- if cr != nil {
- cr.sendContainerState(containerMapEnd)
- }
-}
-
-func (f *encFnInfo) fastpathEncMapInt8BoolR(rv reflect.Value) {
- fastpathTV.EncMapInt8BoolV(rv.Interface().(map[int8]bool), fastpathCheckNilFalse, f.e)
-}
-func (_ fastpathT) EncMapInt8BoolV(v map[int8]bool, checkNil bool, e *Encoder) {
- ee := e.e
- cr := e.cr
- if checkNil && v == nil {
- ee.EncodeNil()
- return
- }
- ee.EncodeMapStart(len(v))
- if e.h.Canonical {
- v2 := make([]int64, len(v))
- var i int
- for k := range v {
- v2[i] = int64(k)
- i++
- }
- sort.Sort(intSlice(v2))
- for _, k2 := range v2 {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- ee.EncodeInt(int64(int8(k2)))
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- ee.EncodeBool(v[int8(k2)])
- }
- } else {
- for k2, v2 := range v {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- ee.EncodeInt(int64(k2))
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- ee.EncodeBool(v2)
- }
- }
- if cr != nil {
- cr.sendContainerState(containerMapEnd)
- }
-}
-
-func (f *encFnInfo) fastpathEncMapInt16IntfR(rv reflect.Value) {
- fastpathTV.EncMapInt16IntfV(rv.Interface().(map[int16]interface{}), fastpathCheckNilFalse, f.e)
-}
-func (_ fastpathT) EncMapInt16IntfV(v map[int16]interface{}, checkNil bool, e *Encoder) {
- ee := e.e
- cr := e.cr
- if checkNil && v == nil {
- ee.EncodeNil()
- return
- }
- ee.EncodeMapStart(len(v))
- if e.h.Canonical {
- v2 := make([]int64, len(v))
- var i int
- for k := range v {
- v2[i] = int64(k)
- i++
- }
- sort.Sort(intSlice(v2))
- for _, k2 := range v2 {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- ee.EncodeInt(int64(int16(k2)))
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- e.encode(v[int16(k2)])
- }
- } else {
- for k2, v2 := range v {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- ee.EncodeInt(int64(k2))
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- e.encode(v2)
- }
- }
- if cr != nil {
- cr.sendContainerState(containerMapEnd)
- }
-}
-
-func (f *encFnInfo) fastpathEncMapInt16StringR(rv reflect.Value) {
- fastpathTV.EncMapInt16StringV(rv.Interface().(map[int16]string), fastpathCheckNilFalse, f.e)
-}
-func (_ fastpathT) EncMapInt16StringV(v map[int16]string, checkNil bool, e *Encoder) {
- ee := e.e
- cr := e.cr
- if checkNil && v == nil {
- ee.EncodeNil()
- return
- }
- ee.EncodeMapStart(len(v))
- if e.h.Canonical {
- v2 := make([]int64, len(v))
- var i int
- for k := range v {
- v2[i] = int64(k)
- i++
- }
- sort.Sort(intSlice(v2))
- for _, k2 := range v2 {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- ee.EncodeInt(int64(int16(k2)))
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- ee.EncodeString(c_UTF8, v[int16(k2)])
- }
- } else {
- for k2, v2 := range v {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- ee.EncodeInt(int64(k2))
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- ee.EncodeString(c_UTF8, v2)
- }
- }
- if cr != nil {
- cr.sendContainerState(containerMapEnd)
- }
-}
-
-func (f *encFnInfo) fastpathEncMapInt16UintR(rv reflect.Value) {
- fastpathTV.EncMapInt16UintV(rv.Interface().(map[int16]uint), fastpathCheckNilFalse, f.e)
-}
-func (_ fastpathT) EncMapInt16UintV(v map[int16]uint, checkNil bool, e *Encoder) {
- ee := e.e
- cr := e.cr
- if checkNil && v == nil {
- ee.EncodeNil()
- return
- }
- ee.EncodeMapStart(len(v))
- if e.h.Canonical {
- v2 := make([]int64, len(v))
- var i int
- for k := range v {
- v2[i] = int64(k)
- i++
- }
- sort.Sort(intSlice(v2))
- for _, k2 := range v2 {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- ee.EncodeInt(int64(int16(k2)))
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- ee.EncodeUint(uint64(v[int16(k2)]))
- }
- } else {
- for k2, v2 := range v {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- ee.EncodeInt(int64(k2))
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- ee.EncodeUint(uint64(v2))
- }
- }
- if cr != nil {
- cr.sendContainerState(containerMapEnd)
- }
-}
-
-func (f *encFnInfo) fastpathEncMapInt16Uint8R(rv reflect.Value) {
- fastpathTV.EncMapInt16Uint8V(rv.Interface().(map[int16]uint8), fastpathCheckNilFalse, f.e)
-}
-func (_ fastpathT) EncMapInt16Uint8V(v map[int16]uint8, checkNil bool, e *Encoder) {
- ee := e.e
- cr := e.cr
- if checkNil && v == nil {
- ee.EncodeNil()
- return
- }
- ee.EncodeMapStart(len(v))
- if e.h.Canonical {
- v2 := make([]int64, len(v))
- var i int
- for k := range v {
- v2[i] = int64(k)
- i++
- }
- sort.Sort(intSlice(v2))
- for _, k2 := range v2 {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- ee.EncodeInt(int64(int16(k2)))
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- ee.EncodeUint(uint64(v[int16(k2)]))
- }
- } else {
- for k2, v2 := range v {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- ee.EncodeInt(int64(k2))
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- ee.EncodeUint(uint64(v2))
- }
- }
- if cr != nil {
- cr.sendContainerState(containerMapEnd)
- }
-}
-
-func (f *encFnInfo) fastpathEncMapInt16Uint16R(rv reflect.Value) {
- fastpathTV.EncMapInt16Uint16V(rv.Interface().(map[int16]uint16), fastpathCheckNilFalse, f.e)
-}
-func (_ fastpathT) EncMapInt16Uint16V(v map[int16]uint16, checkNil bool, e *Encoder) {
- ee := e.e
- cr := e.cr
- if checkNil && v == nil {
- ee.EncodeNil()
- return
- }
- ee.EncodeMapStart(len(v))
- if e.h.Canonical {
- v2 := make([]int64, len(v))
- var i int
- for k := range v {
- v2[i] = int64(k)
- i++
- }
- sort.Sort(intSlice(v2))
- for _, k2 := range v2 {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- ee.EncodeInt(int64(int16(k2)))
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- ee.EncodeUint(uint64(v[int16(k2)]))
- }
- } else {
- for k2, v2 := range v {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- ee.EncodeInt(int64(k2))
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- ee.EncodeUint(uint64(v2))
- }
- }
- if cr != nil {
- cr.sendContainerState(containerMapEnd)
- }
-}
-
-func (f *encFnInfo) fastpathEncMapInt16Uint32R(rv reflect.Value) {
- fastpathTV.EncMapInt16Uint32V(rv.Interface().(map[int16]uint32), fastpathCheckNilFalse, f.e)
-}
-func (_ fastpathT) EncMapInt16Uint32V(v map[int16]uint32, checkNil bool, e *Encoder) {
- ee := e.e
- cr := e.cr
- if checkNil && v == nil {
- ee.EncodeNil()
- return
- }
- ee.EncodeMapStart(len(v))
- if e.h.Canonical {
- v2 := make([]int64, len(v))
- var i int
- for k := range v {
- v2[i] = int64(k)
- i++
- }
- sort.Sort(intSlice(v2))
- for _, k2 := range v2 {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- ee.EncodeInt(int64(int16(k2)))
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- ee.EncodeUint(uint64(v[int16(k2)]))
- }
- } else {
- for k2, v2 := range v {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- ee.EncodeInt(int64(k2))
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- ee.EncodeUint(uint64(v2))
- }
- }
- if cr != nil {
- cr.sendContainerState(containerMapEnd)
- }
-}
-
-func (f *encFnInfo) fastpathEncMapInt16Uint64R(rv reflect.Value) {
- fastpathTV.EncMapInt16Uint64V(rv.Interface().(map[int16]uint64), fastpathCheckNilFalse, f.e)
-}
-func (_ fastpathT) EncMapInt16Uint64V(v map[int16]uint64, checkNil bool, e *Encoder) {
- ee := e.e
- cr := e.cr
- if checkNil && v == nil {
- ee.EncodeNil()
- return
- }
- ee.EncodeMapStart(len(v))
- if e.h.Canonical {
- v2 := make([]int64, len(v))
- var i int
- for k := range v {
- v2[i] = int64(k)
- i++
- }
- sort.Sort(intSlice(v2))
- for _, k2 := range v2 {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- ee.EncodeInt(int64(int16(k2)))
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- ee.EncodeUint(uint64(v[int16(k2)]))
- }
- } else {
- for k2, v2 := range v {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- ee.EncodeInt(int64(k2))
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- ee.EncodeUint(uint64(v2))
- }
- }
- if cr != nil {
- cr.sendContainerState(containerMapEnd)
- }
-}
-
-func (f *encFnInfo) fastpathEncMapInt16UintptrR(rv reflect.Value) {
- fastpathTV.EncMapInt16UintptrV(rv.Interface().(map[int16]uintptr), fastpathCheckNilFalse, f.e)
-}
-func (_ fastpathT) EncMapInt16UintptrV(v map[int16]uintptr, checkNil bool, e *Encoder) {
- ee := e.e
- cr := e.cr
- if checkNil && v == nil {
- ee.EncodeNil()
- return
- }
- ee.EncodeMapStart(len(v))
- if e.h.Canonical {
- v2 := make([]int64, len(v))
- var i int
- for k := range v {
- v2[i] = int64(k)
- i++
- }
- sort.Sort(intSlice(v2))
- for _, k2 := range v2 {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- ee.EncodeInt(int64(int16(k2)))
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- e.encode(v[int16(k2)])
- }
- } else {
- for k2, v2 := range v {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- ee.EncodeInt(int64(k2))
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- e.encode(v2)
- }
- }
- if cr != nil {
- cr.sendContainerState(containerMapEnd)
- }
-}
-
-func (f *encFnInfo) fastpathEncMapInt16IntR(rv reflect.Value) {
- fastpathTV.EncMapInt16IntV(rv.Interface().(map[int16]int), fastpathCheckNilFalse, f.e)
-}
-func (_ fastpathT) EncMapInt16IntV(v map[int16]int, checkNil bool, e *Encoder) {
- ee := e.e
- cr := e.cr
- if checkNil && v == nil {
- ee.EncodeNil()
- return
- }
- ee.EncodeMapStart(len(v))
- if e.h.Canonical {
- v2 := make([]int64, len(v))
- var i int
- for k := range v {
- v2[i] = int64(k)
- i++
- }
- sort.Sort(intSlice(v2))
- for _, k2 := range v2 {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- ee.EncodeInt(int64(int16(k2)))
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- ee.EncodeInt(int64(v[int16(k2)]))
- }
- } else {
- for k2, v2 := range v {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- ee.EncodeInt(int64(k2))
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- ee.EncodeInt(int64(v2))
- }
- }
- if cr != nil {
- cr.sendContainerState(containerMapEnd)
- }
-}
-
-func (f *encFnInfo) fastpathEncMapInt16Int8R(rv reflect.Value) {
- fastpathTV.EncMapInt16Int8V(rv.Interface().(map[int16]int8), fastpathCheckNilFalse, f.e)
-}
-func (_ fastpathT) EncMapInt16Int8V(v map[int16]int8, checkNil bool, e *Encoder) {
- ee := e.e
- cr := e.cr
- if checkNil && v == nil {
- ee.EncodeNil()
- return
- }
- ee.EncodeMapStart(len(v))
- if e.h.Canonical {
- v2 := make([]int64, len(v))
- var i int
- for k := range v {
- v2[i] = int64(k)
- i++
- }
- sort.Sort(intSlice(v2))
- for _, k2 := range v2 {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- ee.EncodeInt(int64(int16(k2)))
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- ee.EncodeInt(int64(v[int16(k2)]))
- }
- } else {
- for k2, v2 := range v {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- ee.EncodeInt(int64(k2))
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- ee.EncodeInt(int64(v2))
- }
- }
- if cr != nil {
- cr.sendContainerState(containerMapEnd)
- }
-}
-
-func (f *encFnInfo) fastpathEncMapInt16Int16R(rv reflect.Value) {
- fastpathTV.EncMapInt16Int16V(rv.Interface().(map[int16]int16), fastpathCheckNilFalse, f.e)
-}
-func (_ fastpathT) EncMapInt16Int16V(v map[int16]int16, checkNil bool, e *Encoder) {
- ee := e.e
- cr := e.cr
- if checkNil && v == nil {
- ee.EncodeNil()
- return
- }
- ee.EncodeMapStart(len(v))
- if e.h.Canonical {
- v2 := make([]int64, len(v))
- var i int
- for k := range v {
- v2[i] = int64(k)
- i++
- }
- sort.Sort(intSlice(v2))
- for _, k2 := range v2 {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- ee.EncodeInt(int64(int16(k2)))
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- ee.EncodeInt(int64(v[int16(k2)]))
- }
- } else {
- for k2, v2 := range v {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- ee.EncodeInt(int64(k2))
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- ee.EncodeInt(int64(v2))
- }
- }
- if cr != nil {
- cr.sendContainerState(containerMapEnd)
- }
-}
-
-func (f *encFnInfo) fastpathEncMapInt16Int32R(rv reflect.Value) {
- fastpathTV.EncMapInt16Int32V(rv.Interface().(map[int16]int32), fastpathCheckNilFalse, f.e)
-}
-func (_ fastpathT) EncMapInt16Int32V(v map[int16]int32, checkNil bool, e *Encoder) {
- ee := e.e
- cr := e.cr
- if checkNil && v == nil {
- ee.EncodeNil()
- return
- }
- ee.EncodeMapStart(len(v))
- if e.h.Canonical {
- v2 := make([]int64, len(v))
- var i int
- for k := range v {
- v2[i] = int64(k)
- i++
- }
- sort.Sort(intSlice(v2))
- for _, k2 := range v2 {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- ee.EncodeInt(int64(int16(k2)))
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- ee.EncodeInt(int64(v[int16(k2)]))
- }
- } else {
- for k2, v2 := range v {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- ee.EncodeInt(int64(k2))
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- ee.EncodeInt(int64(v2))
- }
- }
- if cr != nil {
- cr.sendContainerState(containerMapEnd)
- }
-}
-
-func (f *encFnInfo) fastpathEncMapInt16Int64R(rv reflect.Value) {
- fastpathTV.EncMapInt16Int64V(rv.Interface().(map[int16]int64), fastpathCheckNilFalse, f.e)
-}
-func (_ fastpathT) EncMapInt16Int64V(v map[int16]int64, checkNil bool, e *Encoder) {
- ee := e.e
- cr := e.cr
- if checkNil && v == nil {
- ee.EncodeNil()
- return
- }
- ee.EncodeMapStart(len(v))
- if e.h.Canonical {
- v2 := make([]int64, len(v))
- var i int
- for k := range v {
- v2[i] = int64(k)
- i++
- }
- sort.Sort(intSlice(v2))
- for _, k2 := range v2 {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- ee.EncodeInt(int64(int16(k2)))
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- ee.EncodeInt(int64(v[int16(k2)]))
- }
- } else {
- for k2, v2 := range v {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- ee.EncodeInt(int64(k2))
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- ee.EncodeInt(int64(v2))
- }
- }
- if cr != nil {
- cr.sendContainerState(containerMapEnd)
- }
-}
-
-func (f *encFnInfo) fastpathEncMapInt16Float32R(rv reflect.Value) {
- fastpathTV.EncMapInt16Float32V(rv.Interface().(map[int16]float32), fastpathCheckNilFalse, f.e)
-}
-func (_ fastpathT) EncMapInt16Float32V(v map[int16]float32, checkNil bool, e *Encoder) {
- ee := e.e
- cr := e.cr
- if checkNil && v == nil {
- ee.EncodeNil()
- return
- }
- ee.EncodeMapStart(len(v))
- if e.h.Canonical {
- v2 := make([]int64, len(v))
- var i int
- for k := range v {
- v2[i] = int64(k)
- i++
- }
- sort.Sort(intSlice(v2))
- for _, k2 := range v2 {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- ee.EncodeInt(int64(int16(k2)))
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- ee.EncodeFloat32(v[int16(k2)])
- }
- } else {
- for k2, v2 := range v {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- ee.EncodeInt(int64(k2))
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- ee.EncodeFloat32(v2)
- }
- }
- if cr != nil {
- cr.sendContainerState(containerMapEnd)
- }
-}
-
-func (f *encFnInfo) fastpathEncMapInt16Float64R(rv reflect.Value) {
- fastpathTV.EncMapInt16Float64V(rv.Interface().(map[int16]float64), fastpathCheckNilFalse, f.e)
-}
-func (_ fastpathT) EncMapInt16Float64V(v map[int16]float64, checkNil bool, e *Encoder) {
- ee := e.e
- cr := e.cr
- if checkNil && v == nil {
- ee.EncodeNil()
- return
- }
- ee.EncodeMapStart(len(v))
- if e.h.Canonical {
- v2 := make([]int64, len(v))
- var i int
- for k := range v {
- v2[i] = int64(k)
- i++
- }
- sort.Sort(intSlice(v2))
- for _, k2 := range v2 {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- ee.EncodeInt(int64(int16(k2)))
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- ee.EncodeFloat64(v[int16(k2)])
- }
- } else {
- for k2, v2 := range v {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- ee.EncodeInt(int64(k2))
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- ee.EncodeFloat64(v2)
- }
- }
- if cr != nil {
- cr.sendContainerState(containerMapEnd)
- }
-}
-
-func (f *encFnInfo) fastpathEncMapInt16BoolR(rv reflect.Value) {
- fastpathTV.EncMapInt16BoolV(rv.Interface().(map[int16]bool), fastpathCheckNilFalse, f.e)
-}
-func (_ fastpathT) EncMapInt16BoolV(v map[int16]bool, checkNil bool, e *Encoder) {
- ee := e.e
- cr := e.cr
- if checkNil && v == nil {
- ee.EncodeNil()
- return
- }
- ee.EncodeMapStart(len(v))
- if e.h.Canonical {
- v2 := make([]int64, len(v))
- var i int
- for k := range v {
- v2[i] = int64(k)
- i++
- }
- sort.Sort(intSlice(v2))
- for _, k2 := range v2 {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- ee.EncodeInt(int64(int16(k2)))
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- ee.EncodeBool(v[int16(k2)])
- }
- } else {
- for k2, v2 := range v {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- ee.EncodeInt(int64(k2))
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- ee.EncodeBool(v2)
- }
- }
- if cr != nil {
- cr.sendContainerState(containerMapEnd)
- }
-}
-
-func (f *encFnInfo) fastpathEncMapInt32IntfR(rv reflect.Value) {
- fastpathTV.EncMapInt32IntfV(rv.Interface().(map[int32]interface{}), fastpathCheckNilFalse, f.e)
-}
-func (_ fastpathT) EncMapInt32IntfV(v map[int32]interface{}, checkNil bool, e *Encoder) {
- ee := e.e
- cr := e.cr
- if checkNil && v == nil {
- ee.EncodeNil()
- return
- }
- ee.EncodeMapStart(len(v))
- if e.h.Canonical {
- v2 := make([]int64, len(v))
- var i int
- for k := range v {
- v2[i] = int64(k)
- i++
- }
- sort.Sort(intSlice(v2))
- for _, k2 := range v2 {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- ee.EncodeInt(int64(int32(k2)))
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- e.encode(v[int32(k2)])
- }
- } else {
- for k2, v2 := range v {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- ee.EncodeInt(int64(k2))
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- e.encode(v2)
- }
- }
- if cr != nil {
- cr.sendContainerState(containerMapEnd)
- }
-}
-
-func (f *encFnInfo) fastpathEncMapInt32StringR(rv reflect.Value) {
- fastpathTV.EncMapInt32StringV(rv.Interface().(map[int32]string), fastpathCheckNilFalse, f.e)
-}
-func (_ fastpathT) EncMapInt32StringV(v map[int32]string, checkNil bool, e *Encoder) {
- ee := e.e
- cr := e.cr
- if checkNil && v == nil {
- ee.EncodeNil()
- return
- }
- ee.EncodeMapStart(len(v))
- if e.h.Canonical {
- v2 := make([]int64, len(v))
- var i int
- for k := range v {
- v2[i] = int64(k)
- i++
- }
- sort.Sort(intSlice(v2))
- for _, k2 := range v2 {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- ee.EncodeInt(int64(int32(k2)))
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- ee.EncodeString(c_UTF8, v[int32(k2)])
- }
- } else {
- for k2, v2 := range v {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- ee.EncodeInt(int64(k2))
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- ee.EncodeString(c_UTF8, v2)
- }
- }
- if cr != nil {
- cr.sendContainerState(containerMapEnd)
- }
-}
-
-func (f *encFnInfo) fastpathEncMapInt32UintR(rv reflect.Value) {
- fastpathTV.EncMapInt32UintV(rv.Interface().(map[int32]uint), fastpathCheckNilFalse, f.e)
-}
-func (_ fastpathT) EncMapInt32UintV(v map[int32]uint, checkNil bool, e *Encoder) {
- ee := e.e
- cr := e.cr
- if checkNil && v == nil {
- ee.EncodeNil()
- return
- }
- ee.EncodeMapStart(len(v))
- if e.h.Canonical {
- v2 := make([]int64, len(v))
- var i int
- for k := range v {
- v2[i] = int64(k)
- i++
- }
- sort.Sort(intSlice(v2))
- for _, k2 := range v2 {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- ee.EncodeInt(int64(int32(k2)))
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- ee.EncodeUint(uint64(v[int32(k2)]))
- }
- } else {
- for k2, v2 := range v {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- ee.EncodeInt(int64(k2))
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- ee.EncodeUint(uint64(v2))
- }
- }
- if cr != nil {
- cr.sendContainerState(containerMapEnd)
- }
-}
-
-func (f *encFnInfo) fastpathEncMapInt32Uint8R(rv reflect.Value) {
- fastpathTV.EncMapInt32Uint8V(rv.Interface().(map[int32]uint8), fastpathCheckNilFalse, f.e)
-}
-func (_ fastpathT) EncMapInt32Uint8V(v map[int32]uint8, checkNil bool, e *Encoder) {
- ee := e.e
- cr := e.cr
- if checkNil && v == nil {
- ee.EncodeNil()
- return
- }
- ee.EncodeMapStart(len(v))
- if e.h.Canonical {
- v2 := make([]int64, len(v))
- var i int
- for k := range v {
- v2[i] = int64(k)
- i++
- }
- sort.Sort(intSlice(v2))
- for _, k2 := range v2 {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- ee.EncodeInt(int64(int32(k2)))
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- ee.EncodeUint(uint64(v[int32(k2)]))
- }
- } else {
- for k2, v2 := range v {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- ee.EncodeInt(int64(k2))
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- ee.EncodeUint(uint64(v2))
- }
- }
- if cr != nil {
- cr.sendContainerState(containerMapEnd)
- }
-}
-
-func (f *encFnInfo) fastpathEncMapInt32Uint16R(rv reflect.Value) {
- fastpathTV.EncMapInt32Uint16V(rv.Interface().(map[int32]uint16), fastpathCheckNilFalse, f.e)
-}
-func (_ fastpathT) EncMapInt32Uint16V(v map[int32]uint16, checkNil bool, e *Encoder) {
- ee := e.e
- cr := e.cr
- if checkNil && v == nil {
- ee.EncodeNil()
- return
- }
- ee.EncodeMapStart(len(v))
- if e.h.Canonical {
- v2 := make([]int64, len(v))
- var i int
- for k := range v {
- v2[i] = int64(k)
- i++
- }
- sort.Sort(intSlice(v2))
- for _, k2 := range v2 {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- ee.EncodeInt(int64(int32(k2)))
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- ee.EncodeUint(uint64(v[int32(k2)]))
- }
- } else {
- for k2, v2 := range v {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- ee.EncodeInt(int64(k2))
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- ee.EncodeUint(uint64(v2))
- }
- }
- if cr != nil {
- cr.sendContainerState(containerMapEnd)
- }
-}
-
-func (f *encFnInfo) fastpathEncMapInt32Uint32R(rv reflect.Value) {
- fastpathTV.EncMapInt32Uint32V(rv.Interface().(map[int32]uint32), fastpathCheckNilFalse, f.e)
-}
-func (_ fastpathT) EncMapInt32Uint32V(v map[int32]uint32, checkNil bool, e *Encoder) {
- ee := e.e
- cr := e.cr
- if checkNil && v == nil {
- ee.EncodeNil()
- return
- }
- ee.EncodeMapStart(len(v))
- if e.h.Canonical {
- v2 := make([]int64, len(v))
- var i int
- for k := range v {
- v2[i] = int64(k)
- i++
- }
- sort.Sort(intSlice(v2))
- for _, k2 := range v2 {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- ee.EncodeInt(int64(int32(k2)))
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- ee.EncodeUint(uint64(v[int32(k2)]))
- }
- } else {
- for k2, v2 := range v {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- ee.EncodeInt(int64(k2))
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- ee.EncodeUint(uint64(v2))
- }
- }
- if cr != nil {
- cr.sendContainerState(containerMapEnd)
- }
-}
-
-func (f *encFnInfo) fastpathEncMapInt32Uint64R(rv reflect.Value) {
- fastpathTV.EncMapInt32Uint64V(rv.Interface().(map[int32]uint64), fastpathCheckNilFalse, f.e)
-}
-func (_ fastpathT) EncMapInt32Uint64V(v map[int32]uint64, checkNil bool, e *Encoder) {
- ee := e.e
- cr := e.cr
- if checkNil && v == nil {
- ee.EncodeNil()
- return
- }
- ee.EncodeMapStart(len(v))
- if e.h.Canonical {
- v2 := make([]int64, len(v))
- var i int
- for k := range v {
- v2[i] = int64(k)
- i++
- }
- sort.Sort(intSlice(v2))
- for _, k2 := range v2 {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- ee.EncodeInt(int64(int32(k2)))
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- ee.EncodeUint(uint64(v[int32(k2)]))
- }
- } else {
- for k2, v2 := range v {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- ee.EncodeInt(int64(k2))
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- ee.EncodeUint(uint64(v2))
- }
- }
- if cr != nil {
- cr.sendContainerState(containerMapEnd)
- }
-}
-
-func (f *encFnInfo) fastpathEncMapInt32UintptrR(rv reflect.Value) {
- fastpathTV.EncMapInt32UintptrV(rv.Interface().(map[int32]uintptr), fastpathCheckNilFalse, f.e)
-}
-func (_ fastpathT) EncMapInt32UintptrV(v map[int32]uintptr, checkNil bool, e *Encoder) {
- ee := e.e
- cr := e.cr
- if checkNil && v == nil {
- ee.EncodeNil()
- return
- }
- ee.EncodeMapStart(len(v))
- if e.h.Canonical {
- v2 := make([]int64, len(v))
- var i int
- for k := range v {
- v2[i] = int64(k)
- i++
- }
- sort.Sort(intSlice(v2))
- for _, k2 := range v2 {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- ee.EncodeInt(int64(int32(k2)))
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- e.encode(v[int32(k2)])
- }
- } else {
- for k2, v2 := range v {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- ee.EncodeInt(int64(k2))
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- e.encode(v2)
- }
- }
- if cr != nil {
- cr.sendContainerState(containerMapEnd)
- }
-}
-
-func (f *encFnInfo) fastpathEncMapInt32IntR(rv reflect.Value) {
- fastpathTV.EncMapInt32IntV(rv.Interface().(map[int32]int), fastpathCheckNilFalse, f.e)
-}
-func (_ fastpathT) EncMapInt32IntV(v map[int32]int, checkNil bool, e *Encoder) {
- ee := e.e
- cr := e.cr
- if checkNil && v == nil {
- ee.EncodeNil()
- return
- }
- ee.EncodeMapStart(len(v))
- if e.h.Canonical {
- v2 := make([]int64, len(v))
- var i int
- for k := range v {
- v2[i] = int64(k)
- i++
- }
- sort.Sort(intSlice(v2))
- for _, k2 := range v2 {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- ee.EncodeInt(int64(int32(k2)))
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- ee.EncodeInt(int64(v[int32(k2)]))
- }
- } else {
- for k2, v2 := range v {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- ee.EncodeInt(int64(k2))
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- ee.EncodeInt(int64(v2))
- }
- }
- if cr != nil {
- cr.sendContainerState(containerMapEnd)
- }
-}
-
-func (f *encFnInfo) fastpathEncMapInt32Int8R(rv reflect.Value) {
- fastpathTV.EncMapInt32Int8V(rv.Interface().(map[int32]int8), fastpathCheckNilFalse, f.e)
-}
-func (_ fastpathT) EncMapInt32Int8V(v map[int32]int8, checkNil bool, e *Encoder) {
- ee := e.e
- cr := e.cr
- if checkNil && v == nil {
- ee.EncodeNil()
- return
- }
- ee.EncodeMapStart(len(v))
- if e.h.Canonical {
- v2 := make([]int64, len(v))
- var i int
- for k := range v {
- v2[i] = int64(k)
- i++
- }
- sort.Sort(intSlice(v2))
- for _, k2 := range v2 {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- ee.EncodeInt(int64(int32(k2)))
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- ee.EncodeInt(int64(v[int32(k2)]))
- }
- } else {
- for k2, v2 := range v {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- ee.EncodeInt(int64(k2))
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- ee.EncodeInt(int64(v2))
- }
- }
- if cr != nil {
- cr.sendContainerState(containerMapEnd)
- }
-}
-
-func (f *encFnInfo) fastpathEncMapInt32Int16R(rv reflect.Value) {
- fastpathTV.EncMapInt32Int16V(rv.Interface().(map[int32]int16), fastpathCheckNilFalse, f.e)
-}
-func (_ fastpathT) EncMapInt32Int16V(v map[int32]int16, checkNil bool, e *Encoder) {
- ee := e.e
- cr := e.cr
- if checkNil && v == nil {
- ee.EncodeNil()
- return
- }
- ee.EncodeMapStart(len(v))
- if e.h.Canonical {
- v2 := make([]int64, len(v))
- var i int
- for k := range v {
- v2[i] = int64(k)
- i++
- }
- sort.Sort(intSlice(v2))
- for _, k2 := range v2 {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- ee.EncodeInt(int64(int32(k2)))
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- ee.EncodeInt(int64(v[int32(k2)]))
- }
- } else {
- for k2, v2 := range v {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- ee.EncodeInt(int64(k2))
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- ee.EncodeInt(int64(v2))
- }
- }
- if cr != nil {
- cr.sendContainerState(containerMapEnd)
- }
-}
-
-func (f *encFnInfo) fastpathEncMapInt32Int32R(rv reflect.Value) {
- fastpathTV.EncMapInt32Int32V(rv.Interface().(map[int32]int32), fastpathCheckNilFalse, f.e)
-}
-func (_ fastpathT) EncMapInt32Int32V(v map[int32]int32, checkNil bool, e *Encoder) {
- ee := e.e
- cr := e.cr
- if checkNil && v == nil {
- ee.EncodeNil()
- return
- }
- ee.EncodeMapStart(len(v))
- if e.h.Canonical {
- v2 := make([]int64, len(v))
- var i int
- for k := range v {
- v2[i] = int64(k)
- i++
- }
- sort.Sort(intSlice(v2))
- for _, k2 := range v2 {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- ee.EncodeInt(int64(int32(k2)))
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- ee.EncodeInt(int64(v[int32(k2)]))
- }
- } else {
- for k2, v2 := range v {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- ee.EncodeInt(int64(k2))
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- ee.EncodeInt(int64(v2))
- }
- }
- if cr != nil {
- cr.sendContainerState(containerMapEnd)
- }
-}
-
-func (f *encFnInfo) fastpathEncMapInt32Int64R(rv reflect.Value) {
- fastpathTV.EncMapInt32Int64V(rv.Interface().(map[int32]int64), fastpathCheckNilFalse, f.e)
-}
-func (_ fastpathT) EncMapInt32Int64V(v map[int32]int64, checkNil bool, e *Encoder) {
- ee := e.e
- cr := e.cr
- if checkNil && v == nil {
- ee.EncodeNil()
- return
- }
- ee.EncodeMapStart(len(v))
- if e.h.Canonical {
- v2 := make([]int64, len(v))
- var i int
- for k := range v {
- v2[i] = int64(k)
- i++
- }
- sort.Sort(intSlice(v2))
- for _, k2 := range v2 {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- ee.EncodeInt(int64(int32(k2)))
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- ee.EncodeInt(int64(v[int32(k2)]))
- }
- } else {
- for k2, v2 := range v {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- ee.EncodeInt(int64(k2))
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- ee.EncodeInt(int64(v2))
- }
- }
- if cr != nil {
- cr.sendContainerState(containerMapEnd)
- }
-}
-
-func (f *encFnInfo) fastpathEncMapInt32Float32R(rv reflect.Value) {
- fastpathTV.EncMapInt32Float32V(rv.Interface().(map[int32]float32), fastpathCheckNilFalse, f.e)
-}
-func (_ fastpathT) EncMapInt32Float32V(v map[int32]float32, checkNil bool, e *Encoder) {
- ee := e.e
- cr := e.cr
- if checkNil && v == nil {
- ee.EncodeNil()
- return
- }
- ee.EncodeMapStart(len(v))
- if e.h.Canonical {
- v2 := make([]int64, len(v))
- var i int
- for k := range v {
- v2[i] = int64(k)
- i++
- }
- sort.Sort(intSlice(v2))
- for _, k2 := range v2 {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- ee.EncodeInt(int64(int32(k2)))
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- ee.EncodeFloat32(v[int32(k2)])
- }
- } else {
- for k2, v2 := range v {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- ee.EncodeInt(int64(k2))
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- ee.EncodeFloat32(v2)
- }
- }
- if cr != nil {
- cr.sendContainerState(containerMapEnd)
- }
-}
-
-func (f *encFnInfo) fastpathEncMapInt32Float64R(rv reflect.Value) {
- fastpathTV.EncMapInt32Float64V(rv.Interface().(map[int32]float64), fastpathCheckNilFalse, f.e)
-}
-func (_ fastpathT) EncMapInt32Float64V(v map[int32]float64, checkNil bool, e *Encoder) {
- ee := e.e
- cr := e.cr
- if checkNil && v == nil {
- ee.EncodeNil()
- return
- }
- ee.EncodeMapStart(len(v))
- if e.h.Canonical {
- v2 := make([]int64, len(v))
- var i int
- for k := range v {
- v2[i] = int64(k)
- i++
- }
- sort.Sort(intSlice(v2))
- for _, k2 := range v2 {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- ee.EncodeInt(int64(int32(k2)))
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- ee.EncodeFloat64(v[int32(k2)])
- }
- } else {
- for k2, v2 := range v {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- ee.EncodeInt(int64(k2))
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- ee.EncodeFloat64(v2)
- }
- }
- if cr != nil {
- cr.sendContainerState(containerMapEnd)
- }
-}
-
-func (f *encFnInfo) fastpathEncMapInt32BoolR(rv reflect.Value) {
- fastpathTV.EncMapInt32BoolV(rv.Interface().(map[int32]bool), fastpathCheckNilFalse, f.e)
-}
-func (_ fastpathT) EncMapInt32BoolV(v map[int32]bool, checkNil bool, e *Encoder) {
- ee := e.e
- cr := e.cr
- if checkNil && v == nil {
- ee.EncodeNil()
- return
- }
- ee.EncodeMapStart(len(v))
- if e.h.Canonical {
- v2 := make([]int64, len(v))
- var i int
- for k := range v {
- v2[i] = int64(k)
- i++
- }
- sort.Sort(intSlice(v2))
- for _, k2 := range v2 {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- ee.EncodeInt(int64(int32(k2)))
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- ee.EncodeBool(v[int32(k2)])
- }
- } else {
- for k2, v2 := range v {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- ee.EncodeInt(int64(k2))
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- ee.EncodeBool(v2)
- }
- }
- if cr != nil {
- cr.sendContainerState(containerMapEnd)
- }
-}
-
-func (f *encFnInfo) fastpathEncMapInt64IntfR(rv reflect.Value) {
- fastpathTV.EncMapInt64IntfV(rv.Interface().(map[int64]interface{}), fastpathCheckNilFalse, f.e)
-}
-func (_ fastpathT) EncMapInt64IntfV(v map[int64]interface{}, checkNil bool, e *Encoder) {
- ee := e.e
- cr := e.cr
- if checkNil && v == nil {
- ee.EncodeNil()
- return
- }
- ee.EncodeMapStart(len(v))
- if e.h.Canonical {
- v2 := make([]int64, len(v))
- var i int
- for k := range v {
- v2[i] = int64(k)
- i++
- }
- sort.Sort(intSlice(v2))
- for _, k2 := range v2 {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- ee.EncodeInt(int64(int64(k2)))
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- e.encode(v[int64(k2)])
- }
- } else {
- for k2, v2 := range v {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- ee.EncodeInt(int64(k2))
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- e.encode(v2)
- }
- }
- if cr != nil {
- cr.sendContainerState(containerMapEnd)
- }
-}
-
-func (f *encFnInfo) fastpathEncMapInt64StringR(rv reflect.Value) {
- fastpathTV.EncMapInt64StringV(rv.Interface().(map[int64]string), fastpathCheckNilFalse, f.e)
-}
-func (_ fastpathT) EncMapInt64StringV(v map[int64]string, checkNil bool, e *Encoder) {
- ee := e.e
- cr := e.cr
- if checkNil && v == nil {
- ee.EncodeNil()
- return
- }
- ee.EncodeMapStart(len(v))
- if e.h.Canonical {
- v2 := make([]int64, len(v))
- var i int
- for k := range v {
- v2[i] = int64(k)
- i++
- }
- sort.Sort(intSlice(v2))
- for _, k2 := range v2 {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- ee.EncodeInt(int64(int64(k2)))
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- ee.EncodeString(c_UTF8, v[int64(k2)])
- }
- } else {
- for k2, v2 := range v {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- ee.EncodeInt(int64(k2))
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- ee.EncodeString(c_UTF8, v2)
- }
- }
- if cr != nil {
- cr.sendContainerState(containerMapEnd)
- }
-}
-
-func (f *encFnInfo) fastpathEncMapInt64UintR(rv reflect.Value) {
- fastpathTV.EncMapInt64UintV(rv.Interface().(map[int64]uint), fastpathCheckNilFalse, f.e)
-}
-func (_ fastpathT) EncMapInt64UintV(v map[int64]uint, checkNil bool, e *Encoder) {
- ee := e.e
- cr := e.cr
- if checkNil && v == nil {
- ee.EncodeNil()
- return
- }
- ee.EncodeMapStart(len(v))
- if e.h.Canonical {
- v2 := make([]int64, len(v))
- var i int
- for k := range v {
- v2[i] = int64(k)
- i++
- }
- sort.Sort(intSlice(v2))
- for _, k2 := range v2 {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- ee.EncodeInt(int64(int64(k2)))
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- ee.EncodeUint(uint64(v[int64(k2)]))
- }
- } else {
- for k2, v2 := range v {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- ee.EncodeInt(int64(k2))
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- ee.EncodeUint(uint64(v2))
- }
- }
- if cr != nil {
- cr.sendContainerState(containerMapEnd)
- }
-}
-
-func (f *encFnInfo) fastpathEncMapInt64Uint8R(rv reflect.Value) {
- fastpathTV.EncMapInt64Uint8V(rv.Interface().(map[int64]uint8), fastpathCheckNilFalse, f.e)
-}
-func (_ fastpathT) EncMapInt64Uint8V(v map[int64]uint8, checkNil bool, e *Encoder) {
- ee := e.e
- cr := e.cr
- if checkNil && v == nil {
- ee.EncodeNil()
- return
- }
- ee.EncodeMapStart(len(v))
- if e.h.Canonical {
- v2 := make([]int64, len(v))
- var i int
- for k := range v {
- v2[i] = int64(k)
- i++
- }
- sort.Sort(intSlice(v2))
- for _, k2 := range v2 {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- ee.EncodeInt(int64(int64(k2)))
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- ee.EncodeUint(uint64(v[int64(k2)]))
- }
- } else {
- for k2, v2 := range v {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- ee.EncodeInt(int64(k2))
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- ee.EncodeUint(uint64(v2))
- }
- }
- if cr != nil {
- cr.sendContainerState(containerMapEnd)
- }
-}
-
-func (f *encFnInfo) fastpathEncMapInt64Uint16R(rv reflect.Value) {
- fastpathTV.EncMapInt64Uint16V(rv.Interface().(map[int64]uint16), fastpathCheckNilFalse, f.e)
-}
-func (_ fastpathT) EncMapInt64Uint16V(v map[int64]uint16, checkNil bool, e *Encoder) {
- ee := e.e
- cr := e.cr
- if checkNil && v == nil {
- ee.EncodeNil()
- return
- }
- ee.EncodeMapStart(len(v))
- if e.h.Canonical {
- v2 := make([]int64, len(v))
- var i int
- for k := range v {
- v2[i] = int64(k)
- i++
- }
- sort.Sort(intSlice(v2))
- for _, k2 := range v2 {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- ee.EncodeInt(int64(int64(k2)))
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- ee.EncodeUint(uint64(v[int64(k2)]))
- }
- } else {
- for k2, v2 := range v {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- ee.EncodeInt(int64(k2))
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- ee.EncodeUint(uint64(v2))
- }
- }
- if cr != nil {
- cr.sendContainerState(containerMapEnd)
- }
-}
-
-func (f *encFnInfo) fastpathEncMapInt64Uint32R(rv reflect.Value) {
- fastpathTV.EncMapInt64Uint32V(rv.Interface().(map[int64]uint32), fastpathCheckNilFalse, f.e)
-}
-func (_ fastpathT) EncMapInt64Uint32V(v map[int64]uint32, checkNil bool, e *Encoder) {
- ee := e.e
- cr := e.cr
- if checkNil && v == nil {
- ee.EncodeNil()
- return
- }
- ee.EncodeMapStart(len(v))
- if e.h.Canonical {
- v2 := make([]int64, len(v))
- var i int
- for k := range v {
- v2[i] = int64(k)
- i++
- }
- sort.Sort(intSlice(v2))
- for _, k2 := range v2 {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- ee.EncodeInt(int64(int64(k2)))
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- ee.EncodeUint(uint64(v[int64(k2)]))
- }
- } else {
- for k2, v2 := range v {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- ee.EncodeInt(int64(k2))
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- ee.EncodeUint(uint64(v2))
- }
- }
- if cr != nil {
- cr.sendContainerState(containerMapEnd)
- }
-}
-
-func (f *encFnInfo) fastpathEncMapInt64Uint64R(rv reflect.Value) {
- fastpathTV.EncMapInt64Uint64V(rv.Interface().(map[int64]uint64), fastpathCheckNilFalse, f.e)
-}
-func (_ fastpathT) EncMapInt64Uint64V(v map[int64]uint64, checkNil bool, e *Encoder) {
- ee := e.e
- cr := e.cr
- if checkNil && v == nil {
- ee.EncodeNil()
- return
- }
- ee.EncodeMapStart(len(v))
- if e.h.Canonical {
- v2 := make([]int64, len(v))
- var i int
- for k := range v {
- v2[i] = int64(k)
- i++
- }
- sort.Sort(intSlice(v2))
- for _, k2 := range v2 {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- ee.EncodeInt(int64(int64(k2)))
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- ee.EncodeUint(uint64(v[int64(k2)]))
- }
- } else {
- for k2, v2 := range v {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- ee.EncodeInt(int64(k2))
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- ee.EncodeUint(uint64(v2))
- }
- }
- if cr != nil {
- cr.sendContainerState(containerMapEnd)
- }
-}
-
-func (f *encFnInfo) fastpathEncMapInt64UintptrR(rv reflect.Value) {
- fastpathTV.EncMapInt64UintptrV(rv.Interface().(map[int64]uintptr), fastpathCheckNilFalse, f.e)
-}
-func (_ fastpathT) EncMapInt64UintptrV(v map[int64]uintptr, checkNil bool, e *Encoder) {
- ee := e.e
- cr := e.cr
- if checkNil && v == nil {
- ee.EncodeNil()
- return
- }
- ee.EncodeMapStart(len(v))
- if e.h.Canonical {
- v2 := make([]int64, len(v))
- var i int
- for k := range v {
- v2[i] = int64(k)
- i++
- }
- sort.Sort(intSlice(v2))
- for _, k2 := range v2 {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- ee.EncodeInt(int64(int64(k2)))
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- e.encode(v[int64(k2)])
- }
- } else {
- for k2, v2 := range v {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- ee.EncodeInt(int64(k2))
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- e.encode(v2)
- }
- }
- if cr != nil {
- cr.sendContainerState(containerMapEnd)
- }
-}
-
-func (f *encFnInfo) fastpathEncMapInt64IntR(rv reflect.Value) {
- fastpathTV.EncMapInt64IntV(rv.Interface().(map[int64]int), fastpathCheckNilFalse, f.e)
-}
-func (_ fastpathT) EncMapInt64IntV(v map[int64]int, checkNil bool, e *Encoder) {
- ee := e.e
- cr := e.cr
- if checkNil && v == nil {
- ee.EncodeNil()
- return
- }
- ee.EncodeMapStart(len(v))
- if e.h.Canonical {
- v2 := make([]int64, len(v))
- var i int
- for k := range v {
- v2[i] = int64(k)
- i++
- }
- sort.Sort(intSlice(v2))
- for _, k2 := range v2 {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- ee.EncodeInt(int64(int64(k2)))
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- ee.EncodeInt(int64(v[int64(k2)]))
- }
- } else {
- for k2, v2 := range v {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- ee.EncodeInt(int64(k2))
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- ee.EncodeInt(int64(v2))
- }
- }
- if cr != nil {
- cr.sendContainerState(containerMapEnd)
- }
-}
-
-func (f *encFnInfo) fastpathEncMapInt64Int8R(rv reflect.Value) {
- fastpathTV.EncMapInt64Int8V(rv.Interface().(map[int64]int8), fastpathCheckNilFalse, f.e)
-}
-func (_ fastpathT) EncMapInt64Int8V(v map[int64]int8, checkNil bool, e *Encoder) {
- ee := e.e
- cr := e.cr
- if checkNil && v == nil {
- ee.EncodeNil()
- return
- }
- ee.EncodeMapStart(len(v))
- if e.h.Canonical {
- v2 := make([]int64, len(v))
- var i int
- for k := range v {
- v2[i] = int64(k)
- i++
- }
- sort.Sort(intSlice(v2))
- for _, k2 := range v2 {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- ee.EncodeInt(int64(int64(k2)))
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- ee.EncodeInt(int64(v[int64(k2)]))
- }
- } else {
- for k2, v2 := range v {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- ee.EncodeInt(int64(k2))
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- ee.EncodeInt(int64(v2))
- }
- }
- if cr != nil {
- cr.sendContainerState(containerMapEnd)
- }
-}
-
-func (f *encFnInfo) fastpathEncMapInt64Int16R(rv reflect.Value) {
- fastpathTV.EncMapInt64Int16V(rv.Interface().(map[int64]int16), fastpathCheckNilFalse, f.e)
-}
-func (_ fastpathT) EncMapInt64Int16V(v map[int64]int16, checkNil bool, e *Encoder) {
- ee := e.e
- cr := e.cr
- if checkNil && v == nil {
- ee.EncodeNil()
- return
- }
- ee.EncodeMapStart(len(v))
- if e.h.Canonical {
- v2 := make([]int64, len(v))
- var i int
- for k := range v {
- v2[i] = int64(k)
- i++
- }
- sort.Sort(intSlice(v2))
- for _, k2 := range v2 {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- ee.EncodeInt(int64(int64(k2)))
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- ee.EncodeInt(int64(v[int64(k2)]))
- }
- } else {
- for k2, v2 := range v {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- ee.EncodeInt(int64(k2))
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- ee.EncodeInt(int64(v2))
- }
- }
- if cr != nil {
- cr.sendContainerState(containerMapEnd)
- }
-}
-
-func (f *encFnInfo) fastpathEncMapInt64Int32R(rv reflect.Value) {
- fastpathTV.EncMapInt64Int32V(rv.Interface().(map[int64]int32), fastpathCheckNilFalse, f.e)
-}
-func (_ fastpathT) EncMapInt64Int32V(v map[int64]int32, checkNil bool, e *Encoder) {
- ee := e.e
- cr := e.cr
- if checkNil && v == nil {
- ee.EncodeNil()
- return
- }
- ee.EncodeMapStart(len(v))
- if e.h.Canonical {
- v2 := make([]int64, len(v))
- var i int
- for k := range v {
- v2[i] = int64(k)
- i++
- }
- sort.Sort(intSlice(v2))
- for _, k2 := range v2 {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- ee.EncodeInt(int64(int64(k2)))
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- ee.EncodeInt(int64(v[int64(k2)]))
- }
- } else {
- for k2, v2 := range v {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- ee.EncodeInt(int64(k2))
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- ee.EncodeInt(int64(v2))
- }
- }
- if cr != nil {
- cr.sendContainerState(containerMapEnd)
- }
-}
-
-func (f *encFnInfo) fastpathEncMapInt64Int64R(rv reflect.Value) {
- fastpathTV.EncMapInt64Int64V(rv.Interface().(map[int64]int64), fastpathCheckNilFalse, f.e)
-}
-func (_ fastpathT) EncMapInt64Int64V(v map[int64]int64, checkNil bool, e *Encoder) {
- ee := e.e
- cr := e.cr
- if checkNil && v == nil {
- ee.EncodeNil()
- return
- }
- ee.EncodeMapStart(len(v))
- if e.h.Canonical {
- v2 := make([]int64, len(v))
- var i int
- for k := range v {
- v2[i] = int64(k)
- i++
- }
- sort.Sort(intSlice(v2))
- for _, k2 := range v2 {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- ee.EncodeInt(int64(int64(k2)))
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- ee.EncodeInt(int64(v[int64(k2)]))
- }
- } else {
- for k2, v2 := range v {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- ee.EncodeInt(int64(k2))
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- ee.EncodeInt(int64(v2))
- }
- }
- if cr != nil {
- cr.sendContainerState(containerMapEnd)
- }
-}
-
-func (f *encFnInfo) fastpathEncMapInt64Float32R(rv reflect.Value) {
- fastpathTV.EncMapInt64Float32V(rv.Interface().(map[int64]float32), fastpathCheckNilFalse, f.e)
-}
-func (_ fastpathT) EncMapInt64Float32V(v map[int64]float32, checkNil bool, e *Encoder) {
- ee := e.e
- cr := e.cr
- if checkNil && v == nil {
- ee.EncodeNil()
- return
- }
- ee.EncodeMapStart(len(v))
- if e.h.Canonical {
- v2 := make([]int64, len(v))
- var i int
- for k := range v {
- v2[i] = int64(k)
- i++
- }
- sort.Sort(intSlice(v2))
- for _, k2 := range v2 {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- ee.EncodeInt(int64(int64(k2)))
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- ee.EncodeFloat32(v[int64(k2)])
- }
- } else {
- for k2, v2 := range v {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- ee.EncodeInt(int64(k2))
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- ee.EncodeFloat32(v2)
- }
- }
- if cr != nil {
- cr.sendContainerState(containerMapEnd)
- }
-}
-
-func (f *encFnInfo) fastpathEncMapInt64Float64R(rv reflect.Value) {
- fastpathTV.EncMapInt64Float64V(rv.Interface().(map[int64]float64), fastpathCheckNilFalse, f.e)
-}
-func (_ fastpathT) EncMapInt64Float64V(v map[int64]float64, checkNil bool, e *Encoder) {
- ee := e.e
- cr := e.cr
- if checkNil && v == nil {
- ee.EncodeNil()
- return
- }
- ee.EncodeMapStart(len(v))
- if e.h.Canonical {
- v2 := make([]int64, len(v))
- var i int
- for k := range v {
- v2[i] = int64(k)
- i++
- }
- sort.Sort(intSlice(v2))
- for _, k2 := range v2 {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- ee.EncodeInt(int64(int64(k2)))
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- ee.EncodeFloat64(v[int64(k2)])
- }
- } else {
- for k2, v2 := range v {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- ee.EncodeInt(int64(k2))
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- ee.EncodeFloat64(v2)
- }
- }
- if cr != nil {
- cr.sendContainerState(containerMapEnd)
- }
-}
-
-func (f *encFnInfo) fastpathEncMapInt64BoolR(rv reflect.Value) {
- fastpathTV.EncMapInt64BoolV(rv.Interface().(map[int64]bool), fastpathCheckNilFalse, f.e)
-}
-func (_ fastpathT) EncMapInt64BoolV(v map[int64]bool, checkNil bool, e *Encoder) {
- ee := e.e
- cr := e.cr
- if checkNil && v == nil {
- ee.EncodeNil()
- return
- }
- ee.EncodeMapStart(len(v))
- if e.h.Canonical {
- v2 := make([]int64, len(v))
- var i int
- for k := range v {
- v2[i] = int64(k)
- i++
- }
- sort.Sort(intSlice(v2))
- for _, k2 := range v2 {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- ee.EncodeInt(int64(int64(k2)))
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- ee.EncodeBool(v[int64(k2)])
- }
- } else {
- for k2, v2 := range v {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- ee.EncodeInt(int64(k2))
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- ee.EncodeBool(v2)
- }
- }
- if cr != nil {
- cr.sendContainerState(containerMapEnd)
- }
-}
-
-func (f *encFnInfo) fastpathEncMapBoolIntfR(rv reflect.Value) {
- fastpathTV.EncMapBoolIntfV(rv.Interface().(map[bool]interface{}), fastpathCheckNilFalse, f.e)
-}
-func (_ fastpathT) EncMapBoolIntfV(v map[bool]interface{}, checkNil bool, e *Encoder) {
- ee := e.e
- cr := e.cr
- if checkNil && v == nil {
- ee.EncodeNil()
- return
- }
- ee.EncodeMapStart(len(v))
- if e.h.Canonical {
- v2 := make([]bool, len(v))
- var i int
- for k := range v {
- v2[i] = bool(k)
- i++
- }
- sort.Sort(boolSlice(v2))
- for _, k2 := range v2 {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- ee.EncodeBool(bool(k2))
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- e.encode(v[bool(k2)])
- }
- } else {
- for k2, v2 := range v {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- ee.EncodeBool(k2)
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- e.encode(v2)
- }
- }
- if cr != nil {
- cr.sendContainerState(containerMapEnd)
- }
-}
-
-func (f *encFnInfo) fastpathEncMapBoolStringR(rv reflect.Value) {
- fastpathTV.EncMapBoolStringV(rv.Interface().(map[bool]string), fastpathCheckNilFalse, f.e)
-}
-func (_ fastpathT) EncMapBoolStringV(v map[bool]string, checkNil bool, e *Encoder) {
- ee := e.e
- cr := e.cr
- if checkNil && v == nil {
- ee.EncodeNil()
- return
- }
- ee.EncodeMapStart(len(v))
- if e.h.Canonical {
- v2 := make([]bool, len(v))
- var i int
- for k := range v {
- v2[i] = bool(k)
- i++
- }
- sort.Sort(boolSlice(v2))
- for _, k2 := range v2 {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- ee.EncodeBool(bool(k2))
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- ee.EncodeString(c_UTF8, v[bool(k2)])
- }
- } else {
- for k2, v2 := range v {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- ee.EncodeBool(k2)
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- ee.EncodeString(c_UTF8, v2)
- }
- }
- if cr != nil {
- cr.sendContainerState(containerMapEnd)
- }
-}
-
-func (f *encFnInfo) fastpathEncMapBoolUintR(rv reflect.Value) {
- fastpathTV.EncMapBoolUintV(rv.Interface().(map[bool]uint), fastpathCheckNilFalse, f.e)
-}
-func (_ fastpathT) EncMapBoolUintV(v map[bool]uint, checkNil bool, e *Encoder) {
- ee := e.e
- cr := e.cr
- if checkNil && v == nil {
- ee.EncodeNil()
- return
- }
- ee.EncodeMapStart(len(v))
- if e.h.Canonical {
- v2 := make([]bool, len(v))
- var i int
- for k := range v {
- v2[i] = bool(k)
- i++
- }
- sort.Sort(boolSlice(v2))
- for _, k2 := range v2 {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- ee.EncodeBool(bool(k2))
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- ee.EncodeUint(uint64(v[bool(k2)]))
- }
- } else {
- for k2, v2 := range v {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- ee.EncodeBool(k2)
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- ee.EncodeUint(uint64(v2))
- }
- }
- if cr != nil {
- cr.sendContainerState(containerMapEnd)
- }
-}
-
-func (f *encFnInfo) fastpathEncMapBoolUint8R(rv reflect.Value) {
- fastpathTV.EncMapBoolUint8V(rv.Interface().(map[bool]uint8), fastpathCheckNilFalse, f.e)
-}
-func (_ fastpathT) EncMapBoolUint8V(v map[bool]uint8, checkNil bool, e *Encoder) {
- ee := e.e
- cr := e.cr
- if checkNil && v == nil {
- ee.EncodeNil()
- return
- }
- ee.EncodeMapStart(len(v))
- if e.h.Canonical {
- v2 := make([]bool, len(v))
- var i int
- for k := range v {
- v2[i] = bool(k)
- i++
- }
- sort.Sort(boolSlice(v2))
- for _, k2 := range v2 {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- ee.EncodeBool(bool(k2))
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- ee.EncodeUint(uint64(v[bool(k2)]))
- }
- } else {
- for k2, v2 := range v {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- ee.EncodeBool(k2)
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- ee.EncodeUint(uint64(v2))
- }
- }
- if cr != nil {
- cr.sendContainerState(containerMapEnd)
- }
-}
-
-func (f *encFnInfo) fastpathEncMapBoolUint16R(rv reflect.Value) {
- fastpathTV.EncMapBoolUint16V(rv.Interface().(map[bool]uint16), fastpathCheckNilFalse, f.e)
-}
-func (_ fastpathT) EncMapBoolUint16V(v map[bool]uint16, checkNil bool, e *Encoder) {
- ee := e.e
- cr := e.cr
- if checkNil && v == nil {
- ee.EncodeNil()
- return
- }
- ee.EncodeMapStart(len(v))
- if e.h.Canonical {
- v2 := make([]bool, len(v))
- var i int
- for k := range v {
- v2[i] = bool(k)
- i++
- }
- sort.Sort(boolSlice(v2))
- for _, k2 := range v2 {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- ee.EncodeBool(bool(k2))
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- ee.EncodeUint(uint64(v[bool(k2)]))
- }
- } else {
- for k2, v2 := range v {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- ee.EncodeBool(k2)
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- ee.EncodeUint(uint64(v2))
- }
- }
- if cr != nil {
- cr.sendContainerState(containerMapEnd)
- }
-}
-
-func (f *encFnInfo) fastpathEncMapBoolUint32R(rv reflect.Value) {
- fastpathTV.EncMapBoolUint32V(rv.Interface().(map[bool]uint32), fastpathCheckNilFalse, f.e)
-}
-func (_ fastpathT) EncMapBoolUint32V(v map[bool]uint32, checkNil bool, e *Encoder) {
- ee := e.e
- cr := e.cr
- if checkNil && v == nil {
- ee.EncodeNil()
- return
- }
- ee.EncodeMapStart(len(v))
- if e.h.Canonical {
- v2 := make([]bool, len(v))
- var i int
- for k := range v {
- v2[i] = bool(k)
- i++
- }
- sort.Sort(boolSlice(v2))
- for _, k2 := range v2 {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- ee.EncodeBool(bool(k2))
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- ee.EncodeUint(uint64(v[bool(k2)]))
- }
- } else {
- for k2, v2 := range v {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- ee.EncodeBool(k2)
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- ee.EncodeUint(uint64(v2))
- }
- }
- if cr != nil {
- cr.sendContainerState(containerMapEnd)
- }
-}
-
-func (f *encFnInfo) fastpathEncMapBoolUint64R(rv reflect.Value) {
- fastpathTV.EncMapBoolUint64V(rv.Interface().(map[bool]uint64), fastpathCheckNilFalse, f.e)
-}
-func (_ fastpathT) EncMapBoolUint64V(v map[bool]uint64, checkNil bool, e *Encoder) {
- ee := e.e
- cr := e.cr
- if checkNil && v == nil {
- ee.EncodeNil()
- return
- }
- ee.EncodeMapStart(len(v))
- if e.h.Canonical {
- v2 := make([]bool, len(v))
- var i int
- for k := range v {
- v2[i] = bool(k)
- i++
- }
- sort.Sort(boolSlice(v2))
- for _, k2 := range v2 {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- ee.EncodeBool(bool(k2))
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- ee.EncodeUint(uint64(v[bool(k2)]))
- }
- } else {
- for k2, v2 := range v {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- ee.EncodeBool(k2)
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- ee.EncodeUint(uint64(v2))
- }
- }
- if cr != nil {
- cr.sendContainerState(containerMapEnd)
- }
-}
-
-func (f *encFnInfo) fastpathEncMapBoolUintptrR(rv reflect.Value) {
- fastpathTV.EncMapBoolUintptrV(rv.Interface().(map[bool]uintptr), fastpathCheckNilFalse, f.e)
-}
-func (_ fastpathT) EncMapBoolUintptrV(v map[bool]uintptr, checkNil bool, e *Encoder) {
- ee := e.e
- cr := e.cr
- if checkNil && v == nil {
- ee.EncodeNil()
- return
- }
- ee.EncodeMapStart(len(v))
- if e.h.Canonical {
- v2 := make([]bool, len(v))
- var i int
- for k := range v {
- v2[i] = bool(k)
- i++
- }
- sort.Sort(boolSlice(v2))
- for _, k2 := range v2 {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- ee.EncodeBool(bool(k2))
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- e.encode(v[bool(k2)])
- }
- } else {
- for k2, v2 := range v {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- ee.EncodeBool(k2)
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- e.encode(v2)
- }
- }
- if cr != nil {
- cr.sendContainerState(containerMapEnd)
- }
-}
-
-func (f *encFnInfo) fastpathEncMapBoolIntR(rv reflect.Value) {
- fastpathTV.EncMapBoolIntV(rv.Interface().(map[bool]int), fastpathCheckNilFalse, f.e)
-}
-func (_ fastpathT) EncMapBoolIntV(v map[bool]int, checkNil bool, e *Encoder) {
- ee := e.e
- cr := e.cr
- if checkNil && v == nil {
- ee.EncodeNil()
- return
- }
- ee.EncodeMapStart(len(v))
- if e.h.Canonical {
- v2 := make([]bool, len(v))
- var i int
- for k := range v {
- v2[i] = bool(k)
- i++
- }
- sort.Sort(boolSlice(v2))
- for _, k2 := range v2 {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- ee.EncodeBool(bool(k2))
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- ee.EncodeInt(int64(v[bool(k2)]))
- }
- } else {
- for k2, v2 := range v {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- ee.EncodeBool(k2)
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- ee.EncodeInt(int64(v2))
- }
- }
- if cr != nil {
- cr.sendContainerState(containerMapEnd)
- }
-}
-
-func (f *encFnInfo) fastpathEncMapBoolInt8R(rv reflect.Value) {
- fastpathTV.EncMapBoolInt8V(rv.Interface().(map[bool]int8), fastpathCheckNilFalse, f.e)
-}
-func (_ fastpathT) EncMapBoolInt8V(v map[bool]int8, checkNil bool, e *Encoder) {
- ee := e.e
- cr := e.cr
- if checkNil && v == nil {
- ee.EncodeNil()
- return
- }
- ee.EncodeMapStart(len(v))
- if e.h.Canonical {
- v2 := make([]bool, len(v))
- var i int
- for k := range v {
- v2[i] = bool(k)
- i++
- }
- sort.Sort(boolSlice(v2))
- for _, k2 := range v2 {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- ee.EncodeBool(bool(k2))
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- ee.EncodeInt(int64(v[bool(k2)]))
- }
- } else {
- for k2, v2 := range v {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- ee.EncodeBool(k2)
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- ee.EncodeInt(int64(v2))
- }
- }
- if cr != nil {
- cr.sendContainerState(containerMapEnd)
- }
-}
-
-func (f *encFnInfo) fastpathEncMapBoolInt16R(rv reflect.Value) {
- fastpathTV.EncMapBoolInt16V(rv.Interface().(map[bool]int16), fastpathCheckNilFalse, f.e)
-}
-func (_ fastpathT) EncMapBoolInt16V(v map[bool]int16, checkNil bool, e *Encoder) {
- ee := e.e
- cr := e.cr
- if checkNil && v == nil {
- ee.EncodeNil()
- return
- }
- ee.EncodeMapStart(len(v))
- if e.h.Canonical {
- v2 := make([]bool, len(v))
- var i int
- for k := range v {
- v2[i] = bool(k)
- i++
- }
- sort.Sort(boolSlice(v2))
- for _, k2 := range v2 {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- ee.EncodeBool(bool(k2))
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- ee.EncodeInt(int64(v[bool(k2)]))
- }
- } else {
- for k2, v2 := range v {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- ee.EncodeBool(k2)
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- ee.EncodeInt(int64(v2))
- }
- }
- if cr != nil {
- cr.sendContainerState(containerMapEnd)
- }
-}
-
-func (f *encFnInfo) fastpathEncMapBoolInt32R(rv reflect.Value) {
- fastpathTV.EncMapBoolInt32V(rv.Interface().(map[bool]int32), fastpathCheckNilFalse, f.e)
-}
-func (_ fastpathT) EncMapBoolInt32V(v map[bool]int32, checkNil bool, e *Encoder) {
- ee := e.e
- cr := e.cr
- if checkNil && v == nil {
- ee.EncodeNil()
- return
- }
- ee.EncodeMapStart(len(v))
- if e.h.Canonical {
- v2 := make([]bool, len(v))
- var i int
- for k := range v {
- v2[i] = bool(k)
- i++
- }
- sort.Sort(boolSlice(v2))
- for _, k2 := range v2 {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- ee.EncodeBool(bool(k2))
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- ee.EncodeInt(int64(v[bool(k2)]))
- }
- } else {
- for k2, v2 := range v {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- ee.EncodeBool(k2)
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- ee.EncodeInt(int64(v2))
- }
- }
- if cr != nil {
- cr.sendContainerState(containerMapEnd)
- }
-}
-
-func (f *encFnInfo) fastpathEncMapBoolInt64R(rv reflect.Value) {
- fastpathTV.EncMapBoolInt64V(rv.Interface().(map[bool]int64), fastpathCheckNilFalse, f.e)
-}
-func (_ fastpathT) EncMapBoolInt64V(v map[bool]int64, checkNil bool, e *Encoder) {
- ee := e.e
- cr := e.cr
- if checkNil && v == nil {
- ee.EncodeNil()
- return
- }
- ee.EncodeMapStart(len(v))
- if e.h.Canonical {
- v2 := make([]bool, len(v))
- var i int
- for k := range v {
- v2[i] = bool(k)
- i++
- }
- sort.Sort(boolSlice(v2))
- for _, k2 := range v2 {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- ee.EncodeBool(bool(k2))
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- ee.EncodeInt(int64(v[bool(k2)]))
- }
- } else {
- for k2, v2 := range v {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- ee.EncodeBool(k2)
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- ee.EncodeInt(int64(v2))
- }
- }
- if cr != nil {
- cr.sendContainerState(containerMapEnd)
- }
-}
-
-func (f *encFnInfo) fastpathEncMapBoolFloat32R(rv reflect.Value) {
- fastpathTV.EncMapBoolFloat32V(rv.Interface().(map[bool]float32), fastpathCheckNilFalse, f.e)
-}
-func (_ fastpathT) EncMapBoolFloat32V(v map[bool]float32, checkNil bool, e *Encoder) {
- ee := e.e
- cr := e.cr
- if checkNil && v == nil {
- ee.EncodeNil()
- return
- }
- ee.EncodeMapStart(len(v))
- if e.h.Canonical {
- v2 := make([]bool, len(v))
- var i int
- for k := range v {
- v2[i] = bool(k)
- i++
- }
- sort.Sort(boolSlice(v2))
- for _, k2 := range v2 {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- ee.EncodeBool(bool(k2))
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- ee.EncodeFloat32(v[bool(k2)])
- }
- } else {
- for k2, v2 := range v {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- ee.EncodeBool(k2)
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- ee.EncodeFloat32(v2)
- }
- }
- if cr != nil {
- cr.sendContainerState(containerMapEnd)
- }
-}
-
-func (f *encFnInfo) fastpathEncMapBoolFloat64R(rv reflect.Value) {
- fastpathTV.EncMapBoolFloat64V(rv.Interface().(map[bool]float64), fastpathCheckNilFalse, f.e)
-}
-func (_ fastpathT) EncMapBoolFloat64V(v map[bool]float64, checkNil bool, e *Encoder) {
- ee := e.e
- cr := e.cr
- if checkNil && v == nil {
- ee.EncodeNil()
- return
- }
- ee.EncodeMapStart(len(v))
- if e.h.Canonical {
- v2 := make([]bool, len(v))
- var i int
- for k := range v {
- v2[i] = bool(k)
- i++
- }
- sort.Sort(boolSlice(v2))
- for _, k2 := range v2 {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- ee.EncodeBool(bool(k2))
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- ee.EncodeFloat64(v[bool(k2)])
- }
- } else {
- for k2, v2 := range v {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- ee.EncodeBool(k2)
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- ee.EncodeFloat64(v2)
- }
- }
- if cr != nil {
- cr.sendContainerState(containerMapEnd)
- }
-}
-
-func (f *encFnInfo) fastpathEncMapBoolBoolR(rv reflect.Value) {
- fastpathTV.EncMapBoolBoolV(rv.Interface().(map[bool]bool), fastpathCheckNilFalse, f.e)
-}
-func (_ fastpathT) EncMapBoolBoolV(v map[bool]bool, checkNil bool, e *Encoder) {
- ee := e.e
- cr := e.cr
- if checkNil && v == nil {
- ee.EncodeNil()
- return
- }
- ee.EncodeMapStart(len(v))
- if e.h.Canonical {
- v2 := make([]bool, len(v))
- var i int
- for k := range v {
- v2[i] = bool(k)
- i++
- }
- sort.Sort(boolSlice(v2))
- for _, k2 := range v2 {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- ee.EncodeBool(bool(k2))
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- ee.EncodeBool(v[bool(k2)])
- }
- } else {
- for k2, v2 := range v {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- ee.EncodeBool(k2)
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- ee.EncodeBool(v2)
- }
- }
- if cr != nil {
- cr.sendContainerState(containerMapEnd)
- }
-}
-
-// -- decode
-
-// -- -- fast path type switch
-func fastpathDecodeTypeSwitch(iv interface{}, d *Decoder) bool {
- if !fastpathEnabled {
- return false
- }
- switch v := iv.(type) {
-
- case []interface{}:
- fastpathTV.DecSliceIntfV(v, fastpathCheckNilFalse, false, d)
- case *[]interface{}:
- v2, changed2 := fastpathTV.DecSliceIntfV(*v, fastpathCheckNilFalse, true, d)
- if changed2 {
- *v = v2
- }
-
- case map[interface{}]interface{}:
- fastpathTV.DecMapIntfIntfV(v, fastpathCheckNilFalse, false, d)
- case *map[interface{}]interface{}:
- v2, changed2 := fastpathTV.DecMapIntfIntfV(*v, fastpathCheckNilFalse, true, d)
- if changed2 {
- *v = v2
- }
-
- case map[interface{}]string:
- fastpathTV.DecMapIntfStringV(v, fastpathCheckNilFalse, false, d)
- case *map[interface{}]string:
- v2, changed2 := fastpathTV.DecMapIntfStringV(*v, fastpathCheckNilFalse, true, d)
- if changed2 {
- *v = v2
- }
-
- case map[interface{}]uint:
- fastpathTV.DecMapIntfUintV(v, fastpathCheckNilFalse, false, d)
- case *map[interface{}]uint:
- v2, changed2 := fastpathTV.DecMapIntfUintV(*v, fastpathCheckNilFalse, true, d)
- if changed2 {
- *v = v2
- }
-
- case map[interface{}]uint8:
- fastpathTV.DecMapIntfUint8V(v, fastpathCheckNilFalse, false, d)
- case *map[interface{}]uint8:
- v2, changed2 := fastpathTV.DecMapIntfUint8V(*v, fastpathCheckNilFalse, true, d)
- if changed2 {
- *v = v2
- }
-
- case map[interface{}]uint16:
- fastpathTV.DecMapIntfUint16V(v, fastpathCheckNilFalse, false, d)
- case *map[interface{}]uint16:
- v2, changed2 := fastpathTV.DecMapIntfUint16V(*v, fastpathCheckNilFalse, true, d)
- if changed2 {
- *v = v2
- }
-
- case map[interface{}]uint32:
- fastpathTV.DecMapIntfUint32V(v, fastpathCheckNilFalse, false, d)
- case *map[interface{}]uint32:
- v2, changed2 := fastpathTV.DecMapIntfUint32V(*v, fastpathCheckNilFalse, true, d)
- if changed2 {
- *v = v2
- }
-
- case map[interface{}]uint64:
- fastpathTV.DecMapIntfUint64V(v, fastpathCheckNilFalse, false, d)
- case *map[interface{}]uint64:
- v2, changed2 := fastpathTV.DecMapIntfUint64V(*v, fastpathCheckNilFalse, true, d)
- if changed2 {
- *v = v2
- }
-
- case map[interface{}]uintptr:
- fastpathTV.DecMapIntfUintptrV(v, fastpathCheckNilFalse, false, d)
- case *map[interface{}]uintptr:
- v2, changed2 := fastpathTV.DecMapIntfUintptrV(*v, fastpathCheckNilFalse, true, d)
- if changed2 {
- *v = v2
- }
-
- case map[interface{}]int:
- fastpathTV.DecMapIntfIntV(v, fastpathCheckNilFalse, false, d)
- case *map[interface{}]int:
- v2, changed2 := fastpathTV.DecMapIntfIntV(*v, fastpathCheckNilFalse, true, d)
- if changed2 {
- *v = v2
- }
-
- case map[interface{}]int8:
- fastpathTV.DecMapIntfInt8V(v, fastpathCheckNilFalse, false, d)
- case *map[interface{}]int8:
- v2, changed2 := fastpathTV.DecMapIntfInt8V(*v, fastpathCheckNilFalse, true, d)
- if changed2 {
- *v = v2
- }
-
- case map[interface{}]int16:
- fastpathTV.DecMapIntfInt16V(v, fastpathCheckNilFalse, false, d)
- case *map[interface{}]int16:
- v2, changed2 := fastpathTV.DecMapIntfInt16V(*v, fastpathCheckNilFalse, true, d)
- if changed2 {
- *v = v2
- }
-
- case map[interface{}]int32:
- fastpathTV.DecMapIntfInt32V(v, fastpathCheckNilFalse, false, d)
- case *map[interface{}]int32:
- v2, changed2 := fastpathTV.DecMapIntfInt32V(*v, fastpathCheckNilFalse, true, d)
- if changed2 {
- *v = v2
- }
-
- case map[interface{}]int64:
- fastpathTV.DecMapIntfInt64V(v, fastpathCheckNilFalse, false, d)
- case *map[interface{}]int64:
- v2, changed2 := fastpathTV.DecMapIntfInt64V(*v, fastpathCheckNilFalse, true, d)
- if changed2 {
- *v = v2
- }
-
- case map[interface{}]float32:
- fastpathTV.DecMapIntfFloat32V(v, fastpathCheckNilFalse, false, d)
- case *map[interface{}]float32:
- v2, changed2 := fastpathTV.DecMapIntfFloat32V(*v, fastpathCheckNilFalse, true, d)
- if changed2 {
- *v = v2
- }
-
- case map[interface{}]float64:
- fastpathTV.DecMapIntfFloat64V(v, fastpathCheckNilFalse, false, d)
- case *map[interface{}]float64:
- v2, changed2 := fastpathTV.DecMapIntfFloat64V(*v, fastpathCheckNilFalse, true, d)
- if changed2 {
- *v = v2
- }
-
- case map[interface{}]bool:
- fastpathTV.DecMapIntfBoolV(v, fastpathCheckNilFalse, false, d)
- case *map[interface{}]bool:
- v2, changed2 := fastpathTV.DecMapIntfBoolV(*v, fastpathCheckNilFalse, true, d)
- if changed2 {
- *v = v2
- }
-
- case []string:
- fastpathTV.DecSliceStringV(v, fastpathCheckNilFalse, false, d)
- case *[]string:
- v2, changed2 := fastpathTV.DecSliceStringV(*v, fastpathCheckNilFalse, true, d)
- if changed2 {
- *v = v2
- }
-
- case map[string]interface{}:
- fastpathTV.DecMapStringIntfV(v, fastpathCheckNilFalse, false, d)
- case *map[string]interface{}:
- v2, changed2 := fastpathTV.DecMapStringIntfV(*v, fastpathCheckNilFalse, true, d)
- if changed2 {
- *v = v2
- }
-
- case map[string]string:
- fastpathTV.DecMapStringStringV(v, fastpathCheckNilFalse, false, d)
- case *map[string]string:
- v2, changed2 := fastpathTV.DecMapStringStringV(*v, fastpathCheckNilFalse, true, d)
- if changed2 {
- *v = v2
- }
-
- case map[string]uint:
- fastpathTV.DecMapStringUintV(v, fastpathCheckNilFalse, false, d)
- case *map[string]uint:
- v2, changed2 := fastpathTV.DecMapStringUintV(*v, fastpathCheckNilFalse, true, d)
- if changed2 {
- *v = v2
- }
-
- case map[string]uint8:
- fastpathTV.DecMapStringUint8V(v, fastpathCheckNilFalse, false, d)
- case *map[string]uint8:
- v2, changed2 := fastpathTV.DecMapStringUint8V(*v, fastpathCheckNilFalse, true, d)
- if changed2 {
- *v = v2
- }
-
- case map[string]uint16:
- fastpathTV.DecMapStringUint16V(v, fastpathCheckNilFalse, false, d)
- case *map[string]uint16:
- v2, changed2 := fastpathTV.DecMapStringUint16V(*v, fastpathCheckNilFalse, true, d)
- if changed2 {
- *v = v2
- }
-
- case map[string]uint32:
- fastpathTV.DecMapStringUint32V(v, fastpathCheckNilFalse, false, d)
- case *map[string]uint32:
- v2, changed2 := fastpathTV.DecMapStringUint32V(*v, fastpathCheckNilFalse, true, d)
- if changed2 {
- *v = v2
- }
-
- case map[string]uint64:
- fastpathTV.DecMapStringUint64V(v, fastpathCheckNilFalse, false, d)
- case *map[string]uint64:
- v2, changed2 := fastpathTV.DecMapStringUint64V(*v, fastpathCheckNilFalse, true, d)
- if changed2 {
- *v = v2
- }
-
- case map[string]uintptr:
- fastpathTV.DecMapStringUintptrV(v, fastpathCheckNilFalse, false, d)
- case *map[string]uintptr:
- v2, changed2 := fastpathTV.DecMapStringUintptrV(*v, fastpathCheckNilFalse, true, d)
- if changed2 {
- *v = v2
- }
-
- case map[string]int:
- fastpathTV.DecMapStringIntV(v, fastpathCheckNilFalse, false, d)
- case *map[string]int:
- v2, changed2 := fastpathTV.DecMapStringIntV(*v, fastpathCheckNilFalse, true, d)
- if changed2 {
- *v = v2
- }
-
- case map[string]int8:
- fastpathTV.DecMapStringInt8V(v, fastpathCheckNilFalse, false, d)
- case *map[string]int8:
- v2, changed2 := fastpathTV.DecMapStringInt8V(*v, fastpathCheckNilFalse, true, d)
- if changed2 {
- *v = v2
- }
-
- case map[string]int16:
- fastpathTV.DecMapStringInt16V(v, fastpathCheckNilFalse, false, d)
- case *map[string]int16:
- v2, changed2 := fastpathTV.DecMapStringInt16V(*v, fastpathCheckNilFalse, true, d)
- if changed2 {
- *v = v2
- }
-
- case map[string]int32:
- fastpathTV.DecMapStringInt32V(v, fastpathCheckNilFalse, false, d)
- case *map[string]int32:
- v2, changed2 := fastpathTV.DecMapStringInt32V(*v, fastpathCheckNilFalse, true, d)
- if changed2 {
- *v = v2
- }
-
- case map[string]int64:
- fastpathTV.DecMapStringInt64V(v, fastpathCheckNilFalse, false, d)
- case *map[string]int64:
- v2, changed2 := fastpathTV.DecMapStringInt64V(*v, fastpathCheckNilFalse, true, d)
- if changed2 {
- *v = v2
- }
-
- case map[string]float32:
- fastpathTV.DecMapStringFloat32V(v, fastpathCheckNilFalse, false, d)
- case *map[string]float32:
- v2, changed2 := fastpathTV.DecMapStringFloat32V(*v, fastpathCheckNilFalse, true, d)
- if changed2 {
- *v = v2
- }
-
- case map[string]float64:
- fastpathTV.DecMapStringFloat64V(v, fastpathCheckNilFalse, false, d)
- case *map[string]float64:
- v2, changed2 := fastpathTV.DecMapStringFloat64V(*v, fastpathCheckNilFalse, true, d)
- if changed2 {
- *v = v2
- }
-
- case map[string]bool:
- fastpathTV.DecMapStringBoolV(v, fastpathCheckNilFalse, false, d)
- case *map[string]bool:
- v2, changed2 := fastpathTV.DecMapStringBoolV(*v, fastpathCheckNilFalse, true, d)
- if changed2 {
- *v = v2
- }
-
- case []float32:
- fastpathTV.DecSliceFloat32V(v, fastpathCheckNilFalse, false, d)
- case *[]float32:
- v2, changed2 := fastpathTV.DecSliceFloat32V(*v, fastpathCheckNilFalse, true, d)
- if changed2 {
- *v = v2
- }
-
- case map[float32]interface{}:
- fastpathTV.DecMapFloat32IntfV(v, fastpathCheckNilFalse, false, d)
- case *map[float32]interface{}:
- v2, changed2 := fastpathTV.DecMapFloat32IntfV(*v, fastpathCheckNilFalse, true, d)
- if changed2 {
- *v = v2
- }
-
- case map[float32]string:
- fastpathTV.DecMapFloat32StringV(v, fastpathCheckNilFalse, false, d)
- case *map[float32]string:
- v2, changed2 := fastpathTV.DecMapFloat32StringV(*v, fastpathCheckNilFalse, true, d)
- if changed2 {
- *v = v2
- }
-
- case map[float32]uint:
- fastpathTV.DecMapFloat32UintV(v, fastpathCheckNilFalse, false, d)
- case *map[float32]uint:
- v2, changed2 := fastpathTV.DecMapFloat32UintV(*v, fastpathCheckNilFalse, true, d)
- if changed2 {
- *v = v2
- }
-
- case map[float32]uint8:
- fastpathTV.DecMapFloat32Uint8V(v, fastpathCheckNilFalse, false, d)
- case *map[float32]uint8:
- v2, changed2 := fastpathTV.DecMapFloat32Uint8V(*v, fastpathCheckNilFalse, true, d)
- if changed2 {
- *v = v2
- }
-
- case map[float32]uint16:
- fastpathTV.DecMapFloat32Uint16V(v, fastpathCheckNilFalse, false, d)
- case *map[float32]uint16:
- v2, changed2 := fastpathTV.DecMapFloat32Uint16V(*v, fastpathCheckNilFalse, true, d)
- if changed2 {
- *v = v2
- }
-
- case map[float32]uint32:
- fastpathTV.DecMapFloat32Uint32V(v, fastpathCheckNilFalse, false, d)
- case *map[float32]uint32:
- v2, changed2 := fastpathTV.DecMapFloat32Uint32V(*v, fastpathCheckNilFalse, true, d)
- if changed2 {
- *v = v2
- }
-
- case map[float32]uint64:
- fastpathTV.DecMapFloat32Uint64V(v, fastpathCheckNilFalse, false, d)
- case *map[float32]uint64:
- v2, changed2 := fastpathTV.DecMapFloat32Uint64V(*v, fastpathCheckNilFalse, true, d)
- if changed2 {
- *v = v2
- }
-
- case map[float32]uintptr:
- fastpathTV.DecMapFloat32UintptrV(v, fastpathCheckNilFalse, false, d)
- case *map[float32]uintptr:
- v2, changed2 := fastpathTV.DecMapFloat32UintptrV(*v, fastpathCheckNilFalse, true, d)
- if changed2 {
- *v = v2
- }
-
- case map[float32]int:
- fastpathTV.DecMapFloat32IntV(v, fastpathCheckNilFalse, false, d)
- case *map[float32]int:
- v2, changed2 := fastpathTV.DecMapFloat32IntV(*v, fastpathCheckNilFalse, true, d)
- if changed2 {
- *v = v2
- }
-
- case map[float32]int8:
- fastpathTV.DecMapFloat32Int8V(v, fastpathCheckNilFalse, false, d)
- case *map[float32]int8:
- v2, changed2 := fastpathTV.DecMapFloat32Int8V(*v, fastpathCheckNilFalse, true, d)
- if changed2 {
- *v = v2
- }
-
- case map[float32]int16:
- fastpathTV.DecMapFloat32Int16V(v, fastpathCheckNilFalse, false, d)
- case *map[float32]int16:
- v2, changed2 := fastpathTV.DecMapFloat32Int16V(*v, fastpathCheckNilFalse, true, d)
- if changed2 {
- *v = v2
- }
-
- case map[float32]int32:
- fastpathTV.DecMapFloat32Int32V(v, fastpathCheckNilFalse, false, d)
- case *map[float32]int32:
- v2, changed2 := fastpathTV.DecMapFloat32Int32V(*v, fastpathCheckNilFalse, true, d)
- if changed2 {
- *v = v2
- }
-
- case map[float32]int64:
- fastpathTV.DecMapFloat32Int64V(v, fastpathCheckNilFalse, false, d)
- case *map[float32]int64:
- v2, changed2 := fastpathTV.DecMapFloat32Int64V(*v, fastpathCheckNilFalse, true, d)
- if changed2 {
- *v = v2
- }
-
- case map[float32]float32:
- fastpathTV.DecMapFloat32Float32V(v, fastpathCheckNilFalse, false, d)
- case *map[float32]float32:
- v2, changed2 := fastpathTV.DecMapFloat32Float32V(*v, fastpathCheckNilFalse, true, d)
- if changed2 {
- *v = v2
- }
-
- case map[float32]float64:
- fastpathTV.DecMapFloat32Float64V(v, fastpathCheckNilFalse, false, d)
- case *map[float32]float64:
- v2, changed2 := fastpathTV.DecMapFloat32Float64V(*v, fastpathCheckNilFalse, true, d)
- if changed2 {
- *v = v2
- }
-
- case map[float32]bool:
- fastpathTV.DecMapFloat32BoolV(v, fastpathCheckNilFalse, false, d)
- case *map[float32]bool:
- v2, changed2 := fastpathTV.DecMapFloat32BoolV(*v, fastpathCheckNilFalse, true, d)
- if changed2 {
- *v = v2
- }
-
- case []float64:
- fastpathTV.DecSliceFloat64V(v, fastpathCheckNilFalse, false, d)
- case *[]float64:
- v2, changed2 := fastpathTV.DecSliceFloat64V(*v, fastpathCheckNilFalse, true, d)
- if changed2 {
- *v = v2
- }
-
- case map[float64]interface{}:
- fastpathTV.DecMapFloat64IntfV(v, fastpathCheckNilFalse, false, d)
- case *map[float64]interface{}:
- v2, changed2 := fastpathTV.DecMapFloat64IntfV(*v, fastpathCheckNilFalse, true, d)
- if changed2 {
- *v = v2
- }
-
- case map[float64]string:
- fastpathTV.DecMapFloat64StringV(v, fastpathCheckNilFalse, false, d)
- case *map[float64]string:
- v2, changed2 := fastpathTV.DecMapFloat64StringV(*v, fastpathCheckNilFalse, true, d)
- if changed2 {
- *v = v2
- }
-
- case map[float64]uint:
- fastpathTV.DecMapFloat64UintV(v, fastpathCheckNilFalse, false, d)
- case *map[float64]uint:
- v2, changed2 := fastpathTV.DecMapFloat64UintV(*v, fastpathCheckNilFalse, true, d)
- if changed2 {
- *v = v2
- }
-
- case map[float64]uint8:
- fastpathTV.DecMapFloat64Uint8V(v, fastpathCheckNilFalse, false, d)
- case *map[float64]uint8:
- v2, changed2 := fastpathTV.DecMapFloat64Uint8V(*v, fastpathCheckNilFalse, true, d)
- if changed2 {
- *v = v2
- }
-
- case map[float64]uint16:
- fastpathTV.DecMapFloat64Uint16V(v, fastpathCheckNilFalse, false, d)
- case *map[float64]uint16:
- v2, changed2 := fastpathTV.DecMapFloat64Uint16V(*v, fastpathCheckNilFalse, true, d)
- if changed2 {
- *v = v2
- }
-
- case map[float64]uint32:
- fastpathTV.DecMapFloat64Uint32V(v, fastpathCheckNilFalse, false, d)
- case *map[float64]uint32:
- v2, changed2 := fastpathTV.DecMapFloat64Uint32V(*v, fastpathCheckNilFalse, true, d)
- if changed2 {
- *v = v2
- }
-
- case map[float64]uint64:
- fastpathTV.DecMapFloat64Uint64V(v, fastpathCheckNilFalse, false, d)
- case *map[float64]uint64:
- v2, changed2 := fastpathTV.DecMapFloat64Uint64V(*v, fastpathCheckNilFalse, true, d)
- if changed2 {
- *v = v2
- }
-
- case map[float64]uintptr:
- fastpathTV.DecMapFloat64UintptrV(v, fastpathCheckNilFalse, false, d)
- case *map[float64]uintptr:
- v2, changed2 := fastpathTV.DecMapFloat64UintptrV(*v, fastpathCheckNilFalse, true, d)
- if changed2 {
- *v = v2
- }
-
- case map[float64]int:
- fastpathTV.DecMapFloat64IntV(v, fastpathCheckNilFalse, false, d)
- case *map[float64]int:
- v2, changed2 := fastpathTV.DecMapFloat64IntV(*v, fastpathCheckNilFalse, true, d)
- if changed2 {
- *v = v2
- }
-
- case map[float64]int8:
- fastpathTV.DecMapFloat64Int8V(v, fastpathCheckNilFalse, false, d)
- case *map[float64]int8:
- v2, changed2 := fastpathTV.DecMapFloat64Int8V(*v, fastpathCheckNilFalse, true, d)
- if changed2 {
- *v = v2
- }
-
- case map[float64]int16:
- fastpathTV.DecMapFloat64Int16V(v, fastpathCheckNilFalse, false, d)
- case *map[float64]int16:
- v2, changed2 := fastpathTV.DecMapFloat64Int16V(*v, fastpathCheckNilFalse, true, d)
- if changed2 {
- *v = v2
- }
-
- case map[float64]int32:
- fastpathTV.DecMapFloat64Int32V(v, fastpathCheckNilFalse, false, d)
- case *map[float64]int32:
- v2, changed2 := fastpathTV.DecMapFloat64Int32V(*v, fastpathCheckNilFalse, true, d)
- if changed2 {
- *v = v2
- }
-
- case map[float64]int64:
- fastpathTV.DecMapFloat64Int64V(v, fastpathCheckNilFalse, false, d)
- case *map[float64]int64:
- v2, changed2 := fastpathTV.DecMapFloat64Int64V(*v, fastpathCheckNilFalse, true, d)
- if changed2 {
- *v = v2
- }
-
- case map[float64]float32:
- fastpathTV.DecMapFloat64Float32V(v, fastpathCheckNilFalse, false, d)
- case *map[float64]float32:
- v2, changed2 := fastpathTV.DecMapFloat64Float32V(*v, fastpathCheckNilFalse, true, d)
- if changed2 {
- *v = v2
- }
-
- case map[float64]float64:
- fastpathTV.DecMapFloat64Float64V(v, fastpathCheckNilFalse, false, d)
- case *map[float64]float64:
- v2, changed2 := fastpathTV.DecMapFloat64Float64V(*v, fastpathCheckNilFalse, true, d)
- if changed2 {
- *v = v2
- }
-
- case map[float64]bool:
- fastpathTV.DecMapFloat64BoolV(v, fastpathCheckNilFalse, false, d)
- case *map[float64]bool:
- v2, changed2 := fastpathTV.DecMapFloat64BoolV(*v, fastpathCheckNilFalse, true, d)
- if changed2 {
- *v = v2
- }
-
- case []uint:
- fastpathTV.DecSliceUintV(v, fastpathCheckNilFalse, false, d)
- case *[]uint:
- v2, changed2 := fastpathTV.DecSliceUintV(*v, fastpathCheckNilFalse, true, d)
- if changed2 {
- *v = v2
- }
-
- case map[uint]interface{}:
- fastpathTV.DecMapUintIntfV(v, fastpathCheckNilFalse, false, d)
- case *map[uint]interface{}:
- v2, changed2 := fastpathTV.DecMapUintIntfV(*v, fastpathCheckNilFalse, true, d)
- if changed2 {
- *v = v2
- }
-
- case map[uint]string:
- fastpathTV.DecMapUintStringV(v, fastpathCheckNilFalse, false, d)
- case *map[uint]string:
- v2, changed2 := fastpathTV.DecMapUintStringV(*v, fastpathCheckNilFalse, true, d)
- if changed2 {
- *v = v2
- }
-
- case map[uint]uint:
- fastpathTV.DecMapUintUintV(v, fastpathCheckNilFalse, false, d)
- case *map[uint]uint:
- v2, changed2 := fastpathTV.DecMapUintUintV(*v, fastpathCheckNilFalse, true, d)
- if changed2 {
- *v = v2
- }
-
- case map[uint]uint8:
- fastpathTV.DecMapUintUint8V(v, fastpathCheckNilFalse, false, d)
- case *map[uint]uint8:
- v2, changed2 := fastpathTV.DecMapUintUint8V(*v, fastpathCheckNilFalse, true, d)
- if changed2 {
- *v = v2
- }
-
- case map[uint]uint16:
- fastpathTV.DecMapUintUint16V(v, fastpathCheckNilFalse, false, d)
- case *map[uint]uint16:
- v2, changed2 := fastpathTV.DecMapUintUint16V(*v, fastpathCheckNilFalse, true, d)
- if changed2 {
- *v = v2
- }
-
- case map[uint]uint32:
- fastpathTV.DecMapUintUint32V(v, fastpathCheckNilFalse, false, d)
- case *map[uint]uint32:
- v2, changed2 := fastpathTV.DecMapUintUint32V(*v, fastpathCheckNilFalse, true, d)
- if changed2 {
- *v = v2
- }
-
- case map[uint]uint64:
- fastpathTV.DecMapUintUint64V(v, fastpathCheckNilFalse, false, d)
- case *map[uint]uint64:
- v2, changed2 := fastpathTV.DecMapUintUint64V(*v, fastpathCheckNilFalse, true, d)
- if changed2 {
- *v = v2
- }
-
- case map[uint]uintptr:
- fastpathTV.DecMapUintUintptrV(v, fastpathCheckNilFalse, false, d)
- case *map[uint]uintptr:
- v2, changed2 := fastpathTV.DecMapUintUintptrV(*v, fastpathCheckNilFalse, true, d)
- if changed2 {
- *v = v2
- }
-
- case map[uint]int:
- fastpathTV.DecMapUintIntV(v, fastpathCheckNilFalse, false, d)
- case *map[uint]int:
- v2, changed2 := fastpathTV.DecMapUintIntV(*v, fastpathCheckNilFalse, true, d)
- if changed2 {
- *v = v2
- }
-
- case map[uint]int8:
- fastpathTV.DecMapUintInt8V(v, fastpathCheckNilFalse, false, d)
- case *map[uint]int8:
- v2, changed2 := fastpathTV.DecMapUintInt8V(*v, fastpathCheckNilFalse, true, d)
- if changed2 {
- *v = v2
- }
-
- case map[uint]int16:
- fastpathTV.DecMapUintInt16V(v, fastpathCheckNilFalse, false, d)
- case *map[uint]int16:
- v2, changed2 := fastpathTV.DecMapUintInt16V(*v, fastpathCheckNilFalse, true, d)
- if changed2 {
- *v = v2
- }
-
- case map[uint]int32:
- fastpathTV.DecMapUintInt32V(v, fastpathCheckNilFalse, false, d)
- case *map[uint]int32:
- v2, changed2 := fastpathTV.DecMapUintInt32V(*v, fastpathCheckNilFalse, true, d)
- if changed2 {
- *v = v2
- }
-
- case map[uint]int64:
- fastpathTV.DecMapUintInt64V(v, fastpathCheckNilFalse, false, d)
- case *map[uint]int64:
- v2, changed2 := fastpathTV.DecMapUintInt64V(*v, fastpathCheckNilFalse, true, d)
- if changed2 {
- *v = v2
- }
-
- case map[uint]float32:
- fastpathTV.DecMapUintFloat32V(v, fastpathCheckNilFalse, false, d)
- case *map[uint]float32:
- v2, changed2 := fastpathTV.DecMapUintFloat32V(*v, fastpathCheckNilFalse, true, d)
- if changed2 {
- *v = v2
- }
-
- case map[uint]float64:
- fastpathTV.DecMapUintFloat64V(v, fastpathCheckNilFalse, false, d)
- case *map[uint]float64:
- v2, changed2 := fastpathTV.DecMapUintFloat64V(*v, fastpathCheckNilFalse, true, d)
- if changed2 {
- *v = v2
- }
-
- case map[uint]bool:
- fastpathTV.DecMapUintBoolV(v, fastpathCheckNilFalse, false, d)
- case *map[uint]bool:
- v2, changed2 := fastpathTV.DecMapUintBoolV(*v, fastpathCheckNilFalse, true, d)
- if changed2 {
- *v = v2
- }
-
- case map[uint8]interface{}:
- fastpathTV.DecMapUint8IntfV(v, fastpathCheckNilFalse, false, d)
- case *map[uint8]interface{}:
- v2, changed2 := fastpathTV.DecMapUint8IntfV(*v, fastpathCheckNilFalse, true, d)
- if changed2 {
- *v = v2
- }
-
- case map[uint8]string:
- fastpathTV.DecMapUint8StringV(v, fastpathCheckNilFalse, false, d)
- case *map[uint8]string:
- v2, changed2 := fastpathTV.DecMapUint8StringV(*v, fastpathCheckNilFalse, true, d)
- if changed2 {
- *v = v2
- }
-
- case map[uint8]uint:
- fastpathTV.DecMapUint8UintV(v, fastpathCheckNilFalse, false, d)
- case *map[uint8]uint:
- v2, changed2 := fastpathTV.DecMapUint8UintV(*v, fastpathCheckNilFalse, true, d)
- if changed2 {
- *v = v2
- }
-
- case map[uint8]uint8:
- fastpathTV.DecMapUint8Uint8V(v, fastpathCheckNilFalse, false, d)
- case *map[uint8]uint8:
- v2, changed2 := fastpathTV.DecMapUint8Uint8V(*v, fastpathCheckNilFalse, true, d)
- if changed2 {
- *v = v2
- }
-
- case map[uint8]uint16:
- fastpathTV.DecMapUint8Uint16V(v, fastpathCheckNilFalse, false, d)
- case *map[uint8]uint16:
- v2, changed2 := fastpathTV.DecMapUint8Uint16V(*v, fastpathCheckNilFalse, true, d)
- if changed2 {
- *v = v2
- }
-
- case map[uint8]uint32:
- fastpathTV.DecMapUint8Uint32V(v, fastpathCheckNilFalse, false, d)
- case *map[uint8]uint32:
- v2, changed2 := fastpathTV.DecMapUint8Uint32V(*v, fastpathCheckNilFalse, true, d)
- if changed2 {
- *v = v2
- }
-
- case map[uint8]uint64:
- fastpathTV.DecMapUint8Uint64V(v, fastpathCheckNilFalse, false, d)
- case *map[uint8]uint64:
- v2, changed2 := fastpathTV.DecMapUint8Uint64V(*v, fastpathCheckNilFalse, true, d)
- if changed2 {
- *v = v2
- }
-
- case map[uint8]uintptr:
- fastpathTV.DecMapUint8UintptrV(v, fastpathCheckNilFalse, false, d)
- case *map[uint8]uintptr:
- v2, changed2 := fastpathTV.DecMapUint8UintptrV(*v, fastpathCheckNilFalse, true, d)
- if changed2 {
- *v = v2
- }
-
- case map[uint8]int:
- fastpathTV.DecMapUint8IntV(v, fastpathCheckNilFalse, false, d)
- case *map[uint8]int:
- v2, changed2 := fastpathTV.DecMapUint8IntV(*v, fastpathCheckNilFalse, true, d)
- if changed2 {
- *v = v2
- }
-
- case map[uint8]int8:
- fastpathTV.DecMapUint8Int8V(v, fastpathCheckNilFalse, false, d)
- case *map[uint8]int8:
- v2, changed2 := fastpathTV.DecMapUint8Int8V(*v, fastpathCheckNilFalse, true, d)
- if changed2 {
- *v = v2
- }
-
- case map[uint8]int16:
- fastpathTV.DecMapUint8Int16V(v, fastpathCheckNilFalse, false, d)
- case *map[uint8]int16:
- v2, changed2 := fastpathTV.DecMapUint8Int16V(*v, fastpathCheckNilFalse, true, d)
- if changed2 {
- *v = v2
- }
-
- case map[uint8]int32:
- fastpathTV.DecMapUint8Int32V(v, fastpathCheckNilFalse, false, d)
- case *map[uint8]int32:
- v2, changed2 := fastpathTV.DecMapUint8Int32V(*v, fastpathCheckNilFalse, true, d)
- if changed2 {
- *v = v2
- }
-
- case map[uint8]int64:
- fastpathTV.DecMapUint8Int64V(v, fastpathCheckNilFalse, false, d)
- case *map[uint8]int64:
- v2, changed2 := fastpathTV.DecMapUint8Int64V(*v, fastpathCheckNilFalse, true, d)
- if changed2 {
- *v = v2
- }
-
- case map[uint8]float32:
- fastpathTV.DecMapUint8Float32V(v, fastpathCheckNilFalse, false, d)
- case *map[uint8]float32:
- v2, changed2 := fastpathTV.DecMapUint8Float32V(*v, fastpathCheckNilFalse, true, d)
- if changed2 {
- *v = v2
- }
-
- case map[uint8]float64:
- fastpathTV.DecMapUint8Float64V(v, fastpathCheckNilFalse, false, d)
- case *map[uint8]float64:
- v2, changed2 := fastpathTV.DecMapUint8Float64V(*v, fastpathCheckNilFalse, true, d)
- if changed2 {
- *v = v2
- }
-
- case map[uint8]bool:
- fastpathTV.DecMapUint8BoolV(v, fastpathCheckNilFalse, false, d)
- case *map[uint8]bool:
- v2, changed2 := fastpathTV.DecMapUint8BoolV(*v, fastpathCheckNilFalse, true, d)
- if changed2 {
- *v = v2
- }
-
- case []uint16:
- fastpathTV.DecSliceUint16V(v, fastpathCheckNilFalse, false, d)
- case *[]uint16:
- v2, changed2 := fastpathTV.DecSliceUint16V(*v, fastpathCheckNilFalse, true, d)
- if changed2 {
- *v = v2
- }
-
- case map[uint16]interface{}:
- fastpathTV.DecMapUint16IntfV(v, fastpathCheckNilFalse, false, d)
- case *map[uint16]interface{}:
- v2, changed2 := fastpathTV.DecMapUint16IntfV(*v, fastpathCheckNilFalse, true, d)
- if changed2 {
- *v = v2
- }
-
- case map[uint16]string:
- fastpathTV.DecMapUint16StringV(v, fastpathCheckNilFalse, false, d)
- case *map[uint16]string:
- v2, changed2 := fastpathTV.DecMapUint16StringV(*v, fastpathCheckNilFalse, true, d)
- if changed2 {
- *v = v2
- }
-
- case map[uint16]uint:
- fastpathTV.DecMapUint16UintV(v, fastpathCheckNilFalse, false, d)
- case *map[uint16]uint:
- v2, changed2 := fastpathTV.DecMapUint16UintV(*v, fastpathCheckNilFalse, true, d)
- if changed2 {
- *v = v2
- }
-
- case map[uint16]uint8:
- fastpathTV.DecMapUint16Uint8V(v, fastpathCheckNilFalse, false, d)
- case *map[uint16]uint8:
- v2, changed2 := fastpathTV.DecMapUint16Uint8V(*v, fastpathCheckNilFalse, true, d)
- if changed2 {
- *v = v2
- }
-
- case map[uint16]uint16:
- fastpathTV.DecMapUint16Uint16V(v, fastpathCheckNilFalse, false, d)
- case *map[uint16]uint16:
- v2, changed2 := fastpathTV.DecMapUint16Uint16V(*v, fastpathCheckNilFalse, true, d)
- if changed2 {
- *v = v2
- }
-
- case map[uint16]uint32:
- fastpathTV.DecMapUint16Uint32V(v, fastpathCheckNilFalse, false, d)
- case *map[uint16]uint32:
- v2, changed2 := fastpathTV.DecMapUint16Uint32V(*v, fastpathCheckNilFalse, true, d)
- if changed2 {
- *v = v2
- }
-
- case map[uint16]uint64:
- fastpathTV.DecMapUint16Uint64V(v, fastpathCheckNilFalse, false, d)
- case *map[uint16]uint64:
- v2, changed2 := fastpathTV.DecMapUint16Uint64V(*v, fastpathCheckNilFalse, true, d)
- if changed2 {
- *v = v2
- }
-
- case map[uint16]uintptr:
- fastpathTV.DecMapUint16UintptrV(v, fastpathCheckNilFalse, false, d)
- case *map[uint16]uintptr:
- v2, changed2 := fastpathTV.DecMapUint16UintptrV(*v, fastpathCheckNilFalse, true, d)
- if changed2 {
- *v = v2
- }
-
- case map[uint16]int:
- fastpathTV.DecMapUint16IntV(v, fastpathCheckNilFalse, false, d)
- case *map[uint16]int:
- v2, changed2 := fastpathTV.DecMapUint16IntV(*v, fastpathCheckNilFalse, true, d)
- if changed2 {
- *v = v2
- }
-
- case map[uint16]int8:
- fastpathTV.DecMapUint16Int8V(v, fastpathCheckNilFalse, false, d)
- case *map[uint16]int8:
- v2, changed2 := fastpathTV.DecMapUint16Int8V(*v, fastpathCheckNilFalse, true, d)
- if changed2 {
- *v = v2
- }
-
- case map[uint16]int16:
- fastpathTV.DecMapUint16Int16V(v, fastpathCheckNilFalse, false, d)
- case *map[uint16]int16:
- v2, changed2 := fastpathTV.DecMapUint16Int16V(*v, fastpathCheckNilFalse, true, d)
- if changed2 {
- *v = v2
- }
-
- case map[uint16]int32:
- fastpathTV.DecMapUint16Int32V(v, fastpathCheckNilFalse, false, d)
- case *map[uint16]int32:
- v2, changed2 := fastpathTV.DecMapUint16Int32V(*v, fastpathCheckNilFalse, true, d)
- if changed2 {
- *v = v2
- }
-
- case map[uint16]int64:
- fastpathTV.DecMapUint16Int64V(v, fastpathCheckNilFalse, false, d)
- case *map[uint16]int64:
- v2, changed2 := fastpathTV.DecMapUint16Int64V(*v, fastpathCheckNilFalse, true, d)
- if changed2 {
- *v = v2
- }
-
- case map[uint16]float32:
- fastpathTV.DecMapUint16Float32V(v, fastpathCheckNilFalse, false, d)
- case *map[uint16]float32:
- v2, changed2 := fastpathTV.DecMapUint16Float32V(*v, fastpathCheckNilFalse, true, d)
- if changed2 {
- *v = v2
- }
-
- case map[uint16]float64:
- fastpathTV.DecMapUint16Float64V(v, fastpathCheckNilFalse, false, d)
- case *map[uint16]float64:
- v2, changed2 := fastpathTV.DecMapUint16Float64V(*v, fastpathCheckNilFalse, true, d)
- if changed2 {
- *v = v2
- }
-
- case map[uint16]bool:
- fastpathTV.DecMapUint16BoolV(v, fastpathCheckNilFalse, false, d)
- case *map[uint16]bool:
- v2, changed2 := fastpathTV.DecMapUint16BoolV(*v, fastpathCheckNilFalse, true, d)
- if changed2 {
- *v = v2
- }
-
- case []uint32:
- fastpathTV.DecSliceUint32V(v, fastpathCheckNilFalse, false, d)
- case *[]uint32:
- v2, changed2 := fastpathTV.DecSliceUint32V(*v, fastpathCheckNilFalse, true, d)
- if changed2 {
- *v = v2
- }
-
- case map[uint32]interface{}:
- fastpathTV.DecMapUint32IntfV(v, fastpathCheckNilFalse, false, d)
- case *map[uint32]interface{}:
- v2, changed2 := fastpathTV.DecMapUint32IntfV(*v, fastpathCheckNilFalse, true, d)
- if changed2 {
- *v = v2
- }
-
- case map[uint32]string:
- fastpathTV.DecMapUint32StringV(v, fastpathCheckNilFalse, false, d)
- case *map[uint32]string:
- v2, changed2 := fastpathTV.DecMapUint32StringV(*v, fastpathCheckNilFalse, true, d)
- if changed2 {
- *v = v2
- }
-
- case map[uint32]uint:
- fastpathTV.DecMapUint32UintV(v, fastpathCheckNilFalse, false, d)
- case *map[uint32]uint:
- v2, changed2 := fastpathTV.DecMapUint32UintV(*v, fastpathCheckNilFalse, true, d)
- if changed2 {
- *v = v2
- }
-
- case map[uint32]uint8:
- fastpathTV.DecMapUint32Uint8V(v, fastpathCheckNilFalse, false, d)
- case *map[uint32]uint8:
- v2, changed2 := fastpathTV.DecMapUint32Uint8V(*v, fastpathCheckNilFalse, true, d)
- if changed2 {
- *v = v2
- }
-
- case map[uint32]uint16:
- fastpathTV.DecMapUint32Uint16V(v, fastpathCheckNilFalse, false, d)
- case *map[uint32]uint16:
- v2, changed2 := fastpathTV.DecMapUint32Uint16V(*v, fastpathCheckNilFalse, true, d)
- if changed2 {
- *v = v2
- }
-
- case map[uint32]uint32:
- fastpathTV.DecMapUint32Uint32V(v, fastpathCheckNilFalse, false, d)
- case *map[uint32]uint32:
- v2, changed2 := fastpathTV.DecMapUint32Uint32V(*v, fastpathCheckNilFalse, true, d)
- if changed2 {
- *v = v2
- }
-
- case map[uint32]uint64:
- fastpathTV.DecMapUint32Uint64V(v, fastpathCheckNilFalse, false, d)
- case *map[uint32]uint64:
- v2, changed2 := fastpathTV.DecMapUint32Uint64V(*v, fastpathCheckNilFalse, true, d)
- if changed2 {
- *v = v2
- }
-
- case map[uint32]uintptr:
- fastpathTV.DecMapUint32UintptrV(v, fastpathCheckNilFalse, false, d)
- case *map[uint32]uintptr:
- v2, changed2 := fastpathTV.DecMapUint32UintptrV(*v, fastpathCheckNilFalse, true, d)
- if changed2 {
- *v = v2
- }
-
- case map[uint32]int:
- fastpathTV.DecMapUint32IntV(v, fastpathCheckNilFalse, false, d)
- case *map[uint32]int:
- v2, changed2 := fastpathTV.DecMapUint32IntV(*v, fastpathCheckNilFalse, true, d)
- if changed2 {
- *v = v2
- }
-
- case map[uint32]int8:
- fastpathTV.DecMapUint32Int8V(v, fastpathCheckNilFalse, false, d)
- case *map[uint32]int8:
- v2, changed2 := fastpathTV.DecMapUint32Int8V(*v, fastpathCheckNilFalse, true, d)
- if changed2 {
- *v = v2
- }
-
- case map[uint32]int16:
- fastpathTV.DecMapUint32Int16V(v, fastpathCheckNilFalse, false, d)
- case *map[uint32]int16:
- v2, changed2 := fastpathTV.DecMapUint32Int16V(*v, fastpathCheckNilFalse, true, d)
- if changed2 {
- *v = v2
- }
-
- case map[uint32]int32:
- fastpathTV.DecMapUint32Int32V(v, fastpathCheckNilFalse, false, d)
- case *map[uint32]int32:
- v2, changed2 := fastpathTV.DecMapUint32Int32V(*v, fastpathCheckNilFalse, true, d)
- if changed2 {
- *v = v2
- }
-
- case map[uint32]int64:
- fastpathTV.DecMapUint32Int64V(v, fastpathCheckNilFalse, false, d)
- case *map[uint32]int64:
- v2, changed2 := fastpathTV.DecMapUint32Int64V(*v, fastpathCheckNilFalse, true, d)
- if changed2 {
- *v = v2
- }
-
- case map[uint32]float32:
- fastpathTV.DecMapUint32Float32V(v, fastpathCheckNilFalse, false, d)
- case *map[uint32]float32:
- v2, changed2 := fastpathTV.DecMapUint32Float32V(*v, fastpathCheckNilFalse, true, d)
- if changed2 {
- *v = v2
- }
-
- case map[uint32]float64:
- fastpathTV.DecMapUint32Float64V(v, fastpathCheckNilFalse, false, d)
- case *map[uint32]float64:
- v2, changed2 := fastpathTV.DecMapUint32Float64V(*v, fastpathCheckNilFalse, true, d)
- if changed2 {
- *v = v2
- }
-
- case map[uint32]bool:
- fastpathTV.DecMapUint32BoolV(v, fastpathCheckNilFalse, false, d)
- case *map[uint32]bool:
- v2, changed2 := fastpathTV.DecMapUint32BoolV(*v, fastpathCheckNilFalse, true, d)
- if changed2 {
- *v = v2
- }
-
- case []uint64:
- fastpathTV.DecSliceUint64V(v, fastpathCheckNilFalse, false, d)
- case *[]uint64:
- v2, changed2 := fastpathTV.DecSliceUint64V(*v, fastpathCheckNilFalse, true, d)
- if changed2 {
- *v = v2
- }
-
- case map[uint64]interface{}:
- fastpathTV.DecMapUint64IntfV(v, fastpathCheckNilFalse, false, d)
- case *map[uint64]interface{}:
- v2, changed2 := fastpathTV.DecMapUint64IntfV(*v, fastpathCheckNilFalse, true, d)
- if changed2 {
- *v = v2
- }
-
- case map[uint64]string:
- fastpathTV.DecMapUint64StringV(v, fastpathCheckNilFalse, false, d)
- case *map[uint64]string:
- v2, changed2 := fastpathTV.DecMapUint64StringV(*v, fastpathCheckNilFalse, true, d)
- if changed2 {
- *v = v2
- }
-
- case map[uint64]uint:
- fastpathTV.DecMapUint64UintV(v, fastpathCheckNilFalse, false, d)
- case *map[uint64]uint:
- v2, changed2 := fastpathTV.DecMapUint64UintV(*v, fastpathCheckNilFalse, true, d)
- if changed2 {
- *v = v2
- }
-
- case map[uint64]uint8:
- fastpathTV.DecMapUint64Uint8V(v, fastpathCheckNilFalse, false, d)
- case *map[uint64]uint8:
- v2, changed2 := fastpathTV.DecMapUint64Uint8V(*v, fastpathCheckNilFalse, true, d)
- if changed2 {
- *v = v2
- }
-
- case map[uint64]uint16:
- fastpathTV.DecMapUint64Uint16V(v, fastpathCheckNilFalse, false, d)
- case *map[uint64]uint16:
- v2, changed2 := fastpathTV.DecMapUint64Uint16V(*v, fastpathCheckNilFalse, true, d)
- if changed2 {
- *v = v2
- }
-
- case map[uint64]uint32:
- fastpathTV.DecMapUint64Uint32V(v, fastpathCheckNilFalse, false, d)
- case *map[uint64]uint32:
- v2, changed2 := fastpathTV.DecMapUint64Uint32V(*v, fastpathCheckNilFalse, true, d)
- if changed2 {
- *v = v2
- }
-
- case map[uint64]uint64:
- fastpathTV.DecMapUint64Uint64V(v, fastpathCheckNilFalse, false, d)
- case *map[uint64]uint64:
- v2, changed2 := fastpathTV.DecMapUint64Uint64V(*v, fastpathCheckNilFalse, true, d)
- if changed2 {
- *v = v2
- }
-
- case map[uint64]uintptr:
- fastpathTV.DecMapUint64UintptrV(v, fastpathCheckNilFalse, false, d)
- case *map[uint64]uintptr:
- v2, changed2 := fastpathTV.DecMapUint64UintptrV(*v, fastpathCheckNilFalse, true, d)
- if changed2 {
- *v = v2
- }
-
- case map[uint64]int:
- fastpathTV.DecMapUint64IntV(v, fastpathCheckNilFalse, false, d)
- case *map[uint64]int:
- v2, changed2 := fastpathTV.DecMapUint64IntV(*v, fastpathCheckNilFalse, true, d)
- if changed2 {
- *v = v2
- }
-
- case map[uint64]int8:
- fastpathTV.DecMapUint64Int8V(v, fastpathCheckNilFalse, false, d)
- case *map[uint64]int8:
- v2, changed2 := fastpathTV.DecMapUint64Int8V(*v, fastpathCheckNilFalse, true, d)
- if changed2 {
- *v = v2
- }
-
- case map[uint64]int16:
- fastpathTV.DecMapUint64Int16V(v, fastpathCheckNilFalse, false, d)
- case *map[uint64]int16:
- v2, changed2 := fastpathTV.DecMapUint64Int16V(*v, fastpathCheckNilFalse, true, d)
- if changed2 {
- *v = v2
- }
-
- case map[uint64]int32:
- fastpathTV.DecMapUint64Int32V(v, fastpathCheckNilFalse, false, d)
- case *map[uint64]int32:
- v2, changed2 := fastpathTV.DecMapUint64Int32V(*v, fastpathCheckNilFalse, true, d)
- if changed2 {
- *v = v2
- }
-
- case map[uint64]int64:
- fastpathTV.DecMapUint64Int64V(v, fastpathCheckNilFalse, false, d)
- case *map[uint64]int64:
- v2, changed2 := fastpathTV.DecMapUint64Int64V(*v, fastpathCheckNilFalse, true, d)
- if changed2 {
- *v = v2
- }
-
- case map[uint64]float32:
- fastpathTV.DecMapUint64Float32V(v, fastpathCheckNilFalse, false, d)
- case *map[uint64]float32:
- v2, changed2 := fastpathTV.DecMapUint64Float32V(*v, fastpathCheckNilFalse, true, d)
- if changed2 {
- *v = v2
- }
-
- case map[uint64]float64:
- fastpathTV.DecMapUint64Float64V(v, fastpathCheckNilFalse, false, d)
- case *map[uint64]float64:
- v2, changed2 := fastpathTV.DecMapUint64Float64V(*v, fastpathCheckNilFalse, true, d)
- if changed2 {
- *v = v2
- }
-
- case map[uint64]bool:
- fastpathTV.DecMapUint64BoolV(v, fastpathCheckNilFalse, false, d)
- case *map[uint64]bool:
- v2, changed2 := fastpathTV.DecMapUint64BoolV(*v, fastpathCheckNilFalse, true, d)
- if changed2 {
- *v = v2
- }
-
- case []uintptr:
- fastpathTV.DecSliceUintptrV(v, fastpathCheckNilFalse, false, d)
- case *[]uintptr:
- v2, changed2 := fastpathTV.DecSliceUintptrV(*v, fastpathCheckNilFalse, true, d)
- if changed2 {
- *v = v2
- }
-
- case map[uintptr]interface{}:
- fastpathTV.DecMapUintptrIntfV(v, fastpathCheckNilFalse, false, d)
- case *map[uintptr]interface{}:
- v2, changed2 := fastpathTV.DecMapUintptrIntfV(*v, fastpathCheckNilFalse, true, d)
- if changed2 {
- *v = v2
- }
-
- case map[uintptr]string:
- fastpathTV.DecMapUintptrStringV(v, fastpathCheckNilFalse, false, d)
- case *map[uintptr]string:
- v2, changed2 := fastpathTV.DecMapUintptrStringV(*v, fastpathCheckNilFalse, true, d)
- if changed2 {
- *v = v2
- }
-
- case map[uintptr]uint:
- fastpathTV.DecMapUintptrUintV(v, fastpathCheckNilFalse, false, d)
- case *map[uintptr]uint:
- v2, changed2 := fastpathTV.DecMapUintptrUintV(*v, fastpathCheckNilFalse, true, d)
- if changed2 {
- *v = v2
- }
-
- case map[uintptr]uint8:
- fastpathTV.DecMapUintptrUint8V(v, fastpathCheckNilFalse, false, d)
- case *map[uintptr]uint8:
- v2, changed2 := fastpathTV.DecMapUintptrUint8V(*v, fastpathCheckNilFalse, true, d)
- if changed2 {
- *v = v2
- }
-
- case map[uintptr]uint16:
- fastpathTV.DecMapUintptrUint16V(v, fastpathCheckNilFalse, false, d)
- case *map[uintptr]uint16:
- v2, changed2 := fastpathTV.DecMapUintptrUint16V(*v, fastpathCheckNilFalse, true, d)
- if changed2 {
- *v = v2
- }
-
- case map[uintptr]uint32:
- fastpathTV.DecMapUintptrUint32V(v, fastpathCheckNilFalse, false, d)
- case *map[uintptr]uint32:
- v2, changed2 := fastpathTV.DecMapUintptrUint32V(*v, fastpathCheckNilFalse, true, d)
- if changed2 {
- *v = v2
- }
-
- case map[uintptr]uint64:
- fastpathTV.DecMapUintptrUint64V(v, fastpathCheckNilFalse, false, d)
- case *map[uintptr]uint64:
- v2, changed2 := fastpathTV.DecMapUintptrUint64V(*v, fastpathCheckNilFalse, true, d)
- if changed2 {
- *v = v2
- }
-
- case map[uintptr]uintptr:
- fastpathTV.DecMapUintptrUintptrV(v, fastpathCheckNilFalse, false, d)
- case *map[uintptr]uintptr:
- v2, changed2 := fastpathTV.DecMapUintptrUintptrV(*v, fastpathCheckNilFalse, true, d)
- if changed2 {
- *v = v2
- }
-
- case map[uintptr]int:
- fastpathTV.DecMapUintptrIntV(v, fastpathCheckNilFalse, false, d)
- case *map[uintptr]int:
- v2, changed2 := fastpathTV.DecMapUintptrIntV(*v, fastpathCheckNilFalse, true, d)
- if changed2 {
- *v = v2
- }
-
- case map[uintptr]int8:
- fastpathTV.DecMapUintptrInt8V(v, fastpathCheckNilFalse, false, d)
- case *map[uintptr]int8:
- v2, changed2 := fastpathTV.DecMapUintptrInt8V(*v, fastpathCheckNilFalse, true, d)
- if changed2 {
- *v = v2
- }
-
- case map[uintptr]int16:
- fastpathTV.DecMapUintptrInt16V(v, fastpathCheckNilFalse, false, d)
- case *map[uintptr]int16:
- v2, changed2 := fastpathTV.DecMapUintptrInt16V(*v, fastpathCheckNilFalse, true, d)
- if changed2 {
- *v = v2
- }
-
- case map[uintptr]int32:
- fastpathTV.DecMapUintptrInt32V(v, fastpathCheckNilFalse, false, d)
- case *map[uintptr]int32:
- v2, changed2 := fastpathTV.DecMapUintptrInt32V(*v, fastpathCheckNilFalse, true, d)
- if changed2 {
- *v = v2
- }
-
- case map[uintptr]int64:
- fastpathTV.DecMapUintptrInt64V(v, fastpathCheckNilFalse, false, d)
- case *map[uintptr]int64:
- v2, changed2 := fastpathTV.DecMapUintptrInt64V(*v, fastpathCheckNilFalse, true, d)
- if changed2 {
- *v = v2
- }
-
- case map[uintptr]float32:
- fastpathTV.DecMapUintptrFloat32V(v, fastpathCheckNilFalse, false, d)
- case *map[uintptr]float32:
- v2, changed2 := fastpathTV.DecMapUintptrFloat32V(*v, fastpathCheckNilFalse, true, d)
- if changed2 {
- *v = v2
- }
-
- case map[uintptr]float64:
- fastpathTV.DecMapUintptrFloat64V(v, fastpathCheckNilFalse, false, d)
- case *map[uintptr]float64:
- v2, changed2 := fastpathTV.DecMapUintptrFloat64V(*v, fastpathCheckNilFalse, true, d)
- if changed2 {
- *v = v2
- }
-
- case map[uintptr]bool:
- fastpathTV.DecMapUintptrBoolV(v, fastpathCheckNilFalse, false, d)
- case *map[uintptr]bool:
- v2, changed2 := fastpathTV.DecMapUintptrBoolV(*v, fastpathCheckNilFalse, true, d)
- if changed2 {
- *v = v2
- }
-
- case []int:
- fastpathTV.DecSliceIntV(v, fastpathCheckNilFalse, false, d)
- case *[]int:
- v2, changed2 := fastpathTV.DecSliceIntV(*v, fastpathCheckNilFalse, true, d)
- if changed2 {
- *v = v2
- }
-
- case map[int]interface{}:
- fastpathTV.DecMapIntIntfV(v, fastpathCheckNilFalse, false, d)
- case *map[int]interface{}:
- v2, changed2 := fastpathTV.DecMapIntIntfV(*v, fastpathCheckNilFalse, true, d)
- if changed2 {
- *v = v2
- }
-
- case map[int]string:
- fastpathTV.DecMapIntStringV(v, fastpathCheckNilFalse, false, d)
- case *map[int]string:
- v2, changed2 := fastpathTV.DecMapIntStringV(*v, fastpathCheckNilFalse, true, d)
- if changed2 {
- *v = v2
- }
-
- case map[int]uint:
- fastpathTV.DecMapIntUintV(v, fastpathCheckNilFalse, false, d)
- case *map[int]uint:
- v2, changed2 := fastpathTV.DecMapIntUintV(*v, fastpathCheckNilFalse, true, d)
- if changed2 {
- *v = v2
- }
-
- case map[int]uint8:
- fastpathTV.DecMapIntUint8V(v, fastpathCheckNilFalse, false, d)
- case *map[int]uint8:
- v2, changed2 := fastpathTV.DecMapIntUint8V(*v, fastpathCheckNilFalse, true, d)
- if changed2 {
- *v = v2
- }
-
- case map[int]uint16:
- fastpathTV.DecMapIntUint16V(v, fastpathCheckNilFalse, false, d)
- case *map[int]uint16:
- v2, changed2 := fastpathTV.DecMapIntUint16V(*v, fastpathCheckNilFalse, true, d)
- if changed2 {
- *v = v2
- }
-
- case map[int]uint32:
- fastpathTV.DecMapIntUint32V(v, fastpathCheckNilFalse, false, d)
- case *map[int]uint32:
- v2, changed2 := fastpathTV.DecMapIntUint32V(*v, fastpathCheckNilFalse, true, d)
- if changed2 {
- *v = v2
- }
-
- case map[int]uint64:
- fastpathTV.DecMapIntUint64V(v, fastpathCheckNilFalse, false, d)
- case *map[int]uint64:
- v2, changed2 := fastpathTV.DecMapIntUint64V(*v, fastpathCheckNilFalse, true, d)
- if changed2 {
- *v = v2
- }
-
- case map[int]uintptr:
- fastpathTV.DecMapIntUintptrV(v, fastpathCheckNilFalse, false, d)
- case *map[int]uintptr:
- v2, changed2 := fastpathTV.DecMapIntUintptrV(*v, fastpathCheckNilFalse, true, d)
- if changed2 {
- *v = v2
- }
-
- case map[int]int:
- fastpathTV.DecMapIntIntV(v, fastpathCheckNilFalse, false, d)
- case *map[int]int:
- v2, changed2 := fastpathTV.DecMapIntIntV(*v, fastpathCheckNilFalse, true, d)
- if changed2 {
- *v = v2
- }
-
- case map[int]int8:
- fastpathTV.DecMapIntInt8V(v, fastpathCheckNilFalse, false, d)
- case *map[int]int8:
- v2, changed2 := fastpathTV.DecMapIntInt8V(*v, fastpathCheckNilFalse, true, d)
- if changed2 {
- *v = v2
- }
-
- case map[int]int16:
- fastpathTV.DecMapIntInt16V(v, fastpathCheckNilFalse, false, d)
- case *map[int]int16:
- v2, changed2 := fastpathTV.DecMapIntInt16V(*v, fastpathCheckNilFalse, true, d)
- if changed2 {
- *v = v2
- }
-
- case map[int]int32:
- fastpathTV.DecMapIntInt32V(v, fastpathCheckNilFalse, false, d)
- case *map[int]int32:
- v2, changed2 := fastpathTV.DecMapIntInt32V(*v, fastpathCheckNilFalse, true, d)
- if changed2 {
- *v = v2
- }
-
- case map[int]int64:
- fastpathTV.DecMapIntInt64V(v, fastpathCheckNilFalse, false, d)
- case *map[int]int64:
- v2, changed2 := fastpathTV.DecMapIntInt64V(*v, fastpathCheckNilFalse, true, d)
- if changed2 {
- *v = v2
- }
-
- case map[int]float32:
- fastpathTV.DecMapIntFloat32V(v, fastpathCheckNilFalse, false, d)
- case *map[int]float32:
- v2, changed2 := fastpathTV.DecMapIntFloat32V(*v, fastpathCheckNilFalse, true, d)
- if changed2 {
- *v = v2
- }
-
- case map[int]float64:
- fastpathTV.DecMapIntFloat64V(v, fastpathCheckNilFalse, false, d)
- case *map[int]float64:
- v2, changed2 := fastpathTV.DecMapIntFloat64V(*v, fastpathCheckNilFalse, true, d)
- if changed2 {
- *v = v2
- }
-
- case map[int]bool:
- fastpathTV.DecMapIntBoolV(v, fastpathCheckNilFalse, false, d)
- case *map[int]bool:
- v2, changed2 := fastpathTV.DecMapIntBoolV(*v, fastpathCheckNilFalse, true, d)
- if changed2 {
- *v = v2
- }
-
- case []int8:
- fastpathTV.DecSliceInt8V(v, fastpathCheckNilFalse, false, d)
- case *[]int8:
- v2, changed2 := fastpathTV.DecSliceInt8V(*v, fastpathCheckNilFalse, true, d)
- if changed2 {
- *v = v2
- }
-
- case map[int8]interface{}:
- fastpathTV.DecMapInt8IntfV(v, fastpathCheckNilFalse, false, d)
- case *map[int8]interface{}:
- v2, changed2 := fastpathTV.DecMapInt8IntfV(*v, fastpathCheckNilFalse, true, d)
- if changed2 {
- *v = v2
- }
-
- case map[int8]string:
- fastpathTV.DecMapInt8StringV(v, fastpathCheckNilFalse, false, d)
- case *map[int8]string:
- v2, changed2 := fastpathTV.DecMapInt8StringV(*v, fastpathCheckNilFalse, true, d)
- if changed2 {
- *v = v2
- }
-
- case map[int8]uint:
- fastpathTV.DecMapInt8UintV(v, fastpathCheckNilFalse, false, d)
- case *map[int8]uint:
- v2, changed2 := fastpathTV.DecMapInt8UintV(*v, fastpathCheckNilFalse, true, d)
- if changed2 {
- *v = v2
- }
-
- case map[int8]uint8:
- fastpathTV.DecMapInt8Uint8V(v, fastpathCheckNilFalse, false, d)
- case *map[int8]uint8:
- v2, changed2 := fastpathTV.DecMapInt8Uint8V(*v, fastpathCheckNilFalse, true, d)
- if changed2 {
- *v = v2
- }
-
- case map[int8]uint16:
- fastpathTV.DecMapInt8Uint16V(v, fastpathCheckNilFalse, false, d)
- case *map[int8]uint16:
- v2, changed2 := fastpathTV.DecMapInt8Uint16V(*v, fastpathCheckNilFalse, true, d)
- if changed2 {
- *v = v2
- }
-
- case map[int8]uint32:
- fastpathTV.DecMapInt8Uint32V(v, fastpathCheckNilFalse, false, d)
- case *map[int8]uint32:
- v2, changed2 := fastpathTV.DecMapInt8Uint32V(*v, fastpathCheckNilFalse, true, d)
- if changed2 {
- *v = v2
- }
-
- case map[int8]uint64:
- fastpathTV.DecMapInt8Uint64V(v, fastpathCheckNilFalse, false, d)
- case *map[int8]uint64:
- v2, changed2 := fastpathTV.DecMapInt8Uint64V(*v, fastpathCheckNilFalse, true, d)
- if changed2 {
- *v = v2
- }
-
- case map[int8]uintptr:
- fastpathTV.DecMapInt8UintptrV(v, fastpathCheckNilFalse, false, d)
- case *map[int8]uintptr:
- v2, changed2 := fastpathTV.DecMapInt8UintptrV(*v, fastpathCheckNilFalse, true, d)
- if changed2 {
- *v = v2
- }
-
- case map[int8]int:
- fastpathTV.DecMapInt8IntV(v, fastpathCheckNilFalse, false, d)
- case *map[int8]int:
- v2, changed2 := fastpathTV.DecMapInt8IntV(*v, fastpathCheckNilFalse, true, d)
- if changed2 {
- *v = v2
- }
-
- case map[int8]int8:
- fastpathTV.DecMapInt8Int8V(v, fastpathCheckNilFalse, false, d)
- case *map[int8]int8:
- v2, changed2 := fastpathTV.DecMapInt8Int8V(*v, fastpathCheckNilFalse, true, d)
- if changed2 {
- *v = v2
- }
-
- case map[int8]int16:
- fastpathTV.DecMapInt8Int16V(v, fastpathCheckNilFalse, false, d)
- case *map[int8]int16:
- v2, changed2 := fastpathTV.DecMapInt8Int16V(*v, fastpathCheckNilFalse, true, d)
- if changed2 {
- *v = v2
- }
-
- case map[int8]int32:
- fastpathTV.DecMapInt8Int32V(v, fastpathCheckNilFalse, false, d)
- case *map[int8]int32:
- v2, changed2 := fastpathTV.DecMapInt8Int32V(*v, fastpathCheckNilFalse, true, d)
- if changed2 {
- *v = v2
- }
-
- case map[int8]int64:
- fastpathTV.DecMapInt8Int64V(v, fastpathCheckNilFalse, false, d)
- case *map[int8]int64:
- v2, changed2 := fastpathTV.DecMapInt8Int64V(*v, fastpathCheckNilFalse, true, d)
- if changed2 {
- *v = v2
- }
-
- case map[int8]float32:
- fastpathTV.DecMapInt8Float32V(v, fastpathCheckNilFalse, false, d)
- case *map[int8]float32:
- v2, changed2 := fastpathTV.DecMapInt8Float32V(*v, fastpathCheckNilFalse, true, d)
- if changed2 {
- *v = v2
- }
-
- case map[int8]float64:
- fastpathTV.DecMapInt8Float64V(v, fastpathCheckNilFalse, false, d)
- case *map[int8]float64:
- v2, changed2 := fastpathTV.DecMapInt8Float64V(*v, fastpathCheckNilFalse, true, d)
- if changed2 {
- *v = v2
- }
-
- case map[int8]bool:
- fastpathTV.DecMapInt8BoolV(v, fastpathCheckNilFalse, false, d)
- case *map[int8]bool:
- v2, changed2 := fastpathTV.DecMapInt8BoolV(*v, fastpathCheckNilFalse, true, d)
- if changed2 {
- *v = v2
- }
-
- case []int16:
- fastpathTV.DecSliceInt16V(v, fastpathCheckNilFalse, false, d)
- case *[]int16:
- v2, changed2 := fastpathTV.DecSliceInt16V(*v, fastpathCheckNilFalse, true, d)
- if changed2 {
- *v = v2
- }
-
- case map[int16]interface{}:
- fastpathTV.DecMapInt16IntfV(v, fastpathCheckNilFalse, false, d)
- case *map[int16]interface{}:
- v2, changed2 := fastpathTV.DecMapInt16IntfV(*v, fastpathCheckNilFalse, true, d)
- if changed2 {
- *v = v2
- }
-
- case map[int16]string:
- fastpathTV.DecMapInt16StringV(v, fastpathCheckNilFalse, false, d)
- case *map[int16]string:
- v2, changed2 := fastpathTV.DecMapInt16StringV(*v, fastpathCheckNilFalse, true, d)
- if changed2 {
- *v = v2
- }
-
- case map[int16]uint:
- fastpathTV.DecMapInt16UintV(v, fastpathCheckNilFalse, false, d)
- case *map[int16]uint:
- v2, changed2 := fastpathTV.DecMapInt16UintV(*v, fastpathCheckNilFalse, true, d)
- if changed2 {
- *v = v2
- }
-
- case map[int16]uint8:
- fastpathTV.DecMapInt16Uint8V(v, fastpathCheckNilFalse, false, d)
- case *map[int16]uint8:
- v2, changed2 := fastpathTV.DecMapInt16Uint8V(*v, fastpathCheckNilFalse, true, d)
- if changed2 {
- *v = v2
- }
-
- case map[int16]uint16:
- fastpathTV.DecMapInt16Uint16V(v, fastpathCheckNilFalse, false, d)
- case *map[int16]uint16:
- v2, changed2 := fastpathTV.DecMapInt16Uint16V(*v, fastpathCheckNilFalse, true, d)
- if changed2 {
- *v = v2
- }
-
- case map[int16]uint32:
- fastpathTV.DecMapInt16Uint32V(v, fastpathCheckNilFalse, false, d)
- case *map[int16]uint32:
- v2, changed2 := fastpathTV.DecMapInt16Uint32V(*v, fastpathCheckNilFalse, true, d)
- if changed2 {
- *v = v2
- }
-
- case map[int16]uint64:
- fastpathTV.DecMapInt16Uint64V(v, fastpathCheckNilFalse, false, d)
- case *map[int16]uint64:
- v2, changed2 := fastpathTV.DecMapInt16Uint64V(*v, fastpathCheckNilFalse, true, d)
- if changed2 {
- *v = v2
- }
-
- case map[int16]uintptr:
- fastpathTV.DecMapInt16UintptrV(v, fastpathCheckNilFalse, false, d)
- case *map[int16]uintptr:
- v2, changed2 := fastpathTV.DecMapInt16UintptrV(*v, fastpathCheckNilFalse, true, d)
- if changed2 {
- *v = v2
- }
-
- case map[int16]int:
- fastpathTV.DecMapInt16IntV(v, fastpathCheckNilFalse, false, d)
- case *map[int16]int:
- v2, changed2 := fastpathTV.DecMapInt16IntV(*v, fastpathCheckNilFalse, true, d)
- if changed2 {
- *v = v2
- }
-
- case map[int16]int8:
- fastpathTV.DecMapInt16Int8V(v, fastpathCheckNilFalse, false, d)
- case *map[int16]int8:
- v2, changed2 := fastpathTV.DecMapInt16Int8V(*v, fastpathCheckNilFalse, true, d)
- if changed2 {
- *v = v2
- }
-
- case map[int16]int16:
- fastpathTV.DecMapInt16Int16V(v, fastpathCheckNilFalse, false, d)
- case *map[int16]int16:
- v2, changed2 := fastpathTV.DecMapInt16Int16V(*v, fastpathCheckNilFalse, true, d)
- if changed2 {
- *v = v2
- }
-
- case map[int16]int32:
- fastpathTV.DecMapInt16Int32V(v, fastpathCheckNilFalse, false, d)
- case *map[int16]int32:
- v2, changed2 := fastpathTV.DecMapInt16Int32V(*v, fastpathCheckNilFalse, true, d)
- if changed2 {
- *v = v2
- }
-
- case map[int16]int64:
- fastpathTV.DecMapInt16Int64V(v, fastpathCheckNilFalse, false, d)
- case *map[int16]int64:
- v2, changed2 := fastpathTV.DecMapInt16Int64V(*v, fastpathCheckNilFalse, true, d)
- if changed2 {
- *v = v2
- }
-
- case map[int16]float32:
- fastpathTV.DecMapInt16Float32V(v, fastpathCheckNilFalse, false, d)
- case *map[int16]float32:
- v2, changed2 := fastpathTV.DecMapInt16Float32V(*v, fastpathCheckNilFalse, true, d)
- if changed2 {
- *v = v2
- }
-
- case map[int16]float64:
- fastpathTV.DecMapInt16Float64V(v, fastpathCheckNilFalse, false, d)
- case *map[int16]float64:
- v2, changed2 := fastpathTV.DecMapInt16Float64V(*v, fastpathCheckNilFalse, true, d)
- if changed2 {
- *v = v2
- }
-
- case map[int16]bool:
- fastpathTV.DecMapInt16BoolV(v, fastpathCheckNilFalse, false, d)
- case *map[int16]bool:
- v2, changed2 := fastpathTV.DecMapInt16BoolV(*v, fastpathCheckNilFalse, true, d)
- if changed2 {
- *v = v2
- }
-
- case []int32:
- fastpathTV.DecSliceInt32V(v, fastpathCheckNilFalse, false, d)
- case *[]int32:
- v2, changed2 := fastpathTV.DecSliceInt32V(*v, fastpathCheckNilFalse, true, d)
- if changed2 {
- *v = v2
- }
-
- case map[int32]interface{}:
- fastpathTV.DecMapInt32IntfV(v, fastpathCheckNilFalse, false, d)
- case *map[int32]interface{}:
- v2, changed2 := fastpathTV.DecMapInt32IntfV(*v, fastpathCheckNilFalse, true, d)
- if changed2 {
- *v = v2
- }
-
- case map[int32]string:
- fastpathTV.DecMapInt32StringV(v, fastpathCheckNilFalse, false, d)
- case *map[int32]string:
- v2, changed2 := fastpathTV.DecMapInt32StringV(*v, fastpathCheckNilFalse, true, d)
- if changed2 {
- *v = v2
- }
-
- case map[int32]uint:
- fastpathTV.DecMapInt32UintV(v, fastpathCheckNilFalse, false, d)
- case *map[int32]uint:
- v2, changed2 := fastpathTV.DecMapInt32UintV(*v, fastpathCheckNilFalse, true, d)
- if changed2 {
- *v = v2
- }
-
- case map[int32]uint8:
- fastpathTV.DecMapInt32Uint8V(v, fastpathCheckNilFalse, false, d)
- case *map[int32]uint8:
- v2, changed2 := fastpathTV.DecMapInt32Uint8V(*v, fastpathCheckNilFalse, true, d)
- if changed2 {
- *v = v2
- }
-
- case map[int32]uint16:
- fastpathTV.DecMapInt32Uint16V(v, fastpathCheckNilFalse, false, d)
- case *map[int32]uint16:
- v2, changed2 := fastpathTV.DecMapInt32Uint16V(*v, fastpathCheckNilFalse, true, d)
- if changed2 {
- *v = v2
- }
-
- case map[int32]uint32:
- fastpathTV.DecMapInt32Uint32V(v, fastpathCheckNilFalse, false, d)
- case *map[int32]uint32:
- v2, changed2 := fastpathTV.DecMapInt32Uint32V(*v, fastpathCheckNilFalse, true, d)
- if changed2 {
- *v = v2
- }
-
- case map[int32]uint64:
- fastpathTV.DecMapInt32Uint64V(v, fastpathCheckNilFalse, false, d)
- case *map[int32]uint64:
- v2, changed2 := fastpathTV.DecMapInt32Uint64V(*v, fastpathCheckNilFalse, true, d)
- if changed2 {
- *v = v2
- }
-
- case map[int32]uintptr:
- fastpathTV.DecMapInt32UintptrV(v, fastpathCheckNilFalse, false, d)
- case *map[int32]uintptr:
- v2, changed2 := fastpathTV.DecMapInt32UintptrV(*v, fastpathCheckNilFalse, true, d)
- if changed2 {
- *v = v2
- }
-
- case map[int32]int:
- fastpathTV.DecMapInt32IntV(v, fastpathCheckNilFalse, false, d)
- case *map[int32]int:
- v2, changed2 := fastpathTV.DecMapInt32IntV(*v, fastpathCheckNilFalse, true, d)
- if changed2 {
- *v = v2
- }
-
- case map[int32]int8:
- fastpathTV.DecMapInt32Int8V(v, fastpathCheckNilFalse, false, d)
- case *map[int32]int8:
- v2, changed2 := fastpathTV.DecMapInt32Int8V(*v, fastpathCheckNilFalse, true, d)
- if changed2 {
- *v = v2
- }
-
- case map[int32]int16:
- fastpathTV.DecMapInt32Int16V(v, fastpathCheckNilFalse, false, d)
- case *map[int32]int16:
- v2, changed2 := fastpathTV.DecMapInt32Int16V(*v, fastpathCheckNilFalse, true, d)
- if changed2 {
- *v = v2
- }
-
- case map[int32]int32:
- fastpathTV.DecMapInt32Int32V(v, fastpathCheckNilFalse, false, d)
- case *map[int32]int32:
- v2, changed2 := fastpathTV.DecMapInt32Int32V(*v, fastpathCheckNilFalse, true, d)
- if changed2 {
- *v = v2
- }
-
- case map[int32]int64:
- fastpathTV.DecMapInt32Int64V(v, fastpathCheckNilFalse, false, d)
- case *map[int32]int64:
- v2, changed2 := fastpathTV.DecMapInt32Int64V(*v, fastpathCheckNilFalse, true, d)
- if changed2 {
- *v = v2
- }
-
- case map[int32]float32:
- fastpathTV.DecMapInt32Float32V(v, fastpathCheckNilFalse, false, d)
- case *map[int32]float32:
- v2, changed2 := fastpathTV.DecMapInt32Float32V(*v, fastpathCheckNilFalse, true, d)
- if changed2 {
- *v = v2
- }
-
- case map[int32]float64:
- fastpathTV.DecMapInt32Float64V(v, fastpathCheckNilFalse, false, d)
- case *map[int32]float64:
- v2, changed2 := fastpathTV.DecMapInt32Float64V(*v, fastpathCheckNilFalse, true, d)
- if changed2 {
- *v = v2
- }
-
- case map[int32]bool:
- fastpathTV.DecMapInt32BoolV(v, fastpathCheckNilFalse, false, d)
- case *map[int32]bool:
- v2, changed2 := fastpathTV.DecMapInt32BoolV(*v, fastpathCheckNilFalse, true, d)
- if changed2 {
- *v = v2
- }
-
- case []int64:
- fastpathTV.DecSliceInt64V(v, fastpathCheckNilFalse, false, d)
- case *[]int64:
- v2, changed2 := fastpathTV.DecSliceInt64V(*v, fastpathCheckNilFalse, true, d)
- if changed2 {
- *v = v2
- }
-
- case map[int64]interface{}:
- fastpathTV.DecMapInt64IntfV(v, fastpathCheckNilFalse, false, d)
- case *map[int64]interface{}:
- v2, changed2 := fastpathTV.DecMapInt64IntfV(*v, fastpathCheckNilFalse, true, d)
- if changed2 {
- *v = v2
- }
-
- case map[int64]string:
- fastpathTV.DecMapInt64StringV(v, fastpathCheckNilFalse, false, d)
- case *map[int64]string:
- v2, changed2 := fastpathTV.DecMapInt64StringV(*v, fastpathCheckNilFalse, true, d)
- if changed2 {
- *v = v2
- }
-
- case map[int64]uint:
- fastpathTV.DecMapInt64UintV(v, fastpathCheckNilFalse, false, d)
- case *map[int64]uint:
- v2, changed2 := fastpathTV.DecMapInt64UintV(*v, fastpathCheckNilFalse, true, d)
- if changed2 {
- *v = v2
- }
-
- case map[int64]uint8:
- fastpathTV.DecMapInt64Uint8V(v, fastpathCheckNilFalse, false, d)
- case *map[int64]uint8:
- v2, changed2 := fastpathTV.DecMapInt64Uint8V(*v, fastpathCheckNilFalse, true, d)
- if changed2 {
- *v = v2
- }
-
- case map[int64]uint16:
- fastpathTV.DecMapInt64Uint16V(v, fastpathCheckNilFalse, false, d)
- case *map[int64]uint16:
- v2, changed2 := fastpathTV.DecMapInt64Uint16V(*v, fastpathCheckNilFalse, true, d)
- if changed2 {
- *v = v2
- }
-
- case map[int64]uint32:
- fastpathTV.DecMapInt64Uint32V(v, fastpathCheckNilFalse, false, d)
- case *map[int64]uint32:
- v2, changed2 := fastpathTV.DecMapInt64Uint32V(*v, fastpathCheckNilFalse, true, d)
- if changed2 {
- *v = v2
- }
-
- case map[int64]uint64:
- fastpathTV.DecMapInt64Uint64V(v, fastpathCheckNilFalse, false, d)
- case *map[int64]uint64:
- v2, changed2 := fastpathTV.DecMapInt64Uint64V(*v, fastpathCheckNilFalse, true, d)
- if changed2 {
- *v = v2
- }
-
- case map[int64]uintptr:
- fastpathTV.DecMapInt64UintptrV(v, fastpathCheckNilFalse, false, d)
- case *map[int64]uintptr:
- v2, changed2 := fastpathTV.DecMapInt64UintptrV(*v, fastpathCheckNilFalse, true, d)
- if changed2 {
- *v = v2
- }
-
- case map[int64]int:
- fastpathTV.DecMapInt64IntV(v, fastpathCheckNilFalse, false, d)
- case *map[int64]int:
- v2, changed2 := fastpathTV.DecMapInt64IntV(*v, fastpathCheckNilFalse, true, d)
- if changed2 {
- *v = v2
- }
-
- case map[int64]int8:
- fastpathTV.DecMapInt64Int8V(v, fastpathCheckNilFalse, false, d)
- case *map[int64]int8:
- v2, changed2 := fastpathTV.DecMapInt64Int8V(*v, fastpathCheckNilFalse, true, d)
- if changed2 {
- *v = v2
- }
-
- case map[int64]int16:
- fastpathTV.DecMapInt64Int16V(v, fastpathCheckNilFalse, false, d)
- case *map[int64]int16:
- v2, changed2 := fastpathTV.DecMapInt64Int16V(*v, fastpathCheckNilFalse, true, d)
- if changed2 {
- *v = v2
- }
-
- case map[int64]int32:
- fastpathTV.DecMapInt64Int32V(v, fastpathCheckNilFalse, false, d)
- case *map[int64]int32:
- v2, changed2 := fastpathTV.DecMapInt64Int32V(*v, fastpathCheckNilFalse, true, d)
- if changed2 {
- *v = v2
- }
-
- case map[int64]int64:
- fastpathTV.DecMapInt64Int64V(v, fastpathCheckNilFalse, false, d)
- case *map[int64]int64:
- v2, changed2 := fastpathTV.DecMapInt64Int64V(*v, fastpathCheckNilFalse, true, d)
- if changed2 {
- *v = v2
- }
-
- case map[int64]float32:
- fastpathTV.DecMapInt64Float32V(v, fastpathCheckNilFalse, false, d)
- case *map[int64]float32:
- v2, changed2 := fastpathTV.DecMapInt64Float32V(*v, fastpathCheckNilFalse, true, d)
- if changed2 {
- *v = v2
- }
-
- case map[int64]float64:
- fastpathTV.DecMapInt64Float64V(v, fastpathCheckNilFalse, false, d)
- case *map[int64]float64:
- v2, changed2 := fastpathTV.DecMapInt64Float64V(*v, fastpathCheckNilFalse, true, d)
- if changed2 {
- *v = v2
- }
-
- case map[int64]bool:
- fastpathTV.DecMapInt64BoolV(v, fastpathCheckNilFalse, false, d)
- case *map[int64]bool:
- v2, changed2 := fastpathTV.DecMapInt64BoolV(*v, fastpathCheckNilFalse, true, d)
- if changed2 {
- *v = v2
- }
-
- case []bool:
- fastpathTV.DecSliceBoolV(v, fastpathCheckNilFalse, false, d)
- case *[]bool:
- v2, changed2 := fastpathTV.DecSliceBoolV(*v, fastpathCheckNilFalse, true, d)
- if changed2 {
- *v = v2
- }
-
- case map[bool]interface{}:
- fastpathTV.DecMapBoolIntfV(v, fastpathCheckNilFalse, false, d)
- case *map[bool]interface{}:
- v2, changed2 := fastpathTV.DecMapBoolIntfV(*v, fastpathCheckNilFalse, true, d)
- if changed2 {
- *v = v2
- }
-
- case map[bool]string:
- fastpathTV.DecMapBoolStringV(v, fastpathCheckNilFalse, false, d)
- case *map[bool]string:
- v2, changed2 := fastpathTV.DecMapBoolStringV(*v, fastpathCheckNilFalse, true, d)
- if changed2 {
- *v = v2
- }
-
- case map[bool]uint:
- fastpathTV.DecMapBoolUintV(v, fastpathCheckNilFalse, false, d)
- case *map[bool]uint:
- v2, changed2 := fastpathTV.DecMapBoolUintV(*v, fastpathCheckNilFalse, true, d)
- if changed2 {
- *v = v2
- }
-
- case map[bool]uint8:
- fastpathTV.DecMapBoolUint8V(v, fastpathCheckNilFalse, false, d)
- case *map[bool]uint8:
- v2, changed2 := fastpathTV.DecMapBoolUint8V(*v, fastpathCheckNilFalse, true, d)
- if changed2 {
- *v = v2
- }
-
- case map[bool]uint16:
- fastpathTV.DecMapBoolUint16V(v, fastpathCheckNilFalse, false, d)
- case *map[bool]uint16:
- v2, changed2 := fastpathTV.DecMapBoolUint16V(*v, fastpathCheckNilFalse, true, d)
- if changed2 {
- *v = v2
- }
-
- case map[bool]uint32:
- fastpathTV.DecMapBoolUint32V(v, fastpathCheckNilFalse, false, d)
- case *map[bool]uint32:
- v2, changed2 := fastpathTV.DecMapBoolUint32V(*v, fastpathCheckNilFalse, true, d)
- if changed2 {
- *v = v2
- }
-
- case map[bool]uint64:
- fastpathTV.DecMapBoolUint64V(v, fastpathCheckNilFalse, false, d)
- case *map[bool]uint64:
- v2, changed2 := fastpathTV.DecMapBoolUint64V(*v, fastpathCheckNilFalse, true, d)
- if changed2 {
- *v = v2
- }
-
- case map[bool]uintptr:
- fastpathTV.DecMapBoolUintptrV(v, fastpathCheckNilFalse, false, d)
- case *map[bool]uintptr:
- v2, changed2 := fastpathTV.DecMapBoolUintptrV(*v, fastpathCheckNilFalse, true, d)
- if changed2 {
- *v = v2
- }
-
- case map[bool]int:
- fastpathTV.DecMapBoolIntV(v, fastpathCheckNilFalse, false, d)
- case *map[bool]int:
- v2, changed2 := fastpathTV.DecMapBoolIntV(*v, fastpathCheckNilFalse, true, d)
- if changed2 {
- *v = v2
- }
-
- case map[bool]int8:
- fastpathTV.DecMapBoolInt8V(v, fastpathCheckNilFalse, false, d)
- case *map[bool]int8:
- v2, changed2 := fastpathTV.DecMapBoolInt8V(*v, fastpathCheckNilFalse, true, d)
- if changed2 {
- *v = v2
- }
-
- case map[bool]int16:
- fastpathTV.DecMapBoolInt16V(v, fastpathCheckNilFalse, false, d)
- case *map[bool]int16:
- v2, changed2 := fastpathTV.DecMapBoolInt16V(*v, fastpathCheckNilFalse, true, d)
- if changed2 {
- *v = v2
- }
-
- case map[bool]int32:
- fastpathTV.DecMapBoolInt32V(v, fastpathCheckNilFalse, false, d)
- case *map[bool]int32:
- v2, changed2 := fastpathTV.DecMapBoolInt32V(*v, fastpathCheckNilFalse, true, d)
- if changed2 {
- *v = v2
- }
-
- case map[bool]int64:
- fastpathTV.DecMapBoolInt64V(v, fastpathCheckNilFalse, false, d)
- case *map[bool]int64:
- v2, changed2 := fastpathTV.DecMapBoolInt64V(*v, fastpathCheckNilFalse, true, d)
- if changed2 {
- *v = v2
- }
-
- case map[bool]float32:
- fastpathTV.DecMapBoolFloat32V(v, fastpathCheckNilFalse, false, d)
- case *map[bool]float32:
- v2, changed2 := fastpathTV.DecMapBoolFloat32V(*v, fastpathCheckNilFalse, true, d)
- if changed2 {
- *v = v2
- }
-
- case map[bool]float64:
- fastpathTV.DecMapBoolFloat64V(v, fastpathCheckNilFalse, false, d)
- case *map[bool]float64:
- v2, changed2 := fastpathTV.DecMapBoolFloat64V(*v, fastpathCheckNilFalse, true, d)
- if changed2 {
- *v = v2
- }
-
- case map[bool]bool:
- fastpathTV.DecMapBoolBoolV(v, fastpathCheckNilFalse, false, d)
- case *map[bool]bool:
- v2, changed2 := fastpathTV.DecMapBoolBoolV(*v, fastpathCheckNilFalse, true, d)
- if changed2 {
- *v = v2
- }
-
- default:
- _ = v // TODO: workaround https://github.com/golang/go/issues/12927 (remove after go 1.6 release)
- return false
- }
- return true
-}
-
-// -- -- fast path functions
-
-func (f *decFnInfo) fastpathDecSliceIntfR(rv reflect.Value) {
- array := f.seq == seqTypeArray
- if !array && rv.CanAddr() {
- vp := rv.Addr().Interface().(*[]interface{})
- v, changed := fastpathTV.DecSliceIntfV(*vp, fastpathCheckNilFalse, !array, f.d)
- if changed {
- *vp = v
- }
- } else {
- v := rv.Interface().([]interface{})
- fastpathTV.DecSliceIntfV(v, fastpathCheckNilFalse, false, f.d)
- }
-}
-
-func (f fastpathT) DecSliceIntfX(vp *[]interface{}, checkNil bool, d *Decoder) {
- v, changed := f.DecSliceIntfV(*vp, checkNil, true, d)
- if changed {
- *vp = v
- }
-}
-func (_ fastpathT) DecSliceIntfV(v []interface{}, checkNil bool, canChange bool, d *Decoder) (_ []interface{}, changed bool) {
- dd := d.d
-
- if checkNil && dd.TryDecodeAsNil() {
- if v != nil {
- changed = true
- }
- return nil, changed
- }
-
- slh, containerLenS := d.decSliceHelperStart()
- if containerLenS == 0 {
- if canChange {
- if v == nil {
- v = []interface{}{}
- } else if len(v) != 0 {
- v = v[:0]
- }
- changed = true
- }
- slh.End()
- return v, changed
- }
-
- if containerLenS > 0 {
- x2read := containerLenS
- var xtrunc bool
- if containerLenS > cap(v) {
- if canChange {
- var xlen int
- xlen, xtrunc = decInferLen(containerLenS, d.h.MaxInitLen, 16)
- if xtrunc {
- if xlen <= cap(v) {
- v = v[:xlen]
- } else {
- v = make([]interface{}, xlen)
- }
- } else {
- v = make([]interface{}, xlen)
- }
- changed = true
- } else {
- d.arrayCannotExpand(len(v), containerLenS)
- }
- x2read = len(v)
- } else if containerLenS != len(v) {
- if canChange {
- v = v[:containerLenS]
- changed = true
- }
- }
- j := 0
- for ; j < x2read; j++ {
- slh.ElemContainerState(j)
- d.decode(&v[j])
- }
- if xtrunc {
- for ; j < containerLenS; j++ {
- v = append(v, nil)
- slh.ElemContainerState(j)
- d.decode(&v[j])
- }
- } else if !canChange {
- for ; j < containerLenS; j++ {
- slh.ElemContainerState(j)
- d.swallow()
- }
- }
- } else {
- breakFound := dd.CheckBreak()
- if breakFound {
- if canChange {
- if v == nil {
- v = []interface{}{}
- } else if len(v) != 0 {
- v = v[:0]
- }
- changed = true
- }
- slh.End()
- return v, changed
- }
- if cap(v) == 0 {
- v = make([]interface{}, 1, 4)
- changed = true
- }
- j := 0
- for ; !breakFound; j++ {
- if j >= len(v) {
- if canChange {
- v = append(v, nil)
- changed = true
- } else {
- d.arrayCannotExpand(len(v), j+1)
- }
- }
- slh.ElemContainerState(j)
- if j < len(v) {
- d.decode(&v[j])
-
- } else {
- d.swallow()
- }
- breakFound = dd.CheckBreak()
- }
- if canChange && j < len(v) {
- v = v[:j]
- changed = true
- }
- }
- slh.End()
- return v, changed
-}
-
-func (f *decFnInfo) fastpathDecSliceStringR(rv reflect.Value) {
- array := f.seq == seqTypeArray
- if !array && rv.CanAddr() {
- vp := rv.Addr().Interface().(*[]string)
- v, changed := fastpathTV.DecSliceStringV(*vp, fastpathCheckNilFalse, !array, f.d)
- if changed {
- *vp = v
- }
- } else {
- v := rv.Interface().([]string)
- fastpathTV.DecSliceStringV(v, fastpathCheckNilFalse, false, f.d)
- }
-}
-
-func (f fastpathT) DecSliceStringX(vp *[]string, checkNil bool, d *Decoder) {
- v, changed := f.DecSliceStringV(*vp, checkNil, true, d)
- if changed {
- *vp = v
- }
-}
-func (_ fastpathT) DecSliceStringV(v []string, checkNil bool, canChange bool, d *Decoder) (_ []string, changed bool) {
- dd := d.d
-
- if checkNil && dd.TryDecodeAsNil() {
- if v != nil {
- changed = true
- }
- return nil, changed
- }
-
- slh, containerLenS := d.decSliceHelperStart()
- if containerLenS == 0 {
- if canChange {
- if v == nil {
- v = []string{}
- } else if len(v) != 0 {
- v = v[:0]
- }
- changed = true
- }
- slh.End()
- return v, changed
- }
-
- if containerLenS > 0 {
- x2read := containerLenS
- var xtrunc bool
- if containerLenS > cap(v) {
- if canChange {
- var xlen int
- xlen, xtrunc = decInferLen(containerLenS, d.h.MaxInitLen, 16)
- if xtrunc {
- if xlen <= cap(v) {
- v = v[:xlen]
- } else {
- v = make([]string, xlen)
- }
- } else {
- v = make([]string, xlen)
- }
- changed = true
- } else {
- d.arrayCannotExpand(len(v), containerLenS)
- }
- x2read = len(v)
- } else if containerLenS != len(v) {
- if canChange {
- v = v[:containerLenS]
- changed = true
- }
- }
- j := 0
- for ; j < x2read; j++ {
- slh.ElemContainerState(j)
- v[j] = dd.DecodeString()
- }
- if xtrunc {
- for ; j < containerLenS; j++ {
- v = append(v, "")
- slh.ElemContainerState(j)
- v[j] = dd.DecodeString()
- }
- } else if !canChange {
- for ; j < containerLenS; j++ {
- slh.ElemContainerState(j)
- d.swallow()
- }
- }
- } else {
- breakFound := dd.CheckBreak()
- if breakFound {
- if canChange {
- if v == nil {
- v = []string{}
- } else if len(v) != 0 {
- v = v[:0]
- }
- changed = true
- }
- slh.End()
- return v, changed
- }
- if cap(v) == 0 {
- v = make([]string, 1, 4)
- changed = true
- }
- j := 0
- for ; !breakFound; j++ {
- if j >= len(v) {
- if canChange {
- v = append(v, "")
- changed = true
- } else {
- d.arrayCannotExpand(len(v), j+1)
- }
- }
- slh.ElemContainerState(j)
- if j < len(v) {
- v[j] = dd.DecodeString()
- } else {
- d.swallow()
- }
- breakFound = dd.CheckBreak()
- }
- if canChange && j < len(v) {
- v = v[:j]
- changed = true
- }
- }
- slh.End()
- return v, changed
-}
-
-func (f *decFnInfo) fastpathDecSliceFloat32R(rv reflect.Value) {
- array := f.seq == seqTypeArray
- if !array && rv.CanAddr() {
- vp := rv.Addr().Interface().(*[]float32)
- v, changed := fastpathTV.DecSliceFloat32V(*vp, fastpathCheckNilFalse, !array, f.d)
- if changed {
- *vp = v
- }
- } else {
- v := rv.Interface().([]float32)
- fastpathTV.DecSliceFloat32V(v, fastpathCheckNilFalse, false, f.d)
- }
-}
-
-func (f fastpathT) DecSliceFloat32X(vp *[]float32, checkNil bool, d *Decoder) {
- v, changed := f.DecSliceFloat32V(*vp, checkNil, true, d)
- if changed {
- *vp = v
- }
-}
-func (_ fastpathT) DecSliceFloat32V(v []float32, checkNil bool, canChange bool, d *Decoder) (_ []float32, changed bool) {
- dd := d.d
-
- if checkNil && dd.TryDecodeAsNil() {
- if v != nil {
- changed = true
- }
- return nil, changed
- }
-
- slh, containerLenS := d.decSliceHelperStart()
- if containerLenS == 0 {
- if canChange {
- if v == nil {
- v = []float32{}
- } else if len(v) != 0 {
- v = v[:0]
- }
- changed = true
- }
- slh.End()
- return v, changed
- }
-
- if containerLenS > 0 {
- x2read := containerLenS
- var xtrunc bool
- if containerLenS > cap(v) {
- if canChange {
- var xlen int
- xlen, xtrunc = decInferLen(containerLenS, d.h.MaxInitLen, 4)
- if xtrunc {
- if xlen <= cap(v) {
- v = v[:xlen]
- } else {
- v = make([]float32, xlen)
- }
- } else {
- v = make([]float32, xlen)
- }
- changed = true
- } else {
- d.arrayCannotExpand(len(v), containerLenS)
- }
- x2read = len(v)
- } else if containerLenS != len(v) {
- if canChange {
- v = v[:containerLenS]
- changed = true
- }
- }
- j := 0
- for ; j < x2read; j++ {
- slh.ElemContainerState(j)
- v[j] = float32(dd.DecodeFloat(true))
- }
- if xtrunc {
- for ; j < containerLenS; j++ {
- v = append(v, 0)
- slh.ElemContainerState(j)
- v[j] = float32(dd.DecodeFloat(true))
- }
- } else if !canChange {
- for ; j < containerLenS; j++ {
- slh.ElemContainerState(j)
- d.swallow()
- }
- }
- } else {
- breakFound := dd.CheckBreak()
- if breakFound {
- if canChange {
- if v == nil {
- v = []float32{}
- } else if len(v) != 0 {
- v = v[:0]
- }
- changed = true
- }
- slh.End()
- return v, changed
- }
- if cap(v) == 0 {
- v = make([]float32, 1, 4)
- changed = true
- }
- j := 0
- for ; !breakFound; j++ {
- if j >= len(v) {
- if canChange {
- v = append(v, 0)
- changed = true
- } else {
- d.arrayCannotExpand(len(v), j+1)
- }
- }
- slh.ElemContainerState(j)
- if j < len(v) {
- v[j] = float32(dd.DecodeFloat(true))
- } else {
- d.swallow()
- }
- breakFound = dd.CheckBreak()
- }
- if canChange && j < len(v) {
- v = v[:j]
- changed = true
- }
- }
- slh.End()
- return v, changed
-}
-
-func (f *decFnInfo) fastpathDecSliceFloat64R(rv reflect.Value) {
- array := f.seq == seqTypeArray
- if !array && rv.CanAddr() {
- vp := rv.Addr().Interface().(*[]float64)
- v, changed := fastpathTV.DecSliceFloat64V(*vp, fastpathCheckNilFalse, !array, f.d)
- if changed {
- *vp = v
- }
- } else {
- v := rv.Interface().([]float64)
- fastpathTV.DecSliceFloat64V(v, fastpathCheckNilFalse, false, f.d)
- }
-}
-
-func (f fastpathT) DecSliceFloat64X(vp *[]float64, checkNil bool, d *Decoder) {
- v, changed := f.DecSliceFloat64V(*vp, checkNil, true, d)
- if changed {
- *vp = v
- }
-}
-func (_ fastpathT) DecSliceFloat64V(v []float64, checkNil bool, canChange bool, d *Decoder) (_ []float64, changed bool) {
- dd := d.d
-
- if checkNil && dd.TryDecodeAsNil() {
- if v != nil {
- changed = true
- }
- return nil, changed
- }
-
- slh, containerLenS := d.decSliceHelperStart()
- if containerLenS == 0 {
- if canChange {
- if v == nil {
- v = []float64{}
- } else if len(v) != 0 {
- v = v[:0]
- }
- changed = true
- }
- slh.End()
- return v, changed
- }
-
- if containerLenS > 0 {
- x2read := containerLenS
- var xtrunc bool
- if containerLenS > cap(v) {
- if canChange {
- var xlen int
- xlen, xtrunc = decInferLen(containerLenS, d.h.MaxInitLen, 8)
- if xtrunc {
- if xlen <= cap(v) {
- v = v[:xlen]
- } else {
- v = make([]float64, xlen)
- }
- } else {
- v = make([]float64, xlen)
- }
- changed = true
- } else {
- d.arrayCannotExpand(len(v), containerLenS)
- }
- x2read = len(v)
- } else if containerLenS != len(v) {
- if canChange {
- v = v[:containerLenS]
- changed = true
- }
- }
- j := 0
- for ; j < x2read; j++ {
- slh.ElemContainerState(j)
- v[j] = dd.DecodeFloat(false)
- }
- if xtrunc {
- for ; j < containerLenS; j++ {
- v = append(v, 0)
- slh.ElemContainerState(j)
- v[j] = dd.DecodeFloat(false)
- }
- } else if !canChange {
- for ; j < containerLenS; j++ {
- slh.ElemContainerState(j)
- d.swallow()
- }
- }
- } else {
- breakFound := dd.CheckBreak()
- if breakFound {
- if canChange {
- if v == nil {
- v = []float64{}
- } else if len(v) != 0 {
- v = v[:0]
- }
- changed = true
- }
- slh.End()
- return v, changed
- }
- if cap(v) == 0 {
- v = make([]float64, 1, 4)
- changed = true
- }
- j := 0
- for ; !breakFound; j++ {
- if j >= len(v) {
- if canChange {
- v = append(v, 0)
- changed = true
- } else {
- d.arrayCannotExpand(len(v), j+1)
- }
- }
- slh.ElemContainerState(j)
- if j < len(v) {
- v[j] = dd.DecodeFloat(false)
- } else {
- d.swallow()
- }
- breakFound = dd.CheckBreak()
- }
- if canChange && j < len(v) {
- v = v[:j]
- changed = true
- }
- }
- slh.End()
- return v, changed
-}
-
-func (f *decFnInfo) fastpathDecSliceUintR(rv reflect.Value) {
- array := f.seq == seqTypeArray
- if !array && rv.CanAddr() {
- vp := rv.Addr().Interface().(*[]uint)
- v, changed := fastpathTV.DecSliceUintV(*vp, fastpathCheckNilFalse, !array, f.d)
- if changed {
- *vp = v
- }
- } else {
- v := rv.Interface().([]uint)
- fastpathTV.DecSliceUintV(v, fastpathCheckNilFalse, false, f.d)
- }
-}
-
-func (f fastpathT) DecSliceUintX(vp *[]uint, checkNil bool, d *Decoder) {
- v, changed := f.DecSliceUintV(*vp, checkNil, true, d)
- if changed {
- *vp = v
- }
-}
-func (_ fastpathT) DecSliceUintV(v []uint, checkNil bool, canChange bool, d *Decoder) (_ []uint, changed bool) {
- dd := d.d
-
- if checkNil && dd.TryDecodeAsNil() {
- if v != nil {
- changed = true
- }
- return nil, changed
- }
-
- slh, containerLenS := d.decSliceHelperStart()
- if containerLenS == 0 {
- if canChange {
- if v == nil {
- v = []uint{}
- } else if len(v) != 0 {
- v = v[:0]
- }
- changed = true
- }
- slh.End()
- return v, changed
- }
-
- if containerLenS > 0 {
- x2read := containerLenS
- var xtrunc bool
- if containerLenS > cap(v) {
- if canChange {
- var xlen int
- xlen, xtrunc = decInferLen(containerLenS, d.h.MaxInitLen, 8)
- if xtrunc {
- if xlen <= cap(v) {
- v = v[:xlen]
- } else {
- v = make([]uint, xlen)
- }
- } else {
- v = make([]uint, xlen)
- }
- changed = true
- } else {
- d.arrayCannotExpand(len(v), containerLenS)
- }
- x2read = len(v)
- } else if containerLenS != len(v) {
- if canChange {
- v = v[:containerLenS]
- changed = true
- }
- }
- j := 0
- for ; j < x2read; j++ {
- slh.ElemContainerState(j)
- v[j] = uint(dd.DecodeUint(uintBitsize))
- }
- if xtrunc {
- for ; j < containerLenS; j++ {
- v = append(v, 0)
- slh.ElemContainerState(j)
- v[j] = uint(dd.DecodeUint(uintBitsize))
- }
- } else if !canChange {
- for ; j < containerLenS; j++ {
- slh.ElemContainerState(j)
- d.swallow()
- }
- }
- } else {
- breakFound := dd.CheckBreak()
- if breakFound {
- if canChange {
- if v == nil {
- v = []uint{}
- } else if len(v) != 0 {
- v = v[:0]
- }
- changed = true
- }
- slh.End()
- return v, changed
- }
- if cap(v) == 0 {
- v = make([]uint, 1, 4)
- changed = true
- }
- j := 0
- for ; !breakFound; j++ {
- if j >= len(v) {
- if canChange {
- v = append(v, 0)
- changed = true
- } else {
- d.arrayCannotExpand(len(v), j+1)
- }
- }
- slh.ElemContainerState(j)
- if j < len(v) {
- v[j] = uint(dd.DecodeUint(uintBitsize))
- } else {
- d.swallow()
- }
- breakFound = dd.CheckBreak()
- }
- if canChange && j < len(v) {
- v = v[:j]
- changed = true
- }
- }
- slh.End()
- return v, changed
-}
-
-func (f *decFnInfo) fastpathDecSliceUint16R(rv reflect.Value) {
- array := f.seq == seqTypeArray
- if !array && rv.CanAddr() {
- vp := rv.Addr().Interface().(*[]uint16)
- v, changed := fastpathTV.DecSliceUint16V(*vp, fastpathCheckNilFalse, !array, f.d)
- if changed {
- *vp = v
- }
- } else {
- v := rv.Interface().([]uint16)
- fastpathTV.DecSliceUint16V(v, fastpathCheckNilFalse, false, f.d)
- }
-}
-
-func (f fastpathT) DecSliceUint16X(vp *[]uint16, checkNil bool, d *Decoder) {
- v, changed := f.DecSliceUint16V(*vp, checkNil, true, d)
- if changed {
- *vp = v
- }
-}
-func (_ fastpathT) DecSliceUint16V(v []uint16, checkNil bool, canChange bool, d *Decoder) (_ []uint16, changed bool) {
- dd := d.d
-
- if checkNil && dd.TryDecodeAsNil() {
- if v != nil {
- changed = true
- }
- return nil, changed
- }
-
- slh, containerLenS := d.decSliceHelperStart()
- if containerLenS == 0 {
- if canChange {
- if v == nil {
- v = []uint16{}
- } else if len(v) != 0 {
- v = v[:0]
- }
- changed = true
- }
- slh.End()
- return v, changed
- }
-
- if containerLenS > 0 {
- x2read := containerLenS
- var xtrunc bool
- if containerLenS > cap(v) {
- if canChange {
- var xlen int
- xlen, xtrunc = decInferLen(containerLenS, d.h.MaxInitLen, 2)
- if xtrunc {
- if xlen <= cap(v) {
- v = v[:xlen]
- } else {
- v = make([]uint16, xlen)
- }
- } else {
- v = make([]uint16, xlen)
- }
- changed = true
- } else {
- d.arrayCannotExpand(len(v), containerLenS)
- }
- x2read = len(v)
- } else if containerLenS != len(v) {
- if canChange {
- v = v[:containerLenS]
- changed = true
- }
- }
- j := 0
- for ; j < x2read; j++ {
- slh.ElemContainerState(j)
- v[j] = uint16(dd.DecodeUint(16))
- }
- if xtrunc {
- for ; j < containerLenS; j++ {
- v = append(v, 0)
- slh.ElemContainerState(j)
- v[j] = uint16(dd.DecodeUint(16))
- }
- } else if !canChange {
- for ; j < containerLenS; j++ {
- slh.ElemContainerState(j)
- d.swallow()
- }
- }
- } else {
- breakFound := dd.CheckBreak()
- if breakFound {
- if canChange {
- if v == nil {
- v = []uint16{}
- } else if len(v) != 0 {
- v = v[:0]
- }
- changed = true
- }
- slh.End()
- return v, changed
- }
- if cap(v) == 0 {
- v = make([]uint16, 1, 4)
- changed = true
- }
- j := 0
- for ; !breakFound; j++ {
- if j >= len(v) {
- if canChange {
- v = append(v, 0)
- changed = true
- } else {
- d.arrayCannotExpand(len(v), j+1)
- }
- }
- slh.ElemContainerState(j)
- if j < len(v) {
- v[j] = uint16(dd.DecodeUint(16))
- } else {
- d.swallow()
- }
- breakFound = dd.CheckBreak()
- }
- if canChange && j < len(v) {
- v = v[:j]
- changed = true
- }
- }
- slh.End()
- return v, changed
-}
-
-func (f *decFnInfo) fastpathDecSliceUint32R(rv reflect.Value) {
- array := f.seq == seqTypeArray
- if !array && rv.CanAddr() {
- vp := rv.Addr().Interface().(*[]uint32)
- v, changed := fastpathTV.DecSliceUint32V(*vp, fastpathCheckNilFalse, !array, f.d)
- if changed {
- *vp = v
- }
- } else {
- v := rv.Interface().([]uint32)
- fastpathTV.DecSliceUint32V(v, fastpathCheckNilFalse, false, f.d)
- }
-}
-
-func (f fastpathT) DecSliceUint32X(vp *[]uint32, checkNil bool, d *Decoder) {
- v, changed := f.DecSliceUint32V(*vp, checkNil, true, d)
- if changed {
- *vp = v
- }
-}
-func (_ fastpathT) DecSliceUint32V(v []uint32, checkNil bool, canChange bool, d *Decoder) (_ []uint32, changed bool) {
- dd := d.d
-
- if checkNil && dd.TryDecodeAsNil() {
- if v != nil {
- changed = true
- }
- return nil, changed
- }
-
- slh, containerLenS := d.decSliceHelperStart()
- if containerLenS == 0 {
- if canChange {
- if v == nil {
- v = []uint32{}
- } else if len(v) != 0 {
- v = v[:0]
- }
- changed = true
- }
- slh.End()
- return v, changed
- }
-
- if containerLenS > 0 {
- x2read := containerLenS
- var xtrunc bool
- if containerLenS > cap(v) {
- if canChange {
- var xlen int
- xlen, xtrunc = decInferLen(containerLenS, d.h.MaxInitLen, 4)
- if xtrunc {
- if xlen <= cap(v) {
- v = v[:xlen]
- } else {
- v = make([]uint32, xlen)
- }
- } else {
- v = make([]uint32, xlen)
- }
- changed = true
- } else {
- d.arrayCannotExpand(len(v), containerLenS)
- }
- x2read = len(v)
- } else if containerLenS != len(v) {
- if canChange {
- v = v[:containerLenS]
- changed = true
- }
- }
- j := 0
- for ; j < x2read; j++ {
- slh.ElemContainerState(j)
- v[j] = uint32(dd.DecodeUint(32))
- }
- if xtrunc {
- for ; j < containerLenS; j++ {
- v = append(v, 0)
- slh.ElemContainerState(j)
- v[j] = uint32(dd.DecodeUint(32))
- }
- } else if !canChange {
- for ; j < containerLenS; j++ {
- slh.ElemContainerState(j)
- d.swallow()
- }
- }
- } else {
- breakFound := dd.CheckBreak()
- if breakFound {
- if canChange {
- if v == nil {
- v = []uint32{}
- } else if len(v) != 0 {
- v = v[:0]
- }
- changed = true
- }
- slh.End()
- return v, changed
- }
- if cap(v) == 0 {
- v = make([]uint32, 1, 4)
- changed = true
- }
- j := 0
- for ; !breakFound; j++ {
- if j >= len(v) {
- if canChange {
- v = append(v, 0)
- changed = true
- } else {
- d.arrayCannotExpand(len(v), j+1)
- }
- }
- slh.ElemContainerState(j)
- if j < len(v) {
- v[j] = uint32(dd.DecodeUint(32))
- } else {
- d.swallow()
- }
- breakFound = dd.CheckBreak()
- }
- if canChange && j < len(v) {
- v = v[:j]
- changed = true
- }
- }
- slh.End()
- return v, changed
-}
-
-func (f *decFnInfo) fastpathDecSliceUint64R(rv reflect.Value) {
- array := f.seq == seqTypeArray
- if !array && rv.CanAddr() {
- vp := rv.Addr().Interface().(*[]uint64)
- v, changed := fastpathTV.DecSliceUint64V(*vp, fastpathCheckNilFalse, !array, f.d)
- if changed {
- *vp = v
- }
- } else {
- v := rv.Interface().([]uint64)
- fastpathTV.DecSliceUint64V(v, fastpathCheckNilFalse, false, f.d)
- }
-}
-
-func (f fastpathT) DecSliceUint64X(vp *[]uint64, checkNil bool, d *Decoder) {
- v, changed := f.DecSliceUint64V(*vp, checkNil, true, d)
- if changed {
- *vp = v
- }
-}
-func (_ fastpathT) DecSliceUint64V(v []uint64, checkNil bool, canChange bool, d *Decoder) (_ []uint64, changed bool) {
- dd := d.d
-
- if checkNil && dd.TryDecodeAsNil() {
- if v != nil {
- changed = true
- }
- return nil, changed
- }
-
- slh, containerLenS := d.decSliceHelperStart()
- if containerLenS == 0 {
- if canChange {
- if v == nil {
- v = []uint64{}
- } else if len(v) != 0 {
- v = v[:0]
- }
- changed = true
- }
- slh.End()
- return v, changed
- }
-
- if containerLenS > 0 {
- x2read := containerLenS
- var xtrunc bool
- if containerLenS > cap(v) {
- if canChange {
- var xlen int
- xlen, xtrunc = decInferLen(containerLenS, d.h.MaxInitLen, 8)
- if xtrunc {
- if xlen <= cap(v) {
- v = v[:xlen]
- } else {
- v = make([]uint64, xlen)
- }
- } else {
- v = make([]uint64, xlen)
- }
- changed = true
- } else {
- d.arrayCannotExpand(len(v), containerLenS)
- }
- x2read = len(v)
- } else if containerLenS != len(v) {
- if canChange {
- v = v[:containerLenS]
- changed = true
- }
- }
- j := 0
- for ; j < x2read; j++ {
- slh.ElemContainerState(j)
- v[j] = dd.DecodeUint(64)
- }
- if xtrunc {
- for ; j < containerLenS; j++ {
- v = append(v, 0)
- slh.ElemContainerState(j)
- v[j] = dd.DecodeUint(64)
- }
- } else if !canChange {
- for ; j < containerLenS; j++ {
- slh.ElemContainerState(j)
- d.swallow()
- }
- }
- } else {
- breakFound := dd.CheckBreak()
- if breakFound {
- if canChange {
- if v == nil {
- v = []uint64{}
- } else if len(v) != 0 {
- v = v[:0]
- }
- changed = true
- }
- slh.End()
- return v, changed
- }
- if cap(v) == 0 {
- v = make([]uint64, 1, 4)
- changed = true
- }
- j := 0
- for ; !breakFound; j++ {
- if j >= len(v) {
- if canChange {
- v = append(v, 0)
- changed = true
- } else {
- d.arrayCannotExpand(len(v), j+1)
- }
- }
- slh.ElemContainerState(j)
- if j < len(v) {
- v[j] = dd.DecodeUint(64)
- } else {
- d.swallow()
- }
- breakFound = dd.CheckBreak()
- }
- if canChange && j < len(v) {
- v = v[:j]
- changed = true
- }
- }
- slh.End()
- return v, changed
-}
-
-func (f *decFnInfo) fastpathDecSliceUintptrR(rv reflect.Value) {
- array := f.seq == seqTypeArray
- if !array && rv.CanAddr() {
- vp := rv.Addr().Interface().(*[]uintptr)
- v, changed := fastpathTV.DecSliceUintptrV(*vp, fastpathCheckNilFalse, !array, f.d)
- if changed {
- *vp = v
- }
- } else {
- v := rv.Interface().([]uintptr)
- fastpathTV.DecSliceUintptrV(v, fastpathCheckNilFalse, false, f.d)
- }
-}
-
-func (f fastpathT) DecSliceUintptrX(vp *[]uintptr, checkNil bool, d *Decoder) {
- v, changed := f.DecSliceUintptrV(*vp, checkNil, true, d)
- if changed {
- *vp = v
- }
-}
-func (_ fastpathT) DecSliceUintptrV(v []uintptr, checkNil bool, canChange bool, d *Decoder) (_ []uintptr, changed bool) {
- dd := d.d
-
- if checkNil && dd.TryDecodeAsNil() {
- if v != nil {
- changed = true
- }
- return nil, changed
- }
-
- slh, containerLenS := d.decSliceHelperStart()
- if containerLenS == 0 {
- if canChange {
- if v == nil {
- v = []uintptr{}
- } else if len(v) != 0 {
- v = v[:0]
- }
- changed = true
- }
- slh.End()
- return v, changed
- }
-
- if containerLenS > 0 {
- x2read := containerLenS
- var xtrunc bool
- if containerLenS > cap(v) {
- if canChange {
- var xlen int
- xlen, xtrunc = decInferLen(containerLenS, d.h.MaxInitLen, 8)
- if xtrunc {
- if xlen <= cap(v) {
- v = v[:xlen]
- } else {
- v = make([]uintptr, xlen)
- }
- } else {
- v = make([]uintptr, xlen)
- }
- changed = true
- } else {
- d.arrayCannotExpand(len(v), containerLenS)
- }
- x2read = len(v)
- } else if containerLenS != len(v) {
- if canChange {
- v = v[:containerLenS]
- changed = true
- }
- }
- j := 0
- for ; j < x2read; j++ {
- slh.ElemContainerState(j)
- v[j] = uintptr(dd.DecodeUint(uintBitsize))
- }
- if xtrunc {
- for ; j < containerLenS; j++ {
- v = append(v, 0)
- slh.ElemContainerState(j)
- v[j] = uintptr(dd.DecodeUint(uintBitsize))
- }
- } else if !canChange {
- for ; j < containerLenS; j++ {
- slh.ElemContainerState(j)
- d.swallow()
- }
- }
- } else {
- breakFound := dd.CheckBreak()
- if breakFound {
- if canChange {
- if v == nil {
- v = []uintptr{}
- } else if len(v) != 0 {
- v = v[:0]
- }
- changed = true
- }
- slh.End()
- return v, changed
- }
- if cap(v) == 0 {
- v = make([]uintptr, 1, 4)
- changed = true
- }
- j := 0
- for ; !breakFound; j++ {
- if j >= len(v) {
- if canChange {
- v = append(v, 0)
- changed = true
- } else {
- d.arrayCannotExpand(len(v), j+1)
- }
- }
- slh.ElemContainerState(j)
- if j < len(v) {
- v[j] = uintptr(dd.DecodeUint(uintBitsize))
- } else {
- d.swallow()
- }
- breakFound = dd.CheckBreak()
- }
- if canChange && j < len(v) {
- v = v[:j]
- changed = true
- }
- }
- slh.End()
- return v, changed
-}
-
-func (f *decFnInfo) fastpathDecSliceIntR(rv reflect.Value) {
- array := f.seq == seqTypeArray
- if !array && rv.CanAddr() {
- vp := rv.Addr().Interface().(*[]int)
- v, changed := fastpathTV.DecSliceIntV(*vp, fastpathCheckNilFalse, !array, f.d)
- if changed {
- *vp = v
- }
- } else {
- v := rv.Interface().([]int)
- fastpathTV.DecSliceIntV(v, fastpathCheckNilFalse, false, f.d)
- }
-}
-
-func (f fastpathT) DecSliceIntX(vp *[]int, checkNil bool, d *Decoder) {
- v, changed := f.DecSliceIntV(*vp, checkNil, true, d)
- if changed {
- *vp = v
- }
-}
-func (_ fastpathT) DecSliceIntV(v []int, checkNil bool, canChange bool, d *Decoder) (_ []int, changed bool) {
- dd := d.d
-
- if checkNil && dd.TryDecodeAsNil() {
- if v != nil {
- changed = true
- }
- return nil, changed
- }
-
- slh, containerLenS := d.decSliceHelperStart()
- if containerLenS == 0 {
- if canChange {
- if v == nil {
- v = []int{}
- } else if len(v) != 0 {
- v = v[:0]
- }
- changed = true
- }
- slh.End()
- return v, changed
- }
-
- if containerLenS > 0 {
- x2read := containerLenS
- var xtrunc bool
- if containerLenS > cap(v) {
- if canChange {
- var xlen int
- xlen, xtrunc = decInferLen(containerLenS, d.h.MaxInitLen, 8)
- if xtrunc {
- if xlen <= cap(v) {
- v = v[:xlen]
- } else {
- v = make([]int, xlen)
- }
- } else {
- v = make([]int, xlen)
- }
- changed = true
- } else {
- d.arrayCannotExpand(len(v), containerLenS)
- }
- x2read = len(v)
- } else if containerLenS != len(v) {
- if canChange {
- v = v[:containerLenS]
- changed = true
- }
- }
- j := 0
- for ; j < x2read; j++ {
- slh.ElemContainerState(j)
- v[j] = int(dd.DecodeInt(intBitsize))
- }
- if xtrunc {
- for ; j < containerLenS; j++ {
- v = append(v, 0)
- slh.ElemContainerState(j)
- v[j] = int(dd.DecodeInt(intBitsize))
- }
- } else if !canChange {
- for ; j < containerLenS; j++ {
- slh.ElemContainerState(j)
- d.swallow()
- }
- }
- } else {
- breakFound := dd.CheckBreak()
- if breakFound {
- if canChange {
- if v == nil {
- v = []int{}
- } else if len(v) != 0 {
- v = v[:0]
- }
- changed = true
- }
- slh.End()
- return v, changed
- }
- if cap(v) == 0 {
- v = make([]int, 1, 4)
- changed = true
- }
- j := 0
- for ; !breakFound; j++ {
- if j >= len(v) {
- if canChange {
- v = append(v, 0)
- changed = true
- } else {
- d.arrayCannotExpand(len(v), j+1)
- }
- }
- slh.ElemContainerState(j)
- if j < len(v) {
- v[j] = int(dd.DecodeInt(intBitsize))
- } else {
- d.swallow()
- }
- breakFound = dd.CheckBreak()
- }
- if canChange && j < len(v) {
- v = v[:j]
- changed = true
- }
- }
- slh.End()
- return v, changed
-}
-
-func (f *decFnInfo) fastpathDecSliceInt8R(rv reflect.Value) {
- array := f.seq == seqTypeArray
- if !array && rv.CanAddr() {
- vp := rv.Addr().Interface().(*[]int8)
- v, changed := fastpathTV.DecSliceInt8V(*vp, fastpathCheckNilFalse, !array, f.d)
- if changed {
- *vp = v
- }
- } else {
- v := rv.Interface().([]int8)
- fastpathTV.DecSliceInt8V(v, fastpathCheckNilFalse, false, f.d)
- }
-}
-
-func (f fastpathT) DecSliceInt8X(vp *[]int8, checkNil bool, d *Decoder) {
- v, changed := f.DecSliceInt8V(*vp, checkNil, true, d)
- if changed {
- *vp = v
- }
-}
-func (_ fastpathT) DecSliceInt8V(v []int8, checkNil bool, canChange bool, d *Decoder) (_ []int8, changed bool) {
- dd := d.d
-
- if checkNil && dd.TryDecodeAsNil() {
- if v != nil {
- changed = true
- }
- return nil, changed
- }
-
- slh, containerLenS := d.decSliceHelperStart()
- if containerLenS == 0 {
- if canChange {
- if v == nil {
- v = []int8{}
- } else if len(v) != 0 {
- v = v[:0]
- }
- changed = true
- }
- slh.End()
- return v, changed
- }
-
- if containerLenS > 0 {
- x2read := containerLenS
- var xtrunc bool
- if containerLenS > cap(v) {
- if canChange {
- var xlen int
- xlen, xtrunc = decInferLen(containerLenS, d.h.MaxInitLen, 1)
- if xtrunc {
- if xlen <= cap(v) {
- v = v[:xlen]
- } else {
- v = make([]int8, xlen)
- }
- } else {
- v = make([]int8, xlen)
- }
- changed = true
- } else {
- d.arrayCannotExpand(len(v), containerLenS)
- }
- x2read = len(v)
- } else if containerLenS != len(v) {
- if canChange {
- v = v[:containerLenS]
- changed = true
- }
- }
- j := 0
- for ; j < x2read; j++ {
- slh.ElemContainerState(j)
- v[j] = int8(dd.DecodeInt(8))
- }
- if xtrunc {
- for ; j < containerLenS; j++ {
- v = append(v, 0)
- slh.ElemContainerState(j)
- v[j] = int8(dd.DecodeInt(8))
- }
- } else if !canChange {
- for ; j < containerLenS; j++ {
- slh.ElemContainerState(j)
- d.swallow()
- }
- }
- } else {
- breakFound := dd.CheckBreak()
- if breakFound {
- if canChange {
- if v == nil {
- v = []int8{}
- } else if len(v) != 0 {
- v = v[:0]
- }
- changed = true
- }
- slh.End()
- return v, changed
- }
- if cap(v) == 0 {
- v = make([]int8, 1, 4)
- changed = true
- }
- j := 0
- for ; !breakFound; j++ {
- if j >= len(v) {
- if canChange {
- v = append(v, 0)
- changed = true
- } else {
- d.arrayCannotExpand(len(v), j+1)
- }
- }
- slh.ElemContainerState(j)
- if j < len(v) {
- v[j] = int8(dd.DecodeInt(8))
- } else {
- d.swallow()
- }
- breakFound = dd.CheckBreak()
- }
- if canChange && j < len(v) {
- v = v[:j]
- changed = true
- }
- }
- slh.End()
- return v, changed
-}
-
-func (f *decFnInfo) fastpathDecSliceInt16R(rv reflect.Value) {
- array := f.seq == seqTypeArray
- if !array && rv.CanAddr() {
- vp := rv.Addr().Interface().(*[]int16)
- v, changed := fastpathTV.DecSliceInt16V(*vp, fastpathCheckNilFalse, !array, f.d)
- if changed {
- *vp = v
- }
- } else {
- v := rv.Interface().([]int16)
- fastpathTV.DecSliceInt16V(v, fastpathCheckNilFalse, false, f.d)
- }
-}
-
-func (f fastpathT) DecSliceInt16X(vp *[]int16, checkNil bool, d *Decoder) {
- v, changed := f.DecSliceInt16V(*vp, checkNil, true, d)
- if changed {
- *vp = v
- }
-}
-func (_ fastpathT) DecSliceInt16V(v []int16, checkNil bool, canChange bool, d *Decoder) (_ []int16, changed bool) {
- dd := d.d
-
- if checkNil && dd.TryDecodeAsNil() {
- if v != nil {
- changed = true
- }
- return nil, changed
- }
-
- slh, containerLenS := d.decSliceHelperStart()
- if containerLenS == 0 {
- if canChange {
- if v == nil {
- v = []int16{}
- } else if len(v) != 0 {
- v = v[:0]
- }
- changed = true
- }
- slh.End()
- return v, changed
- }
-
- if containerLenS > 0 {
- x2read := containerLenS
- var xtrunc bool
- if containerLenS > cap(v) {
- if canChange {
- var xlen int
- xlen, xtrunc = decInferLen(containerLenS, d.h.MaxInitLen, 2)
- if xtrunc {
- if xlen <= cap(v) {
- v = v[:xlen]
- } else {
- v = make([]int16, xlen)
- }
- } else {
- v = make([]int16, xlen)
- }
- changed = true
- } else {
- d.arrayCannotExpand(len(v), containerLenS)
- }
- x2read = len(v)
- } else if containerLenS != len(v) {
- if canChange {
- v = v[:containerLenS]
- changed = true
- }
- }
- j := 0
- for ; j < x2read; j++ {
- slh.ElemContainerState(j)
- v[j] = int16(dd.DecodeInt(16))
- }
- if xtrunc {
- for ; j < containerLenS; j++ {
- v = append(v, 0)
- slh.ElemContainerState(j)
- v[j] = int16(dd.DecodeInt(16))
- }
- } else if !canChange {
- for ; j < containerLenS; j++ {
- slh.ElemContainerState(j)
- d.swallow()
- }
- }
- } else {
- breakFound := dd.CheckBreak()
- if breakFound {
- if canChange {
- if v == nil {
- v = []int16{}
- } else if len(v) != 0 {
- v = v[:0]
- }
- changed = true
- }
- slh.End()
- return v, changed
- }
- if cap(v) == 0 {
- v = make([]int16, 1, 4)
- changed = true
- }
- j := 0
- for ; !breakFound; j++ {
- if j >= len(v) {
- if canChange {
- v = append(v, 0)
- changed = true
- } else {
- d.arrayCannotExpand(len(v), j+1)
- }
- }
- slh.ElemContainerState(j)
- if j < len(v) {
- v[j] = int16(dd.DecodeInt(16))
- } else {
- d.swallow()
- }
- breakFound = dd.CheckBreak()
- }
- if canChange && j < len(v) {
- v = v[:j]
- changed = true
- }
- }
- slh.End()
- return v, changed
-}
-
-func (f *decFnInfo) fastpathDecSliceInt32R(rv reflect.Value) {
- array := f.seq == seqTypeArray
- if !array && rv.CanAddr() {
- vp := rv.Addr().Interface().(*[]int32)
- v, changed := fastpathTV.DecSliceInt32V(*vp, fastpathCheckNilFalse, !array, f.d)
- if changed {
- *vp = v
- }
- } else {
- v := rv.Interface().([]int32)
- fastpathTV.DecSliceInt32V(v, fastpathCheckNilFalse, false, f.d)
- }
-}
-
-func (f fastpathT) DecSliceInt32X(vp *[]int32, checkNil bool, d *Decoder) {
- v, changed := f.DecSliceInt32V(*vp, checkNil, true, d)
- if changed {
- *vp = v
- }
-}
-func (_ fastpathT) DecSliceInt32V(v []int32, checkNil bool, canChange bool, d *Decoder) (_ []int32, changed bool) {
- dd := d.d
-
- if checkNil && dd.TryDecodeAsNil() {
- if v != nil {
- changed = true
- }
- return nil, changed
- }
-
- slh, containerLenS := d.decSliceHelperStart()
- if containerLenS == 0 {
- if canChange {
- if v == nil {
- v = []int32{}
- } else if len(v) != 0 {
- v = v[:0]
- }
- changed = true
- }
- slh.End()
- return v, changed
- }
-
- if containerLenS > 0 {
- x2read := containerLenS
- var xtrunc bool
- if containerLenS > cap(v) {
- if canChange {
- var xlen int
- xlen, xtrunc = decInferLen(containerLenS, d.h.MaxInitLen, 4)
- if xtrunc {
- if xlen <= cap(v) {
- v = v[:xlen]
- } else {
- v = make([]int32, xlen)
- }
- } else {
- v = make([]int32, xlen)
- }
- changed = true
- } else {
- d.arrayCannotExpand(len(v), containerLenS)
- }
- x2read = len(v)
- } else if containerLenS != len(v) {
- if canChange {
- v = v[:containerLenS]
- changed = true
- }
- }
- j := 0
- for ; j < x2read; j++ {
- slh.ElemContainerState(j)
- v[j] = int32(dd.DecodeInt(32))
- }
- if xtrunc {
- for ; j < containerLenS; j++ {
- v = append(v, 0)
- slh.ElemContainerState(j)
- v[j] = int32(dd.DecodeInt(32))
- }
- } else if !canChange {
- for ; j < containerLenS; j++ {
- slh.ElemContainerState(j)
- d.swallow()
- }
- }
- } else {
- breakFound := dd.CheckBreak()
- if breakFound {
- if canChange {
- if v == nil {
- v = []int32{}
- } else if len(v) != 0 {
- v = v[:0]
- }
- changed = true
- }
- slh.End()
- return v, changed
- }
- if cap(v) == 0 {
- v = make([]int32, 1, 4)
- changed = true
- }
- j := 0
- for ; !breakFound; j++ {
- if j >= len(v) {
- if canChange {
- v = append(v, 0)
- changed = true
- } else {
- d.arrayCannotExpand(len(v), j+1)
- }
- }
- slh.ElemContainerState(j)
- if j < len(v) {
- v[j] = int32(dd.DecodeInt(32))
- } else {
- d.swallow()
- }
- breakFound = dd.CheckBreak()
- }
- if canChange && j < len(v) {
- v = v[:j]
- changed = true
- }
- }
- slh.End()
- return v, changed
-}
-
-func (f *decFnInfo) fastpathDecSliceInt64R(rv reflect.Value) {
- array := f.seq == seqTypeArray
- if !array && rv.CanAddr() {
- vp := rv.Addr().Interface().(*[]int64)
- v, changed := fastpathTV.DecSliceInt64V(*vp, fastpathCheckNilFalse, !array, f.d)
- if changed {
- *vp = v
- }
- } else {
- v := rv.Interface().([]int64)
- fastpathTV.DecSliceInt64V(v, fastpathCheckNilFalse, false, f.d)
- }
-}
-
-func (f fastpathT) DecSliceInt64X(vp *[]int64, checkNil bool, d *Decoder) {
- v, changed := f.DecSliceInt64V(*vp, checkNil, true, d)
- if changed {
- *vp = v
- }
-}
-func (_ fastpathT) DecSliceInt64V(v []int64, checkNil bool, canChange bool, d *Decoder) (_ []int64, changed bool) {
- dd := d.d
-
- if checkNil && dd.TryDecodeAsNil() {
- if v != nil {
- changed = true
- }
- return nil, changed
- }
-
- slh, containerLenS := d.decSliceHelperStart()
- if containerLenS == 0 {
- if canChange {
- if v == nil {
- v = []int64{}
- } else if len(v) != 0 {
- v = v[:0]
- }
- changed = true
- }
- slh.End()
- return v, changed
- }
-
- if containerLenS > 0 {
- x2read := containerLenS
- var xtrunc bool
- if containerLenS > cap(v) {
- if canChange {
- var xlen int
- xlen, xtrunc = decInferLen(containerLenS, d.h.MaxInitLen, 8)
- if xtrunc {
- if xlen <= cap(v) {
- v = v[:xlen]
- } else {
- v = make([]int64, xlen)
- }
- } else {
- v = make([]int64, xlen)
- }
- changed = true
- } else {
- d.arrayCannotExpand(len(v), containerLenS)
- }
- x2read = len(v)
- } else if containerLenS != len(v) {
- if canChange {
- v = v[:containerLenS]
- changed = true
- }
- }
- j := 0
- for ; j < x2read; j++ {
- slh.ElemContainerState(j)
- v[j] = dd.DecodeInt(64)
- }
- if xtrunc {
- for ; j < containerLenS; j++ {
- v = append(v, 0)
- slh.ElemContainerState(j)
- v[j] = dd.DecodeInt(64)
- }
- } else if !canChange {
- for ; j < containerLenS; j++ {
- slh.ElemContainerState(j)
- d.swallow()
- }
- }
- } else {
- breakFound := dd.CheckBreak()
- if breakFound {
- if canChange {
- if v == nil {
- v = []int64{}
- } else if len(v) != 0 {
- v = v[:0]
- }
- changed = true
- }
- slh.End()
- return v, changed
- }
- if cap(v) == 0 {
- v = make([]int64, 1, 4)
- changed = true
- }
- j := 0
- for ; !breakFound; j++ {
- if j >= len(v) {
- if canChange {
- v = append(v, 0)
- changed = true
- } else {
- d.arrayCannotExpand(len(v), j+1)
- }
- }
- slh.ElemContainerState(j)
- if j < len(v) {
- v[j] = dd.DecodeInt(64)
- } else {
- d.swallow()
- }
- breakFound = dd.CheckBreak()
- }
- if canChange && j < len(v) {
- v = v[:j]
- changed = true
- }
- }
- slh.End()
- return v, changed
-}
-
-func (f *decFnInfo) fastpathDecSliceBoolR(rv reflect.Value) {
- array := f.seq == seqTypeArray
- if !array && rv.CanAddr() {
- vp := rv.Addr().Interface().(*[]bool)
- v, changed := fastpathTV.DecSliceBoolV(*vp, fastpathCheckNilFalse, !array, f.d)
- if changed {
- *vp = v
- }
- } else {
- v := rv.Interface().([]bool)
- fastpathTV.DecSliceBoolV(v, fastpathCheckNilFalse, false, f.d)
- }
-}
-
-func (f fastpathT) DecSliceBoolX(vp *[]bool, checkNil bool, d *Decoder) {
- v, changed := f.DecSliceBoolV(*vp, checkNil, true, d)
- if changed {
- *vp = v
- }
-}
-func (_ fastpathT) DecSliceBoolV(v []bool, checkNil bool, canChange bool, d *Decoder) (_ []bool, changed bool) {
- dd := d.d
-
- if checkNil && dd.TryDecodeAsNil() {
- if v != nil {
- changed = true
- }
- return nil, changed
- }
-
- slh, containerLenS := d.decSliceHelperStart()
- if containerLenS == 0 {
- if canChange {
- if v == nil {
- v = []bool{}
- } else if len(v) != 0 {
- v = v[:0]
- }
- changed = true
- }
- slh.End()
- return v, changed
- }
-
- if containerLenS > 0 {
- x2read := containerLenS
- var xtrunc bool
- if containerLenS > cap(v) {
- if canChange {
- var xlen int
- xlen, xtrunc = decInferLen(containerLenS, d.h.MaxInitLen, 1)
- if xtrunc {
- if xlen <= cap(v) {
- v = v[:xlen]
- } else {
- v = make([]bool, xlen)
- }
- } else {
- v = make([]bool, xlen)
- }
- changed = true
- } else {
- d.arrayCannotExpand(len(v), containerLenS)
- }
- x2read = len(v)
- } else if containerLenS != len(v) {
- if canChange {
- v = v[:containerLenS]
- changed = true
- }
- }
- j := 0
- for ; j < x2read; j++ {
- slh.ElemContainerState(j)
- v[j] = dd.DecodeBool()
- }
- if xtrunc {
- for ; j < containerLenS; j++ {
- v = append(v, false)
- slh.ElemContainerState(j)
- v[j] = dd.DecodeBool()
- }
- } else if !canChange {
- for ; j < containerLenS; j++ {
- slh.ElemContainerState(j)
- d.swallow()
- }
- }
- } else {
- breakFound := dd.CheckBreak()
- if breakFound {
- if canChange {
- if v == nil {
- v = []bool{}
- } else if len(v) != 0 {
- v = v[:0]
- }
- changed = true
- }
- slh.End()
- return v, changed
- }
- if cap(v) == 0 {
- v = make([]bool, 1, 4)
- changed = true
- }
- j := 0
- for ; !breakFound; j++ {
- if j >= len(v) {
- if canChange {
- v = append(v, false)
- changed = true
- } else {
- d.arrayCannotExpand(len(v), j+1)
- }
- }
- slh.ElemContainerState(j)
- if j < len(v) {
- v[j] = dd.DecodeBool()
- } else {
- d.swallow()
- }
- breakFound = dd.CheckBreak()
- }
- if canChange && j < len(v) {
- v = v[:j]
- changed = true
- }
- }
- slh.End()
- return v, changed
-}
-
-func (f *decFnInfo) fastpathDecMapIntfIntfR(rv reflect.Value) {
- if rv.CanAddr() {
- vp := rv.Addr().Interface().(*map[interface{}]interface{})
- v, changed := fastpathTV.DecMapIntfIntfV(*vp, fastpathCheckNilFalse, true, f.d)
- if changed {
- *vp = v
- }
- } else {
- v := rv.Interface().(map[interface{}]interface{})
- fastpathTV.DecMapIntfIntfV(v, fastpathCheckNilFalse, false, f.d)
- }
-}
-func (f fastpathT) DecMapIntfIntfX(vp *map[interface{}]interface{}, checkNil bool, d *Decoder) {
- v, changed := f.DecMapIntfIntfV(*vp, checkNil, true, d)
- if changed {
- *vp = v
- }
-}
-func (_ fastpathT) DecMapIntfIntfV(v map[interface{}]interface{}, checkNil bool, canChange bool,
- d *Decoder) (_ map[interface{}]interface{}, changed bool) {
- dd := d.d
- cr := d.cr
-
- if checkNil && dd.TryDecodeAsNil() {
- if v != nil {
- changed = true
- }
- return nil, changed
- }
-
- containerLen := dd.ReadMapStart()
- if canChange && v == nil {
- xlen, _ := decInferLen(containerLen, d.h.MaxInitLen, 32)
- v = make(map[interface{}]interface{}, xlen)
- changed = true
- }
- mapGet := !d.h.MapValueReset && !d.h.InterfaceReset
- var mk interface{}
- var mv interface{}
- if containerLen > 0 {
- for j := 0; j < containerLen; j++ {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- mk = nil
- d.decode(&mk)
- if bv, bok := mk.([]byte); bok {
- mk = d.string(bv)
- }
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- if mapGet {
- mv = v[mk]
- } else {
- mv = nil
- }
- d.decode(&mv)
- if v != nil {
- v[mk] = mv
- }
- }
- } else if containerLen < 0 {
- for j := 0; !dd.CheckBreak(); j++ {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- mk = nil
- d.decode(&mk)
- if bv, bok := mk.([]byte); bok {
- mk = d.string(bv)
- }
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- if mapGet {
- mv = v[mk]
- } else {
- mv = nil
- }
- d.decode(&mv)
- if v != nil {
- v[mk] = mv
- }
- }
- }
- if cr != nil {
- cr.sendContainerState(containerMapEnd)
- }
- return v, changed
-}
-
-func (f *decFnInfo) fastpathDecMapIntfStringR(rv reflect.Value) {
- if rv.CanAddr() {
- vp := rv.Addr().Interface().(*map[interface{}]string)
- v, changed := fastpathTV.DecMapIntfStringV(*vp, fastpathCheckNilFalse, true, f.d)
- if changed {
- *vp = v
- }
- } else {
- v := rv.Interface().(map[interface{}]string)
- fastpathTV.DecMapIntfStringV(v, fastpathCheckNilFalse, false, f.d)
- }
-}
-func (f fastpathT) DecMapIntfStringX(vp *map[interface{}]string, checkNil bool, d *Decoder) {
- v, changed := f.DecMapIntfStringV(*vp, checkNil, true, d)
- if changed {
- *vp = v
- }
-}
-func (_ fastpathT) DecMapIntfStringV(v map[interface{}]string, checkNil bool, canChange bool,
- d *Decoder) (_ map[interface{}]string, changed bool) {
- dd := d.d
- cr := d.cr
-
- if checkNil && dd.TryDecodeAsNil() {
- if v != nil {
- changed = true
- }
- return nil, changed
- }
-
- containerLen := dd.ReadMapStart()
- if canChange && v == nil {
- xlen, _ := decInferLen(containerLen, d.h.MaxInitLen, 32)
- v = make(map[interface{}]string, xlen)
- changed = true
- }
-
- var mk interface{}
- var mv string
- if containerLen > 0 {
- for j := 0; j < containerLen; j++ {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- mk = nil
- d.decode(&mk)
- if bv, bok := mk.([]byte); bok {
- mk = d.string(bv)
- }
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- mv = dd.DecodeString()
- if v != nil {
- v[mk] = mv
- }
- }
- } else if containerLen < 0 {
- for j := 0; !dd.CheckBreak(); j++ {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- mk = nil
- d.decode(&mk)
- if bv, bok := mk.([]byte); bok {
- mk = d.string(bv)
- }
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- mv = dd.DecodeString()
- if v != nil {
- v[mk] = mv
- }
- }
- }
- if cr != nil {
- cr.sendContainerState(containerMapEnd)
- }
- return v, changed
-}
-
-func (f *decFnInfo) fastpathDecMapIntfUintR(rv reflect.Value) {
- if rv.CanAddr() {
- vp := rv.Addr().Interface().(*map[interface{}]uint)
- v, changed := fastpathTV.DecMapIntfUintV(*vp, fastpathCheckNilFalse, true, f.d)
- if changed {
- *vp = v
- }
- } else {
- v := rv.Interface().(map[interface{}]uint)
- fastpathTV.DecMapIntfUintV(v, fastpathCheckNilFalse, false, f.d)
- }
-}
-func (f fastpathT) DecMapIntfUintX(vp *map[interface{}]uint, checkNil bool, d *Decoder) {
- v, changed := f.DecMapIntfUintV(*vp, checkNil, true, d)
- if changed {
- *vp = v
- }
-}
-func (_ fastpathT) DecMapIntfUintV(v map[interface{}]uint, checkNil bool, canChange bool,
- d *Decoder) (_ map[interface{}]uint, changed bool) {
- dd := d.d
- cr := d.cr
-
- if checkNil && dd.TryDecodeAsNil() {
- if v != nil {
- changed = true
- }
- return nil, changed
- }
-
- containerLen := dd.ReadMapStart()
- if canChange && v == nil {
- xlen, _ := decInferLen(containerLen, d.h.MaxInitLen, 24)
- v = make(map[interface{}]uint, xlen)
- changed = true
- }
-
- var mk interface{}
- var mv uint
- if containerLen > 0 {
- for j := 0; j < containerLen; j++ {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- mk = nil
- d.decode(&mk)
- if bv, bok := mk.([]byte); bok {
- mk = d.string(bv)
- }
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- mv = uint(dd.DecodeUint(uintBitsize))
- if v != nil {
- v[mk] = mv
- }
- }
- } else if containerLen < 0 {
- for j := 0; !dd.CheckBreak(); j++ {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- mk = nil
- d.decode(&mk)
- if bv, bok := mk.([]byte); bok {
- mk = d.string(bv)
- }
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- mv = uint(dd.DecodeUint(uintBitsize))
- if v != nil {
- v[mk] = mv
- }
- }
- }
- if cr != nil {
- cr.sendContainerState(containerMapEnd)
- }
- return v, changed
-}
-
-func (f *decFnInfo) fastpathDecMapIntfUint8R(rv reflect.Value) {
- if rv.CanAddr() {
- vp := rv.Addr().Interface().(*map[interface{}]uint8)
- v, changed := fastpathTV.DecMapIntfUint8V(*vp, fastpathCheckNilFalse, true, f.d)
- if changed {
- *vp = v
- }
- } else {
- v := rv.Interface().(map[interface{}]uint8)
- fastpathTV.DecMapIntfUint8V(v, fastpathCheckNilFalse, false, f.d)
- }
-}
-func (f fastpathT) DecMapIntfUint8X(vp *map[interface{}]uint8, checkNil bool, d *Decoder) {
- v, changed := f.DecMapIntfUint8V(*vp, checkNil, true, d)
- if changed {
- *vp = v
- }
-}
-func (_ fastpathT) DecMapIntfUint8V(v map[interface{}]uint8, checkNil bool, canChange bool,
- d *Decoder) (_ map[interface{}]uint8, changed bool) {
- dd := d.d
- cr := d.cr
-
- if checkNil && dd.TryDecodeAsNil() {
- if v != nil {
- changed = true
- }
- return nil, changed
- }
-
- containerLen := dd.ReadMapStart()
- if canChange && v == nil {
- xlen, _ := decInferLen(containerLen, d.h.MaxInitLen, 17)
- v = make(map[interface{}]uint8, xlen)
- changed = true
- }
-
- var mk interface{}
- var mv uint8
- if containerLen > 0 {
- for j := 0; j < containerLen; j++ {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- mk = nil
- d.decode(&mk)
- if bv, bok := mk.([]byte); bok {
- mk = d.string(bv)
- }
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- mv = uint8(dd.DecodeUint(8))
- if v != nil {
- v[mk] = mv
- }
- }
- } else if containerLen < 0 {
- for j := 0; !dd.CheckBreak(); j++ {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- mk = nil
- d.decode(&mk)
- if bv, bok := mk.([]byte); bok {
- mk = d.string(bv)
- }
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- mv = uint8(dd.DecodeUint(8))
- if v != nil {
- v[mk] = mv
- }
- }
- }
- if cr != nil {
- cr.sendContainerState(containerMapEnd)
- }
- return v, changed
-}
-
-func (f *decFnInfo) fastpathDecMapIntfUint16R(rv reflect.Value) {
- if rv.CanAddr() {
- vp := rv.Addr().Interface().(*map[interface{}]uint16)
- v, changed := fastpathTV.DecMapIntfUint16V(*vp, fastpathCheckNilFalse, true, f.d)
- if changed {
- *vp = v
- }
- } else {
- v := rv.Interface().(map[interface{}]uint16)
- fastpathTV.DecMapIntfUint16V(v, fastpathCheckNilFalse, false, f.d)
- }
-}
-func (f fastpathT) DecMapIntfUint16X(vp *map[interface{}]uint16, checkNil bool, d *Decoder) {
- v, changed := f.DecMapIntfUint16V(*vp, checkNil, true, d)
- if changed {
- *vp = v
- }
-}
-func (_ fastpathT) DecMapIntfUint16V(v map[interface{}]uint16, checkNil bool, canChange bool,
- d *Decoder) (_ map[interface{}]uint16, changed bool) {
- dd := d.d
- cr := d.cr
-
- if checkNil && dd.TryDecodeAsNil() {
- if v != nil {
- changed = true
- }
- return nil, changed
- }
-
- containerLen := dd.ReadMapStart()
- if canChange && v == nil {
- xlen, _ := decInferLen(containerLen, d.h.MaxInitLen, 18)
- v = make(map[interface{}]uint16, xlen)
- changed = true
- }
-
- var mk interface{}
- var mv uint16
- if containerLen > 0 {
- for j := 0; j < containerLen; j++ {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- mk = nil
- d.decode(&mk)
- if bv, bok := mk.([]byte); bok {
- mk = d.string(bv)
- }
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- mv = uint16(dd.DecodeUint(16))
- if v != nil {
- v[mk] = mv
- }
- }
- } else if containerLen < 0 {
- for j := 0; !dd.CheckBreak(); j++ {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- mk = nil
- d.decode(&mk)
- if bv, bok := mk.([]byte); bok {
- mk = d.string(bv)
- }
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- mv = uint16(dd.DecodeUint(16))
- if v != nil {
- v[mk] = mv
- }
- }
- }
- if cr != nil {
- cr.sendContainerState(containerMapEnd)
- }
- return v, changed
-}
-
-func (f *decFnInfo) fastpathDecMapIntfUint32R(rv reflect.Value) {
- if rv.CanAddr() {
- vp := rv.Addr().Interface().(*map[interface{}]uint32)
- v, changed := fastpathTV.DecMapIntfUint32V(*vp, fastpathCheckNilFalse, true, f.d)
- if changed {
- *vp = v
- }
- } else {
- v := rv.Interface().(map[interface{}]uint32)
- fastpathTV.DecMapIntfUint32V(v, fastpathCheckNilFalse, false, f.d)
- }
-}
-func (f fastpathT) DecMapIntfUint32X(vp *map[interface{}]uint32, checkNil bool, d *Decoder) {
- v, changed := f.DecMapIntfUint32V(*vp, checkNil, true, d)
- if changed {
- *vp = v
- }
-}
-func (_ fastpathT) DecMapIntfUint32V(v map[interface{}]uint32, checkNil bool, canChange bool,
- d *Decoder) (_ map[interface{}]uint32, changed bool) {
- dd := d.d
- cr := d.cr
-
- if checkNil && dd.TryDecodeAsNil() {
- if v != nil {
- changed = true
- }
- return nil, changed
- }
-
- containerLen := dd.ReadMapStart()
- if canChange && v == nil {
- xlen, _ := decInferLen(containerLen, d.h.MaxInitLen, 20)
- v = make(map[interface{}]uint32, xlen)
- changed = true
- }
-
- var mk interface{}
- var mv uint32
- if containerLen > 0 {
- for j := 0; j < containerLen; j++ {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- mk = nil
- d.decode(&mk)
- if bv, bok := mk.([]byte); bok {
- mk = d.string(bv)
- }
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- mv = uint32(dd.DecodeUint(32))
- if v != nil {
- v[mk] = mv
- }
- }
- } else if containerLen < 0 {
- for j := 0; !dd.CheckBreak(); j++ {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- mk = nil
- d.decode(&mk)
- if bv, bok := mk.([]byte); bok {
- mk = d.string(bv)
- }
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- mv = uint32(dd.DecodeUint(32))
- if v != nil {
- v[mk] = mv
- }
- }
- }
- if cr != nil {
- cr.sendContainerState(containerMapEnd)
- }
- return v, changed
-}
-
-func (f *decFnInfo) fastpathDecMapIntfUint64R(rv reflect.Value) {
- if rv.CanAddr() {
- vp := rv.Addr().Interface().(*map[interface{}]uint64)
- v, changed := fastpathTV.DecMapIntfUint64V(*vp, fastpathCheckNilFalse, true, f.d)
- if changed {
- *vp = v
- }
- } else {
- v := rv.Interface().(map[interface{}]uint64)
- fastpathTV.DecMapIntfUint64V(v, fastpathCheckNilFalse, false, f.d)
- }
-}
-func (f fastpathT) DecMapIntfUint64X(vp *map[interface{}]uint64, checkNil bool, d *Decoder) {
- v, changed := f.DecMapIntfUint64V(*vp, checkNil, true, d)
- if changed {
- *vp = v
- }
-}
-func (_ fastpathT) DecMapIntfUint64V(v map[interface{}]uint64, checkNil bool, canChange bool,
- d *Decoder) (_ map[interface{}]uint64, changed bool) {
- dd := d.d
- cr := d.cr
-
- if checkNil && dd.TryDecodeAsNil() {
- if v != nil {
- changed = true
- }
- return nil, changed
- }
-
- containerLen := dd.ReadMapStart()
- if canChange && v == nil {
- xlen, _ := decInferLen(containerLen, d.h.MaxInitLen, 24)
- v = make(map[interface{}]uint64, xlen)
- changed = true
- }
-
- var mk interface{}
- var mv uint64
- if containerLen > 0 {
- for j := 0; j < containerLen; j++ {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- mk = nil
- d.decode(&mk)
- if bv, bok := mk.([]byte); bok {
- mk = d.string(bv)
- }
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- mv = dd.DecodeUint(64)
- if v != nil {
- v[mk] = mv
- }
- }
- } else if containerLen < 0 {
- for j := 0; !dd.CheckBreak(); j++ {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- mk = nil
- d.decode(&mk)
- if bv, bok := mk.([]byte); bok {
- mk = d.string(bv)
- }
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- mv = dd.DecodeUint(64)
- if v != nil {
- v[mk] = mv
- }
- }
- }
- if cr != nil {
- cr.sendContainerState(containerMapEnd)
- }
- return v, changed
-}
-
-func (f *decFnInfo) fastpathDecMapIntfUintptrR(rv reflect.Value) {
- if rv.CanAddr() {
- vp := rv.Addr().Interface().(*map[interface{}]uintptr)
- v, changed := fastpathTV.DecMapIntfUintptrV(*vp, fastpathCheckNilFalse, true, f.d)
- if changed {
- *vp = v
- }
- } else {
- v := rv.Interface().(map[interface{}]uintptr)
- fastpathTV.DecMapIntfUintptrV(v, fastpathCheckNilFalse, false, f.d)
- }
-}
-func (f fastpathT) DecMapIntfUintptrX(vp *map[interface{}]uintptr, checkNil bool, d *Decoder) {
- v, changed := f.DecMapIntfUintptrV(*vp, checkNil, true, d)
- if changed {
- *vp = v
- }
-}
-func (_ fastpathT) DecMapIntfUintptrV(v map[interface{}]uintptr, checkNil bool, canChange bool,
- d *Decoder) (_ map[interface{}]uintptr, changed bool) {
- dd := d.d
- cr := d.cr
-
- if checkNil && dd.TryDecodeAsNil() {
- if v != nil {
- changed = true
- }
- return nil, changed
- }
-
- containerLen := dd.ReadMapStart()
- if canChange && v == nil {
- xlen, _ := decInferLen(containerLen, d.h.MaxInitLen, 24)
- v = make(map[interface{}]uintptr, xlen)
- changed = true
- }
-
- var mk interface{}
- var mv uintptr
- if containerLen > 0 {
- for j := 0; j < containerLen; j++ {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- mk = nil
- d.decode(&mk)
- if bv, bok := mk.([]byte); bok {
- mk = d.string(bv)
- }
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- mv = uintptr(dd.DecodeUint(uintBitsize))
- if v != nil {
- v[mk] = mv
- }
- }
- } else if containerLen < 0 {
- for j := 0; !dd.CheckBreak(); j++ {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- mk = nil
- d.decode(&mk)
- if bv, bok := mk.([]byte); bok {
- mk = d.string(bv)
- }
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- mv = uintptr(dd.DecodeUint(uintBitsize))
- if v != nil {
- v[mk] = mv
- }
- }
- }
- if cr != nil {
- cr.sendContainerState(containerMapEnd)
- }
- return v, changed
-}
-
-func (f *decFnInfo) fastpathDecMapIntfIntR(rv reflect.Value) {
- if rv.CanAddr() {
- vp := rv.Addr().Interface().(*map[interface{}]int)
- v, changed := fastpathTV.DecMapIntfIntV(*vp, fastpathCheckNilFalse, true, f.d)
- if changed {
- *vp = v
- }
- } else {
- v := rv.Interface().(map[interface{}]int)
- fastpathTV.DecMapIntfIntV(v, fastpathCheckNilFalse, false, f.d)
- }
-}
-func (f fastpathT) DecMapIntfIntX(vp *map[interface{}]int, checkNil bool, d *Decoder) {
- v, changed := f.DecMapIntfIntV(*vp, checkNil, true, d)
- if changed {
- *vp = v
- }
-}
-func (_ fastpathT) DecMapIntfIntV(v map[interface{}]int, checkNil bool, canChange bool,
- d *Decoder) (_ map[interface{}]int, changed bool) {
- dd := d.d
- cr := d.cr
-
- if checkNil && dd.TryDecodeAsNil() {
- if v != nil {
- changed = true
- }
- return nil, changed
- }
-
- containerLen := dd.ReadMapStart()
- if canChange && v == nil {
- xlen, _ := decInferLen(containerLen, d.h.MaxInitLen, 24)
- v = make(map[interface{}]int, xlen)
- changed = true
- }
-
- var mk interface{}
- var mv int
- if containerLen > 0 {
- for j := 0; j < containerLen; j++ {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- mk = nil
- d.decode(&mk)
- if bv, bok := mk.([]byte); bok {
- mk = d.string(bv)
- }
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- mv = int(dd.DecodeInt(intBitsize))
- if v != nil {
- v[mk] = mv
- }
- }
- } else if containerLen < 0 {
- for j := 0; !dd.CheckBreak(); j++ {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- mk = nil
- d.decode(&mk)
- if bv, bok := mk.([]byte); bok {
- mk = d.string(bv)
- }
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- mv = int(dd.DecodeInt(intBitsize))
- if v != nil {
- v[mk] = mv
- }
- }
- }
- if cr != nil {
- cr.sendContainerState(containerMapEnd)
- }
- return v, changed
-}
-
-func (f *decFnInfo) fastpathDecMapIntfInt8R(rv reflect.Value) {
- if rv.CanAddr() {
- vp := rv.Addr().Interface().(*map[interface{}]int8)
- v, changed := fastpathTV.DecMapIntfInt8V(*vp, fastpathCheckNilFalse, true, f.d)
- if changed {
- *vp = v
- }
- } else {
- v := rv.Interface().(map[interface{}]int8)
- fastpathTV.DecMapIntfInt8V(v, fastpathCheckNilFalse, false, f.d)
- }
-}
-func (f fastpathT) DecMapIntfInt8X(vp *map[interface{}]int8, checkNil bool, d *Decoder) {
- v, changed := f.DecMapIntfInt8V(*vp, checkNil, true, d)
- if changed {
- *vp = v
- }
-}
-func (_ fastpathT) DecMapIntfInt8V(v map[interface{}]int8, checkNil bool, canChange bool,
- d *Decoder) (_ map[interface{}]int8, changed bool) {
- dd := d.d
- cr := d.cr
-
- if checkNil && dd.TryDecodeAsNil() {
- if v != nil {
- changed = true
- }
- return nil, changed
- }
-
- containerLen := dd.ReadMapStart()
- if canChange && v == nil {
- xlen, _ := decInferLen(containerLen, d.h.MaxInitLen, 17)
- v = make(map[interface{}]int8, xlen)
- changed = true
- }
-
- var mk interface{}
- var mv int8
- if containerLen > 0 {
- for j := 0; j < containerLen; j++ {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- mk = nil
- d.decode(&mk)
- if bv, bok := mk.([]byte); bok {
- mk = d.string(bv)
- }
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- mv = int8(dd.DecodeInt(8))
- if v != nil {
- v[mk] = mv
- }
- }
- } else if containerLen < 0 {
- for j := 0; !dd.CheckBreak(); j++ {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- mk = nil
- d.decode(&mk)
- if bv, bok := mk.([]byte); bok {
- mk = d.string(bv)
- }
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- mv = int8(dd.DecodeInt(8))
- if v != nil {
- v[mk] = mv
- }
- }
- }
- if cr != nil {
- cr.sendContainerState(containerMapEnd)
- }
- return v, changed
-}
-
-func (f *decFnInfo) fastpathDecMapIntfInt16R(rv reflect.Value) {
- if rv.CanAddr() {
- vp := rv.Addr().Interface().(*map[interface{}]int16)
- v, changed := fastpathTV.DecMapIntfInt16V(*vp, fastpathCheckNilFalse, true, f.d)
- if changed {
- *vp = v
- }
- } else {
- v := rv.Interface().(map[interface{}]int16)
- fastpathTV.DecMapIntfInt16V(v, fastpathCheckNilFalse, false, f.d)
- }
-}
-func (f fastpathT) DecMapIntfInt16X(vp *map[interface{}]int16, checkNil bool, d *Decoder) {
- v, changed := f.DecMapIntfInt16V(*vp, checkNil, true, d)
- if changed {
- *vp = v
- }
-}
-func (_ fastpathT) DecMapIntfInt16V(v map[interface{}]int16, checkNil bool, canChange bool,
- d *Decoder) (_ map[interface{}]int16, changed bool) {
- dd := d.d
- cr := d.cr
-
- if checkNil && dd.TryDecodeAsNil() {
- if v != nil {
- changed = true
- }
- return nil, changed
- }
-
- containerLen := dd.ReadMapStart()
- if canChange && v == nil {
- xlen, _ := decInferLen(containerLen, d.h.MaxInitLen, 18)
- v = make(map[interface{}]int16, xlen)
- changed = true
- }
-
- var mk interface{}
- var mv int16
- if containerLen > 0 {
- for j := 0; j < containerLen; j++ {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- mk = nil
- d.decode(&mk)
- if bv, bok := mk.([]byte); bok {
- mk = d.string(bv)
- }
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- mv = int16(dd.DecodeInt(16))
- if v != nil {
- v[mk] = mv
- }
- }
- } else if containerLen < 0 {
- for j := 0; !dd.CheckBreak(); j++ {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- mk = nil
- d.decode(&mk)
- if bv, bok := mk.([]byte); bok {
- mk = d.string(bv)
- }
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- mv = int16(dd.DecodeInt(16))
- if v != nil {
- v[mk] = mv
- }
- }
- }
- if cr != nil {
- cr.sendContainerState(containerMapEnd)
- }
- return v, changed
-}
-
-func (f *decFnInfo) fastpathDecMapIntfInt32R(rv reflect.Value) {
- if rv.CanAddr() {
- vp := rv.Addr().Interface().(*map[interface{}]int32)
- v, changed := fastpathTV.DecMapIntfInt32V(*vp, fastpathCheckNilFalse, true, f.d)
- if changed {
- *vp = v
- }
- } else {
- v := rv.Interface().(map[interface{}]int32)
- fastpathTV.DecMapIntfInt32V(v, fastpathCheckNilFalse, false, f.d)
- }
-}
-func (f fastpathT) DecMapIntfInt32X(vp *map[interface{}]int32, checkNil bool, d *Decoder) {
- v, changed := f.DecMapIntfInt32V(*vp, checkNil, true, d)
- if changed {
- *vp = v
- }
-}
-func (_ fastpathT) DecMapIntfInt32V(v map[interface{}]int32, checkNil bool, canChange bool,
- d *Decoder) (_ map[interface{}]int32, changed bool) {
- dd := d.d
- cr := d.cr
-
- if checkNil && dd.TryDecodeAsNil() {
- if v != nil {
- changed = true
- }
- return nil, changed
- }
-
- containerLen := dd.ReadMapStart()
- if canChange && v == nil {
- xlen, _ := decInferLen(containerLen, d.h.MaxInitLen, 20)
- v = make(map[interface{}]int32, xlen)
- changed = true
- }
-
- var mk interface{}
- var mv int32
- if containerLen > 0 {
- for j := 0; j < containerLen; j++ {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- mk = nil
- d.decode(&mk)
- if bv, bok := mk.([]byte); bok {
- mk = d.string(bv)
- }
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- mv = int32(dd.DecodeInt(32))
- if v != nil {
- v[mk] = mv
- }
- }
- } else if containerLen < 0 {
- for j := 0; !dd.CheckBreak(); j++ {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- mk = nil
- d.decode(&mk)
- if bv, bok := mk.([]byte); bok {
- mk = d.string(bv)
- }
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- mv = int32(dd.DecodeInt(32))
- if v != nil {
- v[mk] = mv
- }
- }
- }
- if cr != nil {
- cr.sendContainerState(containerMapEnd)
- }
- return v, changed
-}
-
-func (f *decFnInfo) fastpathDecMapIntfInt64R(rv reflect.Value) {
- if rv.CanAddr() {
- vp := rv.Addr().Interface().(*map[interface{}]int64)
- v, changed := fastpathTV.DecMapIntfInt64V(*vp, fastpathCheckNilFalse, true, f.d)
- if changed {
- *vp = v
- }
- } else {
- v := rv.Interface().(map[interface{}]int64)
- fastpathTV.DecMapIntfInt64V(v, fastpathCheckNilFalse, false, f.d)
- }
-}
-func (f fastpathT) DecMapIntfInt64X(vp *map[interface{}]int64, checkNil bool, d *Decoder) {
- v, changed := f.DecMapIntfInt64V(*vp, checkNil, true, d)
- if changed {
- *vp = v
- }
-}
-func (_ fastpathT) DecMapIntfInt64V(v map[interface{}]int64, checkNil bool, canChange bool,
- d *Decoder) (_ map[interface{}]int64, changed bool) {
- dd := d.d
- cr := d.cr
-
- if checkNil && dd.TryDecodeAsNil() {
- if v != nil {
- changed = true
- }
- return nil, changed
- }
-
- containerLen := dd.ReadMapStart()
- if canChange && v == nil {
- xlen, _ := decInferLen(containerLen, d.h.MaxInitLen, 24)
- v = make(map[interface{}]int64, xlen)
- changed = true
- }
-
- var mk interface{}
- var mv int64
- if containerLen > 0 {
- for j := 0; j < containerLen; j++ {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- mk = nil
- d.decode(&mk)
- if bv, bok := mk.([]byte); bok {
- mk = d.string(bv)
- }
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- mv = dd.DecodeInt(64)
- if v != nil {
- v[mk] = mv
- }
- }
- } else if containerLen < 0 {
- for j := 0; !dd.CheckBreak(); j++ {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- mk = nil
- d.decode(&mk)
- if bv, bok := mk.([]byte); bok {
- mk = d.string(bv)
- }
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- mv = dd.DecodeInt(64)
- if v != nil {
- v[mk] = mv
- }
- }
- }
- if cr != nil {
- cr.sendContainerState(containerMapEnd)
- }
- return v, changed
-}
-
-func (f *decFnInfo) fastpathDecMapIntfFloat32R(rv reflect.Value) {
- if rv.CanAddr() {
- vp := rv.Addr().Interface().(*map[interface{}]float32)
- v, changed := fastpathTV.DecMapIntfFloat32V(*vp, fastpathCheckNilFalse, true, f.d)
- if changed {
- *vp = v
- }
- } else {
- v := rv.Interface().(map[interface{}]float32)
- fastpathTV.DecMapIntfFloat32V(v, fastpathCheckNilFalse, false, f.d)
- }
-}
-func (f fastpathT) DecMapIntfFloat32X(vp *map[interface{}]float32, checkNil bool, d *Decoder) {
- v, changed := f.DecMapIntfFloat32V(*vp, checkNil, true, d)
- if changed {
- *vp = v
- }
-}
-func (_ fastpathT) DecMapIntfFloat32V(v map[interface{}]float32, checkNil bool, canChange bool,
- d *Decoder) (_ map[interface{}]float32, changed bool) {
- dd := d.d
- cr := d.cr
-
- if checkNil && dd.TryDecodeAsNil() {
- if v != nil {
- changed = true
- }
- return nil, changed
- }
-
- containerLen := dd.ReadMapStart()
- if canChange && v == nil {
- xlen, _ := decInferLen(containerLen, d.h.MaxInitLen, 20)
- v = make(map[interface{}]float32, xlen)
- changed = true
- }
-
- var mk interface{}
- var mv float32
- if containerLen > 0 {
- for j := 0; j < containerLen; j++ {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- mk = nil
- d.decode(&mk)
- if bv, bok := mk.([]byte); bok {
- mk = d.string(bv)
- }
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- mv = float32(dd.DecodeFloat(true))
- if v != nil {
- v[mk] = mv
- }
- }
- } else if containerLen < 0 {
- for j := 0; !dd.CheckBreak(); j++ {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- mk = nil
- d.decode(&mk)
- if bv, bok := mk.([]byte); bok {
- mk = d.string(bv)
- }
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- mv = float32(dd.DecodeFloat(true))
- if v != nil {
- v[mk] = mv
- }
- }
- }
- if cr != nil {
- cr.sendContainerState(containerMapEnd)
- }
- return v, changed
-}
-
-func (f *decFnInfo) fastpathDecMapIntfFloat64R(rv reflect.Value) {
- if rv.CanAddr() {
- vp := rv.Addr().Interface().(*map[interface{}]float64)
- v, changed := fastpathTV.DecMapIntfFloat64V(*vp, fastpathCheckNilFalse, true, f.d)
- if changed {
- *vp = v
- }
- } else {
- v := rv.Interface().(map[interface{}]float64)
- fastpathTV.DecMapIntfFloat64V(v, fastpathCheckNilFalse, false, f.d)
- }
-}
-func (f fastpathT) DecMapIntfFloat64X(vp *map[interface{}]float64, checkNil bool, d *Decoder) {
- v, changed := f.DecMapIntfFloat64V(*vp, checkNil, true, d)
- if changed {
- *vp = v
- }
-}
-func (_ fastpathT) DecMapIntfFloat64V(v map[interface{}]float64, checkNil bool, canChange bool,
- d *Decoder) (_ map[interface{}]float64, changed bool) {
- dd := d.d
- cr := d.cr
-
- if checkNil && dd.TryDecodeAsNil() {
- if v != nil {
- changed = true
- }
- return nil, changed
- }
-
- containerLen := dd.ReadMapStart()
- if canChange && v == nil {
- xlen, _ := decInferLen(containerLen, d.h.MaxInitLen, 24)
- v = make(map[interface{}]float64, xlen)
- changed = true
- }
-
- var mk interface{}
- var mv float64
- if containerLen > 0 {
- for j := 0; j < containerLen; j++ {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- mk = nil
- d.decode(&mk)
- if bv, bok := mk.([]byte); bok {
- mk = d.string(bv)
- }
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- mv = dd.DecodeFloat(false)
- if v != nil {
- v[mk] = mv
- }
- }
- } else if containerLen < 0 {
- for j := 0; !dd.CheckBreak(); j++ {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- mk = nil
- d.decode(&mk)
- if bv, bok := mk.([]byte); bok {
- mk = d.string(bv)
- }
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- mv = dd.DecodeFloat(false)
- if v != nil {
- v[mk] = mv
- }
- }
- }
- if cr != nil {
- cr.sendContainerState(containerMapEnd)
- }
- return v, changed
-}
-
-func (f *decFnInfo) fastpathDecMapIntfBoolR(rv reflect.Value) {
- if rv.CanAddr() {
- vp := rv.Addr().Interface().(*map[interface{}]bool)
- v, changed := fastpathTV.DecMapIntfBoolV(*vp, fastpathCheckNilFalse, true, f.d)
- if changed {
- *vp = v
- }
- } else {
- v := rv.Interface().(map[interface{}]bool)
- fastpathTV.DecMapIntfBoolV(v, fastpathCheckNilFalse, false, f.d)
- }
-}
-func (f fastpathT) DecMapIntfBoolX(vp *map[interface{}]bool, checkNil bool, d *Decoder) {
- v, changed := f.DecMapIntfBoolV(*vp, checkNil, true, d)
- if changed {
- *vp = v
- }
-}
-func (_ fastpathT) DecMapIntfBoolV(v map[interface{}]bool, checkNil bool, canChange bool,
- d *Decoder) (_ map[interface{}]bool, changed bool) {
- dd := d.d
- cr := d.cr
-
- if checkNil && dd.TryDecodeAsNil() {
- if v != nil {
- changed = true
- }
- return nil, changed
- }
-
- containerLen := dd.ReadMapStart()
- if canChange && v == nil {
- xlen, _ := decInferLen(containerLen, d.h.MaxInitLen, 17)
- v = make(map[interface{}]bool, xlen)
- changed = true
- }
-
- var mk interface{}
- var mv bool
- if containerLen > 0 {
- for j := 0; j < containerLen; j++ {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- mk = nil
- d.decode(&mk)
- if bv, bok := mk.([]byte); bok {
- mk = d.string(bv)
- }
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- mv = dd.DecodeBool()
- if v != nil {
- v[mk] = mv
- }
- }
- } else if containerLen < 0 {
- for j := 0; !dd.CheckBreak(); j++ {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- mk = nil
- d.decode(&mk)
- if bv, bok := mk.([]byte); bok {
- mk = d.string(bv)
- }
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- mv = dd.DecodeBool()
- if v != nil {
- v[mk] = mv
- }
- }
- }
- if cr != nil {
- cr.sendContainerState(containerMapEnd)
- }
- return v, changed
-}
-
-func (f *decFnInfo) fastpathDecMapStringIntfR(rv reflect.Value) {
- if rv.CanAddr() {
- vp := rv.Addr().Interface().(*map[string]interface{})
- v, changed := fastpathTV.DecMapStringIntfV(*vp, fastpathCheckNilFalse, true, f.d)
- if changed {
- *vp = v
- }
- } else {
- v := rv.Interface().(map[string]interface{})
- fastpathTV.DecMapStringIntfV(v, fastpathCheckNilFalse, false, f.d)
- }
-}
-func (f fastpathT) DecMapStringIntfX(vp *map[string]interface{}, checkNil bool, d *Decoder) {
- v, changed := f.DecMapStringIntfV(*vp, checkNil, true, d)
- if changed {
- *vp = v
- }
-}
-func (_ fastpathT) DecMapStringIntfV(v map[string]interface{}, checkNil bool, canChange bool,
- d *Decoder) (_ map[string]interface{}, changed bool) {
- dd := d.d
- cr := d.cr
-
- if checkNil && dd.TryDecodeAsNil() {
- if v != nil {
- changed = true
- }
- return nil, changed
- }
-
- containerLen := dd.ReadMapStart()
- if canChange && v == nil {
- xlen, _ := decInferLen(containerLen, d.h.MaxInitLen, 32)
- v = make(map[string]interface{}, xlen)
- changed = true
- }
- mapGet := !d.h.MapValueReset && !d.h.InterfaceReset
- var mk string
- var mv interface{}
- if containerLen > 0 {
- for j := 0; j < containerLen; j++ {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- mk = dd.DecodeString()
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- if mapGet {
- mv = v[mk]
- } else {
- mv = nil
- }
- d.decode(&mv)
- if v != nil {
- v[mk] = mv
- }
- }
- } else if containerLen < 0 {
- for j := 0; !dd.CheckBreak(); j++ {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- mk = dd.DecodeString()
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- if mapGet {
- mv = v[mk]
- } else {
- mv = nil
- }
- d.decode(&mv)
- if v != nil {
- v[mk] = mv
- }
- }
- }
- if cr != nil {
- cr.sendContainerState(containerMapEnd)
- }
- return v, changed
-}
-
-func (f *decFnInfo) fastpathDecMapStringStringR(rv reflect.Value) {
- if rv.CanAddr() {
- vp := rv.Addr().Interface().(*map[string]string)
- v, changed := fastpathTV.DecMapStringStringV(*vp, fastpathCheckNilFalse, true, f.d)
- if changed {
- *vp = v
- }
- } else {
- v := rv.Interface().(map[string]string)
- fastpathTV.DecMapStringStringV(v, fastpathCheckNilFalse, false, f.d)
- }
-}
-func (f fastpathT) DecMapStringStringX(vp *map[string]string, checkNil bool, d *Decoder) {
- v, changed := f.DecMapStringStringV(*vp, checkNil, true, d)
- if changed {
- *vp = v
- }
-}
-func (_ fastpathT) DecMapStringStringV(v map[string]string, checkNil bool, canChange bool,
- d *Decoder) (_ map[string]string, changed bool) {
- dd := d.d
- cr := d.cr
-
- if checkNil && dd.TryDecodeAsNil() {
- if v != nil {
- changed = true
- }
- return nil, changed
- }
-
- containerLen := dd.ReadMapStart()
- if canChange && v == nil {
- xlen, _ := decInferLen(containerLen, d.h.MaxInitLen, 32)
- v = make(map[string]string, xlen)
- changed = true
- }
-
- var mk string
- var mv string
- if containerLen > 0 {
- for j := 0; j < containerLen; j++ {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- mk = dd.DecodeString()
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- mv = dd.DecodeString()
- if v != nil {
- v[mk] = mv
- }
- }
- } else if containerLen < 0 {
- for j := 0; !dd.CheckBreak(); j++ {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- mk = dd.DecodeString()
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- mv = dd.DecodeString()
- if v != nil {
- v[mk] = mv
- }
- }
- }
- if cr != nil {
- cr.sendContainerState(containerMapEnd)
- }
- return v, changed
-}
-
-func (f *decFnInfo) fastpathDecMapStringUintR(rv reflect.Value) {
- if rv.CanAddr() {
- vp := rv.Addr().Interface().(*map[string]uint)
- v, changed := fastpathTV.DecMapStringUintV(*vp, fastpathCheckNilFalse, true, f.d)
- if changed {
- *vp = v
- }
- } else {
- v := rv.Interface().(map[string]uint)
- fastpathTV.DecMapStringUintV(v, fastpathCheckNilFalse, false, f.d)
- }
-}
-func (f fastpathT) DecMapStringUintX(vp *map[string]uint, checkNil bool, d *Decoder) {
- v, changed := f.DecMapStringUintV(*vp, checkNil, true, d)
- if changed {
- *vp = v
- }
-}
-func (_ fastpathT) DecMapStringUintV(v map[string]uint, checkNil bool, canChange bool,
- d *Decoder) (_ map[string]uint, changed bool) {
- dd := d.d
- cr := d.cr
-
- if checkNil && dd.TryDecodeAsNil() {
- if v != nil {
- changed = true
- }
- return nil, changed
- }
-
- containerLen := dd.ReadMapStart()
- if canChange && v == nil {
- xlen, _ := decInferLen(containerLen, d.h.MaxInitLen, 24)
- v = make(map[string]uint, xlen)
- changed = true
- }
-
- var mk string
- var mv uint
- if containerLen > 0 {
- for j := 0; j < containerLen; j++ {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- mk = dd.DecodeString()
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- mv = uint(dd.DecodeUint(uintBitsize))
- if v != nil {
- v[mk] = mv
- }
- }
- } else if containerLen < 0 {
- for j := 0; !dd.CheckBreak(); j++ {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- mk = dd.DecodeString()
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- mv = uint(dd.DecodeUint(uintBitsize))
- if v != nil {
- v[mk] = mv
- }
- }
- }
- if cr != nil {
- cr.sendContainerState(containerMapEnd)
- }
- return v, changed
-}
-
-func (f *decFnInfo) fastpathDecMapStringUint8R(rv reflect.Value) {
- if rv.CanAddr() {
- vp := rv.Addr().Interface().(*map[string]uint8)
- v, changed := fastpathTV.DecMapStringUint8V(*vp, fastpathCheckNilFalse, true, f.d)
- if changed {
- *vp = v
- }
- } else {
- v := rv.Interface().(map[string]uint8)
- fastpathTV.DecMapStringUint8V(v, fastpathCheckNilFalse, false, f.d)
- }
-}
-func (f fastpathT) DecMapStringUint8X(vp *map[string]uint8, checkNil bool, d *Decoder) {
- v, changed := f.DecMapStringUint8V(*vp, checkNil, true, d)
- if changed {
- *vp = v
- }
-}
-func (_ fastpathT) DecMapStringUint8V(v map[string]uint8, checkNil bool, canChange bool,
- d *Decoder) (_ map[string]uint8, changed bool) {
- dd := d.d
- cr := d.cr
-
- if checkNil && dd.TryDecodeAsNil() {
- if v != nil {
- changed = true
- }
- return nil, changed
- }
-
- containerLen := dd.ReadMapStart()
- if canChange && v == nil {
- xlen, _ := decInferLen(containerLen, d.h.MaxInitLen, 17)
- v = make(map[string]uint8, xlen)
- changed = true
- }
-
- var mk string
- var mv uint8
- if containerLen > 0 {
- for j := 0; j < containerLen; j++ {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- mk = dd.DecodeString()
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- mv = uint8(dd.DecodeUint(8))
- if v != nil {
- v[mk] = mv
- }
- }
- } else if containerLen < 0 {
- for j := 0; !dd.CheckBreak(); j++ {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- mk = dd.DecodeString()
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- mv = uint8(dd.DecodeUint(8))
- if v != nil {
- v[mk] = mv
- }
- }
- }
- if cr != nil {
- cr.sendContainerState(containerMapEnd)
- }
- return v, changed
-}
-
-func (f *decFnInfo) fastpathDecMapStringUint16R(rv reflect.Value) {
- if rv.CanAddr() {
- vp := rv.Addr().Interface().(*map[string]uint16)
- v, changed := fastpathTV.DecMapStringUint16V(*vp, fastpathCheckNilFalse, true, f.d)
- if changed {
- *vp = v
- }
- } else {
- v := rv.Interface().(map[string]uint16)
- fastpathTV.DecMapStringUint16V(v, fastpathCheckNilFalse, false, f.d)
- }
-}
-func (f fastpathT) DecMapStringUint16X(vp *map[string]uint16, checkNil bool, d *Decoder) {
- v, changed := f.DecMapStringUint16V(*vp, checkNil, true, d)
- if changed {
- *vp = v
- }
-}
-func (_ fastpathT) DecMapStringUint16V(v map[string]uint16, checkNil bool, canChange bool,
- d *Decoder) (_ map[string]uint16, changed bool) {
- dd := d.d
- cr := d.cr
-
- if checkNil && dd.TryDecodeAsNil() {
- if v != nil {
- changed = true
- }
- return nil, changed
- }
-
- containerLen := dd.ReadMapStart()
- if canChange && v == nil {
- xlen, _ := decInferLen(containerLen, d.h.MaxInitLen, 18)
- v = make(map[string]uint16, xlen)
- changed = true
- }
-
- var mk string
- var mv uint16
- if containerLen > 0 {
- for j := 0; j < containerLen; j++ {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- mk = dd.DecodeString()
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- mv = uint16(dd.DecodeUint(16))
- if v != nil {
- v[mk] = mv
- }
- }
- } else if containerLen < 0 {
- for j := 0; !dd.CheckBreak(); j++ {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- mk = dd.DecodeString()
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- mv = uint16(dd.DecodeUint(16))
- if v != nil {
- v[mk] = mv
- }
- }
- }
- if cr != nil {
- cr.sendContainerState(containerMapEnd)
- }
- return v, changed
-}
-
-func (f *decFnInfo) fastpathDecMapStringUint32R(rv reflect.Value) {
- if rv.CanAddr() {
- vp := rv.Addr().Interface().(*map[string]uint32)
- v, changed := fastpathTV.DecMapStringUint32V(*vp, fastpathCheckNilFalse, true, f.d)
- if changed {
- *vp = v
- }
- } else {
- v := rv.Interface().(map[string]uint32)
- fastpathTV.DecMapStringUint32V(v, fastpathCheckNilFalse, false, f.d)
- }
-}
-func (f fastpathT) DecMapStringUint32X(vp *map[string]uint32, checkNil bool, d *Decoder) {
- v, changed := f.DecMapStringUint32V(*vp, checkNil, true, d)
- if changed {
- *vp = v
- }
-}
-func (_ fastpathT) DecMapStringUint32V(v map[string]uint32, checkNil bool, canChange bool,
- d *Decoder) (_ map[string]uint32, changed bool) {
- dd := d.d
- cr := d.cr
-
- if checkNil && dd.TryDecodeAsNil() {
- if v != nil {
- changed = true
- }
- return nil, changed
- }
-
- containerLen := dd.ReadMapStart()
- if canChange && v == nil {
- xlen, _ := decInferLen(containerLen, d.h.MaxInitLen, 20)
- v = make(map[string]uint32, xlen)
- changed = true
- }
-
- var mk string
- var mv uint32
- if containerLen > 0 {
- for j := 0; j < containerLen; j++ {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- mk = dd.DecodeString()
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- mv = uint32(dd.DecodeUint(32))
- if v != nil {
- v[mk] = mv
- }
- }
- } else if containerLen < 0 {
- for j := 0; !dd.CheckBreak(); j++ {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- mk = dd.DecodeString()
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- mv = uint32(dd.DecodeUint(32))
- if v != nil {
- v[mk] = mv
- }
- }
- }
- if cr != nil {
- cr.sendContainerState(containerMapEnd)
- }
- return v, changed
-}
-
-func (f *decFnInfo) fastpathDecMapStringUint64R(rv reflect.Value) {
- if rv.CanAddr() {
- vp := rv.Addr().Interface().(*map[string]uint64)
- v, changed := fastpathTV.DecMapStringUint64V(*vp, fastpathCheckNilFalse, true, f.d)
- if changed {
- *vp = v
- }
- } else {
- v := rv.Interface().(map[string]uint64)
- fastpathTV.DecMapStringUint64V(v, fastpathCheckNilFalse, false, f.d)
- }
-}
-func (f fastpathT) DecMapStringUint64X(vp *map[string]uint64, checkNil bool, d *Decoder) {
- v, changed := f.DecMapStringUint64V(*vp, checkNil, true, d)
- if changed {
- *vp = v
- }
-}
-func (_ fastpathT) DecMapStringUint64V(v map[string]uint64, checkNil bool, canChange bool,
- d *Decoder) (_ map[string]uint64, changed bool) {
- dd := d.d
- cr := d.cr
-
- if checkNil && dd.TryDecodeAsNil() {
- if v != nil {
- changed = true
- }
- return nil, changed
- }
-
- containerLen := dd.ReadMapStart()
- if canChange && v == nil {
- xlen, _ := decInferLen(containerLen, d.h.MaxInitLen, 24)
- v = make(map[string]uint64, xlen)
- changed = true
- }
-
- var mk string
- var mv uint64
- if containerLen > 0 {
- for j := 0; j < containerLen; j++ {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- mk = dd.DecodeString()
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- mv = dd.DecodeUint(64)
- if v != nil {
- v[mk] = mv
- }
- }
- } else if containerLen < 0 {
- for j := 0; !dd.CheckBreak(); j++ {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- mk = dd.DecodeString()
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- mv = dd.DecodeUint(64)
- if v != nil {
- v[mk] = mv
- }
- }
- }
- if cr != nil {
- cr.sendContainerState(containerMapEnd)
- }
- return v, changed
-}
-
-func (f *decFnInfo) fastpathDecMapStringUintptrR(rv reflect.Value) {
- if rv.CanAddr() {
- vp := rv.Addr().Interface().(*map[string]uintptr)
- v, changed := fastpathTV.DecMapStringUintptrV(*vp, fastpathCheckNilFalse, true, f.d)
- if changed {
- *vp = v
- }
- } else {
- v := rv.Interface().(map[string]uintptr)
- fastpathTV.DecMapStringUintptrV(v, fastpathCheckNilFalse, false, f.d)
- }
-}
-func (f fastpathT) DecMapStringUintptrX(vp *map[string]uintptr, checkNil bool, d *Decoder) {
- v, changed := f.DecMapStringUintptrV(*vp, checkNil, true, d)
- if changed {
- *vp = v
- }
-}
-func (_ fastpathT) DecMapStringUintptrV(v map[string]uintptr, checkNil bool, canChange bool,
- d *Decoder) (_ map[string]uintptr, changed bool) {
- dd := d.d
- cr := d.cr
-
- if checkNil && dd.TryDecodeAsNil() {
- if v != nil {
- changed = true
- }
- return nil, changed
- }
-
- containerLen := dd.ReadMapStart()
- if canChange && v == nil {
- xlen, _ := decInferLen(containerLen, d.h.MaxInitLen, 24)
- v = make(map[string]uintptr, xlen)
- changed = true
- }
-
- var mk string
- var mv uintptr
- if containerLen > 0 {
- for j := 0; j < containerLen; j++ {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- mk = dd.DecodeString()
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- mv = uintptr(dd.DecodeUint(uintBitsize))
- if v != nil {
- v[mk] = mv
- }
- }
- } else if containerLen < 0 {
- for j := 0; !dd.CheckBreak(); j++ {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- mk = dd.DecodeString()
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- mv = uintptr(dd.DecodeUint(uintBitsize))
- if v != nil {
- v[mk] = mv
- }
- }
- }
- if cr != nil {
- cr.sendContainerState(containerMapEnd)
- }
- return v, changed
-}
-
-func (f *decFnInfo) fastpathDecMapStringIntR(rv reflect.Value) {
- if rv.CanAddr() {
- vp := rv.Addr().Interface().(*map[string]int)
- v, changed := fastpathTV.DecMapStringIntV(*vp, fastpathCheckNilFalse, true, f.d)
- if changed {
- *vp = v
- }
- } else {
- v := rv.Interface().(map[string]int)
- fastpathTV.DecMapStringIntV(v, fastpathCheckNilFalse, false, f.d)
- }
-}
-func (f fastpathT) DecMapStringIntX(vp *map[string]int, checkNil bool, d *Decoder) {
- v, changed := f.DecMapStringIntV(*vp, checkNil, true, d)
- if changed {
- *vp = v
- }
-}
-func (_ fastpathT) DecMapStringIntV(v map[string]int, checkNil bool, canChange bool,
- d *Decoder) (_ map[string]int, changed bool) {
- dd := d.d
- cr := d.cr
-
- if checkNil && dd.TryDecodeAsNil() {
- if v != nil {
- changed = true
- }
- return nil, changed
- }
-
- containerLen := dd.ReadMapStart()
- if canChange && v == nil {
- xlen, _ := decInferLen(containerLen, d.h.MaxInitLen, 24)
- v = make(map[string]int, xlen)
- changed = true
- }
-
- var mk string
- var mv int
- if containerLen > 0 {
- for j := 0; j < containerLen; j++ {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- mk = dd.DecodeString()
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- mv = int(dd.DecodeInt(intBitsize))
- if v != nil {
- v[mk] = mv
- }
- }
- } else if containerLen < 0 {
- for j := 0; !dd.CheckBreak(); j++ {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- mk = dd.DecodeString()
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- mv = int(dd.DecodeInt(intBitsize))
- if v != nil {
- v[mk] = mv
- }
- }
- }
- if cr != nil {
- cr.sendContainerState(containerMapEnd)
- }
- return v, changed
-}
-
-func (f *decFnInfo) fastpathDecMapStringInt8R(rv reflect.Value) {
- if rv.CanAddr() {
- vp := rv.Addr().Interface().(*map[string]int8)
- v, changed := fastpathTV.DecMapStringInt8V(*vp, fastpathCheckNilFalse, true, f.d)
- if changed {
- *vp = v
- }
- } else {
- v := rv.Interface().(map[string]int8)
- fastpathTV.DecMapStringInt8V(v, fastpathCheckNilFalse, false, f.d)
- }
-}
-func (f fastpathT) DecMapStringInt8X(vp *map[string]int8, checkNil bool, d *Decoder) {
- v, changed := f.DecMapStringInt8V(*vp, checkNil, true, d)
- if changed {
- *vp = v
- }
-}
-func (_ fastpathT) DecMapStringInt8V(v map[string]int8, checkNil bool, canChange bool,
- d *Decoder) (_ map[string]int8, changed bool) {
- dd := d.d
- cr := d.cr
-
- if checkNil && dd.TryDecodeAsNil() {
- if v != nil {
- changed = true
- }
- return nil, changed
- }
-
- containerLen := dd.ReadMapStart()
- if canChange && v == nil {
- xlen, _ := decInferLen(containerLen, d.h.MaxInitLen, 17)
- v = make(map[string]int8, xlen)
- changed = true
- }
-
- var mk string
- var mv int8
- if containerLen > 0 {
- for j := 0; j < containerLen; j++ {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- mk = dd.DecodeString()
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- mv = int8(dd.DecodeInt(8))
- if v != nil {
- v[mk] = mv
- }
- }
- } else if containerLen < 0 {
- for j := 0; !dd.CheckBreak(); j++ {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- mk = dd.DecodeString()
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- mv = int8(dd.DecodeInt(8))
- if v != nil {
- v[mk] = mv
- }
- }
- }
- if cr != nil {
- cr.sendContainerState(containerMapEnd)
- }
- return v, changed
-}
-
-func (f *decFnInfo) fastpathDecMapStringInt16R(rv reflect.Value) {
- if rv.CanAddr() {
- vp := rv.Addr().Interface().(*map[string]int16)
- v, changed := fastpathTV.DecMapStringInt16V(*vp, fastpathCheckNilFalse, true, f.d)
- if changed {
- *vp = v
- }
- } else {
- v := rv.Interface().(map[string]int16)
- fastpathTV.DecMapStringInt16V(v, fastpathCheckNilFalse, false, f.d)
- }
-}
-func (f fastpathT) DecMapStringInt16X(vp *map[string]int16, checkNil bool, d *Decoder) {
- v, changed := f.DecMapStringInt16V(*vp, checkNil, true, d)
- if changed {
- *vp = v
- }
-}
-func (_ fastpathT) DecMapStringInt16V(v map[string]int16, checkNil bool, canChange bool,
- d *Decoder) (_ map[string]int16, changed bool) {
- dd := d.d
- cr := d.cr
-
- if checkNil && dd.TryDecodeAsNil() {
- if v != nil {
- changed = true
- }
- return nil, changed
- }
-
- containerLen := dd.ReadMapStart()
- if canChange && v == nil {
- xlen, _ := decInferLen(containerLen, d.h.MaxInitLen, 18)
- v = make(map[string]int16, xlen)
- changed = true
- }
-
- var mk string
- var mv int16
- if containerLen > 0 {
- for j := 0; j < containerLen; j++ {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- mk = dd.DecodeString()
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- mv = int16(dd.DecodeInt(16))
- if v != nil {
- v[mk] = mv
- }
- }
- } else if containerLen < 0 {
- for j := 0; !dd.CheckBreak(); j++ {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- mk = dd.DecodeString()
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- mv = int16(dd.DecodeInt(16))
- if v != nil {
- v[mk] = mv
- }
- }
- }
- if cr != nil {
- cr.sendContainerState(containerMapEnd)
- }
- return v, changed
-}
-
-func (f *decFnInfo) fastpathDecMapStringInt32R(rv reflect.Value) {
- if rv.CanAddr() {
- vp := rv.Addr().Interface().(*map[string]int32)
- v, changed := fastpathTV.DecMapStringInt32V(*vp, fastpathCheckNilFalse, true, f.d)
- if changed {
- *vp = v
- }
- } else {
- v := rv.Interface().(map[string]int32)
- fastpathTV.DecMapStringInt32V(v, fastpathCheckNilFalse, false, f.d)
- }
-}
-func (f fastpathT) DecMapStringInt32X(vp *map[string]int32, checkNil bool, d *Decoder) {
- v, changed := f.DecMapStringInt32V(*vp, checkNil, true, d)
- if changed {
- *vp = v
- }
-}
-func (_ fastpathT) DecMapStringInt32V(v map[string]int32, checkNil bool, canChange bool,
- d *Decoder) (_ map[string]int32, changed bool) {
- dd := d.d
- cr := d.cr
-
- if checkNil && dd.TryDecodeAsNil() {
- if v != nil {
- changed = true
- }
- return nil, changed
- }
-
- containerLen := dd.ReadMapStart()
- if canChange && v == nil {
- xlen, _ := decInferLen(containerLen, d.h.MaxInitLen, 20)
- v = make(map[string]int32, xlen)
- changed = true
- }
-
- var mk string
- var mv int32
- if containerLen > 0 {
- for j := 0; j < containerLen; j++ {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- mk = dd.DecodeString()
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- mv = int32(dd.DecodeInt(32))
- if v != nil {
- v[mk] = mv
- }
- }
- } else if containerLen < 0 {
- for j := 0; !dd.CheckBreak(); j++ {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- mk = dd.DecodeString()
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- mv = int32(dd.DecodeInt(32))
- if v != nil {
- v[mk] = mv
- }
- }
- }
- if cr != nil {
- cr.sendContainerState(containerMapEnd)
- }
- return v, changed
-}
-
-func (f *decFnInfo) fastpathDecMapStringInt64R(rv reflect.Value) {
- if rv.CanAddr() {
- vp := rv.Addr().Interface().(*map[string]int64)
- v, changed := fastpathTV.DecMapStringInt64V(*vp, fastpathCheckNilFalse, true, f.d)
- if changed {
- *vp = v
- }
- } else {
- v := rv.Interface().(map[string]int64)
- fastpathTV.DecMapStringInt64V(v, fastpathCheckNilFalse, false, f.d)
- }
-}
-func (f fastpathT) DecMapStringInt64X(vp *map[string]int64, checkNil bool, d *Decoder) {
- v, changed := f.DecMapStringInt64V(*vp, checkNil, true, d)
- if changed {
- *vp = v
- }
-}
-func (_ fastpathT) DecMapStringInt64V(v map[string]int64, checkNil bool, canChange bool,
- d *Decoder) (_ map[string]int64, changed bool) {
- dd := d.d
- cr := d.cr
-
- if checkNil && dd.TryDecodeAsNil() {
- if v != nil {
- changed = true
- }
- return nil, changed
- }
-
- containerLen := dd.ReadMapStart()
- if canChange && v == nil {
- xlen, _ := decInferLen(containerLen, d.h.MaxInitLen, 24)
- v = make(map[string]int64, xlen)
- changed = true
- }
-
- var mk string
- var mv int64
- if containerLen > 0 {
- for j := 0; j < containerLen; j++ {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- mk = dd.DecodeString()
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- mv = dd.DecodeInt(64)
- if v != nil {
- v[mk] = mv
- }
- }
- } else if containerLen < 0 {
- for j := 0; !dd.CheckBreak(); j++ {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- mk = dd.DecodeString()
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- mv = dd.DecodeInt(64)
- if v != nil {
- v[mk] = mv
- }
- }
- }
- if cr != nil {
- cr.sendContainerState(containerMapEnd)
- }
- return v, changed
-}
-
-func (f *decFnInfo) fastpathDecMapStringFloat32R(rv reflect.Value) {
- if rv.CanAddr() {
- vp := rv.Addr().Interface().(*map[string]float32)
- v, changed := fastpathTV.DecMapStringFloat32V(*vp, fastpathCheckNilFalse, true, f.d)
- if changed {
- *vp = v
- }
- } else {
- v := rv.Interface().(map[string]float32)
- fastpathTV.DecMapStringFloat32V(v, fastpathCheckNilFalse, false, f.d)
- }
-}
-func (f fastpathT) DecMapStringFloat32X(vp *map[string]float32, checkNil bool, d *Decoder) {
- v, changed := f.DecMapStringFloat32V(*vp, checkNil, true, d)
- if changed {
- *vp = v
- }
-}
-func (_ fastpathT) DecMapStringFloat32V(v map[string]float32, checkNil bool, canChange bool,
- d *Decoder) (_ map[string]float32, changed bool) {
- dd := d.d
- cr := d.cr
-
- if checkNil && dd.TryDecodeAsNil() {
- if v != nil {
- changed = true
- }
- return nil, changed
- }
-
- containerLen := dd.ReadMapStart()
- if canChange && v == nil {
- xlen, _ := decInferLen(containerLen, d.h.MaxInitLen, 20)
- v = make(map[string]float32, xlen)
- changed = true
- }
-
- var mk string
- var mv float32
- if containerLen > 0 {
- for j := 0; j < containerLen; j++ {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- mk = dd.DecodeString()
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- mv = float32(dd.DecodeFloat(true))
- if v != nil {
- v[mk] = mv
- }
- }
- } else if containerLen < 0 {
- for j := 0; !dd.CheckBreak(); j++ {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- mk = dd.DecodeString()
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- mv = float32(dd.DecodeFloat(true))
- if v != nil {
- v[mk] = mv
- }
- }
- }
- if cr != nil {
- cr.sendContainerState(containerMapEnd)
- }
- return v, changed
-}
-
-func (f *decFnInfo) fastpathDecMapStringFloat64R(rv reflect.Value) {
- if rv.CanAddr() {
- vp := rv.Addr().Interface().(*map[string]float64)
- v, changed := fastpathTV.DecMapStringFloat64V(*vp, fastpathCheckNilFalse, true, f.d)
- if changed {
- *vp = v
- }
- } else {
- v := rv.Interface().(map[string]float64)
- fastpathTV.DecMapStringFloat64V(v, fastpathCheckNilFalse, false, f.d)
- }
-}
-func (f fastpathT) DecMapStringFloat64X(vp *map[string]float64, checkNil bool, d *Decoder) {
- v, changed := f.DecMapStringFloat64V(*vp, checkNil, true, d)
- if changed {
- *vp = v
- }
-}
-func (_ fastpathT) DecMapStringFloat64V(v map[string]float64, checkNil bool, canChange bool,
- d *Decoder) (_ map[string]float64, changed bool) {
- dd := d.d
- cr := d.cr
-
- if checkNil && dd.TryDecodeAsNil() {
- if v != nil {
- changed = true
- }
- return nil, changed
- }
-
- containerLen := dd.ReadMapStart()
- if canChange && v == nil {
- xlen, _ := decInferLen(containerLen, d.h.MaxInitLen, 24)
- v = make(map[string]float64, xlen)
- changed = true
- }
-
- var mk string
- var mv float64
- if containerLen > 0 {
- for j := 0; j < containerLen; j++ {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- mk = dd.DecodeString()
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- mv = dd.DecodeFloat(false)
- if v != nil {
- v[mk] = mv
- }
- }
- } else if containerLen < 0 {
- for j := 0; !dd.CheckBreak(); j++ {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- mk = dd.DecodeString()
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- mv = dd.DecodeFloat(false)
- if v != nil {
- v[mk] = mv
- }
- }
- }
- if cr != nil {
- cr.sendContainerState(containerMapEnd)
- }
- return v, changed
-}
-
-func (f *decFnInfo) fastpathDecMapStringBoolR(rv reflect.Value) {
- if rv.CanAddr() {
- vp := rv.Addr().Interface().(*map[string]bool)
- v, changed := fastpathTV.DecMapStringBoolV(*vp, fastpathCheckNilFalse, true, f.d)
- if changed {
- *vp = v
- }
- } else {
- v := rv.Interface().(map[string]bool)
- fastpathTV.DecMapStringBoolV(v, fastpathCheckNilFalse, false, f.d)
- }
-}
-func (f fastpathT) DecMapStringBoolX(vp *map[string]bool, checkNil bool, d *Decoder) {
- v, changed := f.DecMapStringBoolV(*vp, checkNil, true, d)
- if changed {
- *vp = v
- }
-}
-func (_ fastpathT) DecMapStringBoolV(v map[string]bool, checkNil bool, canChange bool,
- d *Decoder) (_ map[string]bool, changed bool) {
- dd := d.d
- cr := d.cr
-
- if checkNil && dd.TryDecodeAsNil() {
- if v != nil {
- changed = true
- }
- return nil, changed
- }
-
- containerLen := dd.ReadMapStart()
- if canChange && v == nil {
- xlen, _ := decInferLen(containerLen, d.h.MaxInitLen, 17)
- v = make(map[string]bool, xlen)
- changed = true
- }
-
- var mk string
- var mv bool
- if containerLen > 0 {
- for j := 0; j < containerLen; j++ {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- mk = dd.DecodeString()
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- mv = dd.DecodeBool()
- if v != nil {
- v[mk] = mv
- }
- }
- } else if containerLen < 0 {
- for j := 0; !dd.CheckBreak(); j++ {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- mk = dd.DecodeString()
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- mv = dd.DecodeBool()
- if v != nil {
- v[mk] = mv
- }
- }
- }
- if cr != nil {
- cr.sendContainerState(containerMapEnd)
- }
- return v, changed
-}
-
-func (f *decFnInfo) fastpathDecMapFloat32IntfR(rv reflect.Value) {
- if rv.CanAddr() {
- vp := rv.Addr().Interface().(*map[float32]interface{})
- v, changed := fastpathTV.DecMapFloat32IntfV(*vp, fastpathCheckNilFalse, true, f.d)
- if changed {
- *vp = v
- }
- } else {
- v := rv.Interface().(map[float32]interface{})
- fastpathTV.DecMapFloat32IntfV(v, fastpathCheckNilFalse, false, f.d)
- }
-}
-func (f fastpathT) DecMapFloat32IntfX(vp *map[float32]interface{}, checkNil bool, d *Decoder) {
- v, changed := f.DecMapFloat32IntfV(*vp, checkNil, true, d)
- if changed {
- *vp = v
- }
-}
-func (_ fastpathT) DecMapFloat32IntfV(v map[float32]interface{}, checkNil bool, canChange bool,
- d *Decoder) (_ map[float32]interface{}, changed bool) {
- dd := d.d
- cr := d.cr
-
- if checkNil && dd.TryDecodeAsNil() {
- if v != nil {
- changed = true
- }
- return nil, changed
- }
-
- containerLen := dd.ReadMapStart()
- if canChange && v == nil {
- xlen, _ := decInferLen(containerLen, d.h.MaxInitLen, 20)
- v = make(map[float32]interface{}, xlen)
- changed = true
- }
- mapGet := !d.h.MapValueReset && !d.h.InterfaceReset
- var mk float32
- var mv interface{}
- if containerLen > 0 {
- for j := 0; j < containerLen; j++ {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- mk = float32(dd.DecodeFloat(true))
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- if mapGet {
- mv = v[mk]
- } else {
- mv = nil
- }
- d.decode(&mv)
- if v != nil {
- v[mk] = mv
- }
- }
- } else if containerLen < 0 {
- for j := 0; !dd.CheckBreak(); j++ {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- mk = float32(dd.DecodeFloat(true))
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- if mapGet {
- mv = v[mk]
- } else {
- mv = nil
- }
- d.decode(&mv)
- if v != nil {
- v[mk] = mv
- }
- }
- }
- if cr != nil {
- cr.sendContainerState(containerMapEnd)
- }
- return v, changed
-}
-
-func (f *decFnInfo) fastpathDecMapFloat32StringR(rv reflect.Value) {
- if rv.CanAddr() {
- vp := rv.Addr().Interface().(*map[float32]string)
- v, changed := fastpathTV.DecMapFloat32StringV(*vp, fastpathCheckNilFalse, true, f.d)
- if changed {
- *vp = v
- }
- } else {
- v := rv.Interface().(map[float32]string)
- fastpathTV.DecMapFloat32StringV(v, fastpathCheckNilFalse, false, f.d)
- }
-}
-func (f fastpathT) DecMapFloat32StringX(vp *map[float32]string, checkNil bool, d *Decoder) {
- v, changed := f.DecMapFloat32StringV(*vp, checkNil, true, d)
- if changed {
- *vp = v
- }
-}
-func (_ fastpathT) DecMapFloat32StringV(v map[float32]string, checkNil bool, canChange bool,
- d *Decoder) (_ map[float32]string, changed bool) {
- dd := d.d
- cr := d.cr
-
- if checkNil && dd.TryDecodeAsNil() {
- if v != nil {
- changed = true
- }
- return nil, changed
- }
-
- containerLen := dd.ReadMapStart()
- if canChange && v == nil {
- xlen, _ := decInferLen(containerLen, d.h.MaxInitLen, 20)
- v = make(map[float32]string, xlen)
- changed = true
- }
-
- var mk float32
- var mv string
- if containerLen > 0 {
- for j := 0; j < containerLen; j++ {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- mk = float32(dd.DecodeFloat(true))
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- mv = dd.DecodeString()
- if v != nil {
- v[mk] = mv
- }
- }
- } else if containerLen < 0 {
- for j := 0; !dd.CheckBreak(); j++ {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- mk = float32(dd.DecodeFloat(true))
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- mv = dd.DecodeString()
- if v != nil {
- v[mk] = mv
- }
- }
- }
- if cr != nil {
- cr.sendContainerState(containerMapEnd)
- }
- return v, changed
-}
-
-func (f *decFnInfo) fastpathDecMapFloat32UintR(rv reflect.Value) {
- if rv.CanAddr() {
- vp := rv.Addr().Interface().(*map[float32]uint)
- v, changed := fastpathTV.DecMapFloat32UintV(*vp, fastpathCheckNilFalse, true, f.d)
- if changed {
- *vp = v
- }
- } else {
- v := rv.Interface().(map[float32]uint)
- fastpathTV.DecMapFloat32UintV(v, fastpathCheckNilFalse, false, f.d)
- }
-}
-func (f fastpathT) DecMapFloat32UintX(vp *map[float32]uint, checkNil bool, d *Decoder) {
- v, changed := f.DecMapFloat32UintV(*vp, checkNil, true, d)
- if changed {
- *vp = v
- }
-}
-func (_ fastpathT) DecMapFloat32UintV(v map[float32]uint, checkNil bool, canChange bool,
- d *Decoder) (_ map[float32]uint, changed bool) {
- dd := d.d
- cr := d.cr
-
- if checkNil && dd.TryDecodeAsNil() {
- if v != nil {
- changed = true
- }
- return nil, changed
- }
-
- containerLen := dd.ReadMapStart()
- if canChange && v == nil {
- xlen, _ := decInferLen(containerLen, d.h.MaxInitLen, 12)
- v = make(map[float32]uint, xlen)
- changed = true
- }
-
- var mk float32
- var mv uint
- if containerLen > 0 {
- for j := 0; j < containerLen; j++ {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- mk = float32(dd.DecodeFloat(true))
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- mv = uint(dd.DecodeUint(uintBitsize))
- if v != nil {
- v[mk] = mv
- }
- }
- } else if containerLen < 0 {
- for j := 0; !dd.CheckBreak(); j++ {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- mk = float32(dd.DecodeFloat(true))
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- mv = uint(dd.DecodeUint(uintBitsize))
- if v != nil {
- v[mk] = mv
- }
- }
- }
- if cr != nil {
- cr.sendContainerState(containerMapEnd)
- }
- return v, changed
-}
-
-func (f *decFnInfo) fastpathDecMapFloat32Uint8R(rv reflect.Value) {
- if rv.CanAddr() {
- vp := rv.Addr().Interface().(*map[float32]uint8)
- v, changed := fastpathTV.DecMapFloat32Uint8V(*vp, fastpathCheckNilFalse, true, f.d)
- if changed {
- *vp = v
- }
- } else {
- v := rv.Interface().(map[float32]uint8)
- fastpathTV.DecMapFloat32Uint8V(v, fastpathCheckNilFalse, false, f.d)
- }
-}
-func (f fastpathT) DecMapFloat32Uint8X(vp *map[float32]uint8, checkNil bool, d *Decoder) {
- v, changed := f.DecMapFloat32Uint8V(*vp, checkNil, true, d)
- if changed {
- *vp = v
- }
-}
-func (_ fastpathT) DecMapFloat32Uint8V(v map[float32]uint8, checkNil bool, canChange bool,
- d *Decoder) (_ map[float32]uint8, changed bool) {
- dd := d.d
- cr := d.cr
-
- if checkNil && dd.TryDecodeAsNil() {
- if v != nil {
- changed = true
- }
- return nil, changed
- }
-
- containerLen := dd.ReadMapStart()
- if canChange && v == nil {
- xlen, _ := decInferLen(containerLen, d.h.MaxInitLen, 5)
- v = make(map[float32]uint8, xlen)
- changed = true
- }
-
- var mk float32
- var mv uint8
- if containerLen > 0 {
- for j := 0; j < containerLen; j++ {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- mk = float32(dd.DecodeFloat(true))
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- mv = uint8(dd.DecodeUint(8))
- if v != nil {
- v[mk] = mv
- }
- }
- } else if containerLen < 0 {
- for j := 0; !dd.CheckBreak(); j++ {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- mk = float32(dd.DecodeFloat(true))
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- mv = uint8(dd.DecodeUint(8))
- if v != nil {
- v[mk] = mv
- }
- }
- }
- if cr != nil {
- cr.sendContainerState(containerMapEnd)
- }
- return v, changed
-}
-
-func (f *decFnInfo) fastpathDecMapFloat32Uint16R(rv reflect.Value) {
- if rv.CanAddr() {
- vp := rv.Addr().Interface().(*map[float32]uint16)
- v, changed := fastpathTV.DecMapFloat32Uint16V(*vp, fastpathCheckNilFalse, true, f.d)
- if changed {
- *vp = v
- }
- } else {
- v := rv.Interface().(map[float32]uint16)
- fastpathTV.DecMapFloat32Uint16V(v, fastpathCheckNilFalse, false, f.d)
- }
-}
-func (f fastpathT) DecMapFloat32Uint16X(vp *map[float32]uint16, checkNil bool, d *Decoder) {
- v, changed := f.DecMapFloat32Uint16V(*vp, checkNil, true, d)
- if changed {
- *vp = v
- }
-}
-func (_ fastpathT) DecMapFloat32Uint16V(v map[float32]uint16, checkNil bool, canChange bool,
- d *Decoder) (_ map[float32]uint16, changed bool) {
- dd := d.d
- cr := d.cr
-
- if checkNil && dd.TryDecodeAsNil() {
- if v != nil {
- changed = true
- }
- return nil, changed
- }
-
- containerLen := dd.ReadMapStart()
- if canChange && v == nil {
- xlen, _ := decInferLen(containerLen, d.h.MaxInitLen, 6)
- v = make(map[float32]uint16, xlen)
- changed = true
- }
-
- var mk float32
- var mv uint16
- if containerLen > 0 {
- for j := 0; j < containerLen; j++ {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- mk = float32(dd.DecodeFloat(true))
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- mv = uint16(dd.DecodeUint(16))
- if v != nil {
- v[mk] = mv
- }
- }
- } else if containerLen < 0 {
- for j := 0; !dd.CheckBreak(); j++ {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- mk = float32(dd.DecodeFloat(true))
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- mv = uint16(dd.DecodeUint(16))
- if v != nil {
- v[mk] = mv
- }
- }
- }
- if cr != nil {
- cr.sendContainerState(containerMapEnd)
- }
- return v, changed
-}
-
-func (f *decFnInfo) fastpathDecMapFloat32Uint32R(rv reflect.Value) {
- if rv.CanAddr() {
- vp := rv.Addr().Interface().(*map[float32]uint32)
- v, changed := fastpathTV.DecMapFloat32Uint32V(*vp, fastpathCheckNilFalse, true, f.d)
- if changed {
- *vp = v
- }
- } else {
- v := rv.Interface().(map[float32]uint32)
- fastpathTV.DecMapFloat32Uint32V(v, fastpathCheckNilFalse, false, f.d)
- }
-}
-func (f fastpathT) DecMapFloat32Uint32X(vp *map[float32]uint32, checkNil bool, d *Decoder) {
- v, changed := f.DecMapFloat32Uint32V(*vp, checkNil, true, d)
- if changed {
- *vp = v
- }
-}
-func (_ fastpathT) DecMapFloat32Uint32V(v map[float32]uint32, checkNil bool, canChange bool,
- d *Decoder) (_ map[float32]uint32, changed bool) {
- dd := d.d
- cr := d.cr
-
- if checkNil && dd.TryDecodeAsNil() {
- if v != nil {
- changed = true
- }
- return nil, changed
- }
-
- containerLen := dd.ReadMapStart()
- if canChange && v == nil {
- xlen, _ := decInferLen(containerLen, d.h.MaxInitLen, 8)
- v = make(map[float32]uint32, xlen)
- changed = true
- }
-
- var mk float32
- var mv uint32
- if containerLen > 0 {
- for j := 0; j < containerLen; j++ {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- mk = float32(dd.DecodeFloat(true))
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- mv = uint32(dd.DecodeUint(32))
- if v != nil {
- v[mk] = mv
- }
- }
- } else if containerLen < 0 {
- for j := 0; !dd.CheckBreak(); j++ {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- mk = float32(dd.DecodeFloat(true))
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- mv = uint32(dd.DecodeUint(32))
- if v != nil {
- v[mk] = mv
- }
- }
- }
- if cr != nil {
- cr.sendContainerState(containerMapEnd)
- }
- return v, changed
-}
-
-func (f *decFnInfo) fastpathDecMapFloat32Uint64R(rv reflect.Value) {
- if rv.CanAddr() {
- vp := rv.Addr().Interface().(*map[float32]uint64)
- v, changed := fastpathTV.DecMapFloat32Uint64V(*vp, fastpathCheckNilFalse, true, f.d)
- if changed {
- *vp = v
- }
- } else {
- v := rv.Interface().(map[float32]uint64)
- fastpathTV.DecMapFloat32Uint64V(v, fastpathCheckNilFalse, false, f.d)
- }
-}
-func (f fastpathT) DecMapFloat32Uint64X(vp *map[float32]uint64, checkNil bool, d *Decoder) {
- v, changed := f.DecMapFloat32Uint64V(*vp, checkNil, true, d)
- if changed {
- *vp = v
- }
-}
-func (_ fastpathT) DecMapFloat32Uint64V(v map[float32]uint64, checkNil bool, canChange bool,
- d *Decoder) (_ map[float32]uint64, changed bool) {
- dd := d.d
- cr := d.cr
-
- if checkNil && dd.TryDecodeAsNil() {
- if v != nil {
- changed = true
- }
- return nil, changed
- }
-
- containerLen := dd.ReadMapStart()
- if canChange && v == nil {
- xlen, _ := decInferLen(containerLen, d.h.MaxInitLen, 12)
- v = make(map[float32]uint64, xlen)
- changed = true
- }
-
- var mk float32
- var mv uint64
- if containerLen > 0 {
- for j := 0; j < containerLen; j++ {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- mk = float32(dd.DecodeFloat(true))
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- mv = dd.DecodeUint(64)
- if v != nil {
- v[mk] = mv
- }
- }
- } else if containerLen < 0 {
- for j := 0; !dd.CheckBreak(); j++ {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- mk = float32(dd.DecodeFloat(true))
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- mv = dd.DecodeUint(64)
- if v != nil {
- v[mk] = mv
- }
- }
- }
- if cr != nil {
- cr.sendContainerState(containerMapEnd)
- }
- return v, changed
-}
-
-func (f *decFnInfo) fastpathDecMapFloat32UintptrR(rv reflect.Value) {
- if rv.CanAddr() {
- vp := rv.Addr().Interface().(*map[float32]uintptr)
- v, changed := fastpathTV.DecMapFloat32UintptrV(*vp, fastpathCheckNilFalse, true, f.d)
- if changed {
- *vp = v
- }
- } else {
- v := rv.Interface().(map[float32]uintptr)
- fastpathTV.DecMapFloat32UintptrV(v, fastpathCheckNilFalse, false, f.d)
- }
-}
-func (f fastpathT) DecMapFloat32UintptrX(vp *map[float32]uintptr, checkNil bool, d *Decoder) {
- v, changed := f.DecMapFloat32UintptrV(*vp, checkNil, true, d)
- if changed {
- *vp = v
- }
-}
-func (_ fastpathT) DecMapFloat32UintptrV(v map[float32]uintptr, checkNil bool, canChange bool,
- d *Decoder) (_ map[float32]uintptr, changed bool) {
- dd := d.d
- cr := d.cr
-
- if checkNil && dd.TryDecodeAsNil() {
- if v != nil {
- changed = true
- }
- return nil, changed
- }
-
- containerLen := dd.ReadMapStart()
- if canChange && v == nil {
- xlen, _ := decInferLen(containerLen, d.h.MaxInitLen, 12)
- v = make(map[float32]uintptr, xlen)
- changed = true
- }
-
- var mk float32
- var mv uintptr
- if containerLen > 0 {
- for j := 0; j < containerLen; j++ {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- mk = float32(dd.DecodeFloat(true))
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- mv = uintptr(dd.DecodeUint(uintBitsize))
- if v != nil {
- v[mk] = mv
- }
- }
- } else if containerLen < 0 {
- for j := 0; !dd.CheckBreak(); j++ {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- mk = float32(dd.DecodeFloat(true))
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- mv = uintptr(dd.DecodeUint(uintBitsize))
- if v != nil {
- v[mk] = mv
- }
- }
- }
- if cr != nil {
- cr.sendContainerState(containerMapEnd)
- }
- return v, changed
-}
-
-func (f *decFnInfo) fastpathDecMapFloat32IntR(rv reflect.Value) {
- if rv.CanAddr() {
- vp := rv.Addr().Interface().(*map[float32]int)
- v, changed := fastpathTV.DecMapFloat32IntV(*vp, fastpathCheckNilFalse, true, f.d)
- if changed {
- *vp = v
- }
- } else {
- v := rv.Interface().(map[float32]int)
- fastpathTV.DecMapFloat32IntV(v, fastpathCheckNilFalse, false, f.d)
- }
-}
-func (f fastpathT) DecMapFloat32IntX(vp *map[float32]int, checkNil bool, d *Decoder) {
- v, changed := f.DecMapFloat32IntV(*vp, checkNil, true, d)
- if changed {
- *vp = v
- }
-}
-func (_ fastpathT) DecMapFloat32IntV(v map[float32]int, checkNil bool, canChange bool,
- d *Decoder) (_ map[float32]int, changed bool) {
- dd := d.d
- cr := d.cr
-
- if checkNil && dd.TryDecodeAsNil() {
- if v != nil {
- changed = true
- }
- return nil, changed
- }
-
- containerLen := dd.ReadMapStart()
- if canChange && v == nil {
- xlen, _ := decInferLen(containerLen, d.h.MaxInitLen, 12)
- v = make(map[float32]int, xlen)
- changed = true
- }
-
- var mk float32
- var mv int
- if containerLen > 0 {
- for j := 0; j < containerLen; j++ {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- mk = float32(dd.DecodeFloat(true))
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- mv = int(dd.DecodeInt(intBitsize))
- if v != nil {
- v[mk] = mv
- }
- }
- } else if containerLen < 0 {
- for j := 0; !dd.CheckBreak(); j++ {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- mk = float32(dd.DecodeFloat(true))
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- mv = int(dd.DecodeInt(intBitsize))
- if v != nil {
- v[mk] = mv
- }
- }
- }
- if cr != nil {
- cr.sendContainerState(containerMapEnd)
- }
- return v, changed
-}
-
-func (f *decFnInfo) fastpathDecMapFloat32Int8R(rv reflect.Value) {
- if rv.CanAddr() {
- vp := rv.Addr().Interface().(*map[float32]int8)
- v, changed := fastpathTV.DecMapFloat32Int8V(*vp, fastpathCheckNilFalse, true, f.d)
- if changed {
- *vp = v
- }
- } else {
- v := rv.Interface().(map[float32]int8)
- fastpathTV.DecMapFloat32Int8V(v, fastpathCheckNilFalse, false, f.d)
- }
-}
-func (f fastpathT) DecMapFloat32Int8X(vp *map[float32]int8, checkNil bool, d *Decoder) {
- v, changed := f.DecMapFloat32Int8V(*vp, checkNil, true, d)
- if changed {
- *vp = v
- }
-}
-func (_ fastpathT) DecMapFloat32Int8V(v map[float32]int8, checkNil bool, canChange bool,
- d *Decoder) (_ map[float32]int8, changed bool) {
- dd := d.d
- cr := d.cr
-
- if checkNil && dd.TryDecodeAsNil() {
- if v != nil {
- changed = true
- }
- return nil, changed
- }
-
- containerLen := dd.ReadMapStart()
- if canChange && v == nil {
- xlen, _ := decInferLen(containerLen, d.h.MaxInitLen, 5)
- v = make(map[float32]int8, xlen)
- changed = true
- }
-
- var mk float32
- var mv int8
- if containerLen > 0 {
- for j := 0; j < containerLen; j++ {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- mk = float32(dd.DecodeFloat(true))
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- mv = int8(dd.DecodeInt(8))
- if v != nil {
- v[mk] = mv
- }
- }
- } else if containerLen < 0 {
- for j := 0; !dd.CheckBreak(); j++ {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- mk = float32(dd.DecodeFloat(true))
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- mv = int8(dd.DecodeInt(8))
- if v != nil {
- v[mk] = mv
- }
- }
- }
- if cr != nil {
- cr.sendContainerState(containerMapEnd)
- }
- return v, changed
-}
-
-func (f *decFnInfo) fastpathDecMapFloat32Int16R(rv reflect.Value) {
- if rv.CanAddr() {
- vp := rv.Addr().Interface().(*map[float32]int16)
- v, changed := fastpathTV.DecMapFloat32Int16V(*vp, fastpathCheckNilFalse, true, f.d)
- if changed {
- *vp = v
- }
- } else {
- v := rv.Interface().(map[float32]int16)
- fastpathTV.DecMapFloat32Int16V(v, fastpathCheckNilFalse, false, f.d)
- }
-}
-func (f fastpathT) DecMapFloat32Int16X(vp *map[float32]int16, checkNil bool, d *Decoder) {
- v, changed := f.DecMapFloat32Int16V(*vp, checkNil, true, d)
- if changed {
- *vp = v
- }
-}
-func (_ fastpathT) DecMapFloat32Int16V(v map[float32]int16, checkNil bool, canChange bool,
- d *Decoder) (_ map[float32]int16, changed bool) {
- dd := d.d
- cr := d.cr
-
- if checkNil && dd.TryDecodeAsNil() {
- if v != nil {
- changed = true
- }
- return nil, changed
- }
-
- containerLen := dd.ReadMapStart()
- if canChange && v == nil {
- xlen, _ := decInferLen(containerLen, d.h.MaxInitLen, 6)
- v = make(map[float32]int16, xlen)
- changed = true
- }
-
- var mk float32
- var mv int16
- if containerLen > 0 {
- for j := 0; j < containerLen; j++ {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- mk = float32(dd.DecodeFloat(true))
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- mv = int16(dd.DecodeInt(16))
- if v != nil {
- v[mk] = mv
- }
- }
- } else if containerLen < 0 {
- for j := 0; !dd.CheckBreak(); j++ {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- mk = float32(dd.DecodeFloat(true))
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- mv = int16(dd.DecodeInt(16))
- if v != nil {
- v[mk] = mv
- }
- }
- }
- if cr != nil {
- cr.sendContainerState(containerMapEnd)
- }
- return v, changed
-}
-
-func (f *decFnInfo) fastpathDecMapFloat32Int32R(rv reflect.Value) {
- if rv.CanAddr() {
- vp := rv.Addr().Interface().(*map[float32]int32)
- v, changed := fastpathTV.DecMapFloat32Int32V(*vp, fastpathCheckNilFalse, true, f.d)
- if changed {
- *vp = v
- }
- } else {
- v := rv.Interface().(map[float32]int32)
- fastpathTV.DecMapFloat32Int32V(v, fastpathCheckNilFalse, false, f.d)
- }
-}
-func (f fastpathT) DecMapFloat32Int32X(vp *map[float32]int32, checkNil bool, d *Decoder) {
- v, changed := f.DecMapFloat32Int32V(*vp, checkNil, true, d)
- if changed {
- *vp = v
- }
-}
-func (_ fastpathT) DecMapFloat32Int32V(v map[float32]int32, checkNil bool, canChange bool,
- d *Decoder) (_ map[float32]int32, changed bool) {
- dd := d.d
- cr := d.cr
-
- if checkNil && dd.TryDecodeAsNil() {
- if v != nil {
- changed = true
- }
- return nil, changed
- }
-
- containerLen := dd.ReadMapStart()
- if canChange && v == nil {
- xlen, _ := decInferLen(containerLen, d.h.MaxInitLen, 8)
- v = make(map[float32]int32, xlen)
- changed = true
- }
-
- var mk float32
- var mv int32
- if containerLen > 0 {
- for j := 0; j < containerLen; j++ {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- mk = float32(dd.DecodeFloat(true))
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- mv = int32(dd.DecodeInt(32))
- if v != nil {
- v[mk] = mv
- }
- }
- } else if containerLen < 0 {
- for j := 0; !dd.CheckBreak(); j++ {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- mk = float32(dd.DecodeFloat(true))
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- mv = int32(dd.DecodeInt(32))
- if v != nil {
- v[mk] = mv
- }
- }
- }
- if cr != nil {
- cr.sendContainerState(containerMapEnd)
- }
- return v, changed
-}
-
-func (f *decFnInfo) fastpathDecMapFloat32Int64R(rv reflect.Value) {
- if rv.CanAddr() {
- vp := rv.Addr().Interface().(*map[float32]int64)
- v, changed := fastpathTV.DecMapFloat32Int64V(*vp, fastpathCheckNilFalse, true, f.d)
- if changed {
- *vp = v
- }
- } else {
- v := rv.Interface().(map[float32]int64)
- fastpathTV.DecMapFloat32Int64V(v, fastpathCheckNilFalse, false, f.d)
- }
-}
-func (f fastpathT) DecMapFloat32Int64X(vp *map[float32]int64, checkNil bool, d *Decoder) {
- v, changed := f.DecMapFloat32Int64V(*vp, checkNil, true, d)
- if changed {
- *vp = v
- }
-}
-func (_ fastpathT) DecMapFloat32Int64V(v map[float32]int64, checkNil bool, canChange bool,
- d *Decoder) (_ map[float32]int64, changed bool) {
- dd := d.d
- cr := d.cr
-
- if checkNil && dd.TryDecodeAsNil() {
- if v != nil {
- changed = true
- }
- return nil, changed
- }
-
- containerLen := dd.ReadMapStart()
- if canChange && v == nil {
- xlen, _ := decInferLen(containerLen, d.h.MaxInitLen, 12)
- v = make(map[float32]int64, xlen)
- changed = true
- }
-
- var mk float32
- var mv int64
- if containerLen > 0 {
- for j := 0; j < containerLen; j++ {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- mk = float32(dd.DecodeFloat(true))
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- mv = dd.DecodeInt(64)
- if v != nil {
- v[mk] = mv
- }
- }
- } else if containerLen < 0 {
- for j := 0; !dd.CheckBreak(); j++ {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- mk = float32(dd.DecodeFloat(true))
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- mv = dd.DecodeInt(64)
- if v != nil {
- v[mk] = mv
- }
- }
- }
- if cr != nil {
- cr.sendContainerState(containerMapEnd)
- }
- return v, changed
-}
-
-func (f *decFnInfo) fastpathDecMapFloat32Float32R(rv reflect.Value) {
- if rv.CanAddr() {
- vp := rv.Addr().Interface().(*map[float32]float32)
- v, changed := fastpathTV.DecMapFloat32Float32V(*vp, fastpathCheckNilFalse, true, f.d)
- if changed {
- *vp = v
- }
- } else {
- v := rv.Interface().(map[float32]float32)
- fastpathTV.DecMapFloat32Float32V(v, fastpathCheckNilFalse, false, f.d)
- }
-}
-func (f fastpathT) DecMapFloat32Float32X(vp *map[float32]float32, checkNil bool, d *Decoder) {
- v, changed := f.DecMapFloat32Float32V(*vp, checkNil, true, d)
- if changed {
- *vp = v
- }
-}
-func (_ fastpathT) DecMapFloat32Float32V(v map[float32]float32, checkNil bool, canChange bool,
- d *Decoder) (_ map[float32]float32, changed bool) {
- dd := d.d
- cr := d.cr
-
- if checkNil && dd.TryDecodeAsNil() {
- if v != nil {
- changed = true
- }
- return nil, changed
- }
-
- containerLen := dd.ReadMapStart()
- if canChange && v == nil {
- xlen, _ := decInferLen(containerLen, d.h.MaxInitLen, 8)
- v = make(map[float32]float32, xlen)
- changed = true
- }
-
- var mk float32
- var mv float32
- if containerLen > 0 {
- for j := 0; j < containerLen; j++ {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- mk = float32(dd.DecodeFloat(true))
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- mv = float32(dd.DecodeFloat(true))
- if v != nil {
- v[mk] = mv
- }
- }
- } else if containerLen < 0 {
- for j := 0; !dd.CheckBreak(); j++ {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- mk = float32(dd.DecodeFloat(true))
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- mv = float32(dd.DecodeFloat(true))
- if v != nil {
- v[mk] = mv
- }
- }
- }
- if cr != nil {
- cr.sendContainerState(containerMapEnd)
- }
- return v, changed
-}
-
-func (f *decFnInfo) fastpathDecMapFloat32Float64R(rv reflect.Value) {
- if rv.CanAddr() {
- vp := rv.Addr().Interface().(*map[float32]float64)
- v, changed := fastpathTV.DecMapFloat32Float64V(*vp, fastpathCheckNilFalse, true, f.d)
- if changed {
- *vp = v
- }
- } else {
- v := rv.Interface().(map[float32]float64)
- fastpathTV.DecMapFloat32Float64V(v, fastpathCheckNilFalse, false, f.d)
- }
-}
-func (f fastpathT) DecMapFloat32Float64X(vp *map[float32]float64, checkNil bool, d *Decoder) {
- v, changed := f.DecMapFloat32Float64V(*vp, checkNil, true, d)
- if changed {
- *vp = v
- }
-}
-func (_ fastpathT) DecMapFloat32Float64V(v map[float32]float64, checkNil bool, canChange bool,
- d *Decoder) (_ map[float32]float64, changed bool) {
- dd := d.d
- cr := d.cr
-
- if checkNil && dd.TryDecodeAsNil() {
- if v != nil {
- changed = true
- }
- return nil, changed
- }
-
- containerLen := dd.ReadMapStart()
- if canChange && v == nil {
- xlen, _ := decInferLen(containerLen, d.h.MaxInitLen, 12)
- v = make(map[float32]float64, xlen)
- changed = true
- }
-
- var mk float32
- var mv float64
- if containerLen > 0 {
- for j := 0; j < containerLen; j++ {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- mk = float32(dd.DecodeFloat(true))
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- mv = dd.DecodeFloat(false)
- if v != nil {
- v[mk] = mv
- }
- }
- } else if containerLen < 0 {
- for j := 0; !dd.CheckBreak(); j++ {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- mk = float32(dd.DecodeFloat(true))
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- mv = dd.DecodeFloat(false)
- if v != nil {
- v[mk] = mv
- }
- }
- }
- if cr != nil {
- cr.sendContainerState(containerMapEnd)
- }
- return v, changed
-}
-
-func (f *decFnInfo) fastpathDecMapFloat32BoolR(rv reflect.Value) {
- if rv.CanAddr() {
- vp := rv.Addr().Interface().(*map[float32]bool)
- v, changed := fastpathTV.DecMapFloat32BoolV(*vp, fastpathCheckNilFalse, true, f.d)
- if changed {
- *vp = v
- }
- } else {
- v := rv.Interface().(map[float32]bool)
- fastpathTV.DecMapFloat32BoolV(v, fastpathCheckNilFalse, false, f.d)
- }
-}
-func (f fastpathT) DecMapFloat32BoolX(vp *map[float32]bool, checkNil bool, d *Decoder) {
- v, changed := f.DecMapFloat32BoolV(*vp, checkNil, true, d)
- if changed {
- *vp = v
- }
-}
-func (_ fastpathT) DecMapFloat32BoolV(v map[float32]bool, checkNil bool, canChange bool,
- d *Decoder) (_ map[float32]bool, changed bool) {
- dd := d.d
- cr := d.cr
-
- if checkNil && dd.TryDecodeAsNil() {
- if v != nil {
- changed = true
- }
- return nil, changed
- }
-
- containerLen := dd.ReadMapStart()
- if canChange && v == nil {
- xlen, _ := decInferLen(containerLen, d.h.MaxInitLen, 5)
- v = make(map[float32]bool, xlen)
- changed = true
- }
-
- var mk float32
- var mv bool
- if containerLen > 0 {
- for j := 0; j < containerLen; j++ {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- mk = float32(dd.DecodeFloat(true))
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- mv = dd.DecodeBool()
- if v != nil {
- v[mk] = mv
- }
- }
- } else if containerLen < 0 {
- for j := 0; !dd.CheckBreak(); j++ {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- mk = float32(dd.DecodeFloat(true))
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- mv = dd.DecodeBool()
- if v != nil {
- v[mk] = mv
- }
- }
- }
- if cr != nil {
- cr.sendContainerState(containerMapEnd)
- }
- return v, changed
-}
-
-func (f *decFnInfo) fastpathDecMapFloat64IntfR(rv reflect.Value) {
- if rv.CanAddr() {
- vp := rv.Addr().Interface().(*map[float64]interface{})
- v, changed := fastpathTV.DecMapFloat64IntfV(*vp, fastpathCheckNilFalse, true, f.d)
- if changed {
- *vp = v
- }
- } else {
- v := rv.Interface().(map[float64]interface{})
- fastpathTV.DecMapFloat64IntfV(v, fastpathCheckNilFalse, false, f.d)
- }
-}
-func (f fastpathT) DecMapFloat64IntfX(vp *map[float64]interface{}, checkNil bool, d *Decoder) {
- v, changed := f.DecMapFloat64IntfV(*vp, checkNil, true, d)
- if changed {
- *vp = v
- }
-}
-func (_ fastpathT) DecMapFloat64IntfV(v map[float64]interface{}, checkNil bool, canChange bool,
- d *Decoder) (_ map[float64]interface{}, changed bool) {
- dd := d.d
- cr := d.cr
-
- if checkNil && dd.TryDecodeAsNil() {
- if v != nil {
- changed = true
- }
- return nil, changed
- }
-
- containerLen := dd.ReadMapStart()
- if canChange && v == nil {
- xlen, _ := decInferLen(containerLen, d.h.MaxInitLen, 24)
- v = make(map[float64]interface{}, xlen)
- changed = true
- }
- mapGet := !d.h.MapValueReset && !d.h.InterfaceReset
- var mk float64
- var mv interface{}
- if containerLen > 0 {
- for j := 0; j < containerLen; j++ {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- mk = dd.DecodeFloat(false)
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- if mapGet {
- mv = v[mk]
- } else {
- mv = nil
- }
- d.decode(&mv)
- if v != nil {
- v[mk] = mv
- }
- }
- } else if containerLen < 0 {
- for j := 0; !dd.CheckBreak(); j++ {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- mk = dd.DecodeFloat(false)
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- if mapGet {
- mv = v[mk]
- } else {
- mv = nil
- }
- d.decode(&mv)
- if v != nil {
- v[mk] = mv
- }
- }
- }
- if cr != nil {
- cr.sendContainerState(containerMapEnd)
- }
- return v, changed
-}
-
-func (f *decFnInfo) fastpathDecMapFloat64StringR(rv reflect.Value) {
- if rv.CanAddr() {
- vp := rv.Addr().Interface().(*map[float64]string)
- v, changed := fastpathTV.DecMapFloat64StringV(*vp, fastpathCheckNilFalse, true, f.d)
- if changed {
- *vp = v
- }
- } else {
- v := rv.Interface().(map[float64]string)
- fastpathTV.DecMapFloat64StringV(v, fastpathCheckNilFalse, false, f.d)
- }
-}
-func (f fastpathT) DecMapFloat64StringX(vp *map[float64]string, checkNil bool, d *Decoder) {
- v, changed := f.DecMapFloat64StringV(*vp, checkNil, true, d)
- if changed {
- *vp = v
- }
-}
-func (_ fastpathT) DecMapFloat64StringV(v map[float64]string, checkNil bool, canChange bool,
- d *Decoder) (_ map[float64]string, changed bool) {
- dd := d.d
- cr := d.cr
-
- if checkNil && dd.TryDecodeAsNil() {
- if v != nil {
- changed = true
- }
- return nil, changed
- }
-
- containerLen := dd.ReadMapStart()
- if canChange && v == nil {
- xlen, _ := decInferLen(containerLen, d.h.MaxInitLen, 24)
- v = make(map[float64]string, xlen)
- changed = true
- }
-
- var mk float64
- var mv string
- if containerLen > 0 {
- for j := 0; j < containerLen; j++ {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- mk = dd.DecodeFloat(false)
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- mv = dd.DecodeString()
- if v != nil {
- v[mk] = mv
- }
- }
- } else if containerLen < 0 {
- for j := 0; !dd.CheckBreak(); j++ {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- mk = dd.DecodeFloat(false)
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- mv = dd.DecodeString()
- if v != nil {
- v[mk] = mv
- }
- }
- }
- if cr != nil {
- cr.sendContainerState(containerMapEnd)
- }
- return v, changed
-}
-
-func (f *decFnInfo) fastpathDecMapFloat64UintR(rv reflect.Value) {
- if rv.CanAddr() {
- vp := rv.Addr().Interface().(*map[float64]uint)
- v, changed := fastpathTV.DecMapFloat64UintV(*vp, fastpathCheckNilFalse, true, f.d)
- if changed {
- *vp = v
- }
- } else {
- v := rv.Interface().(map[float64]uint)
- fastpathTV.DecMapFloat64UintV(v, fastpathCheckNilFalse, false, f.d)
- }
-}
-func (f fastpathT) DecMapFloat64UintX(vp *map[float64]uint, checkNil bool, d *Decoder) {
- v, changed := f.DecMapFloat64UintV(*vp, checkNil, true, d)
- if changed {
- *vp = v
- }
-}
-func (_ fastpathT) DecMapFloat64UintV(v map[float64]uint, checkNil bool, canChange bool,
- d *Decoder) (_ map[float64]uint, changed bool) {
- dd := d.d
- cr := d.cr
-
- if checkNil && dd.TryDecodeAsNil() {
- if v != nil {
- changed = true
- }
- return nil, changed
- }
-
- containerLen := dd.ReadMapStart()
- if canChange && v == nil {
- xlen, _ := decInferLen(containerLen, d.h.MaxInitLen, 16)
- v = make(map[float64]uint, xlen)
- changed = true
- }
-
- var mk float64
- var mv uint
- if containerLen > 0 {
- for j := 0; j < containerLen; j++ {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- mk = dd.DecodeFloat(false)
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- mv = uint(dd.DecodeUint(uintBitsize))
- if v != nil {
- v[mk] = mv
- }
- }
- } else if containerLen < 0 {
- for j := 0; !dd.CheckBreak(); j++ {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- mk = dd.DecodeFloat(false)
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- mv = uint(dd.DecodeUint(uintBitsize))
- if v != nil {
- v[mk] = mv
- }
- }
- }
- if cr != nil {
- cr.sendContainerState(containerMapEnd)
- }
- return v, changed
-}
-
-func (f *decFnInfo) fastpathDecMapFloat64Uint8R(rv reflect.Value) {
- if rv.CanAddr() {
- vp := rv.Addr().Interface().(*map[float64]uint8)
- v, changed := fastpathTV.DecMapFloat64Uint8V(*vp, fastpathCheckNilFalse, true, f.d)
- if changed {
- *vp = v
- }
- } else {
- v := rv.Interface().(map[float64]uint8)
- fastpathTV.DecMapFloat64Uint8V(v, fastpathCheckNilFalse, false, f.d)
- }
-}
-func (f fastpathT) DecMapFloat64Uint8X(vp *map[float64]uint8, checkNil bool, d *Decoder) {
- v, changed := f.DecMapFloat64Uint8V(*vp, checkNil, true, d)
- if changed {
- *vp = v
- }
-}
-func (_ fastpathT) DecMapFloat64Uint8V(v map[float64]uint8, checkNil bool, canChange bool,
- d *Decoder) (_ map[float64]uint8, changed bool) {
- dd := d.d
- cr := d.cr
-
- if checkNil && dd.TryDecodeAsNil() {
- if v != nil {
- changed = true
- }
- return nil, changed
- }
-
- containerLen := dd.ReadMapStart()
- if canChange && v == nil {
- xlen, _ := decInferLen(containerLen, d.h.MaxInitLen, 9)
- v = make(map[float64]uint8, xlen)
- changed = true
- }
-
- var mk float64
- var mv uint8
- if containerLen > 0 {
- for j := 0; j < containerLen; j++ {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- mk = dd.DecodeFloat(false)
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- mv = uint8(dd.DecodeUint(8))
- if v != nil {
- v[mk] = mv
- }
- }
- } else if containerLen < 0 {
- for j := 0; !dd.CheckBreak(); j++ {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- mk = dd.DecodeFloat(false)
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- mv = uint8(dd.DecodeUint(8))
- if v != nil {
- v[mk] = mv
- }
- }
- }
- if cr != nil {
- cr.sendContainerState(containerMapEnd)
- }
- return v, changed
-}
-
-func (f *decFnInfo) fastpathDecMapFloat64Uint16R(rv reflect.Value) {
- if rv.CanAddr() {
- vp := rv.Addr().Interface().(*map[float64]uint16)
- v, changed := fastpathTV.DecMapFloat64Uint16V(*vp, fastpathCheckNilFalse, true, f.d)
- if changed {
- *vp = v
- }
- } else {
- v := rv.Interface().(map[float64]uint16)
- fastpathTV.DecMapFloat64Uint16V(v, fastpathCheckNilFalse, false, f.d)
- }
-}
-func (f fastpathT) DecMapFloat64Uint16X(vp *map[float64]uint16, checkNil bool, d *Decoder) {
- v, changed := f.DecMapFloat64Uint16V(*vp, checkNil, true, d)
- if changed {
- *vp = v
- }
-}
-func (_ fastpathT) DecMapFloat64Uint16V(v map[float64]uint16, checkNil bool, canChange bool,
- d *Decoder) (_ map[float64]uint16, changed bool) {
- dd := d.d
- cr := d.cr
-
- if checkNil && dd.TryDecodeAsNil() {
- if v != nil {
- changed = true
- }
- return nil, changed
- }
-
- containerLen := dd.ReadMapStart()
- if canChange && v == nil {
- xlen, _ := decInferLen(containerLen, d.h.MaxInitLen, 10)
- v = make(map[float64]uint16, xlen)
- changed = true
- }
-
- var mk float64
- var mv uint16
- if containerLen > 0 {
- for j := 0; j < containerLen; j++ {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- mk = dd.DecodeFloat(false)
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- mv = uint16(dd.DecodeUint(16))
- if v != nil {
- v[mk] = mv
- }
- }
- } else if containerLen < 0 {
- for j := 0; !dd.CheckBreak(); j++ {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- mk = dd.DecodeFloat(false)
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- mv = uint16(dd.DecodeUint(16))
- if v != nil {
- v[mk] = mv
- }
- }
- }
- if cr != nil {
- cr.sendContainerState(containerMapEnd)
- }
- return v, changed
-}
-
-func (f *decFnInfo) fastpathDecMapFloat64Uint32R(rv reflect.Value) {
- if rv.CanAddr() {
- vp := rv.Addr().Interface().(*map[float64]uint32)
- v, changed := fastpathTV.DecMapFloat64Uint32V(*vp, fastpathCheckNilFalse, true, f.d)
- if changed {
- *vp = v
- }
- } else {
- v := rv.Interface().(map[float64]uint32)
- fastpathTV.DecMapFloat64Uint32V(v, fastpathCheckNilFalse, false, f.d)
- }
-}
-func (f fastpathT) DecMapFloat64Uint32X(vp *map[float64]uint32, checkNil bool, d *Decoder) {
- v, changed := f.DecMapFloat64Uint32V(*vp, checkNil, true, d)
- if changed {
- *vp = v
- }
-}
-func (_ fastpathT) DecMapFloat64Uint32V(v map[float64]uint32, checkNil bool, canChange bool,
- d *Decoder) (_ map[float64]uint32, changed bool) {
- dd := d.d
- cr := d.cr
-
- if checkNil && dd.TryDecodeAsNil() {
- if v != nil {
- changed = true
- }
- return nil, changed
- }
-
- containerLen := dd.ReadMapStart()
- if canChange && v == nil {
- xlen, _ := decInferLen(containerLen, d.h.MaxInitLen, 12)
- v = make(map[float64]uint32, xlen)
- changed = true
- }
-
- var mk float64
- var mv uint32
- if containerLen > 0 {
- for j := 0; j < containerLen; j++ {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- mk = dd.DecodeFloat(false)
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- mv = uint32(dd.DecodeUint(32))
- if v != nil {
- v[mk] = mv
- }
- }
- } else if containerLen < 0 {
- for j := 0; !dd.CheckBreak(); j++ {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- mk = dd.DecodeFloat(false)
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- mv = uint32(dd.DecodeUint(32))
- if v != nil {
- v[mk] = mv
- }
- }
- }
- if cr != nil {
- cr.sendContainerState(containerMapEnd)
- }
- return v, changed
-}
-
-func (f *decFnInfo) fastpathDecMapFloat64Uint64R(rv reflect.Value) {
- if rv.CanAddr() {
- vp := rv.Addr().Interface().(*map[float64]uint64)
- v, changed := fastpathTV.DecMapFloat64Uint64V(*vp, fastpathCheckNilFalse, true, f.d)
- if changed {
- *vp = v
- }
- } else {
- v := rv.Interface().(map[float64]uint64)
- fastpathTV.DecMapFloat64Uint64V(v, fastpathCheckNilFalse, false, f.d)
- }
-}
-func (f fastpathT) DecMapFloat64Uint64X(vp *map[float64]uint64, checkNil bool, d *Decoder) {
- v, changed := f.DecMapFloat64Uint64V(*vp, checkNil, true, d)
- if changed {
- *vp = v
- }
-}
-func (_ fastpathT) DecMapFloat64Uint64V(v map[float64]uint64, checkNil bool, canChange bool,
- d *Decoder) (_ map[float64]uint64, changed bool) {
- dd := d.d
- cr := d.cr
-
- if checkNil && dd.TryDecodeAsNil() {
- if v != nil {
- changed = true
- }
- return nil, changed
- }
-
- containerLen := dd.ReadMapStart()
- if canChange && v == nil {
- xlen, _ := decInferLen(containerLen, d.h.MaxInitLen, 16)
- v = make(map[float64]uint64, xlen)
- changed = true
- }
-
- var mk float64
- var mv uint64
- if containerLen > 0 {
- for j := 0; j < containerLen; j++ {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- mk = dd.DecodeFloat(false)
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- mv = dd.DecodeUint(64)
- if v != nil {
- v[mk] = mv
- }
- }
- } else if containerLen < 0 {
- for j := 0; !dd.CheckBreak(); j++ {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- mk = dd.DecodeFloat(false)
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- mv = dd.DecodeUint(64)
- if v != nil {
- v[mk] = mv
- }
- }
- }
- if cr != nil {
- cr.sendContainerState(containerMapEnd)
- }
- return v, changed
-}
-
-func (f *decFnInfo) fastpathDecMapFloat64UintptrR(rv reflect.Value) {
- if rv.CanAddr() {
- vp := rv.Addr().Interface().(*map[float64]uintptr)
- v, changed := fastpathTV.DecMapFloat64UintptrV(*vp, fastpathCheckNilFalse, true, f.d)
- if changed {
- *vp = v
- }
- } else {
- v := rv.Interface().(map[float64]uintptr)
- fastpathTV.DecMapFloat64UintptrV(v, fastpathCheckNilFalse, false, f.d)
- }
-}
-func (f fastpathT) DecMapFloat64UintptrX(vp *map[float64]uintptr, checkNil bool, d *Decoder) {
- v, changed := f.DecMapFloat64UintptrV(*vp, checkNil, true, d)
- if changed {
- *vp = v
- }
-}
-func (_ fastpathT) DecMapFloat64UintptrV(v map[float64]uintptr, checkNil bool, canChange bool,
- d *Decoder) (_ map[float64]uintptr, changed bool) {
- dd := d.d
- cr := d.cr
-
- if checkNil && dd.TryDecodeAsNil() {
- if v != nil {
- changed = true
- }
- return nil, changed
- }
-
- containerLen := dd.ReadMapStart()
- if canChange && v == nil {
- xlen, _ := decInferLen(containerLen, d.h.MaxInitLen, 16)
- v = make(map[float64]uintptr, xlen)
- changed = true
- }
-
- var mk float64
- var mv uintptr
- if containerLen > 0 {
- for j := 0; j < containerLen; j++ {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- mk = dd.DecodeFloat(false)
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- mv = uintptr(dd.DecodeUint(uintBitsize))
- if v != nil {
- v[mk] = mv
- }
- }
- } else if containerLen < 0 {
- for j := 0; !dd.CheckBreak(); j++ {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- mk = dd.DecodeFloat(false)
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- mv = uintptr(dd.DecodeUint(uintBitsize))
- if v != nil {
- v[mk] = mv
- }
- }
- }
- if cr != nil {
- cr.sendContainerState(containerMapEnd)
- }
- return v, changed
-}
-
-func (f *decFnInfo) fastpathDecMapFloat64IntR(rv reflect.Value) {
- if rv.CanAddr() {
- vp := rv.Addr().Interface().(*map[float64]int)
- v, changed := fastpathTV.DecMapFloat64IntV(*vp, fastpathCheckNilFalse, true, f.d)
- if changed {
- *vp = v
- }
- } else {
- v := rv.Interface().(map[float64]int)
- fastpathTV.DecMapFloat64IntV(v, fastpathCheckNilFalse, false, f.d)
- }
-}
-func (f fastpathT) DecMapFloat64IntX(vp *map[float64]int, checkNil bool, d *Decoder) {
- v, changed := f.DecMapFloat64IntV(*vp, checkNil, true, d)
- if changed {
- *vp = v
- }
-}
-func (_ fastpathT) DecMapFloat64IntV(v map[float64]int, checkNil bool, canChange bool,
- d *Decoder) (_ map[float64]int, changed bool) {
- dd := d.d
- cr := d.cr
-
- if checkNil && dd.TryDecodeAsNil() {
- if v != nil {
- changed = true
- }
- return nil, changed
- }
-
- containerLen := dd.ReadMapStart()
- if canChange && v == nil {
- xlen, _ := decInferLen(containerLen, d.h.MaxInitLen, 16)
- v = make(map[float64]int, xlen)
- changed = true
- }
-
- var mk float64
- var mv int
- if containerLen > 0 {
- for j := 0; j < containerLen; j++ {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- mk = dd.DecodeFloat(false)
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- mv = int(dd.DecodeInt(intBitsize))
- if v != nil {
- v[mk] = mv
- }
- }
- } else if containerLen < 0 {
- for j := 0; !dd.CheckBreak(); j++ {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- mk = dd.DecodeFloat(false)
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- mv = int(dd.DecodeInt(intBitsize))
- if v != nil {
- v[mk] = mv
- }
- }
- }
- if cr != nil {
- cr.sendContainerState(containerMapEnd)
- }
- return v, changed
-}
-
-func (f *decFnInfo) fastpathDecMapFloat64Int8R(rv reflect.Value) {
- if rv.CanAddr() {
- vp := rv.Addr().Interface().(*map[float64]int8)
- v, changed := fastpathTV.DecMapFloat64Int8V(*vp, fastpathCheckNilFalse, true, f.d)
- if changed {
- *vp = v
- }
- } else {
- v := rv.Interface().(map[float64]int8)
- fastpathTV.DecMapFloat64Int8V(v, fastpathCheckNilFalse, false, f.d)
- }
-}
-func (f fastpathT) DecMapFloat64Int8X(vp *map[float64]int8, checkNil bool, d *Decoder) {
- v, changed := f.DecMapFloat64Int8V(*vp, checkNil, true, d)
- if changed {
- *vp = v
- }
-}
-func (_ fastpathT) DecMapFloat64Int8V(v map[float64]int8, checkNil bool, canChange bool,
- d *Decoder) (_ map[float64]int8, changed bool) {
- dd := d.d
- cr := d.cr
-
- if checkNil && dd.TryDecodeAsNil() {
- if v != nil {
- changed = true
- }
- return nil, changed
- }
-
- containerLen := dd.ReadMapStart()
- if canChange && v == nil {
- xlen, _ := decInferLen(containerLen, d.h.MaxInitLen, 9)
- v = make(map[float64]int8, xlen)
- changed = true
- }
-
- var mk float64
- var mv int8
- if containerLen > 0 {
- for j := 0; j < containerLen; j++ {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- mk = dd.DecodeFloat(false)
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- mv = int8(dd.DecodeInt(8))
- if v != nil {
- v[mk] = mv
- }
- }
- } else if containerLen < 0 {
- for j := 0; !dd.CheckBreak(); j++ {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- mk = dd.DecodeFloat(false)
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- mv = int8(dd.DecodeInt(8))
- if v != nil {
- v[mk] = mv
- }
- }
- }
- if cr != nil {
- cr.sendContainerState(containerMapEnd)
- }
- return v, changed
-}
-
-func (f *decFnInfo) fastpathDecMapFloat64Int16R(rv reflect.Value) {
- if rv.CanAddr() {
- vp := rv.Addr().Interface().(*map[float64]int16)
- v, changed := fastpathTV.DecMapFloat64Int16V(*vp, fastpathCheckNilFalse, true, f.d)
- if changed {
- *vp = v
- }
- } else {
- v := rv.Interface().(map[float64]int16)
- fastpathTV.DecMapFloat64Int16V(v, fastpathCheckNilFalse, false, f.d)
- }
-}
-func (f fastpathT) DecMapFloat64Int16X(vp *map[float64]int16, checkNil bool, d *Decoder) {
- v, changed := f.DecMapFloat64Int16V(*vp, checkNil, true, d)
- if changed {
- *vp = v
- }
-}
-func (_ fastpathT) DecMapFloat64Int16V(v map[float64]int16, checkNil bool, canChange bool,
- d *Decoder) (_ map[float64]int16, changed bool) {
- dd := d.d
- cr := d.cr
-
- if checkNil && dd.TryDecodeAsNil() {
- if v != nil {
- changed = true
- }
- return nil, changed
- }
-
- containerLen := dd.ReadMapStart()
- if canChange && v == nil {
- xlen, _ := decInferLen(containerLen, d.h.MaxInitLen, 10)
- v = make(map[float64]int16, xlen)
- changed = true
- }
-
- var mk float64
- var mv int16
- if containerLen > 0 {
- for j := 0; j < containerLen; j++ {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- mk = dd.DecodeFloat(false)
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- mv = int16(dd.DecodeInt(16))
- if v != nil {
- v[mk] = mv
- }
- }
- } else if containerLen < 0 {
- for j := 0; !dd.CheckBreak(); j++ {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- mk = dd.DecodeFloat(false)
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- mv = int16(dd.DecodeInt(16))
- if v != nil {
- v[mk] = mv
- }
- }
- }
- if cr != nil {
- cr.sendContainerState(containerMapEnd)
- }
- return v, changed
-}
-
-func (f *decFnInfo) fastpathDecMapFloat64Int32R(rv reflect.Value) {
- if rv.CanAddr() {
- vp := rv.Addr().Interface().(*map[float64]int32)
- v, changed := fastpathTV.DecMapFloat64Int32V(*vp, fastpathCheckNilFalse, true, f.d)
- if changed {
- *vp = v
- }
- } else {
- v := rv.Interface().(map[float64]int32)
- fastpathTV.DecMapFloat64Int32V(v, fastpathCheckNilFalse, false, f.d)
- }
-}
-func (f fastpathT) DecMapFloat64Int32X(vp *map[float64]int32, checkNil bool, d *Decoder) {
- v, changed := f.DecMapFloat64Int32V(*vp, checkNil, true, d)
- if changed {
- *vp = v
- }
-}
-func (_ fastpathT) DecMapFloat64Int32V(v map[float64]int32, checkNil bool, canChange bool,
- d *Decoder) (_ map[float64]int32, changed bool) {
- dd := d.d
- cr := d.cr
-
- if checkNil && dd.TryDecodeAsNil() {
- if v != nil {
- changed = true
- }
- return nil, changed
- }
-
- containerLen := dd.ReadMapStart()
- if canChange && v == nil {
- xlen, _ := decInferLen(containerLen, d.h.MaxInitLen, 12)
- v = make(map[float64]int32, xlen)
- changed = true
- }
-
- var mk float64
- var mv int32
- if containerLen > 0 {
- for j := 0; j < containerLen; j++ {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- mk = dd.DecodeFloat(false)
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- mv = int32(dd.DecodeInt(32))
- if v != nil {
- v[mk] = mv
- }
- }
- } else if containerLen < 0 {
- for j := 0; !dd.CheckBreak(); j++ {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- mk = dd.DecodeFloat(false)
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- mv = int32(dd.DecodeInt(32))
- if v != nil {
- v[mk] = mv
- }
- }
- }
- if cr != nil {
- cr.sendContainerState(containerMapEnd)
- }
- return v, changed
-}
-
-func (f *decFnInfo) fastpathDecMapFloat64Int64R(rv reflect.Value) {
- if rv.CanAddr() {
- vp := rv.Addr().Interface().(*map[float64]int64)
- v, changed := fastpathTV.DecMapFloat64Int64V(*vp, fastpathCheckNilFalse, true, f.d)
- if changed {
- *vp = v
- }
- } else {
- v := rv.Interface().(map[float64]int64)
- fastpathTV.DecMapFloat64Int64V(v, fastpathCheckNilFalse, false, f.d)
- }
-}
-func (f fastpathT) DecMapFloat64Int64X(vp *map[float64]int64, checkNil bool, d *Decoder) {
- v, changed := f.DecMapFloat64Int64V(*vp, checkNil, true, d)
- if changed {
- *vp = v
- }
-}
-func (_ fastpathT) DecMapFloat64Int64V(v map[float64]int64, checkNil bool, canChange bool,
- d *Decoder) (_ map[float64]int64, changed bool) {
- dd := d.d
- cr := d.cr
-
- if checkNil && dd.TryDecodeAsNil() {
- if v != nil {
- changed = true
- }
- return nil, changed
- }
-
- containerLen := dd.ReadMapStart()
- if canChange && v == nil {
- xlen, _ := decInferLen(containerLen, d.h.MaxInitLen, 16)
- v = make(map[float64]int64, xlen)
- changed = true
- }
-
- var mk float64
- var mv int64
- if containerLen > 0 {
- for j := 0; j < containerLen; j++ {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- mk = dd.DecodeFloat(false)
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- mv = dd.DecodeInt(64)
- if v != nil {
- v[mk] = mv
- }
- }
- } else if containerLen < 0 {
- for j := 0; !dd.CheckBreak(); j++ {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- mk = dd.DecodeFloat(false)
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- mv = dd.DecodeInt(64)
- if v != nil {
- v[mk] = mv
- }
- }
- }
- if cr != nil {
- cr.sendContainerState(containerMapEnd)
- }
- return v, changed
-}
-
-func (f *decFnInfo) fastpathDecMapFloat64Float32R(rv reflect.Value) {
- if rv.CanAddr() {
- vp := rv.Addr().Interface().(*map[float64]float32)
- v, changed := fastpathTV.DecMapFloat64Float32V(*vp, fastpathCheckNilFalse, true, f.d)
- if changed {
- *vp = v
- }
- } else {
- v := rv.Interface().(map[float64]float32)
- fastpathTV.DecMapFloat64Float32V(v, fastpathCheckNilFalse, false, f.d)
- }
-}
-func (f fastpathT) DecMapFloat64Float32X(vp *map[float64]float32, checkNil bool, d *Decoder) {
- v, changed := f.DecMapFloat64Float32V(*vp, checkNil, true, d)
- if changed {
- *vp = v
- }
-}
-func (_ fastpathT) DecMapFloat64Float32V(v map[float64]float32, checkNil bool, canChange bool,
- d *Decoder) (_ map[float64]float32, changed bool) {
- dd := d.d
- cr := d.cr
-
- if checkNil && dd.TryDecodeAsNil() {
- if v != nil {
- changed = true
- }
- return nil, changed
- }
-
- containerLen := dd.ReadMapStart()
- if canChange && v == nil {
- xlen, _ := decInferLen(containerLen, d.h.MaxInitLen, 12)
- v = make(map[float64]float32, xlen)
- changed = true
- }
-
- var mk float64
- var mv float32
- if containerLen > 0 {
- for j := 0; j < containerLen; j++ {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- mk = dd.DecodeFloat(false)
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- mv = float32(dd.DecodeFloat(true))
- if v != nil {
- v[mk] = mv
- }
- }
- } else if containerLen < 0 {
- for j := 0; !dd.CheckBreak(); j++ {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- mk = dd.DecodeFloat(false)
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- mv = float32(dd.DecodeFloat(true))
- if v != nil {
- v[mk] = mv
- }
- }
- }
- if cr != nil {
- cr.sendContainerState(containerMapEnd)
- }
- return v, changed
-}
-
-func (f *decFnInfo) fastpathDecMapFloat64Float64R(rv reflect.Value) {
- if rv.CanAddr() {
- vp := rv.Addr().Interface().(*map[float64]float64)
- v, changed := fastpathTV.DecMapFloat64Float64V(*vp, fastpathCheckNilFalse, true, f.d)
- if changed {
- *vp = v
- }
- } else {
- v := rv.Interface().(map[float64]float64)
- fastpathTV.DecMapFloat64Float64V(v, fastpathCheckNilFalse, false, f.d)
- }
-}
-func (f fastpathT) DecMapFloat64Float64X(vp *map[float64]float64, checkNil bool, d *Decoder) {
- v, changed := f.DecMapFloat64Float64V(*vp, checkNil, true, d)
- if changed {
- *vp = v
- }
-}
-func (_ fastpathT) DecMapFloat64Float64V(v map[float64]float64, checkNil bool, canChange bool,
- d *Decoder) (_ map[float64]float64, changed bool) {
- dd := d.d
- cr := d.cr
-
- if checkNil && dd.TryDecodeAsNil() {
- if v != nil {
- changed = true
- }
- return nil, changed
- }
-
- containerLen := dd.ReadMapStart()
- if canChange && v == nil {
- xlen, _ := decInferLen(containerLen, d.h.MaxInitLen, 16)
- v = make(map[float64]float64, xlen)
- changed = true
- }
-
- var mk float64
- var mv float64
- if containerLen > 0 {
- for j := 0; j < containerLen; j++ {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- mk = dd.DecodeFloat(false)
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- mv = dd.DecodeFloat(false)
- if v != nil {
- v[mk] = mv
- }
- }
- } else if containerLen < 0 {
- for j := 0; !dd.CheckBreak(); j++ {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- mk = dd.DecodeFloat(false)
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- mv = dd.DecodeFloat(false)
- if v != nil {
- v[mk] = mv
- }
- }
- }
- if cr != nil {
- cr.sendContainerState(containerMapEnd)
- }
- return v, changed
-}
-
-func (f *decFnInfo) fastpathDecMapFloat64BoolR(rv reflect.Value) {
- if rv.CanAddr() {
- vp := rv.Addr().Interface().(*map[float64]bool)
- v, changed := fastpathTV.DecMapFloat64BoolV(*vp, fastpathCheckNilFalse, true, f.d)
- if changed {
- *vp = v
- }
- } else {
- v := rv.Interface().(map[float64]bool)
- fastpathTV.DecMapFloat64BoolV(v, fastpathCheckNilFalse, false, f.d)
- }
-}
-func (f fastpathT) DecMapFloat64BoolX(vp *map[float64]bool, checkNil bool, d *Decoder) {
- v, changed := f.DecMapFloat64BoolV(*vp, checkNil, true, d)
- if changed {
- *vp = v
- }
-}
-func (_ fastpathT) DecMapFloat64BoolV(v map[float64]bool, checkNil bool, canChange bool,
- d *Decoder) (_ map[float64]bool, changed bool) {
- dd := d.d
- cr := d.cr
-
- if checkNil && dd.TryDecodeAsNil() {
- if v != nil {
- changed = true
- }
- return nil, changed
- }
-
- containerLen := dd.ReadMapStart()
- if canChange && v == nil {
- xlen, _ := decInferLen(containerLen, d.h.MaxInitLen, 9)
- v = make(map[float64]bool, xlen)
- changed = true
- }
-
- var mk float64
- var mv bool
- if containerLen > 0 {
- for j := 0; j < containerLen; j++ {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- mk = dd.DecodeFloat(false)
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- mv = dd.DecodeBool()
- if v != nil {
- v[mk] = mv
- }
- }
- } else if containerLen < 0 {
- for j := 0; !dd.CheckBreak(); j++ {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- mk = dd.DecodeFloat(false)
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- mv = dd.DecodeBool()
- if v != nil {
- v[mk] = mv
- }
- }
- }
- if cr != nil {
- cr.sendContainerState(containerMapEnd)
- }
- return v, changed
-}
-
-func (f *decFnInfo) fastpathDecMapUintIntfR(rv reflect.Value) {
- if rv.CanAddr() {
- vp := rv.Addr().Interface().(*map[uint]interface{})
- v, changed := fastpathTV.DecMapUintIntfV(*vp, fastpathCheckNilFalse, true, f.d)
- if changed {
- *vp = v
- }
- } else {
- v := rv.Interface().(map[uint]interface{})
- fastpathTV.DecMapUintIntfV(v, fastpathCheckNilFalse, false, f.d)
- }
-}
-func (f fastpathT) DecMapUintIntfX(vp *map[uint]interface{}, checkNil bool, d *Decoder) {
- v, changed := f.DecMapUintIntfV(*vp, checkNil, true, d)
- if changed {
- *vp = v
- }
-}
-func (_ fastpathT) DecMapUintIntfV(v map[uint]interface{}, checkNil bool, canChange bool,
- d *Decoder) (_ map[uint]interface{}, changed bool) {
- dd := d.d
- cr := d.cr
-
- if checkNil && dd.TryDecodeAsNil() {
- if v != nil {
- changed = true
- }
- return nil, changed
- }
-
- containerLen := dd.ReadMapStart()
- if canChange && v == nil {
- xlen, _ := decInferLen(containerLen, d.h.MaxInitLen, 24)
- v = make(map[uint]interface{}, xlen)
- changed = true
- }
- mapGet := !d.h.MapValueReset && !d.h.InterfaceReset
- var mk uint
- var mv interface{}
- if containerLen > 0 {
- for j := 0; j < containerLen; j++ {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- mk = uint(dd.DecodeUint(uintBitsize))
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- if mapGet {
- mv = v[mk]
- } else {
- mv = nil
- }
- d.decode(&mv)
- if v != nil {
- v[mk] = mv
- }
- }
- } else if containerLen < 0 {
- for j := 0; !dd.CheckBreak(); j++ {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- mk = uint(dd.DecodeUint(uintBitsize))
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- if mapGet {
- mv = v[mk]
- } else {
- mv = nil
- }
- d.decode(&mv)
- if v != nil {
- v[mk] = mv
- }
- }
- }
- if cr != nil {
- cr.sendContainerState(containerMapEnd)
- }
- return v, changed
-}
-
-func (f *decFnInfo) fastpathDecMapUintStringR(rv reflect.Value) {
- if rv.CanAddr() {
- vp := rv.Addr().Interface().(*map[uint]string)
- v, changed := fastpathTV.DecMapUintStringV(*vp, fastpathCheckNilFalse, true, f.d)
- if changed {
- *vp = v
- }
- } else {
- v := rv.Interface().(map[uint]string)
- fastpathTV.DecMapUintStringV(v, fastpathCheckNilFalse, false, f.d)
- }
-}
-func (f fastpathT) DecMapUintStringX(vp *map[uint]string, checkNil bool, d *Decoder) {
- v, changed := f.DecMapUintStringV(*vp, checkNil, true, d)
- if changed {
- *vp = v
- }
-}
-func (_ fastpathT) DecMapUintStringV(v map[uint]string, checkNil bool, canChange bool,
- d *Decoder) (_ map[uint]string, changed bool) {
- dd := d.d
- cr := d.cr
-
- if checkNil && dd.TryDecodeAsNil() {
- if v != nil {
- changed = true
- }
- return nil, changed
- }
-
- containerLen := dd.ReadMapStart()
- if canChange && v == nil {
- xlen, _ := decInferLen(containerLen, d.h.MaxInitLen, 24)
- v = make(map[uint]string, xlen)
- changed = true
- }
-
- var mk uint
- var mv string
- if containerLen > 0 {
- for j := 0; j < containerLen; j++ {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- mk = uint(dd.DecodeUint(uintBitsize))
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- mv = dd.DecodeString()
- if v != nil {
- v[mk] = mv
- }
- }
- } else if containerLen < 0 {
- for j := 0; !dd.CheckBreak(); j++ {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- mk = uint(dd.DecodeUint(uintBitsize))
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- mv = dd.DecodeString()
- if v != nil {
- v[mk] = mv
- }
- }
- }
- if cr != nil {
- cr.sendContainerState(containerMapEnd)
- }
- return v, changed
-}
-
-func (f *decFnInfo) fastpathDecMapUintUintR(rv reflect.Value) {
- if rv.CanAddr() {
- vp := rv.Addr().Interface().(*map[uint]uint)
- v, changed := fastpathTV.DecMapUintUintV(*vp, fastpathCheckNilFalse, true, f.d)
- if changed {
- *vp = v
- }
- } else {
- v := rv.Interface().(map[uint]uint)
- fastpathTV.DecMapUintUintV(v, fastpathCheckNilFalse, false, f.d)
- }
-}
-func (f fastpathT) DecMapUintUintX(vp *map[uint]uint, checkNil bool, d *Decoder) {
- v, changed := f.DecMapUintUintV(*vp, checkNil, true, d)
- if changed {
- *vp = v
- }
-}
-func (_ fastpathT) DecMapUintUintV(v map[uint]uint, checkNil bool, canChange bool,
- d *Decoder) (_ map[uint]uint, changed bool) {
- dd := d.d
- cr := d.cr
-
- if checkNil && dd.TryDecodeAsNil() {
- if v != nil {
- changed = true
- }
- return nil, changed
- }
-
- containerLen := dd.ReadMapStart()
- if canChange && v == nil {
- xlen, _ := decInferLen(containerLen, d.h.MaxInitLen, 16)
- v = make(map[uint]uint, xlen)
- changed = true
- }
-
- var mk uint
- var mv uint
- if containerLen > 0 {
- for j := 0; j < containerLen; j++ {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- mk = uint(dd.DecodeUint(uintBitsize))
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- mv = uint(dd.DecodeUint(uintBitsize))
- if v != nil {
- v[mk] = mv
- }
- }
- } else if containerLen < 0 {
- for j := 0; !dd.CheckBreak(); j++ {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- mk = uint(dd.DecodeUint(uintBitsize))
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- mv = uint(dd.DecodeUint(uintBitsize))
- if v != nil {
- v[mk] = mv
- }
- }
- }
- if cr != nil {
- cr.sendContainerState(containerMapEnd)
- }
- return v, changed
-}
-
-func (f *decFnInfo) fastpathDecMapUintUint8R(rv reflect.Value) {
- if rv.CanAddr() {
- vp := rv.Addr().Interface().(*map[uint]uint8)
- v, changed := fastpathTV.DecMapUintUint8V(*vp, fastpathCheckNilFalse, true, f.d)
- if changed {
- *vp = v
- }
- } else {
- v := rv.Interface().(map[uint]uint8)
- fastpathTV.DecMapUintUint8V(v, fastpathCheckNilFalse, false, f.d)
- }
-}
-func (f fastpathT) DecMapUintUint8X(vp *map[uint]uint8, checkNil bool, d *Decoder) {
- v, changed := f.DecMapUintUint8V(*vp, checkNil, true, d)
- if changed {
- *vp = v
- }
-}
-func (_ fastpathT) DecMapUintUint8V(v map[uint]uint8, checkNil bool, canChange bool,
- d *Decoder) (_ map[uint]uint8, changed bool) {
- dd := d.d
- cr := d.cr
-
- if checkNil && dd.TryDecodeAsNil() {
- if v != nil {
- changed = true
- }
- return nil, changed
- }
-
- containerLen := dd.ReadMapStart()
- if canChange && v == nil {
- xlen, _ := decInferLen(containerLen, d.h.MaxInitLen, 9)
- v = make(map[uint]uint8, xlen)
- changed = true
- }
-
- var mk uint
- var mv uint8
- if containerLen > 0 {
- for j := 0; j < containerLen; j++ {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- mk = uint(dd.DecodeUint(uintBitsize))
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- mv = uint8(dd.DecodeUint(8))
- if v != nil {
- v[mk] = mv
- }
- }
- } else if containerLen < 0 {
- for j := 0; !dd.CheckBreak(); j++ {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- mk = uint(dd.DecodeUint(uintBitsize))
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- mv = uint8(dd.DecodeUint(8))
- if v != nil {
- v[mk] = mv
- }
- }
- }
- if cr != nil {
- cr.sendContainerState(containerMapEnd)
- }
- return v, changed
-}
-
-func (f *decFnInfo) fastpathDecMapUintUint16R(rv reflect.Value) {
- if rv.CanAddr() {
- vp := rv.Addr().Interface().(*map[uint]uint16)
- v, changed := fastpathTV.DecMapUintUint16V(*vp, fastpathCheckNilFalse, true, f.d)
- if changed {
- *vp = v
- }
- } else {
- v := rv.Interface().(map[uint]uint16)
- fastpathTV.DecMapUintUint16V(v, fastpathCheckNilFalse, false, f.d)
- }
-}
-func (f fastpathT) DecMapUintUint16X(vp *map[uint]uint16, checkNil bool, d *Decoder) {
- v, changed := f.DecMapUintUint16V(*vp, checkNil, true, d)
- if changed {
- *vp = v
- }
-}
-func (_ fastpathT) DecMapUintUint16V(v map[uint]uint16, checkNil bool, canChange bool,
- d *Decoder) (_ map[uint]uint16, changed bool) {
- dd := d.d
- cr := d.cr
-
- if checkNil && dd.TryDecodeAsNil() {
- if v != nil {
- changed = true
- }
- return nil, changed
- }
-
- containerLen := dd.ReadMapStart()
- if canChange && v == nil {
- xlen, _ := decInferLen(containerLen, d.h.MaxInitLen, 10)
- v = make(map[uint]uint16, xlen)
- changed = true
- }
-
- var mk uint
- var mv uint16
- if containerLen > 0 {
- for j := 0; j < containerLen; j++ {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- mk = uint(dd.DecodeUint(uintBitsize))
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- mv = uint16(dd.DecodeUint(16))
- if v != nil {
- v[mk] = mv
- }
- }
- } else if containerLen < 0 {
- for j := 0; !dd.CheckBreak(); j++ {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- mk = uint(dd.DecodeUint(uintBitsize))
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- mv = uint16(dd.DecodeUint(16))
- if v != nil {
- v[mk] = mv
- }
- }
- }
- if cr != nil {
- cr.sendContainerState(containerMapEnd)
- }
- return v, changed
-}
-
-func (f *decFnInfo) fastpathDecMapUintUint32R(rv reflect.Value) {
- if rv.CanAddr() {
- vp := rv.Addr().Interface().(*map[uint]uint32)
- v, changed := fastpathTV.DecMapUintUint32V(*vp, fastpathCheckNilFalse, true, f.d)
- if changed {
- *vp = v
- }
- } else {
- v := rv.Interface().(map[uint]uint32)
- fastpathTV.DecMapUintUint32V(v, fastpathCheckNilFalse, false, f.d)
- }
-}
-func (f fastpathT) DecMapUintUint32X(vp *map[uint]uint32, checkNil bool, d *Decoder) {
- v, changed := f.DecMapUintUint32V(*vp, checkNil, true, d)
- if changed {
- *vp = v
- }
-}
-func (_ fastpathT) DecMapUintUint32V(v map[uint]uint32, checkNil bool, canChange bool,
- d *Decoder) (_ map[uint]uint32, changed bool) {
- dd := d.d
- cr := d.cr
-
- if checkNil && dd.TryDecodeAsNil() {
- if v != nil {
- changed = true
- }
- return nil, changed
- }
-
- containerLen := dd.ReadMapStart()
- if canChange && v == nil {
- xlen, _ := decInferLen(containerLen, d.h.MaxInitLen, 12)
- v = make(map[uint]uint32, xlen)
- changed = true
- }
-
- var mk uint
- var mv uint32
- if containerLen > 0 {
- for j := 0; j < containerLen; j++ {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- mk = uint(dd.DecodeUint(uintBitsize))
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- mv = uint32(dd.DecodeUint(32))
- if v != nil {
- v[mk] = mv
- }
- }
- } else if containerLen < 0 {
- for j := 0; !dd.CheckBreak(); j++ {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- mk = uint(dd.DecodeUint(uintBitsize))
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- mv = uint32(dd.DecodeUint(32))
- if v != nil {
- v[mk] = mv
- }
- }
- }
- if cr != nil {
- cr.sendContainerState(containerMapEnd)
- }
- return v, changed
-}
-
-func (f *decFnInfo) fastpathDecMapUintUint64R(rv reflect.Value) {
- if rv.CanAddr() {
- vp := rv.Addr().Interface().(*map[uint]uint64)
- v, changed := fastpathTV.DecMapUintUint64V(*vp, fastpathCheckNilFalse, true, f.d)
- if changed {
- *vp = v
- }
- } else {
- v := rv.Interface().(map[uint]uint64)
- fastpathTV.DecMapUintUint64V(v, fastpathCheckNilFalse, false, f.d)
- }
-}
-func (f fastpathT) DecMapUintUint64X(vp *map[uint]uint64, checkNil bool, d *Decoder) {
- v, changed := f.DecMapUintUint64V(*vp, checkNil, true, d)
- if changed {
- *vp = v
- }
-}
-func (_ fastpathT) DecMapUintUint64V(v map[uint]uint64, checkNil bool, canChange bool,
- d *Decoder) (_ map[uint]uint64, changed bool) {
- dd := d.d
- cr := d.cr
-
- if checkNil && dd.TryDecodeAsNil() {
- if v != nil {
- changed = true
- }
- return nil, changed
- }
-
- containerLen := dd.ReadMapStart()
- if canChange && v == nil {
- xlen, _ := decInferLen(containerLen, d.h.MaxInitLen, 16)
- v = make(map[uint]uint64, xlen)
- changed = true
- }
-
- var mk uint
- var mv uint64
- if containerLen > 0 {
- for j := 0; j < containerLen; j++ {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- mk = uint(dd.DecodeUint(uintBitsize))
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- mv = dd.DecodeUint(64)
- if v != nil {
- v[mk] = mv
- }
- }
- } else if containerLen < 0 {
- for j := 0; !dd.CheckBreak(); j++ {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- mk = uint(dd.DecodeUint(uintBitsize))
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- mv = dd.DecodeUint(64)
- if v != nil {
- v[mk] = mv
- }
- }
- }
- if cr != nil {
- cr.sendContainerState(containerMapEnd)
- }
- return v, changed
-}
-
-func (f *decFnInfo) fastpathDecMapUintUintptrR(rv reflect.Value) {
- if rv.CanAddr() {
- vp := rv.Addr().Interface().(*map[uint]uintptr)
- v, changed := fastpathTV.DecMapUintUintptrV(*vp, fastpathCheckNilFalse, true, f.d)
- if changed {
- *vp = v
- }
- } else {
- v := rv.Interface().(map[uint]uintptr)
- fastpathTV.DecMapUintUintptrV(v, fastpathCheckNilFalse, false, f.d)
- }
-}
-func (f fastpathT) DecMapUintUintptrX(vp *map[uint]uintptr, checkNil bool, d *Decoder) {
- v, changed := f.DecMapUintUintptrV(*vp, checkNil, true, d)
- if changed {
- *vp = v
- }
-}
-func (_ fastpathT) DecMapUintUintptrV(v map[uint]uintptr, checkNil bool, canChange bool,
- d *Decoder) (_ map[uint]uintptr, changed bool) {
- dd := d.d
- cr := d.cr
-
- if checkNil && dd.TryDecodeAsNil() {
- if v != nil {
- changed = true
- }
- return nil, changed
- }
-
- containerLen := dd.ReadMapStart()
- if canChange && v == nil {
- xlen, _ := decInferLen(containerLen, d.h.MaxInitLen, 16)
- v = make(map[uint]uintptr, xlen)
- changed = true
- }
-
- var mk uint
- var mv uintptr
- if containerLen > 0 {
- for j := 0; j < containerLen; j++ {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- mk = uint(dd.DecodeUint(uintBitsize))
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- mv = uintptr(dd.DecodeUint(uintBitsize))
- if v != nil {
- v[mk] = mv
- }
- }
- } else if containerLen < 0 {
- for j := 0; !dd.CheckBreak(); j++ {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- mk = uint(dd.DecodeUint(uintBitsize))
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- mv = uintptr(dd.DecodeUint(uintBitsize))
- if v != nil {
- v[mk] = mv
- }
- }
- }
- if cr != nil {
- cr.sendContainerState(containerMapEnd)
- }
- return v, changed
-}
-
-func (f *decFnInfo) fastpathDecMapUintIntR(rv reflect.Value) {
- if rv.CanAddr() {
- vp := rv.Addr().Interface().(*map[uint]int)
- v, changed := fastpathTV.DecMapUintIntV(*vp, fastpathCheckNilFalse, true, f.d)
- if changed {
- *vp = v
- }
- } else {
- v := rv.Interface().(map[uint]int)
- fastpathTV.DecMapUintIntV(v, fastpathCheckNilFalse, false, f.d)
- }
-}
-func (f fastpathT) DecMapUintIntX(vp *map[uint]int, checkNil bool, d *Decoder) {
- v, changed := f.DecMapUintIntV(*vp, checkNil, true, d)
- if changed {
- *vp = v
- }
-}
-func (_ fastpathT) DecMapUintIntV(v map[uint]int, checkNil bool, canChange bool,
- d *Decoder) (_ map[uint]int, changed bool) {
- dd := d.d
- cr := d.cr
-
- if checkNil && dd.TryDecodeAsNil() {
- if v != nil {
- changed = true
- }
- return nil, changed
- }
-
- containerLen := dd.ReadMapStart()
- if canChange && v == nil {
- xlen, _ := decInferLen(containerLen, d.h.MaxInitLen, 16)
- v = make(map[uint]int, xlen)
- changed = true
- }
-
- var mk uint
- var mv int
- if containerLen > 0 {
- for j := 0; j < containerLen; j++ {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- mk = uint(dd.DecodeUint(uintBitsize))
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- mv = int(dd.DecodeInt(intBitsize))
- if v != nil {
- v[mk] = mv
- }
- }
- } else if containerLen < 0 {
- for j := 0; !dd.CheckBreak(); j++ {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- mk = uint(dd.DecodeUint(uintBitsize))
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- mv = int(dd.DecodeInt(intBitsize))
- if v != nil {
- v[mk] = mv
- }
- }
- }
- if cr != nil {
- cr.sendContainerState(containerMapEnd)
- }
- return v, changed
-}
-
-func (f *decFnInfo) fastpathDecMapUintInt8R(rv reflect.Value) {
- if rv.CanAddr() {
- vp := rv.Addr().Interface().(*map[uint]int8)
- v, changed := fastpathTV.DecMapUintInt8V(*vp, fastpathCheckNilFalse, true, f.d)
- if changed {
- *vp = v
- }
- } else {
- v := rv.Interface().(map[uint]int8)
- fastpathTV.DecMapUintInt8V(v, fastpathCheckNilFalse, false, f.d)
- }
-}
-func (f fastpathT) DecMapUintInt8X(vp *map[uint]int8, checkNil bool, d *Decoder) {
- v, changed := f.DecMapUintInt8V(*vp, checkNil, true, d)
- if changed {
- *vp = v
- }
-}
-func (_ fastpathT) DecMapUintInt8V(v map[uint]int8, checkNil bool, canChange bool,
- d *Decoder) (_ map[uint]int8, changed bool) {
- dd := d.d
- cr := d.cr
-
- if checkNil && dd.TryDecodeAsNil() {
- if v != nil {
- changed = true
- }
- return nil, changed
- }
-
- containerLen := dd.ReadMapStart()
- if canChange && v == nil {
- xlen, _ := decInferLen(containerLen, d.h.MaxInitLen, 9)
- v = make(map[uint]int8, xlen)
- changed = true
- }
-
- var mk uint
- var mv int8
- if containerLen > 0 {
- for j := 0; j < containerLen; j++ {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- mk = uint(dd.DecodeUint(uintBitsize))
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- mv = int8(dd.DecodeInt(8))
- if v != nil {
- v[mk] = mv
- }
- }
- } else if containerLen < 0 {
- for j := 0; !dd.CheckBreak(); j++ {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- mk = uint(dd.DecodeUint(uintBitsize))
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- mv = int8(dd.DecodeInt(8))
- if v != nil {
- v[mk] = mv
- }
- }
- }
- if cr != nil {
- cr.sendContainerState(containerMapEnd)
- }
- return v, changed
-}
-
-func (f *decFnInfo) fastpathDecMapUintInt16R(rv reflect.Value) {
- if rv.CanAddr() {
- vp := rv.Addr().Interface().(*map[uint]int16)
- v, changed := fastpathTV.DecMapUintInt16V(*vp, fastpathCheckNilFalse, true, f.d)
- if changed {
- *vp = v
- }
- } else {
- v := rv.Interface().(map[uint]int16)
- fastpathTV.DecMapUintInt16V(v, fastpathCheckNilFalse, false, f.d)
- }
-}
-func (f fastpathT) DecMapUintInt16X(vp *map[uint]int16, checkNil bool, d *Decoder) {
- v, changed := f.DecMapUintInt16V(*vp, checkNil, true, d)
- if changed {
- *vp = v
- }
-}
-func (_ fastpathT) DecMapUintInt16V(v map[uint]int16, checkNil bool, canChange bool,
- d *Decoder) (_ map[uint]int16, changed bool) {
- dd := d.d
- cr := d.cr
-
- if checkNil && dd.TryDecodeAsNil() {
- if v != nil {
- changed = true
- }
- return nil, changed
- }
-
- containerLen := dd.ReadMapStart()
- if canChange && v == nil {
- xlen, _ := decInferLen(containerLen, d.h.MaxInitLen, 10)
- v = make(map[uint]int16, xlen)
- changed = true
- }
-
- var mk uint
- var mv int16
- if containerLen > 0 {
- for j := 0; j < containerLen; j++ {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- mk = uint(dd.DecodeUint(uintBitsize))
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- mv = int16(dd.DecodeInt(16))
- if v != nil {
- v[mk] = mv
- }
- }
- } else if containerLen < 0 {
- for j := 0; !dd.CheckBreak(); j++ {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- mk = uint(dd.DecodeUint(uintBitsize))
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- mv = int16(dd.DecodeInt(16))
- if v != nil {
- v[mk] = mv
- }
- }
- }
- if cr != nil {
- cr.sendContainerState(containerMapEnd)
- }
- return v, changed
-}
-
-func (f *decFnInfo) fastpathDecMapUintInt32R(rv reflect.Value) {
- if rv.CanAddr() {
- vp := rv.Addr().Interface().(*map[uint]int32)
- v, changed := fastpathTV.DecMapUintInt32V(*vp, fastpathCheckNilFalse, true, f.d)
- if changed {
- *vp = v
- }
- } else {
- v := rv.Interface().(map[uint]int32)
- fastpathTV.DecMapUintInt32V(v, fastpathCheckNilFalse, false, f.d)
- }
-}
-func (f fastpathT) DecMapUintInt32X(vp *map[uint]int32, checkNil bool, d *Decoder) {
- v, changed := f.DecMapUintInt32V(*vp, checkNil, true, d)
- if changed {
- *vp = v
- }
-}
-func (_ fastpathT) DecMapUintInt32V(v map[uint]int32, checkNil bool, canChange bool,
- d *Decoder) (_ map[uint]int32, changed bool) {
- dd := d.d
- cr := d.cr
-
- if checkNil && dd.TryDecodeAsNil() {
- if v != nil {
- changed = true
- }
- return nil, changed
- }
-
- containerLen := dd.ReadMapStart()
- if canChange && v == nil {
- xlen, _ := decInferLen(containerLen, d.h.MaxInitLen, 12)
- v = make(map[uint]int32, xlen)
- changed = true
- }
-
- var mk uint
- var mv int32
- if containerLen > 0 {
- for j := 0; j < containerLen; j++ {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- mk = uint(dd.DecodeUint(uintBitsize))
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- mv = int32(dd.DecodeInt(32))
- if v != nil {
- v[mk] = mv
- }
- }
- } else if containerLen < 0 {
- for j := 0; !dd.CheckBreak(); j++ {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- mk = uint(dd.DecodeUint(uintBitsize))
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- mv = int32(dd.DecodeInt(32))
- if v != nil {
- v[mk] = mv
- }
- }
- }
- if cr != nil {
- cr.sendContainerState(containerMapEnd)
- }
- return v, changed
-}
-
-func (f *decFnInfo) fastpathDecMapUintInt64R(rv reflect.Value) {
- if rv.CanAddr() {
- vp := rv.Addr().Interface().(*map[uint]int64)
- v, changed := fastpathTV.DecMapUintInt64V(*vp, fastpathCheckNilFalse, true, f.d)
- if changed {
- *vp = v
- }
- } else {
- v := rv.Interface().(map[uint]int64)
- fastpathTV.DecMapUintInt64V(v, fastpathCheckNilFalse, false, f.d)
- }
-}
-func (f fastpathT) DecMapUintInt64X(vp *map[uint]int64, checkNil bool, d *Decoder) {
- v, changed := f.DecMapUintInt64V(*vp, checkNil, true, d)
- if changed {
- *vp = v
- }
-}
-func (_ fastpathT) DecMapUintInt64V(v map[uint]int64, checkNil bool, canChange bool,
- d *Decoder) (_ map[uint]int64, changed bool) {
- dd := d.d
- cr := d.cr
-
- if checkNil && dd.TryDecodeAsNil() {
- if v != nil {
- changed = true
- }
- return nil, changed
- }
-
- containerLen := dd.ReadMapStart()
- if canChange && v == nil {
- xlen, _ := decInferLen(containerLen, d.h.MaxInitLen, 16)
- v = make(map[uint]int64, xlen)
- changed = true
- }
-
- var mk uint
- var mv int64
- if containerLen > 0 {
- for j := 0; j < containerLen; j++ {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- mk = uint(dd.DecodeUint(uintBitsize))
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- mv = dd.DecodeInt(64)
- if v != nil {
- v[mk] = mv
- }
- }
- } else if containerLen < 0 {
- for j := 0; !dd.CheckBreak(); j++ {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- mk = uint(dd.DecodeUint(uintBitsize))
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- mv = dd.DecodeInt(64)
- if v != nil {
- v[mk] = mv
- }
- }
- }
- if cr != nil {
- cr.sendContainerState(containerMapEnd)
- }
- return v, changed
-}
-
-func (f *decFnInfo) fastpathDecMapUintFloat32R(rv reflect.Value) {
- if rv.CanAddr() {
- vp := rv.Addr().Interface().(*map[uint]float32)
- v, changed := fastpathTV.DecMapUintFloat32V(*vp, fastpathCheckNilFalse, true, f.d)
- if changed {
- *vp = v
- }
- } else {
- v := rv.Interface().(map[uint]float32)
- fastpathTV.DecMapUintFloat32V(v, fastpathCheckNilFalse, false, f.d)
- }
-}
-func (f fastpathT) DecMapUintFloat32X(vp *map[uint]float32, checkNil bool, d *Decoder) {
- v, changed := f.DecMapUintFloat32V(*vp, checkNil, true, d)
- if changed {
- *vp = v
- }
-}
-func (_ fastpathT) DecMapUintFloat32V(v map[uint]float32, checkNil bool, canChange bool,
- d *Decoder) (_ map[uint]float32, changed bool) {
- dd := d.d
- cr := d.cr
-
- if checkNil && dd.TryDecodeAsNil() {
- if v != nil {
- changed = true
- }
- return nil, changed
- }
-
- containerLen := dd.ReadMapStart()
- if canChange && v == nil {
- xlen, _ := decInferLen(containerLen, d.h.MaxInitLen, 12)
- v = make(map[uint]float32, xlen)
- changed = true
- }
-
- var mk uint
- var mv float32
- if containerLen > 0 {
- for j := 0; j < containerLen; j++ {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- mk = uint(dd.DecodeUint(uintBitsize))
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- mv = float32(dd.DecodeFloat(true))
- if v != nil {
- v[mk] = mv
- }
- }
- } else if containerLen < 0 {
- for j := 0; !dd.CheckBreak(); j++ {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- mk = uint(dd.DecodeUint(uintBitsize))
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- mv = float32(dd.DecodeFloat(true))
- if v != nil {
- v[mk] = mv
- }
- }
- }
- if cr != nil {
- cr.sendContainerState(containerMapEnd)
- }
- return v, changed
-}
-
-func (f *decFnInfo) fastpathDecMapUintFloat64R(rv reflect.Value) {
- if rv.CanAddr() {
- vp := rv.Addr().Interface().(*map[uint]float64)
- v, changed := fastpathTV.DecMapUintFloat64V(*vp, fastpathCheckNilFalse, true, f.d)
- if changed {
- *vp = v
- }
- } else {
- v := rv.Interface().(map[uint]float64)
- fastpathTV.DecMapUintFloat64V(v, fastpathCheckNilFalse, false, f.d)
- }
-}
-func (f fastpathT) DecMapUintFloat64X(vp *map[uint]float64, checkNil bool, d *Decoder) {
- v, changed := f.DecMapUintFloat64V(*vp, checkNil, true, d)
- if changed {
- *vp = v
- }
-}
-func (_ fastpathT) DecMapUintFloat64V(v map[uint]float64, checkNil bool, canChange bool,
- d *Decoder) (_ map[uint]float64, changed bool) {
- dd := d.d
- cr := d.cr
-
- if checkNil && dd.TryDecodeAsNil() {
- if v != nil {
- changed = true
- }
- return nil, changed
- }
-
- containerLen := dd.ReadMapStart()
- if canChange && v == nil {
- xlen, _ := decInferLen(containerLen, d.h.MaxInitLen, 16)
- v = make(map[uint]float64, xlen)
- changed = true
- }
-
- var mk uint
- var mv float64
- if containerLen > 0 {
- for j := 0; j < containerLen; j++ {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- mk = uint(dd.DecodeUint(uintBitsize))
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- mv = dd.DecodeFloat(false)
- if v != nil {
- v[mk] = mv
- }
- }
- } else if containerLen < 0 {
- for j := 0; !dd.CheckBreak(); j++ {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- mk = uint(dd.DecodeUint(uintBitsize))
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- mv = dd.DecodeFloat(false)
- if v != nil {
- v[mk] = mv
- }
- }
- }
- if cr != nil {
- cr.sendContainerState(containerMapEnd)
- }
- return v, changed
-}
-
-func (f *decFnInfo) fastpathDecMapUintBoolR(rv reflect.Value) {
- if rv.CanAddr() {
- vp := rv.Addr().Interface().(*map[uint]bool)
- v, changed := fastpathTV.DecMapUintBoolV(*vp, fastpathCheckNilFalse, true, f.d)
- if changed {
- *vp = v
- }
- } else {
- v := rv.Interface().(map[uint]bool)
- fastpathTV.DecMapUintBoolV(v, fastpathCheckNilFalse, false, f.d)
- }
-}
-func (f fastpathT) DecMapUintBoolX(vp *map[uint]bool, checkNil bool, d *Decoder) {
- v, changed := f.DecMapUintBoolV(*vp, checkNil, true, d)
- if changed {
- *vp = v
- }
-}
-func (_ fastpathT) DecMapUintBoolV(v map[uint]bool, checkNil bool, canChange bool,
- d *Decoder) (_ map[uint]bool, changed bool) {
- dd := d.d
- cr := d.cr
-
- if checkNil && dd.TryDecodeAsNil() {
- if v != nil {
- changed = true
- }
- return nil, changed
- }
-
- containerLen := dd.ReadMapStart()
- if canChange && v == nil {
- xlen, _ := decInferLen(containerLen, d.h.MaxInitLen, 9)
- v = make(map[uint]bool, xlen)
- changed = true
- }
-
- var mk uint
- var mv bool
- if containerLen > 0 {
- for j := 0; j < containerLen; j++ {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- mk = uint(dd.DecodeUint(uintBitsize))
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- mv = dd.DecodeBool()
- if v != nil {
- v[mk] = mv
- }
- }
- } else if containerLen < 0 {
- for j := 0; !dd.CheckBreak(); j++ {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- mk = uint(dd.DecodeUint(uintBitsize))
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- mv = dd.DecodeBool()
- if v != nil {
- v[mk] = mv
- }
- }
- }
- if cr != nil {
- cr.sendContainerState(containerMapEnd)
- }
- return v, changed
-}
-
-func (f *decFnInfo) fastpathDecMapUint8IntfR(rv reflect.Value) {
- if rv.CanAddr() {
- vp := rv.Addr().Interface().(*map[uint8]interface{})
- v, changed := fastpathTV.DecMapUint8IntfV(*vp, fastpathCheckNilFalse, true, f.d)
- if changed {
- *vp = v
- }
- } else {
- v := rv.Interface().(map[uint8]interface{})
- fastpathTV.DecMapUint8IntfV(v, fastpathCheckNilFalse, false, f.d)
- }
-}
-func (f fastpathT) DecMapUint8IntfX(vp *map[uint8]interface{}, checkNil bool, d *Decoder) {
- v, changed := f.DecMapUint8IntfV(*vp, checkNil, true, d)
- if changed {
- *vp = v
- }
-}
-func (_ fastpathT) DecMapUint8IntfV(v map[uint8]interface{}, checkNil bool, canChange bool,
- d *Decoder) (_ map[uint8]interface{}, changed bool) {
- dd := d.d
- cr := d.cr
-
- if checkNil && dd.TryDecodeAsNil() {
- if v != nil {
- changed = true
- }
- return nil, changed
- }
-
- containerLen := dd.ReadMapStart()
- if canChange && v == nil {
- xlen, _ := decInferLen(containerLen, d.h.MaxInitLen, 17)
- v = make(map[uint8]interface{}, xlen)
- changed = true
- }
- mapGet := !d.h.MapValueReset && !d.h.InterfaceReset
- var mk uint8
- var mv interface{}
- if containerLen > 0 {
- for j := 0; j < containerLen; j++ {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- mk = uint8(dd.DecodeUint(8))
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- if mapGet {
- mv = v[mk]
- } else {
- mv = nil
- }
- d.decode(&mv)
- if v != nil {
- v[mk] = mv
- }
- }
- } else if containerLen < 0 {
- for j := 0; !dd.CheckBreak(); j++ {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- mk = uint8(dd.DecodeUint(8))
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- if mapGet {
- mv = v[mk]
- } else {
- mv = nil
- }
- d.decode(&mv)
- if v != nil {
- v[mk] = mv
- }
- }
- }
- if cr != nil {
- cr.sendContainerState(containerMapEnd)
- }
- return v, changed
-}
-
-func (f *decFnInfo) fastpathDecMapUint8StringR(rv reflect.Value) {
- if rv.CanAddr() {
- vp := rv.Addr().Interface().(*map[uint8]string)
- v, changed := fastpathTV.DecMapUint8StringV(*vp, fastpathCheckNilFalse, true, f.d)
- if changed {
- *vp = v
- }
- } else {
- v := rv.Interface().(map[uint8]string)
- fastpathTV.DecMapUint8StringV(v, fastpathCheckNilFalse, false, f.d)
- }
-}
-func (f fastpathT) DecMapUint8StringX(vp *map[uint8]string, checkNil bool, d *Decoder) {
- v, changed := f.DecMapUint8StringV(*vp, checkNil, true, d)
- if changed {
- *vp = v
- }
-}
-func (_ fastpathT) DecMapUint8StringV(v map[uint8]string, checkNil bool, canChange bool,
- d *Decoder) (_ map[uint8]string, changed bool) {
- dd := d.d
- cr := d.cr
-
- if checkNil && dd.TryDecodeAsNil() {
- if v != nil {
- changed = true
- }
- return nil, changed
- }
-
- containerLen := dd.ReadMapStart()
- if canChange && v == nil {
- xlen, _ := decInferLen(containerLen, d.h.MaxInitLen, 17)
- v = make(map[uint8]string, xlen)
- changed = true
- }
-
- var mk uint8
- var mv string
- if containerLen > 0 {
- for j := 0; j < containerLen; j++ {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- mk = uint8(dd.DecodeUint(8))
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- mv = dd.DecodeString()
- if v != nil {
- v[mk] = mv
- }
- }
- } else if containerLen < 0 {
- for j := 0; !dd.CheckBreak(); j++ {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- mk = uint8(dd.DecodeUint(8))
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- mv = dd.DecodeString()
- if v != nil {
- v[mk] = mv
- }
- }
- }
- if cr != nil {
- cr.sendContainerState(containerMapEnd)
- }
- return v, changed
-}
-
-func (f *decFnInfo) fastpathDecMapUint8UintR(rv reflect.Value) {
- if rv.CanAddr() {
- vp := rv.Addr().Interface().(*map[uint8]uint)
- v, changed := fastpathTV.DecMapUint8UintV(*vp, fastpathCheckNilFalse, true, f.d)
- if changed {
- *vp = v
- }
- } else {
- v := rv.Interface().(map[uint8]uint)
- fastpathTV.DecMapUint8UintV(v, fastpathCheckNilFalse, false, f.d)
- }
-}
-func (f fastpathT) DecMapUint8UintX(vp *map[uint8]uint, checkNil bool, d *Decoder) {
- v, changed := f.DecMapUint8UintV(*vp, checkNil, true, d)
- if changed {
- *vp = v
- }
-}
-func (_ fastpathT) DecMapUint8UintV(v map[uint8]uint, checkNil bool, canChange bool,
- d *Decoder) (_ map[uint8]uint, changed bool) {
- dd := d.d
- cr := d.cr
-
- if checkNil && dd.TryDecodeAsNil() {
- if v != nil {
- changed = true
- }
- return nil, changed
- }
-
- containerLen := dd.ReadMapStart()
- if canChange && v == nil {
- xlen, _ := decInferLen(containerLen, d.h.MaxInitLen, 9)
- v = make(map[uint8]uint, xlen)
- changed = true
- }
-
- var mk uint8
- var mv uint
- if containerLen > 0 {
- for j := 0; j < containerLen; j++ {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- mk = uint8(dd.DecodeUint(8))
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- mv = uint(dd.DecodeUint(uintBitsize))
- if v != nil {
- v[mk] = mv
- }
- }
- } else if containerLen < 0 {
- for j := 0; !dd.CheckBreak(); j++ {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- mk = uint8(dd.DecodeUint(8))
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- mv = uint(dd.DecodeUint(uintBitsize))
- if v != nil {
- v[mk] = mv
- }
- }
- }
- if cr != nil {
- cr.sendContainerState(containerMapEnd)
- }
- return v, changed
-}
-
-func (f *decFnInfo) fastpathDecMapUint8Uint8R(rv reflect.Value) {
- if rv.CanAddr() {
- vp := rv.Addr().Interface().(*map[uint8]uint8)
- v, changed := fastpathTV.DecMapUint8Uint8V(*vp, fastpathCheckNilFalse, true, f.d)
- if changed {
- *vp = v
- }
- } else {
- v := rv.Interface().(map[uint8]uint8)
- fastpathTV.DecMapUint8Uint8V(v, fastpathCheckNilFalse, false, f.d)
- }
-}
-func (f fastpathT) DecMapUint8Uint8X(vp *map[uint8]uint8, checkNil bool, d *Decoder) {
- v, changed := f.DecMapUint8Uint8V(*vp, checkNil, true, d)
- if changed {
- *vp = v
- }
-}
-func (_ fastpathT) DecMapUint8Uint8V(v map[uint8]uint8, checkNil bool, canChange bool,
- d *Decoder) (_ map[uint8]uint8, changed bool) {
- dd := d.d
- cr := d.cr
-
- if checkNil && dd.TryDecodeAsNil() {
- if v != nil {
- changed = true
- }
- return nil, changed
- }
-
- containerLen := dd.ReadMapStart()
- if canChange && v == nil {
- xlen, _ := decInferLen(containerLen, d.h.MaxInitLen, 2)
- v = make(map[uint8]uint8, xlen)
- changed = true
- }
-
- var mk uint8
- var mv uint8
- if containerLen > 0 {
- for j := 0; j < containerLen; j++ {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- mk = uint8(dd.DecodeUint(8))
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- mv = uint8(dd.DecodeUint(8))
- if v != nil {
- v[mk] = mv
- }
- }
- } else if containerLen < 0 {
- for j := 0; !dd.CheckBreak(); j++ {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- mk = uint8(dd.DecodeUint(8))
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- mv = uint8(dd.DecodeUint(8))
- if v != nil {
- v[mk] = mv
- }
- }
- }
- if cr != nil {
- cr.sendContainerState(containerMapEnd)
- }
- return v, changed
-}
-
-func (f *decFnInfo) fastpathDecMapUint8Uint16R(rv reflect.Value) {
- if rv.CanAddr() {
- vp := rv.Addr().Interface().(*map[uint8]uint16)
- v, changed := fastpathTV.DecMapUint8Uint16V(*vp, fastpathCheckNilFalse, true, f.d)
- if changed {
- *vp = v
- }
- } else {
- v := rv.Interface().(map[uint8]uint16)
- fastpathTV.DecMapUint8Uint16V(v, fastpathCheckNilFalse, false, f.d)
- }
-}
-func (f fastpathT) DecMapUint8Uint16X(vp *map[uint8]uint16, checkNil bool, d *Decoder) {
- v, changed := f.DecMapUint8Uint16V(*vp, checkNil, true, d)
- if changed {
- *vp = v
- }
-}
-func (_ fastpathT) DecMapUint8Uint16V(v map[uint8]uint16, checkNil bool, canChange bool,
- d *Decoder) (_ map[uint8]uint16, changed bool) {
- dd := d.d
- cr := d.cr
-
- if checkNil && dd.TryDecodeAsNil() {
- if v != nil {
- changed = true
- }
- return nil, changed
- }
-
- containerLen := dd.ReadMapStart()
- if canChange && v == nil {
- xlen, _ := decInferLen(containerLen, d.h.MaxInitLen, 3)
- v = make(map[uint8]uint16, xlen)
- changed = true
- }
-
- var mk uint8
- var mv uint16
- if containerLen > 0 {
- for j := 0; j < containerLen; j++ {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- mk = uint8(dd.DecodeUint(8))
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- mv = uint16(dd.DecodeUint(16))
- if v != nil {
- v[mk] = mv
- }
- }
- } else if containerLen < 0 {
- for j := 0; !dd.CheckBreak(); j++ {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- mk = uint8(dd.DecodeUint(8))
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- mv = uint16(dd.DecodeUint(16))
- if v != nil {
- v[mk] = mv
- }
- }
- }
- if cr != nil {
- cr.sendContainerState(containerMapEnd)
- }
- return v, changed
-}
-
-func (f *decFnInfo) fastpathDecMapUint8Uint32R(rv reflect.Value) {
- if rv.CanAddr() {
- vp := rv.Addr().Interface().(*map[uint8]uint32)
- v, changed := fastpathTV.DecMapUint8Uint32V(*vp, fastpathCheckNilFalse, true, f.d)
- if changed {
- *vp = v
- }
- } else {
- v := rv.Interface().(map[uint8]uint32)
- fastpathTV.DecMapUint8Uint32V(v, fastpathCheckNilFalse, false, f.d)
- }
-}
-func (f fastpathT) DecMapUint8Uint32X(vp *map[uint8]uint32, checkNil bool, d *Decoder) {
- v, changed := f.DecMapUint8Uint32V(*vp, checkNil, true, d)
- if changed {
- *vp = v
- }
-}
-func (_ fastpathT) DecMapUint8Uint32V(v map[uint8]uint32, checkNil bool, canChange bool,
- d *Decoder) (_ map[uint8]uint32, changed bool) {
- dd := d.d
- cr := d.cr
-
- if checkNil && dd.TryDecodeAsNil() {
- if v != nil {
- changed = true
- }
- return nil, changed
- }
-
- containerLen := dd.ReadMapStart()
- if canChange && v == nil {
- xlen, _ := decInferLen(containerLen, d.h.MaxInitLen, 5)
- v = make(map[uint8]uint32, xlen)
- changed = true
- }
-
- var mk uint8
- var mv uint32
- if containerLen > 0 {
- for j := 0; j < containerLen; j++ {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- mk = uint8(dd.DecodeUint(8))
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- mv = uint32(dd.DecodeUint(32))
- if v != nil {
- v[mk] = mv
- }
- }
- } else if containerLen < 0 {
- for j := 0; !dd.CheckBreak(); j++ {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- mk = uint8(dd.DecodeUint(8))
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- mv = uint32(dd.DecodeUint(32))
- if v != nil {
- v[mk] = mv
- }
- }
- }
- if cr != nil {
- cr.sendContainerState(containerMapEnd)
- }
- return v, changed
-}
-
-func (f *decFnInfo) fastpathDecMapUint8Uint64R(rv reflect.Value) {
- if rv.CanAddr() {
- vp := rv.Addr().Interface().(*map[uint8]uint64)
- v, changed := fastpathTV.DecMapUint8Uint64V(*vp, fastpathCheckNilFalse, true, f.d)
- if changed {
- *vp = v
- }
- } else {
- v := rv.Interface().(map[uint8]uint64)
- fastpathTV.DecMapUint8Uint64V(v, fastpathCheckNilFalse, false, f.d)
- }
-}
-func (f fastpathT) DecMapUint8Uint64X(vp *map[uint8]uint64, checkNil bool, d *Decoder) {
- v, changed := f.DecMapUint8Uint64V(*vp, checkNil, true, d)
- if changed {
- *vp = v
- }
-}
-func (_ fastpathT) DecMapUint8Uint64V(v map[uint8]uint64, checkNil bool, canChange bool,
- d *Decoder) (_ map[uint8]uint64, changed bool) {
- dd := d.d
- cr := d.cr
-
- if checkNil && dd.TryDecodeAsNil() {
- if v != nil {
- changed = true
- }
- return nil, changed
- }
-
- containerLen := dd.ReadMapStart()
- if canChange && v == nil {
- xlen, _ := decInferLen(containerLen, d.h.MaxInitLen, 9)
- v = make(map[uint8]uint64, xlen)
- changed = true
- }
-
- var mk uint8
- var mv uint64
- if containerLen > 0 {
- for j := 0; j < containerLen; j++ {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- mk = uint8(dd.DecodeUint(8))
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- mv = dd.DecodeUint(64)
- if v != nil {
- v[mk] = mv
- }
- }
- } else if containerLen < 0 {
- for j := 0; !dd.CheckBreak(); j++ {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- mk = uint8(dd.DecodeUint(8))
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- mv = dd.DecodeUint(64)
- if v != nil {
- v[mk] = mv
- }
- }
- }
- if cr != nil {
- cr.sendContainerState(containerMapEnd)
- }
- return v, changed
-}
-
-func (f *decFnInfo) fastpathDecMapUint8UintptrR(rv reflect.Value) {
- if rv.CanAddr() {
- vp := rv.Addr().Interface().(*map[uint8]uintptr)
- v, changed := fastpathTV.DecMapUint8UintptrV(*vp, fastpathCheckNilFalse, true, f.d)
- if changed {
- *vp = v
- }
- } else {
- v := rv.Interface().(map[uint8]uintptr)
- fastpathTV.DecMapUint8UintptrV(v, fastpathCheckNilFalse, false, f.d)
- }
-}
-func (f fastpathT) DecMapUint8UintptrX(vp *map[uint8]uintptr, checkNil bool, d *Decoder) {
- v, changed := f.DecMapUint8UintptrV(*vp, checkNil, true, d)
- if changed {
- *vp = v
- }
-}
-func (_ fastpathT) DecMapUint8UintptrV(v map[uint8]uintptr, checkNil bool, canChange bool,
- d *Decoder) (_ map[uint8]uintptr, changed bool) {
- dd := d.d
- cr := d.cr
-
- if checkNil && dd.TryDecodeAsNil() {
- if v != nil {
- changed = true
- }
- return nil, changed
- }
-
- containerLen := dd.ReadMapStart()
- if canChange && v == nil {
- xlen, _ := decInferLen(containerLen, d.h.MaxInitLen, 9)
- v = make(map[uint8]uintptr, xlen)
- changed = true
- }
-
- var mk uint8
- var mv uintptr
- if containerLen > 0 {
- for j := 0; j < containerLen; j++ {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- mk = uint8(dd.DecodeUint(8))
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- mv = uintptr(dd.DecodeUint(uintBitsize))
- if v != nil {
- v[mk] = mv
- }
- }
- } else if containerLen < 0 {
- for j := 0; !dd.CheckBreak(); j++ {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- mk = uint8(dd.DecodeUint(8))
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- mv = uintptr(dd.DecodeUint(uintBitsize))
- if v != nil {
- v[mk] = mv
- }
- }
- }
- if cr != nil {
- cr.sendContainerState(containerMapEnd)
- }
- return v, changed
-}
-
-func (f *decFnInfo) fastpathDecMapUint8IntR(rv reflect.Value) {
- if rv.CanAddr() {
- vp := rv.Addr().Interface().(*map[uint8]int)
- v, changed := fastpathTV.DecMapUint8IntV(*vp, fastpathCheckNilFalse, true, f.d)
- if changed {
- *vp = v
- }
- } else {
- v := rv.Interface().(map[uint8]int)
- fastpathTV.DecMapUint8IntV(v, fastpathCheckNilFalse, false, f.d)
- }
-}
-func (f fastpathT) DecMapUint8IntX(vp *map[uint8]int, checkNil bool, d *Decoder) {
- v, changed := f.DecMapUint8IntV(*vp, checkNil, true, d)
- if changed {
- *vp = v
- }
-}
-func (_ fastpathT) DecMapUint8IntV(v map[uint8]int, checkNil bool, canChange bool,
- d *Decoder) (_ map[uint8]int, changed bool) {
- dd := d.d
- cr := d.cr
-
- if checkNil && dd.TryDecodeAsNil() {
- if v != nil {
- changed = true
- }
- return nil, changed
- }
-
- containerLen := dd.ReadMapStart()
- if canChange && v == nil {
- xlen, _ := decInferLen(containerLen, d.h.MaxInitLen, 9)
- v = make(map[uint8]int, xlen)
- changed = true
- }
-
- var mk uint8
- var mv int
- if containerLen > 0 {
- for j := 0; j < containerLen; j++ {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- mk = uint8(dd.DecodeUint(8))
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- mv = int(dd.DecodeInt(intBitsize))
- if v != nil {
- v[mk] = mv
- }
- }
- } else if containerLen < 0 {
- for j := 0; !dd.CheckBreak(); j++ {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- mk = uint8(dd.DecodeUint(8))
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- mv = int(dd.DecodeInt(intBitsize))
- if v != nil {
- v[mk] = mv
- }
- }
- }
- if cr != nil {
- cr.sendContainerState(containerMapEnd)
- }
- return v, changed
-}
-
-func (f *decFnInfo) fastpathDecMapUint8Int8R(rv reflect.Value) {
- if rv.CanAddr() {
- vp := rv.Addr().Interface().(*map[uint8]int8)
- v, changed := fastpathTV.DecMapUint8Int8V(*vp, fastpathCheckNilFalse, true, f.d)
- if changed {
- *vp = v
- }
- } else {
- v := rv.Interface().(map[uint8]int8)
- fastpathTV.DecMapUint8Int8V(v, fastpathCheckNilFalse, false, f.d)
- }
-}
-func (f fastpathT) DecMapUint8Int8X(vp *map[uint8]int8, checkNil bool, d *Decoder) {
- v, changed := f.DecMapUint8Int8V(*vp, checkNil, true, d)
- if changed {
- *vp = v
- }
-}
-func (_ fastpathT) DecMapUint8Int8V(v map[uint8]int8, checkNil bool, canChange bool,
- d *Decoder) (_ map[uint8]int8, changed bool) {
- dd := d.d
- cr := d.cr
-
- if checkNil && dd.TryDecodeAsNil() {
- if v != nil {
- changed = true
- }
- return nil, changed
- }
-
- containerLen := dd.ReadMapStart()
- if canChange && v == nil {
- xlen, _ := decInferLen(containerLen, d.h.MaxInitLen, 2)
- v = make(map[uint8]int8, xlen)
- changed = true
- }
-
- var mk uint8
- var mv int8
- if containerLen > 0 {
- for j := 0; j < containerLen; j++ {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- mk = uint8(dd.DecodeUint(8))
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- mv = int8(dd.DecodeInt(8))
- if v != nil {
- v[mk] = mv
- }
- }
- } else if containerLen < 0 {
- for j := 0; !dd.CheckBreak(); j++ {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- mk = uint8(dd.DecodeUint(8))
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- mv = int8(dd.DecodeInt(8))
- if v != nil {
- v[mk] = mv
- }
- }
- }
- if cr != nil {
- cr.sendContainerState(containerMapEnd)
- }
- return v, changed
-}
-
-func (f *decFnInfo) fastpathDecMapUint8Int16R(rv reflect.Value) {
- if rv.CanAddr() {
- vp := rv.Addr().Interface().(*map[uint8]int16)
- v, changed := fastpathTV.DecMapUint8Int16V(*vp, fastpathCheckNilFalse, true, f.d)
- if changed {
- *vp = v
- }
- } else {
- v := rv.Interface().(map[uint8]int16)
- fastpathTV.DecMapUint8Int16V(v, fastpathCheckNilFalse, false, f.d)
- }
-}
-func (f fastpathT) DecMapUint8Int16X(vp *map[uint8]int16, checkNil bool, d *Decoder) {
- v, changed := f.DecMapUint8Int16V(*vp, checkNil, true, d)
- if changed {
- *vp = v
- }
-}
-func (_ fastpathT) DecMapUint8Int16V(v map[uint8]int16, checkNil bool, canChange bool,
- d *Decoder) (_ map[uint8]int16, changed bool) {
- dd := d.d
- cr := d.cr
-
- if checkNil && dd.TryDecodeAsNil() {
- if v != nil {
- changed = true
- }
- return nil, changed
- }
-
- containerLen := dd.ReadMapStart()
- if canChange && v == nil {
- xlen, _ := decInferLen(containerLen, d.h.MaxInitLen, 3)
- v = make(map[uint8]int16, xlen)
- changed = true
- }
-
- var mk uint8
- var mv int16
- if containerLen > 0 {
- for j := 0; j < containerLen; j++ {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- mk = uint8(dd.DecodeUint(8))
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- mv = int16(dd.DecodeInt(16))
- if v != nil {
- v[mk] = mv
- }
- }
- } else if containerLen < 0 {
- for j := 0; !dd.CheckBreak(); j++ {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- mk = uint8(dd.DecodeUint(8))
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- mv = int16(dd.DecodeInt(16))
- if v != nil {
- v[mk] = mv
- }
- }
- }
- if cr != nil {
- cr.sendContainerState(containerMapEnd)
- }
- return v, changed
-}
-
-func (f *decFnInfo) fastpathDecMapUint8Int32R(rv reflect.Value) {
- if rv.CanAddr() {
- vp := rv.Addr().Interface().(*map[uint8]int32)
- v, changed := fastpathTV.DecMapUint8Int32V(*vp, fastpathCheckNilFalse, true, f.d)
- if changed {
- *vp = v
- }
- } else {
- v := rv.Interface().(map[uint8]int32)
- fastpathTV.DecMapUint8Int32V(v, fastpathCheckNilFalse, false, f.d)
- }
-}
-func (f fastpathT) DecMapUint8Int32X(vp *map[uint8]int32, checkNil bool, d *Decoder) {
- v, changed := f.DecMapUint8Int32V(*vp, checkNil, true, d)
- if changed {
- *vp = v
- }
-}
-func (_ fastpathT) DecMapUint8Int32V(v map[uint8]int32, checkNil bool, canChange bool,
- d *Decoder) (_ map[uint8]int32, changed bool) {
- dd := d.d
- cr := d.cr
-
- if checkNil && dd.TryDecodeAsNil() {
- if v != nil {
- changed = true
- }
- return nil, changed
- }
-
- containerLen := dd.ReadMapStart()
- if canChange && v == nil {
- xlen, _ := decInferLen(containerLen, d.h.MaxInitLen, 5)
- v = make(map[uint8]int32, xlen)
- changed = true
- }
-
- var mk uint8
- var mv int32
- if containerLen > 0 {
- for j := 0; j < containerLen; j++ {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- mk = uint8(dd.DecodeUint(8))
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- mv = int32(dd.DecodeInt(32))
- if v != nil {
- v[mk] = mv
- }
- }
- } else if containerLen < 0 {
- for j := 0; !dd.CheckBreak(); j++ {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- mk = uint8(dd.DecodeUint(8))
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- mv = int32(dd.DecodeInt(32))
- if v != nil {
- v[mk] = mv
- }
- }
- }
- if cr != nil {
- cr.sendContainerState(containerMapEnd)
- }
- return v, changed
-}
-
-func (f *decFnInfo) fastpathDecMapUint8Int64R(rv reflect.Value) {
- if rv.CanAddr() {
- vp := rv.Addr().Interface().(*map[uint8]int64)
- v, changed := fastpathTV.DecMapUint8Int64V(*vp, fastpathCheckNilFalse, true, f.d)
- if changed {
- *vp = v
- }
- } else {
- v := rv.Interface().(map[uint8]int64)
- fastpathTV.DecMapUint8Int64V(v, fastpathCheckNilFalse, false, f.d)
- }
-}
-func (f fastpathT) DecMapUint8Int64X(vp *map[uint8]int64, checkNil bool, d *Decoder) {
- v, changed := f.DecMapUint8Int64V(*vp, checkNil, true, d)
- if changed {
- *vp = v
- }
-}
-func (_ fastpathT) DecMapUint8Int64V(v map[uint8]int64, checkNil bool, canChange bool,
- d *Decoder) (_ map[uint8]int64, changed bool) {
- dd := d.d
- cr := d.cr
-
- if checkNil && dd.TryDecodeAsNil() {
- if v != nil {
- changed = true
- }
- return nil, changed
- }
-
- containerLen := dd.ReadMapStart()
- if canChange && v == nil {
- xlen, _ := decInferLen(containerLen, d.h.MaxInitLen, 9)
- v = make(map[uint8]int64, xlen)
- changed = true
- }
-
- var mk uint8
- var mv int64
- if containerLen > 0 {
- for j := 0; j < containerLen; j++ {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- mk = uint8(dd.DecodeUint(8))
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- mv = dd.DecodeInt(64)
- if v != nil {
- v[mk] = mv
- }
- }
- } else if containerLen < 0 {
- for j := 0; !dd.CheckBreak(); j++ {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- mk = uint8(dd.DecodeUint(8))
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- mv = dd.DecodeInt(64)
- if v != nil {
- v[mk] = mv
- }
- }
- }
- if cr != nil {
- cr.sendContainerState(containerMapEnd)
- }
- return v, changed
-}
-
-func (f *decFnInfo) fastpathDecMapUint8Float32R(rv reflect.Value) {
- if rv.CanAddr() {
- vp := rv.Addr().Interface().(*map[uint8]float32)
- v, changed := fastpathTV.DecMapUint8Float32V(*vp, fastpathCheckNilFalse, true, f.d)
- if changed {
- *vp = v
- }
- } else {
- v := rv.Interface().(map[uint8]float32)
- fastpathTV.DecMapUint8Float32V(v, fastpathCheckNilFalse, false, f.d)
- }
-}
-func (f fastpathT) DecMapUint8Float32X(vp *map[uint8]float32, checkNil bool, d *Decoder) {
- v, changed := f.DecMapUint8Float32V(*vp, checkNil, true, d)
- if changed {
- *vp = v
- }
-}
-func (_ fastpathT) DecMapUint8Float32V(v map[uint8]float32, checkNil bool, canChange bool,
- d *Decoder) (_ map[uint8]float32, changed bool) {
- dd := d.d
- cr := d.cr
-
- if checkNil && dd.TryDecodeAsNil() {
- if v != nil {
- changed = true
- }
- return nil, changed
- }
-
- containerLen := dd.ReadMapStart()
- if canChange && v == nil {
- xlen, _ := decInferLen(containerLen, d.h.MaxInitLen, 5)
- v = make(map[uint8]float32, xlen)
- changed = true
- }
-
- var mk uint8
- var mv float32
- if containerLen > 0 {
- for j := 0; j < containerLen; j++ {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- mk = uint8(dd.DecodeUint(8))
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- mv = float32(dd.DecodeFloat(true))
- if v != nil {
- v[mk] = mv
- }
- }
- } else if containerLen < 0 {
- for j := 0; !dd.CheckBreak(); j++ {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- mk = uint8(dd.DecodeUint(8))
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- mv = float32(dd.DecodeFloat(true))
- if v != nil {
- v[mk] = mv
- }
- }
- }
- if cr != nil {
- cr.sendContainerState(containerMapEnd)
- }
- return v, changed
-}
-
-func (f *decFnInfo) fastpathDecMapUint8Float64R(rv reflect.Value) {
- if rv.CanAddr() {
- vp := rv.Addr().Interface().(*map[uint8]float64)
- v, changed := fastpathTV.DecMapUint8Float64V(*vp, fastpathCheckNilFalse, true, f.d)
- if changed {
- *vp = v
- }
- } else {
- v := rv.Interface().(map[uint8]float64)
- fastpathTV.DecMapUint8Float64V(v, fastpathCheckNilFalse, false, f.d)
- }
-}
-func (f fastpathT) DecMapUint8Float64X(vp *map[uint8]float64, checkNil bool, d *Decoder) {
- v, changed := f.DecMapUint8Float64V(*vp, checkNil, true, d)
- if changed {
- *vp = v
- }
-}
-func (_ fastpathT) DecMapUint8Float64V(v map[uint8]float64, checkNil bool, canChange bool,
- d *Decoder) (_ map[uint8]float64, changed bool) {
- dd := d.d
- cr := d.cr
-
- if checkNil && dd.TryDecodeAsNil() {
- if v != nil {
- changed = true
- }
- return nil, changed
- }
-
- containerLen := dd.ReadMapStart()
- if canChange && v == nil {
- xlen, _ := decInferLen(containerLen, d.h.MaxInitLen, 9)
- v = make(map[uint8]float64, xlen)
- changed = true
- }
-
- var mk uint8
- var mv float64
- if containerLen > 0 {
- for j := 0; j < containerLen; j++ {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- mk = uint8(dd.DecodeUint(8))
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- mv = dd.DecodeFloat(false)
- if v != nil {
- v[mk] = mv
- }
- }
- } else if containerLen < 0 {
- for j := 0; !dd.CheckBreak(); j++ {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- mk = uint8(dd.DecodeUint(8))
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- mv = dd.DecodeFloat(false)
- if v != nil {
- v[mk] = mv
- }
- }
- }
- if cr != nil {
- cr.sendContainerState(containerMapEnd)
- }
- return v, changed
-}
-
-func (f *decFnInfo) fastpathDecMapUint8BoolR(rv reflect.Value) {
- if rv.CanAddr() {
- vp := rv.Addr().Interface().(*map[uint8]bool)
- v, changed := fastpathTV.DecMapUint8BoolV(*vp, fastpathCheckNilFalse, true, f.d)
- if changed {
- *vp = v
- }
- } else {
- v := rv.Interface().(map[uint8]bool)
- fastpathTV.DecMapUint8BoolV(v, fastpathCheckNilFalse, false, f.d)
- }
-}
-func (f fastpathT) DecMapUint8BoolX(vp *map[uint8]bool, checkNil bool, d *Decoder) {
- v, changed := f.DecMapUint8BoolV(*vp, checkNil, true, d)
- if changed {
- *vp = v
- }
-}
-func (_ fastpathT) DecMapUint8BoolV(v map[uint8]bool, checkNil bool, canChange bool,
- d *Decoder) (_ map[uint8]bool, changed bool) {
- dd := d.d
- cr := d.cr
-
- if checkNil && dd.TryDecodeAsNil() {
- if v != nil {
- changed = true
- }
- return nil, changed
- }
-
- containerLen := dd.ReadMapStart()
- if canChange && v == nil {
- xlen, _ := decInferLen(containerLen, d.h.MaxInitLen, 2)
- v = make(map[uint8]bool, xlen)
- changed = true
- }
-
- var mk uint8
- var mv bool
- if containerLen > 0 {
- for j := 0; j < containerLen; j++ {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- mk = uint8(dd.DecodeUint(8))
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- mv = dd.DecodeBool()
- if v != nil {
- v[mk] = mv
- }
- }
- } else if containerLen < 0 {
- for j := 0; !dd.CheckBreak(); j++ {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- mk = uint8(dd.DecodeUint(8))
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- mv = dd.DecodeBool()
- if v != nil {
- v[mk] = mv
- }
- }
- }
- if cr != nil {
- cr.sendContainerState(containerMapEnd)
- }
- return v, changed
-}
-
-func (f *decFnInfo) fastpathDecMapUint16IntfR(rv reflect.Value) {
- if rv.CanAddr() {
- vp := rv.Addr().Interface().(*map[uint16]interface{})
- v, changed := fastpathTV.DecMapUint16IntfV(*vp, fastpathCheckNilFalse, true, f.d)
- if changed {
- *vp = v
- }
- } else {
- v := rv.Interface().(map[uint16]interface{})
- fastpathTV.DecMapUint16IntfV(v, fastpathCheckNilFalse, false, f.d)
- }
-}
-func (f fastpathT) DecMapUint16IntfX(vp *map[uint16]interface{}, checkNil bool, d *Decoder) {
- v, changed := f.DecMapUint16IntfV(*vp, checkNil, true, d)
- if changed {
- *vp = v
- }
-}
-func (_ fastpathT) DecMapUint16IntfV(v map[uint16]interface{}, checkNil bool, canChange bool,
- d *Decoder) (_ map[uint16]interface{}, changed bool) {
- dd := d.d
- cr := d.cr
-
- if checkNil && dd.TryDecodeAsNil() {
- if v != nil {
- changed = true
- }
- return nil, changed
- }
-
- containerLen := dd.ReadMapStart()
- if canChange && v == nil {
- xlen, _ := decInferLen(containerLen, d.h.MaxInitLen, 18)
- v = make(map[uint16]interface{}, xlen)
- changed = true
- }
- mapGet := !d.h.MapValueReset && !d.h.InterfaceReset
- var mk uint16
- var mv interface{}
- if containerLen > 0 {
- for j := 0; j < containerLen; j++ {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- mk = uint16(dd.DecodeUint(16))
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- if mapGet {
- mv = v[mk]
- } else {
- mv = nil
- }
- d.decode(&mv)
- if v != nil {
- v[mk] = mv
- }
- }
- } else if containerLen < 0 {
- for j := 0; !dd.CheckBreak(); j++ {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- mk = uint16(dd.DecodeUint(16))
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- if mapGet {
- mv = v[mk]
- } else {
- mv = nil
- }
- d.decode(&mv)
- if v != nil {
- v[mk] = mv
- }
- }
- }
- if cr != nil {
- cr.sendContainerState(containerMapEnd)
- }
- return v, changed
-}
-
-func (f *decFnInfo) fastpathDecMapUint16StringR(rv reflect.Value) {
- if rv.CanAddr() {
- vp := rv.Addr().Interface().(*map[uint16]string)
- v, changed := fastpathTV.DecMapUint16StringV(*vp, fastpathCheckNilFalse, true, f.d)
- if changed {
- *vp = v
- }
- } else {
- v := rv.Interface().(map[uint16]string)
- fastpathTV.DecMapUint16StringV(v, fastpathCheckNilFalse, false, f.d)
- }
-}
-func (f fastpathT) DecMapUint16StringX(vp *map[uint16]string, checkNil bool, d *Decoder) {
- v, changed := f.DecMapUint16StringV(*vp, checkNil, true, d)
- if changed {
- *vp = v
- }
-}
-func (_ fastpathT) DecMapUint16StringV(v map[uint16]string, checkNil bool, canChange bool,
- d *Decoder) (_ map[uint16]string, changed bool) {
- dd := d.d
- cr := d.cr
-
- if checkNil && dd.TryDecodeAsNil() {
- if v != nil {
- changed = true
- }
- return nil, changed
- }
-
- containerLen := dd.ReadMapStart()
- if canChange && v == nil {
- xlen, _ := decInferLen(containerLen, d.h.MaxInitLen, 18)
- v = make(map[uint16]string, xlen)
- changed = true
- }
-
- var mk uint16
- var mv string
- if containerLen > 0 {
- for j := 0; j < containerLen; j++ {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- mk = uint16(dd.DecodeUint(16))
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- mv = dd.DecodeString()
- if v != nil {
- v[mk] = mv
- }
- }
- } else if containerLen < 0 {
- for j := 0; !dd.CheckBreak(); j++ {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- mk = uint16(dd.DecodeUint(16))
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- mv = dd.DecodeString()
- if v != nil {
- v[mk] = mv
- }
- }
- }
- if cr != nil {
- cr.sendContainerState(containerMapEnd)
- }
- return v, changed
-}
-
-func (f *decFnInfo) fastpathDecMapUint16UintR(rv reflect.Value) {
- if rv.CanAddr() {
- vp := rv.Addr().Interface().(*map[uint16]uint)
- v, changed := fastpathTV.DecMapUint16UintV(*vp, fastpathCheckNilFalse, true, f.d)
- if changed {
- *vp = v
- }
- } else {
- v := rv.Interface().(map[uint16]uint)
- fastpathTV.DecMapUint16UintV(v, fastpathCheckNilFalse, false, f.d)
- }
-}
-func (f fastpathT) DecMapUint16UintX(vp *map[uint16]uint, checkNil bool, d *Decoder) {
- v, changed := f.DecMapUint16UintV(*vp, checkNil, true, d)
- if changed {
- *vp = v
- }
-}
-func (_ fastpathT) DecMapUint16UintV(v map[uint16]uint, checkNil bool, canChange bool,
- d *Decoder) (_ map[uint16]uint, changed bool) {
- dd := d.d
- cr := d.cr
-
- if checkNil && dd.TryDecodeAsNil() {
- if v != nil {
- changed = true
- }
- return nil, changed
- }
-
- containerLen := dd.ReadMapStart()
- if canChange && v == nil {
- xlen, _ := decInferLen(containerLen, d.h.MaxInitLen, 10)
- v = make(map[uint16]uint, xlen)
- changed = true
- }
-
- var mk uint16
- var mv uint
- if containerLen > 0 {
- for j := 0; j < containerLen; j++ {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- mk = uint16(dd.DecodeUint(16))
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- mv = uint(dd.DecodeUint(uintBitsize))
- if v != nil {
- v[mk] = mv
- }
- }
- } else if containerLen < 0 {
- for j := 0; !dd.CheckBreak(); j++ {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- mk = uint16(dd.DecodeUint(16))
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- mv = uint(dd.DecodeUint(uintBitsize))
- if v != nil {
- v[mk] = mv
- }
- }
- }
- if cr != nil {
- cr.sendContainerState(containerMapEnd)
- }
- return v, changed
-}
-
-func (f *decFnInfo) fastpathDecMapUint16Uint8R(rv reflect.Value) {
- if rv.CanAddr() {
- vp := rv.Addr().Interface().(*map[uint16]uint8)
- v, changed := fastpathTV.DecMapUint16Uint8V(*vp, fastpathCheckNilFalse, true, f.d)
- if changed {
- *vp = v
- }
- } else {
- v := rv.Interface().(map[uint16]uint8)
- fastpathTV.DecMapUint16Uint8V(v, fastpathCheckNilFalse, false, f.d)
- }
-}
-func (f fastpathT) DecMapUint16Uint8X(vp *map[uint16]uint8, checkNil bool, d *Decoder) {
- v, changed := f.DecMapUint16Uint8V(*vp, checkNil, true, d)
- if changed {
- *vp = v
- }
-}
-func (_ fastpathT) DecMapUint16Uint8V(v map[uint16]uint8, checkNil bool, canChange bool,
- d *Decoder) (_ map[uint16]uint8, changed bool) {
- dd := d.d
- cr := d.cr
-
- if checkNil && dd.TryDecodeAsNil() {
- if v != nil {
- changed = true
- }
- return nil, changed
- }
-
- containerLen := dd.ReadMapStart()
- if canChange && v == nil {
- xlen, _ := decInferLen(containerLen, d.h.MaxInitLen, 3)
- v = make(map[uint16]uint8, xlen)
- changed = true
- }
-
- var mk uint16
- var mv uint8
- if containerLen > 0 {
- for j := 0; j < containerLen; j++ {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- mk = uint16(dd.DecodeUint(16))
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- mv = uint8(dd.DecodeUint(8))
- if v != nil {
- v[mk] = mv
- }
- }
- } else if containerLen < 0 {
- for j := 0; !dd.CheckBreak(); j++ {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- mk = uint16(dd.DecodeUint(16))
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- mv = uint8(dd.DecodeUint(8))
- if v != nil {
- v[mk] = mv
- }
- }
- }
- if cr != nil {
- cr.sendContainerState(containerMapEnd)
- }
- return v, changed
-}
-
-func (f *decFnInfo) fastpathDecMapUint16Uint16R(rv reflect.Value) {
- if rv.CanAddr() {
- vp := rv.Addr().Interface().(*map[uint16]uint16)
- v, changed := fastpathTV.DecMapUint16Uint16V(*vp, fastpathCheckNilFalse, true, f.d)
- if changed {
- *vp = v
- }
- } else {
- v := rv.Interface().(map[uint16]uint16)
- fastpathTV.DecMapUint16Uint16V(v, fastpathCheckNilFalse, false, f.d)
- }
-}
-func (f fastpathT) DecMapUint16Uint16X(vp *map[uint16]uint16, checkNil bool, d *Decoder) {
- v, changed := f.DecMapUint16Uint16V(*vp, checkNil, true, d)
- if changed {
- *vp = v
- }
-}
-func (_ fastpathT) DecMapUint16Uint16V(v map[uint16]uint16, checkNil bool, canChange bool,
- d *Decoder) (_ map[uint16]uint16, changed bool) {
- dd := d.d
- cr := d.cr
-
- if checkNil && dd.TryDecodeAsNil() {
- if v != nil {
- changed = true
- }
- return nil, changed
- }
-
- containerLen := dd.ReadMapStart()
- if canChange && v == nil {
- xlen, _ := decInferLen(containerLen, d.h.MaxInitLen, 4)
- v = make(map[uint16]uint16, xlen)
- changed = true
- }
-
- var mk uint16
- var mv uint16
- if containerLen > 0 {
- for j := 0; j < containerLen; j++ {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- mk = uint16(dd.DecodeUint(16))
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- mv = uint16(dd.DecodeUint(16))
- if v != nil {
- v[mk] = mv
- }
- }
- } else if containerLen < 0 {
- for j := 0; !dd.CheckBreak(); j++ {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- mk = uint16(dd.DecodeUint(16))
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- mv = uint16(dd.DecodeUint(16))
- if v != nil {
- v[mk] = mv
- }
- }
- }
- if cr != nil {
- cr.sendContainerState(containerMapEnd)
- }
- return v, changed
-}
-
-func (f *decFnInfo) fastpathDecMapUint16Uint32R(rv reflect.Value) {
- if rv.CanAddr() {
- vp := rv.Addr().Interface().(*map[uint16]uint32)
- v, changed := fastpathTV.DecMapUint16Uint32V(*vp, fastpathCheckNilFalse, true, f.d)
- if changed {
- *vp = v
- }
- } else {
- v := rv.Interface().(map[uint16]uint32)
- fastpathTV.DecMapUint16Uint32V(v, fastpathCheckNilFalse, false, f.d)
- }
-}
-func (f fastpathT) DecMapUint16Uint32X(vp *map[uint16]uint32, checkNil bool, d *Decoder) {
- v, changed := f.DecMapUint16Uint32V(*vp, checkNil, true, d)
- if changed {
- *vp = v
- }
-}
-func (_ fastpathT) DecMapUint16Uint32V(v map[uint16]uint32, checkNil bool, canChange bool,
- d *Decoder) (_ map[uint16]uint32, changed bool) {
- dd := d.d
- cr := d.cr
-
- if checkNil && dd.TryDecodeAsNil() {
- if v != nil {
- changed = true
- }
- return nil, changed
- }
-
- containerLen := dd.ReadMapStart()
- if canChange && v == nil {
- xlen, _ := decInferLen(containerLen, d.h.MaxInitLen, 6)
- v = make(map[uint16]uint32, xlen)
- changed = true
- }
-
- var mk uint16
- var mv uint32
- if containerLen > 0 {
- for j := 0; j < containerLen; j++ {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- mk = uint16(dd.DecodeUint(16))
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- mv = uint32(dd.DecodeUint(32))
- if v != nil {
- v[mk] = mv
- }
- }
- } else if containerLen < 0 {
- for j := 0; !dd.CheckBreak(); j++ {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- mk = uint16(dd.DecodeUint(16))
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- mv = uint32(dd.DecodeUint(32))
- if v != nil {
- v[mk] = mv
- }
- }
- }
- if cr != nil {
- cr.sendContainerState(containerMapEnd)
- }
- return v, changed
-}
-
-func (f *decFnInfo) fastpathDecMapUint16Uint64R(rv reflect.Value) {
- if rv.CanAddr() {
- vp := rv.Addr().Interface().(*map[uint16]uint64)
- v, changed := fastpathTV.DecMapUint16Uint64V(*vp, fastpathCheckNilFalse, true, f.d)
- if changed {
- *vp = v
- }
- } else {
- v := rv.Interface().(map[uint16]uint64)
- fastpathTV.DecMapUint16Uint64V(v, fastpathCheckNilFalse, false, f.d)
- }
-}
-func (f fastpathT) DecMapUint16Uint64X(vp *map[uint16]uint64, checkNil bool, d *Decoder) {
- v, changed := f.DecMapUint16Uint64V(*vp, checkNil, true, d)
- if changed {
- *vp = v
- }
-}
-func (_ fastpathT) DecMapUint16Uint64V(v map[uint16]uint64, checkNil bool, canChange bool,
- d *Decoder) (_ map[uint16]uint64, changed bool) {
- dd := d.d
- cr := d.cr
-
- if checkNil && dd.TryDecodeAsNil() {
- if v != nil {
- changed = true
- }
- return nil, changed
- }
-
- containerLen := dd.ReadMapStart()
- if canChange && v == nil {
- xlen, _ := decInferLen(containerLen, d.h.MaxInitLen, 10)
- v = make(map[uint16]uint64, xlen)
- changed = true
- }
-
- var mk uint16
- var mv uint64
- if containerLen > 0 {
- for j := 0; j < containerLen; j++ {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- mk = uint16(dd.DecodeUint(16))
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- mv = dd.DecodeUint(64)
- if v != nil {
- v[mk] = mv
- }
- }
- } else if containerLen < 0 {
- for j := 0; !dd.CheckBreak(); j++ {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- mk = uint16(dd.DecodeUint(16))
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- mv = dd.DecodeUint(64)
- if v != nil {
- v[mk] = mv
- }
- }
- }
- if cr != nil {
- cr.sendContainerState(containerMapEnd)
- }
- return v, changed
-}
-
-func (f *decFnInfo) fastpathDecMapUint16UintptrR(rv reflect.Value) {
- if rv.CanAddr() {
- vp := rv.Addr().Interface().(*map[uint16]uintptr)
- v, changed := fastpathTV.DecMapUint16UintptrV(*vp, fastpathCheckNilFalse, true, f.d)
- if changed {
- *vp = v
- }
- } else {
- v := rv.Interface().(map[uint16]uintptr)
- fastpathTV.DecMapUint16UintptrV(v, fastpathCheckNilFalse, false, f.d)
- }
-}
-func (f fastpathT) DecMapUint16UintptrX(vp *map[uint16]uintptr, checkNil bool, d *Decoder) {
- v, changed := f.DecMapUint16UintptrV(*vp, checkNil, true, d)
- if changed {
- *vp = v
- }
-}
-func (_ fastpathT) DecMapUint16UintptrV(v map[uint16]uintptr, checkNil bool, canChange bool,
- d *Decoder) (_ map[uint16]uintptr, changed bool) {
- dd := d.d
- cr := d.cr
-
- if checkNil && dd.TryDecodeAsNil() {
- if v != nil {
- changed = true
- }
- return nil, changed
- }
-
- containerLen := dd.ReadMapStart()
- if canChange && v == nil {
- xlen, _ := decInferLen(containerLen, d.h.MaxInitLen, 10)
- v = make(map[uint16]uintptr, xlen)
- changed = true
- }
-
- var mk uint16
- var mv uintptr
- if containerLen > 0 {
- for j := 0; j < containerLen; j++ {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- mk = uint16(dd.DecodeUint(16))
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- mv = uintptr(dd.DecodeUint(uintBitsize))
- if v != nil {
- v[mk] = mv
- }
- }
- } else if containerLen < 0 {
- for j := 0; !dd.CheckBreak(); j++ {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- mk = uint16(dd.DecodeUint(16))
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- mv = uintptr(dd.DecodeUint(uintBitsize))
- if v != nil {
- v[mk] = mv
- }
- }
- }
- if cr != nil {
- cr.sendContainerState(containerMapEnd)
- }
- return v, changed
-}
-
-func (f *decFnInfo) fastpathDecMapUint16IntR(rv reflect.Value) {
- if rv.CanAddr() {
- vp := rv.Addr().Interface().(*map[uint16]int)
- v, changed := fastpathTV.DecMapUint16IntV(*vp, fastpathCheckNilFalse, true, f.d)
- if changed {
- *vp = v
- }
- } else {
- v := rv.Interface().(map[uint16]int)
- fastpathTV.DecMapUint16IntV(v, fastpathCheckNilFalse, false, f.d)
- }
-}
-func (f fastpathT) DecMapUint16IntX(vp *map[uint16]int, checkNil bool, d *Decoder) {
- v, changed := f.DecMapUint16IntV(*vp, checkNil, true, d)
- if changed {
- *vp = v
- }
-}
-func (_ fastpathT) DecMapUint16IntV(v map[uint16]int, checkNil bool, canChange bool,
- d *Decoder) (_ map[uint16]int, changed bool) {
- dd := d.d
- cr := d.cr
-
- if checkNil && dd.TryDecodeAsNil() {
- if v != nil {
- changed = true
- }
- return nil, changed
- }
-
- containerLen := dd.ReadMapStart()
- if canChange && v == nil {
- xlen, _ := decInferLen(containerLen, d.h.MaxInitLen, 10)
- v = make(map[uint16]int, xlen)
- changed = true
- }
-
- var mk uint16
- var mv int
- if containerLen > 0 {
- for j := 0; j < containerLen; j++ {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- mk = uint16(dd.DecodeUint(16))
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- mv = int(dd.DecodeInt(intBitsize))
- if v != nil {
- v[mk] = mv
- }
- }
- } else if containerLen < 0 {
- for j := 0; !dd.CheckBreak(); j++ {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- mk = uint16(dd.DecodeUint(16))
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- mv = int(dd.DecodeInt(intBitsize))
- if v != nil {
- v[mk] = mv
- }
- }
- }
- if cr != nil {
- cr.sendContainerState(containerMapEnd)
- }
- return v, changed
-}
-
-func (f *decFnInfo) fastpathDecMapUint16Int8R(rv reflect.Value) {
- if rv.CanAddr() {
- vp := rv.Addr().Interface().(*map[uint16]int8)
- v, changed := fastpathTV.DecMapUint16Int8V(*vp, fastpathCheckNilFalse, true, f.d)
- if changed {
- *vp = v
- }
- } else {
- v := rv.Interface().(map[uint16]int8)
- fastpathTV.DecMapUint16Int8V(v, fastpathCheckNilFalse, false, f.d)
- }
-}
-func (f fastpathT) DecMapUint16Int8X(vp *map[uint16]int8, checkNil bool, d *Decoder) {
- v, changed := f.DecMapUint16Int8V(*vp, checkNil, true, d)
- if changed {
- *vp = v
- }
-}
-func (_ fastpathT) DecMapUint16Int8V(v map[uint16]int8, checkNil bool, canChange bool,
- d *Decoder) (_ map[uint16]int8, changed bool) {
- dd := d.d
- cr := d.cr
-
- if checkNil && dd.TryDecodeAsNil() {
- if v != nil {
- changed = true
- }
- return nil, changed
- }
-
- containerLen := dd.ReadMapStart()
- if canChange && v == nil {
- xlen, _ := decInferLen(containerLen, d.h.MaxInitLen, 3)
- v = make(map[uint16]int8, xlen)
- changed = true
- }
-
- var mk uint16
- var mv int8
- if containerLen > 0 {
- for j := 0; j < containerLen; j++ {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- mk = uint16(dd.DecodeUint(16))
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- mv = int8(dd.DecodeInt(8))
- if v != nil {
- v[mk] = mv
- }
- }
- } else if containerLen < 0 {
- for j := 0; !dd.CheckBreak(); j++ {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- mk = uint16(dd.DecodeUint(16))
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- mv = int8(dd.DecodeInt(8))
- if v != nil {
- v[mk] = mv
- }
- }
- }
- if cr != nil {
- cr.sendContainerState(containerMapEnd)
- }
- return v, changed
-}
-
-func (f *decFnInfo) fastpathDecMapUint16Int16R(rv reflect.Value) {
- if rv.CanAddr() {
- vp := rv.Addr().Interface().(*map[uint16]int16)
- v, changed := fastpathTV.DecMapUint16Int16V(*vp, fastpathCheckNilFalse, true, f.d)
- if changed {
- *vp = v
- }
- } else {
- v := rv.Interface().(map[uint16]int16)
- fastpathTV.DecMapUint16Int16V(v, fastpathCheckNilFalse, false, f.d)
- }
-}
-func (f fastpathT) DecMapUint16Int16X(vp *map[uint16]int16, checkNil bool, d *Decoder) {
- v, changed := f.DecMapUint16Int16V(*vp, checkNil, true, d)
- if changed {
- *vp = v
- }
-}
-func (_ fastpathT) DecMapUint16Int16V(v map[uint16]int16, checkNil bool, canChange bool,
- d *Decoder) (_ map[uint16]int16, changed bool) {
- dd := d.d
- cr := d.cr
-
- if checkNil && dd.TryDecodeAsNil() {
- if v != nil {
- changed = true
- }
- return nil, changed
- }
-
- containerLen := dd.ReadMapStart()
- if canChange && v == nil {
- xlen, _ := decInferLen(containerLen, d.h.MaxInitLen, 4)
- v = make(map[uint16]int16, xlen)
- changed = true
- }
-
- var mk uint16
- var mv int16
- if containerLen > 0 {
- for j := 0; j < containerLen; j++ {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- mk = uint16(dd.DecodeUint(16))
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- mv = int16(dd.DecodeInt(16))
- if v != nil {
- v[mk] = mv
- }
- }
- } else if containerLen < 0 {
- for j := 0; !dd.CheckBreak(); j++ {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- mk = uint16(dd.DecodeUint(16))
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- mv = int16(dd.DecodeInt(16))
- if v != nil {
- v[mk] = mv
- }
- }
- }
- if cr != nil {
- cr.sendContainerState(containerMapEnd)
- }
- return v, changed
-}
-
-func (f *decFnInfo) fastpathDecMapUint16Int32R(rv reflect.Value) {
- if rv.CanAddr() {
- vp := rv.Addr().Interface().(*map[uint16]int32)
- v, changed := fastpathTV.DecMapUint16Int32V(*vp, fastpathCheckNilFalse, true, f.d)
- if changed {
- *vp = v
- }
- } else {
- v := rv.Interface().(map[uint16]int32)
- fastpathTV.DecMapUint16Int32V(v, fastpathCheckNilFalse, false, f.d)
- }
-}
-func (f fastpathT) DecMapUint16Int32X(vp *map[uint16]int32, checkNil bool, d *Decoder) {
- v, changed := f.DecMapUint16Int32V(*vp, checkNil, true, d)
- if changed {
- *vp = v
- }
-}
-func (_ fastpathT) DecMapUint16Int32V(v map[uint16]int32, checkNil bool, canChange bool,
- d *Decoder) (_ map[uint16]int32, changed bool) {
- dd := d.d
- cr := d.cr
-
- if checkNil && dd.TryDecodeAsNil() {
- if v != nil {
- changed = true
- }
- return nil, changed
- }
-
- containerLen := dd.ReadMapStart()
- if canChange && v == nil {
- xlen, _ := decInferLen(containerLen, d.h.MaxInitLen, 6)
- v = make(map[uint16]int32, xlen)
- changed = true
- }
-
- var mk uint16
- var mv int32
- if containerLen > 0 {
- for j := 0; j < containerLen; j++ {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- mk = uint16(dd.DecodeUint(16))
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- mv = int32(dd.DecodeInt(32))
- if v != nil {
- v[mk] = mv
- }
- }
- } else if containerLen < 0 {
- for j := 0; !dd.CheckBreak(); j++ {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- mk = uint16(dd.DecodeUint(16))
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- mv = int32(dd.DecodeInt(32))
- if v != nil {
- v[mk] = mv
- }
- }
- }
- if cr != nil {
- cr.sendContainerState(containerMapEnd)
- }
- return v, changed
-}
-
-func (f *decFnInfo) fastpathDecMapUint16Int64R(rv reflect.Value) {
- if rv.CanAddr() {
- vp := rv.Addr().Interface().(*map[uint16]int64)
- v, changed := fastpathTV.DecMapUint16Int64V(*vp, fastpathCheckNilFalse, true, f.d)
- if changed {
- *vp = v
- }
- } else {
- v := rv.Interface().(map[uint16]int64)
- fastpathTV.DecMapUint16Int64V(v, fastpathCheckNilFalse, false, f.d)
- }
-}
-func (f fastpathT) DecMapUint16Int64X(vp *map[uint16]int64, checkNil bool, d *Decoder) {
- v, changed := f.DecMapUint16Int64V(*vp, checkNil, true, d)
- if changed {
- *vp = v
- }
-}
-func (_ fastpathT) DecMapUint16Int64V(v map[uint16]int64, checkNil bool, canChange bool,
- d *Decoder) (_ map[uint16]int64, changed bool) {
- dd := d.d
- cr := d.cr
-
- if checkNil && dd.TryDecodeAsNil() {
- if v != nil {
- changed = true
- }
- return nil, changed
- }
-
- containerLen := dd.ReadMapStart()
- if canChange && v == nil {
- xlen, _ := decInferLen(containerLen, d.h.MaxInitLen, 10)
- v = make(map[uint16]int64, xlen)
- changed = true
- }
-
- var mk uint16
- var mv int64
- if containerLen > 0 {
- for j := 0; j < containerLen; j++ {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- mk = uint16(dd.DecodeUint(16))
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- mv = dd.DecodeInt(64)
- if v != nil {
- v[mk] = mv
- }
- }
- } else if containerLen < 0 {
- for j := 0; !dd.CheckBreak(); j++ {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- mk = uint16(dd.DecodeUint(16))
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- mv = dd.DecodeInt(64)
- if v != nil {
- v[mk] = mv
- }
- }
- }
- if cr != nil {
- cr.sendContainerState(containerMapEnd)
- }
- return v, changed
-}
-
-func (f *decFnInfo) fastpathDecMapUint16Float32R(rv reflect.Value) {
- if rv.CanAddr() {
- vp := rv.Addr().Interface().(*map[uint16]float32)
- v, changed := fastpathTV.DecMapUint16Float32V(*vp, fastpathCheckNilFalse, true, f.d)
- if changed {
- *vp = v
- }
- } else {
- v := rv.Interface().(map[uint16]float32)
- fastpathTV.DecMapUint16Float32V(v, fastpathCheckNilFalse, false, f.d)
- }
-}
-func (f fastpathT) DecMapUint16Float32X(vp *map[uint16]float32, checkNil bool, d *Decoder) {
- v, changed := f.DecMapUint16Float32V(*vp, checkNil, true, d)
- if changed {
- *vp = v
- }
-}
-func (_ fastpathT) DecMapUint16Float32V(v map[uint16]float32, checkNil bool, canChange bool,
- d *Decoder) (_ map[uint16]float32, changed bool) {
- dd := d.d
- cr := d.cr
-
- if checkNil && dd.TryDecodeAsNil() {
- if v != nil {
- changed = true
- }
- return nil, changed
- }
-
- containerLen := dd.ReadMapStart()
- if canChange && v == nil {
- xlen, _ := decInferLen(containerLen, d.h.MaxInitLen, 6)
- v = make(map[uint16]float32, xlen)
- changed = true
- }
-
- var mk uint16
- var mv float32
- if containerLen > 0 {
- for j := 0; j < containerLen; j++ {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- mk = uint16(dd.DecodeUint(16))
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- mv = float32(dd.DecodeFloat(true))
- if v != nil {
- v[mk] = mv
- }
- }
- } else if containerLen < 0 {
- for j := 0; !dd.CheckBreak(); j++ {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- mk = uint16(dd.DecodeUint(16))
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- mv = float32(dd.DecodeFloat(true))
- if v != nil {
- v[mk] = mv
- }
- }
- }
- if cr != nil {
- cr.sendContainerState(containerMapEnd)
- }
- return v, changed
-}
-
-func (f *decFnInfo) fastpathDecMapUint16Float64R(rv reflect.Value) {
- if rv.CanAddr() {
- vp := rv.Addr().Interface().(*map[uint16]float64)
- v, changed := fastpathTV.DecMapUint16Float64V(*vp, fastpathCheckNilFalse, true, f.d)
- if changed {
- *vp = v
- }
- } else {
- v := rv.Interface().(map[uint16]float64)
- fastpathTV.DecMapUint16Float64V(v, fastpathCheckNilFalse, false, f.d)
- }
-}
-func (f fastpathT) DecMapUint16Float64X(vp *map[uint16]float64, checkNil bool, d *Decoder) {
- v, changed := f.DecMapUint16Float64V(*vp, checkNil, true, d)
- if changed {
- *vp = v
- }
-}
-func (_ fastpathT) DecMapUint16Float64V(v map[uint16]float64, checkNil bool, canChange bool,
- d *Decoder) (_ map[uint16]float64, changed bool) {
- dd := d.d
- cr := d.cr
-
- if checkNil && dd.TryDecodeAsNil() {
- if v != nil {
- changed = true
- }
- return nil, changed
- }
-
- containerLen := dd.ReadMapStart()
- if canChange && v == nil {
- xlen, _ := decInferLen(containerLen, d.h.MaxInitLen, 10)
- v = make(map[uint16]float64, xlen)
- changed = true
- }
-
- var mk uint16
- var mv float64
- if containerLen > 0 {
- for j := 0; j < containerLen; j++ {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- mk = uint16(dd.DecodeUint(16))
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- mv = dd.DecodeFloat(false)
- if v != nil {
- v[mk] = mv
- }
- }
- } else if containerLen < 0 {
- for j := 0; !dd.CheckBreak(); j++ {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- mk = uint16(dd.DecodeUint(16))
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- mv = dd.DecodeFloat(false)
- if v != nil {
- v[mk] = mv
- }
- }
- }
- if cr != nil {
- cr.sendContainerState(containerMapEnd)
- }
- return v, changed
-}
-
-func (f *decFnInfo) fastpathDecMapUint16BoolR(rv reflect.Value) {
- if rv.CanAddr() {
- vp := rv.Addr().Interface().(*map[uint16]bool)
- v, changed := fastpathTV.DecMapUint16BoolV(*vp, fastpathCheckNilFalse, true, f.d)
- if changed {
- *vp = v
- }
- } else {
- v := rv.Interface().(map[uint16]bool)
- fastpathTV.DecMapUint16BoolV(v, fastpathCheckNilFalse, false, f.d)
- }
-}
-func (f fastpathT) DecMapUint16BoolX(vp *map[uint16]bool, checkNil bool, d *Decoder) {
- v, changed := f.DecMapUint16BoolV(*vp, checkNil, true, d)
- if changed {
- *vp = v
- }
-}
-func (_ fastpathT) DecMapUint16BoolV(v map[uint16]bool, checkNil bool, canChange bool,
- d *Decoder) (_ map[uint16]bool, changed bool) {
- dd := d.d
- cr := d.cr
-
- if checkNil && dd.TryDecodeAsNil() {
- if v != nil {
- changed = true
- }
- return nil, changed
- }
-
- containerLen := dd.ReadMapStart()
- if canChange && v == nil {
- xlen, _ := decInferLen(containerLen, d.h.MaxInitLen, 3)
- v = make(map[uint16]bool, xlen)
- changed = true
- }
-
- var mk uint16
- var mv bool
- if containerLen > 0 {
- for j := 0; j < containerLen; j++ {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- mk = uint16(dd.DecodeUint(16))
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- mv = dd.DecodeBool()
- if v != nil {
- v[mk] = mv
- }
- }
- } else if containerLen < 0 {
- for j := 0; !dd.CheckBreak(); j++ {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- mk = uint16(dd.DecodeUint(16))
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- mv = dd.DecodeBool()
- if v != nil {
- v[mk] = mv
- }
- }
- }
- if cr != nil {
- cr.sendContainerState(containerMapEnd)
- }
- return v, changed
-}
-
-func (f *decFnInfo) fastpathDecMapUint32IntfR(rv reflect.Value) {
- if rv.CanAddr() {
- vp := rv.Addr().Interface().(*map[uint32]interface{})
- v, changed := fastpathTV.DecMapUint32IntfV(*vp, fastpathCheckNilFalse, true, f.d)
- if changed {
- *vp = v
- }
- } else {
- v := rv.Interface().(map[uint32]interface{})
- fastpathTV.DecMapUint32IntfV(v, fastpathCheckNilFalse, false, f.d)
- }
-}
-func (f fastpathT) DecMapUint32IntfX(vp *map[uint32]interface{}, checkNil bool, d *Decoder) {
- v, changed := f.DecMapUint32IntfV(*vp, checkNil, true, d)
- if changed {
- *vp = v
- }
-}
-func (_ fastpathT) DecMapUint32IntfV(v map[uint32]interface{}, checkNil bool, canChange bool,
- d *Decoder) (_ map[uint32]interface{}, changed bool) {
- dd := d.d
- cr := d.cr
-
- if checkNil && dd.TryDecodeAsNil() {
- if v != nil {
- changed = true
- }
- return nil, changed
- }
-
- containerLen := dd.ReadMapStart()
- if canChange && v == nil {
- xlen, _ := decInferLen(containerLen, d.h.MaxInitLen, 20)
- v = make(map[uint32]interface{}, xlen)
- changed = true
- }
- mapGet := !d.h.MapValueReset && !d.h.InterfaceReset
- var mk uint32
- var mv interface{}
- if containerLen > 0 {
- for j := 0; j < containerLen; j++ {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- mk = uint32(dd.DecodeUint(32))
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- if mapGet {
- mv = v[mk]
- } else {
- mv = nil
- }
- d.decode(&mv)
- if v != nil {
- v[mk] = mv
- }
- }
- } else if containerLen < 0 {
- for j := 0; !dd.CheckBreak(); j++ {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- mk = uint32(dd.DecodeUint(32))
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- if mapGet {
- mv = v[mk]
- } else {
- mv = nil
- }
- d.decode(&mv)
- if v != nil {
- v[mk] = mv
- }
- }
- }
- if cr != nil {
- cr.sendContainerState(containerMapEnd)
- }
- return v, changed
-}
-
-func (f *decFnInfo) fastpathDecMapUint32StringR(rv reflect.Value) {
- if rv.CanAddr() {
- vp := rv.Addr().Interface().(*map[uint32]string)
- v, changed := fastpathTV.DecMapUint32StringV(*vp, fastpathCheckNilFalse, true, f.d)
- if changed {
- *vp = v
- }
- } else {
- v := rv.Interface().(map[uint32]string)
- fastpathTV.DecMapUint32StringV(v, fastpathCheckNilFalse, false, f.d)
- }
-}
-func (f fastpathT) DecMapUint32StringX(vp *map[uint32]string, checkNil bool, d *Decoder) {
- v, changed := f.DecMapUint32StringV(*vp, checkNil, true, d)
- if changed {
- *vp = v
- }
-}
-func (_ fastpathT) DecMapUint32StringV(v map[uint32]string, checkNil bool, canChange bool,
- d *Decoder) (_ map[uint32]string, changed bool) {
- dd := d.d
- cr := d.cr
-
- if checkNil && dd.TryDecodeAsNil() {
- if v != nil {
- changed = true
- }
- return nil, changed
- }
-
- containerLen := dd.ReadMapStart()
- if canChange && v == nil {
- xlen, _ := decInferLen(containerLen, d.h.MaxInitLen, 20)
- v = make(map[uint32]string, xlen)
- changed = true
- }
-
- var mk uint32
- var mv string
- if containerLen > 0 {
- for j := 0; j < containerLen; j++ {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- mk = uint32(dd.DecodeUint(32))
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- mv = dd.DecodeString()
- if v != nil {
- v[mk] = mv
- }
- }
- } else if containerLen < 0 {
- for j := 0; !dd.CheckBreak(); j++ {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- mk = uint32(dd.DecodeUint(32))
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- mv = dd.DecodeString()
- if v != nil {
- v[mk] = mv
- }
- }
- }
- if cr != nil {
- cr.sendContainerState(containerMapEnd)
- }
- return v, changed
-}
-
-func (f *decFnInfo) fastpathDecMapUint32UintR(rv reflect.Value) {
- if rv.CanAddr() {
- vp := rv.Addr().Interface().(*map[uint32]uint)
- v, changed := fastpathTV.DecMapUint32UintV(*vp, fastpathCheckNilFalse, true, f.d)
- if changed {
- *vp = v
- }
- } else {
- v := rv.Interface().(map[uint32]uint)
- fastpathTV.DecMapUint32UintV(v, fastpathCheckNilFalse, false, f.d)
- }
-}
-func (f fastpathT) DecMapUint32UintX(vp *map[uint32]uint, checkNil bool, d *Decoder) {
- v, changed := f.DecMapUint32UintV(*vp, checkNil, true, d)
- if changed {
- *vp = v
- }
-}
-func (_ fastpathT) DecMapUint32UintV(v map[uint32]uint, checkNil bool, canChange bool,
- d *Decoder) (_ map[uint32]uint, changed bool) {
- dd := d.d
- cr := d.cr
-
- if checkNil && dd.TryDecodeAsNil() {
- if v != nil {
- changed = true
- }
- return nil, changed
- }
-
- containerLen := dd.ReadMapStart()
- if canChange && v == nil {
- xlen, _ := decInferLen(containerLen, d.h.MaxInitLen, 12)
- v = make(map[uint32]uint, xlen)
- changed = true
- }
-
- var mk uint32
- var mv uint
- if containerLen > 0 {
- for j := 0; j < containerLen; j++ {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- mk = uint32(dd.DecodeUint(32))
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- mv = uint(dd.DecodeUint(uintBitsize))
- if v != nil {
- v[mk] = mv
- }
- }
- } else if containerLen < 0 {
- for j := 0; !dd.CheckBreak(); j++ {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- mk = uint32(dd.DecodeUint(32))
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- mv = uint(dd.DecodeUint(uintBitsize))
- if v != nil {
- v[mk] = mv
- }
- }
- }
- if cr != nil {
- cr.sendContainerState(containerMapEnd)
- }
- return v, changed
-}
-
-func (f *decFnInfo) fastpathDecMapUint32Uint8R(rv reflect.Value) {
- if rv.CanAddr() {
- vp := rv.Addr().Interface().(*map[uint32]uint8)
- v, changed := fastpathTV.DecMapUint32Uint8V(*vp, fastpathCheckNilFalse, true, f.d)
- if changed {
- *vp = v
- }
- } else {
- v := rv.Interface().(map[uint32]uint8)
- fastpathTV.DecMapUint32Uint8V(v, fastpathCheckNilFalse, false, f.d)
- }
-}
-func (f fastpathT) DecMapUint32Uint8X(vp *map[uint32]uint8, checkNil bool, d *Decoder) {
- v, changed := f.DecMapUint32Uint8V(*vp, checkNil, true, d)
- if changed {
- *vp = v
- }
-}
-func (_ fastpathT) DecMapUint32Uint8V(v map[uint32]uint8, checkNil bool, canChange bool,
- d *Decoder) (_ map[uint32]uint8, changed bool) {
- dd := d.d
- cr := d.cr
-
- if checkNil && dd.TryDecodeAsNil() {
- if v != nil {
- changed = true
- }
- return nil, changed
- }
-
- containerLen := dd.ReadMapStart()
- if canChange && v == nil {
- xlen, _ := decInferLen(containerLen, d.h.MaxInitLen, 5)
- v = make(map[uint32]uint8, xlen)
- changed = true
- }
-
- var mk uint32
- var mv uint8
- if containerLen > 0 {
- for j := 0; j < containerLen; j++ {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- mk = uint32(dd.DecodeUint(32))
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- mv = uint8(dd.DecodeUint(8))
- if v != nil {
- v[mk] = mv
- }
- }
- } else if containerLen < 0 {
- for j := 0; !dd.CheckBreak(); j++ {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- mk = uint32(dd.DecodeUint(32))
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- mv = uint8(dd.DecodeUint(8))
- if v != nil {
- v[mk] = mv
- }
- }
- }
- if cr != nil {
- cr.sendContainerState(containerMapEnd)
- }
- return v, changed
-}
-
-func (f *decFnInfo) fastpathDecMapUint32Uint16R(rv reflect.Value) {
- if rv.CanAddr() {
- vp := rv.Addr().Interface().(*map[uint32]uint16)
- v, changed := fastpathTV.DecMapUint32Uint16V(*vp, fastpathCheckNilFalse, true, f.d)
- if changed {
- *vp = v
- }
- } else {
- v := rv.Interface().(map[uint32]uint16)
- fastpathTV.DecMapUint32Uint16V(v, fastpathCheckNilFalse, false, f.d)
- }
-}
-func (f fastpathT) DecMapUint32Uint16X(vp *map[uint32]uint16, checkNil bool, d *Decoder) {
- v, changed := f.DecMapUint32Uint16V(*vp, checkNil, true, d)
- if changed {
- *vp = v
- }
-}
-func (_ fastpathT) DecMapUint32Uint16V(v map[uint32]uint16, checkNil bool, canChange bool,
- d *Decoder) (_ map[uint32]uint16, changed bool) {
- dd := d.d
- cr := d.cr
-
- if checkNil && dd.TryDecodeAsNil() {
- if v != nil {
- changed = true
- }
- return nil, changed
- }
-
- containerLen := dd.ReadMapStart()
- if canChange && v == nil {
- xlen, _ := decInferLen(containerLen, d.h.MaxInitLen, 6)
- v = make(map[uint32]uint16, xlen)
- changed = true
- }
-
- var mk uint32
- var mv uint16
- if containerLen > 0 {
- for j := 0; j < containerLen; j++ {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- mk = uint32(dd.DecodeUint(32))
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- mv = uint16(dd.DecodeUint(16))
- if v != nil {
- v[mk] = mv
- }
- }
- } else if containerLen < 0 {
- for j := 0; !dd.CheckBreak(); j++ {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- mk = uint32(dd.DecodeUint(32))
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- mv = uint16(dd.DecodeUint(16))
- if v != nil {
- v[mk] = mv
- }
- }
- }
- if cr != nil {
- cr.sendContainerState(containerMapEnd)
- }
- return v, changed
-}
-
-func (f *decFnInfo) fastpathDecMapUint32Uint32R(rv reflect.Value) {
- if rv.CanAddr() {
- vp := rv.Addr().Interface().(*map[uint32]uint32)
- v, changed := fastpathTV.DecMapUint32Uint32V(*vp, fastpathCheckNilFalse, true, f.d)
- if changed {
- *vp = v
- }
- } else {
- v := rv.Interface().(map[uint32]uint32)
- fastpathTV.DecMapUint32Uint32V(v, fastpathCheckNilFalse, false, f.d)
- }
-}
-func (f fastpathT) DecMapUint32Uint32X(vp *map[uint32]uint32, checkNil bool, d *Decoder) {
- v, changed := f.DecMapUint32Uint32V(*vp, checkNil, true, d)
- if changed {
- *vp = v
- }
-}
-func (_ fastpathT) DecMapUint32Uint32V(v map[uint32]uint32, checkNil bool, canChange bool,
- d *Decoder) (_ map[uint32]uint32, changed bool) {
- dd := d.d
- cr := d.cr
-
- if checkNil && dd.TryDecodeAsNil() {
- if v != nil {
- changed = true
- }
- return nil, changed
- }
-
- containerLen := dd.ReadMapStart()
- if canChange && v == nil {
- xlen, _ := decInferLen(containerLen, d.h.MaxInitLen, 8)
- v = make(map[uint32]uint32, xlen)
- changed = true
- }
-
- var mk uint32
- var mv uint32
- if containerLen > 0 {
- for j := 0; j < containerLen; j++ {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- mk = uint32(dd.DecodeUint(32))
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- mv = uint32(dd.DecodeUint(32))
- if v != nil {
- v[mk] = mv
- }
- }
- } else if containerLen < 0 {
- for j := 0; !dd.CheckBreak(); j++ {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- mk = uint32(dd.DecodeUint(32))
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- mv = uint32(dd.DecodeUint(32))
- if v != nil {
- v[mk] = mv
- }
- }
- }
- if cr != nil {
- cr.sendContainerState(containerMapEnd)
- }
- return v, changed
-}
-
-func (f *decFnInfo) fastpathDecMapUint32Uint64R(rv reflect.Value) {
- if rv.CanAddr() {
- vp := rv.Addr().Interface().(*map[uint32]uint64)
- v, changed := fastpathTV.DecMapUint32Uint64V(*vp, fastpathCheckNilFalse, true, f.d)
- if changed {
- *vp = v
- }
- } else {
- v := rv.Interface().(map[uint32]uint64)
- fastpathTV.DecMapUint32Uint64V(v, fastpathCheckNilFalse, false, f.d)
- }
-}
-func (f fastpathT) DecMapUint32Uint64X(vp *map[uint32]uint64, checkNil bool, d *Decoder) {
- v, changed := f.DecMapUint32Uint64V(*vp, checkNil, true, d)
- if changed {
- *vp = v
- }
-}
-func (_ fastpathT) DecMapUint32Uint64V(v map[uint32]uint64, checkNil bool, canChange bool,
- d *Decoder) (_ map[uint32]uint64, changed bool) {
- dd := d.d
- cr := d.cr
-
- if checkNil && dd.TryDecodeAsNil() {
- if v != nil {
- changed = true
- }
- return nil, changed
- }
-
- containerLen := dd.ReadMapStart()
- if canChange && v == nil {
- xlen, _ := decInferLen(containerLen, d.h.MaxInitLen, 12)
- v = make(map[uint32]uint64, xlen)
- changed = true
- }
-
- var mk uint32
- var mv uint64
- if containerLen > 0 {
- for j := 0; j < containerLen; j++ {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- mk = uint32(dd.DecodeUint(32))
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- mv = dd.DecodeUint(64)
- if v != nil {
- v[mk] = mv
- }
- }
- } else if containerLen < 0 {
- for j := 0; !dd.CheckBreak(); j++ {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- mk = uint32(dd.DecodeUint(32))
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- mv = dd.DecodeUint(64)
- if v != nil {
- v[mk] = mv
- }
- }
- }
- if cr != nil {
- cr.sendContainerState(containerMapEnd)
- }
- return v, changed
-}
-
-func (f *decFnInfo) fastpathDecMapUint32UintptrR(rv reflect.Value) {
- if rv.CanAddr() {
- vp := rv.Addr().Interface().(*map[uint32]uintptr)
- v, changed := fastpathTV.DecMapUint32UintptrV(*vp, fastpathCheckNilFalse, true, f.d)
- if changed {
- *vp = v
- }
- } else {
- v := rv.Interface().(map[uint32]uintptr)
- fastpathTV.DecMapUint32UintptrV(v, fastpathCheckNilFalse, false, f.d)
- }
-}
-func (f fastpathT) DecMapUint32UintptrX(vp *map[uint32]uintptr, checkNil bool, d *Decoder) {
- v, changed := f.DecMapUint32UintptrV(*vp, checkNil, true, d)
- if changed {
- *vp = v
- }
-}
-func (_ fastpathT) DecMapUint32UintptrV(v map[uint32]uintptr, checkNil bool, canChange bool,
- d *Decoder) (_ map[uint32]uintptr, changed bool) {
- dd := d.d
- cr := d.cr
-
- if checkNil && dd.TryDecodeAsNil() {
- if v != nil {
- changed = true
- }
- return nil, changed
- }
-
- containerLen := dd.ReadMapStart()
- if canChange && v == nil {
- xlen, _ := decInferLen(containerLen, d.h.MaxInitLen, 12)
- v = make(map[uint32]uintptr, xlen)
- changed = true
- }
-
- var mk uint32
- var mv uintptr
- if containerLen > 0 {
- for j := 0; j < containerLen; j++ {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- mk = uint32(dd.DecodeUint(32))
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- mv = uintptr(dd.DecodeUint(uintBitsize))
- if v != nil {
- v[mk] = mv
- }
- }
- } else if containerLen < 0 {
- for j := 0; !dd.CheckBreak(); j++ {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- mk = uint32(dd.DecodeUint(32))
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- mv = uintptr(dd.DecodeUint(uintBitsize))
- if v != nil {
- v[mk] = mv
- }
- }
- }
- if cr != nil {
- cr.sendContainerState(containerMapEnd)
- }
- return v, changed
-}
-
-func (f *decFnInfo) fastpathDecMapUint32IntR(rv reflect.Value) {
- if rv.CanAddr() {
- vp := rv.Addr().Interface().(*map[uint32]int)
- v, changed := fastpathTV.DecMapUint32IntV(*vp, fastpathCheckNilFalse, true, f.d)
- if changed {
- *vp = v
- }
- } else {
- v := rv.Interface().(map[uint32]int)
- fastpathTV.DecMapUint32IntV(v, fastpathCheckNilFalse, false, f.d)
- }
-}
-func (f fastpathT) DecMapUint32IntX(vp *map[uint32]int, checkNil bool, d *Decoder) {
- v, changed := f.DecMapUint32IntV(*vp, checkNil, true, d)
- if changed {
- *vp = v
- }
-}
-func (_ fastpathT) DecMapUint32IntV(v map[uint32]int, checkNil bool, canChange bool,
- d *Decoder) (_ map[uint32]int, changed bool) {
- dd := d.d
- cr := d.cr
-
- if checkNil && dd.TryDecodeAsNil() {
- if v != nil {
- changed = true
- }
- return nil, changed
- }
-
- containerLen := dd.ReadMapStart()
- if canChange && v == nil {
- xlen, _ := decInferLen(containerLen, d.h.MaxInitLen, 12)
- v = make(map[uint32]int, xlen)
- changed = true
- }
-
- var mk uint32
- var mv int
- if containerLen > 0 {
- for j := 0; j < containerLen; j++ {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- mk = uint32(dd.DecodeUint(32))
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- mv = int(dd.DecodeInt(intBitsize))
- if v != nil {
- v[mk] = mv
- }
- }
- } else if containerLen < 0 {
- for j := 0; !dd.CheckBreak(); j++ {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- mk = uint32(dd.DecodeUint(32))
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- mv = int(dd.DecodeInt(intBitsize))
- if v != nil {
- v[mk] = mv
- }
- }
- }
- if cr != nil {
- cr.sendContainerState(containerMapEnd)
- }
- return v, changed
-}
-
-func (f *decFnInfo) fastpathDecMapUint32Int8R(rv reflect.Value) {
- if rv.CanAddr() {
- vp := rv.Addr().Interface().(*map[uint32]int8)
- v, changed := fastpathTV.DecMapUint32Int8V(*vp, fastpathCheckNilFalse, true, f.d)
- if changed {
- *vp = v
- }
- } else {
- v := rv.Interface().(map[uint32]int8)
- fastpathTV.DecMapUint32Int8V(v, fastpathCheckNilFalse, false, f.d)
- }
-}
-func (f fastpathT) DecMapUint32Int8X(vp *map[uint32]int8, checkNil bool, d *Decoder) {
- v, changed := f.DecMapUint32Int8V(*vp, checkNil, true, d)
- if changed {
- *vp = v
- }
-}
-func (_ fastpathT) DecMapUint32Int8V(v map[uint32]int8, checkNil bool, canChange bool,
- d *Decoder) (_ map[uint32]int8, changed bool) {
- dd := d.d
- cr := d.cr
-
- if checkNil && dd.TryDecodeAsNil() {
- if v != nil {
- changed = true
- }
- return nil, changed
- }
-
- containerLen := dd.ReadMapStart()
- if canChange && v == nil {
- xlen, _ := decInferLen(containerLen, d.h.MaxInitLen, 5)
- v = make(map[uint32]int8, xlen)
- changed = true
- }
-
- var mk uint32
- var mv int8
- if containerLen > 0 {
- for j := 0; j < containerLen; j++ {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- mk = uint32(dd.DecodeUint(32))
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- mv = int8(dd.DecodeInt(8))
- if v != nil {
- v[mk] = mv
- }
- }
- } else if containerLen < 0 {
- for j := 0; !dd.CheckBreak(); j++ {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- mk = uint32(dd.DecodeUint(32))
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- mv = int8(dd.DecodeInt(8))
- if v != nil {
- v[mk] = mv
- }
- }
- }
- if cr != nil {
- cr.sendContainerState(containerMapEnd)
- }
- return v, changed
-}
-
-func (f *decFnInfo) fastpathDecMapUint32Int16R(rv reflect.Value) {
- if rv.CanAddr() {
- vp := rv.Addr().Interface().(*map[uint32]int16)
- v, changed := fastpathTV.DecMapUint32Int16V(*vp, fastpathCheckNilFalse, true, f.d)
- if changed {
- *vp = v
- }
- } else {
- v := rv.Interface().(map[uint32]int16)
- fastpathTV.DecMapUint32Int16V(v, fastpathCheckNilFalse, false, f.d)
- }
-}
-func (f fastpathT) DecMapUint32Int16X(vp *map[uint32]int16, checkNil bool, d *Decoder) {
- v, changed := f.DecMapUint32Int16V(*vp, checkNil, true, d)
- if changed {
- *vp = v
- }
-}
-func (_ fastpathT) DecMapUint32Int16V(v map[uint32]int16, checkNil bool, canChange bool,
- d *Decoder) (_ map[uint32]int16, changed bool) {
- dd := d.d
- cr := d.cr
-
- if checkNil && dd.TryDecodeAsNil() {
- if v != nil {
- changed = true
- }
- return nil, changed
- }
-
- containerLen := dd.ReadMapStart()
- if canChange && v == nil {
- xlen, _ := decInferLen(containerLen, d.h.MaxInitLen, 6)
- v = make(map[uint32]int16, xlen)
- changed = true
- }
-
- var mk uint32
- var mv int16
- if containerLen > 0 {
- for j := 0; j < containerLen; j++ {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- mk = uint32(dd.DecodeUint(32))
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- mv = int16(dd.DecodeInt(16))
- if v != nil {
- v[mk] = mv
- }
- }
- } else if containerLen < 0 {
- for j := 0; !dd.CheckBreak(); j++ {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- mk = uint32(dd.DecodeUint(32))
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- mv = int16(dd.DecodeInt(16))
- if v != nil {
- v[mk] = mv
- }
- }
- }
- if cr != nil {
- cr.sendContainerState(containerMapEnd)
- }
- return v, changed
-}
-
-func (f *decFnInfo) fastpathDecMapUint32Int32R(rv reflect.Value) {
- if rv.CanAddr() {
- vp := rv.Addr().Interface().(*map[uint32]int32)
- v, changed := fastpathTV.DecMapUint32Int32V(*vp, fastpathCheckNilFalse, true, f.d)
- if changed {
- *vp = v
- }
- } else {
- v := rv.Interface().(map[uint32]int32)
- fastpathTV.DecMapUint32Int32V(v, fastpathCheckNilFalse, false, f.d)
- }
-}
-func (f fastpathT) DecMapUint32Int32X(vp *map[uint32]int32, checkNil bool, d *Decoder) {
- v, changed := f.DecMapUint32Int32V(*vp, checkNil, true, d)
- if changed {
- *vp = v
- }
-}
-func (_ fastpathT) DecMapUint32Int32V(v map[uint32]int32, checkNil bool, canChange bool,
- d *Decoder) (_ map[uint32]int32, changed bool) {
- dd := d.d
- cr := d.cr
-
- if checkNil && dd.TryDecodeAsNil() {
- if v != nil {
- changed = true
- }
- return nil, changed
- }
-
- containerLen := dd.ReadMapStart()
- if canChange && v == nil {
- xlen, _ := decInferLen(containerLen, d.h.MaxInitLen, 8)
- v = make(map[uint32]int32, xlen)
- changed = true
- }
-
- var mk uint32
- var mv int32
- if containerLen > 0 {
- for j := 0; j < containerLen; j++ {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- mk = uint32(dd.DecodeUint(32))
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- mv = int32(dd.DecodeInt(32))
- if v != nil {
- v[mk] = mv
- }
- }
- } else if containerLen < 0 {
- for j := 0; !dd.CheckBreak(); j++ {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- mk = uint32(dd.DecodeUint(32))
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- mv = int32(dd.DecodeInt(32))
- if v != nil {
- v[mk] = mv
- }
- }
- }
- if cr != nil {
- cr.sendContainerState(containerMapEnd)
- }
- return v, changed
-}
-
-func (f *decFnInfo) fastpathDecMapUint32Int64R(rv reflect.Value) {
- if rv.CanAddr() {
- vp := rv.Addr().Interface().(*map[uint32]int64)
- v, changed := fastpathTV.DecMapUint32Int64V(*vp, fastpathCheckNilFalse, true, f.d)
- if changed {
- *vp = v
- }
- } else {
- v := rv.Interface().(map[uint32]int64)
- fastpathTV.DecMapUint32Int64V(v, fastpathCheckNilFalse, false, f.d)
- }
-}
-func (f fastpathT) DecMapUint32Int64X(vp *map[uint32]int64, checkNil bool, d *Decoder) {
- v, changed := f.DecMapUint32Int64V(*vp, checkNil, true, d)
- if changed {
- *vp = v
- }
-}
-func (_ fastpathT) DecMapUint32Int64V(v map[uint32]int64, checkNil bool, canChange bool,
- d *Decoder) (_ map[uint32]int64, changed bool) {
- dd := d.d
- cr := d.cr
-
- if checkNil && dd.TryDecodeAsNil() {
- if v != nil {
- changed = true
- }
- return nil, changed
- }
-
- containerLen := dd.ReadMapStart()
- if canChange && v == nil {
- xlen, _ := decInferLen(containerLen, d.h.MaxInitLen, 12)
- v = make(map[uint32]int64, xlen)
- changed = true
- }
-
- var mk uint32
- var mv int64
- if containerLen > 0 {
- for j := 0; j < containerLen; j++ {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- mk = uint32(dd.DecodeUint(32))
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- mv = dd.DecodeInt(64)
- if v != nil {
- v[mk] = mv
- }
- }
- } else if containerLen < 0 {
- for j := 0; !dd.CheckBreak(); j++ {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- mk = uint32(dd.DecodeUint(32))
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- mv = dd.DecodeInt(64)
- if v != nil {
- v[mk] = mv
- }
- }
- }
- if cr != nil {
- cr.sendContainerState(containerMapEnd)
- }
- return v, changed
-}
-
-func (f *decFnInfo) fastpathDecMapUint32Float32R(rv reflect.Value) {
- if rv.CanAddr() {
- vp := rv.Addr().Interface().(*map[uint32]float32)
- v, changed := fastpathTV.DecMapUint32Float32V(*vp, fastpathCheckNilFalse, true, f.d)
- if changed {
- *vp = v
- }
- } else {
- v := rv.Interface().(map[uint32]float32)
- fastpathTV.DecMapUint32Float32V(v, fastpathCheckNilFalse, false, f.d)
- }
-}
-func (f fastpathT) DecMapUint32Float32X(vp *map[uint32]float32, checkNil bool, d *Decoder) {
- v, changed := f.DecMapUint32Float32V(*vp, checkNil, true, d)
- if changed {
- *vp = v
- }
-}
-func (_ fastpathT) DecMapUint32Float32V(v map[uint32]float32, checkNil bool, canChange bool,
- d *Decoder) (_ map[uint32]float32, changed bool) {
- dd := d.d
- cr := d.cr
-
- if checkNil && dd.TryDecodeAsNil() {
- if v != nil {
- changed = true
- }
- return nil, changed
- }
-
- containerLen := dd.ReadMapStart()
- if canChange && v == nil {
- xlen, _ := decInferLen(containerLen, d.h.MaxInitLen, 8)
- v = make(map[uint32]float32, xlen)
- changed = true
- }
-
- var mk uint32
- var mv float32
- if containerLen > 0 {
- for j := 0; j < containerLen; j++ {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- mk = uint32(dd.DecodeUint(32))
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- mv = float32(dd.DecodeFloat(true))
- if v != nil {
- v[mk] = mv
- }
- }
- } else if containerLen < 0 {
- for j := 0; !dd.CheckBreak(); j++ {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- mk = uint32(dd.DecodeUint(32))
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- mv = float32(dd.DecodeFloat(true))
- if v != nil {
- v[mk] = mv
- }
- }
- }
- if cr != nil {
- cr.sendContainerState(containerMapEnd)
- }
- return v, changed
-}
-
-func (f *decFnInfo) fastpathDecMapUint32Float64R(rv reflect.Value) {
- if rv.CanAddr() {
- vp := rv.Addr().Interface().(*map[uint32]float64)
- v, changed := fastpathTV.DecMapUint32Float64V(*vp, fastpathCheckNilFalse, true, f.d)
- if changed {
- *vp = v
- }
- } else {
- v := rv.Interface().(map[uint32]float64)
- fastpathTV.DecMapUint32Float64V(v, fastpathCheckNilFalse, false, f.d)
- }
-}
-func (f fastpathT) DecMapUint32Float64X(vp *map[uint32]float64, checkNil bool, d *Decoder) {
- v, changed := f.DecMapUint32Float64V(*vp, checkNil, true, d)
- if changed {
- *vp = v
- }
-}
-func (_ fastpathT) DecMapUint32Float64V(v map[uint32]float64, checkNil bool, canChange bool,
- d *Decoder) (_ map[uint32]float64, changed bool) {
- dd := d.d
- cr := d.cr
-
- if checkNil && dd.TryDecodeAsNil() {
- if v != nil {
- changed = true
- }
- return nil, changed
- }
-
- containerLen := dd.ReadMapStart()
- if canChange && v == nil {
- xlen, _ := decInferLen(containerLen, d.h.MaxInitLen, 12)
- v = make(map[uint32]float64, xlen)
- changed = true
- }
-
- var mk uint32
- var mv float64
- if containerLen > 0 {
- for j := 0; j < containerLen; j++ {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- mk = uint32(dd.DecodeUint(32))
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- mv = dd.DecodeFloat(false)
- if v != nil {
- v[mk] = mv
- }
- }
- } else if containerLen < 0 {
- for j := 0; !dd.CheckBreak(); j++ {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- mk = uint32(dd.DecodeUint(32))
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- mv = dd.DecodeFloat(false)
- if v != nil {
- v[mk] = mv
- }
- }
- }
- if cr != nil {
- cr.sendContainerState(containerMapEnd)
- }
- return v, changed
-}
-
-func (f *decFnInfo) fastpathDecMapUint32BoolR(rv reflect.Value) {
- if rv.CanAddr() {
- vp := rv.Addr().Interface().(*map[uint32]bool)
- v, changed := fastpathTV.DecMapUint32BoolV(*vp, fastpathCheckNilFalse, true, f.d)
- if changed {
- *vp = v
- }
- } else {
- v := rv.Interface().(map[uint32]bool)
- fastpathTV.DecMapUint32BoolV(v, fastpathCheckNilFalse, false, f.d)
- }
-}
-func (f fastpathT) DecMapUint32BoolX(vp *map[uint32]bool, checkNil bool, d *Decoder) {
- v, changed := f.DecMapUint32BoolV(*vp, checkNil, true, d)
- if changed {
- *vp = v
- }
-}
-func (_ fastpathT) DecMapUint32BoolV(v map[uint32]bool, checkNil bool, canChange bool,
- d *Decoder) (_ map[uint32]bool, changed bool) {
- dd := d.d
- cr := d.cr
-
- if checkNil && dd.TryDecodeAsNil() {
- if v != nil {
- changed = true
- }
- return nil, changed
- }
-
- containerLen := dd.ReadMapStart()
- if canChange && v == nil {
- xlen, _ := decInferLen(containerLen, d.h.MaxInitLen, 5)
- v = make(map[uint32]bool, xlen)
- changed = true
- }
-
- var mk uint32
- var mv bool
- if containerLen > 0 {
- for j := 0; j < containerLen; j++ {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- mk = uint32(dd.DecodeUint(32))
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- mv = dd.DecodeBool()
- if v != nil {
- v[mk] = mv
- }
- }
- } else if containerLen < 0 {
- for j := 0; !dd.CheckBreak(); j++ {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- mk = uint32(dd.DecodeUint(32))
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- mv = dd.DecodeBool()
- if v != nil {
- v[mk] = mv
- }
- }
- }
- if cr != nil {
- cr.sendContainerState(containerMapEnd)
- }
- return v, changed
-}
-
-func (f *decFnInfo) fastpathDecMapUint64IntfR(rv reflect.Value) {
- if rv.CanAddr() {
- vp := rv.Addr().Interface().(*map[uint64]interface{})
- v, changed := fastpathTV.DecMapUint64IntfV(*vp, fastpathCheckNilFalse, true, f.d)
- if changed {
- *vp = v
- }
- } else {
- v := rv.Interface().(map[uint64]interface{})
- fastpathTV.DecMapUint64IntfV(v, fastpathCheckNilFalse, false, f.d)
- }
-}
-func (f fastpathT) DecMapUint64IntfX(vp *map[uint64]interface{}, checkNil bool, d *Decoder) {
- v, changed := f.DecMapUint64IntfV(*vp, checkNil, true, d)
- if changed {
- *vp = v
- }
-}
-func (_ fastpathT) DecMapUint64IntfV(v map[uint64]interface{}, checkNil bool, canChange bool,
- d *Decoder) (_ map[uint64]interface{}, changed bool) {
- dd := d.d
- cr := d.cr
-
- if checkNil && dd.TryDecodeAsNil() {
- if v != nil {
- changed = true
- }
- return nil, changed
- }
-
- containerLen := dd.ReadMapStart()
- if canChange && v == nil {
- xlen, _ := decInferLen(containerLen, d.h.MaxInitLen, 24)
- v = make(map[uint64]interface{}, xlen)
- changed = true
- }
- mapGet := !d.h.MapValueReset && !d.h.InterfaceReset
- var mk uint64
- var mv interface{}
- if containerLen > 0 {
- for j := 0; j < containerLen; j++ {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- mk = dd.DecodeUint(64)
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- if mapGet {
- mv = v[mk]
- } else {
- mv = nil
- }
- d.decode(&mv)
- if v != nil {
- v[mk] = mv
- }
- }
- } else if containerLen < 0 {
- for j := 0; !dd.CheckBreak(); j++ {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- mk = dd.DecodeUint(64)
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- if mapGet {
- mv = v[mk]
- } else {
- mv = nil
- }
- d.decode(&mv)
- if v != nil {
- v[mk] = mv
- }
- }
- }
- if cr != nil {
- cr.sendContainerState(containerMapEnd)
- }
- return v, changed
-}
-
-func (f *decFnInfo) fastpathDecMapUint64StringR(rv reflect.Value) {
- if rv.CanAddr() {
- vp := rv.Addr().Interface().(*map[uint64]string)
- v, changed := fastpathTV.DecMapUint64StringV(*vp, fastpathCheckNilFalse, true, f.d)
- if changed {
- *vp = v
- }
- } else {
- v := rv.Interface().(map[uint64]string)
- fastpathTV.DecMapUint64StringV(v, fastpathCheckNilFalse, false, f.d)
- }
-}
-func (f fastpathT) DecMapUint64StringX(vp *map[uint64]string, checkNil bool, d *Decoder) {
- v, changed := f.DecMapUint64StringV(*vp, checkNil, true, d)
- if changed {
- *vp = v
- }
-}
-func (_ fastpathT) DecMapUint64StringV(v map[uint64]string, checkNil bool, canChange bool,
- d *Decoder) (_ map[uint64]string, changed bool) {
- dd := d.d
- cr := d.cr
-
- if checkNil && dd.TryDecodeAsNil() {
- if v != nil {
- changed = true
- }
- return nil, changed
- }
-
- containerLen := dd.ReadMapStart()
- if canChange && v == nil {
- xlen, _ := decInferLen(containerLen, d.h.MaxInitLen, 24)
- v = make(map[uint64]string, xlen)
- changed = true
- }
-
- var mk uint64
- var mv string
- if containerLen > 0 {
- for j := 0; j < containerLen; j++ {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- mk = dd.DecodeUint(64)
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- mv = dd.DecodeString()
- if v != nil {
- v[mk] = mv
- }
- }
- } else if containerLen < 0 {
- for j := 0; !dd.CheckBreak(); j++ {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- mk = dd.DecodeUint(64)
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- mv = dd.DecodeString()
- if v != nil {
- v[mk] = mv
- }
- }
- }
- if cr != nil {
- cr.sendContainerState(containerMapEnd)
- }
- return v, changed
-}
-
-func (f *decFnInfo) fastpathDecMapUint64UintR(rv reflect.Value) {
- if rv.CanAddr() {
- vp := rv.Addr().Interface().(*map[uint64]uint)
- v, changed := fastpathTV.DecMapUint64UintV(*vp, fastpathCheckNilFalse, true, f.d)
- if changed {
- *vp = v
- }
- } else {
- v := rv.Interface().(map[uint64]uint)
- fastpathTV.DecMapUint64UintV(v, fastpathCheckNilFalse, false, f.d)
- }
-}
-func (f fastpathT) DecMapUint64UintX(vp *map[uint64]uint, checkNil bool, d *Decoder) {
- v, changed := f.DecMapUint64UintV(*vp, checkNil, true, d)
- if changed {
- *vp = v
- }
-}
-func (_ fastpathT) DecMapUint64UintV(v map[uint64]uint, checkNil bool, canChange bool,
- d *Decoder) (_ map[uint64]uint, changed bool) {
- dd := d.d
- cr := d.cr
-
- if checkNil && dd.TryDecodeAsNil() {
- if v != nil {
- changed = true
- }
- return nil, changed
- }
-
- containerLen := dd.ReadMapStart()
- if canChange && v == nil {
- xlen, _ := decInferLen(containerLen, d.h.MaxInitLen, 16)
- v = make(map[uint64]uint, xlen)
- changed = true
- }
-
- var mk uint64
- var mv uint
- if containerLen > 0 {
- for j := 0; j < containerLen; j++ {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- mk = dd.DecodeUint(64)
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- mv = uint(dd.DecodeUint(uintBitsize))
- if v != nil {
- v[mk] = mv
- }
- }
- } else if containerLen < 0 {
- for j := 0; !dd.CheckBreak(); j++ {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- mk = dd.DecodeUint(64)
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- mv = uint(dd.DecodeUint(uintBitsize))
- if v != nil {
- v[mk] = mv
- }
- }
- }
- if cr != nil {
- cr.sendContainerState(containerMapEnd)
- }
- return v, changed
-}
-
-func (f *decFnInfo) fastpathDecMapUint64Uint8R(rv reflect.Value) {
- if rv.CanAddr() {
- vp := rv.Addr().Interface().(*map[uint64]uint8)
- v, changed := fastpathTV.DecMapUint64Uint8V(*vp, fastpathCheckNilFalse, true, f.d)
- if changed {
- *vp = v
- }
- } else {
- v := rv.Interface().(map[uint64]uint8)
- fastpathTV.DecMapUint64Uint8V(v, fastpathCheckNilFalse, false, f.d)
- }
-}
-func (f fastpathT) DecMapUint64Uint8X(vp *map[uint64]uint8, checkNil bool, d *Decoder) {
- v, changed := f.DecMapUint64Uint8V(*vp, checkNil, true, d)
- if changed {
- *vp = v
- }
-}
-func (_ fastpathT) DecMapUint64Uint8V(v map[uint64]uint8, checkNil bool, canChange bool,
- d *Decoder) (_ map[uint64]uint8, changed bool) {
- dd := d.d
- cr := d.cr
-
- if checkNil && dd.TryDecodeAsNil() {
- if v != nil {
- changed = true
- }
- return nil, changed
- }
-
- containerLen := dd.ReadMapStart()
- if canChange && v == nil {
- xlen, _ := decInferLen(containerLen, d.h.MaxInitLen, 9)
- v = make(map[uint64]uint8, xlen)
- changed = true
- }
-
- var mk uint64
- var mv uint8
- if containerLen > 0 {
- for j := 0; j < containerLen; j++ {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- mk = dd.DecodeUint(64)
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- mv = uint8(dd.DecodeUint(8))
- if v != nil {
- v[mk] = mv
- }
- }
- } else if containerLen < 0 {
- for j := 0; !dd.CheckBreak(); j++ {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- mk = dd.DecodeUint(64)
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- mv = uint8(dd.DecodeUint(8))
- if v != nil {
- v[mk] = mv
- }
- }
- }
- if cr != nil {
- cr.sendContainerState(containerMapEnd)
- }
- return v, changed
-}
-
-func (f *decFnInfo) fastpathDecMapUint64Uint16R(rv reflect.Value) {
- if rv.CanAddr() {
- vp := rv.Addr().Interface().(*map[uint64]uint16)
- v, changed := fastpathTV.DecMapUint64Uint16V(*vp, fastpathCheckNilFalse, true, f.d)
- if changed {
- *vp = v
- }
- } else {
- v := rv.Interface().(map[uint64]uint16)
- fastpathTV.DecMapUint64Uint16V(v, fastpathCheckNilFalse, false, f.d)
- }
-}
-func (f fastpathT) DecMapUint64Uint16X(vp *map[uint64]uint16, checkNil bool, d *Decoder) {
- v, changed := f.DecMapUint64Uint16V(*vp, checkNil, true, d)
- if changed {
- *vp = v
- }
-}
-func (_ fastpathT) DecMapUint64Uint16V(v map[uint64]uint16, checkNil bool, canChange bool,
- d *Decoder) (_ map[uint64]uint16, changed bool) {
- dd := d.d
- cr := d.cr
-
- if checkNil && dd.TryDecodeAsNil() {
- if v != nil {
- changed = true
- }
- return nil, changed
- }
-
- containerLen := dd.ReadMapStart()
- if canChange && v == nil {
- xlen, _ := decInferLen(containerLen, d.h.MaxInitLen, 10)
- v = make(map[uint64]uint16, xlen)
- changed = true
- }
-
- var mk uint64
- var mv uint16
- if containerLen > 0 {
- for j := 0; j < containerLen; j++ {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- mk = dd.DecodeUint(64)
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- mv = uint16(dd.DecodeUint(16))
- if v != nil {
- v[mk] = mv
- }
- }
- } else if containerLen < 0 {
- for j := 0; !dd.CheckBreak(); j++ {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- mk = dd.DecodeUint(64)
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- mv = uint16(dd.DecodeUint(16))
- if v != nil {
- v[mk] = mv
- }
- }
- }
- if cr != nil {
- cr.sendContainerState(containerMapEnd)
- }
- return v, changed
-}
-
-func (f *decFnInfo) fastpathDecMapUint64Uint32R(rv reflect.Value) {
- if rv.CanAddr() {
- vp := rv.Addr().Interface().(*map[uint64]uint32)
- v, changed := fastpathTV.DecMapUint64Uint32V(*vp, fastpathCheckNilFalse, true, f.d)
- if changed {
- *vp = v
- }
- } else {
- v := rv.Interface().(map[uint64]uint32)
- fastpathTV.DecMapUint64Uint32V(v, fastpathCheckNilFalse, false, f.d)
- }
-}
-func (f fastpathT) DecMapUint64Uint32X(vp *map[uint64]uint32, checkNil bool, d *Decoder) {
- v, changed := f.DecMapUint64Uint32V(*vp, checkNil, true, d)
- if changed {
- *vp = v
- }
-}
-func (_ fastpathT) DecMapUint64Uint32V(v map[uint64]uint32, checkNil bool, canChange bool,
- d *Decoder) (_ map[uint64]uint32, changed bool) {
- dd := d.d
- cr := d.cr
-
- if checkNil && dd.TryDecodeAsNil() {
- if v != nil {
- changed = true
- }
- return nil, changed
- }
-
- containerLen := dd.ReadMapStart()
- if canChange && v == nil {
- xlen, _ := decInferLen(containerLen, d.h.MaxInitLen, 12)
- v = make(map[uint64]uint32, xlen)
- changed = true
- }
-
- var mk uint64
- var mv uint32
- if containerLen > 0 {
- for j := 0; j < containerLen; j++ {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- mk = dd.DecodeUint(64)
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- mv = uint32(dd.DecodeUint(32))
- if v != nil {
- v[mk] = mv
- }
- }
- } else if containerLen < 0 {
- for j := 0; !dd.CheckBreak(); j++ {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- mk = dd.DecodeUint(64)
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- mv = uint32(dd.DecodeUint(32))
- if v != nil {
- v[mk] = mv
- }
- }
- }
- if cr != nil {
- cr.sendContainerState(containerMapEnd)
- }
- return v, changed
-}
-
-func (f *decFnInfo) fastpathDecMapUint64Uint64R(rv reflect.Value) {
- if rv.CanAddr() {
- vp := rv.Addr().Interface().(*map[uint64]uint64)
- v, changed := fastpathTV.DecMapUint64Uint64V(*vp, fastpathCheckNilFalse, true, f.d)
- if changed {
- *vp = v
- }
- } else {
- v := rv.Interface().(map[uint64]uint64)
- fastpathTV.DecMapUint64Uint64V(v, fastpathCheckNilFalse, false, f.d)
- }
-}
-func (f fastpathT) DecMapUint64Uint64X(vp *map[uint64]uint64, checkNil bool, d *Decoder) {
- v, changed := f.DecMapUint64Uint64V(*vp, checkNil, true, d)
- if changed {
- *vp = v
- }
-}
-func (_ fastpathT) DecMapUint64Uint64V(v map[uint64]uint64, checkNil bool, canChange bool,
- d *Decoder) (_ map[uint64]uint64, changed bool) {
- dd := d.d
- cr := d.cr
-
- if checkNil && dd.TryDecodeAsNil() {
- if v != nil {
- changed = true
- }
- return nil, changed
- }
-
- containerLen := dd.ReadMapStart()
- if canChange && v == nil {
- xlen, _ := decInferLen(containerLen, d.h.MaxInitLen, 16)
- v = make(map[uint64]uint64, xlen)
- changed = true
- }
-
- var mk uint64
- var mv uint64
- if containerLen > 0 {
- for j := 0; j < containerLen; j++ {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- mk = dd.DecodeUint(64)
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- mv = dd.DecodeUint(64)
- if v != nil {
- v[mk] = mv
- }
- }
- } else if containerLen < 0 {
- for j := 0; !dd.CheckBreak(); j++ {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- mk = dd.DecodeUint(64)
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- mv = dd.DecodeUint(64)
- if v != nil {
- v[mk] = mv
- }
- }
- }
- if cr != nil {
- cr.sendContainerState(containerMapEnd)
- }
- return v, changed
-}
-
-func (f *decFnInfo) fastpathDecMapUint64UintptrR(rv reflect.Value) {
- if rv.CanAddr() {
- vp := rv.Addr().Interface().(*map[uint64]uintptr)
- v, changed := fastpathTV.DecMapUint64UintptrV(*vp, fastpathCheckNilFalse, true, f.d)
- if changed {
- *vp = v
- }
- } else {
- v := rv.Interface().(map[uint64]uintptr)
- fastpathTV.DecMapUint64UintptrV(v, fastpathCheckNilFalse, false, f.d)
- }
-}
-func (f fastpathT) DecMapUint64UintptrX(vp *map[uint64]uintptr, checkNil bool, d *Decoder) {
- v, changed := f.DecMapUint64UintptrV(*vp, checkNil, true, d)
- if changed {
- *vp = v
- }
-}
-func (_ fastpathT) DecMapUint64UintptrV(v map[uint64]uintptr, checkNil bool, canChange bool,
- d *Decoder) (_ map[uint64]uintptr, changed bool) {
- dd := d.d
- cr := d.cr
-
- if checkNil && dd.TryDecodeAsNil() {
- if v != nil {
- changed = true
- }
- return nil, changed
- }
-
- containerLen := dd.ReadMapStart()
- if canChange && v == nil {
- xlen, _ := decInferLen(containerLen, d.h.MaxInitLen, 16)
- v = make(map[uint64]uintptr, xlen)
- changed = true
- }
-
- var mk uint64
- var mv uintptr
- if containerLen > 0 {
- for j := 0; j < containerLen; j++ {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- mk = dd.DecodeUint(64)
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- mv = uintptr(dd.DecodeUint(uintBitsize))
- if v != nil {
- v[mk] = mv
- }
- }
- } else if containerLen < 0 {
- for j := 0; !dd.CheckBreak(); j++ {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- mk = dd.DecodeUint(64)
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- mv = uintptr(dd.DecodeUint(uintBitsize))
- if v != nil {
- v[mk] = mv
- }
- }
- }
- if cr != nil {
- cr.sendContainerState(containerMapEnd)
- }
- return v, changed
-}
-
-func (f *decFnInfo) fastpathDecMapUint64IntR(rv reflect.Value) {
- if rv.CanAddr() {
- vp := rv.Addr().Interface().(*map[uint64]int)
- v, changed := fastpathTV.DecMapUint64IntV(*vp, fastpathCheckNilFalse, true, f.d)
- if changed {
- *vp = v
- }
- } else {
- v := rv.Interface().(map[uint64]int)
- fastpathTV.DecMapUint64IntV(v, fastpathCheckNilFalse, false, f.d)
- }
-}
-func (f fastpathT) DecMapUint64IntX(vp *map[uint64]int, checkNil bool, d *Decoder) {
- v, changed := f.DecMapUint64IntV(*vp, checkNil, true, d)
- if changed {
- *vp = v
- }
-}
-func (_ fastpathT) DecMapUint64IntV(v map[uint64]int, checkNil bool, canChange bool,
- d *Decoder) (_ map[uint64]int, changed bool) {
- dd := d.d
- cr := d.cr
-
- if checkNil && dd.TryDecodeAsNil() {
- if v != nil {
- changed = true
- }
- return nil, changed
- }
-
- containerLen := dd.ReadMapStart()
- if canChange && v == nil {
- xlen, _ := decInferLen(containerLen, d.h.MaxInitLen, 16)
- v = make(map[uint64]int, xlen)
- changed = true
- }
-
- var mk uint64
- var mv int
- if containerLen > 0 {
- for j := 0; j < containerLen; j++ {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- mk = dd.DecodeUint(64)
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- mv = int(dd.DecodeInt(intBitsize))
- if v != nil {
- v[mk] = mv
- }
- }
- } else if containerLen < 0 {
- for j := 0; !dd.CheckBreak(); j++ {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- mk = dd.DecodeUint(64)
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- mv = int(dd.DecodeInt(intBitsize))
- if v != nil {
- v[mk] = mv
- }
- }
- }
- if cr != nil {
- cr.sendContainerState(containerMapEnd)
- }
- return v, changed
-}
-
-func (f *decFnInfo) fastpathDecMapUint64Int8R(rv reflect.Value) {
- if rv.CanAddr() {
- vp := rv.Addr().Interface().(*map[uint64]int8)
- v, changed := fastpathTV.DecMapUint64Int8V(*vp, fastpathCheckNilFalse, true, f.d)
- if changed {
- *vp = v
- }
- } else {
- v := rv.Interface().(map[uint64]int8)
- fastpathTV.DecMapUint64Int8V(v, fastpathCheckNilFalse, false, f.d)
- }
-}
-func (f fastpathT) DecMapUint64Int8X(vp *map[uint64]int8, checkNil bool, d *Decoder) {
- v, changed := f.DecMapUint64Int8V(*vp, checkNil, true, d)
- if changed {
- *vp = v
- }
-}
-func (_ fastpathT) DecMapUint64Int8V(v map[uint64]int8, checkNil bool, canChange bool,
- d *Decoder) (_ map[uint64]int8, changed bool) {
- dd := d.d
- cr := d.cr
-
- if checkNil && dd.TryDecodeAsNil() {
- if v != nil {
- changed = true
- }
- return nil, changed
- }
-
- containerLen := dd.ReadMapStart()
- if canChange && v == nil {
- xlen, _ := decInferLen(containerLen, d.h.MaxInitLen, 9)
- v = make(map[uint64]int8, xlen)
- changed = true
- }
-
- var mk uint64
- var mv int8
- if containerLen > 0 {
- for j := 0; j < containerLen; j++ {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- mk = dd.DecodeUint(64)
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- mv = int8(dd.DecodeInt(8))
- if v != nil {
- v[mk] = mv
- }
- }
- } else if containerLen < 0 {
- for j := 0; !dd.CheckBreak(); j++ {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- mk = dd.DecodeUint(64)
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- mv = int8(dd.DecodeInt(8))
- if v != nil {
- v[mk] = mv
- }
- }
- }
- if cr != nil {
- cr.sendContainerState(containerMapEnd)
- }
- return v, changed
-}
-
-func (f *decFnInfo) fastpathDecMapUint64Int16R(rv reflect.Value) {
- if rv.CanAddr() {
- vp := rv.Addr().Interface().(*map[uint64]int16)
- v, changed := fastpathTV.DecMapUint64Int16V(*vp, fastpathCheckNilFalse, true, f.d)
- if changed {
- *vp = v
- }
- } else {
- v := rv.Interface().(map[uint64]int16)
- fastpathTV.DecMapUint64Int16V(v, fastpathCheckNilFalse, false, f.d)
- }
-}
-func (f fastpathT) DecMapUint64Int16X(vp *map[uint64]int16, checkNil bool, d *Decoder) {
- v, changed := f.DecMapUint64Int16V(*vp, checkNil, true, d)
- if changed {
- *vp = v
- }
-}
-func (_ fastpathT) DecMapUint64Int16V(v map[uint64]int16, checkNil bool, canChange bool,
- d *Decoder) (_ map[uint64]int16, changed bool) {
- dd := d.d
- cr := d.cr
-
- if checkNil && dd.TryDecodeAsNil() {
- if v != nil {
- changed = true
- }
- return nil, changed
- }
-
- containerLen := dd.ReadMapStart()
- if canChange && v == nil {
- xlen, _ := decInferLen(containerLen, d.h.MaxInitLen, 10)
- v = make(map[uint64]int16, xlen)
- changed = true
- }
-
- var mk uint64
- var mv int16
- if containerLen > 0 {
- for j := 0; j < containerLen; j++ {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- mk = dd.DecodeUint(64)
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- mv = int16(dd.DecodeInt(16))
- if v != nil {
- v[mk] = mv
- }
- }
- } else if containerLen < 0 {
- for j := 0; !dd.CheckBreak(); j++ {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- mk = dd.DecodeUint(64)
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- mv = int16(dd.DecodeInt(16))
- if v != nil {
- v[mk] = mv
- }
- }
- }
- if cr != nil {
- cr.sendContainerState(containerMapEnd)
- }
- return v, changed
-}
-
-func (f *decFnInfo) fastpathDecMapUint64Int32R(rv reflect.Value) {
- if rv.CanAddr() {
- vp := rv.Addr().Interface().(*map[uint64]int32)
- v, changed := fastpathTV.DecMapUint64Int32V(*vp, fastpathCheckNilFalse, true, f.d)
- if changed {
- *vp = v
- }
- } else {
- v := rv.Interface().(map[uint64]int32)
- fastpathTV.DecMapUint64Int32V(v, fastpathCheckNilFalse, false, f.d)
- }
-}
-func (f fastpathT) DecMapUint64Int32X(vp *map[uint64]int32, checkNil bool, d *Decoder) {
- v, changed := f.DecMapUint64Int32V(*vp, checkNil, true, d)
- if changed {
- *vp = v
- }
-}
-func (_ fastpathT) DecMapUint64Int32V(v map[uint64]int32, checkNil bool, canChange bool,
- d *Decoder) (_ map[uint64]int32, changed bool) {
- dd := d.d
- cr := d.cr
-
- if checkNil && dd.TryDecodeAsNil() {
- if v != nil {
- changed = true
- }
- return nil, changed
- }
-
- containerLen := dd.ReadMapStart()
- if canChange && v == nil {
- xlen, _ := decInferLen(containerLen, d.h.MaxInitLen, 12)
- v = make(map[uint64]int32, xlen)
- changed = true
- }
-
- var mk uint64
- var mv int32
- if containerLen > 0 {
- for j := 0; j < containerLen; j++ {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- mk = dd.DecodeUint(64)
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- mv = int32(dd.DecodeInt(32))
- if v != nil {
- v[mk] = mv
- }
- }
- } else if containerLen < 0 {
- for j := 0; !dd.CheckBreak(); j++ {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- mk = dd.DecodeUint(64)
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- mv = int32(dd.DecodeInt(32))
- if v != nil {
- v[mk] = mv
- }
- }
- }
- if cr != nil {
- cr.sendContainerState(containerMapEnd)
- }
- return v, changed
-}
-
-func (f *decFnInfo) fastpathDecMapUint64Int64R(rv reflect.Value) {
- if rv.CanAddr() {
- vp := rv.Addr().Interface().(*map[uint64]int64)
- v, changed := fastpathTV.DecMapUint64Int64V(*vp, fastpathCheckNilFalse, true, f.d)
- if changed {
- *vp = v
- }
- } else {
- v := rv.Interface().(map[uint64]int64)
- fastpathTV.DecMapUint64Int64V(v, fastpathCheckNilFalse, false, f.d)
- }
-}
-func (f fastpathT) DecMapUint64Int64X(vp *map[uint64]int64, checkNil bool, d *Decoder) {
- v, changed := f.DecMapUint64Int64V(*vp, checkNil, true, d)
- if changed {
- *vp = v
- }
-}
-func (_ fastpathT) DecMapUint64Int64V(v map[uint64]int64, checkNil bool, canChange bool,
- d *Decoder) (_ map[uint64]int64, changed bool) {
- dd := d.d
- cr := d.cr
-
- if checkNil && dd.TryDecodeAsNil() {
- if v != nil {
- changed = true
- }
- return nil, changed
- }
-
- containerLen := dd.ReadMapStart()
- if canChange && v == nil {
- xlen, _ := decInferLen(containerLen, d.h.MaxInitLen, 16)
- v = make(map[uint64]int64, xlen)
- changed = true
- }
-
- var mk uint64
- var mv int64
- if containerLen > 0 {
- for j := 0; j < containerLen; j++ {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- mk = dd.DecodeUint(64)
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- mv = dd.DecodeInt(64)
- if v != nil {
- v[mk] = mv
- }
- }
- } else if containerLen < 0 {
- for j := 0; !dd.CheckBreak(); j++ {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- mk = dd.DecodeUint(64)
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- mv = dd.DecodeInt(64)
- if v != nil {
- v[mk] = mv
- }
- }
- }
- if cr != nil {
- cr.sendContainerState(containerMapEnd)
- }
- return v, changed
-}
-
-func (f *decFnInfo) fastpathDecMapUint64Float32R(rv reflect.Value) {
- if rv.CanAddr() {
- vp := rv.Addr().Interface().(*map[uint64]float32)
- v, changed := fastpathTV.DecMapUint64Float32V(*vp, fastpathCheckNilFalse, true, f.d)
- if changed {
- *vp = v
- }
- } else {
- v := rv.Interface().(map[uint64]float32)
- fastpathTV.DecMapUint64Float32V(v, fastpathCheckNilFalse, false, f.d)
- }
-}
-func (f fastpathT) DecMapUint64Float32X(vp *map[uint64]float32, checkNil bool, d *Decoder) {
- v, changed := f.DecMapUint64Float32V(*vp, checkNil, true, d)
- if changed {
- *vp = v
- }
-}
-func (_ fastpathT) DecMapUint64Float32V(v map[uint64]float32, checkNil bool, canChange bool,
- d *Decoder) (_ map[uint64]float32, changed bool) {
- dd := d.d
- cr := d.cr
-
- if checkNil && dd.TryDecodeAsNil() {
- if v != nil {
- changed = true
- }
- return nil, changed
- }
-
- containerLen := dd.ReadMapStart()
- if canChange && v == nil {
- xlen, _ := decInferLen(containerLen, d.h.MaxInitLen, 12)
- v = make(map[uint64]float32, xlen)
- changed = true
- }
-
- var mk uint64
- var mv float32
- if containerLen > 0 {
- for j := 0; j < containerLen; j++ {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- mk = dd.DecodeUint(64)
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- mv = float32(dd.DecodeFloat(true))
- if v != nil {
- v[mk] = mv
- }
- }
- } else if containerLen < 0 {
- for j := 0; !dd.CheckBreak(); j++ {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- mk = dd.DecodeUint(64)
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- mv = float32(dd.DecodeFloat(true))
- if v != nil {
- v[mk] = mv
- }
- }
- }
- if cr != nil {
- cr.sendContainerState(containerMapEnd)
- }
- return v, changed
-}
-
-func (f *decFnInfo) fastpathDecMapUint64Float64R(rv reflect.Value) {
- if rv.CanAddr() {
- vp := rv.Addr().Interface().(*map[uint64]float64)
- v, changed := fastpathTV.DecMapUint64Float64V(*vp, fastpathCheckNilFalse, true, f.d)
- if changed {
- *vp = v
- }
- } else {
- v := rv.Interface().(map[uint64]float64)
- fastpathTV.DecMapUint64Float64V(v, fastpathCheckNilFalse, false, f.d)
- }
-}
-func (f fastpathT) DecMapUint64Float64X(vp *map[uint64]float64, checkNil bool, d *Decoder) {
- v, changed := f.DecMapUint64Float64V(*vp, checkNil, true, d)
- if changed {
- *vp = v
- }
-}
-func (_ fastpathT) DecMapUint64Float64V(v map[uint64]float64, checkNil bool, canChange bool,
- d *Decoder) (_ map[uint64]float64, changed bool) {
- dd := d.d
- cr := d.cr
-
- if checkNil && dd.TryDecodeAsNil() {
- if v != nil {
- changed = true
- }
- return nil, changed
- }
-
- containerLen := dd.ReadMapStart()
- if canChange && v == nil {
- xlen, _ := decInferLen(containerLen, d.h.MaxInitLen, 16)
- v = make(map[uint64]float64, xlen)
- changed = true
- }
-
- var mk uint64
- var mv float64
- if containerLen > 0 {
- for j := 0; j < containerLen; j++ {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- mk = dd.DecodeUint(64)
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- mv = dd.DecodeFloat(false)
- if v != nil {
- v[mk] = mv
- }
- }
- } else if containerLen < 0 {
- for j := 0; !dd.CheckBreak(); j++ {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- mk = dd.DecodeUint(64)
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- mv = dd.DecodeFloat(false)
- if v != nil {
- v[mk] = mv
- }
- }
- }
- if cr != nil {
- cr.sendContainerState(containerMapEnd)
- }
- return v, changed
-}
-
-func (f *decFnInfo) fastpathDecMapUint64BoolR(rv reflect.Value) {
- if rv.CanAddr() {
- vp := rv.Addr().Interface().(*map[uint64]bool)
- v, changed := fastpathTV.DecMapUint64BoolV(*vp, fastpathCheckNilFalse, true, f.d)
- if changed {
- *vp = v
- }
- } else {
- v := rv.Interface().(map[uint64]bool)
- fastpathTV.DecMapUint64BoolV(v, fastpathCheckNilFalse, false, f.d)
- }
-}
-func (f fastpathT) DecMapUint64BoolX(vp *map[uint64]bool, checkNil bool, d *Decoder) {
- v, changed := f.DecMapUint64BoolV(*vp, checkNil, true, d)
- if changed {
- *vp = v
- }
-}
-func (_ fastpathT) DecMapUint64BoolV(v map[uint64]bool, checkNil bool, canChange bool,
- d *Decoder) (_ map[uint64]bool, changed bool) {
- dd := d.d
- cr := d.cr
-
- if checkNil && dd.TryDecodeAsNil() {
- if v != nil {
- changed = true
- }
- return nil, changed
- }
-
- containerLen := dd.ReadMapStart()
- if canChange && v == nil {
- xlen, _ := decInferLen(containerLen, d.h.MaxInitLen, 9)
- v = make(map[uint64]bool, xlen)
- changed = true
- }
-
- var mk uint64
- var mv bool
- if containerLen > 0 {
- for j := 0; j < containerLen; j++ {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- mk = dd.DecodeUint(64)
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- mv = dd.DecodeBool()
- if v != nil {
- v[mk] = mv
- }
- }
- } else if containerLen < 0 {
- for j := 0; !dd.CheckBreak(); j++ {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- mk = dd.DecodeUint(64)
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- mv = dd.DecodeBool()
- if v != nil {
- v[mk] = mv
- }
- }
- }
- if cr != nil {
- cr.sendContainerState(containerMapEnd)
- }
- return v, changed
-}
-
-func (f *decFnInfo) fastpathDecMapUintptrIntfR(rv reflect.Value) {
- if rv.CanAddr() {
- vp := rv.Addr().Interface().(*map[uintptr]interface{})
- v, changed := fastpathTV.DecMapUintptrIntfV(*vp, fastpathCheckNilFalse, true, f.d)
- if changed {
- *vp = v
- }
- } else {
- v := rv.Interface().(map[uintptr]interface{})
- fastpathTV.DecMapUintptrIntfV(v, fastpathCheckNilFalse, false, f.d)
- }
-}
-func (f fastpathT) DecMapUintptrIntfX(vp *map[uintptr]interface{}, checkNil bool, d *Decoder) {
- v, changed := f.DecMapUintptrIntfV(*vp, checkNil, true, d)
- if changed {
- *vp = v
- }
-}
-func (_ fastpathT) DecMapUintptrIntfV(v map[uintptr]interface{}, checkNil bool, canChange bool,
- d *Decoder) (_ map[uintptr]interface{}, changed bool) {
- dd := d.d
- cr := d.cr
-
- if checkNil && dd.TryDecodeAsNil() {
- if v != nil {
- changed = true
- }
- return nil, changed
- }
-
- containerLen := dd.ReadMapStart()
- if canChange && v == nil {
- xlen, _ := decInferLen(containerLen, d.h.MaxInitLen, 24)
- v = make(map[uintptr]interface{}, xlen)
- changed = true
- }
- mapGet := !d.h.MapValueReset && !d.h.InterfaceReset
- var mk uintptr
- var mv interface{}
- if containerLen > 0 {
- for j := 0; j < containerLen; j++ {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- mk = uintptr(dd.DecodeUint(uintBitsize))
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- if mapGet {
- mv = v[mk]
- } else {
- mv = nil
- }
- d.decode(&mv)
- if v != nil {
- v[mk] = mv
- }
- }
- } else if containerLen < 0 {
- for j := 0; !dd.CheckBreak(); j++ {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- mk = uintptr(dd.DecodeUint(uintBitsize))
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- if mapGet {
- mv = v[mk]
- } else {
- mv = nil
- }
- d.decode(&mv)
- if v != nil {
- v[mk] = mv
- }
- }
- }
- if cr != nil {
- cr.sendContainerState(containerMapEnd)
- }
- return v, changed
-}
-
-func (f *decFnInfo) fastpathDecMapUintptrStringR(rv reflect.Value) {
- if rv.CanAddr() {
- vp := rv.Addr().Interface().(*map[uintptr]string)
- v, changed := fastpathTV.DecMapUintptrStringV(*vp, fastpathCheckNilFalse, true, f.d)
- if changed {
- *vp = v
- }
- } else {
- v := rv.Interface().(map[uintptr]string)
- fastpathTV.DecMapUintptrStringV(v, fastpathCheckNilFalse, false, f.d)
- }
-}
-func (f fastpathT) DecMapUintptrStringX(vp *map[uintptr]string, checkNil bool, d *Decoder) {
- v, changed := f.DecMapUintptrStringV(*vp, checkNil, true, d)
- if changed {
- *vp = v
- }
-}
-func (_ fastpathT) DecMapUintptrStringV(v map[uintptr]string, checkNil bool, canChange bool,
- d *Decoder) (_ map[uintptr]string, changed bool) {
- dd := d.d
- cr := d.cr
-
- if checkNil && dd.TryDecodeAsNil() {
- if v != nil {
- changed = true
- }
- return nil, changed
- }
-
- containerLen := dd.ReadMapStart()
- if canChange && v == nil {
- xlen, _ := decInferLen(containerLen, d.h.MaxInitLen, 24)
- v = make(map[uintptr]string, xlen)
- changed = true
- }
-
- var mk uintptr
- var mv string
- if containerLen > 0 {
- for j := 0; j < containerLen; j++ {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- mk = uintptr(dd.DecodeUint(uintBitsize))
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- mv = dd.DecodeString()
- if v != nil {
- v[mk] = mv
- }
- }
- } else if containerLen < 0 {
- for j := 0; !dd.CheckBreak(); j++ {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- mk = uintptr(dd.DecodeUint(uintBitsize))
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- mv = dd.DecodeString()
- if v != nil {
- v[mk] = mv
- }
- }
- }
- if cr != nil {
- cr.sendContainerState(containerMapEnd)
- }
- return v, changed
-}
-
-func (f *decFnInfo) fastpathDecMapUintptrUintR(rv reflect.Value) {
- if rv.CanAddr() {
- vp := rv.Addr().Interface().(*map[uintptr]uint)
- v, changed := fastpathTV.DecMapUintptrUintV(*vp, fastpathCheckNilFalse, true, f.d)
- if changed {
- *vp = v
- }
- } else {
- v := rv.Interface().(map[uintptr]uint)
- fastpathTV.DecMapUintptrUintV(v, fastpathCheckNilFalse, false, f.d)
- }
-}
-func (f fastpathT) DecMapUintptrUintX(vp *map[uintptr]uint, checkNil bool, d *Decoder) {
- v, changed := f.DecMapUintptrUintV(*vp, checkNil, true, d)
- if changed {
- *vp = v
- }
-}
-func (_ fastpathT) DecMapUintptrUintV(v map[uintptr]uint, checkNil bool, canChange bool,
- d *Decoder) (_ map[uintptr]uint, changed bool) {
- dd := d.d
- cr := d.cr
-
- if checkNil && dd.TryDecodeAsNil() {
- if v != nil {
- changed = true
- }
- return nil, changed
- }
-
- containerLen := dd.ReadMapStart()
- if canChange && v == nil {
- xlen, _ := decInferLen(containerLen, d.h.MaxInitLen, 16)
- v = make(map[uintptr]uint, xlen)
- changed = true
- }
-
- var mk uintptr
- var mv uint
- if containerLen > 0 {
- for j := 0; j < containerLen; j++ {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- mk = uintptr(dd.DecodeUint(uintBitsize))
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- mv = uint(dd.DecodeUint(uintBitsize))
- if v != nil {
- v[mk] = mv
- }
- }
- } else if containerLen < 0 {
- for j := 0; !dd.CheckBreak(); j++ {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- mk = uintptr(dd.DecodeUint(uintBitsize))
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- mv = uint(dd.DecodeUint(uintBitsize))
- if v != nil {
- v[mk] = mv
- }
- }
- }
- if cr != nil {
- cr.sendContainerState(containerMapEnd)
- }
- return v, changed
-}
-
-func (f *decFnInfo) fastpathDecMapUintptrUint8R(rv reflect.Value) {
- if rv.CanAddr() {
- vp := rv.Addr().Interface().(*map[uintptr]uint8)
- v, changed := fastpathTV.DecMapUintptrUint8V(*vp, fastpathCheckNilFalse, true, f.d)
- if changed {
- *vp = v
- }
- } else {
- v := rv.Interface().(map[uintptr]uint8)
- fastpathTV.DecMapUintptrUint8V(v, fastpathCheckNilFalse, false, f.d)
- }
-}
-func (f fastpathT) DecMapUintptrUint8X(vp *map[uintptr]uint8, checkNil bool, d *Decoder) {
- v, changed := f.DecMapUintptrUint8V(*vp, checkNil, true, d)
- if changed {
- *vp = v
- }
-}
-func (_ fastpathT) DecMapUintptrUint8V(v map[uintptr]uint8, checkNil bool, canChange bool,
- d *Decoder) (_ map[uintptr]uint8, changed bool) {
- dd := d.d
- cr := d.cr
-
- if checkNil && dd.TryDecodeAsNil() {
- if v != nil {
- changed = true
- }
- return nil, changed
- }
-
- containerLen := dd.ReadMapStart()
- if canChange && v == nil {
- xlen, _ := decInferLen(containerLen, d.h.MaxInitLen, 9)
- v = make(map[uintptr]uint8, xlen)
- changed = true
- }
-
- var mk uintptr
- var mv uint8
- if containerLen > 0 {
- for j := 0; j < containerLen; j++ {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- mk = uintptr(dd.DecodeUint(uintBitsize))
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- mv = uint8(dd.DecodeUint(8))
- if v != nil {
- v[mk] = mv
- }
- }
- } else if containerLen < 0 {
- for j := 0; !dd.CheckBreak(); j++ {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- mk = uintptr(dd.DecodeUint(uintBitsize))
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- mv = uint8(dd.DecodeUint(8))
- if v != nil {
- v[mk] = mv
- }
- }
- }
- if cr != nil {
- cr.sendContainerState(containerMapEnd)
- }
- return v, changed
-}
-
-func (f *decFnInfo) fastpathDecMapUintptrUint16R(rv reflect.Value) {
- if rv.CanAddr() {
- vp := rv.Addr().Interface().(*map[uintptr]uint16)
- v, changed := fastpathTV.DecMapUintptrUint16V(*vp, fastpathCheckNilFalse, true, f.d)
- if changed {
- *vp = v
- }
- } else {
- v := rv.Interface().(map[uintptr]uint16)
- fastpathTV.DecMapUintptrUint16V(v, fastpathCheckNilFalse, false, f.d)
- }
-}
-func (f fastpathT) DecMapUintptrUint16X(vp *map[uintptr]uint16, checkNil bool, d *Decoder) {
- v, changed := f.DecMapUintptrUint16V(*vp, checkNil, true, d)
- if changed {
- *vp = v
- }
-}
-func (_ fastpathT) DecMapUintptrUint16V(v map[uintptr]uint16, checkNil bool, canChange bool,
- d *Decoder) (_ map[uintptr]uint16, changed bool) {
- dd := d.d
- cr := d.cr
-
- if checkNil && dd.TryDecodeAsNil() {
- if v != nil {
- changed = true
- }
- return nil, changed
- }
-
- containerLen := dd.ReadMapStart()
- if canChange && v == nil {
- xlen, _ := decInferLen(containerLen, d.h.MaxInitLen, 10)
- v = make(map[uintptr]uint16, xlen)
- changed = true
- }
-
- var mk uintptr
- var mv uint16
- if containerLen > 0 {
- for j := 0; j < containerLen; j++ {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- mk = uintptr(dd.DecodeUint(uintBitsize))
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- mv = uint16(dd.DecodeUint(16))
- if v != nil {
- v[mk] = mv
- }
- }
- } else if containerLen < 0 {
- for j := 0; !dd.CheckBreak(); j++ {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- mk = uintptr(dd.DecodeUint(uintBitsize))
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- mv = uint16(dd.DecodeUint(16))
- if v != nil {
- v[mk] = mv
- }
- }
- }
- if cr != nil {
- cr.sendContainerState(containerMapEnd)
- }
- return v, changed
-}
-
-func (f *decFnInfo) fastpathDecMapUintptrUint32R(rv reflect.Value) {
- if rv.CanAddr() {
- vp := rv.Addr().Interface().(*map[uintptr]uint32)
- v, changed := fastpathTV.DecMapUintptrUint32V(*vp, fastpathCheckNilFalse, true, f.d)
- if changed {
- *vp = v
- }
- } else {
- v := rv.Interface().(map[uintptr]uint32)
- fastpathTV.DecMapUintptrUint32V(v, fastpathCheckNilFalse, false, f.d)
- }
-}
-func (f fastpathT) DecMapUintptrUint32X(vp *map[uintptr]uint32, checkNil bool, d *Decoder) {
- v, changed := f.DecMapUintptrUint32V(*vp, checkNil, true, d)
- if changed {
- *vp = v
- }
-}
-func (_ fastpathT) DecMapUintptrUint32V(v map[uintptr]uint32, checkNil bool, canChange bool,
- d *Decoder) (_ map[uintptr]uint32, changed bool) {
- dd := d.d
- cr := d.cr
-
- if checkNil && dd.TryDecodeAsNil() {
- if v != nil {
- changed = true
- }
- return nil, changed
- }
-
- containerLen := dd.ReadMapStart()
- if canChange && v == nil {
- xlen, _ := decInferLen(containerLen, d.h.MaxInitLen, 12)
- v = make(map[uintptr]uint32, xlen)
- changed = true
- }
-
- var mk uintptr
- var mv uint32
- if containerLen > 0 {
- for j := 0; j < containerLen; j++ {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- mk = uintptr(dd.DecodeUint(uintBitsize))
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- mv = uint32(dd.DecodeUint(32))
- if v != nil {
- v[mk] = mv
- }
- }
- } else if containerLen < 0 {
- for j := 0; !dd.CheckBreak(); j++ {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- mk = uintptr(dd.DecodeUint(uintBitsize))
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- mv = uint32(dd.DecodeUint(32))
- if v != nil {
- v[mk] = mv
- }
- }
- }
- if cr != nil {
- cr.sendContainerState(containerMapEnd)
- }
- return v, changed
-}
-
-func (f *decFnInfo) fastpathDecMapUintptrUint64R(rv reflect.Value) {
- if rv.CanAddr() {
- vp := rv.Addr().Interface().(*map[uintptr]uint64)
- v, changed := fastpathTV.DecMapUintptrUint64V(*vp, fastpathCheckNilFalse, true, f.d)
- if changed {
- *vp = v
- }
- } else {
- v := rv.Interface().(map[uintptr]uint64)
- fastpathTV.DecMapUintptrUint64V(v, fastpathCheckNilFalse, false, f.d)
- }
-}
-func (f fastpathT) DecMapUintptrUint64X(vp *map[uintptr]uint64, checkNil bool, d *Decoder) {
- v, changed := f.DecMapUintptrUint64V(*vp, checkNil, true, d)
- if changed {
- *vp = v
- }
-}
-func (_ fastpathT) DecMapUintptrUint64V(v map[uintptr]uint64, checkNil bool, canChange bool,
- d *Decoder) (_ map[uintptr]uint64, changed bool) {
- dd := d.d
- cr := d.cr
-
- if checkNil && dd.TryDecodeAsNil() {
- if v != nil {
- changed = true
- }
- return nil, changed
- }
-
- containerLen := dd.ReadMapStart()
- if canChange && v == nil {
- xlen, _ := decInferLen(containerLen, d.h.MaxInitLen, 16)
- v = make(map[uintptr]uint64, xlen)
- changed = true
- }
-
- var mk uintptr
- var mv uint64
- if containerLen > 0 {
- for j := 0; j < containerLen; j++ {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- mk = uintptr(dd.DecodeUint(uintBitsize))
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- mv = dd.DecodeUint(64)
- if v != nil {
- v[mk] = mv
- }
- }
- } else if containerLen < 0 {
- for j := 0; !dd.CheckBreak(); j++ {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- mk = uintptr(dd.DecodeUint(uintBitsize))
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- mv = dd.DecodeUint(64)
- if v != nil {
- v[mk] = mv
- }
- }
- }
- if cr != nil {
- cr.sendContainerState(containerMapEnd)
- }
- return v, changed
-}
-
-func (f *decFnInfo) fastpathDecMapUintptrUintptrR(rv reflect.Value) {
- if rv.CanAddr() {
- vp := rv.Addr().Interface().(*map[uintptr]uintptr)
- v, changed := fastpathTV.DecMapUintptrUintptrV(*vp, fastpathCheckNilFalse, true, f.d)
- if changed {
- *vp = v
- }
- } else {
- v := rv.Interface().(map[uintptr]uintptr)
- fastpathTV.DecMapUintptrUintptrV(v, fastpathCheckNilFalse, false, f.d)
- }
-}
-func (f fastpathT) DecMapUintptrUintptrX(vp *map[uintptr]uintptr, checkNil bool, d *Decoder) {
- v, changed := f.DecMapUintptrUintptrV(*vp, checkNil, true, d)
- if changed {
- *vp = v
- }
-}
-func (_ fastpathT) DecMapUintptrUintptrV(v map[uintptr]uintptr, checkNil bool, canChange bool,
- d *Decoder) (_ map[uintptr]uintptr, changed bool) {
- dd := d.d
- cr := d.cr
-
- if checkNil && dd.TryDecodeAsNil() {
- if v != nil {
- changed = true
- }
- return nil, changed
- }
-
- containerLen := dd.ReadMapStart()
- if canChange && v == nil {
- xlen, _ := decInferLen(containerLen, d.h.MaxInitLen, 16)
- v = make(map[uintptr]uintptr, xlen)
- changed = true
- }
-
- var mk uintptr
- var mv uintptr
- if containerLen > 0 {
- for j := 0; j < containerLen; j++ {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- mk = uintptr(dd.DecodeUint(uintBitsize))
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- mv = uintptr(dd.DecodeUint(uintBitsize))
- if v != nil {
- v[mk] = mv
- }
- }
- } else if containerLen < 0 {
- for j := 0; !dd.CheckBreak(); j++ {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- mk = uintptr(dd.DecodeUint(uintBitsize))
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- mv = uintptr(dd.DecodeUint(uintBitsize))
- if v != nil {
- v[mk] = mv
- }
- }
- }
- if cr != nil {
- cr.sendContainerState(containerMapEnd)
- }
- return v, changed
-}
-
-func (f *decFnInfo) fastpathDecMapUintptrIntR(rv reflect.Value) {
- if rv.CanAddr() {
- vp := rv.Addr().Interface().(*map[uintptr]int)
- v, changed := fastpathTV.DecMapUintptrIntV(*vp, fastpathCheckNilFalse, true, f.d)
- if changed {
- *vp = v
- }
- } else {
- v := rv.Interface().(map[uintptr]int)
- fastpathTV.DecMapUintptrIntV(v, fastpathCheckNilFalse, false, f.d)
- }
-}
-func (f fastpathT) DecMapUintptrIntX(vp *map[uintptr]int, checkNil bool, d *Decoder) {
- v, changed := f.DecMapUintptrIntV(*vp, checkNil, true, d)
- if changed {
- *vp = v
- }
-}
-func (_ fastpathT) DecMapUintptrIntV(v map[uintptr]int, checkNil bool, canChange bool,
- d *Decoder) (_ map[uintptr]int, changed bool) {
- dd := d.d
- cr := d.cr
-
- if checkNil && dd.TryDecodeAsNil() {
- if v != nil {
- changed = true
- }
- return nil, changed
- }
-
- containerLen := dd.ReadMapStart()
- if canChange && v == nil {
- xlen, _ := decInferLen(containerLen, d.h.MaxInitLen, 16)
- v = make(map[uintptr]int, xlen)
- changed = true
- }
-
- var mk uintptr
- var mv int
- if containerLen > 0 {
- for j := 0; j < containerLen; j++ {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- mk = uintptr(dd.DecodeUint(uintBitsize))
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- mv = int(dd.DecodeInt(intBitsize))
- if v != nil {
- v[mk] = mv
- }
- }
- } else if containerLen < 0 {
- for j := 0; !dd.CheckBreak(); j++ {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- mk = uintptr(dd.DecodeUint(uintBitsize))
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- mv = int(dd.DecodeInt(intBitsize))
- if v != nil {
- v[mk] = mv
- }
- }
- }
- if cr != nil {
- cr.sendContainerState(containerMapEnd)
- }
- return v, changed
-}
-
-func (f *decFnInfo) fastpathDecMapUintptrInt8R(rv reflect.Value) {
- if rv.CanAddr() {
- vp := rv.Addr().Interface().(*map[uintptr]int8)
- v, changed := fastpathTV.DecMapUintptrInt8V(*vp, fastpathCheckNilFalse, true, f.d)
- if changed {
- *vp = v
- }
- } else {
- v := rv.Interface().(map[uintptr]int8)
- fastpathTV.DecMapUintptrInt8V(v, fastpathCheckNilFalse, false, f.d)
- }
-}
-func (f fastpathT) DecMapUintptrInt8X(vp *map[uintptr]int8, checkNil bool, d *Decoder) {
- v, changed := f.DecMapUintptrInt8V(*vp, checkNil, true, d)
- if changed {
- *vp = v
- }
-}
-func (_ fastpathT) DecMapUintptrInt8V(v map[uintptr]int8, checkNil bool, canChange bool,
- d *Decoder) (_ map[uintptr]int8, changed bool) {
- dd := d.d
- cr := d.cr
-
- if checkNil && dd.TryDecodeAsNil() {
- if v != nil {
- changed = true
- }
- return nil, changed
- }
-
- containerLen := dd.ReadMapStart()
- if canChange && v == nil {
- xlen, _ := decInferLen(containerLen, d.h.MaxInitLen, 9)
- v = make(map[uintptr]int8, xlen)
- changed = true
- }
-
- var mk uintptr
- var mv int8
- if containerLen > 0 {
- for j := 0; j < containerLen; j++ {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- mk = uintptr(dd.DecodeUint(uintBitsize))
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- mv = int8(dd.DecodeInt(8))
- if v != nil {
- v[mk] = mv
- }
- }
- } else if containerLen < 0 {
- for j := 0; !dd.CheckBreak(); j++ {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- mk = uintptr(dd.DecodeUint(uintBitsize))
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- mv = int8(dd.DecodeInt(8))
- if v != nil {
- v[mk] = mv
- }
- }
- }
- if cr != nil {
- cr.sendContainerState(containerMapEnd)
- }
- return v, changed
-}
-
-func (f *decFnInfo) fastpathDecMapUintptrInt16R(rv reflect.Value) {
- if rv.CanAddr() {
- vp := rv.Addr().Interface().(*map[uintptr]int16)
- v, changed := fastpathTV.DecMapUintptrInt16V(*vp, fastpathCheckNilFalse, true, f.d)
- if changed {
- *vp = v
- }
- } else {
- v := rv.Interface().(map[uintptr]int16)
- fastpathTV.DecMapUintptrInt16V(v, fastpathCheckNilFalse, false, f.d)
- }
-}
-func (f fastpathT) DecMapUintptrInt16X(vp *map[uintptr]int16, checkNil bool, d *Decoder) {
- v, changed := f.DecMapUintptrInt16V(*vp, checkNil, true, d)
- if changed {
- *vp = v
- }
-}
-func (_ fastpathT) DecMapUintptrInt16V(v map[uintptr]int16, checkNil bool, canChange bool,
- d *Decoder) (_ map[uintptr]int16, changed bool) {
- dd := d.d
- cr := d.cr
-
- if checkNil && dd.TryDecodeAsNil() {
- if v != nil {
- changed = true
- }
- return nil, changed
- }
-
- containerLen := dd.ReadMapStart()
- if canChange && v == nil {
- xlen, _ := decInferLen(containerLen, d.h.MaxInitLen, 10)
- v = make(map[uintptr]int16, xlen)
- changed = true
- }
-
- var mk uintptr
- var mv int16
- if containerLen > 0 {
- for j := 0; j < containerLen; j++ {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- mk = uintptr(dd.DecodeUint(uintBitsize))
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- mv = int16(dd.DecodeInt(16))
- if v != nil {
- v[mk] = mv
- }
- }
- } else if containerLen < 0 {
- for j := 0; !dd.CheckBreak(); j++ {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- mk = uintptr(dd.DecodeUint(uintBitsize))
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- mv = int16(dd.DecodeInt(16))
- if v != nil {
- v[mk] = mv
- }
- }
- }
- if cr != nil {
- cr.sendContainerState(containerMapEnd)
- }
- return v, changed
-}
-
-func (f *decFnInfo) fastpathDecMapUintptrInt32R(rv reflect.Value) {
- if rv.CanAddr() {
- vp := rv.Addr().Interface().(*map[uintptr]int32)
- v, changed := fastpathTV.DecMapUintptrInt32V(*vp, fastpathCheckNilFalse, true, f.d)
- if changed {
- *vp = v
- }
- } else {
- v := rv.Interface().(map[uintptr]int32)
- fastpathTV.DecMapUintptrInt32V(v, fastpathCheckNilFalse, false, f.d)
- }
-}
-func (f fastpathT) DecMapUintptrInt32X(vp *map[uintptr]int32, checkNil bool, d *Decoder) {
- v, changed := f.DecMapUintptrInt32V(*vp, checkNil, true, d)
- if changed {
- *vp = v
- }
-}
-func (_ fastpathT) DecMapUintptrInt32V(v map[uintptr]int32, checkNil bool, canChange bool,
- d *Decoder) (_ map[uintptr]int32, changed bool) {
- dd := d.d
- cr := d.cr
-
- if checkNil && dd.TryDecodeAsNil() {
- if v != nil {
- changed = true
- }
- return nil, changed
- }
-
- containerLen := dd.ReadMapStart()
- if canChange && v == nil {
- xlen, _ := decInferLen(containerLen, d.h.MaxInitLen, 12)
- v = make(map[uintptr]int32, xlen)
- changed = true
- }
-
- var mk uintptr
- var mv int32
- if containerLen > 0 {
- for j := 0; j < containerLen; j++ {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- mk = uintptr(dd.DecodeUint(uintBitsize))
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- mv = int32(dd.DecodeInt(32))
- if v != nil {
- v[mk] = mv
- }
- }
- } else if containerLen < 0 {
- for j := 0; !dd.CheckBreak(); j++ {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- mk = uintptr(dd.DecodeUint(uintBitsize))
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- mv = int32(dd.DecodeInt(32))
- if v != nil {
- v[mk] = mv
- }
- }
- }
- if cr != nil {
- cr.sendContainerState(containerMapEnd)
- }
- return v, changed
-}
-
-func (f *decFnInfo) fastpathDecMapUintptrInt64R(rv reflect.Value) {
- if rv.CanAddr() {
- vp := rv.Addr().Interface().(*map[uintptr]int64)
- v, changed := fastpathTV.DecMapUintptrInt64V(*vp, fastpathCheckNilFalse, true, f.d)
- if changed {
- *vp = v
- }
- } else {
- v := rv.Interface().(map[uintptr]int64)
- fastpathTV.DecMapUintptrInt64V(v, fastpathCheckNilFalse, false, f.d)
- }
-}
-func (f fastpathT) DecMapUintptrInt64X(vp *map[uintptr]int64, checkNil bool, d *Decoder) {
- v, changed := f.DecMapUintptrInt64V(*vp, checkNil, true, d)
- if changed {
- *vp = v
- }
-}
-func (_ fastpathT) DecMapUintptrInt64V(v map[uintptr]int64, checkNil bool, canChange bool,
- d *Decoder) (_ map[uintptr]int64, changed bool) {
- dd := d.d
- cr := d.cr
-
- if checkNil && dd.TryDecodeAsNil() {
- if v != nil {
- changed = true
- }
- return nil, changed
- }
-
- containerLen := dd.ReadMapStart()
- if canChange && v == nil {
- xlen, _ := decInferLen(containerLen, d.h.MaxInitLen, 16)
- v = make(map[uintptr]int64, xlen)
- changed = true
- }
-
- var mk uintptr
- var mv int64
- if containerLen > 0 {
- for j := 0; j < containerLen; j++ {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- mk = uintptr(dd.DecodeUint(uintBitsize))
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- mv = dd.DecodeInt(64)
- if v != nil {
- v[mk] = mv
- }
- }
- } else if containerLen < 0 {
- for j := 0; !dd.CheckBreak(); j++ {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- mk = uintptr(dd.DecodeUint(uintBitsize))
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- mv = dd.DecodeInt(64)
- if v != nil {
- v[mk] = mv
- }
- }
- }
- if cr != nil {
- cr.sendContainerState(containerMapEnd)
- }
- return v, changed
-}
-
-func (f *decFnInfo) fastpathDecMapUintptrFloat32R(rv reflect.Value) {
- if rv.CanAddr() {
- vp := rv.Addr().Interface().(*map[uintptr]float32)
- v, changed := fastpathTV.DecMapUintptrFloat32V(*vp, fastpathCheckNilFalse, true, f.d)
- if changed {
- *vp = v
- }
- } else {
- v := rv.Interface().(map[uintptr]float32)
- fastpathTV.DecMapUintptrFloat32V(v, fastpathCheckNilFalse, false, f.d)
- }
-}
-func (f fastpathT) DecMapUintptrFloat32X(vp *map[uintptr]float32, checkNil bool, d *Decoder) {
- v, changed := f.DecMapUintptrFloat32V(*vp, checkNil, true, d)
- if changed {
- *vp = v
- }
-}
-func (_ fastpathT) DecMapUintptrFloat32V(v map[uintptr]float32, checkNil bool, canChange bool,
- d *Decoder) (_ map[uintptr]float32, changed bool) {
- dd := d.d
- cr := d.cr
-
- if checkNil && dd.TryDecodeAsNil() {
- if v != nil {
- changed = true
- }
- return nil, changed
- }
-
- containerLen := dd.ReadMapStart()
- if canChange && v == nil {
- xlen, _ := decInferLen(containerLen, d.h.MaxInitLen, 12)
- v = make(map[uintptr]float32, xlen)
- changed = true
- }
-
- var mk uintptr
- var mv float32
- if containerLen > 0 {
- for j := 0; j < containerLen; j++ {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- mk = uintptr(dd.DecodeUint(uintBitsize))
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- mv = float32(dd.DecodeFloat(true))
- if v != nil {
- v[mk] = mv
- }
- }
- } else if containerLen < 0 {
- for j := 0; !dd.CheckBreak(); j++ {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- mk = uintptr(dd.DecodeUint(uintBitsize))
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- mv = float32(dd.DecodeFloat(true))
- if v != nil {
- v[mk] = mv
- }
- }
- }
- if cr != nil {
- cr.sendContainerState(containerMapEnd)
- }
- return v, changed
-}
-
-func (f *decFnInfo) fastpathDecMapUintptrFloat64R(rv reflect.Value) {
- if rv.CanAddr() {
- vp := rv.Addr().Interface().(*map[uintptr]float64)
- v, changed := fastpathTV.DecMapUintptrFloat64V(*vp, fastpathCheckNilFalse, true, f.d)
- if changed {
- *vp = v
- }
- } else {
- v := rv.Interface().(map[uintptr]float64)
- fastpathTV.DecMapUintptrFloat64V(v, fastpathCheckNilFalse, false, f.d)
- }
-}
-func (f fastpathT) DecMapUintptrFloat64X(vp *map[uintptr]float64, checkNil bool, d *Decoder) {
- v, changed := f.DecMapUintptrFloat64V(*vp, checkNil, true, d)
- if changed {
- *vp = v
- }
-}
-func (_ fastpathT) DecMapUintptrFloat64V(v map[uintptr]float64, checkNil bool, canChange bool,
- d *Decoder) (_ map[uintptr]float64, changed bool) {
- dd := d.d
- cr := d.cr
-
- if checkNil && dd.TryDecodeAsNil() {
- if v != nil {
- changed = true
- }
- return nil, changed
- }
-
- containerLen := dd.ReadMapStart()
- if canChange && v == nil {
- xlen, _ := decInferLen(containerLen, d.h.MaxInitLen, 16)
- v = make(map[uintptr]float64, xlen)
- changed = true
- }
-
- var mk uintptr
- var mv float64
- if containerLen > 0 {
- for j := 0; j < containerLen; j++ {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- mk = uintptr(dd.DecodeUint(uintBitsize))
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- mv = dd.DecodeFloat(false)
- if v != nil {
- v[mk] = mv
- }
- }
- } else if containerLen < 0 {
- for j := 0; !dd.CheckBreak(); j++ {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- mk = uintptr(dd.DecodeUint(uintBitsize))
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- mv = dd.DecodeFloat(false)
- if v != nil {
- v[mk] = mv
- }
- }
- }
- if cr != nil {
- cr.sendContainerState(containerMapEnd)
- }
- return v, changed
-}
-
-func (f *decFnInfo) fastpathDecMapUintptrBoolR(rv reflect.Value) {
- if rv.CanAddr() {
- vp := rv.Addr().Interface().(*map[uintptr]bool)
- v, changed := fastpathTV.DecMapUintptrBoolV(*vp, fastpathCheckNilFalse, true, f.d)
- if changed {
- *vp = v
- }
- } else {
- v := rv.Interface().(map[uintptr]bool)
- fastpathTV.DecMapUintptrBoolV(v, fastpathCheckNilFalse, false, f.d)
- }
-}
-func (f fastpathT) DecMapUintptrBoolX(vp *map[uintptr]bool, checkNil bool, d *Decoder) {
- v, changed := f.DecMapUintptrBoolV(*vp, checkNil, true, d)
- if changed {
- *vp = v
- }
-}
-func (_ fastpathT) DecMapUintptrBoolV(v map[uintptr]bool, checkNil bool, canChange bool,
- d *Decoder) (_ map[uintptr]bool, changed bool) {
- dd := d.d
- cr := d.cr
-
- if checkNil && dd.TryDecodeAsNil() {
- if v != nil {
- changed = true
- }
- return nil, changed
- }
-
- containerLen := dd.ReadMapStart()
- if canChange && v == nil {
- xlen, _ := decInferLen(containerLen, d.h.MaxInitLen, 9)
- v = make(map[uintptr]bool, xlen)
- changed = true
- }
-
- var mk uintptr
- var mv bool
- if containerLen > 0 {
- for j := 0; j < containerLen; j++ {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- mk = uintptr(dd.DecodeUint(uintBitsize))
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- mv = dd.DecodeBool()
- if v != nil {
- v[mk] = mv
- }
- }
- } else if containerLen < 0 {
- for j := 0; !dd.CheckBreak(); j++ {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- mk = uintptr(dd.DecodeUint(uintBitsize))
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- mv = dd.DecodeBool()
- if v != nil {
- v[mk] = mv
- }
- }
- }
- if cr != nil {
- cr.sendContainerState(containerMapEnd)
- }
- return v, changed
-}
-
-func (f *decFnInfo) fastpathDecMapIntIntfR(rv reflect.Value) {
- if rv.CanAddr() {
- vp := rv.Addr().Interface().(*map[int]interface{})
- v, changed := fastpathTV.DecMapIntIntfV(*vp, fastpathCheckNilFalse, true, f.d)
- if changed {
- *vp = v
- }
- } else {
- v := rv.Interface().(map[int]interface{})
- fastpathTV.DecMapIntIntfV(v, fastpathCheckNilFalse, false, f.d)
- }
-}
-func (f fastpathT) DecMapIntIntfX(vp *map[int]interface{}, checkNil bool, d *Decoder) {
- v, changed := f.DecMapIntIntfV(*vp, checkNil, true, d)
- if changed {
- *vp = v
- }
-}
-func (_ fastpathT) DecMapIntIntfV(v map[int]interface{}, checkNil bool, canChange bool,
- d *Decoder) (_ map[int]interface{}, changed bool) {
- dd := d.d
- cr := d.cr
-
- if checkNil && dd.TryDecodeAsNil() {
- if v != nil {
- changed = true
- }
- return nil, changed
- }
-
- containerLen := dd.ReadMapStart()
- if canChange && v == nil {
- xlen, _ := decInferLen(containerLen, d.h.MaxInitLen, 24)
- v = make(map[int]interface{}, xlen)
- changed = true
- }
- mapGet := !d.h.MapValueReset && !d.h.InterfaceReset
- var mk int
- var mv interface{}
- if containerLen > 0 {
- for j := 0; j < containerLen; j++ {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- mk = int(dd.DecodeInt(intBitsize))
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- if mapGet {
- mv = v[mk]
- } else {
- mv = nil
- }
- d.decode(&mv)
- if v != nil {
- v[mk] = mv
- }
- }
- } else if containerLen < 0 {
- for j := 0; !dd.CheckBreak(); j++ {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- mk = int(dd.DecodeInt(intBitsize))
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- if mapGet {
- mv = v[mk]
- } else {
- mv = nil
- }
- d.decode(&mv)
- if v != nil {
- v[mk] = mv
- }
- }
- }
- if cr != nil {
- cr.sendContainerState(containerMapEnd)
- }
- return v, changed
-}
-
-func (f *decFnInfo) fastpathDecMapIntStringR(rv reflect.Value) {
- if rv.CanAddr() {
- vp := rv.Addr().Interface().(*map[int]string)
- v, changed := fastpathTV.DecMapIntStringV(*vp, fastpathCheckNilFalse, true, f.d)
- if changed {
- *vp = v
- }
- } else {
- v := rv.Interface().(map[int]string)
- fastpathTV.DecMapIntStringV(v, fastpathCheckNilFalse, false, f.d)
- }
-}
-func (f fastpathT) DecMapIntStringX(vp *map[int]string, checkNil bool, d *Decoder) {
- v, changed := f.DecMapIntStringV(*vp, checkNil, true, d)
- if changed {
- *vp = v
- }
-}
-func (_ fastpathT) DecMapIntStringV(v map[int]string, checkNil bool, canChange bool,
- d *Decoder) (_ map[int]string, changed bool) {
- dd := d.d
- cr := d.cr
-
- if checkNil && dd.TryDecodeAsNil() {
- if v != nil {
- changed = true
- }
- return nil, changed
- }
-
- containerLen := dd.ReadMapStart()
- if canChange && v == nil {
- xlen, _ := decInferLen(containerLen, d.h.MaxInitLen, 24)
- v = make(map[int]string, xlen)
- changed = true
- }
-
- var mk int
- var mv string
- if containerLen > 0 {
- for j := 0; j < containerLen; j++ {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- mk = int(dd.DecodeInt(intBitsize))
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- mv = dd.DecodeString()
- if v != nil {
- v[mk] = mv
- }
- }
- } else if containerLen < 0 {
- for j := 0; !dd.CheckBreak(); j++ {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- mk = int(dd.DecodeInt(intBitsize))
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- mv = dd.DecodeString()
- if v != nil {
- v[mk] = mv
- }
- }
- }
- if cr != nil {
- cr.sendContainerState(containerMapEnd)
- }
- return v, changed
-}
-
-func (f *decFnInfo) fastpathDecMapIntUintR(rv reflect.Value) {
- if rv.CanAddr() {
- vp := rv.Addr().Interface().(*map[int]uint)
- v, changed := fastpathTV.DecMapIntUintV(*vp, fastpathCheckNilFalse, true, f.d)
- if changed {
- *vp = v
- }
- } else {
- v := rv.Interface().(map[int]uint)
- fastpathTV.DecMapIntUintV(v, fastpathCheckNilFalse, false, f.d)
- }
-}
-func (f fastpathT) DecMapIntUintX(vp *map[int]uint, checkNil bool, d *Decoder) {
- v, changed := f.DecMapIntUintV(*vp, checkNil, true, d)
- if changed {
- *vp = v
- }
-}
-func (_ fastpathT) DecMapIntUintV(v map[int]uint, checkNil bool, canChange bool,
- d *Decoder) (_ map[int]uint, changed bool) {
- dd := d.d
- cr := d.cr
-
- if checkNil && dd.TryDecodeAsNil() {
- if v != nil {
- changed = true
- }
- return nil, changed
- }
-
- containerLen := dd.ReadMapStart()
- if canChange && v == nil {
- xlen, _ := decInferLen(containerLen, d.h.MaxInitLen, 16)
- v = make(map[int]uint, xlen)
- changed = true
- }
-
- var mk int
- var mv uint
- if containerLen > 0 {
- for j := 0; j < containerLen; j++ {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- mk = int(dd.DecodeInt(intBitsize))
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- mv = uint(dd.DecodeUint(uintBitsize))
- if v != nil {
- v[mk] = mv
- }
- }
- } else if containerLen < 0 {
- for j := 0; !dd.CheckBreak(); j++ {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- mk = int(dd.DecodeInt(intBitsize))
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- mv = uint(dd.DecodeUint(uintBitsize))
- if v != nil {
- v[mk] = mv
- }
- }
- }
- if cr != nil {
- cr.sendContainerState(containerMapEnd)
- }
- return v, changed
-}
-
-func (f *decFnInfo) fastpathDecMapIntUint8R(rv reflect.Value) {
- if rv.CanAddr() {
- vp := rv.Addr().Interface().(*map[int]uint8)
- v, changed := fastpathTV.DecMapIntUint8V(*vp, fastpathCheckNilFalse, true, f.d)
- if changed {
- *vp = v
- }
- } else {
- v := rv.Interface().(map[int]uint8)
- fastpathTV.DecMapIntUint8V(v, fastpathCheckNilFalse, false, f.d)
- }
-}
-func (f fastpathT) DecMapIntUint8X(vp *map[int]uint8, checkNil bool, d *Decoder) {
- v, changed := f.DecMapIntUint8V(*vp, checkNil, true, d)
- if changed {
- *vp = v
- }
-}
-func (_ fastpathT) DecMapIntUint8V(v map[int]uint8, checkNil bool, canChange bool,
- d *Decoder) (_ map[int]uint8, changed bool) {
- dd := d.d
- cr := d.cr
-
- if checkNil && dd.TryDecodeAsNil() {
- if v != nil {
- changed = true
- }
- return nil, changed
- }
-
- containerLen := dd.ReadMapStart()
- if canChange && v == nil {
- xlen, _ := decInferLen(containerLen, d.h.MaxInitLen, 9)
- v = make(map[int]uint8, xlen)
- changed = true
- }
-
- var mk int
- var mv uint8
- if containerLen > 0 {
- for j := 0; j < containerLen; j++ {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- mk = int(dd.DecodeInt(intBitsize))
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- mv = uint8(dd.DecodeUint(8))
- if v != nil {
- v[mk] = mv
- }
- }
- } else if containerLen < 0 {
- for j := 0; !dd.CheckBreak(); j++ {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- mk = int(dd.DecodeInt(intBitsize))
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- mv = uint8(dd.DecodeUint(8))
- if v != nil {
- v[mk] = mv
- }
- }
- }
- if cr != nil {
- cr.sendContainerState(containerMapEnd)
- }
- return v, changed
-}
-
-func (f *decFnInfo) fastpathDecMapIntUint16R(rv reflect.Value) {
- if rv.CanAddr() {
- vp := rv.Addr().Interface().(*map[int]uint16)
- v, changed := fastpathTV.DecMapIntUint16V(*vp, fastpathCheckNilFalse, true, f.d)
- if changed {
- *vp = v
- }
- } else {
- v := rv.Interface().(map[int]uint16)
- fastpathTV.DecMapIntUint16V(v, fastpathCheckNilFalse, false, f.d)
- }
-}
-func (f fastpathT) DecMapIntUint16X(vp *map[int]uint16, checkNil bool, d *Decoder) {
- v, changed := f.DecMapIntUint16V(*vp, checkNil, true, d)
- if changed {
- *vp = v
- }
-}
-func (_ fastpathT) DecMapIntUint16V(v map[int]uint16, checkNil bool, canChange bool,
- d *Decoder) (_ map[int]uint16, changed bool) {
- dd := d.d
- cr := d.cr
-
- if checkNil && dd.TryDecodeAsNil() {
- if v != nil {
- changed = true
- }
- return nil, changed
- }
-
- containerLen := dd.ReadMapStart()
- if canChange && v == nil {
- xlen, _ := decInferLen(containerLen, d.h.MaxInitLen, 10)
- v = make(map[int]uint16, xlen)
- changed = true
- }
-
- var mk int
- var mv uint16
- if containerLen > 0 {
- for j := 0; j < containerLen; j++ {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- mk = int(dd.DecodeInt(intBitsize))
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- mv = uint16(dd.DecodeUint(16))
- if v != nil {
- v[mk] = mv
- }
- }
- } else if containerLen < 0 {
- for j := 0; !dd.CheckBreak(); j++ {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- mk = int(dd.DecodeInt(intBitsize))
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- mv = uint16(dd.DecodeUint(16))
- if v != nil {
- v[mk] = mv
- }
- }
- }
- if cr != nil {
- cr.sendContainerState(containerMapEnd)
- }
- return v, changed
-}
-
-func (f *decFnInfo) fastpathDecMapIntUint32R(rv reflect.Value) {
- if rv.CanAddr() {
- vp := rv.Addr().Interface().(*map[int]uint32)
- v, changed := fastpathTV.DecMapIntUint32V(*vp, fastpathCheckNilFalse, true, f.d)
- if changed {
- *vp = v
- }
- } else {
- v := rv.Interface().(map[int]uint32)
- fastpathTV.DecMapIntUint32V(v, fastpathCheckNilFalse, false, f.d)
- }
-}
-func (f fastpathT) DecMapIntUint32X(vp *map[int]uint32, checkNil bool, d *Decoder) {
- v, changed := f.DecMapIntUint32V(*vp, checkNil, true, d)
- if changed {
- *vp = v
- }
-}
-func (_ fastpathT) DecMapIntUint32V(v map[int]uint32, checkNil bool, canChange bool,
- d *Decoder) (_ map[int]uint32, changed bool) {
- dd := d.d
- cr := d.cr
-
- if checkNil && dd.TryDecodeAsNil() {
- if v != nil {
- changed = true
- }
- return nil, changed
- }
-
- containerLen := dd.ReadMapStart()
- if canChange && v == nil {
- xlen, _ := decInferLen(containerLen, d.h.MaxInitLen, 12)
- v = make(map[int]uint32, xlen)
- changed = true
- }
-
- var mk int
- var mv uint32
- if containerLen > 0 {
- for j := 0; j < containerLen; j++ {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- mk = int(dd.DecodeInt(intBitsize))
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- mv = uint32(dd.DecodeUint(32))
- if v != nil {
- v[mk] = mv
- }
- }
- } else if containerLen < 0 {
- for j := 0; !dd.CheckBreak(); j++ {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- mk = int(dd.DecodeInt(intBitsize))
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- mv = uint32(dd.DecodeUint(32))
- if v != nil {
- v[mk] = mv
- }
- }
- }
- if cr != nil {
- cr.sendContainerState(containerMapEnd)
- }
- return v, changed
-}
-
-func (f *decFnInfo) fastpathDecMapIntUint64R(rv reflect.Value) {
- if rv.CanAddr() {
- vp := rv.Addr().Interface().(*map[int]uint64)
- v, changed := fastpathTV.DecMapIntUint64V(*vp, fastpathCheckNilFalse, true, f.d)
- if changed {
- *vp = v
- }
- } else {
- v := rv.Interface().(map[int]uint64)
- fastpathTV.DecMapIntUint64V(v, fastpathCheckNilFalse, false, f.d)
- }
-}
-func (f fastpathT) DecMapIntUint64X(vp *map[int]uint64, checkNil bool, d *Decoder) {
- v, changed := f.DecMapIntUint64V(*vp, checkNil, true, d)
- if changed {
- *vp = v
- }
-}
-func (_ fastpathT) DecMapIntUint64V(v map[int]uint64, checkNil bool, canChange bool,
- d *Decoder) (_ map[int]uint64, changed bool) {
- dd := d.d
- cr := d.cr
-
- if checkNil && dd.TryDecodeAsNil() {
- if v != nil {
- changed = true
- }
- return nil, changed
- }
-
- containerLen := dd.ReadMapStart()
- if canChange && v == nil {
- xlen, _ := decInferLen(containerLen, d.h.MaxInitLen, 16)
- v = make(map[int]uint64, xlen)
- changed = true
- }
-
- var mk int
- var mv uint64
- if containerLen > 0 {
- for j := 0; j < containerLen; j++ {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- mk = int(dd.DecodeInt(intBitsize))
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- mv = dd.DecodeUint(64)
- if v != nil {
- v[mk] = mv
- }
- }
- } else if containerLen < 0 {
- for j := 0; !dd.CheckBreak(); j++ {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- mk = int(dd.DecodeInt(intBitsize))
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- mv = dd.DecodeUint(64)
- if v != nil {
- v[mk] = mv
- }
- }
- }
- if cr != nil {
- cr.sendContainerState(containerMapEnd)
- }
- return v, changed
-}
-
-func (f *decFnInfo) fastpathDecMapIntUintptrR(rv reflect.Value) {
- if rv.CanAddr() {
- vp := rv.Addr().Interface().(*map[int]uintptr)
- v, changed := fastpathTV.DecMapIntUintptrV(*vp, fastpathCheckNilFalse, true, f.d)
- if changed {
- *vp = v
- }
- } else {
- v := rv.Interface().(map[int]uintptr)
- fastpathTV.DecMapIntUintptrV(v, fastpathCheckNilFalse, false, f.d)
- }
-}
-func (f fastpathT) DecMapIntUintptrX(vp *map[int]uintptr, checkNil bool, d *Decoder) {
- v, changed := f.DecMapIntUintptrV(*vp, checkNil, true, d)
- if changed {
- *vp = v
- }
-}
-func (_ fastpathT) DecMapIntUintptrV(v map[int]uintptr, checkNil bool, canChange bool,
- d *Decoder) (_ map[int]uintptr, changed bool) {
- dd := d.d
- cr := d.cr
-
- if checkNil && dd.TryDecodeAsNil() {
- if v != nil {
- changed = true
- }
- return nil, changed
- }
-
- containerLen := dd.ReadMapStart()
- if canChange && v == nil {
- xlen, _ := decInferLen(containerLen, d.h.MaxInitLen, 16)
- v = make(map[int]uintptr, xlen)
- changed = true
- }
-
- var mk int
- var mv uintptr
- if containerLen > 0 {
- for j := 0; j < containerLen; j++ {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- mk = int(dd.DecodeInt(intBitsize))
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- mv = uintptr(dd.DecodeUint(uintBitsize))
- if v != nil {
- v[mk] = mv
- }
- }
- } else if containerLen < 0 {
- for j := 0; !dd.CheckBreak(); j++ {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- mk = int(dd.DecodeInt(intBitsize))
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- mv = uintptr(dd.DecodeUint(uintBitsize))
- if v != nil {
- v[mk] = mv
- }
- }
- }
- if cr != nil {
- cr.sendContainerState(containerMapEnd)
- }
- return v, changed
-}
-
-func (f *decFnInfo) fastpathDecMapIntIntR(rv reflect.Value) {
- if rv.CanAddr() {
- vp := rv.Addr().Interface().(*map[int]int)
- v, changed := fastpathTV.DecMapIntIntV(*vp, fastpathCheckNilFalse, true, f.d)
- if changed {
- *vp = v
- }
- } else {
- v := rv.Interface().(map[int]int)
- fastpathTV.DecMapIntIntV(v, fastpathCheckNilFalse, false, f.d)
- }
-}
-func (f fastpathT) DecMapIntIntX(vp *map[int]int, checkNil bool, d *Decoder) {
- v, changed := f.DecMapIntIntV(*vp, checkNil, true, d)
- if changed {
- *vp = v
- }
-}
-func (_ fastpathT) DecMapIntIntV(v map[int]int, checkNil bool, canChange bool,
- d *Decoder) (_ map[int]int, changed bool) {
- dd := d.d
- cr := d.cr
-
- if checkNil && dd.TryDecodeAsNil() {
- if v != nil {
- changed = true
- }
- return nil, changed
- }
-
- containerLen := dd.ReadMapStart()
- if canChange && v == nil {
- xlen, _ := decInferLen(containerLen, d.h.MaxInitLen, 16)
- v = make(map[int]int, xlen)
- changed = true
- }
-
- var mk int
- var mv int
- if containerLen > 0 {
- for j := 0; j < containerLen; j++ {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- mk = int(dd.DecodeInt(intBitsize))
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- mv = int(dd.DecodeInt(intBitsize))
- if v != nil {
- v[mk] = mv
- }
- }
- } else if containerLen < 0 {
- for j := 0; !dd.CheckBreak(); j++ {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- mk = int(dd.DecodeInt(intBitsize))
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- mv = int(dd.DecodeInt(intBitsize))
- if v != nil {
- v[mk] = mv
- }
- }
- }
- if cr != nil {
- cr.sendContainerState(containerMapEnd)
- }
- return v, changed
-}
-
-func (f *decFnInfo) fastpathDecMapIntInt8R(rv reflect.Value) {
- if rv.CanAddr() {
- vp := rv.Addr().Interface().(*map[int]int8)
- v, changed := fastpathTV.DecMapIntInt8V(*vp, fastpathCheckNilFalse, true, f.d)
- if changed {
- *vp = v
- }
- } else {
- v := rv.Interface().(map[int]int8)
- fastpathTV.DecMapIntInt8V(v, fastpathCheckNilFalse, false, f.d)
- }
-}
-func (f fastpathT) DecMapIntInt8X(vp *map[int]int8, checkNil bool, d *Decoder) {
- v, changed := f.DecMapIntInt8V(*vp, checkNil, true, d)
- if changed {
- *vp = v
- }
-}
-func (_ fastpathT) DecMapIntInt8V(v map[int]int8, checkNil bool, canChange bool,
- d *Decoder) (_ map[int]int8, changed bool) {
- dd := d.d
- cr := d.cr
-
- if checkNil && dd.TryDecodeAsNil() {
- if v != nil {
- changed = true
- }
- return nil, changed
- }
-
- containerLen := dd.ReadMapStart()
- if canChange && v == nil {
- xlen, _ := decInferLen(containerLen, d.h.MaxInitLen, 9)
- v = make(map[int]int8, xlen)
- changed = true
- }
-
- var mk int
- var mv int8
- if containerLen > 0 {
- for j := 0; j < containerLen; j++ {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- mk = int(dd.DecodeInt(intBitsize))
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- mv = int8(dd.DecodeInt(8))
- if v != nil {
- v[mk] = mv
- }
- }
- } else if containerLen < 0 {
- for j := 0; !dd.CheckBreak(); j++ {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- mk = int(dd.DecodeInt(intBitsize))
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- mv = int8(dd.DecodeInt(8))
- if v != nil {
- v[mk] = mv
- }
- }
- }
- if cr != nil {
- cr.sendContainerState(containerMapEnd)
- }
- return v, changed
-}
-
-func (f *decFnInfo) fastpathDecMapIntInt16R(rv reflect.Value) {
- if rv.CanAddr() {
- vp := rv.Addr().Interface().(*map[int]int16)
- v, changed := fastpathTV.DecMapIntInt16V(*vp, fastpathCheckNilFalse, true, f.d)
- if changed {
- *vp = v
- }
- } else {
- v := rv.Interface().(map[int]int16)
- fastpathTV.DecMapIntInt16V(v, fastpathCheckNilFalse, false, f.d)
- }
-}
-func (f fastpathT) DecMapIntInt16X(vp *map[int]int16, checkNil bool, d *Decoder) {
- v, changed := f.DecMapIntInt16V(*vp, checkNil, true, d)
- if changed {
- *vp = v
- }
-}
-func (_ fastpathT) DecMapIntInt16V(v map[int]int16, checkNil bool, canChange bool,
- d *Decoder) (_ map[int]int16, changed bool) {
- dd := d.d
- cr := d.cr
-
- if checkNil && dd.TryDecodeAsNil() {
- if v != nil {
- changed = true
- }
- return nil, changed
- }
-
- containerLen := dd.ReadMapStart()
- if canChange && v == nil {
- xlen, _ := decInferLen(containerLen, d.h.MaxInitLen, 10)
- v = make(map[int]int16, xlen)
- changed = true
- }
-
- var mk int
- var mv int16
- if containerLen > 0 {
- for j := 0; j < containerLen; j++ {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- mk = int(dd.DecodeInt(intBitsize))
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- mv = int16(dd.DecodeInt(16))
- if v != nil {
- v[mk] = mv
- }
- }
- } else if containerLen < 0 {
- for j := 0; !dd.CheckBreak(); j++ {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- mk = int(dd.DecodeInt(intBitsize))
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- mv = int16(dd.DecodeInt(16))
- if v != nil {
- v[mk] = mv
- }
- }
- }
- if cr != nil {
- cr.sendContainerState(containerMapEnd)
- }
- return v, changed
-}
-
-func (f *decFnInfo) fastpathDecMapIntInt32R(rv reflect.Value) {
- if rv.CanAddr() {
- vp := rv.Addr().Interface().(*map[int]int32)
- v, changed := fastpathTV.DecMapIntInt32V(*vp, fastpathCheckNilFalse, true, f.d)
- if changed {
- *vp = v
- }
- } else {
- v := rv.Interface().(map[int]int32)
- fastpathTV.DecMapIntInt32V(v, fastpathCheckNilFalse, false, f.d)
- }
-}
-func (f fastpathT) DecMapIntInt32X(vp *map[int]int32, checkNil bool, d *Decoder) {
- v, changed := f.DecMapIntInt32V(*vp, checkNil, true, d)
- if changed {
- *vp = v
- }
-}
-func (_ fastpathT) DecMapIntInt32V(v map[int]int32, checkNil bool, canChange bool,
- d *Decoder) (_ map[int]int32, changed bool) {
- dd := d.d
- cr := d.cr
-
- if checkNil && dd.TryDecodeAsNil() {
- if v != nil {
- changed = true
- }
- return nil, changed
- }
-
- containerLen := dd.ReadMapStart()
- if canChange && v == nil {
- xlen, _ := decInferLen(containerLen, d.h.MaxInitLen, 12)
- v = make(map[int]int32, xlen)
- changed = true
- }
-
- var mk int
- var mv int32
- if containerLen > 0 {
- for j := 0; j < containerLen; j++ {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- mk = int(dd.DecodeInt(intBitsize))
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- mv = int32(dd.DecodeInt(32))
- if v != nil {
- v[mk] = mv
- }
- }
- } else if containerLen < 0 {
- for j := 0; !dd.CheckBreak(); j++ {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- mk = int(dd.DecodeInt(intBitsize))
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- mv = int32(dd.DecodeInt(32))
- if v != nil {
- v[mk] = mv
- }
- }
- }
- if cr != nil {
- cr.sendContainerState(containerMapEnd)
- }
- return v, changed
-}
-
-func (f *decFnInfo) fastpathDecMapIntInt64R(rv reflect.Value) {
- if rv.CanAddr() {
- vp := rv.Addr().Interface().(*map[int]int64)
- v, changed := fastpathTV.DecMapIntInt64V(*vp, fastpathCheckNilFalse, true, f.d)
- if changed {
- *vp = v
- }
- } else {
- v := rv.Interface().(map[int]int64)
- fastpathTV.DecMapIntInt64V(v, fastpathCheckNilFalse, false, f.d)
- }
-}
-func (f fastpathT) DecMapIntInt64X(vp *map[int]int64, checkNil bool, d *Decoder) {
- v, changed := f.DecMapIntInt64V(*vp, checkNil, true, d)
- if changed {
- *vp = v
- }
-}
-func (_ fastpathT) DecMapIntInt64V(v map[int]int64, checkNil bool, canChange bool,
- d *Decoder) (_ map[int]int64, changed bool) {
- dd := d.d
- cr := d.cr
-
- if checkNil && dd.TryDecodeAsNil() {
- if v != nil {
- changed = true
- }
- return nil, changed
- }
-
- containerLen := dd.ReadMapStart()
- if canChange && v == nil {
- xlen, _ := decInferLen(containerLen, d.h.MaxInitLen, 16)
- v = make(map[int]int64, xlen)
- changed = true
- }
-
- var mk int
- var mv int64
- if containerLen > 0 {
- for j := 0; j < containerLen; j++ {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- mk = int(dd.DecodeInt(intBitsize))
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- mv = dd.DecodeInt(64)
- if v != nil {
- v[mk] = mv
- }
- }
- } else if containerLen < 0 {
- for j := 0; !dd.CheckBreak(); j++ {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- mk = int(dd.DecodeInt(intBitsize))
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- mv = dd.DecodeInt(64)
- if v != nil {
- v[mk] = mv
- }
- }
- }
- if cr != nil {
- cr.sendContainerState(containerMapEnd)
- }
- return v, changed
-}
-
-func (f *decFnInfo) fastpathDecMapIntFloat32R(rv reflect.Value) {
- if rv.CanAddr() {
- vp := rv.Addr().Interface().(*map[int]float32)
- v, changed := fastpathTV.DecMapIntFloat32V(*vp, fastpathCheckNilFalse, true, f.d)
- if changed {
- *vp = v
- }
- } else {
- v := rv.Interface().(map[int]float32)
- fastpathTV.DecMapIntFloat32V(v, fastpathCheckNilFalse, false, f.d)
- }
-}
-func (f fastpathT) DecMapIntFloat32X(vp *map[int]float32, checkNil bool, d *Decoder) {
- v, changed := f.DecMapIntFloat32V(*vp, checkNil, true, d)
- if changed {
- *vp = v
- }
-}
-func (_ fastpathT) DecMapIntFloat32V(v map[int]float32, checkNil bool, canChange bool,
- d *Decoder) (_ map[int]float32, changed bool) {
- dd := d.d
- cr := d.cr
-
- if checkNil && dd.TryDecodeAsNil() {
- if v != nil {
- changed = true
- }
- return nil, changed
- }
-
- containerLen := dd.ReadMapStart()
- if canChange && v == nil {
- xlen, _ := decInferLen(containerLen, d.h.MaxInitLen, 12)
- v = make(map[int]float32, xlen)
- changed = true
- }
-
- var mk int
- var mv float32
- if containerLen > 0 {
- for j := 0; j < containerLen; j++ {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- mk = int(dd.DecodeInt(intBitsize))
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- mv = float32(dd.DecodeFloat(true))
- if v != nil {
- v[mk] = mv
- }
- }
- } else if containerLen < 0 {
- for j := 0; !dd.CheckBreak(); j++ {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- mk = int(dd.DecodeInt(intBitsize))
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- mv = float32(dd.DecodeFloat(true))
- if v != nil {
- v[mk] = mv
- }
- }
- }
- if cr != nil {
- cr.sendContainerState(containerMapEnd)
- }
- return v, changed
-}
-
-func (f *decFnInfo) fastpathDecMapIntFloat64R(rv reflect.Value) {
- if rv.CanAddr() {
- vp := rv.Addr().Interface().(*map[int]float64)
- v, changed := fastpathTV.DecMapIntFloat64V(*vp, fastpathCheckNilFalse, true, f.d)
- if changed {
- *vp = v
- }
- } else {
- v := rv.Interface().(map[int]float64)
- fastpathTV.DecMapIntFloat64V(v, fastpathCheckNilFalse, false, f.d)
- }
-}
-func (f fastpathT) DecMapIntFloat64X(vp *map[int]float64, checkNil bool, d *Decoder) {
- v, changed := f.DecMapIntFloat64V(*vp, checkNil, true, d)
- if changed {
- *vp = v
- }
-}
-func (_ fastpathT) DecMapIntFloat64V(v map[int]float64, checkNil bool, canChange bool,
- d *Decoder) (_ map[int]float64, changed bool) {
- dd := d.d
- cr := d.cr
-
- if checkNil && dd.TryDecodeAsNil() {
- if v != nil {
- changed = true
- }
- return nil, changed
- }
-
- containerLen := dd.ReadMapStart()
- if canChange && v == nil {
- xlen, _ := decInferLen(containerLen, d.h.MaxInitLen, 16)
- v = make(map[int]float64, xlen)
- changed = true
- }
-
- var mk int
- var mv float64
- if containerLen > 0 {
- for j := 0; j < containerLen; j++ {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- mk = int(dd.DecodeInt(intBitsize))
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- mv = dd.DecodeFloat(false)
- if v != nil {
- v[mk] = mv
- }
- }
- } else if containerLen < 0 {
- for j := 0; !dd.CheckBreak(); j++ {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- mk = int(dd.DecodeInt(intBitsize))
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- mv = dd.DecodeFloat(false)
- if v != nil {
- v[mk] = mv
- }
- }
- }
- if cr != nil {
- cr.sendContainerState(containerMapEnd)
- }
- return v, changed
-}
-
-func (f *decFnInfo) fastpathDecMapIntBoolR(rv reflect.Value) {
- if rv.CanAddr() {
- vp := rv.Addr().Interface().(*map[int]bool)
- v, changed := fastpathTV.DecMapIntBoolV(*vp, fastpathCheckNilFalse, true, f.d)
- if changed {
- *vp = v
- }
- } else {
- v := rv.Interface().(map[int]bool)
- fastpathTV.DecMapIntBoolV(v, fastpathCheckNilFalse, false, f.d)
- }
-}
-func (f fastpathT) DecMapIntBoolX(vp *map[int]bool, checkNil bool, d *Decoder) {
- v, changed := f.DecMapIntBoolV(*vp, checkNil, true, d)
- if changed {
- *vp = v
- }
-}
-func (_ fastpathT) DecMapIntBoolV(v map[int]bool, checkNil bool, canChange bool,
- d *Decoder) (_ map[int]bool, changed bool) {
- dd := d.d
- cr := d.cr
-
- if checkNil && dd.TryDecodeAsNil() {
- if v != nil {
- changed = true
- }
- return nil, changed
- }
-
- containerLen := dd.ReadMapStart()
- if canChange && v == nil {
- xlen, _ := decInferLen(containerLen, d.h.MaxInitLen, 9)
- v = make(map[int]bool, xlen)
- changed = true
- }
-
- var mk int
- var mv bool
- if containerLen > 0 {
- for j := 0; j < containerLen; j++ {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- mk = int(dd.DecodeInt(intBitsize))
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- mv = dd.DecodeBool()
- if v != nil {
- v[mk] = mv
- }
- }
- } else if containerLen < 0 {
- for j := 0; !dd.CheckBreak(); j++ {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- mk = int(dd.DecodeInt(intBitsize))
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- mv = dd.DecodeBool()
- if v != nil {
- v[mk] = mv
- }
- }
- }
- if cr != nil {
- cr.sendContainerState(containerMapEnd)
- }
- return v, changed
-}
-
-func (f *decFnInfo) fastpathDecMapInt8IntfR(rv reflect.Value) {
- if rv.CanAddr() {
- vp := rv.Addr().Interface().(*map[int8]interface{})
- v, changed := fastpathTV.DecMapInt8IntfV(*vp, fastpathCheckNilFalse, true, f.d)
- if changed {
- *vp = v
- }
- } else {
- v := rv.Interface().(map[int8]interface{})
- fastpathTV.DecMapInt8IntfV(v, fastpathCheckNilFalse, false, f.d)
- }
-}
-func (f fastpathT) DecMapInt8IntfX(vp *map[int8]interface{}, checkNil bool, d *Decoder) {
- v, changed := f.DecMapInt8IntfV(*vp, checkNil, true, d)
- if changed {
- *vp = v
- }
-}
-func (_ fastpathT) DecMapInt8IntfV(v map[int8]interface{}, checkNil bool, canChange bool,
- d *Decoder) (_ map[int8]interface{}, changed bool) {
- dd := d.d
- cr := d.cr
-
- if checkNil && dd.TryDecodeAsNil() {
- if v != nil {
- changed = true
- }
- return nil, changed
- }
-
- containerLen := dd.ReadMapStart()
- if canChange && v == nil {
- xlen, _ := decInferLen(containerLen, d.h.MaxInitLen, 17)
- v = make(map[int8]interface{}, xlen)
- changed = true
- }
- mapGet := !d.h.MapValueReset && !d.h.InterfaceReset
- var mk int8
- var mv interface{}
- if containerLen > 0 {
- for j := 0; j < containerLen; j++ {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- mk = int8(dd.DecodeInt(8))
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- if mapGet {
- mv = v[mk]
- } else {
- mv = nil
- }
- d.decode(&mv)
- if v != nil {
- v[mk] = mv
- }
- }
- } else if containerLen < 0 {
- for j := 0; !dd.CheckBreak(); j++ {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- mk = int8(dd.DecodeInt(8))
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- if mapGet {
- mv = v[mk]
- } else {
- mv = nil
- }
- d.decode(&mv)
- if v != nil {
- v[mk] = mv
- }
- }
- }
- if cr != nil {
- cr.sendContainerState(containerMapEnd)
- }
- return v, changed
-}
-
-func (f *decFnInfo) fastpathDecMapInt8StringR(rv reflect.Value) {
- if rv.CanAddr() {
- vp := rv.Addr().Interface().(*map[int8]string)
- v, changed := fastpathTV.DecMapInt8StringV(*vp, fastpathCheckNilFalse, true, f.d)
- if changed {
- *vp = v
- }
- } else {
- v := rv.Interface().(map[int8]string)
- fastpathTV.DecMapInt8StringV(v, fastpathCheckNilFalse, false, f.d)
- }
-}
-func (f fastpathT) DecMapInt8StringX(vp *map[int8]string, checkNil bool, d *Decoder) {
- v, changed := f.DecMapInt8StringV(*vp, checkNil, true, d)
- if changed {
- *vp = v
- }
-}
-func (_ fastpathT) DecMapInt8StringV(v map[int8]string, checkNil bool, canChange bool,
- d *Decoder) (_ map[int8]string, changed bool) {
- dd := d.d
- cr := d.cr
-
- if checkNil && dd.TryDecodeAsNil() {
- if v != nil {
- changed = true
- }
- return nil, changed
- }
-
- containerLen := dd.ReadMapStart()
- if canChange && v == nil {
- xlen, _ := decInferLen(containerLen, d.h.MaxInitLen, 17)
- v = make(map[int8]string, xlen)
- changed = true
- }
-
- var mk int8
- var mv string
- if containerLen > 0 {
- for j := 0; j < containerLen; j++ {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- mk = int8(dd.DecodeInt(8))
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- mv = dd.DecodeString()
- if v != nil {
- v[mk] = mv
- }
- }
- } else if containerLen < 0 {
- for j := 0; !dd.CheckBreak(); j++ {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- mk = int8(dd.DecodeInt(8))
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- mv = dd.DecodeString()
- if v != nil {
- v[mk] = mv
- }
- }
- }
- if cr != nil {
- cr.sendContainerState(containerMapEnd)
- }
- return v, changed
-}
-
-func (f *decFnInfo) fastpathDecMapInt8UintR(rv reflect.Value) {
- if rv.CanAddr() {
- vp := rv.Addr().Interface().(*map[int8]uint)
- v, changed := fastpathTV.DecMapInt8UintV(*vp, fastpathCheckNilFalse, true, f.d)
- if changed {
- *vp = v
- }
- } else {
- v := rv.Interface().(map[int8]uint)
- fastpathTV.DecMapInt8UintV(v, fastpathCheckNilFalse, false, f.d)
- }
-}
-func (f fastpathT) DecMapInt8UintX(vp *map[int8]uint, checkNil bool, d *Decoder) {
- v, changed := f.DecMapInt8UintV(*vp, checkNil, true, d)
- if changed {
- *vp = v
- }
-}
-func (_ fastpathT) DecMapInt8UintV(v map[int8]uint, checkNil bool, canChange bool,
- d *Decoder) (_ map[int8]uint, changed bool) {
- dd := d.d
- cr := d.cr
-
- if checkNil && dd.TryDecodeAsNil() {
- if v != nil {
- changed = true
- }
- return nil, changed
- }
-
- containerLen := dd.ReadMapStart()
- if canChange && v == nil {
- xlen, _ := decInferLen(containerLen, d.h.MaxInitLen, 9)
- v = make(map[int8]uint, xlen)
- changed = true
- }
-
- var mk int8
- var mv uint
- if containerLen > 0 {
- for j := 0; j < containerLen; j++ {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- mk = int8(dd.DecodeInt(8))
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- mv = uint(dd.DecodeUint(uintBitsize))
- if v != nil {
- v[mk] = mv
- }
- }
- } else if containerLen < 0 {
- for j := 0; !dd.CheckBreak(); j++ {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- mk = int8(dd.DecodeInt(8))
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- mv = uint(dd.DecodeUint(uintBitsize))
- if v != nil {
- v[mk] = mv
- }
- }
- }
- if cr != nil {
- cr.sendContainerState(containerMapEnd)
- }
- return v, changed
-}
-
-func (f *decFnInfo) fastpathDecMapInt8Uint8R(rv reflect.Value) {
- if rv.CanAddr() {
- vp := rv.Addr().Interface().(*map[int8]uint8)
- v, changed := fastpathTV.DecMapInt8Uint8V(*vp, fastpathCheckNilFalse, true, f.d)
- if changed {
- *vp = v
- }
- } else {
- v := rv.Interface().(map[int8]uint8)
- fastpathTV.DecMapInt8Uint8V(v, fastpathCheckNilFalse, false, f.d)
- }
-}
-func (f fastpathT) DecMapInt8Uint8X(vp *map[int8]uint8, checkNil bool, d *Decoder) {
- v, changed := f.DecMapInt8Uint8V(*vp, checkNil, true, d)
- if changed {
- *vp = v
- }
-}
-func (_ fastpathT) DecMapInt8Uint8V(v map[int8]uint8, checkNil bool, canChange bool,
- d *Decoder) (_ map[int8]uint8, changed bool) {
- dd := d.d
- cr := d.cr
-
- if checkNil && dd.TryDecodeAsNil() {
- if v != nil {
- changed = true
- }
- return nil, changed
- }
-
- containerLen := dd.ReadMapStart()
- if canChange && v == nil {
- xlen, _ := decInferLen(containerLen, d.h.MaxInitLen, 2)
- v = make(map[int8]uint8, xlen)
- changed = true
- }
-
- var mk int8
- var mv uint8
- if containerLen > 0 {
- for j := 0; j < containerLen; j++ {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- mk = int8(dd.DecodeInt(8))
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- mv = uint8(dd.DecodeUint(8))
- if v != nil {
- v[mk] = mv
- }
- }
- } else if containerLen < 0 {
- for j := 0; !dd.CheckBreak(); j++ {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- mk = int8(dd.DecodeInt(8))
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- mv = uint8(dd.DecodeUint(8))
- if v != nil {
- v[mk] = mv
- }
- }
- }
- if cr != nil {
- cr.sendContainerState(containerMapEnd)
- }
- return v, changed
-}
-
-func (f *decFnInfo) fastpathDecMapInt8Uint16R(rv reflect.Value) {
- if rv.CanAddr() {
- vp := rv.Addr().Interface().(*map[int8]uint16)
- v, changed := fastpathTV.DecMapInt8Uint16V(*vp, fastpathCheckNilFalse, true, f.d)
- if changed {
- *vp = v
- }
- } else {
- v := rv.Interface().(map[int8]uint16)
- fastpathTV.DecMapInt8Uint16V(v, fastpathCheckNilFalse, false, f.d)
- }
-}
-func (f fastpathT) DecMapInt8Uint16X(vp *map[int8]uint16, checkNil bool, d *Decoder) {
- v, changed := f.DecMapInt8Uint16V(*vp, checkNil, true, d)
- if changed {
- *vp = v
- }
-}
-func (_ fastpathT) DecMapInt8Uint16V(v map[int8]uint16, checkNil bool, canChange bool,
- d *Decoder) (_ map[int8]uint16, changed bool) {
- dd := d.d
- cr := d.cr
-
- if checkNil && dd.TryDecodeAsNil() {
- if v != nil {
- changed = true
- }
- return nil, changed
- }
-
- containerLen := dd.ReadMapStart()
- if canChange && v == nil {
- xlen, _ := decInferLen(containerLen, d.h.MaxInitLen, 3)
- v = make(map[int8]uint16, xlen)
- changed = true
- }
-
- var mk int8
- var mv uint16
- if containerLen > 0 {
- for j := 0; j < containerLen; j++ {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- mk = int8(dd.DecodeInt(8))
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- mv = uint16(dd.DecodeUint(16))
- if v != nil {
- v[mk] = mv
- }
- }
- } else if containerLen < 0 {
- for j := 0; !dd.CheckBreak(); j++ {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- mk = int8(dd.DecodeInt(8))
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- mv = uint16(dd.DecodeUint(16))
- if v != nil {
- v[mk] = mv
- }
- }
- }
- if cr != nil {
- cr.sendContainerState(containerMapEnd)
- }
- return v, changed
-}
-
-func (f *decFnInfo) fastpathDecMapInt8Uint32R(rv reflect.Value) {
- if rv.CanAddr() {
- vp := rv.Addr().Interface().(*map[int8]uint32)
- v, changed := fastpathTV.DecMapInt8Uint32V(*vp, fastpathCheckNilFalse, true, f.d)
- if changed {
- *vp = v
- }
- } else {
- v := rv.Interface().(map[int8]uint32)
- fastpathTV.DecMapInt8Uint32V(v, fastpathCheckNilFalse, false, f.d)
- }
-}
-func (f fastpathT) DecMapInt8Uint32X(vp *map[int8]uint32, checkNil bool, d *Decoder) {
- v, changed := f.DecMapInt8Uint32V(*vp, checkNil, true, d)
- if changed {
- *vp = v
- }
-}
-func (_ fastpathT) DecMapInt8Uint32V(v map[int8]uint32, checkNil bool, canChange bool,
- d *Decoder) (_ map[int8]uint32, changed bool) {
- dd := d.d
- cr := d.cr
-
- if checkNil && dd.TryDecodeAsNil() {
- if v != nil {
- changed = true
- }
- return nil, changed
- }
-
- containerLen := dd.ReadMapStart()
- if canChange && v == nil {
- xlen, _ := decInferLen(containerLen, d.h.MaxInitLen, 5)
- v = make(map[int8]uint32, xlen)
- changed = true
- }
-
- var mk int8
- var mv uint32
- if containerLen > 0 {
- for j := 0; j < containerLen; j++ {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- mk = int8(dd.DecodeInt(8))
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- mv = uint32(dd.DecodeUint(32))
- if v != nil {
- v[mk] = mv
- }
- }
- } else if containerLen < 0 {
- for j := 0; !dd.CheckBreak(); j++ {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- mk = int8(dd.DecodeInt(8))
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- mv = uint32(dd.DecodeUint(32))
- if v != nil {
- v[mk] = mv
- }
- }
- }
- if cr != nil {
- cr.sendContainerState(containerMapEnd)
- }
- return v, changed
-}
-
-func (f *decFnInfo) fastpathDecMapInt8Uint64R(rv reflect.Value) {
- if rv.CanAddr() {
- vp := rv.Addr().Interface().(*map[int8]uint64)
- v, changed := fastpathTV.DecMapInt8Uint64V(*vp, fastpathCheckNilFalse, true, f.d)
- if changed {
- *vp = v
- }
- } else {
- v := rv.Interface().(map[int8]uint64)
- fastpathTV.DecMapInt8Uint64V(v, fastpathCheckNilFalse, false, f.d)
- }
-}
-func (f fastpathT) DecMapInt8Uint64X(vp *map[int8]uint64, checkNil bool, d *Decoder) {
- v, changed := f.DecMapInt8Uint64V(*vp, checkNil, true, d)
- if changed {
- *vp = v
- }
-}
-func (_ fastpathT) DecMapInt8Uint64V(v map[int8]uint64, checkNil bool, canChange bool,
- d *Decoder) (_ map[int8]uint64, changed bool) {
- dd := d.d
- cr := d.cr
-
- if checkNil && dd.TryDecodeAsNil() {
- if v != nil {
- changed = true
- }
- return nil, changed
- }
-
- containerLen := dd.ReadMapStart()
- if canChange && v == nil {
- xlen, _ := decInferLen(containerLen, d.h.MaxInitLen, 9)
- v = make(map[int8]uint64, xlen)
- changed = true
- }
-
- var mk int8
- var mv uint64
- if containerLen > 0 {
- for j := 0; j < containerLen; j++ {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- mk = int8(dd.DecodeInt(8))
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- mv = dd.DecodeUint(64)
- if v != nil {
- v[mk] = mv
- }
- }
- } else if containerLen < 0 {
- for j := 0; !dd.CheckBreak(); j++ {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- mk = int8(dd.DecodeInt(8))
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- mv = dd.DecodeUint(64)
- if v != nil {
- v[mk] = mv
- }
- }
- }
- if cr != nil {
- cr.sendContainerState(containerMapEnd)
- }
- return v, changed
-}
-
-func (f *decFnInfo) fastpathDecMapInt8UintptrR(rv reflect.Value) {
- if rv.CanAddr() {
- vp := rv.Addr().Interface().(*map[int8]uintptr)
- v, changed := fastpathTV.DecMapInt8UintptrV(*vp, fastpathCheckNilFalse, true, f.d)
- if changed {
- *vp = v
- }
- } else {
- v := rv.Interface().(map[int8]uintptr)
- fastpathTV.DecMapInt8UintptrV(v, fastpathCheckNilFalse, false, f.d)
- }
-}
-func (f fastpathT) DecMapInt8UintptrX(vp *map[int8]uintptr, checkNil bool, d *Decoder) {
- v, changed := f.DecMapInt8UintptrV(*vp, checkNil, true, d)
- if changed {
- *vp = v
- }
-}
-func (_ fastpathT) DecMapInt8UintptrV(v map[int8]uintptr, checkNil bool, canChange bool,
- d *Decoder) (_ map[int8]uintptr, changed bool) {
- dd := d.d
- cr := d.cr
-
- if checkNil && dd.TryDecodeAsNil() {
- if v != nil {
- changed = true
- }
- return nil, changed
- }
-
- containerLen := dd.ReadMapStart()
- if canChange && v == nil {
- xlen, _ := decInferLen(containerLen, d.h.MaxInitLen, 9)
- v = make(map[int8]uintptr, xlen)
- changed = true
- }
-
- var mk int8
- var mv uintptr
- if containerLen > 0 {
- for j := 0; j < containerLen; j++ {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- mk = int8(dd.DecodeInt(8))
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- mv = uintptr(dd.DecodeUint(uintBitsize))
- if v != nil {
- v[mk] = mv
- }
- }
- } else if containerLen < 0 {
- for j := 0; !dd.CheckBreak(); j++ {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- mk = int8(dd.DecodeInt(8))
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- mv = uintptr(dd.DecodeUint(uintBitsize))
- if v != nil {
- v[mk] = mv
- }
- }
- }
- if cr != nil {
- cr.sendContainerState(containerMapEnd)
- }
- return v, changed
-}
-
-func (f *decFnInfo) fastpathDecMapInt8IntR(rv reflect.Value) {
- if rv.CanAddr() {
- vp := rv.Addr().Interface().(*map[int8]int)
- v, changed := fastpathTV.DecMapInt8IntV(*vp, fastpathCheckNilFalse, true, f.d)
- if changed {
- *vp = v
- }
- } else {
- v := rv.Interface().(map[int8]int)
- fastpathTV.DecMapInt8IntV(v, fastpathCheckNilFalse, false, f.d)
- }
-}
-func (f fastpathT) DecMapInt8IntX(vp *map[int8]int, checkNil bool, d *Decoder) {
- v, changed := f.DecMapInt8IntV(*vp, checkNil, true, d)
- if changed {
- *vp = v
- }
-}
-func (_ fastpathT) DecMapInt8IntV(v map[int8]int, checkNil bool, canChange bool,
- d *Decoder) (_ map[int8]int, changed bool) {
- dd := d.d
- cr := d.cr
-
- if checkNil && dd.TryDecodeAsNil() {
- if v != nil {
- changed = true
- }
- return nil, changed
- }
-
- containerLen := dd.ReadMapStart()
- if canChange && v == nil {
- xlen, _ := decInferLen(containerLen, d.h.MaxInitLen, 9)
- v = make(map[int8]int, xlen)
- changed = true
- }
-
- var mk int8
- var mv int
- if containerLen > 0 {
- for j := 0; j < containerLen; j++ {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- mk = int8(dd.DecodeInt(8))
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- mv = int(dd.DecodeInt(intBitsize))
- if v != nil {
- v[mk] = mv
- }
- }
- } else if containerLen < 0 {
- for j := 0; !dd.CheckBreak(); j++ {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- mk = int8(dd.DecodeInt(8))
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- mv = int(dd.DecodeInt(intBitsize))
- if v != nil {
- v[mk] = mv
- }
- }
- }
- if cr != nil {
- cr.sendContainerState(containerMapEnd)
- }
- return v, changed
-}
-
-func (f *decFnInfo) fastpathDecMapInt8Int8R(rv reflect.Value) {
- if rv.CanAddr() {
- vp := rv.Addr().Interface().(*map[int8]int8)
- v, changed := fastpathTV.DecMapInt8Int8V(*vp, fastpathCheckNilFalse, true, f.d)
- if changed {
- *vp = v
- }
- } else {
- v := rv.Interface().(map[int8]int8)
- fastpathTV.DecMapInt8Int8V(v, fastpathCheckNilFalse, false, f.d)
- }
-}
-func (f fastpathT) DecMapInt8Int8X(vp *map[int8]int8, checkNil bool, d *Decoder) {
- v, changed := f.DecMapInt8Int8V(*vp, checkNil, true, d)
- if changed {
- *vp = v
- }
-}
-func (_ fastpathT) DecMapInt8Int8V(v map[int8]int8, checkNil bool, canChange bool,
- d *Decoder) (_ map[int8]int8, changed bool) {
- dd := d.d
- cr := d.cr
-
- if checkNil && dd.TryDecodeAsNil() {
- if v != nil {
- changed = true
- }
- return nil, changed
- }
-
- containerLen := dd.ReadMapStart()
- if canChange && v == nil {
- xlen, _ := decInferLen(containerLen, d.h.MaxInitLen, 2)
- v = make(map[int8]int8, xlen)
- changed = true
- }
-
- var mk int8
- var mv int8
- if containerLen > 0 {
- for j := 0; j < containerLen; j++ {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- mk = int8(dd.DecodeInt(8))
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- mv = int8(dd.DecodeInt(8))
- if v != nil {
- v[mk] = mv
- }
- }
- } else if containerLen < 0 {
- for j := 0; !dd.CheckBreak(); j++ {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- mk = int8(dd.DecodeInt(8))
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- mv = int8(dd.DecodeInt(8))
- if v != nil {
- v[mk] = mv
- }
- }
- }
- if cr != nil {
- cr.sendContainerState(containerMapEnd)
- }
- return v, changed
-}
-
-func (f *decFnInfo) fastpathDecMapInt8Int16R(rv reflect.Value) {
- if rv.CanAddr() {
- vp := rv.Addr().Interface().(*map[int8]int16)
- v, changed := fastpathTV.DecMapInt8Int16V(*vp, fastpathCheckNilFalse, true, f.d)
- if changed {
- *vp = v
- }
- } else {
- v := rv.Interface().(map[int8]int16)
- fastpathTV.DecMapInt8Int16V(v, fastpathCheckNilFalse, false, f.d)
- }
-}
-func (f fastpathT) DecMapInt8Int16X(vp *map[int8]int16, checkNil bool, d *Decoder) {
- v, changed := f.DecMapInt8Int16V(*vp, checkNil, true, d)
- if changed {
- *vp = v
- }
-}
-func (_ fastpathT) DecMapInt8Int16V(v map[int8]int16, checkNil bool, canChange bool,
- d *Decoder) (_ map[int8]int16, changed bool) {
- dd := d.d
- cr := d.cr
-
- if checkNil && dd.TryDecodeAsNil() {
- if v != nil {
- changed = true
- }
- return nil, changed
- }
-
- containerLen := dd.ReadMapStart()
- if canChange && v == nil {
- xlen, _ := decInferLen(containerLen, d.h.MaxInitLen, 3)
- v = make(map[int8]int16, xlen)
- changed = true
- }
-
- var mk int8
- var mv int16
- if containerLen > 0 {
- for j := 0; j < containerLen; j++ {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- mk = int8(dd.DecodeInt(8))
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- mv = int16(dd.DecodeInt(16))
- if v != nil {
- v[mk] = mv
- }
- }
- } else if containerLen < 0 {
- for j := 0; !dd.CheckBreak(); j++ {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- mk = int8(dd.DecodeInt(8))
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- mv = int16(dd.DecodeInt(16))
- if v != nil {
- v[mk] = mv
- }
- }
- }
- if cr != nil {
- cr.sendContainerState(containerMapEnd)
- }
- return v, changed
-}
-
-func (f *decFnInfo) fastpathDecMapInt8Int32R(rv reflect.Value) {
- if rv.CanAddr() {
- vp := rv.Addr().Interface().(*map[int8]int32)
- v, changed := fastpathTV.DecMapInt8Int32V(*vp, fastpathCheckNilFalse, true, f.d)
- if changed {
- *vp = v
- }
- } else {
- v := rv.Interface().(map[int8]int32)
- fastpathTV.DecMapInt8Int32V(v, fastpathCheckNilFalse, false, f.d)
- }
-}
-func (f fastpathT) DecMapInt8Int32X(vp *map[int8]int32, checkNil bool, d *Decoder) {
- v, changed := f.DecMapInt8Int32V(*vp, checkNil, true, d)
- if changed {
- *vp = v
- }
-}
-func (_ fastpathT) DecMapInt8Int32V(v map[int8]int32, checkNil bool, canChange bool,
- d *Decoder) (_ map[int8]int32, changed bool) {
- dd := d.d
- cr := d.cr
-
- if checkNil && dd.TryDecodeAsNil() {
- if v != nil {
- changed = true
- }
- return nil, changed
- }
-
- containerLen := dd.ReadMapStart()
- if canChange && v == nil {
- xlen, _ := decInferLen(containerLen, d.h.MaxInitLen, 5)
- v = make(map[int8]int32, xlen)
- changed = true
- }
-
- var mk int8
- var mv int32
- if containerLen > 0 {
- for j := 0; j < containerLen; j++ {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- mk = int8(dd.DecodeInt(8))
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- mv = int32(dd.DecodeInt(32))
- if v != nil {
- v[mk] = mv
- }
- }
- } else if containerLen < 0 {
- for j := 0; !dd.CheckBreak(); j++ {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- mk = int8(dd.DecodeInt(8))
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- mv = int32(dd.DecodeInt(32))
- if v != nil {
- v[mk] = mv
- }
- }
- }
- if cr != nil {
- cr.sendContainerState(containerMapEnd)
- }
- return v, changed
-}
-
-func (f *decFnInfo) fastpathDecMapInt8Int64R(rv reflect.Value) {
- if rv.CanAddr() {
- vp := rv.Addr().Interface().(*map[int8]int64)
- v, changed := fastpathTV.DecMapInt8Int64V(*vp, fastpathCheckNilFalse, true, f.d)
- if changed {
- *vp = v
- }
- } else {
- v := rv.Interface().(map[int8]int64)
- fastpathTV.DecMapInt8Int64V(v, fastpathCheckNilFalse, false, f.d)
- }
-}
-func (f fastpathT) DecMapInt8Int64X(vp *map[int8]int64, checkNil bool, d *Decoder) {
- v, changed := f.DecMapInt8Int64V(*vp, checkNil, true, d)
- if changed {
- *vp = v
- }
-}
-func (_ fastpathT) DecMapInt8Int64V(v map[int8]int64, checkNil bool, canChange bool,
- d *Decoder) (_ map[int8]int64, changed bool) {
- dd := d.d
- cr := d.cr
-
- if checkNil && dd.TryDecodeAsNil() {
- if v != nil {
- changed = true
- }
- return nil, changed
- }
-
- containerLen := dd.ReadMapStart()
- if canChange && v == nil {
- xlen, _ := decInferLen(containerLen, d.h.MaxInitLen, 9)
- v = make(map[int8]int64, xlen)
- changed = true
- }
-
- var mk int8
- var mv int64
- if containerLen > 0 {
- for j := 0; j < containerLen; j++ {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- mk = int8(dd.DecodeInt(8))
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- mv = dd.DecodeInt(64)
- if v != nil {
- v[mk] = mv
- }
- }
- } else if containerLen < 0 {
- for j := 0; !dd.CheckBreak(); j++ {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- mk = int8(dd.DecodeInt(8))
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- mv = dd.DecodeInt(64)
- if v != nil {
- v[mk] = mv
- }
- }
- }
- if cr != nil {
- cr.sendContainerState(containerMapEnd)
- }
- return v, changed
-}
-
-func (f *decFnInfo) fastpathDecMapInt8Float32R(rv reflect.Value) {
- if rv.CanAddr() {
- vp := rv.Addr().Interface().(*map[int8]float32)
- v, changed := fastpathTV.DecMapInt8Float32V(*vp, fastpathCheckNilFalse, true, f.d)
- if changed {
- *vp = v
- }
- } else {
- v := rv.Interface().(map[int8]float32)
- fastpathTV.DecMapInt8Float32V(v, fastpathCheckNilFalse, false, f.d)
- }
-}
-func (f fastpathT) DecMapInt8Float32X(vp *map[int8]float32, checkNil bool, d *Decoder) {
- v, changed := f.DecMapInt8Float32V(*vp, checkNil, true, d)
- if changed {
- *vp = v
- }
-}
-func (_ fastpathT) DecMapInt8Float32V(v map[int8]float32, checkNil bool, canChange bool,
- d *Decoder) (_ map[int8]float32, changed bool) {
- dd := d.d
- cr := d.cr
-
- if checkNil && dd.TryDecodeAsNil() {
- if v != nil {
- changed = true
- }
- return nil, changed
- }
-
- containerLen := dd.ReadMapStart()
- if canChange && v == nil {
- xlen, _ := decInferLen(containerLen, d.h.MaxInitLen, 5)
- v = make(map[int8]float32, xlen)
- changed = true
- }
-
- var mk int8
- var mv float32
- if containerLen > 0 {
- for j := 0; j < containerLen; j++ {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- mk = int8(dd.DecodeInt(8))
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- mv = float32(dd.DecodeFloat(true))
- if v != nil {
- v[mk] = mv
- }
- }
- } else if containerLen < 0 {
- for j := 0; !dd.CheckBreak(); j++ {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- mk = int8(dd.DecodeInt(8))
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- mv = float32(dd.DecodeFloat(true))
- if v != nil {
- v[mk] = mv
- }
- }
- }
- if cr != nil {
- cr.sendContainerState(containerMapEnd)
- }
- return v, changed
-}
-
-func (f *decFnInfo) fastpathDecMapInt8Float64R(rv reflect.Value) {
- if rv.CanAddr() {
- vp := rv.Addr().Interface().(*map[int8]float64)
- v, changed := fastpathTV.DecMapInt8Float64V(*vp, fastpathCheckNilFalse, true, f.d)
- if changed {
- *vp = v
- }
- } else {
- v := rv.Interface().(map[int8]float64)
- fastpathTV.DecMapInt8Float64V(v, fastpathCheckNilFalse, false, f.d)
- }
-}
-func (f fastpathT) DecMapInt8Float64X(vp *map[int8]float64, checkNil bool, d *Decoder) {
- v, changed := f.DecMapInt8Float64V(*vp, checkNil, true, d)
- if changed {
- *vp = v
- }
-}
-func (_ fastpathT) DecMapInt8Float64V(v map[int8]float64, checkNil bool, canChange bool,
- d *Decoder) (_ map[int8]float64, changed bool) {
- dd := d.d
- cr := d.cr
-
- if checkNil && dd.TryDecodeAsNil() {
- if v != nil {
- changed = true
- }
- return nil, changed
- }
-
- containerLen := dd.ReadMapStart()
- if canChange && v == nil {
- xlen, _ := decInferLen(containerLen, d.h.MaxInitLen, 9)
- v = make(map[int8]float64, xlen)
- changed = true
- }
-
- var mk int8
- var mv float64
- if containerLen > 0 {
- for j := 0; j < containerLen; j++ {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- mk = int8(dd.DecodeInt(8))
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- mv = dd.DecodeFloat(false)
- if v != nil {
- v[mk] = mv
- }
- }
- } else if containerLen < 0 {
- for j := 0; !dd.CheckBreak(); j++ {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- mk = int8(dd.DecodeInt(8))
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- mv = dd.DecodeFloat(false)
- if v != nil {
- v[mk] = mv
- }
- }
- }
- if cr != nil {
- cr.sendContainerState(containerMapEnd)
- }
- return v, changed
-}
-
-func (f *decFnInfo) fastpathDecMapInt8BoolR(rv reflect.Value) {
- if rv.CanAddr() {
- vp := rv.Addr().Interface().(*map[int8]bool)
- v, changed := fastpathTV.DecMapInt8BoolV(*vp, fastpathCheckNilFalse, true, f.d)
- if changed {
- *vp = v
- }
- } else {
- v := rv.Interface().(map[int8]bool)
- fastpathTV.DecMapInt8BoolV(v, fastpathCheckNilFalse, false, f.d)
- }
-}
-func (f fastpathT) DecMapInt8BoolX(vp *map[int8]bool, checkNil bool, d *Decoder) {
- v, changed := f.DecMapInt8BoolV(*vp, checkNil, true, d)
- if changed {
- *vp = v
- }
-}
-func (_ fastpathT) DecMapInt8BoolV(v map[int8]bool, checkNil bool, canChange bool,
- d *Decoder) (_ map[int8]bool, changed bool) {
- dd := d.d
- cr := d.cr
-
- if checkNil && dd.TryDecodeAsNil() {
- if v != nil {
- changed = true
- }
- return nil, changed
- }
-
- containerLen := dd.ReadMapStart()
- if canChange && v == nil {
- xlen, _ := decInferLen(containerLen, d.h.MaxInitLen, 2)
- v = make(map[int8]bool, xlen)
- changed = true
- }
-
- var mk int8
- var mv bool
- if containerLen > 0 {
- for j := 0; j < containerLen; j++ {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- mk = int8(dd.DecodeInt(8))
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- mv = dd.DecodeBool()
- if v != nil {
- v[mk] = mv
- }
- }
- } else if containerLen < 0 {
- for j := 0; !dd.CheckBreak(); j++ {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- mk = int8(dd.DecodeInt(8))
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- mv = dd.DecodeBool()
- if v != nil {
- v[mk] = mv
- }
- }
- }
- if cr != nil {
- cr.sendContainerState(containerMapEnd)
- }
- return v, changed
-}
-
-func (f *decFnInfo) fastpathDecMapInt16IntfR(rv reflect.Value) {
- if rv.CanAddr() {
- vp := rv.Addr().Interface().(*map[int16]interface{})
- v, changed := fastpathTV.DecMapInt16IntfV(*vp, fastpathCheckNilFalse, true, f.d)
- if changed {
- *vp = v
- }
- } else {
- v := rv.Interface().(map[int16]interface{})
- fastpathTV.DecMapInt16IntfV(v, fastpathCheckNilFalse, false, f.d)
- }
-}
-func (f fastpathT) DecMapInt16IntfX(vp *map[int16]interface{}, checkNil bool, d *Decoder) {
- v, changed := f.DecMapInt16IntfV(*vp, checkNil, true, d)
- if changed {
- *vp = v
- }
-}
-func (_ fastpathT) DecMapInt16IntfV(v map[int16]interface{}, checkNil bool, canChange bool,
- d *Decoder) (_ map[int16]interface{}, changed bool) {
- dd := d.d
- cr := d.cr
-
- if checkNil && dd.TryDecodeAsNil() {
- if v != nil {
- changed = true
- }
- return nil, changed
- }
-
- containerLen := dd.ReadMapStart()
- if canChange && v == nil {
- xlen, _ := decInferLen(containerLen, d.h.MaxInitLen, 18)
- v = make(map[int16]interface{}, xlen)
- changed = true
- }
- mapGet := !d.h.MapValueReset && !d.h.InterfaceReset
- var mk int16
- var mv interface{}
- if containerLen > 0 {
- for j := 0; j < containerLen; j++ {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- mk = int16(dd.DecodeInt(16))
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- if mapGet {
- mv = v[mk]
- } else {
- mv = nil
- }
- d.decode(&mv)
- if v != nil {
- v[mk] = mv
- }
- }
- } else if containerLen < 0 {
- for j := 0; !dd.CheckBreak(); j++ {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- mk = int16(dd.DecodeInt(16))
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- if mapGet {
- mv = v[mk]
- } else {
- mv = nil
- }
- d.decode(&mv)
- if v != nil {
- v[mk] = mv
- }
- }
- }
- if cr != nil {
- cr.sendContainerState(containerMapEnd)
- }
- return v, changed
-}
-
-func (f *decFnInfo) fastpathDecMapInt16StringR(rv reflect.Value) {
- if rv.CanAddr() {
- vp := rv.Addr().Interface().(*map[int16]string)
- v, changed := fastpathTV.DecMapInt16StringV(*vp, fastpathCheckNilFalse, true, f.d)
- if changed {
- *vp = v
- }
- } else {
- v := rv.Interface().(map[int16]string)
- fastpathTV.DecMapInt16StringV(v, fastpathCheckNilFalse, false, f.d)
- }
-}
-func (f fastpathT) DecMapInt16StringX(vp *map[int16]string, checkNil bool, d *Decoder) {
- v, changed := f.DecMapInt16StringV(*vp, checkNil, true, d)
- if changed {
- *vp = v
- }
-}
-func (_ fastpathT) DecMapInt16StringV(v map[int16]string, checkNil bool, canChange bool,
- d *Decoder) (_ map[int16]string, changed bool) {
- dd := d.d
- cr := d.cr
-
- if checkNil && dd.TryDecodeAsNil() {
- if v != nil {
- changed = true
- }
- return nil, changed
- }
-
- containerLen := dd.ReadMapStart()
- if canChange && v == nil {
- xlen, _ := decInferLen(containerLen, d.h.MaxInitLen, 18)
- v = make(map[int16]string, xlen)
- changed = true
- }
-
- var mk int16
- var mv string
- if containerLen > 0 {
- for j := 0; j < containerLen; j++ {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- mk = int16(dd.DecodeInt(16))
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- mv = dd.DecodeString()
- if v != nil {
- v[mk] = mv
- }
- }
- } else if containerLen < 0 {
- for j := 0; !dd.CheckBreak(); j++ {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- mk = int16(dd.DecodeInt(16))
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- mv = dd.DecodeString()
- if v != nil {
- v[mk] = mv
- }
- }
- }
- if cr != nil {
- cr.sendContainerState(containerMapEnd)
- }
- return v, changed
-}
-
-func (f *decFnInfo) fastpathDecMapInt16UintR(rv reflect.Value) {
- if rv.CanAddr() {
- vp := rv.Addr().Interface().(*map[int16]uint)
- v, changed := fastpathTV.DecMapInt16UintV(*vp, fastpathCheckNilFalse, true, f.d)
- if changed {
- *vp = v
- }
- } else {
- v := rv.Interface().(map[int16]uint)
- fastpathTV.DecMapInt16UintV(v, fastpathCheckNilFalse, false, f.d)
- }
-}
-func (f fastpathT) DecMapInt16UintX(vp *map[int16]uint, checkNil bool, d *Decoder) {
- v, changed := f.DecMapInt16UintV(*vp, checkNil, true, d)
- if changed {
- *vp = v
- }
-}
-func (_ fastpathT) DecMapInt16UintV(v map[int16]uint, checkNil bool, canChange bool,
- d *Decoder) (_ map[int16]uint, changed bool) {
- dd := d.d
- cr := d.cr
-
- if checkNil && dd.TryDecodeAsNil() {
- if v != nil {
- changed = true
- }
- return nil, changed
- }
-
- containerLen := dd.ReadMapStart()
- if canChange && v == nil {
- xlen, _ := decInferLen(containerLen, d.h.MaxInitLen, 10)
- v = make(map[int16]uint, xlen)
- changed = true
- }
-
- var mk int16
- var mv uint
- if containerLen > 0 {
- for j := 0; j < containerLen; j++ {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- mk = int16(dd.DecodeInt(16))
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- mv = uint(dd.DecodeUint(uintBitsize))
- if v != nil {
- v[mk] = mv
- }
- }
- } else if containerLen < 0 {
- for j := 0; !dd.CheckBreak(); j++ {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- mk = int16(dd.DecodeInt(16))
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- mv = uint(dd.DecodeUint(uintBitsize))
- if v != nil {
- v[mk] = mv
- }
- }
- }
- if cr != nil {
- cr.sendContainerState(containerMapEnd)
- }
- return v, changed
-}
-
-func (f *decFnInfo) fastpathDecMapInt16Uint8R(rv reflect.Value) {
- if rv.CanAddr() {
- vp := rv.Addr().Interface().(*map[int16]uint8)
- v, changed := fastpathTV.DecMapInt16Uint8V(*vp, fastpathCheckNilFalse, true, f.d)
- if changed {
- *vp = v
- }
- } else {
- v := rv.Interface().(map[int16]uint8)
- fastpathTV.DecMapInt16Uint8V(v, fastpathCheckNilFalse, false, f.d)
- }
-}
-func (f fastpathT) DecMapInt16Uint8X(vp *map[int16]uint8, checkNil bool, d *Decoder) {
- v, changed := f.DecMapInt16Uint8V(*vp, checkNil, true, d)
- if changed {
- *vp = v
- }
-}
-func (_ fastpathT) DecMapInt16Uint8V(v map[int16]uint8, checkNil bool, canChange bool,
- d *Decoder) (_ map[int16]uint8, changed bool) {
- dd := d.d
- cr := d.cr
-
- if checkNil && dd.TryDecodeAsNil() {
- if v != nil {
- changed = true
- }
- return nil, changed
- }
-
- containerLen := dd.ReadMapStart()
- if canChange && v == nil {
- xlen, _ := decInferLen(containerLen, d.h.MaxInitLen, 3)
- v = make(map[int16]uint8, xlen)
- changed = true
- }
-
- var mk int16
- var mv uint8
- if containerLen > 0 {
- for j := 0; j < containerLen; j++ {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- mk = int16(dd.DecodeInt(16))
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- mv = uint8(dd.DecodeUint(8))
- if v != nil {
- v[mk] = mv
- }
- }
- } else if containerLen < 0 {
- for j := 0; !dd.CheckBreak(); j++ {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- mk = int16(dd.DecodeInt(16))
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- mv = uint8(dd.DecodeUint(8))
- if v != nil {
- v[mk] = mv
- }
- }
- }
- if cr != nil {
- cr.sendContainerState(containerMapEnd)
- }
- return v, changed
-}
-
-func (f *decFnInfo) fastpathDecMapInt16Uint16R(rv reflect.Value) {
- if rv.CanAddr() {
- vp := rv.Addr().Interface().(*map[int16]uint16)
- v, changed := fastpathTV.DecMapInt16Uint16V(*vp, fastpathCheckNilFalse, true, f.d)
- if changed {
- *vp = v
- }
- } else {
- v := rv.Interface().(map[int16]uint16)
- fastpathTV.DecMapInt16Uint16V(v, fastpathCheckNilFalse, false, f.d)
- }
-}
-func (f fastpathT) DecMapInt16Uint16X(vp *map[int16]uint16, checkNil bool, d *Decoder) {
- v, changed := f.DecMapInt16Uint16V(*vp, checkNil, true, d)
- if changed {
- *vp = v
- }
-}
-func (_ fastpathT) DecMapInt16Uint16V(v map[int16]uint16, checkNil bool, canChange bool,
- d *Decoder) (_ map[int16]uint16, changed bool) {
- dd := d.d
- cr := d.cr
-
- if checkNil && dd.TryDecodeAsNil() {
- if v != nil {
- changed = true
- }
- return nil, changed
- }
-
- containerLen := dd.ReadMapStart()
- if canChange && v == nil {
- xlen, _ := decInferLen(containerLen, d.h.MaxInitLen, 4)
- v = make(map[int16]uint16, xlen)
- changed = true
- }
-
- var mk int16
- var mv uint16
- if containerLen > 0 {
- for j := 0; j < containerLen; j++ {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- mk = int16(dd.DecodeInt(16))
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- mv = uint16(dd.DecodeUint(16))
- if v != nil {
- v[mk] = mv
- }
- }
- } else if containerLen < 0 {
- for j := 0; !dd.CheckBreak(); j++ {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- mk = int16(dd.DecodeInt(16))
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- mv = uint16(dd.DecodeUint(16))
- if v != nil {
- v[mk] = mv
- }
- }
- }
- if cr != nil {
- cr.sendContainerState(containerMapEnd)
- }
- return v, changed
-}
-
-func (f *decFnInfo) fastpathDecMapInt16Uint32R(rv reflect.Value) {
- if rv.CanAddr() {
- vp := rv.Addr().Interface().(*map[int16]uint32)
- v, changed := fastpathTV.DecMapInt16Uint32V(*vp, fastpathCheckNilFalse, true, f.d)
- if changed {
- *vp = v
- }
- } else {
- v := rv.Interface().(map[int16]uint32)
- fastpathTV.DecMapInt16Uint32V(v, fastpathCheckNilFalse, false, f.d)
- }
-}
-func (f fastpathT) DecMapInt16Uint32X(vp *map[int16]uint32, checkNil bool, d *Decoder) {
- v, changed := f.DecMapInt16Uint32V(*vp, checkNil, true, d)
- if changed {
- *vp = v
- }
-}
-func (_ fastpathT) DecMapInt16Uint32V(v map[int16]uint32, checkNil bool, canChange bool,
- d *Decoder) (_ map[int16]uint32, changed bool) {
- dd := d.d
- cr := d.cr
-
- if checkNil && dd.TryDecodeAsNil() {
- if v != nil {
- changed = true
- }
- return nil, changed
- }
-
- containerLen := dd.ReadMapStart()
- if canChange && v == nil {
- xlen, _ := decInferLen(containerLen, d.h.MaxInitLen, 6)
- v = make(map[int16]uint32, xlen)
- changed = true
- }
-
- var mk int16
- var mv uint32
- if containerLen > 0 {
- for j := 0; j < containerLen; j++ {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- mk = int16(dd.DecodeInt(16))
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- mv = uint32(dd.DecodeUint(32))
- if v != nil {
- v[mk] = mv
- }
- }
- } else if containerLen < 0 {
- for j := 0; !dd.CheckBreak(); j++ {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- mk = int16(dd.DecodeInt(16))
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- mv = uint32(dd.DecodeUint(32))
- if v != nil {
- v[mk] = mv
- }
- }
- }
- if cr != nil {
- cr.sendContainerState(containerMapEnd)
- }
- return v, changed
-}
-
-func (f *decFnInfo) fastpathDecMapInt16Uint64R(rv reflect.Value) {
- if rv.CanAddr() {
- vp := rv.Addr().Interface().(*map[int16]uint64)
- v, changed := fastpathTV.DecMapInt16Uint64V(*vp, fastpathCheckNilFalse, true, f.d)
- if changed {
- *vp = v
- }
- } else {
- v := rv.Interface().(map[int16]uint64)
- fastpathTV.DecMapInt16Uint64V(v, fastpathCheckNilFalse, false, f.d)
- }
-}
-func (f fastpathT) DecMapInt16Uint64X(vp *map[int16]uint64, checkNil bool, d *Decoder) {
- v, changed := f.DecMapInt16Uint64V(*vp, checkNil, true, d)
- if changed {
- *vp = v
- }
-}
-func (_ fastpathT) DecMapInt16Uint64V(v map[int16]uint64, checkNil bool, canChange bool,
- d *Decoder) (_ map[int16]uint64, changed bool) {
- dd := d.d
- cr := d.cr
-
- if checkNil && dd.TryDecodeAsNil() {
- if v != nil {
- changed = true
- }
- return nil, changed
- }
-
- containerLen := dd.ReadMapStart()
- if canChange && v == nil {
- xlen, _ := decInferLen(containerLen, d.h.MaxInitLen, 10)
- v = make(map[int16]uint64, xlen)
- changed = true
- }
-
- var mk int16
- var mv uint64
- if containerLen > 0 {
- for j := 0; j < containerLen; j++ {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- mk = int16(dd.DecodeInt(16))
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- mv = dd.DecodeUint(64)
- if v != nil {
- v[mk] = mv
- }
- }
- } else if containerLen < 0 {
- for j := 0; !dd.CheckBreak(); j++ {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- mk = int16(dd.DecodeInt(16))
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- mv = dd.DecodeUint(64)
- if v != nil {
- v[mk] = mv
- }
- }
- }
- if cr != nil {
- cr.sendContainerState(containerMapEnd)
- }
- return v, changed
-}
-
-func (f *decFnInfo) fastpathDecMapInt16UintptrR(rv reflect.Value) {
- if rv.CanAddr() {
- vp := rv.Addr().Interface().(*map[int16]uintptr)
- v, changed := fastpathTV.DecMapInt16UintptrV(*vp, fastpathCheckNilFalse, true, f.d)
- if changed {
- *vp = v
- }
- } else {
- v := rv.Interface().(map[int16]uintptr)
- fastpathTV.DecMapInt16UintptrV(v, fastpathCheckNilFalse, false, f.d)
- }
-}
-func (f fastpathT) DecMapInt16UintptrX(vp *map[int16]uintptr, checkNil bool, d *Decoder) {
- v, changed := f.DecMapInt16UintptrV(*vp, checkNil, true, d)
- if changed {
- *vp = v
- }
-}
-func (_ fastpathT) DecMapInt16UintptrV(v map[int16]uintptr, checkNil bool, canChange bool,
- d *Decoder) (_ map[int16]uintptr, changed bool) {
- dd := d.d
- cr := d.cr
-
- if checkNil && dd.TryDecodeAsNil() {
- if v != nil {
- changed = true
- }
- return nil, changed
- }
-
- containerLen := dd.ReadMapStart()
- if canChange && v == nil {
- xlen, _ := decInferLen(containerLen, d.h.MaxInitLen, 10)
- v = make(map[int16]uintptr, xlen)
- changed = true
- }
-
- var mk int16
- var mv uintptr
- if containerLen > 0 {
- for j := 0; j < containerLen; j++ {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- mk = int16(dd.DecodeInt(16))
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- mv = uintptr(dd.DecodeUint(uintBitsize))
- if v != nil {
- v[mk] = mv
- }
- }
- } else if containerLen < 0 {
- for j := 0; !dd.CheckBreak(); j++ {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- mk = int16(dd.DecodeInt(16))
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- mv = uintptr(dd.DecodeUint(uintBitsize))
- if v != nil {
- v[mk] = mv
- }
- }
- }
- if cr != nil {
- cr.sendContainerState(containerMapEnd)
- }
- return v, changed
-}
-
-func (f *decFnInfo) fastpathDecMapInt16IntR(rv reflect.Value) {
- if rv.CanAddr() {
- vp := rv.Addr().Interface().(*map[int16]int)
- v, changed := fastpathTV.DecMapInt16IntV(*vp, fastpathCheckNilFalse, true, f.d)
- if changed {
- *vp = v
- }
- } else {
- v := rv.Interface().(map[int16]int)
- fastpathTV.DecMapInt16IntV(v, fastpathCheckNilFalse, false, f.d)
- }
-}
-func (f fastpathT) DecMapInt16IntX(vp *map[int16]int, checkNil bool, d *Decoder) {
- v, changed := f.DecMapInt16IntV(*vp, checkNil, true, d)
- if changed {
- *vp = v
- }
-}
-func (_ fastpathT) DecMapInt16IntV(v map[int16]int, checkNil bool, canChange bool,
- d *Decoder) (_ map[int16]int, changed bool) {
- dd := d.d
- cr := d.cr
-
- if checkNil && dd.TryDecodeAsNil() {
- if v != nil {
- changed = true
- }
- return nil, changed
- }
-
- containerLen := dd.ReadMapStart()
- if canChange && v == nil {
- xlen, _ := decInferLen(containerLen, d.h.MaxInitLen, 10)
- v = make(map[int16]int, xlen)
- changed = true
- }
-
- var mk int16
- var mv int
- if containerLen > 0 {
- for j := 0; j < containerLen; j++ {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- mk = int16(dd.DecodeInt(16))
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- mv = int(dd.DecodeInt(intBitsize))
- if v != nil {
- v[mk] = mv
- }
- }
- } else if containerLen < 0 {
- for j := 0; !dd.CheckBreak(); j++ {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- mk = int16(dd.DecodeInt(16))
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- mv = int(dd.DecodeInt(intBitsize))
- if v != nil {
- v[mk] = mv
- }
- }
- }
- if cr != nil {
- cr.sendContainerState(containerMapEnd)
- }
- return v, changed
-}
-
-func (f *decFnInfo) fastpathDecMapInt16Int8R(rv reflect.Value) {
- if rv.CanAddr() {
- vp := rv.Addr().Interface().(*map[int16]int8)
- v, changed := fastpathTV.DecMapInt16Int8V(*vp, fastpathCheckNilFalse, true, f.d)
- if changed {
- *vp = v
- }
- } else {
- v := rv.Interface().(map[int16]int8)
- fastpathTV.DecMapInt16Int8V(v, fastpathCheckNilFalse, false, f.d)
- }
-}
-func (f fastpathT) DecMapInt16Int8X(vp *map[int16]int8, checkNil bool, d *Decoder) {
- v, changed := f.DecMapInt16Int8V(*vp, checkNil, true, d)
- if changed {
- *vp = v
- }
-}
-func (_ fastpathT) DecMapInt16Int8V(v map[int16]int8, checkNil bool, canChange bool,
- d *Decoder) (_ map[int16]int8, changed bool) {
- dd := d.d
- cr := d.cr
-
- if checkNil && dd.TryDecodeAsNil() {
- if v != nil {
- changed = true
- }
- return nil, changed
- }
-
- containerLen := dd.ReadMapStart()
- if canChange && v == nil {
- xlen, _ := decInferLen(containerLen, d.h.MaxInitLen, 3)
- v = make(map[int16]int8, xlen)
- changed = true
- }
-
- var mk int16
- var mv int8
- if containerLen > 0 {
- for j := 0; j < containerLen; j++ {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- mk = int16(dd.DecodeInt(16))
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- mv = int8(dd.DecodeInt(8))
- if v != nil {
- v[mk] = mv
- }
- }
- } else if containerLen < 0 {
- for j := 0; !dd.CheckBreak(); j++ {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- mk = int16(dd.DecodeInt(16))
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- mv = int8(dd.DecodeInt(8))
- if v != nil {
- v[mk] = mv
- }
- }
- }
- if cr != nil {
- cr.sendContainerState(containerMapEnd)
- }
- return v, changed
-}
-
-func (f *decFnInfo) fastpathDecMapInt16Int16R(rv reflect.Value) {
- if rv.CanAddr() {
- vp := rv.Addr().Interface().(*map[int16]int16)
- v, changed := fastpathTV.DecMapInt16Int16V(*vp, fastpathCheckNilFalse, true, f.d)
- if changed {
- *vp = v
- }
- } else {
- v := rv.Interface().(map[int16]int16)
- fastpathTV.DecMapInt16Int16V(v, fastpathCheckNilFalse, false, f.d)
- }
-}
-func (f fastpathT) DecMapInt16Int16X(vp *map[int16]int16, checkNil bool, d *Decoder) {
- v, changed := f.DecMapInt16Int16V(*vp, checkNil, true, d)
- if changed {
- *vp = v
- }
-}
-func (_ fastpathT) DecMapInt16Int16V(v map[int16]int16, checkNil bool, canChange bool,
- d *Decoder) (_ map[int16]int16, changed bool) {
- dd := d.d
- cr := d.cr
-
- if checkNil && dd.TryDecodeAsNil() {
- if v != nil {
- changed = true
- }
- return nil, changed
- }
-
- containerLen := dd.ReadMapStart()
- if canChange && v == nil {
- xlen, _ := decInferLen(containerLen, d.h.MaxInitLen, 4)
- v = make(map[int16]int16, xlen)
- changed = true
- }
-
- var mk int16
- var mv int16
- if containerLen > 0 {
- for j := 0; j < containerLen; j++ {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- mk = int16(dd.DecodeInt(16))
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- mv = int16(dd.DecodeInt(16))
- if v != nil {
- v[mk] = mv
- }
- }
- } else if containerLen < 0 {
- for j := 0; !dd.CheckBreak(); j++ {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- mk = int16(dd.DecodeInt(16))
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- mv = int16(dd.DecodeInt(16))
- if v != nil {
- v[mk] = mv
- }
- }
- }
- if cr != nil {
- cr.sendContainerState(containerMapEnd)
- }
- return v, changed
-}
-
-func (f *decFnInfo) fastpathDecMapInt16Int32R(rv reflect.Value) {
- if rv.CanAddr() {
- vp := rv.Addr().Interface().(*map[int16]int32)
- v, changed := fastpathTV.DecMapInt16Int32V(*vp, fastpathCheckNilFalse, true, f.d)
- if changed {
- *vp = v
- }
- } else {
- v := rv.Interface().(map[int16]int32)
- fastpathTV.DecMapInt16Int32V(v, fastpathCheckNilFalse, false, f.d)
- }
-}
-func (f fastpathT) DecMapInt16Int32X(vp *map[int16]int32, checkNil bool, d *Decoder) {
- v, changed := f.DecMapInt16Int32V(*vp, checkNil, true, d)
- if changed {
- *vp = v
- }
-}
-func (_ fastpathT) DecMapInt16Int32V(v map[int16]int32, checkNil bool, canChange bool,
- d *Decoder) (_ map[int16]int32, changed bool) {
- dd := d.d
- cr := d.cr
-
- if checkNil && dd.TryDecodeAsNil() {
- if v != nil {
- changed = true
- }
- return nil, changed
- }
-
- containerLen := dd.ReadMapStart()
- if canChange && v == nil {
- xlen, _ := decInferLen(containerLen, d.h.MaxInitLen, 6)
- v = make(map[int16]int32, xlen)
- changed = true
- }
-
- var mk int16
- var mv int32
- if containerLen > 0 {
- for j := 0; j < containerLen; j++ {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- mk = int16(dd.DecodeInt(16))
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- mv = int32(dd.DecodeInt(32))
- if v != nil {
- v[mk] = mv
- }
- }
- } else if containerLen < 0 {
- for j := 0; !dd.CheckBreak(); j++ {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- mk = int16(dd.DecodeInt(16))
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- mv = int32(dd.DecodeInt(32))
- if v != nil {
- v[mk] = mv
- }
- }
- }
- if cr != nil {
- cr.sendContainerState(containerMapEnd)
- }
- return v, changed
-}
-
-func (f *decFnInfo) fastpathDecMapInt16Int64R(rv reflect.Value) {
- if rv.CanAddr() {
- vp := rv.Addr().Interface().(*map[int16]int64)
- v, changed := fastpathTV.DecMapInt16Int64V(*vp, fastpathCheckNilFalse, true, f.d)
- if changed {
- *vp = v
- }
- } else {
- v := rv.Interface().(map[int16]int64)
- fastpathTV.DecMapInt16Int64V(v, fastpathCheckNilFalse, false, f.d)
- }
-}
-func (f fastpathT) DecMapInt16Int64X(vp *map[int16]int64, checkNil bool, d *Decoder) {
- v, changed := f.DecMapInt16Int64V(*vp, checkNil, true, d)
- if changed {
- *vp = v
- }
-}
-func (_ fastpathT) DecMapInt16Int64V(v map[int16]int64, checkNil bool, canChange bool,
- d *Decoder) (_ map[int16]int64, changed bool) {
- dd := d.d
- cr := d.cr
-
- if checkNil && dd.TryDecodeAsNil() {
- if v != nil {
- changed = true
- }
- return nil, changed
- }
-
- containerLen := dd.ReadMapStart()
- if canChange && v == nil {
- xlen, _ := decInferLen(containerLen, d.h.MaxInitLen, 10)
- v = make(map[int16]int64, xlen)
- changed = true
- }
-
- var mk int16
- var mv int64
- if containerLen > 0 {
- for j := 0; j < containerLen; j++ {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- mk = int16(dd.DecodeInt(16))
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- mv = dd.DecodeInt(64)
- if v != nil {
- v[mk] = mv
- }
- }
- } else if containerLen < 0 {
- for j := 0; !dd.CheckBreak(); j++ {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- mk = int16(dd.DecodeInt(16))
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- mv = dd.DecodeInt(64)
- if v != nil {
- v[mk] = mv
- }
- }
- }
- if cr != nil {
- cr.sendContainerState(containerMapEnd)
- }
- return v, changed
-}
-
-func (f *decFnInfo) fastpathDecMapInt16Float32R(rv reflect.Value) {
- if rv.CanAddr() {
- vp := rv.Addr().Interface().(*map[int16]float32)
- v, changed := fastpathTV.DecMapInt16Float32V(*vp, fastpathCheckNilFalse, true, f.d)
- if changed {
- *vp = v
- }
- } else {
- v := rv.Interface().(map[int16]float32)
- fastpathTV.DecMapInt16Float32V(v, fastpathCheckNilFalse, false, f.d)
- }
-}
-func (f fastpathT) DecMapInt16Float32X(vp *map[int16]float32, checkNil bool, d *Decoder) {
- v, changed := f.DecMapInt16Float32V(*vp, checkNil, true, d)
- if changed {
- *vp = v
- }
-}
-func (_ fastpathT) DecMapInt16Float32V(v map[int16]float32, checkNil bool, canChange bool,
- d *Decoder) (_ map[int16]float32, changed bool) {
- dd := d.d
- cr := d.cr
-
- if checkNil && dd.TryDecodeAsNil() {
- if v != nil {
- changed = true
- }
- return nil, changed
- }
-
- containerLen := dd.ReadMapStart()
- if canChange && v == nil {
- xlen, _ := decInferLen(containerLen, d.h.MaxInitLen, 6)
- v = make(map[int16]float32, xlen)
- changed = true
- }
-
- var mk int16
- var mv float32
- if containerLen > 0 {
- for j := 0; j < containerLen; j++ {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- mk = int16(dd.DecodeInt(16))
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- mv = float32(dd.DecodeFloat(true))
- if v != nil {
- v[mk] = mv
- }
- }
- } else if containerLen < 0 {
- for j := 0; !dd.CheckBreak(); j++ {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- mk = int16(dd.DecodeInt(16))
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- mv = float32(dd.DecodeFloat(true))
- if v != nil {
- v[mk] = mv
- }
- }
- }
- if cr != nil {
- cr.sendContainerState(containerMapEnd)
- }
- return v, changed
-}
-
-func (f *decFnInfo) fastpathDecMapInt16Float64R(rv reflect.Value) {
- if rv.CanAddr() {
- vp := rv.Addr().Interface().(*map[int16]float64)
- v, changed := fastpathTV.DecMapInt16Float64V(*vp, fastpathCheckNilFalse, true, f.d)
- if changed {
- *vp = v
- }
- } else {
- v := rv.Interface().(map[int16]float64)
- fastpathTV.DecMapInt16Float64V(v, fastpathCheckNilFalse, false, f.d)
- }
-}
-func (f fastpathT) DecMapInt16Float64X(vp *map[int16]float64, checkNil bool, d *Decoder) {
- v, changed := f.DecMapInt16Float64V(*vp, checkNil, true, d)
- if changed {
- *vp = v
- }
-}
-func (_ fastpathT) DecMapInt16Float64V(v map[int16]float64, checkNil bool, canChange bool,
- d *Decoder) (_ map[int16]float64, changed bool) {
- dd := d.d
- cr := d.cr
-
- if checkNil && dd.TryDecodeAsNil() {
- if v != nil {
- changed = true
- }
- return nil, changed
- }
-
- containerLen := dd.ReadMapStart()
- if canChange && v == nil {
- xlen, _ := decInferLen(containerLen, d.h.MaxInitLen, 10)
- v = make(map[int16]float64, xlen)
- changed = true
- }
-
- var mk int16
- var mv float64
- if containerLen > 0 {
- for j := 0; j < containerLen; j++ {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- mk = int16(dd.DecodeInt(16))
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- mv = dd.DecodeFloat(false)
- if v != nil {
- v[mk] = mv
- }
- }
- } else if containerLen < 0 {
- for j := 0; !dd.CheckBreak(); j++ {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- mk = int16(dd.DecodeInt(16))
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- mv = dd.DecodeFloat(false)
- if v != nil {
- v[mk] = mv
- }
- }
- }
- if cr != nil {
- cr.sendContainerState(containerMapEnd)
- }
- return v, changed
-}
-
-func (f *decFnInfo) fastpathDecMapInt16BoolR(rv reflect.Value) {
- if rv.CanAddr() {
- vp := rv.Addr().Interface().(*map[int16]bool)
- v, changed := fastpathTV.DecMapInt16BoolV(*vp, fastpathCheckNilFalse, true, f.d)
- if changed {
- *vp = v
- }
- } else {
- v := rv.Interface().(map[int16]bool)
- fastpathTV.DecMapInt16BoolV(v, fastpathCheckNilFalse, false, f.d)
- }
-}
-func (f fastpathT) DecMapInt16BoolX(vp *map[int16]bool, checkNil bool, d *Decoder) {
- v, changed := f.DecMapInt16BoolV(*vp, checkNil, true, d)
- if changed {
- *vp = v
- }
-}
-func (_ fastpathT) DecMapInt16BoolV(v map[int16]bool, checkNil bool, canChange bool,
- d *Decoder) (_ map[int16]bool, changed bool) {
- dd := d.d
- cr := d.cr
-
- if checkNil && dd.TryDecodeAsNil() {
- if v != nil {
- changed = true
- }
- return nil, changed
- }
-
- containerLen := dd.ReadMapStart()
- if canChange && v == nil {
- xlen, _ := decInferLen(containerLen, d.h.MaxInitLen, 3)
- v = make(map[int16]bool, xlen)
- changed = true
- }
-
- var mk int16
- var mv bool
- if containerLen > 0 {
- for j := 0; j < containerLen; j++ {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- mk = int16(dd.DecodeInt(16))
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- mv = dd.DecodeBool()
- if v != nil {
- v[mk] = mv
- }
- }
- } else if containerLen < 0 {
- for j := 0; !dd.CheckBreak(); j++ {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- mk = int16(dd.DecodeInt(16))
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- mv = dd.DecodeBool()
- if v != nil {
- v[mk] = mv
- }
- }
- }
- if cr != nil {
- cr.sendContainerState(containerMapEnd)
- }
- return v, changed
-}
-
-func (f *decFnInfo) fastpathDecMapInt32IntfR(rv reflect.Value) {
- if rv.CanAddr() {
- vp := rv.Addr().Interface().(*map[int32]interface{})
- v, changed := fastpathTV.DecMapInt32IntfV(*vp, fastpathCheckNilFalse, true, f.d)
- if changed {
- *vp = v
- }
- } else {
- v := rv.Interface().(map[int32]interface{})
- fastpathTV.DecMapInt32IntfV(v, fastpathCheckNilFalse, false, f.d)
- }
-}
-func (f fastpathT) DecMapInt32IntfX(vp *map[int32]interface{}, checkNil bool, d *Decoder) {
- v, changed := f.DecMapInt32IntfV(*vp, checkNil, true, d)
- if changed {
- *vp = v
- }
-}
-func (_ fastpathT) DecMapInt32IntfV(v map[int32]interface{}, checkNil bool, canChange bool,
- d *Decoder) (_ map[int32]interface{}, changed bool) {
- dd := d.d
- cr := d.cr
-
- if checkNil && dd.TryDecodeAsNil() {
- if v != nil {
- changed = true
- }
- return nil, changed
- }
-
- containerLen := dd.ReadMapStart()
- if canChange && v == nil {
- xlen, _ := decInferLen(containerLen, d.h.MaxInitLen, 20)
- v = make(map[int32]interface{}, xlen)
- changed = true
- }
- mapGet := !d.h.MapValueReset && !d.h.InterfaceReset
- var mk int32
- var mv interface{}
- if containerLen > 0 {
- for j := 0; j < containerLen; j++ {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- mk = int32(dd.DecodeInt(32))
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- if mapGet {
- mv = v[mk]
- } else {
- mv = nil
- }
- d.decode(&mv)
- if v != nil {
- v[mk] = mv
- }
- }
- } else if containerLen < 0 {
- for j := 0; !dd.CheckBreak(); j++ {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- mk = int32(dd.DecodeInt(32))
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- if mapGet {
- mv = v[mk]
- } else {
- mv = nil
- }
- d.decode(&mv)
- if v != nil {
- v[mk] = mv
- }
- }
- }
- if cr != nil {
- cr.sendContainerState(containerMapEnd)
- }
- return v, changed
-}
-
-func (f *decFnInfo) fastpathDecMapInt32StringR(rv reflect.Value) {
- if rv.CanAddr() {
- vp := rv.Addr().Interface().(*map[int32]string)
- v, changed := fastpathTV.DecMapInt32StringV(*vp, fastpathCheckNilFalse, true, f.d)
- if changed {
- *vp = v
- }
- } else {
- v := rv.Interface().(map[int32]string)
- fastpathTV.DecMapInt32StringV(v, fastpathCheckNilFalse, false, f.d)
- }
-}
-func (f fastpathT) DecMapInt32StringX(vp *map[int32]string, checkNil bool, d *Decoder) {
- v, changed := f.DecMapInt32StringV(*vp, checkNil, true, d)
- if changed {
- *vp = v
- }
-}
-func (_ fastpathT) DecMapInt32StringV(v map[int32]string, checkNil bool, canChange bool,
- d *Decoder) (_ map[int32]string, changed bool) {
- dd := d.d
- cr := d.cr
-
- if checkNil && dd.TryDecodeAsNil() {
- if v != nil {
- changed = true
- }
- return nil, changed
- }
-
- containerLen := dd.ReadMapStart()
- if canChange && v == nil {
- xlen, _ := decInferLen(containerLen, d.h.MaxInitLen, 20)
- v = make(map[int32]string, xlen)
- changed = true
- }
-
- var mk int32
- var mv string
- if containerLen > 0 {
- for j := 0; j < containerLen; j++ {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- mk = int32(dd.DecodeInt(32))
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- mv = dd.DecodeString()
- if v != nil {
- v[mk] = mv
- }
- }
- } else if containerLen < 0 {
- for j := 0; !dd.CheckBreak(); j++ {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- mk = int32(dd.DecodeInt(32))
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- mv = dd.DecodeString()
- if v != nil {
- v[mk] = mv
- }
- }
- }
- if cr != nil {
- cr.sendContainerState(containerMapEnd)
- }
- return v, changed
-}
-
-func (f *decFnInfo) fastpathDecMapInt32UintR(rv reflect.Value) {
- if rv.CanAddr() {
- vp := rv.Addr().Interface().(*map[int32]uint)
- v, changed := fastpathTV.DecMapInt32UintV(*vp, fastpathCheckNilFalse, true, f.d)
- if changed {
- *vp = v
- }
- } else {
- v := rv.Interface().(map[int32]uint)
- fastpathTV.DecMapInt32UintV(v, fastpathCheckNilFalse, false, f.d)
- }
-}
-func (f fastpathT) DecMapInt32UintX(vp *map[int32]uint, checkNil bool, d *Decoder) {
- v, changed := f.DecMapInt32UintV(*vp, checkNil, true, d)
- if changed {
- *vp = v
- }
-}
-func (_ fastpathT) DecMapInt32UintV(v map[int32]uint, checkNil bool, canChange bool,
- d *Decoder) (_ map[int32]uint, changed bool) {
- dd := d.d
- cr := d.cr
-
- if checkNil && dd.TryDecodeAsNil() {
- if v != nil {
- changed = true
- }
- return nil, changed
- }
-
- containerLen := dd.ReadMapStart()
- if canChange && v == nil {
- xlen, _ := decInferLen(containerLen, d.h.MaxInitLen, 12)
- v = make(map[int32]uint, xlen)
- changed = true
- }
-
- var mk int32
- var mv uint
- if containerLen > 0 {
- for j := 0; j < containerLen; j++ {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- mk = int32(dd.DecodeInt(32))
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- mv = uint(dd.DecodeUint(uintBitsize))
- if v != nil {
- v[mk] = mv
- }
- }
- } else if containerLen < 0 {
- for j := 0; !dd.CheckBreak(); j++ {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- mk = int32(dd.DecodeInt(32))
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- mv = uint(dd.DecodeUint(uintBitsize))
- if v != nil {
- v[mk] = mv
- }
- }
- }
- if cr != nil {
- cr.sendContainerState(containerMapEnd)
- }
- return v, changed
-}
-
-func (f *decFnInfo) fastpathDecMapInt32Uint8R(rv reflect.Value) {
- if rv.CanAddr() {
- vp := rv.Addr().Interface().(*map[int32]uint8)
- v, changed := fastpathTV.DecMapInt32Uint8V(*vp, fastpathCheckNilFalse, true, f.d)
- if changed {
- *vp = v
- }
- } else {
- v := rv.Interface().(map[int32]uint8)
- fastpathTV.DecMapInt32Uint8V(v, fastpathCheckNilFalse, false, f.d)
- }
-}
-func (f fastpathT) DecMapInt32Uint8X(vp *map[int32]uint8, checkNil bool, d *Decoder) {
- v, changed := f.DecMapInt32Uint8V(*vp, checkNil, true, d)
- if changed {
- *vp = v
- }
-}
-func (_ fastpathT) DecMapInt32Uint8V(v map[int32]uint8, checkNil bool, canChange bool,
- d *Decoder) (_ map[int32]uint8, changed bool) {
- dd := d.d
- cr := d.cr
-
- if checkNil && dd.TryDecodeAsNil() {
- if v != nil {
- changed = true
- }
- return nil, changed
- }
-
- containerLen := dd.ReadMapStart()
- if canChange && v == nil {
- xlen, _ := decInferLen(containerLen, d.h.MaxInitLen, 5)
- v = make(map[int32]uint8, xlen)
- changed = true
- }
-
- var mk int32
- var mv uint8
- if containerLen > 0 {
- for j := 0; j < containerLen; j++ {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- mk = int32(dd.DecodeInt(32))
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- mv = uint8(dd.DecodeUint(8))
- if v != nil {
- v[mk] = mv
- }
- }
- } else if containerLen < 0 {
- for j := 0; !dd.CheckBreak(); j++ {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- mk = int32(dd.DecodeInt(32))
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- mv = uint8(dd.DecodeUint(8))
- if v != nil {
- v[mk] = mv
- }
- }
- }
- if cr != nil {
- cr.sendContainerState(containerMapEnd)
- }
- return v, changed
-}
-
-func (f *decFnInfo) fastpathDecMapInt32Uint16R(rv reflect.Value) {
- if rv.CanAddr() {
- vp := rv.Addr().Interface().(*map[int32]uint16)
- v, changed := fastpathTV.DecMapInt32Uint16V(*vp, fastpathCheckNilFalse, true, f.d)
- if changed {
- *vp = v
- }
- } else {
- v := rv.Interface().(map[int32]uint16)
- fastpathTV.DecMapInt32Uint16V(v, fastpathCheckNilFalse, false, f.d)
- }
-}
-func (f fastpathT) DecMapInt32Uint16X(vp *map[int32]uint16, checkNil bool, d *Decoder) {
- v, changed := f.DecMapInt32Uint16V(*vp, checkNil, true, d)
- if changed {
- *vp = v
- }
-}
-func (_ fastpathT) DecMapInt32Uint16V(v map[int32]uint16, checkNil bool, canChange bool,
- d *Decoder) (_ map[int32]uint16, changed bool) {
- dd := d.d
- cr := d.cr
-
- if checkNil && dd.TryDecodeAsNil() {
- if v != nil {
- changed = true
- }
- return nil, changed
- }
-
- containerLen := dd.ReadMapStart()
- if canChange && v == nil {
- xlen, _ := decInferLen(containerLen, d.h.MaxInitLen, 6)
- v = make(map[int32]uint16, xlen)
- changed = true
- }
-
- var mk int32
- var mv uint16
- if containerLen > 0 {
- for j := 0; j < containerLen; j++ {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- mk = int32(dd.DecodeInt(32))
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- mv = uint16(dd.DecodeUint(16))
- if v != nil {
- v[mk] = mv
- }
- }
- } else if containerLen < 0 {
- for j := 0; !dd.CheckBreak(); j++ {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- mk = int32(dd.DecodeInt(32))
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- mv = uint16(dd.DecodeUint(16))
- if v != nil {
- v[mk] = mv
- }
- }
- }
- if cr != nil {
- cr.sendContainerState(containerMapEnd)
- }
- return v, changed
-}
-
-func (f *decFnInfo) fastpathDecMapInt32Uint32R(rv reflect.Value) {
- if rv.CanAddr() {
- vp := rv.Addr().Interface().(*map[int32]uint32)
- v, changed := fastpathTV.DecMapInt32Uint32V(*vp, fastpathCheckNilFalse, true, f.d)
- if changed {
- *vp = v
- }
- } else {
- v := rv.Interface().(map[int32]uint32)
- fastpathTV.DecMapInt32Uint32V(v, fastpathCheckNilFalse, false, f.d)
- }
-}
-func (f fastpathT) DecMapInt32Uint32X(vp *map[int32]uint32, checkNil bool, d *Decoder) {
- v, changed := f.DecMapInt32Uint32V(*vp, checkNil, true, d)
- if changed {
- *vp = v
- }
-}
-func (_ fastpathT) DecMapInt32Uint32V(v map[int32]uint32, checkNil bool, canChange bool,
- d *Decoder) (_ map[int32]uint32, changed bool) {
- dd := d.d
- cr := d.cr
-
- if checkNil && dd.TryDecodeAsNil() {
- if v != nil {
- changed = true
- }
- return nil, changed
- }
-
- containerLen := dd.ReadMapStart()
- if canChange && v == nil {
- xlen, _ := decInferLen(containerLen, d.h.MaxInitLen, 8)
- v = make(map[int32]uint32, xlen)
- changed = true
- }
-
- var mk int32
- var mv uint32
- if containerLen > 0 {
- for j := 0; j < containerLen; j++ {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- mk = int32(dd.DecodeInt(32))
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- mv = uint32(dd.DecodeUint(32))
- if v != nil {
- v[mk] = mv
- }
- }
- } else if containerLen < 0 {
- for j := 0; !dd.CheckBreak(); j++ {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- mk = int32(dd.DecodeInt(32))
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- mv = uint32(dd.DecodeUint(32))
- if v != nil {
- v[mk] = mv
- }
- }
- }
- if cr != nil {
- cr.sendContainerState(containerMapEnd)
- }
- return v, changed
-}
-
-func (f *decFnInfo) fastpathDecMapInt32Uint64R(rv reflect.Value) {
- if rv.CanAddr() {
- vp := rv.Addr().Interface().(*map[int32]uint64)
- v, changed := fastpathTV.DecMapInt32Uint64V(*vp, fastpathCheckNilFalse, true, f.d)
- if changed {
- *vp = v
- }
- } else {
- v := rv.Interface().(map[int32]uint64)
- fastpathTV.DecMapInt32Uint64V(v, fastpathCheckNilFalse, false, f.d)
- }
-}
-func (f fastpathT) DecMapInt32Uint64X(vp *map[int32]uint64, checkNil bool, d *Decoder) {
- v, changed := f.DecMapInt32Uint64V(*vp, checkNil, true, d)
- if changed {
- *vp = v
- }
-}
-func (_ fastpathT) DecMapInt32Uint64V(v map[int32]uint64, checkNil bool, canChange bool,
- d *Decoder) (_ map[int32]uint64, changed bool) {
- dd := d.d
- cr := d.cr
-
- if checkNil && dd.TryDecodeAsNil() {
- if v != nil {
- changed = true
- }
- return nil, changed
- }
-
- containerLen := dd.ReadMapStart()
- if canChange && v == nil {
- xlen, _ := decInferLen(containerLen, d.h.MaxInitLen, 12)
- v = make(map[int32]uint64, xlen)
- changed = true
- }
-
- var mk int32
- var mv uint64
- if containerLen > 0 {
- for j := 0; j < containerLen; j++ {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- mk = int32(dd.DecodeInt(32))
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- mv = dd.DecodeUint(64)
- if v != nil {
- v[mk] = mv
- }
- }
- } else if containerLen < 0 {
- for j := 0; !dd.CheckBreak(); j++ {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- mk = int32(dd.DecodeInt(32))
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- mv = dd.DecodeUint(64)
- if v != nil {
- v[mk] = mv
- }
- }
- }
- if cr != nil {
- cr.sendContainerState(containerMapEnd)
- }
- return v, changed
-}
-
-func (f *decFnInfo) fastpathDecMapInt32UintptrR(rv reflect.Value) {
- if rv.CanAddr() {
- vp := rv.Addr().Interface().(*map[int32]uintptr)
- v, changed := fastpathTV.DecMapInt32UintptrV(*vp, fastpathCheckNilFalse, true, f.d)
- if changed {
- *vp = v
- }
- } else {
- v := rv.Interface().(map[int32]uintptr)
- fastpathTV.DecMapInt32UintptrV(v, fastpathCheckNilFalse, false, f.d)
- }
-}
-func (f fastpathT) DecMapInt32UintptrX(vp *map[int32]uintptr, checkNil bool, d *Decoder) {
- v, changed := f.DecMapInt32UintptrV(*vp, checkNil, true, d)
- if changed {
- *vp = v
- }
-}
-func (_ fastpathT) DecMapInt32UintptrV(v map[int32]uintptr, checkNil bool, canChange bool,
- d *Decoder) (_ map[int32]uintptr, changed bool) {
- dd := d.d
- cr := d.cr
-
- if checkNil && dd.TryDecodeAsNil() {
- if v != nil {
- changed = true
- }
- return nil, changed
- }
-
- containerLen := dd.ReadMapStart()
- if canChange && v == nil {
- xlen, _ := decInferLen(containerLen, d.h.MaxInitLen, 12)
- v = make(map[int32]uintptr, xlen)
- changed = true
- }
-
- var mk int32
- var mv uintptr
- if containerLen > 0 {
- for j := 0; j < containerLen; j++ {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- mk = int32(dd.DecodeInt(32))
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- mv = uintptr(dd.DecodeUint(uintBitsize))
- if v != nil {
- v[mk] = mv
- }
- }
- } else if containerLen < 0 {
- for j := 0; !dd.CheckBreak(); j++ {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- mk = int32(dd.DecodeInt(32))
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- mv = uintptr(dd.DecodeUint(uintBitsize))
- if v != nil {
- v[mk] = mv
- }
- }
- }
- if cr != nil {
- cr.sendContainerState(containerMapEnd)
- }
- return v, changed
-}
-
-func (f *decFnInfo) fastpathDecMapInt32IntR(rv reflect.Value) {
- if rv.CanAddr() {
- vp := rv.Addr().Interface().(*map[int32]int)
- v, changed := fastpathTV.DecMapInt32IntV(*vp, fastpathCheckNilFalse, true, f.d)
- if changed {
- *vp = v
- }
- } else {
- v := rv.Interface().(map[int32]int)
- fastpathTV.DecMapInt32IntV(v, fastpathCheckNilFalse, false, f.d)
- }
-}
-func (f fastpathT) DecMapInt32IntX(vp *map[int32]int, checkNil bool, d *Decoder) {
- v, changed := f.DecMapInt32IntV(*vp, checkNil, true, d)
- if changed {
- *vp = v
- }
-}
-func (_ fastpathT) DecMapInt32IntV(v map[int32]int, checkNil bool, canChange bool,
- d *Decoder) (_ map[int32]int, changed bool) {
- dd := d.d
- cr := d.cr
-
- if checkNil && dd.TryDecodeAsNil() {
- if v != nil {
- changed = true
- }
- return nil, changed
- }
-
- containerLen := dd.ReadMapStart()
- if canChange && v == nil {
- xlen, _ := decInferLen(containerLen, d.h.MaxInitLen, 12)
- v = make(map[int32]int, xlen)
- changed = true
- }
-
- var mk int32
- var mv int
- if containerLen > 0 {
- for j := 0; j < containerLen; j++ {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- mk = int32(dd.DecodeInt(32))
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- mv = int(dd.DecodeInt(intBitsize))
- if v != nil {
- v[mk] = mv
- }
- }
- } else if containerLen < 0 {
- for j := 0; !dd.CheckBreak(); j++ {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- mk = int32(dd.DecodeInt(32))
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- mv = int(dd.DecodeInt(intBitsize))
- if v != nil {
- v[mk] = mv
- }
- }
- }
- if cr != nil {
- cr.sendContainerState(containerMapEnd)
- }
- return v, changed
-}
-
-func (f *decFnInfo) fastpathDecMapInt32Int8R(rv reflect.Value) {
- if rv.CanAddr() {
- vp := rv.Addr().Interface().(*map[int32]int8)
- v, changed := fastpathTV.DecMapInt32Int8V(*vp, fastpathCheckNilFalse, true, f.d)
- if changed {
- *vp = v
- }
- } else {
- v := rv.Interface().(map[int32]int8)
- fastpathTV.DecMapInt32Int8V(v, fastpathCheckNilFalse, false, f.d)
- }
-}
-func (f fastpathT) DecMapInt32Int8X(vp *map[int32]int8, checkNil bool, d *Decoder) {
- v, changed := f.DecMapInt32Int8V(*vp, checkNil, true, d)
- if changed {
- *vp = v
- }
-}
-func (_ fastpathT) DecMapInt32Int8V(v map[int32]int8, checkNil bool, canChange bool,
- d *Decoder) (_ map[int32]int8, changed bool) {
- dd := d.d
- cr := d.cr
-
- if checkNil && dd.TryDecodeAsNil() {
- if v != nil {
- changed = true
- }
- return nil, changed
- }
-
- containerLen := dd.ReadMapStart()
- if canChange && v == nil {
- xlen, _ := decInferLen(containerLen, d.h.MaxInitLen, 5)
- v = make(map[int32]int8, xlen)
- changed = true
- }
-
- var mk int32
- var mv int8
- if containerLen > 0 {
- for j := 0; j < containerLen; j++ {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- mk = int32(dd.DecodeInt(32))
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- mv = int8(dd.DecodeInt(8))
- if v != nil {
- v[mk] = mv
- }
- }
- } else if containerLen < 0 {
- for j := 0; !dd.CheckBreak(); j++ {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- mk = int32(dd.DecodeInt(32))
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- mv = int8(dd.DecodeInt(8))
- if v != nil {
- v[mk] = mv
- }
- }
- }
- if cr != nil {
- cr.sendContainerState(containerMapEnd)
- }
- return v, changed
-}
-
-func (f *decFnInfo) fastpathDecMapInt32Int16R(rv reflect.Value) {
- if rv.CanAddr() {
- vp := rv.Addr().Interface().(*map[int32]int16)
- v, changed := fastpathTV.DecMapInt32Int16V(*vp, fastpathCheckNilFalse, true, f.d)
- if changed {
- *vp = v
- }
- } else {
- v := rv.Interface().(map[int32]int16)
- fastpathTV.DecMapInt32Int16V(v, fastpathCheckNilFalse, false, f.d)
- }
-}
-func (f fastpathT) DecMapInt32Int16X(vp *map[int32]int16, checkNil bool, d *Decoder) {
- v, changed := f.DecMapInt32Int16V(*vp, checkNil, true, d)
- if changed {
- *vp = v
- }
-}
-func (_ fastpathT) DecMapInt32Int16V(v map[int32]int16, checkNil bool, canChange bool,
- d *Decoder) (_ map[int32]int16, changed bool) {
- dd := d.d
- cr := d.cr
-
- if checkNil && dd.TryDecodeAsNil() {
- if v != nil {
- changed = true
- }
- return nil, changed
- }
-
- containerLen := dd.ReadMapStart()
- if canChange && v == nil {
- xlen, _ := decInferLen(containerLen, d.h.MaxInitLen, 6)
- v = make(map[int32]int16, xlen)
- changed = true
- }
-
- var mk int32
- var mv int16
- if containerLen > 0 {
- for j := 0; j < containerLen; j++ {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- mk = int32(dd.DecodeInt(32))
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- mv = int16(dd.DecodeInt(16))
- if v != nil {
- v[mk] = mv
- }
- }
- } else if containerLen < 0 {
- for j := 0; !dd.CheckBreak(); j++ {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- mk = int32(dd.DecodeInt(32))
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- mv = int16(dd.DecodeInt(16))
- if v != nil {
- v[mk] = mv
- }
- }
- }
- if cr != nil {
- cr.sendContainerState(containerMapEnd)
- }
- return v, changed
-}
-
-func (f *decFnInfo) fastpathDecMapInt32Int32R(rv reflect.Value) {
- if rv.CanAddr() {
- vp := rv.Addr().Interface().(*map[int32]int32)
- v, changed := fastpathTV.DecMapInt32Int32V(*vp, fastpathCheckNilFalse, true, f.d)
- if changed {
- *vp = v
- }
- } else {
- v := rv.Interface().(map[int32]int32)
- fastpathTV.DecMapInt32Int32V(v, fastpathCheckNilFalse, false, f.d)
- }
-}
-func (f fastpathT) DecMapInt32Int32X(vp *map[int32]int32, checkNil bool, d *Decoder) {
- v, changed := f.DecMapInt32Int32V(*vp, checkNil, true, d)
- if changed {
- *vp = v
- }
-}
-func (_ fastpathT) DecMapInt32Int32V(v map[int32]int32, checkNil bool, canChange bool,
- d *Decoder) (_ map[int32]int32, changed bool) {
- dd := d.d
- cr := d.cr
-
- if checkNil && dd.TryDecodeAsNil() {
- if v != nil {
- changed = true
- }
- return nil, changed
- }
-
- containerLen := dd.ReadMapStart()
- if canChange && v == nil {
- xlen, _ := decInferLen(containerLen, d.h.MaxInitLen, 8)
- v = make(map[int32]int32, xlen)
- changed = true
- }
-
- var mk int32
- var mv int32
- if containerLen > 0 {
- for j := 0; j < containerLen; j++ {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- mk = int32(dd.DecodeInt(32))
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- mv = int32(dd.DecodeInt(32))
- if v != nil {
- v[mk] = mv
- }
- }
- } else if containerLen < 0 {
- for j := 0; !dd.CheckBreak(); j++ {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- mk = int32(dd.DecodeInt(32))
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- mv = int32(dd.DecodeInt(32))
- if v != nil {
- v[mk] = mv
- }
- }
- }
- if cr != nil {
- cr.sendContainerState(containerMapEnd)
- }
- return v, changed
-}
-
-func (f *decFnInfo) fastpathDecMapInt32Int64R(rv reflect.Value) {
- if rv.CanAddr() {
- vp := rv.Addr().Interface().(*map[int32]int64)
- v, changed := fastpathTV.DecMapInt32Int64V(*vp, fastpathCheckNilFalse, true, f.d)
- if changed {
- *vp = v
- }
- } else {
- v := rv.Interface().(map[int32]int64)
- fastpathTV.DecMapInt32Int64V(v, fastpathCheckNilFalse, false, f.d)
- }
-}
-func (f fastpathT) DecMapInt32Int64X(vp *map[int32]int64, checkNil bool, d *Decoder) {
- v, changed := f.DecMapInt32Int64V(*vp, checkNil, true, d)
- if changed {
- *vp = v
- }
-}
-func (_ fastpathT) DecMapInt32Int64V(v map[int32]int64, checkNil bool, canChange bool,
- d *Decoder) (_ map[int32]int64, changed bool) {
- dd := d.d
- cr := d.cr
-
- if checkNil && dd.TryDecodeAsNil() {
- if v != nil {
- changed = true
- }
- return nil, changed
- }
-
- containerLen := dd.ReadMapStart()
- if canChange && v == nil {
- xlen, _ := decInferLen(containerLen, d.h.MaxInitLen, 12)
- v = make(map[int32]int64, xlen)
- changed = true
- }
-
- var mk int32
- var mv int64
- if containerLen > 0 {
- for j := 0; j < containerLen; j++ {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- mk = int32(dd.DecodeInt(32))
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- mv = dd.DecodeInt(64)
- if v != nil {
- v[mk] = mv
- }
- }
- } else if containerLen < 0 {
- for j := 0; !dd.CheckBreak(); j++ {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- mk = int32(dd.DecodeInt(32))
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- mv = dd.DecodeInt(64)
- if v != nil {
- v[mk] = mv
- }
- }
- }
- if cr != nil {
- cr.sendContainerState(containerMapEnd)
- }
- return v, changed
-}
-
-func (f *decFnInfo) fastpathDecMapInt32Float32R(rv reflect.Value) {
- if rv.CanAddr() {
- vp := rv.Addr().Interface().(*map[int32]float32)
- v, changed := fastpathTV.DecMapInt32Float32V(*vp, fastpathCheckNilFalse, true, f.d)
- if changed {
- *vp = v
- }
- } else {
- v := rv.Interface().(map[int32]float32)
- fastpathTV.DecMapInt32Float32V(v, fastpathCheckNilFalse, false, f.d)
- }
-}
-func (f fastpathT) DecMapInt32Float32X(vp *map[int32]float32, checkNil bool, d *Decoder) {
- v, changed := f.DecMapInt32Float32V(*vp, checkNil, true, d)
- if changed {
- *vp = v
- }
-}
-func (_ fastpathT) DecMapInt32Float32V(v map[int32]float32, checkNil bool, canChange bool,
- d *Decoder) (_ map[int32]float32, changed bool) {
- dd := d.d
- cr := d.cr
-
- if checkNil && dd.TryDecodeAsNil() {
- if v != nil {
- changed = true
- }
- return nil, changed
- }
-
- containerLen := dd.ReadMapStart()
- if canChange && v == nil {
- xlen, _ := decInferLen(containerLen, d.h.MaxInitLen, 8)
- v = make(map[int32]float32, xlen)
- changed = true
- }
-
- var mk int32
- var mv float32
- if containerLen > 0 {
- for j := 0; j < containerLen; j++ {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- mk = int32(dd.DecodeInt(32))
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- mv = float32(dd.DecodeFloat(true))
- if v != nil {
- v[mk] = mv
- }
- }
- } else if containerLen < 0 {
- for j := 0; !dd.CheckBreak(); j++ {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- mk = int32(dd.DecodeInt(32))
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- mv = float32(dd.DecodeFloat(true))
- if v != nil {
- v[mk] = mv
- }
- }
- }
- if cr != nil {
- cr.sendContainerState(containerMapEnd)
- }
- return v, changed
-}
-
-func (f *decFnInfo) fastpathDecMapInt32Float64R(rv reflect.Value) {
- if rv.CanAddr() {
- vp := rv.Addr().Interface().(*map[int32]float64)
- v, changed := fastpathTV.DecMapInt32Float64V(*vp, fastpathCheckNilFalse, true, f.d)
- if changed {
- *vp = v
- }
- } else {
- v := rv.Interface().(map[int32]float64)
- fastpathTV.DecMapInt32Float64V(v, fastpathCheckNilFalse, false, f.d)
- }
-}
-func (f fastpathT) DecMapInt32Float64X(vp *map[int32]float64, checkNil bool, d *Decoder) {
- v, changed := f.DecMapInt32Float64V(*vp, checkNil, true, d)
- if changed {
- *vp = v
- }
-}
-func (_ fastpathT) DecMapInt32Float64V(v map[int32]float64, checkNil bool, canChange bool,
- d *Decoder) (_ map[int32]float64, changed bool) {
- dd := d.d
- cr := d.cr
-
- if checkNil && dd.TryDecodeAsNil() {
- if v != nil {
- changed = true
- }
- return nil, changed
- }
-
- containerLen := dd.ReadMapStart()
- if canChange && v == nil {
- xlen, _ := decInferLen(containerLen, d.h.MaxInitLen, 12)
- v = make(map[int32]float64, xlen)
- changed = true
- }
-
- var mk int32
- var mv float64
- if containerLen > 0 {
- for j := 0; j < containerLen; j++ {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- mk = int32(dd.DecodeInt(32))
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- mv = dd.DecodeFloat(false)
- if v != nil {
- v[mk] = mv
- }
- }
- } else if containerLen < 0 {
- for j := 0; !dd.CheckBreak(); j++ {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- mk = int32(dd.DecodeInt(32))
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- mv = dd.DecodeFloat(false)
- if v != nil {
- v[mk] = mv
- }
- }
- }
- if cr != nil {
- cr.sendContainerState(containerMapEnd)
- }
- return v, changed
-}
-
-func (f *decFnInfo) fastpathDecMapInt32BoolR(rv reflect.Value) {
- if rv.CanAddr() {
- vp := rv.Addr().Interface().(*map[int32]bool)
- v, changed := fastpathTV.DecMapInt32BoolV(*vp, fastpathCheckNilFalse, true, f.d)
- if changed {
- *vp = v
- }
- } else {
- v := rv.Interface().(map[int32]bool)
- fastpathTV.DecMapInt32BoolV(v, fastpathCheckNilFalse, false, f.d)
- }
-}
-func (f fastpathT) DecMapInt32BoolX(vp *map[int32]bool, checkNil bool, d *Decoder) {
- v, changed := f.DecMapInt32BoolV(*vp, checkNil, true, d)
- if changed {
- *vp = v
- }
-}
-func (_ fastpathT) DecMapInt32BoolV(v map[int32]bool, checkNil bool, canChange bool,
- d *Decoder) (_ map[int32]bool, changed bool) {
- dd := d.d
- cr := d.cr
-
- if checkNil && dd.TryDecodeAsNil() {
- if v != nil {
- changed = true
- }
- return nil, changed
- }
-
- containerLen := dd.ReadMapStart()
- if canChange && v == nil {
- xlen, _ := decInferLen(containerLen, d.h.MaxInitLen, 5)
- v = make(map[int32]bool, xlen)
- changed = true
- }
-
- var mk int32
- var mv bool
- if containerLen > 0 {
- for j := 0; j < containerLen; j++ {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- mk = int32(dd.DecodeInt(32))
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- mv = dd.DecodeBool()
- if v != nil {
- v[mk] = mv
- }
- }
- } else if containerLen < 0 {
- for j := 0; !dd.CheckBreak(); j++ {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- mk = int32(dd.DecodeInt(32))
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- mv = dd.DecodeBool()
- if v != nil {
- v[mk] = mv
- }
- }
- }
- if cr != nil {
- cr.sendContainerState(containerMapEnd)
- }
- return v, changed
-}
-
-func (f *decFnInfo) fastpathDecMapInt64IntfR(rv reflect.Value) {
- if rv.CanAddr() {
- vp := rv.Addr().Interface().(*map[int64]interface{})
- v, changed := fastpathTV.DecMapInt64IntfV(*vp, fastpathCheckNilFalse, true, f.d)
- if changed {
- *vp = v
- }
- } else {
- v := rv.Interface().(map[int64]interface{})
- fastpathTV.DecMapInt64IntfV(v, fastpathCheckNilFalse, false, f.d)
- }
-}
-func (f fastpathT) DecMapInt64IntfX(vp *map[int64]interface{}, checkNil bool, d *Decoder) {
- v, changed := f.DecMapInt64IntfV(*vp, checkNil, true, d)
- if changed {
- *vp = v
- }
-}
-func (_ fastpathT) DecMapInt64IntfV(v map[int64]interface{}, checkNil bool, canChange bool,
- d *Decoder) (_ map[int64]interface{}, changed bool) {
- dd := d.d
- cr := d.cr
-
- if checkNil && dd.TryDecodeAsNil() {
- if v != nil {
- changed = true
- }
- return nil, changed
- }
-
- containerLen := dd.ReadMapStart()
- if canChange && v == nil {
- xlen, _ := decInferLen(containerLen, d.h.MaxInitLen, 24)
- v = make(map[int64]interface{}, xlen)
- changed = true
- }
- mapGet := !d.h.MapValueReset && !d.h.InterfaceReset
- var mk int64
- var mv interface{}
- if containerLen > 0 {
- for j := 0; j < containerLen; j++ {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- mk = dd.DecodeInt(64)
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- if mapGet {
- mv = v[mk]
- } else {
- mv = nil
- }
- d.decode(&mv)
- if v != nil {
- v[mk] = mv
- }
- }
- } else if containerLen < 0 {
- for j := 0; !dd.CheckBreak(); j++ {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- mk = dd.DecodeInt(64)
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- if mapGet {
- mv = v[mk]
- } else {
- mv = nil
- }
- d.decode(&mv)
- if v != nil {
- v[mk] = mv
- }
- }
- }
- if cr != nil {
- cr.sendContainerState(containerMapEnd)
- }
- return v, changed
-}
-
-func (f *decFnInfo) fastpathDecMapInt64StringR(rv reflect.Value) {
- if rv.CanAddr() {
- vp := rv.Addr().Interface().(*map[int64]string)
- v, changed := fastpathTV.DecMapInt64StringV(*vp, fastpathCheckNilFalse, true, f.d)
- if changed {
- *vp = v
- }
- } else {
- v := rv.Interface().(map[int64]string)
- fastpathTV.DecMapInt64StringV(v, fastpathCheckNilFalse, false, f.d)
- }
-}
-func (f fastpathT) DecMapInt64StringX(vp *map[int64]string, checkNil bool, d *Decoder) {
- v, changed := f.DecMapInt64StringV(*vp, checkNil, true, d)
- if changed {
- *vp = v
- }
-}
-func (_ fastpathT) DecMapInt64StringV(v map[int64]string, checkNil bool, canChange bool,
- d *Decoder) (_ map[int64]string, changed bool) {
- dd := d.d
- cr := d.cr
-
- if checkNil && dd.TryDecodeAsNil() {
- if v != nil {
- changed = true
- }
- return nil, changed
- }
-
- containerLen := dd.ReadMapStart()
- if canChange && v == nil {
- xlen, _ := decInferLen(containerLen, d.h.MaxInitLen, 24)
- v = make(map[int64]string, xlen)
- changed = true
- }
-
- var mk int64
- var mv string
- if containerLen > 0 {
- for j := 0; j < containerLen; j++ {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- mk = dd.DecodeInt(64)
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- mv = dd.DecodeString()
- if v != nil {
- v[mk] = mv
- }
- }
- } else if containerLen < 0 {
- for j := 0; !dd.CheckBreak(); j++ {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- mk = dd.DecodeInt(64)
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- mv = dd.DecodeString()
- if v != nil {
- v[mk] = mv
- }
- }
- }
- if cr != nil {
- cr.sendContainerState(containerMapEnd)
- }
- return v, changed
-}
-
-func (f *decFnInfo) fastpathDecMapInt64UintR(rv reflect.Value) {
- if rv.CanAddr() {
- vp := rv.Addr().Interface().(*map[int64]uint)
- v, changed := fastpathTV.DecMapInt64UintV(*vp, fastpathCheckNilFalse, true, f.d)
- if changed {
- *vp = v
- }
- } else {
- v := rv.Interface().(map[int64]uint)
- fastpathTV.DecMapInt64UintV(v, fastpathCheckNilFalse, false, f.d)
- }
-}
-func (f fastpathT) DecMapInt64UintX(vp *map[int64]uint, checkNil bool, d *Decoder) {
- v, changed := f.DecMapInt64UintV(*vp, checkNil, true, d)
- if changed {
- *vp = v
- }
-}
-func (_ fastpathT) DecMapInt64UintV(v map[int64]uint, checkNil bool, canChange bool,
- d *Decoder) (_ map[int64]uint, changed bool) {
- dd := d.d
- cr := d.cr
-
- if checkNil && dd.TryDecodeAsNil() {
- if v != nil {
- changed = true
- }
- return nil, changed
- }
-
- containerLen := dd.ReadMapStart()
- if canChange && v == nil {
- xlen, _ := decInferLen(containerLen, d.h.MaxInitLen, 16)
- v = make(map[int64]uint, xlen)
- changed = true
- }
-
- var mk int64
- var mv uint
- if containerLen > 0 {
- for j := 0; j < containerLen; j++ {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- mk = dd.DecodeInt(64)
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- mv = uint(dd.DecodeUint(uintBitsize))
- if v != nil {
- v[mk] = mv
- }
- }
- } else if containerLen < 0 {
- for j := 0; !dd.CheckBreak(); j++ {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- mk = dd.DecodeInt(64)
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- mv = uint(dd.DecodeUint(uintBitsize))
- if v != nil {
- v[mk] = mv
- }
- }
- }
- if cr != nil {
- cr.sendContainerState(containerMapEnd)
- }
- return v, changed
-}
-
-func (f *decFnInfo) fastpathDecMapInt64Uint8R(rv reflect.Value) {
- if rv.CanAddr() {
- vp := rv.Addr().Interface().(*map[int64]uint8)
- v, changed := fastpathTV.DecMapInt64Uint8V(*vp, fastpathCheckNilFalse, true, f.d)
- if changed {
- *vp = v
- }
- } else {
- v := rv.Interface().(map[int64]uint8)
- fastpathTV.DecMapInt64Uint8V(v, fastpathCheckNilFalse, false, f.d)
- }
-}
-func (f fastpathT) DecMapInt64Uint8X(vp *map[int64]uint8, checkNil bool, d *Decoder) {
- v, changed := f.DecMapInt64Uint8V(*vp, checkNil, true, d)
- if changed {
- *vp = v
- }
-}
-func (_ fastpathT) DecMapInt64Uint8V(v map[int64]uint8, checkNil bool, canChange bool,
- d *Decoder) (_ map[int64]uint8, changed bool) {
- dd := d.d
- cr := d.cr
-
- if checkNil && dd.TryDecodeAsNil() {
- if v != nil {
- changed = true
- }
- return nil, changed
- }
-
- containerLen := dd.ReadMapStart()
- if canChange && v == nil {
- xlen, _ := decInferLen(containerLen, d.h.MaxInitLen, 9)
- v = make(map[int64]uint8, xlen)
- changed = true
- }
-
- var mk int64
- var mv uint8
- if containerLen > 0 {
- for j := 0; j < containerLen; j++ {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- mk = dd.DecodeInt(64)
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- mv = uint8(dd.DecodeUint(8))
- if v != nil {
- v[mk] = mv
- }
- }
- } else if containerLen < 0 {
- for j := 0; !dd.CheckBreak(); j++ {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- mk = dd.DecodeInt(64)
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- mv = uint8(dd.DecodeUint(8))
- if v != nil {
- v[mk] = mv
- }
- }
- }
- if cr != nil {
- cr.sendContainerState(containerMapEnd)
- }
- return v, changed
-}
-
-func (f *decFnInfo) fastpathDecMapInt64Uint16R(rv reflect.Value) {
- if rv.CanAddr() {
- vp := rv.Addr().Interface().(*map[int64]uint16)
- v, changed := fastpathTV.DecMapInt64Uint16V(*vp, fastpathCheckNilFalse, true, f.d)
- if changed {
- *vp = v
- }
- } else {
- v := rv.Interface().(map[int64]uint16)
- fastpathTV.DecMapInt64Uint16V(v, fastpathCheckNilFalse, false, f.d)
- }
-}
-func (f fastpathT) DecMapInt64Uint16X(vp *map[int64]uint16, checkNil bool, d *Decoder) {
- v, changed := f.DecMapInt64Uint16V(*vp, checkNil, true, d)
- if changed {
- *vp = v
- }
-}
-func (_ fastpathT) DecMapInt64Uint16V(v map[int64]uint16, checkNil bool, canChange bool,
- d *Decoder) (_ map[int64]uint16, changed bool) {
- dd := d.d
- cr := d.cr
-
- if checkNil && dd.TryDecodeAsNil() {
- if v != nil {
- changed = true
- }
- return nil, changed
- }
-
- containerLen := dd.ReadMapStart()
- if canChange && v == nil {
- xlen, _ := decInferLen(containerLen, d.h.MaxInitLen, 10)
- v = make(map[int64]uint16, xlen)
- changed = true
- }
-
- var mk int64
- var mv uint16
- if containerLen > 0 {
- for j := 0; j < containerLen; j++ {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- mk = dd.DecodeInt(64)
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- mv = uint16(dd.DecodeUint(16))
- if v != nil {
- v[mk] = mv
- }
- }
- } else if containerLen < 0 {
- for j := 0; !dd.CheckBreak(); j++ {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- mk = dd.DecodeInt(64)
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- mv = uint16(dd.DecodeUint(16))
- if v != nil {
- v[mk] = mv
- }
- }
- }
- if cr != nil {
- cr.sendContainerState(containerMapEnd)
- }
- return v, changed
-}
-
-func (f *decFnInfo) fastpathDecMapInt64Uint32R(rv reflect.Value) {
- if rv.CanAddr() {
- vp := rv.Addr().Interface().(*map[int64]uint32)
- v, changed := fastpathTV.DecMapInt64Uint32V(*vp, fastpathCheckNilFalse, true, f.d)
- if changed {
- *vp = v
- }
- } else {
- v := rv.Interface().(map[int64]uint32)
- fastpathTV.DecMapInt64Uint32V(v, fastpathCheckNilFalse, false, f.d)
- }
-}
-func (f fastpathT) DecMapInt64Uint32X(vp *map[int64]uint32, checkNil bool, d *Decoder) {
- v, changed := f.DecMapInt64Uint32V(*vp, checkNil, true, d)
- if changed {
- *vp = v
- }
-}
-func (_ fastpathT) DecMapInt64Uint32V(v map[int64]uint32, checkNil bool, canChange bool,
- d *Decoder) (_ map[int64]uint32, changed bool) {
- dd := d.d
- cr := d.cr
-
- if checkNil && dd.TryDecodeAsNil() {
- if v != nil {
- changed = true
- }
- return nil, changed
- }
-
- containerLen := dd.ReadMapStart()
- if canChange && v == nil {
- xlen, _ := decInferLen(containerLen, d.h.MaxInitLen, 12)
- v = make(map[int64]uint32, xlen)
- changed = true
- }
-
- var mk int64
- var mv uint32
- if containerLen > 0 {
- for j := 0; j < containerLen; j++ {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- mk = dd.DecodeInt(64)
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- mv = uint32(dd.DecodeUint(32))
- if v != nil {
- v[mk] = mv
- }
- }
- } else if containerLen < 0 {
- for j := 0; !dd.CheckBreak(); j++ {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- mk = dd.DecodeInt(64)
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- mv = uint32(dd.DecodeUint(32))
- if v != nil {
- v[mk] = mv
- }
- }
- }
- if cr != nil {
- cr.sendContainerState(containerMapEnd)
- }
- return v, changed
-}
-
-func (f *decFnInfo) fastpathDecMapInt64Uint64R(rv reflect.Value) {
- if rv.CanAddr() {
- vp := rv.Addr().Interface().(*map[int64]uint64)
- v, changed := fastpathTV.DecMapInt64Uint64V(*vp, fastpathCheckNilFalse, true, f.d)
- if changed {
- *vp = v
- }
- } else {
- v := rv.Interface().(map[int64]uint64)
- fastpathTV.DecMapInt64Uint64V(v, fastpathCheckNilFalse, false, f.d)
- }
-}
-func (f fastpathT) DecMapInt64Uint64X(vp *map[int64]uint64, checkNil bool, d *Decoder) {
- v, changed := f.DecMapInt64Uint64V(*vp, checkNil, true, d)
- if changed {
- *vp = v
- }
-}
-func (_ fastpathT) DecMapInt64Uint64V(v map[int64]uint64, checkNil bool, canChange bool,
- d *Decoder) (_ map[int64]uint64, changed bool) {
- dd := d.d
- cr := d.cr
-
- if checkNil && dd.TryDecodeAsNil() {
- if v != nil {
- changed = true
- }
- return nil, changed
- }
-
- containerLen := dd.ReadMapStart()
- if canChange && v == nil {
- xlen, _ := decInferLen(containerLen, d.h.MaxInitLen, 16)
- v = make(map[int64]uint64, xlen)
- changed = true
- }
-
- var mk int64
- var mv uint64
- if containerLen > 0 {
- for j := 0; j < containerLen; j++ {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- mk = dd.DecodeInt(64)
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- mv = dd.DecodeUint(64)
- if v != nil {
- v[mk] = mv
- }
- }
- } else if containerLen < 0 {
- for j := 0; !dd.CheckBreak(); j++ {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- mk = dd.DecodeInt(64)
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- mv = dd.DecodeUint(64)
- if v != nil {
- v[mk] = mv
- }
- }
- }
- if cr != nil {
- cr.sendContainerState(containerMapEnd)
- }
- return v, changed
-}
-
-func (f *decFnInfo) fastpathDecMapInt64UintptrR(rv reflect.Value) {
- if rv.CanAddr() {
- vp := rv.Addr().Interface().(*map[int64]uintptr)
- v, changed := fastpathTV.DecMapInt64UintptrV(*vp, fastpathCheckNilFalse, true, f.d)
- if changed {
- *vp = v
- }
- } else {
- v := rv.Interface().(map[int64]uintptr)
- fastpathTV.DecMapInt64UintptrV(v, fastpathCheckNilFalse, false, f.d)
- }
-}
-func (f fastpathT) DecMapInt64UintptrX(vp *map[int64]uintptr, checkNil bool, d *Decoder) {
- v, changed := f.DecMapInt64UintptrV(*vp, checkNil, true, d)
- if changed {
- *vp = v
- }
-}
-func (_ fastpathT) DecMapInt64UintptrV(v map[int64]uintptr, checkNil bool, canChange bool,
- d *Decoder) (_ map[int64]uintptr, changed bool) {
- dd := d.d
- cr := d.cr
-
- if checkNil && dd.TryDecodeAsNil() {
- if v != nil {
- changed = true
- }
- return nil, changed
- }
-
- containerLen := dd.ReadMapStart()
- if canChange && v == nil {
- xlen, _ := decInferLen(containerLen, d.h.MaxInitLen, 16)
- v = make(map[int64]uintptr, xlen)
- changed = true
- }
-
- var mk int64
- var mv uintptr
- if containerLen > 0 {
- for j := 0; j < containerLen; j++ {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- mk = dd.DecodeInt(64)
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- mv = uintptr(dd.DecodeUint(uintBitsize))
- if v != nil {
- v[mk] = mv
- }
- }
- } else if containerLen < 0 {
- for j := 0; !dd.CheckBreak(); j++ {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- mk = dd.DecodeInt(64)
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- mv = uintptr(dd.DecodeUint(uintBitsize))
- if v != nil {
- v[mk] = mv
- }
- }
- }
- if cr != nil {
- cr.sendContainerState(containerMapEnd)
- }
- return v, changed
-}
-
-func (f *decFnInfo) fastpathDecMapInt64IntR(rv reflect.Value) {
- if rv.CanAddr() {
- vp := rv.Addr().Interface().(*map[int64]int)
- v, changed := fastpathTV.DecMapInt64IntV(*vp, fastpathCheckNilFalse, true, f.d)
- if changed {
- *vp = v
- }
- } else {
- v := rv.Interface().(map[int64]int)
- fastpathTV.DecMapInt64IntV(v, fastpathCheckNilFalse, false, f.d)
- }
-}
-func (f fastpathT) DecMapInt64IntX(vp *map[int64]int, checkNil bool, d *Decoder) {
- v, changed := f.DecMapInt64IntV(*vp, checkNil, true, d)
- if changed {
- *vp = v
- }
-}
-func (_ fastpathT) DecMapInt64IntV(v map[int64]int, checkNil bool, canChange bool,
- d *Decoder) (_ map[int64]int, changed bool) {
- dd := d.d
- cr := d.cr
-
- if checkNil && dd.TryDecodeAsNil() {
- if v != nil {
- changed = true
- }
- return nil, changed
- }
-
- containerLen := dd.ReadMapStart()
- if canChange && v == nil {
- xlen, _ := decInferLen(containerLen, d.h.MaxInitLen, 16)
- v = make(map[int64]int, xlen)
- changed = true
- }
-
- var mk int64
- var mv int
- if containerLen > 0 {
- for j := 0; j < containerLen; j++ {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- mk = dd.DecodeInt(64)
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- mv = int(dd.DecodeInt(intBitsize))
- if v != nil {
- v[mk] = mv
- }
- }
- } else if containerLen < 0 {
- for j := 0; !dd.CheckBreak(); j++ {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- mk = dd.DecodeInt(64)
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- mv = int(dd.DecodeInt(intBitsize))
- if v != nil {
- v[mk] = mv
- }
- }
- }
- if cr != nil {
- cr.sendContainerState(containerMapEnd)
- }
- return v, changed
-}
-
-func (f *decFnInfo) fastpathDecMapInt64Int8R(rv reflect.Value) {
- if rv.CanAddr() {
- vp := rv.Addr().Interface().(*map[int64]int8)
- v, changed := fastpathTV.DecMapInt64Int8V(*vp, fastpathCheckNilFalse, true, f.d)
- if changed {
- *vp = v
- }
- } else {
- v := rv.Interface().(map[int64]int8)
- fastpathTV.DecMapInt64Int8V(v, fastpathCheckNilFalse, false, f.d)
- }
-}
-func (f fastpathT) DecMapInt64Int8X(vp *map[int64]int8, checkNil bool, d *Decoder) {
- v, changed := f.DecMapInt64Int8V(*vp, checkNil, true, d)
- if changed {
- *vp = v
- }
-}
-func (_ fastpathT) DecMapInt64Int8V(v map[int64]int8, checkNil bool, canChange bool,
- d *Decoder) (_ map[int64]int8, changed bool) {
- dd := d.d
- cr := d.cr
-
- if checkNil && dd.TryDecodeAsNil() {
- if v != nil {
- changed = true
- }
- return nil, changed
- }
-
- containerLen := dd.ReadMapStart()
- if canChange && v == nil {
- xlen, _ := decInferLen(containerLen, d.h.MaxInitLen, 9)
- v = make(map[int64]int8, xlen)
- changed = true
- }
-
- var mk int64
- var mv int8
- if containerLen > 0 {
- for j := 0; j < containerLen; j++ {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- mk = dd.DecodeInt(64)
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- mv = int8(dd.DecodeInt(8))
- if v != nil {
- v[mk] = mv
- }
- }
- } else if containerLen < 0 {
- for j := 0; !dd.CheckBreak(); j++ {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- mk = dd.DecodeInt(64)
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- mv = int8(dd.DecodeInt(8))
- if v != nil {
- v[mk] = mv
- }
- }
- }
- if cr != nil {
- cr.sendContainerState(containerMapEnd)
- }
- return v, changed
-}
-
-func (f *decFnInfo) fastpathDecMapInt64Int16R(rv reflect.Value) {
- if rv.CanAddr() {
- vp := rv.Addr().Interface().(*map[int64]int16)
- v, changed := fastpathTV.DecMapInt64Int16V(*vp, fastpathCheckNilFalse, true, f.d)
- if changed {
- *vp = v
- }
- } else {
- v := rv.Interface().(map[int64]int16)
- fastpathTV.DecMapInt64Int16V(v, fastpathCheckNilFalse, false, f.d)
- }
-}
-func (f fastpathT) DecMapInt64Int16X(vp *map[int64]int16, checkNil bool, d *Decoder) {
- v, changed := f.DecMapInt64Int16V(*vp, checkNil, true, d)
- if changed {
- *vp = v
- }
-}
-func (_ fastpathT) DecMapInt64Int16V(v map[int64]int16, checkNil bool, canChange bool,
- d *Decoder) (_ map[int64]int16, changed bool) {
- dd := d.d
- cr := d.cr
-
- if checkNil && dd.TryDecodeAsNil() {
- if v != nil {
- changed = true
- }
- return nil, changed
- }
-
- containerLen := dd.ReadMapStart()
- if canChange && v == nil {
- xlen, _ := decInferLen(containerLen, d.h.MaxInitLen, 10)
- v = make(map[int64]int16, xlen)
- changed = true
- }
-
- var mk int64
- var mv int16
- if containerLen > 0 {
- for j := 0; j < containerLen; j++ {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- mk = dd.DecodeInt(64)
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- mv = int16(dd.DecodeInt(16))
- if v != nil {
- v[mk] = mv
- }
- }
- } else if containerLen < 0 {
- for j := 0; !dd.CheckBreak(); j++ {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- mk = dd.DecodeInt(64)
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- mv = int16(dd.DecodeInt(16))
- if v != nil {
- v[mk] = mv
- }
- }
- }
- if cr != nil {
- cr.sendContainerState(containerMapEnd)
- }
- return v, changed
-}
-
-func (f *decFnInfo) fastpathDecMapInt64Int32R(rv reflect.Value) {
- if rv.CanAddr() {
- vp := rv.Addr().Interface().(*map[int64]int32)
- v, changed := fastpathTV.DecMapInt64Int32V(*vp, fastpathCheckNilFalse, true, f.d)
- if changed {
- *vp = v
- }
- } else {
- v := rv.Interface().(map[int64]int32)
- fastpathTV.DecMapInt64Int32V(v, fastpathCheckNilFalse, false, f.d)
- }
-}
-func (f fastpathT) DecMapInt64Int32X(vp *map[int64]int32, checkNil bool, d *Decoder) {
- v, changed := f.DecMapInt64Int32V(*vp, checkNil, true, d)
- if changed {
- *vp = v
- }
-}
-func (_ fastpathT) DecMapInt64Int32V(v map[int64]int32, checkNil bool, canChange bool,
- d *Decoder) (_ map[int64]int32, changed bool) {
- dd := d.d
- cr := d.cr
-
- if checkNil && dd.TryDecodeAsNil() {
- if v != nil {
- changed = true
- }
- return nil, changed
- }
-
- containerLen := dd.ReadMapStart()
- if canChange && v == nil {
- xlen, _ := decInferLen(containerLen, d.h.MaxInitLen, 12)
- v = make(map[int64]int32, xlen)
- changed = true
- }
-
- var mk int64
- var mv int32
- if containerLen > 0 {
- for j := 0; j < containerLen; j++ {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- mk = dd.DecodeInt(64)
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- mv = int32(dd.DecodeInt(32))
- if v != nil {
- v[mk] = mv
- }
- }
- } else if containerLen < 0 {
- for j := 0; !dd.CheckBreak(); j++ {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- mk = dd.DecodeInt(64)
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- mv = int32(dd.DecodeInt(32))
- if v != nil {
- v[mk] = mv
- }
- }
- }
- if cr != nil {
- cr.sendContainerState(containerMapEnd)
- }
- return v, changed
-}
-
-func (f *decFnInfo) fastpathDecMapInt64Int64R(rv reflect.Value) {
- if rv.CanAddr() {
- vp := rv.Addr().Interface().(*map[int64]int64)
- v, changed := fastpathTV.DecMapInt64Int64V(*vp, fastpathCheckNilFalse, true, f.d)
- if changed {
- *vp = v
- }
- } else {
- v := rv.Interface().(map[int64]int64)
- fastpathTV.DecMapInt64Int64V(v, fastpathCheckNilFalse, false, f.d)
- }
-}
-func (f fastpathT) DecMapInt64Int64X(vp *map[int64]int64, checkNil bool, d *Decoder) {
- v, changed := f.DecMapInt64Int64V(*vp, checkNil, true, d)
- if changed {
- *vp = v
- }
-}
-func (_ fastpathT) DecMapInt64Int64V(v map[int64]int64, checkNil bool, canChange bool,
- d *Decoder) (_ map[int64]int64, changed bool) {
- dd := d.d
- cr := d.cr
-
- if checkNil && dd.TryDecodeAsNil() {
- if v != nil {
- changed = true
- }
- return nil, changed
- }
-
- containerLen := dd.ReadMapStart()
- if canChange && v == nil {
- xlen, _ := decInferLen(containerLen, d.h.MaxInitLen, 16)
- v = make(map[int64]int64, xlen)
- changed = true
- }
-
- var mk int64
- var mv int64
- if containerLen > 0 {
- for j := 0; j < containerLen; j++ {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- mk = dd.DecodeInt(64)
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- mv = dd.DecodeInt(64)
- if v != nil {
- v[mk] = mv
- }
- }
- } else if containerLen < 0 {
- for j := 0; !dd.CheckBreak(); j++ {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- mk = dd.DecodeInt(64)
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- mv = dd.DecodeInt(64)
- if v != nil {
- v[mk] = mv
- }
- }
- }
- if cr != nil {
- cr.sendContainerState(containerMapEnd)
- }
- return v, changed
-}
-
-func (f *decFnInfo) fastpathDecMapInt64Float32R(rv reflect.Value) {
- if rv.CanAddr() {
- vp := rv.Addr().Interface().(*map[int64]float32)
- v, changed := fastpathTV.DecMapInt64Float32V(*vp, fastpathCheckNilFalse, true, f.d)
- if changed {
- *vp = v
- }
- } else {
- v := rv.Interface().(map[int64]float32)
- fastpathTV.DecMapInt64Float32V(v, fastpathCheckNilFalse, false, f.d)
- }
-}
-func (f fastpathT) DecMapInt64Float32X(vp *map[int64]float32, checkNil bool, d *Decoder) {
- v, changed := f.DecMapInt64Float32V(*vp, checkNil, true, d)
- if changed {
- *vp = v
- }
-}
-func (_ fastpathT) DecMapInt64Float32V(v map[int64]float32, checkNil bool, canChange bool,
- d *Decoder) (_ map[int64]float32, changed bool) {
- dd := d.d
- cr := d.cr
-
- if checkNil && dd.TryDecodeAsNil() {
- if v != nil {
- changed = true
- }
- return nil, changed
- }
-
- containerLen := dd.ReadMapStart()
- if canChange && v == nil {
- xlen, _ := decInferLen(containerLen, d.h.MaxInitLen, 12)
- v = make(map[int64]float32, xlen)
- changed = true
- }
-
- var mk int64
- var mv float32
- if containerLen > 0 {
- for j := 0; j < containerLen; j++ {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- mk = dd.DecodeInt(64)
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- mv = float32(dd.DecodeFloat(true))
- if v != nil {
- v[mk] = mv
- }
- }
- } else if containerLen < 0 {
- for j := 0; !dd.CheckBreak(); j++ {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- mk = dd.DecodeInt(64)
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- mv = float32(dd.DecodeFloat(true))
- if v != nil {
- v[mk] = mv
- }
- }
- }
- if cr != nil {
- cr.sendContainerState(containerMapEnd)
- }
- return v, changed
-}
-
-func (f *decFnInfo) fastpathDecMapInt64Float64R(rv reflect.Value) {
- if rv.CanAddr() {
- vp := rv.Addr().Interface().(*map[int64]float64)
- v, changed := fastpathTV.DecMapInt64Float64V(*vp, fastpathCheckNilFalse, true, f.d)
- if changed {
- *vp = v
- }
- } else {
- v := rv.Interface().(map[int64]float64)
- fastpathTV.DecMapInt64Float64V(v, fastpathCheckNilFalse, false, f.d)
- }
-}
-func (f fastpathT) DecMapInt64Float64X(vp *map[int64]float64, checkNil bool, d *Decoder) {
- v, changed := f.DecMapInt64Float64V(*vp, checkNil, true, d)
- if changed {
- *vp = v
- }
-}
-func (_ fastpathT) DecMapInt64Float64V(v map[int64]float64, checkNil bool, canChange bool,
- d *Decoder) (_ map[int64]float64, changed bool) {
- dd := d.d
- cr := d.cr
-
- if checkNil && dd.TryDecodeAsNil() {
- if v != nil {
- changed = true
- }
- return nil, changed
- }
-
- containerLen := dd.ReadMapStart()
- if canChange && v == nil {
- xlen, _ := decInferLen(containerLen, d.h.MaxInitLen, 16)
- v = make(map[int64]float64, xlen)
- changed = true
- }
-
- var mk int64
- var mv float64
- if containerLen > 0 {
- for j := 0; j < containerLen; j++ {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- mk = dd.DecodeInt(64)
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- mv = dd.DecodeFloat(false)
- if v != nil {
- v[mk] = mv
- }
- }
- } else if containerLen < 0 {
- for j := 0; !dd.CheckBreak(); j++ {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- mk = dd.DecodeInt(64)
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- mv = dd.DecodeFloat(false)
- if v != nil {
- v[mk] = mv
- }
- }
- }
- if cr != nil {
- cr.sendContainerState(containerMapEnd)
- }
- return v, changed
-}
-
-func (f *decFnInfo) fastpathDecMapInt64BoolR(rv reflect.Value) {
- if rv.CanAddr() {
- vp := rv.Addr().Interface().(*map[int64]bool)
- v, changed := fastpathTV.DecMapInt64BoolV(*vp, fastpathCheckNilFalse, true, f.d)
- if changed {
- *vp = v
- }
- } else {
- v := rv.Interface().(map[int64]bool)
- fastpathTV.DecMapInt64BoolV(v, fastpathCheckNilFalse, false, f.d)
- }
-}
-func (f fastpathT) DecMapInt64BoolX(vp *map[int64]bool, checkNil bool, d *Decoder) {
- v, changed := f.DecMapInt64BoolV(*vp, checkNil, true, d)
- if changed {
- *vp = v
- }
-}
-func (_ fastpathT) DecMapInt64BoolV(v map[int64]bool, checkNil bool, canChange bool,
- d *Decoder) (_ map[int64]bool, changed bool) {
- dd := d.d
- cr := d.cr
-
- if checkNil && dd.TryDecodeAsNil() {
- if v != nil {
- changed = true
- }
- return nil, changed
- }
-
- containerLen := dd.ReadMapStart()
- if canChange && v == nil {
- xlen, _ := decInferLen(containerLen, d.h.MaxInitLen, 9)
- v = make(map[int64]bool, xlen)
- changed = true
- }
-
- var mk int64
- var mv bool
- if containerLen > 0 {
- for j := 0; j < containerLen; j++ {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- mk = dd.DecodeInt(64)
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- mv = dd.DecodeBool()
- if v != nil {
- v[mk] = mv
- }
- }
- } else if containerLen < 0 {
- for j := 0; !dd.CheckBreak(); j++ {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- mk = dd.DecodeInt(64)
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- mv = dd.DecodeBool()
- if v != nil {
- v[mk] = mv
- }
- }
- }
- if cr != nil {
- cr.sendContainerState(containerMapEnd)
- }
- return v, changed
-}
-
-func (f *decFnInfo) fastpathDecMapBoolIntfR(rv reflect.Value) {
- if rv.CanAddr() {
- vp := rv.Addr().Interface().(*map[bool]interface{})
- v, changed := fastpathTV.DecMapBoolIntfV(*vp, fastpathCheckNilFalse, true, f.d)
- if changed {
- *vp = v
- }
- } else {
- v := rv.Interface().(map[bool]interface{})
- fastpathTV.DecMapBoolIntfV(v, fastpathCheckNilFalse, false, f.d)
- }
-}
-func (f fastpathT) DecMapBoolIntfX(vp *map[bool]interface{}, checkNil bool, d *Decoder) {
- v, changed := f.DecMapBoolIntfV(*vp, checkNil, true, d)
- if changed {
- *vp = v
- }
-}
-func (_ fastpathT) DecMapBoolIntfV(v map[bool]interface{}, checkNil bool, canChange bool,
- d *Decoder) (_ map[bool]interface{}, changed bool) {
- dd := d.d
- cr := d.cr
-
- if checkNil && dd.TryDecodeAsNil() {
- if v != nil {
- changed = true
- }
- return nil, changed
- }
-
- containerLen := dd.ReadMapStart()
- if canChange && v == nil {
- xlen, _ := decInferLen(containerLen, d.h.MaxInitLen, 17)
- v = make(map[bool]interface{}, xlen)
- changed = true
- }
- mapGet := !d.h.MapValueReset && !d.h.InterfaceReset
- var mk bool
- var mv interface{}
- if containerLen > 0 {
- for j := 0; j < containerLen; j++ {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- mk = dd.DecodeBool()
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- if mapGet {
- mv = v[mk]
- } else {
- mv = nil
- }
- d.decode(&mv)
- if v != nil {
- v[mk] = mv
- }
- }
- } else if containerLen < 0 {
- for j := 0; !dd.CheckBreak(); j++ {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- mk = dd.DecodeBool()
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- if mapGet {
- mv = v[mk]
- } else {
- mv = nil
- }
- d.decode(&mv)
- if v != nil {
- v[mk] = mv
- }
- }
- }
- if cr != nil {
- cr.sendContainerState(containerMapEnd)
- }
- return v, changed
-}
-
-func (f *decFnInfo) fastpathDecMapBoolStringR(rv reflect.Value) {
- if rv.CanAddr() {
- vp := rv.Addr().Interface().(*map[bool]string)
- v, changed := fastpathTV.DecMapBoolStringV(*vp, fastpathCheckNilFalse, true, f.d)
- if changed {
- *vp = v
- }
- } else {
- v := rv.Interface().(map[bool]string)
- fastpathTV.DecMapBoolStringV(v, fastpathCheckNilFalse, false, f.d)
- }
-}
-func (f fastpathT) DecMapBoolStringX(vp *map[bool]string, checkNil bool, d *Decoder) {
- v, changed := f.DecMapBoolStringV(*vp, checkNil, true, d)
- if changed {
- *vp = v
- }
-}
-func (_ fastpathT) DecMapBoolStringV(v map[bool]string, checkNil bool, canChange bool,
- d *Decoder) (_ map[bool]string, changed bool) {
- dd := d.d
- cr := d.cr
-
- if checkNil && dd.TryDecodeAsNil() {
- if v != nil {
- changed = true
- }
- return nil, changed
- }
-
- containerLen := dd.ReadMapStart()
- if canChange && v == nil {
- xlen, _ := decInferLen(containerLen, d.h.MaxInitLen, 17)
- v = make(map[bool]string, xlen)
- changed = true
- }
-
- var mk bool
- var mv string
- if containerLen > 0 {
- for j := 0; j < containerLen; j++ {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- mk = dd.DecodeBool()
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- mv = dd.DecodeString()
- if v != nil {
- v[mk] = mv
- }
- }
- } else if containerLen < 0 {
- for j := 0; !dd.CheckBreak(); j++ {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- mk = dd.DecodeBool()
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- mv = dd.DecodeString()
- if v != nil {
- v[mk] = mv
- }
- }
- }
- if cr != nil {
- cr.sendContainerState(containerMapEnd)
- }
- return v, changed
-}
-
-func (f *decFnInfo) fastpathDecMapBoolUintR(rv reflect.Value) {
- if rv.CanAddr() {
- vp := rv.Addr().Interface().(*map[bool]uint)
- v, changed := fastpathTV.DecMapBoolUintV(*vp, fastpathCheckNilFalse, true, f.d)
- if changed {
- *vp = v
- }
- } else {
- v := rv.Interface().(map[bool]uint)
- fastpathTV.DecMapBoolUintV(v, fastpathCheckNilFalse, false, f.d)
- }
-}
-func (f fastpathT) DecMapBoolUintX(vp *map[bool]uint, checkNil bool, d *Decoder) {
- v, changed := f.DecMapBoolUintV(*vp, checkNil, true, d)
- if changed {
- *vp = v
- }
-}
-func (_ fastpathT) DecMapBoolUintV(v map[bool]uint, checkNil bool, canChange bool,
- d *Decoder) (_ map[bool]uint, changed bool) {
- dd := d.d
- cr := d.cr
-
- if checkNil && dd.TryDecodeAsNil() {
- if v != nil {
- changed = true
- }
- return nil, changed
- }
-
- containerLen := dd.ReadMapStart()
- if canChange && v == nil {
- xlen, _ := decInferLen(containerLen, d.h.MaxInitLen, 9)
- v = make(map[bool]uint, xlen)
- changed = true
- }
-
- var mk bool
- var mv uint
- if containerLen > 0 {
- for j := 0; j < containerLen; j++ {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- mk = dd.DecodeBool()
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- mv = uint(dd.DecodeUint(uintBitsize))
- if v != nil {
- v[mk] = mv
- }
- }
- } else if containerLen < 0 {
- for j := 0; !dd.CheckBreak(); j++ {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- mk = dd.DecodeBool()
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- mv = uint(dd.DecodeUint(uintBitsize))
- if v != nil {
- v[mk] = mv
- }
- }
- }
- if cr != nil {
- cr.sendContainerState(containerMapEnd)
- }
- return v, changed
-}
-
-func (f *decFnInfo) fastpathDecMapBoolUint8R(rv reflect.Value) {
- if rv.CanAddr() {
- vp := rv.Addr().Interface().(*map[bool]uint8)
- v, changed := fastpathTV.DecMapBoolUint8V(*vp, fastpathCheckNilFalse, true, f.d)
- if changed {
- *vp = v
- }
- } else {
- v := rv.Interface().(map[bool]uint8)
- fastpathTV.DecMapBoolUint8V(v, fastpathCheckNilFalse, false, f.d)
- }
-}
-func (f fastpathT) DecMapBoolUint8X(vp *map[bool]uint8, checkNil bool, d *Decoder) {
- v, changed := f.DecMapBoolUint8V(*vp, checkNil, true, d)
- if changed {
- *vp = v
- }
-}
-func (_ fastpathT) DecMapBoolUint8V(v map[bool]uint8, checkNil bool, canChange bool,
- d *Decoder) (_ map[bool]uint8, changed bool) {
- dd := d.d
- cr := d.cr
-
- if checkNil && dd.TryDecodeAsNil() {
- if v != nil {
- changed = true
- }
- return nil, changed
- }
-
- containerLen := dd.ReadMapStart()
- if canChange && v == nil {
- xlen, _ := decInferLen(containerLen, d.h.MaxInitLen, 2)
- v = make(map[bool]uint8, xlen)
- changed = true
- }
-
- var mk bool
- var mv uint8
- if containerLen > 0 {
- for j := 0; j < containerLen; j++ {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- mk = dd.DecodeBool()
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- mv = uint8(dd.DecodeUint(8))
- if v != nil {
- v[mk] = mv
- }
- }
- } else if containerLen < 0 {
- for j := 0; !dd.CheckBreak(); j++ {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- mk = dd.DecodeBool()
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- mv = uint8(dd.DecodeUint(8))
- if v != nil {
- v[mk] = mv
- }
- }
- }
- if cr != nil {
- cr.sendContainerState(containerMapEnd)
- }
- return v, changed
-}
-
-func (f *decFnInfo) fastpathDecMapBoolUint16R(rv reflect.Value) {
- if rv.CanAddr() {
- vp := rv.Addr().Interface().(*map[bool]uint16)
- v, changed := fastpathTV.DecMapBoolUint16V(*vp, fastpathCheckNilFalse, true, f.d)
- if changed {
- *vp = v
- }
- } else {
- v := rv.Interface().(map[bool]uint16)
- fastpathTV.DecMapBoolUint16V(v, fastpathCheckNilFalse, false, f.d)
- }
-}
-func (f fastpathT) DecMapBoolUint16X(vp *map[bool]uint16, checkNil bool, d *Decoder) {
- v, changed := f.DecMapBoolUint16V(*vp, checkNil, true, d)
- if changed {
- *vp = v
- }
-}
-func (_ fastpathT) DecMapBoolUint16V(v map[bool]uint16, checkNil bool, canChange bool,
- d *Decoder) (_ map[bool]uint16, changed bool) {
- dd := d.d
- cr := d.cr
-
- if checkNil && dd.TryDecodeAsNil() {
- if v != nil {
- changed = true
- }
- return nil, changed
- }
-
- containerLen := dd.ReadMapStart()
- if canChange && v == nil {
- xlen, _ := decInferLen(containerLen, d.h.MaxInitLen, 3)
- v = make(map[bool]uint16, xlen)
- changed = true
- }
-
- var mk bool
- var mv uint16
- if containerLen > 0 {
- for j := 0; j < containerLen; j++ {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- mk = dd.DecodeBool()
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- mv = uint16(dd.DecodeUint(16))
- if v != nil {
- v[mk] = mv
- }
- }
- } else if containerLen < 0 {
- for j := 0; !dd.CheckBreak(); j++ {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- mk = dd.DecodeBool()
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- mv = uint16(dd.DecodeUint(16))
- if v != nil {
- v[mk] = mv
- }
- }
- }
- if cr != nil {
- cr.sendContainerState(containerMapEnd)
- }
- return v, changed
-}
-
-func (f *decFnInfo) fastpathDecMapBoolUint32R(rv reflect.Value) {
- if rv.CanAddr() {
- vp := rv.Addr().Interface().(*map[bool]uint32)
- v, changed := fastpathTV.DecMapBoolUint32V(*vp, fastpathCheckNilFalse, true, f.d)
- if changed {
- *vp = v
- }
- } else {
- v := rv.Interface().(map[bool]uint32)
- fastpathTV.DecMapBoolUint32V(v, fastpathCheckNilFalse, false, f.d)
- }
-}
-func (f fastpathT) DecMapBoolUint32X(vp *map[bool]uint32, checkNil bool, d *Decoder) {
- v, changed := f.DecMapBoolUint32V(*vp, checkNil, true, d)
- if changed {
- *vp = v
- }
-}
-func (_ fastpathT) DecMapBoolUint32V(v map[bool]uint32, checkNil bool, canChange bool,
- d *Decoder) (_ map[bool]uint32, changed bool) {
- dd := d.d
- cr := d.cr
-
- if checkNil && dd.TryDecodeAsNil() {
- if v != nil {
- changed = true
- }
- return nil, changed
- }
-
- containerLen := dd.ReadMapStart()
- if canChange && v == nil {
- xlen, _ := decInferLen(containerLen, d.h.MaxInitLen, 5)
- v = make(map[bool]uint32, xlen)
- changed = true
- }
-
- var mk bool
- var mv uint32
- if containerLen > 0 {
- for j := 0; j < containerLen; j++ {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- mk = dd.DecodeBool()
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- mv = uint32(dd.DecodeUint(32))
- if v != nil {
- v[mk] = mv
- }
- }
- } else if containerLen < 0 {
- for j := 0; !dd.CheckBreak(); j++ {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- mk = dd.DecodeBool()
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- mv = uint32(dd.DecodeUint(32))
- if v != nil {
- v[mk] = mv
- }
- }
- }
- if cr != nil {
- cr.sendContainerState(containerMapEnd)
- }
- return v, changed
-}
-
-func (f *decFnInfo) fastpathDecMapBoolUint64R(rv reflect.Value) {
- if rv.CanAddr() {
- vp := rv.Addr().Interface().(*map[bool]uint64)
- v, changed := fastpathTV.DecMapBoolUint64V(*vp, fastpathCheckNilFalse, true, f.d)
- if changed {
- *vp = v
- }
- } else {
- v := rv.Interface().(map[bool]uint64)
- fastpathTV.DecMapBoolUint64V(v, fastpathCheckNilFalse, false, f.d)
- }
-}
-func (f fastpathT) DecMapBoolUint64X(vp *map[bool]uint64, checkNil bool, d *Decoder) {
- v, changed := f.DecMapBoolUint64V(*vp, checkNil, true, d)
- if changed {
- *vp = v
- }
-}
-func (_ fastpathT) DecMapBoolUint64V(v map[bool]uint64, checkNil bool, canChange bool,
- d *Decoder) (_ map[bool]uint64, changed bool) {
- dd := d.d
- cr := d.cr
-
- if checkNil && dd.TryDecodeAsNil() {
- if v != nil {
- changed = true
- }
- return nil, changed
- }
-
- containerLen := dd.ReadMapStart()
- if canChange && v == nil {
- xlen, _ := decInferLen(containerLen, d.h.MaxInitLen, 9)
- v = make(map[bool]uint64, xlen)
- changed = true
- }
-
- var mk bool
- var mv uint64
- if containerLen > 0 {
- for j := 0; j < containerLen; j++ {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- mk = dd.DecodeBool()
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- mv = dd.DecodeUint(64)
- if v != nil {
- v[mk] = mv
- }
- }
- } else if containerLen < 0 {
- for j := 0; !dd.CheckBreak(); j++ {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- mk = dd.DecodeBool()
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- mv = dd.DecodeUint(64)
- if v != nil {
- v[mk] = mv
- }
- }
- }
- if cr != nil {
- cr.sendContainerState(containerMapEnd)
- }
- return v, changed
-}
-
-func (f *decFnInfo) fastpathDecMapBoolUintptrR(rv reflect.Value) {
- if rv.CanAddr() {
- vp := rv.Addr().Interface().(*map[bool]uintptr)
- v, changed := fastpathTV.DecMapBoolUintptrV(*vp, fastpathCheckNilFalse, true, f.d)
- if changed {
- *vp = v
- }
- } else {
- v := rv.Interface().(map[bool]uintptr)
- fastpathTV.DecMapBoolUintptrV(v, fastpathCheckNilFalse, false, f.d)
- }
-}
-func (f fastpathT) DecMapBoolUintptrX(vp *map[bool]uintptr, checkNil bool, d *Decoder) {
- v, changed := f.DecMapBoolUintptrV(*vp, checkNil, true, d)
- if changed {
- *vp = v
- }
-}
-func (_ fastpathT) DecMapBoolUintptrV(v map[bool]uintptr, checkNil bool, canChange bool,
- d *Decoder) (_ map[bool]uintptr, changed bool) {
- dd := d.d
- cr := d.cr
-
- if checkNil && dd.TryDecodeAsNil() {
- if v != nil {
- changed = true
- }
- return nil, changed
- }
-
- containerLen := dd.ReadMapStart()
- if canChange && v == nil {
- xlen, _ := decInferLen(containerLen, d.h.MaxInitLen, 9)
- v = make(map[bool]uintptr, xlen)
- changed = true
- }
-
- var mk bool
- var mv uintptr
- if containerLen > 0 {
- for j := 0; j < containerLen; j++ {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- mk = dd.DecodeBool()
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- mv = uintptr(dd.DecodeUint(uintBitsize))
- if v != nil {
- v[mk] = mv
- }
- }
- } else if containerLen < 0 {
- for j := 0; !dd.CheckBreak(); j++ {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- mk = dd.DecodeBool()
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- mv = uintptr(dd.DecodeUint(uintBitsize))
- if v != nil {
- v[mk] = mv
- }
- }
- }
- if cr != nil {
- cr.sendContainerState(containerMapEnd)
- }
- return v, changed
-}
-
-func (f *decFnInfo) fastpathDecMapBoolIntR(rv reflect.Value) {
- if rv.CanAddr() {
- vp := rv.Addr().Interface().(*map[bool]int)
- v, changed := fastpathTV.DecMapBoolIntV(*vp, fastpathCheckNilFalse, true, f.d)
- if changed {
- *vp = v
- }
- } else {
- v := rv.Interface().(map[bool]int)
- fastpathTV.DecMapBoolIntV(v, fastpathCheckNilFalse, false, f.d)
- }
-}
-func (f fastpathT) DecMapBoolIntX(vp *map[bool]int, checkNil bool, d *Decoder) {
- v, changed := f.DecMapBoolIntV(*vp, checkNil, true, d)
- if changed {
- *vp = v
- }
-}
-func (_ fastpathT) DecMapBoolIntV(v map[bool]int, checkNil bool, canChange bool,
- d *Decoder) (_ map[bool]int, changed bool) {
- dd := d.d
- cr := d.cr
-
- if checkNil && dd.TryDecodeAsNil() {
- if v != nil {
- changed = true
- }
- return nil, changed
- }
-
- containerLen := dd.ReadMapStart()
- if canChange && v == nil {
- xlen, _ := decInferLen(containerLen, d.h.MaxInitLen, 9)
- v = make(map[bool]int, xlen)
- changed = true
- }
-
- var mk bool
- var mv int
- if containerLen > 0 {
- for j := 0; j < containerLen; j++ {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- mk = dd.DecodeBool()
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- mv = int(dd.DecodeInt(intBitsize))
- if v != nil {
- v[mk] = mv
- }
- }
- } else if containerLen < 0 {
- for j := 0; !dd.CheckBreak(); j++ {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- mk = dd.DecodeBool()
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- mv = int(dd.DecodeInt(intBitsize))
- if v != nil {
- v[mk] = mv
- }
- }
- }
- if cr != nil {
- cr.sendContainerState(containerMapEnd)
- }
- return v, changed
-}
-
-func (f *decFnInfo) fastpathDecMapBoolInt8R(rv reflect.Value) {
- if rv.CanAddr() {
- vp := rv.Addr().Interface().(*map[bool]int8)
- v, changed := fastpathTV.DecMapBoolInt8V(*vp, fastpathCheckNilFalse, true, f.d)
- if changed {
- *vp = v
- }
- } else {
- v := rv.Interface().(map[bool]int8)
- fastpathTV.DecMapBoolInt8V(v, fastpathCheckNilFalse, false, f.d)
- }
-}
-func (f fastpathT) DecMapBoolInt8X(vp *map[bool]int8, checkNil bool, d *Decoder) {
- v, changed := f.DecMapBoolInt8V(*vp, checkNil, true, d)
- if changed {
- *vp = v
- }
-}
-func (_ fastpathT) DecMapBoolInt8V(v map[bool]int8, checkNil bool, canChange bool,
- d *Decoder) (_ map[bool]int8, changed bool) {
- dd := d.d
- cr := d.cr
-
- if checkNil && dd.TryDecodeAsNil() {
- if v != nil {
- changed = true
- }
- return nil, changed
- }
-
- containerLen := dd.ReadMapStart()
- if canChange && v == nil {
- xlen, _ := decInferLen(containerLen, d.h.MaxInitLen, 2)
- v = make(map[bool]int8, xlen)
- changed = true
- }
-
- var mk bool
- var mv int8
- if containerLen > 0 {
- for j := 0; j < containerLen; j++ {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- mk = dd.DecodeBool()
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- mv = int8(dd.DecodeInt(8))
- if v != nil {
- v[mk] = mv
- }
- }
- } else if containerLen < 0 {
- for j := 0; !dd.CheckBreak(); j++ {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- mk = dd.DecodeBool()
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- mv = int8(dd.DecodeInt(8))
- if v != nil {
- v[mk] = mv
- }
- }
- }
- if cr != nil {
- cr.sendContainerState(containerMapEnd)
- }
- return v, changed
-}
-
-func (f *decFnInfo) fastpathDecMapBoolInt16R(rv reflect.Value) {
- if rv.CanAddr() {
- vp := rv.Addr().Interface().(*map[bool]int16)
- v, changed := fastpathTV.DecMapBoolInt16V(*vp, fastpathCheckNilFalse, true, f.d)
- if changed {
- *vp = v
- }
- } else {
- v := rv.Interface().(map[bool]int16)
- fastpathTV.DecMapBoolInt16V(v, fastpathCheckNilFalse, false, f.d)
- }
-}
-func (f fastpathT) DecMapBoolInt16X(vp *map[bool]int16, checkNil bool, d *Decoder) {
- v, changed := f.DecMapBoolInt16V(*vp, checkNil, true, d)
- if changed {
- *vp = v
- }
-}
-func (_ fastpathT) DecMapBoolInt16V(v map[bool]int16, checkNil bool, canChange bool,
- d *Decoder) (_ map[bool]int16, changed bool) {
- dd := d.d
- cr := d.cr
-
- if checkNil && dd.TryDecodeAsNil() {
- if v != nil {
- changed = true
- }
- return nil, changed
- }
-
- containerLen := dd.ReadMapStart()
- if canChange && v == nil {
- xlen, _ := decInferLen(containerLen, d.h.MaxInitLen, 3)
- v = make(map[bool]int16, xlen)
- changed = true
- }
-
- var mk bool
- var mv int16
- if containerLen > 0 {
- for j := 0; j < containerLen; j++ {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- mk = dd.DecodeBool()
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- mv = int16(dd.DecodeInt(16))
- if v != nil {
- v[mk] = mv
- }
- }
- } else if containerLen < 0 {
- for j := 0; !dd.CheckBreak(); j++ {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- mk = dd.DecodeBool()
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- mv = int16(dd.DecodeInt(16))
- if v != nil {
- v[mk] = mv
- }
- }
- }
- if cr != nil {
- cr.sendContainerState(containerMapEnd)
- }
- return v, changed
-}
-
-func (f *decFnInfo) fastpathDecMapBoolInt32R(rv reflect.Value) {
- if rv.CanAddr() {
- vp := rv.Addr().Interface().(*map[bool]int32)
- v, changed := fastpathTV.DecMapBoolInt32V(*vp, fastpathCheckNilFalse, true, f.d)
- if changed {
- *vp = v
- }
- } else {
- v := rv.Interface().(map[bool]int32)
- fastpathTV.DecMapBoolInt32V(v, fastpathCheckNilFalse, false, f.d)
- }
-}
-func (f fastpathT) DecMapBoolInt32X(vp *map[bool]int32, checkNil bool, d *Decoder) {
- v, changed := f.DecMapBoolInt32V(*vp, checkNil, true, d)
- if changed {
- *vp = v
- }
-}
-func (_ fastpathT) DecMapBoolInt32V(v map[bool]int32, checkNil bool, canChange bool,
- d *Decoder) (_ map[bool]int32, changed bool) {
- dd := d.d
- cr := d.cr
-
- if checkNil && dd.TryDecodeAsNil() {
- if v != nil {
- changed = true
- }
- return nil, changed
- }
-
- containerLen := dd.ReadMapStart()
- if canChange && v == nil {
- xlen, _ := decInferLen(containerLen, d.h.MaxInitLen, 5)
- v = make(map[bool]int32, xlen)
- changed = true
- }
-
- var mk bool
- var mv int32
- if containerLen > 0 {
- for j := 0; j < containerLen; j++ {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- mk = dd.DecodeBool()
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- mv = int32(dd.DecodeInt(32))
- if v != nil {
- v[mk] = mv
- }
- }
- } else if containerLen < 0 {
- for j := 0; !dd.CheckBreak(); j++ {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- mk = dd.DecodeBool()
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- mv = int32(dd.DecodeInt(32))
- if v != nil {
- v[mk] = mv
- }
- }
- }
- if cr != nil {
- cr.sendContainerState(containerMapEnd)
- }
- return v, changed
-}
-
-func (f *decFnInfo) fastpathDecMapBoolInt64R(rv reflect.Value) {
- if rv.CanAddr() {
- vp := rv.Addr().Interface().(*map[bool]int64)
- v, changed := fastpathTV.DecMapBoolInt64V(*vp, fastpathCheckNilFalse, true, f.d)
- if changed {
- *vp = v
- }
- } else {
- v := rv.Interface().(map[bool]int64)
- fastpathTV.DecMapBoolInt64V(v, fastpathCheckNilFalse, false, f.d)
- }
-}
-func (f fastpathT) DecMapBoolInt64X(vp *map[bool]int64, checkNil bool, d *Decoder) {
- v, changed := f.DecMapBoolInt64V(*vp, checkNil, true, d)
- if changed {
- *vp = v
- }
-}
-func (_ fastpathT) DecMapBoolInt64V(v map[bool]int64, checkNil bool, canChange bool,
- d *Decoder) (_ map[bool]int64, changed bool) {
- dd := d.d
- cr := d.cr
-
- if checkNil && dd.TryDecodeAsNil() {
- if v != nil {
- changed = true
- }
- return nil, changed
- }
-
- containerLen := dd.ReadMapStart()
- if canChange && v == nil {
- xlen, _ := decInferLen(containerLen, d.h.MaxInitLen, 9)
- v = make(map[bool]int64, xlen)
- changed = true
- }
-
- var mk bool
- var mv int64
- if containerLen > 0 {
- for j := 0; j < containerLen; j++ {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- mk = dd.DecodeBool()
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- mv = dd.DecodeInt(64)
- if v != nil {
- v[mk] = mv
- }
- }
- } else if containerLen < 0 {
- for j := 0; !dd.CheckBreak(); j++ {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- mk = dd.DecodeBool()
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- mv = dd.DecodeInt(64)
- if v != nil {
- v[mk] = mv
- }
- }
- }
- if cr != nil {
- cr.sendContainerState(containerMapEnd)
- }
- return v, changed
-}
-
-func (f *decFnInfo) fastpathDecMapBoolFloat32R(rv reflect.Value) {
- if rv.CanAddr() {
- vp := rv.Addr().Interface().(*map[bool]float32)
- v, changed := fastpathTV.DecMapBoolFloat32V(*vp, fastpathCheckNilFalse, true, f.d)
- if changed {
- *vp = v
- }
- } else {
- v := rv.Interface().(map[bool]float32)
- fastpathTV.DecMapBoolFloat32V(v, fastpathCheckNilFalse, false, f.d)
- }
-}
-func (f fastpathT) DecMapBoolFloat32X(vp *map[bool]float32, checkNil bool, d *Decoder) {
- v, changed := f.DecMapBoolFloat32V(*vp, checkNil, true, d)
- if changed {
- *vp = v
- }
-}
-func (_ fastpathT) DecMapBoolFloat32V(v map[bool]float32, checkNil bool, canChange bool,
- d *Decoder) (_ map[bool]float32, changed bool) {
- dd := d.d
- cr := d.cr
-
- if checkNil && dd.TryDecodeAsNil() {
- if v != nil {
- changed = true
- }
- return nil, changed
- }
-
- containerLen := dd.ReadMapStart()
- if canChange && v == nil {
- xlen, _ := decInferLen(containerLen, d.h.MaxInitLen, 5)
- v = make(map[bool]float32, xlen)
- changed = true
- }
-
- var mk bool
- var mv float32
- if containerLen > 0 {
- for j := 0; j < containerLen; j++ {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- mk = dd.DecodeBool()
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- mv = float32(dd.DecodeFloat(true))
- if v != nil {
- v[mk] = mv
- }
- }
- } else if containerLen < 0 {
- for j := 0; !dd.CheckBreak(); j++ {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- mk = dd.DecodeBool()
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- mv = float32(dd.DecodeFloat(true))
- if v != nil {
- v[mk] = mv
- }
- }
- }
- if cr != nil {
- cr.sendContainerState(containerMapEnd)
- }
- return v, changed
-}
-
-func (f *decFnInfo) fastpathDecMapBoolFloat64R(rv reflect.Value) {
- if rv.CanAddr() {
- vp := rv.Addr().Interface().(*map[bool]float64)
- v, changed := fastpathTV.DecMapBoolFloat64V(*vp, fastpathCheckNilFalse, true, f.d)
- if changed {
- *vp = v
- }
- } else {
- v := rv.Interface().(map[bool]float64)
- fastpathTV.DecMapBoolFloat64V(v, fastpathCheckNilFalse, false, f.d)
- }
-}
-func (f fastpathT) DecMapBoolFloat64X(vp *map[bool]float64, checkNil bool, d *Decoder) {
- v, changed := f.DecMapBoolFloat64V(*vp, checkNil, true, d)
- if changed {
- *vp = v
- }
-}
-func (_ fastpathT) DecMapBoolFloat64V(v map[bool]float64, checkNil bool, canChange bool,
- d *Decoder) (_ map[bool]float64, changed bool) {
- dd := d.d
- cr := d.cr
-
- if checkNil && dd.TryDecodeAsNil() {
- if v != nil {
- changed = true
- }
- return nil, changed
- }
-
- containerLen := dd.ReadMapStart()
- if canChange && v == nil {
- xlen, _ := decInferLen(containerLen, d.h.MaxInitLen, 9)
- v = make(map[bool]float64, xlen)
- changed = true
- }
-
- var mk bool
- var mv float64
- if containerLen > 0 {
- for j := 0; j < containerLen; j++ {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- mk = dd.DecodeBool()
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- mv = dd.DecodeFloat(false)
- if v != nil {
- v[mk] = mv
- }
- }
- } else if containerLen < 0 {
- for j := 0; !dd.CheckBreak(); j++ {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- mk = dd.DecodeBool()
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- mv = dd.DecodeFloat(false)
- if v != nil {
- v[mk] = mv
- }
- }
- }
- if cr != nil {
- cr.sendContainerState(containerMapEnd)
- }
- return v, changed
-}
-
-func (f *decFnInfo) fastpathDecMapBoolBoolR(rv reflect.Value) {
- if rv.CanAddr() {
- vp := rv.Addr().Interface().(*map[bool]bool)
- v, changed := fastpathTV.DecMapBoolBoolV(*vp, fastpathCheckNilFalse, true, f.d)
- if changed {
- *vp = v
- }
- } else {
- v := rv.Interface().(map[bool]bool)
- fastpathTV.DecMapBoolBoolV(v, fastpathCheckNilFalse, false, f.d)
- }
-}
-func (f fastpathT) DecMapBoolBoolX(vp *map[bool]bool, checkNil bool, d *Decoder) {
- v, changed := f.DecMapBoolBoolV(*vp, checkNil, true, d)
- if changed {
- *vp = v
- }
-}
-func (_ fastpathT) DecMapBoolBoolV(v map[bool]bool, checkNil bool, canChange bool,
- d *Decoder) (_ map[bool]bool, changed bool) {
- dd := d.d
- cr := d.cr
-
- if checkNil && dd.TryDecodeAsNil() {
- if v != nil {
- changed = true
- }
- return nil, changed
- }
-
- containerLen := dd.ReadMapStart()
- if canChange && v == nil {
- xlen, _ := decInferLen(containerLen, d.h.MaxInitLen, 2)
- v = make(map[bool]bool, xlen)
- changed = true
- }
-
- var mk bool
- var mv bool
- if containerLen > 0 {
- for j := 0; j < containerLen; j++ {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- mk = dd.DecodeBool()
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- mv = dd.DecodeBool()
- if v != nil {
- v[mk] = mv
- }
- }
- } else if containerLen < 0 {
- for j := 0; !dd.CheckBreak(); j++ {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- mk = dd.DecodeBool()
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- mv = dd.DecodeBool()
- if v != nil {
- v[mk] = mv
- }
- }
- }
- if cr != nil {
- cr.sendContainerState(containerMapEnd)
- }
- return v, changed
-}
diff --git a/vendor/github.com/ugorji/go/codec/fast-path.go.tmpl b/vendor/github.com/ugorji/go/codec/fast-path.go.tmpl
deleted file mode 100644
index 04c173fb..00000000
--- a/vendor/github.com/ugorji/go/codec/fast-path.go.tmpl
+++ /dev/null
@@ -1,540 +0,0 @@
-// +build !notfastpath
-
-// Copyright (c) 2012-2015 Ugorji Nwoke. All rights reserved.
-// Use of this source code is governed by a MIT license found in the LICENSE file.
-
-// ************************************************************
-// DO NOT EDIT.
-// THIS FILE IS AUTO-GENERATED from fast-path.go.tmpl
-// ************************************************************
-
-package codec
-
-// Fast path functions try to create a fast path encode or decode implementation
-// for common maps and slices.
-//
-// We define the functions and register then in this single file
-// so as not to pollute the encode.go and decode.go, and create a dependency in there.
-// This file can be omitted without causing a build failure.
-//
-// The advantage of fast paths is:
-// - Many calls bypass reflection altogether
-//
-// Currently support
-// - slice of all builtin types,
-// - map of all builtin types to string or interface value
-// - symetrical maps of all builtin types (e.g. str-str, uint8-uint8)
-// This should provide adequate "typical" implementations.
-//
-// Note that fast track decode functions must handle values for which an address cannot be obtained.
-// For example:
-// m2 := map[string]int{}
-// p2 := []interface{}{m2}
-// // decoding into p2 will bomb if fast track functions do not treat like unaddressable.
-//
-
-import (
- "reflect"
- "sort"
-)
-
-const fastpathCheckNilFalse = false // for reflect
-const fastpathCheckNilTrue = true // for type switch
-
-type fastpathT struct {}
-
-var fastpathTV fastpathT
-
-type fastpathE struct {
- rtid uintptr
- rt reflect.Type
- encfn func(*encFnInfo, reflect.Value)
- decfn func(*decFnInfo, reflect.Value)
-}
-
-type fastpathA [{{ .FastpathLen }}]fastpathE
-
-func (x *fastpathA) index(rtid uintptr) int {
- // use binary search to grab the index (adapted from sort/search.go)
- h, i, j := 0, 0, {{ .FastpathLen }} // len(x)
- for i < j {
- h = i + (j-i)/2
- if x[h].rtid < rtid {
- i = h + 1
- } else {
- j = h
- }
- }
- if i < {{ .FastpathLen }} && x[i].rtid == rtid {
- return i
- }
- return -1
-}
-
-type fastpathAslice []fastpathE
-
-func (x fastpathAslice) Len() int { return len(x) }
-func (x fastpathAslice) Less(i, j int) bool { return x[i].rtid < x[j].rtid }
-func (x fastpathAslice) Swap(i, j int) { x[i], x[j] = x[j], x[i] }
-
-var fastpathAV fastpathA
-
-// due to possible initialization loop error, make fastpath in an init()
-func init() {
- if !fastpathEnabled {
- return
- }
- i := 0
- fn := func(v interface{}, fe func(*encFnInfo, reflect.Value), fd func(*decFnInfo, reflect.Value)) (f fastpathE) {
- xrt := reflect.TypeOf(v)
- xptr := reflect.ValueOf(xrt).Pointer()
- fastpathAV[i] = fastpathE{xptr, xrt, fe, fd}
- i++
- return
- }
-
- {{range .Values}}{{if not .Primitive}}{{if not .MapKey }}
- fn([]{{ .Elem }}(nil), (*encFnInfo).{{ .MethodNamePfx "fastpathEnc" false }}R, (*decFnInfo).{{ .MethodNamePfx "fastpathDec" false }}R){{end}}{{end}}{{end}}
-
- {{range .Values}}{{if not .Primitive}}{{if .MapKey }}
- fn(map[{{ .MapKey }}]{{ .Elem }}(nil), (*encFnInfo).{{ .MethodNamePfx "fastpathEnc" false }}R, (*decFnInfo).{{ .MethodNamePfx "fastpathDec" false }}R){{end}}{{end}}{{end}}
-
- sort.Sort(fastpathAslice(fastpathAV[:]))
-}
-
-// -- encode
-
-// -- -- fast path type switch
-func fastpathEncodeTypeSwitch(iv interface{}, e *Encoder) bool {
- if !fastpathEnabled {
- return false
- }
- switch v := iv.(type) {
-{{range .Values}}{{if not .Primitive}}{{if not .MapKey }}
- case []{{ .Elem }}:{{else}}
- case map[{{ .MapKey }}]{{ .Elem }}:{{end}}
- fastpathTV.{{ .MethodNamePfx "Enc" false }}V(v, fastpathCheckNilTrue, e){{if not .MapKey }}
- case *[]{{ .Elem }}:{{else}}
- case *map[{{ .MapKey }}]{{ .Elem }}:{{end}}
- fastpathTV.{{ .MethodNamePfx "Enc" false }}V(*v, fastpathCheckNilTrue, e)
-{{end}}{{end}}
- default:
- _ = v // TODO: workaround https://github.com/golang/go/issues/12927 (remove after go 1.6 release)
- return false
- }
- return true
-}
-
-func fastpathEncodeTypeSwitchSlice(iv interface{}, e *Encoder) bool {
- if !fastpathEnabled {
- return false
- }
- switch v := iv.(type) {
-{{range .Values}}{{if not .Primitive}}{{if not .MapKey }}
- case []{{ .Elem }}:
- fastpathTV.{{ .MethodNamePfx "Enc" false }}V(v, fastpathCheckNilTrue, e)
- case *[]{{ .Elem }}:
- fastpathTV.{{ .MethodNamePfx "Enc" false }}V(*v, fastpathCheckNilTrue, e)
-{{end}}{{end}}{{end}}
- default:
- _ = v // TODO: workaround https://github.com/golang/go/issues/12927 (remove after go 1.6 release)
- return false
- }
- return true
-}
-
-func fastpathEncodeTypeSwitchMap(iv interface{}, e *Encoder) bool {
- if !fastpathEnabled {
- return false
- }
- switch v := iv.(type) {
-{{range .Values}}{{if not .Primitive}}{{if .MapKey }}
- case map[{{ .MapKey }}]{{ .Elem }}:
- fastpathTV.{{ .MethodNamePfx "Enc" false }}V(v, fastpathCheckNilTrue, e)
- case *map[{{ .MapKey }}]{{ .Elem }}:
- fastpathTV.{{ .MethodNamePfx "Enc" false }}V(*v, fastpathCheckNilTrue, e)
-{{end}}{{end}}{{end}}
- default:
- _ = v // TODO: workaround https://github.com/golang/go/issues/12927 (remove after go 1.6 release)
- return false
- }
- return true
-}
-
-// -- -- fast path functions
-{{range .Values}}{{if not .Primitive}}{{if not .MapKey }}
-
-func (f *encFnInfo) {{ .MethodNamePfx "fastpathEnc" false }}R(rv reflect.Value) {
- if f.ti.mbs {
- fastpathTV.{{ .MethodNamePfx "EncAsMap" false }}V(rv.Interface().([]{{ .Elem }}), fastpathCheckNilFalse, f.e)
- } else {
- fastpathTV.{{ .MethodNamePfx "Enc" false }}V(rv.Interface().([]{{ .Elem }}), fastpathCheckNilFalse, f.e)
- }
-}
-func (_ fastpathT) {{ .MethodNamePfx "Enc" false }}V(v []{{ .Elem }}, checkNil bool, e *Encoder) {
- ee := e.e
- cr := e.cr
- if checkNil && v == nil {
- ee.EncodeNil()
- return
- }
- ee.EncodeArrayStart(len(v))
- for _, v2 := range v {
- if cr != nil { cr.sendContainerState(containerArrayElem) }
- {{ encmd .Elem "v2"}}
- }
- if cr != nil { cr.sendContainerState(containerArrayEnd) }{{/* ee.EncodeEnd() */}}
-}
-
-func (_ fastpathT) {{ .MethodNamePfx "EncAsMap" false }}V(v []{{ .Elem }}, checkNil bool, e *Encoder) {
- ee := e.e
- cr := e.cr
- if checkNil && v == nil {
- ee.EncodeNil()
- return
- }
- if len(v)%2 == 1 {
- e.errorf("mapBySlice requires even slice length, but got %v", len(v))
- return
- }
- ee.EncodeMapStart(len(v) / 2)
- for j, v2 := range v {
- if cr != nil {
- if j%2 == 0 {
- cr.sendContainerState(containerMapKey)
- } else {
- cr.sendContainerState(containerMapValue)
- }
- }
- {{ encmd .Elem "v2"}}
- }
- if cr != nil { cr.sendContainerState(containerMapEnd) }
-}
-
-{{end}}{{end}}{{end}}
-
-{{range .Values}}{{if not .Primitive}}{{if .MapKey }}
-
-func (f *encFnInfo) {{ .MethodNamePfx "fastpathEnc" false }}R(rv reflect.Value) {
- fastpathTV.{{ .MethodNamePfx "Enc" false }}V(rv.Interface().(map[{{ .MapKey }}]{{ .Elem }}), fastpathCheckNilFalse, f.e)
-}
-func (_ fastpathT) {{ .MethodNamePfx "Enc" false }}V(v map[{{ .MapKey }}]{{ .Elem }}, checkNil bool, e *Encoder) {
- ee := e.e
- cr := e.cr
- if checkNil && v == nil {
- ee.EncodeNil()
- return
- }
- ee.EncodeMapStart(len(v))
- {{if eq .MapKey "string"}}asSymbols := e.h.AsSymbols&AsSymbolMapStringKeysFlag != 0
- {{end}}if e.h.Canonical {
- {{if eq .MapKey "interface{}"}}{{/* out of band
- */}}var mksv []byte = make([]byte, 0, len(v)*16) // temporary byte slice for the encoding
- e2 := NewEncoderBytes(&mksv, e.hh)
- v2 := make([]bytesI, len(v))
- var i, l int
- var vp *bytesI {{/* put loop variables outside. seems currently needed for better perf */}}
- for k2, _ := range v {
- l = len(mksv)
- e2.MustEncode(k2)
- vp = &v2[i]
- vp.v = mksv[l:]
- vp.i = k2
- i++
- }
- sort.Sort(bytesISlice(v2))
- for j := range v2 {
- if cr != nil { cr.sendContainerState(containerMapKey) }
- e.asis(v2[j].v)
- if cr != nil { cr.sendContainerState(containerMapValue) }
- e.encode(v[v2[j].i])
- } {{else}}{{ $x := sorttype .MapKey true}}v2 := make([]{{ $x }}, len(v))
- var i int
- for k, _ := range v {
- v2[i] = {{ $x }}(k)
- i++
- }
- sort.Sort({{ sorttype .MapKey false}}(v2))
- for _, k2 := range v2 {
- if cr != nil { cr.sendContainerState(containerMapKey) }
- {{if eq .MapKey "string"}}if asSymbols {
- ee.EncodeSymbol(k2)
- } else {
- ee.EncodeString(c_UTF8, k2)
- }{{else}}{{ $y := printf "%s(k2)" .MapKey }}{{ encmd .MapKey $y }}{{end}}
- if cr != nil { cr.sendContainerState(containerMapValue) }
- {{ $y := printf "v[%s(k2)]" .MapKey }}{{ encmd .Elem $y }}
- } {{end}}
- } else {
- for k2, v2 := range v {
- if cr != nil { cr.sendContainerState(containerMapKey) }
- {{if eq .MapKey "string"}}if asSymbols {
- ee.EncodeSymbol(k2)
- } else {
- ee.EncodeString(c_UTF8, k2)
- }{{else}}{{ encmd .MapKey "k2"}}{{end}}
- if cr != nil { cr.sendContainerState(containerMapValue) }
- {{ encmd .Elem "v2"}}
- }
- }
- if cr != nil { cr.sendContainerState(containerMapEnd) }{{/* ee.EncodeEnd() */}}
-}
-
-{{end}}{{end}}{{end}}
-
-// -- decode
-
-// -- -- fast path type switch
-func fastpathDecodeTypeSwitch(iv interface{}, d *Decoder) bool {
- if !fastpathEnabled {
- return false
- }
- switch v := iv.(type) {
-{{range .Values}}{{if not .Primitive}}{{if not .MapKey }}
- case []{{ .Elem }}:{{else}}
- case map[{{ .MapKey }}]{{ .Elem }}:{{end}}
- fastpathTV.{{ .MethodNamePfx "Dec" false }}V(v, fastpathCheckNilFalse, false, d){{if not .MapKey }}
- case *[]{{ .Elem }}:{{else}}
- case *map[{{ .MapKey }}]{{ .Elem }}:{{end}}
- v2, changed2 := fastpathTV.{{ .MethodNamePfx "Dec" false }}V(*v, fastpathCheckNilFalse, true, d)
- if changed2 {
- *v = v2
- }
-{{end}}{{end}}
- default:
- _ = v // TODO: workaround https://github.com/golang/go/issues/12927 (remove after go 1.6 release)
- return false
- }
- return true
-}
-
-// -- -- fast path functions
-{{range .Values}}{{if not .Primitive}}{{if not .MapKey }}
-{{/*
-Slices can change if they
-- did not come from an array
-- are addressable (from a ptr)
-- are settable (e.g. contained in an interface{})
-*/}}
-func (f *decFnInfo) {{ .MethodNamePfx "fastpathDec" false }}R(rv reflect.Value) {
- array := f.seq == seqTypeArray
- if !array && rv.CanAddr() { {{/* // CanSet => CanAddr + Exported */}}
- vp := rv.Addr().Interface().(*[]{{ .Elem }})
- v, changed := fastpathTV.{{ .MethodNamePfx "Dec" false }}V(*vp, fastpathCheckNilFalse, !array, f.d)
- if changed {
- *vp = v
- }
- } else {
- v := rv.Interface().([]{{ .Elem }})
- fastpathTV.{{ .MethodNamePfx "Dec" false }}V(v, fastpathCheckNilFalse, false, f.d)
- }
-}
-
-func (f fastpathT) {{ .MethodNamePfx "Dec" false }}X(vp *[]{{ .Elem }}, checkNil bool, d *Decoder) {
- v, changed := f.{{ .MethodNamePfx "Dec" false }}V(*vp, checkNil, true, d)
- if changed {
- *vp = v
- }
-}
-func (_ fastpathT) {{ .MethodNamePfx "Dec" false }}V(v []{{ .Elem }}, checkNil bool, canChange bool, d *Decoder) (_ []{{ .Elem }}, changed bool) {
- dd := d.d
- {{/* // if dd.isContainerType(valueTypeNil) { dd.TryDecodeAsNil() */}}
- if checkNil && dd.TryDecodeAsNil() {
- if v != nil {
- changed = true
- }
- return nil, changed
- }
-
- slh, containerLenS := d.decSliceHelperStart()
- if containerLenS == 0 {
- if canChange {
- if v == nil {
- v = []{{ .Elem }}{}
- } else if len(v) != 0 {
- v = v[:0]
- }
- changed = true
- }
- slh.End()
- return v, changed
- }
-
- if containerLenS > 0 {
- x2read := containerLenS
- var xtrunc bool
- if containerLenS > cap(v) {
- if canChange { {{/*
- // fast-path is for "basic" immutable types, so no need to copy them over
- // s := make([]{{ .Elem }}, decInferLen(containerLenS, d.h.MaxInitLen))
- // copy(s, v[:cap(v)])
- // v = s */}}
- var xlen int
- xlen, xtrunc = decInferLen(containerLenS, d.h.MaxInitLen, {{ .Size }})
- if xtrunc {
- if xlen <= cap(v) {
- v = v[:xlen]
- } else {
- v = make([]{{ .Elem }}, xlen)
- }
- } else {
- v = make([]{{ .Elem }}, xlen)
- }
- changed = true
- } else {
- d.arrayCannotExpand(len(v), containerLenS)
- }
- x2read = len(v)
- } else if containerLenS != len(v) {
- if canChange {
- v = v[:containerLenS]
- changed = true
- }
- } {{/* // all checks done. cannot go past len. */}}
- j := 0
- for ; j < x2read; j++ {
- slh.ElemContainerState(j)
- {{ if eq .Elem "interface{}" }}d.decode(&v[j]){{ else }}v[j] = {{ decmd .Elem }}{{ end }}
- }
- if xtrunc { {{/* // means canChange=true, changed=true already. */}}
- for ; j < containerLenS; j++ {
- v = append(v, {{ zerocmd .Elem }})
- slh.ElemContainerState(j)
- {{ if eq .Elem "interface{}" }}d.decode(&v[j]){{ else }}v[j] = {{ decmd .Elem }}{{ end }}
- }
- } else if !canChange {
- for ; j < containerLenS; j++ {
- slh.ElemContainerState(j)
- d.swallow()
- }
- }
- } else {
- breakFound := dd.CheckBreak() {{/* check break first, so we can initialize v with a capacity of 4 if necessary */}}
- if breakFound {
- if canChange {
- if v == nil {
- v = []{{ .Elem }}{}
- } else if len(v) != 0 {
- v = v[:0]
- }
- changed = true
- }
- slh.End()
- return v, changed
- }
- if cap(v) == 0 {
- v = make([]{{ .Elem }}, 1, 4)
- changed = true
- }
- j := 0
- for ; !breakFound; j++ {
- if j >= len(v) {
- if canChange {
- v = append(v, {{ zerocmd .Elem }})
- changed = true
- } else {
- d.arrayCannotExpand(len(v), j+1)
- }
- }
- slh.ElemContainerState(j)
- if j < len(v) { {{/* // all checks done. cannot go past len. */}}
- {{ if eq .Elem "interface{}" }}d.decode(&v[j])
- {{ else }}v[j] = {{ decmd .Elem }}{{ end }}
- } else {
- d.swallow()
- }
- breakFound = dd.CheckBreak()
- }
- if canChange && j < len(v) {
- v = v[:j]
- changed = true
- }
- }
- slh.End()
- return v, changed
-}
-
-{{end}}{{end}}{{end}}
-
-
-{{range .Values}}{{if not .Primitive}}{{if .MapKey }}
-{{/*
-Maps can change if they are
-- addressable (from a ptr)
-- settable (e.g. contained in an interface{})
-*/}}
-func (f *decFnInfo) {{ .MethodNamePfx "fastpathDec" false }}R(rv reflect.Value) {
- if rv.CanAddr() {
- vp := rv.Addr().Interface().(*map[{{ .MapKey }}]{{ .Elem }})
- v, changed := fastpathTV.{{ .MethodNamePfx "Dec" false }}V(*vp, fastpathCheckNilFalse, true, f.d)
- if changed {
- *vp = v
- }
- } else {
- v := rv.Interface().(map[{{ .MapKey }}]{{ .Elem }})
- fastpathTV.{{ .MethodNamePfx "Dec" false }}V(v, fastpathCheckNilFalse, false, f.d)
- }
-}
-func (f fastpathT) {{ .MethodNamePfx "Dec" false }}X(vp *map[{{ .MapKey }}]{{ .Elem }}, checkNil bool, d *Decoder) {
- v, changed := f.{{ .MethodNamePfx "Dec" false }}V(*vp, checkNil, true, d)
- if changed {
- *vp = v
- }
-}
-func (_ fastpathT) {{ .MethodNamePfx "Dec" false }}V(v map[{{ .MapKey }}]{{ .Elem }}, checkNil bool, canChange bool,
- d *Decoder) (_ map[{{ .MapKey }}]{{ .Elem }}, changed bool) {
- dd := d.d
- cr := d.cr
- {{/* // if dd.isContainerType(valueTypeNil) {dd.TryDecodeAsNil() */}}
- if checkNil && dd.TryDecodeAsNil() {
- if v != nil {
- changed = true
- }
- return nil, changed
- }
-
- containerLen := dd.ReadMapStart()
- if canChange && v == nil {
- xlen, _ := decInferLen(containerLen, d.h.MaxInitLen, {{ .Size }})
- v = make(map[{{ .MapKey }}]{{ .Elem }}, xlen)
- changed = true
- }
- {{ if eq .Elem "interface{}" }}mapGet := !d.h.MapValueReset && !d.h.InterfaceReset{{end}}
- var mk {{ .MapKey }}
- var mv {{ .Elem }}
- if containerLen > 0 {
- for j := 0; j < containerLen; j++ {
- if cr != nil { cr.sendContainerState(containerMapKey) }
- {{ if eq .MapKey "interface{}" }}mk = nil
- d.decode(&mk)
- if bv, bok := mk.([]byte); bok {
- mk = d.string(bv) {{/* // maps cannot have []byte as key. switch to string. */}}
- }{{ else }}mk = {{ decmd .MapKey }}{{ end }}
- if cr != nil { cr.sendContainerState(containerMapValue) }
- {{ if eq .Elem "interface{}" }}if mapGet { mv = v[mk] } else { mv = nil }
- d.decode(&mv){{ else }}mv = {{ decmd .Elem }}{{ end }}
- if v != nil {
- v[mk] = mv
- }
- }
- } else if containerLen < 0 {
- for j := 0; !dd.CheckBreak(); j++ {
- if cr != nil { cr.sendContainerState(containerMapKey) }
- {{ if eq .MapKey "interface{}" }}mk = nil
- d.decode(&mk)
- if bv, bok := mk.([]byte); bok {
- mk = d.string(bv) {{/* // maps cannot have []byte as key. switch to string. */}}
- }{{ else }}mk = {{ decmd .MapKey }}{{ end }}
- if cr != nil { cr.sendContainerState(containerMapValue) }
- {{ if eq .Elem "interface{}" }}if mapGet { mv = v[mk] } else { mv = nil }
- d.decode(&mv){{ else }}mv = {{ decmd .Elem }}{{ end }}
- if v != nil {
- v[mk] = mv
- }
- }
- }
- if cr != nil { cr.sendContainerState(containerMapEnd) }
- return v, changed
-}
-
-{{end}}{{end}}{{end}}
diff --git a/vendor/github.com/ugorji/go/codec/fast-path.not.go b/vendor/github.com/ugorji/go/codec/fast-path.not.go
deleted file mode 100644
index d6f5f0c9..00000000
--- a/vendor/github.com/ugorji/go/codec/fast-path.not.go
+++ /dev/null
@@ -1,32 +0,0 @@
-// +build notfastpath
-
-package codec
-
-import "reflect"
-
-// The generated fast-path code is very large, and adds a few seconds to the build time.
-// This causes test execution, execution of small tools which use codec, etc
-// to take a long time.
-//
-// To mitigate, we now support the notfastpath tag.
-// This tag disables fastpath during build, allowing for faster build, test execution,
-// short-program runs, etc.
-
-func fastpathDecodeTypeSwitch(iv interface{}, d *Decoder) bool { return false }
-func fastpathEncodeTypeSwitch(iv interface{}, e *Encoder) bool { return false }
-func fastpathEncodeTypeSwitchSlice(iv interface{}, e *Encoder) bool { return false }
-func fastpathEncodeTypeSwitchMap(iv interface{}, e *Encoder) bool { return false }
-
-type fastpathT struct{}
-type fastpathE struct {
- rtid uintptr
- rt reflect.Type
- encfn func(*encFnInfo, reflect.Value)
- decfn func(*decFnInfo, reflect.Value)
-}
-type fastpathA [0]fastpathE
-
-func (x fastpathA) index(rtid uintptr) int { return -1 }
-
-var fastpathAV fastpathA
-var fastpathTV fastpathT
diff --git a/vendor/github.com/ugorji/go/codec/gen-dec-array.go.tmpl b/vendor/github.com/ugorji/go/codec/gen-dec-array.go.tmpl
deleted file mode 100644
index 32df5414..00000000
--- a/vendor/github.com/ugorji/go/codec/gen-dec-array.go.tmpl
+++ /dev/null
@@ -1,104 +0,0 @@
-{{var "v"}} := {{if not isArray}}*{{end}}{{ .Varname }}
-{{var "h"}}, {{var "l"}} := z.DecSliceHelperStart() {{/* // helper, containerLenS */}}{{if not isArray}}
-var {{var "c"}} bool {{/* // changed */}}
-_ = {{var "c"}}{{end}}
-if {{var "l"}} == 0 {
- {{if isSlice }}if {{var "v"}} == nil {
- {{var "v"}} = []{{ .Typ }}{}
- {{var "c"}} = true
- } else if len({{var "v"}}) != 0 {
- {{var "v"}} = {{var "v"}}[:0]
- {{var "c"}} = true
- } {{end}} {{if isChan }}if {{var "v"}} == nil {
- {{var "v"}} = make({{ .CTyp }}, 0)
- {{var "c"}} = true
- } {{end}}
-} else if {{var "l"}} > 0 {
- {{if isChan }}if {{var "v"}} == nil {
- {{var "rl"}}, _ = z.DecInferLen({{var "l"}}, z.DecBasicHandle().MaxInitLen, {{ .Size }})
- {{var "v"}} = make({{ .CTyp }}, {{var "rl"}})
- {{var "c"}} = true
- }
- for {{var "r"}} := 0; {{var "r"}} < {{var "l"}}; {{var "r"}}++ {
- {{var "h"}}.ElemContainerState({{var "r"}})
- var {{var "t"}} {{ .Typ }}
- {{ $x := printf "%st%s" .TempVar .Rand }}{{ decLineVar $x }}
- {{var "v"}} <- {{var "t"}}
- }
- {{ else }} var {{var "rr"}}, {{var "rl"}} int {{/* // num2read, length of slice/array/chan */}}
- var {{var "rt"}} bool {{/* truncated */}}
- _, _ = {{var "rl"}}, {{var "rt"}}
- {{var "rr"}} = {{var "l"}} // len({{var "v"}})
- if {{var "l"}} > cap({{var "v"}}) {
- {{if isArray }}z.DecArrayCannotExpand(len({{var "v"}}), {{var "l"}})
- {{ else }}{{if not .Immutable }}
- {{var "rg"}} := len({{var "v"}}) > 0
- {{var "v2"}} := {{var "v"}} {{end}}
- {{var "rl"}}, {{var "rt"}} = z.DecInferLen({{var "l"}}, z.DecBasicHandle().MaxInitLen, {{ .Size }})
- if {{var "rt"}} {
- if {{var "rl"}} <= cap({{var "v"}}) {
- {{var "v"}} = {{var "v"}}[:{{var "rl"}}]
- } else {
- {{var "v"}} = make([]{{ .Typ }}, {{var "rl"}})
- }
- } else {
- {{var "v"}} = make([]{{ .Typ }}, {{var "rl"}})
- }
- {{var "c"}} = true
- {{var "rr"}} = len({{var "v"}}) {{if not .Immutable }}
- if {{var "rg"}} { copy({{var "v"}}, {{var "v2"}}) } {{end}} {{end}}{{/* end not Immutable, isArray */}}
- } {{if isSlice }} else if {{var "l"}} != len({{var "v"}}) {
- {{var "v"}} = {{var "v"}}[:{{var "l"}}]
- {{var "c"}} = true
- } {{end}} {{/* end isSlice:47 */}}
- {{var "j"}} := 0
- for ; {{var "j"}} < {{var "rr"}} ; {{var "j"}}++ {
- {{var "h"}}.ElemContainerState({{var "j"}})
- {{ $x := printf "%[1]vv%[2]v[%[1]vj%[2]v]" .TempVar .Rand }}{{ decLineVar $x }}
- }
- {{if isArray }}for ; {{var "j"}} < {{var "l"}} ; {{var "j"}}++ {
- {{var "h"}}.ElemContainerState({{var "j"}})
- z.DecSwallow()
- }
- {{ else }}if {{var "rt"}} {
- for ; {{var "j"}} < {{var "l"}} ; {{var "j"}}++ {
- {{var "v"}} = append({{var "v"}}, {{ zero}})
- {{var "h"}}.ElemContainerState({{var "j"}})
- {{ $x := printf "%[1]vv%[2]v[%[1]vj%[2]v]" .TempVar .Rand }}{{ decLineVar $x }}
- }
- } {{end}} {{/* end isArray:56 */}}
- {{end}} {{/* end isChan:16 */}}
-} else { {{/* len < 0 */}}
- {{var "j"}} := 0
- for ; !r.CheckBreak(); {{var "j"}}++ {
- {{if isChan }}
- {{var "h"}}.ElemContainerState({{var "j"}})
- var {{var "t"}} {{ .Typ }}
- {{ $x := printf "%st%s" .TempVar .Rand }}{{ decLineVar $x }}
- {{var "v"}} <- {{var "t"}}
- {{ else }}
- if {{var "j"}} >= len({{var "v"}}) {
- {{if isArray }}z.DecArrayCannotExpand(len({{var "v"}}), {{var "j"}}+1)
- {{ else }}{{var "v"}} = append({{var "v"}}, {{zero}})// var {{var "z"}} {{ .Typ }}
- {{var "c"}} = true {{end}}
- }
- {{var "h"}}.ElemContainerState({{var "j"}})
- if {{var "j"}} < len({{var "v"}}) {
- {{ $x := printf "%[1]vv%[2]v[%[1]vj%[2]v]" .TempVar .Rand }}{{ decLineVar $x }}
- } else {
- z.DecSwallow()
- }
- {{end}}
- }
- {{if isSlice }}if {{var "j"}} < len({{var "v"}}) {
- {{var "v"}} = {{var "v"}}[:{{var "j"}}]
- {{var "c"}} = true
- } else if {{var "j"}} == 0 && {{var "v"}} == nil {
- {{var "v"}} = []{{ .Typ }}{}
- {{var "c"}} = true
- }{{end}}
-}
-{{var "h"}}.End()
-{{if not isArray }}if {{var "c"}} {
- *{{ .Varname }} = {{var "v"}}
-}{{end}}
diff --git a/vendor/github.com/ugorji/go/codec/gen-dec-map.go.tmpl b/vendor/github.com/ugorji/go/codec/gen-dec-map.go.tmpl
deleted file mode 100644
index 77400e0a..00000000
--- a/vendor/github.com/ugorji/go/codec/gen-dec-map.go.tmpl
+++ /dev/null
@@ -1,58 +0,0 @@
-{{var "v"}} := *{{ .Varname }}
-{{var "l"}} := r.ReadMapStart()
-{{var "bh"}} := z.DecBasicHandle()
-if {{var "v"}} == nil {
- {{var "rl"}}, _ := z.DecInferLen({{var "l"}}, {{var "bh"}}.MaxInitLen, {{ .Size }})
- {{var "v"}} = make(map[{{ .KTyp }}]{{ .Typ }}, {{var "rl"}})
- *{{ .Varname }} = {{var "v"}}
-}
-var {{var "mk"}} {{ .KTyp }}
-var {{var "mv"}} {{ .Typ }}
-var {{var "mg"}} {{if decElemKindPtr}}, {{var "ms"}}, {{var "mok"}}{{end}} bool
-if {{var "bh"}}.MapValueReset {
- {{if decElemKindPtr}}{{var "mg"}} = true
- {{else if decElemKindIntf}}if !{{var "bh"}}.InterfaceReset { {{var "mg"}} = true }
- {{else if not decElemKindImmutable}}{{var "mg"}} = true
- {{end}} }
-if {{var "l"}} > 0 {
-for {{var "j"}} := 0; {{var "j"}} < {{var "l"}}; {{var "j"}}++ {
- z.DecSendContainerState(codecSelfer_containerMapKey{{ .Sfx }})
- {{ $x := printf "%vmk%v" .TempVar .Rand }}{{ decLineVarK $x }}
-{{ if eq .KTyp "interface{}" }}{{/* // special case if a byte array. */}}if {{var "bv"}}, {{var "bok"}} := {{var "mk"}}.([]byte); {{var "bok"}} {
- {{var "mk"}} = string({{var "bv"}})
- }{{ end }}{{if decElemKindPtr}}
- {{var "ms"}} = true{{end}}
- if {{var "mg"}} {
- {{if decElemKindPtr}}{{var "mv"}}, {{var "mok"}} = {{var "v"}}[{{var "mk"}}]
- if {{var "mok"}} {
- {{var "ms"}} = false
- } {{else}}{{var "mv"}} = {{var "v"}}[{{var "mk"}}] {{end}}
- } {{if not decElemKindImmutable}}else { {{var "mv"}} = {{decElemZero}} }{{end}}
- z.DecSendContainerState(codecSelfer_containerMapValue{{ .Sfx }})
- {{ $x := printf "%vmv%v" .TempVar .Rand }}{{ decLineVar $x }}
- if {{if decElemKindPtr}} {{var "ms"}} && {{end}} {{var "v"}} != nil {
- {{var "v"}}[{{var "mk"}}] = {{var "mv"}}
- }
-}
-} else if {{var "l"}} < 0 {
-for {{var "j"}} := 0; !r.CheckBreak(); {{var "j"}}++ {
- z.DecSendContainerState(codecSelfer_containerMapKey{{ .Sfx }})
- {{ $x := printf "%vmk%v" .TempVar .Rand }}{{ decLineVarK $x }}
-{{ if eq .KTyp "interface{}" }}{{/* // special case if a byte array. */}}if {{var "bv"}}, {{var "bok"}} := {{var "mk"}}.([]byte); {{var "bok"}} {
- {{var "mk"}} = string({{var "bv"}})
- }{{ end }}{{if decElemKindPtr}}
- {{var "ms"}} = true {{ end }}
- if {{var "mg"}} {
- {{if decElemKindPtr}}{{var "mv"}}, {{var "mok"}} = {{var "v"}}[{{var "mk"}}]
- if {{var "mok"}} {
- {{var "ms"}} = false
- } {{else}}{{var "mv"}} = {{var "v"}}[{{var "mk"}}] {{end}}
- } {{if not decElemKindImmutable}}else { {{var "mv"}} = {{decElemZero}} }{{end}}
- z.DecSendContainerState(codecSelfer_containerMapValue{{ .Sfx }})
- {{ $x := printf "%vmv%v" .TempVar .Rand }}{{ decLineVar $x }}
- if {{if decElemKindPtr}} {{var "ms"}} && {{end}} {{var "v"}} != nil {
- {{var "v"}}[{{var "mk"}}] = {{var "mv"}}
- }
-}
-} // else len==0: TODO: Should we clear map entries?
-z.DecSendContainerState(codecSelfer_containerMapEnd{{ .Sfx }})
diff --git a/vendor/github.com/ugorji/go/codec/gen-helper.generated.go b/vendor/github.com/ugorji/go/codec/gen-helper.generated.go
deleted file mode 100644
index 22bce776..00000000
--- a/vendor/github.com/ugorji/go/codec/gen-helper.generated.go
+++ /dev/null
@@ -1,233 +0,0 @@
-// //+build ignore
-
-// Copyright (c) 2012-2015 Ugorji Nwoke. All rights reserved.
-// Use of this source code is governed by a MIT license found in the LICENSE file.
-
-// ************************************************************
-// DO NOT EDIT.
-// THIS FILE IS AUTO-GENERATED from gen-helper.go.tmpl
-// ************************************************************
-
-package codec
-
-import (
- "encoding"
- "reflect"
-)
-
-// This file is used to generate helper code for codecgen.
-// The values here i.e. genHelper(En|De)coder are not to be used directly by
-// library users. They WILL change continously and without notice.
-//
-// To help enforce this, we create an unexported type with exported members.
-// The only way to get the type is via the one exported type that we control (somewhat).
-//
-// When static codecs are created for types, they will use this value
-// to perform encoding or decoding of primitives or known slice or map types.
-
-// GenHelperEncoder is exported so that it can be used externally by codecgen.
-// Library users: DO NOT USE IT DIRECTLY. IT WILL CHANGE CONTINOUSLY WITHOUT NOTICE.
-func GenHelperEncoder(e *Encoder) (genHelperEncoder, encDriver) {
- return genHelperEncoder{e: e}, e.e
-}
-
-// GenHelperDecoder is exported so that it can be used externally by codecgen.
-// Library users: DO NOT USE IT DIRECTLY. IT WILL CHANGE CONTINOUSLY WITHOUT NOTICE.
-func GenHelperDecoder(d *Decoder) (genHelperDecoder, decDriver) {
- return genHelperDecoder{d: d}, d.d
-}
-
-// FOR USE BY CODECGEN ONLY. IT *WILL* CHANGE WITHOUT NOTICE. *DO NOT USE*
-type genHelperEncoder struct {
- e *Encoder
- F fastpathT
-}
-
-// FOR USE BY CODECGEN ONLY. IT *WILL* CHANGE WITHOUT NOTICE. *DO NOT USE*
-type genHelperDecoder struct {
- d *Decoder
- F fastpathT
-}
-
-// FOR USE BY CODECGEN ONLY. IT *WILL* CHANGE WITHOUT NOTICE. *DO NOT USE*
-func (f genHelperEncoder) EncBasicHandle() *BasicHandle {
- return f.e.h
-}
-
-// FOR USE BY CODECGEN ONLY. IT *WILL* CHANGE WITHOUT NOTICE. *DO NOT USE*
-func (f genHelperEncoder) EncBinary() bool {
- return f.e.be // f.e.hh.isBinaryEncoding()
-}
-
-// FOR USE BY CODECGEN ONLY. IT *WILL* CHANGE WITHOUT NOTICE. *DO NOT USE*
-func (f genHelperEncoder) EncFallback(iv interface{}) {
- // println(">>>>>>>>> EncFallback")
- f.e.encodeI(iv, false, false)
-}
-
-// FOR USE BY CODECGEN ONLY. IT *WILL* CHANGE WITHOUT NOTICE. *DO NOT USE*
-func (f genHelperEncoder) EncTextMarshal(iv encoding.TextMarshaler) {
- bs, fnerr := iv.MarshalText()
- f.e.marshal(bs, fnerr, false, c_UTF8)
-}
-
-// FOR USE BY CODECGEN ONLY. IT *WILL* CHANGE WITHOUT NOTICE. *DO NOT USE*
-func (f genHelperEncoder) EncJSONMarshal(iv jsonMarshaler) {
- bs, fnerr := iv.MarshalJSON()
- f.e.marshal(bs, fnerr, true, c_UTF8)
-}
-
-// FOR USE BY CODECGEN ONLY. IT *WILL* CHANGE WITHOUT NOTICE. *DO NOT USE*
-func (f genHelperEncoder) EncBinaryMarshal(iv encoding.BinaryMarshaler) {
- bs, fnerr := iv.MarshalBinary()
- f.e.marshal(bs, fnerr, false, c_RAW)
-}
-
-// FOR USE BY CODECGEN ONLY. IT *WILL* CHANGE WITHOUT NOTICE. *DO NOT USE*
-func (f genHelperEncoder) TimeRtidIfBinc() uintptr {
- if _, ok := f.e.hh.(*BincHandle); ok {
- return timeTypId
- }
- return 0
-}
-
-// FOR USE BY CODECGEN ONLY. IT *WILL* CHANGE WITHOUT NOTICE. *DO NOT USE*
-func (f genHelperEncoder) IsJSONHandle() bool {
- return f.e.js
-}
-
-// FOR USE BY CODECGEN ONLY. IT *WILL* CHANGE WITHOUT NOTICE. *DO NOT USE*
-func (f genHelperEncoder) HasExtensions() bool {
- return len(f.e.h.extHandle) != 0
-}
-
-// FOR USE BY CODECGEN ONLY. IT *WILL* CHANGE WITHOUT NOTICE. *DO NOT USE*
-func (f genHelperEncoder) EncExt(v interface{}) (r bool) {
- rt := reflect.TypeOf(v)
- if rt.Kind() == reflect.Ptr {
- rt = rt.Elem()
- }
- rtid := reflect.ValueOf(rt).Pointer()
- if xfFn := f.e.h.getExt(rtid); xfFn != nil {
- f.e.e.EncodeExt(v, xfFn.tag, xfFn.ext, f.e)
- return true
- }
- return false
-}
-
-// FOR USE BY CODECGEN ONLY. IT *WILL* CHANGE WITHOUT NOTICE. *DO NOT USE*
-func (f genHelperEncoder) EncSendContainerState(c containerState) {
- if f.e.cr != nil {
- f.e.cr.sendContainerState(c)
- }
-}
-
-// ---------------- DECODER FOLLOWS -----------------
-
-// FOR USE BY CODECGEN ONLY. IT *WILL* CHANGE WITHOUT NOTICE. *DO NOT USE*
-func (f genHelperDecoder) DecBasicHandle() *BasicHandle {
- return f.d.h
-}
-
-// FOR USE BY CODECGEN ONLY. IT *WILL* CHANGE WITHOUT NOTICE. *DO NOT USE*
-func (f genHelperDecoder) DecBinary() bool {
- return f.d.be // f.d.hh.isBinaryEncoding()
-}
-
-// FOR USE BY CODECGEN ONLY. IT *WILL* CHANGE WITHOUT NOTICE. *DO NOT USE*
-func (f genHelperDecoder) DecSwallow() {
- f.d.swallow()
-}
-
-// FOR USE BY CODECGEN ONLY. IT *WILL* CHANGE WITHOUT NOTICE. *DO NOT USE*
-func (f genHelperDecoder) DecScratchBuffer() []byte {
- return f.d.b[:]
-}
-
-// FOR USE BY CODECGEN ONLY. IT *WILL* CHANGE WITHOUT NOTICE. *DO NOT USE*
-func (f genHelperDecoder) DecFallback(iv interface{}, chkPtr bool) {
- // println(">>>>>>>>> DecFallback")
- f.d.decodeI(iv, chkPtr, false, false, false)
-}
-
-// FOR USE BY CODECGEN ONLY. IT *WILL* CHANGE WITHOUT NOTICE. *DO NOT USE*
-func (f genHelperDecoder) DecSliceHelperStart() (decSliceHelper, int) {
- return f.d.decSliceHelperStart()
-}
-
-// FOR USE BY CODECGEN ONLY. IT *WILL* CHANGE WITHOUT NOTICE. *DO NOT USE*
-func (f genHelperDecoder) DecStructFieldNotFound(index int, name string) {
- f.d.structFieldNotFound(index, name)
-}
-
-// FOR USE BY CODECGEN ONLY. IT *WILL* CHANGE WITHOUT NOTICE. *DO NOT USE*
-func (f genHelperDecoder) DecArrayCannotExpand(sliceLen, streamLen int) {
- f.d.arrayCannotExpand(sliceLen, streamLen)
-}
-
-// FOR USE BY CODECGEN ONLY. IT *WILL* CHANGE WITHOUT NOTICE. *DO NOT USE*
-func (f genHelperDecoder) DecTextUnmarshal(tm encoding.TextUnmarshaler) {
- fnerr := tm.UnmarshalText(f.d.d.DecodeBytes(f.d.b[:], true, true))
- if fnerr != nil {
- panic(fnerr)
- }
-}
-
-// FOR USE BY CODECGEN ONLY. IT *WILL* CHANGE WITHOUT NOTICE. *DO NOT USE*
-func (f genHelperDecoder) DecJSONUnmarshal(tm jsonUnmarshaler) {
- // bs := f.dd.DecodeBytes(f.d.b[:], true, true)
- // grab the bytes to be read, as UnmarshalJSON needs the full JSON so as to unmarshal it itself.
- fnerr := tm.UnmarshalJSON(f.d.nextValueBytes())
- if fnerr != nil {
- panic(fnerr)
- }
-}
-
-// FOR USE BY CODECGEN ONLY. IT *WILL* CHANGE WITHOUT NOTICE. *DO NOT USE*
-func (f genHelperDecoder) DecBinaryUnmarshal(bm encoding.BinaryUnmarshaler) {
- fnerr := bm.UnmarshalBinary(f.d.d.DecodeBytes(nil, false, true))
- if fnerr != nil {
- panic(fnerr)
- }
-}
-
-// FOR USE BY CODECGEN ONLY. IT *WILL* CHANGE WITHOUT NOTICE. *DO NOT USE*
-func (f genHelperDecoder) TimeRtidIfBinc() uintptr {
- if _, ok := f.d.hh.(*BincHandle); ok {
- return timeTypId
- }
- return 0
-}
-
-// FOR USE BY CODECGEN ONLY. IT *WILL* CHANGE WITHOUT NOTICE. *DO NOT USE*
-func (f genHelperDecoder) IsJSONHandle() bool {
- return f.d.js
-}
-
-// FOR USE BY CODECGEN ONLY. IT *WILL* CHANGE WITHOUT NOTICE. *DO NOT USE*
-func (f genHelperDecoder) HasExtensions() bool {
- return len(f.d.h.extHandle) != 0
-}
-
-// FOR USE BY CODECGEN ONLY. IT *WILL* CHANGE WITHOUT NOTICE. *DO NOT USE*
-func (f genHelperDecoder) DecExt(v interface{}) (r bool) {
- rt := reflect.TypeOf(v).Elem()
- rtid := reflect.ValueOf(rt).Pointer()
- if xfFn := f.d.h.getExt(rtid); xfFn != nil {
- f.d.d.DecodeExt(v, xfFn.tag, xfFn.ext)
- return true
- }
- return false
-}
-
-// FOR USE BY CODECGEN ONLY. IT *WILL* CHANGE WITHOUT NOTICE. *DO NOT USE*
-func (f genHelperDecoder) DecInferLen(clen, maxlen, unit int) (rvlen int, truncated bool) {
- return decInferLen(clen, maxlen, unit)
-}
-
-// FOR USE BY CODECGEN ONLY. IT *WILL* CHANGE WITHOUT NOTICE. *DO NOT USE*
-func (f genHelperDecoder) DecSendContainerState(c containerState) {
- if f.d.cr != nil {
- f.d.cr.sendContainerState(c)
- }
-}
diff --git a/vendor/github.com/ugorji/go/codec/gen-helper.go.tmpl b/vendor/github.com/ugorji/go/codec/gen-helper.go.tmpl
deleted file mode 100644
index 31958574..00000000
--- a/vendor/github.com/ugorji/go/codec/gen-helper.go.tmpl
+++ /dev/null
@@ -1,364 +0,0 @@
-// //+build ignore
-
-// Copyright (c) 2012-2015 Ugorji Nwoke. All rights reserved.
-// Use of this source code is governed by a MIT license found in the LICENSE file.
-
-// ************************************************************
-// DO NOT EDIT.
-// THIS FILE IS AUTO-GENERATED from gen-helper.go.tmpl
-// ************************************************************
-
-package codec
-
-import (
- "encoding"
- "reflect"
-)
-
-// This file is used to generate helper code for codecgen.
-// The values here i.e. genHelper(En|De)coder are not to be used directly by
-// library users. They WILL change continously and without notice.
-//
-// To help enforce this, we create an unexported type with exported members.
-// The only way to get the type is via the one exported type that we control (somewhat).
-//
-// When static codecs are created for types, they will use this value
-// to perform encoding or decoding of primitives or known slice or map types.
-
-// GenHelperEncoder is exported so that it can be used externally by codecgen.
-// Library users: DO NOT USE IT DIRECTLY. IT WILL CHANGE CONTINOUSLY WITHOUT NOTICE.
-func GenHelperEncoder(e *Encoder) (genHelperEncoder, encDriver) {
- return genHelperEncoder{e:e}, e.e
-}
-
-// GenHelperDecoder is exported so that it can be used externally by codecgen.
-// Library users: DO NOT USE IT DIRECTLY. IT WILL CHANGE CONTINOUSLY WITHOUT NOTICE.
-func GenHelperDecoder(d *Decoder) (genHelperDecoder, decDriver) {
- return genHelperDecoder{d:d}, d.d
-}
-
-// FOR USE BY CODECGEN ONLY. IT *WILL* CHANGE WITHOUT NOTICE. *DO NOT USE*
-type genHelperEncoder struct {
- e *Encoder
- F fastpathT
-}
-
-// FOR USE BY CODECGEN ONLY. IT *WILL* CHANGE WITHOUT NOTICE. *DO NOT USE*
-type genHelperDecoder struct {
- d *Decoder
- F fastpathT
-}
-
-// FOR USE BY CODECGEN ONLY. IT *WILL* CHANGE WITHOUT NOTICE. *DO NOT USE*
-func (f genHelperEncoder) EncBasicHandle() *BasicHandle {
- return f.e.h
-}
-
-// FOR USE BY CODECGEN ONLY. IT *WILL* CHANGE WITHOUT NOTICE. *DO NOT USE*
-func (f genHelperEncoder) EncBinary() bool {
- return f.e.be // f.e.hh.isBinaryEncoding()
-}
-// FOR USE BY CODECGEN ONLY. IT *WILL* CHANGE WITHOUT NOTICE. *DO NOT USE*
-func (f genHelperEncoder) EncFallback(iv interface{}) {
- // println(">>>>>>>>> EncFallback")
- f.e.encodeI(iv, false, false)
-}
-// FOR USE BY CODECGEN ONLY. IT *WILL* CHANGE WITHOUT NOTICE. *DO NOT USE*
-func (f genHelperEncoder) EncTextMarshal(iv encoding.TextMarshaler) {
- bs, fnerr := iv.MarshalText()
- f.e.marshal(bs, fnerr, false, c_UTF8)
-}
-// FOR USE BY CODECGEN ONLY. IT *WILL* CHANGE WITHOUT NOTICE. *DO NOT USE*
-func (f genHelperEncoder) EncJSONMarshal(iv jsonMarshaler) {
- bs, fnerr := iv.MarshalJSON()
- f.e.marshal(bs, fnerr, true, c_UTF8)
-}
-// FOR USE BY CODECGEN ONLY. IT *WILL* CHANGE WITHOUT NOTICE. *DO NOT USE*
-func (f genHelperEncoder) EncBinaryMarshal(iv encoding.BinaryMarshaler) {
- bs, fnerr := iv.MarshalBinary()
- f.e.marshal(bs, fnerr, false, c_RAW)
-}
-// FOR USE BY CODECGEN ONLY. IT *WILL* CHANGE WITHOUT NOTICE. *DO NOT USE*
-func (f genHelperEncoder) TimeRtidIfBinc() uintptr {
- if _, ok := f.e.hh.(*BincHandle); ok {
- return timeTypId
- }
- return 0
-}
-// FOR USE BY CODECGEN ONLY. IT *WILL* CHANGE WITHOUT NOTICE. *DO NOT USE*
-func (f genHelperEncoder) IsJSONHandle() bool {
- return f.e.js
-}
-// FOR USE BY CODECGEN ONLY. IT *WILL* CHANGE WITHOUT NOTICE. *DO NOT USE*
-func (f genHelperEncoder) HasExtensions() bool {
- return len(f.e.h.extHandle) != 0
-}
-// FOR USE BY CODECGEN ONLY. IT *WILL* CHANGE WITHOUT NOTICE. *DO NOT USE*
-func (f genHelperEncoder) EncExt(v interface{}) (r bool) {
- rt := reflect.TypeOf(v)
- if rt.Kind() == reflect.Ptr {
- rt = rt.Elem()
- }
- rtid := reflect.ValueOf(rt).Pointer()
- if xfFn := f.e.h.getExt(rtid); xfFn != nil {
- f.e.e.EncodeExt(v, xfFn.tag, xfFn.ext, f.e)
- return true
- }
- return false
-}
-// FOR USE BY CODECGEN ONLY. IT *WILL* CHANGE WITHOUT NOTICE. *DO NOT USE*
-func (f genHelperEncoder) EncSendContainerState(c containerState) {
- if f.e.cr != nil {
- f.e.cr.sendContainerState(c)
- }
-}
-
-// ---------------- DECODER FOLLOWS -----------------
-
-// FOR USE BY CODECGEN ONLY. IT *WILL* CHANGE WITHOUT NOTICE. *DO NOT USE*
-func (f genHelperDecoder) DecBasicHandle() *BasicHandle {
- return f.d.h
-}
-// FOR USE BY CODECGEN ONLY. IT *WILL* CHANGE WITHOUT NOTICE. *DO NOT USE*
-func (f genHelperDecoder) DecBinary() bool {
- return f.d.be // f.d.hh.isBinaryEncoding()
-}
-// FOR USE BY CODECGEN ONLY. IT *WILL* CHANGE WITHOUT NOTICE. *DO NOT USE*
-func (f genHelperDecoder) DecSwallow() {
- f.d.swallow()
-}
-// FOR USE BY CODECGEN ONLY. IT *WILL* CHANGE WITHOUT NOTICE. *DO NOT USE*
-func (f genHelperDecoder) DecScratchBuffer() []byte {
- return f.d.b[:]
-}
-// FOR USE BY CODECGEN ONLY. IT *WILL* CHANGE WITHOUT NOTICE. *DO NOT USE*
-func (f genHelperDecoder) DecFallback(iv interface{}, chkPtr bool) {
- // println(">>>>>>>>> DecFallback")
- f.d.decodeI(iv, chkPtr, false, false, false)
-}
-// FOR USE BY CODECGEN ONLY. IT *WILL* CHANGE WITHOUT NOTICE. *DO NOT USE*
-func (f genHelperDecoder) DecSliceHelperStart() (decSliceHelper, int) {
- return f.d.decSliceHelperStart()
-}
-// FOR USE BY CODECGEN ONLY. IT *WILL* CHANGE WITHOUT NOTICE. *DO NOT USE*
-func (f genHelperDecoder) DecStructFieldNotFound(index int, name string) {
- f.d.structFieldNotFound(index, name)
-}
-// FOR USE BY CODECGEN ONLY. IT *WILL* CHANGE WITHOUT NOTICE. *DO NOT USE*
-func (f genHelperDecoder) DecArrayCannotExpand(sliceLen, streamLen int) {
- f.d.arrayCannotExpand(sliceLen, streamLen)
-}
-// FOR USE BY CODECGEN ONLY. IT *WILL* CHANGE WITHOUT NOTICE. *DO NOT USE*
-func (f genHelperDecoder) DecTextUnmarshal(tm encoding.TextUnmarshaler) {
- fnerr := tm.UnmarshalText(f.d.d.DecodeBytes(f.d.b[:], true, true))
- if fnerr != nil {
- panic(fnerr)
- }
-}
-// FOR USE BY CODECGEN ONLY. IT *WILL* CHANGE WITHOUT NOTICE. *DO NOT USE*
-func (f genHelperDecoder) DecJSONUnmarshal(tm jsonUnmarshaler) {
- // bs := f.dd.DecodeBytes(f.d.b[:], true, true)
- // grab the bytes to be read, as UnmarshalJSON needs the full JSON so as to unmarshal it itself.
- fnerr := tm.UnmarshalJSON(f.d.nextValueBytes())
- if fnerr != nil {
- panic(fnerr)
- }
-}
-// FOR USE BY CODECGEN ONLY. IT *WILL* CHANGE WITHOUT NOTICE. *DO NOT USE*
-func (f genHelperDecoder) DecBinaryUnmarshal(bm encoding.BinaryUnmarshaler) {
- fnerr := bm.UnmarshalBinary(f.d.d.DecodeBytes(nil, false, true))
- if fnerr != nil {
- panic(fnerr)
- }
-}
-// FOR USE BY CODECGEN ONLY. IT *WILL* CHANGE WITHOUT NOTICE. *DO NOT USE*
-func (f genHelperDecoder) TimeRtidIfBinc() uintptr {
- if _, ok := f.d.hh.(*BincHandle); ok {
- return timeTypId
- }
- return 0
-}
-// FOR USE BY CODECGEN ONLY. IT *WILL* CHANGE WITHOUT NOTICE. *DO NOT USE*
-func (f genHelperDecoder) IsJSONHandle() bool {
- return f.d.js
-}
-// FOR USE BY CODECGEN ONLY. IT *WILL* CHANGE WITHOUT NOTICE. *DO NOT USE*
-func (f genHelperDecoder) HasExtensions() bool {
- return len(f.d.h.extHandle) != 0
-}
-// FOR USE BY CODECGEN ONLY. IT *WILL* CHANGE WITHOUT NOTICE. *DO NOT USE*
-func (f genHelperDecoder) DecExt(v interface{}) (r bool) {
- rt := reflect.TypeOf(v).Elem()
- rtid := reflect.ValueOf(rt).Pointer()
- if xfFn := f.d.h.getExt(rtid); xfFn != nil {
- f.d.d.DecodeExt(v, xfFn.tag, xfFn.ext)
- return true
- }
- return false
-}
-// FOR USE BY CODECGEN ONLY. IT *WILL* CHANGE WITHOUT NOTICE. *DO NOT USE*
-func (f genHelperDecoder) DecInferLen(clen, maxlen, unit int) (rvlen int, truncated bool) {
- return decInferLen(clen, maxlen, unit)
-}
-// FOR USE BY CODECGEN ONLY. IT *WILL* CHANGE WITHOUT NOTICE. *DO NOT USE*
-func (f genHelperDecoder) DecSendContainerState(c containerState) {
- if f.d.cr != nil {
- f.d.cr.sendContainerState(c)
- }
-}
-
-{{/*
-
-// FOR USE BY CODECGEN ONLY. IT *WILL* CHANGE WITHOUT NOTICE. *DO NOT USE*
-func (f genHelperEncoder) EncDriver() encDriver {
- return f.e.e
-}
-// FOR USE BY CODECGEN ONLY. IT *WILL* CHANGE WITHOUT NOTICE. *DO NOT USE*
-func (f genHelperDecoder) DecDriver() decDriver {
- return f.d.d
-}
-
-// FOR USE BY CODECGEN ONLY. IT *WILL* CHANGE WITHOUT NOTICE. *DO NOT USE*
-func (f genHelperEncoder) EncNil() {
- f.e.e.EncodeNil()
-}
-// FOR USE BY CODECGEN ONLY. IT *WILL* CHANGE WITHOUT NOTICE. *DO NOT USE*
-func (f genHelperEncoder) EncBytes(v []byte) {
- f.e.e.EncodeStringBytes(c_RAW, v)
-}
-// FOR USE BY CODECGEN ONLY. IT *WILL* CHANGE WITHOUT NOTICE. *DO NOT USE*
-func (f genHelperEncoder) EncArrayStart(length int) {
- f.e.e.EncodeArrayStart(length)
-}
-// FOR USE BY CODECGEN ONLY. IT *WILL* CHANGE WITHOUT NOTICE. *DO NOT USE*
-func (f genHelperEncoder) EncArrayEnd() {
- f.e.e.EncodeArrayEnd()
-}
-// FOR USE BY CODECGEN ONLY. IT *WILL* CHANGE WITHOUT NOTICE. *DO NOT USE*
-func (f genHelperEncoder) EncArrayEntrySeparator() {
- f.e.e.EncodeArrayEntrySeparator()
-}
-// FOR USE BY CODECGEN ONLY. IT *WILL* CHANGE WITHOUT NOTICE. *DO NOT USE*
-func (f genHelperEncoder) EncMapStart(length int) {
- f.e.e.EncodeMapStart(length)
-}
-// FOR USE BY CODECGEN ONLY. IT *WILL* CHANGE WITHOUT NOTICE. *DO NOT USE*
-func (f genHelperEncoder) EncMapEnd() {
- f.e.e.EncodeMapEnd()
-}
-// FOR USE BY CODECGEN ONLY. IT *WILL* CHANGE WITHOUT NOTICE. *DO NOT USE*
-func (f genHelperEncoder) EncMapEntrySeparator() {
- f.e.e.EncodeMapEntrySeparator()
-}
-// FOR USE BY CODECGEN ONLY. IT *WILL* CHANGE WITHOUT NOTICE. *DO NOT USE*
-func (f genHelperEncoder) EncMapKVSeparator() {
- f.e.e.EncodeMapKVSeparator()
-}
-
-// ---------
-
-// FOR USE BY CODECGEN ONLY. IT *WILL* CHANGE WITHOUT NOTICE. *DO NOT USE*
-func (f genHelperDecoder) DecBytes(v *[]byte) {
- *v = f.d.d.DecodeBytes(*v)
-}
-// FOR USE BY CODECGEN ONLY. IT *WILL* CHANGE WITHOUT NOTICE. *DO NOT USE*
-func (f genHelperDecoder) DecTryNil() bool {
- return f.d.d.TryDecodeAsNil()
-}
-// FOR USE BY CODECGEN ONLY. IT *WILL* CHANGE WITHOUT NOTICE. *DO NOT USE*
-func (f genHelperDecoder) DecContainerIsNil() (b bool) {
- return f.d.d.IsContainerType(valueTypeNil)
-}
-// FOR USE BY CODECGEN ONLY. IT *WILL* CHANGE WITHOUT NOTICE. *DO NOT USE*
-func (f genHelperDecoder) DecContainerIsMap() (b bool) {
- return f.d.d.IsContainerType(valueTypeMap)
-}
-// FOR USE BY CODECGEN ONLY. IT *WILL* CHANGE WITHOUT NOTICE. *DO NOT USE*
-func (f genHelperDecoder) DecContainerIsArray() (b bool) {
- return f.d.d.IsContainerType(valueTypeArray)
-}
-// FOR USE BY CODECGEN ONLY. IT *WILL* CHANGE WITHOUT NOTICE. *DO NOT USE*
-func (f genHelperDecoder) DecCheckBreak() bool {
- return f.d.d.CheckBreak()
-}
-// FOR USE BY CODECGEN ONLY. IT *WILL* CHANGE WITHOUT NOTICE. *DO NOT USE*
-func (f genHelperDecoder) DecMapStart() int {
- return f.d.d.ReadMapStart()
-}
-// FOR USE BY CODECGEN ONLY. IT *WILL* CHANGE WITHOUT NOTICE. *DO NOT USE*
-func (f genHelperDecoder) DecArrayStart() int {
- return f.d.d.ReadArrayStart()
-}
-// FOR USE BY CODECGEN ONLY. IT *WILL* CHANGE WITHOUT NOTICE. *DO NOT USE*
-func (f genHelperDecoder) DecMapEnd() {
- f.d.d.ReadMapEnd()
-}
-// FOR USE BY CODECGEN ONLY. IT *WILL* CHANGE WITHOUT NOTICE. *DO NOT USE*
-func (f genHelperDecoder) DecArrayEnd() {
- f.d.d.ReadArrayEnd()
-}
-// FOR USE BY CODECGEN ONLY. IT *WILL* CHANGE WITHOUT NOTICE. *DO NOT USE*
-func (f genHelperDecoder) DecArrayEntrySeparator() {
- f.d.d.ReadArrayEntrySeparator()
-}
-// FOR USE BY CODECGEN ONLY. IT *WILL* CHANGE WITHOUT NOTICE. *DO NOT USE*
-func (f genHelperDecoder) DecMapEntrySeparator() {
- f.d.d.ReadMapEntrySeparator()
-}
-// FOR USE BY CODECGEN ONLY. IT *WILL* CHANGE WITHOUT NOTICE. *DO NOT USE*
-func (f genHelperDecoder) DecMapKVSeparator() {
- f.d.d.ReadMapKVSeparator()
-}
-// FOR USE BY CODECGEN ONLY. IT *WILL* CHANGE WITHOUT NOTICE. *DO NOT USE*
-func (f genHelperDecoder) ReadStringAsBytes(bs []byte) []byte {
- return f.d.d.DecodeStringAsBytes(bs)
-}
-
-
-// -- encode calls (primitives)
-{{range .Values}}{{if .Primitive }}{{if ne .Primitive "interface{}" }}
-// FOR USE BY CODECGEN ONLY. IT *WILL* CHANGE WITHOUT NOTICE. *DO NOT USE*
-func (f genHelperEncoder) {{ .MethodNamePfx "Enc" true }}(v {{ .Primitive }}) {
- ee := f.e.e
- {{ encmd .Primitive "v" }}
-}
-{{ end }}{{ end }}{{ end }}
-
-// -- decode calls (primitives)
-{{range .Values}}{{if .Primitive }}{{if ne .Primitive "interface{}" }}
-// FOR USE BY CODECGEN ONLY. IT *WILL* CHANGE WITHOUT NOTICE. *DO NOT USE*
-func (f genHelperDecoder) {{ .MethodNamePfx "Dec" true }}(vp *{{ .Primitive }}) {
- dd := f.d.d
- *vp = {{ decmd .Primitive }}
-}
-// FOR USE BY CODECGEN ONLY. IT *WILL* CHANGE WITHOUT NOTICE. *DO NOT USE*
-func (f genHelperDecoder) {{ .MethodNamePfx "Read" true }}() (v {{ .Primitive }}) {
- dd := f.d.d
- v = {{ decmd .Primitive }}
- return
-}
-{{ end }}{{ end }}{{ end }}
-
-
-// -- encode calls (slices/maps)
-{{range .Values}}{{if not .Primitive }}{{if .Slice }}
-// FOR USE BY CODECGEN ONLY. IT *WILL* CHANGE WITHOUT NOTICE. *DO NOT USE*
-func (f genHelperEncoder) {{ .MethodNamePfx "Enc" false }}(v []{{ .Elem }}) { {{ else }}
-// FOR USE BY CODECGEN ONLY. IT *WILL* CHANGE WITHOUT NOTICE. *DO NOT USE*
-func (f genHelperEncoder) {{ .MethodNamePfx "Enc" false }}(v map[{{ .MapKey }}]{{ .Elem }}) { {{end}}
- f.F.{{ .MethodNamePfx "Enc" false }}V(v, false, f.e)
-}
-{{ end }}{{ end }}
-
-// -- decode calls (slices/maps)
-{{range .Values}}{{if not .Primitive }}
-// FOR USE BY CODECGEN ONLY. IT *WILL* CHANGE WITHOUT NOTICE. *DO NOT USE*
-{{if .Slice }}func (f genHelperDecoder) {{ .MethodNamePfx "Dec" false }}(vp *[]{{ .Elem }}) {
-{{else}}func (f genHelperDecoder) {{ .MethodNamePfx "Dec" false }}(vp *map[{{ .MapKey }}]{{ .Elem }}) { {{end}}
- v, changed := f.F.{{ .MethodNamePfx "Dec" false }}V(*vp, false, true, f.d)
- if changed {
- *vp = v
- }
-}
-{{ end }}{{ end }}
-*/}}
diff --git a/vendor/github.com/ugorji/go/codec/gen.generated.go b/vendor/github.com/ugorji/go/codec/gen.generated.go
deleted file mode 100644
index b130ed67..00000000
--- a/vendor/github.com/ugorji/go/codec/gen.generated.go
+++ /dev/null
@@ -1,174 +0,0 @@
-// Copyright (c) 2012-2015 Ugorji Nwoke. All rights reserved.
-// Use of this source code is governed by a MIT license found in the LICENSE file.
-
-package codec
-
-// DO NOT EDIT. THIS FILE IS AUTO-GENERATED FROM gen-dec-(map|array).go.tmpl
-
-const genDecMapTmpl = `
-{{var "v"}} := *{{ .Varname }}
-{{var "l"}} := r.ReadMapStart()
-{{var "bh"}} := z.DecBasicHandle()
-if {{var "v"}} == nil {
- {{var "rl"}}, _ := z.DecInferLen({{var "l"}}, {{var "bh"}}.MaxInitLen, {{ .Size }})
- {{var "v"}} = make(map[{{ .KTyp }}]{{ .Typ }}, {{var "rl"}})
- *{{ .Varname }} = {{var "v"}}
-}
-var {{var "mk"}} {{ .KTyp }}
-var {{var "mv"}} {{ .Typ }}
-var {{var "mg"}} {{if decElemKindPtr}}, {{var "ms"}}, {{var "mok"}}{{end}} bool
-if {{var "bh"}}.MapValueReset {
- {{if decElemKindPtr}}{{var "mg"}} = true
- {{else if decElemKindIntf}}if !{{var "bh"}}.InterfaceReset { {{var "mg"}} = true }
- {{else if not decElemKindImmutable}}{{var "mg"}} = true
- {{end}} }
-if {{var "l"}} > 0 {
-for {{var "j"}} := 0; {{var "j"}} < {{var "l"}}; {{var "j"}}++ {
- z.DecSendContainerState(codecSelfer_containerMapKey{{ .Sfx }})
- {{ $x := printf "%vmk%v" .TempVar .Rand }}{{ decLineVarK $x }}
-{{ if eq .KTyp "interface{}" }}{{/* // special case if a byte array. */}}if {{var "bv"}}, {{var "bok"}} := {{var "mk"}}.([]byte); {{var "bok"}} {
- {{var "mk"}} = string({{var "bv"}})
- }{{ end }}{{if decElemKindPtr}}
- {{var "ms"}} = true{{end}}
- if {{var "mg"}} {
- {{if decElemKindPtr}}{{var "mv"}}, {{var "mok"}} = {{var "v"}}[{{var "mk"}}]
- if {{var "mok"}} {
- {{var "ms"}} = false
- } {{else}}{{var "mv"}} = {{var "v"}}[{{var "mk"}}] {{end}}
- } {{if not decElemKindImmutable}}else { {{var "mv"}} = {{decElemZero}} }{{end}}
- z.DecSendContainerState(codecSelfer_containerMapValue{{ .Sfx }})
- {{ $x := printf "%vmv%v" .TempVar .Rand }}{{ decLineVar $x }}
- if {{if decElemKindPtr}} {{var "ms"}} && {{end}} {{var "v"}} != nil {
- {{var "v"}}[{{var "mk"}}] = {{var "mv"}}
- }
-}
-} else if {{var "l"}} < 0 {
-for {{var "j"}} := 0; !r.CheckBreak(); {{var "j"}}++ {
- z.DecSendContainerState(codecSelfer_containerMapKey{{ .Sfx }})
- {{ $x := printf "%vmk%v" .TempVar .Rand }}{{ decLineVarK $x }}
-{{ if eq .KTyp "interface{}" }}{{/* // special case if a byte array. */}}if {{var "bv"}}, {{var "bok"}} := {{var "mk"}}.([]byte); {{var "bok"}} {
- {{var "mk"}} = string({{var "bv"}})
- }{{ end }}{{if decElemKindPtr}}
- {{var "ms"}} = true {{ end }}
- if {{var "mg"}} {
- {{if decElemKindPtr}}{{var "mv"}}, {{var "mok"}} = {{var "v"}}[{{var "mk"}}]
- if {{var "mok"}} {
- {{var "ms"}} = false
- } {{else}}{{var "mv"}} = {{var "v"}}[{{var "mk"}}] {{end}}
- } {{if not decElemKindImmutable}}else { {{var "mv"}} = {{decElemZero}} }{{end}}
- z.DecSendContainerState(codecSelfer_containerMapValue{{ .Sfx }})
- {{ $x := printf "%vmv%v" .TempVar .Rand }}{{ decLineVar $x }}
- if {{if decElemKindPtr}} {{var "ms"}} && {{end}} {{var "v"}} != nil {
- {{var "v"}}[{{var "mk"}}] = {{var "mv"}}
- }
-}
-} // else len==0: TODO: Should we clear map entries?
-z.DecSendContainerState(codecSelfer_containerMapEnd{{ .Sfx }})
-`
-
-const genDecListTmpl = `
-{{var "v"}} := {{if not isArray}}*{{end}}{{ .Varname }}
-{{var "h"}}, {{var "l"}} := z.DecSliceHelperStart() {{/* // helper, containerLenS */}}{{if not isArray}}
-var {{var "c"}} bool {{/* // changed */}}
-_ = {{var "c"}}{{end}}
-if {{var "l"}} == 0 {
- {{if isSlice }}if {{var "v"}} == nil {
- {{var "v"}} = []{{ .Typ }}{}
- {{var "c"}} = true
- } else if len({{var "v"}}) != 0 {
- {{var "v"}} = {{var "v"}}[:0]
- {{var "c"}} = true
- } {{end}} {{if isChan }}if {{var "v"}} == nil {
- {{var "v"}} = make({{ .CTyp }}, 0)
- {{var "c"}} = true
- } {{end}}
-} else if {{var "l"}} > 0 {
- {{if isChan }}if {{var "v"}} == nil {
- {{var "rl"}}, _ = z.DecInferLen({{var "l"}}, z.DecBasicHandle().MaxInitLen, {{ .Size }})
- {{var "v"}} = make({{ .CTyp }}, {{var "rl"}})
- {{var "c"}} = true
- }
- for {{var "r"}} := 0; {{var "r"}} < {{var "l"}}; {{var "r"}}++ {
- {{var "h"}}.ElemContainerState({{var "r"}})
- var {{var "t"}} {{ .Typ }}
- {{ $x := printf "%st%s" .TempVar .Rand }}{{ decLineVar $x }}
- {{var "v"}} <- {{var "t"}}
- }
- {{ else }} var {{var "rr"}}, {{var "rl"}} int {{/* // num2read, length of slice/array/chan */}}
- var {{var "rt"}} bool {{/* truncated */}}
- _, _ = {{var "rl"}}, {{var "rt"}}
- {{var "rr"}} = {{var "l"}} // len({{var "v"}})
- if {{var "l"}} > cap({{var "v"}}) {
- {{if isArray }}z.DecArrayCannotExpand(len({{var "v"}}), {{var "l"}})
- {{ else }}{{if not .Immutable }}
- {{var "rg"}} := len({{var "v"}}) > 0
- {{var "v2"}} := {{var "v"}} {{end}}
- {{var "rl"}}, {{var "rt"}} = z.DecInferLen({{var "l"}}, z.DecBasicHandle().MaxInitLen, {{ .Size }})
- if {{var "rt"}} {
- if {{var "rl"}} <= cap({{var "v"}}) {
- {{var "v"}} = {{var "v"}}[:{{var "rl"}}]
- } else {
- {{var "v"}} = make([]{{ .Typ }}, {{var "rl"}})
- }
- } else {
- {{var "v"}} = make([]{{ .Typ }}, {{var "rl"}})
- }
- {{var "c"}} = true
- {{var "rr"}} = len({{var "v"}}) {{if not .Immutable }}
- if {{var "rg"}} { copy({{var "v"}}, {{var "v2"}}) } {{end}} {{end}}{{/* end not Immutable, isArray */}}
- } {{if isSlice }} else if {{var "l"}} != len({{var "v"}}) {
- {{var "v"}} = {{var "v"}}[:{{var "l"}}]
- {{var "c"}} = true
- } {{end}} {{/* end isSlice:47 */}}
- {{var "j"}} := 0
- for ; {{var "j"}} < {{var "rr"}} ; {{var "j"}}++ {
- {{var "h"}}.ElemContainerState({{var "j"}})
- {{ $x := printf "%[1]vv%[2]v[%[1]vj%[2]v]" .TempVar .Rand }}{{ decLineVar $x }}
- }
- {{if isArray }}for ; {{var "j"}} < {{var "l"}} ; {{var "j"}}++ {
- {{var "h"}}.ElemContainerState({{var "j"}})
- z.DecSwallow()
- }
- {{ else }}if {{var "rt"}} {
- for ; {{var "j"}} < {{var "l"}} ; {{var "j"}}++ {
- {{var "v"}} = append({{var "v"}}, {{ zero}})
- {{var "h"}}.ElemContainerState({{var "j"}})
- {{ $x := printf "%[1]vv%[2]v[%[1]vj%[2]v]" .TempVar .Rand }}{{ decLineVar $x }}
- }
- } {{end}} {{/* end isArray:56 */}}
- {{end}} {{/* end isChan:16 */}}
-} else { {{/* len < 0 */}}
- {{var "j"}} := 0
- for ; !r.CheckBreak(); {{var "j"}}++ {
- {{if isChan }}
- {{var "h"}}.ElemContainerState({{var "j"}})
- var {{var "t"}} {{ .Typ }}
- {{ $x := printf "%st%s" .TempVar .Rand }}{{ decLineVar $x }}
- {{var "v"}} <- {{var "t"}}
- {{ else }}
- if {{var "j"}} >= len({{var "v"}}) {
- {{if isArray }}z.DecArrayCannotExpand(len({{var "v"}}), {{var "j"}}+1)
- {{ else }}{{var "v"}} = append({{var "v"}}, {{zero}})// var {{var "z"}} {{ .Typ }}
- {{var "c"}} = true {{end}}
- }
- {{var "h"}}.ElemContainerState({{var "j"}})
- if {{var "j"}} < len({{var "v"}}) {
- {{ $x := printf "%[1]vv%[2]v[%[1]vj%[2]v]" .TempVar .Rand }}{{ decLineVar $x }}
- } else {
- z.DecSwallow()
- }
- {{end}}
- }
- {{if isSlice }}if {{var "j"}} < len({{var "v"}}) {
- {{var "v"}} = {{var "v"}}[:{{var "j"}}]
- {{var "c"}} = true
- } else if {{var "j"}} == 0 && {{var "v"}} == nil {
- {{var "v"}} = []{{ .Typ }}{}
- {{var "c"}} = true
- }{{end}}
-}
-{{var "h"}}.End()
-{{if not isArray }}if {{var "c"}} {
- *{{ .Varname }} = {{var "v"}}
-}{{end}}
-`
diff --git a/vendor/github.com/ugorji/go/codec/gen.go b/vendor/github.com/ugorji/go/codec/gen.go
deleted file mode 100644
index 78b7b1e1..00000000
--- a/vendor/github.com/ugorji/go/codec/gen.go
+++ /dev/null
@@ -1,1989 +0,0 @@
-// Copyright (c) 2012-2015 Ugorji Nwoke. All rights reserved.
-// Use of this source code is governed by a MIT license found in the LICENSE file.
-
-package codec
-
-import (
- "bytes"
- "encoding/base64"
- "errors"
- "fmt"
- "go/format"
- "io"
- "io/ioutil"
- "math/rand"
- "os"
- "reflect"
- "regexp"
- "sort"
- "strconv"
- "strings"
- "sync"
- "text/template"
- "time"
- "unicode"
- "unicode/utf8"
-)
-
-// ---------------------------------------------------
-// codecgen supports the full cycle of reflection-based codec:
-// - RawExt
-// - Builtins
-// - Extensions
-// - (Binary|Text|JSON)(Unm|M)arshal
-// - generic by-kind
-//
-// This means that, for dynamic things, we MUST use reflection to at least get the reflect.Type.
-// In those areas, we try to only do reflection or interface-conversion when NECESSARY:
-// - Extensions, only if Extensions are configured.
-//
-// However, codecgen doesn't support the following:
-// - Canonical option. (codecgen IGNORES it currently)
-// This is just because it has not been implemented.
-//
-// During encode/decode, Selfer takes precedence.
-// A type implementing Selfer will know how to encode/decode itself statically.
-//
-// The following field types are supported:
-// array: [n]T
-// slice: []T
-// map: map[K]V
-// primitive: [u]int[n], float(32|64), bool, string
-// struct
-//
-// ---------------------------------------------------
-// Note that a Selfer cannot call (e|d).(En|De)code on itself,
-// as this will cause a circular reference, as (En|De)code will call Selfer methods.
-// Any type that implements Selfer must implement completely and not fallback to (En|De)code.
-//
-// In addition, code in this file manages the generation of fast-path implementations of
-// encode/decode of slices/maps of primitive keys/values.
-//
-// Users MUST re-generate their implementations whenever the code shape changes.
-// The generated code will panic if it was generated with a version older than the supporting library.
-// ---------------------------------------------------
-//
-// codec framework is very feature rich.
-// When encoding or decoding into an interface, it depends on the runtime type of the interface.
-// The type of the interface may be a named type, an extension, etc.
-// Consequently, we fallback to runtime codec for encoding/decoding interfaces.
-// In addition, we fallback for any value which cannot be guaranteed at runtime.
-// This allows us support ANY value, including any named types, specifically those which
-// do not implement our interfaces (e.g. Selfer).
-//
-// This explains some slowness compared to other code generation codecs (e.g. msgp).
-// This reduction in speed is only seen when your refers to interfaces,
-// e.g. type T struct { A interface{}; B []interface{}; C map[string]interface{} }
-//
-// codecgen will panic if the file was generated with an old version of the library in use.
-//
-// Note:
-// It was a concious decision to have gen.go always explicitly call EncodeNil or TryDecodeAsNil.
-// This way, there isn't a function call overhead just to see that we should not enter a block of code.
-
-// GenVersion is the current version of codecgen.
-//
-// NOTE: Increment this value each time codecgen changes fundamentally.
-// Fundamental changes are:
-// - helper methods change (signature change, new ones added, some removed, etc)
-// - codecgen command line changes
-//
-// v1: Initial Version
-// v2:
-// v3: Changes for Kubernetes:
-// changes in signature of some unpublished helper methods and codecgen cmdline arguments.
-// v4: Removed separator support from (en|de)cDriver, and refactored codec(gen)
-// v5: changes to support faster json decoding. Let encoder/decoder maintain state of collections.
-const GenVersion = 5
-
-const (
- genCodecPkg = "codec1978"
- genTempVarPfx = "yy"
- genTopLevelVarName = "x"
-
- // ignore canBeNil parameter, and always set to true.
- // This is because nil can appear anywhere, so we should always check.
- genAnythingCanBeNil = true
-
- // if genUseOneFunctionForDecStructMap, make a single codecDecodeSelferFromMap function;
- // else make codecDecodeSelferFromMap{LenPrefix,CheckBreak} so that conditionals
- // are not executed a lot.
- //
- // From testing, it didn't make much difference in runtime, so keep as true (one function only)
- genUseOneFunctionForDecStructMap = true
-)
-
-type genStructMapStyle uint8
-
-const (
- genStructMapStyleConsolidated genStructMapStyle = iota
- genStructMapStyleLenPrefix
- genStructMapStyleCheckBreak
-)
-
-var (
- genAllTypesSamePkgErr = errors.New("All types must be in the same package")
- genExpectArrayOrMapErr = errors.New("unexpected type. Expecting array/map/slice")
- genBase64enc = base64.NewEncoding("ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789__")
- genQNameRegex = regexp.MustCompile(`[A-Za-z_.]+`)
-)
-
-// genRunner holds some state used during a Gen run.
-type genRunner struct {
- w io.Writer // output
- c uint64 // counter used for generating varsfx
- t []reflect.Type // list of types to run selfer on
-
- tc reflect.Type // currently running selfer on this type
- te map[uintptr]bool // types for which the encoder has been created
- td map[uintptr]bool // types for which the decoder has been created
- cp string // codec import path
-
- im map[string]reflect.Type // imports to add
- imn map[string]string // package names of imports to add
- imc uint64 // counter for import numbers
-
- is map[reflect.Type]struct{} // types seen during import search
- bp string // base PkgPath, for which we are generating for
-
- cpfx string // codec package prefix
- unsafe bool // is unsafe to be used in generated code?
-
- tm map[reflect.Type]struct{} // types for which enc/dec must be generated
- ts []reflect.Type // types for which enc/dec must be generated
-
- xs string // top level variable/constant suffix
- hn string // fn helper type name
-
- ti *TypeInfos
- // rr *rand.Rand // random generator for file-specific types
-}
-
-// Gen will write a complete go file containing Selfer implementations for each
-// type passed. All the types must be in the same package.
-//
-// Library users: *DO NOT USE IT DIRECTLY. IT WILL CHANGE CONTINOUSLY WITHOUT NOTICE.*
-func Gen(w io.Writer, buildTags, pkgName, uid string, useUnsafe bool, ti *TypeInfos, typ ...reflect.Type) {
- if len(typ) == 0 {
- return
- }
- x := genRunner{
- unsafe: useUnsafe,
- w: w,
- t: typ,
- te: make(map[uintptr]bool),
- td: make(map[uintptr]bool),
- im: make(map[string]reflect.Type),
- imn: make(map[string]string),
- is: make(map[reflect.Type]struct{}),
- tm: make(map[reflect.Type]struct{}),
- ts: []reflect.Type{},
- bp: genImportPath(typ[0]),
- xs: uid,
- ti: ti,
- }
- if x.ti == nil {
- x.ti = defTypeInfos
- }
- if x.xs == "" {
- rr := rand.New(rand.NewSource(time.Now().UnixNano()))
- x.xs = strconv.FormatInt(rr.Int63n(9999), 10)
- }
-
- // gather imports first:
- x.cp = genImportPath(reflect.TypeOf(x))
- x.imn[x.cp] = genCodecPkg
- for _, t := range typ {
- // fmt.Printf("###########: PkgPath: '%v', Name: '%s'\n", genImportPath(t), t.Name())
- if genImportPath(t) != x.bp {
- panic(genAllTypesSamePkgErr)
- }
- x.genRefPkgs(t)
- }
- if buildTags != "" {
- x.line("//+build " + buildTags)
- x.line("")
- }
- x.line(`
-
-// ************************************************************
-// DO NOT EDIT.
-// THIS FILE IS AUTO-GENERATED BY codecgen.
-// ************************************************************
-
-`)
- x.line("package " + pkgName)
- x.line("")
- x.line("import (")
- if x.cp != x.bp {
- x.cpfx = genCodecPkg + "."
- x.linef("%s \"%s\"", genCodecPkg, x.cp)
- }
- // use a sorted set of im keys, so that we can get consistent output
- imKeys := make([]string, 0, len(x.im))
- for k := range x.im {
- imKeys = append(imKeys, k)
- }
- sort.Strings(imKeys)
- for _, k := range imKeys { // for k, _ := range x.im {
- x.linef("%s \"%s\"", x.imn[k], k)
- }
- // add required packages
- for _, k := range [...]string{"reflect", "unsafe", "runtime", "fmt", "errors"} {
- if _, ok := x.im[k]; !ok {
- if k == "unsafe" && !x.unsafe {
- continue
- }
- x.line("\"" + k + "\"")
- }
- }
- x.line(")")
- x.line("")
-
- x.line("const (")
- x.linef("// ----- content types ----")
- x.linef("codecSelferC_UTF8%s = %v", x.xs, int64(c_UTF8))
- x.linef("codecSelferC_RAW%s = %v", x.xs, int64(c_RAW))
- x.linef("// ----- value types used ----")
- x.linef("codecSelferValueTypeArray%s = %v", x.xs, int64(valueTypeArray))
- x.linef("codecSelferValueTypeMap%s = %v", x.xs, int64(valueTypeMap))
- x.linef("// ----- containerStateValues ----")
- x.linef("codecSelfer_containerMapKey%s = %v", x.xs, int64(containerMapKey))
- x.linef("codecSelfer_containerMapValue%s = %v", x.xs, int64(containerMapValue))
- x.linef("codecSelfer_containerMapEnd%s = %v", x.xs, int64(containerMapEnd))
- x.linef("codecSelfer_containerArrayElem%s = %v", x.xs, int64(containerArrayElem))
- x.linef("codecSelfer_containerArrayEnd%s = %v", x.xs, int64(containerArrayEnd))
- x.line(")")
- x.line("var (")
- x.line("codecSelferBitsize" + x.xs + " = uint8(reflect.TypeOf(uint(0)).Bits())")
- x.line("codecSelferOnlyMapOrArrayEncodeToStructErr" + x.xs + " = errors.New(`only encoded map or array can be decoded into a struct`)")
- x.line(")")
- x.line("")
-
- if x.unsafe {
- x.line("type codecSelferUnsafeString" + x.xs + " struct { Data uintptr; Len int}")
- x.line("")
- }
- x.hn = "codecSelfer" + x.xs
- x.line("type " + x.hn + " struct{}")
- x.line("")
-
- x.line("func init() {")
- x.linef("if %sGenVersion != %v {", x.cpfx, GenVersion)
- x.line("_, file, _, _ := runtime.Caller(0)")
- x.line(`err := fmt.Errorf("codecgen version mismatch: current: %v, need %v. Re-generate file: %v", `)
- x.linef(`%v, %sGenVersion, file)`, GenVersion, x.cpfx)
- x.line("panic(err)")
- x.linef("}")
- x.line("if false { // reference the types, but skip this branch at build/run time")
- var n int
- // for k, t := range x.im {
- for _, k := range imKeys {
- t := x.im[k]
- x.linef("var v%v %s.%s", n, x.imn[k], t.Name())
- n++
- }
- if x.unsafe {
- x.linef("var v%v unsafe.Pointer", n)
- n++
- }
- if n > 0 {
- x.out("_")
- for i := 1; i < n; i++ {
- x.out(", _")
- }
- x.out(" = v0")
- for i := 1; i < n; i++ {
- x.outf(", v%v", i)
- }
- }
- x.line("} ") // close if false
- x.line("}") // close init
- x.line("")
-
- // generate rest of type info
- for _, t := range typ {
- x.tc = t
- x.selfer(true)
- x.selfer(false)
- }
-
- for _, t := range x.ts {
- rtid := reflect.ValueOf(t).Pointer()
- // generate enc functions for all these slice/map types.
- x.linef("func (x %s) enc%s(v %s%s, e *%sEncoder) {", x.hn, x.genMethodNameT(t), x.arr2str(t, "*"), x.genTypeName(t), x.cpfx)
- x.genRequiredMethodVars(true)
- switch t.Kind() {
- case reflect.Array, reflect.Slice, reflect.Chan:
- x.encListFallback("v", t)
- case reflect.Map:
- x.encMapFallback("v", t)
- default:
- panic(genExpectArrayOrMapErr)
- }
- x.line("}")
- x.line("")
-
- // generate dec functions for all these slice/map types.
- x.linef("func (x %s) dec%s(v *%s, d *%sDecoder) {", x.hn, x.genMethodNameT(t), x.genTypeName(t), x.cpfx)
- x.genRequiredMethodVars(false)
- switch t.Kind() {
- case reflect.Array, reflect.Slice, reflect.Chan:
- x.decListFallback("v", rtid, t)
- case reflect.Map:
- x.decMapFallback("v", rtid, t)
- default:
- panic(genExpectArrayOrMapErr)
- }
- x.line("}")
- x.line("")
- }
-
- x.line("")
-}
-
-func (x *genRunner) checkForSelfer(t reflect.Type, varname string) bool {
- // return varname != genTopLevelVarName && t != x.tc
- // the only time we checkForSelfer is if we are not at the TOP of the generated code.
- return varname != genTopLevelVarName
-}
-
-func (x *genRunner) arr2str(t reflect.Type, s string) string {
- if t.Kind() == reflect.Array {
- return s
- }
- return ""
-}
-
-func (x *genRunner) genRequiredMethodVars(encode bool) {
- x.line("var h " + x.hn)
- if encode {
- x.line("z, r := " + x.cpfx + "GenHelperEncoder(e)")
- } else {
- x.line("z, r := " + x.cpfx + "GenHelperDecoder(d)")
- }
- x.line("_, _, _ = h, z, r")
-}
-
-func (x *genRunner) genRefPkgs(t reflect.Type) {
- if _, ok := x.is[t]; ok {
- return
- }
- // fmt.Printf(">>>>>>: PkgPath: '%v', Name: '%s'\n", genImportPath(t), t.Name())
- x.is[t] = struct{}{}
- tpkg, tname := genImportPath(t), t.Name()
- if tpkg != "" && tpkg != x.bp && tpkg != x.cp && tname != "" && tname[0] >= 'A' && tname[0] <= 'Z' {
- if _, ok := x.im[tpkg]; !ok {
- x.im[tpkg] = t
- if idx := strings.LastIndex(tpkg, "/"); idx < 0 {
- x.imn[tpkg] = tpkg
- } else {
- x.imc++
- x.imn[tpkg] = "pkg" + strconv.FormatUint(x.imc, 10) + "_" + genGoIdentifier(tpkg[idx+1:], false)
- }
- }
- }
- switch t.Kind() {
- case reflect.Array, reflect.Slice, reflect.Ptr, reflect.Chan:
- x.genRefPkgs(t.Elem())
- case reflect.Map:
- x.genRefPkgs(t.Elem())
- x.genRefPkgs(t.Key())
- case reflect.Struct:
- for i := 0; i < t.NumField(); i++ {
- if fname := t.Field(i).Name; fname != "" && fname[0] >= 'A' && fname[0] <= 'Z' {
- x.genRefPkgs(t.Field(i).Type)
- }
- }
- }
-}
-
-func (x *genRunner) line(s string) {
- x.out(s)
- if len(s) == 0 || s[len(s)-1] != '\n' {
- x.out("\n")
- }
-}
-
-func (x *genRunner) varsfx() string {
- x.c++
- return strconv.FormatUint(x.c, 10)
-}
-
-func (x *genRunner) out(s string) {
- if _, err := io.WriteString(x.w, s); err != nil {
- panic(err)
- }
-}
-
-func (x *genRunner) linef(s string, params ...interface{}) {
- x.line(fmt.Sprintf(s, params...))
-}
-
-func (x *genRunner) outf(s string, params ...interface{}) {
- x.out(fmt.Sprintf(s, params...))
-}
-
-func (x *genRunner) genTypeName(t reflect.Type) (n string) {
- // defer func() { fmt.Printf(">>>> ####: genTypeName: t: %v, name: '%s'\n", t, n) }()
-
- // if the type has a PkgPath, which doesn't match the current package,
- // then include it.
- // We cannot depend on t.String() because it includes current package,
- // or t.PkgPath because it includes full import path,
- //
- var ptrPfx string
- for t.Kind() == reflect.Ptr {
- ptrPfx += "*"
- t = t.Elem()
- }
- if tn := t.Name(); tn != "" {
- return ptrPfx + x.genTypeNamePrim(t)
- }
- switch t.Kind() {
- case reflect.Map:
- return ptrPfx + "map[" + x.genTypeName(t.Key()) + "]" + x.genTypeName(t.Elem())
- case reflect.Slice:
- return ptrPfx + "[]" + x.genTypeName(t.Elem())
- case reflect.Array:
- return ptrPfx + "[" + strconv.FormatInt(int64(t.Len()), 10) + "]" + x.genTypeName(t.Elem())
- case reflect.Chan:
- return ptrPfx + t.ChanDir().String() + " " + x.genTypeName(t.Elem())
- default:
- if t == intfTyp {
- return ptrPfx + "interface{}"
- } else {
- return ptrPfx + x.genTypeNamePrim(t)
- }
- }
-}
-
-func (x *genRunner) genTypeNamePrim(t reflect.Type) (n string) {
- if t.Name() == "" {
- return t.String()
- } else if genImportPath(t) == "" || genImportPath(t) == genImportPath(x.tc) {
- return t.Name()
- } else {
- return x.imn[genImportPath(t)] + "." + t.Name()
- // return t.String() // best way to get the package name inclusive
- }
-}
-
-func (x *genRunner) genZeroValueR(t reflect.Type) string {
- // if t is a named type, w
- switch t.Kind() {
- case reflect.Ptr, reflect.Interface, reflect.Chan, reflect.Func,
- reflect.Slice, reflect.Map, reflect.Invalid:
- return "nil"
- case reflect.Bool:
- return "false"
- case reflect.String:
- return `""`
- case reflect.Struct, reflect.Array:
- return x.genTypeName(t) + "{}"
- default: // all numbers
- return "0"
- }
-}
-
-func (x *genRunner) genMethodNameT(t reflect.Type) (s string) {
- return genMethodNameT(t, x.tc)
-}
-
-func (x *genRunner) selfer(encode bool) {
- t := x.tc
- t0 := t
- // always make decode use a pointer receiver,
- // and structs always use a ptr receiver (encode|decode)
- isptr := !encode || t.Kind() == reflect.Struct
- fnSigPfx := "func (x "
- if isptr {
- fnSigPfx += "*"
- }
- fnSigPfx += x.genTypeName(t)
-
- x.out(fnSigPfx)
- if isptr {
- t = reflect.PtrTo(t)
- }
- if encode {
- x.line(") CodecEncodeSelf(e *" + x.cpfx + "Encoder) {")
- x.genRequiredMethodVars(true)
- // x.enc(genTopLevelVarName, t)
- x.encVar(genTopLevelVarName, t)
- } else {
- x.line(") CodecDecodeSelf(d *" + x.cpfx + "Decoder) {")
- x.genRequiredMethodVars(false)
- // do not use decVar, as there is no need to check TryDecodeAsNil
- // or way to elegantly handle that, and also setting it to a
- // non-nil value doesn't affect the pointer passed.
- // x.decVar(genTopLevelVarName, t, false)
- x.dec(genTopLevelVarName, t0)
- }
- x.line("}")
- x.line("")
-
- if encode || t0.Kind() != reflect.Struct {
- return
- }
-
- // write is containerMap
- if genUseOneFunctionForDecStructMap {
- x.out(fnSigPfx)
- x.line(") codecDecodeSelfFromMap(l int, d *" + x.cpfx + "Decoder) {")
- x.genRequiredMethodVars(false)
- x.decStructMap(genTopLevelVarName, "l", reflect.ValueOf(t0).Pointer(), t0, genStructMapStyleConsolidated)
- x.line("}")
- x.line("")
- } else {
- x.out(fnSigPfx)
- x.line(") codecDecodeSelfFromMapLenPrefix(l int, d *" + x.cpfx + "Decoder) {")
- x.genRequiredMethodVars(false)
- x.decStructMap(genTopLevelVarName, "l", reflect.ValueOf(t0).Pointer(), t0, genStructMapStyleLenPrefix)
- x.line("}")
- x.line("")
-
- x.out(fnSigPfx)
- x.line(") codecDecodeSelfFromMapCheckBreak(l int, d *" + x.cpfx + "Decoder) {")
- x.genRequiredMethodVars(false)
- x.decStructMap(genTopLevelVarName, "l", reflect.ValueOf(t0).Pointer(), t0, genStructMapStyleCheckBreak)
- x.line("}")
- x.line("")
- }
-
- // write containerArray
- x.out(fnSigPfx)
- x.line(") codecDecodeSelfFromArray(l int, d *" + x.cpfx + "Decoder) {")
- x.genRequiredMethodVars(false)
- x.decStructArray(genTopLevelVarName, "l", "return", reflect.ValueOf(t0).Pointer(), t0)
- x.line("}")
- x.line("")
-
-}
-
-// used for chan, array, slice, map
-func (x *genRunner) xtraSM(varname string, encode bool, t reflect.Type) {
- if encode {
- x.linef("h.enc%s((%s%s)(%s), e)", x.genMethodNameT(t), x.arr2str(t, "*"), x.genTypeName(t), varname)
- } else {
- x.linef("h.dec%s((*%s)(%s), d)", x.genMethodNameT(t), x.genTypeName(t), varname)
- }
- x.registerXtraT(t)
-}
-
-func (x *genRunner) registerXtraT(t reflect.Type) {
- // recursively register the types
- if _, ok := x.tm[t]; ok {
- return
- }
- var tkey reflect.Type
- switch t.Kind() {
- case reflect.Chan, reflect.Slice, reflect.Array:
- case reflect.Map:
- tkey = t.Key()
- default:
- return
- }
- x.tm[t] = struct{}{}
- x.ts = append(x.ts, t)
- // check if this refers to any xtra types eg. a slice of array: add the array
- x.registerXtraT(t.Elem())
- if tkey != nil {
- x.registerXtraT(tkey)
- }
-}
-
-// encVar will encode a variable.
-// The parameter, t, is the reflect.Type of the variable itself
-func (x *genRunner) encVar(varname string, t reflect.Type) {
- // fmt.Printf(">>>>>> varname: %s, t: %v\n", varname, t)
- var checkNil bool
- switch t.Kind() {
- case reflect.Ptr, reflect.Interface, reflect.Slice, reflect.Map, reflect.Chan:
- checkNil = true
- }
- if checkNil {
- x.linef("if %s == nil { r.EncodeNil() } else { ", varname)
- }
- switch t.Kind() {
- case reflect.Ptr:
- switch t.Elem().Kind() {
- case reflect.Struct, reflect.Array:
- x.enc(varname, genNonPtr(t))
- default:
- i := x.varsfx()
- x.line(genTempVarPfx + i + " := *" + varname)
- x.enc(genTempVarPfx+i, genNonPtr(t))
- }
- case reflect.Struct, reflect.Array:
- i := x.varsfx()
- x.line(genTempVarPfx + i + " := &" + varname)
- x.enc(genTempVarPfx+i, t)
- default:
- x.enc(varname, t)
- }
-
- if checkNil {
- x.line("}")
- }
-
-}
-
-// enc will encode a variable (varname) of type t,
-// except t is of kind reflect.Struct or reflect.Array, wherein varname is of type ptrTo(T) (to prevent copying)
-func (x *genRunner) enc(varname string, t reflect.Type) {
- rtid := reflect.ValueOf(t).Pointer()
- // We call CodecEncodeSelf if one of the following are honored:
- // - the type already implements Selfer, call that
- // - the type has a Selfer implementation just created, use that
- // - the type is in the list of the ones we will generate for, but it is not currently being generated
-
- mi := x.varsfx()
- tptr := reflect.PtrTo(t)
- tk := t.Kind()
- if x.checkForSelfer(t, varname) {
- if tk == reflect.Array || tk == reflect.Struct { // varname is of type *T
- if tptr.Implements(selferTyp) || t.Implements(selferTyp) {
- x.line(varname + ".CodecEncodeSelf(e)")
- return
- }
- } else { // varname is of type T
- if t.Implements(selferTyp) {
- x.line(varname + ".CodecEncodeSelf(e)")
- return
- } else if tptr.Implements(selferTyp) {
- x.linef("%ssf%s := &%s", genTempVarPfx, mi, varname)
- x.linef("%ssf%s.CodecEncodeSelf(e)", genTempVarPfx, mi)
- return
- }
- }
-
- if _, ok := x.te[rtid]; ok {
- x.line(varname + ".CodecEncodeSelf(e)")
- return
- }
- }
-
- inlist := false
- for _, t0 := range x.t {
- if t == t0 {
- inlist = true
- if x.checkForSelfer(t, varname) {
- x.line(varname + ".CodecEncodeSelf(e)")
- return
- }
- break
- }
- }
-
- var rtidAdded bool
- if t == x.tc {
- x.te[rtid] = true
- rtidAdded = true
- }
-
- // check if
- // - type is RawExt
- // - the type implements (Text|JSON|Binary)(Unm|M)arshal
- x.linef("%sm%s := z.EncBinary()", genTempVarPfx, mi)
- x.linef("_ = %sm%s", genTempVarPfx, mi)
- x.line("if false {") //start if block
- defer func() { x.line("}") }() //end if block
-
- if t == rawExtTyp {
- x.linef("} else { r.EncodeRawExt(%v, e)", varname)
- return
- }
- // HACK: Support for Builtins.
- // Currently, only Binc supports builtins, and the only builtin type is time.Time.
- // Have a method that returns the rtid for time.Time if Handle is Binc.
- if t == timeTyp {
- vrtid := genTempVarPfx + "m" + x.varsfx()
- x.linef("} else if %s := z.TimeRtidIfBinc(); %s != 0 { ", vrtid, vrtid)
- x.linef("r.EncodeBuiltin(%s, %s)", vrtid, varname)
- }
- // only check for extensions if the type is named, and has a packagePath.
- if genImportPath(t) != "" && t.Name() != "" {
- // first check if extensions are configued, before doing the interface conversion
- x.linef("} else if z.HasExtensions() && z.EncExt(%s) {", varname)
- }
- if tk == reflect.Array || tk == reflect.Struct { // varname is of type *T
- if t.Implements(binaryMarshalerTyp) || tptr.Implements(binaryMarshalerTyp) {
- x.linef("} else if %sm%s { z.EncBinaryMarshal(%v) ", genTempVarPfx, mi, varname)
- }
- if t.Implements(jsonMarshalerTyp) || tptr.Implements(jsonMarshalerTyp) {
- x.linef("} else if !%sm%s && z.IsJSONHandle() { z.EncJSONMarshal(%v) ", genTempVarPfx, mi, varname)
- } else if t.Implements(textMarshalerTyp) || tptr.Implements(textMarshalerTyp) {
- x.linef("} else if !%sm%s { z.EncTextMarshal(%v) ", genTempVarPfx, mi, varname)
- }
- } else { // varname is of type T
- if t.Implements(binaryMarshalerTyp) {
- x.linef("} else if %sm%s { z.EncBinaryMarshal(%v) ", genTempVarPfx, mi, varname)
- } else if tptr.Implements(binaryMarshalerTyp) {
- x.linef("} else if %sm%s { z.EncBinaryMarshal(&%v) ", genTempVarPfx, mi, varname)
- }
- if t.Implements(jsonMarshalerTyp) {
- x.linef("} else if !%sm%s && z.IsJSONHandle() { z.EncJSONMarshal(%v) ", genTempVarPfx, mi, varname)
- } else if tptr.Implements(jsonMarshalerTyp) {
- x.linef("} else if !%sm%s && z.IsJSONHandle() { z.EncJSONMarshal(&%v) ", genTempVarPfx, mi, varname)
- } else if t.Implements(textMarshalerTyp) {
- x.linef("} else if !%sm%s { z.EncTextMarshal(%v) ", genTempVarPfx, mi, varname)
- } else if tptr.Implements(textMarshalerTyp) {
- x.linef("} else if !%sm%s { z.EncTextMarshal(&%v) ", genTempVarPfx, mi, varname)
- }
- }
- x.line("} else {")
-
- switch t.Kind() {
- case reflect.Int, reflect.Int8, reflect.Int16, reflect.Int32, reflect.Int64:
- x.line("r.EncodeInt(int64(" + varname + "))")
- case reflect.Uint, reflect.Uint8, reflect.Uint16, reflect.Uint32, reflect.Uint64, reflect.Uintptr:
- x.line("r.EncodeUint(uint64(" + varname + "))")
- case reflect.Float32:
- x.line("r.EncodeFloat32(float32(" + varname + "))")
- case reflect.Float64:
- x.line("r.EncodeFloat64(float64(" + varname + "))")
- case reflect.Bool:
- x.line("r.EncodeBool(bool(" + varname + "))")
- case reflect.String:
- x.line("r.EncodeString(codecSelferC_UTF8" + x.xs + ", string(" + varname + "))")
- case reflect.Chan:
- x.xtraSM(varname, true, t)
- // x.encListFallback(varname, rtid, t)
- case reflect.Array:
- x.xtraSM(varname, true, t)
- case reflect.Slice:
- // if nil, call dedicated function
- // if a []uint8, call dedicated function
- // if a known fastpath slice, call dedicated function
- // else write encode function in-line.
- // - if elements are primitives or Selfers, call dedicated function on each member.
- // - else call Encoder.encode(XXX) on it.
- if rtid == uint8SliceTypId {
- x.line("r.EncodeStringBytes(codecSelferC_RAW" + x.xs + ", []byte(" + varname + "))")
- } else if fastpathAV.index(rtid) != -1 {
- g := x.newGenV(t)
- x.line("z.F." + g.MethodNamePfx("Enc", false) + "V(" + varname + ", false, e)")
- } else {
- x.xtraSM(varname, true, t)
- // x.encListFallback(varname, rtid, t)
- }
- case reflect.Map:
- // if nil, call dedicated function
- // if a known fastpath map, call dedicated function
- // else write encode function in-line.
- // - if elements are primitives or Selfers, call dedicated function on each member.
- // - else call Encoder.encode(XXX) on it.
- // x.line("if " + varname + " == nil { \nr.EncodeNil()\n } else { ")
- if fastpathAV.index(rtid) != -1 {
- g := x.newGenV(t)
- x.line("z.F." + g.MethodNamePfx("Enc", false) + "V(" + varname + ", false, e)")
- } else {
- x.xtraSM(varname, true, t)
- // x.encMapFallback(varname, rtid, t)
- }
- case reflect.Struct:
- if !inlist {
- delete(x.te, rtid)
- x.line("z.EncFallback(" + varname + ")")
- break
- }
- x.encStruct(varname, rtid, t)
- default:
- if rtidAdded {
- delete(x.te, rtid)
- }
- x.line("z.EncFallback(" + varname + ")")
- }
-}
-
-func (x *genRunner) encZero(t reflect.Type) {
- switch t.Kind() {
- case reflect.Int, reflect.Int8, reflect.Int16, reflect.Int32, reflect.Int64:
- x.line("r.EncodeInt(0)")
- case reflect.Uint, reflect.Uint8, reflect.Uint16, reflect.Uint32, reflect.Uint64, reflect.Uintptr:
- x.line("r.EncodeUint(0)")
- case reflect.Float32:
- x.line("r.EncodeFloat32(0)")
- case reflect.Float64:
- x.line("r.EncodeFloat64(0)")
- case reflect.Bool:
- x.line("r.EncodeBool(false)")
- case reflect.String:
- x.line("r.EncodeString(codecSelferC_UTF8" + x.xs + `, "")`)
- default:
- x.line("r.EncodeNil()")
- }
-}
-
-func (x *genRunner) encStruct(varname string, rtid uintptr, t reflect.Type) {
- // Use knowledge from structfieldinfo (mbs, encodable fields. Ignore omitempty. )
- // replicate code in kStruct i.e. for each field, deref type to non-pointer, and call x.enc on it
-
- // if t === type currently running selfer on, do for all
- ti := x.ti.get(rtid, t)
- i := x.varsfx()
- sepVarname := genTempVarPfx + "sep" + i
- numfieldsvar := genTempVarPfx + "q" + i
- ti2arrayvar := genTempVarPfx + "r" + i
- struct2arrvar := genTempVarPfx + "2arr" + i
-
- x.line(sepVarname + " := !z.EncBinary()")
- x.linef("%s := z.EncBasicHandle().StructToArray", struct2arrvar)
- tisfi := ti.sfip // always use sequence from file. decStruct expects same thing.
- // due to omitEmpty, we need to calculate the
- // number of non-empty things we write out first.
- // This is required as we need to pre-determine the size of the container,
- // to support length-prefixing.
- x.linef("var %s [%v]bool", numfieldsvar, len(tisfi))
- x.linef("_, _, _ = %s, %s, %s", sepVarname, numfieldsvar, struct2arrvar)
- x.linef("const %s bool = %v", ti2arrayvar, ti.toArray)
- nn := 0
- for j, si := range tisfi {
- if !si.omitEmpty {
- nn++
- continue
- }
- var t2 reflect.StructField
- var omitline string
- if si.i != -1 {
- t2 = t.Field(int(si.i))
- } else {
- t2typ := t
- varname3 := varname
- for _, ix := range si.is {
- for t2typ.Kind() == reflect.Ptr {
- t2typ = t2typ.Elem()
- }
- t2 = t2typ.Field(ix)
- t2typ = t2.Type
- varname3 = varname3 + "." + t2.Name
- if t2typ.Kind() == reflect.Ptr {
- omitline += varname3 + " != nil && "
- }
- }
- }
- // never check omitEmpty on a struct type, as it may contain uncomparable map/slice/etc.
- // also, for maps/slices/arrays, check if len ! 0 (not if == zero value)
- switch t2.Type.Kind() {
- case reflect.Struct:
- omitline += " true"
- case reflect.Map, reflect.Slice, reflect.Array, reflect.Chan:
- omitline += "len(" + varname + "." + t2.Name + ") != 0"
- default:
- omitline += varname + "." + t2.Name + " != " + x.genZeroValueR(t2.Type)
- }
- x.linef("%s[%v] = %s", numfieldsvar, j, omitline)
- }
- x.linef("var %snn%s int", genTempVarPfx, i)
- x.linef("if %s || %s {", ti2arrayvar, struct2arrvar) // if ti.toArray {
- x.line("r.EncodeArrayStart(" + strconv.FormatInt(int64(len(tisfi)), 10) + ")")
- x.linef("} else {") // if not ti.toArray
- x.linef("%snn%s = %v", genTempVarPfx, i, nn)
- x.linef("for _, b := range %s { if b { %snn%s++ } }", numfieldsvar, genTempVarPfx, i)
- x.linef("r.EncodeMapStart(%snn%s)", genTempVarPfx, i)
- x.linef("%snn%s = %v", genTempVarPfx, i, 0)
- // x.line("r.EncodeMapStart(" + strconv.FormatInt(int64(len(tisfi)), 10) + ")")
- x.line("}") // close if not StructToArray
-
- for j, si := range tisfi {
- i := x.varsfx()
- isNilVarName := genTempVarPfx + "n" + i
- var labelUsed bool
- var t2 reflect.StructField
- if si.i != -1 {
- t2 = t.Field(int(si.i))
- } else {
- t2typ := t
- varname3 := varname
- for _, ix := range si.is {
- // fmt.Printf("%%%% %v, ix: %v\n", t2typ, ix)
- for t2typ.Kind() == reflect.Ptr {
- t2typ = t2typ.Elem()
- }
- t2 = t2typ.Field(ix)
- t2typ = t2.Type
- varname3 = varname3 + "." + t2.Name
- if t2typ.Kind() == reflect.Ptr {
- if !labelUsed {
- x.line("var " + isNilVarName + " bool")
- }
- x.line("if " + varname3 + " == nil { " + isNilVarName + " = true ")
- x.line("goto LABEL" + i)
- x.line("}")
- labelUsed = true
- // "varname3 = new(" + x.genTypeName(t3.Elem()) + ") }")
- }
- }
- // t2 = t.FieldByIndex(si.is)
- }
- if labelUsed {
- x.line("LABEL" + i + ":")
- }
- // if the type of the field is a Selfer, or one of the ones
-
- x.linef("if %s || %s {", ti2arrayvar, struct2arrvar) // if ti.toArray
- if labelUsed {
- x.line("if " + isNilVarName + " { r.EncodeNil() } else { ")
- }
- x.linef("z.EncSendContainerState(codecSelfer_containerArrayElem%s)", x.xs)
- if si.omitEmpty {
- x.linef("if %s[%v] {", numfieldsvar, j)
- }
- x.encVar(varname+"."+t2.Name, t2.Type)
- if si.omitEmpty {
- x.linef("} else {")
- x.encZero(t2.Type)
- x.linef("}")
- }
- if labelUsed {
- x.line("}")
- }
-
- x.linef("} else {") // if not ti.toArray
-
- if si.omitEmpty {
- x.linef("if %s[%v] {", numfieldsvar, j)
- }
- x.linef("z.EncSendContainerState(codecSelfer_containerMapKey%s)", x.xs)
- x.line("r.EncodeString(codecSelferC_UTF8" + x.xs + ", string(\"" + si.encName + "\"))")
- x.linef("z.EncSendContainerState(codecSelfer_containerMapValue%s)", x.xs)
- if labelUsed {
- x.line("if " + isNilVarName + " { r.EncodeNil() } else { ")
- x.encVar(varname+"."+t2.Name, t2.Type)
- x.line("}")
- } else {
- x.encVar(varname+"."+t2.Name, t2.Type)
- }
- if si.omitEmpty {
- x.line("}")
- }
- x.linef("} ") // end if/else ti.toArray
- }
- x.linef("if %s || %s {", ti2arrayvar, struct2arrvar) // if ti.toArray {
- x.linef("z.EncSendContainerState(codecSelfer_containerArrayEnd%s)", x.xs)
- x.line("} else {")
- x.linef("z.EncSendContainerState(codecSelfer_containerMapEnd%s)", x.xs)
- x.line("}")
-
-}
-
-func (x *genRunner) encListFallback(varname string, t reflect.Type) {
- i := x.varsfx()
- g := genTempVarPfx
- x.line("r.EncodeArrayStart(len(" + varname + "))")
- if t.Kind() == reflect.Chan {
- x.linef("for %si%s, %si2%s := 0, len(%s); %si%s < %si2%s; %si%s++ {", g, i, g, i, varname, g, i, g, i, g, i)
- x.linef("z.EncSendContainerState(codecSelfer_containerArrayElem%s)", x.xs)
- x.linef("%sv%s := <-%s", g, i, varname)
- } else {
- // x.linef("for %si%s, %sv%s := range %s {", genTempVarPfx, i, genTempVarPfx, i, varname)
- x.linef("for _, %sv%s := range %s {", genTempVarPfx, i, varname)
- x.linef("z.EncSendContainerState(codecSelfer_containerArrayElem%s)", x.xs)
- }
- x.encVar(genTempVarPfx+"v"+i, t.Elem())
- x.line("}")
- x.linef("z.EncSendContainerState(codecSelfer_containerArrayEnd%s)", x.xs)
-}
-
-func (x *genRunner) encMapFallback(varname string, t reflect.Type) {
- // TODO: expand this to handle canonical.
- i := x.varsfx()
- x.line("r.EncodeMapStart(len(" + varname + "))")
- x.linef("for %sk%s, %sv%s := range %s {", genTempVarPfx, i, genTempVarPfx, i, varname)
- // x.line("for " + genTempVarPfx + "k" + i + ", " + genTempVarPfx + "v" + i + " := range " + varname + " {")
- x.linef("z.EncSendContainerState(codecSelfer_containerMapKey%s)", x.xs)
- x.encVar(genTempVarPfx+"k"+i, t.Key())
- x.linef("z.EncSendContainerState(codecSelfer_containerMapValue%s)", x.xs)
- x.encVar(genTempVarPfx+"v"+i, t.Elem())
- x.line("}")
- x.linef("z.EncSendContainerState(codecSelfer_containerMapEnd%s)", x.xs)
-}
-
-func (x *genRunner) decVar(varname string, t reflect.Type, canBeNil bool) {
- // We only encode as nil if a nillable value.
- // This removes some of the wasted checks for TryDecodeAsNil.
- // We need to think about this more, to see what happens if omitempty, etc
- // cause a nil value to be stored when something is expected.
- // This could happen when decoding from a struct encoded as an array.
- // For that, decVar should be called with canNil=true, to force true as its value.
- i := x.varsfx()
- if !canBeNil {
- canBeNil = genAnythingCanBeNil || !genIsImmutable(t)
- }
- if canBeNil {
- x.line("if r.TryDecodeAsNil() {")
- if t.Kind() == reflect.Ptr {
- x.line("if " + varname + " != nil { ")
-
- // if varname is a field of a struct (has a dot in it),
- // then just set it to nil
- if strings.IndexByte(varname, '.') != -1 {
- x.line(varname + " = nil")
- } else {
- x.line("*" + varname + " = " + x.genZeroValueR(t.Elem()))
- }
- x.line("}")
- } else {
- x.line(varname + " = " + x.genZeroValueR(t))
- }
- x.line("} else {")
- } else {
- x.line("// cannot be nil")
- }
- if t.Kind() != reflect.Ptr {
- if x.decTryAssignPrimitive(varname, t) {
- x.line(genTempVarPfx + "v" + i + " := &" + varname)
- x.dec(genTempVarPfx+"v"+i, t)
- }
- } else {
- x.linef("if %s == nil { %s = new(%s) }", varname, varname, x.genTypeName(t.Elem()))
- // Ensure we set underlying ptr to a non-nil value (so we can deref to it later).
- // There's a chance of a **T in here which is nil.
- var ptrPfx string
- for t = t.Elem(); t.Kind() == reflect.Ptr; t = t.Elem() {
- ptrPfx += "*"
- x.linef("if %s%s == nil { %s%s = new(%s)}",
- ptrPfx, varname, ptrPfx, varname, x.genTypeName(t))
- }
- // if varname has [ in it, then create temp variable for this ptr thingie
- if strings.Index(varname, "[") >= 0 {
- varname2 := genTempVarPfx + "w" + i
- x.line(varname2 + " := " + varname)
- varname = varname2
- }
-
- if ptrPfx == "" {
- x.dec(varname, t)
- } else {
- x.line(genTempVarPfx + "z" + i + " := " + ptrPfx + varname)
- x.dec(genTempVarPfx+"z"+i, t)
- }
-
- }
-
- if canBeNil {
- x.line("} ")
- }
-}
-
-// dec will decode a variable (varname) of type ptrTo(t).
-// t is always a basetype (i.e. not of kind reflect.Ptr).
-func (x *genRunner) dec(varname string, t reflect.Type) {
- // assumptions:
- // - the varname is to a pointer already. No need to take address of it
- // - t is always a baseType T (not a *T, etc).
- rtid := reflect.ValueOf(t).Pointer()
- tptr := reflect.PtrTo(t)
- if x.checkForSelfer(t, varname) {
- if t.Implements(selferTyp) || tptr.Implements(selferTyp) {
- x.line(varname + ".CodecDecodeSelf(d)")
- return
- }
- if _, ok := x.td[rtid]; ok {
- x.line(varname + ".CodecDecodeSelf(d)")
- return
- }
- }
-
- inlist := false
- for _, t0 := range x.t {
- if t == t0 {
- inlist = true
- if x.checkForSelfer(t, varname) {
- x.line(varname + ".CodecDecodeSelf(d)")
- return
- }
- break
- }
- }
-
- var rtidAdded bool
- if t == x.tc {
- x.td[rtid] = true
- rtidAdded = true
- }
-
- // check if
- // - type is RawExt
- // - the type implements (Text|JSON|Binary)(Unm|M)arshal
- mi := x.varsfx()
- x.linef("%sm%s := z.DecBinary()", genTempVarPfx, mi)
- x.linef("_ = %sm%s", genTempVarPfx, mi)
- x.line("if false {") //start if block
- defer func() { x.line("}") }() //end if block
-
- if t == rawExtTyp {
- x.linef("} else { r.DecodeExt(%v, 0, nil)", varname)
- return
- }
-
- // HACK: Support for Builtins.
- // Currently, only Binc supports builtins, and the only builtin type is time.Time.
- // Have a method that returns the rtid for time.Time if Handle is Binc.
- if t == timeTyp {
- vrtid := genTempVarPfx + "m" + x.varsfx()
- x.linef("} else if %s := z.TimeRtidIfBinc(); %s != 0 { ", vrtid, vrtid)
- x.linef("r.DecodeBuiltin(%s, %s)", vrtid, varname)
- }
- // only check for extensions if the type is named, and has a packagePath.
- if genImportPath(t) != "" && t.Name() != "" {
- // first check if extensions are configued, before doing the interface conversion
- x.linef("} else if z.HasExtensions() && z.DecExt(%s) {", varname)
- }
-
- if t.Implements(binaryUnmarshalerTyp) || tptr.Implements(binaryUnmarshalerTyp) {
- x.linef("} else if %sm%s { z.DecBinaryUnmarshal(%v) ", genTempVarPfx, mi, varname)
- }
- if t.Implements(jsonUnmarshalerTyp) || tptr.Implements(jsonUnmarshalerTyp) {
- x.linef("} else if !%sm%s && z.IsJSONHandle() { z.DecJSONUnmarshal(%v)", genTempVarPfx, mi, varname)
- } else if t.Implements(textUnmarshalerTyp) || tptr.Implements(textUnmarshalerTyp) {
- x.linef("} else if !%sm%s { z.DecTextUnmarshal(%v)", genTempVarPfx, mi, varname)
- }
-
- x.line("} else {")
-
- // Since these are pointers, we cannot share, and have to use them one by one
- switch t.Kind() {
- case reflect.Int:
- x.line("*((*int)(" + varname + ")) = int(r.DecodeInt(codecSelferBitsize" + x.xs + "))")
- // x.line("z.DecInt((*int)(" + varname + "))")
- case reflect.Int8:
- x.line("*((*int8)(" + varname + ")) = int8(r.DecodeInt(8))")
- // x.line("z.DecInt8((*int8)(" + varname + "))")
- case reflect.Int16:
- x.line("*((*int16)(" + varname + ")) = int16(r.DecodeInt(16))")
- // x.line("z.DecInt16((*int16)(" + varname + "))")
- case reflect.Int32:
- x.line("*((*int32)(" + varname + ")) = int32(r.DecodeInt(32))")
- // x.line("z.DecInt32((*int32)(" + varname + "))")
- case reflect.Int64:
- x.line("*((*int64)(" + varname + ")) = int64(r.DecodeInt(64))")
- // x.line("z.DecInt64((*int64)(" + varname + "))")
-
- case reflect.Uint:
- x.line("*((*uint)(" + varname + ")) = uint(r.DecodeUint(codecSelferBitsize" + x.xs + "))")
- // x.line("z.DecUint((*uint)(" + varname + "))")
- case reflect.Uint8:
- x.line("*((*uint8)(" + varname + ")) = uint8(r.DecodeUint(8))")
- // x.line("z.DecUint8((*uint8)(" + varname + "))")
- case reflect.Uint16:
- x.line("*((*uint16)(" + varname + ")) = uint16(r.DecodeUint(16))")
- //x.line("z.DecUint16((*uint16)(" + varname + "))")
- case reflect.Uint32:
- x.line("*((*uint32)(" + varname + ")) = uint32(r.DecodeUint(32))")
- //x.line("z.DecUint32((*uint32)(" + varname + "))")
- case reflect.Uint64:
- x.line("*((*uint64)(" + varname + ")) = uint64(r.DecodeUint(64))")
- //x.line("z.DecUint64((*uint64)(" + varname + "))")
- case reflect.Uintptr:
- x.line("*((*uintptr)(" + varname + ")) = uintptr(r.DecodeUint(codecSelferBitsize" + x.xs + "))")
-
- case reflect.Float32:
- x.line("*((*float32)(" + varname + ")) = float32(r.DecodeFloat(true))")
- //x.line("z.DecFloat32((*float32)(" + varname + "))")
- case reflect.Float64:
- x.line("*((*float64)(" + varname + ")) = float64(r.DecodeFloat(false))")
- // x.line("z.DecFloat64((*float64)(" + varname + "))")
-
- case reflect.Bool:
- x.line("*((*bool)(" + varname + ")) = r.DecodeBool()")
- // x.line("z.DecBool((*bool)(" + varname + "))")
- case reflect.String:
- x.line("*((*string)(" + varname + ")) = r.DecodeString()")
- // x.line("z.DecString((*string)(" + varname + "))")
- case reflect.Array, reflect.Chan:
- x.xtraSM(varname, false, t)
- // x.decListFallback(varname, rtid, true, t)
- case reflect.Slice:
- // if a []uint8, call dedicated function
- // if a known fastpath slice, call dedicated function
- // else write encode function in-line.
- // - if elements are primitives or Selfers, call dedicated function on each member.
- // - else call Encoder.encode(XXX) on it.
- if rtid == uint8SliceTypId {
- x.line("*" + varname + " = r.DecodeBytes(*(*[]byte)(" + varname + "), false, false)")
- } else if fastpathAV.index(rtid) != -1 {
- g := x.newGenV(t)
- x.line("z.F." + g.MethodNamePfx("Dec", false) + "X(" + varname + ", false, d)")
- } else {
- x.xtraSM(varname, false, t)
- // x.decListFallback(varname, rtid, false, t)
- }
- case reflect.Map:
- // if a known fastpath map, call dedicated function
- // else write encode function in-line.
- // - if elements are primitives or Selfers, call dedicated function on each member.
- // - else call Encoder.encode(XXX) on it.
- if fastpathAV.index(rtid) != -1 {
- g := x.newGenV(t)
- x.line("z.F." + g.MethodNamePfx("Dec", false) + "X(" + varname + ", false, d)")
- } else {
- x.xtraSM(varname, false, t)
- // x.decMapFallback(varname, rtid, t)
- }
- case reflect.Struct:
- if inlist {
- x.decStruct(varname, rtid, t)
- } else {
- // delete(x.td, rtid)
- x.line("z.DecFallback(" + varname + ", false)")
- }
- default:
- if rtidAdded {
- delete(x.te, rtid)
- }
- x.line("z.DecFallback(" + varname + ", true)")
- }
-}
-
-func (x *genRunner) decTryAssignPrimitive(varname string, t reflect.Type) (tryAsPtr bool) {
- // We have to use the actual type name when doing a direct assignment.
- // We don't have the luxury of casting the pointer to the underlying type.
- //
- // Consequently, in the situation of a
- // type Message int32
- // var x Message
- // var i int32 = 32
- // x = i // this will bomb
- // x = Message(i) // this will work
- // *((*int32)(&x)) = i // this will work
- //
- // Consequently, we replace:
- // case reflect.Uint32: x.line(varname + " = uint32(r.DecodeUint(32))")
- // with:
- // case reflect.Uint32: x.line(varname + " = " + genTypeNamePrim(t, x.tc) + "(r.DecodeUint(32))")
-
- xfn := func(t reflect.Type) string {
- return x.genTypeNamePrim(t)
- }
- switch t.Kind() {
- case reflect.Int:
- x.linef("%s = %s(r.DecodeInt(codecSelferBitsize%s))", varname, xfn(t), x.xs)
- case reflect.Int8:
- x.linef("%s = %s(r.DecodeInt(8))", varname, xfn(t))
- case reflect.Int16:
- x.linef("%s = %s(r.DecodeInt(16))", varname, xfn(t))
- case reflect.Int32:
- x.linef("%s = %s(r.DecodeInt(32))", varname, xfn(t))
- case reflect.Int64:
- x.linef("%s = %s(r.DecodeInt(64))", varname, xfn(t))
-
- case reflect.Uint:
- x.linef("%s = %s(r.DecodeUint(codecSelferBitsize%s))", varname, xfn(t), x.xs)
- case reflect.Uint8:
- x.linef("%s = %s(r.DecodeUint(8))", varname, xfn(t))
- case reflect.Uint16:
- x.linef("%s = %s(r.DecodeUint(16))", varname, xfn(t))
- case reflect.Uint32:
- x.linef("%s = %s(r.DecodeUint(32))", varname, xfn(t))
- case reflect.Uint64:
- x.linef("%s = %s(r.DecodeUint(64))", varname, xfn(t))
- case reflect.Uintptr:
- x.linef("%s = %s(r.DecodeUint(codecSelferBitsize%s))", varname, xfn(t), x.xs)
-
- case reflect.Float32:
- x.linef("%s = %s(r.DecodeFloat(true))", varname, xfn(t))
- case reflect.Float64:
- x.linef("%s = %s(r.DecodeFloat(false))", varname, xfn(t))
-
- case reflect.Bool:
- x.linef("%s = %s(r.DecodeBool())", varname, xfn(t))
- case reflect.String:
- x.linef("%s = %s(r.DecodeString())", varname, xfn(t))
- default:
- tryAsPtr = true
- }
- return
-}
-
-func (x *genRunner) decListFallback(varname string, rtid uintptr, t reflect.Type) {
- type tstruc struct {
- TempVar string
- Rand string
- Varname string
- CTyp string
- Typ string
- Immutable bool
- Size int
- }
- telem := t.Elem()
- ts := tstruc{genTempVarPfx, x.varsfx(), varname, x.genTypeName(t), x.genTypeName(telem), genIsImmutable(telem), int(telem.Size())}
-
- funcs := make(template.FuncMap)
-
- funcs["decLineVar"] = func(varname string) string {
- x.decVar(varname, telem, false)
- return ""
- }
- funcs["decLine"] = func(pfx string) string {
- x.decVar(ts.TempVar+pfx+ts.Rand, reflect.PtrTo(telem), false)
- return ""
- }
- funcs["var"] = func(s string) string {
- return ts.TempVar + s + ts.Rand
- }
- funcs["zero"] = func() string {
- return x.genZeroValueR(telem)
- }
- funcs["isArray"] = func() bool {
- return t.Kind() == reflect.Array
- }
- funcs["isSlice"] = func() bool {
- return t.Kind() == reflect.Slice
- }
- funcs["isChan"] = func() bool {
- return t.Kind() == reflect.Chan
- }
- tm, err := template.New("").Funcs(funcs).Parse(genDecListTmpl)
- if err != nil {
- panic(err)
- }
- if err = tm.Execute(x.w, &ts); err != nil {
- panic(err)
- }
-}
-
-func (x *genRunner) decMapFallback(varname string, rtid uintptr, t reflect.Type) {
- type tstruc struct {
- TempVar string
- Sfx string
- Rand string
- Varname string
- KTyp string
- Typ string
- Size int
- }
- telem := t.Elem()
- tkey := t.Key()
- ts := tstruc{
- genTempVarPfx, x.xs, x.varsfx(), varname, x.genTypeName(tkey),
- x.genTypeName(telem), int(telem.Size() + tkey.Size()),
- }
-
- funcs := make(template.FuncMap)
- funcs["decElemZero"] = func() string {
- return x.genZeroValueR(telem)
- }
- funcs["decElemKindImmutable"] = func() bool {
- return genIsImmutable(telem)
- }
- funcs["decElemKindPtr"] = func() bool {
- return telem.Kind() == reflect.Ptr
- }
- funcs["decElemKindIntf"] = func() bool {
- return telem.Kind() == reflect.Interface
- }
- funcs["decLineVarK"] = func(varname string) string {
- x.decVar(varname, tkey, false)
- return ""
- }
- funcs["decLineVar"] = func(varname string) string {
- x.decVar(varname, telem, false)
- return ""
- }
- funcs["decLineK"] = func(pfx string) string {
- x.decVar(ts.TempVar+pfx+ts.Rand, reflect.PtrTo(tkey), false)
- return ""
- }
- funcs["decLine"] = func(pfx string) string {
- x.decVar(ts.TempVar+pfx+ts.Rand, reflect.PtrTo(telem), false)
- return ""
- }
- funcs["var"] = func(s string) string {
- return ts.TempVar + s + ts.Rand
- }
-
- tm, err := template.New("").Funcs(funcs).Parse(genDecMapTmpl)
- if err != nil {
- panic(err)
- }
- if err = tm.Execute(x.w, &ts); err != nil {
- panic(err)
- }
-}
-
-func (x *genRunner) decStructMapSwitch(kName string, varname string, rtid uintptr, t reflect.Type) {
- ti := x.ti.get(rtid, t)
- tisfi := ti.sfip // always use sequence from file. decStruct expects same thing.
- x.line("switch (" + kName + ") {")
- for _, si := range tisfi {
- x.line("case \"" + si.encName + "\":")
- var t2 reflect.StructField
- if si.i != -1 {
- t2 = t.Field(int(si.i))
- } else {
- //we must accomodate anonymous fields, where the embedded field is a nil pointer in the value.
- // t2 = t.FieldByIndex(si.is)
- t2typ := t
- varname3 := varname
- for _, ix := range si.is {
- for t2typ.Kind() == reflect.Ptr {
- t2typ = t2typ.Elem()
- }
- t2 = t2typ.Field(ix)
- t2typ = t2.Type
- varname3 = varname3 + "." + t2.Name
- if t2typ.Kind() == reflect.Ptr {
- x.linef("if %s == nil { %s = new(%s) }", varname3, varname3, x.genTypeName(t2typ.Elem()))
- }
- }
- }
- x.decVar(varname+"."+t2.Name, t2.Type, false)
- }
- x.line("default:")
- // pass the slice here, so that the string will not escape, and maybe save allocation
- x.line("z.DecStructFieldNotFound(-1, " + kName + ")")
- x.line("} // end switch " + kName)
-}
-
-func (x *genRunner) decStructMap(varname, lenvarname string, rtid uintptr, t reflect.Type, style genStructMapStyle) {
- tpfx := genTempVarPfx
- i := x.varsfx()
- kName := tpfx + "s" + i
-
- // We thought to use ReadStringAsBytes, as go compiler might optimize the copy out.
- // However, using that was more expensive, as it seems that the switch expression
- // is evaluated each time.
- //
- // We could depend on decodeString using a temporary/shared buffer internally.
- // However, this model of creating a byte array, and using explicitly is faster,
- // and allows optional use of unsafe []byte->string conversion without alloc.
-
- // Also, ensure that the slice array doesn't escape.
- // That will help escape analysis prevent allocation when it gets better.
-
- // x.line("var " + kName + "Arr = [32]byte{} // default string to decode into")
- // x.line("var " + kName + "Slc = " + kName + "Arr[:] // default slice to decode into")
- // use the scratch buffer to avoid allocation (most field names are < 32).
-
- x.line("var " + kName + "Slc = z.DecScratchBuffer() // default slice to decode into")
-
- x.line("_ = " + kName + "Slc")
- switch style {
- case genStructMapStyleLenPrefix:
- x.linef("for %sj%s := 0; %sj%s < %s; %sj%s++ {", tpfx, i, tpfx, i, lenvarname, tpfx, i)
- case genStructMapStyleCheckBreak:
- x.linef("for %sj%s := 0; !r.CheckBreak(); %sj%s++ {", tpfx, i, tpfx, i)
- default: // 0, otherwise.
- x.linef("var %shl%s bool = %s >= 0", tpfx, i, lenvarname) // has length
- x.linef("for %sj%s := 0; ; %sj%s++ {", tpfx, i, tpfx, i)
- x.linef("if %shl%s { if %sj%s >= %s { break }", tpfx, i, tpfx, i, lenvarname)
- x.line("} else { if r.CheckBreak() { break }; }")
- }
- x.linef("z.DecSendContainerState(codecSelfer_containerMapKey%s)", x.xs)
- x.line(kName + "Slc = r.DecodeBytes(" + kName + "Slc, true, true)")
- // let string be scoped to this loop alone, so it doesn't escape.
- if x.unsafe {
- x.line(kName + "SlcHdr := codecSelferUnsafeString" + x.xs + "{uintptr(unsafe.Pointer(&" +
- kName + "Slc[0])), len(" + kName + "Slc)}")
- x.line(kName + " := *(*string)(unsafe.Pointer(&" + kName + "SlcHdr))")
- } else {
- x.line(kName + " := string(" + kName + "Slc)")
- }
- x.linef("z.DecSendContainerState(codecSelfer_containerMapValue%s)", x.xs)
- x.decStructMapSwitch(kName, varname, rtid, t)
-
- x.line("} // end for " + tpfx + "j" + i)
- x.linef("z.DecSendContainerState(codecSelfer_containerMapEnd%s)", x.xs)
-}
-
-func (x *genRunner) decStructArray(varname, lenvarname, breakString string, rtid uintptr, t reflect.Type) {
- tpfx := genTempVarPfx
- i := x.varsfx()
- ti := x.ti.get(rtid, t)
- tisfi := ti.sfip // always use sequence from file. decStruct expects same thing.
- x.linef("var %sj%s int", tpfx, i)
- x.linef("var %sb%s bool", tpfx, i) // break
- x.linef("var %shl%s bool = %s >= 0", tpfx, i, lenvarname) // has length
- for _, si := range tisfi {
- var t2 reflect.StructField
- if si.i != -1 {
- t2 = t.Field(int(si.i))
- } else {
- //we must accomodate anonymous fields, where the embedded field is a nil pointer in the value.
- // t2 = t.FieldByIndex(si.is)
- t2typ := t
- varname3 := varname
- for _, ix := range si.is {
- for t2typ.Kind() == reflect.Ptr {
- t2typ = t2typ.Elem()
- }
- t2 = t2typ.Field(ix)
- t2typ = t2.Type
- varname3 = varname3 + "." + t2.Name
- if t2typ.Kind() == reflect.Ptr {
- x.linef("if %s == nil { %s = new(%s) }", varname3, varname3, x.genTypeName(t2typ.Elem()))
- }
- }
- }
-
- x.linef("%sj%s++; if %shl%s { %sb%s = %sj%s > %s } else { %sb%s = r.CheckBreak() }",
- tpfx, i, tpfx, i, tpfx, i,
- tpfx, i, lenvarname, tpfx, i)
- x.linef("if %sb%s { z.DecSendContainerState(codecSelfer_containerArrayEnd%s); %s }",
- tpfx, i, x.xs, breakString)
- x.linef("z.DecSendContainerState(codecSelfer_containerArrayElem%s)", x.xs)
- x.decVar(varname+"."+t2.Name, t2.Type, true)
- }
- // read remaining values and throw away.
- x.line("for {")
- x.linef("%sj%s++; if %shl%s { %sb%s = %sj%s > %s } else { %sb%s = r.CheckBreak() }",
- tpfx, i, tpfx, i, tpfx, i,
- tpfx, i, lenvarname, tpfx, i)
- x.linef("if %sb%s { break }", tpfx, i)
- x.linef("z.DecSendContainerState(codecSelfer_containerArrayElem%s)", x.xs)
- x.linef(`z.DecStructFieldNotFound(%sj%s - 1, "")`, tpfx, i)
- x.line("}")
- x.linef("z.DecSendContainerState(codecSelfer_containerArrayEnd%s)", x.xs)
-}
-
-func (x *genRunner) decStruct(varname string, rtid uintptr, t reflect.Type) {
- // if container is map
- i := x.varsfx()
- x.linef("%sct%s := r.ContainerType()", genTempVarPfx, i)
- x.linef("if %sct%s == codecSelferValueTypeMap%s {", genTempVarPfx, i, x.xs)
- x.line(genTempVarPfx + "l" + i + " := r.ReadMapStart()")
- x.linef("if %sl%s == 0 {", genTempVarPfx, i)
- x.linef("z.DecSendContainerState(codecSelfer_containerMapEnd%s)", x.xs)
- if genUseOneFunctionForDecStructMap {
- x.line("} else { ")
- x.linef("x.codecDecodeSelfFromMap(%sl%s, d)", genTempVarPfx, i)
- } else {
- x.line("} else if " + genTempVarPfx + "l" + i + " > 0 { ")
- x.line("x.codecDecodeSelfFromMapLenPrefix(" + genTempVarPfx + "l" + i + ", d)")
- x.line("} else {")
- x.line("x.codecDecodeSelfFromMapCheckBreak(" + genTempVarPfx + "l" + i + ", d)")
- }
- x.line("}")
-
- // else if container is array
- x.linef("} else if %sct%s == codecSelferValueTypeArray%s {", genTempVarPfx, i, x.xs)
- x.line(genTempVarPfx + "l" + i + " := r.ReadArrayStart()")
- x.linef("if %sl%s == 0 {", genTempVarPfx, i)
- x.linef("z.DecSendContainerState(codecSelfer_containerArrayEnd%s)", x.xs)
- x.line("} else { ")
- x.linef("x.codecDecodeSelfFromArray(%sl%s, d)", genTempVarPfx, i)
- x.line("}")
- // else panic
- x.line("} else { ")
- x.line("panic(codecSelferOnlyMapOrArrayEncodeToStructErr" + x.xs + ")")
- x.line("} ")
-}
-
-// --------
-
-type genV struct {
- // genV is either a primitive (Primitive != "") or a map (MapKey != "") or a slice
- MapKey string
- Elem string
- Primitive string
- Size int
-}
-
-func (x *genRunner) newGenV(t reflect.Type) (v genV) {
- switch t.Kind() {
- case reflect.Slice, reflect.Array:
- te := t.Elem()
- v.Elem = x.genTypeName(te)
- v.Size = int(te.Size())
- case reflect.Map:
- te, tk := t.Elem(), t.Key()
- v.Elem = x.genTypeName(te)
- v.MapKey = x.genTypeName(tk)
- v.Size = int(te.Size() + tk.Size())
- default:
- panic("unexpected type for newGenV. Requires map or slice type")
- }
- return
-}
-
-func (x *genV) MethodNamePfx(prefix string, prim bool) string {
- var name []byte
- if prefix != "" {
- name = append(name, prefix...)
- }
- if prim {
- name = append(name, genTitleCaseName(x.Primitive)...)
- } else {
- if x.MapKey == "" {
- name = append(name, "Slice"...)
- } else {
- name = append(name, "Map"...)
- name = append(name, genTitleCaseName(x.MapKey)...)
- }
- name = append(name, genTitleCaseName(x.Elem)...)
- }
- return string(name)
-
-}
-
-var genCheckVendor = os.Getenv("GO15VENDOREXPERIMENT") == "1"
-
-// genImportPath returns import path of a non-predeclared named typed, or an empty string otherwise.
-//
-// This handles the misbehaviour that occurs when 1.5-style vendoring is enabled,
-// where PkgPath returns the full path, including the vendoring pre-fix that should have been stripped.
-// We strip it here.
-func genImportPath(t reflect.Type) (s string) {
- s = t.PkgPath()
- if genCheckVendor {
- // HACK: Misbehaviour occurs in go 1.5. May have to re-visit this later.
- // if s contains /vendor/ OR startsWith vendor/, then return everything after it.
- const vendorStart = "vendor/"
- const vendorInline = "/vendor/"
- if i := strings.LastIndex(s, vendorInline); i >= 0 {
- s = s[i+len(vendorInline):]
- } else if strings.HasPrefix(s, vendorStart) {
- s = s[len(vendorStart):]
- }
- }
- return
-}
-
-// A go identifier is (letter|_)[letter|number|_]*
-func genGoIdentifier(s string, checkFirstChar bool) string {
- b := make([]byte, 0, len(s))
- t := make([]byte, 4)
- var n int
- for i, r := range s {
- if checkFirstChar && i == 0 && !unicode.IsLetter(r) {
- b = append(b, '_')
- }
- // r must be unicode_letter, unicode_digit or _
- if unicode.IsLetter(r) || unicode.IsDigit(r) {
- n = utf8.EncodeRune(t, r)
- b = append(b, t[:n]...)
- } else {
- b = append(b, '_')
- }
- }
- return string(b)
-}
-
-func genNonPtr(t reflect.Type) reflect.Type {
- for t.Kind() == reflect.Ptr {
- t = t.Elem()
- }
- return t
-}
-
-func genTitleCaseName(s string) string {
- switch s {
- case "interface{}":
- return "Intf"
- default:
- return strings.ToUpper(s[0:1]) + s[1:]
- }
-}
-
-func genMethodNameT(t reflect.Type, tRef reflect.Type) (n string) {
- var ptrPfx string
- for t.Kind() == reflect.Ptr {
- ptrPfx += "Ptrto"
- t = t.Elem()
- }
- tstr := t.String()
- if tn := t.Name(); tn != "" {
- if tRef != nil && genImportPath(t) == genImportPath(tRef) {
- return ptrPfx + tn
- } else {
- if genQNameRegex.MatchString(tstr) {
- return ptrPfx + strings.Replace(tstr, ".", "_", 1000)
- } else {
- return ptrPfx + genCustomTypeName(tstr)
- }
- }
- }
- switch t.Kind() {
- case reflect.Map:
- return ptrPfx + "Map" + genMethodNameT(t.Key(), tRef) + genMethodNameT(t.Elem(), tRef)
- case reflect.Slice:
- return ptrPfx + "Slice" + genMethodNameT(t.Elem(), tRef)
- case reflect.Array:
- return ptrPfx + "Array" + strconv.FormatInt(int64(t.Len()), 10) + genMethodNameT(t.Elem(), tRef)
- case reflect.Chan:
- var cx string
- switch t.ChanDir() {
- case reflect.SendDir:
- cx = "ChanSend"
- case reflect.RecvDir:
- cx = "ChanRecv"
- default:
- cx = "Chan"
- }
- return ptrPfx + cx + genMethodNameT(t.Elem(), tRef)
- default:
- if t == intfTyp {
- return ptrPfx + "Interface"
- } else {
- if tRef != nil && genImportPath(t) == genImportPath(tRef) {
- if t.Name() != "" {
- return ptrPfx + t.Name()
- } else {
- return ptrPfx + genCustomTypeName(tstr)
- }
- } else {
- // best way to get the package name inclusive
- // return ptrPfx + strings.Replace(tstr, ".", "_", 1000)
- // return ptrPfx + genBase64enc.EncodeToString([]byte(tstr))
- if t.Name() != "" && genQNameRegex.MatchString(tstr) {
- return ptrPfx + strings.Replace(tstr, ".", "_", 1000)
- } else {
- return ptrPfx + genCustomTypeName(tstr)
- }
- }
- }
- }
-}
-
-// genCustomNameForType base64encodes the t.String() value in such a way
-// that it can be used within a function name.
-func genCustomTypeName(tstr string) string {
- len2 := genBase64enc.EncodedLen(len(tstr))
- bufx := make([]byte, len2)
- genBase64enc.Encode(bufx, []byte(tstr))
- for i := len2 - 1; i >= 0; i-- {
- if bufx[i] == '=' {
- len2--
- } else {
- break
- }
- }
- return string(bufx[:len2])
-}
-
-func genIsImmutable(t reflect.Type) (v bool) {
- return isImmutableKind(t.Kind())
-}
-
-type genInternal struct {
- Values []genV
- Unsafe bool
-}
-
-func (x genInternal) FastpathLen() (l int) {
- for _, v := range x.Values {
- if v.Primitive == "" {
- l++
- }
- }
- return
-}
-
-func genInternalZeroValue(s string) string {
- switch s {
- case "interface{}":
- return "nil"
- case "bool":
- return "false"
- case "string":
- return `""`
- default:
- return "0"
- }
-}
-
-func genInternalEncCommandAsString(s string, vname string) string {
- switch s {
- case "uint", "uint8", "uint16", "uint32", "uint64":
- return "ee.EncodeUint(uint64(" + vname + "))"
- case "int", "int8", "int16", "int32", "int64":
- return "ee.EncodeInt(int64(" + vname + "))"
- case "string":
- return "ee.EncodeString(c_UTF8, " + vname + ")"
- case "float32":
- return "ee.EncodeFloat32(" + vname + ")"
- case "float64":
- return "ee.EncodeFloat64(" + vname + ")"
- case "bool":
- return "ee.EncodeBool(" + vname + ")"
- case "symbol":
- return "ee.EncodeSymbol(" + vname + ")"
- default:
- return "e.encode(" + vname + ")"
- }
-}
-
-func genInternalDecCommandAsString(s string) string {
- switch s {
- case "uint":
- return "uint(dd.DecodeUint(uintBitsize))"
- case "uint8":
- return "uint8(dd.DecodeUint(8))"
- case "uint16":
- return "uint16(dd.DecodeUint(16))"
- case "uint32":
- return "uint32(dd.DecodeUint(32))"
- case "uint64":
- return "dd.DecodeUint(64)"
- case "uintptr":
- return "uintptr(dd.DecodeUint(uintBitsize))"
- case "int":
- return "int(dd.DecodeInt(intBitsize))"
- case "int8":
- return "int8(dd.DecodeInt(8))"
- case "int16":
- return "int16(dd.DecodeInt(16))"
- case "int32":
- return "int32(dd.DecodeInt(32))"
- case "int64":
- return "dd.DecodeInt(64)"
-
- case "string":
- return "dd.DecodeString()"
- case "float32":
- return "float32(dd.DecodeFloat(true))"
- case "float64":
- return "dd.DecodeFloat(false)"
- case "bool":
- return "dd.DecodeBool()"
- default:
- panic(errors.New("gen internal: unknown type for decode: " + s))
- }
-}
-
-func genInternalSortType(s string, elem bool) string {
- for _, v := range [...]string{"int", "uint", "float", "bool", "string"} {
- if strings.HasPrefix(s, v) {
- if elem {
- if v == "int" || v == "uint" || v == "float" {
- return v + "64"
- } else {
- return v
- }
- }
- return v + "Slice"
- }
- }
- panic("sorttype: unexpected type: " + s)
-}
-
-// var genInternalMu sync.Mutex
-var genInternalV genInternal
-var genInternalTmplFuncs template.FuncMap
-var genInternalOnce sync.Once
-
-func genInternalInit() {
- types := [...]string{
- "interface{}",
- "string",
- "float32",
- "float64",
- "uint",
- "uint8",
- "uint16",
- "uint32",
- "uint64",
- "uintptr",
- "int",
- "int8",
- "int16",
- "int32",
- "int64",
- "bool",
- }
- // keep as slice, so it is in specific iteration order.
- // Initial order was uint64, string, interface{}, int, int64
- mapvaltypes := [...]string{
- "interface{}",
- "string",
- "uint",
- "uint8",
- "uint16",
- "uint32",
- "uint64",
- "uintptr",
- "int",
- "int8",
- "int16",
- "int32",
- "int64",
- "float32",
- "float64",
- "bool",
- }
- wordSizeBytes := int(intBitsize) / 8
-
- mapvaltypes2 := map[string]int{
- "interface{}": 2 * wordSizeBytes,
- "string": 2 * wordSizeBytes,
- "uint": 1 * wordSizeBytes,
- "uint8": 1,
- "uint16": 2,
- "uint32": 4,
- "uint64": 8,
- "uintptr": 1 * wordSizeBytes,
- "int": 1 * wordSizeBytes,
- "int8": 1,
- "int16": 2,
- "int32": 4,
- "int64": 8,
- "float32": 4,
- "float64": 8,
- "bool": 1,
- }
- var gt genInternal
-
- // For each slice or map type, there must be a (symetrical) Encode and Decode fast-path function
- for _, s := range types {
- gt.Values = append(gt.Values, genV{Primitive: s, Size: mapvaltypes2[s]})
- if s != "uint8" { // do not generate fast path for slice of bytes. Treat specially already.
- gt.Values = append(gt.Values, genV{Elem: s, Size: mapvaltypes2[s]})
- }
- if _, ok := mapvaltypes2[s]; !ok {
- gt.Values = append(gt.Values, genV{MapKey: s, Elem: s, Size: 2 * mapvaltypes2[s]})
- }
- for _, ms := range mapvaltypes {
- gt.Values = append(gt.Values, genV{MapKey: s, Elem: ms, Size: mapvaltypes2[s] + mapvaltypes2[ms]})
- }
- }
-
- funcs := make(template.FuncMap)
- // funcs["haspfx"] = strings.HasPrefix
- funcs["encmd"] = genInternalEncCommandAsString
- funcs["decmd"] = genInternalDecCommandAsString
- funcs["zerocmd"] = genInternalZeroValue
- funcs["hasprefix"] = strings.HasPrefix
- funcs["sorttype"] = genInternalSortType
-
- genInternalV = gt
- genInternalTmplFuncs = funcs
-}
-
-// genInternalGoFile is used to generate source files from templates.
-// It is run by the program author alone.
-// Unfortunately, it has to be exported so that it can be called from a command line tool.
-// *** DO NOT USE ***
-func genInternalGoFile(r io.Reader, w io.Writer, safe bool) (err error) {
- genInternalOnce.Do(genInternalInit)
-
- gt := genInternalV
- gt.Unsafe = !safe
-
- t := template.New("").Funcs(genInternalTmplFuncs)
-
- tmplstr, err := ioutil.ReadAll(r)
- if err != nil {
- return
- }
-
- if t, err = t.Parse(string(tmplstr)); err != nil {
- return
- }
-
- var out bytes.Buffer
- err = t.Execute(&out, gt)
- if err != nil {
- return
- }
-
- bout, err := format.Source(out.Bytes())
- if err != nil {
- w.Write(out.Bytes()) // write out if error, so we can still see.
- // w.Write(bout) // write out if error, as much as possible, so we can still see.
- return
- }
- w.Write(bout)
- return
-}
diff --git a/vendor/github.com/ugorji/go/codec/helper.go b/vendor/github.com/ugorji/go/codec/helper.go
deleted file mode 100644
index 40065a01..00000000
--- a/vendor/github.com/ugorji/go/codec/helper.go
+++ /dev/null
@@ -1,1271 +0,0 @@
-// Copyright (c) 2012-2015 Ugorji Nwoke. All rights reserved.
-// Use of this source code is governed by a MIT license found in the LICENSE file.
-
-package codec
-
-// Contains code shared by both encode and decode.
-
-// Some shared ideas around encoding/decoding
-// ------------------------------------------
-//
-// If an interface{} is passed, we first do a type assertion to see if it is
-// a primitive type or a map/slice of primitive types, and use a fastpath to handle it.
-//
-// If we start with a reflect.Value, we are already in reflect.Value land and
-// will try to grab the function for the underlying Type and directly call that function.
-// This is more performant than calling reflect.Value.Interface().
-//
-// This still helps us bypass many layers of reflection, and give best performance.
-//
-// Containers
-// ------------
-// Containers in the stream are either associative arrays (key-value pairs) or
-// regular arrays (indexed by incrementing integers).
-//
-// Some streams support indefinite-length containers, and use a breaking
-// byte-sequence to denote that the container has come to an end.
-//
-// Some streams also are text-based, and use explicit separators to denote the
-// end/beginning of different values.
-//
-// During encode, we use a high-level condition to determine how to iterate through
-// the container. That decision is based on whether the container is text-based (with
-// separators) or binary (without separators). If binary, we do not even call the
-// encoding of separators.
-//
-// During decode, we use a different high-level condition to determine how to iterate
-// through the containers. That decision is based on whether the stream contained
-// a length prefix, or if it used explicit breaks. If length-prefixed, we assume that
-// it has to be binary, and we do not even try to read separators.
-//
-// The only codec that may suffer (slightly) is cbor, and only when decoding indefinite-length.
-// It may suffer because we treat it like a text-based codec, and read separators.
-// However, this read is a no-op and the cost is insignificant.
-//
-// Philosophy
-// ------------
-// On decode, this codec will update containers appropriately:
-// - If struct, update fields from stream into fields of struct.
-// If field in stream not found in struct, handle appropriately (based on option).
-// If a struct field has no corresponding value in the stream, leave it AS IS.
-// If nil in stream, set value to nil/zero value.
-// - If map, update map from stream.
-// If the stream value is NIL, set the map to nil.
-// - if slice, try to update up to length of array in stream.
-// if container len is less than stream array length,
-// and container cannot be expanded, handled (based on option).
-// This means you can decode 4-element stream array into 1-element array.
-//
-// ------------------------------------
-// On encode, user can specify omitEmpty. This means that the value will be omitted
-// if the zero value. The problem may occur during decode, where omitted values do not affect
-// the value being decoded into. This means that if decoding into a struct with an
-// int field with current value=5, and the field is omitted in the stream, then after
-// decoding, the value will still be 5 (not 0).
-// omitEmpty only works if you guarantee that you always decode into zero-values.
-//
-// ------------------------------------
-// We could have truncated a map to remove keys not available in the stream,
-// or set values in the struct which are not in the stream to their zero values.
-// We decided against it because there is no efficient way to do it.
-// We may introduce it as an option later.
-// However, that will require enabling it for both runtime and code generation modes.
-//
-// To support truncate, we need to do 2 passes over the container:
-// map
-// - first collect all keys (e.g. in k1)
-// - for each key in stream, mark k1 that the key should not be removed
-// - after updating map, do second pass and call delete for all keys in k1 which are not marked
-// struct:
-// - for each field, track the *typeInfo s1
-// - iterate through all s1, and for each one not marked, set value to zero
-// - this involves checking the possible anonymous fields which are nil ptrs.
-// too much work.
-//
-// ------------------------------------------
-// Error Handling is done within the library using panic.
-//
-// This way, the code doesn't have to keep checking if an error has happened,
-// and we don't have to keep sending the error value along with each call
-// or storing it in the En|Decoder and checking it constantly along the way.
-//
-// The disadvantage is that small functions which use panics cannot be inlined.
-// The code accounts for that by only using panics behind an interface;
-// since interface calls cannot be inlined, this is irrelevant.
-//
-// We considered storing the error is En|Decoder.
-// - once it has its err field set, it cannot be used again.
-// - panicing will be optional, controlled by const flag.
-// - code should always check error first and return early.
-// We eventually decided against it as it makes the code clumsier to always
-// check for these error conditions.
-
-import (
- "bytes"
- "encoding"
- "encoding/binary"
- "errors"
- "fmt"
- "math"
- "reflect"
- "sort"
- "strings"
- "sync"
- "time"
-)
-
-const (
- scratchByteArrayLen = 32
- initCollectionCap = 32 // 32 is defensive. 16 is preferred.
-
- // Support encoding.(Binary|Text)(Unm|M)arshaler.
- // This constant flag will enable or disable it.
- supportMarshalInterfaces = true
-
- // Each Encoder or Decoder uses a cache of functions based on conditionals,
- // so that the conditionals are not run every time.
- //
- // Either a map or a slice is used to keep track of the functions.
- // The map is more natural, but has a higher cost than a slice/array.
- // This flag (useMapForCodecCache) controls which is used.
- //
- // From benchmarks, slices with linear search perform better with < 32 entries.
- // We have typically seen a high threshold of about 24 entries.
- useMapForCodecCache = false
-
- // for debugging, set this to false, to catch panic traces.
- // Note that this will always cause rpc tests to fail, since they need io.EOF sent via panic.
- recoverPanicToErr = true
-
- // Fast path functions try to create a fast path encode or decode implementation
- // for common maps and slices, by by-passing reflection altogether.
- fastpathEnabled = true
-
- // if checkStructForEmptyValue, check structs fields to see if an empty value.
- // This could be an expensive call, so possibly disable it.
- checkStructForEmptyValue = false
-
- // if derefForIsEmptyValue, deref pointers and interfaces when checking isEmptyValue
- derefForIsEmptyValue = false
-
- // if resetSliceElemToZeroValue, then on decoding a slice, reset the element to a zero value first.
- // Only concern is that, if the slice already contained some garbage, we will decode into that garbage.
- // The chances of this are slim, so leave this "optimization".
- // TODO: should this be true, to ensure that we always decode into a "zero" "empty" value?
- resetSliceElemToZeroValue bool = false
-)
-
-var (
- oneByteArr = [1]byte{0}
- zeroByteSlice = oneByteArr[:0:0]
-)
-
-type charEncoding uint8
-
-const (
- c_RAW charEncoding = iota
- c_UTF8
- c_UTF16LE
- c_UTF16BE
- c_UTF32LE
- c_UTF32BE
-)
-
-// valueType is the stream type
-type valueType uint8
-
-const (
- valueTypeUnset valueType = iota
- valueTypeNil
- valueTypeInt
- valueTypeUint
- valueTypeFloat
- valueTypeBool
- valueTypeString
- valueTypeSymbol
- valueTypeBytes
- valueTypeMap
- valueTypeArray
- valueTypeTimestamp
- valueTypeExt
-
- // valueTypeInvalid = 0xff
-)
-
-type seqType uint8
-
-const (
- _ seqType = iota
- seqTypeArray
- seqTypeSlice
- seqTypeChan
-)
-
-// note that containerMapStart and containerArraySend are not sent.
-// This is because the ReadXXXStart and EncodeXXXStart already does these.
-type containerState uint8
-
-const (
- _ containerState = iota
-
- containerMapStart // slot left open, since Driver method already covers it
- containerMapKey
- containerMapValue
- containerMapEnd
- containerArrayStart // slot left open, since Driver methods already cover it
- containerArrayElem
- containerArrayEnd
-)
-
-type rgetPoolT struct {
- encNames [8]string
- fNames [8]string
- etypes [8]uintptr
- sfis [8]*structFieldInfo
-}
-
-var rgetPool = sync.Pool{
- New: func() interface{} { return new(rgetPoolT) },
-}
-
-type rgetT struct {
- fNames []string
- encNames []string
- etypes []uintptr
- sfis []*structFieldInfo
-}
-
-type containerStateRecv interface {
- sendContainerState(containerState)
-}
-
-// mirror json.Marshaler and json.Unmarshaler here,
-// so we don't import the encoding/json package
-type jsonMarshaler interface {
- MarshalJSON() ([]byte, error)
-}
-type jsonUnmarshaler interface {
- UnmarshalJSON([]byte) error
-}
-
-var (
- bigen = binary.BigEndian
- structInfoFieldName = "_struct"
-
- mapStrIntfTyp = reflect.TypeOf(map[string]interface{}(nil))
- mapIntfIntfTyp = reflect.TypeOf(map[interface{}]interface{}(nil))
- intfSliceTyp = reflect.TypeOf([]interface{}(nil))
- intfTyp = intfSliceTyp.Elem()
-
- stringTyp = reflect.TypeOf("")
- timeTyp = reflect.TypeOf(time.Time{})
- rawExtTyp = reflect.TypeOf(RawExt{})
- uint8SliceTyp = reflect.TypeOf([]uint8(nil))
-
- mapBySliceTyp = reflect.TypeOf((*MapBySlice)(nil)).Elem()
-
- binaryMarshalerTyp = reflect.TypeOf((*encoding.BinaryMarshaler)(nil)).Elem()
- binaryUnmarshalerTyp = reflect.TypeOf((*encoding.BinaryUnmarshaler)(nil)).Elem()
-
- textMarshalerTyp = reflect.TypeOf((*encoding.TextMarshaler)(nil)).Elem()
- textUnmarshalerTyp = reflect.TypeOf((*encoding.TextUnmarshaler)(nil)).Elem()
-
- jsonMarshalerTyp = reflect.TypeOf((*jsonMarshaler)(nil)).Elem()
- jsonUnmarshalerTyp = reflect.TypeOf((*jsonUnmarshaler)(nil)).Elem()
-
- selferTyp = reflect.TypeOf((*Selfer)(nil)).Elem()
-
- uint8SliceTypId = reflect.ValueOf(uint8SliceTyp).Pointer()
- rawExtTypId = reflect.ValueOf(rawExtTyp).Pointer()
- intfTypId = reflect.ValueOf(intfTyp).Pointer()
- timeTypId = reflect.ValueOf(timeTyp).Pointer()
- stringTypId = reflect.ValueOf(stringTyp).Pointer()
-
- mapStrIntfTypId = reflect.ValueOf(mapStrIntfTyp).Pointer()
- mapIntfIntfTypId = reflect.ValueOf(mapIntfIntfTyp).Pointer()
- intfSliceTypId = reflect.ValueOf(intfSliceTyp).Pointer()
- // mapBySliceTypId = reflect.ValueOf(mapBySliceTyp).Pointer()
-
- intBitsize uint8 = uint8(reflect.TypeOf(int(0)).Bits())
- uintBitsize uint8 = uint8(reflect.TypeOf(uint(0)).Bits())
-
- bsAll0x00 = []byte{0, 0, 0, 0, 0, 0, 0, 0}
- bsAll0xff = []byte{0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff}
-
- chkOvf checkOverflow
-
- noFieldNameToStructFieldInfoErr = errors.New("no field name passed to parseStructFieldInfo")
-)
-
-var defTypeInfos = NewTypeInfos([]string{"codec", "json"})
-
-// Selfer defines methods by which a value can encode or decode itself.
-//
-// Any type which implements Selfer will be able to encode or decode itself.
-// Consequently, during (en|de)code, this takes precedence over
-// (text|binary)(M|Unm)arshal or extension support.
-type Selfer interface {
- CodecEncodeSelf(*Encoder)
- CodecDecodeSelf(*Decoder)
-}
-
-// MapBySlice represents a slice which should be encoded as a map in the stream.
-// The slice contains a sequence of key-value pairs.
-// This affords storing a map in a specific sequence in the stream.
-//
-// The support of MapBySlice affords the following:
-// - A slice type which implements MapBySlice will be encoded as a map
-// - A slice can be decoded from a map in the stream
-type MapBySlice interface {
- MapBySlice()
-}
-
-// WARNING: DO NOT USE DIRECTLY. EXPORTED FOR GODOC BENEFIT. WILL BE REMOVED.
-//
-// BasicHandle encapsulates the common options and extension functions.
-type BasicHandle struct {
- // TypeInfos is used to get the type info for any type.
- //
- // If not configured, the default TypeInfos is used, which uses struct tag keys: codec, json
- TypeInfos *TypeInfos
-
- extHandle
- EncodeOptions
- DecodeOptions
-}
-
-func (x *BasicHandle) getBasicHandle() *BasicHandle {
- return x
-}
-
-func (x *BasicHandle) getTypeInfo(rtid uintptr, rt reflect.Type) (pti *typeInfo) {
- if x.TypeInfos != nil {
- return x.TypeInfos.get(rtid, rt)
- }
- return defTypeInfos.get(rtid, rt)
-}
-
-// Handle is the interface for a specific encoding format.
-//
-// Typically, a Handle is pre-configured before first time use,
-// and not modified while in use. Such a pre-configured Handle
-// is safe for concurrent access.
-type Handle interface {
- getBasicHandle() *BasicHandle
- newEncDriver(w *Encoder) encDriver
- newDecDriver(r *Decoder) decDriver
- isBinary() bool
-}
-
-// RawExt represents raw unprocessed extension data.
-// Some codecs will decode extension data as a *RawExt if there is no registered extension for the tag.
-//
-// Only one of Data or Value is nil. If Data is nil, then the content of the RawExt is in the Value.
-type RawExt struct {
- Tag uint64
- // Data is the []byte which represents the raw ext. If Data is nil, ext is exposed in Value.
- // Data is used by codecs (e.g. binc, msgpack, simple) which do custom serialization of the types
- Data []byte
- // Value represents the extension, if Data is nil.
- // Value is used by codecs (e.g. cbor) which use the format to do custom serialization of the types.
- Value interface{}
-}
-
-// BytesExt handles custom (de)serialization of types to/from []byte.
-// It is used by codecs (e.g. binc, msgpack, simple) which do custom serialization of the types.
-type BytesExt interface {
- // WriteExt converts a value to a []byte.
- //
- // Note: v *may* be a pointer to the extension type, if the extension type was a struct or array.
- WriteExt(v interface{}) []byte
-
- // ReadExt updates a value from a []byte.
- ReadExt(dst interface{}, src []byte)
-}
-
-// InterfaceExt handles custom (de)serialization of types to/from another interface{} value.
-// The Encoder or Decoder will then handle the further (de)serialization of that known type.
-//
-// It is used by codecs (e.g. cbor, json) which use the format to do custom serialization of the types.
-type InterfaceExt interface {
- // ConvertExt converts a value into a simpler interface for easy encoding e.g. convert time.Time to int64.
- //
- // Note: v *may* be a pointer to the extension type, if the extension type was a struct or array.
- ConvertExt(v interface{}) interface{}
-
- // UpdateExt updates a value from a simpler interface for easy decoding e.g. convert int64 to time.Time.
- UpdateExt(dst interface{}, src interface{})
-}
-
-// Ext handles custom (de)serialization of custom types / extensions.
-type Ext interface {
- BytesExt
- InterfaceExt
-}
-
-// addExtWrapper is a wrapper implementation to support former AddExt exported method.
-type addExtWrapper struct {
- encFn func(reflect.Value) ([]byte, error)
- decFn func(reflect.Value, []byte) error
-}
-
-func (x addExtWrapper) WriteExt(v interface{}) []byte {
- bs, err := x.encFn(reflect.ValueOf(v))
- if err != nil {
- panic(err)
- }
- return bs
-}
-
-func (x addExtWrapper) ReadExt(v interface{}, bs []byte) {
- if err := x.decFn(reflect.ValueOf(v), bs); err != nil {
- panic(err)
- }
-}
-
-func (x addExtWrapper) ConvertExt(v interface{}) interface{} {
- return x.WriteExt(v)
-}
-
-func (x addExtWrapper) UpdateExt(dest interface{}, v interface{}) {
- x.ReadExt(dest, v.([]byte))
-}
-
-type setExtWrapper struct {
- b BytesExt
- i InterfaceExt
-}
-
-func (x *setExtWrapper) WriteExt(v interface{}) []byte {
- if x.b == nil {
- panic("BytesExt.WriteExt is not supported")
- }
- return x.b.WriteExt(v)
-}
-
-func (x *setExtWrapper) ReadExt(v interface{}, bs []byte) {
- if x.b == nil {
- panic("BytesExt.WriteExt is not supported")
-
- }
- x.b.ReadExt(v, bs)
-}
-
-func (x *setExtWrapper) ConvertExt(v interface{}) interface{} {
- if x.i == nil {
- panic("InterfaceExt.ConvertExt is not supported")
-
- }
- return x.i.ConvertExt(v)
-}
-
-func (x *setExtWrapper) UpdateExt(dest interface{}, v interface{}) {
- if x.i == nil {
- panic("InterfaceExxt.UpdateExt is not supported")
-
- }
- x.i.UpdateExt(dest, v)
-}
-
-// type errorString string
-// func (x errorString) Error() string { return string(x) }
-
-type binaryEncodingType struct{}
-
-func (_ binaryEncodingType) isBinary() bool { return true }
-
-type textEncodingType struct{}
-
-func (_ textEncodingType) isBinary() bool { return false }
-
-// noBuiltInTypes is embedded into many types which do not support builtins
-// e.g. msgpack, simple, cbor.
-type noBuiltInTypes struct{}
-
-func (_ noBuiltInTypes) IsBuiltinType(rt uintptr) bool { return false }
-func (_ noBuiltInTypes) EncodeBuiltin(rt uintptr, v interface{}) {}
-func (_ noBuiltInTypes) DecodeBuiltin(rt uintptr, v interface{}) {}
-
-type noStreamingCodec struct{}
-
-func (_ noStreamingCodec) CheckBreak() bool { return false }
-
-// bigenHelper.
-// Users must already slice the x completely, because we will not reslice.
-type bigenHelper struct {
- x []byte // must be correctly sliced to appropriate len. slicing is a cost.
- w encWriter
-}
-
-func (z bigenHelper) writeUint16(v uint16) {
- bigen.PutUint16(z.x, v)
- z.w.writeb(z.x)
-}
-
-func (z bigenHelper) writeUint32(v uint32) {
- bigen.PutUint32(z.x, v)
- z.w.writeb(z.x)
-}
-
-func (z bigenHelper) writeUint64(v uint64) {
- bigen.PutUint64(z.x, v)
- z.w.writeb(z.x)
-}
-
-type extTypeTagFn struct {
- rtid uintptr
- rt reflect.Type
- tag uint64
- ext Ext
-}
-
-type extHandle []extTypeTagFn
-
-// DEPRECATED: Use SetBytesExt or SetInterfaceExt on the Handle instead.
-//
-// AddExt registes an encode and decode function for a reflect.Type.
-// AddExt internally calls SetExt.
-// To deregister an Ext, call AddExt with nil encfn and/or nil decfn.
-func (o *extHandle) AddExt(
- rt reflect.Type, tag byte,
- encfn func(reflect.Value) ([]byte, error), decfn func(reflect.Value, []byte) error,
-) (err error) {
- if encfn == nil || decfn == nil {
- return o.SetExt(rt, uint64(tag), nil)
- }
- return o.SetExt(rt, uint64(tag), addExtWrapper{encfn, decfn})
-}
-
-// DEPRECATED: Use SetBytesExt or SetInterfaceExt on the Handle instead.
-//
-// Note that the type must be a named type, and specifically not
-// a pointer or Interface. An error is returned if that is not honored.
-//
-// To Deregister an ext, call SetExt with nil Ext
-func (o *extHandle) SetExt(rt reflect.Type, tag uint64, ext Ext) (err error) {
- // o is a pointer, because we may need to initialize it
- if rt.PkgPath() == "" || rt.Kind() == reflect.Interface {
- err = fmt.Errorf("codec.Handle.AddExt: Takes named type, especially not a pointer or interface: %T",
- reflect.Zero(rt).Interface())
- return
- }
-
- rtid := reflect.ValueOf(rt).Pointer()
- for _, v := range *o {
- if v.rtid == rtid {
- v.tag, v.ext = tag, ext
- return
- }
- }
-
- if *o == nil {
- *o = make([]extTypeTagFn, 0, 4)
- }
- *o = append(*o, extTypeTagFn{rtid, rt, tag, ext})
- return
-}
-
-func (o extHandle) getExt(rtid uintptr) *extTypeTagFn {
- var v *extTypeTagFn
- for i := range o {
- v = &o[i]
- if v.rtid == rtid {
- return v
- }
- }
- return nil
-}
-
-func (o extHandle) getExtForTag(tag uint64) *extTypeTagFn {
- var v *extTypeTagFn
- for i := range o {
- v = &o[i]
- if v.tag == tag {
- return v
- }
- }
- return nil
-}
-
-type structFieldInfo struct {
- encName string // encode name
-
- // only one of 'i' or 'is' can be set. If 'i' is -1, then 'is' has been set.
-
- is []int // (recursive/embedded) field index in struct
- i int16 // field index in struct
- omitEmpty bool
- toArray bool // if field is _struct, is the toArray set?
-}
-
-// func (si *structFieldInfo) isZero() bool {
-// return si.encName == "" && len(si.is) == 0 && si.i == 0 && !si.omitEmpty && !si.toArray
-// }
-
-// rv returns the field of the struct.
-// If anonymous, it returns an Invalid
-func (si *structFieldInfo) field(v reflect.Value, update bool) (rv2 reflect.Value) {
- if si.i != -1 {
- v = v.Field(int(si.i))
- return v
- }
- // replicate FieldByIndex
- for _, x := range si.is {
- for v.Kind() == reflect.Ptr {
- if v.IsNil() {
- if !update {
- return
- }
- v.Set(reflect.New(v.Type().Elem()))
- }
- v = v.Elem()
- }
- v = v.Field(x)
- }
- return v
-}
-
-func (si *structFieldInfo) setToZeroValue(v reflect.Value) {
- if si.i != -1 {
- v = v.Field(int(si.i))
- v.Set(reflect.Zero(v.Type()))
- // v.Set(reflect.New(v.Type()).Elem())
- // v.Set(reflect.New(v.Type()))
- } else {
- // replicate FieldByIndex
- for _, x := range si.is {
- for v.Kind() == reflect.Ptr {
- if v.IsNil() {
- return
- }
- v = v.Elem()
- }
- v = v.Field(x)
- }
- v.Set(reflect.Zero(v.Type()))
- }
-}
-
-func parseStructFieldInfo(fname string, stag string) *structFieldInfo {
- // if fname == "" {
- // panic(noFieldNameToStructFieldInfoErr)
- // }
- si := structFieldInfo{
- encName: fname,
- }
-
- if stag != "" {
- for i, s := range strings.Split(stag, ",") {
- if i == 0 {
- if s != "" {
- si.encName = s
- }
- } else {
- if s == "omitempty" {
- si.omitEmpty = true
- } else if s == "toarray" {
- si.toArray = true
- }
- }
- }
- }
- // si.encNameBs = []byte(si.encName)
- return &si
-}
-
-type sfiSortedByEncName []*structFieldInfo
-
-func (p sfiSortedByEncName) Len() int {
- return len(p)
-}
-
-func (p sfiSortedByEncName) Less(i, j int) bool {
- return p[i].encName < p[j].encName
-}
-
-func (p sfiSortedByEncName) Swap(i, j int) {
- p[i], p[j] = p[j], p[i]
-}
-
-// typeInfo keeps information about each type referenced in the encode/decode sequence.
-//
-// During an encode/decode sequence, we work as below:
-// - If base is a built in type, en/decode base value
-// - If base is registered as an extension, en/decode base value
-// - If type is binary(M/Unm)arshaler, call Binary(M/Unm)arshal method
-// - If type is text(M/Unm)arshaler, call Text(M/Unm)arshal method
-// - Else decode appropriately based on the reflect.Kind
-type typeInfo struct {
- sfi []*structFieldInfo // sorted. Used when enc/dec struct to map.
- sfip []*structFieldInfo // unsorted. Used when enc/dec struct to array.
-
- rt reflect.Type
- rtid uintptr
-
- numMeth uint16 // number of methods
-
- // baseId gives pointer to the base reflect.Type, after deferencing
- // the pointers. E.g. base type of ***time.Time is time.Time.
- base reflect.Type
- baseId uintptr
- baseIndir int8 // number of indirections to get to base
-
- mbs bool // base type (T or *T) is a MapBySlice
-
- bm bool // base type (T or *T) is a binaryMarshaler
- bunm bool // base type (T or *T) is a binaryUnmarshaler
- bmIndir int8 // number of indirections to get to binaryMarshaler type
- bunmIndir int8 // number of indirections to get to binaryUnmarshaler type
-
- tm bool // base type (T or *T) is a textMarshaler
- tunm bool // base type (T or *T) is a textUnmarshaler
- tmIndir int8 // number of indirections to get to textMarshaler type
- tunmIndir int8 // number of indirections to get to textUnmarshaler type
-
- jm bool // base type (T or *T) is a jsonMarshaler
- junm bool // base type (T or *T) is a jsonUnmarshaler
- jmIndir int8 // number of indirections to get to jsonMarshaler type
- junmIndir int8 // number of indirections to get to jsonUnmarshaler type
-
- cs bool // base type (T or *T) is a Selfer
- csIndir int8 // number of indirections to get to Selfer type
-
- toArray bool // whether this (struct) type should be encoded as an array
-}
-
-func (ti *typeInfo) indexForEncName(name string) int {
- //tisfi := ti.sfi
- const binarySearchThreshold = 16
- if sfilen := len(ti.sfi); sfilen < binarySearchThreshold {
- // linear search. faster than binary search in my testing up to 16-field structs.
- for i, si := range ti.sfi {
- if si.encName == name {
- return i
- }
- }
- } else {
- // binary search. adapted from sort/search.go.
- h, i, j := 0, 0, sfilen
- for i < j {
- h = i + (j-i)/2
- if ti.sfi[h].encName < name {
- i = h + 1
- } else {
- j = h
- }
- }
- if i < sfilen && ti.sfi[i].encName == name {
- return i
- }
- }
- return -1
-}
-
-// TypeInfos caches typeInfo for each type on first inspection.
-//
-// It is configured with a set of tag keys, which are used to get
-// configuration for the type.
-type TypeInfos struct {
- infos map[uintptr]*typeInfo
- mu sync.RWMutex
- tags []string
-}
-
-// NewTypeInfos creates a TypeInfos given a set of struct tags keys.
-//
-// This allows users customize the struct tag keys which contain configuration
-// of their types.
-func NewTypeInfos(tags []string) *TypeInfos {
- return &TypeInfos{tags: tags, infos: make(map[uintptr]*typeInfo, 64)}
-}
-
-func (x *TypeInfos) structTag(t reflect.StructTag) (s string) {
- // check for tags: codec, json, in that order.
- // this allows seamless support for many configured structs.
- for _, x := range x.tags {
- s = t.Get(x)
- if s != "" {
- return s
- }
- }
- return
-}
-
-func (x *TypeInfos) get(rtid uintptr, rt reflect.Type) (pti *typeInfo) {
- var ok bool
- x.mu.RLock()
- pti, ok = x.infos[rtid]
- x.mu.RUnlock()
- if ok {
- return
- }
-
- // do not hold lock while computing this.
- // it may lead to duplication, but that's ok.
- ti := typeInfo{rt: rt, rtid: rtid}
- ti.numMeth = uint16(rt.NumMethod())
-
- var indir int8
- if ok, indir = implementsIntf(rt, binaryMarshalerTyp); ok {
- ti.bm, ti.bmIndir = true, indir
- }
- if ok, indir = implementsIntf(rt, binaryUnmarshalerTyp); ok {
- ti.bunm, ti.bunmIndir = true, indir
- }
- if ok, indir = implementsIntf(rt, textMarshalerTyp); ok {
- ti.tm, ti.tmIndir = true, indir
- }
- if ok, indir = implementsIntf(rt, textUnmarshalerTyp); ok {
- ti.tunm, ti.tunmIndir = true, indir
- }
- if ok, indir = implementsIntf(rt, jsonMarshalerTyp); ok {
- ti.jm, ti.jmIndir = true, indir
- }
- if ok, indir = implementsIntf(rt, jsonUnmarshalerTyp); ok {
- ti.junm, ti.junmIndir = true, indir
- }
- if ok, indir = implementsIntf(rt, selferTyp); ok {
- ti.cs, ti.csIndir = true, indir
- }
- if ok, _ = implementsIntf(rt, mapBySliceTyp); ok {
- ti.mbs = true
- }
-
- pt := rt
- var ptIndir int8
- // for ; pt.Kind() == reflect.Ptr; pt, ptIndir = pt.Elem(), ptIndir+1 { }
- for pt.Kind() == reflect.Ptr {
- pt = pt.Elem()
- ptIndir++
- }
- if ptIndir == 0 {
- ti.base = rt
- ti.baseId = rtid
- } else {
- ti.base = pt
- ti.baseId = reflect.ValueOf(pt).Pointer()
- ti.baseIndir = ptIndir
- }
-
- if rt.Kind() == reflect.Struct {
- var siInfo *structFieldInfo
- if f, ok := rt.FieldByName(structInfoFieldName); ok {
- siInfo = parseStructFieldInfo(structInfoFieldName, x.structTag(f.Tag))
- ti.toArray = siInfo.toArray
- }
- pi := rgetPool.Get()
- pv := pi.(*rgetPoolT)
- pv.etypes[0] = ti.baseId
- vv := rgetT{pv.fNames[:0], pv.encNames[:0], pv.etypes[:1], pv.sfis[:0]}
- x.rget(rt, rtid, nil, &vv, siInfo)
- ti.sfip = make([]*structFieldInfo, len(vv.sfis))
- ti.sfi = make([]*structFieldInfo, len(vv.sfis))
- copy(ti.sfip, vv.sfis)
- sort.Sort(sfiSortedByEncName(vv.sfis))
- copy(ti.sfi, vv.sfis)
- rgetPool.Put(pi)
- }
- // sfi = sfip
-
- x.mu.Lock()
- if pti, ok = x.infos[rtid]; !ok {
- pti = &ti
- x.infos[rtid] = pti
- }
- x.mu.Unlock()
- return
-}
-
-func (x *TypeInfos) rget(rt reflect.Type, rtid uintptr,
- indexstack []int, pv *rgetT, siInfo *structFieldInfo,
-) {
- // This will read up the fields and store how to access the value.
- // It uses the go language's rules for embedding, as below:
- // - if a field has been seen while traversing, skip it
- // - if an encName has been seen while traversing, skip it
- // - if an embedded type has been seen, skip it
- //
- // Also, per Go's rules, embedded fields must be analyzed AFTER all top-level fields.
- //
- // Note: we consciously use slices, not a map, to simulate a set.
- // Typically, types have < 16 fields, and iteration using equals is faster than maps there
-
- type anonField struct {
- ft reflect.Type
- idx int
- }
-
- var anonFields []anonField
-
-LOOP:
- for j, jlen := 0, rt.NumField(); j < jlen; j++ {
- f := rt.Field(j)
- fkind := f.Type.Kind()
- // skip if a func type, or is unexported, or structTag value == "-"
- switch fkind {
- case reflect.Func, reflect.Complex64, reflect.Complex128, reflect.UnsafePointer:
- continue LOOP
- }
-
- // if r1, _ := utf8.DecodeRuneInString(f.Name); r1 == utf8.RuneError || !unicode.IsUpper(r1) {
- if f.PkgPath != "" && !f.Anonymous { // unexported, not embedded
- continue
- }
- stag := x.structTag(f.Tag)
- if stag == "-" {
- continue
- }
- var si *structFieldInfo
- // if anonymous and no struct tag (or it's blank), and a struct (or pointer to struct), inline it.
- if f.Anonymous && fkind != reflect.Interface {
- doInline := stag == ""
- if !doInline {
- si = parseStructFieldInfo("", stag)
- doInline = si.encName == ""
- // doInline = si.isZero()
- }
- if doInline {
- ft := f.Type
- for ft.Kind() == reflect.Ptr {
- ft = ft.Elem()
- }
- if ft.Kind() == reflect.Struct {
- // handle anonymous fields after handling all the non-anon fields
- anonFields = append(anonFields, anonField{ft, j})
- continue
- }
- }
- }
-
- // after the anonymous dance: if an unexported field, skip
- if f.PkgPath != "" { // unexported
- continue
- }
-
- if f.Name == "" {
- panic(noFieldNameToStructFieldInfoErr)
- }
-
- for _, k := range pv.fNames {
- if k == f.Name {
- continue LOOP
- }
- }
- pv.fNames = append(pv.fNames, f.Name)
-
- if si == nil {
- si = parseStructFieldInfo(f.Name, stag)
- } else if si.encName == "" {
- si.encName = f.Name
- }
-
- for _, k := range pv.encNames {
- if k == si.encName {
- continue LOOP
- }
- }
- pv.encNames = append(pv.encNames, si.encName)
-
- // si.ikind = int(f.Type.Kind())
- if len(indexstack) == 0 {
- si.i = int16(j)
- } else {
- si.i = -1
- si.is = make([]int, len(indexstack)+1)
- copy(si.is, indexstack)
- si.is[len(indexstack)] = j
- // si.is = append(append(make([]int, 0, len(indexstack)+4), indexstack...), j)
- }
-
- if siInfo != nil {
- if siInfo.omitEmpty {
- si.omitEmpty = true
- }
- }
- pv.sfis = append(pv.sfis, si)
- }
-
- // now handle anonymous fields
-LOOP2:
- for _, af := range anonFields {
- // if etypes contains this, then do not call rget again (as the fields are already seen here)
- ftid := reflect.ValueOf(af.ft).Pointer()
- for _, k := range pv.etypes {
- if k == ftid {
- continue LOOP2
- }
- }
- pv.etypes = append(pv.etypes, ftid)
-
- indexstack2 := make([]int, len(indexstack)+1)
- copy(indexstack2, indexstack)
- indexstack2[len(indexstack)] = af.idx
- // indexstack2 := append(append(make([]int, 0, len(indexstack)+4), indexstack...), j)
- x.rget(af.ft, ftid, indexstack2, pv, siInfo)
- }
-}
-
-func panicToErr(err *error) {
- if recoverPanicToErr {
- if x := recover(); x != nil {
- //debug.PrintStack()
- panicValToErr(x, err)
- }
- }
-}
-
-// func doPanic(tag string, format string, params ...interface{}) {
-// params2 := make([]interface{}, len(params)+1)
-// params2[0] = tag
-// copy(params2[1:], params)
-// panic(fmt.Errorf("%s: "+format, params2...))
-// }
-
-func isImmutableKind(k reflect.Kind) (v bool) {
- return false ||
- k == reflect.Int ||
- k == reflect.Int8 ||
- k == reflect.Int16 ||
- k == reflect.Int32 ||
- k == reflect.Int64 ||
- k == reflect.Uint ||
- k == reflect.Uint8 ||
- k == reflect.Uint16 ||
- k == reflect.Uint32 ||
- k == reflect.Uint64 ||
- k == reflect.Uintptr ||
- k == reflect.Float32 ||
- k == reflect.Float64 ||
- k == reflect.Bool ||
- k == reflect.String
-}
-
-// these functions must be inlinable, and not call anybody
-type checkOverflow struct{}
-
-func (_ checkOverflow) Float32(f float64) (overflow bool) {
- if f < 0 {
- f = -f
- }
- return math.MaxFloat32 < f && f <= math.MaxFloat64
-}
-
-func (_ checkOverflow) Uint(v uint64, bitsize uint8) (overflow bool) {
- if bitsize == 0 || bitsize >= 64 || v == 0 {
- return
- }
- if trunc := (v << (64 - bitsize)) >> (64 - bitsize); v != trunc {
- overflow = true
- }
- return
-}
-
-func (_ checkOverflow) Int(v int64, bitsize uint8) (overflow bool) {
- if bitsize == 0 || bitsize >= 64 || v == 0 {
- return
- }
- if trunc := (v << (64 - bitsize)) >> (64 - bitsize); v != trunc {
- overflow = true
- }
- return
-}
-
-func (_ checkOverflow) SignedInt(v uint64) (i int64, overflow bool) {
- //e.g. -127 to 128 for int8
- pos := (v >> 63) == 0
- ui2 := v & 0x7fffffffffffffff
- if pos {
- if ui2 > math.MaxInt64 {
- overflow = true
- return
- }
- } else {
- if ui2 > math.MaxInt64-1 {
- overflow = true
- return
- }
- }
- i = int64(v)
- return
-}
-
-// ------------------ SORT -----------------
-
-func isNaN(f float64) bool { return f != f }
-
-// -----------------------
-
-type intSlice []int64
-type uintSlice []uint64
-type floatSlice []float64
-type boolSlice []bool
-type stringSlice []string
-type bytesSlice [][]byte
-
-func (p intSlice) Len() int { return len(p) }
-func (p intSlice) Less(i, j int) bool { return p[i] < p[j] }
-func (p intSlice) Swap(i, j int) { p[i], p[j] = p[j], p[i] }
-
-func (p uintSlice) Len() int { return len(p) }
-func (p uintSlice) Less(i, j int) bool { return p[i] < p[j] }
-func (p uintSlice) Swap(i, j int) { p[i], p[j] = p[j], p[i] }
-
-func (p floatSlice) Len() int { return len(p) }
-func (p floatSlice) Less(i, j int) bool {
- return p[i] < p[j] || isNaN(p[i]) && !isNaN(p[j])
-}
-func (p floatSlice) Swap(i, j int) { p[i], p[j] = p[j], p[i] }
-
-func (p stringSlice) Len() int { return len(p) }
-func (p stringSlice) Less(i, j int) bool { return p[i] < p[j] }
-func (p stringSlice) Swap(i, j int) { p[i], p[j] = p[j], p[i] }
-
-func (p bytesSlice) Len() int { return len(p) }
-func (p bytesSlice) Less(i, j int) bool { return bytes.Compare(p[i], p[j]) == -1 }
-func (p bytesSlice) Swap(i, j int) { p[i], p[j] = p[j], p[i] }
-
-func (p boolSlice) Len() int { return len(p) }
-func (p boolSlice) Less(i, j int) bool { return !p[i] && p[j] }
-func (p boolSlice) Swap(i, j int) { p[i], p[j] = p[j], p[i] }
-
-// ---------------------
-
-type intRv struct {
- v int64
- r reflect.Value
-}
-type intRvSlice []intRv
-type uintRv struct {
- v uint64
- r reflect.Value
-}
-type uintRvSlice []uintRv
-type floatRv struct {
- v float64
- r reflect.Value
-}
-type floatRvSlice []floatRv
-type boolRv struct {
- v bool
- r reflect.Value
-}
-type boolRvSlice []boolRv
-type stringRv struct {
- v string
- r reflect.Value
-}
-type stringRvSlice []stringRv
-type bytesRv struct {
- v []byte
- r reflect.Value
-}
-type bytesRvSlice []bytesRv
-
-func (p intRvSlice) Len() int { return len(p) }
-func (p intRvSlice) Less(i, j int) bool { return p[i].v < p[j].v }
-func (p intRvSlice) Swap(i, j int) { p[i], p[j] = p[j], p[i] }
-
-func (p uintRvSlice) Len() int { return len(p) }
-func (p uintRvSlice) Less(i, j int) bool { return p[i].v < p[j].v }
-func (p uintRvSlice) Swap(i, j int) { p[i], p[j] = p[j], p[i] }
-
-func (p floatRvSlice) Len() int { return len(p) }
-func (p floatRvSlice) Less(i, j int) bool {
- return p[i].v < p[j].v || isNaN(p[i].v) && !isNaN(p[j].v)
-}
-func (p floatRvSlice) Swap(i, j int) { p[i], p[j] = p[j], p[i] }
-
-func (p stringRvSlice) Len() int { return len(p) }
-func (p stringRvSlice) Less(i, j int) bool { return p[i].v < p[j].v }
-func (p stringRvSlice) Swap(i, j int) { p[i], p[j] = p[j], p[i] }
-
-func (p bytesRvSlice) Len() int { return len(p) }
-func (p bytesRvSlice) Less(i, j int) bool { return bytes.Compare(p[i].v, p[j].v) == -1 }
-func (p bytesRvSlice) Swap(i, j int) { p[i], p[j] = p[j], p[i] }
-
-func (p boolRvSlice) Len() int { return len(p) }
-func (p boolRvSlice) Less(i, j int) bool { return !p[i].v && p[j].v }
-func (p boolRvSlice) Swap(i, j int) { p[i], p[j] = p[j], p[i] }
-
-// -----------------
-
-type bytesI struct {
- v []byte
- i interface{}
-}
-
-type bytesISlice []bytesI
-
-func (p bytesISlice) Len() int { return len(p) }
-func (p bytesISlice) Less(i, j int) bool { return bytes.Compare(p[i].v, p[j].v) == -1 }
-func (p bytesISlice) Swap(i, j int) { p[i], p[j] = p[j], p[i] }
-
-// -----------------
-
-type set []uintptr
-
-func (s *set) add(v uintptr) (exists bool) {
- // e.ci is always nil, or len >= 1
- // defer func() { fmt.Printf("$$$$$$$$$$$ cirRef Add: %v, exists: %v\n", v, exists) }()
- x := *s
- if x == nil {
- x = make([]uintptr, 1, 8)
- x[0] = v
- *s = x
- return
- }
- // typically, length will be 1. make this perform.
- if len(x) == 1 {
- if j := x[0]; j == 0 {
- x[0] = v
- } else if j == v {
- exists = true
- } else {
- x = append(x, v)
- *s = x
- }
- return
- }
- // check if it exists
- for _, j := range x {
- if j == v {
- exists = true
- return
- }
- }
- // try to replace a "deleted" slot
- for i, j := range x {
- if j == 0 {
- x[i] = v
- return
- }
- }
- // if unable to replace deleted slot, just append it.
- x = append(x, v)
- *s = x
- return
-}
-
-func (s *set) remove(v uintptr) (exists bool) {
- // defer func() { fmt.Printf("$$$$$$$$$$$ cirRef Rm: %v, exists: %v\n", v, exists) }()
- x := *s
- if len(x) == 0 {
- return
- }
- if len(x) == 1 {
- if x[0] == v {
- x[0] = 0
- }
- return
- }
- for i, j := range x {
- if j == v {
- exists = true
- x[i] = 0 // set it to 0, as way to delete it.
- // copy(x[i:], x[i+1:])
- // x = x[:len(x)-1]
- return
- }
- }
- return
-}
diff --git a/vendor/github.com/ugorji/go/codec/helper_internal.go b/vendor/github.com/ugorji/go/codec/helper_internal.go
deleted file mode 100644
index dea981fb..00000000
--- a/vendor/github.com/ugorji/go/codec/helper_internal.go
+++ /dev/null
@@ -1,242 +0,0 @@
-// Copyright (c) 2012-2015 Ugorji Nwoke. All rights reserved.
-// Use of this source code is governed by a MIT license found in the LICENSE file.
-
-package codec
-
-// All non-std package dependencies live in this file,
-// so porting to different environment is easy (just update functions).
-
-import (
- "errors"
- "fmt"
- "math"
- "reflect"
-)
-
-func panicValToErr(panicVal interface{}, err *error) {
- if panicVal == nil {
- return
- }
- // case nil
- switch xerr := panicVal.(type) {
- case error:
- *err = xerr
- case string:
- *err = errors.New(xerr)
- default:
- *err = fmt.Errorf("%v", panicVal)
- }
- return
-}
-
-func hIsEmptyValue(v reflect.Value, deref, checkStruct bool) bool {
- switch v.Kind() {
- case reflect.Invalid:
- return true
- case reflect.Array, reflect.Map, reflect.Slice, reflect.String:
- return v.Len() == 0
- case reflect.Bool:
- return !v.Bool()
- case reflect.Int, reflect.Int8, reflect.Int16, reflect.Int32, reflect.Int64:
- return v.Int() == 0
- case reflect.Uint, reflect.Uint8, reflect.Uint16, reflect.Uint32, reflect.Uint64, reflect.Uintptr:
- return v.Uint() == 0
- case reflect.Float32, reflect.Float64:
- return v.Float() == 0
- case reflect.Interface, reflect.Ptr:
- if deref {
- if v.IsNil() {
- return true
- }
- return hIsEmptyValue(v.Elem(), deref, checkStruct)
- } else {
- return v.IsNil()
- }
- case reflect.Struct:
- if !checkStruct {
- return false
- }
- // return true if all fields are empty. else return false.
- // we cannot use equality check, because some fields may be maps/slices/etc
- // and consequently the structs are not comparable.
- // return v.Interface() == reflect.Zero(v.Type()).Interface()
- for i, n := 0, v.NumField(); i < n; i++ {
- if !hIsEmptyValue(v.Field(i), deref, checkStruct) {
- return false
- }
- }
- return true
- }
- return false
-}
-
-func isEmptyValue(v reflect.Value) bool {
- return hIsEmptyValue(v, derefForIsEmptyValue, checkStructForEmptyValue)
-}
-
-func pruneSignExt(v []byte, pos bool) (n int) {
- if len(v) < 2 {
- } else if pos && v[0] == 0 {
- for ; v[n] == 0 && n+1 < len(v) && (v[n+1]&(1<<7) == 0); n++ {
- }
- } else if !pos && v[0] == 0xff {
- for ; v[n] == 0xff && n+1 < len(v) && (v[n+1]&(1<<7) != 0); n++ {
- }
- }
- return
-}
-
-func implementsIntf(typ, iTyp reflect.Type) (success bool, indir int8) {
- if typ == nil {
- return
- }
- rt := typ
- // The type might be a pointer and we need to keep
- // dereferencing to the base type until we find an implementation.
- for {
- if rt.Implements(iTyp) {
- return true, indir
- }
- if p := rt; p.Kind() == reflect.Ptr {
- indir++
- if indir >= math.MaxInt8 { // insane number of indirections
- return false, 0
- }
- rt = p.Elem()
- continue
- }
- break
- }
- // No luck yet, but if this is a base type (non-pointer), the pointer might satisfy.
- if typ.Kind() != reflect.Ptr {
- // Not a pointer, but does the pointer work?
- if reflect.PtrTo(typ).Implements(iTyp) {
- return true, -1
- }
- }
- return false, 0
-}
-
-// validate that this function is correct ...
-// culled from OGRE (Object-Oriented Graphics Rendering Engine)
-// function: halfToFloatI (http://stderr.org/doc/ogre-doc/api/OgreBitwise_8h-source.html)
-func halfFloatToFloatBits(yy uint16) (d uint32) {
- y := uint32(yy)
- s := (y >> 15) & 0x01
- e := (y >> 10) & 0x1f
- m := y & 0x03ff
-
- if e == 0 {
- if m == 0 { // plu or minus 0
- return s << 31
- } else { // Denormalized number -- renormalize it
- for (m & 0x00000400) == 0 {
- m <<= 1
- e -= 1
- }
- e += 1
- const zz uint32 = 0x0400
- m &= ^zz
- }
- } else if e == 31 {
- if m == 0 { // Inf
- return (s << 31) | 0x7f800000
- } else { // NaN
- return (s << 31) | 0x7f800000 | (m << 13)
- }
- }
- e = e + (127 - 15)
- m = m << 13
- return (s << 31) | (e << 23) | m
-}
-
-// GrowCap will return a new capacity for a slice, given the following:
-// - oldCap: current capacity
-// - unit: in-memory size of an element
-// - num: number of elements to add
-func growCap(oldCap, unit, num int) (newCap int) {
- // appendslice logic (if cap < 1024, *2, else *1.25):
- // leads to many copy calls, especially when copying bytes.
- // bytes.Buffer model (2*cap + n): much better for bytes.
- // smarter way is to take the byte-size of the appended element(type) into account
-
- // maintain 3 thresholds:
- // t1: if cap <= t1, newcap = 2x
- // t2: if cap <= t2, newcap = 1.75x
- // t3: if cap <= t3, newcap = 1.5x
- // else newcap = 1.25x
- //
- // t1, t2, t3 >= 1024 always.
- // i.e. if unit size >= 16, then always do 2x or 1.25x (ie t1, t2, t3 are all same)
- //
- // With this, appending for bytes increase by:
- // 100% up to 4K
- // 75% up to 8K
- // 50% up to 16K
- // 25% beyond that
-
- // unit can be 0 e.g. for struct{}{}; handle that appropriately
- var t1, t2, t3 int // thresholds
- if unit <= 1 {
- t1, t2, t3 = 4*1024, 8*1024, 16*1024
- } else if unit < 16 {
- t3 = 16 / unit * 1024
- t1 = t3 * 1 / 4
- t2 = t3 * 2 / 4
- } else {
- t1, t2, t3 = 1024, 1024, 1024
- }
-
- var x int // temporary variable
-
- // x is multiplier here: one of 5, 6, 7 or 8; incr of 25%, 50%, 75% or 100% respectively
- if oldCap <= t1 { // [0,t1]
- x = 8
- } else if oldCap > t3 { // (t3,infinity]
- x = 5
- } else if oldCap <= t2 { // (t1,t2]
- x = 7
- } else { // (t2,t3]
- x = 6
- }
- newCap = x * oldCap / 4
-
- if num > 0 {
- newCap += num
- }
-
- // ensure newCap is a multiple of 64 (if it is > 64) or 16.
- if newCap > 64 {
- if x = newCap % 64; x != 0 {
- x = newCap / 64
- newCap = 64 * (x + 1)
- }
- } else {
- if x = newCap % 16; x != 0 {
- x = newCap / 16
- newCap = 16 * (x + 1)
- }
- }
- return
-}
-
-func expandSliceValue(s reflect.Value, num int) reflect.Value {
- if num <= 0 {
- return s
- }
- l0 := s.Len()
- l1 := l0 + num // new slice length
- if l1 < l0 {
- panic("ExpandSlice: slice overflow")
- }
- c0 := s.Cap()
- if l1 <= c0 {
- return s.Slice(0, l1)
- }
- st := s.Type()
- c1 := growCap(c0, int(st.Elem().Size()), num)
- s2 := reflect.MakeSlice(st, l1, c1)
- // println("expandslicevalue: cap-old: ", c0, ", cap-new: ", c1, ", len-new: ", l1)
- reflect.Copy(s2, s)
- return s2
-}
diff --git a/vendor/github.com/ugorji/go/codec/helper_not_unsafe.go b/vendor/github.com/ugorji/go/codec/helper_not_unsafe.go
deleted file mode 100644
index 7c2ffc0f..00000000
--- a/vendor/github.com/ugorji/go/codec/helper_not_unsafe.go
+++ /dev/null
@@ -1,20 +0,0 @@
-//+build !unsafe
-
-// Copyright (c) 2012-2015 Ugorji Nwoke. All rights reserved.
-// Use of this source code is governed by a MIT license found in the LICENSE file.
-
-package codec
-
-// stringView returns a view of the []byte as a string.
-// In unsafe mode, it doesn't incur allocation and copying caused by conversion.
-// In regular safe mode, it is an allocation and copy.
-func stringView(v []byte) string {
- return string(v)
-}
-
-// bytesView returns a view of the string as a []byte.
-// In unsafe mode, it doesn't incur allocation and copying caused by conversion.
-// In regular safe mode, it is an allocation and copy.
-func bytesView(v string) []byte {
- return []byte(v)
-}
diff --git a/vendor/github.com/ugorji/go/codec/helper_unsafe.go b/vendor/github.com/ugorji/go/codec/helper_unsafe.go
deleted file mode 100644
index 373b2b10..00000000
--- a/vendor/github.com/ugorji/go/codec/helper_unsafe.go
+++ /dev/null
@@ -1,45 +0,0 @@
-//+build unsafe
-
-// Copyright (c) 2012-2015 Ugorji Nwoke. All rights reserved.
-// Use of this source code is governed by a MIT license found in the LICENSE file.
-
-package codec
-
-import (
- "unsafe"
-)
-
-// This file has unsafe variants of some helper methods.
-
-type unsafeString struct {
- Data uintptr
- Len int
-}
-
-type unsafeBytes struct {
- Data uintptr
- Len int
- Cap int
-}
-
-// stringView returns a view of the []byte as a string.
-// In unsafe mode, it doesn't incur allocation and copying caused by conversion.
-// In regular safe mode, it is an allocation and copy.
-func stringView(v []byte) string {
- if len(v) == 0 {
- return ""
- }
- x := unsafeString{uintptr(unsafe.Pointer(&v[0])), len(v)}
- return *(*string)(unsafe.Pointer(&x))
-}
-
-// bytesView returns a view of the string as a []byte.
-// In unsafe mode, it doesn't incur allocation and copying caused by conversion.
-// In regular safe mode, it is an allocation and copy.
-func bytesView(v string) []byte {
- if len(v) == 0 {
- return zeroByteSlice
- }
- x := unsafeBytes{uintptr(unsafe.Pointer(&v)), len(v), len(v)}
- return *(*[]byte)(unsafe.Pointer(&x))
-}
diff --git a/vendor/github.com/ugorji/go/codec/json.go b/vendor/github.com/ugorji/go/codec/json.go
deleted file mode 100644
index a04dfcb9..00000000
--- a/vendor/github.com/ugorji/go/codec/json.go
+++ /dev/null
@@ -1,1213 +0,0 @@
-// Copyright (c) 2012-2015 Ugorji Nwoke. All rights reserved.
-// Use of this source code is governed by a MIT license found in the LICENSE file.
-
-package codec
-
-// By default, this json support uses base64 encoding for bytes, because you cannot
-// store and read any arbitrary string in json (only unicode).
-// However, the user can configre how to encode/decode bytes.
-//
-// This library specifically supports UTF-8 for encoding and decoding only.
-//
-// Note that the library will happily encode/decode things which are not valid
-// json e.g. a map[int64]string. We do it for consistency. With valid json,
-// we will encode and decode appropriately.
-// Users can specify their map type if necessary to force it.
-//
-// Note:
-// - we cannot use strconv.Quote and strconv.Unquote because json quotes/unquotes differently.
-// We implement it here.
-// - Also, strconv.ParseXXX for floats and integers
-// - only works on strings resulting in unnecessary allocation and []byte-string conversion.
-// - it does a lot of redundant checks, because json numbers are simpler that what it supports.
-// - We parse numbers (floats and integers) directly here.
-// We only delegate parsing floats if it is a hairy float which could cause a loss of precision.
-// In that case, we delegate to strconv.ParseFloat.
-//
-// Note:
-// - encode does not beautify. There is no whitespace when encoding.
-// - rpc calls which take single integer arguments or write single numeric arguments will need care.
-
-// Top-level methods of json(End|Dec)Driver (which are implementations of (en|de)cDriver
-// MUST not call one-another.
-
-import (
- "bytes"
- "encoding/base64"
- "fmt"
- "reflect"
- "strconv"
- "unicode/utf16"
- "unicode/utf8"
-)
-
-//--------------------------------
-
-var (
- jsonLiterals = [...]byte{'t', 'r', 'u', 'e', 'f', 'a', 'l', 's', 'e', 'n', 'u', 'l', 'l'}
-
- jsonFloat64Pow10 = [...]float64{
- 1e0, 1e1, 1e2, 1e3, 1e4, 1e5, 1e6, 1e7, 1e8, 1e9,
- 1e10, 1e11, 1e12, 1e13, 1e14, 1e15, 1e16, 1e17, 1e18, 1e19,
- 1e20, 1e21, 1e22,
- }
-
- jsonUint64Pow10 = [...]uint64{
- 1e0, 1e1, 1e2, 1e3, 1e4, 1e5, 1e6, 1e7, 1e8, 1e9,
- 1e10, 1e11, 1e12, 1e13, 1e14, 1e15, 1e16, 1e17, 1e18, 1e19,
- }
-
- // jsonTabs and jsonSpaces are used as caches for indents
- jsonTabs, jsonSpaces string
-)
-
-const (
- // jsonUnreadAfterDecNum controls whether we unread after decoding a number.
- //
- // instead of unreading, just update d.tok (iff it's not a whitespace char)
- // However, doing this means that we may HOLD onto some data which belongs to another stream.
- // Thus, it is safest to unread the data when done.
- // keep behind a constant flag for now.
- jsonUnreadAfterDecNum = true
-
- // If !jsonValidateSymbols, decoding will be faster, by skipping some checks:
- // - If we see first character of null, false or true,
- // do not validate subsequent characters.
- // - e.g. if we see a n, assume null and skip next 3 characters,
- // and do not validate they are ull.
- // P.S. Do not expect a significant decoding boost from this.
- jsonValidateSymbols = true
-
- // if jsonTruncateMantissa, truncate mantissa if trailing 0's.
- // This is important because it could allow some floats to be decoded without
- // deferring to strconv.ParseFloat.
- jsonTruncateMantissa = true
-
- // if mantissa >= jsonNumUintCutoff before multiplying by 10, this is an overflow
- jsonNumUintCutoff = (1<<64-1)/uint64(10) + 1 // cutoff64(base)
-
- // if mantissa >= jsonNumUintMaxVal, this is an overflow
- jsonNumUintMaxVal = 1< 1<<53 || v < -(1<<53)) {
- e.w.writen1('"')
- e.w.writeb(strconv.AppendInt(e.b[:0], v, 10))
- e.w.writen1('"')
- return
- }
- e.w.writeb(strconv.AppendInt(e.b[:0], v, 10))
-}
-
-func (e *jsonEncDriver) EncodeUint(v uint64) {
- if x := e.h.IntegerAsString; x == 'A' || x == 'L' && v > 1<<53 {
- e.w.writen1('"')
- e.w.writeb(strconv.AppendUint(e.b[:0], v, 10))
- e.w.writen1('"')
- return
- }
- e.w.writeb(strconv.AppendUint(e.b[:0], v, 10))
-}
-
-func (e *jsonEncDriver) EncodeExt(rv interface{}, xtag uint64, ext Ext, en *Encoder) {
- if v := ext.ConvertExt(rv); v == nil {
- e.w.writeb(jsonLiterals[9:13]) // null // e.EncodeNil()
- } else {
- en.encode(v)
- }
-}
-
-func (e *jsonEncDriver) EncodeRawExt(re *RawExt, en *Encoder) {
- // only encodes re.Value (never re.Data)
- if re.Value == nil {
- e.w.writeb(jsonLiterals[9:13]) // null // e.EncodeNil()
- } else {
- en.encode(re.Value)
- }
-}
-
-func (e *jsonEncDriver) EncodeArrayStart(length int) {
- if e.d {
- e.dl++
- }
- e.w.writen1('[')
- e.c = containerArrayStart
-}
-
-func (e *jsonEncDriver) EncodeMapStart(length int) {
- if e.d {
- e.dl++
- }
- e.w.writen1('{')
- e.c = containerMapStart
-}
-
-func (e *jsonEncDriver) EncodeString(c charEncoding, v string) {
- // e.w.writestr(strconv.Quote(v))
- e.quoteStr(v)
-}
-
-func (e *jsonEncDriver) EncodeSymbol(v string) {
- // e.EncodeString(c_UTF8, v)
- e.quoteStr(v)
-}
-
-func (e *jsonEncDriver) EncodeStringBytes(c charEncoding, v []byte) {
- // if encoding raw bytes and RawBytesExt is configured, use it to encode
- if c == c_RAW && e.se.i != nil {
- e.EncodeExt(v, 0, &e.se, e.e)
- return
- }
- if c == c_RAW {
- slen := base64.StdEncoding.EncodedLen(len(v))
- if cap(e.bs) >= slen {
- e.bs = e.bs[:slen]
- } else {
- e.bs = make([]byte, slen)
- }
- base64.StdEncoding.Encode(e.bs, v)
- e.w.writen1('"')
- e.w.writeb(e.bs)
- e.w.writen1('"')
- } else {
- // e.EncodeString(c, string(v))
- e.quoteStr(stringView(v))
- }
-}
-
-func (e *jsonEncDriver) EncodeAsis(v []byte) {
- e.w.writeb(v)
-}
-
-func (e *jsonEncDriver) quoteStr(s string) {
- // adapted from std pkg encoding/json
- const hex = "0123456789abcdef"
- w := e.w
- w.writen1('"')
- start := 0
- for i := 0; i < len(s); {
- if b := s[i]; b < utf8.RuneSelf {
- if 0x20 <= b && b != '\\' && b != '"' && b != '<' && b != '>' && b != '&' {
- i++
- continue
- }
- if start < i {
- w.writestr(s[start:i])
- }
- switch b {
- case '\\', '"':
- w.writen2('\\', b)
- case '\n':
- w.writen2('\\', 'n')
- case '\r':
- w.writen2('\\', 'r')
- case '\b':
- w.writen2('\\', 'b')
- case '\f':
- w.writen2('\\', 'f')
- case '\t':
- w.writen2('\\', 't')
- default:
- // encode all bytes < 0x20 (except \r, \n).
- // also encode < > & to prevent security holes when served to some browsers.
- w.writestr(`\u00`)
- w.writen2(hex[b>>4], hex[b&0xF])
- }
- i++
- start = i
- continue
- }
- c, size := utf8.DecodeRuneInString(s[i:])
- if c == utf8.RuneError && size == 1 {
- if start < i {
- w.writestr(s[start:i])
- }
- w.writestr(`\ufffd`)
- i += size
- start = i
- continue
- }
- // U+2028 is LINE SEPARATOR. U+2029 is PARAGRAPH SEPARATOR.
- // Both technically valid JSON, but bomb on JSONP, so fix here.
- if c == '\u2028' || c == '\u2029' {
- if start < i {
- w.writestr(s[start:i])
- }
- w.writestr(`\u202`)
- w.writen1(hex[c&0xF])
- i += size
- start = i
- continue
- }
- i += size
- }
- if start < len(s) {
- w.writestr(s[start:])
- }
- w.writen1('"')
-}
-
-//--------------------------------
-
-type jsonNum struct {
- // bytes []byte // may have [+-.eE0-9]
- mantissa uint64 // where mantissa ends, and maybe dot begins.
- exponent int16 // exponent value.
- manOverflow bool
- neg bool // started with -. No initial sign in the bytes above.
- dot bool // has dot
- explicitExponent bool // explicit exponent
-}
-
-func (x *jsonNum) reset() {
- x.manOverflow = false
- x.neg = false
- x.dot = false
- x.explicitExponent = false
- x.mantissa = 0
- x.exponent = 0
-}
-
-// uintExp is called only if exponent > 0.
-func (x *jsonNum) uintExp() (n uint64, overflow bool) {
- n = x.mantissa
- e := x.exponent
- if e >= int16(len(jsonUint64Pow10)) {
- overflow = true
- return
- }
- n *= jsonUint64Pow10[e]
- if n < x.mantissa || n > jsonNumUintMaxVal {
- overflow = true
- return
- }
- return
- // for i := int16(0); i < e; i++ {
- // if n >= jsonNumUintCutoff {
- // overflow = true
- // return
- // }
- // n *= 10
- // }
- // return
-}
-
-// these constants are only used withn floatVal.
-// They are brought out, so that floatVal can be inlined.
-const (
- jsonUint64MantissaBits = 52
- jsonMaxExponent = int16(len(jsonFloat64Pow10)) - 1
-)
-
-func (x *jsonNum) floatVal() (f float64, parseUsingStrConv bool) {
- // We do not want to lose precision.
- // Consequently, we will delegate to strconv.ParseFloat if any of the following happen:
- // - There are more digits than in math.MaxUint64: 18446744073709551615 (20 digits)
- // We expect up to 99.... (19 digits)
- // - The mantissa cannot fit into a 52 bits of uint64
- // - The exponent is beyond our scope ie beyong 22.
- parseUsingStrConv = x.manOverflow ||
- x.exponent > jsonMaxExponent ||
- (x.exponent < 0 && -(x.exponent) > jsonMaxExponent) ||
- x.mantissa>>jsonUint64MantissaBits != 0
-
- if parseUsingStrConv {
- return
- }
-
- // all good. so handle parse here.
- f = float64(x.mantissa)
- // fmt.Printf(".Float: uint64 value: %v, float: %v\n", m, f)
- if x.neg {
- f = -f
- }
- if x.exponent > 0 {
- f *= jsonFloat64Pow10[x.exponent]
- } else if x.exponent < 0 {
- f /= jsonFloat64Pow10[-x.exponent]
- }
- return
-}
-
-type jsonDecDriver struct {
- noBuiltInTypes
- d *Decoder
- h *JsonHandle
- r decReader
-
- c containerState
- // tok is used to store the token read right after skipWhiteSpace.
- tok uint8
-
- bstr [8]byte // scratch used for string \UXXX parsing
- b [64]byte // scratch, used for parsing strings or numbers
- b2 [64]byte // scratch, used only for decodeBytes (after base64)
- bs []byte // scratch. Initialized from b. Used for parsing strings or numbers.
-
- se setExtWrapper
-
- n jsonNum
-}
-
-func jsonIsWS(b byte) bool {
- return b == ' ' || b == '\t' || b == '\r' || b == '\n'
-}
-
-// // This will skip whitespace characters and return the next byte to read.
-// // The next byte determines what the value will be one of.
-// func (d *jsonDecDriver) skipWhitespace() {
-// // fast-path: do not enter loop. Just check first (in case no whitespace).
-// b := d.r.readn1()
-// if jsonIsWS(b) {
-// r := d.r
-// for b = r.readn1(); jsonIsWS(b); b = r.readn1() {
-// }
-// }
-// d.tok = b
-// }
-
-func (d *jsonDecDriver) uncacheRead() {
- if d.tok != 0 {
- d.r.unreadn1()
- d.tok = 0
- }
-}
-
-func (d *jsonDecDriver) sendContainerState(c containerState) {
- if d.tok == 0 {
- var b byte
- r := d.r
- for b = r.readn1(); jsonIsWS(b); b = r.readn1() {
- }
- d.tok = b
- }
- var xc uint8 // char expected
- if c == containerMapKey {
- if d.c != containerMapStart {
- xc = ','
- }
- } else if c == containerMapValue {
- xc = ':'
- } else if c == containerMapEnd {
- xc = '}'
- } else if c == containerArrayElem {
- if d.c != containerArrayStart {
- xc = ','
- }
- } else if c == containerArrayEnd {
- xc = ']'
- }
- if xc != 0 {
- if d.tok != xc {
- d.d.errorf("json: expect char '%c' but got char '%c'", xc, d.tok)
- }
- d.tok = 0
- }
- d.c = c
-}
-
-func (d *jsonDecDriver) CheckBreak() bool {
- if d.tok == 0 {
- var b byte
- r := d.r
- for b = r.readn1(); jsonIsWS(b); b = r.readn1() {
- }
- d.tok = b
- }
- if d.tok == '}' || d.tok == ']' {
- // d.tok = 0 // only checking, not consuming
- return true
- }
- return false
-}
-
-func (d *jsonDecDriver) readStrIdx(fromIdx, toIdx uint8) {
- bs := d.r.readx(int(toIdx - fromIdx))
- d.tok = 0
- if jsonValidateSymbols {
- if !bytes.Equal(bs, jsonLiterals[fromIdx:toIdx]) {
- d.d.errorf("json: expecting %s: got %s", jsonLiterals[fromIdx:toIdx], bs)
- return
- }
- }
-}
-
-func (d *jsonDecDriver) TryDecodeAsNil() bool {
- if d.tok == 0 {
- var b byte
- r := d.r
- for b = r.readn1(); jsonIsWS(b); b = r.readn1() {
- }
- d.tok = b
- }
- if d.tok == 'n' {
- d.readStrIdx(10, 13) // ull
- return true
- }
- return false
-}
-
-func (d *jsonDecDriver) DecodeBool() bool {
- if d.tok == 0 {
- var b byte
- r := d.r
- for b = r.readn1(); jsonIsWS(b); b = r.readn1() {
- }
- d.tok = b
- }
- if d.tok == 'f' {
- d.readStrIdx(5, 9) // alse
- return false
- }
- if d.tok == 't' {
- d.readStrIdx(1, 4) // rue
- return true
- }
- d.d.errorf("json: decode bool: got first char %c", d.tok)
- return false // "unreachable"
-}
-
-func (d *jsonDecDriver) ReadMapStart() int {
- if d.tok == 0 {
- var b byte
- r := d.r
- for b = r.readn1(); jsonIsWS(b); b = r.readn1() {
- }
- d.tok = b
- }
- if d.tok != '{' {
- d.d.errorf("json: expect char '%c' but got char '%c'", '{', d.tok)
- }
- d.tok = 0
- d.c = containerMapStart
- return -1
-}
-
-func (d *jsonDecDriver) ReadArrayStart() int {
- if d.tok == 0 {
- var b byte
- r := d.r
- for b = r.readn1(); jsonIsWS(b); b = r.readn1() {
- }
- d.tok = b
- }
- if d.tok != '[' {
- d.d.errorf("json: expect char '%c' but got char '%c'", '[', d.tok)
- }
- d.tok = 0
- d.c = containerArrayStart
- return -1
-}
-
-func (d *jsonDecDriver) ContainerType() (vt valueType) {
- // check container type by checking the first char
- if d.tok == 0 {
- var b byte
- r := d.r
- for b = r.readn1(); jsonIsWS(b); b = r.readn1() {
- }
- d.tok = b
- }
- if b := d.tok; b == '{' {
- return valueTypeMap
- } else if b == '[' {
- return valueTypeArray
- } else if b == 'n' {
- return valueTypeNil
- } else if b == '"' {
- return valueTypeString
- }
- return valueTypeUnset
- // d.d.errorf("isContainerType: unsupported parameter: %v", vt)
- // return false // "unreachable"
-}
-
-func (d *jsonDecDriver) decNum(storeBytes bool) {
- // If it is has a . or an e|E, decode as a float; else decode as an int.
- if d.tok == 0 {
- var b byte
- r := d.r
- for b = r.readn1(); jsonIsWS(b); b = r.readn1() {
- }
- d.tok = b
- }
- b := d.tok
- var str bool
- if b == '"' {
- str = true
- b = d.r.readn1()
- }
- if !(b == '+' || b == '-' || b == '.' || (b >= '0' && b <= '9')) {
- d.d.errorf("json: decNum: got first char '%c'", b)
- return
- }
- d.tok = 0
-
- const cutoff = (1<<64-1)/uint64(10) + 1 // cutoff64(base)
- const jsonNumUintMaxVal = 1<= jsonNumUintCutoff {
- n.manOverflow = true
- break
- }
- v := uint64(b - '0')
- n.mantissa *= 10
- if v != 0 {
- n1 := n.mantissa + v
- if n1 < n.mantissa || n1 > jsonNumUintMaxVal {
- n.manOverflow = true // n+v overflows
- break
- }
- n.mantissa = n1
- }
- case 6:
- state = 7
- fallthrough
- case 7:
- if !(b == '0' && e == 0) {
- e = e*10 + int16(b-'0')
- }
- default:
- break LOOP
- }
- case '"':
- if str {
- if storeBytes {
- d.bs = append(d.bs, '"')
- }
- b, eof = r.readn1eof()
- }
- break LOOP
- default:
- break LOOP
- }
- if storeBytes {
- d.bs = append(d.bs, b)
- }
- b, eof = r.readn1eof()
- }
-
- if jsonTruncateMantissa && n.mantissa != 0 {
- for n.mantissa%10 == 0 {
- n.mantissa /= 10
- n.exponent++
- }
- }
-
- if e != 0 {
- if eNeg {
- n.exponent -= e
- } else {
- n.exponent += e
- }
- }
-
- // d.n = n
-
- if !eof {
- if jsonUnreadAfterDecNum {
- r.unreadn1()
- } else {
- if !jsonIsWS(b) {
- d.tok = b
- }
- }
- }
- // fmt.Printf("1: n: bytes: %s, neg: %v, dot: %v, exponent: %v, mantissaEndIndex: %v\n",
- // n.bytes, n.neg, n.dot, n.exponent, n.mantissaEndIndex)
- return
-}
-
-func (d *jsonDecDriver) DecodeInt(bitsize uint8) (i int64) {
- d.decNum(false)
- n := &d.n
- if n.manOverflow {
- d.d.errorf("json: overflow integer after: %v", n.mantissa)
- return
- }
- var u uint64
- if n.exponent == 0 {
- u = n.mantissa
- } else if n.exponent < 0 {
- d.d.errorf("json: fractional integer")
- return
- } else if n.exponent > 0 {
- var overflow bool
- if u, overflow = n.uintExp(); overflow {
- d.d.errorf("json: overflow integer")
- return
- }
- }
- i = int64(u)
- if n.neg {
- i = -i
- }
- if chkOvf.Int(i, bitsize) {
- d.d.errorf("json: overflow %v bits: %s", bitsize, d.bs)
- return
- }
- // fmt.Printf("DecodeInt: %v\n", i)
- return
-}
-
-// floatVal MUST only be called after a decNum, as d.bs now contains the bytes of the number
-func (d *jsonDecDriver) floatVal() (f float64) {
- f, useStrConv := d.n.floatVal()
- if useStrConv {
- var err error
- if f, err = strconv.ParseFloat(stringView(d.bs), 64); err != nil {
- panic(fmt.Errorf("parse float: %s, %v", d.bs, err))
- }
- if d.n.neg {
- f = -f
- }
- }
- return
-}
-
-func (d *jsonDecDriver) DecodeUint(bitsize uint8) (u uint64) {
- d.decNum(false)
- n := &d.n
- if n.neg {
- d.d.errorf("json: unsigned integer cannot be negative")
- return
- }
- if n.manOverflow {
- d.d.errorf("json: overflow integer after: %v", n.mantissa)
- return
- }
- if n.exponent == 0 {
- u = n.mantissa
- } else if n.exponent < 0 {
- d.d.errorf("json: fractional integer")
- return
- } else if n.exponent > 0 {
- var overflow bool
- if u, overflow = n.uintExp(); overflow {
- d.d.errorf("json: overflow integer")
- return
- }
- }
- if chkOvf.Uint(u, bitsize) {
- d.d.errorf("json: overflow %v bits: %s", bitsize, d.bs)
- return
- }
- // fmt.Printf("DecodeUint: %v\n", u)
- return
-}
-
-func (d *jsonDecDriver) DecodeFloat(chkOverflow32 bool) (f float64) {
- d.decNum(true)
- f = d.floatVal()
- if chkOverflow32 && chkOvf.Float32(f) {
- d.d.errorf("json: overflow float32: %v, %s", f, d.bs)
- return
- }
- return
-}
-
-func (d *jsonDecDriver) DecodeExt(rv interface{}, xtag uint64, ext Ext) (realxtag uint64) {
- if ext == nil {
- re := rv.(*RawExt)
- re.Tag = xtag
- d.d.decode(&re.Value)
- } else {
- var v interface{}
- d.d.decode(&v)
- ext.UpdateExt(rv, v)
- }
- return
-}
-
-func (d *jsonDecDriver) DecodeBytes(bs []byte, isstring, zerocopy bool) (bsOut []byte) {
- // if decoding into raw bytes, and the RawBytesExt is configured, use it to decode.
- if !isstring && d.se.i != nil {
- bsOut = bs
- d.DecodeExt(&bsOut, 0, &d.se)
- return
- }
- d.appendStringAsBytes()
- // if isstring, then just return the bytes, even if it is using the scratch buffer.
- // the bytes will be converted to a string as needed.
- if isstring {
- return d.bs
- }
- bs0 := d.bs
- slen := base64.StdEncoding.DecodedLen(len(bs0))
- if slen <= cap(bs) {
- bsOut = bs[:slen]
- } else if zerocopy && slen <= cap(d.b2) {
- bsOut = d.b2[:slen]
- } else {
- bsOut = make([]byte, slen)
- }
- slen2, err := base64.StdEncoding.Decode(bsOut, bs0)
- if err != nil {
- d.d.errorf("json: error decoding base64 binary '%s': %v", bs0, err)
- return nil
- }
- if slen != slen2 {
- bsOut = bsOut[:slen2]
- }
- return
-}
-
-func (d *jsonDecDriver) DecodeString() (s string) {
- d.appendStringAsBytes()
- // if x := d.s.sc; x != nil && x.so && x.st == '}' { // map key
- if d.c == containerMapKey {
- return d.d.string(d.bs)
- }
- return string(d.bs)
-}
-
-func (d *jsonDecDriver) appendStringAsBytes() {
- if d.tok == 0 {
- var b byte
- r := d.r
- for b = r.readn1(); jsonIsWS(b); b = r.readn1() {
- }
- d.tok = b
- }
- if d.tok != '"' {
- d.d.errorf("json: expect char '%c' but got char '%c'", '"', d.tok)
- }
- d.tok = 0
-
- v := d.bs[:0]
- var c uint8
- r := d.r
- for {
- c = r.readn1()
- if c == '"' {
- break
- } else if c == '\\' {
- c = r.readn1()
- switch c {
- case '"', '\\', '/', '\'':
- v = append(v, c)
- case 'b':
- v = append(v, '\b')
- case 'f':
- v = append(v, '\f')
- case 'n':
- v = append(v, '\n')
- case 'r':
- v = append(v, '\r')
- case 't':
- v = append(v, '\t')
- case 'u':
- rr := d.jsonU4(false)
- // fmt.Printf("$$$$$$$$$: is surrogate: %v\n", utf16.IsSurrogate(rr))
- if utf16.IsSurrogate(rr) {
- rr = utf16.DecodeRune(rr, d.jsonU4(true))
- }
- w2 := utf8.EncodeRune(d.bstr[:], rr)
- v = append(v, d.bstr[:w2]...)
- default:
- d.d.errorf("json: unsupported escaped value: %c", c)
- }
- } else {
- v = append(v, c)
- }
- }
- d.bs = v
-}
-
-func (d *jsonDecDriver) jsonU4(checkSlashU bool) rune {
- r := d.r
- if checkSlashU && !(r.readn1() == '\\' && r.readn1() == 'u') {
- d.d.errorf(`json: unquoteStr: invalid unicode sequence. Expecting \u`)
- return 0
- }
- // u, _ := strconv.ParseUint(string(d.bstr[:4]), 16, 64)
- var u uint32
- for i := 0; i < 4; i++ {
- v := r.readn1()
- if '0' <= v && v <= '9' {
- v = v - '0'
- } else if 'a' <= v && v <= 'z' {
- v = v - 'a' + 10
- } else if 'A' <= v && v <= 'Z' {
- v = v - 'A' + 10
- } else {
- d.d.errorf(`json: unquoteStr: invalid hex char in \u unicode sequence: %q`, v)
- return 0
- }
- u = u*16 + uint32(v)
- }
- return rune(u)
-}
-
-func (d *jsonDecDriver) DecodeNaked() {
- z := &d.d.n
- // var decodeFurther bool
-
- if d.tok == 0 {
- var b byte
- r := d.r
- for b = r.readn1(); jsonIsWS(b); b = r.readn1() {
- }
- d.tok = b
- }
- switch d.tok {
- case 'n':
- d.readStrIdx(10, 13) // ull
- z.v = valueTypeNil
- case 'f':
- d.readStrIdx(5, 9) // alse
- z.v = valueTypeBool
- z.b = false
- case 't':
- d.readStrIdx(1, 4) // rue
- z.v = valueTypeBool
- z.b = true
- case '{':
- z.v = valueTypeMap
- // d.tok = 0 // don't consume. kInterfaceNaked will call ReadMapStart
- // decodeFurther = true
- case '[':
- z.v = valueTypeArray
- // d.tok = 0 // don't consume. kInterfaceNaked will call ReadArrayStart
- // decodeFurther = true
- case '"':
- z.v = valueTypeString
- z.s = d.DecodeString()
- default: // number
- d.decNum(true)
- n := &d.n
- // if the string had a any of [.eE], then decode as float.
- switch {
- case n.explicitExponent, n.dot, n.exponent < 0, n.manOverflow:
- z.v = valueTypeFloat
- z.f = d.floatVal()
- case n.exponent == 0:
- u := n.mantissa
- switch {
- case n.neg:
- z.v = valueTypeInt
- z.i = -int64(u)
- case d.h.SignedInteger:
- z.v = valueTypeInt
- z.i = int64(u)
- default:
- z.v = valueTypeUint
- z.u = u
- }
- default:
- u, overflow := n.uintExp()
- switch {
- case overflow:
- z.v = valueTypeFloat
- z.f = d.floatVal()
- case n.neg:
- z.v = valueTypeInt
- z.i = -int64(u)
- case d.h.SignedInteger:
- z.v = valueTypeInt
- z.i = int64(u)
- default:
- z.v = valueTypeUint
- z.u = u
- }
- }
- // fmt.Printf("DecodeNaked: Number: %T, %v\n", v, v)
- }
- // if decodeFurther {
- // d.s.sc.retryRead()
- // }
- return
-}
-
-//----------------------
-
-// JsonHandle is a handle for JSON encoding format.
-//
-// Json is comprehensively supported:
-// - decodes numbers into interface{} as int, uint or float64
-// - configurable way to encode/decode []byte .
-// by default, encodes and decodes []byte using base64 Std Encoding
-// - UTF-8 support for encoding and decoding
-//
-// It has better performance than the json library in the standard library,
-// by leveraging the performance improvements of the codec library and
-// minimizing allocations.
-//
-// In addition, it doesn't read more bytes than necessary during a decode, which allows
-// reading multiple values from a stream containing json and non-json content.
-// For example, a user can read a json value, then a cbor value, then a msgpack value,
-// all from the same stream in sequence.
-type JsonHandle struct {
- textEncodingType
- BasicHandle
- // RawBytesExt, if configured, is used to encode and decode raw bytes in a custom way.
- // If not configured, raw bytes are encoded to/from base64 text.
- RawBytesExt InterfaceExt
-
- // Indent indicates how a value is encoded.
- // - If positive, indent by that number of spaces.
- // - If negative, indent by that number of tabs.
- Indent int8
-
- // IntegerAsString controls how integers (signed and unsigned) are encoded.
- //
- // Per the JSON Spec, JSON numbers are 64-bit floating point numbers.
- // Consequently, integers > 2^53 cannot be represented as a JSON number without losing precision.
- // This can be mitigated by configuring how to encode integers.
- //
- // IntegerAsString interpretes the following values:
- // - if 'L', then encode integers > 2^53 as a json string.
- // - if 'A', then encode all integers as a json string
- // containing the exact integer representation as a decimal.
- // - else encode all integers as a json number (default)
- IntegerAsString uint8
-}
-
-func (h *JsonHandle) SetInterfaceExt(rt reflect.Type, tag uint64, ext InterfaceExt) (err error) {
- return h.SetExt(rt, tag, &setExtWrapper{i: ext})
-}
-
-func (h *JsonHandle) newEncDriver(e *Encoder) encDriver {
- hd := jsonEncDriver{e: e, h: h}
- hd.bs = hd.b[:0]
-
- hd.reset()
-
- return &hd
-}
-
-func (h *JsonHandle) newDecDriver(d *Decoder) decDriver {
- // d := jsonDecDriver{r: r.(*bytesDecReader), h: h}
- hd := jsonDecDriver{d: d, h: h}
- hd.bs = hd.b[:0]
- hd.reset()
- return &hd
-}
-
-func (e *jsonEncDriver) reset() {
- e.w = e.e.w
- e.se.i = e.h.RawBytesExt
- if e.bs != nil {
- e.bs = e.bs[:0]
- }
- e.d, e.dt, e.dl, e.ds = false, false, 0, ""
- e.c = 0
- if e.h.Indent > 0 {
- e.d = true
- e.ds = jsonSpaces[:e.h.Indent]
- } else if e.h.Indent < 0 {
- e.d = true
- e.dt = true
- e.ds = jsonTabs[:-(e.h.Indent)]
- }
-}
-
-func (d *jsonDecDriver) reset() {
- d.r = d.d.r
- d.se.i = d.h.RawBytesExt
- if d.bs != nil {
- d.bs = d.bs[:0]
- }
- d.c, d.tok = 0, 0
- d.n.reset()
-}
-
-var jsonEncodeTerminate = []byte{' '}
-
-func (h *JsonHandle) rpcEncodeTerminate() []byte {
- return jsonEncodeTerminate
-}
-
-var _ decDriver = (*jsonDecDriver)(nil)
-var _ encDriver = (*jsonEncDriver)(nil)
diff --git a/vendor/github.com/ugorji/go/codec/msgpack.go b/vendor/github.com/ugorji/go/codec/msgpack.go
deleted file mode 100644
index f9f87236..00000000
--- a/vendor/github.com/ugorji/go/codec/msgpack.go
+++ /dev/null
@@ -1,845 +0,0 @@
-// Copyright (c) 2012-2015 Ugorji Nwoke. All rights reserved.
-// Use of this source code is governed by a MIT license found in the LICENSE file.
-
-/*
-MSGPACK
-
-Msgpack-c implementation powers the c, c++, python, ruby, etc libraries.
-We need to maintain compatibility with it and how it encodes integer values
-without caring about the type.
-
-For compatibility with behaviour of msgpack-c reference implementation:
- - Go intX (>0) and uintX
- IS ENCODED AS
- msgpack +ve fixnum, unsigned
- - Go intX (<0)
- IS ENCODED AS
- msgpack -ve fixnum, signed
-
-*/
-package codec
-
-import (
- "fmt"
- "io"
- "math"
- "net/rpc"
- "reflect"
-)
-
-const (
- mpPosFixNumMin byte = 0x00
- mpPosFixNumMax = 0x7f
- mpFixMapMin = 0x80
- mpFixMapMax = 0x8f
- mpFixArrayMin = 0x90
- mpFixArrayMax = 0x9f
- mpFixStrMin = 0xa0
- mpFixStrMax = 0xbf
- mpNil = 0xc0
- _ = 0xc1
- mpFalse = 0xc2
- mpTrue = 0xc3
- mpFloat = 0xca
- mpDouble = 0xcb
- mpUint8 = 0xcc
- mpUint16 = 0xcd
- mpUint32 = 0xce
- mpUint64 = 0xcf
- mpInt8 = 0xd0
- mpInt16 = 0xd1
- mpInt32 = 0xd2
- mpInt64 = 0xd3
-
- // extensions below
- mpBin8 = 0xc4
- mpBin16 = 0xc5
- mpBin32 = 0xc6
- mpExt8 = 0xc7
- mpExt16 = 0xc8
- mpExt32 = 0xc9
- mpFixExt1 = 0xd4
- mpFixExt2 = 0xd5
- mpFixExt4 = 0xd6
- mpFixExt8 = 0xd7
- mpFixExt16 = 0xd8
-
- mpStr8 = 0xd9 // new
- mpStr16 = 0xda
- mpStr32 = 0xdb
-
- mpArray16 = 0xdc
- mpArray32 = 0xdd
-
- mpMap16 = 0xde
- mpMap32 = 0xdf
-
- mpNegFixNumMin = 0xe0
- mpNegFixNumMax = 0xff
-)
-
-// MsgpackSpecRpcMultiArgs is a special type which signifies to the MsgpackSpecRpcCodec
-// that the backend RPC service takes multiple arguments, which have been arranged
-// in sequence in the slice.
-//
-// The Codec then passes it AS-IS to the rpc service (without wrapping it in an
-// array of 1 element).
-type MsgpackSpecRpcMultiArgs []interface{}
-
-// A MsgpackContainer type specifies the different types of msgpackContainers.
-type msgpackContainerType struct {
- fixCutoff int
- bFixMin, b8, b16, b32 byte
- hasFixMin, has8, has8Always bool
-}
-
-var (
- msgpackContainerStr = msgpackContainerType{32, mpFixStrMin, mpStr8, mpStr16, mpStr32, true, true, false}
- msgpackContainerBin = msgpackContainerType{0, 0, mpBin8, mpBin16, mpBin32, false, true, true}
- msgpackContainerList = msgpackContainerType{16, mpFixArrayMin, 0, mpArray16, mpArray32, true, false, false}
- msgpackContainerMap = msgpackContainerType{16, mpFixMapMin, 0, mpMap16, mpMap32, true, false, false}
-)
-
-//---------------------------------------------
-
-type msgpackEncDriver struct {
- noBuiltInTypes
- encNoSeparator
- e *Encoder
- w encWriter
- h *MsgpackHandle
- x [8]byte
-}
-
-func (e *msgpackEncDriver) EncodeNil() {
- e.w.writen1(mpNil)
-}
-
-func (e *msgpackEncDriver) EncodeInt(i int64) {
- if i >= 0 {
- e.EncodeUint(uint64(i))
- } else if i >= -32 {
- e.w.writen1(byte(i))
- } else if i >= math.MinInt8 {
- e.w.writen2(mpInt8, byte(i))
- } else if i >= math.MinInt16 {
- e.w.writen1(mpInt16)
- bigenHelper{e.x[:2], e.w}.writeUint16(uint16(i))
- } else if i >= math.MinInt32 {
- e.w.writen1(mpInt32)
- bigenHelper{e.x[:4], e.w}.writeUint32(uint32(i))
- } else {
- e.w.writen1(mpInt64)
- bigenHelper{e.x[:8], e.w}.writeUint64(uint64(i))
- }
-}
-
-func (e *msgpackEncDriver) EncodeUint(i uint64) {
- if i <= math.MaxInt8 {
- e.w.writen1(byte(i))
- } else if i <= math.MaxUint8 {
- e.w.writen2(mpUint8, byte(i))
- } else if i <= math.MaxUint16 {
- e.w.writen1(mpUint16)
- bigenHelper{e.x[:2], e.w}.writeUint16(uint16(i))
- } else if i <= math.MaxUint32 {
- e.w.writen1(mpUint32)
- bigenHelper{e.x[:4], e.w}.writeUint32(uint32(i))
- } else {
- e.w.writen1(mpUint64)
- bigenHelper{e.x[:8], e.w}.writeUint64(uint64(i))
- }
-}
-
-func (e *msgpackEncDriver) EncodeBool(b bool) {
- if b {
- e.w.writen1(mpTrue)
- } else {
- e.w.writen1(mpFalse)
- }
-}
-
-func (e *msgpackEncDriver) EncodeFloat32(f float32) {
- e.w.writen1(mpFloat)
- bigenHelper{e.x[:4], e.w}.writeUint32(math.Float32bits(f))
-}
-
-func (e *msgpackEncDriver) EncodeFloat64(f float64) {
- e.w.writen1(mpDouble)
- bigenHelper{e.x[:8], e.w}.writeUint64(math.Float64bits(f))
-}
-
-func (e *msgpackEncDriver) EncodeExt(v interface{}, xtag uint64, ext Ext, _ *Encoder) {
- bs := ext.WriteExt(v)
- if bs == nil {
- e.EncodeNil()
- return
- }
- if e.h.WriteExt {
- e.encodeExtPreamble(uint8(xtag), len(bs))
- e.w.writeb(bs)
- } else {
- e.EncodeStringBytes(c_RAW, bs)
- }
-}
-
-func (e *msgpackEncDriver) EncodeRawExt(re *RawExt, _ *Encoder) {
- e.encodeExtPreamble(uint8(re.Tag), len(re.Data))
- e.w.writeb(re.Data)
-}
-
-func (e *msgpackEncDriver) encodeExtPreamble(xtag byte, l int) {
- if l == 1 {
- e.w.writen2(mpFixExt1, xtag)
- } else if l == 2 {
- e.w.writen2(mpFixExt2, xtag)
- } else if l == 4 {
- e.w.writen2(mpFixExt4, xtag)
- } else if l == 8 {
- e.w.writen2(mpFixExt8, xtag)
- } else if l == 16 {
- e.w.writen2(mpFixExt16, xtag)
- } else if l < 256 {
- e.w.writen2(mpExt8, byte(l))
- e.w.writen1(xtag)
- } else if l < 65536 {
- e.w.writen1(mpExt16)
- bigenHelper{e.x[:2], e.w}.writeUint16(uint16(l))
- e.w.writen1(xtag)
- } else {
- e.w.writen1(mpExt32)
- bigenHelper{e.x[:4], e.w}.writeUint32(uint32(l))
- e.w.writen1(xtag)
- }
-}
-
-func (e *msgpackEncDriver) EncodeArrayStart(length int) {
- e.writeContainerLen(msgpackContainerList, length)
-}
-
-func (e *msgpackEncDriver) EncodeMapStart(length int) {
- e.writeContainerLen(msgpackContainerMap, length)
-}
-
-func (e *msgpackEncDriver) EncodeString(c charEncoding, s string) {
- if c == c_RAW && e.h.WriteExt {
- e.writeContainerLen(msgpackContainerBin, len(s))
- } else {
- e.writeContainerLen(msgpackContainerStr, len(s))
- }
- if len(s) > 0 {
- e.w.writestr(s)
- }
-}
-
-func (e *msgpackEncDriver) EncodeSymbol(v string) {
- e.EncodeString(c_UTF8, v)
-}
-
-func (e *msgpackEncDriver) EncodeStringBytes(c charEncoding, bs []byte) {
- if c == c_RAW && e.h.WriteExt {
- e.writeContainerLen(msgpackContainerBin, len(bs))
- } else {
- e.writeContainerLen(msgpackContainerStr, len(bs))
- }
- if len(bs) > 0 {
- e.w.writeb(bs)
- }
-}
-
-func (e *msgpackEncDriver) writeContainerLen(ct msgpackContainerType, l int) {
- if ct.hasFixMin && l < ct.fixCutoff {
- e.w.writen1(ct.bFixMin | byte(l))
- } else if ct.has8 && l < 256 && (ct.has8Always || e.h.WriteExt) {
- e.w.writen2(ct.b8, uint8(l))
- } else if l < 65536 {
- e.w.writen1(ct.b16)
- bigenHelper{e.x[:2], e.w}.writeUint16(uint16(l))
- } else {
- e.w.writen1(ct.b32)
- bigenHelper{e.x[:4], e.w}.writeUint32(uint32(l))
- }
-}
-
-//---------------------------------------------
-
-type msgpackDecDriver struct {
- d *Decoder
- r decReader // *Decoder decReader decReaderT
- h *MsgpackHandle
- b [scratchByteArrayLen]byte
- bd byte
- bdRead bool
- br bool // bytes reader
- noBuiltInTypes
- noStreamingCodec
- decNoSeparator
-}
-
-// Note: This returns either a primitive (int, bool, etc) for non-containers,
-// or a containerType, or a specific type denoting nil or extension.
-// It is called when a nil interface{} is passed, leaving it up to the DecDriver
-// to introspect the stream and decide how best to decode.
-// It deciphers the value by looking at the stream first.
-func (d *msgpackDecDriver) DecodeNaked() {
- if !d.bdRead {
- d.readNextBd()
- }
- bd := d.bd
- n := &d.d.n
- var decodeFurther bool
-
- switch bd {
- case mpNil:
- n.v = valueTypeNil
- d.bdRead = false
- case mpFalse:
- n.v = valueTypeBool
- n.b = false
- case mpTrue:
- n.v = valueTypeBool
- n.b = true
-
- case mpFloat:
- n.v = valueTypeFloat
- n.f = float64(math.Float32frombits(bigen.Uint32(d.r.readx(4))))
- case mpDouble:
- n.v = valueTypeFloat
- n.f = math.Float64frombits(bigen.Uint64(d.r.readx(8)))
-
- case mpUint8:
- n.v = valueTypeUint
- n.u = uint64(d.r.readn1())
- case mpUint16:
- n.v = valueTypeUint
- n.u = uint64(bigen.Uint16(d.r.readx(2)))
- case mpUint32:
- n.v = valueTypeUint
- n.u = uint64(bigen.Uint32(d.r.readx(4)))
- case mpUint64:
- n.v = valueTypeUint
- n.u = uint64(bigen.Uint64(d.r.readx(8)))
-
- case mpInt8:
- n.v = valueTypeInt
- n.i = int64(int8(d.r.readn1()))
- case mpInt16:
- n.v = valueTypeInt
- n.i = int64(int16(bigen.Uint16(d.r.readx(2))))
- case mpInt32:
- n.v = valueTypeInt
- n.i = int64(int32(bigen.Uint32(d.r.readx(4))))
- case mpInt64:
- n.v = valueTypeInt
- n.i = int64(int64(bigen.Uint64(d.r.readx(8))))
-
- default:
- switch {
- case bd >= mpPosFixNumMin && bd <= mpPosFixNumMax:
- // positive fixnum (always signed)
- n.v = valueTypeInt
- n.i = int64(int8(bd))
- case bd >= mpNegFixNumMin && bd <= mpNegFixNumMax:
- // negative fixnum
- n.v = valueTypeInt
- n.i = int64(int8(bd))
- case bd == mpStr8, bd == mpStr16, bd == mpStr32, bd >= mpFixStrMin && bd <= mpFixStrMax:
- if d.h.RawToString {
- n.v = valueTypeString
- n.s = d.DecodeString()
- } else {
- n.v = valueTypeBytes
- n.l = d.DecodeBytes(nil, false, false)
- }
- case bd == mpBin8, bd == mpBin16, bd == mpBin32:
- n.v = valueTypeBytes
- n.l = d.DecodeBytes(nil, false, false)
- case bd == mpArray16, bd == mpArray32, bd >= mpFixArrayMin && bd <= mpFixArrayMax:
- n.v = valueTypeArray
- decodeFurther = true
- case bd == mpMap16, bd == mpMap32, bd >= mpFixMapMin && bd <= mpFixMapMax:
- n.v = valueTypeMap
- decodeFurther = true
- case bd >= mpFixExt1 && bd <= mpFixExt16, bd >= mpExt8 && bd <= mpExt32:
- n.v = valueTypeExt
- clen := d.readExtLen()
- n.u = uint64(d.r.readn1())
- n.l = d.r.readx(clen)
- default:
- d.d.errorf("Nil-Deciphered DecodeValue: %s: hex: %x, dec: %d", msgBadDesc, bd, bd)
- }
- }
- if !decodeFurther {
- d.bdRead = false
- }
- if n.v == valueTypeUint && d.h.SignedInteger {
- n.v = valueTypeInt
- n.i = int64(n.u)
- }
- return
-}
-
-// int can be decoded from msgpack type: intXXX or uintXXX
-func (d *msgpackDecDriver) DecodeInt(bitsize uint8) (i int64) {
- if !d.bdRead {
- d.readNextBd()
- }
- switch d.bd {
- case mpUint8:
- i = int64(uint64(d.r.readn1()))
- case mpUint16:
- i = int64(uint64(bigen.Uint16(d.r.readx(2))))
- case mpUint32:
- i = int64(uint64(bigen.Uint32(d.r.readx(4))))
- case mpUint64:
- i = int64(bigen.Uint64(d.r.readx(8)))
- case mpInt8:
- i = int64(int8(d.r.readn1()))
- case mpInt16:
- i = int64(int16(bigen.Uint16(d.r.readx(2))))
- case mpInt32:
- i = int64(int32(bigen.Uint32(d.r.readx(4))))
- case mpInt64:
- i = int64(bigen.Uint64(d.r.readx(8)))
- default:
- switch {
- case d.bd >= mpPosFixNumMin && d.bd <= mpPosFixNumMax:
- i = int64(int8(d.bd))
- case d.bd >= mpNegFixNumMin && d.bd <= mpNegFixNumMax:
- i = int64(int8(d.bd))
- default:
- d.d.errorf("Unhandled single-byte unsigned integer value: %s: %x", msgBadDesc, d.bd)
- return
- }
- }
- // check overflow (logic adapted from std pkg reflect/value.go OverflowUint()
- if bitsize > 0 {
- if trunc := (i << (64 - bitsize)) >> (64 - bitsize); i != trunc {
- d.d.errorf("Overflow int value: %v", i)
- return
- }
- }
- d.bdRead = false
- return
-}
-
-// uint can be decoded from msgpack type: intXXX or uintXXX
-func (d *msgpackDecDriver) DecodeUint(bitsize uint8) (ui uint64) {
- if !d.bdRead {
- d.readNextBd()
- }
- switch d.bd {
- case mpUint8:
- ui = uint64(d.r.readn1())
- case mpUint16:
- ui = uint64(bigen.Uint16(d.r.readx(2)))
- case mpUint32:
- ui = uint64(bigen.Uint32(d.r.readx(4)))
- case mpUint64:
- ui = bigen.Uint64(d.r.readx(8))
- case mpInt8:
- if i := int64(int8(d.r.readn1())); i >= 0 {
- ui = uint64(i)
- } else {
- d.d.errorf("Assigning negative signed value: %v, to unsigned type", i)
- return
- }
- case mpInt16:
- if i := int64(int16(bigen.Uint16(d.r.readx(2)))); i >= 0 {
- ui = uint64(i)
- } else {
- d.d.errorf("Assigning negative signed value: %v, to unsigned type", i)
- return
- }
- case mpInt32:
- if i := int64(int32(bigen.Uint32(d.r.readx(4)))); i >= 0 {
- ui = uint64(i)
- } else {
- d.d.errorf("Assigning negative signed value: %v, to unsigned type", i)
- return
- }
- case mpInt64:
- if i := int64(bigen.Uint64(d.r.readx(8))); i >= 0 {
- ui = uint64(i)
- } else {
- d.d.errorf("Assigning negative signed value: %v, to unsigned type", i)
- return
- }
- default:
- switch {
- case d.bd >= mpPosFixNumMin && d.bd <= mpPosFixNumMax:
- ui = uint64(d.bd)
- case d.bd >= mpNegFixNumMin && d.bd <= mpNegFixNumMax:
- d.d.errorf("Assigning negative signed value: %v, to unsigned type", int(d.bd))
- return
- default:
- d.d.errorf("Unhandled single-byte unsigned integer value: %s: %x", msgBadDesc, d.bd)
- return
- }
- }
- // check overflow (logic adapted from std pkg reflect/value.go OverflowUint()
- if bitsize > 0 {
- if trunc := (ui << (64 - bitsize)) >> (64 - bitsize); ui != trunc {
- d.d.errorf("Overflow uint value: %v", ui)
- return
- }
- }
- d.bdRead = false
- return
-}
-
-// float can either be decoded from msgpack type: float, double or intX
-func (d *msgpackDecDriver) DecodeFloat(chkOverflow32 bool) (f float64) {
- if !d.bdRead {
- d.readNextBd()
- }
- if d.bd == mpFloat {
- f = float64(math.Float32frombits(bigen.Uint32(d.r.readx(4))))
- } else if d.bd == mpDouble {
- f = math.Float64frombits(bigen.Uint64(d.r.readx(8)))
- } else {
- f = float64(d.DecodeInt(0))
- }
- if chkOverflow32 && chkOvf.Float32(f) {
- d.d.errorf("msgpack: float32 overflow: %v", f)
- return
- }
- d.bdRead = false
- return
-}
-
-// bool can be decoded from bool, fixnum 0 or 1.
-func (d *msgpackDecDriver) DecodeBool() (b bool) {
- if !d.bdRead {
- d.readNextBd()
- }
- if d.bd == mpFalse || d.bd == 0 {
- // b = false
- } else if d.bd == mpTrue || d.bd == 1 {
- b = true
- } else {
- d.d.errorf("Invalid single-byte value for bool: %s: %x", msgBadDesc, d.bd)
- return
- }
- d.bdRead = false
- return
-}
-
-func (d *msgpackDecDriver) DecodeBytes(bs []byte, isstring, zerocopy bool) (bsOut []byte) {
- if !d.bdRead {
- d.readNextBd()
- }
- var clen int
- // ignore isstring. Expect that the bytes may be found from msgpackContainerStr or msgpackContainerBin
- if bd := d.bd; bd == mpBin8 || bd == mpBin16 || bd == mpBin32 {
- clen = d.readContainerLen(msgpackContainerBin)
- } else {
- clen = d.readContainerLen(msgpackContainerStr)
- }
- // println("DecodeBytes: clen: ", clen)
- d.bdRead = false
- // bytes may be nil, so handle it. if nil, clen=-1.
- if clen < 0 {
- return nil
- }
- if zerocopy {
- if d.br {
- return d.r.readx(clen)
- } else if len(bs) == 0 {
- bs = d.b[:]
- }
- }
- return decByteSlice(d.r, clen, bs)
-}
-
-func (d *msgpackDecDriver) DecodeString() (s string) {
- return string(d.DecodeBytes(d.b[:], true, true))
-}
-
-func (d *msgpackDecDriver) readNextBd() {
- d.bd = d.r.readn1()
- d.bdRead = true
-}
-
-func (d *msgpackDecDriver) ContainerType() (vt valueType) {
- bd := d.bd
- if bd == mpNil {
- return valueTypeNil
- } else if bd == mpBin8 || bd == mpBin16 || bd == mpBin32 ||
- (!d.h.RawToString &&
- (bd == mpStr8 || bd == mpStr16 || bd == mpStr32 || (bd >= mpFixStrMin && bd <= mpFixStrMax))) {
- return valueTypeBytes
- } else if d.h.RawToString &&
- (bd == mpStr8 || bd == mpStr16 || bd == mpStr32 || (bd >= mpFixStrMin && bd <= mpFixStrMax)) {
- return valueTypeString
- } else if bd == mpArray16 || bd == mpArray32 || (bd >= mpFixArrayMin && bd <= mpFixArrayMax) {
- return valueTypeArray
- } else if bd == mpMap16 || bd == mpMap32 || (bd >= mpFixMapMin && bd <= mpFixMapMax) {
- return valueTypeMap
- } else {
- // d.d.errorf("isContainerType: unsupported parameter: %v", vt)
- }
- return valueTypeUnset
-}
-
-func (d *msgpackDecDriver) TryDecodeAsNil() (v bool) {
- if !d.bdRead {
- d.readNextBd()
- }
- if d.bd == mpNil {
- d.bdRead = false
- v = true
- }
- return
-}
-
-func (d *msgpackDecDriver) readContainerLen(ct msgpackContainerType) (clen int) {
- bd := d.bd
- if bd == mpNil {
- clen = -1 // to represent nil
- } else if bd == ct.b8 {
- clen = int(d.r.readn1())
- } else if bd == ct.b16 {
- clen = int(bigen.Uint16(d.r.readx(2)))
- } else if bd == ct.b32 {
- clen = int(bigen.Uint32(d.r.readx(4)))
- } else if (ct.bFixMin & bd) == ct.bFixMin {
- clen = int(ct.bFixMin ^ bd)
- } else {
- d.d.errorf("readContainerLen: %s: hex: %x, decimal: %d", msgBadDesc, bd, bd)
- return
- }
- d.bdRead = false
- return
-}
-
-func (d *msgpackDecDriver) ReadMapStart() int {
- return d.readContainerLen(msgpackContainerMap)
-}
-
-func (d *msgpackDecDriver) ReadArrayStart() int {
- return d.readContainerLen(msgpackContainerList)
-}
-
-func (d *msgpackDecDriver) readExtLen() (clen int) {
- switch d.bd {
- case mpNil:
- clen = -1 // to represent nil
- case mpFixExt1:
- clen = 1
- case mpFixExt2:
- clen = 2
- case mpFixExt4:
- clen = 4
- case mpFixExt8:
- clen = 8
- case mpFixExt16:
- clen = 16
- case mpExt8:
- clen = int(d.r.readn1())
- case mpExt16:
- clen = int(bigen.Uint16(d.r.readx(2)))
- case mpExt32:
- clen = int(bigen.Uint32(d.r.readx(4)))
- default:
- d.d.errorf("decoding ext bytes: found unexpected byte: %x", d.bd)
- return
- }
- return
-}
-
-func (d *msgpackDecDriver) DecodeExt(rv interface{}, xtag uint64, ext Ext) (realxtag uint64) {
- if xtag > 0xff {
- d.d.errorf("decodeExt: tag must be <= 0xff; got: %v", xtag)
- return
- }
- realxtag1, xbs := d.decodeExtV(ext != nil, uint8(xtag))
- realxtag = uint64(realxtag1)
- if ext == nil {
- re := rv.(*RawExt)
- re.Tag = realxtag
- re.Data = detachZeroCopyBytes(d.br, re.Data, xbs)
- } else {
- ext.ReadExt(rv, xbs)
- }
- return
-}
-
-func (d *msgpackDecDriver) decodeExtV(verifyTag bool, tag byte) (xtag byte, xbs []byte) {
- if !d.bdRead {
- d.readNextBd()
- }
- xbd := d.bd
- if xbd == mpBin8 || xbd == mpBin16 || xbd == mpBin32 {
- xbs = d.DecodeBytes(nil, false, true)
- } else if xbd == mpStr8 || xbd == mpStr16 || xbd == mpStr32 ||
- (xbd >= mpFixStrMin && xbd <= mpFixStrMax) {
- xbs = d.DecodeBytes(nil, true, true)
- } else {
- clen := d.readExtLen()
- xtag = d.r.readn1()
- if verifyTag && xtag != tag {
- d.d.errorf("Wrong extension tag. Got %b. Expecting: %v", xtag, tag)
- return
- }
- xbs = d.r.readx(clen)
- }
- d.bdRead = false
- return
-}
-
-//--------------------------------------------------
-
-//MsgpackHandle is a Handle for the Msgpack Schema-Free Encoding Format.
-type MsgpackHandle struct {
- BasicHandle
-
- // RawToString controls how raw bytes are decoded into a nil interface{}.
- RawToString bool
-
- // WriteExt flag supports encoding configured extensions with extension tags.
- // It also controls whether other elements of the new spec are encoded (ie Str8).
- //
- // With WriteExt=false, configured extensions are serialized as raw bytes
- // and Str8 is not encoded.
- //
- // A stream can still be decoded into a typed value, provided an appropriate value
- // is provided, but the type cannot be inferred from the stream. If no appropriate
- // type is provided (e.g. decoding into a nil interface{}), you get back
- // a []byte or string based on the setting of RawToString.
- WriteExt bool
- binaryEncodingType
-}
-
-func (h *MsgpackHandle) SetBytesExt(rt reflect.Type, tag uint64, ext BytesExt) (err error) {
- return h.SetExt(rt, tag, &setExtWrapper{b: ext})
-}
-
-func (h *MsgpackHandle) newEncDriver(e *Encoder) encDriver {
- return &msgpackEncDriver{e: e, w: e.w, h: h}
-}
-
-func (h *MsgpackHandle) newDecDriver(d *Decoder) decDriver {
- return &msgpackDecDriver{d: d, r: d.r, h: h, br: d.bytes}
-}
-
-func (e *msgpackEncDriver) reset() {
- e.w = e.e.w
-}
-
-func (d *msgpackDecDriver) reset() {
- d.r = d.d.r
- d.bd, d.bdRead = 0, false
-}
-
-//--------------------------------------------------
-
-type msgpackSpecRpcCodec struct {
- rpcCodec
-}
-
-// /////////////// Spec RPC Codec ///////////////////
-func (c *msgpackSpecRpcCodec) WriteRequest(r *rpc.Request, body interface{}) error {
- // WriteRequest can write to both a Go service, and other services that do
- // not abide by the 1 argument rule of a Go service.
- // We discriminate based on if the body is a MsgpackSpecRpcMultiArgs
- var bodyArr []interface{}
- if m, ok := body.(MsgpackSpecRpcMultiArgs); ok {
- bodyArr = ([]interface{})(m)
- } else {
- bodyArr = []interface{}{body}
- }
- r2 := []interface{}{0, uint32(r.Seq), r.ServiceMethod, bodyArr}
- return c.write(r2, nil, false, true)
-}
-
-func (c *msgpackSpecRpcCodec) WriteResponse(r *rpc.Response, body interface{}) error {
- var moe interface{}
- if r.Error != "" {
- moe = r.Error
- }
- if moe != nil && body != nil {
- body = nil
- }
- r2 := []interface{}{1, uint32(r.Seq), moe, body}
- return c.write(r2, nil, false, true)
-}
-
-func (c *msgpackSpecRpcCodec) ReadResponseHeader(r *rpc.Response) error {
- return c.parseCustomHeader(1, &r.Seq, &r.Error)
-}
-
-func (c *msgpackSpecRpcCodec) ReadRequestHeader(r *rpc.Request) error {
- return c.parseCustomHeader(0, &r.Seq, &r.ServiceMethod)
-}
-
-func (c *msgpackSpecRpcCodec) ReadRequestBody(body interface{}) error {
- if body == nil { // read and discard
- return c.read(nil)
- }
- bodyArr := []interface{}{body}
- return c.read(&bodyArr)
-}
-
-func (c *msgpackSpecRpcCodec) parseCustomHeader(expectTypeByte byte, msgid *uint64, methodOrError *string) (err error) {
-
- if c.isClosed() {
- return io.EOF
- }
-
- // We read the response header by hand
- // so that the body can be decoded on its own from the stream at a later time.
-
- const fia byte = 0x94 //four item array descriptor value
- // Not sure why the panic of EOF is swallowed above.
- // if bs1 := c.dec.r.readn1(); bs1 != fia {
- // err = fmt.Errorf("Unexpected value for array descriptor: Expecting %v. Received %v", fia, bs1)
- // return
- // }
- var b byte
- b, err = c.br.ReadByte()
- if err != nil {
- return
- }
- if b != fia {
- err = fmt.Errorf("Unexpected value for array descriptor: Expecting %v. Received %v", fia, b)
- return
- }
-
- if err = c.read(&b); err != nil {
- return
- }
- if b != expectTypeByte {
- err = fmt.Errorf("Unexpected byte descriptor in header. Expecting %v. Received %v", expectTypeByte, b)
- return
- }
- if err = c.read(msgid); err != nil {
- return
- }
- if err = c.read(methodOrError); err != nil {
- return
- }
- return
-}
-
-//--------------------------------------------------
-
-// msgpackSpecRpc is the implementation of Rpc that uses custom communication protocol
-// as defined in the msgpack spec at https://github.com/msgpack-rpc/msgpack-rpc/blob/master/spec.md
-type msgpackSpecRpc struct{}
-
-// MsgpackSpecRpc implements Rpc using the communication protocol defined in
-// the msgpack spec at https://github.com/msgpack-rpc/msgpack-rpc/blob/master/spec.md .
-// Its methods (ServerCodec and ClientCodec) return values that implement RpcCodecBuffered.
-var MsgpackSpecRpc msgpackSpecRpc
-
-func (x msgpackSpecRpc) ServerCodec(conn io.ReadWriteCloser, h Handle) rpc.ServerCodec {
- return &msgpackSpecRpcCodec{newRPCCodec(conn, h)}
-}
-
-func (x msgpackSpecRpc) ClientCodec(conn io.ReadWriteCloser, h Handle) rpc.ClientCodec {
- return &msgpackSpecRpcCodec{newRPCCodec(conn, h)}
-}
-
-var _ decDriver = (*msgpackDecDriver)(nil)
-var _ encDriver = (*msgpackEncDriver)(nil)
diff --git a/vendor/github.com/ugorji/go/codec/noop.go b/vendor/github.com/ugorji/go/codec/noop.go
deleted file mode 100644
index cfee3d08..00000000
--- a/vendor/github.com/ugorji/go/codec/noop.go
+++ /dev/null
@@ -1,213 +0,0 @@
-// Copyright (c) 2012-2015 Ugorji Nwoke. All rights reserved.
-// Use of this source code is governed by a MIT license found in the LICENSE file.
-
-package codec
-
-import (
- "math/rand"
- "time"
-)
-
-// NoopHandle returns a no-op handle. It basically does nothing.
-// It is only useful for benchmarking, as it gives an idea of the
-// overhead from the codec framework.
-//
-// LIBRARY USERS: *** DO NOT USE ***
-func NoopHandle(slen int) *noopHandle {
- h := noopHandle{}
- h.rand = rand.New(rand.NewSource(time.Now().UnixNano()))
- h.B = make([][]byte, slen)
- h.S = make([]string, slen)
- for i := 0; i < len(h.S); i++ {
- b := make([]byte, i+1)
- for j := 0; j < len(b); j++ {
- b[j] = 'a' + byte(i)
- }
- h.B[i] = b
- h.S[i] = string(b)
- }
- return &h
-}
-
-// noopHandle does nothing.
-// It is used to simulate the overhead of the codec framework.
-type noopHandle struct {
- BasicHandle
- binaryEncodingType
- noopDrv // noopDrv is unexported here, so we can get a copy of it when needed.
-}
-
-type noopDrv struct {
- d *Decoder
- e *Encoder
- i int
- S []string
- B [][]byte
- mks []bool // stack. if map (true), else if array (false)
- mk bool // top of stack. what container are we on? map or array?
- ct valueType // last response for IsContainerType.
- cb int // counter for ContainerType
- rand *rand.Rand
-}
-
-func (h *noopDrv) r(v int) int { return h.rand.Intn(v) }
-func (h *noopDrv) m(v int) int { h.i++; return h.i % v }
-
-func (h *noopDrv) newEncDriver(e *Encoder) encDriver { h.e = e; return h }
-func (h *noopDrv) newDecDriver(d *Decoder) decDriver { h.d = d; return h }
-
-func (h *noopDrv) reset() {}
-func (h *noopDrv) uncacheRead() {}
-
-// --- encDriver
-
-// stack functions (for map and array)
-func (h *noopDrv) start(b bool) {
- // println("start", len(h.mks)+1)
- h.mks = append(h.mks, b)
- h.mk = b
-}
-func (h *noopDrv) end() {
- // println("end: ", len(h.mks)-1)
- h.mks = h.mks[:len(h.mks)-1]
- if len(h.mks) > 0 {
- h.mk = h.mks[len(h.mks)-1]
- } else {
- h.mk = false
- }
-}
-
-func (h *noopDrv) EncodeBuiltin(rt uintptr, v interface{}) {}
-func (h *noopDrv) EncodeNil() {}
-func (h *noopDrv) EncodeInt(i int64) {}
-func (h *noopDrv) EncodeUint(i uint64) {}
-func (h *noopDrv) EncodeBool(b bool) {}
-func (h *noopDrv) EncodeFloat32(f float32) {}
-func (h *noopDrv) EncodeFloat64(f float64) {}
-func (h *noopDrv) EncodeRawExt(re *RawExt, e *Encoder) {}
-func (h *noopDrv) EncodeArrayStart(length int) { h.start(true) }
-func (h *noopDrv) EncodeMapStart(length int) { h.start(false) }
-func (h *noopDrv) EncodeEnd() { h.end() }
-
-func (h *noopDrv) EncodeString(c charEncoding, v string) {}
-func (h *noopDrv) EncodeSymbol(v string) {}
-func (h *noopDrv) EncodeStringBytes(c charEncoding, v []byte) {}
-
-func (h *noopDrv) EncodeExt(rv interface{}, xtag uint64, ext Ext, e *Encoder) {}
-
-// ---- decDriver
-func (h *noopDrv) initReadNext() {}
-func (h *noopDrv) CheckBreak() bool { return false }
-func (h *noopDrv) IsBuiltinType(rt uintptr) bool { return false }
-func (h *noopDrv) DecodeBuiltin(rt uintptr, v interface{}) {}
-func (h *noopDrv) DecodeInt(bitsize uint8) (i int64) { return int64(h.m(15)) }
-func (h *noopDrv) DecodeUint(bitsize uint8) (ui uint64) { return uint64(h.m(35)) }
-func (h *noopDrv) DecodeFloat(chkOverflow32 bool) (f float64) { return float64(h.m(95)) }
-func (h *noopDrv) DecodeBool() (b bool) { return h.m(2) == 0 }
-func (h *noopDrv) DecodeString() (s string) { return h.S[h.m(8)] }
-
-// func (h *noopDrv) DecodeStringAsBytes(bs []byte) []byte { return h.DecodeBytes(bs) }
-
-func (h *noopDrv) DecodeBytes(bs []byte, isstring, zerocopy bool) []byte { return h.B[h.m(len(h.B))] }
-
-func (h *noopDrv) ReadEnd() { h.end() }
-
-// toggle map/slice
-func (h *noopDrv) ReadMapStart() int { h.start(true); return h.m(10) }
-func (h *noopDrv) ReadArrayStart() int { h.start(false); return h.m(10) }
-
-func (h *noopDrv) ContainerType() (vt valueType) {
- // return h.m(2) == 0
- // handle kStruct, which will bomb is it calls this and doesn't get back a map or array.
- // consequently, if the return value is not map or array, reset it to one of them based on h.m(7) % 2
- // for kstruct: at least one out of every 2 times, return one of valueTypeMap or Array (else kstruct bombs)
- // however, every 10th time it is called, we just return something else.
- var vals = [...]valueType{valueTypeArray, valueTypeMap}
- // ------------ TAKE ------------
- // if h.cb%2 == 0 {
- // if h.ct == valueTypeMap || h.ct == valueTypeArray {
- // } else {
- // h.ct = vals[h.m(2)]
- // }
- // } else if h.cb%5 == 0 {
- // h.ct = valueType(h.m(8))
- // } else {
- // h.ct = vals[h.m(2)]
- // }
- // ------------ TAKE ------------
- // if h.cb%16 == 0 {
- // h.ct = valueType(h.cb % 8)
- // } else {
- // h.ct = vals[h.cb%2]
- // }
- h.ct = vals[h.cb%2]
- h.cb++
- return h.ct
-
- // if h.ct == valueTypeNil || h.ct == valueTypeString || h.ct == valueTypeBytes {
- // return h.ct
- // }
- // return valueTypeUnset
- // TODO: may need to tweak this so it works.
- // if h.ct == valueTypeMap && vt == valueTypeArray || h.ct == valueTypeArray && vt == valueTypeMap {
- // h.cb = !h.cb
- // h.ct = vt
- // return h.cb
- // }
- // // go in a loop and check it.
- // h.ct = vt
- // h.cb = h.m(7) == 0
- // return h.cb
-}
-func (h *noopDrv) TryDecodeAsNil() bool {
- if h.mk {
- return false
- } else {
- return h.m(8) == 0
- }
-}
-func (h *noopDrv) DecodeExt(rv interface{}, xtag uint64, ext Ext) uint64 {
- return 0
-}
-
-func (h *noopDrv) DecodeNaked() {
- // use h.r (random) not h.m() because h.m() could cause the same value to be given.
- var sk int
- if h.mk {
- // if mapkey, do not support values of nil OR bytes, array, map or rawext
- sk = h.r(7) + 1
- } else {
- sk = h.r(12)
- }
- n := &h.d.n
- switch sk {
- case 0:
- n.v = valueTypeNil
- case 1:
- n.v, n.b = valueTypeBool, false
- case 2:
- n.v, n.b = valueTypeBool, true
- case 3:
- n.v, n.i = valueTypeInt, h.DecodeInt(64)
- case 4:
- n.v, n.u = valueTypeUint, h.DecodeUint(64)
- case 5:
- n.v, n.f = valueTypeFloat, h.DecodeFloat(true)
- case 6:
- n.v, n.f = valueTypeFloat, h.DecodeFloat(false)
- case 7:
- n.v, n.s = valueTypeString, h.DecodeString()
- case 8:
- n.v, n.l = valueTypeBytes, h.B[h.m(len(h.B))]
- case 9:
- n.v = valueTypeArray
- case 10:
- n.v = valueTypeMap
- default:
- n.v = valueTypeExt
- n.u = h.DecodeUint(64)
- n.l = h.B[h.m(len(h.B))]
- }
- h.ct = n.v
- return
-}
diff --git a/vendor/github.com/ugorji/go/codec/prebuild.go b/vendor/github.com/ugorji/go/codec/prebuild.go
deleted file mode 100644
index 2353263e..00000000
--- a/vendor/github.com/ugorji/go/codec/prebuild.go
+++ /dev/null
@@ -1,3 +0,0 @@
-package codec
-
-//go:generate bash prebuild.sh
diff --git a/vendor/github.com/ugorji/go/codec/prebuild.sh b/vendor/github.com/ugorji/go/codec/prebuild.sh
deleted file mode 100755
index 909f4bb0..00000000
--- a/vendor/github.com/ugorji/go/codec/prebuild.sh
+++ /dev/null
@@ -1,199 +0,0 @@
-#!/bin/bash
-
-# _needgen is a helper function to tell if we need to generate files for msgp, codecgen.
-_needgen() {
- local a="$1"
- zneedgen=0
- if [[ ! -e "$a" ]]
- then
- zneedgen=1
- echo 1
- return 0
- fi
- for i in `ls -1 *.go.tmpl gen.go values_test.go`
- do
- if [[ "$a" -ot "$i" ]]
- then
- zneedgen=1
- echo 1
- return 0
- fi
- done
- echo 0
-}
-
-# _build generates fast-path.go and gen-helper.go.
-#
-# It is needed because there is some dependency between the generated code
-# and the other classes. Consequently, we have to totally remove the
-# generated files and put stubs in place, before calling "go run" again
-# to recreate them.
-_build() {
- if ! [[ "${zforce}" == "1" ||
- "1" == $( _needgen "fast-path.generated.go" ) ||
- "1" == $( _needgen "gen-helper.generated.go" ) ||
- "1" == $( _needgen "gen.generated.go" ) ||
- 1 == 0 ]]
- then
- return 0
- fi
-
- # echo "Running prebuild"
- if [ "${zbak}" == "1" ]
- then
- # echo "Backing up old generated files"
- _zts=`date '+%m%d%Y_%H%M%S'`
- _gg=".generated.go"
- [ -e "gen-helper${_gg}" ] && mv gen-helper${_gg} gen-helper${_gg}__${_zts}.bak
- [ -e "fast-path${_gg}" ] && mv fast-path${_gg} fast-path${_gg}__${_zts}.bak
- # [ -e "safe${_gg}" ] && mv safe${_gg} safe${_gg}__${_zts}.bak
- # [ -e "unsafe${_gg}" ] && mv unsafe${_gg} unsafe${_gg}__${_zts}.bak
- else
- rm -f fast-path.generated.go gen.generated.go gen-helper.generated.go \
- *safe.generated.go *_generated_test.go *.generated_ffjson_expose.go
- fi
-
- cat > gen.generated.go <> gen.generated.go < gen-dec-map.go.tmpl
-
- cat >> gen.generated.go <> gen.generated.go < gen-dec-array.go.tmpl
-
- cat >> gen.generated.go < gen-from-tmpl.codec.generated.go < gen-from-tmpl.generated.go < math.MaxInt64 {
- // d.d.errorf("decIntAny: Integer out of range for signed int64: %v", ui)
- // return
- // }
- return
-}
-
-func (d *simpleDecDriver) DecodeInt(bitsize uint8) (i int64) {
- ui, neg := d.decCheckInteger()
- i, overflow := chkOvf.SignedInt(ui)
- if overflow {
- d.d.errorf("simple: overflow converting %v to signed integer", ui)
- return
- }
- if neg {
- i = -i
- }
- if chkOvf.Int(i, bitsize) {
- d.d.errorf("simple: overflow integer: %v", i)
- return
- }
- d.bdRead = false
- return
-}
-
-func (d *simpleDecDriver) DecodeUint(bitsize uint8) (ui uint64) {
- ui, neg := d.decCheckInteger()
- if neg {
- d.d.errorf("Assigning negative signed value to unsigned type")
- return
- }
- if chkOvf.Uint(ui, bitsize) {
- d.d.errorf("simple: overflow integer: %v", ui)
- return
- }
- d.bdRead = false
- return
-}
-
-func (d *simpleDecDriver) DecodeFloat(chkOverflow32 bool) (f float64) {
- if !d.bdRead {
- d.readNextBd()
- }
- if d.bd == simpleVdFloat32 {
- f = float64(math.Float32frombits(bigen.Uint32(d.r.readx(4))))
- } else if d.bd == simpleVdFloat64 {
- f = math.Float64frombits(bigen.Uint64(d.r.readx(8)))
- } else {
- if d.bd >= simpleVdPosInt && d.bd <= simpleVdNegInt+3 {
- f = float64(d.DecodeInt(64))
- } else {
- d.d.errorf("Float only valid from float32/64: Invalid descriptor: %v", d.bd)
- return
- }
- }
- if chkOverflow32 && chkOvf.Float32(f) {
- d.d.errorf("msgpack: float32 overflow: %v", f)
- return
- }
- d.bdRead = false
- return
-}
-
-// bool can be decoded from bool only (single byte).
-func (d *simpleDecDriver) DecodeBool() (b bool) {
- if !d.bdRead {
- d.readNextBd()
- }
- if d.bd == simpleVdTrue {
- b = true
- } else if d.bd == simpleVdFalse {
- } else {
- d.d.errorf("Invalid single-byte value for bool: %s: %x", msgBadDesc, d.bd)
- return
- }
- d.bdRead = false
- return
-}
-
-func (d *simpleDecDriver) ReadMapStart() (length int) {
- d.bdRead = false
- return d.decLen()
-}
-
-func (d *simpleDecDriver) ReadArrayStart() (length int) {
- d.bdRead = false
- return d.decLen()
-}
-
-func (d *simpleDecDriver) decLen() int {
- switch d.bd % 8 {
- case 0:
- return 0
- case 1:
- return int(d.r.readn1())
- case 2:
- return int(bigen.Uint16(d.r.readx(2)))
- case 3:
- ui := uint64(bigen.Uint32(d.r.readx(4)))
- if chkOvf.Uint(ui, intBitsize) {
- d.d.errorf("simple: overflow integer: %v", ui)
- return 0
- }
- return int(ui)
- case 4:
- ui := bigen.Uint64(d.r.readx(8))
- if chkOvf.Uint(ui, intBitsize) {
- d.d.errorf("simple: overflow integer: %v", ui)
- return 0
- }
- return int(ui)
- }
- d.d.errorf("decLen: Cannot read length: bd%8 must be in range 0..4. Got: %d", d.bd%8)
- return -1
-}
-
-func (d *simpleDecDriver) DecodeString() (s string) {
- return string(d.DecodeBytes(d.b[:], true, true))
-}
-
-func (d *simpleDecDriver) DecodeBytes(bs []byte, isstring, zerocopy bool) (bsOut []byte) {
- if !d.bdRead {
- d.readNextBd()
- }
- if d.bd == simpleVdNil {
- d.bdRead = false
- return
- }
- clen := d.decLen()
- d.bdRead = false
- if zerocopy {
- if d.br {
- return d.r.readx(clen)
- } else if len(bs) == 0 {
- bs = d.b[:]
- }
- }
- return decByteSlice(d.r, clen, bs)
-}
-
-func (d *simpleDecDriver) DecodeExt(rv interface{}, xtag uint64, ext Ext) (realxtag uint64) {
- if xtag > 0xff {
- d.d.errorf("decodeExt: tag must be <= 0xff; got: %v", xtag)
- return
- }
- realxtag1, xbs := d.decodeExtV(ext != nil, uint8(xtag))
- realxtag = uint64(realxtag1)
- if ext == nil {
- re := rv.(*RawExt)
- re.Tag = realxtag
- re.Data = detachZeroCopyBytes(d.br, re.Data, xbs)
- } else {
- ext.ReadExt(rv, xbs)
- }
- return
-}
-
-func (d *simpleDecDriver) decodeExtV(verifyTag bool, tag byte) (xtag byte, xbs []byte) {
- if !d.bdRead {
- d.readNextBd()
- }
- switch d.bd {
- case simpleVdExt, simpleVdExt + 1, simpleVdExt + 2, simpleVdExt + 3, simpleVdExt + 4:
- l := d.decLen()
- xtag = d.r.readn1()
- if verifyTag && xtag != tag {
- d.d.errorf("Wrong extension tag. Got %b. Expecting: %v", xtag, tag)
- return
- }
- xbs = d.r.readx(l)
- case simpleVdByteArray, simpleVdByteArray + 1, simpleVdByteArray + 2, simpleVdByteArray + 3, simpleVdByteArray + 4:
- xbs = d.DecodeBytes(nil, false, true)
- default:
- d.d.errorf("Invalid d.bd for extensions (Expecting extensions or byte array). Got: 0x%x", d.bd)
- return
- }
- d.bdRead = false
- return
-}
-
-func (d *simpleDecDriver) DecodeNaked() {
- if !d.bdRead {
- d.readNextBd()
- }
-
- n := &d.d.n
- var decodeFurther bool
-
- switch d.bd {
- case simpleVdNil:
- n.v = valueTypeNil
- case simpleVdFalse:
- n.v = valueTypeBool
- n.b = false
- case simpleVdTrue:
- n.v = valueTypeBool
- n.b = true
- case simpleVdPosInt, simpleVdPosInt + 1, simpleVdPosInt + 2, simpleVdPosInt + 3:
- if d.h.SignedInteger {
- n.v = valueTypeInt
- n.i = d.DecodeInt(64)
- } else {
- n.v = valueTypeUint
- n.u = d.DecodeUint(64)
- }
- case simpleVdNegInt, simpleVdNegInt + 1, simpleVdNegInt + 2, simpleVdNegInt + 3:
- n.v = valueTypeInt
- n.i = d.DecodeInt(64)
- case simpleVdFloat32:
- n.v = valueTypeFloat
- n.f = d.DecodeFloat(true)
- case simpleVdFloat64:
- n.v = valueTypeFloat
- n.f = d.DecodeFloat(false)
- case simpleVdString, simpleVdString + 1, simpleVdString + 2, simpleVdString + 3, simpleVdString + 4:
- n.v = valueTypeString
- n.s = d.DecodeString()
- case simpleVdByteArray, simpleVdByteArray + 1, simpleVdByteArray + 2, simpleVdByteArray + 3, simpleVdByteArray + 4:
- n.v = valueTypeBytes
- n.l = d.DecodeBytes(nil, false, false)
- case simpleVdExt, simpleVdExt + 1, simpleVdExt + 2, simpleVdExt + 3, simpleVdExt + 4:
- n.v = valueTypeExt
- l := d.decLen()
- n.u = uint64(d.r.readn1())
- n.l = d.r.readx(l)
- case simpleVdArray, simpleVdArray + 1, simpleVdArray + 2, simpleVdArray + 3, simpleVdArray + 4:
- n.v = valueTypeArray
- decodeFurther = true
- case simpleVdMap, simpleVdMap + 1, simpleVdMap + 2, simpleVdMap + 3, simpleVdMap + 4:
- n.v = valueTypeMap
- decodeFurther = true
- default:
- d.d.errorf("decodeNaked: Unrecognized d.bd: 0x%x", d.bd)
- }
-
- if !decodeFurther {
- d.bdRead = false
- }
- return
-}
-
-//------------------------------------
-
-// SimpleHandle is a Handle for a very simple encoding format.
-//
-// simple is a simplistic codec similar to binc, but not as compact.
-// - Encoding of a value is always preceeded by the descriptor byte (bd)
-// - True, false, nil are encoded fully in 1 byte (the descriptor)
-// - Integers (intXXX, uintXXX) are encoded in 1, 2, 4 or 8 bytes (plus a descriptor byte).
-// There are positive (uintXXX and intXXX >= 0) and negative (intXXX < 0) integers.
-// - Floats are encoded in 4 or 8 bytes (plus a descriptor byte)
-// - Lenght of containers (strings, bytes, array, map, extensions)
-// are encoded in 0, 1, 2, 4 or 8 bytes.
-// Zero-length containers have no length encoded.
-// For others, the number of bytes is given by pow(2, bd%3)
-// - maps are encoded as [bd] [length] [[key][value]]...
-// - arrays are encoded as [bd] [length] [value]...
-// - extensions are encoded as [bd] [length] [tag] [byte]...
-// - strings/bytearrays are encoded as [bd] [length] [byte]...
-//
-// The full spec will be published soon.
-type SimpleHandle struct {
- BasicHandle
- binaryEncodingType
-}
-
-func (h *SimpleHandle) SetBytesExt(rt reflect.Type, tag uint64, ext BytesExt) (err error) {
- return h.SetExt(rt, tag, &setExtWrapper{b: ext})
-}
-
-func (h *SimpleHandle) newEncDriver(e *Encoder) encDriver {
- return &simpleEncDriver{e: e, w: e.w, h: h}
-}
-
-func (h *SimpleHandle) newDecDriver(d *Decoder) decDriver {
- return &simpleDecDriver{d: d, r: d.r, h: h, br: d.bytes}
-}
-
-func (e *simpleEncDriver) reset() {
- e.w = e.e.w
-}
-
-func (d *simpleDecDriver) reset() {
- d.r = d.d.r
- d.bd, d.bdRead = 0, false
-}
-
-var _ decDriver = (*simpleDecDriver)(nil)
-var _ encDriver = (*simpleEncDriver)(nil)
diff --git a/vendor/github.com/ugorji/go/codec/test-cbor-goldens.json b/vendor/github.com/ugorji/go/codec/test-cbor-goldens.json
deleted file mode 100644
index 90285867..00000000
--- a/vendor/github.com/ugorji/go/codec/test-cbor-goldens.json
+++ /dev/null
@@ -1,639 +0,0 @@
-[
- {
- "cbor": "AA==",
- "hex": "00",
- "roundtrip": true,
- "decoded": 0
- },
- {
- "cbor": "AQ==",
- "hex": "01",
- "roundtrip": true,
- "decoded": 1
- },
- {
- "cbor": "Cg==",
- "hex": "0a",
- "roundtrip": true,
- "decoded": 10
- },
- {
- "cbor": "Fw==",
- "hex": "17",
- "roundtrip": true,
- "decoded": 23
- },
- {
- "cbor": "GBg=",
- "hex": "1818",
- "roundtrip": true,
- "decoded": 24
- },
- {
- "cbor": "GBk=",
- "hex": "1819",
- "roundtrip": true,
- "decoded": 25
- },
- {
- "cbor": "GGQ=",
- "hex": "1864",
- "roundtrip": true,
- "decoded": 100
- },
- {
- "cbor": "GQPo",
- "hex": "1903e8",
- "roundtrip": true,
- "decoded": 1000
- },
- {
- "cbor": "GgAPQkA=",
- "hex": "1a000f4240",
- "roundtrip": true,
- "decoded": 1000000
- },
- {
- "cbor": "GwAAAOjUpRAA",
- "hex": "1b000000e8d4a51000",
- "roundtrip": true,
- "decoded": 1000000000000
- },
- {
- "cbor": "G///////////",
- "hex": "1bffffffffffffffff",
- "roundtrip": true,
- "decoded": 18446744073709551615
- },
- {
- "cbor": "wkkBAAAAAAAAAAA=",
- "hex": "c249010000000000000000",
- "roundtrip": true,
- "decoded": 18446744073709551616
- },
- {
- "cbor": "O///////////",
- "hex": "3bffffffffffffffff",
- "roundtrip": true,
- "decoded": -18446744073709551616,
- "skip": true
- },
- {
- "cbor": "w0kBAAAAAAAAAAA=",
- "hex": "c349010000000000000000",
- "roundtrip": true,
- "decoded": -18446744073709551617
- },
- {
- "cbor": "IA==",
- "hex": "20",
- "roundtrip": true,
- "decoded": -1
- },
- {
- "cbor": "KQ==",
- "hex": "29",
- "roundtrip": true,
- "decoded": -10
- },
- {
- "cbor": "OGM=",
- "hex": "3863",
- "roundtrip": true,
- "decoded": -100
- },
- {
- "cbor": "OQPn",
- "hex": "3903e7",
- "roundtrip": true,
- "decoded": -1000
- },
- {
- "cbor": "+QAA",
- "hex": "f90000",
- "roundtrip": true,
- "decoded": 0.0
- },
- {
- "cbor": "+YAA",
- "hex": "f98000",
- "roundtrip": true,
- "decoded": -0.0
- },
- {
- "cbor": "+TwA",
- "hex": "f93c00",
- "roundtrip": true,
- "decoded": 1.0
- },
- {
- "cbor": "+z/xmZmZmZma",
- "hex": "fb3ff199999999999a",
- "roundtrip": true,
- "decoded": 1.1
- },
- {
- "cbor": "+T4A",
- "hex": "f93e00",
- "roundtrip": true,
- "decoded": 1.5
- },
- {
- "cbor": "+Xv/",
- "hex": "f97bff",
- "roundtrip": true,
- "decoded": 65504.0
- },
- {
- "cbor": "+kfDUAA=",
- "hex": "fa47c35000",
- "roundtrip": true,
- "decoded": 100000.0
- },
- {
- "cbor": "+n9///8=",
- "hex": "fa7f7fffff",
- "roundtrip": true,
- "decoded": 3.4028234663852886e+38
- },
- {
- "cbor": "+3435DyIAHWc",
- "hex": "fb7e37e43c8800759c",
- "roundtrip": true,
- "decoded": 1.0e+300
- },
- {
- "cbor": "+QAB",
- "hex": "f90001",
- "roundtrip": true,
- "decoded": 5.960464477539063e-08
- },
- {
- "cbor": "+QQA",
- "hex": "f90400",
- "roundtrip": true,
- "decoded": 6.103515625e-05
- },
- {
- "cbor": "+cQA",
- "hex": "f9c400",
- "roundtrip": true,
- "decoded": -4.0
- },
- {
- "cbor": "+8AQZmZmZmZm",
- "hex": "fbc010666666666666",
- "roundtrip": true,
- "decoded": -4.1
- },
- {
- "cbor": "+XwA",
- "hex": "f97c00",
- "roundtrip": true,
- "diagnostic": "Infinity"
- },
- {
- "cbor": "+X4A",
- "hex": "f97e00",
- "roundtrip": true,
- "diagnostic": "NaN"
- },
- {
- "cbor": "+fwA",
- "hex": "f9fc00",
- "roundtrip": true,
- "diagnostic": "-Infinity"
- },
- {
- "cbor": "+n+AAAA=",
- "hex": "fa7f800000",
- "roundtrip": false,
- "diagnostic": "Infinity"
- },
- {
- "cbor": "+n/AAAA=",
- "hex": "fa7fc00000",
- "roundtrip": false,
- "diagnostic": "NaN"
- },
- {
- "cbor": "+v+AAAA=",
- "hex": "faff800000",
- "roundtrip": false,
- "diagnostic": "-Infinity"
- },
- {
- "cbor": "+3/wAAAAAAAA",
- "hex": "fb7ff0000000000000",
- "roundtrip": false,
- "diagnostic": "Infinity"
- },
- {
- "cbor": "+3/4AAAAAAAA",
- "hex": "fb7ff8000000000000",
- "roundtrip": false,
- "diagnostic": "NaN"
- },
- {
- "cbor": "+//wAAAAAAAA",
- "hex": "fbfff0000000000000",
- "roundtrip": false,
- "diagnostic": "-Infinity"
- },
- {
- "cbor": "9A==",
- "hex": "f4",
- "roundtrip": true,
- "decoded": false
- },
- {
- "cbor": "9Q==",
- "hex": "f5",
- "roundtrip": true,
- "decoded": true
- },
- {
- "cbor": "9g==",
- "hex": "f6",
- "roundtrip": true,
- "decoded": null
- },
- {
- "cbor": "9w==",
- "hex": "f7",
- "roundtrip": true,
- "diagnostic": "undefined"
- },
- {
- "cbor": "8A==",
- "hex": "f0",
- "roundtrip": true,
- "diagnostic": "simple(16)"
- },
- {
- "cbor": "+Bg=",
- "hex": "f818",
- "roundtrip": true,
- "diagnostic": "simple(24)"
- },
- {
- "cbor": "+P8=",
- "hex": "f8ff",
- "roundtrip": true,
- "diagnostic": "simple(255)"
- },
- {
- "cbor": "wHQyMDEzLTAzLTIxVDIwOjA0OjAwWg==",
- "hex": "c074323031332d30332d32315432303a30343a30305a",
- "roundtrip": true,
- "diagnostic": "0(\"2013-03-21T20:04:00Z\")"
- },
- {
- "cbor": "wRpRS2ew",
- "hex": "c11a514b67b0",
- "roundtrip": true,
- "diagnostic": "1(1363896240)"
- },
- {
- "cbor": "wftB1FLZ7CAAAA==",
- "hex": "c1fb41d452d9ec200000",
- "roundtrip": true,
- "diagnostic": "1(1363896240.5)"
- },
- {
- "cbor": "10QBAgME",
- "hex": "d74401020304",
- "roundtrip": true,
- "diagnostic": "23(h'01020304')"
- },
- {
- "cbor": "2BhFZElFVEY=",
- "hex": "d818456449455446",
- "roundtrip": true,
- "diagnostic": "24(h'6449455446')"
- },
- {
- "cbor": "2CB2aHR0cDovL3d3dy5leGFtcGxlLmNvbQ==",
- "hex": "d82076687474703a2f2f7777772e6578616d706c652e636f6d",
- "roundtrip": true,
- "diagnostic": "32(\"http://www.example.com\")"
- },
- {
- "cbor": "QA==",
- "hex": "40",
- "roundtrip": true,
- "diagnostic": "h''"
- },
- {
- "cbor": "RAECAwQ=",
- "hex": "4401020304",
- "roundtrip": true,
- "diagnostic": "h'01020304'"
- },
- {
- "cbor": "YA==",
- "hex": "60",
- "roundtrip": true,
- "decoded": ""
- },
- {
- "cbor": "YWE=",
- "hex": "6161",
- "roundtrip": true,
- "decoded": "a"
- },
- {
- "cbor": "ZElFVEY=",
- "hex": "6449455446",
- "roundtrip": true,
- "decoded": "IETF"
- },
- {
- "cbor": "YiJc",
- "hex": "62225c",
- "roundtrip": true,
- "decoded": "\"\\"
- },
- {
- "cbor": "YsO8",
- "hex": "62c3bc",
- "roundtrip": true,
- "decoded": "ü"
- },
- {
- "cbor": "Y+awtA==",
- "hex": "63e6b0b4",
- "roundtrip": true,
- "decoded": "水"
- },
- {
- "cbor": "ZPCQhZE=",
- "hex": "64f0908591",
- "roundtrip": true,
- "decoded": "𐅑"
- },
- {
- "cbor": "gA==",
- "hex": "80",
- "roundtrip": true,
- "decoded": [
-
- ]
- },
- {
- "cbor": "gwECAw==",
- "hex": "83010203",
- "roundtrip": true,
- "decoded": [
- 1,
- 2,
- 3
- ]
- },
- {
- "cbor": "gwGCAgOCBAU=",
- "hex": "8301820203820405",
- "roundtrip": true,
- "decoded": [
- 1,
- [
- 2,
- 3
- ],
- [
- 4,
- 5
- ]
- ]
- },
- {
- "cbor": "mBkBAgMEBQYHCAkKCwwNDg8QERITFBUWFxgYGBk=",
- "hex": "98190102030405060708090a0b0c0d0e0f101112131415161718181819",
- "roundtrip": true,
- "decoded": [
- 1,
- 2,
- 3,
- 4,
- 5,
- 6,
- 7,
- 8,
- 9,
- 10,
- 11,
- 12,
- 13,
- 14,
- 15,
- 16,
- 17,
- 18,
- 19,
- 20,
- 21,
- 22,
- 23,
- 24,
- 25
- ]
- },
- {
- "cbor": "oA==",
- "hex": "a0",
- "roundtrip": true,
- "decoded": {
- }
- },
- {
- "cbor": "ogECAwQ=",
- "hex": "a201020304",
- "roundtrip": true,
- "skip": true,
- "diagnostic": "{1: 2, 3: 4}"
- },
- {
- "cbor": "omFhAWFiggID",
- "hex": "a26161016162820203",
- "roundtrip": true,
- "decoded": {
- "a": 1,
- "b": [
- 2,
- 3
- ]
- }
- },
- {
- "cbor": "gmFhoWFiYWM=",
- "hex": "826161a161626163",
- "roundtrip": true,
- "decoded": [
- "a",
- {
- "b": "c"
- }
- ]
- },
- {
- "cbor": "pWFhYUFhYmFCYWNhQ2FkYURhZWFF",
- "hex": "a56161614161626142616361436164614461656145",
- "roundtrip": true,
- "decoded": {
- "a": "A",
- "b": "B",
- "c": "C",
- "d": "D",
- "e": "E"
- }
- },
- {
- "cbor": "X0IBAkMDBAX/",
- "hex": "5f42010243030405ff",
- "roundtrip": false,
- "skip": true,
- "diagnostic": "(_ h'0102', h'030405')"
- },
- {
- "cbor": "f2VzdHJlYWRtaW5n/w==",
- "hex": "7f657374726561646d696e67ff",
- "roundtrip": false,
- "decoded": "streaming"
- },
- {
- "cbor": "n/8=",
- "hex": "9fff",
- "roundtrip": false,
- "decoded": [
-
- ]
- },
- {
- "cbor": "nwGCAgOfBAX//w==",
- "hex": "9f018202039f0405ffff",
- "roundtrip": false,
- "decoded": [
- 1,
- [
- 2,
- 3
- ],
- [
- 4,
- 5
- ]
- ]
- },
- {
- "cbor": "nwGCAgOCBAX/",
- "hex": "9f01820203820405ff",
- "roundtrip": false,
- "decoded": [
- 1,
- [
- 2,
- 3
- ],
- [
- 4,
- 5
- ]
- ]
- },
- {
- "cbor": "gwGCAgOfBAX/",
- "hex": "83018202039f0405ff",
- "roundtrip": false,
- "decoded": [
- 1,
- [
- 2,
- 3
- ],
- [
- 4,
- 5
- ]
- ]
- },
- {
- "cbor": "gwGfAgP/ggQF",
- "hex": "83019f0203ff820405",
- "roundtrip": false,
- "decoded": [
- 1,
- [
- 2,
- 3
- ],
- [
- 4,
- 5
- ]
- ]
- },
- {
- "cbor": "nwECAwQFBgcICQoLDA0ODxAREhMUFRYXGBgYGf8=",
- "hex": "9f0102030405060708090a0b0c0d0e0f101112131415161718181819ff",
- "roundtrip": false,
- "decoded": [
- 1,
- 2,
- 3,
- 4,
- 5,
- 6,
- 7,
- 8,
- 9,
- 10,
- 11,
- 12,
- 13,
- 14,
- 15,
- 16,
- 17,
- 18,
- 19,
- 20,
- 21,
- 22,
- 23,
- 24,
- 25
- ]
- },
- {
- "cbor": "v2FhAWFinwID//8=",
- "hex": "bf61610161629f0203ffff",
- "roundtrip": false,
- "decoded": {
- "a": 1,
- "b": [
- 2,
- 3
- ]
- }
- },
- {
- "cbor": "gmFhv2FiYWP/",
- "hex": "826161bf61626163ff",
- "roundtrip": false,
- "decoded": [
- "a",
- {
- "b": "c"
- }
- ]
- },
- {
- "cbor": "v2NGdW71Y0FtdCH/",
- "hex": "bf6346756ef563416d7421ff",
- "roundtrip": false,
- "decoded": {
- "Fun": true,
- "Amt": -2
- }
- }
-]
diff --git a/vendor/github.com/ugorji/go/codec/test.py b/vendor/github.com/ugorji/go/codec/test.py
deleted file mode 100755
index c0ad20b3..00000000
--- a/vendor/github.com/ugorji/go/codec/test.py
+++ /dev/null
@@ -1,126 +0,0 @@
-#!/usr/bin/env python
-
-# This will create golden files in a directory passed to it.
-# A Test calls this internally to create the golden files
-# So it can process them (so we don't have to checkin the files).
-
-# Ensure msgpack-python and cbor are installed first, using:
-# sudo apt-get install python-dev
-# sudo apt-get install python-pip
-# pip install --user msgpack-python msgpack-rpc-python cbor
-
-# Ensure all "string" keys are utf strings (else encoded as bytes)
-
-import cbor, msgpack, msgpackrpc, sys, os, threading
-
-def get_test_data_list():
- # get list with all primitive types, and a combo type
- l0 = [
- -8,
- -1616,
- -32323232,
- -6464646464646464,
- 192,
- 1616,
- 32323232,
- 6464646464646464,
- 192,
- -3232.0,
- -6464646464.0,
- 3232.0,
- 6464.0,
- 6464646464.0,
- False,
- True,
- u"null",
- None,
- u"someday",
- 1328176922000002000,
- u"",
- -2206187877999998000,
- u"bytestring",
- 270,
- u"none",
- -2013855847999995777,
- #-6795364578871345152,
- ]
- l1 = [
- { "true": True,
- "false": False },
- { "true": u"True",
- "false": False,
- "uint16(1616)": 1616 },
- { "list": [1616, 32323232, True, -3232.0, {"TRUE":True, "FALSE":False}, [True, False] ],
- "int32":32323232, "bool": True,
- "LONG STRING": u"123456789012345678901234567890123456789012345678901234567890",
- "SHORT STRING": u"1234567890" },
- { True: "true", 138: False, "false": 200 }
- ]
-
- l = []
- l.extend(l0)
- l.append(l0)
- l.append(1)
- l.extend(l1)
- return l
-
-def build_test_data(destdir):
- l = get_test_data_list()
- for i in range(len(l)):
- # packer = msgpack.Packer()
- serialized = msgpack.dumps(l[i])
- f = open(os.path.join(destdir, str(i) + '.msgpack.golden'), 'wb')
- f.write(serialized)
- f.close()
- serialized = cbor.dumps(l[i])
- f = open(os.path.join(destdir, str(i) + '.cbor.golden'), 'wb')
- f.write(serialized)
- f.close()
-
-def doRpcServer(port, stopTimeSec):
- class EchoHandler(object):
- def Echo123(self, msg1, msg2, msg3):
- return ("1:%s 2:%s 3:%s" % (msg1, msg2, msg3))
- def EchoStruct(self, msg):
- return ("%s" % msg)
-
- addr = msgpackrpc.Address('localhost', port)
- server = msgpackrpc.Server(EchoHandler())
- server.listen(addr)
- # run thread to stop it after stopTimeSec seconds if > 0
- if stopTimeSec > 0:
- def myStopRpcServer():
- server.stop()
- t = threading.Timer(stopTimeSec, myStopRpcServer)
- t.start()
- server.start()
-
-def doRpcClientToPythonSvc(port):
- address = msgpackrpc.Address('localhost', port)
- client = msgpackrpc.Client(address, unpack_encoding='utf-8')
- print client.call("Echo123", "A1", "B2", "C3")
- print client.call("EchoStruct", {"A" :"Aa", "B":"Bb", "C":"Cc"})
-
-def doRpcClientToGoSvc(port):
- # print ">>>> port: ", port, " <<<<<"
- address = msgpackrpc.Address('localhost', port)
- client = msgpackrpc.Client(address, unpack_encoding='utf-8')
- print client.call("TestRpcInt.Echo123", ["A1", "B2", "C3"])
- print client.call("TestRpcInt.EchoStruct", {"A" :"Aa", "B":"Bb", "C":"Cc"})
-
-def doMain(args):
- if len(args) == 2 and args[0] == "testdata":
- build_test_data(args[1])
- elif len(args) == 3 and args[0] == "rpc-server":
- doRpcServer(int(args[1]), int(args[2]))
- elif len(args) == 2 and args[0] == "rpc-client-python-service":
- doRpcClientToPythonSvc(int(args[1]))
- elif len(args) == 2 and args[0] == "rpc-client-go-service":
- doRpcClientToGoSvc(int(args[1]))
- else:
- print("Usage: test.py " +
- "[testdata|rpc-server|rpc-client-python-service|rpc-client-go-service] ...")
-
-if __name__ == "__main__":
- doMain(sys.argv[1:])
-
diff --git a/vendor/github.com/ugorji/go/codec/tests.sh b/vendor/github.com/ugorji/go/codec/tests.sh
deleted file mode 100755
index 00857b62..00000000
--- a/vendor/github.com/ugorji/go/codec/tests.sh
+++ /dev/null
@@ -1,80 +0,0 @@
-#!/bin/bash
-
-# Run all the different permutations of all the tests.
-# This helps ensure that nothing gets broken.
-
-_run() {
- # 1. VARIATIONS: regular (t), canonical (c), IO R/W (i),
- # binc-nosymbols (n), struct2array (s), intern string (e),
- # json-indent (d), circular (l)
- # 2. MODE: reflection (r), external (x), codecgen (g), unsafe (u), notfastpath (f)
- # 3. OPTIONS: verbose (v), reset (z), must (m),
- #
- # Use combinations of mode to get exactly what you want,
- # and then pass the variations you need.
-
- ztags=""
- zargs=""
- local OPTIND
- OPTIND=1
- while getopts "_xurtcinsvgzmefdl" flag
- do
- case "x$flag" in
- 'xr') ;;
- 'xf') ztags="$ztags notfastpath" ;;
- 'xg') ztags="$ztags codecgen" ;;
- 'xx') ztags="$ztags x" ;;
- 'xu') ztags="$ztags unsafe" ;;
- 'xv') zargs="$zargs -tv" ;;
- 'xz') zargs="$zargs -tr" ;;
- 'xm') zargs="$zargs -tm" ;;
- 'xl') zargs="$zargs -tl" ;;
- *) ;;
- esac
- done
- # shift $((OPTIND-1))
- printf '............. TAGS: %s .............\n' "$ztags"
- # echo ">>>>>>> TAGS: $ztags"
-
- OPTIND=1
- while getopts "_xurtcinsvgzmefdl" flag
- do
- case "x$flag" in
- 'xt') printf ">>>>>>> REGULAR : "; go test "-tags=$ztags" $zargs ; sleep 2 ;;
- 'xc') printf ">>>>>>> CANONICAL : "; go test "-tags=$ztags" $zargs -tc; sleep 2 ;;
- 'xi') printf ">>>>>>> I/O : "; go test "-tags=$ztags" $zargs -ti; sleep 2 ;;
- 'xn') printf ">>>>>>> NO_SYMBOLS : "; go test "-tags=$ztags" -run=Binc $zargs -tn; sleep 2 ;;
- 'xs') printf ">>>>>>> TO_ARRAY : "; go test "-tags=$ztags" $zargs -ts; sleep 2 ;;
- 'xe') printf ">>>>>>> INTERN : "; go test "-tags=$ztags" $zargs -te; sleep 2 ;;
- 'xd') printf ">>>>>>> INDENT : ";
- go test "-tags=$ztags" -run=JsonCodecsTable -td=-1 $zargs;
- go test "-tags=$ztags" -run=JsonCodecsTable -td=8 $zargs;
- sleep 2 ;;
- *) ;;
- esac
- done
- shift $((OPTIND-1))
-
- OPTIND=1
-}
-
-# echo ">>>>>>> RUNNING VARIATIONS OF TESTS"
-if [[ "x$@" = "x" ]]; then
- # All: r, x, g, gu
- _run "-_tcinsed_ml" # regular
- _run "-_tcinsed_ml_z" # regular with reset
- _run "-_tcinsed_ml_f" # regular with no fastpath (notfastpath)
- _run "-x_tcinsed_ml" # external
- _run "-gx_tcinsed_ml" # codecgen: requires external
- _run "-gxu_tcinsed_ml" # codecgen + unsafe
-elif [[ "x$@" = "x-Z" ]]; then
- # Regular
- _run "-_tcinsed_ml" # regular
- _run "-_tcinsed_ml_z" # regular with reset
-elif [[ "x$@" = "x-F" ]]; then
- # regular with notfastpath
- _run "-_tcinsed_ml_f" # regular
- _run "-_tcinsed_ml_zf" # regular with reset
-else
- _run "$@"
-fi
diff --git a/vendor/github.com/ugorji/go/codec/time.go b/vendor/github.com/ugorji/go/codec/time.go
deleted file mode 100644
index 718b731e..00000000
--- a/vendor/github.com/ugorji/go/codec/time.go
+++ /dev/null
@@ -1,233 +0,0 @@
-// Copyright (c) 2012-2015 Ugorji Nwoke. All rights reserved.
-// Use of this source code is governed by a MIT license found in the LICENSE file.
-
-package codec
-
-import (
- "fmt"
- "reflect"
- "time"
-)
-
-var (
- timeDigits = [...]byte{'0', '1', '2', '3', '4', '5', '6', '7', '8', '9'}
- timeExtEncFn = func(rv reflect.Value) (bs []byte, err error) {
- defer panicToErr(&err)
- bs = timeExt{}.WriteExt(rv.Interface())
- return
- }
- timeExtDecFn = func(rv reflect.Value, bs []byte) (err error) {
- defer panicToErr(&err)
- timeExt{}.ReadExt(rv.Interface(), bs)
- return
- }
-)
-
-type timeExt struct{}
-
-func (x timeExt) WriteExt(v interface{}) (bs []byte) {
- switch v2 := v.(type) {
- case time.Time:
- bs = encodeTime(v2)
- case *time.Time:
- bs = encodeTime(*v2)
- default:
- panic(fmt.Errorf("unsupported format for time conversion: expecting time.Time; got %T", v2))
- }
- return
-}
-func (x timeExt) ReadExt(v interface{}, bs []byte) {
- tt, err := decodeTime(bs)
- if err != nil {
- panic(err)
- }
- *(v.(*time.Time)) = tt
-}
-
-func (x timeExt) ConvertExt(v interface{}) interface{} {
- return x.WriteExt(v)
-}
-func (x timeExt) UpdateExt(v interface{}, src interface{}) {
- x.ReadExt(v, src.([]byte))
-}
-
-// EncodeTime encodes a time.Time as a []byte, including
-// information on the instant in time and UTC offset.
-//
-// Format Description
-//
-// A timestamp is composed of 3 components:
-//
-// - secs: signed integer representing seconds since unix epoch
-// - nsces: unsigned integer representing fractional seconds as a
-// nanosecond offset within secs, in the range 0 <= nsecs < 1e9
-// - tz: signed integer representing timezone offset in minutes east of UTC,
-// and a dst (daylight savings time) flag
-//
-// When encoding a timestamp, the first byte is the descriptor, which
-// defines which components are encoded and how many bytes are used to
-// encode secs and nsecs components. *If secs/nsecs is 0 or tz is UTC, it
-// is not encoded in the byte array explicitly*.
-//
-// Descriptor 8 bits are of the form `A B C DDD EE`:
-// A: Is secs component encoded? 1 = true
-// B: Is nsecs component encoded? 1 = true
-// C: Is tz component encoded? 1 = true
-// DDD: Number of extra bytes for secs (range 0-7).
-// If A = 1, secs encoded in DDD+1 bytes.
-// If A = 0, secs is not encoded, and is assumed to be 0.
-// If A = 1, then we need at least 1 byte to encode secs.
-// DDD says the number of extra bytes beyond that 1.
-// E.g. if DDD=0, then secs is represented in 1 byte.
-// if DDD=2, then secs is represented in 3 bytes.
-// EE: Number of extra bytes for nsecs (range 0-3).
-// If B = 1, nsecs encoded in EE+1 bytes (similar to secs/DDD above)
-//
-// Following the descriptor bytes, subsequent bytes are:
-//
-// secs component encoded in `DDD + 1` bytes (if A == 1)
-// nsecs component encoded in `EE + 1` bytes (if B == 1)
-// tz component encoded in 2 bytes (if C == 1)
-//
-// secs and nsecs components are integers encoded in a BigEndian
-// 2-complement encoding format.
-//
-// tz component is encoded as 2 bytes (16 bits). Most significant bit 15 to
-// Least significant bit 0 are described below:
-//
-// Timezone offset has a range of -12:00 to +14:00 (ie -720 to +840 minutes).
-// Bit 15 = have\_dst: set to 1 if we set the dst flag.
-// Bit 14 = dst\_on: set to 1 if dst is in effect at the time, or 0 if not.
-// Bits 13..0 = timezone offset in minutes. It is a signed integer in Big Endian format.
-//
-func encodeTime(t time.Time) []byte {
- //t := rv.Interface().(time.Time)
- tsecs, tnsecs := t.Unix(), t.Nanosecond()
- var (
- bd byte
- btmp [8]byte
- bs [16]byte
- i int = 1
- )
- l := t.Location()
- if l == time.UTC {
- l = nil
- }
- if tsecs != 0 {
- bd = bd | 0x80
- bigen.PutUint64(btmp[:], uint64(tsecs))
- f := pruneSignExt(btmp[:], tsecs >= 0)
- bd = bd | (byte(7-f) << 2)
- copy(bs[i:], btmp[f:])
- i = i + (8 - f)
- }
- if tnsecs != 0 {
- bd = bd | 0x40
- bigen.PutUint32(btmp[:4], uint32(tnsecs))
- f := pruneSignExt(btmp[:4], true)
- bd = bd | byte(3-f)
- copy(bs[i:], btmp[f:4])
- i = i + (4 - f)
- }
- if l != nil {
- bd = bd | 0x20
- // Note that Go Libs do not give access to dst flag.
- _, zoneOffset := t.Zone()
- //zoneName, zoneOffset := t.Zone()
- zoneOffset /= 60
- z := uint16(zoneOffset)
- bigen.PutUint16(btmp[:2], z)
- // clear dst flags
- bs[i] = btmp[0] & 0x3f
- bs[i+1] = btmp[1]
- i = i + 2
- }
- bs[0] = bd
- return bs[0:i]
-}
-
-// DecodeTime decodes a []byte into a time.Time.
-func decodeTime(bs []byte) (tt time.Time, err error) {
- bd := bs[0]
- var (
- tsec int64
- tnsec uint32
- tz uint16
- i byte = 1
- i2 byte
- n byte
- )
- if bd&(1<<7) != 0 {
- var btmp [8]byte
- n = ((bd >> 2) & 0x7) + 1
- i2 = i + n
- copy(btmp[8-n:], bs[i:i2])
- //if first bit of bs[i] is set, then fill btmp[0..8-n] with 0xff (ie sign extend it)
- if bs[i]&(1<<7) != 0 {
- copy(btmp[0:8-n], bsAll0xff)
- //for j,k := byte(0), 8-n; j < k; j++ { btmp[j] = 0xff }
- }
- i = i2
- tsec = int64(bigen.Uint64(btmp[:]))
- }
- if bd&(1<<6) != 0 {
- var btmp [4]byte
- n = (bd & 0x3) + 1
- i2 = i + n
- copy(btmp[4-n:], bs[i:i2])
- i = i2
- tnsec = bigen.Uint32(btmp[:])
- }
- if bd&(1<<5) == 0 {
- tt = time.Unix(tsec, int64(tnsec)).UTC()
- return
- }
- // In stdlib time.Parse, when a date is parsed without a zone name, it uses "" as zone name.
- // However, we need name here, so it can be shown when time is printed.
- // Zone name is in form: UTC-08:00.
- // Note that Go Libs do not give access to dst flag, so we ignore dst bits
-
- i2 = i + 2
- tz = bigen.Uint16(bs[i:i2])
- i = i2
- // sign extend sign bit into top 2 MSB (which were dst bits):
- if tz&(1<<13) == 0 { // positive
- tz = tz & 0x3fff //clear 2 MSBs: dst bits
- } else { // negative
- tz = tz | 0xc000 //set 2 MSBs: dst bits
- //tzname[3] = '-' (TODO: verify. this works here)
- }
- tzint := int16(tz)
- if tzint == 0 {
- tt = time.Unix(tsec, int64(tnsec)).UTC()
- } else {
- // For Go Time, do not use a descriptive timezone.
- // It's unnecessary, and makes it harder to do a reflect.DeepEqual.
- // The Offset already tells what the offset should be, if not on UTC and unknown zone name.
- // var zoneName = timeLocUTCName(tzint)
- tt = time.Unix(tsec, int64(tnsec)).In(time.FixedZone("", int(tzint)*60))
- }
- return
-}
-
-func timeLocUTCName(tzint int16) string {
- if tzint == 0 {
- return "UTC"
- }
- var tzname = []byte("UTC+00:00")
- //tzname := fmt.Sprintf("UTC%s%02d:%02d", tzsign, tz/60, tz%60) //perf issue using Sprintf. inline below.
- //tzhr, tzmin := tz/60, tz%60 //faster if u convert to int first
- var tzhr, tzmin int16
- if tzint < 0 {
- tzname[3] = '-' // (TODO: verify. this works here)
- tzhr, tzmin = -tzint/60, (-tzint)%60
- } else {
- tzhr, tzmin = tzint/60, tzint%60
- }
- tzname[4] = timeDigits[tzhr/10]
- tzname[5] = timeDigits[tzhr%10]
- tzname[7] = timeDigits[tzmin/10]
- tzname[8] = timeDigits[tzmin%10]
- return string(tzname)
- //return time.FixedZone(string(tzname), int(tzint)*60)
-}
diff --git a/vendor/github.com/xenserver/go-xenserver-client/.travis.yml b/vendor/github.com/xenserver/go-xenserver-client/.travis.yml
deleted file mode 100644
index 3463e713..00000000
--- a/vendor/github.com/xenserver/go-xenserver-client/.travis.yml
+++ /dev/null
@@ -1,7 +0,0 @@
-language: go
-go:
- # Test with the first and the latest go release - to ensure compatibility
- - 1
- - release
-script:
- - gofmtresult=$(gofmt -s -l .); if [[ -n $gofmtresult ]]; then echo -e "Please run \"gofmt -s -w .\" before committing for the below:\n$gofmtresult"; false; fi
diff --git a/vendor/github.com/xenserver/go-xenserver-client/LICENCE b/vendor/github.com/xenserver/go-xenserver-client/LICENCE
deleted file mode 100644
index 931927e8..00000000
--- a/vendor/github.com/xenserver/go-xenserver-client/LICENCE
+++ /dev/null
@@ -1,10 +0,0 @@
-Copyright (c) 2015, Citrix Systems Inc.
-All rights reserved.
-
-Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
-
-1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
-
-2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
-
-THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
diff --git a/vendor/github.com/xenserver/go-xenserver-client/README.md b/vendor/github.com/xenserver/go-xenserver-client/README.md
deleted file mode 100644
index b5380e87..00000000
--- a/vendor/github.com/xenserver/go-xenserver-client/README.md
+++ /dev/null
@@ -1,25 +0,0 @@
-[![Build Status](https://travis-ci.org/xenserver/go-xenserver-client.svg?branch=master)](https://travis-ci.org/xenserver/go-xenserver-client)
-
-go-xenserver-client
-===================
-
-This is the beginnings of a golang client library for XenAPI.
-
-
-Disclaimer!
------------
-Please note that this library is currently **experimental** and only
-enables a limited subset of XenAPI's interface.
-
-As with any early beginnings of a project, the interfaces are also subject to
-change, so please beware!
-
-And of course, contributions are most welcome!
-
-
-
-
-
-
-
-
diff --git a/vendor/github.com/xenserver/go-xenserver-client/client.go b/vendor/github.com/xenserver/go-xenserver-client/client.go
deleted file mode 100644
index 91ea6e77..00000000
--- a/vendor/github.com/xenserver/go-xenserver-client/client.go
+++ /dev/null
@@ -1,376 +0,0 @@
-package client
-
-import (
- "errors"
- "fmt"
- log "github.com/Sirupsen/logrus"
- "github.com/nilshell/xmlrpc"
-)
-
-type XenAPIClient struct {
- Session interface{}
- Host string
- Url string
- Username string
- Password string
- RPC *xmlrpc.Client
-}
-
-type APIResult struct {
- Status string
- Value interface{}
- ErrorDescription string
-}
-
-type XenAPIObject struct {
- Ref string
- Client *XenAPIClient
-}
-
-func (c *XenAPIClient) RPCCall(result interface{}, method string, params []interface{}) (err error) {
- log.Debugf("RPCCall method=%v params=%v\n", method, params)
- p := new(xmlrpc.Params)
- p.Params = params
- err = c.RPC.Call(method, *p, result)
- return err
-}
-
-func (client *XenAPIClient) Login() (err error) {
- //Do loging call
- result := xmlrpc.Struct{}
-
- params := make([]interface{}, 2)
- params[0] = client.Username
- params[1] = client.Password
-
- err = client.RPCCall(&result, "session.login_with_password", params)
- if err == nil {
- // err might not be set properly, so check the reference
- if result["Value"] == nil {
- return errors.New("Invalid credentials supplied")
- }
- }
- client.Session = result["Value"]
- return err
-}
-
-func (client *XenAPIClient) APICall(result *APIResult, method string, params ...interface{}) (err error) {
- if client.Session == nil {
- log.Errorf("no session\n")
- return fmt.Errorf("No session. Unable to make call")
- }
-
- //Make a params slice which will include the session
- p := make([]interface{}, len(params)+1)
- p[0] = client.Session
-
- if params != nil {
- for idx, element := range params {
- p[idx+1] = element
- }
- }
-
- res := xmlrpc.Struct{}
-
- err = client.RPCCall(&res, method, p)
-
- if err != nil {
- return err
- }
-
- result.Status = res["Status"].(string)
-
- if result.Status != "Success" {
- log.Errorf("Encountered an API error: %v %v", result.Status, res["ErrorDescription"])
- return fmt.Errorf("API Error: %s", res["ErrorDescription"])
- } else {
- result.Value = res["Value"]
- }
- return
-}
-
-func (client *XenAPIClient) GetHosts() (hosts []*Host, err error) {
- hosts = make([]*Host, 0)
- result := APIResult{}
- err = client.APICall(&result, "host.get_all")
- if err != nil {
- return hosts, err
- }
- for _, elem := range result.Value.([]interface{}) {
- host := new(Host)
- host.Ref = elem.(string)
- host.Client = client
- hosts = append(hosts, host)
- }
- return hosts, nil
-}
-
-func (client *XenAPIClient) GetPools() (pools []*Pool, err error) {
- pools = make([]*Pool, 0)
- result := APIResult{}
- err = client.APICall(&result, "pool.get_all")
- if err != nil {
- return pools, err
- }
-
- for _, elem := range result.Value.([]interface{}) {
- pool := new(Pool)
- pool.Ref = elem.(string)
- pool.Client = client
- pools = append(pools, pool)
- }
-
- return pools, nil
-}
-
-func (client *XenAPIClient) GetDefaultSR() (sr *SR, err error) {
- pools, err := client.GetPools()
-
- if err != nil {
- return nil, err
- }
-
- pool_rec, err := pools[0].GetRecord()
-
- if err != nil {
- return nil, err
- }
-
- if pool_rec["default_SR"] == "" {
- return nil, errors.New("No default_SR specified for the pool.")
- }
-
- sr = new(SR)
- sr.Ref = pool_rec["default_SR"].(string)
- sr.Client = client
-
- return sr, nil
-}
-
-func (client *XenAPIClient) GetVMByUuid(vm_uuid string) (vm *VM, err error) {
- vm = new(VM)
- result := APIResult{}
- err = client.APICall(&result, "VM.get_by_uuid", vm_uuid)
- if err != nil {
- return nil, err
- }
- vm.Ref = result.Value.(string)
- vm.Client = client
- return
-}
-
-func (client *XenAPIClient) GetHostByUuid(host_uuid string) (host *Host, err error) {
- host = new(Host)
- result := APIResult{}
- err = client.APICall(&result, "host.get_by_uuid", host_uuid)
- if err != nil {
- return nil, err
- }
- host.Ref = result.Value.(string)
- host.Client = client
- return
-}
-
-func (client *XenAPIClient) GetVMByNameLabel(name_label string) (vms []*VM, err error) {
- vms = make([]*VM, 0)
- result := APIResult{}
- err = client.APICall(&result, "VM.get_by_name_label", name_label)
- if err != nil {
- return vms, err
- }
-
- for _, elem := range result.Value.([]interface{}) {
- vm := new(VM)
- vm.Ref = elem.(string)
- vm.Client = client
- vms = append(vms, vm)
- }
-
- return vms, nil
-}
-
-func (client *XenAPIClient) GetHostByNameLabel(name_label string) (hosts []*Host, err error) {
- hosts = make([]*Host, 0)
- result := APIResult{}
- err = client.APICall(&result, "host.get_by_name_label", name_label)
- if err != nil {
- return hosts, err
- }
-
- for _, elem := range result.Value.([]interface{}) {
- host := new(Host)
- host.Ref = elem.(string)
- host.Client = client
- hosts = append(hosts, host)
- }
-
- return hosts, nil
-}
-
-func (client *XenAPIClient) GetSRByNameLabel(name_label string) (srs []*SR, err error) {
- srs = make([]*SR, 0)
- result := APIResult{}
- err = client.APICall(&result, "SR.get_by_name_label", name_label)
- if err != nil {
- return srs, err
- }
-
- for _, elem := range result.Value.([]interface{}) {
- sr := new(SR)
- sr.Ref = elem.(string)
- sr.Client = client
- srs = append(srs, sr)
- }
-
- return srs, nil
-}
-
-func (client *XenAPIClient) GetNetworks() (networks []*Network, err error) {
- networks = make([]*Network, 0)
- result := APIResult{}
- err = client.APICall(&result, "network.get_all")
- if err != nil {
- return nil, err
- }
-
- for _, elem := range result.Value.([]interface{}) {
- network := new(Network)
- network.Ref = elem.(string)
- network.Client = client
- networks = append(networks, network)
- }
-
- return networks, nil
-}
-
-func (client *XenAPIClient) GetNetworkByUuid(network_uuid string) (network *Network, err error) {
- network = new(Network)
- result := APIResult{}
- err = client.APICall(&result, "network.get_by_uuid", network_uuid)
- if err != nil {
- return nil, err
- }
- network.Ref = result.Value.(string)
- network.Client = client
- return
-}
-
-func (client *XenAPIClient) GetNetworkByNameLabel(name_label string) (networks []*Network, err error) {
- networks = make([]*Network, 0)
- result := APIResult{}
- err = client.APICall(&result, "network.get_by_name_label", name_label)
- if err != nil {
- return networks, err
- }
-
- for _, elem := range result.Value.([]interface{}) {
- network := new(Network)
- network.Ref = elem.(string)
- network.Client = client
- networks = append(networks, network)
- }
-
- return networks, nil
-}
-
-func (client *XenAPIClient) GetVdiByNameLabel(name_label string) (vdis []*VDI, err error) {
- vdis = make([]*VDI, 0)
- result := APIResult{}
- err = client.APICall(&result, "VDI.get_by_name_label", name_label)
- if err != nil {
- return vdis, err
- }
-
- for _, elem := range result.Value.([]interface{}) {
- vdi := new(VDI)
- vdi.Ref = elem.(string)
- vdi.Client = client
- vdis = append(vdis, vdi)
- }
-
- return vdis, nil
-}
-
-func (client *XenAPIClient) GetSRByUuid(sr_uuid string) (sr *SR, err error) {
- sr = new(SR)
- result := APIResult{}
- err = client.APICall(&result, "SR.get_by_uuid", sr_uuid)
- if err != nil {
- return nil, err
- }
- sr.Ref = result.Value.(string)
- sr.Client = client
- return
-}
-
-func (client *XenAPIClient) GetVdiByUuid(vdi_uuid string) (vdi *VDI, err error) {
- vdi = new(VDI)
- result := APIResult{}
- err = client.APICall(&result, "VDI.get_by_uuid", vdi_uuid)
- if err != nil {
- return nil, err
- }
- vdi.Ref = result.Value.(string)
- vdi.Client = client
- return
-}
-
-func (client *XenAPIClient) GetPIFs() (pifs []*PIF, err error) {
- pifs = make([]*PIF, 0)
- result := APIResult{}
- err = client.APICall(&result, "PIF.get_all")
- if err != nil {
- return pifs, err
- }
- for _, elem := range result.Value.([]interface{}) {
- pif := new(PIF)
- pif.Ref = elem.(string)
- pif.Client = client
- pifs = append(pifs, pif)
- }
-
- return pifs, nil
-}
-
-func (client *XenAPIClient) CreateTask() (task *Task, err error) {
- result := APIResult{}
- err = client.APICall(&result, "task.create", "packer-task", "Packer task")
-
- if err != nil {
- return
- }
-
- task = new(Task)
- task.Ref = result.Value.(string)
- task.Client = client
- return
-}
-
-func (client *XenAPIClient) CreateNetwork(name_label string, name_description string, bridge string) (network *Network, err error) {
- network = new(Network)
-
- net_rec := make(xmlrpc.Struct)
- net_rec["name_label"] = name_label
- net_rec["name_description"] = name_description
- net_rec["bridge"] = bridge
- net_rec["other_config"] = make(xmlrpc.Struct)
-
- result := APIResult{}
- err = client.APICall(&result, "network.create", net_rec)
- if err != nil {
- return nil, err
- }
- network.Ref = result.Value.(string)
- network.Client = client
-
- return network, nil
-}
-
-func NewXenAPIClient(host, username, password string) (client XenAPIClient) {
- client.Host = host
- client.Url = "http://" + host
- client.Username = username
- client.Password = password
- client.RPC, _ = xmlrpc.NewClient(client.Url, nil)
- return
-}
diff --git a/vendor/github.com/xenserver/go-xenserver-client/host.go b/vendor/github.com/xenserver/go-xenserver-client/host.go
deleted file mode 100644
index 71c75657..00000000
--- a/vendor/github.com/xenserver/go-xenserver-client/host.go
+++ /dev/null
@@ -1,46 +0,0 @@
-package client
-
-import (
- "github.com/nilshell/xmlrpc"
-)
-
-type Host XenAPIObject
-
-func (self *Host) CallPlugin(plugin, method string, params map[string]string) (response string, err error) {
- result := APIResult{}
- params_rec := make(xmlrpc.Struct)
- for key, value := range params {
- params_rec[key] = value
- }
- err = self.Client.APICall(&result, "host.call_plugin", self.Ref, plugin, method, params_rec)
- if err != nil {
- return "", err
- }
- response = result.Value.(string)
- return
-}
-
-func (self *Host) GetAddress() (address string, err error) {
- result := APIResult{}
- err = self.Client.APICall(&result, "host.get_address", self.Ref)
- if err != nil {
- return "", err
- }
- address = result.Value.(string)
- return address, nil
-}
-
-func (self *Host) GetSoftwareVersion() (versions map[string]interface{}, err error) {
- versions = make(map[string]interface{})
-
- result := APIResult{}
- err = self.Client.APICall(&result, "host.get_software_version", self.Ref)
- if err != nil {
- return nil, err
- }
-
- for k, v := range result.Value.(xmlrpc.Struct) {
- versions[k] = v.(string)
- }
- return
-}
diff --git a/vendor/github.com/xenserver/go-xenserver-client/network.go b/vendor/github.com/xenserver/go-xenserver-client/network.go
deleted file mode 100644
index 9d13d3d0..00000000
--- a/vendor/github.com/xenserver/go-xenserver-client/network.go
+++ /dev/null
@@ -1,52 +0,0 @@
-package client
-
-import (
- "github.com/nilshell/xmlrpc"
-)
-
-type Network XenAPIObject
-
-func (self *Network) GetAssignedIPs() (ipMap map[string]string, err error) {
- ipMap = make(map[string]string, 0)
- result := APIResult{}
- err = self.Client.APICall(&result, "network.get_assigned_ips", self.Ref)
- if err != nil {
- return ipMap, err
- }
- for k, v := range result.Value.(xmlrpc.Struct) {
- ipMap[k] = v.(string)
- }
- return ipMap, nil
-}
-
-func (self *Network) GetOtherConfig() (otherConfig map[string]string, err error) {
- otherConfig = make(map[string]string, 0)
- result := APIResult{}
- err = self.Client.APICall(&result, "network.get_other_config", self.Ref)
- if err != nil {
- return otherConfig, err
- }
- for k, v := range result.Value.(xmlrpc.Struct) {
- otherConfig[k] = v.(string)
- }
- return otherConfig, nil
-}
-
-func (self *Network) IsHostInternalManagementNetwork() (isHostInternalManagementNetwork bool, err error) {
- other_config, err := self.GetOtherConfig()
- if err != nil {
- return false, nil
- }
- value, ok := other_config["is_host_internal_management_network"]
- isHostInternalManagementNetwork = ok && value == "true"
- return isHostInternalManagementNetwork, nil
-}
-
-func (self *Network) Destroy() (err error) {
- result := APIResult{}
- err = self.Client.APICall(&result, "network.destroy", self.Ref)
- if err != nil {
- return err
- }
- return
-}
diff --git a/vendor/github.com/xenserver/go-xenserver-client/pif.go b/vendor/github.com/xenserver/go-xenserver-client/pif.go
deleted file mode 100644
index fef206b6..00000000
--- a/vendor/github.com/xenserver/go-xenserver-client/pif.go
+++ /dev/null
@@ -1,20 +0,0 @@
-package client
-
-import (
- "github.com/nilshell/xmlrpc"
-)
-
-type PIF XenAPIObject
-
-func (self *PIF) GetRecord() (record map[string]interface{}, err error) {
- record = make(map[string]interface{})
- result := APIResult{}
- err = self.Client.APICall(&result, "PIF.get_record", self.Ref)
- if err != nil {
- return record, err
- }
- for k, v := range result.Value.(xmlrpc.Struct) {
- record[k] = v
- }
- return record, nil
-}
diff --git a/vendor/github.com/xenserver/go-xenserver-client/pool.go b/vendor/github.com/xenserver/go-xenserver-client/pool.go
deleted file mode 100644
index a49f1524..00000000
--- a/vendor/github.com/xenserver/go-xenserver-client/pool.go
+++ /dev/null
@@ -1,32 +0,0 @@
-package client
-
-import (
- "github.com/nilshell/xmlrpc"
-)
-
-type Pool XenAPIObject
-
-func (self *Pool) GetMaster() (host *Host, err error) {
- result := APIResult{}
- err = self.Client.APICall(&result, "pool.get_master", self.Ref)
- if err != nil {
- return nil, err
- }
- host = new(Host)
- host.Ref = result.Value.(string)
- host.Client = self.Client
- return host, nil
-}
-
-func (self *Pool) GetRecord() (record map[string]interface{}, err error) {
- record = make(map[string]interface{})
- result := APIResult{}
- err = self.Client.APICall(&result, "pool.get_record", self.Ref)
- if err != nil {
- return record, err
- }
- for k, v := range result.Value.(xmlrpc.Struct) {
- record[k] = v
- }
- return record, nil
-}
diff --git a/vendor/github.com/xenserver/go-xenserver-client/sr.go b/vendor/github.com/xenserver/go-xenserver-client/sr.go
deleted file mode 100644
index c6ba9f14..00000000
--- a/vendor/github.com/xenserver/go-xenserver-client/sr.go
+++ /dev/null
@@ -1,45 +0,0 @@
-package client
-
-import (
- "fmt"
- "github.com/nilshell/xmlrpc"
-)
-
-type SR XenAPIObject
-
-func (self *SR) GetUuid() (uuid string, err error) {
- result := APIResult{}
- err = self.Client.APICall(&result, "SR.get_uuid", self.Ref)
- if err != nil {
- return "", err
- }
- uuid = result.Value.(string)
- return uuid, nil
-}
-
-func (self *SR) CreateVdi(name_label string, size int64) (vdi *VDI, err error) {
- vdi = new(VDI)
-
- vdi_rec := make(xmlrpc.Struct)
- vdi_rec["name_label"] = name_label
- vdi_rec["SR"] = self.Ref
- vdi_rec["virtual_size"] = fmt.Sprintf("%d", size)
- vdi_rec["type"] = "user"
- vdi_rec["sharable"] = false
- vdi_rec["read_only"] = false
-
- oc := make(xmlrpc.Struct)
- oc["temp"] = "temp"
- vdi_rec["other_config"] = oc
-
- result := APIResult{}
- err = self.Client.APICall(&result, "VDI.create", vdi_rec)
- if err != nil {
- return nil, err
- }
-
- vdi.Ref = result.Value.(string)
- vdi.Client = self.Client
-
- return
-}
diff --git a/vendor/github.com/xenserver/go-xenserver-client/task.go b/vendor/github.com/xenserver/go-xenserver-client/task.go
deleted file mode 100644
index 487865d9..00000000
--- a/vendor/github.com/xenserver/go-xenserver-client/task.go
+++ /dev/null
@@ -1,101 +0,0 @@
-package client
-
-import (
- "fmt"
- "regexp"
- "strings"
-)
-
-type Task XenAPIObject
-
-type TaskStatusType int
-
-const (
- _ TaskStatusType = iota
- Pending
- Success
- Failure
- Cancelling
- Cancelled
-)
-
-func (self *Task) GetStatus() (status TaskStatusType, err error) {
- result := APIResult{}
- err = self.Client.APICall(&result, "task.get_status", self.Ref)
- if err != nil {
- return
- }
- rawStatus := result.Value.(string)
- switch strings.ToLower(rawStatus) {
- case "pending":
- status = Pending
- case "success":
- status = Success
- case "failure":
- status = Failure
- case "cancelling":
- status = Cancelling
- case "cancelled":
- status = Cancelled
- default:
- panic(fmt.Sprintf("Task.get_status: Unknown status '%s'", rawStatus))
- }
- return
-}
-
-func (self *Task) GetProgress() (progress float64, err error) {
- result := APIResult{}
- err = self.Client.APICall(&result, "task.get_progress", self.Ref)
- if err != nil {
- return
- }
- progress = result.Value.(float64)
- return
-}
-
-func (self *Task) GetResult() (object *XenAPIObject, err error) {
- result := APIResult{}
- err = self.Client.APICall(&result, "task.get_result", self.Ref)
- if err != nil {
- return
- }
- switch ref := result.Value.(type) {
- case string:
- // @fixme: xapi currently sends us an xmlrpc-encoded string via xmlrpc.
- // This seems to be a bug in xapi. Remove this workaround when it's fixed
- re := regexp.MustCompile("^([^<]*).*$")
- match := re.FindStringSubmatch(ref)
- if match == nil {
- object = nil
- } else {
- object = &XenAPIObject{
- Ref: match[1],
- Client: self.Client,
- }
- }
- case nil:
- object = nil
- default:
- err = fmt.Errorf("task.get_result: unknown value type %T (expected string or nil)", ref)
- }
- return
-}
-
-func (self *Task) GetErrorInfo() (errorInfo []string, err error) {
- result := APIResult{}
- err = self.Client.APICall(&result, "task.get_error_info", self.Ref)
- if err != nil {
- return
- }
- errorInfo = make([]string, 0)
- for _, infoRaw := range result.Value.([]interface{}) {
- errorInfo = append(errorInfo, fmt.Sprintf("%v", infoRaw))
- }
- return
-}
-
-func (self *Task) Destroy() (err error) {
- result := APIResult{}
- err = self.Client.APICall(&result, "task.destroy", self.Ref)
- return
-}
diff --git a/vendor/github.com/xenserver/go-xenserver-client/vbd.go b/vendor/github.com/xenserver/go-xenserver-client/vbd.go
deleted file mode 100644
index 3c666bf5..00000000
--- a/vendor/github.com/xenserver/go-xenserver-client/vbd.go
+++ /dev/null
@@ -1,60 +0,0 @@
-package client
-
-import (
- "github.com/nilshell/xmlrpc"
-)
-
-type VBD XenAPIObject
-
-func (self *VBD) GetRecord() (record map[string]interface{}, err error) {
- record = make(map[string]interface{})
- result := APIResult{}
- err = self.Client.APICall(&result, "VBD.get_record", self.Ref)
- if err != nil {
- return record, err
- }
- for k, v := range result.Value.(xmlrpc.Struct) {
- record[k] = v
- }
- return record, nil
-}
-
-func (self *VBD) GetVDI() (vdi *VDI, err error) {
- vbd_rec, err := self.GetRecord()
- if err != nil {
- return nil, err
- }
-
- vdi = new(VDI)
- vdi.Ref = vbd_rec["VDI"].(string)
- vdi.Client = self.Client
-
- return vdi, nil
-}
-
-func (self *VBD) Eject() (err error) {
- result := APIResult{}
- err = self.Client.APICall(&result, "VBD.eject", self.Ref)
- if err != nil {
- return err
- }
- return nil
-}
-
-func (self *VBD) Unplug() (err error) {
- result := APIResult{}
- err = self.Client.APICall(&result, "VBD.unplug", self.Ref)
- if err != nil {
- return err
- }
- return nil
-}
-
-func (self *VBD) Destroy() (err error) {
- result := APIResult{}
- err = self.Client.APICall(&result, "VBD.destroy", self.Ref)
- if err != nil {
- return err
- }
- return nil
-}
diff --git a/vendor/github.com/xenserver/go-xenserver-client/vdi.go b/vendor/github.com/xenserver/go-xenserver-client/vdi.go
deleted file mode 100644
index 46735256..00000000
--- a/vendor/github.com/xenserver/go-xenserver-client/vdi.go
+++ /dev/null
@@ -1,201 +0,0 @@
-package client
-
-import (
- "encoding/xml"
- "errors"
- "fmt"
- log "github.com/Sirupsen/logrus"
-)
-
-type VDI XenAPIObject
-
-type VDIType int
-
-const (
- _ VDIType = iota
- Disk
- CD
- Floppy
-)
-
-func (self *VDI) GetUuid() (vdi_uuid string, err error) {
- result := APIResult{}
- err = self.Client.APICall(&result, "VDI.get_uuid", self.Ref)
- if err != nil {
- return "", err
- }
- vdi_uuid = result.Value.(string)
- return vdi_uuid, nil
-}
-
-func (self *VDI) GetVBDs() (vbds []VBD, err error) {
- vbds = make([]VBD, 0)
- result := APIResult{}
- err = self.Client.APICall(&result, "VDI.get_VBDs", self.Ref)
- if err != nil {
- return vbds, err
- }
- for _, elem := range result.Value.([]interface{}) {
- vbd := VBD{}
- vbd.Ref = elem.(string)
- vbd.Client = self.Client
- vbds = append(vbds, vbd)
- }
-
- return vbds, nil
-}
-
-func (self *VDI) GetVirtualSize() (virtual_size string, err error) {
- result := APIResult{}
- err = self.Client.APICall(&result, "VDI.get_virtual_size", self.Ref)
- if err != nil {
- return "", err
- }
- virtual_size = result.Value.(string)
- return virtual_size, nil
-}
-
-func (self *VDI) Forget() (err error) {
- result := APIResult{}
- err = self.Client.APICall(&result, "VDI.forget", self.Ref)
- if err != nil {
- return err
- }
- return
-}
-
-func (self *VDI) Destroy() (err error) {
- result := APIResult{}
- err = self.Client.APICall(&result, "VDI.destroy", self.Ref)
- if err != nil {
- return err
- }
- return
-}
-
-func (self *VDI) SetNameLabel(name_label string) (err error) {
- result := APIResult{}
- err = self.Client.APICall(&result, "VDI.set_name_label", self.Ref, name_label)
- if err != nil {
- return err
- }
- return
-}
-
-func (self *VDI) SetReadOnly(value bool) (err error) {
- result := APIResult{}
- err = self.Client.APICall(&result, "VDI.set_read_only", self.Ref, value)
- if err != nil {
- return err
- }
- return
-}
-
-func (self *VDI) SetSharable(value bool) (err error) {
- result := APIResult{}
- err = self.Client.APICall(&result, "VDI.set_sharable", self.Ref, value)
- if err != nil {
- return err
- }
- return
-}
-
-// Expose a VDI using the Transfer VM
-// (Legacy VHD export)
-
-type TransferRecord struct {
- UrlFull string `xml:"url_full,attr"`
-}
-
-func (self *VDI) Expose(format string) (url string, err error) {
-
- hosts, err := self.Client.GetHosts()
-
- if err != nil {
- err = errors.New(fmt.Sprintf("Could not retrieve hosts in the pool: %s", err.Error()))
- return "", err
- }
- host := hosts[0]
-
- disk_uuid, err := self.GetUuid()
-
- if err != nil {
- err = errors.New(fmt.Sprintf("Failed to get VDI uuid for %s: %s", self.Ref, err.Error()))
- return "", err
- }
-
- args := make(map[string]string)
- args["transfer_mode"] = "http"
- args["vdi_uuid"] = disk_uuid
- args["expose_vhd"] = "true"
- args["network_uuid"] = "management"
- args["timeout_minutes"] = "5"
-
- handle, err := host.CallPlugin("transfer", "expose", args)
-
- if err != nil {
- err = errors.New(fmt.Sprintf("Error whilst exposing VDI %s: %s", disk_uuid, err.Error()))
- return "", err
- }
-
- args = make(map[string]string)
- args["record_handle"] = handle
- record_xml, err := host.CallPlugin("transfer", "get_record", args)
-
- if err != nil {
- err = errors.New(fmt.Sprintf("Unable to retrieve transfer record for VDI %s: %s", disk_uuid, err.Error()))
- return "", err
- }
-
- var record TransferRecord
- xml.Unmarshal([]byte(record_xml), &record)
-
- if record.UrlFull == "" {
- return "", errors.New(fmt.Sprintf("Error: did not parse XML properly: '%s'", record_xml))
- }
-
- // Handles either raw or VHD formats
-
- switch format {
- case "vhd":
- url = fmt.Sprintf("%s.vhd", record.UrlFull)
-
- case "raw":
- url = record.UrlFull
- }
-
- return
-}
-
-// Unexpose a VDI if exposed with a Transfer VM.
-
-func (self *VDI) Unexpose() (err error) {
-
- disk_uuid, err := self.GetUuid()
-
- if err != nil {
- return err
- }
-
- hosts, err := self.Client.GetHosts()
-
- if err != nil {
- err = errors.New(fmt.Sprintf("Could not retrieve hosts in the pool: %s", err.Error()))
- return err
- }
-
- host := hosts[0]
-
- args := make(map[string]string)
- args["vdi_uuid"] = disk_uuid
-
- result, err := host.CallPlugin("transfer", "unexpose", args)
-
- if err != nil {
- return err
- }
-
- log.Println(fmt.Sprintf("Unexpose result: %s", result))
-
- return nil
-}
diff --git a/vendor/github.com/xenserver/go-xenserver-client/vif.go b/vendor/github.com/xenserver/go-xenserver-client/vif.go
deleted file mode 100644
index fe0f0d68..00000000
--- a/vendor/github.com/xenserver/go-xenserver-client/vif.go
+++ /dev/null
@@ -1,27 +0,0 @@
-package client
-
-type VIF XenAPIObject
-
-func (self *VIF) Destroy() (err error) {
- result := APIResult{}
- err = self.Client.APICall(&result, "VIF.destroy", self.Ref)
- if err != nil {
- return err
- }
- return nil
-}
-
-func (self *VIF) GetNetwork() (network *Network, err error) {
-
- network = new(Network)
- result := APIResult{}
- err = self.Client.APICall(&result, "VIF.get_network", self.Ref)
-
- if err != nil {
- return nil, err
- }
- network.Ref = result.Value.(string)
- network.Client = self.Client
- return
-
-}
diff --git a/vendor/github.com/xenserver/go-xenserver-client/vm.go b/vendor/github.com/xenserver/go-xenserver-client/vm.go
deleted file mode 100644
index bf0098bd..00000000
--- a/vendor/github.com/xenserver/go-xenserver-client/vm.go
+++ /dev/null
@@ -1,609 +0,0 @@
-package client
-
-import (
- "fmt"
- "github.com/nilshell/xmlrpc"
- "strconv"
-)
-
-type VM XenAPIObject
-
-func (self *VM) Clone(name_label string) (new_instance *VM, err error) {
- new_instance = new(VM)
-
- result := APIResult{}
- err = self.Client.APICall(&result, "VM.clone", self.Ref, name_label)
- if err != nil {
- return nil, err
- }
- new_instance.Ref = result.Value.(string)
- new_instance.Client = self.Client
- return
-}
-
-func (self *VM) Copy(new_name string, targetSr *SR) (new_instance *VM, err error) {
- new_instance = new(VM)
-
- result := APIResult{}
- err = self.Client.APICall(&result, "VM.copy", self.Ref, new_name, targetSr.Ref)
- if err != nil {
- return nil, err
- }
- new_instance.Ref = result.Value.(string)
- new_instance.Client = self.Client
- return
-}
-
-func (self *VM) Snapshot(label string) (snapshot *VM, err error) {
- snapshot = new(VM)
-
- result := APIResult{}
- err = self.Client.APICall(&result, "VM.snapshot", self.Ref, label)
- if err != nil {
- return nil, err
- }
- snapshot.Ref = result.Value.(string)
- snapshot.Client = self.Client
- return
-}
-
-func (self *VM) Provision() (err error) {
- result := APIResult{}
- err = self.Client.APICall(&result, "VM.provision", self.Ref)
- if err != nil {
- return err
- }
- return
-}
-
-func (self *VM) Destroy() (err error) {
- result := APIResult{}
- err = self.Client.APICall(&result, "VM.destroy", self.Ref)
- if err != nil {
- return err
- }
- return
-}
-
-func (self *VM) Start(paused, force bool) (err error) {
- result := APIResult{}
- err = self.Client.APICall(&result, "VM.start", self.Ref, paused, force)
- if err != nil {
- return err
- }
- return
-}
-
-func (self *VM) StartOn(host *Host, paused, force bool) (err error) {
- result := APIResult{}
- err = self.Client.APICall(&result, "VM.start_on", self.Ref, host.Ref, paused, force)
- if err != nil {
- return err
- }
- return
-}
-
-func (self *VM) CleanShutdown() (err error) {
- result := APIResult{}
- err = self.Client.APICall(&result, "VM.clean_shutdown", self.Ref)
- if err != nil {
- return err
- }
- return
-}
-
-func (self *VM) HardShutdown() (err error) {
- result := APIResult{}
- err = self.Client.APICall(&result, "VM.hard_shutdown", self.Ref)
- if err != nil {
- return err
- }
- return
-}
-
-func (self *VM) CleanReboot() (err error) {
- result := APIResult{}
- err = self.Client.APICall(&result, "VM.clean_reboot", self.Ref)
- if err != nil {
- return err
- }
- return
-}
-
-func (self *VM) HardReboot() (err error) {
- result := APIResult{}
- err = self.Client.APICall(&result, "VM.hard_reboot", self.Ref)
- if err != nil {
- return err
- }
- return
-}
-
-func (self *VM) Unpause() (err error) {
- result := APIResult{}
- err = self.Client.APICall(&result, "VM.unpause", self.Ref)
- if err != nil {
- return err
- }
- return
-}
-
-func (self *VM) Resume(paused, force bool) (err error) {
- result := APIResult{}
- err = self.Client.APICall(&result, "VM.resume", self.Ref, paused, force)
- if err != nil {
- return err
- }
- return
-}
-
-func (self *VM) GetHVMBootPolicy() (bootOrder string, err error) {
- result := APIResult{}
- err = self.Client.APICall(&result, "VM.get_HVM_boot_policy", self.Ref)
- if err != nil {
- return "", err
- }
- bootOrder = ""
- if result.Value != nil {
- bootOrder = result.Value.(string)
- }
-
- return bootOrder, nil
-}
-
-func (self *VM) SetHVMBoot(policy, bootOrder string) (err error) {
- result := APIResult{}
- err = self.Client.APICall(&result, "VM.set_HVM_boot_policy", self.Ref, policy)
- if err != nil {
- return err
- }
- result = APIResult{}
- params := make(xmlrpc.Struct)
- params["order"] = bootOrder
- err = self.Client.APICall(&result, "VM.set_HVM_boot_params", self.Ref, params)
- if err != nil {
- return err
- }
- return
-}
-
-func (self *VM) SetPVBootloader(pv_bootloader, pv_args string) (err error) {
- result := APIResult{}
- err = self.Client.APICall(&result, "VM.set_PV_bootloader", self.Ref, pv_bootloader)
- if err != nil {
- return err
- }
- result = APIResult{}
- err = self.Client.APICall(&result, "VM.set_PV_bootloader_args", self.Ref, pv_args)
- if err != nil {
- return err
- }
- return
-}
-
-func (self *VM) GetDomainId() (domid string, err error) {
- result := APIResult{}
- err = self.Client.APICall(&result, "VM.get_domid", self.Ref)
- if err != nil {
- return "", err
- }
- domid = result.Value.(string)
- return domid, nil
-}
-
-func (self *VM) GetResidentOn() (host *Host, err error) {
- result := APIResult{}
- err = self.Client.APICall(&result, "VM.get_resident_on", self.Ref)
- if err != nil {
- return nil, err
- }
-
- host = new(Host)
- host.Ref = result.Value.(string)
- host.Client = self.Client
-
- return host, nil
-}
-
-func (self *VM) GetPowerState() (state string, err error) {
- result := APIResult{}
- err = self.Client.APICall(&result, "VM.get_power_state", self.Ref)
- if err != nil {
- return "", err
- }
- state = result.Value.(string)
- return state, nil
-}
-
-func (self *VM) GetUuid() (uuid string, err error) {
- result := APIResult{}
- err = self.Client.APICall(&result, "VM.get_uuid", self.Ref)
- if err != nil {
- return "", err
- }
- uuid = result.Value.(string)
- return uuid, nil
-}
-
-func (self *VM) GetVBDs() (vbds []VBD, err error) {
- vbds = make([]VBD, 0)
- result := APIResult{}
- err = self.Client.APICall(&result, "VM.get_VBDs", self.Ref)
- if err != nil {
- return vbds, err
- }
- for _, elem := range result.Value.([]interface{}) {
- vbd := VBD{}
- vbd.Ref = elem.(string)
- vbd.Client = self.Client
- vbds = append(vbds, vbd)
- }
-
- return vbds, nil
-}
-
-func (self *VM) GetAllowedVBDDevices() (devices []string, err error) {
- var device string
- devices = make([]string, 0)
- result := APIResult{}
- err = self.Client.APICall(&result, "VM.get_allowed_VBD_devices", self.Ref)
- if err != nil {
- return devices, err
- }
- for _, elem := range result.Value.([]interface{}) {
- device = elem.(string)
- devices = append(devices, device)
- }
-
- return devices, nil
-}
-
-func (self *VM) GetVIFs() (vifs []VIF, err error) {
- vifs = make([]VIF, 0)
- result := APIResult{}
- err = self.Client.APICall(&result, "VM.get_VIFs", self.Ref)
- if err != nil {
- return vifs, err
- }
- for _, elem := range result.Value.([]interface{}) {
- vif := VIF{}
- vif.Ref = elem.(string)
- vif.Client = self.Client
- vifs = append(vifs, vif)
- }
-
- return vifs, nil
-}
-
-func (self *VM) GetAllowedVIFDevices() (devices []string, err error) {
- var device string
- devices = make([]string, 0)
- result := APIResult{}
- err = self.Client.APICall(&result, "VM.get_allowed_VIF_devices", self.Ref)
- if err != nil {
- return devices, err
- }
- for _, elem := range result.Value.([]interface{}) {
- device = elem.(string)
- devices = append(devices, device)
- }
-
- return devices, nil
-}
-
-func (self *VM) GetDisks() (vdis []*VDI, err error) {
- // Return just data disks (non-isos)
- vdis = make([]*VDI, 0)
- vbds, err := self.GetVBDs()
- if err != nil {
- return nil, err
- }
-
- for _, vbd := range vbds {
- rec, err := vbd.GetRecord()
- if err != nil {
- return nil, err
- }
- if rec["type"] == "Disk" {
-
- vdi, err := vbd.GetVDI()
- if err != nil {
- return nil, err
- }
- vdis = append(vdis, vdi)
-
- }
- }
- return vdis, nil
-}
-
-func (self *VM) GetGuestMetricsRef() (ref string, err error) {
- result := APIResult{}
- err = self.Client.APICall(&result, "VM.get_guest_metrics", self.Ref)
- if err != nil {
- return "", nil
- }
- ref = result.Value.(string)
- return ref, err
-}
-
-func (self *VM) GetGuestMetrics() (metrics map[string]interface{}, err error) {
- metrics_ref, err := self.GetGuestMetricsRef()
- if err != nil {
- return nil, err
- }
- if metrics_ref == "OpaqueRef:NULL" {
- return nil, nil
- }
-
- result := APIResult{}
- err = self.Client.APICall(&result, "VM_guest_metrics.get_record", metrics_ref)
- if err != nil {
- return nil, err
- }
- return result.Value.(xmlrpc.Struct), nil
-}
-
-func (self *VM) SetStaticMemoryRange(min, max uint64) (err error) {
- result := APIResult{}
- strMin := fmt.Sprintf("%d", min)
- strMax := fmt.Sprintf("%d", max)
- err = self.Client.APICall(&result, "VM.set_memory_limits", self.Ref, strMin, strMax, strMin, strMax)
- if err != nil {
- return err
- }
- return
-}
-
-func (self *VM) ConnectVdi(vdi *VDI, vdiType VDIType, userdevice string) (err error) {
-
- // 1. Create a VBD
- if userdevice == "" {
- userdevice = "autodetect"
- }
-
- vbd_rec := make(xmlrpc.Struct)
- vbd_rec["VM"] = self.Ref
- vbd_rec["VDI"] = vdi.Ref
- vbd_rec["userdevice"] = userdevice
- vbd_rec["empty"] = false
- vbd_rec["other_config"] = make(xmlrpc.Struct)
- vbd_rec["qos_algorithm_type"] = ""
- vbd_rec["qos_algorithm_params"] = make(xmlrpc.Struct)
-
- switch vdiType {
- case CD:
- vbd_rec["mode"] = "RO"
- vbd_rec["bootable"] = true
- vbd_rec["unpluggable"] = false
- vbd_rec["type"] = "CD"
- case Disk:
- vbd_rec["mode"] = "RW"
- vbd_rec["bootable"] = false
- vbd_rec["unpluggable"] = false
- vbd_rec["type"] = "Disk"
- case Floppy:
- vbd_rec["mode"] = "RW"
- vbd_rec["bootable"] = false
- vbd_rec["unpluggable"] = true
- vbd_rec["type"] = "Floppy"
- }
-
- result := APIResult{}
- err = self.Client.APICall(&result, "VBD.create", vbd_rec)
-
- if err != nil {
- return err
- }
-
- vbd_ref := result.Value.(string)
-
- result = APIResult{}
- err = self.Client.APICall(&result, "VBD.get_uuid", vbd_ref)
-
- /*
- // 2. Plug VBD (Non need - the VM hasn't booted.
- // @todo - check VM state
- result = APIResult{}
- err = self.Client.APICall(&result, "VBD.plug", vbd_ref)
-
- if err != nil {
- return err
- }
- */
- return
-}
-
-func (self *VM) DisconnectVdi(vdi *VDI) error {
- vbds, err := self.GetVBDs()
- if err != nil {
- return fmt.Errorf("Unable to get VM VBDs: %s", err.Error())
- }
-
- for _, vbd := range vbds {
- rec, err := vbd.GetRecord()
- if err != nil {
- return fmt.Errorf("Could not get record for VBD '%s': %s", vbd.Ref, err.Error())
- }
-
- if recVdi, ok := rec["VDI"].(string); ok {
- if recVdi == vdi.Ref {
- _ = vbd.Unplug()
- err = vbd.Destroy()
- if err != nil {
- return fmt.Errorf("Could not destroy VBD '%s': %s", vbd.Ref, err.Error())
- }
-
- return nil
- }
- }
- }
-
- return fmt.Errorf("Could not find VBD for VDI '%s'", vdi.Ref)
-}
-
-func (self *VM) SetPlatform(params map[string]string) (err error) {
- result := APIResult{}
- platform_rec := make(xmlrpc.Struct)
- for key, value := range params {
- platform_rec[key] = value
- }
-
- err = self.Client.APICall(&result, "VM.set_platform", self.Ref, platform_rec)
-
- if err != nil {
- return err
- }
- return
-}
-
-func (self *VM) ConnectNetwork(network *Network, device string) (vif *VIF, err error) {
- // Create the VIF
-
- vif_rec := make(xmlrpc.Struct)
- vif_rec["network"] = network.Ref
- vif_rec["VM"] = self.Ref
- vif_rec["MAC"] = ""
- vif_rec["device"] = device
- vif_rec["MTU"] = "1504"
- vif_rec["other_config"] = make(xmlrpc.Struct)
- vif_rec["MAC_autogenerated"] = true
- vif_rec["locking_mode"] = "network_default"
- vif_rec["qos_algorithm_type"] = ""
- vif_rec["qos_algorithm_params"] = make(xmlrpc.Struct)
-
- result := APIResult{}
- err = self.Client.APICall(&result, "VIF.create", vif_rec)
-
- if err != nil {
- return nil, err
- }
-
- vif = new(VIF)
- vif.Ref = result.Value.(string)
- vif.Client = self.Client
-
- return vif, nil
-}
-
-// Setters
-
-func (self *VM) SetVCpuMax(vcpus uint) (err error) {
- result := APIResult{}
- strVcpu := fmt.Sprintf("%d", vcpus)
-
- err = self.Client.APICall(&result, "VM.set_VCPUs_max", self.Ref, strVcpu)
-
- if err != nil {
- return err
- }
- return
-}
-
-func (self *VM) SetVCpuAtStartup(vcpus uint) (err error) {
- result := APIResult{}
- strVcpu := fmt.Sprintf("%d", vcpus)
-
- err = self.Client.APICall(&result, "VM.set_VCPUs_at_startup", self.Ref, strVcpu)
-
- if err != nil {
- return err
- }
- return
-}
-
-func (self *VM) SetIsATemplate(is_a_template bool) (err error) {
- result := APIResult{}
- err = self.Client.APICall(&result, "VM.set_is_a_template", self.Ref, is_a_template)
- if err != nil {
- return err
- }
- return
-}
-
-func (self *VM) GetOtherConfig() (other_config map[string]string, err error) {
- result := APIResult{}
- other_config = make(map[string]string)
- err = self.Client.APICall(&result, "VM.get_other_config", self.Ref)
- if err != nil {
- return
- }
- for key, value := range result.Value.(xmlrpc.Struct) {
- if valueStr, ok := value.(string); ok {
- other_config[key] = valueStr
- }
- }
- return
-}
-
-func (self *VM) SetOtherConfig(other_config map[string]string) (err error) {
- result := APIResult{}
- other_config_rec := make(xmlrpc.Struct)
- for key, value := range other_config {
- other_config_rec[key] = value
- }
- err = self.Client.APICall(&result, "VM.set_other_config", self.Ref, other_config_rec)
- if err != nil {
- return err
- }
- return
-}
-
-func (self *VM) SetNameLabel(name_label string) (err error) {
- result := APIResult{}
- err = self.Client.APICall(&result, "VM.set_name_label", self.Ref, name_label)
- if err != nil {
- return err
- }
- return
-}
-
-func (self *VM) SetDescription(description string) (err error) {
- result := APIResult{}
- err = self.Client.APICall(&result, "VM.set_name_description", self.Ref, description)
- if err != nil {
- return err
- }
- return
-}
-
-func (self *VM) SetVCPUsMax(vcpus uint) (err error) {
- result := APIResult{}
- err = self.Client.APICall(&result, "VM.set_VCPUs_max", self.Ref, strconv.Itoa(int(vcpus)))
- if err != nil {
- return err
- }
- return
-}
-
-func (self *VM) SetVCPUsAtStartup(vcpus uint) (err error) {
- result := APIResult{}
- err = self.Client.APICall(&result, "VM.set_VCPUs_at_startup", self.Ref, strconv.Itoa(int(vcpus)))
- if err != nil {
- return err
- }
- return
-}
-
-func (self *VM) SetSuspendSR(vdi *VDI) (err error) {
- result := APIResult{}
- var vdi_uuid string
- vdi_uuid, err = vdi.GetUuid()
- if err != nil {
- return err
- }
- err = self.Client.APICall(&result, "VM.set_suspend_SR", self.Ref, vdi_uuid)
- if err != nil {
- return err
- }
- return
-}
-
-func (self *VM) SetHaAlwaysRun(ha_always_run bool) (err error) {
- result := APIResult{}
- err = self.Client.APICall(&result, "VM.set_ha_always_run", self.Ref, ha_always_run)
- if err != nil {
- return err
- }
- return
-}
diff --git a/vendor/golang.org/x/crypto/LICENSE b/vendor/golang.org/x/crypto/LICENSE
deleted file mode 100644
index 6a66aea5..00000000
--- a/vendor/golang.org/x/crypto/LICENSE
+++ /dev/null
@@ -1,27 +0,0 @@
-Copyright (c) 2009 The Go Authors. All rights reserved.
-
-Redistribution and use in source and binary forms, with or without
-modification, are permitted provided that the following conditions are
-met:
-
- * Redistributions of source code must retain the above copyright
-notice, this list of conditions and the following disclaimer.
- * Redistributions in binary form must reproduce the above
-copyright notice, this list of conditions and the following disclaimer
-in the documentation and/or other materials provided with the
-distribution.
- * Neither the name of Google Inc. nor the names of its
-contributors may be used to endorse or promote products derived from
-this software without specific prior written permission.
-
-THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
diff --git a/vendor/golang.org/x/crypto/PATENTS b/vendor/golang.org/x/crypto/PATENTS
deleted file mode 100644
index 73309904..00000000
--- a/vendor/golang.org/x/crypto/PATENTS
+++ /dev/null
@@ -1,22 +0,0 @@
-Additional IP Rights Grant (Patents)
-
-"This implementation" means the copyrightable works distributed by
-Google as part of the Go project.
-
-Google hereby grants to You a perpetual, worldwide, non-exclusive,
-no-charge, royalty-free, irrevocable (except as stated in this section)
-patent license to make, have made, use, offer to sell, sell, import,
-transfer and otherwise run, modify and propagate the contents of this
-implementation of Go, where such license applies only to those patent
-claims, both currently owned or controlled by Google and acquired in
-the future, licensable by Google that are necessarily infringed by this
-implementation of Go. This grant does not include claims that would be
-infringed only as a consequence of further modification of this
-implementation. If you or your agent or exclusive licensee institute or
-order or agree to the institution of patent litigation against any
-entity (including a cross-claim or counterclaim in a lawsuit) alleging
-that this implementation of Go or any code incorporated within this
-implementation of Go constitutes direct or contributory patent
-infringement, or inducement of patent infringement, then any patent
-rights granted to you under this License for this implementation of Go
-shall terminate as of the date such litigation is filed.
diff --git a/vendor/golang.org/x/crypto/curve25519/const_amd64.s b/vendor/golang.org/x/crypto/curve25519/const_amd64.s
deleted file mode 100644
index 797f9b05..00000000
--- a/vendor/golang.org/x/crypto/curve25519/const_amd64.s
+++ /dev/null
@@ -1,20 +0,0 @@
-// Copyright 2012 The Go Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style
-// license that can be found in the LICENSE file.
-
-// This code was translated into a form compatible with 6a from the public
-// domain sources in SUPERCOP: http://bench.cr.yp.to/supercop.html
-
-// +build amd64,!gccgo,!appengine
-
-DATA ·REDMASK51(SB)/8, $0x0007FFFFFFFFFFFF
-GLOBL ·REDMASK51(SB), 8, $8
-
-DATA ·_121666_213(SB)/8, $996687872
-GLOBL ·_121666_213(SB), 8, $8
-
-DATA ·_2P0(SB)/8, $0xFFFFFFFFFFFDA
-GLOBL ·_2P0(SB), 8, $8
-
-DATA ·_2P1234(SB)/8, $0xFFFFFFFFFFFFE
-GLOBL ·_2P1234(SB), 8, $8
diff --git a/vendor/golang.org/x/crypto/curve25519/cswap_amd64.s b/vendor/golang.org/x/crypto/curve25519/cswap_amd64.s
deleted file mode 100644
index 45484d1b..00000000
--- a/vendor/golang.org/x/crypto/curve25519/cswap_amd64.s
+++ /dev/null
@@ -1,88 +0,0 @@
-// Copyright 2012 The Go Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style
-// license that can be found in the LICENSE file.
-
-// This code was translated into a form compatible with 6a from the public
-// domain sources in SUPERCOP: http://bench.cr.yp.to/supercop.html
-
-// +build amd64,!gccgo,!appengine
-
-// func cswap(inout *[5]uint64, v uint64)
-TEXT ·cswap(SB),7,$0
- MOVQ inout+0(FP),DI
- MOVQ v+8(FP),SI
-
- CMPQ SI,$1
- MOVQ 0(DI),SI
- MOVQ 80(DI),DX
- MOVQ 8(DI),CX
- MOVQ 88(DI),R8
- MOVQ SI,R9
- CMOVQEQ DX,SI
- CMOVQEQ R9,DX
- MOVQ CX,R9
- CMOVQEQ R8,CX
- CMOVQEQ R9,R8
- MOVQ SI,0(DI)
- MOVQ DX,80(DI)
- MOVQ CX,8(DI)
- MOVQ R8,88(DI)
- MOVQ 16(DI),SI
- MOVQ 96(DI),DX
- MOVQ 24(DI),CX
- MOVQ 104(DI),R8
- MOVQ SI,R9
- CMOVQEQ DX,SI
- CMOVQEQ R9,DX
- MOVQ CX,R9
- CMOVQEQ R8,CX
- CMOVQEQ R9,R8
- MOVQ SI,16(DI)
- MOVQ DX,96(DI)
- MOVQ CX,24(DI)
- MOVQ R8,104(DI)
- MOVQ 32(DI),SI
- MOVQ 112(DI),DX
- MOVQ 40(DI),CX
- MOVQ 120(DI),R8
- MOVQ SI,R9
- CMOVQEQ DX,SI
- CMOVQEQ R9,DX
- MOVQ CX,R9
- CMOVQEQ R8,CX
- CMOVQEQ R9,R8
- MOVQ SI,32(DI)
- MOVQ DX,112(DI)
- MOVQ CX,40(DI)
- MOVQ R8,120(DI)
- MOVQ 48(DI),SI
- MOVQ 128(DI),DX
- MOVQ 56(DI),CX
- MOVQ 136(DI),R8
- MOVQ SI,R9
- CMOVQEQ DX,SI
- CMOVQEQ R9,DX
- MOVQ CX,R9
- CMOVQEQ R8,CX
- CMOVQEQ R9,R8
- MOVQ SI,48(DI)
- MOVQ DX,128(DI)
- MOVQ CX,56(DI)
- MOVQ R8,136(DI)
- MOVQ 64(DI),SI
- MOVQ 144(DI),DX
- MOVQ 72(DI),CX
- MOVQ 152(DI),R8
- MOVQ SI,R9
- CMOVQEQ DX,SI
- CMOVQEQ R9,DX
- MOVQ CX,R9
- CMOVQEQ R8,CX
- CMOVQEQ R9,R8
- MOVQ SI,64(DI)
- MOVQ DX,144(DI)
- MOVQ CX,72(DI)
- MOVQ R8,152(DI)
- MOVQ DI,AX
- MOVQ SI,DX
- RET
diff --git a/vendor/golang.org/x/crypto/curve25519/curve25519.go b/vendor/golang.org/x/crypto/curve25519/curve25519.go
deleted file mode 100644
index 6918c47f..00000000
--- a/vendor/golang.org/x/crypto/curve25519/curve25519.go
+++ /dev/null
@@ -1,841 +0,0 @@
-// Copyright 2013 The Go Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style
-// license that can be found in the LICENSE file.
-
-// We have a implementation in amd64 assembly so this code is only run on
-// non-amd64 platforms. The amd64 assembly does not support gccgo.
-// +build !amd64 gccgo appengine
-
-package curve25519
-
-// This code is a port of the public domain, "ref10" implementation of
-// curve25519 from SUPERCOP 20130419 by D. J. Bernstein.
-
-// fieldElement represents an element of the field GF(2^255 - 19). An element
-// t, entries t[0]...t[9], represents the integer t[0]+2^26 t[1]+2^51 t[2]+2^77
-// t[3]+2^102 t[4]+...+2^230 t[9]. Bounds on each t[i] vary depending on
-// context.
-type fieldElement [10]int32
-
-func feZero(fe *fieldElement) {
- for i := range fe {
- fe[i] = 0
- }
-}
-
-func feOne(fe *fieldElement) {
- feZero(fe)
- fe[0] = 1
-}
-
-func feAdd(dst, a, b *fieldElement) {
- for i := range dst {
- dst[i] = a[i] + b[i]
- }
-}
-
-func feSub(dst, a, b *fieldElement) {
- for i := range dst {
- dst[i] = a[i] - b[i]
- }
-}
-
-func feCopy(dst, src *fieldElement) {
- for i := range dst {
- dst[i] = src[i]
- }
-}
-
-// feCSwap replaces (f,g) with (g,f) if b == 1; replaces (f,g) with (f,g) if b == 0.
-//
-// Preconditions: b in {0,1}.
-func feCSwap(f, g *fieldElement, b int32) {
- var x fieldElement
- b = -b
- for i := range x {
- x[i] = b & (f[i] ^ g[i])
- }
-
- for i := range f {
- f[i] ^= x[i]
- }
- for i := range g {
- g[i] ^= x[i]
- }
-}
-
-// load3 reads a 24-bit, little-endian value from in.
-func load3(in []byte) int64 {
- var r int64
- r = int64(in[0])
- r |= int64(in[1]) << 8
- r |= int64(in[2]) << 16
- return r
-}
-
-// load4 reads a 32-bit, little-endian value from in.
-func load4(in []byte) int64 {
- var r int64
- r = int64(in[0])
- r |= int64(in[1]) << 8
- r |= int64(in[2]) << 16
- r |= int64(in[3]) << 24
- return r
-}
-
-func feFromBytes(dst *fieldElement, src *[32]byte) {
- h0 := load4(src[:])
- h1 := load3(src[4:]) << 6
- h2 := load3(src[7:]) << 5
- h3 := load3(src[10:]) << 3
- h4 := load3(src[13:]) << 2
- h5 := load4(src[16:])
- h6 := load3(src[20:]) << 7
- h7 := load3(src[23:]) << 5
- h8 := load3(src[26:]) << 4
- h9 := load3(src[29:]) << 2
-
- var carry [10]int64
- carry[9] = (h9 + 1<<24) >> 25
- h0 += carry[9] * 19
- h9 -= carry[9] << 25
- carry[1] = (h1 + 1<<24) >> 25
- h2 += carry[1]
- h1 -= carry[1] << 25
- carry[3] = (h3 + 1<<24) >> 25
- h4 += carry[3]
- h3 -= carry[3] << 25
- carry[5] = (h5 + 1<<24) >> 25
- h6 += carry[5]
- h5 -= carry[5] << 25
- carry[7] = (h7 + 1<<24) >> 25
- h8 += carry[7]
- h7 -= carry[7] << 25
-
- carry[0] = (h0 + 1<<25) >> 26
- h1 += carry[0]
- h0 -= carry[0] << 26
- carry[2] = (h2 + 1<<25) >> 26
- h3 += carry[2]
- h2 -= carry[2] << 26
- carry[4] = (h4 + 1<<25) >> 26
- h5 += carry[4]
- h4 -= carry[4] << 26
- carry[6] = (h6 + 1<<25) >> 26
- h7 += carry[6]
- h6 -= carry[6] << 26
- carry[8] = (h8 + 1<<25) >> 26
- h9 += carry[8]
- h8 -= carry[8] << 26
-
- dst[0] = int32(h0)
- dst[1] = int32(h1)
- dst[2] = int32(h2)
- dst[3] = int32(h3)
- dst[4] = int32(h4)
- dst[5] = int32(h5)
- dst[6] = int32(h6)
- dst[7] = int32(h7)
- dst[8] = int32(h8)
- dst[9] = int32(h9)
-}
-
-// feToBytes marshals h to s.
-// Preconditions:
-// |h| bounded by 1.1*2^25,1.1*2^24,1.1*2^25,1.1*2^24,etc.
-//
-// Write p=2^255-19; q=floor(h/p).
-// Basic claim: q = floor(2^(-255)(h + 19 2^(-25)h9 + 2^(-1))).
-//
-// Proof:
-// Have |h|<=p so |q|<=1 so |19^2 2^(-255) q|<1/4.
-// Also have |h-2^230 h9|<2^230 so |19 2^(-255)(h-2^230 h9)|<1/4.
-//
-// Write y=2^(-1)-19^2 2^(-255)q-19 2^(-255)(h-2^230 h9).
-// Then 0> 25
- q = (h[0] + q) >> 26
- q = (h[1] + q) >> 25
- q = (h[2] + q) >> 26
- q = (h[3] + q) >> 25
- q = (h[4] + q) >> 26
- q = (h[5] + q) >> 25
- q = (h[6] + q) >> 26
- q = (h[7] + q) >> 25
- q = (h[8] + q) >> 26
- q = (h[9] + q) >> 25
-
- // Goal: Output h-(2^255-19)q, which is between 0 and 2^255-20.
- h[0] += 19 * q
- // Goal: Output h-2^255 q, which is between 0 and 2^255-20.
-
- carry[0] = h[0] >> 26
- h[1] += carry[0]
- h[0] -= carry[0] << 26
- carry[1] = h[1] >> 25
- h[2] += carry[1]
- h[1] -= carry[1] << 25
- carry[2] = h[2] >> 26
- h[3] += carry[2]
- h[2] -= carry[2] << 26
- carry[3] = h[3] >> 25
- h[4] += carry[3]
- h[3] -= carry[3] << 25
- carry[4] = h[4] >> 26
- h[5] += carry[4]
- h[4] -= carry[4] << 26
- carry[5] = h[5] >> 25
- h[6] += carry[5]
- h[5] -= carry[5] << 25
- carry[6] = h[6] >> 26
- h[7] += carry[6]
- h[6] -= carry[6] << 26
- carry[7] = h[7] >> 25
- h[8] += carry[7]
- h[7] -= carry[7] << 25
- carry[8] = h[8] >> 26
- h[9] += carry[8]
- h[8] -= carry[8] << 26
- carry[9] = h[9] >> 25
- h[9] -= carry[9] << 25
- // h10 = carry9
-
- // Goal: Output h[0]+...+2^255 h10-2^255 q, which is between 0 and 2^255-20.
- // Have h[0]+...+2^230 h[9] between 0 and 2^255-1;
- // evidently 2^255 h10-2^255 q = 0.
- // Goal: Output h[0]+...+2^230 h[9].
-
- s[0] = byte(h[0] >> 0)
- s[1] = byte(h[0] >> 8)
- s[2] = byte(h[0] >> 16)
- s[3] = byte((h[0] >> 24) | (h[1] << 2))
- s[4] = byte(h[1] >> 6)
- s[5] = byte(h[1] >> 14)
- s[6] = byte((h[1] >> 22) | (h[2] << 3))
- s[7] = byte(h[2] >> 5)
- s[8] = byte(h[2] >> 13)
- s[9] = byte((h[2] >> 21) | (h[3] << 5))
- s[10] = byte(h[3] >> 3)
- s[11] = byte(h[3] >> 11)
- s[12] = byte((h[3] >> 19) | (h[4] << 6))
- s[13] = byte(h[4] >> 2)
- s[14] = byte(h[4] >> 10)
- s[15] = byte(h[4] >> 18)
- s[16] = byte(h[5] >> 0)
- s[17] = byte(h[5] >> 8)
- s[18] = byte(h[5] >> 16)
- s[19] = byte((h[5] >> 24) | (h[6] << 1))
- s[20] = byte(h[6] >> 7)
- s[21] = byte(h[6] >> 15)
- s[22] = byte((h[6] >> 23) | (h[7] << 3))
- s[23] = byte(h[7] >> 5)
- s[24] = byte(h[7] >> 13)
- s[25] = byte((h[7] >> 21) | (h[8] << 4))
- s[26] = byte(h[8] >> 4)
- s[27] = byte(h[8] >> 12)
- s[28] = byte((h[8] >> 20) | (h[9] << 6))
- s[29] = byte(h[9] >> 2)
- s[30] = byte(h[9] >> 10)
- s[31] = byte(h[9] >> 18)
-}
-
-// feMul calculates h = f * g
-// Can overlap h with f or g.
-//
-// Preconditions:
-// |f| bounded by 1.1*2^26,1.1*2^25,1.1*2^26,1.1*2^25,etc.
-// |g| bounded by 1.1*2^26,1.1*2^25,1.1*2^26,1.1*2^25,etc.
-//
-// Postconditions:
-// |h| bounded by 1.1*2^25,1.1*2^24,1.1*2^25,1.1*2^24,etc.
-//
-// Notes on implementation strategy:
-//
-// Using schoolbook multiplication.
-// Karatsuba would save a little in some cost models.
-//
-// Most multiplications by 2 and 19 are 32-bit precomputations;
-// cheaper than 64-bit postcomputations.
-//
-// There is one remaining multiplication by 19 in the carry chain;
-// one *19 precomputation can be merged into this,
-// but the resulting data flow is considerably less clean.
-//
-// There are 12 carries below.
-// 10 of them are 2-way parallelizable and vectorizable.
-// Can get away with 11 carries, but then data flow is much deeper.
-//
-// With tighter constraints on inputs can squeeze carries into int32.
-func feMul(h, f, g *fieldElement) {
- f0 := f[0]
- f1 := f[1]
- f2 := f[2]
- f3 := f[3]
- f4 := f[4]
- f5 := f[5]
- f6 := f[6]
- f7 := f[7]
- f8 := f[8]
- f9 := f[9]
- g0 := g[0]
- g1 := g[1]
- g2 := g[2]
- g3 := g[3]
- g4 := g[4]
- g5 := g[5]
- g6 := g[6]
- g7 := g[7]
- g8 := g[8]
- g9 := g[9]
- g1_19 := 19 * g1 // 1.4*2^29
- g2_19 := 19 * g2 // 1.4*2^30; still ok
- g3_19 := 19 * g3
- g4_19 := 19 * g4
- g5_19 := 19 * g5
- g6_19 := 19 * g6
- g7_19 := 19 * g7
- g8_19 := 19 * g8
- g9_19 := 19 * g9
- f1_2 := 2 * f1
- f3_2 := 2 * f3
- f5_2 := 2 * f5
- f7_2 := 2 * f7
- f9_2 := 2 * f9
- f0g0 := int64(f0) * int64(g0)
- f0g1 := int64(f0) * int64(g1)
- f0g2 := int64(f0) * int64(g2)
- f0g3 := int64(f0) * int64(g3)
- f0g4 := int64(f0) * int64(g4)
- f0g5 := int64(f0) * int64(g5)
- f0g6 := int64(f0) * int64(g6)
- f0g7 := int64(f0) * int64(g7)
- f0g8 := int64(f0) * int64(g8)
- f0g9 := int64(f0) * int64(g9)
- f1g0 := int64(f1) * int64(g0)
- f1g1_2 := int64(f1_2) * int64(g1)
- f1g2 := int64(f1) * int64(g2)
- f1g3_2 := int64(f1_2) * int64(g3)
- f1g4 := int64(f1) * int64(g4)
- f1g5_2 := int64(f1_2) * int64(g5)
- f1g6 := int64(f1) * int64(g6)
- f1g7_2 := int64(f1_2) * int64(g7)
- f1g8 := int64(f1) * int64(g8)
- f1g9_38 := int64(f1_2) * int64(g9_19)
- f2g0 := int64(f2) * int64(g0)
- f2g1 := int64(f2) * int64(g1)
- f2g2 := int64(f2) * int64(g2)
- f2g3 := int64(f2) * int64(g3)
- f2g4 := int64(f2) * int64(g4)
- f2g5 := int64(f2) * int64(g5)
- f2g6 := int64(f2) * int64(g6)
- f2g7 := int64(f2) * int64(g7)
- f2g8_19 := int64(f2) * int64(g8_19)
- f2g9_19 := int64(f2) * int64(g9_19)
- f3g0 := int64(f3) * int64(g0)
- f3g1_2 := int64(f3_2) * int64(g1)
- f3g2 := int64(f3) * int64(g2)
- f3g3_2 := int64(f3_2) * int64(g3)
- f3g4 := int64(f3) * int64(g4)
- f3g5_2 := int64(f3_2) * int64(g5)
- f3g6 := int64(f3) * int64(g6)
- f3g7_38 := int64(f3_2) * int64(g7_19)
- f3g8_19 := int64(f3) * int64(g8_19)
- f3g9_38 := int64(f3_2) * int64(g9_19)
- f4g0 := int64(f4) * int64(g0)
- f4g1 := int64(f4) * int64(g1)
- f4g2 := int64(f4) * int64(g2)
- f4g3 := int64(f4) * int64(g3)
- f4g4 := int64(f4) * int64(g4)
- f4g5 := int64(f4) * int64(g5)
- f4g6_19 := int64(f4) * int64(g6_19)
- f4g7_19 := int64(f4) * int64(g7_19)
- f4g8_19 := int64(f4) * int64(g8_19)
- f4g9_19 := int64(f4) * int64(g9_19)
- f5g0 := int64(f5) * int64(g0)
- f5g1_2 := int64(f5_2) * int64(g1)
- f5g2 := int64(f5) * int64(g2)
- f5g3_2 := int64(f5_2) * int64(g3)
- f5g4 := int64(f5) * int64(g4)
- f5g5_38 := int64(f5_2) * int64(g5_19)
- f5g6_19 := int64(f5) * int64(g6_19)
- f5g7_38 := int64(f5_2) * int64(g7_19)
- f5g8_19 := int64(f5) * int64(g8_19)
- f5g9_38 := int64(f5_2) * int64(g9_19)
- f6g0 := int64(f6) * int64(g0)
- f6g1 := int64(f6) * int64(g1)
- f6g2 := int64(f6) * int64(g2)
- f6g3 := int64(f6) * int64(g3)
- f6g4_19 := int64(f6) * int64(g4_19)
- f6g5_19 := int64(f6) * int64(g5_19)
- f6g6_19 := int64(f6) * int64(g6_19)
- f6g7_19 := int64(f6) * int64(g7_19)
- f6g8_19 := int64(f6) * int64(g8_19)
- f6g9_19 := int64(f6) * int64(g9_19)
- f7g0 := int64(f7) * int64(g0)
- f7g1_2 := int64(f7_2) * int64(g1)
- f7g2 := int64(f7) * int64(g2)
- f7g3_38 := int64(f7_2) * int64(g3_19)
- f7g4_19 := int64(f7) * int64(g4_19)
- f7g5_38 := int64(f7_2) * int64(g5_19)
- f7g6_19 := int64(f7) * int64(g6_19)
- f7g7_38 := int64(f7_2) * int64(g7_19)
- f7g8_19 := int64(f7) * int64(g8_19)
- f7g9_38 := int64(f7_2) * int64(g9_19)
- f8g0 := int64(f8) * int64(g0)
- f8g1 := int64(f8) * int64(g1)
- f8g2_19 := int64(f8) * int64(g2_19)
- f8g3_19 := int64(f8) * int64(g3_19)
- f8g4_19 := int64(f8) * int64(g4_19)
- f8g5_19 := int64(f8) * int64(g5_19)
- f8g6_19 := int64(f8) * int64(g6_19)
- f8g7_19 := int64(f8) * int64(g7_19)
- f8g8_19 := int64(f8) * int64(g8_19)
- f8g9_19 := int64(f8) * int64(g9_19)
- f9g0 := int64(f9) * int64(g0)
- f9g1_38 := int64(f9_2) * int64(g1_19)
- f9g2_19 := int64(f9) * int64(g2_19)
- f9g3_38 := int64(f9_2) * int64(g3_19)
- f9g4_19 := int64(f9) * int64(g4_19)
- f9g5_38 := int64(f9_2) * int64(g5_19)
- f9g6_19 := int64(f9) * int64(g6_19)
- f9g7_38 := int64(f9_2) * int64(g7_19)
- f9g8_19 := int64(f9) * int64(g8_19)
- f9g9_38 := int64(f9_2) * int64(g9_19)
- h0 := f0g0 + f1g9_38 + f2g8_19 + f3g7_38 + f4g6_19 + f5g5_38 + f6g4_19 + f7g3_38 + f8g2_19 + f9g1_38
- h1 := f0g1 + f1g0 + f2g9_19 + f3g8_19 + f4g7_19 + f5g6_19 + f6g5_19 + f7g4_19 + f8g3_19 + f9g2_19
- h2 := f0g2 + f1g1_2 + f2g0 + f3g9_38 + f4g8_19 + f5g7_38 + f6g6_19 + f7g5_38 + f8g4_19 + f9g3_38
- h3 := f0g3 + f1g2 + f2g1 + f3g0 + f4g9_19 + f5g8_19 + f6g7_19 + f7g6_19 + f8g5_19 + f9g4_19
- h4 := f0g4 + f1g3_2 + f2g2 + f3g1_2 + f4g0 + f5g9_38 + f6g8_19 + f7g7_38 + f8g6_19 + f9g5_38
- h5 := f0g5 + f1g4 + f2g3 + f3g2 + f4g1 + f5g0 + f6g9_19 + f7g8_19 + f8g7_19 + f9g6_19
- h6 := f0g6 + f1g5_2 + f2g4 + f3g3_2 + f4g2 + f5g1_2 + f6g0 + f7g9_38 + f8g8_19 + f9g7_38
- h7 := f0g7 + f1g6 + f2g5 + f3g4 + f4g3 + f5g2 + f6g1 + f7g0 + f8g9_19 + f9g8_19
- h8 := f0g8 + f1g7_2 + f2g6 + f3g5_2 + f4g4 + f5g3_2 + f6g2 + f7g1_2 + f8g0 + f9g9_38
- h9 := f0g9 + f1g8 + f2g7 + f3g6 + f4g5 + f5g4 + f6g3 + f7g2 + f8g1 + f9g0
- var carry [10]int64
-
- // |h0| <= (1.1*1.1*2^52*(1+19+19+19+19)+1.1*1.1*2^50*(38+38+38+38+38))
- // i.e. |h0| <= 1.2*2^59; narrower ranges for h2, h4, h6, h8
- // |h1| <= (1.1*1.1*2^51*(1+1+19+19+19+19+19+19+19+19))
- // i.e. |h1| <= 1.5*2^58; narrower ranges for h3, h5, h7, h9
-
- carry[0] = (h0 + (1 << 25)) >> 26
- h1 += carry[0]
- h0 -= carry[0] << 26
- carry[4] = (h4 + (1 << 25)) >> 26
- h5 += carry[4]
- h4 -= carry[4] << 26
- // |h0| <= 2^25
- // |h4| <= 2^25
- // |h1| <= 1.51*2^58
- // |h5| <= 1.51*2^58
-
- carry[1] = (h1 + (1 << 24)) >> 25
- h2 += carry[1]
- h1 -= carry[1] << 25
- carry[5] = (h5 + (1 << 24)) >> 25
- h6 += carry[5]
- h5 -= carry[5] << 25
- // |h1| <= 2^24; from now on fits into int32
- // |h5| <= 2^24; from now on fits into int32
- // |h2| <= 1.21*2^59
- // |h6| <= 1.21*2^59
-
- carry[2] = (h2 + (1 << 25)) >> 26
- h3 += carry[2]
- h2 -= carry[2] << 26
- carry[6] = (h6 + (1 << 25)) >> 26
- h7 += carry[6]
- h6 -= carry[6] << 26
- // |h2| <= 2^25; from now on fits into int32 unchanged
- // |h6| <= 2^25; from now on fits into int32 unchanged
- // |h3| <= 1.51*2^58
- // |h7| <= 1.51*2^58
-
- carry[3] = (h3 + (1 << 24)) >> 25
- h4 += carry[3]
- h3 -= carry[3] << 25
- carry[7] = (h7 + (1 << 24)) >> 25
- h8 += carry[7]
- h7 -= carry[7] << 25
- // |h3| <= 2^24; from now on fits into int32 unchanged
- // |h7| <= 2^24; from now on fits into int32 unchanged
- // |h4| <= 1.52*2^33
- // |h8| <= 1.52*2^33
-
- carry[4] = (h4 + (1 << 25)) >> 26
- h5 += carry[4]
- h4 -= carry[4] << 26
- carry[8] = (h8 + (1 << 25)) >> 26
- h9 += carry[8]
- h8 -= carry[8] << 26
- // |h4| <= 2^25; from now on fits into int32 unchanged
- // |h8| <= 2^25; from now on fits into int32 unchanged
- // |h5| <= 1.01*2^24
- // |h9| <= 1.51*2^58
-
- carry[9] = (h9 + (1 << 24)) >> 25
- h0 += carry[9] * 19
- h9 -= carry[9] << 25
- // |h9| <= 2^24; from now on fits into int32 unchanged
- // |h0| <= 1.8*2^37
-
- carry[0] = (h0 + (1 << 25)) >> 26
- h1 += carry[0]
- h0 -= carry[0] << 26
- // |h0| <= 2^25; from now on fits into int32 unchanged
- // |h1| <= 1.01*2^24
-
- h[0] = int32(h0)
- h[1] = int32(h1)
- h[2] = int32(h2)
- h[3] = int32(h3)
- h[4] = int32(h4)
- h[5] = int32(h5)
- h[6] = int32(h6)
- h[7] = int32(h7)
- h[8] = int32(h8)
- h[9] = int32(h9)
-}
-
-// feSquare calculates h = f*f. Can overlap h with f.
-//
-// Preconditions:
-// |f| bounded by 1.1*2^26,1.1*2^25,1.1*2^26,1.1*2^25,etc.
-//
-// Postconditions:
-// |h| bounded by 1.1*2^25,1.1*2^24,1.1*2^25,1.1*2^24,etc.
-func feSquare(h, f *fieldElement) {
- f0 := f[0]
- f1 := f[1]
- f2 := f[2]
- f3 := f[3]
- f4 := f[4]
- f5 := f[5]
- f6 := f[6]
- f7 := f[7]
- f8 := f[8]
- f9 := f[9]
- f0_2 := 2 * f0
- f1_2 := 2 * f1
- f2_2 := 2 * f2
- f3_2 := 2 * f3
- f4_2 := 2 * f4
- f5_2 := 2 * f5
- f6_2 := 2 * f6
- f7_2 := 2 * f7
- f5_38 := 38 * f5 // 1.31*2^30
- f6_19 := 19 * f6 // 1.31*2^30
- f7_38 := 38 * f7 // 1.31*2^30
- f8_19 := 19 * f8 // 1.31*2^30
- f9_38 := 38 * f9 // 1.31*2^30
- f0f0 := int64(f0) * int64(f0)
- f0f1_2 := int64(f0_2) * int64(f1)
- f0f2_2 := int64(f0_2) * int64(f2)
- f0f3_2 := int64(f0_2) * int64(f3)
- f0f4_2 := int64(f0_2) * int64(f4)
- f0f5_2 := int64(f0_2) * int64(f5)
- f0f6_2 := int64(f0_2) * int64(f6)
- f0f7_2 := int64(f0_2) * int64(f7)
- f0f8_2 := int64(f0_2) * int64(f8)
- f0f9_2 := int64(f0_2) * int64(f9)
- f1f1_2 := int64(f1_2) * int64(f1)
- f1f2_2 := int64(f1_2) * int64(f2)
- f1f3_4 := int64(f1_2) * int64(f3_2)
- f1f4_2 := int64(f1_2) * int64(f4)
- f1f5_4 := int64(f1_2) * int64(f5_2)
- f1f6_2 := int64(f1_2) * int64(f6)
- f1f7_4 := int64(f1_2) * int64(f7_2)
- f1f8_2 := int64(f1_2) * int64(f8)
- f1f9_76 := int64(f1_2) * int64(f9_38)
- f2f2 := int64(f2) * int64(f2)
- f2f3_2 := int64(f2_2) * int64(f3)
- f2f4_2 := int64(f2_2) * int64(f4)
- f2f5_2 := int64(f2_2) * int64(f5)
- f2f6_2 := int64(f2_2) * int64(f6)
- f2f7_2 := int64(f2_2) * int64(f7)
- f2f8_38 := int64(f2_2) * int64(f8_19)
- f2f9_38 := int64(f2) * int64(f9_38)
- f3f3_2 := int64(f3_2) * int64(f3)
- f3f4_2 := int64(f3_2) * int64(f4)
- f3f5_4 := int64(f3_2) * int64(f5_2)
- f3f6_2 := int64(f3_2) * int64(f6)
- f3f7_76 := int64(f3_2) * int64(f7_38)
- f3f8_38 := int64(f3_2) * int64(f8_19)
- f3f9_76 := int64(f3_2) * int64(f9_38)
- f4f4 := int64(f4) * int64(f4)
- f4f5_2 := int64(f4_2) * int64(f5)
- f4f6_38 := int64(f4_2) * int64(f6_19)
- f4f7_38 := int64(f4) * int64(f7_38)
- f4f8_38 := int64(f4_2) * int64(f8_19)
- f4f9_38 := int64(f4) * int64(f9_38)
- f5f5_38 := int64(f5) * int64(f5_38)
- f5f6_38 := int64(f5_2) * int64(f6_19)
- f5f7_76 := int64(f5_2) * int64(f7_38)
- f5f8_38 := int64(f5_2) * int64(f8_19)
- f5f9_76 := int64(f5_2) * int64(f9_38)
- f6f6_19 := int64(f6) * int64(f6_19)
- f6f7_38 := int64(f6) * int64(f7_38)
- f6f8_38 := int64(f6_2) * int64(f8_19)
- f6f9_38 := int64(f6) * int64(f9_38)
- f7f7_38 := int64(f7) * int64(f7_38)
- f7f8_38 := int64(f7_2) * int64(f8_19)
- f7f9_76 := int64(f7_2) * int64(f9_38)
- f8f8_19 := int64(f8) * int64(f8_19)
- f8f9_38 := int64(f8) * int64(f9_38)
- f9f9_38 := int64(f9) * int64(f9_38)
- h0 := f0f0 + f1f9_76 + f2f8_38 + f3f7_76 + f4f6_38 + f5f5_38
- h1 := f0f1_2 + f2f9_38 + f3f8_38 + f4f7_38 + f5f6_38
- h2 := f0f2_2 + f1f1_2 + f3f9_76 + f4f8_38 + f5f7_76 + f6f6_19
- h3 := f0f3_2 + f1f2_2 + f4f9_38 + f5f8_38 + f6f7_38
- h4 := f0f4_2 + f1f3_4 + f2f2 + f5f9_76 + f6f8_38 + f7f7_38
- h5 := f0f5_2 + f1f4_2 + f2f3_2 + f6f9_38 + f7f8_38
- h6 := f0f6_2 + f1f5_4 + f2f4_2 + f3f3_2 + f7f9_76 + f8f8_19
- h7 := f0f7_2 + f1f6_2 + f2f5_2 + f3f4_2 + f8f9_38
- h8 := f0f8_2 + f1f7_4 + f2f6_2 + f3f5_4 + f4f4 + f9f9_38
- h9 := f0f9_2 + f1f8_2 + f2f7_2 + f3f6_2 + f4f5_2
- var carry [10]int64
-
- carry[0] = (h0 + (1 << 25)) >> 26
- h1 += carry[0]
- h0 -= carry[0] << 26
- carry[4] = (h4 + (1 << 25)) >> 26
- h5 += carry[4]
- h4 -= carry[4] << 26
-
- carry[1] = (h1 + (1 << 24)) >> 25
- h2 += carry[1]
- h1 -= carry[1] << 25
- carry[5] = (h5 + (1 << 24)) >> 25
- h6 += carry[5]
- h5 -= carry[5] << 25
-
- carry[2] = (h2 + (1 << 25)) >> 26
- h3 += carry[2]
- h2 -= carry[2] << 26
- carry[6] = (h6 + (1 << 25)) >> 26
- h7 += carry[6]
- h6 -= carry[6] << 26
-
- carry[3] = (h3 + (1 << 24)) >> 25
- h4 += carry[3]
- h3 -= carry[3] << 25
- carry[7] = (h7 + (1 << 24)) >> 25
- h8 += carry[7]
- h7 -= carry[7] << 25
-
- carry[4] = (h4 + (1 << 25)) >> 26
- h5 += carry[4]
- h4 -= carry[4] << 26
- carry[8] = (h8 + (1 << 25)) >> 26
- h9 += carry[8]
- h8 -= carry[8] << 26
-
- carry[9] = (h9 + (1 << 24)) >> 25
- h0 += carry[9] * 19
- h9 -= carry[9] << 25
-
- carry[0] = (h0 + (1 << 25)) >> 26
- h1 += carry[0]
- h0 -= carry[0] << 26
-
- h[0] = int32(h0)
- h[1] = int32(h1)
- h[2] = int32(h2)
- h[3] = int32(h3)
- h[4] = int32(h4)
- h[5] = int32(h5)
- h[6] = int32(h6)
- h[7] = int32(h7)
- h[8] = int32(h8)
- h[9] = int32(h9)
-}
-
-// feMul121666 calculates h = f * 121666. Can overlap h with f.
-//
-// Preconditions:
-// |f| bounded by 1.1*2^26,1.1*2^25,1.1*2^26,1.1*2^25,etc.
-//
-// Postconditions:
-// |h| bounded by 1.1*2^25,1.1*2^24,1.1*2^25,1.1*2^24,etc.
-func feMul121666(h, f *fieldElement) {
- h0 := int64(f[0]) * 121666
- h1 := int64(f[1]) * 121666
- h2 := int64(f[2]) * 121666
- h3 := int64(f[3]) * 121666
- h4 := int64(f[4]) * 121666
- h5 := int64(f[5]) * 121666
- h6 := int64(f[6]) * 121666
- h7 := int64(f[7]) * 121666
- h8 := int64(f[8]) * 121666
- h9 := int64(f[9]) * 121666
- var carry [10]int64
-
- carry[9] = (h9 + (1 << 24)) >> 25
- h0 += carry[9] * 19
- h9 -= carry[9] << 25
- carry[1] = (h1 + (1 << 24)) >> 25
- h2 += carry[1]
- h1 -= carry[1] << 25
- carry[3] = (h3 + (1 << 24)) >> 25
- h4 += carry[3]
- h3 -= carry[3] << 25
- carry[5] = (h5 + (1 << 24)) >> 25
- h6 += carry[5]
- h5 -= carry[5] << 25
- carry[7] = (h7 + (1 << 24)) >> 25
- h8 += carry[7]
- h7 -= carry[7] << 25
-
- carry[0] = (h0 + (1 << 25)) >> 26
- h1 += carry[0]
- h0 -= carry[0] << 26
- carry[2] = (h2 + (1 << 25)) >> 26
- h3 += carry[2]
- h2 -= carry[2] << 26
- carry[4] = (h4 + (1 << 25)) >> 26
- h5 += carry[4]
- h4 -= carry[4] << 26
- carry[6] = (h6 + (1 << 25)) >> 26
- h7 += carry[6]
- h6 -= carry[6] << 26
- carry[8] = (h8 + (1 << 25)) >> 26
- h9 += carry[8]
- h8 -= carry[8] << 26
-
- h[0] = int32(h0)
- h[1] = int32(h1)
- h[2] = int32(h2)
- h[3] = int32(h3)
- h[4] = int32(h4)
- h[5] = int32(h5)
- h[6] = int32(h6)
- h[7] = int32(h7)
- h[8] = int32(h8)
- h[9] = int32(h9)
-}
-
-// feInvert sets out = z^-1.
-func feInvert(out, z *fieldElement) {
- var t0, t1, t2, t3 fieldElement
- var i int
-
- feSquare(&t0, z)
- for i = 1; i < 1; i++ {
- feSquare(&t0, &t0)
- }
- feSquare(&t1, &t0)
- for i = 1; i < 2; i++ {
- feSquare(&t1, &t1)
- }
- feMul(&t1, z, &t1)
- feMul(&t0, &t0, &t1)
- feSquare(&t2, &t0)
- for i = 1; i < 1; i++ {
- feSquare(&t2, &t2)
- }
- feMul(&t1, &t1, &t2)
- feSquare(&t2, &t1)
- for i = 1; i < 5; i++ {
- feSquare(&t2, &t2)
- }
- feMul(&t1, &t2, &t1)
- feSquare(&t2, &t1)
- for i = 1; i < 10; i++ {
- feSquare(&t2, &t2)
- }
- feMul(&t2, &t2, &t1)
- feSquare(&t3, &t2)
- for i = 1; i < 20; i++ {
- feSquare(&t3, &t3)
- }
- feMul(&t2, &t3, &t2)
- feSquare(&t2, &t2)
- for i = 1; i < 10; i++ {
- feSquare(&t2, &t2)
- }
- feMul(&t1, &t2, &t1)
- feSquare(&t2, &t1)
- for i = 1; i < 50; i++ {
- feSquare(&t2, &t2)
- }
- feMul(&t2, &t2, &t1)
- feSquare(&t3, &t2)
- for i = 1; i < 100; i++ {
- feSquare(&t3, &t3)
- }
- feMul(&t2, &t3, &t2)
- feSquare(&t2, &t2)
- for i = 1; i < 50; i++ {
- feSquare(&t2, &t2)
- }
- feMul(&t1, &t2, &t1)
- feSquare(&t1, &t1)
- for i = 1; i < 5; i++ {
- feSquare(&t1, &t1)
- }
- feMul(out, &t1, &t0)
-}
-
-func scalarMult(out, in, base *[32]byte) {
- var e [32]byte
-
- copy(e[:], in[:])
- e[0] &= 248
- e[31] &= 127
- e[31] |= 64
-
- var x1, x2, z2, x3, z3, tmp0, tmp1 fieldElement
- feFromBytes(&x1, base)
- feOne(&x2)
- feCopy(&x3, &x1)
- feOne(&z3)
-
- swap := int32(0)
- for pos := 254; pos >= 0; pos-- {
- b := e[pos/8] >> uint(pos&7)
- b &= 1
- swap ^= int32(b)
- feCSwap(&x2, &x3, swap)
- feCSwap(&z2, &z3, swap)
- swap = int32(b)
-
- feSub(&tmp0, &x3, &z3)
- feSub(&tmp1, &x2, &z2)
- feAdd(&x2, &x2, &z2)
- feAdd(&z2, &x3, &z3)
- feMul(&z3, &tmp0, &x2)
- feMul(&z2, &z2, &tmp1)
- feSquare(&tmp0, &tmp1)
- feSquare(&tmp1, &x2)
- feAdd(&x3, &z3, &z2)
- feSub(&z2, &z3, &z2)
- feMul(&x2, &tmp1, &tmp0)
- feSub(&tmp1, &tmp1, &tmp0)
- feSquare(&z2, &z2)
- feMul121666(&z3, &tmp1)
- feSquare(&x3, &x3)
- feAdd(&tmp0, &tmp0, &z3)
- feMul(&z3, &x1, &z2)
- feMul(&z2, &tmp1, &tmp0)
- }
-
- feCSwap(&x2, &x3, swap)
- feCSwap(&z2, &z3, swap)
-
- feInvert(&z2, &z2)
- feMul(&x2, &x2, &z2)
- feToBytes(out, &x2)
-}
diff --git a/vendor/golang.org/x/crypto/curve25519/doc.go b/vendor/golang.org/x/crypto/curve25519/doc.go
deleted file mode 100644
index f7db9c1c..00000000
--- a/vendor/golang.org/x/crypto/curve25519/doc.go
+++ /dev/null
@@ -1,23 +0,0 @@
-// Copyright 2012 The Go Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style
-// license that can be found in the LICENSE file.
-
-// Package curve25519 provides an implementation of scalar multiplication on
-// the elliptic curve known as curve25519. See http://cr.yp.to/ecdh.html
-package curve25519
-
-// basePoint is the x coordinate of the generator of the curve.
-var basePoint = [32]byte{9, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}
-
-// ScalarMult sets dst to the product in*base where dst and base are the x
-// coordinates of group points and all values are in little-endian form.
-func ScalarMult(dst, in, base *[32]byte) {
- scalarMult(dst, in, base)
-}
-
-// ScalarBaseMult sets dst to the product in*base where dst and base are the x
-// coordinates of group points, base is the standard generator and all values
-// are in little-endian form.
-func ScalarBaseMult(dst, in *[32]byte) {
- ScalarMult(dst, in, &basePoint)
-}
diff --git a/vendor/golang.org/x/crypto/curve25519/freeze_amd64.s b/vendor/golang.org/x/crypto/curve25519/freeze_amd64.s
deleted file mode 100644
index 37599fac..00000000
--- a/vendor/golang.org/x/crypto/curve25519/freeze_amd64.s
+++ /dev/null
@@ -1,94 +0,0 @@
-// Copyright 2012 The Go Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style
-// license that can be found in the LICENSE file.
-
-// This code was translated into a form compatible with 6a from the public
-// domain sources in SUPERCOP: http://bench.cr.yp.to/supercop.html
-
-// +build amd64,!gccgo,!appengine
-
-// func freeze(inout *[5]uint64)
-TEXT ·freeze(SB),7,$96-8
- MOVQ inout+0(FP), DI
-
- MOVQ SP,R11
- MOVQ $31,CX
- NOTQ CX
- ANDQ CX,SP
- ADDQ $32,SP
-
- MOVQ R11,0(SP)
- MOVQ R12,8(SP)
- MOVQ R13,16(SP)
- MOVQ R14,24(SP)
- MOVQ R15,32(SP)
- MOVQ BX,40(SP)
- MOVQ BP,48(SP)
- MOVQ 0(DI),SI
- MOVQ 8(DI),DX
- MOVQ 16(DI),CX
- MOVQ 24(DI),R8
- MOVQ 32(DI),R9
- MOVQ ·REDMASK51(SB),AX
- MOVQ AX,R10
- SUBQ $18,R10
- MOVQ $3,R11
-REDUCELOOP:
- MOVQ SI,R12
- SHRQ $51,R12
- ANDQ AX,SI
- ADDQ R12,DX
- MOVQ DX,R12
- SHRQ $51,R12
- ANDQ AX,DX
- ADDQ R12,CX
- MOVQ CX,R12
- SHRQ $51,R12
- ANDQ AX,CX
- ADDQ R12,R8
- MOVQ R8,R12
- SHRQ $51,R12
- ANDQ AX,R8
- ADDQ R12,R9
- MOVQ R9,R12
- SHRQ $51,R12
- ANDQ AX,R9
- IMUL3Q $19,R12,R12
- ADDQ R12,SI
- SUBQ $1,R11
- JA REDUCELOOP
- MOVQ $1,R12
- CMPQ R10,SI
- CMOVQLT R11,R12
- CMPQ AX,DX
- CMOVQNE R11,R12
- CMPQ AX,CX
- CMOVQNE R11,R12
- CMPQ AX,R8
- CMOVQNE R11,R12
- CMPQ AX,R9
- CMOVQNE R11,R12
- NEGQ R12
- ANDQ R12,AX
- ANDQ R12,R10
- SUBQ R10,SI
- SUBQ AX,DX
- SUBQ AX,CX
- SUBQ AX,R8
- SUBQ AX,R9
- MOVQ SI,0(DI)
- MOVQ DX,8(DI)
- MOVQ CX,16(DI)
- MOVQ R8,24(DI)
- MOVQ R9,32(DI)
- MOVQ 0(SP),R11
- MOVQ 8(SP),R12
- MOVQ 16(SP),R13
- MOVQ 24(SP),R14
- MOVQ 32(SP),R15
- MOVQ 40(SP),BX
- MOVQ 48(SP),BP
- MOVQ R11,SP
- MOVQ DI,AX
- MOVQ SI,DX
- RET
diff --git a/vendor/golang.org/x/crypto/curve25519/ladderstep_amd64.s b/vendor/golang.org/x/crypto/curve25519/ladderstep_amd64.s
deleted file mode 100644
index 3949f9cf..00000000
--- a/vendor/golang.org/x/crypto/curve25519/ladderstep_amd64.s
+++ /dev/null
@@ -1,1398 +0,0 @@
-// Copyright 2012 The Go Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style
-// license that can be found in the LICENSE file.
-
-// This code was translated into a form compatible with 6a from the public
-// domain sources in SUPERCOP: http://bench.cr.yp.to/supercop.html
-
-// +build amd64,!gccgo,!appengine
-
-// func ladderstep(inout *[5][5]uint64)
-TEXT ·ladderstep(SB),0,$384-8
- MOVQ inout+0(FP),DI
-
- MOVQ SP,R11
- MOVQ $31,CX
- NOTQ CX
- ANDQ CX,SP
- ADDQ $32,SP
-
- MOVQ R11,0(SP)
- MOVQ R12,8(SP)
- MOVQ R13,16(SP)
- MOVQ R14,24(SP)
- MOVQ R15,32(SP)
- MOVQ BX,40(SP)
- MOVQ BP,48(SP)
- MOVQ 40(DI),SI
- MOVQ 48(DI),DX
- MOVQ 56(DI),CX
- MOVQ 64(DI),R8
- MOVQ 72(DI),R9
- MOVQ SI,AX
- MOVQ DX,R10
- MOVQ CX,R11
- MOVQ R8,R12
- MOVQ R9,R13
- ADDQ ·_2P0(SB),AX
- ADDQ ·_2P1234(SB),R10
- ADDQ ·_2P1234(SB),R11
- ADDQ ·_2P1234(SB),R12
- ADDQ ·_2P1234(SB),R13
- ADDQ 80(DI),SI
- ADDQ 88(DI),DX
- ADDQ 96(DI),CX
- ADDQ 104(DI),R8
- ADDQ 112(DI),R9
- SUBQ 80(DI),AX
- SUBQ 88(DI),R10
- SUBQ 96(DI),R11
- SUBQ 104(DI),R12
- SUBQ 112(DI),R13
- MOVQ SI,56(SP)
- MOVQ DX,64(SP)
- MOVQ CX,72(SP)
- MOVQ R8,80(SP)
- MOVQ R9,88(SP)
- MOVQ AX,96(SP)
- MOVQ R10,104(SP)
- MOVQ R11,112(SP)
- MOVQ R12,120(SP)
- MOVQ R13,128(SP)
- MOVQ 96(SP),AX
- MULQ 96(SP)
- MOVQ AX,SI
- MOVQ DX,CX
- MOVQ 96(SP),AX
- SHLQ $1,AX
- MULQ 104(SP)
- MOVQ AX,R8
- MOVQ DX,R9
- MOVQ 96(SP),AX
- SHLQ $1,AX
- MULQ 112(SP)
- MOVQ AX,R10
- MOVQ DX,R11
- MOVQ 96(SP),AX
- SHLQ $1,AX
- MULQ 120(SP)
- MOVQ AX,R12
- MOVQ DX,R13
- MOVQ 96(SP),AX
- SHLQ $1,AX
- MULQ 128(SP)
- MOVQ AX,R14
- MOVQ DX,R15
- MOVQ 104(SP),AX
- MULQ 104(SP)
- ADDQ AX,R10
- ADCQ DX,R11
- MOVQ 104(SP),AX
- SHLQ $1,AX
- MULQ 112(SP)
- ADDQ AX,R12
- ADCQ DX,R13
- MOVQ 104(SP),AX
- SHLQ $1,AX
- MULQ 120(SP)
- ADDQ AX,R14
- ADCQ DX,R15
- MOVQ 104(SP),DX
- IMUL3Q $38,DX,AX
- MULQ 128(SP)
- ADDQ AX,SI
- ADCQ DX,CX
- MOVQ 112(SP),AX
- MULQ 112(SP)
- ADDQ AX,R14
- ADCQ DX,R15
- MOVQ 112(SP),DX
- IMUL3Q $38,DX,AX
- MULQ 120(SP)
- ADDQ AX,SI
- ADCQ DX,CX
- MOVQ 112(SP),DX
- IMUL3Q $38,DX,AX
- MULQ 128(SP)
- ADDQ AX,R8
- ADCQ DX,R9
- MOVQ 120(SP),DX
- IMUL3Q $19,DX,AX
- MULQ 120(SP)
- ADDQ AX,R8
- ADCQ DX,R9
- MOVQ 120(SP),DX
- IMUL3Q $38,DX,AX
- MULQ 128(SP)
- ADDQ AX,R10
- ADCQ DX,R11
- MOVQ 128(SP),DX
- IMUL3Q $19,DX,AX
- MULQ 128(SP)
- ADDQ AX,R12
- ADCQ DX,R13
- MOVQ ·REDMASK51(SB),DX
- SHLQ $13,CX:SI
- ANDQ DX,SI
- SHLQ $13,R9:R8
- ANDQ DX,R8
- ADDQ CX,R8
- SHLQ $13,R11:R10
- ANDQ DX,R10
- ADDQ R9,R10
- SHLQ $13,R13:R12
- ANDQ DX,R12
- ADDQ R11,R12
- SHLQ $13,R15:R14
- ANDQ DX,R14
- ADDQ R13,R14
- IMUL3Q $19,R15,CX
- ADDQ CX,SI
- MOVQ SI,CX
- SHRQ $51,CX
- ADDQ R8,CX
- ANDQ DX,SI
- MOVQ CX,R8
- SHRQ $51,CX
- ADDQ R10,CX
- ANDQ DX,R8
- MOVQ CX,R9
- SHRQ $51,CX
- ADDQ R12,CX
- ANDQ DX,R9
- MOVQ CX,AX
- SHRQ $51,CX
- ADDQ R14,CX
- ANDQ DX,AX
- MOVQ CX,R10
- SHRQ $51,CX
- IMUL3Q $19,CX,CX
- ADDQ CX,SI
- ANDQ DX,R10
- MOVQ SI,136(SP)
- MOVQ R8,144(SP)
- MOVQ R9,152(SP)
- MOVQ AX,160(SP)
- MOVQ R10,168(SP)
- MOVQ 56(SP),AX
- MULQ 56(SP)
- MOVQ AX,SI
- MOVQ DX,CX
- MOVQ 56(SP),AX
- SHLQ $1,AX
- MULQ 64(SP)
- MOVQ AX,R8
- MOVQ DX,R9
- MOVQ 56(SP),AX
- SHLQ $1,AX
- MULQ 72(SP)
- MOVQ AX,R10
- MOVQ DX,R11
- MOVQ 56(SP),AX
- SHLQ $1,AX
- MULQ 80(SP)
- MOVQ AX,R12
- MOVQ DX,R13
- MOVQ 56(SP),AX
- SHLQ $1,AX
- MULQ 88(SP)
- MOVQ AX,R14
- MOVQ DX,R15
- MOVQ 64(SP),AX
- MULQ 64(SP)
- ADDQ AX,R10
- ADCQ DX,R11
- MOVQ 64(SP),AX
- SHLQ $1,AX
- MULQ 72(SP)
- ADDQ AX,R12
- ADCQ DX,R13
- MOVQ 64(SP),AX
- SHLQ $1,AX
- MULQ 80(SP)
- ADDQ AX,R14
- ADCQ DX,R15
- MOVQ 64(SP),DX
- IMUL3Q $38,DX,AX
- MULQ 88(SP)
- ADDQ AX,SI
- ADCQ DX,CX
- MOVQ 72(SP),AX
- MULQ 72(SP)
- ADDQ AX,R14
- ADCQ DX,R15
- MOVQ 72(SP),DX
- IMUL3Q $38,DX,AX
- MULQ 80(SP)
- ADDQ AX,SI
- ADCQ DX,CX
- MOVQ 72(SP),DX
- IMUL3Q $38,DX,AX
- MULQ 88(SP)
- ADDQ AX,R8
- ADCQ DX,R9
- MOVQ 80(SP),DX
- IMUL3Q $19,DX,AX
- MULQ 80(SP)
- ADDQ AX,R8
- ADCQ DX,R9
- MOVQ 80(SP),DX
- IMUL3Q $38,DX,AX
- MULQ 88(SP)
- ADDQ AX,R10
- ADCQ DX,R11
- MOVQ 88(SP),DX
- IMUL3Q $19,DX,AX
- MULQ 88(SP)
- ADDQ AX,R12
- ADCQ DX,R13
- MOVQ ·REDMASK51(SB),DX
- SHLQ $13,CX:SI
- ANDQ DX,SI
- SHLQ $13,R9:R8
- ANDQ DX,R8
- ADDQ CX,R8
- SHLQ $13,R11:R10
- ANDQ DX,R10
- ADDQ R9,R10
- SHLQ $13,R13:R12
- ANDQ DX,R12
- ADDQ R11,R12
- SHLQ $13,R15:R14
- ANDQ DX,R14
- ADDQ R13,R14
- IMUL3Q $19,R15,CX
- ADDQ CX,SI
- MOVQ SI,CX
- SHRQ $51,CX
- ADDQ R8,CX
- ANDQ DX,SI
- MOVQ CX,R8
- SHRQ $51,CX
- ADDQ R10,CX
- ANDQ DX,R8
- MOVQ CX,R9
- SHRQ $51,CX
- ADDQ R12,CX
- ANDQ DX,R9
- MOVQ CX,AX
- SHRQ $51,CX
- ADDQ R14,CX
- ANDQ DX,AX
- MOVQ CX,R10
- SHRQ $51,CX
- IMUL3Q $19,CX,CX
- ADDQ CX,SI
- ANDQ DX,R10
- MOVQ SI,176(SP)
- MOVQ R8,184(SP)
- MOVQ R9,192(SP)
- MOVQ AX,200(SP)
- MOVQ R10,208(SP)
- MOVQ SI,SI
- MOVQ R8,DX
- MOVQ R9,CX
- MOVQ AX,R8
- MOVQ R10,R9
- ADDQ ·_2P0(SB),SI
- ADDQ ·_2P1234(SB),DX
- ADDQ ·_2P1234(SB),CX
- ADDQ ·_2P1234(SB),R8
- ADDQ ·_2P1234(SB),R9
- SUBQ 136(SP),SI
- SUBQ 144(SP),DX
- SUBQ 152(SP),CX
- SUBQ 160(SP),R8
- SUBQ 168(SP),R9
- MOVQ SI,216(SP)
- MOVQ DX,224(SP)
- MOVQ CX,232(SP)
- MOVQ R8,240(SP)
- MOVQ R9,248(SP)
- MOVQ 120(DI),SI
- MOVQ 128(DI),DX
- MOVQ 136(DI),CX
- MOVQ 144(DI),R8
- MOVQ 152(DI),R9
- MOVQ SI,AX
- MOVQ DX,R10
- MOVQ CX,R11
- MOVQ R8,R12
- MOVQ R9,R13
- ADDQ ·_2P0(SB),AX
- ADDQ ·_2P1234(SB),R10
- ADDQ ·_2P1234(SB),R11
- ADDQ ·_2P1234(SB),R12
- ADDQ ·_2P1234(SB),R13
- ADDQ 160(DI),SI
- ADDQ 168(DI),DX
- ADDQ 176(DI),CX
- ADDQ 184(DI),R8
- ADDQ 192(DI),R9
- SUBQ 160(DI),AX
- SUBQ 168(DI),R10
- SUBQ 176(DI),R11
- SUBQ 184(DI),R12
- SUBQ 192(DI),R13
- MOVQ SI,256(SP)
- MOVQ DX,264(SP)
- MOVQ CX,272(SP)
- MOVQ R8,280(SP)
- MOVQ R9,288(SP)
- MOVQ AX,296(SP)
- MOVQ R10,304(SP)
- MOVQ R11,312(SP)
- MOVQ R12,320(SP)
- MOVQ R13,328(SP)
- MOVQ 280(SP),SI
- IMUL3Q $19,SI,AX
- MOVQ AX,336(SP)
- MULQ 112(SP)
- MOVQ AX,SI
- MOVQ DX,CX
- MOVQ 288(SP),DX
- IMUL3Q $19,DX,AX
- MOVQ AX,344(SP)
- MULQ 104(SP)
- ADDQ AX,SI
- ADCQ DX,CX
- MOVQ 256(SP),AX
- MULQ 96(SP)
- ADDQ AX,SI
- ADCQ DX,CX
- MOVQ 256(SP),AX
- MULQ 104(SP)
- MOVQ AX,R8
- MOVQ DX,R9
- MOVQ 256(SP),AX
- MULQ 112(SP)
- MOVQ AX,R10
- MOVQ DX,R11
- MOVQ 256(SP),AX
- MULQ 120(SP)
- MOVQ AX,R12
- MOVQ DX,R13
- MOVQ 256(SP),AX
- MULQ 128(SP)
- MOVQ AX,R14
- MOVQ DX,R15
- MOVQ 264(SP),AX
- MULQ 96(SP)
- ADDQ AX,R8
- ADCQ DX,R9
- MOVQ 264(SP),AX
- MULQ 104(SP)
- ADDQ AX,R10
- ADCQ DX,R11
- MOVQ 264(SP),AX
- MULQ 112(SP)
- ADDQ AX,R12
- ADCQ DX,R13
- MOVQ 264(SP),AX
- MULQ 120(SP)
- ADDQ AX,R14
- ADCQ DX,R15
- MOVQ 264(SP),DX
- IMUL3Q $19,DX,AX
- MULQ 128(SP)
- ADDQ AX,SI
- ADCQ DX,CX
- MOVQ 272(SP),AX
- MULQ 96(SP)
- ADDQ AX,R10
- ADCQ DX,R11
- MOVQ 272(SP),AX
- MULQ 104(SP)
- ADDQ AX,R12
- ADCQ DX,R13
- MOVQ 272(SP),AX
- MULQ 112(SP)
- ADDQ AX,R14
- ADCQ DX,R15
- MOVQ 272(SP),DX
- IMUL3Q $19,DX,AX
- MULQ 120(SP)
- ADDQ AX,SI
- ADCQ DX,CX
- MOVQ 272(SP),DX
- IMUL3Q $19,DX,AX
- MULQ 128(SP)
- ADDQ AX,R8
- ADCQ DX,R9
- MOVQ 280(SP),AX
- MULQ 96(SP)
- ADDQ AX,R12
- ADCQ DX,R13
- MOVQ 280(SP),AX
- MULQ 104(SP)
- ADDQ AX,R14
- ADCQ DX,R15
- MOVQ 336(SP),AX
- MULQ 120(SP)
- ADDQ AX,R8
- ADCQ DX,R9
- MOVQ 336(SP),AX
- MULQ 128(SP)
- ADDQ AX,R10
- ADCQ DX,R11
- MOVQ 288(SP),AX
- MULQ 96(SP)
- ADDQ AX,R14
- ADCQ DX,R15
- MOVQ 344(SP),AX
- MULQ 112(SP)
- ADDQ AX,R8
- ADCQ DX,R9
- MOVQ 344(SP),AX
- MULQ 120(SP)
- ADDQ AX,R10
- ADCQ DX,R11
- MOVQ 344(SP),AX
- MULQ 128(SP)
- ADDQ AX,R12
- ADCQ DX,R13
- MOVQ ·REDMASK51(SB),DX
- SHLQ $13,CX:SI
- ANDQ DX,SI
- SHLQ $13,R9:R8
- ANDQ DX,R8
- ADDQ CX,R8
- SHLQ $13,R11:R10
- ANDQ DX,R10
- ADDQ R9,R10
- SHLQ $13,R13:R12
- ANDQ DX,R12
- ADDQ R11,R12
- SHLQ $13,R15:R14
- ANDQ DX,R14
- ADDQ R13,R14
- IMUL3Q $19,R15,CX
- ADDQ CX,SI
- MOVQ SI,CX
- SHRQ $51,CX
- ADDQ R8,CX
- MOVQ CX,R8
- SHRQ $51,CX
- ANDQ DX,SI
- ADDQ R10,CX
- MOVQ CX,R9
- SHRQ $51,CX
- ANDQ DX,R8
- ADDQ R12,CX
- MOVQ CX,AX
- SHRQ $51,CX
- ANDQ DX,R9
- ADDQ R14,CX
- MOVQ CX,R10
- SHRQ $51,CX
- ANDQ DX,AX
- IMUL3Q $19,CX,CX
- ADDQ CX,SI
- ANDQ DX,R10
- MOVQ SI,96(SP)
- MOVQ R8,104(SP)
- MOVQ R9,112(SP)
- MOVQ AX,120(SP)
- MOVQ R10,128(SP)
- MOVQ 320(SP),SI
- IMUL3Q $19,SI,AX
- MOVQ AX,256(SP)
- MULQ 72(SP)
- MOVQ AX,SI
- MOVQ DX,CX
- MOVQ 328(SP),DX
- IMUL3Q $19,DX,AX
- MOVQ AX,264(SP)
- MULQ 64(SP)
- ADDQ AX,SI
- ADCQ DX,CX
- MOVQ 296(SP),AX
- MULQ 56(SP)
- ADDQ AX,SI
- ADCQ DX,CX
- MOVQ 296(SP),AX
- MULQ 64(SP)
- MOVQ AX,R8
- MOVQ DX,R9
- MOVQ 296(SP),AX
- MULQ 72(SP)
- MOVQ AX,R10
- MOVQ DX,R11
- MOVQ 296(SP),AX
- MULQ 80(SP)
- MOVQ AX,R12
- MOVQ DX,R13
- MOVQ 296(SP),AX
- MULQ 88(SP)
- MOVQ AX,R14
- MOVQ DX,R15
- MOVQ 304(SP),AX
- MULQ 56(SP)
- ADDQ AX,R8
- ADCQ DX,R9
- MOVQ 304(SP),AX
- MULQ 64(SP)
- ADDQ AX,R10
- ADCQ DX,R11
- MOVQ 304(SP),AX
- MULQ 72(SP)
- ADDQ AX,R12
- ADCQ DX,R13
- MOVQ 304(SP),AX
- MULQ 80(SP)
- ADDQ AX,R14
- ADCQ DX,R15
- MOVQ 304(SP),DX
- IMUL3Q $19,DX,AX
- MULQ 88(SP)
- ADDQ AX,SI
- ADCQ DX,CX
- MOVQ 312(SP),AX
- MULQ 56(SP)
- ADDQ AX,R10
- ADCQ DX,R11
- MOVQ 312(SP),AX
- MULQ 64(SP)
- ADDQ AX,R12
- ADCQ DX,R13
- MOVQ 312(SP),AX
- MULQ 72(SP)
- ADDQ AX,R14
- ADCQ DX,R15
- MOVQ 312(SP),DX
- IMUL3Q $19,DX,AX
- MULQ 80(SP)
- ADDQ AX,SI
- ADCQ DX,CX
- MOVQ 312(SP),DX
- IMUL3Q $19,DX,AX
- MULQ 88(SP)
- ADDQ AX,R8
- ADCQ DX,R9
- MOVQ 320(SP),AX
- MULQ 56(SP)
- ADDQ AX,R12
- ADCQ DX,R13
- MOVQ 320(SP),AX
- MULQ 64(SP)
- ADDQ AX,R14
- ADCQ DX,R15
- MOVQ 256(SP),AX
- MULQ 80(SP)
- ADDQ AX,R8
- ADCQ DX,R9
- MOVQ 256(SP),AX
- MULQ 88(SP)
- ADDQ AX,R10
- ADCQ DX,R11
- MOVQ 328(SP),AX
- MULQ 56(SP)
- ADDQ AX,R14
- ADCQ DX,R15
- MOVQ 264(SP),AX
- MULQ 72(SP)
- ADDQ AX,R8
- ADCQ DX,R9
- MOVQ 264(SP),AX
- MULQ 80(SP)
- ADDQ AX,R10
- ADCQ DX,R11
- MOVQ 264(SP),AX
- MULQ 88(SP)
- ADDQ AX,R12
- ADCQ DX,R13
- MOVQ ·REDMASK51(SB),DX
- SHLQ $13,CX:SI
- ANDQ DX,SI
- SHLQ $13,R9:R8
- ANDQ DX,R8
- ADDQ CX,R8
- SHLQ $13,R11:R10
- ANDQ DX,R10
- ADDQ R9,R10
- SHLQ $13,R13:R12
- ANDQ DX,R12
- ADDQ R11,R12
- SHLQ $13,R15:R14
- ANDQ DX,R14
- ADDQ R13,R14
- IMUL3Q $19,R15,CX
- ADDQ CX,SI
- MOVQ SI,CX
- SHRQ $51,CX
- ADDQ R8,CX
- MOVQ CX,R8
- SHRQ $51,CX
- ANDQ DX,SI
- ADDQ R10,CX
- MOVQ CX,R9
- SHRQ $51,CX
- ANDQ DX,R8
- ADDQ R12,CX
- MOVQ CX,AX
- SHRQ $51,CX
- ANDQ DX,R9
- ADDQ R14,CX
- MOVQ CX,R10
- SHRQ $51,CX
- ANDQ DX,AX
- IMUL3Q $19,CX,CX
- ADDQ CX,SI
- ANDQ DX,R10
- MOVQ SI,DX
- MOVQ R8,CX
- MOVQ R9,R11
- MOVQ AX,R12
- MOVQ R10,R13
- ADDQ ·_2P0(SB),DX
- ADDQ ·_2P1234(SB),CX
- ADDQ ·_2P1234(SB),R11
- ADDQ ·_2P1234(SB),R12
- ADDQ ·_2P1234(SB),R13
- ADDQ 96(SP),SI
- ADDQ 104(SP),R8
- ADDQ 112(SP),R9
- ADDQ 120(SP),AX
- ADDQ 128(SP),R10
- SUBQ 96(SP),DX
- SUBQ 104(SP),CX
- SUBQ 112(SP),R11
- SUBQ 120(SP),R12
- SUBQ 128(SP),R13
- MOVQ SI,120(DI)
- MOVQ R8,128(DI)
- MOVQ R9,136(DI)
- MOVQ AX,144(DI)
- MOVQ R10,152(DI)
- MOVQ DX,160(DI)
- MOVQ CX,168(DI)
- MOVQ R11,176(DI)
- MOVQ R12,184(DI)
- MOVQ R13,192(DI)
- MOVQ 120(DI),AX
- MULQ 120(DI)
- MOVQ AX,SI
- MOVQ DX,CX
- MOVQ 120(DI),AX
- SHLQ $1,AX
- MULQ 128(DI)
- MOVQ AX,R8
- MOVQ DX,R9
- MOVQ 120(DI),AX
- SHLQ $1,AX
- MULQ 136(DI)
- MOVQ AX,R10
- MOVQ DX,R11
- MOVQ 120(DI),AX
- SHLQ $1,AX
- MULQ 144(DI)
- MOVQ AX,R12
- MOVQ DX,R13
- MOVQ 120(DI),AX
- SHLQ $1,AX
- MULQ 152(DI)
- MOVQ AX,R14
- MOVQ DX,R15
- MOVQ 128(DI),AX
- MULQ 128(DI)
- ADDQ AX,R10
- ADCQ DX,R11
- MOVQ 128(DI),AX
- SHLQ $1,AX
- MULQ 136(DI)
- ADDQ AX,R12
- ADCQ DX,R13
- MOVQ 128(DI),AX
- SHLQ $1,AX
- MULQ 144(DI)
- ADDQ AX,R14
- ADCQ DX,R15
- MOVQ 128(DI),DX
- IMUL3Q $38,DX,AX
- MULQ 152(DI)
- ADDQ AX,SI
- ADCQ DX,CX
- MOVQ 136(DI),AX
- MULQ 136(DI)
- ADDQ AX,R14
- ADCQ DX,R15
- MOVQ 136(DI),DX
- IMUL3Q $38,DX,AX
- MULQ 144(DI)
- ADDQ AX,SI
- ADCQ DX,CX
- MOVQ 136(DI),DX
- IMUL3Q $38,DX,AX
- MULQ 152(DI)
- ADDQ AX,R8
- ADCQ DX,R9
- MOVQ 144(DI),DX
- IMUL3Q $19,DX,AX
- MULQ 144(DI)
- ADDQ AX,R8
- ADCQ DX,R9
- MOVQ 144(DI),DX
- IMUL3Q $38,DX,AX
- MULQ 152(DI)
- ADDQ AX,R10
- ADCQ DX,R11
- MOVQ 152(DI),DX
- IMUL3Q $19,DX,AX
- MULQ 152(DI)
- ADDQ AX,R12
- ADCQ DX,R13
- MOVQ ·REDMASK51(SB),DX
- SHLQ $13,CX:SI
- ANDQ DX,SI
- SHLQ $13,R9:R8
- ANDQ DX,R8
- ADDQ CX,R8
- SHLQ $13,R11:R10
- ANDQ DX,R10
- ADDQ R9,R10
- SHLQ $13,R13:R12
- ANDQ DX,R12
- ADDQ R11,R12
- SHLQ $13,R15:R14
- ANDQ DX,R14
- ADDQ R13,R14
- IMUL3Q $19,R15,CX
- ADDQ CX,SI
- MOVQ SI,CX
- SHRQ $51,CX
- ADDQ R8,CX
- ANDQ DX,SI
- MOVQ CX,R8
- SHRQ $51,CX
- ADDQ R10,CX
- ANDQ DX,R8
- MOVQ CX,R9
- SHRQ $51,CX
- ADDQ R12,CX
- ANDQ DX,R9
- MOVQ CX,AX
- SHRQ $51,CX
- ADDQ R14,CX
- ANDQ DX,AX
- MOVQ CX,R10
- SHRQ $51,CX
- IMUL3Q $19,CX,CX
- ADDQ CX,SI
- ANDQ DX,R10
- MOVQ SI,120(DI)
- MOVQ R8,128(DI)
- MOVQ R9,136(DI)
- MOVQ AX,144(DI)
- MOVQ R10,152(DI)
- MOVQ 160(DI),AX
- MULQ 160(DI)
- MOVQ AX,SI
- MOVQ DX,CX
- MOVQ 160(DI),AX
- SHLQ $1,AX
- MULQ 168(DI)
- MOVQ AX,R8
- MOVQ DX,R9
- MOVQ 160(DI),AX
- SHLQ $1,AX
- MULQ 176(DI)
- MOVQ AX,R10
- MOVQ DX,R11
- MOVQ 160(DI),AX
- SHLQ $1,AX
- MULQ 184(DI)
- MOVQ AX,R12
- MOVQ DX,R13
- MOVQ 160(DI),AX
- SHLQ $1,AX
- MULQ 192(DI)
- MOVQ AX,R14
- MOVQ DX,R15
- MOVQ 168(DI),AX
- MULQ 168(DI)
- ADDQ AX,R10
- ADCQ DX,R11
- MOVQ 168(DI),AX
- SHLQ $1,AX
- MULQ 176(DI)
- ADDQ AX,R12
- ADCQ DX,R13
- MOVQ 168(DI),AX
- SHLQ $1,AX
- MULQ 184(DI)
- ADDQ AX,R14
- ADCQ DX,R15
- MOVQ 168(DI),DX
- IMUL3Q $38,DX,AX
- MULQ 192(DI)
- ADDQ AX,SI
- ADCQ DX,CX
- MOVQ 176(DI),AX
- MULQ 176(DI)
- ADDQ AX,R14
- ADCQ DX,R15
- MOVQ 176(DI),DX
- IMUL3Q $38,DX,AX
- MULQ 184(DI)
- ADDQ AX,SI
- ADCQ DX,CX
- MOVQ 176(DI),DX
- IMUL3Q $38,DX,AX
- MULQ 192(DI)
- ADDQ AX,R8
- ADCQ DX,R9
- MOVQ 184(DI),DX
- IMUL3Q $19,DX,AX
- MULQ 184(DI)
- ADDQ AX,R8
- ADCQ DX,R9
- MOVQ 184(DI),DX
- IMUL3Q $38,DX,AX
- MULQ 192(DI)
- ADDQ AX,R10
- ADCQ DX,R11
- MOVQ 192(DI),DX
- IMUL3Q $19,DX,AX
- MULQ 192(DI)
- ADDQ AX,R12
- ADCQ DX,R13
- MOVQ ·REDMASK51(SB),DX
- SHLQ $13,CX:SI
- ANDQ DX,SI
- SHLQ $13,R9:R8
- ANDQ DX,R8
- ADDQ CX,R8
- SHLQ $13,R11:R10
- ANDQ DX,R10
- ADDQ R9,R10
- SHLQ $13,R13:R12
- ANDQ DX,R12
- ADDQ R11,R12
- SHLQ $13,R15:R14
- ANDQ DX,R14
- ADDQ R13,R14
- IMUL3Q $19,R15,CX
- ADDQ CX,SI
- MOVQ SI,CX
- SHRQ $51,CX
- ADDQ R8,CX
- ANDQ DX,SI
- MOVQ CX,R8
- SHRQ $51,CX
- ADDQ R10,CX
- ANDQ DX,R8
- MOVQ CX,R9
- SHRQ $51,CX
- ADDQ R12,CX
- ANDQ DX,R9
- MOVQ CX,AX
- SHRQ $51,CX
- ADDQ R14,CX
- ANDQ DX,AX
- MOVQ CX,R10
- SHRQ $51,CX
- IMUL3Q $19,CX,CX
- ADDQ CX,SI
- ANDQ DX,R10
- MOVQ SI,160(DI)
- MOVQ R8,168(DI)
- MOVQ R9,176(DI)
- MOVQ AX,184(DI)
- MOVQ R10,192(DI)
- MOVQ 184(DI),SI
- IMUL3Q $19,SI,AX
- MOVQ AX,56(SP)
- MULQ 16(DI)
- MOVQ AX,SI
- MOVQ DX,CX
- MOVQ 192(DI),DX
- IMUL3Q $19,DX,AX
- MOVQ AX,64(SP)
- MULQ 8(DI)
- ADDQ AX,SI
- ADCQ DX,CX
- MOVQ 160(DI),AX
- MULQ 0(DI)
- ADDQ AX,SI
- ADCQ DX,CX
- MOVQ 160(DI),AX
- MULQ 8(DI)
- MOVQ AX,R8
- MOVQ DX,R9
- MOVQ 160(DI),AX
- MULQ 16(DI)
- MOVQ AX,R10
- MOVQ DX,R11
- MOVQ 160(DI),AX
- MULQ 24(DI)
- MOVQ AX,R12
- MOVQ DX,R13
- MOVQ 160(DI),AX
- MULQ 32(DI)
- MOVQ AX,R14
- MOVQ DX,R15
- MOVQ 168(DI),AX
- MULQ 0(DI)
- ADDQ AX,R8
- ADCQ DX,R9
- MOVQ 168(DI),AX
- MULQ 8(DI)
- ADDQ AX,R10
- ADCQ DX,R11
- MOVQ 168(DI),AX
- MULQ 16(DI)
- ADDQ AX,R12
- ADCQ DX,R13
- MOVQ 168(DI),AX
- MULQ 24(DI)
- ADDQ AX,R14
- ADCQ DX,R15
- MOVQ 168(DI),DX
- IMUL3Q $19,DX,AX
- MULQ 32(DI)
- ADDQ AX,SI
- ADCQ DX,CX
- MOVQ 176(DI),AX
- MULQ 0(DI)
- ADDQ AX,R10
- ADCQ DX,R11
- MOVQ 176(DI),AX
- MULQ 8(DI)
- ADDQ AX,R12
- ADCQ DX,R13
- MOVQ 176(DI),AX
- MULQ 16(DI)
- ADDQ AX,R14
- ADCQ DX,R15
- MOVQ 176(DI),DX
- IMUL3Q $19,DX,AX
- MULQ 24(DI)
- ADDQ AX,SI
- ADCQ DX,CX
- MOVQ 176(DI),DX
- IMUL3Q $19,DX,AX
- MULQ 32(DI)
- ADDQ AX,R8
- ADCQ DX,R9
- MOVQ 184(DI),AX
- MULQ 0(DI)
- ADDQ AX,R12
- ADCQ DX,R13
- MOVQ 184(DI),AX
- MULQ 8(DI)
- ADDQ AX,R14
- ADCQ DX,R15
- MOVQ 56(SP),AX
- MULQ 24(DI)
- ADDQ AX,R8
- ADCQ DX,R9
- MOVQ 56(SP),AX
- MULQ 32(DI)
- ADDQ AX,R10
- ADCQ DX,R11
- MOVQ 192(DI),AX
- MULQ 0(DI)
- ADDQ AX,R14
- ADCQ DX,R15
- MOVQ 64(SP),AX
- MULQ 16(DI)
- ADDQ AX,R8
- ADCQ DX,R9
- MOVQ 64(SP),AX
- MULQ 24(DI)
- ADDQ AX,R10
- ADCQ DX,R11
- MOVQ 64(SP),AX
- MULQ 32(DI)
- ADDQ AX,R12
- ADCQ DX,R13
- MOVQ ·REDMASK51(SB),DX
- SHLQ $13,CX:SI
- ANDQ DX,SI
- SHLQ $13,R9:R8
- ANDQ DX,R8
- ADDQ CX,R8
- SHLQ $13,R11:R10
- ANDQ DX,R10
- ADDQ R9,R10
- SHLQ $13,R13:R12
- ANDQ DX,R12
- ADDQ R11,R12
- SHLQ $13,R15:R14
- ANDQ DX,R14
- ADDQ R13,R14
- IMUL3Q $19,R15,CX
- ADDQ CX,SI
- MOVQ SI,CX
- SHRQ $51,CX
- ADDQ R8,CX
- MOVQ CX,R8
- SHRQ $51,CX
- ANDQ DX,SI
- ADDQ R10,CX
- MOVQ CX,R9
- SHRQ $51,CX
- ANDQ DX,R8
- ADDQ R12,CX
- MOVQ CX,AX
- SHRQ $51,CX
- ANDQ DX,R9
- ADDQ R14,CX
- MOVQ CX,R10
- SHRQ $51,CX
- ANDQ DX,AX
- IMUL3Q $19,CX,CX
- ADDQ CX,SI
- ANDQ DX,R10
- MOVQ SI,160(DI)
- MOVQ R8,168(DI)
- MOVQ R9,176(DI)
- MOVQ AX,184(DI)
- MOVQ R10,192(DI)
- MOVQ 200(SP),SI
- IMUL3Q $19,SI,AX
- MOVQ AX,56(SP)
- MULQ 152(SP)
- MOVQ AX,SI
- MOVQ DX,CX
- MOVQ 208(SP),DX
- IMUL3Q $19,DX,AX
- MOVQ AX,64(SP)
- MULQ 144(SP)
- ADDQ AX,SI
- ADCQ DX,CX
- MOVQ 176(SP),AX
- MULQ 136(SP)
- ADDQ AX,SI
- ADCQ DX,CX
- MOVQ 176(SP),AX
- MULQ 144(SP)
- MOVQ AX,R8
- MOVQ DX,R9
- MOVQ 176(SP),AX
- MULQ 152(SP)
- MOVQ AX,R10
- MOVQ DX,R11
- MOVQ 176(SP),AX
- MULQ 160(SP)
- MOVQ AX,R12
- MOVQ DX,R13
- MOVQ 176(SP),AX
- MULQ 168(SP)
- MOVQ AX,R14
- MOVQ DX,R15
- MOVQ 184(SP),AX
- MULQ 136(SP)
- ADDQ AX,R8
- ADCQ DX,R9
- MOVQ 184(SP),AX
- MULQ 144(SP)
- ADDQ AX,R10
- ADCQ DX,R11
- MOVQ 184(SP),AX
- MULQ 152(SP)
- ADDQ AX,R12
- ADCQ DX,R13
- MOVQ 184(SP),AX
- MULQ 160(SP)
- ADDQ AX,R14
- ADCQ DX,R15
- MOVQ 184(SP),DX
- IMUL3Q $19,DX,AX
- MULQ 168(SP)
- ADDQ AX,SI
- ADCQ DX,CX
- MOVQ 192(SP),AX
- MULQ 136(SP)
- ADDQ AX,R10
- ADCQ DX,R11
- MOVQ 192(SP),AX
- MULQ 144(SP)
- ADDQ AX,R12
- ADCQ DX,R13
- MOVQ 192(SP),AX
- MULQ 152(SP)
- ADDQ AX,R14
- ADCQ DX,R15
- MOVQ 192(SP),DX
- IMUL3Q $19,DX,AX
- MULQ 160(SP)
- ADDQ AX,SI
- ADCQ DX,CX
- MOVQ 192(SP),DX
- IMUL3Q $19,DX,AX
- MULQ 168(SP)
- ADDQ AX,R8
- ADCQ DX,R9
- MOVQ 200(SP),AX
- MULQ 136(SP)
- ADDQ AX,R12
- ADCQ DX,R13
- MOVQ 200(SP),AX
- MULQ 144(SP)
- ADDQ AX,R14
- ADCQ DX,R15
- MOVQ 56(SP),AX
- MULQ 160(SP)
- ADDQ AX,R8
- ADCQ DX,R9
- MOVQ 56(SP),AX
- MULQ 168(SP)
- ADDQ AX,R10
- ADCQ DX,R11
- MOVQ 208(SP),AX
- MULQ 136(SP)
- ADDQ AX,R14
- ADCQ DX,R15
- MOVQ 64(SP),AX
- MULQ 152(SP)
- ADDQ AX,R8
- ADCQ DX,R9
- MOVQ 64(SP),AX
- MULQ 160(SP)
- ADDQ AX,R10
- ADCQ DX,R11
- MOVQ 64(SP),AX
- MULQ 168(SP)
- ADDQ AX,R12
- ADCQ DX,R13
- MOVQ ·REDMASK51(SB),DX
- SHLQ $13,CX:SI
- ANDQ DX,SI
- SHLQ $13,R9:R8
- ANDQ DX,R8
- ADDQ CX,R8
- SHLQ $13,R11:R10
- ANDQ DX,R10
- ADDQ R9,R10
- SHLQ $13,R13:R12
- ANDQ DX,R12
- ADDQ R11,R12
- SHLQ $13,R15:R14
- ANDQ DX,R14
- ADDQ R13,R14
- IMUL3Q $19,R15,CX
- ADDQ CX,SI
- MOVQ SI,CX
- SHRQ $51,CX
- ADDQ R8,CX
- MOVQ CX,R8
- SHRQ $51,CX
- ANDQ DX,SI
- ADDQ R10,CX
- MOVQ CX,R9
- SHRQ $51,CX
- ANDQ DX,R8
- ADDQ R12,CX
- MOVQ CX,AX
- SHRQ $51,CX
- ANDQ DX,R9
- ADDQ R14,CX
- MOVQ CX,R10
- SHRQ $51,CX
- ANDQ DX,AX
- IMUL3Q $19,CX,CX
- ADDQ CX,SI
- ANDQ DX,R10
- MOVQ SI,40(DI)
- MOVQ R8,48(DI)
- MOVQ R9,56(DI)
- MOVQ AX,64(DI)
- MOVQ R10,72(DI)
- MOVQ 216(SP),AX
- MULQ ·_121666_213(SB)
- SHRQ $13,AX
- MOVQ AX,SI
- MOVQ DX,CX
- MOVQ 224(SP),AX
- MULQ ·_121666_213(SB)
- SHRQ $13,AX
- ADDQ AX,CX
- MOVQ DX,R8
- MOVQ 232(SP),AX
- MULQ ·_121666_213(SB)
- SHRQ $13,AX
- ADDQ AX,R8
- MOVQ DX,R9
- MOVQ 240(SP),AX
- MULQ ·_121666_213(SB)
- SHRQ $13,AX
- ADDQ AX,R9
- MOVQ DX,R10
- MOVQ 248(SP),AX
- MULQ ·_121666_213(SB)
- SHRQ $13,AX
- ADDQ AX,R10
- IMUL3Q $19,DX,DX
- ADDQ DX,SI
- ADDQ 136(SP),SI
- ADDQ 144(SP),CX
- ADDQ 152(SP),R8
- ADDQ 160(SP),R9
- ADDQ 168(SP),R10
- MOVQ SI,80(DI)
- MOVQ CX,88(DI)
- MOVQ R8,96(DI)
- MOVQ R9,104(DI)
- MOVQ R10,112(DI)
- MOVQ 104(DI),SI
- IMUL3Q $19,SI,AX
- MOVQ AX,56(SP)
- MULQ 232(SP)
- MOVQ AX,SI
- MOVQ DX,CX
- MOVQ 112(DI),DX
- IMUL3Q $19,DX,AX
- MOVQ AX,64(SP)
- MULQ 224(SP)
- ADDQ AX,SI
- ADCQ DX,CX
- MOVQ 80(DI),AX
- MULQ 216(SP)
- ADDQ AX,SI
- ADCQ DX,CX
- MOVQ 80(DI),AX
- MULQ 224(SP)
- MOVQ AX,R8
- MOVQ DX,R9
- MOVQ 80(DI),AX
- MULQ 232(SP)
- MOVQ AX,R10
- MOVQ DX,R11
- MOVQ 80(DI),AX
- MULQ 240(SP)
- MOVQ AX,R12
- MOVQ DX,R13
- MOVQ 80(DI),AX
- MULQ 248(SP)
- MOVQ AX,R14
- MOVQ DX,R15
- MOVQ 88(DI),AX
- MULQ 216(SP)
- ADDQ AX,R8
- ADCQ DX,R9
- MOVQ 88(DI),AX
- MULQ 224(SP)
- ADDQ AX,R10
- ADCQ DX,R11
- MOVQ 88(DI),AX
- MULQ 232(SP)
- ADDQ AX,R12
- ADCQ DX,R13
- MOVQ 88(DI),AX
- MULQ 240(SP)
- ADDQ AX,R14
- ADCQ DX,R15
- MOVQ 88(DI),DX
- IMUL3Q $19,DX,AX
- MULQ 248(SP)
- ADDQ AX,SI
- ADCQ DX,CX
- MOVQ 96(DI),AX
- MULQ 216(SP)
- ADDQ AX,R10
- ADCQ DX,R11
- MOVQ 96(DI),AX
- MULQ 224(SP)
- ADDQ AX,R12
- ADCQ DX,R13
- MOVQ 96(DI),AX
- MULQ 232(SP)
- ADDQ AX,R14
- ADCQ DX,R15
- MOVQ 96(DI),DX
- IMUL3Q $19,DX,AX
- MULQ 240(SP)
- ADDQ AX,SI
- ADCQ DX,CX
- MOVQ 96(DI),DX
- IMUL3Q $19,DX,AX
- MULQ 248(SP)
- ADDQ AX,R8
- ADCQ DX,R9
- MOVQ 104(DI),AX
- MULQ 216(SP)
- ADDQ AX,R12
- ADCQ DX,R13
- MOVQ 104(DI),AX
- MULQ 224(SP)
- ADDQ AX,R14
- ADCQ DX,R15
- MOVQ 56(SP),AX
- MULQ 240(SP)
- ADDQ AX,R8
- ADCQ DX,R9
- MOVQ 56(SP),AX
- MULQ 248(SP)
- ADDQ AX,R10
- ADCQ DX,R11
- MOVQ 112(DI),AX
- MULQ 216(SP)
- ADDQ AX,R14
- ADCQ DX,R15
- MOVQ 64(SP),AX
- MULQ 232(SP)
- ADDQ AX,R8
- ADCQ DX,R9
- MOVQ 64(SP),AX
- MULQ 240(SP)
- ADDQ AX,R10
- ADCQ DX,R11
- MOVQ 64(SP),AX
- MULQ 248(SP)
- ADDQ AX,R12
- ADCQ DX,R13
- MOVQ ·REDMASK51(SB),DX
- SHLQ $13,CX:SI
- ANDQ DX,SI
- SHLQ $13,R9:R8
- ANDQ DX,R8
- ADDQ CX,R8
- SHLQ $13,R11:R10
- ANDQ DX,R10
- ADDQ R9,R10
- SHLQ $13,R13:R12
- ANDQ DX,R12
- ADDQ R11,R12
- SHLQ $13,R15:R14
- ANDQ DX,R14
- ADDQ R13,R14
- IMUL3Q $19,R15,CX
- ADDQ CX,SI
- MOVQ SI,CX
- SHRQ $51,CX
- ADDQ R8,CX
- MOVQ CX,R8
- SHRQ $51,CX
- ANDQ DX,SI
- ADDQ R10,CX
- MOVQ CX,R9
- SHRQ $51,CX
- ANDQ DX,R8
- ADDQ R12,CX
- MOVQ CX,AX
- SHRQ $51,CX
- ANDQ DX,R9
- ADDQ R14,CX
- MOVQ CX,R10
- SHRQ $51,CX
- ANDQ DX,AX
- IMUL3Q $19,CX,CX
- ADDQ CX,SI
- ANDQ DX,R10
- MOVQ SI,80(DI)
- MOVQ R8,88(DI)
- MOVQ R9,96(DI)
- MOVQ AX,104(DI)
- MOVQ R10,112(DI)
- MOVQ 0(SP),R11
- MOVQ 8(SP),R12
- MOVQ 16(SP),R13
- MOVQ 24(SP),R14
- MOVQ 32(SP),R15
- MOVQ 40(SP),BX
- MOVQ 48(SP),BP
- MOVQ R11,SP
- MOVQ DI,AX
- MOVQ SI,DX
- RET
diff --git a/vendor/golang.org/x/crypto/curve25519/mont25519_amd64.go b/vendor/golang.org/x/crypto/curve25519/mont25519_amd64.go
deleted file mode 100644
index 5822bd53..00000000
--- a/vendor/golang.org/x/crypto/curve25519/mont25519_amd64.go
+++ /dev/null
@@ -1,240 +0,0 @@
-// Copyright 2012 The Go Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style
-// license that can be found in the LICENSE file.
-
-// +build amd64,!gccgo,!appengine
-
-package curve25519
-
-// These functions are implemented in the .s files. The names of the functions
-// in the rest of the file are also taken from the SUPERCOP sources to help
-// people following along.
-
-//go:noescape
-
-func cswap(inout *[5]uint64, v uint64)
-
-//go:noescape
-
-func ladderstep(inout *[5][5]uint64)
-
-//go:noescape
-
-func freeze(inout *[5]uint64)
-
-//go:noescape
-
-func mul(dest, a, b *[5]uint64)
-
-//go:noescape
-
-func square(out, in *[5]uint64)
-
-// mladder uses a Montgomery ladder to calculate (xr/zr) *= s.
-func mladder(xr, zr *[5]uint64, s *[32]byte) {
- var work [5][5]uint64
-
- work[0] = *xr
- setint(&work[1], 1)
- setint(&work[2], 0)
- work[3] = *xr
- setint(&work[4], 1)
-
- j := uint(6)
- var prevbit byte
-
- for i := 31; i >= 0; i-- {
- for j < 8 {
- bit := ((*s)[i] >> j) & 1
- swap := bit ^ prevbit
- prevbit = bit
- cswap(&work[1], uint64(swap))
- ladderstep(&work)
- j--
- }
- j = 7
- }
-
- *xr = work[1]
- *zr = work[2]
-}
-
-func scalarMult(out, in, base *[32]byte) {
- var e [32]byte
- copy(e[:], (*in)[:])
- e[0] &= 248
- e[31] &= 127
- e[31] |= 64
-
- var t, z [5]uint64
- unpack(&t, base)
- mladder(&t, &z, &e)
- invert(&z, &z)
- mul(&t, &t, &z)
- pack(out, &t)
-}
-
-func setint(r *[5]uint64, v uint64) {
- r[0] = v
- r[1] = 0
- r[2] = 0
- r[3] = 0
- r[4] = 0
-}
-
-// unpack sets r = x where r consists of 5, 51-bit limbs in little-endian
-// order.
-func unpack(r *[5]uint64, x *[32]byte) {
- r[0] = uint64(x[0]) |
- uint64(x[1])<<8 |
- uint64(x[2])<<16 |
- uint64(x[3])<<24 |
- uint64(x[4])<<32 |
- uint64(x[5])<<40 |
- uint64(x[6]&7)<<48
-
- r[1] = uint64(x[6])>>3 |
- uint64(x[7])<<5 |
- uint64(x[8])<<13 |
- uint64(x[9])<<21 |
- uint64(x[10])<<29 |
- uint64(x[11])<<37 |
- uint64(x[12]&63)<<45
-
- r[2] = uint64(x[12])>>6 |
- uint64(x[13])<<2 |
- uint64(x[14])<<10 |
- uint64(x[15])<<18 |
- uint64(x[16])<<26 |
- uint64(x[17])<<34 |
- uint64(x[18])<<42 |
- uint64(x[19]&1)<<50
-
- r[3] = uint64(x[19])>>1 |
- uint64(x[20])<<7 |
- uint64(x[21])<<15 |
- uint64(x[22])<<23 |
- uint64(x[23])<<31 |
- uint64(x[24])<<39 |
- uint64(x[25]&15)<<47
-
- r[4] = uint64(x[25])>>4 |
- uint64(x[26])<<4 |
- uint64(x[27])<<12 |
- uint64(x[28])<<20 |
- uint64(x[29])<<28 |
- uint64(x[30])<<36 |
- uint64(x[31]&127)<<44
-}
-
-// pack sets out = x where out is the usual, little-endian form of the 5,
-// 51-bit limbs in x.
-func pack(out *[32]byte, x *[5]uint64) {
- t := *x
- freeze(&t)
-
- out[0] = byte(t[0])
- out[1] = byte(t[0] >> 8)
- out[2] = byte(t[0] >> 16)
- out[3] = byte(t[0] >> 24)
- out[4] = byte(t[0] >> 32)
- out[5] = byte(t[0] >> 40)
- out[6] = byte(t[0] >> 48)
-
- out[6] ^= byte(t[1]<<3) & 0xf8
- out[7] = byte(t[1] >> 5)
- out[8] = byte(t[1] >> 13)
- out[9] = byte(t[1] >> 21)
- out[10] = byte(t[1] >> 29)
- out[11] = byte(t[1] >> 37)
- out[12] = byte(t[1] >> 45)
-
- out[12] ^= byte(t[2]<<6) & 0xc0
- out[13] = byte(t[2] >> 2)
- out[14] = byte(t[2] >> 10)
- out[15] = byte(t[2] >> 18)
- out[16] = byte(t[2] >> 26)
- out[17] = byte(t[2] >> 34)
- out[18] = byte(t[2] >> 42)
- out[19] = byte(t[2] >> 50)
-
- out[19] ^= byte(t[3]<<1) & 0xfe
- out[20] = byte(t[3] >> 7)
- out[21] = byte(t[3] >> 15)
- out[22] = byte(t[3] >> 23)
- out[23] = byte(t[3] >> 31)
- out[24] = byte(t[3] >> 39)
- out[25] = byte(t[3] >> 47)
-
- out[25] ^= byte(t[4]<<4) & 0xf0
- out[26] = byte(t[4] >> 4)
- out[27] = byte(t[4] >> 12)
- out[28] = byte(t[4] >> 20)
- out[29] = byte(t[4] >> 28)
- out[30] = byte(t[4] >> 36)
- out[31] = byte(t[4] >> 44)
-}
-
-// invert calculates r = x^-1 mod p using Fermat's little theorem.
-func invert(r *[5]uint64, x *[5]uint64) {
- var z2, z9, z11, z2_5_0, z2_10_0, z2_20_0, z2_50_0, z2_100_0, t [5]uint64
-
- square(&z2, x) /* 2 */
- square(&t, &z2) /* 4 */
- square(&t, &t) /* 8 */
- mul(&z9, &t, x) /* 9 */
- mul(&z11, &z9, &z2) /* 11 */
- square(&t, &z11) /* 22 */
- mul(&z2_5_0, &t, &z9) /* 2^5 - 2^0 = 31 */
-
- square(&t, &z2_5_0) /* 2^6 - 2^1 */
- for i := 1; i < 5; i++ { /* 2^20 - 2^10 */
- square(&t, &t)
- }
- mul(&z2_10_0, &t, &z2_5_0) /* 2^10 - 2^0 */
-
- square(&t, &z2_10_0) /* 2^11 - 2^1 */
- for i := 1; i < 10; i++ { /* 2^20 - 2^10 */
- square(&t, &t)
- }
- mul(&z2_20_0, &t, &z2_10_0) /* 2^20 - 2^0 */
-
- square(&t, &z2_20_0) /* 2^21 - 2^1 */
- for i := 1; i < 20; i++ { /* 2^40 - 2^20 */
- square(&t, &t)
- }
- mul(&t, &t, &z2_20_0) /* 2^40 - 2^0 */
-
- square(&t, &t) /* 2^41 - 2^1 */
- for i := 1; i < 10; i++ { /* 2^50 - 2^10 */
- square(&t, &t)
- }
- mul(&z2_50_0, &t, &z2_10_0) /* 2^50 - 2^0 */
-
- square(&t, &z2_50_0) /* 2^51 - 2^1 */
- for i := 1; i < 50; i++ { /* 2^100 - 2^50 */
- square(&t, &t)
- }
- mul(&z2_100_0, &t, &z2_50_0) /* 2^100 - 2^0 */
-
- square(&t, &z2_100_0) /* 2^101 - 2^1 */
- for i := 1; i < 100; i++ { /* 2^200 - 2^100 */
- square(&t, &t)
- }
- mul(&t, &t, &z2_100_0) /* 2^200 - 2^0 */
-
- square(&t, &t) /* 2^201 - 2^1 */
- for i := 1; i < 50; i++ { /* 2^250 - 2^50 */
- square(&t, &t)
- }
- mul(&t, &t, &z2_50_0) /* 2^250 - 2^0 */
-
- square(&t, &t) /* 2^251 - 2^1 */
- square(&t, &t) /* 2^252 - 2^2 */
- square(&t, &t) /* 2^253 - 2^3 */
-
- square(&t, &t) /* 2^254 - 2^4 */
-
- square(&t, &t) /* 2^255 - 2^5 */
- mul(r, &t, &z11) /* 2^255 - 21 */
-}
diff --git a/vendor/golang.org/x/crypto/curve25519/mul_amd64.s b/vendor/golang.org/x/crypto/curve25519/mul_amd64.s
deleted file mode 100644
index e48d183e..00000000
--- a/vendor/golang.org/x/crypto/curve25519/mul_amd64.s
+++ /dev/null
@@ -1,191 +0,0 @@
-// Copyright 2012 The Go Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style
-// license that can be found in the LICENSE file.
-
-// This code was translated into a form compatible with 6a from the public
-// domain sources in SUPERCOP: http://bench.cr.yp.to/supercop.html
-
-// +build amd64,!gccgo,!appengine
-
-// func mul(dest, a, b *[5]uint64)
-TEXT ·mul(SB),0,$128-24
- MOVQ dest+0(FP), DI
- MOVQ a+8(FP), SI
- MOVQ b+16(FP), DX
-
- MOVQ SP,R11
- MOVQ $31,CX
- NOTQ CX
- ANDQ CX,SP
- ADDQ $32,SP
-
- MOVQ R11,0(SP)
- MOVQ R12,8(SP)
- MOVQ R13,16(SP)
- MOVQ R14,24(SP)
- MOVQ R15,32(SP)
- MOVQ BX,40(SP)
- MOVQ BP,48(SP)
- MOVQ DI,56(SP)
- MOVQ DX,CX
- MOVQ 24(SI),DX
- IMUL3Q $19,DX,AX
- MOVQ AX,64(SP)
- MULQ 16(CX)
- MOVQ AX,R8
- MOVQ DX,R9
- MOVQ 32(SI),DX
- IMUL3Q $19,DX,AX
- MOVQ AX,72(SP)
- MULQ 8(CX)
- ADDQ AX,R8
- ADCQ DX,R9
- MOVQ 0(SI),AX
- MULQ 0(CX)
- ADDQ AX,R8
- ADCQ DX,R9
- MOVQ 0(SI),AX
- MULQ 8(CX)
- MOVQ AX,R10
- MOVQ DX,R11
- MOVQ 0(SI),AX
- MULQ 16(CX)
- MOVQ AX,R12
- MOVQ DX,R13
- MOVQ 0(SI),AX
- MULQ 24(CX)
- MOVQ AX,R14
- MOVQ DX,R15
- MOVQ 0(SI),AX
- MULQ 32(CX)
- MOVQ AX,BX
- MOVQ DX,BP
- MOVQ 8(SI),AX
- MULQ 0(CX)
- ADDQ AX,R10
- ADCQ DX,R11
- MOVQ 8(SI),AX
- MULQ 8(CX)
- ADDQ AX,R12
- ADCQ DX,R13
- MOVQ 8(SI),AX
- MULQ 16(CX)
- ADDQ AX,R14
- ADCQ DX,R15
- MOVQ 8(SI),AX
- MULQ 24(CX)
- ADDQ AX,BX
- ADCQ DX,BP
- MOVQ 8(SI),DX
- IMUL3Q $19,DX,AX
- MULQ 32(CX)
- ADDQ AX,R8
- ADCQ DX,R9
- MOVQ 16(SI),AX
- MULQ 0(CX)
- ADDQ AX,R12
- ADCQ DX,R13
- MOVQ 16(SI),AX
- MULQ 8(CX)
- ADDQ AX,R14
- ADCQ DX,R15
- MOVQ 16(SI),AX
- MULQ 16(CX)
- ADDQ AX,BX
- ADCQ DX,BP
- MOVQ 16(SI),DX
- IMUL3Q $19,DX,AX
- MULQ 24(CX)
- ADDQ AX,R8
- ADCQ DX,R9
- MOVQ 16(SI),DX
- IMUL3Q $19,DX,AX
- MULQ 32(CX)
- ADDQ AX,R10
- ADCQ DX,R11
- MOVQ 24(SI),AX
- MULQ 0(CX)
- ADDQ AX,R14
- ADCQ DX,R15
- MOVQ 24(SI),AX
- MULQ 8(CX)
- ADDQ AX,BX
- ADCQ DX,BP
- MOVQ 64(SP),AX
- MULQ 24(CX)
- ADDQ AX,R10
- ADCQ DX,R11
- MOVQ 64(SP),AX
- MULQ 32(CX)
- ADDQ AX,R12
- ADCQ DX,R13
- MOVQ 32(SI),AX
- MULQ 0(CX)
- ADDQ AX,BX
- ADCQ DX,BP
- MOVQ 72(SP),AX
- MULQ 16(CX)
- ADDQ AX,R10
- ADCQ DX,R11
- MOVQ 72(SP),AX
- MULQ 24(CX)
- ADDQ AX,R12
- ADCQ DX,R13
- MOVQ 72(SP),AX
- MULQ 32(CX)
- ADDQ AX,R14
- ADCQ DX,R15
- MOVQ ·REDMASK51(SB),SI
- SHLQ $13,R9:R8
- ANDQ SI,R8
- SHLQ $13,R11:R10
- ANDQ SI,R10
- ADDQ R9,R10
- SHLQ $13,R13:R12
- ANDQ SI,R12
- ADDQ R11,R12
- SHLQ $13,R15:R14
- ANDQ SI,R14
- ADDQ R13,R14
- SHLQ $13,BP:BX
- ANDQ SI,BX
- ADDQ R15,BX
- IMUL3Q $19,BP,DX
- ADDQ DX,R8
- MOVQ R8,DX
- SHRQ $51,DX
- ADDQ R10,DX
- MOVQ DX,CX
- SHRQ $51,DX
- ANDQ SI,R8
- ADDQ R12,DX
- MOVQ DX,R9
- SHRQ $51,DX
- ANDQ SI,CX
- ADDQ R14,DX
- MOVQ DX,AX
- SHRQ $51,DX
- ANDQ SI,R9
- ADDQ BX,DX
- MOVQ DX,R10
- SHRQ $51,DX
- ANDQ SI,AX
- IMUL3Q $19,DX,DX
- ADDQ DX,R8
- ANDQ SI,R10
- MOVQ R8,0(DI)
- MOVQ CX,8(DI)
- MOVQ R9,16(DI)
- MOVQ AX,24(DI)
- MOVQ R10,32(DI)
- MOVQ 0(SP),R11
- MOVQ 8(SP),R12
- MOVQ 16(SP),R13
- MOVQ 24(SP),R14
- MOVQ 32(SP),R15
- MOVQ 40(SP),BX
- MOVQ 48(SP),BP
- MOVQ R11,SP
- MOVQ DI,AX
- MOVQ SI,DX
- RET
diff --git a/vendor/golang.org/x/crypto/curve25519/square_amd64.s b/vendor/golang.org/x/crypto/curve25519/square_amd64.s
deleted file mode 100644
index 78d1a50d..00000000
--- a/vendor/golang.org/x/crypto/curve25519/square_amd64.s
+++ /dev/null
@@ -1,153 +0,0 @@
-// Copyright 2012 The Go Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style
-// license that can be found in the LICENSE file.
-
-// This code was translated into a form compatible with 6a from the public
-// domain sources in SUPERCOP: http://bench.cr.yp.to/supercop.html
-
-// +build amd64,!gccgo,!appengine
-
-// func square(out, in *[5]uint64)
-TEXT ·square(SB),7,$96-16
- MOVQ out+0(FP), DI
- MOVQ in+8(FP), SI
-
- MOVQ SP,R11
- MOVQ $31,CX
- NOTQ CX
- ANDQ CX,SP
- ADDQ $32, SP
-
- MOVQ R11,0(SP)
- MOVQ R12,8(SP)
- MOVQ R13,16(SP)
- MOVQ R14,24(SP)
- MOVQ R15,32(SP)
- MOVQ BX,40(SP)
- MOVQ BP,48(SP)
- MOVQ 0(SI),AX
- MULQ 0(SI)
- MOVQ AX,CX
- MOVQ DX,R8
- MOVQ 0(SI),AX
- SHLQ $1,AX
- MULQ 8(SI)
- MOVQ AX,R9
- MOVQ DX,R10
- MOVQ 0(SI),AX
- SHLQ $1,AX
- MULQ 16(SI)
- MOVQ AX,R11
- MOVQ DX,R12
- MOVQ 0(SI),AX
- SHLQ $1,AX
- MULQ 24(SI)
- MOVQ AX,R13
- MOVQ DX,R14
- MOVQ 0(SI),AX
- SHLQ $1,AX
- MULQ 32(SI)
- MOVQ AX,R15
- MOVQ DX,BX
- MOVQ 8(SI),AX
- MULQ 8(SI)
- ADDQ AX,R11
- ADCQ DX,R12
- MOVQ 8(SI),AX
- SHLQ $1,AX
- MULQ 16(SI)
- ADDQ AX,R13
- ADCQ DX,R14
- MOVQ 8(SI),AX
- SHLQ $1,AX
- MULQ 24(SI)
- ADDQ AX,R15
- ADCQ DX,BX
- MOVQ 8(SI),DX
- IMUL3Q $38,DX,AX
- MULQ 32(SI)
- ADDQ AX,CX
- ADCQ DX,R8
- MOVQ 16(SI),AX
- MULQ 16(SI)
- ADDQ AX,R15
- ADCQ DX,BX
- MOVQ 16(SI),DX
- IMUL3Q $38,DX,AX
- MULQ 24(SI)
- ADDQ AX,CX
- ADCQ DX,R8
- MOVQ 16(SI),DX
- IMUL3Q $38,DX,AX
- MULQ 32(SI)
- ADDQ AX,R9
- ADCQ DX,R10
- MOVQ 24(SI),DX
- IMUL3Q $19,DX,AX
- MULQ 24(SI)
- ADDQ AX,R9
- ADCQ DX,R10
- MOVQ 24(SI),DX
- IMUL3Q $38,DX,AX
- MULQ 32(SI)
- ADDQ AX,R11
- ADCQ DX,R12
- MOVQ 32(SI),DX
- IMUL3Q $19,DX,AX
- MULQ 32(SI)
- ADDQ AX,R13
- ADCQ DX,R14
- MOVQ ·REDMASK51(SB),SI
- SHLQ $13,R8:CX
- ANDQ SI,CX
- SHLQ $13,R10:R9
- ANDQ SI,R9
- ADDQ R8,R9
- SHLQ $13,R12:R11
- ANDQ SI,R11
- ADDQ R10,R11
- SHLQ $13,R14:R13
- ANDQ SI,R13
- ADDQ R12,R13
- SHLQ $13,BX:R15
- ANDQ SI,R15
- ADDQ R14,R15
- IMUL3Q $19,BX,DX
- ADDQ DX,CX
- MOVQ CX,DX
- SHRQ $51,DX
- ADDQ R9,DX
- ANDQ SI,CX
- MOVQ DX,R8
- SHRQ $51,DX
- ADDQ R11,DX
- ANDQ SI,R8
- MOVQ DX,R9
- SHRQ $51,DX
- ADDQ R13,DX
- ANDQ SI,R9
- MOVQ DX,AX
- SHRQ $51,DX
- ADDQ R15,DX
- ANDQ SI,AX
- MOVQ DX,R10
- SHRQ $51,DX
- IMUL3Q $19,DX,DX
- ADDQ DX,CX
- ANDQ SI,R10
- MOVQ CX,0(DI)
- MOVQ R8,8(DI)
- MOVQ R9,16(DI)
- MOVQ AX,24(DI)
- MOVQ R10,32(DI)
- MOVQ 0(SP),R11
- MOVQ 8(SP),R12
- MOVQ 16(SP),R13
- MOVQ 24(SP),R14
- MOVQ 32(SP),R15
- MOVQ 40(SP),BX
- MOVQ 48(SP),BP
- MOVQ R11,SP
- MOVQ DI,AX
- MOVQ SI,DX
- RET
diff --git a/vendor/golang.org/x/crypto/ssh/agent/client.go b/vendor/golang.org/x/crypto/ssh/agent/client.go
deleted file mode 100644
index d043c5be..00000000
--- a/vendor/golang.org/x/crypto/ssh/agent/client.go
+++ /dev/null
@@ -1,615 +0,0 @@
-// Copyright 2012 The Go Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style
-// license that can be found in the LICENSE file.
-
-/*
- Package agent implements a client to an ssh-agent daemon.
-
-References:
- [PROTOCOL.agent]: http://cvsweb.openbsd.org/cgi-bin/cvsweb/src/usr.bin/ssh/PROTOCOL.agent?rev=HEAD
-*/
-package agent
-
-import (
- "bytes"
- "crypto/dsa"
- "crypto/ecdsa"
- "crypto/elliptic"
- "crypto/rsa"
- "encoding/base64"
- "encoding/binary"
- "errors"
- "fmt"
- "io"
- "math/big"
- "sync"
-
- "golang.org/x/crypto/ssh"
-)
-
-// Agent represents the capabilities of an ssh-agent.
-type Agent interface {
- // List returns the identities known to the agent.
- List() ([]*Key, error)
-
- // Sign has the agent sign the data using a protocol 2 key as defined
- // in [PROTOCOL.agent] section 2.6.2.
- Sign(key ssh.PublicKey, data []byte) (*ssh.Signature, error)
-
- // Add adds a private key to the agent.
- Add(key AddedKey) error
-
- // Remove removes all identities with the given public key.
- Remove(key ssh.PublicKey) error
-
- // RemoveAll removes all identities.
- RemoveAll() error
-
- // Lock locks the agent. Sign and Remove will fail, and List will empty an empty list.
- Lock(passphrase []byte) error
-
- // Unlock undoes the effect of Lock
- Unlock(passphrase []byte) error
-
- // Signers returns signers for all the known keys.
- Signers() ([]ssh.Signer, error)
-}
-
-// AddedKey describes an SSH key to be added to an Agent.
-type AddedKey struct {
- // PrivateKey must be a *rsa.PrivateKey, *dsa.PrivateKey or
- // *ecdsa.PrivateKey, which will be inserted into the agent.
- PrivateKey interface{}
- // Certificate, if not nil, is communicated to the agent and will be
- // stored with the key.
- Certificate *ssh.Certificate
- // Comment is an optional, free-form string.
- Comment string
- // LifetimeSecs, if not zero, is the number of seconds that the
- // agent will store the key for.
- LifetimeSecs uint32
- // ConfirmBeforeUse, if true, requests that the agent confirm with the
- // user before each use of this key.
- ConfirmBeforeUse bool
-}
-
-// See [PROTOCOL.agent], section 3.
-const (
- agentRequestV1Identities = 1
-
- // 3.2 Requests from client to agent for protocol 2 key operations
- agentAddIdentity = 17
- agentRemoveIdentity = 18
- agentRemoveAllIdentities = 19
- agentAddIdConstrained = 25
-
- // 3.3 Key-type independent requests from client to agent
- agentAddSmartcardKey = 20
- agentRemoveSmartcardKey = 21
- agentLock = 22
- agentUnlock = 23
- agentAddSmartcardKeyConstrained = 26
-
- // 3.7 Key constraint identifiers
- agentConstrainLifetime = 1
- agentConstrainConfirm = 2
-)
-
-// maxAgentResponseBytes is the maximum agent reply size that is accepted. This
-// is a sanity check, not a limit in the spec.
-const maxAgentResponseBytes = 16 << 20
-
-// Agent messages:
-// These structures mirror the wire format of the corresponding ssh agent
-// messages found in [PROTOCOL.agent].
-
-// 3.4 Generic replies from agent to client
-const agentFailure = 5
-
-type failureAgentMsg struct{}
-
-const agentSuccess = 6
-
-type successAgentMsg struct{}
-
-// See [PROTOCOL.agent], section 2.5.2.
-const agentRequestIdentities = 11
-
-type requestIdentitiesAgentMsg struct{}
-
-// See [PROTOCOL.agent], section 2.5.2.
-const agentIdentitiesAnswer = 12
-
-type identitiesAnswerAgentMsg struct {
- NumKeys uint32 `sshtype:"12"`
- Keys []byte `ssh:"rest"`
-}
-
-// See [PROTOCOL.agent], section 2.6.2.
-const agentSignRequest = 13
-
-type signRequestAgentMsg struct {
- KeyBlob []byte `sshtype:"13"`
- Data []byte
- Flags uint32
-}
-
-// See [PROTOCOL.agent], section 2.6.2.
-
-// 3.6 Replies from agent to client for protocol 2 key operations
-const agentSignResponse = 14
-
-type signResponseAgentMsg struct {
- SigBlob []byte `sshtype:"14"`
-}
-
-type publicKey struct {
- Format string
- Rest []byte `ssh:"rest"`
-}
-
-// Key represents a protocol 2 public key as defined in
-// [PROTOCOL.agent], section 2.5.2.
-type Key struct {
- Format string
- Blob []byte
- Comment string
-}
-
-func clientErr(err error) error {
- return fmt.Errorf("agent: client error: %v", err)
-}
-
-// String returns the storage form of an agent key with the format, base64
-// encoded serialized key, and the comment if it is not empty.
-func (k *Key) String() string {
- s := string(k.Format) + " " + base64.StdEncoding.EncodeToString(k.Blob)
-
- if k.Comment != "" {
- s += " " + k.Comment
- }
-
- return s
-}
-
-// Type returns the public key type.
-func (k *Key) Type() string {
- return k.Format
-}
-
-// Marshal returns key blob to satisfy the ssh.PublicKey interface.
-func (k *Key) Marshal() []byte {
- return k.Blob
-}
-
-// Verify satisfies the ssh.PublicKey interface, but is not
-// implemented for agent keys.
-func (k *Key) Verify(data []byte, sig *ssh.Signature) error {
- return errors.New("agent: agent key does not know how to verify")
-}
-
-type wireKey struct {
- Format string
- Rest []byte `ssh:"rest"`
-}
-
-func parseKey(in []byte) (out *Key, rest []byte, err error) {
- var record struct {
- Blob []byte
- Comment string
- Rest []byte `ssh:"rest"`
- }
-
- if err := ssh.Unmarshal(in, &record); err != nil {
- return nil, nil, err
- }
-
- var wk wireKey
- if err := ssh.Unmarshal(record.Blob, &wk); err != nil {
- return nil, nil, err
- }
-
- return &Key{
- Format: wk.Format,
- Blob: record.Blob,
- Comment: record.Comment,
- }, record.Rest, nil
-}
-
-// client is a client for an ssh-agent process.
-type client struct {
- // conn is typically a *net.UnixConn
- conn io.ReadWriter
- // mu is used to prevent concurrent access to the agent
- mu sync.Mutex
-}
-
-// NewClient returns an Agent that talks to an ssh-agent process over
-// the given connection.
-func NewClient(rw io.ReadWriter) Agent {
- return &client{conn: rw}
-}
-
-// call sends an RPC to the agent. On success, the reply is
-// unmarshaled into reply and replyType is set to the first byte of
-// the reply, which contains the type of the message.
-func (c *client) call(req []byte) (reply interface{}, err error) {
- c.mu.Lock()
- defer c.mu.Unlock()
-
- msg := make([]byte, 4+len(req))
- binary.BigEndian.PutUint32(msg, uint32(len(req)))
- copy(msg[4:], req)
- if _, err = c.conn.Write(msg); err != nil {
- return nil, clientErr(err)
- }
-
- var respSizeBuf [4]byte
- if _, err = io.ReadFull(c.conn, respSizeBuf[:]); err != nil {
- return nil, clientErr(err)
- }
- respSize := binary.BigEndian.Uint32(respSizeBuf[:])
- if respSize > maxAgentResponseBytes {
- return nil, clientErr(err)
- }
-
- buf := make([]byte, respSize)
- if _, err = io.ReadFull(c.conn, buf); err != nil {
- return nil, clientErr(err)
- }
- reply, err = unmarshal(buf)
- if err != nil {
- return nil, clientErr(err)
- }
- return reply, err
-}
-
-func (c *client) simpleCall(req []byte) error {
- resp, err := c.call(req)
- if err != nil {
- return err
- }
- if _, ok := resp.(*successAgentMsg); ok {
- return nil
- }
- return errors.New("agent: failure")
-}
-
-func (c *client) RemoveAll() error {
- return c.simpleCall([]byte{agentRemoveAllIdentities})
-}
-
-func (c *client) Remove(key ssh.PublicKey) error {
- req := ssh.Marshal(&agentRemoveIdentityMsg{
- KeyBlob: key.Marshal(),
- })
- return c.simpleCall(req)
-}
-
-func (c *client) Lock(passphrase []byte) error {
- req := ssh.Marshal(&agentLockMsg{
- Passphrase: passphrase,
- })
- return c.simpleCall(req)
-}
-
-func (c *client) Unlock(passphrase []byte) error {
- req := ssh.Marshal(&agentUnlockMsg{
- Passphrase: passphrase,
- })
- return c.simpleCall(req)
-}
-
-// List returns the identities known to the agent.
-func (c *client) List() ([]*Key, error) {
- // see [PROTOCOL.agent] section 2.5.2.
- req := []byte{agentRequestIdentities}
-
- msg, err := c.call(req)
- if err != nil {
- return nil, err
- }
-
- switch msg := msg.(type) {
- case *identitiesAnswerAgentMsg:
- if msg.NumKeys > maxAgentResponseBytes/8 {
- return nil, errors.New("agent: too many keys in agent reply")
- }
- keys := make([]*Key, msg.NumKeys)
- data := msg.Keys
- for i := uint32(0); i < msg.NumKeys; i++ {
- var key *Key
- var err error
- if key, data, err = parseKey(data); err != nil {
- return nil, err
- }
- keys[i] = key
- }
- return keys, nil
- case *failureAgentMsg:
- return nil, errors.New("agent: failed to list keys")
- }
- panic("unreachable")
-}
-
-// Sign has the agent sign the data using a protocol 2 key as defined
-// in [PROTOCOL.agent] section 2.6.2.
-func (c *client) Sign(key ssh.PublicKey, data []byte) (*ssh.Signature, error) {
- req := ssh.Marshal(signRequestAgentMsg{
- KeyBlob: key.Marshal(),
- Data: data,
- })
-
- msg, err := c.call(req)
- if err != nil {
- return nil, err
- }
-
- switch msg := msg.(type) {
- case *signResponseAgentMsg:
- var sig ssh.Signature
- if err := ssh.Unmarshal(msg.SigBlob, &sig); err != nil {
- return nil, err
- }
-
- return &sig, nil
- case *failureAgentMsg:
- return nil, errors.New("agent: failed to sign challenge")
- }
- panic("unreachable")
-}
-
-// unmarshal parses an agent message in packet, returning the parsed
-// form and the message type of packet.
-func unmarshal(packet []byte) (interface{}, error) {
- if len(packet) < 1 {
- return nil, errors.New("agent: empty packet")
- }
- var msg interface{}
- switch packet[0] {
- case agentFailure:
- return new(failureAgentMsg), nil
- case agentSuccess:
- return new(successAgentMsg), nil
- case agentIdentitiesAnswer:
- msg = new(identitiesAnswerAgentMsg)
- case agentSignResponse:
- msg = new(signResponseAgentMsg)
- default:
- return nil, fmt.Errorf("agent: unknown type tag %d", packet[0])
- }
- if err := ssh.Unmarshal(packet, msg); err != nil {
- return nil, err
- }
- return msg, nil
-}
-
-type rsaKeyMsg struct {
- Type string `sshtype:"17"`
- N *big.Int
- E *big.Int
- D *big.Int
- Iqmp *big.Int // IQMP = Inverse Q Mod P
- P *big.Int
- Q *big.Int
- Comments string
- Constraints []byte `ssh:"rest"`
-}
-
-type dsaKeyMsg struct {
- Type string `sshtype:"17"`
- P *big.Int
- Q *big.Int
- G *big.Int
- Y *big.Int
- X *big.Int
- Comments string
- Constraints []byte `ssh:"rest"`
-}
-
-type ecdsaKeyMsg struct {
- Type string `sshtype:"17"`
- Curve string
- KeyBytes []byte
- D *big.Int
- Comments string
- Constraints []byte `ssh:"rest"`
-}
-
-// Insert adds a private key to the agent.
-func (c *client) insertKey(s interface{}, comment string, constraints []byte) error {
- var req []byte
- switch k := s.(type) {
- case *rsa.PrivateKey:
- if len(k.Primes) != 2 {
- return fmt.Errorf("agent: unsupported RSA key with %d primes", len(k.Primes))
- }
- k.Precompute()
- req = ssh.Marshal(rsaKeyMsg{
- Type: ssh.KeyAlgoRSA,
- N: k.N,
- E: big.NewInt(int64(k.E)),
- D: k.D,
- Iqmp: k.Precomputed.Qinv,
- P: k.Primes[0],
- Q: k.Primes[1],
- Comments: comment,
- Constraints: constraints,
- })
- case *dsa.PrivateKey:
- req = ssh.Marshal(dsaKeyMsg{
- Type: ssh.KeyAlgoDSA,
- P: k.P,
- Q: k.Q,
- G: k.G,
- Y: k.Y,
- X: k.X,
- Comments: comment,
- Constraints: constraints,
- })
- case *ecdsa.PrivateKey:
- nistID := fmt.Sprintf("nistp%d", k.Params().BitSize)
- req = ssh.Marshal(ecdsaKeyMsg{
- Type: "ecdsa-sha2-" + nistID,
- Curve: nistID,
- KeyBytes: elliptic.Marshal(k.Curve, k.X, k.Y),
- D: k.D,
- Comments: comment,
- Constraints: constraints,
- })
- default:
- return fmt.Errorf("agent: unsupported key type %T", s)
- }
-
- // if constraints are present then the message type needs to be changed.
- if len(constraints) != 0 {
- req[0] = agentAddIdConstrained
- }
-
- resp, err := c.call(req)
- if err != nil {
- return err
- }
- if _, ok := resp.(*successAgentMsg); ok {
- return nil
- }
- return errors.New("agent: failure")
-}
-
-type rsaCertMsg struct {
- Type string `sshtype:"17"`
- CertBytes []byte
- D *big.Int
- Iqmp *big.Int // IQMP = Inverse Q Mod P
- P *big.Int
- Q *big.Int
- Comments string
- Constraints []byte `ssh:"rest"`
-}
-
-type dsaCertMsg struct {
- Type string `sshtype:"17"`
- CertBytes []byte
- X *big.Int
- Comments string
- Constraints []byte `ssh:"rest"`
-}
-
-type ecdsaCertMsg struct {
- Type string `sshtype:"17"`
- CertBytes []byte
- D *big.Int
- Comments string
- Constraints []byte `ssh:"rest"`
-}
-
-// Insert adds a private key to the agent. If a certificate is given,
-// that certificate is added instead as public key.
-func (c *client) Add(key AddedKey) error {
- var constraints []byte
-
- if secs := key.LifetimeSecs; secs != 0 {
- constraints = append(constraints, agentConstrainLifetime)
-
- var secsBytes [4]byte
- binary.BigEndian.PutUint32(secsBytes[:], secs)
- constraints = append(constraints, secsBytes[:]...)
- }
-
- if key.ConfirmBeforeUse {
- constraints = append(constraints, agentConstrainConfirm)
- }
-
- if cert := key.Certificate; cert == nil {
- return c.insertKey(key.PrivateKey, key.Comment, constraints)
- } else {
- return c.insertCert(key.PrivateKey, cert, key.Comment, constraints)
- }
-}
-
-func (c *client) insertCert(s interface{}, cert *ssh.Certificate, comment string, constraints []byte) error {
- var req []byte
- switch k := s.(type) {
- case *rsa.PrivateKey:
- if len(k.Primes) != 2 {
- return fmt.Errorf("agent: unsupported RSA key with %d primes", len(k.Primes))
- }
- k.Precompute()
- req = ssh.Marshal(rsaCertMsg{
- Type: cert.Type(),
- CertBytes: cert.Marshal(),
- D: k.D,
- Iqmp: k.Precomputed.Qinv,
- P: k.Primes[0],
- Q: k.Primes[1],
- Comments: comment,
- Constraints: constraints,
- })
- case *dsa.PrivateKey:
- req = ssh.Marshal(dsaCertMsg{
- Type: cert.Type(),
- CertBytes: cert.Marshal(),
- X: k.X,
- Comments: comment,
- })
- case *ecdsa.PrivateKey:
- req = ssh.Marshal(ecdsaCertMsg{
- Type: cert.Type(),
- CertBytes: cert.Marshal(),
- D: k.D,
- Comments: comment,
- })
- default:
- return fmt.Errorf("agent: unsupported key type %T", s)
- }
-
- // if constraints are present then the message type needs to be changed.
- if len(constraints) != 0 {
- req[0] = agentAddIdConstrained
- }
-
- signer, err := ssh.NewSignerFromKey(s)
- if err != nil {
- return err
- }
- if bytes.Compare(cert.Key.Marshal(), signer.PublicKey().Marshal()) != 0 {
- return errors.New("agent: signer and cert have different public key")
- }
-
- resp, err := c.call(req)
- if err != nil {
- return err
- }
- if _, ok := resp.(*successAgentMsg); ok {
- return nil
- }
- return errors.New("agent: failure")
-}
-
-// Signers provides a callback for client authentication.
-func (c *client) Signers() ([]ssh.Signer, error) {
- keys, err := c.List()
- if err != nil {
- return nil, err
- }
-
- var result []ssh.Signer
- for _, k := range keys {
- result = append(result, &agentKeyringSigner{c, k})
- }
- return result, nil
-}
-
-type agentKeyringSigner struct {
- agent *client
- pub ssh.PublicKey
-}
-
-func (s *agentKeyringSigner) PublicKey() ssh.PublicKey {
- return s.pub
-}
-
-func (s *agentKeyringSigner) Sign(rand io.Reader, data []byte) (*ssh.Signature, error) {
- // The agent has its own entropy source, so the rand argument is ignored.
- return s.agent.Sign(s.pub, data)
-}
diff --git a/vendor/golang.org/x/crypto/ssh/agent/forward.go b/vendor/golang.org/x/crypto/ssh/agent/forward.go
deleted file mode 100644
index fd24ba90..00000000
--- a/vendor/golang.org/x/crypto/ssh/agent/forward.go
+++ /dev/null
@@ -1,103 +0,0 @@
-// Copyright 2014 The Go Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style
-// license that can be found in the LICENSE file.
-
-package agent
-
-import (
- "errors"
- "io"
- "net"
- "sync"
-
- "golang.org/x/crypto/ssh"
-)
-
-// RequestAgentForwarding sets up agent forwarding for the session.
-// ForwardToAgent or ForwardToRemote should be called to route
-// the authentication requests.
-func RequestAgentForwarding(session *ssh.Session) error {
- ok, err := session.SendRequest("auth-agent-req@openssh.com", true, nil)
- if err != nil {
- return err
- }
- if !ok {
- return errors.New("forwarding request denied")
- }
- return nil
-}
-
-// ForwardToAgent routes authentication requests to the given keyring.
-func ForwardToAgent(client *ssh.Client, keyring Agent) error {
- channels := client.HandleChannelOpen(channelType)
- if channels == nil {
- return errors.New("agent: already have handler for " + channelType)
- }
-
- go func() {
- for ch := range channels {
- channel, reqs, err := ch.Accept()
- if err != nil {
- continue
- }
- go ssh.DiscardRequests(reqs)
- go func() {
- ServeAgent(keyring, channel)
- channel.Close()
- }()
- }
- }()
- return nil
-}
-
-const channelType = "auth-agent@openssh.com"
-
-// ForwardToRemote routes authentication requests to the ssh-agent
-// process serving on the given unix socket.
-func ForwardToRemote(client *ssh.Client, addr string) error {
- channels := client.HandleChannelOpen(channelType)
- if channels == nil {
- return errors.New("agent: already have handler for " + channelType)
- }
- conn, err := net.Dial("unix", addr)
- if err != nil {
- return err
- }
- conn.Close()
-
- go func() {
- for ch := range channels {
- channel, reqs, err := ch.Accept()
- if err != nil {
- continue
- }
- go ssh.DiscardRequests(reqs)
- go forwardUnixSocket(channel, addr)
- }
- }()
- return nil
-}
-
-func forwardUnixSocket(channel ssh.Channel, addr string) {
- conn, err := net.Dial("unix", addr)
- if err != nil {
- return
- }
-
- var wg sync.WaitGroup
- wg.Add(2)
- go func() {
- io.Copy(conn, channel)
- conn.(*net.UnixConn).CloseWrite()
- wg.Done()
- }()
- go func() {
- io.Copy(channel, conn)
- channel.CloseWrite()
- wg.Done()
- }()
-
- wg.Wait()
- conn.Close()
- channel.Close()
-}
diff --git a/vendor/golang.org/x/crypto/ssh/agent/keyring.go b/vendor/golang.org/x/crypto/ssh/agent/keyring.go
deleted file mode 100644
index 12ffa82b..00000000
--- a/vendor/golang.org/x/crypto/ssh/agent/keyring.go
+++ /dev/null
@@ -1,184 +0,0 @@
-// Copyright 2014 The Go Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style
-// license that can be found in the LICENSE file.
-
-package agent
-
-import (
- "bytes"
- "crypto/rand"
- "crypto/subtle"
- "errors"
- "fmt"
- "sync"
-
- "golang.org/x/crypto/ssh"
-)
-
-type privKey struct {
- signer ssh.Signer
- comment string
-}
-
-type keyring struct {
- mu sync.Mutex
- keys []privKey
-
- locked bool
- passphrase []byte
-}
-
-var errLocked = errors.New("agent: locked")
-
-// NewKeyring returns an Agent that holds keys in memory. It is safe
-// for concurrent use by multiple goroutines.
-func NewKeyring() Agent {
- return &keyring{}
-}
-
-// RemoveAll removes all identities.
-func (r *keyring) RemoveAll() error {
- r.mu.Lock()
- defer r.mu.Unlock()
- if r.locked {
- return errLocked
- }
-
- r.keys = nil
- return nil
-}
-
-// Remove removes all identities with the given public key.
-func (r *keyring) Remove(key ssh.PublicKey) error {
- r.mu.Lock()
- defer r.mu.Unlock()
- if r.locked {
- return errLocked
- }
-
- want := key.Marshal()
- found := false
- for i := 0; i < len(r.keys); {
- if bytes.Equal(r.keys[i].signer.PublicKey().Marshal(), want) {
- found = true
- r.keys[i] = r.keys[len(r.keys)-1]
- r.keys = r.keys[:len(r.keys)-1]
- continue
- } else {
- i++
- }
- }
-
- if !found {
- return errors.New("agent: key not found")
- }
- return nil
-}
-
-// Lock locks the agent. Sign and Remove will fail, and List will empty an empty list.
-func (r *keyring) Lock(passphrase []byte) error {
- r.mu.Lock()
- defer r.mu.Unlock()
- if r.locked {
- return errLocked
- }
-
- r.locked = true
- r.passphrase = passphrase
- return nil
-}
-
-// Unlock undoes the effect of Lock
-func (r *keyring) Unlock(passphrase []byte) error {
- r.mu.Lock()
- defer r.mu.Unlock()
- if !r.locked {
- return errors.New("agent: not locked")
- }
- if len(passphrase) != len(r.passphrase) || 1 != subtle.ConstantTimeCompare(passphrase, r.passphrase) {
- return fmt.Errorf("agent: incorrect passphrase")
- }
-
- r.locked = false
- r.passphrase = nil
- return nil
-}
-
-// List returns the identities known to the agent.
-func (r *keyring) List() ([]*Key, error) {
- r.mu.Lock()
- defer r.mu.Unlock()
- if r.locked {
- // section 2.7: locked agents return empty.
- return nil, nil
- }
-
- var ids []*Key
- for _, k := range r.keys {
- pub := k.signer.PublicKey()
- ids = append(ids, &Key{
- Format: pub.Type(),
- Blob: pub.Marshal(),
- Comment: k.comment})
- }
- return ids, nil
-}
-
-// Insert adds a private key to the keyring. If a certificate
-// is given, that certificate is added as public key. Note that
-// any constraints given are ignored.
-func (r *keyring) Add(key AddedKey) error {
- r.mu.Lock()
- defer r.mu.Unlock()
- if r.locked {
- return errLocked
- }
- signer, err := ssh.NewSignerFromKey(key.PrivateKey)
-
- if err != nil {
- return err
- }
-
- if cert := key.Certificate; cert != nil {
- signer, err = ssh.NewCertSigner(cert, signer)
- if err != nil {
- return err
- }
- }
-
- r.keys = append(r.keys, privKey{signer, key.Comment})
-
- return nil
-}
-
-// Sign returns a signature for the data.
-func (r *keyring) Sign(key ssh.PublicKey, data []byte) (*ssh.Signature, error) {
- r.mu.Lock()
- defer r.mu.Unlock()
- if r.locked {
- return nil, errLocked
- }
-
- wanted := key.Marshal()
- for _, k := range r.keys {
- if bytes.Equal(k.signer.PublicKey().Marshal(), wanted) {
- return k.signer.Sign(rand.Reader, data)
- }
- }
- return nil, errors.New("not found")
-}
-
-// Signers returns signers for all the known keys.
-func (r *keyring) Signers() ([]ssh.Signer, error) {
- r.mu.Lock()
- defer r.mu.Unlock()
- if r.locked {
- return nil, errLocked
- }
-
- s := make([]ssh.Signer, 0, len(r.keys))
- for _, k := range r.keys {
- s = append(s, k.signer)
- }
- return s, nil
-}
diff --git a/vendor/golang.org/x/crypto/ssh/agent/server.go b/vendor/golang.org/x/crypto/ssh/agent/server.go
deleted file mode 100644
index b21a2018..00000000
--- a/vendor/golang.org/x/crypto/ssh/agent/server.go
+++ /dev/null
@@ -1,209 +0,0 @@
-// Copyright 2012 The Go Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style
-// license that can be found in the LICENSE file.
-
-package agent
-
-import (
- "crypto/rsa"
- "encoding/binary"
- "fmt"
- "io"
- "log"
- "math/big"
-
- "golang.org/x/crypto/ssh"
-)
-
-// Server wraps an Agent and uses it to implement the agent side of
-// the SSH-agent, wire protocol.
-type server struct {
- agent Agent
-}
-
-func (s *server) processRequestBytes(reqData []byte) []byte {
- rep, err := s.processRequest(reqData)
- if err != nil {
- if err != errLocked {
- // TODO(hanwen): provide better logging interface?
- log.Printf("agent %d: %v", reqData[0], err)
- }
- return []byte{agentFailure}
- }
-
- if err == nil && rep == nil {
- return []byte{agentSuccess}
- }
-
- return ssh.Marshal(rep)
-}
-
-func marshalKey(k *Key) []byte {
- var record struct {
- Blob []byte
- Comment string
- }
- record.Blob = k.Marshal()
- record.Comment = k.Comment
-
- return ssh.Marshal(&record)
-}
-
-type agentV1IdentityMsg struct {
- Numkeys uint32 `sshtype:"2"`
-}
-
-type agentRemoveIdentityMsg struct {
- KeyBlob []byte `sshtype:"18"`
-}
-
-type agentLockMsg struct {
- Passphrase []byte `sshtype:"22"`
-}
-
-type agentUnlockMsg struct {
- Passphrase []byte `sshtype:"23"`
-}
-
-func (s *server) processRequest(data []byte) (interface{}, error) {
- switch data[0] {
- case agentRequestV1Identities:
- return &agentV1IdentityMsg{0}, nil
- case agentRemoveIdentity:
- var req agentRemoveIdentityMsg
- if err := ssh.Unmarshal(data, &req); err != nil {
- return nil, err
- }
-
- var wk wireKey
- if err := ssh.Unmarshal(req.KeyBlob, &wk); err != nil {
- return nil, err
- }
-
- return nil, s.agent.Remove(&Key{Format: wk.Format, Blob: req.KeyBlob})
-
- case agentRemoveAllIdentities:
- return nil, s.agent.RemoveAll()
-
- case agentLock:
- var req agentLockMsg
- if err := ssh.Unmarshal(data, &req); err != nil {
- return nil, err
- }
-
- return nil, s.agent.Lock(req.Passphrase)
-
- case agentUnlock:
- var req agentLockMsg
- if err := ssh.Unmarshal(data, &req); err != nil {
- return nil, err
- }
- return nil, s.agent.Unlock(req.Passphrase)
-
- case agentSignRequest:
- var req signRequestAgentMsg
- if err := ssh.Unmarshal(data, &req); err != nil {
- return nil, err
- }
-
- var wk wireKey
- if err := ssh.Unmarshal(req.KeyBlob, &wk); err != nil {
- return nil, err
- }
-
- k := &Key{
- Format: wk.Format,
- Blob: req.KeyBlob,
- }
-
- sig, err := s.agent.Sign(k, req.Data) // TODO(hanwen): flags.
- if err != nil {
- return nil, err
- }
- return &signResponseAgentMsg{SigBlob: ssh.Marshal(sig)}, nil
- case agentRequestIdentities:
- keys, err := s.agent.List()
- if err != nil {
- return nil, err
- }
-
- rep := identitiesAnswerAgentMsg{
- NumKeys: uint32(len(keys)),
- }
- for _, k := range keys {
- rep.Keys = append(rep.Keys, marshalKey(k)...)
- }
- return rep, nil
- case agentAddIdentity:
- return nil, s.insertIdentity(data)
- }
-
- return nil, fmt.Errorf("unknown opcode %d", data[0])
-}
-
-func (s *server) insertIdentity(req []byte) error {
- var record struct {
- Type string `sshtype:"17"`
- Rest []byte `ssh:"rest"`
- }
- if err := ssh.Unmarshal(req, &record); err != nil {
- return err
- }
-
- switch record.Type {
- case ssh.KeyAlgoRSA:
- var k rsaKeyMsg
- if err := ssh.Unmarshal(req, &k); err != nil {
- return err
- }
-
- priv := rsa.PrivateKey{
- PublicKey: rsa.PublicKey{
- E: int(k.E.Int64()),
- N: k.N,
- },
- D: k.D,
- Primes: []*big.Int{k.P, k.Q},
- }
- priv.Precompute()
-
- return s.agent.Add(AddedKey{PrivateKey: &priv, Comment: k.Comments})
- }
- return fmt.Errorf("not implemented: %s", record.Type)
-}
-
-// ServeAgent serves the agent protocol on the given connection. It
-// returns when an I/O error occurs.
-func ServeAgent(agent Agent, c io.ReadWriter) error {
- s := &server{agent}
-
- var length [4]byte
- for {
- if _, err := io.ReadFull(c, length[:]); err != nil {
- return err
- }
- l := binary.BigEndian.Uint32(length[:])
- if l > maxAgentResponseBytes {
- // We also cap requests.
- return fmt.Errorf("agent: request too large: %d", l)
- }
-
- req := make([]byte, l)
- if _, err := io.ReadFull(c, req); err != nil {
- return err
- }
-
- repData := s.processRequestBytes(req)
- if len(repData) > maxAgentResponseBytes {
- return fmt.Errorf("agent: reply too large: %d bytes", len(repData))
- }
-
- binary.BigEndian.PutUint32(length[:], uint32(len(repData)))
- if _, err := c.Write(length[:]); err != nil {
- return err
- }
- if _, err := c.Write(repData); err != nil {
- return err
- }
- }
-}
diff --git a/vendor/golang.org/x/crypto/ssh/buffer.go b/vendor/golang.org/x/crypto/ssh/buffer.go
deleted file mode 100644
index 6931b511..00000000
--- a/vendor/golang.org/x/crypto/ssh/buffer.go
+++ /dev/null
@@ -1,98 +0,0 @@
-// Copyright 2012 The Go Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style
-// license that can be found in the LICENSE file.
-
-package ssh
-
-import (
- "io"
- "sync"
-)
-
-// buffer provides a linked list buffer for data exchange
-// between producer and consumer. Theoretically the buffer is
-// of unlimited capacity as it does no allocation of its own.
-type buffer struct {
- // protects concurrent access to head, tail and closed
- *sync.Cond
-
- head *element // the buffer that will be read first
- tail *element // the buffer that will be read last
-
- closed bool
-}
-
-// An element represents a single link in a linked list.
-type element struct {
- buf []byte
- next *element
-}
-
-// newBuffer returns an empty buffer that is not closed.
-func newBuffer() *buffer {
- e := new(element)
- b := &buffer{
- Cond: newCond(),
- head: e,
- tail: e,
- }
- return b
-}
-
-// write makes buf available for Read to receive.
-// buf must not be modified after the call to write.
-func (b *buffer) write(buf []byte) {
- b.Cond.L.Lock()
- e := &element{buf: buf}
- b.tail.next = e
- b.tail = e
- b.Cond.Signal()
- b.Cond.L.Unlock()
-}
-
-// eof closes the buffer. Reads from the buffer once all
-// the data has been consumed will receive os.EOF.
-func (b *buffer) eof() error {
- b.Cond.L.Lock()
- b.closed = true
- b.Cond.Signal()
- b.Cond.L.Unlock()
- return nil
-}
-
-// Read reads data from the internal buffer in buf. Reads will block
-// if no data is available, or until the buffer is closed.
-func (b *buffer) Read(buf []byte) (n int, err error) {
- b.Cond.L.Lock()
- defer b.Cond.L.Unlock()
-
- for len(buf) > 0 {
- // if there is data in b.head, copy it
- if len(b.head.buf) > 0 {
- r := copy(buf, b.head.buf)
- buf, b.head.buf = buf[r:], b.head.buf[r:]
- n += r
- continue
- }
- // if there is a next buffer, make it the head
- if len(b.head.buf) == 0 && b.head != b.tail {
- b.head = b.head.next
- continue
- }
-
- // if at least one byte has been copied, return
- if n > 0 {
- break
- }
-
- // if nothing was read, and there is nothing outstanding
- // check to see if the buffer is closed.
- if b.closed {
- err = io.EOF
- break
- }
- // out of buffers, wait for producer
- b.Cond.Wait()
- }
- return
-}
diff --git a/vendor/golang.org/x/crypto/ssh/certs.go b/vendor/golang.org/x/crypto/ssh/certs.go
deleted file mode 100644
index 4c9155c3..00000000
--- a/vendor/golang.org/x/crypto/ssh/certs.go
+++ /dev/null
@@ -1,501 +0,0 @@
-// Copyright 2012 The Go Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style
-// license that can be found in the LICENSE file.
-
-package ssh
-
-import (
- "bytes"
- "errors"
- "fmt"
- "io"
- "net"
- "sort"
- "time"
-)
-
-// These constants from [PROTOCOL.certkeys] represent the algorithm names
-// for certificate types supported by this package.
-const (
- CertAlgoRSAv01 = "ssh-rsa-cert-v01@openssh.com"
- CertAlgoDSAv01 = "ssh-dss-cert-v01@openssh.com"
- CertAlgoECDSA256v01 = "ecdsa-sha2-nistp256-cert-v01@openssh.com"
- CertAlgoECDSA384v01 = "ecdsa-sha2-nistp384-cert-v01@openssh.com"
- CertAlgoECDSA521v01 = "ecdsa-sha2-nistp521-cert-v01@openssh.com"
-)
-
-// Certificate types distinguish between host and user
-// certificates. The values can be set in the CertType field of
-// Certificate.
-const (
- UserCert = 1
- HostCert = 2
-)
-
-// Signature represents a cryptographic signature.
-type Signature struct {
- Format string
- Blob []byte
-}
-
-// CertTimeInfinity can be used for OpenSSHCertV01.ValidBefore to indicate that
-// a certificate does not expire.
-const CertTimeInfinity = 1<<64 - 1
-
-// An Certificate represents an OpenSSH certificate as defined in
-// [PROTOCOL.certkeys]?rev=1.8.
-type Certificate struct {
- Nonce []byte
- Key PublicKey
- Serial uint64
- CertType uint32
- KeyId string
- ValidPrincipals []string
- ValidAfter uint64
- ValidBefore uint64
- Permissions
- Reserved []byte
- SignatureKey PublicKey
- Signature *Signature
-}
-
-// genericCertData holds the key-independent part of the certificate data.
-// Overall, certificates contain an nonce, public key fields and
-// key-independent fields.
-type genericCertData struct {
- Serial uint64
- CertType uint32
- KeyId string
- ValidPrincipals []byte
- ValidAfter uint64
- ValidBefore uint64
- CriticalOptions []byte
- Extensions []byte
- Reserved []byte
- SignatureKey []byte
- Signature []byte
-}
-
-func marshalStringList(namelist []string) []byte {
- var to []byte
- for _, name := range namelist {
- s := struct{ N string }{name}
- to = append(to, Marshal(&s)...)
- }
- return to
-}
-
-type optionsTuple struct {
- Key string
- Value []byte
-}
-
-type optionsTupleValue struct {
- Value string
-}
-
-// serialize a map of critical options or extensions
-// issue #10569 - per [PROTOCOL.certkeys] and SSH implementation,
-// we need two length prefixes for a non-empty string value
-func marshalTuples(tups map[string]string) []byte {
- keys := make([]string, 0, len(tups))
- for key := range tups {
- keys = append(keys, key)
- }
- sort.Strings(keys)
-
- var ret []byte
- for _, key := range keys {
- s := optionsTuple{Key: key}
- if value := tups[key]; len(value) > 0 {
- s.Value = Marshal(&optionsTupleValue{value})
- }
- ret = append(ret, Marshal(&s)...)
- }
- return ret
-}
-
-// issue #10569 - per [PROTOCOL.certkeys] and SSH implementation,
-// we need two length prefixes for a non-empty option value
-func parseTuples(in []byte) (map[string]string, error) {
- tups := map[string]string{}
- var lastKey string
- var haveLastKey bool
-
- for len(in) > 0 {
- var key, val, extra []byte
- var ok bool
-
- if key, in, ok = parseString(in); !ok {
- return nil, errShortRead
- }
- keyStr := string(key)
- // according to [PROTOCOL.certkeys], the names must be in
- // lexical order.
- if haveLastKey && keyStr <= lastKey {
- return nil, fmt.Errorf("ssh: certificate options are not in lexical order")
- }
- lastKey, haveLastKey = keyStr, true
- // the next field is a data field, which if non-empty has a string embedded
- if val, in, ok = parseString(in); !ok {
- return nil, errShortRead
- }
- if len(val) > 0 {
- val, extra, ok = parseString(val)
- if !ok {
- return nil, errShortRead
- }
- if len(extra) > 0 {
- return nil, fmt.Errorf("ssh: unexpected trailing data after certificate option value")
- }
- tups[keyStr] = string(val)
- } else {
- tups[keyStr] = ""
- }
- }
- return tups, nil
-}
-
-func parseCert(in []byte, privAlgo string) (*Certificate, error) {
- nonce, rest, ok := parseString(in)
- if !ok {
- return nil, errShortRead
- }
-
- key, rest, err := parsePubKey(rest, privAlgo)
- if err != nil {
- return nil, err
- }
-
- var g genericCertData
- if err := Unmarshal(rest, &g); err != nil {
- return nil, err
- }
-
- c := &Certificate{
- Nonce: nonce,
- Key: key,
- Serial: g.Serial,
- CertType: g.CertType,
- KeyId: g.KeyId,
- ValidAfter: g.ValidAfter,
- ValidBefore: g.ValidBefore,
- }
-
- for principals := g.ValidPrincipals; len(principals) > 0; {
- principal, rest, ok := parseString(principals)
- if !ok {
- return nil, errShortRead
- }
- c.ValidPrincipals = append(c.ValidPrincipals, string(principal))
- principals = rest
- }
-
- c.CriticalOptions, err = parseTuples(g.CriticalOptions)
- if err != nil {
- return nil, err
- }
- c.Extensions, err = parseTuples(g.Extensions)
- if err != nil {
- return nil, err
- }
- c.Reserved = g.Reserved
- k, err := ParsePublicKey(g.SignatureKey)
- if err != nil {
- return nil, err
- }
-
- c.SignatureKey = k
- c.Signature, rest, ok = parseSignatureBody(g.Signature)
- if !ok || len(rest) > 0 {
- return nil, errors.New("ssh: signature parse error")
- }
-
- return c, nil
-}
-
-type openSSHCertSigner struct {
- pub *Certificate
- signer Signer
-}
-
-// NewCertSigner returns a Signer that signs with the given Certificate, whose
-// private key is held by signer. It returns an error if the public key in cert
-// doesn't match the key used by signer.
-func NewCertSigner(cert *Certificate, signer Signer) (Signer, error) {
- if bytes.Compare(cert.Key.Marshal(), signer.PublicKey().Marshal()) != 0 {
- return nil, errors.New("ssh: signer and cert have different public key")
- }
-
- return &openSSHCertSigner{cert, signer}, nil
-}
-
-func (s *openSSHCertSigner) Sign(rand io.Reader, data []byte) (*Signature, error) {
- return s.signer.Sign(rand, data)
-}
-
-func (s *openSSHCertSigner) PublicKey() PublicKey {
- return s.pub
-}
-
-const sourceAddressCriticalOption = "source-address"
-
-// CertChecker does the work of verifying a certificate. Its methods
-// can be plugged into ClientConfig.HostKeyCallback and
-// ServerConfig.PublicKeyCallback. For the CertChecker to work,
-// minimally, the IsAuthority callback should be set.
-type CertChecker struct {
- // SupportedCriticalOptions lists the CriticalOptions that the
- // server application layer understands. These are only used
- // for user certificates.
- SupportedCriticalOptions []string
-
- // IsAuthority should return true if the key is recognized as
- // an authority. This allows for certificates to be signed by other
- // certificates.
- IsAuthority func(auth PublicKey) bool
-
- // Clock is used for verifying time stamps. If nil, time.Now
- // is used.
- Clock func() time.Time
-
- // UserKeyFallback is called when CertChecker.Authenticate encounters a
- // public key that is not a certificate. It must implement validation
- // of user keys or else, if nil, all such keys are rejected.
- UserKeyFallback func(conn ConnMetadata, key PublicKey) (*Permissions, error)
-
- // HostKeyFallback is called when CertChecker.CheckHostKey encounters a
- // public key that is not a certificate. It must implement host key
- // validation or else, if nil, all such keys are rejected.
- HostKeyFallback func(addr string, remote net.Addr, key PublicKey) error
-
- // IsRevoked is called for each certificate so that revocation checking
- // can be implemented. It should return true if the given certificate
- // is revoked and false otherwise. If nil, no certificates are
- // considered to have been revoked.
- IsRevoked func(cert *Certificate) bool
-}
-
-// CheckHostKey checks a host key certificate. This method can be
-// plugged into ClientConfig.HostKeyCallback.
-func (c *CertChecker) CheckHostKey(addr string, remote net.Addr, key PublicKey) error {
- cert, ok := key.(*Certificate)
- if !ok {
- if c.HostKeyFallback != nil {
- return c.HostKeyFallback(addr, remote, key)
- }
- return errors.New("ssh: non-certificate host key")
- }
- if cert.CertType != HostCert {
- return fmt.Errorf("ssh: certificate presented as a host key has type %d", cert.CertType)
- }
-
- return c.CheckCert(addr, cert)
-}
-
-// Authenticate checks a user certificate. Authenticate can be used as
-// a value for ServerConfig.PublicKeyCallback.
-func (c *CertChecker) Authenticate(conn ConnMetadata, pubKey PublicKey) (*Permissions, error) {
- cert, ok := pubKey.(*Certificate)
- if !ok {
- if c.UserKeyFallback != nil {
- return c.UserKeyFallback(conn, pubKey)
- }
- return nil, errors.New("ssh: normal key pairs not accepted")
- }
-
- if cert.CertType != UserCert {
- return nil, fmt.Errorf("ssh: cert has type %d", cert.CertType)
- }
-
- if err := c.CheckCert(conn.User(), cert); err != nil {
- return nil, err
- }
-
- return &cert.Permissions, nil
-}
-
-// CheckCert checks CriticalOptions, ValidPrincipals, revocation, timestamp and
-// the signature of the certificate.
-func (c *CertChecker) CheckCert(principal string, cert *Certificate) error {
- if c.IsRevoked != nil && c.IsRevoked(cert) {
- return fmt.Errorf("ssh: certicate serial %d revoked", cert.Serial)
- }
-
- for opt := range cert.CriticalOptions {
- // sourceAddressCriticalOption will be enforced by
- // serverAuthenticate
- if opt == sourceAddressCriticalOption {
- continue
- }
-
- found := false
- for _, supp := range c.SupportedCriticalOptions {
- if supp == opt {
- found = true
- break
- }
- }
- if !found {
- return fmt.Errorf("ssh: unsupported critical option %q in certificate", opt)
- }
- }
-
- if len(cert.ValidPrincipals) > 0 {
- // By default, certs are valid for all users/hosts.
- found := false
- for _, p := range cert.ValidPrincipals {
- if p == principal {
- found = true
- break
- }
- }
- if !found {
- return fmt.Errorf("ssh: principal %q not in the set of valid principals for given certificate: %q", principal, cert.ValidPrincipals)
- }
- }
-
- if !c.IsAuthority(cert.SignatureKey) {
- return fmt.Errorf("ssh: certificate signed by unrecognized authority")
- }
-
- clock := c.Clock
- if clock == nil {
- clock = time.Now
- }
-
- unixNow := clock().Unix()
- if after := int64(cert.ValidAfter); after < 0 || unixNow < int64(cert.ValidAfter) {
- return fmt.Errorf("ssh: cert is not yet valid")
- }
- if before := int64(cert.ValidBefore); cert.ValidBefore != uint64(CertTimeInfinity) && (unixNow >= before || before < 0) {
- return fmt.Errorf("ssh: cert has expired")
- }
- if err := cert.SignatureKey.Verify(cert.bytesForSigning(), cert.Signature); err != nil {
- return fmt.Errorf("ssh: certificate signature does not verify")
- }
-
- return nil
-}
-
-// SignCert sets c.SignatureKey to the authority's public key and stores a
-// Signature, by authority, in the certificate.
-func (c *Certificate) SignCert(rand io.Reader, authority Signer) error {
- c.Nonce = make([]byte, 32)
- if _, err := io.ReadFull(rand, c.Nonce); err != nil {
- return err
- }
- c.SignatureKey = authority.PublicKey()
-
- sig, err := authority.Sign(rand, c.bytesForSigning())
- if err != nil {
- return err
- }
- c.Signature = sig
- return nil
-}
-
-var certAlgoNames = map[string]string{
- KeyAlgoRSA: CertAlgoRSAv01,
- KeyAlgoDSA: CertAlgoDSAv01,
- KeyAlgoECDSA256: CertAlgoECDSA256v01,
- KeyAlgoECDSA384: CertAlgoECDSA384v01,
- KeyAlgoECDSA521: CertAlgoECDSA521v01,
-}
-
-// certToPrivAlgo returns the underlying algorithm for a certificate algorithm.
-// Panics if a non-certificate algorithm is passed.
-func certToPrivAlgo(algo string) string {
- for privAlgo, pubAlgo := range certAlgoNames {
- if pubAlgo == algo {
- return privAlgo
- }
- }
- panic("unknown cert algorithm")
-}
-
-func (cert *Certificate) bytesForSigning() []byte {
- c2 := *cert
- c2.Signature = nil
- out := c2.Marshal()
- // Drop trailing signature length.
- return out[:len(out)-4]
-}
-
-// Marshal serializes c into OpenSSH's wire format. It is part of the
-// PublicKey interface.
-func (c *Certificate) Marshal() []byte {
- generic := genericCertData{
- Serial: c.Serial,
- CertType: c.CertType,
- KeyId: c.KeyId,
- ValidPrincipals: marshalStringList(c.ValidPrincipals),
- ValidAfter: uint64(c.ValidAfter),
- ValidBefore: uint64(c.ValidBefore),
- CriticalOptions: marshalTuples(c.CriticalOptions),
- Extensions: marshalTuples(c.Extensions),
- Reserved: c.Reserved,
- SignatureKey: c.SignatureKey.Marshal(),
- }
- if c.Signature != nil {
- generic.Signature = Marshal(c.Signature)
- }
- genericBytes := Marshal(&generic)
- keyBytes := c.Key.Marshal()
- _, keyBytes, _ = parseString(keyBytes)
- prefix := Marshal(&struct {
- Name string
- Nonce []byte
- Key []byte `ssh:"rest"`
- }{c.Type(), c.Nonce, keyBytes})
-
- result := make([]byte, 0, len(prefix)+len(genericBytes))
- result = append(result, prefix...)
- result = append(result, genericBytes...)
- return result
-}
-
-// Type returns the key name. It is part of the PublicKey interface.
-func (c *Certificate) Type() string {
- algo, ok := certAlgoNames[c.Key.Type()]
- if !ok {
- panic("unknown cert key type")
- }
- return algo
-}
-
-// Verify verifies a signature against the certificate's public
-// key. It is part of the PublicKey interface.
-func (c *Certificate) Verify(data []byte, sig *Signature) error {
- return c.Key.Verify(data, sig)
-}
-
-func parseSignatureBody(in []byte) (out *Signature, rest []byte, ok bool) {
- format, in, ok := parseString(in)
- if !ok {
- return
- }
-
- out = &Signature{
- Format: string(format),
- }
-
- if out.Blob, in, ok = parseString(in); !ok {
- return
- }
-
- return out, in, ok
-}
-
-func parseSignature(in []byte) (out *Signature, rest []byte, ok bool) {
- sigBytes, rest, ok := parseString(in)
- if !ok {
- return
- }
-
- out, trailing, ok := parseSignatureBody(sigBytes)
- if !ok || len(trailing) > 0 {
- return nil, nil, false
- }
- return
-}
diff --git a/vendor/golang.org/x/crypto/ssh/channel.go b/vendor/golang.org/x/crypto/ssh/channel.go
deleted file mode 100644
index 5403c7e4..00000000
--- a/vendor/golang.org/x/crypto/ssh/channel.go
+++ /dev/null
@@ -1,631 +0,0 @@
-// Copyright 2011 The Go Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style
-// license that can be found in the LICENSE file.
-
-package ssh
-
-import (
- "encoding/binary"
- "errors"
- "fmt"
- "io"
- "log"
- "sync"
-)
-
-const (
- minPacketLength = 9
- // channelMaxPacket contains the maximum number of bytes that will be
- // sent in a single packet. As per RFC 4253, section 6.1, 32k is also
- // the minimum.
- channelMaxPacket = 1 << 15
- // We follow OpenSSH here.
- channelWindowSize = 64 * channelMaxPacket
-)
-
-// NewChannel represents an incoming request to a channel. It must either be
-// accepted for use by calling Accept, or rejected by calling Reject.
-type NewChannel interface {
- // Accept accepts the channel creation request. It returns the Channel
- // and a Go channel containing SSH requests. The Go channel must be
- // serviced otherwise the Channel will hang.
- Accept() (Channel, <-chan *Request, error)
-
- // Reject rejects the channel creation request. After calling
- // this, no other methods on the Channel may be called.
- Reject(reason RejectionReason, message string) error
-
- // ChannelType returns the type of the channel, as supplied by the
- // client.
- ChannelType() string
-
- // ExtraData returns the arbitrary payload for this channel, as supplied
- // by the client. This data is specific to the channel type.
- ExtraData() []byte
-}
-
-// A Channel is an ordered, reliable, flow-controlled, duplex stream
-// that is multiplexed over an SSH connection.
-type Channel interface {
- // Read reads up to len(data) bytes from the channel.
- Read(data []byte) (int, error)
-
- // Write writes len(data) bytes to the channel.
- Write(data []byte) (int, error)
-
- // Close signals end of channel use. No data may be sent after this
- // call.
- Close() error
-
- // CloseWrite signals the end of sending in-band
- // data. Requests may still be sent, and the other side may
- // still send data
- CloseWrite() error
-
- // SendRequest sends a channel request. If wantReply is true,
- // it will wait for a reply and return the result as a
- // boolean, otherwise the return value will be false. Channel
- // requests are out-of-band messages so they may be sent even
- // if the data stream is closed or blocked by flow control.
- SendRequest(name string, wantReply bool, payload []byte) (bool, error)
-
- // Stderr returns an io.ReadWriter that writes to this channel
- // with the extended data type set to stderr. Stderr may
- // safely be read and written from a different goroutine than
- // Read and Write respectively.
- Stderr() io.ReadWriter
-}
-
-// Request is a request sent outside of the normal stream of
-// data. Requests can either be specific to an SSH channel, or they
-// can be global.
-type Request struct {
- Type string
- WantReply bool
- Payload []byte
-
- ch *channel
- mux *mux
-}
-
-// Reply sends a response to a request. It must be called for all requests
-// where WantReply is true and is a no-op otherwise. The payload argument is
-// ignored for replies to channel-specific requests.
-func (r *Request) Reply(ok bool, payload []byte) error {
- if !r.WantReply {
- return nil
- }
-
- if r.ch == nil {
- return r.mux.ackRequest(ok, payload)
- }
-
- return r.ch.ackRequest(ok)
-}
-
-// RejectionReason is an enumeration used when rejecting channel creation
-// requests. See RFC 4254, section 5.1.
-type RejectionReason uint32
-
-const (
- Prohibited RejectionReason = iota + 1
- ConnectionFailed
- UnknownChannelType
- ResourceShortage
-)
-
-// String converts the rejection reason to human readable form.
-func (r RejectionReason) String() string {
- switch r {
- case Prohibited:
- return "administratively prohibited"
- case ConnectionFailed:
- return "connect failed"
- case UnknownChannelType:
- return "unknown channel type"
- case ResourceShortage:
- return "resource shortage"
- }
- return fmt.Sprintf("unknown reason %d", int(r))
-}
-
-func min(a uint32, b int) uint32 {
- if a < uint32(b) {
- return a
- }
- return uint32(b)
-}
-
-type channelDirection uint8
-
-const (
- channelInbound channelDirection = iota
- channelOutbound
-)
-
-// channel is an implementation of the Channel interface that works
-// with the mux class.
-type channel struct {
- // R/O after creation
- chanType string
- extraData []byte
- localId, remoteId uint32
-
- // maxIncomingPayload and maxRemotePayload are the maximum
- // payload sizes of normal and extended data packets for
- // receiving and sending, respectively. The wire packet will
- // be 9 or 13 bytes larger (excluding encryption overhead).
- maxIncomingPayload uint32
- maxRemotePayload uint32
-
- mux *mux
-
- // decided is set to true if an accept or reject message has been sent
- // (for outbound channels) or received (for inbound channels).
- decided bool
-
- // direction contains either channelOutbound, for channels created
- // locally, or channelInbound, for channels created by the peer.
- direction channelDirection
-
- // Pending internal channel messages.
- msg chan interface{}
-
- // Since requests have no ID, there can be only one request
- // with WantReply=true outstanding. This lock is held by a
- // goroutine that has such an outgoing request pending.
- sentRequestMu sync.Mutex
-
- incomingRequests chan *Request
-
- sentEOF bool
-
- // thread-safe data
- remoteWin window
- pending *buffer
- extPending *buffer
-
- // windowMu protects myWindow, the flow-control window.
- windowMu sync.Mutex
- myWindow uint32
-
- // writeMu serializes calls to mux.conn.writePacket() and
- // protects sentClose and packetPool. This mutex must be
- // different from windowMu, as writePacket can block if there
- // is a key exchange pending.
- writeMu sync.Mutex
- sentClose bool
-
- // packetPool has a buffer for each extended channel ID to
- // save allocations during writes.
- packetPool map[uint32][]byte
-}
-
-// writePacket sends a packet. If the packet is a channel close, it updates
-// sentClose. This method takes the lock c.writeMu.
-func (c *channel) writePacket(packet []byte) error {
- c.writeMu.Lock()
- if c.sentClose {
- c.writeMu.Unlock()
- return io.EOF
- }
- c.sentClose = (packet[0] == msgChannelClose)
- err := c.mux.conn.writePacket(packet)
- c.writeMu.Unlock()
- return err
-}
-
-func (c *channel) sendMessage(msg interface{}) error {
- if debugMux {
- log.Printf("send %d: %#v", c.mux.chanList.offset, msg)
- }
-
- p := Marshal(msg)
- binary.BigEndian.PutUint32(p[1:], c.remoteId)
- return c.writePacket(p)
-}
-
-// WriteExtended writes data to a specific extended stream. These streams are
-// used, for example, for stderr.
-func (c *channel) WriteExtended(data []byte, extendedCode uint32) (n int, err error) {
- if c.sentEOF {
- return 0, io.EOF
- }
- // 1 byte message type, 4 bytes remoteId, 4 bytes data length
- opCode := byte(msgChannelData)
- headerLength := uint32(9)
- if extendedCode > 0 {
- headerLength += 4
- opCode = msgChannelExtendedData
- }
-
- c.writeMu.Lock()
- packet := c.packetPool[extendedCode]
- // We don't remove the buffer from packetPool, so
- // WriteExtended calls from different goroutines will be
- // flagged as errors by the race detector.
- c.writeMu.Unlock()
-
- for len(data) > 0 {
- space := min(c.maxRemotePayload, len(data))
- if space, err = c.remoteWin.reserve(space); err != nil {
- return n, err
- }
- if want := headerLength + space; uint32(cap(packet)) < want {
- packet = make([]byte, want)
- } else {
- packet = packet[:want]
- }
-
- todo := data[:space]
-
- packet[0] = opCode
- binary.BigEndian.PutUint32(packet[1:], c.remoteId)
- if extendedCode > 0 {
- binary.BigEndian.PutUint32(packet[5:], uint32(extendedCode))
- }
- binary.BigEndian.PutUint32(packet[headerLength-4:], uint32(len(todo)))
- copy(packet[headerLength:], todo)
- if err = c.writePacket(packet); err != nil {
- return n, err
- }
-
- n += len(todo)
- data = data[len(todo):]
- }
-
- c.writeMu.Lock()
- c.packetPool[extendedCode] = packet
- c.writeMu.Unlock()
-
- return n, err
-}
-
-func (c *channel) handleData(packet []byte) error {
- headerLen := 9
- isExtendedData := packet[0] == msgChannelExtendedData
- if isExtendedData {
- headerLen = 13
- }
- if len(packet) < headerLen {
- // malformed data packet
- return parseError(packet[0])
- }
-
- var extended uint32
- if isExtendedData {
- extended = binary.BigEndian.Uint32(packet[5:])
- }
-
- length := binary.BigEndian.Uint32(packet[headerLen-4 : headerLen])
- if length == 0 {
- return nil
- }
- if length > c.maxIncomingPayload {
- // TODO(hanwen): should send Disconnect?
- return errors.New("ssh: incoming packet exceeds maximum payload size")
- }
-
- data := packet[headerLen:]
- if length != uint32(len(data)) {
- return errors.New("ssh: wrong packet length")
- }
-
- c.windowMu.Lock()
- if c.myWindow < length {
- c.windowMu.Unlock()
- // TODO(hanwen): should send Disconnect with reason?
- return errors.New("ssh: remote side wrote too much")
- }
- c.myWindow -= length
- c.windowMu.Unlock()
-
- if extended == 1 {
- c.extPending.write(data)
- } else if extended > 0 {
- // discard other extended data.
- } else {
- c.pending.write(data)
- }
- return nil
-}
-
-func (c *channel) adjustWindow(n uint32) error {
- c.windowMu.Lock()
- // Since myWindow is managed on our side, and can never exceed
- // the initial window setting, we don't worry about overflow.
- c.myWindow += uint32(n)
- c.windowMu.Unlock()
- return c.sendMessage(windowAdjustMsg{
- AdditionalBytes: uint32(n),
- })
-}
-
-func (c *channel) ReadExtended(data []byte, extended uint32) (n int, err error) {
- switch extended {
- case 1:
- n, err = c.extPending.Read(data)
- case 0:
- n, err = c.pending.Read(data)
- default:
- return 0, fmt.Errorf("ssh: extended code %d unimplemented", extended)
- }
-
- if n > 0 {
- err = c.adjustWindow(uint32(n))
- // sendWindowAdjust can return io.EOF if the remote
- // peer has closed the connection, however we want to
- // defer forwarding io.EOF to the caller of Read until
- // the buffer has been drained.
- if n > 0 && err == io.EOF {
- err = nil
- }
- }
-
- return n, err
-}
-
-func (c *channel) close() {
- c.pending.eof()
- c.extPending.eof()
- close(c.msg)
- close(c.incomingRequests)
- c.writeMu.Lock()
- // This is not necesary for a normal channel teardown, but if
- // there was another error, it is.
- c.sentClose = true
- c.writeMu.Unlock()
- // Unblock writers.
- c.remoteWin.close()
-}
-
-// responseMessageReceived is called when a success or failure message is
-// received on a channel to check that such a message is reasonable for the
-// given channel.
-func (c *channel) responseMessageReceived() error {
- if c.direction == channelInbound {
- return errors.New("ssh: channel response message received on inbound channel")
- }
- if c.decided {
- return errors.New("ssh: duplicate response received for channel")
- }
- c.decided = true
- return nil
-}
-
-func (c *channel) handlePacket(packet []byte) error {
- switch packet[0] {
- case msgChannelData, msgChannelExtendedData:
- return c.handleData(packet)
- case msgChannelClose:
- c.sendMessage(channelCloseMsg{PeersId: c.remoteId})
- c.mux.chanList.remove(c.localId)
- c.close()
- return nil
- case msgChannelEOF:
- // RFC 4254 is mute on how EOF affects dataExt messages but
- // it is logical to signal EOF at the same time.
- c.extPending.eof()
- c.pending.eof()
- return nil
- }
-
- decoded, err := decode(packet)
- if err != nil {
- return err
- }
-
- switch msg := decoded.(type) {
- case *channelOpenFailureMsg:
- if err := c.responseMessageReceived(); err != nil {
- return err
- }
- c.mux.chanList.remove(msg.PeersId)
- c.msg <- msg
- case *channelOpenConfirmMsg:
- if err := c.responseMessageReceived(); err != nil {
- return err
- }
- if msg.MaxPacketSize < minPacketLength || msg.MaxPacketSize > 1<<31 {
- return fmt.Errorf("ssh: invalid MaxPacketSize %d from peer", msg.MaxPacketSize)
- }
- c.remoteId = msg.MyId
- c.maxRemotePayload = msg.MaxPacketSize
- c.remoteWin.add(msg.MyWindow)
- c.msg <- msg
- case *windowAdjustMsg:
- if !c.remoteWin.add(msg.AdditionalBytes) {
- return fmt.Errorf("ssh: invalid window update for %d bytes", msg.AdditionalBytes)
- }
- case *channelRequestMsg:
- req := Request{
- Type: msg.Request,
- WantReply: msg.WantReply,
- Payload: msg.RequestSpecificData,
- ch: c,
- }
-
- c.incomingRequests <- &req
- default:
- c.msg <- msg
- }
- return nil
-}
-
-func (m *mux) newChannel(chanType string, direction channelDirection, extraData []byte) *channel {
- ch := &channel{
- remoteWin: window{Cond: newCond()},
- myWindow: channelWindowSize,
- pending: newBuffer(),
- extPending: newBuffer(),
- direction: direction,
- incomingRequests: make(chan *Request, 16),
- msg: make(chan interface{}, 16),
- chanType: chanType,
- extraData: extraData,
- mux: m,
- packetPool: make(map[uint32][]byte),
- }
- ch.localId = m.chanList.add(ch)
- return ch
-}
-
-var errUndecided = errors.New("ssh: must Accept or Reject channel")
-var errDecidedAlready = errors.New("ssh: can call Accept or Reject only once")
-
-type extChannel struct {
- code uint32
- ch *channel
-}
-
-func (e *extChannel) Write(data []byte) (n int, err error) {
- return e.ch.WriteExtended(data, e.code)
-}
-
-func (e *extChannel) Read(data []byte) (n int, err error) {
- return e.ch.ReadExtended(data, e.code)
-}
-
-func (c *channel) Accept() (Channel, <-chan *Request, error) {
- if c.decided {
- return nil, nil, errDecidedAlready
- }
- c.maxIncomingPayload = channelMaxPacket
- confirm := channelOpenConfirmMsg{
- PeersId: c.remoteId,
- MyId: c.localId,
- MyWindow: c.myWindow,
- MaxPacketSize: c.maxIncomingPayload,
- }
- c.decided = true
- if err := c.sendMessage(confirm); err != nil {
- return nil, nil, err
- }
-
- return c, c.incomingRequests, nil
-}
-
-func (ch *channel) Reject(reason RejectionReason, message string) error {
- if ch.decided {
- return errDecidedAlready
- }
- reject := channelOpenFailureMsg{
- PeersId: ch.remoteId,
- Reason: reason,
- Message: message,
- Language: "en",
- }
- ch.decided = true
- return ch.sendMessage(reject)
-}
-
-func (ch *channel) Read(data []byte) (int, error) {
- if !ch.decided {
- return 0, errUndecided
- }
- return ch.ReadExtended(data, 0)
-}
-
-func (ch *channel) Write(data []byte) (int, error) {
- if !ch.decided {
- return 0, errUndecided
- }
- return ch.WriteExtended(data, 0)
-}
-
-func (ch *channel) CloseWrite() error {
- if !ch.decided {
- return errUndecided
- }
- ch.sentEOF = true
- return ch.sendMessage(channelEOFMsg{
- PeersId: ch.remoteId})
-}
-
-func (ch *channel) Close() error {
- if !ch.decided {
- return errUndecided
- }
-
- return ch.sendMessage(channelCloseMsg{
- PeersId: ch.remoteId})
-}
-
-// Extended returns an io.ReadWriter that sends and receives data on the given,
-// SSH extended stream. Such streams are used, for example, for stderr.
-func (ch *channel) Extended(code uint32) io.ReadWriter {
- if !ch.decided {
- return nil
- }
- return &extChannel{code, ch}
-}
-
-func (ch *channel) Stderr() io.ReadWriter {
- return ch.Extended(1)
-}
-
-func (ch *channel) SendRequest(name string, wantReply bool, payload []byte) (bool, error) {
- if !ch.decided {
- return false, errUndecided
- }
-
- if wantReply {
- ch.sentRequestMu.Lock()
- defer ch.sentRequestMu.Unlock()
- }
-
- msg := channelRequestMsg{
- PeersId: ch.remoteId,
- Request: name,
- WantReply: wantReply,
- RequestSpecificData: payload,
- }
-
- if err := ch.sendMessage(msg); err != nil {
- return false, err
- }
-
- if wantReply {
- m, ok := (<-ch.msg)
- if !ok {
- return false, io.EOF
- }
- switch m.(type) {
- case *channelRequestFailureMsg:
- return false, nil
- case *channelRequestSuccessMsg:
- return true, nil
- default:
- return false, fmt.Errorf("ssh: unexpected response to channel request: %#v", m)
- }
- }
-
- return false, nil
-}
-
-// ackRequest either sends an ack or nack to the channel request.
-func (ch *channel) ackRequest(ok bool) error {
- if !ch.decided {
- return errUndecided
- }
-
- var msg interface{}
- if !ok {
- msg = channelRequestFailureMsg{
- PeersId: ch.remoteId,
- }
- } else {
- msg = channelRequestSuccessMsg{
- PeersId: ch.remoteId,
- }
- }
- return ch.sendMessage(msg)
-}
-
-func (ch *channel) ChannelType() string {
- return ch.chanType
-}
-
-func (ch *channel) ExtraData() []byte {
- return ch.extraData
-}
diff --git a/vendor/golang.org/x/crypto/ssh/cipher.go b/vendor/golang.org/x/crypto/ssh/cipher.go
deleted file mode 100644
index 2732963f..00000000
--- a/vendor/golang.org/x/crypto/ssh/cipher.go
+++ /dev/null
@@ -1,552 +0,0 @@
-// Copyright 2011 The Go Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style
-// license that can be found in the LICENSE file.
-
-package ssh
-
-import (
- "crypto/aes"
- "crypto/cipher"
- "crypto/rc4"
- "crypto/subtle"
- "encoding/binary"
- "errors"
- "fmt"
- "hash"
- "io"
- "io/ioutil"
-)
-
-const (
- packetSizeMultiple = 16 // TODO(huin) this should be determined by the cipher.
-
- // RFC 4253 section 6.1 defines a minimum packet size of 32768 that implementations
- // MUST be able to process (plus a few more kilobytes for padding and mac). The RFC
- // indicates implementations SHOULD be able to handle larger packet sizes, but then
- // waffles on about reasonable limits.
- //
- // OpenSSH caps their maxPacket at 256kB so we choose to do
- // the same. maxPacket is also used to ensure that uint32
- // length fields do not overflow, so it should remain well
- // below 4G.
- maxPacket = 256 * 1024
-)
-
-// noneCipher implements cipher.Stream and provides no encryption. It is used
-// by the transport before the first key-exchange.
-type noneCipher struct{}
-
-func (c noneCipher) XORKeyStream(dst, src []byte) {
- copy(dst, src)
-}
-
-func newAESCTR(key, iv []byte) (cipher.Stream, error) {
- c, err := aes.NewCipher(key)
- if err != nil {
- return nil, err
- }
- return cipher.NewCTR(c, iv), nil
-}
-
-func newRC4(key, iv []byte) (cipher.Stream, error) {
- return rc4.NewCipher(key)
-}
-
-type streamCipherMode struct {
- keySize int
- ivSize int
- skip int
- createFunc func(key, iv []byte) (cipher.Stream, error)
-}
-
-func (c *streamCipherMode) createStream(key, iv []byte) (cipher.Stream, error) {
- if len(key) < c.keySize {
- panic("ssh: key length too small for cipher")
- }
- if len(iv) < c.ivSize {
- panic("ssh: iv too small for cipher")
- }
-
- stream, err := c.createFunc(key[:c.keySize], iv[:c.ivSize])
- if err != nil {
- return nil, err
- }
-
- var streamDump []byte
- if c.skip > 0 {
- streamDump = make([]byte, 512)
- }
-
- for remainingToDump := c.skip; remainingToDump > 0; {
- dumpThisTime := remainingToDump
- if dumpThisTime > len(streamDump) {
- dumpThisTime = len(streamDump)
- }
- stream.XORKeyStream(streamDump[:dumpThisTime], streamDump[:dumpThisTime])
- remainingToDump -= dumpThisTime
- }
-
- return stream, nil
-}
-
-// cipherModes documents properties of supported ciphers. Ciphers not included
-// are not supported and will not be negotiated, even if explicitly requested in
-// ClientConfig.Crypto.Ciphers.
-var cipherModes = map[string]*streamCipherMode{
- // Ciphers from RFC4344, which introduced many CTR-based ciphers. Algorithms
- // are defined in the order specified in the RFC.
- "aes128-ctr": {16, aes.BlockSize, 0, newAESCTR},
- "aes192-ctr": {24, aes.BlockSize, 0, newAESCTR},
- "aes256-ctr": {32, aes.BlockSize, 0, newAESCTR},
-
- // Ciphers from RFC4345, which introduces security-improved arcfour ciphers.
- // They are defined in the order specified in the RFC.
- "arcfour128": {16, 0, 1536, newRC4},
- "arcfour256": {32, 0, 1536, newRC4},
-
- // Cipher defined in RFC 4253, which describes SSH Transport Layer Protocol.
- // Note that this cipher is not safe, as stated in RFC 4253: "Arcfour (and
- // RC4) has problems with weak keys, and should be used with caution."
- // RFC4345 introduces improved versions of Arcfour.
- "arcfour": {16, 0, 0, newRC4},
-
- // AES-GCM is not a stream cipher, so it is constructed with a
- // special case. If we add any more non-stream ciphers, we
- // should invest a cleaner way to do this.
- gcmCipherID: {16, 12, 0, nil},
-
- // CBC mode is insecure and so is not included in the default config.
- // (See http://www.isg.rhul.ac.uk/~kp/SandPfinal.pdf). If absolutely
- // needed, it's possible to specify a custom Config to enable it.
- // You should expect that an active attacker can recover plaintext if
- // you do.
- aes128cbcID: {16, aes.BlockSize, 0, nil},
-}
-
-// prefixLen is the length of the packet prefix that contains the packet length
-// and number of padding bytes.
-const prefixLen = 5
-
-// streamPacketCipher is a packetCipher using a stream cipher.
-type streamPacketCipher struct {
- mac hash.Hash
- cipher cipher.Stream
-
- // The following members are to avoid per-packet allocations.
- prefix [prefixLen]byte
- seqNumBytes [4]byte
- padding [2 * packetSizeMultiple]byte
- packetData []byte
- macResult []byte
-}
-
-// readPacket reads and decrypt a single packet from the reader argument.
-func (s *streamPacketCipher) readPacket(seqNum uint32, r io.Reader) ([]byte, error) {
- if _, err := io.ReadFull(r, s.prefix[:]); err != nil {
- return nil, err
- }
-
- s.cipher.XORKeyStream(s.prefix[:], s.prefix[:])
- length := binary.BigEndian.Uint32(s.prefix[0:4])
- paddingLength := uint32(s.prefix[4])
-
- var macSize uint32
- if s.mac != nil {
- s.mac.Reset()
- binary.BigEndian.PutUint32(s.seqNumBytes[:], seqNum)
- s.mac.Write(s.seqNumBytes[:])
- s.mac.Write(s.prefix[:])
- macSize = uint32(s.mac.Size())
- }
-
- if length <= paddingLength+1 {
- return nil, errors.New("ssh: invalid packet length, packet too small")
- }
-
- if length > maxPacket {
- return nil, errors.New("ssh: invalid packet length, packet too large")
- }
-
- // the maxPacket check above ensures that length-1+macSize
- // does not overflow.
- if uint32(cap(s.packetData)) < length-1+macSize {
- s.packetData = make([]byte, length-1+macSize)
- } else {
- s.packetData = s.packetData[:length-1+macSize]
- }
-
- if _, err := io.ReadFull(r, s.packetData); err != nil {
- return nil, err
- }
- mac := s.packetData[length-1:]
- data := s.packetData[:length-1]
- s.cipher.XORKeyStream(data, data)
-
- if s.mac != nil {
- s.mac.Write(data)
- s.macResult = s.mac.Sum(s.macResult[:0])
- if subtle.ConstantTimeCompare(s.macResult, mac) != 1 {
- return nil, errors.New("ssh: MAC failure")
- }
- }
-
- return s.packetData[:length-paddingLength-1], nil
-}
-
-// writePacket encrypts and sends a packet of data to the writer argument
-func (s *streamPacketCipher) writePacket(seqNum uint32, w io.Writer, rand io.Reader, packet []byte) error {
- if len(packet) > maxPacket {
- return errors.New("ssh: packet too large")
- }
-
- paddingLength := packetSizeMultiple - (prefixLen+len(packet))%packetSizeMultiple
- if paddingLength < 4 {
- paddingLength += packetSizeMultiple
- }
-
- length := len(packet) + 1 + paddingLength
- binary.BigEndian.PutUint32(s.prefix[:], uint32(length))
- s.prefix[4] = byte(paddingLength)
- padding := s.padding[:paddingLength]
- if _, err := io.ReadFull(rand, padding); err != nil {
- return err
- }
-
- if s.mac != nil {
- s.mac.Reset()
- binary.BigEndian.PutUint32(s.seqNumBytes[:], seqNum)
- s.mac.Write(s.seqNumBytes[:])
- s.mac.Write(s.prefix[:])
- s.mac.Write(packet)
- s.mac.Write(padding)
- }
-
- s.cipher.XORKeyStream(s.prefix[:], s.prefix[:])
- s.cipher.XORKeyStream(packet, packet)
- s.cipher.XORKeyStream(padding, padding)
-
- if _, err := w.Write(s.prefix[:]); err != nil {
- return err
- }
- if _, err := w.Write(packet); err != nil {
- return err
- }
- if _, err := w.Write(padding); err != nil {
- return err
- }
-
- if s.mac != nil {
- s.macResult = s.mac.Sum(s.macResult[:0])
- if _, err := w.Write(s.macResult); err != nil {
- return err
- }
- }
-
- return nil
-}
-
-type gcmCipher struct {
- aead cipher.AEAD
- prefix [4]byte
- iv []byte
- buf []byte
-}
-
-func newGCMCipher(iv, key, macKey []byte) (packetCipher, error) {
- c, err := aes.NewCipher(key)
- if err != nil {
- return nil, err
- }
-
- aead, err := cipher.NewGCM(c)
- if err != nil {
- return nil, err
- }
-
- return &gcmCipher{
- aead: aead,
- iv: iv,
- }, nil
-}
-
-const gcmTagSize = 16
-
-func (c *gcmCipher) writePacket(seqNum uint32, w io.Writer, rand io.Reader, packet []byte) error {
- // Pad out to multiple of 16 bytes. This is different from the
- // stream cipher because that encrypts the length too.
- padding := byte(packetSizeMultiple - (1+len(packet))%packetSizeMultiple)
- if padding < 4 {
- padding += packetSizeMultiple
- }
-
- length := uint32(len(packet) + int(padding) + 1)
- binary.BigEndian.PutUint32(c.prefix[:], length)
- if _, err := w.Write(c.prefix[:]); err != nil {
- return err
- }
-
- if cap(c.buf) < int(length) {
- c.buf = make([]byte, length)
- } else {
- c.buf = c.buf[:length]
- }
-
- c.buf[0] = padding
- copy(c.buf[1:], packet)
- if _, err := io.ReadFull(rand, c.buf[1+len(packet):]); err != nil {
- return err
- }
- c.buf = c.aead.Seal(c.buf[:0], c.iv, c.buf, c.prefix[:])
- if _, err := w.Write(c.buf); err != nil {
- return err
- }
- c.incIV()
-
- return nil
-}
-
-func (c *gcmCipher) incIV() {
- for i := 4 + 7; i >= 4; i-- {
- c.iv[i]++
- if c.iv[i] != 0 {
- break
- }
- }
-}
-
-func (c *gcmCipher) readPacket(seqNum uint32, r io.Reader) ([]byte, error) {
- if _, err := io.ReadFull(r, c.prefix[:]); err != nil {
- return nil, err
- }
- length := binary.BigEndian.Uint32(c.prefix[:])
- if length > maxPacket {
- return nil, errors.New("ssh: max packet length exceeded.")
- }
-
- if cap(c.buf) < int(length+gcmTagSize) {
- c.buf = make([]byte, length+gcmTagSize)
- } else {
- c.buf = c.buf[:length+gcmTagSize]
- }
-
- if _, err := io.ReadFull(r, c.buf); err != nil {
- return nil, err
- }
-
- plain, err := c.aead.Open(c.buf[:0], c.iv, c.buf, c.prefix[:])
- if err != nil {
- return nil, err
- }
- c.incIV()
-
- padding := plain[0]
- if padding < 4 || padding >= 20 {
- return nil, fmt.Errorf("ssh: illegal padding %d", padding)
- }
-
- if int(padding+1) >= len(plain) {
- return nil, fmt.Errorf("ssh: padding %d too large", padding)
- }
- plain = plain[1 : length-uint32(padding)]
- return plain, nil
-}
-
-// cbcCipher implements aes128-cbc cipher defined in RFC 4253 section 6.1
-type cbcCipher struct {
- mac hash.Hash
- macSize uint32
- decrypter cipher.BlockMode
- encrypter cipher.BlockMode
-
- // The following members are to avoid per-packet allocations.
- seqNumBytes [4]byte
- packetData []byte
- macResult []byte
-
- // Amount of data we should still read to hide which
- // verification error triggered.
- oracleCamouflage uint32
-}
-
-func newAESCBCCipher(iv, key, macKey []byte, algs directionAlgorithms) (packetCipher, error) {
- c, err := aes.NewCipher(key)
- if err != nil {
- return nil, err
- }
-
- cbc := &cbcCipher{
- mac: macModes[algs.MAC].new(macKey),
- decrypter: cipher.NewCBCDecrypter(c, iv),
- encrypter: cipher.NewCBCEncrypter(c, iv),
- packetData: make([]byte, 1024),
- }
- if cbc.mac != nil {
- cbc.macSize = uint32(cbc.mac.Size())
- }
-
- return cbc, nil
-}
-
-func maxUInt32(a, b int) uint32 {
- if a > b {
- return uint32(a)
- }
- return uint32(b)
-}
-
-const (
- cbcMinPacketSizeMultiple = 8
- cbcMinPacketSize = 16
- cbcMinPaddingSize = 4
-)
-
-// cbcError represents a verification error that may leak information.
-type cbcError string
-
-func (e cbcError) Error() string { return string(e) }
-
-func (c *cbcCipher) readPacket(seqNum uint32, r io.Reader) ([]byte, error) {
- p, err := c.readPacketLeaky(seqNum, r)
- if err != nil {
- if _, ok := err.(cbcError); ok {
- // Verification error: read a fixed amount of
- // data, to make distinguishing between
- // failing MAC and failing length check more
- // difficult.
- io.CopyN(ioutil.Discard, r, int64(c.oracleCamouflage))
- }
- }
- return p, err
-}
-
-func (c *cbcCipher) readPacketLeaky(seqNum uint32, r io.Reader) ([]byte, error) {
- blockSize := c.decrypter.BlockSize()
-
- // Read the header, which will include some of the subsequent data in the
- // case of block ciphers - this is copied back to the payload later.
- // How many bytes of payload/padding will be read with this first read.
- firstBlockLength := uint32((prefixLen + blockSize - 1) / blockSize * blockSize)
- firstBlock := c.packetData[:firstBlockLength]
- if _, err := io.ReadFull(r, firstBlock); err != nil {
- return nil, err
- }
-
- c.oracleCamouflage = maxPacket + 4 + c.macSize - firstBlockLength
-
- c.decrypter.CryptBlocks(firstBlock, firstBlock)
- length := binary.BigEndian.Uint32(firstBlock[:4])
- if length > maxPacket {
- return nil, cbcError("ssh: packet too large")
- }
- if length+4 < maxUInt32(cbcMinPacketSize, blockSize) {
- // The minimum size of a packet is 16 (or the cipher block size, whichever
- // is larger) bytes.
- return nil, cbcError("ssh: packet too small")
- }
- // The length of the packet (including the length field but not the MAC) must
- // be a multiple of the block size or 8, whichever is larger.
- if (length+4)%maxUInt32(cbcMinPacketSizeMultiple, blockSize) != 0 {
- return nil, cbcError("ssh: invalid packet length multiple")
- }
-
- paddingLength := uint32(firstBlock[4])
- if paddingLength < cbcMinPaddingSize || length <= paddingLength+1 {
- return nil, cbcError("ssh: invalid packet length")
- }
-
- // Positions within the c.packetData buffer:
- macStart := 4 + length
- paddingStart := macStart - paddingLength
-
- // Entire packet size, starting before length, ending at end of mac.
- entirePacketSize := macStart + c.macSize
-
- // Ensure c.packetData is large enough for the entire packet data.
- if uint32(cap(c.packetData)) < entirePacketSize {
- // Still need to upsize and copy, but this should be rare at runtime, only
- // on upsizing the packetData buffer.
- c.packetData = make([]byte, entirePacketSize)
- copy(c.packetData, firstBlock)
- } else {
- c.packetData = c.packetData[:entirePacketSize]
- }
-
- if n, err := io.ReadFull(r, c.packetData[firstBlockLength:]); err != nil {
- return nil, err
- } else {
- c.oracleCamouflage -= uint32(n)
- }
-
- remainingCrypted := c.packetData[firstBlockLength:macStart]
- c.decrypter.CryptBlocks(remainingCrypted, remainingCrypted)
-
- mac := c.packetData[macStart:]
- if c.mac != nil {
- c.mac.Reset()
- binary.BigEndian.PutUint32(c.seqNumBytes[:], seqNum)
- c.mac.Write(c.seqNumBytes[:])
- c.mac.Write(c.packetData[:macStart])
- c.macResult = c.mac.Sum(c.macResult[:0])
- if subtle.ConstantTimeCompare(c.macResult, mac) != 1 {
- return nil, cbcError("ssh: MAC failure")
- }
- }
-
- return c.packetData[prefixLen:paddingStart], nil
-}
-
-func (c *cbcCipher) writePacket(seqNum uint32, w io.Writer, rand io.Reader, packet []byte) error {
- effectiveBlockSize := maxUInt32(cbcMinPacketSizeMultiple, c.encrypter.BlockSize())
-
- // Length of encrypted portion of the packet (header, payload, padding).
- // Enforce minimum padding and packet size.
- encLength := maxUInt32(prefixLen+len(packet)+cbcMinPaddingSize, cbcMinPaddingSize)
- // Enforce block size.
- encLength = (encLength + effectiveBlockSize - 1) / effectiveBlockSize * effectiveBlockSize
-
- length := encLength - 4
- paddingLength := int(length) - (1 + len(packet))
-
- // Overall buffer contains: header, payload, padding, mac.
- // Space for the MAC is reserved in the capacity but not the slice length.
- bufferSize := encLength + c.macSize
- if uint32(cap(c.packetData)) < bufferSize {
- c.packetData = make([]byte, encLength, bufferSize)
- } else {
- c.packetData = c.packetData[:encLength]
- }
-
- p := c.packetData
-
- // Packet header.
- binary.BigEndian.PutUint32(p, length)
- p = p[4:]
- p[0] = byte(paddingLength)
-
- // Payload.
- p = p[1:]
- copy(p, packet)
-
- // Padding.
- p = p[len(packet):]
- if _, err := io.ReadFull(rand, p); err != nil {
- return err
- }
-
- if c.mac != nil {
- c.mac.Reset()
- binary.BigEndian.PutUint32(c.seqNumBytes[:], seqNum)
- c.mac.Write(c.seqNumBytes[:])
- c.mac.Write(c.packetData)
- // The MAC is now appended into the capacity reserved for it earlier.
- c.packetData = c.mac.Sum(c.packetData)
- }
-
- c.encrypter.CryptBlocks(c.packetData[:encLength], c.packetData[:encLength])
-
- if _, err := w.Write(c.packetData); err != nil {
- return err
- }
-
- return nil
-}
diff --git a/vendor/golang.org/x/crypto/ssh/client.go b/vendor/golang.org/x/crypto/ssh/client.go
deleted file mode 100644
index 0b9fbe50..00000000
--- a/vendor/golang.org/x/crypto/ssh/client.go
+++ /dev/null
@@ -1,213 +0,0 @@
-// Copyright 2011 The Go Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style
-// license that can be found in the LICENSE file.
-
-package ssh
-
-import (
- "errors"
- "fmt"
- "net"
- "sync"
-)
-
-// Client implements a traditional SSH client that supports shells,
-// subprocesses, port forwarding and tunneled dialing.
-type Client struct {
- Conn
-
- forwards forwardList // forwarded tcpip connections from the remote side
- mu sync.Mutex
- channelHandlers map[string]chan NewChannel
-}
-
-// HandleChannelOpen returns a channel on which NewChannel requests
-// for the given type are sent. If the type already is being handled,
-// nil is returned. The channel is closed when the connection is closed.
-func (c *Client) HandleChannelOpen(channelType string) <-chan NewChannel {
- c.mu.Lock()
- defer c.mu.Unlock()
- if c.channelHandlers == nil {
- // The SSH channel has been closed.
- c := make(chan NewChannel)
- close(c)
- return c
- }
-
- ch := c.channelHandlers[channelType]
- if ch != nil {
- return nil
- }
-
- ch = make(chan NewChannel, 16)
- c.channelHandlers[channelType] = ch
- return ch
-}
-
-// NewClient creates a Client on top of the given connection.
-func NewClient(c Conn, chans <-chan NewChannel, reqs <-chan *Request) *Client {
- conn := &Client{
- Conn: c,
- channelHandlers: make(map[string]chan NewChannel, 1),
- }
-
- go conn.handleGlobalRequests(reqs)
- go conn.handleChannelOpens(chans)
- go func() {
- conn.Wait()
- conn.forwards.closeAll()
- }()
- go conn.forwards.handleChannels(conn.HandleChannelOpen("forwarded-tcpip"))
- return conn
-}
-
-// NewClientConn establishes an authenticated SSH connection using c
-// as the underlying transport. The Request and NewChannel channels
-// must be serviced or the connection will hang.
-func NewClientConn(c net.Conn, addr string, config *ClientConfig) (Conn, <-chan NewChannel, <-chan *Request, error) {
- fullConf := *config
- fullConf.SetDefaults()
- conn := &connection{
- sshConn: sshConn{conn: c},
- }
-
- if err := conn.clientHandshake(addr, &fullConf); err != nil {
- c.Close()
- return nil, nil, nil, fmt.Errorf("ssh: handshake failed: %v", err)
- }
- conn.mux = newMux(conn.transport)
- return conn, conn.mux.incomingChannels, conn.mux.incomingRequests, nil
-}
-
-// clientHandshake performs the client side key exchange. See RFC 4253 Section
-// 7.
-func (c *connection) clientHandshake(dialAddress string, config *ClientConfig) error {
- if config.ClientVersion != "" {
- c.clientVersion = []byte(config.ClientVersion)
- } else {
- c.clientVersion = []byte(packageVersion)
- }
- var err error
- c.serverVersion, err = exchangeVersions(c.sshConn.conn, c.clientVersion)
- if err != nil {
- return err
- }
-
- c.transport = newClientTransport(
- newTransport(c.sshConn.conn, config.Rand, true /* is client */),
- c.clientVersion, c.serverVersion, config, dialAddress, c.sshConn.RemoteAddr())
- if err := c.transport.requestKeyChange(); err != nil {
- return err
- }
-
- if packet, err := c.transport.readPacket(); err != nil {
- return err
- } else if packet[0] != msgNewKeys {
- return unexpectedMessageError(msgNewKeys, packet[0])
- }
-
- // We just did the key change, so the session ID is established.
- c.sessionID = c.transport.getSessionID()
-
- return c.clientAuthenticate(config)
-}
-
-// verifyHostKeySignature verifies the host key obtained in the key
-// exchange.
-func verifyHostKeySignature(hostKey PublicKey, result *kexResult) error {
- sig, rest, ok := parseSignatureBody(result.Signature)
- if len(rest) > 0 || !ok {
- return errors.New("ssh: signature parse error")
- }
-
- return hostKey.Verify(result.H, sig)
-}
-
-// NewSession opens a new Session for this client. (A session is a remote
-// execution of a program.)
-func (c *Client) NewSession() (*Session, error) {
- ch, in, err := c.OpenChannel("session", nil)
- if err != nil {
- return nil, err
- }
- return newSession(ch, in)
-}
-
-func (c *Client) handleGlobalRequests(incoming <-chan *Request) {
- for r := range incoming {
- // This handles keepalive messages and matches
- // the behaviour of OpenSSH.
- r.Reply(false, nil)
- }
-}
-
-// handleChannelOpens channel open messages from the remote side.
-func (c *Client) handleChannelOpens(in <-chan NewChannel) {
- for ch := range in {
- c.mu.Lock()
- handler := c.channelHandlers[ch.ChannelType()]
- c.mu.Unlock()
-
- if handler != nil {
- handler <- ch
- } else {
- ch.Reject(UnknownChannelType, fmt.Sprintf("unknown channel type: %v", ch.ChannelType()))
- }
- }
-
- c.mu.Lock()
- for _, ch := range c.channelHandlers {
- close(ch)
- }
- c.channelHandlers = nil
- c.mu.Unlock()
-}
-
-// Dial starts a client connection to the given SSH server. It is a
-// convenience function that connects to the given network address,
-// initiates the SSH handshake, and then sets up a Client. For access
-// to incoming channels and requests, use net.Dial with NewClientConn
-// instead.
-func Dial(network, addr string, config *ClientConfig) (*Client, error) {
- conn, err := net.Dial(network, addr)
- if err != nil {
- return nil, err
- }
- c, chans, reqs, err := NewClientConn(conn, addr, config)
- if err != nil {
- return nil, err
- }
- return NewClient(c, chans, reqs), nil
-}
-
-// A ClientConfig structure is used to configure a Client. It must not be
-// modified after having been passed to an SSH function.
-type ClientConfig struct {
- // Config contains configuration that is shared between clients and
- // servers.
- Config
-
- // User contains the username to authenticate as.
- User string
-
- // Auth contains possible authentication methods to use with the
- // server. Only the first instance of a particular RFC 4252 method will
- // be used during authentication.
- Auth []AuthMethod
-
- // HostKeyCallback, if not nil, is called during the cryptographic
- // handshake to validate the server's host key. A nil HostKeyCallback
- // implies that all host keys are accepted.
- HostKeyCallback func(hostname string, remote net.Addr, key PublicKey) error
-
- // ClientVersion contains the version identification string that will
- // be used for the connection. If empty, a reasonable default is used.
- ClientVersion string
-
- // HostKeyAlgorithms lists the key types that the client will
- // accept from the server as host key, in order of
- // preference. If empty, a reasonable default is used. Any
- // string returned from PublicKey.Type method may be used, or
- // any of the CertAlgoXxxx and KeyAlgoXxxx constants.
- HostKeyAlgorithms []string
-}
diff --git a/vendor/golang.org/x/crypto/ssh/client_auth.go b/vendor/golang.org/x/crypto/ssh/client_auth.go
deleted file mode 100644
index e15be3ef..00000000
--- a/vendor/golang.org/x/crypto/ssh/client_auth.go
+++ /dev/null
@@ -1,441 +0,0 @@
-// Copyright 2011 The Go Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style
-// license that can be found in the LICENSE file.
-
-package ssh
-
-import (
- "bytes"
- "errors"
- "fmt"
- "io"
-)
-
-// clientAuthenticate authenticates with the remote server. See RFC 4252.
-func (c *connection) clientAuthenticate(config *ClientConfig) error {
- // initiate user auth session
- if err := c.transport.writePacket(Marshal(&serviceRequestMsg{serviceUserAuth})); err != nil {
- return err
- }
- packet, err := c.transport.readPacket()
- if err != nil {
- return err
- }
- var serviceAccept serviceAcceptMsg
- if err := Unmarshal(packet, &serviceAccept); err != nil {
- return err
- }
-
- // during the authentication phase the client first attempts the "none" method
- // then any untried methods suggested by the server.
- tried := make(map[string]bool)
- var lastMethods []string
- for auth := AuthMethod(new(noneAuth)); auth != nil; {
- ok, methods, err := auth.auth(c.transport.getSessionID(), config.User, c.transport, config.Rand)
- if err != nil {
- return err
- }
- if ok {
- // success
- return nil
- }
- tried[auth.method()] = true
- if methods == nil {
- methods = lastMethods
- }
- lastMethods = methods
-
- auth = nil
-
- findNext:
- for _, a := range config.Auth {
- candidateMethod := a.method()
- if tried[candidateMethod] {
- continue
- }
- for _, meth := range methods {
- if meth == candidateMethod {
- auth = a
- break findNext
- }
- }
- }
- }
- return fmt.Errorf("ssh: unable to authenticate, attempted methods %v, no supported methods remain", keys(tried))
-}
-
-func keys(m map[string]bool) []string {
- s := make([]string, 0, len(m))
-
- for key := range m {
- s = append(s, key)
- }
- return s
-}
-
-// An AuthMethod represents an instance of an RFC 4252 authentication method.
-type AuthMethod interface {
- // auth authenticates user over transport t.
- // Returns true if authentication is successful.
- // If authentication is not successful, a []string of alternative
- // method names is returned. If the slice is nil, it will be ignored
- // and the previous set of possible methods will be reused.
- auth(session []byte, user string, p packetConn, rand io.Reader) (bool, []string, error)
-
- // method returns the RFC 4252 method name.
- method() string
-}
-
-// "none" authentication, RFC 4252 section 5.2.
-type noneAuth int
-
-func (n *noneAuth) auth(session []byte, user string, c packetConn, rand io.Reader) (bool, []string, error) {
- if err := c.writePacket(Marshal(&userAuthRequestMsg{
- User: user,
- Service: serviceSSH,
- Method: "none",
- })); err != nil {
- return false, nil, err
- }
-
- return handleAuthResponse(c)
-}
-
-func (n *noneAuth) method() string {
- return "none"
-}
-
-// passwordCallback is an AuthMethod that fetches the password through
-// a function call, e.g. by prompting the user.
-type passwordCallback func() (password string, err error)
-
-func (cb passwordCallback) auth(session []byte, user string, c packetConn, rand io.Reader) (bool, []string, error) {
- type passwordAuthMsg struct {
- User string `sshtype:"50"`
- Service string
- Method string
- Reply bool
- Password string
- }
-
- pw, err := cb()
- // REVIEW NOTE: is there a need to support skipping a password attempt?
- // The program may only find out that the user doesn't have a password
- // when prompting.
- if err != nil {
- return false, nil, err
- }
-
- if err := c.writePacket(Marshal(&passwordAuthMsg{
- User: user,
- Service: serviceSSH,
- Method: cb.method(),
- Reply: false,
- Password: pw,
- })); err != nil {
- return false, nil, err
- }
-
- return handleAuthResponse(c)
-}
-
-func (cb passwordCallback) method() string {
- return "password"
-}
-
-// Password returns an AuthMethod using the given password.
-func Password(secret string) AuthMethod {
- return passwordCallback(func() (string, error) { return secret, nil })
-}
-
-// PasswordCallback returns an AuthMethod that uses a callback for
-// fetching a password.
-func PasswordCallback(prompt func() (secret string, err error)) AuthMethod {
- return passwordCallback(prompt)
-}
-
-type publickeyAuthMsg struct {
- User string `sshtype:"50"`
- Service string
- Method string
- // HasSig indicates to the receiver packet that the auth request is signed and
- // should be used for authentication of the request.
- HasSig bool
- Algoname string
- PubKey []byte
- // Sig is tagged with "rest" so Marshal will exclude it during
- // validateKey
- Sig []byte `ssh:"rest"`
-}
-
-// publicKeyCallback is an AuthMethod that uses a set of key
-// pairs for authentication.
-type publicKeyCallback func() ([]Signer, error)
-
-func (cb publicKeyCallback) method() string {
- return "publickey"
-}
-
-func (cb publicKeyCallback) auth(session []byte, user string, c packetConn, rand io.Reader) (bool, []string, error) {
- // Authentication is performed in two stages. The first stage sends an
- // enquiry to test if each key is acceptable to the remote. The second
- // stage attempts to authenticate with the valid keys obtained in the
- // first stage.
-
- signers, err := cb()
- if err != nil {
- return false, nil, err
- }
- var validKeys []Signer
- for _, signer := range signers {
- if ok, err := validateKey(signer.PublicKey(), user, c); ok {
- validKeys = append(validKeys, signer)
- } else {
- if err != nil {
- return false, nil, err
- }
- }
- }
-
- // methods that may continue if this auth is not successful.
- var methods []string
- for _, signer := range validKeys {
- pub := signer.PublicKey()
-
- pubKey := pub.Marshal()
- sign, err := signer.Sign(rand, buildDataSignedForAuth(session, userAuthRequestMsg{
- User: user,
- Service: serviceSSH,
- Method: cb.method(),
- }, []byte(pub.Type()), pubKey))
- if err != nil {
- return false, nil, err
- }
-
- // manually wrap the serialized signature in a string
- s := Marshal(sign)
- sig := make([]byte, stringLength(len(s)))
- marshalString(sig, s)
- msg := publickeyAuthMsg{
- User: user,
- Service: serviceSSH,
- Method: cb.method(),
- HasSig: true,
- Algoname: pub.Type(),
- PubKey: pubKey,
- Sig: sig,
- }
- p := Marshal(&msg)
- if err := c.writePacket(p); err != nil {
- return false, nil, err
- }
- var success bool
- success, methods, err = handleAuthResponse(c)
- if err != nil {
- return false, nil, err
- }
- if success {
- return success, methods, err
- }
- }
- return false, methods, nil
-}
-
-// validateKey validates the key provided is acceptable to the server.
-func validateKey(key PublicKey, user string, c packetConn) (bool, error) {
- pubKey := key.Marshal()
- msg := publickeyAuthMsg{
- User: user,
- Service: serviceSSH,
- Method: "publickey",
- HasSig: false,
- Algoname: key.Type(),
- PubKey: pubKey,
- }
- if err := c.writePacket(Marshal(&msg)); err != nil {
- return false, err
- }
-
- return confirmKeyAck(key, c)
-}
-
-func confirmKeyAck(key PublicKey, c packetConn) (bool, error) {
- pubKey := key.Marshal()
- algoname := key.Type()
-
- for {
- packet, err := c.readPacket()
- if err != nil {
- return false, err
- }
- switch packet[0] {
- case msgUserAuthBanner:
- // TODO(gpaul): add callback to present the banner to the user
- case msgUserAuthPubKeyOk:
- var msg userAuthPubKeyOkMsg
- if err := Unmarshal(packet, &msg); err != nil {
- return false, err
- }
- if msg.Algo != algoname || !bytes.Equal(msg.PubKey, pubKey) {
- return false, nil
- }
- return true, nil
- case msgUserAuthFailure:
- return false, nil
- default:
- return false, unexpectedMessageError(msgUserAuthSuccess, packet[0])
- }
- }
-}
-
-// PublicKeys returns an AuthMethod that uses the given key
-// pairs.
-func PublicKeys(signers ...Signer) AuthMethod {
- return publicKeyCallback(func() ([]Signer, error) { return signers, nil })
-}
-
-// PublicKeysCallback returns an AuthMethod that runs the given
-// function to obtain a list of key pairs.
-func PublicKeysCallback(getSigners func() (signers []Signer, err error)) AuthMethod {
- return publicKeyCallback(getSigners)
-}
-
-// handleAuthResponse returns whether the preceding authentication request succeeded
-// along with a list of remaining authentication methods to try next and
-// an error if an unexpected response was received.
-func handleAuthResponse(c packetConn) (bool, []string, error) {
- for {
- packet, err := c.readPacket()
- if err != nil {
- return false, nil, err
- }
-
- switch packet[0] {
- case msgUserAuthBanner:
- // TODO: add callback to present the banner to the user
- case msgUserAuthFailure:
- var msg userAuthFailureMsg
- if err := Unmarshal(packet, &msg); err != nil {
- return false, nil, err
- }
- return false, msg.Methods, nil
- case msgUserAuthSuccess:
- return true, nil, nil
- case msgDisconnect:
- return false, nil, io.EOF
- default:
- return false, nil, unexpectedMessageError(msgUserAuthSuccess, packet[0])
- }
- }
-}
-
-// KeyboardInteractiveChallenge should print questions, optionally
-// disabling echoing (e.g. for passwords), and return all the answers.
-// Challenge may be called multiple times in a single session. After
-// successful authentication, the server may send a challenge with no
-// questions, for which the user and instruction messages should be
-// printed. RFC 4256 section 3.3 details how the UI should behave for
-// both CLI and GUI environments.
-type KeyboardInteractiveChallenge func(user, instruction string, questions []string, echos []bool) (answers []string, err error)
-
-// KeyboardInteractive returns a AuthMethod using a prompt/response
-// sequence controlled by the server.
-func KeyboardInteractive(challenge KeyboardInteractiveChallenge) AuthMethod {
- return challenge
-}
-
-func (cb KeyboardInteractiveChallenge) method() string {
- return "keyboard-interactive"
-}
-
-func (cb KeyboardInteractiveChallenge) auth(session []byte, user string, c packetConn, rand io.Reader) (bool, []string, error) {
- type initiateMsg struct {
- User string `sshtype:"50"`
- Service string
- Method string
- Language string
- Submethods string
- }
-
- if err := c.writePacket(Marshal(&initiateMsg{
- User: user,
- Service: serviceSSH,
- Method: "keyboard-interactive",
- })); err != nil {
- return false, nil, err
- }
-
- for {
- packet, err := c.readPacket()
- if err != nil {
- return false, nil, err
- }
-
- // like handleAuthResponse, but with less options.
- switch packet[0] {
- case msgUserAuthBanner:
- // TODO: Print banners during userauth.
- continue
- case msgUserAuthInfoRequest:
- // OK
- case msgUserAuthFailure:
- var msg userAuthFailureMsg
- if err := Unmarshal(packet, &msg); err != nil {
- return false, nil, err
- }
- return false, msg.Methods, nil
- case msgUserAuthSuccess:
- return true, nil, nil
- default:
- return false, nil, unexpectedMessageError(msgUserAuthInfoRequest, packet[0])
- }
-
- var msg userAuthInfoRequestMsg
- if err := Unmarshal(packet, &msg); err != nil {
- return false, nil, err
- }
-
- // Manually unpack the prompt/echo pairs.
- rest := msg.Prompts
- var prompts []string
- var echos []bool
- for i := 0; i < int(msg.NumPrompts); i++ {
- prompt, r, ok := parseString(rest)
- if !ok || len(r) == 0 {
- return false, nil, errors.New("ssh: prompt format error")
- }
- prompts = append(prompts, string(prompt))
- echos = append(echos, r[0] != 0)
- rest = r[1:]
- }
-
- if len(rest) != 0 {
- return false, nil, errors.New("ssh: extra data following keyboard-interactive pairs")
- }
-
- answers, err := cb(msg.User, msg.Instruction, prompts, echos)
- if err != nil {
- return false, nil, err
- }
-
- if len(answers) != len(prompts) {
- return false, nil, errors.New("ssh: not enough answers from keyboard-interactive callback")
- }
- responseLength := 1 + 4
- for _, a := range answers {
- responseLength += stringLength(len(a))
- }
- serialized := make([]byte, responseLength)
- p := serialized
- p[0] = msgUserAuthInfoResponse
- p = p[1:]
- p = marshalUint32(p, uint32(len(answers)))
- for _, a := range answers {
- p = marshalString(p, []byte(a))
- }
-
- if err := c.writePacket(serialized); err != nil {
- return false, nil, err
- }
- }
-}
diff --git a/vendor/golang.org/x/crypto/ssh/common.go b/vendor/golang.org/x/crypto/ssh/common.go
deleted file mode 100644
index 9fc739e1..00000000
--- a/vendor/golang.org/x/crypto/ssh/common.go
+++ /dev/null
@@ -1,354 +0,0 @@
-// Copyright 2011 The Go Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style
-// license that can be found in the LICENSE file.
-
-package ssh
-
-import (
- "crypto"
- "crypto/rand"
- "fmt"
- "io"
- "sync"
-
- _ "crypto/sha1"
- _ "crypto/sha256"
- _ "crypto/sha512"
-)
-
-// These are string constants in the SSH protocol.
-const (
- compressionNone = "none"
- serviceUserAuth = "ssh-userauth"
- serviceSSH = "ssh-connection"
-)
-
-// supportedCiphers specifies the supported ciphers in preference order.
-var supportedCiphers = []string{
- "aes128-ctr", "aes192-ctr", "aes256-ctr",
- "aes128-gcm@openssh.com",
- "arcfour256", "arcfour128",
-}
-
-// supportedKexAlgos specifies the supported key-exchange algorithms in
-// preference order.
-var supportedKexAlgos = []string{
- kexAlgoCurve25519SHA256,
- // P384 and P521 are not constant-time yet, but since we don't
- // reuse ephemeral keys, using them for ECDH should be OK.
- kexAlgoECDH256, kexAlgoECDH384, kexAlgoECDH521,
- kexAlgoDH14SHA1, kexAlgoDH1SHA1,
-}
-
-// supportedKexAlgos specifies the supported host-key algorithms (i.e. methods
-// of authenticating servers) in preference order.
-var supportedHostKeyAlgos = []string{
- CertAlgoRSAv01, CertAlgoDSAv01, CertAlgoECDSA256v01,
- CertAlgoECDSA384v01, CertAlgoECDSA521v01,
-
- KeyAlgoECDSA256, KeyAlgoECDSA384, KeyAlgoECDSA521,
- KeyAlgoRSA, KeyAlgoDSA,
-}
-
-// supportedMACs specifies a default set of MAC algorithms in preference order.
-// This is based on RFC 4253, section 6.4, but with hmac-md5 variants removed
-// because they have reached the end of their useful life.
-var supportedMACs = []string{
- "hmac-sha2-256", "hmac-sha1", "hmac-sha1-96",
-}
-
-var supportedCompressions = []string{compressionNone}
-
-// hashFuncs keeps the mapping of supported algorithms to their respective
-// hashes needed for signature verification.
-var hashFuncs = map[string]crypto.Hash{
- KeyAlgoRSA: crypto.SHA1,
- KeyAlgoDSA: crypto.SHA1,
- KeyAlgoECDSA256: crypto.SHA256,
- KeyAlgoECDSA384: crypto.SHA384,
- KeyAlgoECDSA521: crypto.SHA512,
- CertAlgoRSAv01: crypto.SHA1,
- CertAlgoDSAv01: crypto.SHA1,
- CertAlgoECDSA256v01: crypto.SHA256,
- CertAlgoECDSA384v01: crypto.SHA384,
- CertAlgoECDSA521v01: crypto.SHA512,
-}
-
-// unexpectedMessageError results when the SSH message that we received didn't
-// match what we wanted.
-func unexpectedMessageError(expected, got uint8) error {
- return fmt.Errorf("ssh: unexpected message type %d (expected %d)", got, expected)
-}
-
-// parseError results from a malformed SSH message.
-func parseError(tag uint8) error {
- return fmt.Errorf("ssh: parse error in message type %d", tag)
-}
-
-func findCommon(what string, client []string, server []string) (common string, err error) {
- for _, c := range client {
- for _, s := range server {
- if c == s {
- return c, nil
- }
- }
- }
- return "", fmt.Errorf("ssh: no common algorithm for %s; client offered: %v, server offered: %v", what, client, server)
-}
-
-type directionAlgorithms struct {
- Cipher string
- MAC string
- Compression string
-}
-
-type algorithms struct {
- kex string
- hostKey string
- w directionAlgorithms
- r directionAlgorithms
-}
-
-func findAgreedAlgorithms(clientKexInit, serverKexInit *kexInitMsg) (algs *algorithms, err error) {
- result := &algorithms{}
-
- result.kex, err = findCommon("key exchange", clientKexInit.KexAlgos, serverKexInit.KexAlgos)
- if err != nil {
- return
- }
-
- result.hostKey, err = findCommon("host key", clientKexInit.ServerHostKeyAlgos, serverKexInit.ServerHostKeyAlgos)
- if err != nil {
- return
- }
-
- result.w.Cipher, err = findCommon("client to server cipher", clientKexInit.CiphersClientServer, serverKexInit.CiphersClientServer)
- if err != nil {
- return
- }
-
- result.r.Cipher, err = findCommon("server to client cipher", clientKexInit.CiphersServerClient, serverKexInit.CiphersServerClient)
- if err != nil {
- return
- }
-
- result.w.MAC, err = findCommon("client to server MAC", clientKexInit.MACsClientServer, serverKexInit.MACsClientServer)
- if err != nil {
- return
- }
-
- result.r.MAC, err = findCommon("server to client MAC", clientKexInit.MACsServerClient, serverKexInit.MACsServerClient)
- if err != nil {
- return
- }
-
- result.w.Compression, err = findCommon("client to server compression", clientKexInit.CompressionClientServer, serverKexInit.CompressionClientServer)
- if err != nil {
- return
- }
-
- result.r.Compression, err = findCommon("server to client compression", clientKexInit.CompressionServerClient, serverKexInit.CompressionServerClient)
- if err != nil {
- return
- }
-
- return result, nil
-}
-
-// If rekeythreshold is too small, we can't make any progress sending
-// stuff.
-const minRekeyThreshold uint64 = 256
-
-// Config contains configuration data common to both ServerConfig and
-// ClientConfig.
-type Config struct {
- // Rand provides the source of entropy for cryptographic
- // primitives. If Rand is nil, the cryptographic random reader
- // in package crypto/rand will be used.
- Rand io.Reader
-
- // The maximum number of bytes sent or received after which a
- // new key is negotiated. It must be at least 256. If
- // unspecified, 1 gigabyte is used.
- RekeyThreshold uint64
-
- // The allowed key exchanges algorithms. If unspecified then a
- // default set of algorithms is used.
- KeyExchanges []string
-
- // The allowed cipher algorithms. If unspecified then a sensible
- // default is used.
- Ciphers []string
-
- // The allowed MAC algorithms. If unspecified then a sensible default
- // is used.
- MACs []string
-}
-
-// SetDefaults sets sensible values for unset fields in config. This is
-// exported for testing: Configs passed to SSH functions are copied and have
-// default values set automatically.
-func (c *Config) SetDefaults() {
- if c.Rand == nil {
- c.Rand = rand.Reader
- }
- if c.Ciphers == nil {
- c.Ciphers = supportedCiphers
- }
- var ciphers []string
- for _, c := range c.Ciphers {
- if cipherModes[c] != nil {
- // reject the cipher if we have no cipherModes definition
- ciphers = append(ciphers, c)
- }
- }
- c.Ciphers = ciphers
-
- if c.KeyExchanges == nil {
- c.KeyExchanges = supportedKexAlgos
- }
-
- if c.MACs == nil {
- c.MACs = supportedMACs
- }
-
- if c.RekeyThreshold == 0 {
- // RFC 4253, section 9 suggests rekeying after 1G.
- c.RekeyThreshold = 1 << 30
- }
- if c.RekeyThreshold < minRekeyThreshold {
- c.RekeyThreshold = minRekeyThreshold
- }
-}
-
-// buildDataSignedForAuth returns the data that is signed in order to prove
-// possession of a private key. See RFC 4252, section 7.
-func buildDataSignedForAuth(sessionId []byte, req userAuthRequestMsg, algo, pubKey []byte) []byte {
- data := struct {
- Session []byte
- Type byte
- User string
- Service string
- Method string
- Sign bool
- Algo []byte
- PubKey []byte
- }{
- sessionId,
- msgUserAuthRequest,
- req.User,
- req.Service,
- req.Method,
- true,
- algo,
- pubKey,
- }
- return Marshal(data)
-}
-
-func appendU16(buf []byte, n uint16) []byte {
- return append(buf, byte(n>>8), byte(n))
-}
-
-func appendU32(buf []byte, n uint32) []byte {
- return append(buf, byte(n>>24), byte(n>>16), byte(n>>8), byte(n))
-}
-
-func appendU64(buf []byte, n uint64) []byte {
- return append(buf,
- byte(n>>56), byte(n>>48), byte(n>>40), byte(n>>32),
- byte(n>>24), byte(n>>16), byte(n>>8), byte(n))
-}
-
-func appendInt(buf []byte, n int) []byte {
- return appendU32(buf, uint32(n))
-}
-
-func appendString(buf []byte, s string) []byte {
- buf = appendU32(buf, uint32(len(s)))
- buf = append(buf, s...)
- return buf
-}
-
-func appendBool(buf []byte, b bool) []byte {
- if b {
- return append(buf, 1)
- }
- return append(buf, 0)
-}
-
-// newCond is a helper to hide the fact that there is no usable zero
-// value for sync.Cond.
-func newCond() *sync.Cond { return sync.NewCond(new(sync.Mutex)) }
-
-// window represents the buffer available to clients
-// wishing to write to a channel.
-type window struct {
- *sync.Cond
- win uint32 // RFC 4254 5.2 says the window size can grow to 2^32-1
- writeWaiters int
- closed bool
-}
-
-// add adds win to the amount of window available
-// for consumers.
-func (w *window) add(win uint32) bool {
- // a zero sized window adjust is a noop.
- if win == 0 {
- return true
- }
- w.L.Lock()
- if w.win+win < win {
- w.L.Unlock()
- return false
- }
- w.win += win
- // It is unusual that multiple goroutines would be attempting to reserve
- // window space, but not guaranteed. Use broadcast to notify all waiters
- // that additional window is available.
- w.Broadcast()
- w.L.Unlock()
- return true
-}
-
-// close sets the window to closed, so all reservations fail
-// immediately.
-func (w *window) close() {
- w.L.Lock()
- w.closed = true
- w.Broadcast()
- w.L.Unlock()
-}
-
-// reserve reserves win from the available window capacity.
-// If no capacity remains, reserve will block. reserve may
-// return less than requested.
-func (w *window) reserve(win uint32) (uint32, error) {
- var err error
- w.L.Lock()
- w.writeWaiters++
- w.Broadcast()
- for w.win == 0 && !w.closed {
- w.Wait()
- }
- w.writeWaiters--
- if w.win < win {
- win = w.win
- }
- w.win -= win
- if w.closed {
- err = io.EOF
- }
- w.L.Unlock()
- return win, err
-}
-
-// waitWriterBlocked waits until some goroutine is blocked for further
-// writes. It is used in tests only.
-func (w *window) waitWriterBlocked() {
- w.Cond.L.Lock()
- for w.writeWaiters == 0 {
- w.Cond.Wait()
- }
- w.Cond.L.Unlock()
-}
diff --git a/vendor/golang.org/x/crypto/ssh/connection.go b/vendor/golang.org/x/crypto/ssh/connection.go
deleted file mode 100644
index 979d919e..00000000
--- a/vendor/golang.org/x/crypto/ssh/connection.go
+++ /dev/null
@@ -1,144 +0,0 @@
-// Copyright 2013 The Go Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style
-// license that can be found in the LICENSE file.
-
-package ssh
-
-import (
- "fmt"
- "net"
-)
-
-// OpenChannelError is returned if the other side rejects an
-// OpenChannel request.
-type OpenChannelError struct {
- Reason RejectionReason
- Message string
-}
-
-func (e *OpenChannelError) Error() string {
- return fmt.Sprintf("ssh: rejected: %s (%s)", e.Reason, e.Message)
-}
-
-// ConnMetadata holds metadata for the connection.
-type ConnMetadata interface {
- // User returns the user ID for this connection.
- // It is empty if no authentication is used.
- User() string
-
- // SessionID returns the sesson hash, also denoted by H.
- SessionID() []byte
-
- // ClientVersion returns the client's version string as hashed
- // into the session ID.
- ClientVersion() []byte
-
- // ServerVersion returns the server's version string as hashed
- // into the session ID.
- ServerVersion() []byte
-
- // RemoteAddr returns the remote address for this connection.
- RemoteAddr() net.Addr
-
- // LocalAddr returns the local address for this connection.
- LocalAddr() net.Addr
-}
-
-// Conn represents an SSH connection for both server and client roles.
-// Conn is the basis for implementing an application layer, such
-// as ClientConn, which implements the traditional shell access for
-// clients.
-type Conn interface {
- ConnMetadata
-
- // SendRequest sends a global request, and returns the
- // reply. If wantReply is true, it returns the response status
- // and payload. See also RFC4254, section 4.
- SendRequest(name string, wantReply bool, payload []byte) (bool, []byte, error)
-
- // OpenChannel tries to open an channel. If the request is
- // rejected, it returns *OpenChannelError. On success it returns
- // the SSH Channel and a Go channel for incoming, out-of-band
- // requests. The Go channel must be serviced, or the
- // connection will hang.
- OpenChannel(name string, data []byte) (Channel, <-chan *Request, error)
-
- // Close closes the underlying network connection
- Close() error
-
- // Wait blocks until the connection has shut down, and returns the
- // error causing the shutdown.
- Wait() error
-
- // TODO(hanwen): consider exposing:
- // RequestKeyChange
- // Disconnect
-}
-
-// DiscardRequests consumes and rejects all requests from the
-// passed-in channel.
-func DiscardRequests(in <-chan *Request) {
- for req := range in {
- if req.WantReply {
- req.Reply(false, nil)
- }
- }
-}
-
-// A connection represents an incoming connection.
-type connection struct {
- transport *handshakeTransport
- sshConn
-
- // The connection protocol.
- *mux
-}
-
-func (c *connection) Close() error {
- return c.sshConn.conn.Close()
-}
-
-// sshconn provides net.Conn metadata, but disallows direct reads and
-// writes.
-type sshConn struct {
- conn net.Conn
-
- user string
- sessionID []byte
- clientVersion []byte
- serverVersion []byte
-}
-
-func dup(src []byte) []byte {
- dst := make([]byte, len(src))
- copy(dst, src)
- return dst
-}
-
-func (c *sshConn) User() string {
- return c.user
-}
-
-func (c *sshConn) RemoteAddr() net.Addr {
- return c.conn.RemoteAddr()
-}
-
-func (c *sshConn) Close() error {
- return c.conn.Close()
-}
-
-func (c *sshConn) LocalAddr() net.Addr {
- return c.conn.LocalAddr()
-}
-
-func (c *sshConn) SessionID() []byte {
- return dup(c.sessionID)
-}
-
-func (c *sshConn) ClientVersion() []byte {
- return dup(c.clientVersion)
-}
-
-func (c *sshConn) ServerVersion() []byte {
- return dup(c.serverVersion)
-}
diff --git a/vendor/golang.org/x/crypto/ssh/doc.go b/vendor/golang.org/x/crypto/ssh/doc.go
deleted file mode 100644
index a5ff8af6..00000000
--- a/vendor/golang.org/x/crypto/ssh/doc.go
+++ /dev/null
@@ -1,18 +0,0 @@
-// Copyright 2011 The Go Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style
-// license that can be found in the LICENSE file.
-
-/*
-Package ssh implements an SSH client and server.
-
-SSH is a transport security protocol, an authentication protocol and a
-family of application protocols. The most typical application level
-protocol is a remote shell and this is specifically implemented. However,
-the multiplexed nature of SSH is exposed to users that wish to support
-others.
-
-References:
- [PROTOCOL.certkeys]: http://cvsweb.openbsd.org/cgi-bin/cvsweb/src/usr.bin/ssh/PROTOCOL.certkeys?rev=HEAD
- [SSH-PARAMETERS]: http://www.iana.org/assignments/ssh-parameters/ssh-parameters.xml#ssh-parameters-1
-*/
-package ssh
diff --git a/vendor/golang.org/x/crypto/ssh/handshake.go b/vendor/golang.org/x/crypto/ssh/handshake.go
deleted file mode 100644
index 1c54f758..00000000
--- a/vendor/golang.org/x/crypto/ssh/handshake.go
+++ /dev/null
@@ -1,412 +0,0 @@
-// Copyright 2013 The Go Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style
-// license that can be found in the LICENSE file.
-
-package ssh
-
-import (
- "crypto/rand"
- "errors"
- "fmt"
- "io"
- "log"
- "net"
- "sync"
-)
-
-// debugHandshake, if set, prints messages sent and received. Key
-// exchange messages are printed as if DH were used, so the debug
-// messages are wrong when using ECDH.
-const debugHandshake = false
-
-// keyingTransport is a packet based transport that supports key
-// changes. It need not be thread-safe. It should pass through
-// msgNewKeys in both directions.
-type keyingTransport interface {
- packetConn
-
- // prepareKeyChange sets up a key change. The key change for a
- // direction will be effected if a msgNewKeys message is sent
- // or received.
- prepareKeyChange(*algorithms, *kexResult) error
-
- // getSessionID returns the session ID. prepareKeyChange must
- // have been called once.
- getSessionID() []byte
-}
-
-// rekeyingTransport is the interface of handshakeTransport that we
-// (internally) expose to ClientConn and ServerConn.
-type rekeyingTransport interface {
- packetConn
-
- // requestKeyChange asks the remote side to change keys. All
- // writes are blocked until the key change succeeds, which is
- // signaled by reading a msgNewKeys.
- requestKeyChange() error
-
- // getSessionID returns the session ID. This is only valid
- // after the first key change has completed.
- getSessionID() []byte
-}
-
-// handshakeTransport implements rekeying on top of a keyingTransport
-// and offers a thread-safe writePacket() interface.
-type handshakeTransport struct {
- conn keyingTransport
- config *Config
-
- serverVersion []byte
- clientVersion []byte
-
- // hostKeys is non-empty if we are the server. In that case,
- // it contains all host keys that can be used to sign the
- // connection.
- hostKeys []Signer
-
- // hostKeyAlgorithms is non-empty if we are the client. In that case,
- // we accept these key types from the server as host key.
- hostKeyAlgorithms []string
-
- // On read error, incoming is closed, and readError is set.
- incoming chan []byte
- readError error
-
- // data for host key checking
- hostKeyCallback func(hostname string, remote net.Addr, key PublicKey) error
- dialAddress string
- remoteAddr net.Addr
-
- readSinceKex uint64
-
- // Protects the writing side of the connection
- mu sync.Mutex
- cond *sync.Cond
- sentInitPacket []byte
- sentInitMsg *kexInitMsg
- writtenSinceKex uint64
- writeError error
-}
-
-func newHandshakeTransport(conn keyingTransport, config *Config, clientVersion, serverVersion []byte) *handshakeTransport {
- t := &handshakeTransport{
- conn: conn,
- serverVersion: serverVersion,
- clientVersion: clientVersion,
- incoming: make(chan []byte, 16),
- config: config,
- }
- t.cond = sync.NewCond(&t.mu)
- return t
-}
-
-func newClientTransport(conn keyingTransport, clientVersion, serverVersion []byte, config *ClientConfig, dialAddr string, addr net.Addr) *handshakeTransport {
- t := newHandshakeTransport(conn, &config.Config, clientVersion, serverVersion)
- t.dialAddress = dialAddr
- t.remoteAddr = addr
- t.hostKeyCallback = config.HostKeyCallback
- if config.HostKeyAlgorithms != nil {
- t.hostKeyAlgorithms = config.HostKeyAlgorithms
- } else {
- t.hostKeyAlgorithms = supportedHostKeyAlgos
- }
- go t.readLoop()
- return t
-}
-
-func newServerTransport(conn keyingTransport, clientVersion, serverVersion []byte, config *ServerConfig) *handshakeTransport {
- t := newHandshakeTransport(conn, &config.Config, clientVersion, serverVersion)
- t.hostKeys = config.hostKeys
- go t.readLoop()
- return t
-}
-
-func (t *handshakeTransport) getSessionID() []byte {
- return t.conn.getSessionID()
-}
-
-func (t *handshakeTransport) id() string {
- if len(t.hostKeys) > 0 {
- return "server"
- }
- return "client"
-}
-
-func (t *handshakeTransport) readPacket() ([]byte, error) {
- p, ok := <-t.incoming
- if !ok {
- return nil, t.readError
- }
- return p, nil
-}
-
-func (t *handshakeTransport) readLoop() {
- for {
- p, err := t.readOnePacket()
- if err != nil {
- t.readError = err
- close(t.incoming)
- break
- }
- if p[0] == msgIgnore || p[0] == msgDebug {
- continue
- }
- t.incoming <- p
- }
-
- // If we can't read, declare the writing part dead too.
- t.mu.Lock()
- defer t.mu.Unlock()
- if t.writeError == nil {
- t.writeError = t.readError
- }
- t.cond.Broadcast()
-}
-
-func (t *handshakeTransport) readOnePacket() ([]byte, error) {
- if t.readSinceKex > t.config.RekeyThreshold {
- if err := t.requestKeyChange(); err != nil {
- return nil, err
- }
- }
-
- p, err := t.conn.readPacket()
- if err != nil {
- return nil, err
- }
-
- t.readSinceKex += uint64(len(p))
- if debugHandshake {
- msg, err := decode(p)
- log.Printf("%s got %T %v (%v)", t.id(), msg, msg, err)
- }
- if p[0] != msgKexInit {
- return p, nil
- }
- err = t.enterKeyExchange(p)
-
- t.mu.Lock()
- if err != nil {
- // drop connection
- t.conn.Close()
- t.writeError = err
- }
-
- if debugHandshake {
- log.Printf("%s exited key exchange, err %v", t.id(), err)
- }
-
- // Unblock writers.
- t.sentInitMsg = nil
- t.sentInitPacket = nil
- t.cond.Broadcast()
- t.writtenSinceKex = 0
- t.mu.Unlock()
-
- if err != nil {
- return nil, err
- }
-
- t.readSinceKex = 0
- return []byte{msgNewKeys}, nil
-}
-
-// sendKexInit sends a key change message, and returns the message
-// that was sent. After initiating the key change, all writes will be
-// blocked until the change is done, and a failed key change will
-// close the underlying transport. This function is safe for
-// concurrent use by multiple goroutines.
-func (t *handshakeTransport) sendKexInit() (*kexInitMsg, []byte, error) {
- t.mu.Lock()
- defer t.mu.Unlock()
- return t.sendKexInitLocked()
-}
-
-func (t *handshakeTransport) requestKeyChange() error {
- _, _, err := t.sendKexInit()
- return err
-}
-
-// sendKexInitLocked sends a key change message. t.mu must be locked
-// while this happens.
-func (t *handshakeTransport) sendKexInitLocked() (*kexInitMsg, []byte, error) {
- // kexInits may be sent either in response to the other side,
- // or because our side wants to initiate a key change, so we
- // may have already sent a kexInit. In that case, don't send a
- // second kexInit.
- if t.sentInitMsg != nil {
- return t.sentInitMsg, t.sentInitPacket, nil
- }
- msg := &kexInitMsg{
- KexAlgos: t.config.KeyExchanges,
- CiphersClientServer: t.config.Ciphers,
- CiphersServerClient: t.config.Ciphers,
- MACsClientServer: t.config.MACs,
- MACsServerClient: t.config.MACs,
- CompressionClientServer: supportedCompressions,
- CompressionServerClient: supportedCompressions,
- }
- io.ReadFull(rand.Reader, msg.Cookie[:])
-
- if len(t.hostKeys) > 0 {
- for _, k := range t.hostKeys {
- msg.ServerHostKeyAlgos = append(
- msg.ServerHostKeyAlgos, k.PublicKey().Type())
- }
- } else {
- msg.ServerHostKeyAlgos = t.hostKeyAlgorithms
- }
- packet := Marshal(msg)
-
- // writePacket destroys the contents, so save a copy.
- packetCopy := make([]byte, len(packet))
- copy(packetCopy, packet)
-
- if err := t.conn.writePacket(packetCopy); err != nil {
- return nil, nil, err
- }
-
- t.sentInitMsg = msg
- t.sentInitPacket = packet
- return msg, packet, nil
-}
-
-func (t *handshakeTransport) writePacket(p []byte) error {
- t.mu.Lock()
- defer t.mu.Unlock()
-
- if t.writtenSinceKex > t.config.RekeyThreshold {
- t.sendKexInitLocked()
- }
- for t.sentInitMsg != nil && t.writeError == nil {
- t.cond.Wait()
- }
- if t.writeError != nil {
- return t.writeError
- }
- t.writtenSinceKex += uint64(len(p))
-
- switch p[0] {
- case msgKexInit:
- return errors.New("ssh: only handshakeTransport can send kexInit")
- case msgNewKeys:
- return errors.New("ssh: only handshakeTransport can send newKeys")
- default:
- return t.conn.writePacket(p)
- }
-}
-
-func (t *handshakeTransport) Close() error {
- return t.conn.Close()
-}
-
-// enterKeyExchange runs the key exchange.
-func (t *handshakeTransport) enterKeyExchange(otherInitPacket []byte) error {
- if debugHandshake {
- log.Printf("%s entered key exchange", t.id())
- }
- myInit, myInitPacket, err := t.sendKexInit()
- if err != nil {
- return err
- }
-
- otherInit := &kexInitMsg{}
- if err := Unmarshal(otherInitPacket, otherInit); err != nil {
- return err
- }
-
- magics := handshakeMagics{
- clientVersion: t.clientVersion,
- serverVersion: t.serverVersion,
- clientKexInit: otherInitPacket,
- serverKexInit: myInitPacket,
- }
-
- clientInit := otherInit
- serverInit := myInit
- if len(t.hostKeys) == 0 {
- clientInit = myInit
- serverInit = otherInit
-
- magics.clientKexInit = myInitPacket
- magics.serverKexInit = otherInitPacket
- }
-
- algs, err := findAgreedAlgorithms(clientInit, serverInit)
- if err != nil {
- return err
- }
-
- // We don't send FirstKexFollows, but we handle receiving it.
- if otherInit.FirstKexFollows && algs.kex != otherInit.KexAlgos[0] {
- // other side sent a kex message for the wrong algorithm,
- // which we have to ignore.
- if _, err := t.conn.readPacket(); err != nil {
- return err
- }
- }
-
- kex, ok := kexAlgoMap[algs.kex]
- if !ok {
- return fmt.Errorf("ssh: unexpected key exchange algorithm %v", algs.kex)
- }
-
- var result *kexResult
- if len(t.hostKeys) > 0 {
- result, err = t.server(kex, algs, &magics)
- } else {
- result, err = t.client(kex, algs, &magics)
- }
-
- if err != nil {
- return err
- }
-
- t.conn.prepareKeyChange(algs, result)
- if err = t.conn.writePacket([]byte{msgNewKeys}); err != nil {
- return err
- }
- if packet, err := t.conn.readPacket(); err != nil {
- return err
- } else if packet[0] != msgNewKeys {
- return unexpectedMessageError(msgNewKeys, packet[0])
- }
- return nil
-}
-
-func (t *handshakeTransport) server(kex kexAlgorithm, algs *algorithms, magics *handshakeMagics) (*kexResult, error) {
- var hostKey Signer
- for _, k := range t.hostKeys {
- if algs.hostKey == k.PublicKey().Type() {
- hostKey = k
- }
- }
-
- r, err := kex.Server(t.conn, t.config.Rand, magics, hostKey)
- return r, err
-}
-
-func (t *handshakeTransport) client(kex kexAlgorithm, algs *algorithms, magics *handshakeMagics) (*kexResult, error) {
- result, err := kex.Client(t.conn, t.config.Rand, magics)
- if err != nil {
- return nil, err
- }
-
- hostKey, err := ParsePublicKey(result.HostKey)
- if err != nil {
- return nil, err
- }
-
- if err := verifyHostKeySignature(hostKey, result); err != nil {
- return nil, err
- }
-
- if t.hostKeyCallback != nil {
- err = t.hostKeyCallback(t.dialAddress, t.remoteAddr, hostKey)
- if err != nil {
- return nil, err
- }
- }
-
- return result, nil
-}
diff --git a/vendor/golang.org/x/crypto/ssh/kex.go b/vendor/golang.org/x/crypto/ssh/kex.go
deleted file mode 100644
index 3ec603c0..00000000
--- a/vendor/golang.org/x/crypto/ssh/kex.go
+++ /dev/null
@@ -1,526 +0,0 @@
-// Copyright 2013 The Go Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style
-// license that can be found in the LICENSE file.
-
-package ssh
-
-import (
- "crypto"
- "crypto/ecdsa"
- "crypto/elliptic"
- "crypto/rand"
- "crypto/subtle"
- "errors"
- "io"
- "math/big"
-
- "golang.org/x/crypto/curve25519"
-)
-
-const (
- kexAlgoDH1SHA1 = "diffie-hellman-group1-sha1"
- kexAlgoDH14SHA1 = "diffie-hellman-group14-sha1"
- kexAlgoECDH256 = "ecdh-sha2-nistp256"
- kexAlgoECDH384 = "ecdh-sha2-nistp384"
- kexAlgoECDH521 = "ecdh-sha2-nistp521"
- kexAlgoCurve25519SHA256 = "curve25519-sha256@libssh.org"
-)
-
-// kexResult captures the outcome of a key exchange.
-type kexResult struct {
- // Session hash. See also RFC 4253, section 8.
- H []byte
-
- // Shared secret. See also RFC 4253, section 8.
- K []byte
-
- // Host key as hashed into H.
- HostKey []byte
-
- // Signature of H.
- Signature []byte
-
- // A cryptographic hash function that matches the security
- // level of the key exchange algorithm. It is used for
- // calculating H, and for deriving keys from H and K.
- Hash crypto.Hash
-
- // The session ID, which is the first H computed. This is used
- // to signal data inside transport.
- SessionID []byte
-}
-
-// handshakeMagics contains data that is always included in the
-// session hash.
-type handshakeMagics struct {
- clientVersion, serverVersion []byte
- clientKexInit, serverKexInit []byte
-}
-
-func (m *handshakeMagics) write(w io.Writer) {
- writeString(w, m.clientVersion)
- writeString(w, m.serverVersion)
- writeString(w, m.clientKexInit)
- writeString(w, m.serverKexInit)
-}
-
-// kexAlgorithm abstracts different key exchange algorithms.
-type kexAlgorithm interface {
- // Server runs server-side key agreement, signing the result
- // with a hostkey.
- Server(p packetConn, rand io.Reader, magics *handshakeMagics, s Signer) (*kexResult, error)
-
- // Client runs the client-side key agreement. Caller is
- // responsible for verifying the host key signature.
- Client(p packetConn, rand io.Reader, magics *handshakeMagics) (*kexResult, error)
-}
-
-// dhGroup is a multiplicative group suitable for implementing Diffie-Hellman key agreement.
-type dhGroup struct {
- g, p *big.Int
-}
-
-func (group *dhGroup) diffieHellman(theirPublic, myPrivate *big.Int) (*big.Int, error) {
- if theirPublic.Sign() <= 0 || theirPublic.Cmp(group.p) >= 0 {
- return nil, errors.New("ssh: DH parameter out of bounds")
- }
- return new(big.Int).Exp(theirPublic, myPrivate, group.p), nil
-}
-
-func (group *dhGroup) Client(c packetConn, randSource io.Reader, magics *handshakeMagics) (*kexResult, error) {
- hashFunc := crypto.SHA1
-
- x, err := rand.Int(randSource, group.p)
- if err != nil {
- return nil, err
- }
- X := new(big.Int).Exp(group.g, x, group.p)
- kexDHInit := kexDHInitMsg{
- X: X,
- }
- if err := c.writePacket(Marshal(&kexDHInit)); err != nil {
- return nil, err
- }
-
- packet, err := c.readPacket()
- if err != nil {
- return nil, err
- }
-
- var kexDHReply kexDHReplyMsg
- if err = Unmarshal(packet, &kexDHReply); err != nil {
- return nil, err
- }
-
- kInt, err := group.diffieHellman(kexDHReply.Y, x)
- if err != nil {
- return nil, err
- }
-
- h := hashFunc.New()
- magics.write(h)
- writeString(h, kexDHReply.HostKey)
- writeInt(h, X)
- writeInt(h, kexDHReply.Y)
- K := make([]byte, intLength(kInt))
- marshalInt(K, kInt)
- h.Write(K)
-
- return &kexResult{
- H: h.Sum(nil),
- K: K,
- HostKey: kexDHReply.HostKey,
- Signature: kexDHReply.Signature,
- Hash: crypto.SHA1,
- }, nil
-}
-
-func (group *dhGroup) Server(c packetConn, randSource io.Reader, magics *handshakeMagics, priv Signer) (result *kexResult, err error) {
- hashFunc := crypto.SHA1
- packet, err := c.readPacket()
- if err != nil {
- return
- }
- var kexDHInit kexDHInitMsg
- if err = Unmarshal(packet, &kexDHInit); err != nil {
- return
- }
-
- y, err := rand.Int(randSource, group.p)
- if err != nil {
- return
- }
-
- Y := new(big.Int).Exp(group.g, y, group.p)
- kInt, err := group.diffieHellman(kexDHInit.X, y)
- if err != nil {
- return nil, err
- }
-
- hostKeyBytes := priv.PublicKey().Marshal()
-
- h := hashFunc.New()
- magics.write(h)
- writeString(h, hostKeyBytes)
- writeInt(h, kexDHInit.X)
- writeInt(h, Y)
-
- K := make([]byte, intLength(kInt))
- marshalInt(K, kInt)
- h.Write(K)
-
- H := h.Sum(nil)
-
- // H is already a hash, but the hostkey signing will apply its
- // own key-specific hash algorithm.
- sig, err := signAndMarshal(priv, randSource, H)
- if err != nil {
- return nil, err
- }
-
- kexDHReply := kexDHReplyMsg{
- HostKey: hostKeyBytes,
- Y: Y,
- Signature: sig,
- }
- packet = Marshal(&kexDHReply)
-
- err = c.writePacket(packet)
- return &kexResult{
- H: H,
- K: K,
- HostKey: hostKeyBytes,
- Signature: sig,
- Hash: crypto.SHA1,
- }, nil
-}
-
-// ecdh performs Elliptic Curve Diffie-Hellman key exchange as
-// described in RFC 5656, section 4.
-type ecdh struct {
- curve elliptic.Curve
-}
-
-func (kex *ecdh) Client(c packetConn, rand io.Reader, magics *handshakeMagics) (*kexResult, error) {
- ephKey, err := ecdsa.GenerateKey(kex.curve, rand)
- if err != nil {
- return nil, err
- }
-
- kexInit := kexECDHInitMsg{
- ClientPubKey: elliptic.Marshal(kex.curve, ephKey.PublicKey.X, ephKey.PublicKey.Y),
- }
-
- serialized := Marshal(&kexInit)
- if err := c.writePacket(serialized); err != nil {
- return nil, err
- }
-
- packet, err := c.readPacket()
- if err != nil {
- return nil, err
- }
-
- var reply kexECDHReplyMsg
- if err = Unmarshal(packet, &reply); err != nil {
- return nil, err
- }
-
- x, y, err := unmarshalECKey(kex.curve, reply.EphemeralPubKey)
- if err != nil {
- return nil, err
- }
-
- // generate shared secret
- secret, _ := kex.curve.ScalarMult(x, y, ephKey.D.Bytes())
-
- h := ecHash(kex.curve).New()
- magics.write(h)
- writeString(h, reply.HostKey)
- writeString(h, kexInit.ClientPubKey)
- writeString(h, reply.EphemeralPubKey)
- K := make([]byte, intLength(secret))
- marshalInt(K, secret)
- h.Write(K)
-
- return &kexResult{
- H: h.Sum(nil),
- K: K,
- HostKey: reply.HostKey,
- Signature: reply.Signature,
- Hash: ecHash(kex.curve),
- }, nil
-}
-
-// unmarshalECKey parses and checks an EC key.
-func unmarshalECKey(curve elliptic.Curve, pubkey []byte) (x, y *big.Int, err error) {
- x, y = elliptic.Unmarshal(curve, pubkey)
- if x == nil {
- return nil, nil, errors.New("ssh: elliptic.Unmarshal failure")
- }
- if !validateECPublicKey(curve, x, y) {
- return nil, nil, errors.New("ssh: public key not on curve")
- }
- return x, y, nil
-}
-
-// validateECPublicKey checks that the point is a valid public key for
-// the given curve. See [SEC1], 3.2.2
-func validateECPublicKey(curve elliptic.Curve, x, y *big.Int) bool {
- if x.Sign() == 0 && y.Sign() == 0 {
- return false
- }
-
- if x.Cmp(curve.Params().P) >= 0 {
- return false
- }
-
- if y.Cmp(curve.Params().P) >= 0 {
- return false
- }
-
- if !curve.IsOnCurve(x, y) {
- return false
- }
-
- // We don't check if N * PubKey == 0, since
- //
- // - the NIST curves have cofactor = 1, so this is implicit.
- // (We don't foresee an implementation that supports non NIST
- // curves)
- //
- // - for ephemeral keys, we don't need to worry about small
- // subgroup attacks.
- return true
-}
-
-func (kex *ecdh) Server(c packetConn, rand io.Reader, magics *handshakeMagics, priv Signer) (result *kexResult, err error) {
- packet, err := c.readPacket()
- if err != nil {
- return nil, err
- }
-
- var kexECDHInit kexECDHInitMsg
- if err = Unmarshal(packet, &kexECDHInit); err != nil {
- return nil, err
- }
-
- clientX, clientY, err := unmarshalECKey(kex.curve, kexECDHInit.ClientPubKey)
- if err != nil {
- return nil, err
- }
-
- // We could cache this key across multiple users/multiple
- // connection attempts, but the benefit is small. OpenSSH
- // generates a new key for each incoming connection.
- ephKey, err := ecdsa.GenerateKey(kex.curve, rand)
- if err != nil {
- return nil, err
- }
-
- hostKeyBytes := priv.PublicKey().Marshal()
-
- serializedEphKey := elliptic.Marshal(kex.curve, ephKey.PublicKey.X, ephKey.PublicKey.Y)
-
- // generate shared secret
- secret, _ := kex.curve.ScalarMult(clientX, clientY, ephKey.D.Bytes())
-
- h := ecHash(kex.curve).New()
- magics.write(h)
- writeString(h, hostKeyBytes)
- writeString(h, kexECDHInit.ClientPubKey)
- writeString(h, serializedEphKey)
-
- K := make([]byte, intLength(secret))
- marshalInt(K, secret)
- h.Write(K)
-
- H := h.Sum(nil)
-
- // H is already a hash, but the hostkey signing will apply its
- // own key-specific hash algorithm.
- sig, err := signAndMarshal(priv, rand, H)
- if err != nil {
- return nil, err
- }
-
- reply := kexECDHReplyMsg{
- EphemeralPubKey: serializedEphKey,
- HostKey: hostKeyBytes,
- Signature: sig,
- }
-
- serialized := Marshal(&reply)
- if err := c.writePacket(serialized); err != nil {
- return nil, err
- }
-
- return &kexResult{
- H: H,
- K: K,
- HostKey: reply.HostKey,
- Signature: sig,
- Hash: ecHash(kex.curve),
- }, nil
-}
-
-var kexAlgoMap = map[string]kexAlgorithm{}
-
-func init() {
- // This is the group called diffie-hellman-group1-sha1 in RFC
- // 4253 and Oakley Group 2 in RFC 2409.
- p, _ := new(big.Int).SetString("FFFFFFFFFFFFFFFFC90FDAA22168C234C4C6628B80DC1CD129024E088A67CC74020BBEA63B139B22514A08798E3404DDEF9519B3CD3A431B302B0A6DF25F14374FE1356D6D51C245E485B576625E7EC6F44C42E9A637ED6B0BFF5CB6F406B7EDEE386BFB5A899FA5AE9F24117C4B1FE649286651ECE65381FFFFFFFFFFFFFFFF", 16)
- kexAlgoMap[kexAlgoDH1SHA1] = &dhGroup{
- g: new(big.Int).SetInt64(2),
- p: p,
- }
-
- // This is the group called diffie-hellman-group14-sha1 in RFC
- // 4253 and Oakley Group 14 in RFC 3526.
- p, _ = new(big.Int).SetString("FFFFFFFFFFFFFFFFC90FDAA22168C234C4C6628B80DC1CD129024E088A67CC74020BBEA63B139B22514A08798E3404DDEF9519B3CD3A431B302B0A6DF25F14374FE1356D6D51C245E485B576625E7EC6F44C42E9A637ED6B0BFF5CB6F406B7EDEE386BFB5A899FA5AE9F24117C4B1FE649286651ECE45B3DC2007CB8A163BF0598DA48361C55D39A69163FA8FD24CF5F83655D23DCA3AD961C62F356208552BB9ED529077096966D670C354E4ABC9804F1746C08CA18217C32905E462E36CE3BE39E772C180E86039B2783A2EC07A28FB5C55DF06F4C52C9DE2BCBF6955817183995497CEA956AE515D2261898FA051015728E5A8AACAA68FFFFFFFFFFFFFFFF", 16)
-
- kexAlgoMap[kexAlgoDH14SHA1] = &dhGroup{
- g: new(big.Int).SetInt64(2),
- p: p,
- }
-
- kexAlgoMap[kexAlgoECDH521] = &ecdh{elliptic.P521()}
- kexAlgoMap[kexAlgoECDH384] = &ecdh{elliptic.P384()}
- kexAlgoMap[kexAlgoECDH256] = &ecdh{elliptic.P256()}
- kexAlgoMap[kexAlgoCurve25519SHA256] = &curve25519sha256{}
-}
-
-// curve25519sha256 implements the curve25519-sha256@libssh.org key
-// agreement protocol, as described in
-// https://git.libssh.org/projects/libssh.git/tree/doc/curve25519-sha256@libssh.org.txt
-type curve25519sha256 struct{}
-
-type curve25519KeyPair struct {
- priv [32]byte
- pub [32]byte
-}
-
-func (kp *curve25519KeyPair) generate(rand io.Reader) error {
- if _, err := io.ReadFull(rand, kp.priv[:]); err != nil {
- return err
- }
- curve25519.ScalarBaseMult(&kp.pub, &kp.priv)
- return nil
-}
-
-// curve25519Zeros is just an array of 32 zero bytes so that we have something
-// convenient to compare against in order to reject curve25519 points with the
-// wrong order.
-var curve25519Zeros [32]byte
-
-func (kex *curve25519sha256) Client(c packetConn, rand io.Reader, magics *handshakeMagics) (*kexResult, error) {
- var kp curve25519KeyPair
- if err := kp.generate(rand); err != nil {
- return nil, err
- }
- if err := c.writePacket(Marshal(&kexECDHInitMsg{kp.pub[:]})); err != nil {
- return nil, err
- }
-
- packet, err := c.readPacket()
- if err != nil {
- return nil, err
- }
-
- var reply kexECDHReplyMsg
- if err = Unmarshal(packet, &reply); err != nil {
- return nil, err
- }
- if len(reply.EphemeralPubKey) != 32 {
- return nil, errors.New("ssh: peer's curve25519 public value has wrong length")
- }
-
- var servPub, secret [32]byte
- copy(servPub[:], reply.EphemeralPubKey)
- curve25519.ScalarMult(&secret, &kp.priv, &servPub)
- if subtle.ConstantTimeCompare(secret[:], curve25519Zeros[:]) == 1 {
- return nil, errors.New("ssh: peer's curve25519 public value has wrong order")
- }
-
- h := crypto.SHA256.New()
- magics.write(h)
- writeString(h, reply.HostKey)
- writeString(h, kp.pub[:])
- writeString(h, reply.EphemeralPubKey)
-
- kInt := new(big.Int).SetBytes(secret[:])
- K := make([]byte, intLength(kInt))
- marshalInt(K, kInt)
- h.Write(K)
-
- return &kexResult{
- H: h.Sum(nil),
- K: K,
- HostKey: reply.HostKey,
- Signature: reply.Signature,
- Hash: crypto.SHA256,
- }, nil
-}
-
-func (kex *curve25519sha256) Server(c packetConn, rand io.Reader, magics *handshakeMagics, priv Signer) (result *kexResult, err error) {
- packet, err := c.readPacket()
- if err != nil {
- return
- }
- var kexInit kexECDHInitMsg
- if err = Unmarshal(packet, &kexInit); err != nil {
- return
- }
-
- if len(kexInit.ClientPubKey) != 32 {
- return nil, errors.New("ssh: peer's curve25519 public value has wrong length")
- }
-
- var kp curve25519KeyPair
- if err := kp.generate(rand); err != nil {
- return nil, err
- }
-
- var clientPub, secret [32]byte
- copy(clientPub[:], kexInit.ClientPubKey)
- curve25519.ScalarMult(&secret, &kp.priv, &clientPub)
- if subtle.ConstantTimeCompare(secret[:], curve25519Zeros[:]) == 1 {
- return nil, errors.New("ssh: peer's curve25519 public value has wrong order")
- }
-
- hostKeyBytes := priv.PublicKey().Marshal()
-
- h := crypto.SHA256.New()
- magics.write(h)
- writeString(h, hostKeyBytes)
- writeString(h, kexInit.ClientPubKey)
- writeString(h, kp.pub[:])
-
- kInt := new(big.Int).SetBytes(secret[:])
- K := make([]byte, intLength(kInt))
- marshalInt(K, kInt)
- h.Write(K)
-
- H := h.Sum(nil)
-
- sig, err := signAndMarshal(priv, rand, H)
- if err != nil {
- return nil, err
- }
-
- reply := kexECDHReplyMsg{
- EphemeralPubKey: kp.pub[:],
- HostKey: hostKeyBytes,
- Signature: sig,
- }
- if err := c.writePacket(Marshal(&reply)); err != nil {
- return nil, err
- }
- return &kexResult{
- H: H,
- K: K,
- HostKey: hostKeyBytes,
- Signature: sig,
- Hash: crypto.SHA256,
- }, nil
-}
diff --git a/vendor/golang.org/x/crypto/ssh/keys.go b/vendor/golang.org/x/crypto/ssh/keys.go
deleted file mode 100644
index cfc970b2..00000000
--- a/vendor/golang.org/x/crypto/ssh/keys.go
+++ /dev/null
@@ -1,720 +0,0 @@
-// Copyright 2012 The Go Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style
-// license that can be found in the LICENSE file.
-
-package ssh
-
-import (
- "bytes"
- "crypto"
- "crypto/dsa"
- "crypto/ecdsa"
- "crypto/elliptic"
- "crypto/rsa"
- "crypto/x509"
- "encoding/asn1"
- "encoding/base64"
- "encoding/pem"
- "errors"
- "fmt"
- "io"
- "math/big"
- "strings"
-)
-
-// These constants represent the algorithm names for key types supported by this
-// package.
-const (
- KeyAlgoRSA = "ssh-rsa"
- KeyAlgoDSA = "ssh-dss"
- KeyAlgoECDSA256 = "ecdsa-sha2-nistp256"
- KeyAlgoECDSA384 = "ecdsa-sha2-nistp384"
- KeyAlgoECDSA521 = "ecdsa-sha2-nistp521"
-)
-
-// parsePubKey parses a public key of the given algorithm.
-// Use ParsePublicKey for keys with prepended algorithm.
-func parsePubKey(in []byte, algo string) (pubKey PublicKey, rest []byte, err error) {
- switch algo {
- case KeyAlgoRSA:
- return parseRSA(in)
- case KeyAlgoDSA:
- return parseDSA(in)
- case KeyAlgoECDSA256, KeyAlgoECDSA384, KeyAlgoECDSA521:
- return parseECDSA(in)
- case CertAlgoRSAv01, CertAlgoDSAv01, CertAlgoECDSA256v01, CertAlgoECDSA384v01, CertAlgoECDSA521v01:
- cert, err := parseCert(in, certToPrivAlgo(algo))
- if err != nil {
- return nil, nil, err
- }
- return cert, nil, nil
- }
- return nil, nil, fmt.Errorf("ssh: unknown key algorithm: %v", err)
-}
-
-// parseAuthorizedKey parses a public key in OpenSSH authorized_keys format
-// (see sshd(8) manual page) once the options and key type fields have been
-// removed.
-func parseAuthorizedKey(in []byte) (out PublicKey, comment string, err error) {
- in = bytes.TrimSpace(in)
-
- i := bytes.IndexAny(in, " \t")
- if i == -1 {
- i = len(in)
- }
- base64Key := in[:i]
-
- key := make([]byte, base64.StdEncoding.DecodedLen(len(base64Key)))
- n, err := base64.StdEncoding.Decode(key, base64Key)
- if err != nil {
- return nil, "", err
- }
- key = key[:n]
- out, err = ParsePublicKey(key)
- if err != nil {
- return nil, "", err
- }
- comment = string(bytes.TrimSpace(in[i:]))
- return out, comment, nil
-}
-
-// ParseKnownHosts parses an entry in the format of the known_hosts file.
-//
-// The known_hosts format is documented in the sshd(8) manual page. This
-// function will parse a single entry from in. On successful return, marker
-// will contain the optional marker value (i.e. "cert-authority" or "revoked")
-// or else be empty, hosts will contain the hosts that this entry matches,
-// pubKey will contain the public key and comment will contain any trailing
-// comment at the end of the line. See the sshd(8) manual page for the various
-// forms that a host string can take.
-//
-// The unparsed remainder of the input will be returned in rest. This function
-// can be called repeatedly to parse multiple entries.
-//
-// If no entries were found in the input then err will be io.EOF. Otherwise a
-// non-nil err value indicates a parse error.
-func ParseKnownHosts(in []byte) (marker string, hosts []string, pubKey PublicKey, comment string, rest []byte, err error) {
- for len(in) > 0 {
- end := bytes.IndexByte(in, '\n')
- if end != -1 {
- rest = in[end+1:]
- in = in[:end]
- } else {
- rest = nil
- }
-
- end = bytes.IndexByte(in, '\r')
- if end != -1 {
- in = in[:end]
- }
-
- in = bytes.TrimSpace(in)
- if len(in) == 0 || in[0] == '#' {
- in = rest
- continue
- }
-
- i := bytes.IndexAny(in, " \t")
- if i == -1 {
- in = rest
- continue
- }
-
- // Strip out the begining of the known_host key.
- // This is either an optional marker or a (set of) hostname(s).
- keyFields := bytes.Fields(in)
- if len(keyFields) < 3 || len(keyFields) > 5 {
- return "", nil, nil, "", nil, errors.New("ssh: invalid entry in known_hosts data")
- }
-
- // keyFields[0] is either "@cert-authority", "@revoked" or a comma separated
- // list of hosts
- marker := ""
- if keyFields[0][0] == '@' {
- marker = string(keyFields[0][1:])
- keyFields = keyFields[1:]
- }
-
- hosts := string(keyFields[0])
- // keyFields[1] contains the key type (e.g. “ssh-rsa”).
- // However, that information is duplicated inside the
- // base64-encoded key and so is ignored here.
-
- key := bytes.Join(keyFields[2:], []byte(" "))
- if pubKey, comment, err = parseAuthorizedKey(key); err != nil {
- return "", nil, nil, "", nil, err
- }
-
- return marker, strings.Split(hosts, ","), pubKey, comment, rest, nil
- }
-
- return "", nil, nil, "", nil, io.EOF
-}
-
-// ParseAuthorizedKeys parses a public key from an authorized_keys
-// file used in OpenSSH according to the sshd(8) manual page.
-func ParseAuthorizedKey(in []byte) (out PublicKey, comment string, options []string, rest []byte, err error) {
- for len(in) > 0 {
- end := bytes.IndexByte(in, '\n')
- if end != -1 {
- rest = in[end+1:]
- in = in[:end]
- } else {
- rest = nil
- }
-
- end = bytes.IndexByte(in, '\r')
- if end != -1 {
- in = in[:end]
- }
-
- in = bytes.TrimSpace(in)
- if len(in) == 0 || in[0] == '#' {
- in = rest
- continue
- }
-
- i := bytes.IndexAny(in, " \t")
- if i == -1 {
- in = rest
- continue
- }
-
- if out, comment, err = parseAuthorizedKey(in[i:]); err == nil {
- return out, comment, options, rest, nil
- }
-
- // No key type recognised. Maybe there's an options field at
- // the beginning.
- var b byte
- inQuote := false
- var candidateOptions []string
- optionStart := 0
- for i, b = range in {
- isEnd := !inQuote && (b == ' ' || b == '\t')
- if (b == ',' && !inQuote) || isEnd {
- if i-optionStart > 0 {
- candidateOptions = append(candidateOptions, string(in[optionStart:i]))
- }
- optionStart = i + 1
- }
- if isEnd {
- break
- }
- if b == '"' && (i == 0 || (i > 0 && in[i-1] != '\\')) {
- inQuote = !inQuote
- }
- }
- for i < len(in) && (in[i] == ' ' || in[i] == '\t') {
- i++
- }
- if i == len(in) {
- // Invalid line: unmatched quote
- in = rest
- continue
- }
-
- in = in[i:]
- i = bytes.IndexAny(in, " \t")
- if i == -1 {
- in = rest
- continue
- }
-
- if out, comment, err = parseAuthorizedKey(in[i:]); err == nil {
- options = candidateOptions
- return out, comment, options, rest, nil
- }
-
- in = rest
- continue
- }
-
- return nil, "", nil, nil, errors.New("ssh: no key found")
-}
-
-// ParsePublicKey parses an SSH public key formatted for use in
-// the SSH wire protocol according to RFC 4253, section 6.6.
-func ParsePublicKey(in []byte) (out PublicKey, err error) {
- algo, in, ok := parseString(in)
- if !ok {
- return nil, errShortRead
- }
- var rest []byte
- out, rest, err = parsePubKey(in, string(algo))
- if len(rest) > 0 {
- return nil, errors.New("ssh: trailing junk in public key")
- }
-
- return out, err
-}
-
-// MarshalAuthorizedKey serializes key for inclusion in an OpenSSH
-// authorized_keys file. The return value ends with newline.
-func MarshalAuthorizedKey(key PublicKey) []byte {
- b := &bytes.Buffer{}
- b.WriteString(key.Type())
- b.WriteByte(' ')
- e := base64.NewEncoder(base64.StdEncoding, b)
- e.Write(key.Marshal())
- e.Close()
- b.WriteByte('\n')
- return b.Bytes()
-}
-
-// PublicKey is an abstraction of different types of public keys.
-type PublicKey interface {
- // Type returns the key's type, e.g. "ssh-rsa".
- Type() string
-
- // Marshal returns the serialized key data in SSH wire format,
- // with the name prefix.
- Marshal() []byte
-
- // Verify that sig is a signature on the given data using this
- // key. This function will hash the data appropriately first.
- Verify(data []byte, sig *Signature) error
-}
-
-// A Signer can create signatures that verify against a public key.
-type Signer interface {
- // PublicKey returns an associated PublicKey instance.
- PublicKey() PublicKey
-
- // Sign returns raw signature for the given data. This method
- // will apply the hash specified for the keytype to the data.
- Sign(rand io.Reader, data []byte) (*Signature, error)
-}
-
-type rsaPublicKey rsa.PublicKey
-
-func (r *rsaPublicKey) Type() string {
- return "ssh-rsa"
-}
-
-// parseRSA parses an RSA key according to RFC 4253, section 6.6.
-func parseRSA(in []byte) (out PublicKey, rest []byte, err error) {
- var w struct {
- E *big.Int
- N *big.Int
- Rest []byte `ssh:"rest"`
- }
- if err := Unmarshal(in, &w); err != nil {
- return nil, nil, err
- }
-
- if w.E.BitLen() > 24 {
- return nil, nil, errors.New("ssh: exponent too large")
- }
- e := w.E.Int64()
- if e < 3 || e&1 == 0 {
- return nil, nil, errors.New("ssh: incorrect exponent")
- }
-
- var key rsa.PublicKey
- key.E = int(e)
- key.N = w.N
- return (*rsaPublicKey)(&key), w.Rest, nil
-}
-
-func (r *rsaPublicKey) Marshal() []byte {
- e := new(big.Int).SetInt64(int64(r.E))
- wirekey := struct {
- Name string
- E *big.Int
- N *big.Int
- }{
- KeyAlgoRSA,
- e,
- r.N,
- }
- return Marshal(&wirekey)
-}
-
-func (r *rsaPublicKey) Verify(data []byte, sig *Signature) error {
- if sig.Format != r.Type() {
- return fmt.Errorf("ssh: signature type %s for key type %s", sig.Format, r.Type())
- }
- h := crypto.SHA1.New()
- h.Write(data)
- digest := h.Sum(nil)
- return rsa.VerifyPKCS1v15((*rsa.PublicKey)(r), crypto.SHA1, digest, sig.Blob)
-}
-
-type dsaPublicKey dsa.PublicKey
-
-func (r *dsaPublicKey) Type() string {
- return "ssh-dss"
-}
-
-// parseDSA parses an DSA key according to RFC 4253, section 6.6.
-func parseDSA(in []byte) (out PublicKey, rest []byte, err error) {
- var w struct {
- P, Q, G, Y *big.Int
- Rest []byte `ssh:"rest"`
- }
- if err := Unmarshal(in, &w); err != nil {
- return nil, nil, err
- }
-
- key := &dsaPublicKey{
- Parameters: dsa.Parameters{
- P: w.P,
- Q: w.Q,
- G: w.G,
- },
- Y: w.Y,
- }
- return key, w.Rest, nil
-}
-
-func (k *dsaPublicKey) Marshal() []byte {
- w := struct {
- Name string
- P, Q, G, Y *big.Int
- }{
- k.Type(),
- k.P,
- k.Q,
- k.G,
- k.Y,
- }
-
- return Marshal(&w)
-}
-
-func (k *dsaPublicKey) Verify(data []byte, sig *Signature) error {
- if sig.Format != k.Type() {
- return fmt.Errorf("ssh: signature type %s for key type %s", sig.Format, k.Type())
- }
- h := crypto.SHA1.New()
- h.Write(data)
- digest := h.Sum(nil)
-
- // Per RFC 4253, section 6.6,
- // The value for 'dss_signature_blob' is encoded as a string containing
- // r, followed by s (which are 160-bit integers, without lengths or
- // padding, unsigned, and in network byte order).
- // For DSS purposes, sig.Blob should be exactly 40 bytes in length.
- if len(sig.Blob) != 40 {
- return errors.New("ssh: DSA signature parse error")
- }
- r := new(big.Int).SetBytes(sig.Blob[:20])
- s := new(big.Int).SetBytes(sig.Blob[20:])
- if dsa.Verify((*dsa.PublicKey)(k), digest, r, s) {
- return nil
- }
- return errors.New("ssh: signature did not verify")
-}
-
-type dsaPrivateKey struct {
- *dsa.PrivateKey
-}
-
-func (k *dsaPrivateKey) PublicKey() PublicKey {
- return (*dsaPublicKey)(&k.PrivateKey.PublicKey)
-}
-
-func (k *dsaPrivateKey) Sign(rand io.Reader, data []byte) (*Signature, error) {
- h := crypto.SHA1.New()
- h.Write(data)
- digest := h.Sum(nil)
- r, s, err := dsa.Sign(rand, k.PrivateKey, digest)
- if err != nil {
- return nil, err
- }
-
- sig := make([]byte, 40)
- rb := r.Bytes()
- sb := s.Bytes()
-
- copy(sig[20-len(rb):20], rb)
- copy(sig[40-len(sb):], sb)
-
- return &Signature{
- Format: k.PublicKey().Type(),
- Blob: sig,
- }, nil
-}
-
-type ecdsaPublicKey ecdsa.PublicKey
-
-func (key *ecdsaPublicKey) Type() string {
- return "ecdsa-sha2-" + key.nistID()
-}
-
-func (key *ecdsaPublicKey) nistID() string {
- switch key.Params().BitSize {
- case 256:
- return "nistp256"
- case 384:
- return "nistp384"
- case 521:
- return "nistp521"
- }
- panic("ssh: unsupported ecdsa key size")
-}
-
-func supportedEllipticCurve(curve elliptic.Curve) bool {
- return curve == elliptic.P256() || curve == elliptic.P384() || curve == elliptic.P521()
-}
-
-// ecHash returns the hash to match the given elliptic curve, see RFC
-// 5656, section 6.2.1
-func ecHash(curve elliptic.Curve) crypto.Hash {
- bitSize := curve.Params().BitSize
- switch {
- case bitSize <= 256:
- return crypto.SHA256
- case bitSize <= 384:
- return crypto.SHA384
- }
- return crypto.SHA512
-}
-
-// parseECDSA parses an ECDSA key according to RFC 5656, section 3.1.
-func parseECDSA(in []byte) (out PublicKey, rest []byte, err error) {
- var w struct {
- Curve string
- KeyBytes []byte
- Rest []byte `ssh:"rest"`
- }
-
- if err := Unmarshal(in, &w); err != nil {
- return nil, nil, err
- }
-
- key := new(ecdsa.PublicKey)
-
- switch w.Curve {
- case "nistp256":
- key.Curve = elliptic.P256()
- case "nistp384":
- key.Curve = elliptic.P384()
- case "nistp521":
- key.Curve = elliptic.P521()
- default:
- return nil, nil, errors.New("ssh: unsupported curve")
- }
-
- key.X, key.Y = elliptic.Unmarshal(key.Curve, w.KeyBytes)
- if key.X == nil || key.Y == nil {
- return nil, nil, errors.New("ssh: invalid curve point")
- }
- return (*ecdsaPublicKey)(key), w.Rest, nil
-}
-
-func (key *ecdsaPublicKey) Marshal() []byte {
- // See RFC 5656, section 3.1.
- keyBytes := elliptic.Marshal(key.Curve, key.X, key.Y)
- w := struct {
- Name string
- ID string
- Key []byte
- }{
- key.Type(),
- key.nistID(),
- keyBytes,
- }
-
- return Marshal(&w)
-}
-
-func (key *ecdsaPublicKey) Verify(data []byte, sig *Signature) error {
- if sig.Format != key.Type() {
- return fmt.Errorf("ssh: signature type %s for key type %s", sig.Format, key.Type())
- }
-
- h := ecHash(key.Curve).New()
- h.Write(data)
- digest := h.Sum(nil)
-
- // Per RFC 5656, section 3.1.2,
- // The ecdsa_signature_blob value has the following specific encoding:
- // mpint r
- // mpint s
- var ecSig struct {
- R *big.Int
- S *big.Int
- }
-
- if err := Unmarshal(sig.Blob, &ecSig); err != nil {
- return err
- }
-
- if ecdsa.Verify((*ecdsa.PublicKey)(key), digest, ecSig.R, ecSig.S) {
- return nil
- }
- return errors.New("ssh: signature did not verify")
-}
-
-// NewSignerFromKey takes an *rsa.PrivateKey, *dsa.PrivateKey,
-// *ecdsa.PrivateKey or any other crypto.Signer and returns a corresponding
-// Signer instance. ECDSA keys must use P-256, P-384 or P-521.
-func NewSignerFromKey(key interface{}) (Signer, error) {
- switch key := key.(type) {
- case crypto.Signer:
- return NewSignerFromSigner(key)
- case *dsa.PrivateKey:
- return &dsaPrivateKey{key}, nil
- default:
- return nil, fmt.Errorf("ssh: unsupported key type %T", key)
- }
-}
-
-type wrappedSigner struct {
- signer crypto.Signer
- pubKey PublicKey
-}
-
-// NewSignerFromSigner takes any crypto.Signer implementation and
-// returns a corresponding Signer interface. This can be used, for
-// example, with keys kept in hardware modules.
-func NewSignerFromSigner(signer crypto.Signer) (Signer, error) {
- pubKey, err := NewPublicKey(signer.Public())
- if err != nil {
- return nil, err
- }
-
- return &wrappedSigner{signer, pubKey}, nil
-}
-
-func (s *wrappedSigner) PublicKey() PublicKey {
- return s.pubKey
-}
-
-func (s *wrappedSigner) Sign(rand io.Reader, data []byte) (*Signature, error) {
- var hashFunc crypto.Hash
-
- switch key := s.pubKey.(type) {
- case *rsaPublicKey, *dsaPublicKey:
- hashFunc = crypto.SHA1
- case *ecdsaPublicKey:
- hashFunc = ecHash(key.Curve)
- default:
- return nil, fmt.Errorf("ssh: unsupported key type %T", key)
- }
-
- h := hashFunc.New()
- h.Write(data)
- digest := h.Sum(nil)
-
- signature, err := s.signer.Sign(rand, digest, hashFunc)
- if err != nil {
- return nil, err
- }
-
- // crypto.Signer.Sign is expected to return an ASN.1-encoded signature
- // for ECDSA and DSA, but that's not the encoding expected by SSH, so
- // re-encode.
- switch s.pubKey.(type) {
- case *ecdsaPublicKey, *dsaPublicKey:
- type asn1Signature struct {
- R, S *big.Int
- }
- asn1Sig := new(asn1Signature)
- _, err := asn1.Unmarshal(signature, asn1Sig)
- if err != nil {
- return nil, err
- }
-
- switch s.pubKey.(type) {
- case *ecdsaPublicKey:
- signature = Marshal(asn1Sig)
-
- case *dsaPublicKey:
- signature = make([]byte, 40)
- r := asn1Sig.R.Bytes()
- s := asn1Sig.S.Bytes()
- copy(signature[20-len(r):20], r)
- copy(signature[40-len(s):40], s)
- }
- }
-
- return &Signature{
- Format: s.pubKey.Type(),
- Blob: signature,
- }, nil
-}
-
-// NewPublicKey takes an *rsa.PublicKey, *dsa.PublicKey, *ecdsa.PublicKey or
-// any other crypto.Signer and returns a corresponding Signer instance. ECDSA
-// keys must use P-256, P-384 or P-521.
-func NewPublicKey(key interface{}) (PublicKey, error) {
- switch key := key.(type) {
- case *rsa.PublicKey:
- return (*rsaPublicKey)(key), nil
- case *ecdsa.PublicKey:
- if !supportedEllipticCurve(key.Curve) {
- return nil, errors.New("ssh: only P-256, P-384 and P-521 EC keys are supported.")
- }
- return (*ecdsaPublicKey)(key), nil
- case *dsa.PublicKey:
- return (*dsaPublicKey)(key), nil
- default:
- return nil, fmt.Errorf("ssh: unsupported key type %T", key)
- }
-}
-
-// ParsePrivateKey returns a Signer from a PEM encoded private key. It supports
-// the same keys as ParseRawPrivateKey.
-func ParsePrivateKey(pemBytes []byte) (Signer, error) {
- key, err := ParseRawPrivateKey(pemBytes)
- if err != nil {
- return nil, err
- }
-
- return NewSignerFromKey(key)
-}
-
-// ParseRawPrivateKey returns a private key from a PEM encoded private key. It
-// supports RSA (PKCS#1), DSA (OpenSSL), and ECDSA private keys.
-func ParseRawPrivateKey(pemBytes []byte) (interface{}, error) {
- block, _ := pem.Decode(pemBytes)
- if block == nil {
- return nil, errors.New("ssh: no key found")
- }
-
- switch block.Type {
- case "RSA PRIVATE KEY":
- return x509.ParsePKCS1PrivateKey(block.Bytes)
- case "EC PRIVATE KEY":
- return x509.ParseECPrivateKey(block.Bytes)
- case "DSA PRIVATE KEY":
- return ParseDSAPrivateKey(block.Bytes)
- default:
- return nil, fmt.Errorf("ssh: unsupported key type %q", block.Type)
- }
-}
-
-// ParseDSAPrivateKey returns a DSA private key from its ASN.1 DER encoding, as
-// specified by the OpenSSL DSA man page.
-func ParseDSAPrivateKey(der []byte) (*dsa.PrivateKey, error) {
- var k struct {
- Version int
- P *big.Int
- Q *big.Int
- G *big.Int
- Priv *big.Int
- Pub *big.Int
- }
- rest, err := asn1.Unmarshal(der, &k)
- if err != nil {
- return nil, errors.New("ssh: failed to parse DSA key: " + err.Error())
- }
- if len(rest) > 0 {
- return nil, errors.New("ssh: garbage after DSA key")
- }
-
- return &dsa.PrivateKey{
- PublicKey: dsa.PublicKey{
- Parameters: dsa.Parameters{
- P: k.P,
- Q: k.Q,
- G: k.G,
- },
- Y: k.Priv,
- },
- X: k.Pub,
- }, nil
-}
diff --git a/vendor/golang.org/x/crypto/ssh/mac.go b/vendor/golang.org/x/crypto/ssh/mac.go
deleted file mode 100644
index 07744ad6..00000000
--- a/vendor/golang.org/x/crypto/ssh/mac.go
+++ /dev/null
@@ -1,57 +0,0 @@
-// Copyright 2012 The Go Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style
-// license that can be found in the LICENSE file.
-
-package ssh
-
-// Message authentication support
-
-import (
- "crypto/hmac"
- "crypto/sha1"
- "crypto/sha256"
- "hash"
-)
-
-type macMode struct {
- keySize int
- new func(key []byte) hash.Hash
-}
-
-// truncatingMAC wraps around a hash.Hash and truncates the output digest to
-// a given size.
-type truncatingMAC struct {
- length int
- hmac hash.Hash
-}
-
-func (t truncatingMAC) Write(data []byte) (int, error) {
- return t.hmac.Write(data)
-}
-
-func (t truncatingMAC) Sum(in []byte) []byte {
- out := t.hmac.Sum(in)
- return out[:len(in)+t.length]
-}
-
-func (t truncatingMAC) Reset() {
- t.hmac.Reset()
-}
-
-func (t truncatingMAC) Size() int {
- return t.length
-}
-
-func (t truncatingMAC) BlockSize() int { return t.hmac.BlockSize() }
-
-var macModes = map[string]*macMode{
- "hmac-sha2-256": {32, func(key []byte) hash.Hash {
- return hmac.New(sha256.New, key)
- }},
- "hmac-sha1": {20, func(key []byte) hash.Hash {
- return hmac.New(sha1.New, key)
- }},
- "hmac-sha1-96": {20, func(key []byte) hash.Hash {
- return truncatingMAC{12, hmac.New(sha1.New, key)}
- }},
-}
diff --git a/vendor/golang.org/x/crypto/ssh/messages.go b/vendor/golang.org/x/crypto/ssh/messages.go
deleted file mode 100644
index eaf61066..00000000
--- a/vendor/golang.org/x/crypto/ssh/messages.go
+++ /dev/null
@@ -1,725 +0,0 @@
-// Copyright 2011 The Go Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style
-// license that can be found in the LICENSE file.
-
-package ssh
-
-import (
- "bytes"
- "encoding/binary"
- "errors"
- "fmt"
- "io"
- "math/big"
- "reflect"
- "strconv"
-)
-
-// These are SSH message type numbers. They are scattered around several
-// documents but many were taken from [SSH-PARAMETERS].
-const (
- msgIgnore = 2
- msgUnimplemented = 3
- msgDebug = 4
- msgNewKeys = 21
-
- // Standard authentication messages
- msgUserAuthSuccess = 52
- msgUserAuthBanner = 53
-)
-
-// SSH messages:
-//
-// These structures mirror the wire format of the corresponding SSH messages.
-// They are marshaled using reflection with the marshal and unmarshal functions
-// in this file. The only wrinkle is that a final member of type []byte with a
-// ssh tag of "rest" receives the remainder of a packet when unmarshaling.
-
-// See RFC 4253, section 11.1.
-const msgDisconnect = 1
-
-// disconnectMsg is the message that signals a disconnect. It is also
-// the error type returned from mux.Wait()
-type disconnectMsg struct {
- Reason uint32 `sshtype:"1"`
- Message string
- Language string
-}
-
-func (d *disconnectMsg) Error() string {
- return fmt.Sprintf("ssh: disconnect reason %d: %s", d.Reason, d.Message)
-}
-
-// See RFC 4253, section 7.1.
-const msgKexInit = 20
-
-type kexInitMsg struct {
- Cookie [16]byte `sshtype:"20"`
- KexAlgos []string
- ServerHostKeyAlgos []string
- CiphersClientServer []string
- CiphersServerClient []string
- MACsClientServer []string
- MACsServerClient []string
- CompressionClientServer []string
- CompressionServerClient []string
- LanguagesClientServer []string
- LanguagesServerClient []string
- FirstKexFollows bool
- Reserved uint32
-}
-
-// See RFC 4253, section 8.
-
-// Diffie-Helman
-const msgKexDHInit = 30
-
-type kexDHInitMsg struct {
- X *big.Int `sshtype:"30"`
-}
-
-const msgKexECDHInit = 30
-
-type kexECDHInitMsg struct {
- ClientPubKey []byte `sshtype:"30"`
-}
-
-const msgKexECDHReply = 31
-
-type kexECDHReplyMsg struct {
- HostKey []byte `sshtype:"31"`
- EphemeralPubKey []byte
- Signature []byte
-}
-
-const msgKexDHReply = 31
-
-type kexDHReplyMsg struct {
- HostKey []byte `sshtype:"31"`
- Y *big.Int
- Signature []byte
-}
-
-// See RFC 4253, section 10.
-const msgServiceRequest = 5
-
-type serviceRequestMsg struct {
- Service string `sshtype:"5"`
-}
-
-// See RFC 4253, section 10.
-const msgServiceAccept = 6
-
-type serviceAcceptMsg struct {
- Service string `sshtype:"6"`
-}
-
-// See RFC 4252, section 5.
-const msgUserAuthRequest = 50
-
-type userAuthRequestMsg struct {
- User string `sshtype:"50"`
- Service string
- Method string
- Payload []byte `ssh:"rest"`
-}
-
-// See RFC 4252, section 5.1
-const msgUserAuthFailure = 51
-
-type userAuthFailureMsg struct {
- Methods []string `sshtype:"51"`
- PartialSuccess bool
-}
-
-// See RFC 4256, section 3.2
-const msgUserAuthInfoRequest = 60
-const msgUserAuthInfoResponse = 61
-
-type userAuthInfoRequestMsg struct {
- User string `sshtype:"60"`
- Instruction string
- DeprecatedLanguage string
- NumPrompts uint32
- Prompts []byte `ssh:"rest"`
-}
-
-// See RFC 4254, section 5.1.
-const msgChannelOpen = 90
-
-type channelOpenMsg struct {
- ChanType string `sshtype:"90"`
- PeersId uint32
- PeersWindow uint32
- MaxPacketSize uint32
- TypeSpecificData []byte `ssh:"rest"`
-}
-
-const msgChannelExtendedData = 95
-const msgChannelData = 94
-
-// See RFC 4254, section 5.1.
-const msgChannelOpenConfirm = 91
-
-type channelOpenConfirmMsg struct {
- PeersId uint32 `sshtype:"91"`
- MyId uint32
- MyWindow uint32
- MaxPacketSize uint32
- TypeSpecificData []byte `ssh:"rest"`
-}
-
-// See RFC 4254, section 5.1.
-const msgChannelOpenFailure = 92
-
-type channelOpenFailureMsg struct {
- PeersId uint32 `sshtype:"92"`
- Reason RejectionReason
- Message string
- Language string
-}
-
-const msgChannelRequest = 98
-
-type channelRequestMsg struct {
- PeersId uint32 `sshtype:"98"`
- Request string
- WantReply bool
- RequestSpecificData []byte `ssh:"rest"`
-}
-
-// See RFC 4254, section 5.4.
-const msgChannelSuccess = 99
-
-type channelRequestSuccessMsg struct {
- PeersId uint32 `sshtype:"99"`
-}
-
-// See RFC 4254, section 5.4.
-const msgChannelFailure = 100
-
-type channelRequestFailureMsg struct {
- PeersId uint32 `sshtype:"100"`
-}
-
-// See RFC 4254, section 5.3
-const msgChannelClose = 97
-
-type channelCloseMsg struct {
- PeersId uint32 `sshtype:"97"`
-}
-
-// See RFC 4254, section 5.3
-const msgChannelEOF = 96
-
-type channelEOFMsg struct {
- PeersId uint32 `sshtype:"96"`
-}
-
-// See RFC 4254, section 4
-const msgGlobalRequest = 80
-
-type globalRequestMsg struct {
- Type string `sshtype:"80"`
- WantReply bool
- Data []byte `ssh:"rest"`
-}
-
-// See RFC 4254, section 4
-const msgRequestSuccess = 81
-
-type globalRequestSuccessMsg struct {
- Data []byte `ssh:"rest" sshtype:"81"`
-}
-
-// See RFC 4254, section 4
-const msgRequestFailure = 82
-
-type globalRequestFailureMsg struct {
- Data []byte `ssh:"rest" sshtype:"82"`
-}
-
-// See RFC 4254, section 5.2
-const msgChannelWindowAdjust = 93
-
-type windowAdjustMsg struct {
- PeersId uint32 `sshtype:"93"`
- AdditionalBytes uint32
-}
-
-// See RFC 4252, section 7
-const msgUserAuthPubKeyOk = 60
-
-type userAuthPubKeyOkMsg struct {
- Algo string `sshtype:"60"`
- PubKey []byte
-}
-
-// typeTag returns the type byte for the given type. The type should
-// be struct.
-func typeTag(structType reflect.Type) byte {
- var tag byte
- var tagStr string
- tagStr = structType.Field(0).Tag.Get("sshtype")
- i, err := strconv.Atoi(tagStr)
- if err == nil {
- tag = byte(i)
- }
- return tag
-}
-
-func fieldError(t reflect.Type, field int, problem string) error {
- if problem != "" {
- problem = ": " + problem
- }
- return fmt.Errorf("ssh: unmarshal error for field %s of type %s%s", t.Field(field).Name, t.Name(), problem)
-}
-
-var errShortRead = errors.New("ssh: short read")
-
-// Unmarshal parses data in SSH wire format into a structure. The out
-// argument should be a pointer to struct. If the first member of the
-// struct has the "sshtype" tag set to a number in decimal, the packet
-// must start that number. In case of error, Unmarshal returns a
-// ParseError or UnexpectedMessageError.
-func Unmarshal(data []byte, out interface{}) error {
- v := reflect.ValueOf(out).Elem()
- structType := v.Type()
- expectedType := typeTag(structType)
- if len(data) == 0 {
- return parseError(expectedType)
- }
- if expectedType > 0 {
- if data[0] != expectedType {
- return unexpectedMessageError(expectedType, data[0])
- }
- data = data[1:]
- }
-
- var ok bool
- for i := 0; i < v.NumField(); i++ {
- field := v.Field(i)
- t := field.Type()
- switch t.Kind() {
- case reflect.Bool:
- if len(data) < 1 {
- return errShortRead
- }
- field.SetBool(data[0] != 0)
- data = data[1:]
- case reflect.Array:
- if t.Elem().Kind() != reflect.Uint8 {
- return fieldError(structType, i, "array of unsupported type")
- }
- if len(data) < t.Len() {
- return errShortRead
- }
- for j, n := 0, t.Len(); j < n; j++ {
- field.Index(j).Set(reflect.ValueOf(data[j]))
- }
- data = data[t.Len():]
- case reflect.Uint64:
- var u64 uint64
- if u64, data, ok = parseUint64(data); !ok {
- return errShortRead
- }
- field.SetUint(u64)
- case reflect.Uint32:
- var u32 uint32
- if u32, data, ok = parseUint32(data); !ok {
- return errShortRead
- }
- field.SetUint(uint64(u32))
- case reflect.Uint8:
- if len(data) < 1 {
- return errShortRead
- }
- field.SetUint(uint64(data[0]))
- data = data[1:]
- case reflect.String:
- var s []byte
- if s, data, ok = parseString(data); !ok {
- return fieldError(structType, i, "")
- }
- field.SetString(string(s))
- case reflect.Slice:
- switch t.Elem().Kind() {
- case reflect.Uint8:
- if structType.Field(i).Tag.Get("ssh") == "rest" {
- field.Set(reflect.ValueOf(data))
- data = nil
- } else {
- var s []byte
- if s, data, ok = parseString(data); !ok {
- return errShortRead
- }
- field.Set(reflect.ValueOf(s))
- }
- case reflect.String:
- var nl []string
- if nl, data, ok = parseNameList(data); !ok {
- return errShortRead
- }
- field.Set(reflect.ValueOf(nl))
- default:
- return fieldError(structType, i, "slice of unsupported type")
- }
- case reflect.Ptr:
- if t == bigIntType {
- var n *big.Int
- if n, data, ok = parseInt(data); !ok {
- return errShortRead
- }
- field.Set(reflect.ValueOf(n))
- } else {
- return fieldError(structType, i, "pointer to unsupported type")
- }
- default:
- return fieldError(structType, i, "unsupported type")
- }
- }
-
- if len(data) != 0 {
- return parseError(expectedType)
- }
-
- return nil
-}
-
-// Marshal serializes the message in msg to SSH wire format. The msg
-// argument should be a struct or pointer to struct. If the first
-// member has the "sshtype" tag set to a number in decimal, that
-// number is prepended to the result. If the last of member has the
-// "ssh" tag set to "rest", its contents are appended to the output.
-func Marshal(msg interface{}) []byte {
- out := make([]byte, 0, 64)
- return marshalStruct(out, msg)
-}
-
-func marshalStruct(out []byte, msg interface{}) []byte {
- v := reflect.Indirect(reflect.ValueOf(msg))
- msgType := typeTag(v.Type())
- if msgType > 0 {
- out = append(out, msgType)
- }
-
- for i, n := 0, v.NumField(); i < n; i++ {
- field := v.Field(i)
- switch t := field.Type(); t.Kind() {
- case reflect.Bool:
- var v uint8
- if field.Bool() {
- v = 1
- }
- out = append(out, v)
- case reflect.Array:
- if t.Elem().Kind() != reflect.Uint8 {
- panic(fmt.Sprintf("array of non-uint8 in field %d: %T", i, field.Interface()))
- }
- for j, l := 0, t.Len(); j < l; j++ {
- out = append(out, uint8(field.Index(j).Uint()))
- }
- case reflect.Uint32:
- out = appendU32(out, uint32(field.Uint()))
- case reflect.Uint64:
- out = appendU64(out, uint64(field.Uint()))
- case reflect.Uint8:
- out = append(out, uint8(field.Uint()))
- case reflect.String:
- s := field.String()
- out = appendInt(out, len(s))
- out = append(out, s...)
- case reflect.Slice:
- switch t.Elem().Kind() {
- case reflect.Uint8:
- if v.Type().Field(i).Tag.Get("ssh") != "rest" {
- out = appendInt(out, field.Len())
- }
- out = append(out, field.Bytes()...)
- case reflect.String:
- offset := len(out)
- out = appendU32(out, 0)
- if n := field.Len(); n > 0 {
- for j := 0; j < n; j++ {
- f := field.Index(j)
- if j != 0 {
- out = append(out, ',')
- }
- out = append(out, f.String()...)
- }
- // overwrite length value
- binary.BigEndian.PutUint32(out[offset:], uint32(len(out)-offset-4))
- }
- default:
- panic(fmt.Sprintf("slice of unknown type in field %d: %T", i, field.Interface()))
- }
- case reflect.Ptr:
- if t == bigIntType {
- var n *big.Int
- nValue := reflect.ValueOf(&n)
- nValue.Elem().Set(field)
- needed := intLength(n)
- oldLength := len(out)
-
- if cap(out)-len(out) < needed {
- newOut := make([]byte, len(out), 2*(len(out)+needed))
- copy(newOut, out)
- out = newOut
- }
- out = out[:oldLength+needed]
- marshalInt(out[oldLength:], n)
- } else {
- panic(fmt.Sprintf("pointer to unknown type in field %d: %T", i, field.Interface()))
- }
- }
- }
-
- return out
-}
-
-var bigOne = big.NewInt(1)
-
-func parseString(in []byte) (out, rest []byte, ok bool) {
- if len(in) < 4 {
- return
- }
- length := binary.BigEndian.Uint32(in)
- in = in[4:]
- if uint32(len(in)) < length {
- return
- }
- out = in[:length]
- rest = in[length:]
- ok = true
- return
-}
-
-var (
- comma = []byte{','}
- emptyNameList = []string{}
-)
-
-func parseNameList(in []byte) (out []string, rest []byte, ok bool) {
- contents, rest, ok := parseString(in)
- if !ok {
- return
- }
- if len(contents) == 0 {
- out = emptyNameList
- return
- }
- parts := bytes.Split(contents, comma)
- out = make([]string, len(parts))
- for i, part := range parts {
- out[i] = string(part)
- }
- return
-}
-
-func parseInt(in []byte) (out *big.Int, rest []byte, ok bool) {
- contents, rest, ok := parseString(in)
- if !ok {
- return
- }
- out = new(big.Int)
-
- if len(contents) > 0 && contents[0]&0x80 == 0x80 {
- // This is a negative number
- notBytes := make([]byte, len(contents))
- for i := range notBytes {
- notBytes[i] = ^contents[i]
- }
- out.SetBytes(notBytes)
- out.Add(out, bigOne)
- out.Neg(out)
- } else {
- // Positive number
- out.SetBytes(contents)
- }
- ok = true
- return
-}
-
-func parseUint32(in []byte) (uint32, []byte, bool) {
- if len(in) < 4 {
- return 0, nil, false
- }
- return binary.BigEndian.Uint32(in), in[4:], true
-}
-
-func parseUint64(in []byte) (uint64, []byte, bool) {
- if len(in) < 8 {
- return 0, nil, false
- }
- return binary.BigEndian.Uint64(in), in[8:], true
-}
-
-func intLength(n *big.Int) int {
- length := 4 /* length bytes */
- if n.Sign() < 0 {
- nMinus1 := new(big.Int).Neg(n)
- nMinus1.Sub(nMinus1, bigOne)
- bitLen := nMinus1.BitLen()
- if bitLen%8 == 0 {
- // The number will need 0xff padding
- length++
- }
- length += (bitLen + 7) / 8
- } else if n.Sign() == 0 {
- // A zero is the zero length string
- } else {
- bitLen := n.BitLen()
- if bitLen%8 == 0 {
- // The number will need 0x00 padding
- length++
- }
- length += (bitLen + 7) / 8
- }
-
- return length
-}
-
-func marshalUint32(to []byte, n uint32) []byte {
- binary.BigEndian.PutUint32(to, n)
- return to[4:]
-}
-
-func marshalUint64(to []byte, n uint64) []byte {
- binary.BigEndian.PutUint64(to, n)
- return to[8:]
-}
-
-func marshalInt(to []byte, n *big.Int) []byte {
- lengthBytes := to
- to = to[4:]
- length := 0
-
- if n.Sign() < 0 {
- // A negative number has to be converted to two's-complement
- // form. So we'll subtract 1 and invert. If the
- // most-significant-bit isn't set then we'll need to pad the
- // beginning with 0xff in order to keep the number negative.
- nMinus1 := new(big.Int).Neg(n)
- nMinus1.Sub(nMinus1, bigOne)
- bytes := nMinus1.Bytes()
- for i := range bytes {
- bytes[i] ^= 0xff
- }
- if len(bytes) == 0 || bytes[0]&0x80 == 0 {
- to[0] = 0xff
- to = to[1:]
- length++
- }
- nBytes := copy(to, bytes)
- to = to[nBytes:]
- length += nBytes
- } else if n.Sign() == 0 {
- // A zero is the zero length string
- } else {
- bytes := n.Bytes()
- if len(bytes) > 0 && bytes[0]&0x80 != 0 {
- // We'll have to pad this with a 0x00 in order to
- // stop it looking like a negative number.
- to[0] = 0
- to = to[1:]
- length++
- }
- nBytes := copy(to, bytes)
- to = to[nBytes:]
- length += nBytes
- }
-
- lengthBytes[0] = byte(length >> 24)
- lengthBytes[1] = byte(length >> 16)
- lengthBytes[2] = byte(length >> 8)
- lengthBytes[3] = byte(length)
- return to
-}
-
-func writeInt(w io.Writer, n *big.Int) {
- length := intLength(n)
- buf := make([]byte, length)
- marshalInt(buf, n)
- w.Write(buf)
-}
-
-func writeString(w io.Writer, s []byte) {
- var lengthBytes [4]byte
- lengthBytes[0] = byte(len(s) >> 24)
- lengthBytes[1] = byte(len(s) >> 16)
- lengthBytes[2] = byte(len(s) >> 8)
- lengthBytes[3] = byte(len(s))
- w.Write(lengthBytes[:])
- w.Write(s)
-}
-
-func stringLength(n int) int {
- return 4 + n
-}
-
-func marshalString(to []byte, s []byte) []byte {
- to[0] = byte(len(s) >> 24)
- to[1] = byte(len(s) >> 16)
- to[2] = byte(len(s) >> 8)
- to[3] = byte(len(s))
- to = to[4:]
- copy(to, s)
- return to[len(s):]
-}
-
-var bigIntType = reflect.TypeOf((*big.Int)(nil))
-
-// Decode a packet into its corresponding message.
-func decode(packet []byte) (interface{}, error) {
- var msg interface{}
- switch packet[0] {
- case msgDisconnect:
- msg = new(disconnectMsg)
- case msgServiceRequest:
- msg = new(serviceRequestMsg)
- case msgServiceAccept:
- msg = new(serviceAcceptMsg)
- case msgKexInit:
- msg = new(kexInitMsg)
- case msgKexDHInit:
- msg = new(kexDHInitMsg)
- case msgKexDHReply:
- msg = new(kexDHReplyMsg)
- case msgUserAuthRequest:
- msg = new(userAuthRequestMsg)
- case msgUserAuthFailure:
- msg = new(userAuthFailureMsg)
- case msgUserAuthPubKeyOk:
- msg = new(userAuthPubKeyOkMsg)
- case msgGlobalRequest:
- msg = new(globalRequestMsg)
- case msgRequestSuccess:
- msg = new(globalRequestSuccessMsg)
- case msgRequestFailure:
- msg = new(globalRequestFailureMsg)
- case msgChannelOpen:
- msg = new(channelOpenMsg)
- case msgChannelOpenConfirm:
- msg = new(channelOpenConfirmMsg)
- case msgChannelOpenFailure:
- msg = new(channelOpenFailureMsg)
- case msgChannelWindowAdjust:
- msg = new(windowAdjustMsg)
- case msgChannelEOF:
- msg = new(channelEOFMsg)
- case msgChannelClose:
- msg = new(channelCloseMsg)
- case msgChannelRequest:
- msg = new(channelRequestMsg)
- case msgChannelSuccess:
- msg = new(channelRequestSuccessMsg)
- case msgChannelFailure:
- msg = new(channelRequestFailureMsg)
- default:
- return nil, unexpectedMessageError(0, packet[0])
- }
- if err := Unmarshal(packet, msg); err != nil {
- return nil, err
- }
- return msg, nil
-}
diff --git a/vendor/golang.org/x/crypto/ssh/mux.go b/vendor/golang.org/x/crypto/ssh/mux.go
deleted file mode 100644
index 321880ad..00000000
--- a/vendor/golang.org/x/crypto/ssh/mux.go
+++ /dev/null
@@ -1,356 +0,0 @@
-// Copyright 2013 The Go Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style
-// license that can be found in the LICENSE file.
-
-package ssh
-
-import (
- "encoding/binary"
- "fmt"
- "io"
- "log"
- "sync"
- "sync/atomic"
-)
-
-// debugMux, if set, causes messages in the connection protocol to be
-// logged.
-const debugMux = false
-
-// chanList is a thread safe channel list.
-type chanList struct {
- // protects concurrent access to chans
- sync.Mutex
-
- // chans are indexed by the local id of the channel, which the
- // other side should send in the PeersId field.
- chans []*channel
-
- // This is a debugging aid: it offsets all IDs by this
- // amount. This helps distinguish otherwise identical
- // server/client muxes
- offset uint32
-}
-
-// Assigns a channel ID to the given channel.
-func (c *chanList) add(ch *channel) uint32 {
- c.Lock()
- defer c.Unlock()
- for i := range c.chans {
- if c.chans[i] == nil {
- c.chans[i] = ch
- return uint32(i) + c.offset
- }
- }
- c.chans = append(c.chans, ch)
- return uint32(len(c.chans)-1) + c.offset
-}
-
-// getChan returns the channel for the given ID.
-func (c *chanList) getChan(id uint32) *channel {
- id -= c.offset
-
- c.Lock()
- defer c.Unlock()
- if id < uint32(len(c.chans)) {
- return c.chans[id]
- }
- return nil
-}
-
-func (c *chanList) remove(id uint32) {
- id -= c.offset
- c.Lock()
- if id < uint32(len(c.chans)) {
- c.chans[id] = nil
- }
- c.Unlock()
-}
-
-// dropAll forgets all channels it knows, returning them in a slice.
-func (c *chanList) dropAll() []*channel {
- c.Lock()
- defer c.Unlock()
- var r []*channel
-
- for _, ch := range c.chans {
- if ch == nil {
- continue
- }
- r = append(r, ch)
- }
- c.chans = nil
- return r
-}
-
-// mux represents the state for the SSH connection protocol, which
-// multiplexes many channels onto a single packet transport.
-type mux struct {
- conn packetConn
- chanList chanList
-
- incomingChannels chan NewChannel
-
- globalSentMu sync.Mutex
- globalResponses chan interface{}
- incomingRequests chan *Request
-
- errCond *sync.Cond
- err error
-}
-
-// When debugging, each new chanList instantiation has a different
-// offset.
-var globalOff uint32
-
-func (m *mux) Wait() error {
- m.errCond.L.Lock()
- defer m.errCond.L.Unlock()
- for m.err == nil {
- m.errCond.Wait()
- }
- return m.err
-}
-
-// newMux returns a mux that runs over the given connection.
-func newMux(p packetConn) *mux {
- m := &mux{
- conn: p,
- incomingChannels: make(chan NewChannel, 16),
- globalResponses: make(chan interface{}, 1),
- incomingRequests: make(chan *Request, 16),
- errCond: newCond(),
- }
- if debugMux {
- m.chanList.offset = atomic.AddUint32(&globalOff, 1)
- }
-
- go m.loop()
- return m
-}
-
-func (m *mux) sendMessage(msg interface{}) error {
- p := Marshal(msg)
- return m.conn.writePacket(p)
-}
-
-func (m *mux) SendRequest(name string, wantReply bool, payload []byte) (bool, []byte, error) {
- if wantReply {
- m.globalSentMu.Lock()
- defer m.globalSentMu.Unlock()
- }
-
- if err := m.sendMessage(globalRequestMsg{
- Type: name,
- WantReply: wantReply,
- Data: payload,
- }); err != nil {
- return false, nil, err
- }
-
- if !wantReply {
- return false, nil, nil
- }
-
- msg, ok := <-m.globalResponses
- if !ok {
- return false, nil, io.EOF
- }
- switch msg := msg.(type) {
- case *globalRequestFailureMsg:
- return false, msg.Data, nil
- case *globalRequestSuccessMsg:
- return true, msg.Data, nil
- default:
- return false, nil, fmt.Errorf("ssh: unexpected response to request: %#v", msg)
- }
-}
-
-// ackRequest must be called after processing a global request that
-// has WantReply set.
-func (m *mux) ackRequest(ok bool, data []byte) error {
- if ok {
- return m.sendMessage(globalRequestSuccessMsg{Data: data})
- }
- return m.sendMessage(globalRequestFailureMsg{Data: data})
-}
-
-// TODO(hanwen): Disconnect is a transport layer message. We should
-// probably send and receive Disconnect somewhere in the transport
-// code.
-
-// Disconnect sends a disconnect message.
-func (m *mux) Disconnect(reason uint32, message string) error {
- return m.sendMessage(disconnectMsg{
- Reason: reason,
- Message: message,
- })
-}
-
-func (m *mux) Close() error {
- return m.conn.Close()
-}
-
-// loop runs the connection machine. It will process packets until an
-// error is encountered. To synchronize on loop exit, use mux.Wait.
-func (m *mux) loop() {
- var err error
- for err == nil {
- err = m.onePacket()
- }
-
- for _, ch := range m.chanList.dropAll() {
- ch.close()
- }
-
- close(m.incomingChannels)
- close(m.incomingRequests)
- close(m.globalResponses)
-
- m.conn.Close()
-
- m.errCond.L.Lock()
- m.err = err
- m.errCond.Broadcast()
- m.errCond.L.Unlock()
-
- if debugMux {
- log.Println("loop exit", err)
- }
-}
-
-// onePacket reads and processes one packet.
-func (m *mux) onePacket() error {
- packet, err := m.conn.readPacket()
- if err != nil {
- return err
- }
-
- if debugMux {
- if packet[0] == msgChannelData || packet[0] == msgChannelExtendedData {
- log.Printf("decoding(%d): data packet - %d bytes", m.chanList.offset, len(packet))
- } else {
- p, _ := decode(packet)
- log.Printf("decoding(%d): %d %#v - %d bytes", m.chanList.offset, packet[0], p, len(packet))
- }
- }
-
- switch packet[0] {
- case msgNewKeys:
- // Ignore notification of key change.
- return nil
- case msgDisconnect:
- return m.handleDisconnect(packet)
- case msgChannelOpen:
- return m.handleChannelOpen(packet)
- case msgGlobalRequest, msgRequestSuccess, msgRequestFailure:
- return m.handleGlobalPacket(packet)
- }
-
- // assume a channel packet.
- if len(packet) < 5 {
- return parseError(packet[0])
- }
- id := binary.BigEndian.Uint32(packet[1:])
- ch := m.chanList.getChan(id)
- if ch == nil {
- return fmt.Errorf("ssh: invalid channel %d", id)
- }
-
- return ch.handlePacket(packet)
-}
-
-func (m *mux) handleDisconnect(packet []byte) error {
- var d disconnectMsg
- if err := Unmarshal(packet, &d); err != nil {
- return err
- }
-
- if debugMux {
- log.Printf("caught disconnect: %v", d)
- }
- return &d
-}
-
-func (m *mux) handleGlobalPacket(packet []byte) error {
- msg, err := decode(packet)
- if err != nil {
- return err
- }
-
- switch msg := msg.(type) {
- case *globalRequestMsg:
- m.incomingRequests <- &Request{
- Type: msg.Type,
- WantReply: msg.WantReply,
- Payload: msg.Data,
- mux: m,
- }
- case *globalRequestSuccessMsg, *globalRequestFailureMsg:
- m.globalResponses <- msg
- default:
- panic(fmt.Sprintf("not a global message %#v", msg))
- }
-
- return nil
-}
-
-// handleChannelOpen schedules a channel to be Accept()ed.
-func (m *mux) handleChannelOpen(packet []byte) error {
- var msg channelOpenMsg
- if err := Unmarshal(packet, &msg); err != nil {
- return err
- }
-
- if msg.MaxPacketSize < minPacketLength || msg.MaxPacketSize > 1<<31 {
- failMsg := channelOpenFailureMsg{
- PeersId: msg.PeersId,
- Reason: ConnectionFailed,
- Message: "invalid request",
- Language: "en_US.UTF-8",
- }
- return m.sendMessage(failMsg)
- }
-
- c := m.newChannel(msg.ChanType, channelInbound, msg.TypeSpecificData)
- c.remoteId = msg.PeersId
- c.maxRemotePayload = msg.MaxPacketSize
- c.remoteWin.add(msg.PeersWindow)
- m.incomingChannels <- c
- return nil
-}
-
-func (m *mux) OpenChannel(chanType string, extra []byte) (Channel, <-chan *Request, error) {
- ch, err := m.openChannel(chanType, extra)
- if err != nil {
- return nil, nil, err
- }
-
- return ch, ch.incomingRequests, nil
-}
-
-func (m *mux) openChannel(chanType string, extra []byte) (*channel, error) {
- ch := m.newChannel(chanType, channelOutbound, extra)
-
- ch.maxIncomingPayload = channelMaxPacket
-
- open := channelOpenMsg{
- ChanType: chanType,
- PeersWindow: ch.myWindow,
- MaxPacketSize: ch.maxIncomingPayload,
- TypeSpecificData: extra,
- PeersId: ch.localId,
- }
- if err := m.sendMessage(open); err != nil {
- return nil, err
- }
-
- switch msg := (<-ch.msg).(type) {
- case *channelOpenConfirmMsg:
- return ch, nil
- case *channelOpenFailureMsg:
- return nil, &OpenChannelError{msg.Reason, msg.Message}
- default:
- return nil, fmt.Errorf("ssh: unexpected packet in response to channel open: %T", msg)
- }
-}
diff --git a/vendor/golang.org/x/crypto/ssh/server.go b/vendor/golang.org/x/crypto/ssh/server.go
deleted file mode 100644
index 4781eb78..00000000
--- a/vendor/golang.org/x/crypto/ssh/server.go
+++ /dev/null
@@ -1,495 +0,0 @@
-// Copyright 2011 The Go Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style
-// license that can be found in the LICENSE file.
-
-package ssh
-
-import (
- "bytes"
- "errors"
- "fmt"
- "io"
- "net"
-)
-
-// The Permissions type holds fine-grained permissions that are
-// specific to a user or a specific authentication method for a
-// user. Permissions, except for "source-address", must be enforced in
-// the server application layer, after successful authentication. The
-// Permissions are passed on in ServerConn so a server implementation
-// can honor them.
-type Permissions struct {
- // Critical options restrict default permissions. Common
- // restrictions are "source-address" and "force-command". If
- // the server cannot enforce the restriction, or does not
- // recognize it, the user should not authenticate.
- CriticalOptions map[string]string
-
- // Extensions are extra functionality that the server may
- // offer on authenticated connections. Common extensions are
- // "permit-agent-forwarding", "permit-X11-forwarding". Lack of
- // support for an extension does not preclude authenticating a
- // user.
- Extensions map[string]string
-}
-
-// ServerConfig holds server specific configuration data.
-type ServerConfig struct {
- // Config contains configuration shared between client and server.
- Config
-
- hostKeys []Signer
-
- // NoClientAuth is true if clients are allowed to connect without
- // authenticating.
- NoClientAuth bool
-
- // PasswordCallback, if non-nil, is called when a user
- // attempts to authenticate using a password.
- PasswordCallback func(conn ConnMetadata, password []byte) (*Permissions, error)
-
- // PublicKeyCallback, if non-nil, is called when a client attempts public
- // key authentication. It must return true if the given public key is
- // valid for the given user. For example, see CertChecker.Authenticate.
- PublicKeyCallback func(conn ConnMetadata, key PublicKey) (*Permissions, error)
-
- // KeyboardInteractiveCallback, if non-nil, is called when
- // keyboard-interactive authentication is selected (RFC
- // 4256). The client object's Challenge function should be
- // used to query the user. The callback may offer multiple
- // Challenge rounds. To avoid information leaks, the client
- // should be presented a challenge even if the user is
- // unknown.
- KeyboardInteractiveCallback func(conn ConnMetadata, client KeyboardInteractiveChallenge) (*Permissions, error)
-
- // AuthLogCallback, if non-nil, is called to log all authentication
- // attempts.
- AuthLogCallback func(conn ConnMetadata, method string, err error)
-
- // ServerVersion is the version identification string to announce in
- // the public handshake.
- // If empty, a reasonable default is used.
- // Note that RFC 4253 section 4.2 requires that this string start with
- // "SSH-2.0-".
- ServerVersion string
-}
-
-// AddHostKey adds a private key as a host key. If an existing host
-// key exists with the same algorithm, it is overwritten. Each server
-// config must have at least one host key.
-func (s *ServerConfig) AddHostKey(key Signer) {
- for i, k := range s.hostKeys {
- if k.PublicKey().Type() == key.PublicKey().Type() {
- s.hostKeys[i] = key
- return
- }
- }
-
- s.hostKeys = append(s.hostKeys, key)
-}
-
-// cachedPubKey contains the results of querying whether a public key is
-// acceptable for a user.
-type cachedPubKey struct {
- user string
- pubKeyData []byte
- result error
- perms *Permissions
-}
-
-const maxCachedPubKeys = 16
-
-// pubKeyCache caches tests for public keys. Since SSH clients
-// will query whether a public key is acceptable before attempting to
-// authenticate with it, we end up with duplicate queries for public
-// key validity. The cache only applies to a single ServerConn.
-type pubKeyCache struct {
- keys []cachedPubKey
-}
-
-// get returns the result for a given user/algo/key tuple.
-func (c *pubKeyCache) get(user string, pubKeyData []byte) (cachedPubKey, bool) {
- for _, k := range c.keys {
- if k.user == user && bytes.Equal(k.pubKeyData, pubKeyData) {
- return k, true
- }
- }
- return cachedPubKey{}, false
-}
-
-// add adds the given tuple to the cache.
-func (c *pubKeyCache) add(candidate cachedPubKey) {
- if len(c.keys) < maxCachedPubKeys {
- c.keys = append(c.keys, candidate)
- }
-}
-
-// ServerConn is an authenticated SSH connection, as seen from the
-// server
-type ServerConn struct {
- Conn
-
- // If the succeeding authentication callback returned a
- // non-nil Permissions pointer, it is stored here.
- Permissions *Permissions
-}
-
-// NewServerConn starts a new SSH server with c as the underlying
-// transport. It starts with a handshake and, if the handshake is
-// unsuccessful, it closes the connection and returns an error. The
-// Request and NewChannel channels must be serviced, or the connection
-// will hang.
-func NewServerConn(c net.Conn, config *ServerConfig) (*ServerConn, <-chan NewChannel, <-chan *Request, error) {
- fullConf := *config
- fullConf.SetDefaults()
- s := &connection{
- sshConn: sshConn{conn: c},
- }
- perms, err := s.serverHandshake(&fullConf)
- if err != nil {
- c.Close()
- return nil, nil, nil, err
- }
- return &ServerConn{s, perms}, s.mux.incomingChannels, s.mux.incomingRequests, nil
-}
-
-// signAndMarshal signs the data with the appropriate algorithm,
-// and serializes the result in SSH wire format.
-func signAndMarshal(k Signer, rand io.Reader, data []byte) ([]byte, error) {
- sig, err := k.Sign(rand, data)
- if err != nil {
- return nil, err
- }
-
- return Marshal(sig), nil
-}
-
-// handshake performs key exchange and user authentication.
-func (s *connection) serverHandshake(config *ServerConfig) (*Permissions, error) {
- if len(config.hostKeys) == 0 {
- return nil, errors.New("ssh: server has no host keys")
- }
-
- if !config.NoClientAuth && config.PasswordCallback == nil && config.PublicKeyCallback == nil && config.KeyboardInteractiveCallback == nil {
- return nil, errors.New("ssh: no authentication methods configured but NoClientAuth is also false")
- }
-
- if config.ServerVersion != "" {
- s.serverVersion = []byte(config.ServerVersion)
- } else {
- s.serverVersion = []byte(packageVersion)
- }
- var err error
- s.clientVersion, err = exchangeVersions(s.sshConn.conn, s.serverVersion)
- if err != nil {
- return nil, err
- }
-
- tr := newTransport(s.sshConn.conn, config.Rand, false /* not client */)
- s.transport = newServerTransport(tr, s.clientVersion, s.serverVersion, config)
-
- if err := s.transport.requestKeyChange(); err != nil {
- return nil, err
- }
-
- if packet, err := s.transport.readPacket(); err != nil {
- return nil, err
- } else if packet[0] != msgNewKeys {
- return nil, unexpectedMessageError(msgNewKeys, packet[0])
- }
-
- // We just did the key change, so the session ID is established.
- s.sessionID = s.transport.getSessionID()
-
- var packet []byte
- if packet, err = s.transport.readPacket(); err != nil {
- return nil, err
- }
-
- var serviceRequest serviceRequestMsg
- if err = Unmarshal(packet, &serviceRequest); err != nil {
- return nil, err
- }
- if serviceRequest.Service != serviceUserAuth {
- return nil, errors.New("ssh: requested service '" + serviceRequest.Service + "' before authenticating")
- }
- serviceAccept := serviceAcceptMsg{
- Service: serviceUserAuth,
- }
- if err := s.transport.writePacket(Marshal(&serviceAccept)); err != nil {
- return nil, err
- }
-
- perms, err := s.serverAuthenticate(config)
- if err != nil {
- return nil, err
- }
- s.mux = newMux(s.transport)
- return perms, err
-}
-
-func isAcceptableAlgo(algo string) bool {
- switch algo {
- case KeyAlgoRSA, KeyAlgoDSA, KeyAlgoECDSA256, KeyAlgoECDSA384, KeyAlgoECDSA521,
- CertAlgoRSAv01, CertAlgoDSAv01, CertAlgoECDSA256v01, CertAlgoECDSA384v01, CertAlgoECDSA521v01:
- return true
- }
- return false
-}
-
-func checkSourceAddress(addr net.Addr, sourceAddr string) error {
- if addr == nil {
- return errors.New("ssh: no address known for client, but source-address match required")
- }
-
- tcpAddr, ok := addr.(*net.TCPAddr)
- if !ok {
- return fmt.Errorf("ssh: remote address %v is not an TCP address when checking source-address match", addr)
- }
-
- if allowedIP := net.ParseIP(sourceAddr); allowedIP != nil {
- if bytes.Equal(allowedIP, tcpAddr.IP) {
- return nil
- }
- } else {
- _, ipNet, err := net.ParseCIDR(sourceAddr)
- if err != nil {
- return fmt.Errorf("ssh: error parsing source-address restriction %q: %v", sourceAddr, err)
- }
-
- if ipNet.Contains(tcpAddr.IP) {
- return nil
- }
- }
-
- return fmt.Errorf("ssh: remote address %v is not allowed because of source-address restriction", addr)
-}
-
-func (s *connection) serverAuthenticate(config *ServerConfig) (*Permissions, error) {
- var err error
- var cache pubKeyCache
- var perms *Permissions
-
-userAuthLoop:
- for {
- var userAuthReq userAuthRequestMsg
- if packet, err := s.transport.readPacket(); err != nil {
- return nil, err
- } else if err = Unmarshal(packet, &userAuthReq); err != nil {
- return nil, err
- }
-
- if userAuthReq.Service != serviceSSH {
- return nil, errors.New("ssh: client attempted to negotiate for unknown service: " + userAuthReq.Service)
- }
-
- s.user = userAuthReq.User
- perms = nil
- authErr := errors.New("no auth passed yet")
-
- switch userAuthReq.Method {
- case "none":
- if config.NoClientAuth {
- s.user = ""
- authErr = nil
- }
- case "password":
- if config.PasswordCallback == nil {
- authErr = errors.New("ssh: password auth not configured")
- break
- }
- payload := userAuthReq.Payload
- if len(payload) < 1 || payload[0] != 0 {
- return nil, parseError(msgUserAuthRequest)
- }
- payload = payload[1:]
- password, payload, ok := parseString(payload)
- if !ok || len(payload) > 0 {
- return nil, parseError(msgUserAuthRequest)
- }
-
- perms, authErr = config.PasswordCallback(s, password)
- case "keyboard-interactive":
- if config.KeyboardInteractiveCallback == nil {
- authErr = errors.New("ssh: keyboard-interactive auth not configubred")
- break
- }
-
- prompter := &sshClientKeyboardInteractive{s}
- perms, authErr = config.KeyboardInteractiveCallback(s, prompter.Challenge)
- case "publickey":
- if config.PublicKeyCallback == nil {
- authErr = errors.New("ssh: publickey auth not configured")
- break
- }
- payload := userAuthReq.Payload
- if len(payload) < 1 {
- return nil, parseError(msgUserAuthRequest)
- }
- isQuery := payload[0] == 0
- payload = payload[1:]
- algoBytes, payload, ok := parseString(payload)
- if !ok {
- return nil, parseError(msgUserAuthRequest)
- }
- algo := string(algoBytes)
- if !isAcceptableAlgo(algo) {
- authErr = fmt.Errorf("ssh: algorithm %q not accepted", algo)
- break
- }
-
- pubKeyData, payload, ok := parseString(payload)
- if !ok {
- return nil, parseError(msgUserAuthRequest)
- }
-
- pubKey, err := ParsePublicKey(pubKeyData)
- if err != nil {
- return nil, err
- }
-
- candidate, ok := cache.get(s.user, pubKeyData)
- if !ok {
- candidate.user = s.user
- candidate.pubKeyData = pubKeyData
- candidate.perms, candidate.result = config.PublicKeyCallback(s, pubKey)
- if candidate.result == nil && candidate.perms != nil && candidate.perms.CriticalOptions != nil && candidate.perms.CriticalOptions[sourceAddressCriticalOption] != "" {
- candidate.result = checkSourceAddress(
- s.RemoteAddr(),
- candidate.perms.CriticalOptions[sourceAddressCriticalOption])
- }
- cache.add(candidate)
- }
-
- if isQuery {
- // The client can query if the given public key
- // would be okay.
- if len(payload) > 0 {
- return nil, parseError(msgUserAuthRequest)
- }
-
- if candidate.result == nil {
- okMsg := userAuthPubKeyOkMsg{
- Algo: algo,
- PubKey: pubKeyData,
- }
- if err = s.transport.writePacket(Marshal(&okMsg)); err != nil {
- return nil, err
- }
- continue userAuthLoop
- }
- authErr = candidate.result
- } else {
- sig, payload, ok := parseSignature(payload)
- if !ok || len(payload) > 0 {
- return nil, parseError(msgUserAuthRequest)
- }
- // Ensure the public key algo and signature algo
- // are supported. Compare the private key
- // algorithm name that corresponds to algo with
- // sig.Format. This is usually the same, but
- // for certs, the names differ.
- if !isAcceptableAlgo(sig.Format) {
- break
- }
- signedData := buildDataSignedForAuth(s.transport.getSessionID(), userAuthReq, algoBytes, pubKeyData)
-
- if err := pubKey.Verify(signedData, sig); err != nil {
- return nil, err
- }
-
- authErr = candidate.result
- perms = candidate.perms
- }
- default:
- authErr = fmt.Errorf("ssh: unknown method %q", userAuthReq.Method)
- }
-
- if config.AuthLogCallback != nil {
- config.AuthLogCallback(s, userAuthReq.Method, authErr)
- }
-
- if authErr == nil {
- break userAuthLoop
- }
-
- var failureMsg userAuthFailureMsg
- if config.PasswordCallback != nil {
- failureMsg.Methods = append(failureMsg.Methods, "password")
- }
- if config.PublicKeyCallback != nil {
- failureMsg.Methods = append(failureMsg.Methods, "publickey")
- }
- if config.KeyboardInteractiveCallback != nil {
- failureMsg.Methods = append(failureMsg.Methods, "keyboard-interactive")
- }
-
- if len(failureMsg.Methods) == 0 {
- return nil, errors.New("ssh: no authentication methods configured but NoClientAuth is also false")
- }
-
- if err = s.transport.writePacket(Marshal(&failureMsg)); err != nil {
- return nil, err
- }
- }
-
- if err = s.transport.writePacket([]byte{msgUserAuthSuccess}); err != nil {
- return nil, err
- }
- return perms, nil
-}
-
-// sshClientKeyboardInteractive implements a ClientKeyboardInteractive by
-// asking the client on the other side of a ServerConn.
-type sshClientKeyboardInteractive struct {
- *connection
-}
-
-func (c *sshClientKeyboardInteractive) Challenge(user, instruction string, questions []string, echos []bool) (answers []string, err error) {
- if len(questions) != len(echos) {
- return nil, errors.New("ssh: echos and questions must have equal length")
- }
-
- var prompts []byte
- for i := range questions {
- prompts = appendString(prompts, questions[i])
- prompts = appendBool(prompts, echos[i])
- }
-
- if err := c.transport.writePacket(Marshal(&userAuthInfoRequestMsg{
- Instruction: instruction,
- NumPrompts: uint32(len(questions)),
- Prompts: prompts,
- })); err != nil {
- return nil, err
- }
-
- packet, err := c.transport.readPacket()
- if err != nil {
- return nil, err
- }
- if packet[0] != msgUserAuthInfoResponse {
- return nil, unexpectedMessageError(msgUserAuthInfoResponse, packet[0])
- }
- packet = packet[1:]
-
- n, packet, ok := parseUint32(packet)
- if !ok || int(n) != len(questions) {
- return nil, parseError(msgUserAuthInfoResponse)
- }
-
- for i := uint32(0); i < n; i++ {
- ans, rest, ok := parseString(packet)
- if !ok {
- return nil, parseError(msgUserAuthInfoResponse)
- }
-
- answers = append(answers, string(ans))
- packet = rest
- }
- if len(packet) != 0 {
- return nil, errors.New("ssh: junk at end of message")
- }
-
- return answers, nil
-}
diff --git a/vendor/golang.org/x/crypto/ssh/session.go b/vendor/golang.org/x/crypto/ssh/session.go
deleted file mode 100644
index b039fb46..00000000
--- a/vendor/golang.org/x/crypto/ssh/session.go
+++ /dev/null
@@ -1,605 +0,0 @@
-// Copyright 2011 The Go Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style
-// license that can be found in the LICENSE file.
-
-package ssh
-
-// Session implements an interactive session described in
-// "RFC 4254, section 6".
-
-import (
- "bytes"
- "errors"
- "fmt"
- "io"
- "io/ioutil"
- "sync"
-)
-
-type Signal string
-
-// POSIX signals as listed in RFC 4254 Section 6.10.
-const (
- SIGABRT Signal = "ABRT"
- SIGALRM Signal = "ALRM"
- SIGFPE Signal = "FPE"
- SIGHUP Signal = "HUP"
- SIGILL Signal = "ILL"
- SIGINT Signal = "INT"
- SIGKILL Signal = "KILL"
- SIGPIPE Signal = "PIPE"
- SIGQUIT Signal = "QUIT"
- SIGSEGV Signal = "SEGV"
- SIGTERM Signal = "TERM"
- SIGUSR1 Signal = "USR1"
- SIGUSR2 Signal = "USR2"
-)
-
-var signals = map[Signal]int{
- SIGABRT: 6,
- SIGALRM: 14,
- SIGFPE: 8,
- SIGHUP: 1,
- SIGILL: 4,
- SIGINT: 2,
- SIGKILL: 9,
- SIGPIPE: 13,
- SIGQUIT: 3,
- SIGSEGV: 11,
- SIGTERM: 15,
-}
-
-type TerminalModes map[uint8]uint32
-
-// POSIX terminal mode flags as listed in RFC 4254 Section 8.
-const (
- tty_OP_END = 0
- VINTR = 1
- VQUIT = 2
- VERASE = 3
- VKILL = 4
- VEOF = 5
- VEOL = 6
- VEOL2 = 7
- VSTART = 8
- VSTOP = 9
- VSUSP = 10
- VDSUSP = 11
- VREPRINT = 12
- VWERASE = 13
- VLNEXT = 14
- VFLUSH = 15
- VSWTCH = 16
- VSTATUS = 17
- VDISCARD = 18
- IGNPAR = 30
- PARMRK = 31
- INPCK = 32
- ISTRIP = 33
- INLCR = 34
- IGNCR = 35
- ICRNL = 36
- IUCLC = 37
- IXON = 38
- IXANY = 39
- IXOFF = 40
- IMAXBEL = 41
- ISIG = 50
- ICANON = 51
- XCASE = 52
- ECHO = 53
- ECHOE = 54
- ECHOK = 55
- ECHONL = 56
- NOFLSH = 57
- TOSTOP = 58
- IEXTEN = 59
- ECHOCTL = 60
- ECHOKE = 61
- PENDIN = 62
- OPOST = 70
- OLCUC = 71
- ONLCR = 72
- OCRNL = 73
- ONOCR = 74
- ONLRET = 75
- CS7 = 90
- CS8 = 91
- PARENB = 92
- PARODD = 93
- TTY_OP_ISPEED = 128
- TTY_OP_OSPEED = 129
-)
-
-// A Session represents a connection to a remote command or shell.
-type Session struct {
- // Stdin specifies the remote process's standard input.
- // If Stdin is nil, the remote process reads from an empty
- // bytes.Buffer.
- Stdin io.Reader
-
- // Stdout and Stderr specify the remote process's standard
- // output and error.
- //
- // If either is nil, Run connects the corresponding file
- // descriptor to an instance of ioutil.Discard. There is a
- // fixed amount of buffering that is shared for the two streams.
- // If either blocks it may eventually cause the remote
- // command to block.
- Stdout io.Writer
- Stderr io.Writer
-
- ch Channel // the channel backing this session
- started bool // true once Start, Run or Shell is invoked.
- copyFuncs []func() error
- errors chan error // one send per copyFunc
-
- // true if pipe method is active
- stdinpipe, stdoutpipe, stderrpipe bool
-
- // stdinPipeWriter is non-nil if StdinPipe has not been called
- // and Stdin was specified by the user; it is the write end of
- // a pipe connecting Session.Stdin to the stdin channel.
- stdinPipeWriter io.WriteCloser
-
- exitStatus chan error
-}
-
-// SendRequest sends an out-of-band channel request on the SSH channel
-// underlying the session.
-func (s *Session) SendRequest(name string, wantReply bool, payload []byte) (bool, error) {
- return s.ch.SendRequest(name, wantReply, payload)
-}
-
-func (s *Session) Close() error {
- return s.ch.Close()
-}
-
-// RFC 4254 Section 6.4.
-type setenvRequest struct {
- Name string
- Value string
-}
-
-// Setenv sets an environment variable that will be applied to any
-// command executed by Shell or Run.
-func (s *Session) Setenv(name, value string) error {
- msg := setenvRequest{
- Name: name,
- Value: value,
- }
- ok, err := s.ch.SendRequest("env", true, Marshal(&msg))
- if err == nil && !ok {
- err = errors.New("ssh: setenv failed")
- }
- return err
-}
-
-// RFC 4254 Section 6.2.
-type ptyRequestMsg struct {
- Term string
- Columns uint32
- Rows uint32
- Width uint32
- Height uint32
- Modelist string
-}
-
-// RequestPty requests the association of a pty with the session on the remote host.
-func (s *Session) RequestPty(term string, h, w int, termmodes TerminalModes) error {
- var tm []byte
- for k, v := range termmodes {
- kv := struct {
- Key byte
- Val uint32
- }{k, v}
-
- tm = append(tm, Marshal(&kv)...)
- }
- tm = append(tm, tty_OP_END)
- req := ptyRequestMsg{
- Term: term,
- Columns: uint32(w),
- Rows: uint32(h),
- Width: uint32(w * 8),
- Height: uint32(h * 8),
- Modelist: string(tm),
- }
- ok, err := s.ch.SendRequest("pty-req", true, Marshal(&req))
- if err == nil && !ok {
- err = errors.New("ssh: pty-req failed")
- }
- return err
-}
-
-// RFC 4254 Section 6.5.
-type subsystemRequestMsg struct {
- Subsystem string
-}
-
-// RequestSubsystem requests the association of a subsystem with the session on the remote host.
-// A subsystem is a predefined command that runs in the background when the ssh session is initiated
-func (s *Session) RequestSubsystem(subsystem string) error {
- msg := subsystemRequestMsg{
- Subsystem: subsystem,
- }
- ok, err := s.ch.SendRequest("subsystem", true, Marshal(&msg))
- if err == nil && !ok {
- err = errors.New("ssh: subsystem request failed")
- }
- return err
-}
-
-// RFC 4254 Section 6.9.
-type signalMsg struct {
- Signal string
-}
-
-// Signal sends the given signal to the remote process.
-// sig is one of the SIG* constants.
-func (s *Session) Signal(sig Signal) error {
- msg := signalMsg{
- Signal: string(sig),
- }
-
- _, err := s.ch.SendRequest("signal", false, Marshal(&msg))
- return err
-}
-
-// RFC 4254 Section 6.5.
-type execMsg struct {
- Command string
-}
-
-// Start runs cmd on the remote host. Typically, the remote
-// server passes cmd to the shell for interpretation.
-// A Session only accepts one call to Run, Start or Shell.
-func (s *Session) Start(cmd string) error {
- if s.started {
- return errors.New("ssh: session already started")
- }
- req := execMsg{
- Command: cmd,
- }
-
- ok, err := s.ch.SendRequest("exec", true, Marshal(&req))
- if err == nil && !ok {
- err = fmt.Errorf("ssh: command %v failed", cmd)
- }
- if err != nil {
- return err
- }
- return s.start()
-}
-
-// Run runs cmd on the remote host. Typically, the remote
-// server passes cmd to the shell for interpretation.
-// A Session only accepts one call to Run, Start, Shell, Output,
-// or CombinedOutput.
-//
-// The returned error is nil if the command runs, has no problems
-// copying stdin, stdout, and stderr, and exits with a zero exit
-// status.
-//
-// If the command fails to run or doesn't complete successfully, the
-// error is of type *ExitError. Other error types may be
-// returned for I/O problems.
-func (s *Session) Run(cmd string) error {
- err := s.Start(cmd)
- if err != nil {
- return err
- }
- return s.Wait()
-}
-
-// Output runs cmd on the remote host and returns its standard output.
-func (s *Session) Output(cmd string) ([]byte, error) {
- if s.Stdout != nil {
- return nil, errors.New("ssh: Stdout already set")
- }
- var b bytes.Buffer
- s.Stdout = &b
- err := s.Run(cmd)
- return b.Bytes(), err
-}
-
-type singleWriter struct {
- b bytes.Buffer
- mu sync.Mutex
-}
-
-func (w *singleWriter) Write(p []byte) (int, error) {
- w.mu.Lock()
- defer w.mu.Unlock()
- return w.b.Write(p)
-}
-
-// CombinedOutput runs cmd on the remote host and returns its combined
-// standard output and standard error.
-func (s *Session) CombinedOutput(cmd string) ([]byte, error) {
- if s.Stdout != nil {
- return nil, errors.New("ssh: Stdout already set")
- }
- if s.Stderr != nil {
- return nil, errors.New("ssh: Stderr already set")
- }
- var b singleWriter
- s.Stdout = &b
- s.Stderr = &b
- err := s.Run(cmd)
- return b.b.Bytes(), err
-}
-
-// Shell starts a login shell on the remote host. A Session only
-// accepts one call to Run, Start, Shell, Output, or CombinedOutput.
-func (s *Session) Shell() error {
- if s.started {
- return errors.New("ssh: session already started")
- }
-
- ok, err := s.ch.SendRequest("shell", true, nil)
- if err == nil && !ok {
- return errors.New("ssh: could not start shell")
- }
- if err != nil {
- return err
- }
- return s.start()
-}
-
-func (s *Session) start() error {
- s.started = true
-
- type F func(*Session)
- for _, setupFd := range []F{(*Session).stdin, (*Session).stdout, (*Session).stderr} {
- setupFd(s)
- }
-
- s.errors = make(chan error, len(s.copyFuncs))
- for _, fn := range s.copyFuncs {
- go func(fn func() error) {
- s.errors <- fn()
- }(fn)
- }
- return nil
-}
-
-// Wait waits for the remote command to exit.
-//
-// The returned error is nil if the command runs, has no problems
-// copying stdin, stdout, and stderr, and exits with a zero exit
-// status.
-//
-// If the command fails to run or doesn't complete successfully, the
-// error is of type *ExitError. Other error types may be
-// returned for I/O problems.
-func (s *Session) Wait() error {
- if !s.started {
- return errors.New("ssh: session not started")
- }
- waitErr := <-s.exitStatus
-
- if s.stdinPipeWriter != nil {
- s.stdinPipeWriter.Close()
- }
- var copyError error
- for range s.copyFuncs {
- if err := <-s.errors; err != nil && copyError == nil {
- copyError = err
- }
- }
- if waitErr != nil {
- return waitErr
- }
- return copyError
-}
-
-func (s *Session) wait(reqs <-chan *Request) error {
- wm := Waitmsg{status: -1}
- // Wait for msg channel to be closed before returning.
- for msg := range reqs {
- switch msg.Type {
- case "exit-status":
- d := msg.Payload
- wm.status = int(d[0])<<24 | int(d[1])<<16 | int(d[2])<<8 | int(d[3])
- case "exit-signal":
- var sigval struct {
- Signal string
- CoreDumped bool
- Error string
- Lang string
- }
- if err := Unmarshal(msg.Payload, &sigval); err != nil {
- return err
- }
-
- // Must sanitize strings?
- wm.signal = sigval.Signal
- wm.msg = sigval.Error
- wm.lang = sigval.Lang
- default:
- // This handles keepalives and matches
- // OpenSSH's behaviour.
- if msg.WantReply {
- msg.Reply(false, nil)
- }
- }
- }
- if wm.status == 0 {
- return nil
- }
- if wm.status == -1 {
- // exit-status was never sent from server
- if wm.signal == "" {
- return errors.New("wait: remote command exited without exit status or exit signal")
- }
- wm.status = 128
- if _, ok := signals[Signal(wm.signal)]; ok {
- wm.status += signals[Signal(wm.signal)]
- }
- }
- return &ExitError{wm}
-}
-
-func (s *Session) stdin() {
- if s.stdinpipe {
- return
- }
- var stdin io.Reader
- if s.Stdin == nil {
- stdin = new(bytes.Buffer)
- } else {
- r, w := io.Pipe()
- go func() {
- _, err := io.Copy(w, s.Stdin)
- w.CloseWithError(err)
- }()
- stdin, s.stdinPipeWriter = r, w
- }
- s.copyFuncs = append(s.copyFuncs, func() error {
- _, err := io.Copy(s.ch, stdin)
- if err1 := s.ch.CloseWrite(); err == nil && err1 != io.EOF {
- err = err1
- }
- return err
- })
-}
-
-func (s *Session) stdout() {
- if s.stdoutpipe {
- return
- }
- if s.Stdout == nil {
- s.Stdout = ioutil.Discard
- }
- s.copyFuncs = append(s.copyFuncs, func() error {
- _, err := io.Copy(s.Stdout, s.ch)
- return err
- })
-}
-
-func (s *Session) stderr() {
- if s.stderrpipe {
- return
- }
- if s.Stderr == nil {
- s.Stderr = ioutil.Discard
- }
- s.copyFuncs = append(s.copyFuncs, func() error {
- _, err := io.Copy(s.Stderr, s.ch.Stderr())
- return err
- })
-}
-
-// sessionStdin reroutes Close to CloseWrite.
-type sessionStdin struct {
- io.Writer
- ch Channel
-}
-
-func (s *sessionStdin) Close() error {
- return s.ch.CloseWrite()
-}
-
-// StdinPipe returns a pipe that will be connected to the
-// remote command's standard input when the command starts.
-func (s *Session) StdinPipe() (io.WriteCloser, error) {
- if s.Stdin != nil {
- return nil, errors.New("ssh: Stdin already set")
- }
- if s.started {
- return nil, errors.New("ssh: StdinPipe after process started")
- }
- s.stdinpipe = true
- return &sessionStdin{s.ch, s.ch}, nil
-}
-
-// StdoutPipe returns a pipe that will be connected to the
-// remote command's standard output when the command starts.
-// There is a fixed amount of buffering that is shared between
-// stdout and stderr streams. If the StdoutPipe reader is
-// not serviced fast enough it may eventually cause the
-// remote command to block.
-func (s *Session) StdoutPipe() (io.Reader, error) {
- if s.Stdout != nil {
- return nil, errors.New("ssh: Stdout already set")
- }
- if s.started {
- return nil, errors.New("ssh: StdoutPipe after process started")
- }
- s.stdoutpipe = true
- return s.ch, nil
-}
-
-// StderrPipe returns a pipe that will be connected to the
-// remote command's standard error when the command starts.
-// There is a fixed amount of buffering that is shared between
-// stdout and stderr streams. If the StderrPipe reader is
-// not serviced fast enough it may eventually cause the
-// remote command to block.
-func (s *Session) StderrPipe() (io.Reader, error) {
- if s.Stderr != nil {
- return nil, errors.New("ssh: Stderr already set")
- }
- if s.started {
- return nil, errors.New("ssh: StderrPipe after process started")
- }
- s.stderrpipe = true
- return s.ch.Stderr(), nil
-}
-
-// newSession returns a new interactive session on the remote host.
-func newSession(ch Channel, reqs <-chan *Request) (*Session, error) {
- s := &Session{
- ch: ch,
- }
- s.exitStatus = make(chan error, 1)
- go func() {
- s.exitStatus <- s.wait(reqs)
- }()
-
- return s, nil
-}
-
-// An ExitError reports unsuccessful completion of a remote command.
-type ExitError struct {
- Waitmsg
-}
-
-func (e *ExitError) Error() string {
- return e.Waitmsg.String()
-}
-
-// Waitmsg stores the information about an exited remote command
-// as reported by Wait.
-type Waitmsg struct {
- status int
- signal string
- msg string
- lang string
-}
-
-// ExitStatus returns the exit status of the remote command.
-func (w Waitmsg) ExitStatus() int {
- return w.status
-}
-
-// Signal returns the exit signal of the remote command if
-// it was terminated violently.
-func (w Waitmsg) Signal() string {
- return w.signal
-}
-
-// Msg returns the exit message given by the remote command
-func (w Waitmsg) Msg() string {
- return w.msg
-}
-
-// Lang returns the language tag. See RFC 3066
-func (w Waitmsg) Lang() string {
- return w.lang
-}
-
-func (w Waitmsg) String() string {
- return fmt.Sprintf("Process exited with: %v. Reason was: %v (%v)", w.status, w.msg, w.signal)
-}
diff --git a/vendor/golang.org/x/crypto/ssh/tcpip.go b/vendor/golang.org/x/crypto/ssh/tcpip.go
deleted file mode 100644
index 6151241f..00000000
--- a/vendor/golang.org/x/crypto/ssh/tcpip.go
+++ /dev/null
@@ -1,407 +0,0 @@
-// Copyright 2011 The Go Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style
-// license that can be found in the LICENSE file.
-
-package ssh
-
-import (
- "errors"
- "fmt"
- "io"
- "math/rand"
- "net"
- "strconv"
- "strings"
- "sync"
- "time"
-)
-
-// Listen requests the remote peer open a listening socket on
-// addr. Incoming connections will be available by calling Accept on
-// the returned net.Listener. The listener must be serviced, or the
-// SSH connection may hang.
-func (c *Client) Listen(n, addr string) (net.Listener, error) {
- laddr, err := net.ResolveTCPAddr(n, addr)
- if err != nil {
- return nil, err
- }
- return c.ListenTCP(laddr)
-}
-
-// Automatic port allocation is broken with OpenSSH before 6.0. See
-// also https://bugzilla.mindrot.org/show_bug.cgi?id=2017. In
-// particular, OpenSSH 5.9 sends a channelOpenMsg with port number 0,
-// rather than the actual port number. This means you can never open
-// two different listeners with auto allocated ports. We work around
-// this by trying explicit ports until we succeed.
-
-const openSSHPrefix = "OpenSSH_"
-
-var portRandomizer = rand.New(rand.NewSource(time.Now().UnixNano()))
-
-// isBrokenOpenSSHVersion returns true if the given version string
-// specifies a version of OpenSSH that is known to have a bug in port
-// forwarding.
-func isBrokenOpenSSHVersion(versionStr string) bool {
- i := strings.Index(versionStr, openSSHPrefix)
- if i < 0 {
- return false
- }
- i += len(openSSHPrefix)
- j := i
- for ; j < len(versionStr); j++ {
- if versionStr[j] < '0' || versionStr[j] > '9' {
- break
- }
- }
- version, _ := strconv.Atoi(versionStr[i:j])
- return version < 6
-}
-
-// autoPortListenWorkaround simulates automatic port allocation by
-// trying random ports repeatedly.
-func (c *Client) autoPortListenWorkaround(laddr *net.TCPAddr) (net.Listener, error) {
- var sshListener net.Listener
- var err error
- const tries = 10
- for i := 0; i < tries; i++ {
- addr := *laddr
- addr.Port = 1024 + portRandomizer.Intn(60000)
- sshListener, err = c.ListenTCP(&addr)
- if err == nil {
- laddr.Port = addr.Port
- return sshListener, err
- }
- }
- return nil, fmt.Errorf("ssh: listen on random port failed after %d tries: %v", tries, err)
-}
-
-// RFC 4254 7.1
-type channelForwardMsg struct {
- addr string
- rport uint32
-}
-
-// ListenTCP requests the remote peer open a listening socket
-// on laddr. Incoming connections will be available by calling
-// Accept on the returned net.Listener.
-func (c *Client) ListenTCP(laddr *net.TCPAddr) (net.Listener, error) {
- if laddr.Port == 0 && isBrokenOpenSSHVersion(string(c.ServerVersion())) {
- return c.autoPortListenWorkaround(laddr)
- }
-
- m := channelForwardMsg{
- laddr.IP.String(),
- uint32(laddr.Port),
- }
- // send message
- ok, resp, err := c.SendRequest("tcpip-forward", true, Marshal(&m))
- if err != nil {
- return nil, err
- }
- if !ok {
- return nil, errors.New("ssh: tcpip-forward request denied by peer")
- }
-
- // If the original port was 0, then the remote side will
- // supply a real port number in the response.
- if laddr.Port == 0 {
- var p struct {
- Port uint32
- }
- if err := Unmarshal(resp, &p); err != nil {
- return nil, err
- }
- laddr.Port = int(p.Port)
- }
-
- // Register this forward, using the port number we obtained.
- ch := c.forwards.add(*laddr)
-
- return &tcpListener{laddr, c, ch}, nil
-}
-
-// forwardList stores a mapping between remote
-// forward requests and the tcpListeners.
-type forwardList struct {
- sync.Mutex
- entries []forwardEntry
-}
-
-// forwardEntry represents an established mapping of a laddr on a
-// remote ssh server to a channel connected to a tcpListener.
-type forwardEntry struct {
- laddr net.TCPAddr
- c chan forward
-}
-
-// forward represents an incoming forwarded tcpip connection. The
-// arguments to add/remove/lookup should be address as specified in
-// the original forward-request.
-type forward struct {
- newCh NewChannel // the ssh client channel underlying this forward
- raddr *net.TCPAddr // the raddr of the incoming connection
-}
-
-func (l *forwardList) add(addr net.TCPAddr) chan forward {
- l.Lock()
- defer l.Unlock()
- f := forwardEntry{
- addr,
- make(chan forward, 1),
- }
- l.entries = append(l.entries, f)
- return f.c
-}
-
-// See RFC 4254, section 7.2
-type forwardedTCPPayload struct {
- Addr string
- Port uint32
- OriginAddr string
- OriginPort uint32
-}
-
-// parseTCPAddr parses the originating address from the remote into a *net.TCPAddr.
-func parseTCPAddr(addr string, port uint32) (*net.TCPAddr, error) {
- if port == 0 || port > 65535 {
- return nil, fmt.Errorf("ssh: port number out of range: %d", port)
- }
- ip := net.ParseIP(string(addr))
- if ip == nil {
- return nil, fmt.Errorf("ssh: cannot parse IP address %q", addr)
- }
- return &net.TCPAddr{IP: ip, Port: int(port)}, nil
-}
-
-func (l *forwardList) handleChannels(in <-chan NewChannel) {
- for ch := range in {
- var payload forwardedTCPPayload
- if err := Unmarshal(ch.ExtraData(), &payload); err != nil {
- ch.Reject(ConnectionFailed, "could not parse forwarded-tcpip payload: "+err.Error())
- continue
- }
-
- // RFC 4254 section 7.2 specifies that incoming
- // addresses should list the address, in string
- // format. It is implied that this should be an IP
- // address, as it would be impossible to connect to it
- // otherwise.
- laddr, err := parseTCPAddr(payload.Addr, payload.Port)
- if err != nil {
- ch.Reject(ConnectionFailed, err.Error())
- continue
- }
- raddr, err := parseTCPAddr(payload.OriginAddr, payload.OriginPort)
- if err != nil {
- ch.Reject(ConnectionFailed, err.Error())
- continue
- }
-
- if ok := l.forward(*laddr, *raddr, ch); !ok {
- // Section 7.2, implementations MUST reject spurious incoming
- // connections.
- ch.Reject(Prohibited, "no forward for address")
- continue
- }
- }
-}
-
-// remove removes the forward entry, and the channel feeding its
-// listener.
-func (l *forwardList) remove(addr net.TCPAddr) {
- l.Lock()
- defer l.Unlock()
- for i, f := range l.entries {
- if addr.IP.Equal(f.laddr.IP) && addr.Port == f.laddr.Port {
- l.entries = append(l.entries[:i], l.entries[i+1:]...)
- close(f.c)
- return
- }
- }
-}
-
-// closeAll closes and clears all forwards.
-func (l *forwardList) closeAll() {
- l.Lock()
- defer l.Unlock()
- for _, f := range l.entries {
- close(f.c)
- }
- l.entries = nil
-}
-
-func (l *forwardList) forward(laddr, raddr net.TCPAddr, ch NewChannel) bool {
- l.Lock()
- defer l.Unlock()
- for _, f := range l.entries {
- if laddr.IP.Equal(f.laddr.IP) && laddr.Port == f.laddr.Port {
- f.c <- forward{ch, &raddr}
- return true
- }
- }
- return false
-}
-
-type tcpListener struct {
- laddr *net.TCPAddr
-
- conn *Client
- in <-chan forward
-}
-
-// Accept waits for and returns the next connection to the listener.
-func (l *tcpListener) Accept() (net.Conn, error) {
- s, ok := <-l.in
- if !ok {
- return nil, io.EOF
- }
- ch, incoming, err := s.newCh.Accept()
- if err != nil {
- return nil, err
- }
- go DiscardRequests(incoming)
-
- return &tcpChanConn{
- Channel: ch,
- laddr: l.laddr,
- raddr: s.raddr,
- }, nil
-}
-
-// Close closes the listener.
-func (l *tcpListener) Close() error {
- m := channelForwardMsg{
- l.laddr.IP.String(),
- uint32(l.laddr.Port),
- }
-
- // this also closes the listener.
- l.conn.forwards.remove(*l.laddr)
- ok, _, err := l.conn.SendRequest("cancel-tcpip-forward", true, Marshal(&m))
- if err == nil && !ok {
- err = errors.New("ssh: cancel-tcpip-forward failed")
- }
- return err
-}
-
-// Addr returns the listener's network address.
-func (l *tcpListener) Addr() net.Addr {
- return l.laddr
-}
-
-// Dial initiates a connection to the addr from the remote host.
-// The resulting connection has a zero LocalAddr() and RemoteAddr().
-func (c *Client) Dial(n, addr string) (net.Conn, error) {
- // Parse the address into host and numeric port.
- host, portString, err := net.SplitHostPort(addr)
- if err != nil {
- return nil, err
- }
- port, err := strconv.ParseUint(portString, 10, 16)
- if err != nil {
- return nil, err
- }
- // Use a zero address for local and remote address.
- zeroAddr := &net.TCPAddr{
- IP: net.IPv4zero,
- Port: 0,
- }
- ch, err := c.dial(net.IPv4zero.String(), 0, host, int(port))
- if err != nil {
- return nil, err
- }
- return &tcpChanConn{
- Channel: ch,
- laddr: zeroAddr,
- raddr: zeroAddr,
- }, nil
-}
-
-// DialTCP connects to the remote address raddr on the network net,
-// which must be "tcp", "tcp4", or "tcp6". If laddr is not nil, it is used
-// as the local address for the connection.
-func (c *Client) DialTCP(n string, laddr, raddr *net.TCPAddr) (net.Conn, error) {
- if laddr == nil {
- laddr = &net.TCPAddr{
- IP: net.IPv4zero,
- Port: 0,
- }
- }
- ch, err := c.dial(laddr.IP.String(), laddr.Port, raddr.IP.String(), raddr.Port)
- if err != nil {
- return nil, err
- }
- return &tcpChanConn{
- Channel: ch,
- laddr: laddr,
- raddr: raddr,
- }, nil
-}
-
-// RFC 4254 7.2
-type channelOpenDirectMsg struct {
- raddr string
- rport uint32
- laddr string
- lport uint32
-}
-
-func (c *Client) dial(laddr string, lport int, raddr string, rport int) (Channel, error) {
- msg := channelOpenDirectMsg{
- raddr: raddr,
- rport: uint32(rport),
- laddr: laddr,
- lport: uint32(lport),
- }
- ch, in, err := c.OpenChannel("direct-tcpip", Marshal(&msg))
- if err != nil {
- return nil, err
- }
- go DiscardRequests(in)
- return ch, err
-}
-
-type tcpChan struct {
- Channel // the backing channel
-}
-
-// tcpChanConn fulfills the net.Conn interface without
-// the tcpChan having to hold laddr or raddr directly.
-type tcpChanConn struct {
- Channel
- laddr, raddr net.Addr
-}
-
-// LocalAddr returns the local network address.
-func (t *tcpChanConn) LocalAddr() net.Addr {
- return t.laddr
-}
-
-// RemoteAddr returns the remote network address.
-func (t *tcpChanConn) RemoteAddr() net.Addr {
- return t.raddr
-}
-
-// SetDeadline sets the read and write deadlines associated
-// with the connection.
-func (t *tcpChanConn) SetDeadline(deadline time.Time) error {
- if err := t.SetReadDeadline(deadline); err != nil {
- return err
- }
- return t.SetWriteDeadline(deadline)
-}
-
-// SetReadDeadline sets the read deadline.
-// A zero value for t means Read will not time out.
-// After the deadline, the error from Read will implement net.Error
-// with Timeout() == true.
-func (t *tcpChanConn) SetReadDeadline(deadline time.Time) error {
- return errors.New("ssh: tcpChan: deadline not supported")
-}
-
-// SetWriteDeadline exists to satisfy the net.Conn interface
-// but is not implemented by this type. It always returns an error.
-func (t *tcpChanConn) SetWriteDeadline(deadline time.Time) error {
- return errors.New("ssh: tcpChan: deadline not supported")
-}
diff --git a/vendor/golang.org/x/crypto/ssh/transport.go b/vendor/golang.org/x/crypto/ssh/transport.go
deleted file mode 100644
index 8351d378..00000000
--- a/vendor/golang.org/x/crypto/ssh/transport.go
+++ /dev/null
@@ -1,332 +0,0 @@
-// Copyright 2011 The Go Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style
-// license that can be found in the LICENSE file.
-
-package ssh
-
-import (
- "bufio"
- "errors"
- "io"
-)
-
-const (
- gcmCipherID = "aes128-gcm@openssh.com"
- aes128cbcID = "aes128-cbc"
-)
-
-// packetConn represents a transport that implements packet based
-// operations.
-type packetConn interface {
- // Encrypt and send a packet of data to the remote peer.
- writePacket(packet []byte) error
-
- // Read a packet from the connection
- readPacket() ([]byte, error)
-
- // Close closes the write-side of the connection.
- Close() error
-}
-
-// transport is the keyingTransport that implements the SSH packet
-// protocol.
-type transport struct {
- reader connectionState
- writer connectionState
-
- bufReader *bufio.Reader
- bufWriter *bufio.Writer
- rand io.Reader
-
- io.Closer
-
- // Initial H used for the session ID. Once assigned this does
- // not change, even during subsequent key exchanges.
- sessionID []byte
-}
-
-// getSessionID returns the ID of the SSH connection. The return value
-// should not be modified.
-func (t *transport) getSessionID() []byte {
- if t.sessionID == nil {
- panic("session ID not set yet")
- }
- return t.sessionID
-}
-
-// packetCipher represents a combination of SSH encryption/MAC
-// protocol. A single instance should be used for one direction only.
-type packetCipher interface {
- // writePacket encrypts the packet and writes it to w. The
- // contents of the packet are generally scrambled.
- writePacket(seqnum uint32, w io.Writer, rand io.Reader, packet []byte) error
-
- // readPacket reads and decrypts a packet of data. The
- // returned packet may be overwritten by future calls of
- // readPacket.
- readPacket(seqnum uint32, r io.Reader) ([]byte, error)
-}
-
-// connectionState represents one side (read or write) of the
-// connection. This is necessary because each direction has its own
-// keys, and can even have its own algorithms
-type connectionState struct {
- packetCipher
- seqNum uint32
- dir direction
- pendingKeyChange chan packetCipher
-}
-
-// prepareKeyChange sets up key material for a keychange. The key changes in
-// both directions are triggered by reading and writing a msgNewKey packet
-// respectively.
-func (t *transport) prepareKeyChange(algs *algorithms, kexResult *kexResult) error {
- if t.sessionID == nil {
- t.sessionID = kexResult.H
- }
-
- kexResult.SessionID = t.sessionID
-
- if ciph, err := newPacketCipher(t.reader.dir, algs.r, kexResult); err != nil {
- return err
- } else {
- t.reader.pendingKeyChange <- ciph
- }
-
- if ciph, err := newPacketCipher(t.writer.dir, algs.w, kexResult); err != nil {
- return err
- } else {
- t.writer.pendingKeyChange <- ciph
- }
-
- return nil
-}
-
-// Read and decrypt next packet.
-func (t *transport) readPacket() ([]byte, error) {
- return t.reader.readPacket(t.bufReader)
-}
-
-func (s *connectionState) readPacket(r *bufio.Reader) ([]byte, error) {
- packet, err := s.packetCipher.readPacket(s.seqNum, r)
- s.seqNum++
- if err == nil && len(packet) == 0 {
- err = errors.New("ssh: zero length packet")
- }
-
- if len(packet) > 0 && packet[0] == msgNewKeys {
- select {
- case cipher := <-s.pendingKeyChange:
- s.packetCipher = cipher
- default:
- return nil, errors.New("ssh: got bogus newkeys message.")
- }
- }
-
- // The packet may point to an internal buffer, so copy the
- // packet out here.
- fresh := make([]byte, len(packet))
- copy(fresh, packet)
-
- return fresh, err
-}
-
-func (t *transport) writePacket(packet []byte) error {
- return t.writer.writePacket(t.bufWriter, t.rand, packet)
-}
-
-func (s *connectionState) writePacket(w *bufio.Writer, rand io.Reader, packet []byte) error {
- changeKeys := len(packet) > 0 && packet[0] == msgNewKeys
-
- err := s.packetCipher.writePacket(s.seqNum, w, rand, packet)
- if err != nil {
- return err
- }
- if err = w.Flush(); err != nil {
- return err
- }
- s.seqNum++
- if changeKeys {
- select {
- case cipher := <-s.pendingKeyChange:
- s.packetCipher = cipher
- default:
- panic("ssh: no key material for msgNewKeys")
- }
- }
- return err
-}
-
-func newTransport(rwc io.ReadWriteCloser, rand io.Reader, isClient bool) *transport {
- t := &transport{
- bufReader: bufio.NewReader(rwc),
- bufWriter: bufio.NewWriter(rwc),
- rand: rand,
- reader: connectionState{
- packetCipher: &streamPacketCipher{cipher: noneCipher{}},
- pendingKeyChange: make(chan packetCipher, 1),
- },
- writer: connectionState{
- packetCipher: &streamPacketCipher{cipher: noneCipher{}},
- pendingKeyChange: make(chan packetCipher, 1),
- },
- Closer: rwc,
- }
- if isClient {
- t.reader.dir = serverKeys
- t.writer.dir = clientKeys
- } else {
- t.reader.dir = clientKeys
- t.writer.dir = serverKeys
- }
-
- return t
-}
-
-type direction struct {
- ivTag []byte
- keyTag []byte
- macKeyTag []byte
-}
-
-var (
- serverKeys = direction{[]byte{'B'}, []byte{'D'}, []byte{'F'}}
- clientKeys = direction{[]byte{'A'}, []byte{'C'}, []byte{'E'}}
-)
-
-// generateKeys generates key material for IV, MAC and encryption.
-func generateKeys(d direction, algs directionAlgorithms, kex *kexResult) (iv, key, macKey []byte) {
- cipherMode := cipherModes[algs.Cipher]
- macMode := macModes[algs.MAC]
-
- iv = make([]byte, cipherMode.ivSize)
- key = make([]byte, cipherMode.keySize)
- macKey = make([]byte, macMode.keySize)
-
- generateKeyMaterial(iv, d.ivTag, kex)
- generateKeyMaterial(key, d.keyTag, kex)
- generateKeyMaterial(macKey, d.macKeyTag, kex)
- return
-}
-
-// setupKeys sets the cipher and MAC keys from kex.K, kex.H and sessionId, as
-// described in RFC 4253, section 6.4. direction should either be serverKeys
-// (to setup server->client keys) or clientKeys (for client->server keys).
-func newPacketCipher(d direction, algs directionAlgorithms, kex *kexResult) (packetCipher, error) {
- iv, key, macKey := generateKeys(d, algs, kex)
-
- if algs.Cipher == gcmCipherID {
- return newGCMCipher(iv, key, macKey)
- }
-
- if algs.Cipher == aes128cbcID {
- return newAESCBCCipher(iv, key, macKey, algs)
- }
-
- c := &streamPacketCipher{
- mac: macModes[algs.MAC].new(macKey),
- }
- c.macResult = make([]byte, c.mac.Size())
-
- var err error
- c.cipher, err = cipherModes[algs.Cipher].createStream(key, iv)
- if err != nil {
- return nil, err
- }
-
- return c, nil
-}
-
-// generateKeyMaterial fills out with key material generated from tag, K, H
-// and sessionId, as specified in RFC 4253, section 7.2.
-func generateKeyMaterial(out, tag []byte, r *kexResult) {
- var digestsSoFar []byte
-
- h := r.Hash.New()
- for len(out) > 0 {
- h.Reset()
- h.Write(r.K)
- h.Write(r.H)
-
- if len(digestsSoFar) == 0 {
- h.Write(tag)
- h.Write(r.SessionID)
- } else {
- h.Write(digestsSoFar)
- }
-
- digest := h.Sum(nil)
- n := copy(out, digest)
- out = out[n:]
- if len(out) > 0 {
- digestsSoFar = append(digestsSoFar, digest...)
- }
- }
-}
-
-const packageVersion = "SSH-2.0-Go"
-
-// Sends and receives a version line. The versionLine string should
-// be US ASCII, start with "SSH-2.0-", and should not include a
-// newline. exchangeVersions returns the other side's version line.
-func exchangeVersions(rw io.ReadWriter, versionLine []byte) (them []byte, err error) {
- // Contrary to the RFC, we do not ignore lines that don't
- // start with "SSH-2.0-" to make the library usable with
- // nonconforming servers.
- for _, c := range versionLine {
- // The spec disallows non US-ASCII chars, and
- // specifically forbids null chars.
- if c < 32 {
- return nil, errors.New("ssh: junk character in version line")
- }
- }
- if _, err = rw.Write(append(versionLine, '\r', '\n')); err != nil {
- return
- }
-
- them, err = readVersion(rw)
- return them, err
-}
-
-// maxVersionStringBytes is the maximum number of bytes that we'll
-// accept as a version string. RFC 4253 section 4.2 limits this at 255
-// chars
-const maxVersionStringBytes = 255
-
-// Read version string as specified by RFC 4253, section 4.2.
-func readVersion(r io.Reader) ([]byte, error) {
- versionString := make([]byte, 0, 64)
- var ok bool
- var buf [1]byte
-
- for len(versionString) < maxVersionStringBytes {
- _, err := io.ReadFull(r, buf[:])
- if err != nil {
- return nil, err
- }
- // The RFC says that the version should be terminated with \r\n
- // but several SSH servers actually only send a \n.
- if buf[0] == '\n' {
- ok = true
- break
- }
-
- // non ASCII chars are disallowed, but we are lenient,
- // since Go doesn't use null-terminated strings.
-
- // The RFC allows a comment after a space, however,
- // all of it (version and comments) goes into the
- // session hash.
- versionString = append(versionString, buf[0])
- }
-
- if !ok {
- return nil, errors.New("ssh: overflow reading version string")
- }
-
- // There might be a '\r' on the end which we should remove.
- if len(versionString) > 0 && versionString[len(versionString)-1] == '\r' {
- versionString = versionString[:len(versionString)-1]
- }
- return versionString, nil
-}
diff --git a/vendor/golang.org/x/sys/LICENSE b/vendor/golang.org/x/sys/LICENSE
deleted file mode 100644
index 6a66aea5..00000000
--- a/vendor/golang.org/x/sys/LICENSE
+++ /dev/null
@@ -1,27 +0,0 @@
-Copyright (c) 2009 The Go Authors. All rights reserved.
-
-Redistribution and use in source and binary forms, with or without
-modification, are permitted provided that the following conditions are
-met:
-
- * Redistributions of source code must retain the above copyright
-notice, this list of conditions and the following disclaimer.
- * Redistributions in binary form must reproduce the above
-copyright notice, this list of conditions and the following disclaimer
-in the documentation and/or other materials provided with the
-distribution.
- * Neither the name of Google Inc. nor the names of its
-contributors may be used to endorse or promote products derived from
-this software without specific prior written permission.
-
-THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
diff --git a/vendor/golang.org/x/sys/PATENTS b/vendor/golang.org/x/sys/PATENTS
deleted file mode 100644
index 73309904..00000000
--- a/vendor/golang.org/x/sys/PATENTS
+++ /dev/null
@@ -1,22 +0,0 @@
-Additional IP Rights Grant (Patents)
-
-"This implementation" means the copyrightable works distributed by
-Google as part of the Go project.
-
-Google hereby grants to You a perpetual, worldwide, non-exclusive,
-no-charge, royalty-free, irrevocable (except as stated in this section)
-patent license to make, have made, use, offer to sell, sell, import,
-transfer and otherwise run, modify and propagate the contents of this
-implementation of Go, where such license applies only to those patent
-claims, both currently owned or controlled by Google and acquired in
-the future, licensable by Google that are necessarily infringed by this
-implementation of Go. This grant does not include claims that would be
-infringed only as a consequence of further modification of this
-implementation. If you or your agent or exclusive licensee institute or
-order or agree to the institution of patent litigation against any
-entity (including a cross-claim or counterclaim in a lawsuit) alleging
-that this implementation of Go or any code incorporated within this
-implementation of Go constitutes direct or contributory patent
-infringement, or inducement of patent infringement, then any patent
-rights granted to you under this License for this implementation of Go
-shall terminate as of the date such litigation is filed.
diff --git a/vendor/golang.org/x/sys/unix/.gitignore b/vendor/golang.org/x/sys/unix/.gitignore
deleted file mode 100644
index e4827159..00000000
--- a/vendor/golang.org/x/sys/unix/.gitignore
+++ /dev/null
@@ -1 +0,0 @@
-_obj/
diff --git a/vendor/golang.org/x/sys/unix/asm.s b/vendor/golang.org/x/sys/unix/asm.s
deleted file mode 100644
index 8ed2fdb9..00000000
--- a/vendor/golang.org/x/sys/unix/asm.s
+++ /dev/null
@@ -1,10 +0,0 @@
-// Copyright 2014 The Go Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style
-// license that can be found in the LICENSE file.
-
-// +build !gccgo
-
-#include "textflag.h"
-
-TEXT ·use(SB),NOSPLIT,$0
- RET
diff --git a/vendor/golang.org/x/sys/unix/asm_darwin_386.s b/vendor/golang.org/x/sys/unix/asm_darwin_386.s
deleted file mode 100644
index 8a727831..00000000
--- a/vendor/golang.org/x/sys/unix/asm_darwin_386.s
+++ /dev/null
@@ -1,29 +0,0 @@
-// Copyright 2009 The Go Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style
-// license that can be found in the LICENSE file.
-
-// +build !gccgo
-
-#include "textflag.h"
-
-//
-// System call support for 386, Darwin
-//
-
-// Just jump to package syscall's implementation for all these functions.
-// The runtime may know about them.
-
-TEXT ·Syscall(SB),NOSPLIT,$0-28
- JMP syscall·Syscall(SB)
-
-TEXT ·Syscall6(SB),NOSPLIT,$0-40
- JMP syscall·Syscall6(SB)
-
-TEXT ·Syscall9(SB),NOSPLIT,$0-52
- JMP syscall·Syscall9(SB)
-
-TEXT ·RawSyscall(SB),NOSPLIT,$0-28
- JMP syscall·RawSyscall(SB)
-
-TEXT ·RawSyscall6(SB),NOSPLIT,$0-40
- JMP syscall·RawSyscall6(SB)
diff --git a/vendor/golang.org/x/sys/unix/asm_darwin_amd64.s b/vendor/golang.org/x/sys/unix/asm_darwin_amd64.s
deleted file mode 100644
index 6321421f..00000000
--- a/vendor/golang.org/x/sys/unix/asm_darwin_amd64.s
+++ /dev/null
@@ -1,29 +0,0 @@
-// Copyright 2009 The Go Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style
-// license that can be found in the LICENSE file.
-
-// +build !gccgo
-
-#include "textflag.h"
-
-//
-// System call support for AMD64, Darwin
-//
-
-// Just jump to package syscall's implementation for all these functions.
-// The runtime may know about them.
-
-TEXT ·Syscall(SB),NOSPLIT,$0-56
- JMP syscall·Syscall(SB)
-
-TEXT ·Syscall6(SB),NOSPLIT,$0-80
- JMP syscall·Syscall6(SB)
-
-TEXT ·Syscall9(SB),NOSPLIT,$0-104
- JMP syscall·Syscall9(SB)
-
-TEXT ·RawSyscall(SB),NOSPLIT,$0-56
- JMP syscall·RawSyscall(SB)
-
-TEXT ·RawSyscall6(SB),NOSPLIT,$0-80
- JMP syscall·RawSyscall6(SB)
diff --git a/vendor/golang.org/x/sys/unix/asm_darwin_arm.s b/vendor/golang.org/x/sys/unix/asm_darwin_arm.s
deleted file mode 100644
index 333242d5..00000000
--- a/vendor/golang.org/x/sys/unix/asm_darwin_arm.s
+++ /dev/null
@@ -1,30 +0,0 @@
-// Copyright 2015 The Go Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style
-// license that can be found in the LICENSE file.
-
-// +build !gccgo
-// +build arm,darwin
-
-#include "textflag.h"
-
-//
-// System call support for ARM, Darwin
-//
-
-// Just jump to package syscall's implementation for all these functions.
-// The runtime may know about them.
-
-TEXT ·Syscall(SB),NOSPLIT,$0-28
- B syscall·Syscall(SB)
-
-TEXT ·Syscall6(SB),NOSPLIT,$0-40
- B syscall·Syscall6(SB)
-
-TEXT ·Syscall9(SB),NOSPLIT,$0-52
- B syscall·Syscall9(SB)
-
-TEXT ·RawSyscall(SB),NOSPLIT,$0-28
- B syscall·RawSyscall(SB)
-
-TEXT ·RawSyscall6(SB),NOSPLIT,$0-40
- B syscall·RawSyscall6(SB)
diff --git a/vendor/golang.org/x/sys/unix/asm_darwin_arm64.s b/vendor/golang.org/x/sys/unix/asm_darwin_arm64.s
deleted file mode 100644
index 97e01743..00000000
--- a/vendor/golang.org/x/sys/unix/asm_darwin_arm64.s
+++ /dev/null
@@ -1,30 +0,0 @@
-// Copyright 2015 The Go Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style
-// license that can be found in the LICENSE file.
-
-// +build !gccgo
-// +build arm64,darwin
-
-#include "textflag.h"
-
-//
-// System call support for AMD64, Darwin
-//
-
-// Just jump to package syscall's implementation for all these functions.
-// The runtime may know about them.
-
-TEXT ·Syscall(SB),NOSPLIT,$0-56
- B syscall·Syscall(SB)
-
-TEXT ·Syscall6(SB),NOSPLIT,$0-80
- B syscall·Syscall6(SB)
-
-TEXT ·Syscall9(SB),NOSPLIT,$0-104
- B syscall·Syscall9(SB)
-
-TEXT ·RawSyscall(SB),NOSPLIT,$0-56
- B syscall·RawSyscall(SB)
-
-TEXT ·RawSyscall6(SB),NOSPLIT,$0-80
- B syscall·RawSyscall6(SB)
diff --git a/vendor/golang.org/x/sys/unix/asm_dragonfly_386.s b/vendor/golang.org/x/sys/unix/asm_dragonfly_386.s
deleted file mode 100644
index 7e55e0d3..00000000
--- a/vendor/golang.org/x/sys/unix/asm_dragonfly_386.s
+++ /dev/null
@@ -1,29 +0,0 @@
-// Copyright 2009 The Go Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style
-// license that can be found in the LICENSE file.
-
-// +build !gccgo
-
-#include "textflag.h"
-
-//
-// System call support for 386, FreeBSD
-//
-
-// Just jump to package syscall's implementation for all these functions.
-// The runtime may know about them.
-
-TEXT ·Syscall(SB),NOSPLIT,$0-32
- JMP syscall·Syscall(SB)
-
-TEXT ·Syscall6(SB),NOSPLIT,$0-44
- JMP syscall·Syscall6(SB)
-
-TEXT ·Syscall9(SB),NOSPLIT,$0-56
- JMP syscall·Syscall9(SB)
-
-TEXT ·RawSyscall(SB),NOSPLIT,$0-32
- JMP syscall·RawSyscall(SB)
-
-TEXT ·RawSyscall6(SB),NOSPLIT,$0-44
- JMP syscall·RawSyscall6(SB)
diff --git a/vendor/golang.org/x/sys/unix/asm_dragonfly_amd64.s b/vendor/golang.org/x/sys/unix/asm_dragonfly_amd64.s
deleted file mode 100644
index d5ed6726..00000000
--- a/vendor/golang.org/x/sys/unix/asm_dragonfly_amd64.s
+++ /dev/null
@@ -1,29 +0,0 @@
-// Copyright 2009 The Go Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style
-// license that can be found in the LICENSE file.
-
-// +build !gccgo
-
-#include "textflag.h"
-
-//
-// System call support for AMD64, DragonFly
-//
-
-// Just jump to package syscall's implementation for all these functions.
-// The runtime may know about them.
-
-TEXT ·Syscall(SB),NOSPLIT,$0-64
- JMP syscall·Syscall(SB)
-
-TEXT ·Syscall6(SB),NOSPLIT,$0-88
- JMP syscall·Syscall6(SB)
-
-TEXT ·Syscall9(SB),NOSPLIT,$0-112
- JMP syscall·Syscall9(SB)
-
-TEXT ·RawSyscall(SB),NOSPLIT,$0-64
- JMP syscall·RawSyscall(SB)
-
-TEXT ·RawSyscall6(SB),NOSPLIT,$0-88
- JMP syscall·RawSyscall6(SB)
diff --git a/vendor/golang.org/x/sys/unix/asm_freebsd_386.s b/vendor/golang.org/x/sys/unix/asm_freebsd_386.s
deleted file mode 100644
index c9a0a260..00000000
--- a/vendor/golang.org/x/sys/unix/asm_freebsd_386.s
+++ /dev/null
@@ -1,29 +0,0 @@
-// Copyright 2009 The Go Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style
-// license that can be found in the LICENSE file.
-
-// +build !gccgo
-
-#include "textflag.h"
-
-//
-// System call support for 386, FreeBSD
-//
-
-// Just jump to package syscall's implementation for all these functions.
-// The runtime may know about them.
-
-TEXT ·Syscall(SB),NOSPLIT,$0-28
- JMP syscall·Syscall(SB)
-
-TEXT ·Syscall6(SB),NOSPLIT,$0-40
- JMP syscall·Syscall6(SB)
-
-TEXT ·Syscall9(SB),NOSPLIT,$0-52
- JMP syscall·Syscall9(SB)
-
-TEXT ·RawSyscall(SB),NOSPLIT,$0-28
- JMP syscall·RawSyscall(SB)
-
-TEXT ·RawSyscall6(SB),NOSPLIT,$0-40
- JMP syscall·RawSyscall6(SB)
diff --git a/vendor/golang.org/x/sys/unix/asm_freebsd_amd64.s b/vendor/golang.org/x/sys/unix/asm_freebsd_amd64.s
deleted file mode 100644
index 35172477..00000000
--- a/vendor/golang.org/x/sys/unix/asm_freebsd_amd64.s
+++ /dev/null
@@ -1,29 +0,0 @@
-// Copyright 2009 The Go Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style
-// license that can be found in the LICENSE file.
-
-// +build !gccgo
-
-#include "textflag.h"
-
-//
-// System call support for AMD64, FreeBSD
-//
-
-// Just jump to package syscall's implementation for all these functions.
-// The runtime may know about them.
-
-TEXT ·Syscall(SB),NOSPLIT,$0-56
- JMP syscall·Syscall(SB)
-
-TEXT ·Syscall6(SB),NOSPLIT,$0-80
- JMP syscall·Syscall6(SB)
-
-TEXT ·Syscall9(SB),NOSPLIT,$0-104
- JMP syscall·Syscall9(SB)
-
-TEXT ·RawSyscall(SB),NOSPLIT,$0-56
- JMP syscall·RawSyscall(SB)
-
-TEXT ·RawSyscall6(SB),NOSPLIT,$0-80
- JMP syscall·RawSyscall6(SB)
diff --git a/vendor/golang.org/x/sys/unix/asm_freebsd_arm.s b/vendor/golang.org/x/sys/unix/asm_freebsd_arm.s
deleted file mode 100644
index 9227c875..00000000
--- a/vendor/golang.org/x/sys/unix/asm_freebsd_arm.s
+++ /dev/null
@@ -1,29 +0,0 @@
-// Copyright 2012 The Go Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style
-// license that can be found in the LICENSE file.
-
-// +build !gccgo
-
-#include "textflag.h"
-
-//
-// System call support for ARM, FreeBSD
-//
-
-// Just jump to package syscall's implementation for all these functions.
-// The runtime may know about them.
-
-TEXT ·Syscall(SB),NOSPLIT,$0-28
- B syscall·Syscall(SB)
-
-TEXT ·Syscall6(SB),NOSPLIT,$0-40
- B syscall·Syscall6(SB)
-
-TEXT ·Syscall9(SB),NOSPLIT,$0-52
- B syscall·Syscall9(SB)
-
-TEXT ·RawSyscall(SB),NOSPLIT,$0-28
- B syscall·RawSyscall(SB)
-
-TEXT ·RawSyscall6(SB),NOSPLIT,$0-40
- B syscall·RawSyscall6(SB)
diff --git a/vendor/golang.org/x/sys/unix/asm_linux_386.s b/vendor/golang.org/x/sys/unix/asm_linux_386.s
deleted file mode 100644
index 4db29093..00000000
--- a/vendor/golang.org/x/sys/unix/asm_linux_386.s
+++ /dev/null
@@ -1,35 +0,0 @@
-// Copyright 2009 The Go Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style
-// license that can be found in the LICENSE file.
-
-// +build !gccgo
-
-#include "textflag.h"
-
-//
-// System calls for 386, Linux
-//
-
-// Just jump to package syscall's implementation for all these functions.
-// The runtime may know about them.
-
-TEXT ·Syscall(SB),NOSPLIT,$0-28
- JMP syscall·Syscall(SB)
-
-TEXT ·Syscall6(SB),NOSPLIT,$0-40
- JMP syscall·Syscall6(SB)
-
-TEXT ·RawSyscall(SB),NOSPLIT,$0-28
- JMP syscall·RawSyscall(SB)
-
-TEXT ·RawSyscall6(SB),NOSPLIT,$0-40
- JMP syscall·RawSyscall6(SB)
-
-TEXT ·socketcall(SB),NOSPLIT,$0-36
- JMP syscall·socketcall(SB)
-
-TEXT ·rawsocketcall(SB),NOSPLIT,$0-36
- JMP syscall·rawsocketcall(SB)
-
-TEXT ·seek(SB),NOSPLIT,$0-28
- JMP syscall·seek(SB)
diff --git a/vendor/golang.org/x/sys/unix/asm_linux_amd64.s b/vendor/golang.org/x/sys/unix/asm_linux_amd64.s
deleted file mode 100644
index 44e25c62..00000000
--- a/vendor/golang.org/x/sys/unix/asm_linux_amd64.s
+++ /dev/null
@@ -1,29 +0,0 @@
-// Copyright 2009 The Go Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style
-// license that can be found in the LICENSE file.
-
-// +build !gccgo
-
-#include "textflag.h"
-
-//
-// System calls for AMD64, Linux
-//
-
-// Just jump to package syscall's implementation for all these functions.
-// The runtime may know about them.
-
-TEXT ·Syscall(SB),NOSPLIT,$0-56
- JMP syscall·Syscall(SB)
-
-TEXT ·Syscall6(SB),NOSPLIT,$0-80
- JMP syscall·Syscall6(SB)
-
-TEXT ·RawSyscall(SB),NOSPLIT,$0-56
- JMP syscall·RawSyscall(SB)
-
-TEXT ·RawSyscall6(SB),NOSPLIT,$0-80
- JMP syscall·RawSyscall6(SB)
-
-TEXT ·gettimeofday(SB),NOSPLIT,$0-16
- JMP syscall·gettimeofday(SB)
diff --git a/vendor/golang.org/x/sys/unix/asm_linux_arm.s b/vendor/golang.org/x/sys/unix/asm_linux_arm.s
deleted file mode 100644
index cf0b5746..00000000
--- a/vendor/golang.org/x/sys/unix/asm_linux_arm.s
+++ /dev/null
@@ -1,29 +0,0 @@
-// Copyright 2009 The Go Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style
-// license that can be found in the LICENSE file.
-
-// +build !gccgo
-
-#include "textflag.h"
-
-//
-// System calls for arm, Linux
-//
-
-// Just jump to package syscall's implementation for all these functions.
-// The runtime may know about them.
-
-TEXT ·Syscall(SB),NOSPLIT,$0-28
- B syscall·Syscall(SB)
-
-TEXT ·Syscall6(SB),NOSPLIT,$0-40
- B syscall·Syscall6(SB)
-
-TEXT ·RawSyscall(SB),NOSPLIT,$0-28
- B syscall·RawSyscall(SB)
-
-TEXT ·RawSyscall6(SB),NOSPLIT,$0-40
- B syscall·RawSyscall6(SB)
-
-TEXT ·seek(SB),NOSPLIT,$0-32
- B syscall·seek(SB)
diff --git a/vendor/golang.org/x/sys/unix/asm_linux_arm64.s b/vendor/golang.org/x/sys/unix/asm_linux_arm64.s
deleted file mode 100644
index 4be9bfed..00000000
--- a/vendor/golang.org/x/sys/unix/asm_linux_arm64.s
+++ /dev/null
@@ -1,24 +0,0 @@
-// Copyright 2015 The Go Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style
-// license that can be found in the LICENSE file.
-
-// +build linux
-// +build arm64
-// +build !gccgo
-
-#include "textflag.h"
-
-// Just jump to package syscall's implementation for all these functions.
-// The runtime may know about them.
-
-TEXT ·Syscall(SB),NOSPLIT,$0-56
- B syscall·Syscall(SB)
-
-TEXT ·Syscall6(SB),NOSPLIT,$0-80
- B syscall·Syscall6(SB)
-
-TEXT ·RawSyscall(SB),NOSPLIT,$0-56
- B syscall·RawSyscall(SB)
-
-TEXT ·RawSyscall6(SB),NOSPLIT,$0-80
- B syscall·RawSyscall6(SB)
diff --git a/vendor/golang.org/x/sys/unix/asm_linux_ppc64x.s b/vendor/golang.org/x/sys/unix/asm_linux_ppc64x.s
deleted file mode 100644
index 8d231feb..00000000
--- a/vendor/golang.org/x/sys/unix/asm_linux_ppc64x.s
+++ /dev/null
@@ -1,28 +0,0 @@
-// Copyright 2014 The Go Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style
-// license that can be found in the LICENSE file.
-
-// +build linux
-// +build ppc64 ppc64le
-// +build !gccgo
-
-#include "textflag.h"
-
-//
-// System calls for ppc64, Linux
-//
-
-// Just jump to package syscall's implementation for all these functions.
-// The runtime may know about them.
-
-TEXT ·Syscall(SB),NOSPLIT,$0-56
- BR syscall·Syscall(SB)
-
-TEXT ·Syscall6(SB),NOSPLIT,$0-80
- BR syscall·Syscall6(SB)
-
-TEXT ·RawSyscall(SB),NOSPLIT,$0-56
- BR syscall·RawSyscall(SB)
-
-TEXT ·RawSyscall6(SB),NOSPLIT,$0-80
- BR syscall·RawSyscall6(SB)
diff --git a/vendor/golang.org/x/sys/unix/asm_netbsd_386.s b/vendor/golang.org/x/sys/unix/asm_netbsd_386.s
deleted file mode 100644
index 48bdcd76..00000000
--- a/vendor/golang.org/x/sys/unix/asm_netbsd_386.s
+++ /dev/null
@@ -1,29 +0,0 @@
-// Copyright 2009 The Go Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style
-// license that can be found in the LICENSE file.
-
-// +build !gccgo
-
-#include "textflag.h"
-
-//
-// System call support for 386, NetBSD
-//
-
-// Just jump to package syscall's implementation for all these functions.
-// The runtime may know about them.
-
-TEXT ·Syscall(SB),NOSPLIT,$0-28
- JMP syscall·Syscall(SB)
-
-TEXT ·Syscall6(SB),NOSPLIT,$0-40
- JMP syscall·Syscall6(SB)
-
-TEXT ·Syscall9(SB),NOSPLIT,$0-52
- JMP syscall·Syscall9(SB)
-
-TEXT ·RawSyscall(SB),NOSPLIT,$0-28
- JMP syscall·RawSyscall(SB)
-
-TEXT ·RawSyscall6(SB),NOSPLIT,$0-40
- JMP syscall·RawSyscall6(SB)
diff --git a/vendor/golang.org/x/sys/unix/asm_netbsd_amd64.s b/vendor/golang.org/x/sys/unix/asm_netbsd_amd64.s
deleted file mode 100644
index 2ede05c7..00000000
--- a/vendor/golang.org/x/sys/unix/asm_netbsd_amd64.s
+++ /dev/null
@@ -1,29 +0,0 @@
-// Copyright 2009 The Go Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style
-// license that can be found in the LICENSE file.
-
-// +build !gccgo
-
-#include "textflag.h"
-
-//
-// System call support for AMD64, NetBSD
-//
-
-// Just jump to package syscall's implementation for all these functions.
-// The runtime may know about them.
-
-TEXT ·Syscall(SB),NOSPLIT,$0-56
- JMP syscall·Syscall(SB)
-
-TEXT ·Syscall6(SB),NOSPLIT,$0-80
- JMP syscall·Syscall6(SB)
-
-TEXT ·Syscall9(SB),NOSPLIT,$0-104
- JMP syscall·Syscall9(SB)
-
-TEXT ·RawSyscall(SB),NOSPLIT,$0-56
- JMP syscall·RawSyscall(SB)
-
-TEXT ·RawSyscall6(SB),NOSPLIT,$0-80
- JMP syscall·RawSyscall6(SB)
diff --git a/vendor/golang.org/x/sys/unix/asm_netbsd_arm.s b/vendor/golang.org/x/sys/unix/asm_netbsd_arm.s
deleted file mode 100644
index e8928571..00000000
--- a/vendor/golang.org/x/sys/unix/asm_netbsd_arm.s
+++ /dev/null
@@ -1,29 +0,0 @@
-// Copyright 2013 The Go Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style
-// license that can be found in the LICENSE file.
-
-// +build !gccgo
-
-#include "textflag.h"
-
-//
-// System call support for ARM, NetBSD
-//
-
-// Just jump to package syscall's implementation for all these functions.
-// The runtime may know about them.
-
-TEXT ·Syscall(SB),NOSPLIT,$0-28
- B syscall·Syscall(SB)
-
-TEXT ·Syscall6(SB),NOSPLIT,$0-40
- B syscall·Syscall6(SB)
-
-TEXT ·Syscall9(SB),NOSPLIT,$0-52
- B syscall·Syscall9(SB)
-
-TEXT ·RawSyscall(SB),NOSPLIT,$0-28
- B syscall·RawSyscall(SB)
-
-TEXT ·RawSyscall6(SB),NOSPLIT,$0-40
- B syscall·RawSyscall6(SB)
diff --git a/vendor/golang.org/x/sys/unix/asm_openbsd_386.s b/vendor/golang.org/x/sys/unix/asm_openbsd_386.s
deleted file mode 100644
index 00576f3c..00000000
--- a/vendor/golang.org/x/sys/unix/asm_openbsd_386.s
+++ /dev/null
@@ -1,29 +0,0 @@
-// Copyright 2009 The Go Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style
-// license that can be found in the LICENSE file.
-
-// +build !gccgo
-
-#include "textflag.h"
-
-//
-// System call support for 386, OpenBSD
-//
-
-// Just jump to package syscall's implementation for all these functions.
-// The runtime may know about them.
-
-TEXT ·Syscall(SB),NOSPLIT,$0-28
- JMP syscall·Syscall(SB)
-
-TEXT ·Syscall6(SB),NOSPLIT,$0-40
- JMP syscall·Syscall6(SB)
-
-TEXT ·Syscall9(SB),NOSPLIT,$0-52
- JMP syscall·Syscall9(SB)
-
-TEXT ·RawSyscall(SB),NOSPLIT,$0-28
- JMP syscall·RawSyscall(SB)
-
-TEXT ·RawSyscall6(SB),NOSPLIT,$0-40
- JMP syscall·RawSyscall6(SB)
diff --git a/vendor/golang.org/x/sys/unix/asm_openbsd_amd64.s b/vendor/golang.org/x/sys/unix/asm_openbsd_amd64.s
deleted file mode 100644
index 790ef77f..00000000
--- a/vendor/golang.org/x/sys/unix/asm_openbsd_amd64.s
+++ /dev/null
@@ -1,29 +0,0 @@
-// Copyright 2009 The Go Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style
-// license that can be found in the LICENSE file.
-
-// +build !gccgo
-
-#include "textflag.h"
-
-//
-// System call support for AMD64, OpenBSD
-//
-
-// Just jump to package syscall's implementation for all these functions.
-// The runtime may know about them.
-
-TEXT ·Syscall(SB),NOSPLIT,$0-56
- JMP syscall·Syscall(SB)
-
-TEXT ·Syscall6(SB),NOSPLIT,$0-80
- JMP syscall·Syscall6(SB)
-
-TEXT ·Syscall9(SB),NOSPLIT,$0-104
- JMP syscall·Syscall9(SB)
-
-TEXT ·RawSyscall(SB),NOSPLIT,$0-56
- JMP syscall·RawSyscall(SB)
-
-TEXT ·RawSyscall6(SB),NOSPLIT,$0-80
- JMP syscall·RawSyscall6(SB)
diff --git a/vendor/golang.org/x/sys/unix/asm_solaris_amd64.s b/vendor/golang.org/x/sys/unix/asm_solaris_amd64.s
deleted file mode 100644
index 43ed17a0..00000000
--- a/vendor/golang.org/x/sys/unix/asm_solaris_amd64.s
+++ /dev/null
@@ -1,17 +0,0 @@
-// Copyright 2014 The Go Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style
-// license that can be found in the LICENSE file.
-
-// +build !gccgo
-
-#include "textflag.h"
-
-//
-// System calls for amd64, Solaris are implemented in runtime/syscall_solaris.go
-//
-
-TEXT ·sysvicall6(SB),NOSPLIT,$0-64
- JMP syscall·sysvicall6(SB)
-
-TEXT ·rawSysvicall6(SB),NOSPLIT,$0-64
- JMP syscall·rawSysvicall6(SB)
diff --git a/vendor/golang.org/x/sys/unix/constants.go b/vendor/golang.org/x/sys/unix/constants.go
deleted file mode 100644
index a96f0ebc..00000000
--- a/vendor/golang.org/x/sys/unix/constants.go
+++ /dev/null
@@ -1,13 +0,0 @@
-// Copyright 2015 The Go Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style
-// license that can be found in the LICENSE file.
-
-// +build darwin dragonfly freebsd linux netbsd openbsd solaris
-
-package unix
-
-const (
- R_OK = 0x4
- W_OK = 0x2
- X_OK = 0x1
-)
diff --git a/vendor/golang.org/x/sys/unix/env_unix.go b/vendor/golang.org/x/sys/unix/env_unix.go
deleted file mode 100644
index 45e281a0..00000000
--- a/vendor/golang.org/x/sys/unix/env_unix.go
+++ /dev/null
@@ -1,27 +0,0 @@
-// Copyright 2010 The Go Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style
-// license that can be found in the LICENSE file.
-
-// +build darwin dragonfly freebsd linux netbsd openbsd solaris
-
-// Unix environment variables.
-
-package unix
-
-import "syscall"
-
-func Getenv(key string) (value string, found bool) {
- return syscall.Getenv(key)
-}
-
-func Setenv(key, value string) error {
- return syscall.Setenv(key, value)
-}
-
-func Clearenv() {
- syscall.Clearenv()
-}
-
-func Environ() []string {
- return syscall.Environ()
-}
diff --git a/vendor/golang.org/x/sys/unix/env_unset.go b/vendor/golang.org/x/sys/unix/env_unset.go
deleted file mode 100644
index 92222625..00000000
--- a/vendor/golang.org/x/sys/unix/env_unset.go
+++ /dev/null
@@ -1,14 +0,0 @@
-// Copyright 2014 The Go Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style
-// license that can be found in the LICENSE file.
-
-// +build go1.4
-
-package unix
-
-import "syscall"
-
-func Unsetenv(key string) error {
- // This was added in Go 1.4.
- return syscall.Unsetenv(key)
-}
diff --git a/vendor/golang.org/x/sys/unix/flock.go b/vendor/golang.org/x/sys/unix/flock.go
deleted file mode 100644
index ce67a595..00000000
--- a/vendor/golang.org/x/sys/unix/flock.go
+++ /dev/null
@@ -1,24 +0,0 @@
-// +build linux darwin freebsd openbsd netbsd dragonfly
-
-// Copyright 2014 The Go Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style
-// license that can be found in the LICENSE file.
-
-// +build darwin dragonfly freebsd linux netbsd openbsd
-
-package unix
-
-import "unsafe"
-
-// fcntl64Syscall is usually SYS_FCNTL, but is overridden on 32-bit Linux
-// systems by flock_linux_32bit.go to be SYS_FCNTL64.
-var fcntl64Syscall uintptr = SYS_FCNTL
-
-// FcntlFlock performs a fcntl syscall for the F_GETLK, F_SETLK or F_SETLKW command.
-func FcntlFlock(fd uintptr, cmd int, lk *Flock_t) error {
- _, _, errno := Syscall(fcntl64Syscall, fd, uintptr(cmd), uintptr(unsafe.Pointer(lk)))
- if errno == 0 {
- return nil
- }
- return errno
-}
diff --git a/vendor/golang.org/x/sys/unix/flock_linux_32bit.go b/vendor/golang.org/x/sys/unix/flock_linux_32bit.go
deleted file mode 100644
index 362831c3..00000000
--- a/vendor/golang.org/x/sys/unix/flock_linux_32bit.go
+++ /dev/null
@@ -1,13 +0,0 @@
-// +build linux,386 linux,arm
-
-// Copyright 2014 The Go Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style
-// license that can be found in the LICENSE file.
-
-package unix
-
-func init() {
- // On 32-bit Linux systems, the fcntl syscall that matches Go's
- // Flock_t type is SYS_FCNTL64, not SYS_FCNTL.
- fcntl64Syscall = SYS_FCNTL64
-}
diff --git a/vendor/golang.org/x/sys/unix/gccgo.go b/vendor/golang.org/x/sys/unix/gccgo.go
deleted file mode 100644
index 94c82321..00000000
--- a/vendor/golang.org/x/sys/unix/gccgo.go
+++ /dev/null
@@ -1,46 +0,0 @@
-// Copyright 2015 The Go Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style
-// license that can be found in the LICENSE file.
-
-// +build gccgo
-
-package unix
-
-import "syscall"
-
-// We can't use the gc-syntax .s files for gccgo. On the plus side
-// much of the functionality can be written directly in Go.
-
-//extern gccgoRealSyscall
-func realSyscall(trap, a1, a2, a3, a4, a5, a6, a7, a8, a9 uintptr) (r, errno uintptr)
-
-func Syscall(trap, a1, a2, a3 uintptr) (r1, r2 uintptr, err syscall.Errno) {
- syscall.Entersyscall()
- r, errno := realSyscall(trap, a1, a2, a3, 0, 0, 0, 0, 0, 0)
- syscall.Exitsyscall()
- return r, 0, syscall.Errno(errno)
-}
-
-func Syscall6(trap, a1, a2, a3, a4, a5, a6 uintptr) (r1, r2 uintptr, err syscall.Errno) {
- syscall.Entersyscall()
- r, errno := realSyscall(trap, a1, a2, a3, a4, a5, a6, 0, 0, 0)
- syscall.Exitsyscall()
- return r, 0, syscall.Errno(errno)
-}
-
-func Syscall9(trap, a1, a2, a3, a4, a5, a6, a7, a8, a9 uintptr) (r1, r2 uintptr, err syscall.Errno) {
- syscall.Entersyscall()
- r, errno := realSyscall(trap, a1, a2, a3, a4, a5, a6, a7, a8, a9)
- syscall.Exitsyscall()
- return r, 0, syscall.Errno(errno)
-}
-
-func RawSyscall(trap, a1, a2, a3 uintptr) (r1, r2 uintptr, err syscall.Errno) {
- r, errno := realSyscall(trap, a1, a2, a3, 0, 0, 0, 0, 0, 0)
- return r, 0, syscall.Errno(errno)
-}
-
-func RawSyscall6(trap, a1, a2, a3, a4, a5, a6 uintptr) (r1, r2 uintptr, err syscall.Errno) {
- r, errno := realSyscall(trap, a1, a2, a3, a4, a5, a6, 0, 0, 0)
- return r, 0, syscall.Errno(errno)
-}
diff --git a/vendor/golang.org/x/sys/unix/gccgo_c.c b/vendor/golang.org/x/sys/unix/gccgo_c.c
deleted file mode 100644
index 07f6be03..00000000
--- a/vendor/golang.org/x/sys/unix/gccgo_c.c
+++ /dev/null
@@ -1,41 +0,0 @@
-// Copyright 2015 The Go Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style
-// license that can be found in the LICENSE file.
-
-// +build gccgo
-
-#include
-#include
-#include
-
-#define _STRINGIFY2_(x) #x
-#define _STRINGIFY_(x) _STRINGIFY2_(x)
-#define GOSYM_PREFIX _STRINGIFY_(__USER_LABEL_PREFIX__)
-
-// Call syscall from C code because the gccgo support for calling from
-// Go to C does not support varargs functions.
-
-struct ret {
- uintptr_t r;
- uintptr_t err;
-};
-
-struct ret
-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)
-{
- struct ret r;
-
- errno = 0;
- r.r = syscall(trap, a1, a2, a3, a4, a5, a6, a7, a8, a9);
- r.err = errno;
- return r;
-}
-
-// Define the use function in C so that it is not inlined.
-
-extern void use(void *) __asm__ (GOSYM_PREFIX GOPKGPATH ".use") __attribute__((noinline));
-
-void
-use(void *p __attribute__ ((unused)))
-{
-}
diff --git a/vendor/golang.org/x/sys/unix/gccgo_linux_amd64.go b/vendor/golang.org/x/sys/unix/gccgo_linux_amd64.go
deleted file mode 100644
index bffe1a77..00000000
--- a/vendor/golang.org/x/sys/unix/gccgo_linux_amd64.go
+++ /dev/null
@@ -1,20 +0,0 @@
-// Copyright 2015 The Go Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style
-// license that can be found in the LICENSE file.
-
-// +build gccgo,linux,amd64
-
-package unix
-
-import "syscall"
-
-//extern gettimeofday
-func realGettimeofday(*Timeval, *byte) int32
-
-func gettimeofday(tv *Timeval) (err syscall.Errno) {
- r := realGettimeofday(tv, nil)
- if r < 0 {
- return syscall.GetErrno()
- }
- return 0
-}
diff --git a/vendor/golang.org/x/sys/unix/mkall.sh b/vendor/golang.org/x/sys/unix/mkall.sh
deleted file mode 100755
index de95a4bb..00000000
--- a/vendor/golang.org/x/sys/unix/mkall.sh
+++ /dev/null
@@ -1,274 +0,0 @@
-#!/usr/bin/env bash
-# Copyright 2009 The Go Authors. All rights reserved.
-# Use of this source code is governed by a BSD-style
-# license that can be found in the LICENSE file.
-
-# The unix package provides access to the raw system call
-# interface of the underlying operating system. Porting Go to
-# a new architecture/operating system combination requires
-# some manual effort, though there are tools that automate
-# much of the process. The auto-generated files have names
-# beginning with z.
-#
-# This script runs or (given -n) prints suggested commands to generate z files
-# for the current system. Running those commands is not automatic.
-# This script is documentation more than anything else.
-#
-# * asm_${GOOS}_${GOARCH}.s
-#
-# This hand-written assembly file implements system call dispatch.
-# There are three entry points:
-#
-# func Syscall(trap, a1, a2, a3 uintptr) (r1, r2, err uintptr);
-# func Syscall6(trap, a1, a2, a3, a4, a5, a6 uintptr) (r1, r2, err uintptr);
-# func RawSyscall(trap, a1, a2, a3 uintptr) (r1, r2, err uintptr);
-#
-# The first and second are the standard ones; they differ only in
-# how many arguments can be passed to the kernel.
-# The third is for low-level use by the ForkExec wrapper;
-# unlike the first two, it does not call into the scheduler to
-# let it know that a system call is running.
-#
-# * syscall_${GOOS}.go
-#
-# This hand-written Go file implements system calls that need
-# special handling and lists "//sys" comments giving prototypes
-# for ones that can be auto-generated. Mksyscall reads those
-# comments to generate the stubs.
-#
-# * syscall_${GOOS}_${GOARCH}.go
-#
-# Same as syscall_${GOOS}.go except that it contains code specific
-# to ${GOOS} on one particular architecture.
-#
-# * types_${GOOS}.c
-#
-# This hand-written C file includes standard C headers and then
-# creates typedef or enum names beginning with a dollar sign
-# (use of $ in variable names is a gcc extension). The hardest
-# part about preparing this file is figuring out which headers to
-# include and which symbols need to be #defined to get the
-# actual data structures that pass through to the kernel system calls.
-# Some C libraries present alternate versions for binary compatibility
-# and translate them on the way in and out of system calls, but
-# there is almost always a #define that can get the real ones.
-# See types_darwin.c and types_linux.c for examples.
-#
-# * zerror_${GOOS}_${GOARCH}.go
-#
-# This machine-generated file defines the system's error numbers,
-# error strings, and signal numbers. The generator is "mkerrors.sh".
-# Usually no arguments are needed, but mkerrors.sh will pass its
-# arguments on to godefs.
-#
-# * zsyscall_${GOOS}_${GOARCH}.go
-#
-# Generated by mksyscall.pl; see syscall_${GOOS}.go above.
-#
-# * zsysnum_${GOOS}_${GOARCH}.go
-#
-# Generated by mksysnum_${GOOS}.
-#
-# * ztypes_${GOOS}_${GOARCH}.go
-#
-# Generated by godefs; see types_${GOOS}.c above.
-
-GOOSARCH="${GOOS}_${GOARCH}"
-
-# defaults
-mksyscall="./mksyscall.pl"
-mkerrors="./mkerrors.sh"
-zerrors="zerrors_$GOOSARCH.go"
-mksysctl=""
-zsysctl="zsysctl_$GOOSARCH.go"
-mksysnum=
-mktypes=
-run="sh"
-
-case "$1" in
--syscalls)
- for i in zsyscall*go
- do
- sed 1q $i | sed 's;^// ;;' | sh > _$i && gofmt < _$i > $i
- rm _$i
- done
- exit 0
- ;;
--n)
- run="cat"
- shift
-esac
-
-case "$#" in
-0)
- ;;
-*)
- echo 'usage: mkall.sh [-n]' 1>&2
- exit 2
-esac
-
-GOOSARCH_in=syscall_$GOOSARCH.go
-case "$GOOSARCH" in
-_* | *_ | _)
- echo 'undefined $GOOS_$GOARCH:' "$GOOSARCH" 1>&2
- exit 1
- ;;
-darwin_386)
- mkerrors="$mkerrors -m32"
- mksyscall="./mksyscall.pl -l32"
- mksysnum="./mksysnum_darwin.pl $(xcrun --show-sdk-path --sdk macosx)/usr/include/sys/syscall.h"
- mktypes="GOARCH=$GOARCH go tool cgo -godefs"
- ;;
-darwin_amd64)
- mkerrors="$mkerrors -m64"
- mksysnum="./mksysnum_darwin.pl $(xcrun --show-sdk-path --sdk macosx)/usr/include/sys/syscall.h"
- mktypes="GOARCH=$GOARCH go tool cgo -godefs"
- ;;
-darwin_arm)
- mkerrors="$mkerrors"
- mksysnum="./mksysnum_darwin.pl /usr/include/sys/syscall.h"
- mktypes="GOARCH=$GOARCH go tool cgo -godefs"
- ;;
-darwin_arm64)
- mkerrors="$mkerrors -m64"
- mksysnum="./mksysnum_darwin.pl $(xcrun --show-sdk-path --sdk iphoneos)/usr/include/sys/syscall.h"
- mktypes="GOARCH=$GOARCH go tool cgo -godefs"
- ;;
-dragonfly_386)
- mkerrors="$mkerrors -m32"
- mksyscall="./mksyscall.pl -l32 -dragonfly"
- mksysnum="curl -s 'http://gitweb.dragonflybsd.org/dragonfly.git/blob_plain/HEAD:/sys/kern/syscalls.master' | ./mksysnum_dragonfly.pl"
- mktypes="GOARCH=$GOARCH go tool cgo -godefs"
- ;;
-dragonfly_amd64)
- mkerrors="$mkerrors -m64"
- mksyscall="./mksyscall.pl -dragonfly"
- mksysnum="curl -s 'http://gitweb.dragonflybsd.org/dragonfly.git/blob_plain/HEAD:/sys/kern/syscalls.master' | ./mksysnum_dragonfly.pl"
- mktypes="GOARCH=$GOARCH go tool cgo -godefs"
- ;;
-freebsd_386)
- mkerrors="$mkerrors -m32"
- mksyscall="./mksyscall.pl -l32"
- mksysnum="curl -s 'http://svn.freebsd.org/base/stable/10/sys/kern/syscalls.master' | ./mksysnum_freebsd.pl"
- mktypes="GOARCH=$GOARCH go tool cgo -godefs"
- ;;
-freebsd_amd64)
- mkerrors="$mkerrors -m64"
- mksysnum="curl -s 'http://svn.freebsd.org/base/stable/10/sys/kern/syscalls.master' | ./mksysnum_freebsd.pl"
- mktypes="GOARCH=$GOARCH go tool cgo -godefs"
- ;;
-freebsd_arm)
- mkerrors="$mkerrors"
- mksyscall="./mksyscall.pl -l32 -arm"
- mksysnum="curl -s 'http://svn.freebsd.org/base/stable/10/sys/kern/syscalls.master' | ./mksysnum_freebsd.pl"
- # Let the type of C char be singed for making the bare syscall
- # API consistent across over platforms.
- mktypes="GOARCH=$GOARCH go tool cgo -godefs -- -fsigned-char"
- ;;
-linux_386)
- mkerrors="$mkerrors -m32"
- mksyscall="./mksyscall.pl -l32"
- mksysnum="./mksysnum_linux.pl /usr/include/asm/unistd_32.h"
- mktypes="GOARCH=$GOARCH go tool cgo -godefs"
- ;;
-linux_amd64)
- unistd_h=$(ls -1 /usr/include/asm/unistd_64.h /usr/include/x86_64-linux-gnu/asm/unistd_64.h 2>/dev/null | head -1)
- if [ "$unistd_h" = "" ]; then
- echo >&2 cannot find unistd_64.h
- exit 1
- fi
- mkerrors="$mkerrors -m64"
- mksysnum="./mksysnum_linux.pl $unistd_h"
- mktypes="GOARCH=$GOARCH go tool cgo -godefs"
- ;;
-linux_arm)
- mkerrors="$mkerrors"
- mksyscall="./mksyscall.pl -l32 -arm"
- mksysnum="curl -s 'http://git.kernel.org/cgit/linux/kernel/git/torvalds/linux.git/plain/arch/arm/include/uapi/asm/unistd.h' | ./mksysnum_linux.pl -"
- mktypes="GOARCH=$GOARCH go tool cgo -godefs"
- ;;
-linux_arm64)
- unistd_h=$(ls -1 /usr/include/asm/unistd.h /usr/include/asm-generic/unistd.h 2>/dev/null | head -1)
- if [ "$unistd_h" = "" ]; then
- echo >&2 cannot find unistd_64.h
- exit 1
- fi
- mksysnum="./mksysnum_linux.pl $unistd_h"
- # Let the type of C char be singed for making the bare syscall
- # API consistent across over platforms.
- mktypes="GOARCH=$GOARCH go tool cgo -godefs -- -fsigned-char"
- ;;
-linux_ppc64)
- GOOSARCH_in=syscall_linux_ppc64x.go
- unistd_h=/usr/include/asm/unistd.h
- mkerrors="$mkerrors -m64"
- mksysnum="./mksysnum_linux.pl $unistd_h"
- mktypes="GOARCH=$GOARCH go tool cgo -godefs"
- ;;
-linux_ppc64le)
- GOOSARCH_in=syscall_linux_ppc64x.go
- unistd_h=/usr/include/powerpc64le-linux-gnu/asm/unistd.h
- mkerrors="$mkerrors -m64"
- mksysnum="./mksysnum_linux.pl $unistd_h"
- mktypes="GOARCH=$GOARCH go tool cgo -godefs"
- ;;
-netbsd_386)
- mkerrors="$mkerrors -m32"
- mksyscall="./mksyscall.pl -l32 -netbsd"
- mksysnum="curl -s 'http://cvsweb.netbsd.org/bsdweb.cgi/~checkout~/src/sys/kern/syscalls.master' | ./mksysnum_netbsd.pl"
- mktypes="GOARCH=$GOARCH go tool cgo -godefs"
- ;;
-netbsd_amd64)
- mkerrors="$mkerrors -m64"
- mksyscall="./mksyscall.pl -netbsd"
- mksysnum="curl -s 'http://cvsweb.netbsd.org/bsdweb.cgi/~checkout~/src/sys/kern/syscalls.master' | ./mksysnum_netbsd.pl"
- mktypes="GOARCH=$GOARCH go tool cgo -godefs"
- ;;
-openbsd_386)
- mkerrors="$mkerrors -m32"
- mksyscall="./mksyscall.pl -l32 -openbsd"
- mksysctl="./mksysctl_openbsd.pl"
- zsysctl="zsysctl_openbsd.go"
- mksysnum="curl -s 'http://cvsweb.openbsd.org/cgi-bin/cvsweb/~checkout~/src/sys/kern/syscalls.master' | ./mksysnum_openbsd.pl"
- mktypes="GOARCH=$GOARCH go tool cgo -godefs"
- ;;
-openbsd_amd64)
- mkerrors="$mkerrors -m64"
- mksyscall="./mksyscall.pl -openbsd"
- mksysctl="./mksysctl_openbsd.pl"
- zsysctl="zsysctl_openbsd.go"
- mksysnum="curl -s 'http://cvsweb.openbsd.org/cgi-bin/cvsweb/~checkout~/src/sys/kern/syscalls.master' | ./mksysnum_openbsd.pl"
- mktypes="GOARCH=$GOARCH go tool cgo -godefs"
- ;;
-solaris_amd64)
- mksyscall="./mksyscall_solaris.pl"
- mkerrors="$mkerrors -m64"
- mksysnum=
- mktypes="GOARCH=$GOARCH go tool cgo -godefs"
- ;;
-*)
- echo 'unrecognized $GOOS_$GOARCH: ' "$GOOSARCH" 1>&2
- exit 1
- ;;
-esac
-
-(
- if [ -n "$mkerrors" ]; then echo "$mkerrors |gofmt >$zerrors"; fi
- case "$GOOS" in
- *)
- syscall_goos="syscall_$GOOS.go"
- case "$GOOS" in
- darwin | dragonfly | freebsd | netbsd | openbsd)
- syscall_goos="syscall_bsd.go $syscall_goos"
- ;;
- esac
- if [ -n "$mksyscall" ]; then echo "$mksyscall $syscall_goos $GOOSARCH_in |gofmt >zsyscall_$GOOSARCH.go"; fi
- ;;
- esac
- if [ -n "$mksysctl" ]; then echo "$mksysctl |gofmt >$zsysctl"; fi
- if [ -n "$mksysnum" ]; then echo "$mksysnum |gofmt >zsysnum_$GOOSARCH.go"; fi
- if [ -n "$mktypes" ]; then
- echo "echo // +build $GOARCH,$GOOS > ztypes_$GOOSARCH.go";
- echo "$mktypes types_$GOOS.go | gofmt >>ztypes_$GOOSARCH.go";
- fi
-) | $run
diff --git a/vendor/golang.org/x/sys/unix/mkerrors.sh b/vendor/golang.org/x/sys/unix/mkerrors.sh
deleted file mode 100755
index c40d788c..00000000
--- a/vendor/golang.org/x/sys/unix/mkerrors.sh
+++ /dev/null
@@ -1,476 +0,0 @@
-#!/usr/bin/env bash
-# Copyright 2009 The Go Authors. All rights reserved.
-# Use of this source code is governed by a BSD-style
-# license that can be found in the LICENSE file.
-
-# Generate Go code listing errors and other #defined constant
-# values (ENAMETOOLONG etc.), by asking the preprocessor
-# about the definitions.
-
-unset LANG
-export LC_ALL=C
-export LC_CTYPE=C
-
-if test -z "$GOARCH" -o -z "$GOOS"; then
- echo 1>&2 "GOARCH or GOOS not defined in environment"
- exit 1
-fi
-
-CC=${CC:-cc}
-
-if [[ "$GOOS" -eq "solaris" ]]; then
- # Assumes GNU versions of utilities in PATH.
- export PATH=/usr/gnu/bin:$PATH
-fi
-
-uname=$(uname)
-
-includes_Darwin='
-#define _DARWIN_C_SOURCE
-#define KERNEL
-#define _DARWIN_USE_64_BIT_INODE
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-'
-
-includes_DragonFly='
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-'
-
-includes_FreeBSD='
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-
-#if __FreeBSD__ >= 10
-#define IFT_CARP 0xf8 // IFT_CARP is deprecated in FreeBSD 10
-#undef SIOCAIFADDR
-#define SIOCAIFADDR _IOW(105, 26, struct oifaliasreq) // ifaliasreq contains if_data
-#undef SIOCSIFPHYADDR
-#define SIOCSIFPHYADDR _IOW(105, 70, struct oifaliasreq) // ifaliasreq contains if_data
-#endif
-'
-
-includes_Linux='
-#define _LARGEFILE_SOURCE
-#define _LARGEFILE64_SOURCE
-#ifndef __LP64__
-#define _FILE_OFFSET_BITS 64
-#endif
-#define _GNU_SOURCE
-
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-
-#ifndef MSG_FASTOPEN
-#define MSG_FASTOPEN 0x20000000
-#endif
-
-#ifndef PTRACE_GETREGS
-#define PTRACE_GETREGS 0xc
-#endif
-
-#ifndef PTRACE_SETREGS
-#define PTRACE_SETREGS 0xd
-#endif
-'
-
-includes_NetBSD='
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-
-// Needed since refers to it...
-#define schedppq 1
-'
-
-includes_OpenBSD='
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-
-// We keep some constants not supported in OpenBSD 5.5 and beyond for
-// the promise of compatibility.
-#define EMUL_ENABLED 0x1
-#define EMUL_NATIVE 0x2
-#define IPV6_FAITH 0x1d
-#define IPV6_OPTIONS 0x1
-#define IPV6_RTHDR_STRICT 0x1
-#define IPV6_SOCKOPT_RESERVED1 0x3
-#define SIOCGIFGENERIC 0xc020693a
-#define SIOCSIFGENERIC 0x80206939
-#define WALTSIG 0x4
-'
-
-includes_SunOS='
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-'
-
-
-includes='
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-'
-ccflags="$@"
-
-# Write go tool cgo -godefs input.
-(
- echo package unix
- echo
- echo '/*'
- indirect="includes_$(uname)"
- echo "${!indirect} $includes"
- echo '*/'
- echo 'import "C"'
- echo 'import "syscall"'
- echo
- echo 'const ('
-
- # The gcc command line prints all the #defines
- # it encounters while processing the input
- echo "${!indirect} $includes" | $CC -x c - -E -dM $ccflags |
- awk '
- $1 != "#define" || $2 ~ /\(/ || $3 == "" {next}
-
- $2 ~ /^E([ABCD]X|[BIS]P|[SD]I|S|FL)$/ {next} # 386 registers
- $2 ~ /^(SIGEV_|SIGSTKSZ|SIGRT(MIN|MAX))/ {next}
- $2 ~ /^(SCM_SRCRT)$/ {next}
- $2 ~ /^(MAP_FAILED)$/ {next}
- $2 ~ /^ELF_.*$/ {next}# contains ELF_ARCH, etc.
-
- $2 ~ /^EXTATTR_NAMESPACE_NAMES/ ||
- $2 ~ /^EXTATTR_NAMESPACE_[A-Z]+_STRING/ {next}
-
- $2 !~ /^ETH_/ &&
- $2 !~ /^EPROC_/ &&
- $2 !~ /^EQUIV_/ &&
- $2 !~ /^EXPR_/ &&
- $2 ~ /^E[A-Z0-9_]+$/ ||
- $2 ~ /^B[0-9_]+$/ ||
- $2 == "BOTHER" ||
- $2 ~ /^CI?BAUD(EX)?$/ ||
- $2 == "IBSHIFT" ||
- $2 ~ /^V[A-Z0-9]+$/ ||
- $2 ~ /^CS[A-Z0-9]/ ||
- $2 ~ /^I(SIG|CANON|CRNL|UCLC|EXTEN|MAXBEL|STRIP|UTF8)$/ ||
- $2 ~ /^IGN/ ||
- $2 ~ /^IX(ON|ANY|OFF)$/ ||
- $2 ~ /^IN(LCR|PCK)$/ ||
- $2 ~ /(^FLU?SH)|(FLU?SH$)/ ||
- $2 ~ /^C(LOCAL|READ|MSPAR|RTSCTS)$/ ||
- $2 == "BRKINT" ||
- $2 == "HUPCL" ||
- $2 == "PENDIN" ||
- $2 == "TOSTOP" ||
- $2 == "XCASE" ||
- $2 == "ALTWERASE" ||
- $2 == "NOKERNINFO" ||
- $2 ~ /^PAR/ ||
- $2 ~ /^SIG[^_]/ ||
- $2 ~ /^O[CNPFPL][A-Z]+[^_][A-Z]+$/ ||
- $2 ~ /^(NL|CR|TAB|BS|VT|FF)DLY$/ ||
- $2 ~ /^(NL|CR|TAB|BS|VT|FF)[0-9]$/ ||
- $2 ~ /^O?XTABS$/ ||
- $2 ~ /^TC[IO](ON|OFF)$/ ||
- $2 ~ /^IN_/ ||
- $2 ~ /^LOCK_(SH|EX|NB|UN)$/ ||
- $2 ~ /^(AF|SOCK|SO|SOL|IPPROTO|IP|IPV6|ICMP6|TCP|EVFILT|NOTE|EV|SHUT|PROT|MAP|PACKET|MSG|SCM|MCL|DT|MADV|PR)_/ ||
- $2 == "ICMPV6_FILTER" ||
- $2 == "SOMAXCONN" ||
- $2 == "NAME_MAX" ||
- $2 == "IFNAMSIZ" ||
- $2 ~ /^CTL_(MAXNAME|NET|QUERY)$/ ||
- $2 ~ /^SYSCTL_VERS/ ||
- $2 ~ /^(MS|MNT)_/ ||
- $2 ~ /^TUN(SET|GET|ATTACH|DETACH)/ ||
- $2 ~ /^(O|F|FD|NAME|S|PTRACE|PT)_/ ||
- $2 ~ /^LINUX_REBOOT_CMD_/ ||
- $2 ~ /^LINUX_REBOOT_MAGIC[12]$/ ||
- $2 !~ "NLA_TYPE_MASK" &&
- $2 ~ /^(NETLINK|NLM|NLMSG|NLA|IFA|IFAN|RT|RTCF|RTN|RTPROT|RTNH|ARPHRD|ETH_P)_/ ||
- $2 ~ /^SIOC/ ||
- $2 ~ /^TIOC/ ||
- $2 ~ /^TCGET/ ||
- $2 ~ /^TCSET/ ||
- $2 ~ /^TC(FLSH|SBRKP?|XONC)$/ ||
- $2 !~ "RTF_BITS" &&
- $2 ~ /^(IFF|IFT|NET_RT|RTM|RTF|RTV|RTA|RTAX)_/ ||
- $2 ~ /^BIOC/ ||
- $2 ~ /^RUSAGE_(SELF|CHILDREN|THREAD)/ ||
- $2 ~ /^RLIMIT_(AS|CORE|CPU|DATA|FSIZE|NOFILE|STACK)|RLIM_INFINITY/ ||
- $2 ~ /^PRIO_(PROCESS|PGRP|USER)/ ||
- $2 ~ /^CLONE_[A-Z_]+/ ||
- $2 !~ /^(BPF_TIMEVAL)$/ &&
- $2 ~ /^(BPF|DLT)_/ ||
- $2 ~ /^CLOCK_/ ||
- $2 !~ "WMESGLEN" &&
- $2 ~ /^W[A-Z0-9]+$/ {printf("\t%s = C.%s\n", $2, $2)}
- $2 ~ /^__WCOREFLAG$/ {next}
- $2 ~ /^__W[A-Z0-9]+$/ {printf("\t%s = C.%s\n", substr($2,3), $2)}
-
- {next}
- ' | sort
-
- echo ')'
-) >_const.go
-
-# Pull out the error names for later.
-errors=$(
- echo '#include ' | $CC -x c - -E -dM $ccflags |
- awk '$1=="#define" && $2 ~ /^E[A-Z0-9_]+$/ { print $2 }' |
- sort
-)
-
-# Pull out the signal names for later.
-signals=$(
- echo '#include ' | $CC -x c - -E -dM $ccflags |
- awk '$1=="#define" && $2 ~ /^SIG[A-Z0-9]+$/ { print $2 }' |
- egrep -v '(SIGSTKSIZE|SIGSTKSZ|SIGRT)' |
- sort
-)
-
-# Again, writing regexps to a file.
-echo '#include ' | $CC -x c - -E -dM $ccflags |
- awk '$1=="#define" && $2 ~ /^E[A-Z0-9_]+$/ { print "^\t" $2 "[ \t]*=" }' |
- sort >_error.grep
-echo '#include ' | $CC -x c - -E -dM $ccflags |
- awk '$1=="#define" && $2 ~ /^SIG[A-Z0-9]+$/ { print "^\t" $2 "[ \t]*=" }' |
- egrep -v '(SIGSTKSIZE|SIGSTKSZ|SIGRT)' |
- sort >_signal.grep
-
-echo '// mkerrors.sh' "$@"
-echo '// MACHINE GENERATED BY THE COMMAND ABOVE; DO NOT EDIT'
-echo
-echo "// +build ${GOARCH},${GOOS}"
-echo
-go tool cgo -godefs -- "$@" _const.go >_error.out
-cat _error.out | grep -vf _error.grep | grep -vf _signal.grep
-echo
-echo '// Errors'
-echo 'const ('
-cat _error.out | grep -f _error.grep | sed 's/=\(.*\)/= syscall.Errno(\1)/'
-echo ')'
-
-echo
-echo '// Signals'
-echo 'const ('
-cat _error.out | grep -f _signal.grep | sed 's/=\(.*\)/= syscall.Signal(\1)/'
-echo ')'
-
-# Run C program to print error and syscall strings.
-(
- echo -E "
-#include
-#include
-#include
-#include
-#include
-#include
-
-#define nelem(x) (sizeof(x)/sizeof((x)[0]))
-
-enum { A = 'A', Z = 'Z', a = 'a', z = 'z' }; // avoid need for single quotes below
-
-int errors[] = {
-"
- for i in $errors
- do
- echo -E ' '$i,
- done
-
- echo -E "
-};
-
-int signals[] = {
-"
- for i in $signals
- do
- echo -E ' '$i,
- done
-
- # Use -E because on some systems bash builtin interprets \n itself.
- echo -E '
-};
-
-static int
-intcmp(const void *a, const void *b)
-{
- return *(int*)a - *(int*)b;
-}
-
-int
-main(void)
-{
- int i, j, e;
- char buf[1024], *p;
-
- printf("\n\n// Error table\n");
- printf("var errors = [...]string {\n");
- qsort(errors, nelem(errors), sizeof errors[0], intcmp);
- for(i=0; i 0 && errors[i-1] == e)
- continue;
- strcpy(buf, strerror(e));
- // lowercase first letter: Bad -> bad, but STREAM -> STREAM.
- if(A <= buf[0] && buf[0] <= Z && a <= buf[1] && buf[1] <= z)
- buf[0] += a - A;
- printf("\t%d: \"%s\",\n", e, buf);
- }
- printf("}\n\n");
-
- printf("\n\n// Signal table\n");
- printf("var signals = [...]string {\n");
- qsort(signals, nelem(signals), sizeof signals[0], intcmp);
- for(i=0; i 0 && signals[i-1] == e)
- continue;
- strcpy(buf, strsignal(e));
- // lowercase first letter: Bad -> bad, but STREAM -> STREAM.
- if(A <= buf[0] && buf[0] <= Z && a <= buf[1] && buf[1] <= z)
- buf[0] += a - A;
- // cut trailing : number.
- p = strrchr(buf, ":"[0]);
- if(p)
- *p = '\0';
- printf("\t%d: \"%s\",\n", e, buf);
- }
- printf("}\n\n");
-
- return 0;
-}
-
-'
-) >_errors.c
-
-$CC $ccflags -o _errors _errors.c && $GORUN ./_errors && rm -f _errors.c _errors _const.go _error.grep _signal.grep _error.out
diff --git a/vendor/golang.org/x/sys/unix/mksyscall.pl b/vendor/golang.org/x/sys/unix/mksyscall.pl
deleted file mode 100755
index b1e7766d..00000000
--- a/vendor/golang.org/x/sys/unix/mksyscall.pl
+++ /dev/null
@@ -1,323 +0,0 @@
-#!/usr/bin/env perl
-# Copyright 2009 The Go Authors. All rights reserved.
-# Use of this source code is governed by a BSD-style
-# license that can be found in the LICENSE file.
-
-# This program reads a file containing function prototypes
-# (like syscall_darwin.go) and generates system call bodies.
-# The prototypes are marked by lines beginning with "//sys"
-# and read like func declarations if //sys is replaced by func, but:
-# * The parameter lists must give a name for each argument.
-# This includes return parameters.
-# * The parameter lists must give a type for each argument:
-# the (x, y, z int) shorthand is not allowed.
-# * If the return parameter is an error number, it must be named errno.
-
-# A line beginning with //sysnb is like //sys, except that the
-# goroutine will not be suspended during the execution of the system
-# call. This must only be used for system calls which can never
-# block, as otherwise the system call could cause all goroutines to
-# hang.
-
-use strict;
-
-my $cmdline = "mksyscall.pl " . join(' ', @ARGV);
-my $errors = 0;
-my $_32bit = "";
-my $plan9 = 0;
-my $openbsd = 0;
-my $netbsd = 0;
-my $dragonfly = 0;
-my $arm = 0; # 64-bit value should use (even, odd)-pair
-
-if($ARGV[0] eq "-b32") {
- $_32bit = "big-endian";
- shift;
-} elsif($ARGV[0] eq "-l32") {
- $_32bit = "little-endian";
- shift;
-}
-if($ARGV[0] eq "-plan9") {
- $plan9 = 1;
- shift;
-}
-if($ARGV[0] eq "-openbsd") {
- $openbsd = 1;
- shift;
-}
-if($ARGV[0] eq "-netbsd") {
- $netbsd = 1;
- shift;
-}
-if($ARGV[0] eq "-dragonfly") {
- $dragonfly = 1;
- shift;
-}
-if($ARGV[0] eq "-arm") {
- $arm = 1;
- shift;
-}
-
-if($ARGV[0] =~ /^-/) {
- print STDERR "usage: mksyscall.pl [-b32 | -l32] [file ...]\n";
- exit 1;
-}
-
-if($ENV{'GOARCH'} eq "" || $ENV{'GOOS'} eq "") {
- print STDERR "GOARCH or GOOS not defined in environment\n";
- exit 1;
-}
-
-sub parseparamlist($) {
- my ($list) = @_;
- $list =~ s/^\s*//;
- $list =~ s/\s*$//;
- if($list eq "") {
- return ();
- }
- return split(/\s*,\s*/, $list);
-}
-
-sub parseparam($) {
- my ($p) = @_;
- if($p !~ /^(\S*) (\S*)$/) {
- print STDERR "$ARGV:$.: malformed parameter: $p\n";
- $errors = 1;
- return ("xx", "int");
- }
- return ($1, $2);
-}
-
-my $text = "";
-while(<>) {
- chomp;
- s/\s+/ /g;
- s/^\s+//;
- s/\s+$//;
- my $nonblock = /^\/\/sysnb /;
- next if !/^\/\/sys / && !$nonblock;
-
- # Line must be of the form
- # func Open(path string, mode int, perm int) (fd int, errno error)
- # Split into name, in params, out params.
- if(!/^\/\/sys(nb)? (\w+)\(([^()]*)\)\s*(?:\(([^()]+)\))?\s*(?:=\s*((?i)SYS_[A-Z0-9_]+))?$/) {
- print STDERR "$ARGV:$.: malformed //sys declaration\n";
- $errors = 1;
- next;
- }
- my ($func, $in, $out, $sysname) = ($2, $3, $4, $5);
-
- # Split argument lists on comma.
- my @in = parseparamlist($in);
- my @out = parseparamlist($out);
-
- # Try in vain to keep people from editing this file.
- # The theory is that they jump into the middle of the file
- # without reading the header.
- $text .= "// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT\n\n";
-
- # Go function header.
- my $out_decl = @out ? sprintf(" (%s)", join(', ', @out)) : "";
- $text .= sprintf "func %s(%s)%s {\n", $func, join(', ', @in), $out_decl;
-
- # Check if err return available
- my $errvar = "";
- foreach my $p (@out) {
- my ($name, $type) = parseparam($p);
- if($type eq "error") {
- $errvar = $name;
- last;
- }
- }
-
- # Prepare arguments to Syscall.
- my @args = ();
- my @uses = ();
- my $n = 0;
- foreach my $p (@in) {
- my ($name, $type) = parseparam($p);
- if($type =~ /^\*/) {
- push @args, "uintptr(unsafe.Pointer($name))";
- } elsif($type eq "string" && $errvar ne "") {
- $text .= "\tvar _p$n *byte\n";
- $text .= "\t_p$n, $errvar = BytePtrFromString($name)\n";
- $text .= "\tif $errvar != nil {\n\t\treturn\n\t}\n";
- push @args, "uintptr(unsafe.Pointer(_p$n))";
- push @uses, "use(unsafe.Pointer(_p$n))";
- $n++;
- } elsif($type eq "string") {
- print STDERR "$ARGV:$.: $func uses string arguments, but has no error return\n";
- $text .= "\tvar _p$n *byte\n";
- $text .= "\t_p$n, _ = BytePtrFromString($name)\n";
- push @args, "uintptr(unsafe.Pointer(_p$n))";
- push @uses, "use(unsafe.Pointer(_p$n))";
- $n++;
- } elsif($type =~ /^\[\](.*)/) {
- # Convert slice into pointer, length.
- # Have to be careful not to take address of &a[0] if len == 0:
- # pass dummy pointer in that case.
- # Used to pass nil, but some OSes or simulators reject write(fd, nil, 0).
- $text .= "\tvar _p$n unsafe.Pointer\n";
- $text .= "\tif len($name) > 0 {\n\t\t_p$n = unsafe.Pointer(\&${name}[0])\n\t}";
- $text .= " else {\n\t\t_p$n = unsafe.Pointer(&_zero)\n\t}";
- $text .= "\n";
- push @args, "uintptr(_p$n)", "uintptr(len($name))";
- $n++;
- } elsif($type eq "int64" && ($openbsd || $netbsd)) {
- push @args, "0";
- if($_32bit eq "big-endian") {
- push @args, "uintptr($name>>32)", "uintptr($name)";
- } elsif($_32bit eq "little-endian") {
- push @args, "uintptr($name)", "uintptr($name>>32)";
- } else {
- push @args, "uintptr($name)";
- }
- } elsif($type eq "int64" && $dragonfly) {
- if ($func !~ /^extp(read|write)/i) {
- push @args, "0";
- }
- if($_32bit eq "big-endian") {
- push @args, "uintptr($name>>32)", "uintptr($name)";
- } elsif($_32bit eq "little-endian") {
- push @args, "uintptr($name)", "uintptr($name>>32)";
- } else {
- push @args, "uintptr($name)";
- }
- } elsif($type eq "int64" && $_32bit ne "") {
- if(@args % 2 && $arm) {
- # arm abi specifies 64-bit argument uses
- # (even, odd) pair
- push @args, "0"
- }
- if($_32bit eq "big-endian") {
- push @args, "uintptr($name>>32)", "uintptr($name)";
- } else {
- push @args, "uintptr($name)", "uintptr($name>>32)";
- }
- } else {
- push @args, "uintptr($name)";
- }
- }
-
- # Determine which form to use; pad args with zeros.
- my $asm = "Syscall";
- if ($nonblock) {
- $asm = "RawSyscall";
- }
- if(@args <= 3) {
- while(@args < 3) {
- push @args, "0";
- }
- } elsif(@args <= 6) {
- $asm .= "6";
- while(@args < 6) {
- push @args, "0";
- }
- } elsif(@args <= 9) {
- $asm .= "9";
- while(@args < 9) {
- push @args, "0";
- }
- } else {
- print STDERR "$ARGV:$.: too many arguments to system call\n";
- }
-
- # System call number.
- if($sysname eq "") {
- $sysname = "SYS_$func";
- $sysname =~ s/([a-z])([A-Z])/${1}_$2/g; # turn FooBar into Foo_Bar
- $sysname =~ y/a-z/A-Z/;
- }
-
- # Actual call.
- my $args = join(', ', @args);
- my $call = "$asm($sysname, $args)";
-
- # Assign return values.
- my $body = "";
- my @ret = ("_", "_", "_");
- my $do_errno = 0;
- for(my $i=0; $i<@out; $i++) {
- my $p = $out[$i];
- my ($name, $type) = parseparam($p);
- my $reg = "";
- if($name eq "err" && !$plan9) {
- $reg = "e1";
- $ret[2] = $reg;
- $do_errno = 1;
- } elsif($name eq "err" && $plan9) {
- $ret[0] = "r0";
- $ret[2] = "e1";
- next;
- } else {
- $reg = sprintf("r%d", $i);
- $ret[$i] = $reg;
- }
- if($type eq "bool") {
- $reg = "$reg != 0";
- }
- if($type eq "int64" && $_32bit ne "") {
- # 64-bit number in r1:r0 or r0:r1.
- if($i+2 > @out) {
- print STDERR "$ARGV:$.: not enough registers for int64 return\n";
- }
- if($_32bit eq "big-endian") {
- $reg = sprintf("int64(r%d)<<32 | int64(r%d)", $i, $i+1);
- } else {
- $reg = sprintf("int64(r%d)<<32 | int64(r%d)", $i+1, $i);
- }
- $ret[$i] = sprintf("r%d", $i);
- $ret[$i+1] = sprintf("r%d", $i+1);
- }
- if($reg ne "e1" || $plan9) {
- $body .= "\t$name = $type($reg)\n";
- }
- }
- if ($ret[0] eq "_" && $ret[1] eq "_" && $ret[2] eq "_") {
- $text .= "\t$call\n";
- } else {
- $text .= "\t$ret[0], $ret[1], $ret[2] := $call\n";
- }
- foreach my $use (@uses) {
- $text .= "\t$use\n";
- }
- $text .= $body;
-
- if ($plan9 && $ret[2] eq "e1") {
- $text .= "\tif int32(r0) == -1 {\n";
- $text .= "\t\terr = e1\n";
- $text .= "\t}\n";
- } elsif ($do_errno) {
- $text .= "\tif e1 != 0 {\n";
- $text .= "\t\terr = errnoErr(e1)\n";
- $text .= "\t}\n";
- }
- $text .= "\treturn\n";
- $text .= "}\n\n";
-}
-
-chomp $text;
-chomp $text;
-
-if($errors) {
- exit 1;
-}
-
-print <) {
- chomp;
- s/\s+/ /g;
- s/^\s+//;
- s/\s+$//;
- $package = $1 if !$package && /^package (\S+)$/;
- my $nonblock = /^\/\/sysnb /;
- next if !/^\/\/sys / && !$nonblock;
-
- # Line must be of the form
- # func Open(path string, mode int, perm int) (fd int, err error)
- # Split into name, in params, out params.
- if(!/^\/\/sys(nb)? (\w+)\(([^()]*)\)\s*(?:\(([^()]+)\))?\s*(?:=\s*(?:(\w*)\.)?(\w*))?$/) {
- print STDERR "$ARGV:$.: malformed //sys declaration\n";
- $errors = 1;
- next;
- }
- my ($nb, $func, $in, $out, $modname, $sysname) = ($1, $2, $3, $4, $5, $6);
-
- # Split argument lists on comma.
- my @in = parseparamlist($in);
- my @out = parseparamlist($out);
-
- # So file name.
- if($modname eq "") {
- $modname = "libc";
- }
-
- # System call name.
- if($sysname eq "") {
- $sysname = "$func";
- }
-
- # System call pointer variable name.
- my $sysvarname = "proc$sysname";
-
- my $strconvfunc = "BytePtrFromString";
- my $strconvtype = "*byte";
-
- $sysname =~ y/A-Z/a-z/; # All libc functions are lowercase.
-
- # Runtime import of function to allow cross-platform builds.
- $dynimports .= "//go:cgo_import_dynamic libc_${sysname} ${sysname} \"$modname.so\"\n";
- # Link symbol to proc address variable.
- $linknames .= "//go:linkname ${sysvarname} libc_${sysname}\n";
- # Library proc address variable.
- push @vars, $sysvarname;
-
- # Go function header.
- $out = join(', ', @out);
- if($out ne "") {
- $out = " ($out)";
- }
- if($text ne "") {
- $text .= "\n"
- }
- $text .= sprintf "func %s(%s)%s {\n", $func, join(', ', @in), $out;
-
- # Check if err return available
- my $errvar = "";
- foreach my $p (@out) {
- my ($name, $type) = parseparam($p);
- if($type eq "error") {
- $errvar = $name;
- last;
- }
- }
-
- # Prepare arguments to Syscall.
- my @args = ();
- my @uses = ();
- my $n = 0;
- foreach my $p (@in) {
- my ($name, $type) = parseparam($p);
- if($type =~ /^\*/) {
- push @args, "uintptr(unsafe.Pointer($name))";
- } elsif($type eq "string" && $errvar ne "") {
- $text .= "\tvar _p$n $strconvtype\n";
- $text .= "\t_p$n, $errvar = $strconvfunc($name)\n";
- $text .= "\tif $errvar != nil {\n\t\treturn\n\t}\n";
- push @args, "uintptr(unsafe.Pointer(_p$n))";
- push @uses, "use(unsafe.Pointer(_p$n))";
- $n++;
- } elsif($type eq "string") {
- print STDERR "$ARGV:$.: $func uses string arguments, but has no error return\n";
- $text .= "\tvar _p$n $strconvtype\n";
- $text .= "\t_p$n, _ = $strconvfunc($name)\n";
- push @args, "uintptr(unsafe.Pointer(_p$n))";
- push @uses, "use(unsafe.Pointer(_p$n))";
- $n++;
- } elsif($type =~ /^\[\](.*)/) {
- # Convert slice into pointer, length.
- # Have to be careful not to take address of &a[0] if len == 0:
- # pass nil in that case.
- $text .= "\tvar _p$n *$1\n";
- $text .= "\tif len($name) > 0 {\n\t\t_p$n = \&$name\[0]\n\t}\n";
- push @args, "uintptr(unsafe.Pointer(_p$n))", "uintptr(len($name))";
- $n++;
- } elsif($type eq "int64" && $_32bit ne "") {
- if($_32bit eq "big-endian") {
- push @args, "uintptr($name >> 32)", "uintptr($name)";
- } else {
- push @args, "uintptr($name)", "uintptr($name >> 32)";
- }
- } elsif($type eq "bool") {
- $text .= "\tvar _p$n uint32\n";
- $text .= "\tif $name {\n\t\t_p$n = 1\n\t} else {\n\t\t_p$n = 0\n\t}\n";
- push @args, "uintptr(_p$n)";
- $n++;
- } else {
- push @args, "uintptr($name)";
- }
- }
- my $nargs = @args;
-
- # Determine which form to use; pad args with zeros.
- my $asm = "sysvicall6";
- if ($nonblock) {
- $asm = "rawSysvicall6";
- }
- if(@args <= 6) {
- while(@args < 6) {
- push @args, "0";
- }
- } else {
- print STDERR "$ARGV:$.: too many arguments to system call\n";
- }
-
- # Actual call.
- my $args = join(', ', @args);
- my $call = "$asm(uintptr(unsafe.Pointer(&$sysvarname)), $nargs, $args)";
-
- # Assign return values.
- my $body = "";
- my $failexpr = "";
- my @ret = ("_", "_", "_");
- my @pout= ();
- my $do_errno = 0;
- for(my $i=0; $i<@out; $i++) {
- my $p = $out[$i];
- my ($name, $type) = parseparam($p);
- my $reg = "";
- if($name eq "err") {
- $reg = "e1";
- $ret[2] = $reg;
- $do_errno = 1;
- } else {
- $reg = sprintf("r%d", $i);
- $ret[$i] = $reg;
- }
- if($type eq "bool") {
- $reg = "$reg != 0";
- }
- if($type eq "int64" && $_32bit ne "") {
- # 64-bit number in r1:r0 or r0:r1.
- if($i+2 > @out) {
- print STDERR "$ARGV:$.: not enough registers for int64 return\n";
- }
- if($_32bit eq "big-endian") {
- $reg = sprintf("int64(r%d)<<32 | int64(r%d)", $i, $i+1);
- } else {
- $reg = sprintf("int64(r%d)<<32 | int64(r%d)", $i+1, $i);
- }
- $ret[$i] = sprintf("r%d", $i);
- $ret[$i+1] = sprintf("r%d", $i+1);
- }
- if($reg ne "e1") {
- $body .= "\t$name = $type($reg)\n";
- }
- }
- if ($ret[0] eq "_" && $ret[1] eq "_" && $ret[2] eq "_") {
- $text .= "\t$call\n";
- } else {
- $text .= "\t$ret[0], $ret[1], $ret[2] := $call\n";
- }
- foreach my $use (@uses) {
- $text .= "\t$use\n";
- }
- $text .= $body;
-
- if ($do_errno) {
- $text .= "\tif e1 != 0 {\n";
- $text .= "\t\terr = e1\n";
- $text .= "\t}\n";
- }
- $text .= "\treturn\n";
- $text .= "}\n";
-}
-
-if($errors) {
- exit 1;
-}
-
-print < "net.inet",
- "net.inet.ipproto" => "net.inet",
- "net.inet6.ipv6proto" => "net.inet6",
- "net.inet6.ipv6" => "net.inet6.ip6",
- "net.inet.icmpv6" => "net.inet6.icmp6",
- "net.inet6.divert6" => "net.inet6.divert",
- "net.inet6.tcp6" => "net.inet.tcp",
- "net.inet6.udp6" => "net.inet.udp",
- "mpls" => "net.mpls",
- "swpenc" => "vm.swapencrypt"
-);
-
-# Node mappings
-my %node_map = (
- "net.inet.ip.ifq" => "net.ifq",
- "net.inet.pfsync" => "net.pfsync",
- "net.mpls.ifq" => "net.ifq"
-);
-
-my $ctlname;
-my %mib = ();
-my %sysctl = ();
-my $node;
-
-sub debug() {
- print STDERR "$_[0]\n" if $debug;
-}
-
-# Walk the MIB and build a sysctl name to OID mapping.
-sub build_sysctl() {
- my ($node, $name, $oid) = @_;
- my %node = %{$node};
- my @oid = @{$oid};
-
- foreach my $key (sort keys %node) {
- my @node = @{$node{$key}};
- my $nodename = $name.($name ne '' ? '.' : '').$key;
- my @nodeoid = (@oid, $node[0]);
- if ($node[1] eq 'CTLTYPE_NODE') {
- if (exists $node_map{$nodename}) {
- $node = \%mib;
- $ctlname = $node_map{$nodename};
- foreach my $part (split /\./, $ctlname) {
- $node = \%{@{$$node{$part}}[2]};
- }
- } else {
- $node = $node[2];
- }
- &build_sysctl($node, $nodename, \@nodeoid);
- } elsif ($node[1] ne '') {
- $sysctl{$nodename} = \@nodeoid;
- }
- }
-}
-
-foreach my $ctl (@ctls) {
- $ctls{$ctl} = $ctl;
-}
-
-# Build MIB
-foreach my $header (@headers) {
- &debug("Processing $header...");
- open HEADER, "/usr/include/$header" ||
- print STDERR "Failed to open $header\n";
- while () {
- if ($_ =~ /^#define\s+(CTL_NAMES)\s+{/ ||
- $_ =~ /^#define\s+(CTL_(.*)_NAMES)\s+{/ ||
- $_ =~ /^#define\s+((.*)CTL_NAMES)\s+{/) {
- if ($1 eq 'CTL_NAMES') {
- # Top level.
- $node = \%mib;
- } else {
- # Node.
- my $nodename = lc($2);
- if ($header =~ /^netinet\//) {
- $ctlname = "net.inet.$nodename";
- } elsif ($header =~ /^netinet6\//) {
- $ctlname = "net.inet6.$nodename";
- } elsif ($header =~ /^net\//) {
- $ctlname = "net.$nodename";
- } else {
- $ctlname = "$nodename";
- $ctlname =~ s/^(fs|net|kern)_/$1\./;
- }
- if (exists $ctl_map{$ctlname}) {
- $ctlname = $ctl_map{$ctlname};
- }
- if (not exists $ctls{$ctlname}) {
- &debug("Ignoring $ctlname...");
- next;
- }
-
- # Walk down from the top of the MIB.
- $node = \%mib;
- foreach my $part (split /\./, $ctlname) {
- if (not exists $$node{$part}) {
- &debug("Missing node $part");
- $$node{$part} = [ 0, '', {} ];
- }
- $node = \%{@{$$node{$part}}[2]};
- }
- }
-
- # Populate current node with entries.
- my $i = -1;
- while (defined($_) && $_ !~ /^}/) {
- $_ = ;
- $i++ if $_ =~ /{.*}/;
- next if $_ !~ /{\s+"(\w+)",\s+(CTLTYPE_[A-Z]+)\s+}/;
- $$node{$1} = [ $i, $2, {} ];
- }
- }
- }
- close HEADER;
-}
-
-&build_sysctl(\%mib, "", []);
-
-print <){
- if(/^#define\s+SYS_(\w+)\s+([0-9]+)/){
- my $name = $1;
- my $num = $2;
- $name =~ y/a-z/A-Z/;
- print " SYS_$name = $num;"
- }
-}
-
-print <){
- if(/^([0-9]+)\s+STD\s+({ \S+\s+(\w+).*)$/){
- my $num = $1;
- my $proto = $2;
- my $name = "SYS_$3";
- $name =~ y/a-z/A-Z/;
-
- # There are multiple entries for enosys and nosys, so comment them out.
- if($name =~ /^SYS_E?NOSYS$/){
- $name = "// $name";
- }
- if($name eq 'SYS_SYS_EXIT'){
- $name = 'SYS_EXIT';
- }
-
- print " $name = $num; // $proto\n";
- }
-}
-
-print <){
- if(/^([0-9]+)\s+\S+\s+STD\s+({ \S+\s+(\w+).*)$/){
- my $num = $1;
- my $proto = $2;
- my $name = "SYS_$3";
- $name =~ y/a-z/A-Z/;
-
- # There are multiple entries for enosys and nosys, so comment them out.
- if($name =~ /^SYS_E?NOSYS$/){
- $name = "// $name";
- }
- if($name eq 'SYS_SYS_EXIT'){
- $name = 'SYS_EXIT';
- }
- if($name =~ /^SYS_CAP_+/ || $name =~ /^SYS___CAP_+/){
- next
- }
-
- print " $name = $num; // $proto\n";
-
- # We keep Capsicum syscall numbers for FreeBSD
- # 9-STABLE here because we are not sure whether they
- # are mature and stable.
- if($num == 513){
- print " SYS_CAP_NEW = 514 // { int cap_new(int fd, uint64_t rights); }\n";
- print " SYS_CAP_GETRIGHTS = 515 // { int cap_getrights(int fd, \\\n";
- print " SYS_CAP_ENTER = 516 // { int cap_enter(void); }\n";
- print " SYS_CAP_GETMODE = 517 // { int cap_getmode(u_int *modep); }\n";
- }
- }
-}
-
-print < 999){
- # ignore deprecated syscalls that are no longer implemented
- # https://git.kernel.org/cgit/linux/kernel/git/torvalds/linux.git/tree/include/uapi/asm-generic/unistd.h?id=refs/heads/master#n716
- return;
- }
- $name =~ y/a-z/A-Z/;
- print " SYS_$name = $num;\n";
-}
-
-my $prev;
-open(GCC, "gcc -E -dD $ARGV[0] |") || die "can't run gcc";
-while(){
- if(/^#define __NR_syscalls\s+/) {
- # ignore redefinitions of __NR_syscalls
- }
- elsif(/^#define __NR_(\w+)\s+([0-9]+)/){
- $prev = $2;
- fmt($1, $2);
- }
- elsif(/^#define __NR3264_(\w+)\s+([0-9]+)/){
- $prev = $2;
- fmt($1, $2);
- }
- elsif(/^#define __NR_(\w+)\s+\(\w+\+\s*([0-9]+)\)/){
- fmt($1, $prev+$2)
- }
-}
-
-print <){
- if($line =~ /^(.*)\\$/) {
- # Handle continuation
- $line = $1;
- $_ =~ s/^\s+//;
- $line .= $_;
- } else {
- # New line
- $line = $_;
- }
- next if $line =~ /\\$/;
- if($line =~ /^([0-9]+)\s+((STD)|(NOERR))\s+(RUMP\s+)?({\s+\S+\s*\*?\s*\|(\S+)\|(\S*)\|(\w+).*\s+})(\s+(\S+))?$/) {
- my $num = $1;
- my $proto = $6;
- my $compat = $8;
- my $name = "$7_$9";
-
- $name = "$7_$11" if $11 ne '';
- $name =~ y/a-z/A-Z/;
-
- if($compat eq '' || $compat eq '30' || $compat eq '50') {
- print " $name = $num; // $proto\n";
- }
- }
-}
-
-print <){
- if(/^([0-9]+)\s+STD\s+(NOLOCK\s+)?({ \S+\s+\*?(\w+).*)$/){
- my $num = $1;
- my $proto = $3;
- my $name = $4;
- $name =~ y/a-z/A-Z/;
-
- # There are multiple entries for enosys and nosys, so comment them out.
- if($name =~ /^SYS_E?NOSYS$/){
- $name = "// $name";
- }
- if($name eq 'SYS_SYS_EXIT'){
- $name = 'SYS_EXIT';
- }
-
- print " $name = $num; // $proto\n";
- }
-}
-
-print < len(b) {
- return nil, nil, EINVAL
- }
- return h, b[cmsgAlignOf(SizeofCmsghdr):h.Len], nil
-}
-
-// UnixRights encodes a set of open file descriptors into a socket
-// control message for sending to another process.
-func UnixRights(fds ...int) []byte {
- datalen := len(fds) * 4
- b := make([]byte, CmsgSpace(datalen))
- h := (*Cmsghdr)(unsafe.Pointer(&b[0]))
- h.Level = SOL_SOCKET
- h.Type = SCM_RIGHTS
- h.SetLen(CmsgLen(datalen))
- data := cmsgData(h)
- for _, fd := range fds {
- *(*int32)(data) = int32(fd)
- data = unsafe.Pointer(uintptr(data) + 4)
- }
- return b
-}
-
-// ParseUnixRights decodes a socket control message that contains an
-// integer array of open file descriptors from another process.
-func ParseUnixRights(m *SocketControlMessage) ([]int, error) {
- if m.Header.Level != SOL_SOCKET {
- return nil, EINVAL
- }
- if m.Header.Type != SCM_RIGHTS {
- return nil, EINVAL
- }
- fds := make([]int, len(m.Data)>>2)
- for i, j := 0, 0; i < len(m.Data); i += 4 {
- fds[j] = int(*(*int32)(unsafe.Pointer(&m.Data[i])))
- j++
- }
- return fds, nil
-}
diff --git a/vendor/golang.org/x/sys/unix/str.go b/vendor/golang.org/x/sys/unix/str.go
deleted file mode 100644
index 35ed6643..00000000
--- a/vendor/golang.org/x/sys/unix/str.go
+++ /dev/null
@@ -1,26 +0,0 @@
-// Copyright 2009 The Go Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style
-// license that can be found in the LICENSE file.
-
-// +build darwin dragonfly freebsd linux netbsd openbsd solaris
-
-package unix
-
-func itoa(val int) string { // do it here rather than with fmt to avoid dependency
- if val < 0 {
- return "-" + uitoa(uint(-val))
- }
- return uitoa(uint(val))
-}
-
-func uitoa(val uint) string {
- var buf [32]byte // big enough for int64
- i := len(buf) - 1
- for val >= 10 {
- buf[i] = byte(val%10 + '0')
- i--
- val /= 10
- }
- buf[i] = byte(val + '0')
- return string(buf[i:])
-}
diff --git a/vendor/golang.org/x/sys/unix/syscall.go b/vendor/golang.org/x/sys/unix/syscall.go
deleted file mode 100644
index a48d47cf..00000000
--- a/vendor/golang.org/x/sys/unix/syscall.go
+++ /dev/null
@@ -1,74 +0,0 @@
-// Copyright 2009 The Go Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style
-// license that can be found in the LICENSE file.
-
-// +build darwin dragonfly freebsd linux netbsd openbsd solaris
-
-// Package unix contains an interface to the low-level operating system
-// primitives. OS details vary depending on the underlying system, and
-// by default, godoc will display OS-specific documentation for the current
-// system. If you want godoc to display OS documentation for another
-// system, set $GOOS and $GOARCH to the desired system. For example, if
-// you want to view documentation for freebsd/arm on linux/amd64, set $GOOS
-// to freebsd and $GOARCH to arm.
-// The primary use of this package is inside other packages that provide a more
-// portable interface to the system, such as "os", "time" and "net". Use
-// those packages rather than this one if you can.
-// For details of the functions and data types in this package consult
-// the manuals for the appropriate operating system.
-// These calls return err == nil to indicate success; otherwise
-// err represents an operating system error describing the failure and
-// holds a value of type syscall.Errno.
-package unix
-
-import "unsafe"
-
-// ByteSliceFromString returns a NUL-terminated slice of bytes
-// containing the text of s. If s contains a NUL byte at any
-// location, it returns (nil, EINVAL).
-func ByteSliceFromString(s string) ([]byte, error) {
- for i := 0; i < len(s); i++ {
- if s[i] == 0 {
- return nil, EINVAL
- }
- }
- a := make([]byte, len(s)+1)
- copy(a, s)
- return a, nil
-}
-
-// BytePtrFromString returns a pointer to a NUL-terminated array of
-// bytes containing the text of s. If s contains a NUL byte at any
-// location, it returns (nil, EINVAL).
-func BytePtrFromString(s string) (*byte, error) {
- a, err := ByteSliceFromString(s)
- if err != nil {
- return nil, err
- }
- return &a[0], nil
-}
-
-// Single-word zero for use when we need a valid pointer to 0 bytes.
-// See mkunix.pl.
-var _zero uintptr
-
-func (ts *Timespec) Unix() (sec int64, nsec int64) {
- return int64(ts.Sec), int64(ts.Nsec)
-}
-
-func (tv *Timeval) Unix() (sec int64, nsec int64) {
- return int64(tv.Sec), int64(tv.Usec) * 1000
-}
-
-func (ts *Timespec) Nano() int64 {
- return int64(ts.Sec)*1e9 + int64(ts.Nsec)
-}
-
-func (tv *Timeval) Nano() int64 {
- return int64(tv.Sec)*1e9 + int64(tv.Usec)*1000
-}
-
-// use is a no-op, but the compiler cannot see that it is.
-// Calling use(p) ensures that p is kept live until that point.
-//go:noescape
-func use(p unsafe.Pointer)
diff --git a/vendor/golang.org/x/sys/unix/syscall_bsd.go b/vendor/golang.org/x/sys/unix/syscall_bsd.go
deleted file mode 100644
index e9671764..00000000
--- a/vendor/golang.org/x/sys/unix/syscall_bsd.go
+++ /dev/null
@@ -1,628 +0,0 @@
-// Copyright 2009 The Go Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style
-// license that can be found in the LICENSE file.
-
-// +build darwin dragonfly freebsd netbsd openbsd
-
-// BSD system call wrappers shared by *BSD based systems
-// including OS X (Darwin) and FreeBSD. Like the other
-// syscall_*.go files it is compiled as Go code but also
-// used as input to mksyscall which parses the //sys
-// lines and generates system call stubs.
-
-package unix
-
-import (
- "runtime"
- "syscall"
- "unsafe"
-)
-
-/*
- * Wrapped
- */
-
-//sysnb getgroups(ngid int, gid *_Gid_t) (n int, err error)
-//sysnb setgroups(ngid int, gid *_Gid_t) (err error)
-
-func Getgroups() (gids []int, err error) {
- n, err := getgroups(0, nil)
- if err != nil {
- return nil, err
- }
- if n == 0 {
- return nil, nil
- }
-
- // Sanity check group count. Max is 16 on BSD.
- if n < 0 || n > 1000 {
- return nil, EINVAL
- }
-
- a := make([]_Gid_t, n)
- n, err = getgroups(n, &a[0])
- if err != nil {
- return nil, err
- }
- gids = make([]int, n)
- for i, v := range a[0:n] {
- gids[i] = int(v)
- }
- return
-}
-
-func Setgroups(gids []int) (err error) {
- if len(gids) == 0 {
- return setgroups(0, nil)
- }
-
- a := make([]_Gid_t, len(gids))
- for i, v := range gids {
- a[i] = _Gid_t(v)
- }
- return setgroups(len(a), &a[0])
-}
-
-func ReadDirent(fd int, buf []byte) (n int, err error) {
- // Final argument is (basep *uintptr) and the syscall doesn't take nil.
- // 64 bits should be enough. (32 bits isn't even on 386). Since the
- // actual system call is getdirentries64, 64 is a good guess.
- // TODO(rsc): Can we use a single global basep for all calls?
- var base = (*uintptr)(unsafe.Pointer(new(uint64)))
- return Getdirentries(fd, buf, base)
-}
-
-// Wait status is 7 bits at bottom, either 0 (exited),
-// 0x7F (stopped), or a signal number that caused an exit.
-// The 0x80 bit is whether there was a core dump.
-// An extra number (exit code, signal causing a stop)
-// is in the high bits.
-
-type WaitStatus uint32
-
-const (
- mask = 0x7F
- core = 0x80
- shift = 8
-
- exited = 0
- stopped = 0x7F
-)
-
-func (w WaitStatus) Exited() bool { return w&mask == exited }
-
-func (w WaitStatus) ExitStatus() int {
- if w&mask != exited {
- return -1
- }
- return int(w >> shift)
-}
-
-func (w WaitStatus) Signaled() bool { return w&mask != stopped && w&mask != 0 }
-
-func (w WaitStatus) Signal() syscall.Signal {
- sig := syscall.Signal(w & mask)
- if sig == stopped || sig == 0 {
- return -1
- }
- return sig
-}
-
-func (w WaitStatus) CoreDump() bool { return w.Signaled() && w&core != 0 }
-
-func (w WaitStatus) Stopped() bool { return w&mask == stopped && syscall.Signal(w>>shift) != SIGSTOP }
-
-func (w WaitStatus) Continued() bool { return w&mask == stopped && syscall.Signal(w>>shift) == SIGSTOP }
-
-func (w WaitStatus) StopSignal() syscall.Signal {
- if !w.Stopped() {
- return -1
- }
- return syscall.Signal(w>>shift) & 0xFF
-}
-
-func (w WaitStatus) TrapCause() int { return -1 }
-
-//sys wait4(pid int, wstatus *_C_int, options int, rusage *Rusage) (wpid int, err error)
-
-func Wait4(pid int, wstatus *WaitStatus, options int, rusage *Rusage) (wpid int, err error) {
- var status _C_int
- wpid, err = wait4(pid, &status, options, rusage)
- if wstatus != nil {
- *wstatus = WaitStatus(status)
- }
- return
-}
-
-//sys accept(s int, rsa *RawSockaddrAny, addrlen *_Socklen) (fd int, err error)
-//sys bind(s int, addr unsafe.Pointer, addrlen _Socklen) (err error)
-//sys connect(s int, addr unsafe.Pointer, addrlen _Socklen) (err error)
-//sysnb socket(domain int, typ int, proto int) (fd int, err error)
-//sys getsockopt(s int, level int, name int, val unsafe.Pointer, vallen *_Socklen) (err error)
-//sys setsockopt(s int, level int, name int, val unsafe.Pointer, vallen uintptr) (err error)
-//sysnb getpeername(fd int, rsa *RawSockaddrAny, addrlen *_Socklen) (err error)
-//sysnb getsockname(fd int, rsa *RawSockaddrAny, addrlen *_Socklen) (err error)
-//sys Shutdown(s int, how int) (err error)
-
-func (sa *SockaddrInet4) sockaddr() (unsafe.Pointer, _Socklen, error) {
- if sa.Port < 0 || sa.Port > 0xFFFF {
- return nil, 0, EINVAL
- }
- sa.raw.Len = SizeofSockaddrInet4
- sa.raw.Family = AF_INET
- p := (*[2]byte)(unsafe.Pointer(&sa.raw.Port))
- p[0] = byte(sa.Port >> 8)
- p[1] = byte(sa.Port)
- for i := 0; i < len(sa.Addr); i++ {
- sa.raw.Addr[i] = sa.Addr[i]
- }
- return unsafe.Pointer(&sa.raw), _Socklen(sa.raw.Len), nil
-}
-
-func (sa *SockaddrInet6) sockaddr() (unsafe.Pointer, _Socklen, error) {
- if sa.Port < 0 || sa.Port > 0xFFFF {
- return nil, 0, EINVAL
- }
- sa.raw.Len = SizeofSockaddrInet6
- sa.raw.Family = AF_INET6
- p := (*[2]byte)(unsafe.Pointer(&sa.raw.Port))
- p[0] = byte(sa.Port >> 8)
- p[1] = byte(sa.Port)
- sa.raw.Scope_id = sa.ZoneId
- for i := 0; i < len(sa.Addr); i++ {
- sa.raw.Addr[i] = sa.Addr[i]
- }
- return unsafe.Pointer(&sa.raw), _Socklen(sa.raw.Len), nil
-}
-
-func (sa *SockaddrUnix) sockaddr() (unsafe.Pointer, _Socklen, error) {
- name := sa.Name
- n := len(name)
- if n >= len(sa.raw.Path) || n == 0 {
- return nil, 0, EINVAL
- }
- sa.raw.Len = byte(3 + n) // 2 for Family, Len; 1 for NUL
- sa.raw.Family = AF_UNIX
- for i := 0; i < n; i++ {
- sa.raw.Path[i] = int8(name[i])
- }
- return unsafe.Pointer(&sa.raw), _Socklen(sa.raw.Len), nil
-}
-
-func (sa *SockaddrDatalink) sockaddr() (unsafe.Pointer, _Socklen, error) {
- if sa.Index == 0 {
- return nil, 0, EINVAL
- }
- sa.raw.Len = sa.Len
- sa.raw.Family = AF_LINK
- sa.raw.Index = sa.Index
- sa.raw.Type = sa.Type
- sa.raw.Nlen = sa.Nlen
- sa.raw.Alen = sa.Alen
- sa.raw.Slen = sa.Slen
- for i := 0; i < len(sa.raw.Data); i++ {
- sa.raw.Data[i] = sa.Data[i]
- }
- return unsafe.Pointer(&sa.raw), SizeofSockaddrDatalink, nil
-}
-
-func anyToSockaddr(rsa *RawSockaddrAny) (Sockaddr, error) {
- switch rsa.Addr.Family {
- case AF_LINK:
- pp := (*RawSockaddrDatalink)(unsafe.Pointer(rsa))
- sa := new(SockaddrDatalink)
- sa.Len = pp.Len
- sa.Family = pp.Family
- sa.Index = pp.Index
- sa.Type = pp.Type
- sa.Nlen = pp.Nlen
- sa.Alen = pp.Alen
- sa.Slen = pp.Slen
- for i := 0; i < len(sa.Data); i++ {
- sa.Data[i] = pp.Data[i]
- }
- return sa, nil
-
- case AF_UNIX:
- pp := (*RawSockaddrUnix)(unsafe.Pointer(rsa))
- if pp.Len < 2 || pp.Len > SizeofSockaddrUnix {
- return nil, EINVAL
- }
- sa := new(SockaddrUnix)
-
- // Some BSDs include the trailing NUL in the length, whereas
- // others do not. Work around this by subtracting the leading
- // family and len. The path is then scanned to see if a NUL
- // terminator still exists within the length.
- n := int(pp.Len) - 2 // subtract leading Family, Len
- for i := 0; i < n; i++ {
- if pp.Path[i] == 0 {
- // found early NUL; assume Len included the NUL
- // or was overestimating.
- n = i
- break
- }
- }
- bytes := (*[10000]byte)(unsafe.Pointer(&pp.Path[0]))[0:n]
- sa.Name = string(bytes)
- return sa, nil
-
- case AF_INET:
- pp := (*RawSockaddrInet4)(unsafe.Pointer(rsa))
- sa := new(SockaddrInet4)
- p := (*[2]byte)(unsafe.Pointer(&pp.Port))
- sa.Port = int(p[0])<<8 + int(p[1])
- for i := 0; i < len(sa.Addr); i++ {
- sa.Addr[i] = pp.Addr[i]
- }
- return sa, nil
-
- case AF_INET6:
- pp := (*RawSockaddrInet6)(unsafe.Pointer(rsa))
- sa := new(SockaddrInet6)
- p := (*[2]byte)(unsafe.Pointer(&pp.Port))
- sa.Port = int(p[0])<<8 + int(p[1])
- sa.ZoneId = pp.Scope_id
- for i := 0; i < len(sa.Addr); i++ {
- sa.Addr[i] = pp.Addr[i]
- }
- return sa, nil
- }
- return nil, EAFNOSUPPORT
-}
-
-func Accept(fd int) (nfd int, sa Sockaddr, err error) {
- var rsa RawSockaddrAny
- var len _Socklen = SizeofSockaddrAny
- nfd, err = accept(fd, &rsa, &len)
- if err != nil {
- return
- }
- if runtime.GOOS == "darwin" && len == 0 {
- // Accepted socket has no address.
- // This is likely due to a bug in xnu kernels,
- // where instead of ECONNABORTED error socket
- // is accepted, but has no address.
- Close(nfd)
- return 0, nil, ECONNABORTED
- }
- sa, err = anyToSockaddr(&rsa)
- if err != nil {
- Close(nfd)
- nfd = 0
- }
- return
-}
-
-func Getsockname(fd int) (sa Sockaddr, err error) {
- var rsa RawSockaddrAny
- var len _Socklen = SizeofSockaddrAny
- if err = getsockname(fd, &rsa, &len); err != nil {
- return
- }
- // TODO(jsing): DragonFly has a "bug" (see issue 3349), which should be
- // reported upstream.
- if runtime.GOOS == "dragonfly" && rsa.Addr.Family == AF_UNSPEC && rsa.Addr.Len == 0 {
- rsa.Addr.Family = AF_UNIX
- rsa.Addr.Len = SizeofSockaddrUnix
- }
- return anyToSockaddr(&rsa)
-}
-
-//sysnb socketpair(domain int, typ int, proto int, fd *[2]int32) (err error)
-
-func GetsockoptByte(fd, level, opt int) (value byte, err error) {
- var n byte
- vallen := _Socklen(1)
- err = getsockopt(fd, level, opt, unsafe.Pointer(&n), &vallen)
- return n, err
-}
-
-func GetsockoptInet4Addr(fd, level, opt int) (value [4]byte, err error) {
- vallen := _Socklen(4)
- err = getsockopt(fd, level, opt, unsafe.Pointer(&value[0]), &vallen)
- return value, err
-}
-
-func GetsockoptIPMreq(fd, level, opt int) (*IPMreq, error) {
- var value IPMreq
- vallen := _Socklen(SizeofIPMreq)
- err := getsockopt(fd, level, opt, unsafe.Pointer(&value), &vallen)
- return &value, err
-}
-
-func GetsockoptIPv6Mreq(fd, level, opt int) (*IPv6Mreq, error) {
- var value IPv6Mreq
- vallen := _Socklen(SizeofIPv6Mreq)
- err := getsockopt(fd, level, opt, unsafe.Pointer(&value), &vallen)
- return &value, err
-}
-
-func GetsockoptIPv6MTUInfo(fd, level, opt int) (*IPv6MTUInfo, error) {
- var value IPv6MTUInfo
- vallen := _Socklen(SizeofIPv6MTUInfo)
- err := getsockopt(fd, level, opt, unsafe.Pointer(&value), &vallen)
- return &value, err
-}
-
-func GetsockoptICMPv6Filter(fd, level, opt int) (*ICMPv6Filter, error) {
- var value ICMPv6Filter
- vallen := _Socklen(SizeofICMPv6Filter)
- err := getsockopt(fd, level, opt, unsafe.Pointer(&value), &vallen)
- return &value, err
-}
-
-//sys recvfrom(fd int, p []byte, flags int, from *RawSockaddrAny, fromlen *_Socklen) (n int, err error)
-//sys sendto(s int, buf []byte, flags int, to unsafe.Pointer, addrlen _Socklen) (err error)
-//sys recvmsg(s int, msg *Msghdr, flags int) (n int, err error)
-
-func Recvmsg(fd int, p, oob []byte, flags int) (n, oobn int, recvflags int, from Sockaddr, err error) {
- var msg Msghdr
- var rsa RawSockaddrAny
- msg.Name = (*byte)(unsafe.Pointer(&rsa))
- msg.Namelen = uint32(SizeofSockaddrAny)
- var iov Iovec
- if len(p) > 0 {
- iov.Base = (*byte)(unsafe.Pointer(&p[0]))
- iov.SetLen(len(p))
- }
- var dummy byte
- if len(oob) > 0 {
- // receive at least one normal byte
- if len(p) == 0 {
- iov.Base = &dummy
- iov.SetLen(1)
- }
- msg.Control = (*byte)(unsafe.Pointer(&oob[0]))
- msg.SetControllen(len(oob))
- }
- msg.Iov = &iov
- msg.Iovlen = 1
- if n, err = recvmsg(fd, &msg, flags); err != nil {
- return
- }
- oobn = int(msg.Controllen)
- recvflags = int(msg.Flags)
- // source address is only specified if the socket is unconnected
- if rsa.Addr.Family != AF_UNSPEC {
- from, err = anyToSockaddr(&rsa)
- }
- return
-}
-
-//sys sendmsg(s int, msg *Msghdr, flags int) (n int, err error)
-
-func Sendmsg(fd int, p, oob []byte, to Sockaddr, flags int) (err error) {
- _, err = SendmsgN(fd, p, oob, to, flags)
- return
-}
-
-func SendmsgN(fd int, p, oob []byte, to Sockaddr, flags int) (n int, err error) {
- var ptr unsafe.Pointer
- var salen _Socklen
- if to != nil {
- ptr, salen, err = to.sockaddr()
- if err != nil {
- return 0, err
- }
- }
- var msg Msghdr
- msg.Name = (*byte)(unsafe.Pointer(ptr))
- msg.Namelen = uint32(salen)
- var iov Iovec
- if len(p) > 0 {
- iov.Base = (*byte)(unsafe.Pointer(&p[0]))
- iov.SetLen(len(p))
- }
- var dummy byte
- if len(oob) > 0 {
- // send at least one normal byte
- if len(p) == 0 {
- iov.Base = &dummy
- iov.SetLen(1)
- }
- msg.Control = (*byte)(unsafe.Pointer(&oob[0]))
- msg.SetControllen(len(oob))
- }
- msg.Iov = &iov
- msg.Iovlen = 1
- if n, err = sendmsg(fd, &msg, flags); err != nil {
- return 0, err
- }
- if len(oob) > 0 && len(p) == 0 {
- n = 0
- }
- return n, nil
-}
-
-//sys kevent(kq int, change unsafe.Pointer, nchange int, event unsafe.Pointer, nevent int, timeout *Timespec) (n int, err error)
-
-func Kevent(kq int, changes, events []Kevent_t, timeout *Timespec) (n int, err error) {
- var change, event unsafe.Pointer
- if len(changes) > 0 {
- change = unsafe.Pointer(&changes[0])
- }
- if len(events) > 0 {
- event = unsafe.Pointer(&events[0])
- }
- return kevent(kq, change, len(changes), event, len(events), timeout)
-}
-
-//sys sysctl(mib []_C_int, old *byte, oldlen *uintptr, new *byte, newlen uintptr) (err error) = SYS___SYSCTL
-
-// sysctlmib translates name to mib number and appends any additional args.
-func sysctlmib(name string, args ...int) ([]_C_int, error) {
- // Translate name to mib number.
- mib, err := nametomib(name)
- if err != nil {
- return nil, err
- }
-
- for _, a := range args {
- mib = append(mib, _C_int(a))
- }
-
- return mib, nil
-}
-
-func Sysctl(name string) (string, error) {
- return SysctlArgs(name)
-}
-
-func SysctlArgs(name string, args ...int) (string, error) {
- mib, err := sysctlmib(name, args...)
- if err != nil {
- return "", err
- }
-
- // Find size.
- n := uintptr(0)
- if err := sysctl(mib, nil, &n, nil, 0); err != nil {
- return "", err
- }
- if n == 0 {
- return "", nil
- }
-
- // Read into buffer of that size.
- buf := make([]byte, n)
- if err := sysctl(mib, &buf[0], &n, nil, 0); err != nil {
- return "", err
- }
-
- // Throw away terminating NUL.
- if n > 0 && buf[n-1] == '\x00' {
- n--
- }
- return string(buf[0:n]), nil
-}
-
-func SysctlUint32(name string) (uint32, error) {
- return SysctlUint32Args(name)
-}
-
-func SysctlUint32Args(name string, args ...int) (uint32, error) {
- mib, err := sysctlmib(name, args...)
- if err != nil {
- return 0, err
- }
-
- n := uintptr(4)
- buf := make([]byte, 4)
- if err := sysctl(mib, &buf[0], &n, nil, 0); err != nil {
- return 0, err
- }
- if n != 4 {
- return 0, EIO
- }
- return *(*uint32)(unsafe.Pointer(&buf[0])), nil
-}
-
-func SysctlUint64(name string, args ...int) (uint64, error) {
- mib, err := sysctlmib(name, args...)
- if err != nil {
- return 0, err
- }
-
- n := uintptr(8)
- buf := make([]byte, 8)
- if err := sysctl(mib, &buf[0], &n, nil, 0); err != nil {
- return 0, err
- }
- if n != 8 {
- return 0, EIO
- }
- return *(*uint64)(unsafe.Pointer(&buf[0])), nil
-}
-
-func SysctlRaw(name string, args ...int) ([]byte, error) {
- mib, err := sysctlmib(name, args...)
- if err != nil {
- return nil, err
- }
-
- // Find size.
- n := uintptr(0)
- if err := sysctl(mib, nil, &n, nil, 0); err != nil {
- return nil, err
- }
- if n == 0 {
- return nil, nil
- }
-
- // Read into buffer of that size.
- buf := make([]byte, n)
- if err := sysctl(mib, &buf[0], &n, nil, 0); err != nil {
- return nil, err
- }
-
- // The actual call may return less than the original reported required
- // size so ensure we deal with that.
- return buf[:n], nil
-}
-
-//sys utimes(path string, timeval *[2]Timeval) (err error)
-
-func Utimes(path string, tv []Timeval) error {
- if tv == nil {
- return utimes(path, nil)
- }
- if len(tv) != 2 {
- return EINVAL
- }
- return utimes(path, (*[2]Timeval)(unsafe.Pointer(&tv[0])))
-}
-
-func UtimesNano(path string, ts []Timespec) error {
- if ts == nil {
- return utimes(path, nil)
- }
- // TODO: The BSDs can do utimensat with SYS_UTIMENSAT but it
- // isn't supported by darwin so this uses utimes instead
- if len(ts) != 2 {
- return EINVAL
- }
- // Not as efficient as it could be because Timespec and
- // Timeval have different types in the different OSes
- tv := [2]Timeval{
- NsecToTimeval(TimespecToNsec(ts[0])),
- NsecToTimeval(TimespecToNsec(ts[1])),
- }
- return utimes(path, (*[2]Timeval)(unsafe.Pointer(&tv[0])))
-}
-
-//sys futimes(fd int, timeval *[2]Timeval) (err error)
-
-func Futimes(fd int, tv []Timeval) error {
- if tv == nil {
- return futimes(fd, nil)
- }
- if len(tv) != 2 {
- return EINVAL
- }
- return futimes(fd, (*[2]Timeval)(unsafe.Pointer(&tv[0])))
-}
-
-//sys fcntl(fd int, cmd int, arg int) (val int, err error)
-
-// TODO: wrap
-// Acct(name nil-string) (err error)
-// Gethostuuid(uuid *byte, timeout *Timespec) (err error)
-// Madvise(addr *byte, len int, behav int) (err error)
-// Mprotect(addr *byte, len int, prot int) (err error)
-// Msync(addr *byte, len int, flags int) (err error)
-// Ptrace(req int, pid int, addr uintptr, data int) (ret uintptr, err error)
-
-var mapper = &mmapper{
- active: make(map[*byte][]byte),
- mmap: mmap,
- munmap: munmap,
-}
-
-func Mmap(fd int, offset int64, length int, prot int, flags int) (data []byte, err error) {
- return mapper.Mmap(fd, offset, length, prot, flags)
-}
-
-func Munmap(b []byte) (err error) {
- return mapper.Munmap(b)
-}
diff --git a/vendor/golang.org/x/sys/unix/syscall_darwin.go b/vendor/golang.org/x/sys/unix/syscall_darwin.go
deleted file mode 100644
index 0d1771c3..00000000
--- a/vendor/golang.org/x/sys/unix/syscall_darwin.go
+++ /dev/null
@@ -1,509 +0,0 @@
-// Copyright 2009,2010 The Go Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style
-// license that can be found in the LICENSE file.
-
-// Darwin system calls.
-// This file is compiled as ordinary Go code,
-// but it is also input to mksyscall,
-// which parses the //sys lines and generates system call stubs.
-// Note that sometimes we use a lowercase //sys name and wrap
-// it in our own nicer implementation, either here or in
-// syscall_bsd.go or syscall_unix.go.
-
-package unix
-
-import (
- errorspkg "errors"
- "syscall"
- "unsafe"
-)
-
-const ImplementsGetwd = true
-
-func Getwd() (string, error) {
- buf := make([]byte, 2048)
- attrs, err := getAttrList(".", attrList{CommonAttr: attrCmnFullpath}, buf, 0)
- if err == nil && len(attrs) == 1 && len(attrs[0]) >= 2 {
- wd := string(attrs[0])
- // Sanity check that it's an absolute path and ends
- // in a null byte, which we then strip.
- if wd[0] == '/' && wd[len(wd)-1] == 0 {
- return wd[:len(wd)-1], nil
- }
- }
- // If pkg/os/getwd.go gets ENOTSUP, it will fall back to the
- // slow algorithm.
- return "", ENOTSUP
-}
-
-type SockaddrDatalink struct {
- Len uint8
- Family uint8
- Index uint16
- Type uint8
- Nlen uint8
- Alen uint8
- Slen uint8
- Data [12]int8
- raw RawSockaddrDatalink
-}
-
-// Translate "kern.hostname" to []_C_int{0,1,2,3}.
-func nametomib(name string) (mib []_C_int, err error) {
- const siz = unsafe.Sizeof(mib[0])
-
- // NOTE(rsc): It seems strange to set the buffer to have
- // size CTL_MAXNAME+2 but use only CTL_MAXNAME
- // as the size. I don't know why the +2 is here, but the
- // kernel uses +2 for its own implementation of this function.
- // I am scared that if we don't include the +2 here, the kernel
- // will silently write 2 words farther than we specify
- // and we'll get memory corruption.
- var buf [CTL_MAXNAME + 2]_C_int
- n := uintptr(CTL_MAXNAME) * siz
-
- p := (*byte)(unsafe.Pointer(&buf[0]))
- bytes, err := ByteSliceFromString(name)
- if err != nil {
- return nil, err
- }
-
- // Magic sysctl: "setting" 0.3 to a string name
- // lets you read back the array of integers form.
- if err = sysctl([]_C_int{0, 3}, p, &n, &bytes[0], uintptr(len(name))); err != nil {
- return nil, err
- }
- return buf[0 : n/siz], nil
-}
-
-// ParseDirent parses up to max directory entries in buf,
-// appending the names to names. It returns the number
-// bytes consumed from buf, the number of entries added
-// to names, and the new names slice.
-func ParseDirent(buf []byte, max int, names []string) (consumed int, count int, newnames []string) {
- origlen := len(buf)
- for max != 0 && len(buf) > 0 {
- dirent := (*Dirent)(unsafe.Pointer(&buf[0]))
- if dirent.Reclen == 0 {
- buf = nil
- break
- }
- buf = buf[dirent.Reclen:]
- if dirent.Ino == 0 { // File absent in directory.
- continue
- }
- bytes := (*[10000]byte)(unsafe.Pointer(&dirent.Name[0]))
- var name = string(bytes[0:dirent.Namlen])
- if name == "." || name == ".." { // Useless names
- continue
- }
- max--
- count++
- names = append(names, name)
- }
- return origlen - len(buf), count, names
-}
-
-//sys ptrace(request int, pid int, addr uintptr, data uintptr) (err error)
-func PtraceAttach(pid int) (err error) { return ptrace(PT_ATTACH, pid, 0, 0) }
-func PtraceDetach(pid int) (err error) { return ptrace(PT_DETACH, pid, 0, 0) }
-
-const (
- attrBitMapCount = 5
- attrCmnFullpath = 0x08000000
-)
-
-type attrList struct {
- bitmapCount uint16
- _ uint16
- CommonAttr uint32
- VolAttr uint32
- DirAttr uint32
- FileAttr uint32
- Forkattr uint32
-}
-
-func getAttrList(path string, attrList attrList, attrBuf []byte, options uint) (attrs [][]byte, err error) {
- if len(attrBuf) < 4 {
- return nil, errorspkg.New("attrBuf too small")
- }
- attrList.bitmapCount = attrBitMapCount
-
- var _p0 *byte
- _p0, err = BytePtrFromString(path)
- if err != nil {
- return nil, err
- }
-
- _, _, e1 := Syscall6(
- SYS_GETATTRLIST,
- uintptr(unsafe.Pointer(_p0)),
- uintptr(unsafe.Pointer(&attrList)),
- uintptr(unsafe.Pointer(&attrBuf[0])),
- uintptr(len(attrBuf)),
- uintptr(options),
- 0,
- )
- if e1 != 0 {
- return nil, e1
- }
- size := *(*uint32)(unsafe.Pointer(&attrBuf[0]))
-
- // dat is the section of attrBuf that contains valid data,
- // without the 4 byte length header. All attribute offsets
- // are relative to dat.
- dat := attrBuf
- if int(size) < len(attrBuf) {
- dat = dat[:size]
- }
- dat = dat[4:] // remove length prefix
-
- for i := uint32(0); int(i) < len(dat); {
- header := dat[i:]
- if len(header) < 8 {
- return attrs, errorspkg.New("truncated attribute header")
- }
- datOff := *(*int32)(unsafe.Pointer(&header[0]))
- attrLen := *(*uint32)(unsafe.Pointer(&header[4]))
- if datOff < 0 || uint32(datOff)+attrLen > uint32(len(dat)) {
- return attrs, errorspkg.New("truncated results; attrBuf too small")
- }
- end := uint32(datOff) + attrLen
- attrs = append(attrs, dat[datOff:end])
- i = end
- if r := i % 4; r != 0 {
- i += (4 - r)
- }
- }
- return
-}
-
-//sysnb pipe() (r int, w int, err error)
-
-func Pipe(p []int) (err error) {
- if len(p) != 2 {
- return EINVAL
- }
- p[0], p[1], err = pipe()
- return
-}
-
-func Getfsstat(buf []Statfs_t, flags int) (n int, err error) {
- var _p0 unsafe.Pointer
- var bufsize uintptr
- if len(buf) > 0 {
- _p0 = unsafe.Pointer(&buf[0])
- bufsize = unsafe.Sizeof(Statfs_t{}) * uintptr(len(buf))
- }
- r0, _, e1 := Syscall(SYS_GETFSSTAT64, uintptr(_p0), bufsize, uintptr(flags))
- n = int(r0)
- if e1 != 0 {
- err = e1
- }
- return
-}
-
-/*
- * Wrapped
- */
-
-//sys kill(pid int, signum int, posix int) (err error)
-
-func Kill(pid int, signum syscall.Signal) (err error) { return kill(pid, int(signum), 1) }
-
-/*
- * Exposed directly
- */
-//sys Access(path string, mode uint32) (err error)
-//sys Adjtime(delta *Timeval, olddelta *Timeval) (err error)
-//sys Chdir(path string) (err error)
-//sys Chflags(path string, flags int) (err error)
-//sys Chmod(path string, mode uint32) (err error)
-//sys Chown(path string, uid int, gid int) (err error)
-//sys Chroot(path string) (err error)
-//sys Close(fd int) (err error)
-//sys Dup(fd int) (nfd int, err error)
-//sys Dup2(from int, to int) (err error)
-//sys Exchangedata(path1 string, path2 string, options int) (err error)
-//sys Exit(code int)
-//sys Fchdir(fd int) (err error)
-//sys Fchflags(fd int, flags int) (err error)
-//sys Fchmod(fd int, mode uint32) (err error)
-//sys Fchown(fd int, uid int, gid int) (err error)
-//sys Flock(fd int, how int) (err error)
-//sys Fpathconf(fd int, name int) (val int, err error)
-//sys Fstat(fd int, stat *Stat_t) (err error) = SYS_FSTAT64
-//sys Fstatfs(fd int, stat *Statfs_t) (err error) = SYS_FSTATFS64
-//sys Fsync(fd int) (err error)
-//sys Ftruncate(fd int, length int64) (err error)
-//sys Getdirentries(fd int, buf []byte, basep *uintptr) (n int, err error) = SYS_GETDIRENTRIES64
-//sys Getdtablesize() (size int)
-//sysnb Getegid() (egid int)
-//sysnb Geteuid() (uid int)
-//sysnb Getgid() (gid int)
-//sysnb Getpgid(pid int) (pgid int, err error)
-//sysnb Getpgrp() (pgrp int)
-//sysnb Getpid() (pid int)
-//sysnb Getppid() (ppid int)
-//sys Getpriority(which int, who int) (prio int, err error)
-//sysnb Getrlimit(which int, lim *Rlimit) (err error)
-//sysnb Getrusage(who int, rusage *Rusage) (err error)
-//sysnb Getsid(pid int) (sid int, err error)
-//sysnb Getuid() (uid int)
-//sysnb Issetugid() (tainted bool)
-//sys Kqueue() (fd int, err error)
-//sys Lchown(path string, uid int, gid int) (err error)
-//sys Link(path string, link string) (err error)
-//sys Listen(s int, backlog int) (err error)
-//sys Lstat(path string, stat *Stat_t) (err error) = SYS_LSTAT64
-//sys Mkdir(path string, mode uint32) (err error)
-//sys Mkfifo(path string, mode uint32) (err error)
-//sys Mknod(path string, mode uint32, dev int) (err error)
-//sys Mlock(b []byte) (err error)
-//sys Mlockall(flags int) (err error)
-//sys Mprotect(b []byte, prot int) (err error)
-//sys Munlock(b []byte) (err error)
-//sys Munlockall() (err error)
-//sys Open(path string, mode int, perm uint32) (fd int, err error)
-//sys Pathconf(path string, name int) (val int, err error)
-//sys Pread(fd int, p []byte, offset int64) (n int, err error)
-//sys Pwrite(fd int, p []byte, offset int64) (n int, err error)
-//sys read(fd int, p []byte) (n int, err error)
-//sys Readlink(path string, buf []byte) (n int, err error)
-//sys Rename(from string, to string) (err error)
-//sys Revoke(path string) (err error)
-//sys Rmdir(path string) (err error)
-//sys Seek(fd int, offset int64, whence int) (newoffset int64, err error) = SYS_LSEEK
-//sys Select(n int, r *FdSet, w *FdSet, e *FdSet, timeout *Timeval) (err error)
-//sys Setegid(egid int) (err error)
-//sysnb Seteuid(euid int) (err error)
-//sysnb Setgid(gid int) (err error)
-//sys Setlogin(name string) (err error)
-//sysnb Setpgid(pid int, pgid int) (err error)
-//sys Setpriority(which int, who int, prio int) (err error)
-//sys Setprivexec(flag int) (err error)
-//sysnb Setregid(rgid int, egid int) (err error)
-//sysnb Setreuid(ruid int, euid int) (err error)
-//sysnb Setrlimit(which int, lim *Rlimit) (err error)
-//sysnb Setsid() (pid int, err error)
-//sysnb Settimeofday(tp *Timeval) (err error)
-//sysnb Setuid(uid int) (err error)
-//sys Stat(path string, stat *Stat_t) (err error) = SYS_STAT64
-//sys Statfs(path string, stat *Statfs_t) (err error) = SYS_STATFS64
-//sys Symlink(path string, link string) (err error)
-//sys Sync() (err error)
-//sys Truncate(path string, length int64) (err error)
-//sys Umask(newmask int) (oldmask int)
-//sys Undelete(path string) (err error)
-//sys Unlink(path string) (err error)
-//sys Unmount(path string, flags int) (err error)
-//sys write(fd int, p []byte) (n int, err error)
-//sys mmap(addr uintptr, length uintptr, prot int, flag int, fd int, pos int64) (ret uintptr, err error)
-//sys munmap(addr uintptr, length uintptr) (err error)
-//sys readlen(fd int, buf *byte, nbuf int) (n int, err error) = SYS_READ
-//sys writelen(fd int, buf *byte, nbuf int) (n int, err error) = SYS_WRITE
-
-/*
- * Unimplemented
- */
-// Profil
-// Sigaction
-// Sigprocmask
-// Getlogin
-// Sigpending
-// Sigaltstack
-// Ioctl
-// Reboot
-// Execve
-// Vfork
-// Sbrk
-// Sstk
-// Ovadvise
-// Mincore
-// Setitimer
-// Swapon
-// Select
-// Sigsuspend
-// Readv
-// Writev
-// Nfssvc
-// Getfh
-// Quotactl
-// Mount
-// Csops
-// Waitid
-// Add_profil
-// Kdebug_trace
-// Sigreturn
-// Mmap
-// Mlock
-// Munlock
-// Atsocket
-// Kqueue_from_portset_np
-// Kqueue_portset
-// Getattrlist
-// Setattrlist
-// Getdirentriesattr
-// Searchfs
-// Delete
-// Copyfile
-// Poll
-// Watchevent
-// Waitevent
-// Modwatch
-// Getxattr
-// Fgetxattr
-// Setxattr
-// Fsetxattr
-// Removexattr
-// Fremovexattr
-// Listxattr
-// Flistxattr
-// Fsctl
-// Initgroups
-// Posix_spawn
-// Nfsclnt
-// Fhopen
-// Minherit
-// Semsys
-// Msgsys
-// Shmsys
-// Semctl
-// Semget
-// Semop
-// Msgctl
-// Msgget
-// Msgsnd
-// Msgrcv
-// Shmat
-// Shmctl
-// Shmdt
-// Shmget
-// Shm_open
-// Shm_unlink
-// Sem_open
-// Sem_close
-// Sem_unlink
-// Sem_wait
-// Sem_trywait
-// Sem_post
-// Sem_getvalue
-// Sem_init
-// Sem_destroy
-// Open_extended
-// Umask_extended
-// Stat_extended
-// Lstat_extended
-// Fstat_extended
-// Chmod_extended
-// Fchmod_extended
-// Access_extended
-// Settid
-// Gettid
-// Setsgroups
-// Getsgroups
-// Setwgroups
-// Getwgroups
-// Mkfifo_extended
-// Mkdir_extended
-// Identitysvc
-// Shared_region_check_np
-// Shared_region_map_np
-// __pthread_mutex_destroy
-// __pthread_mutex_init
-// __pthread_mutex_lock
-// __pthread_mutex_trylock
-// __pthread_mutex_unlock
-// __pthread_cond_init
-// __pthread_cond_destroy
-// __pthread_cond_broadcast
-// __pthread_cond_signal
-// Setsid_with_pid
-// __pthread_cond_timedwait
-// Aio_fsync
-// Aio_return
-// Aio_suspend
-// Aio_cancel
-// Aio_error
-// Aio_read
-// Aio_write
-// Lio_listio
-// __pthread_cond_wait
-// Iopolicysys
-// Mlockall
-// Munlockall
-// __pthread_kill
-// __pthread_sigmask
-// __sigwait
-// __disable_threadsignal
-// __pthread_markcancel
-// __pthread_canceled
-// __semwait_signal
-// Proc_info
-// sendfile
-// Stat64_extended
-// Lstat64_extended
-// Fstat64_extended
-// __pthread_chdir
-// __pthread_fchdir
-// Audit
-// Auditon
-// Getauid
-// Setauid
-// Getaudit
-// Setaudit
-// Getaudit_addr
-// Setaudit_addr
-// Auditctl
-// Bsdthread_create
-// Bsdthread_terminate
-// Stack_snapshot
-// Bsdthread_register
-// Workq_open
-// Workq_ops
-// __mac_execve
-// __mac_syscall
-// __mac_get_file
-// __mac_set_file
-// __mac_get_link
-// __mac_set_link
-// __mac_get_proc
-// __mac_set_proc
-// __mac_get_fd
-// __mac_set_fd
-// __mac_get_pid
-// __mac_get_lcid
-// __mac_get_lctx
-// __mac_set_lctx
-// Setlcid
-// Read_nocancel
-// Write_nocancel
-// Open_nocancel
-// Close_nocancel
-// Wait4_nocancel
-// Recvmsg_nocancel
-// Sendmsg_nocancel
-// Recvfrom_nocancel
-// Accept_nocancel
-// Msync_nocancel
-// Fcntl_nocancel
-// Select_nocancel
-// Fsync_nocancel
-// Connect_nocancel
-// Sigsuspend_nocancel
-// Readv_nocancel
-// Writev_nocancel
-// Sendto_nocancel
-// Pread_nocancel
-// Pwrite_nocancel
-// Waitid_nocancel
-// Poll_nocancel
-// Msgsnd_nocancel
-// Msgrcv_nocancel
-// Sem_wait_nocancel
-// Aio_suspend_nocancel
-// __sigwait_nocancel
-// __semwait_signal_nocancel
-// __mac_mount
-// __mac_get_mount
-// __mac_getfsstat
diff --git a/vendor/golang.org/x/sys/unix/syscall_darwin_386.go b/vendor/golang.org/x/sys/unix/syscall_darwin_386.go
deleted file mode 100644
index 3195c8bf..00000000
--- a/vendor/golang.org/x/sys/unix/syscall_darwin_386.go
+++ /dev/null
@@ -1,79 +0,0 @@
-// Copyright 2009 The Go Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style
-// license that can be found in the LICENSE file.
-
-// +build 386,darwin
-
-package unix
-
-import (
- "syscall"
- "unsafe"
-)
-
-func Getpagesize() int { return 4096 }
-
-func TimespecToNsec(ts Timespec) int64 { return int64(ts.Sec)*1e9 + int64(ts.Nsec) }
-
-func NsecToTimespec(nsec int64) (ts Timespec) {
- ts.Sec = int32(nsec / 1e9)
- ts.Nsec = int32(nsec % 1e9)
- return
-}
-
-func TimevalToNsec(tv Timeval) int64 { return int64(tv.Sec)*1e9 + int64(tv.Usec)*1e3 }
-
-func NsecToTimeval(nsec int64) (tv Timeval) {
- nsec += 999 // round up to microsecond
- tv.Usec = int32(nsec % 1e9 / 1e3)
- tv.Sec = int32(nsec / 1e9)
- return
-}
-
-//sysnb gettimeofday(tp *Timeval) (sec int32, usec int32, err error)
-func Gettimeofday(tv *Timeval) (err error) {
- // The tv passed to gettimeofday must be non-nil
- // but is otherwise unused. The answers come back
- // in the two registers.
- sec, usec, err := gettimeofday(tv)
- tv.Sec = int32(sec)
- tv.Usec = int32(usec)
- return err
-}
-
-func SetKevent(k *Kevent_t, fd, mode, flags int) {
- k.Ident = uint32(fd)
- k.Filter = int16(mode)
- k.Flags = uint16(flags)
-}
-
-func (iov *Iovec) SetLen(length int) {
- iov.Len = uint32(length)
-}
-
-func (msghdr *Msghdr) SetControllen(length int) {
- msghdr.Controllen = uint32(length)
-}
-
-func (cmsg *Cmsghdr) SetLen(length int) {
- cmsg.Len = uint32(length)
-}
-
-func sendfile(outfd int, infd int, offset *int64, count int) (written int, err error) {
- var length = uint64(count)
-
- _, _, e1 := Syscall9(SYS_SENDFILE, uintptr(infd), uintptr(outfd), uintptr(*offset), uintptr(*offset>>32), uintptr(unsafe.Pointer(&length)), 0, 0, 0, 0)
-
- written = int(length)
-
- if e1 != 0 {
- err = e1
- }
- return
-}
-
-func Syscall9(num, a1, a2, a3, a4, a5, a6, a7, a8, a9 uintptr) (r1, r2 uintptr, err syscall.Errno)
-
-// SYS___SYSCTL is used by syscall_bsd.go for all BSDs, but in modern versions
-// of darwin/386 the syscall is called sysctl instead of __sysctl.
-const SYS___SYSCTL = SYS_SYSCTL
diff --git a/vendor/golang.org/x/sys/unix/syscall_darwin_amd64.go b/vendor/golang.org/x/sys/unix/syscall_darwin_amd64.go
deleted file mode 100644
index 7adb98de..00000000
--- a/vendor/golang.org/x/sys/unix/syscall_darwin_amd64.go
+++ /dev/null
@@ -1,81 +0,0 @@
-// Copyright 2009 The Go Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style
-// license that can be found in the LICENSE file.
-
-// +build amd64,darwin
-
-package unix
-
-import (
- "syscall"
- "unsafe"
-)
-
-//sys Fchmodat(dirfd int, path string, mode uint32, flags int) (err error)
-
-func Getpagesize() int { return 4096 }
-
-func TimespecToNsec(ts Timespec) int64 { return int64(ts.Sec)*1e9 + int64(ts.Nsec) }
-
-func NsecToTimespec(nsec int64) (ts Timespec) {
- ts.Sec = nsec / 1e9
- ts.Nsec = nsec % 1e9
- return
-}
-
-func TimevalToNsec(tv Timeval) int64 { return int64(tv.Sec)*1e9 + int64(tv.Usec)*1e3 }
-
-func NsecToTimeval(nsec int64) (tv Timeval) {
- nsec += 999 // round up to microsecond
- tv.Usec = int32(nsec % 1e9 / 1e3)
- tv.Sec = int64(nsec / 1e9)
- return
-}
-
-//sysnb gettimeofday(tp *Timeval) (sec int64, usec int32, err error)
-func Gettimeofday(tv *Timeval) (err error) {
- // The tv passed to gettimeofday must be non-nil
- // but is otherwise unused. The answers come back
- // in the two registers.
- sec, usec, err := gettimeofday(tv)
- tv.Sec = sec
- tv.Usec = usec
- return err
-}
-
-func SetKevent(k *Kevent_t, fd, mode, flags int) {
- k.Ident = uint64(fd)
- k.Filter = int16(mode)
- k.Flags = uint16(flags)
-}
-
-func (iov *Iovec) SetLen(length int) {
- iov.Len = uint64(length)
-}
-
-func (msghdr *Msghdr) SetControllen(length int) {
- msghdr.Controllen = uint32(length)
-}
-
-func (cmsg *Cmsghdr) SetLen(length int) {
- cmsg.Len = uint32(length)
-}
-
-func sendfile(outfd int, infd int, offset *int64, count int) (written int, err error) {
- var length = uint64(count)
-
- _, _, e1 := Syscall6(SYS_SENDFILE, uintptr(infd), uintptr(outfd), uintptr(*offset), uintptr(unsafe.Pointer(&length)), 0, 0)
-
- written = int(length)
-
- if e1 != 0 {
- err = e1
- }
- return
-}
-
-func Syscall9(num, a1, a2, a3, a4, a5, a6, a7, a8, a9 uintptr) (r1, r2 uintptr, err syscall.Errno)
-
-// SYS___SYSCTL is used by syscall_bsd.go for all BSDs, but in modern versions
-// of darwin/amd64 the syscall is called sysctl instead of __sysctl.
-const SYS___SYSCTL = SYS_SYSCTL
diff --git a/vendor/golang.org/x/sys/unix/syscall_darwin_arm.go b/vendor/golang.org/x/sys/unix/syscall_darwin_arm.go
deleted file mode 100644
index e47ffd73..00000000
--- a/vendor/golang.org/x/sys/unix/syscall_darwin_arm.go
+++ /dev/null
@@ -1,73 +0,0 @@
-// Copyright 2015 The Go Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style
-// license that can be found in the LICENSE file.
-
-package unix
-
-import (
- "syscall"
- "unsafe"
-)
-
-func Getpagesize() int { return 4096 }
-
-func TimespecToNsec(ts Timespec) int64 { return int64(ts.Sec)*1e9 + int64(ts.Nsec) }
-
-func NsecToTimespec(nsec int64) (ts Timespec) {
- ts.Sec = int32(nsec / 1e9)
- ts.Nsec = int32(nsec % 1e9)
- return
-}
-
-func TimevalToNsec(tv Timeval) int64 { return int64(tv.Sec)*1e9 + int64(tv.Usec)*1e3 }
-
-func NsecToTimeval(nsec int64) (tv Timeval) {
- nsec += 999 // round up to microsecond
- tv.Usec = int32(nsec % 1e9 / 1e3)
- tv.Sec = int32(nsec / 1e9)
- return
-}
-
-//sysnb gettimeofday(tp *Timeval) (sec int32, usec int32, err error)
-func Gettimeofday(tv *Timeval) (err error) {
- // The tv passed to gettimeofday must be non-nil
- // but is otherwise unused. The answers come back
- // in the two registers.
- sec, usec, err := gettimeofday(tv)
- tv.Sec = int32(sec)
- tv.Usec = int32(usec)
- return err
-}
-
-func SetKevent(k *Kevent_t, fd, mode, flags int) {
- k.Ident = uint32(fd)
- k.Filter = int16(mode)
- k.Flags = uint16(flags)
-}
-
-func (iov *Iovec) SetLen(length int) {
- iov.Len = uint32(length)
-}
-
-func (msghdr *Msghdr) SetControllen(length int) {
- msghdr.Controllen = uint32(length)
-}
-
-func (cmsg *Cmsghdr) SetLen(length int) {
- cmsg.Len = uint32(length)
-}
-
-func sendfile(outfd int, infd int, offset *int64, count int) (written int, err error) {
- var length = uint64(count)
-
- _, _, e1 := Syscall9(SYS_SENDFILE, uintptr(infd), uintptr(outfd), uintptr(*offset), uintptr(*offset>>32), uintptr(unsafe.Pointer(&length)), 0, 0, 0, 0)
-
- written = int(length)
-
- if e1 != 0 {
- err = e1
- }
- return
-}
-
-func Syscall9(num, a1, a2, a3, a4, a5, a6, a7, a8, a9 uintptr) (r1, r2 uintptr, err syscall.Errno) // sic
diff --git a/vendor/golang.org/x/sys/unix/syscall_darwin_arm64.go b/vendor/golang.org/x/sys/unix/syscall_darwin_arm64.go
deleted file mode 100644
index 2560a959..00000000
--- a/vendor/golang.org/x/sys/unix/syscall_darwin_arm64.go
+++ /dev/null
@@ -1,79 +0,0 @@
-// Copyright 2015 The Go Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style
-// license that can be found in the LICENSE file.
-
-// +build arm64,darwin
-
-package unix
-
-import (
- "syscall"
- "unsafe"
-)
-
-func Getpagesize() int { return 16384 }
-
-func TimespecToNsec(ts Timespec) int64 { return int64(ts.Sec)*1e9 + int64(ts.Nsec) }
-
-func NsecToTimespec(nsec int64) (ts Timespec) {
- ts.Sec = nsec / 1e9
- ts.Nsec = nsec % 1e9
- return
-}
-
-func TimevalToNsec(tv Timeval) int64 { return int64(tv.Sec)*1e9 + int64(tv.Usec)*1e3 }
-
-func NsecToTimeval(nsec int64) (tv Timeval) {
- nsec += 999 // round up to microsecond
- tv.Usec = int32(nsec % 1e9 / 1e3)
- tv.Sec = int64(nsec / 1e9)
- return
-}
-
-//sysnb gettimeofday(tp *Timeval) (sec int64, usec int32, err error)
-func Gettimeofday(tv *Timeval) (err error) {
- // The tv passed to gettimeofday must be non-nil
- // but is otherwise unused. The answers come back
- // in the two registers.
- sec, usec, err := gettimeofday(tv)
- tv.Sec = sec
- tv.Usec = usec
- return err
-}
-
-func SetKevent(k *Kevent_t, fd, mode, flags int) {
- k.Ident = uint64(fd)
- k.Filter = int16(mode)
- k.Flags = uint16(flags)
-}
-
-func (iov *Iovec) SetLen(length int) {
- iov.Len = uint64(length)
-}
-
-func (msghdr *Msghdr) SetControllen(length int) {
- msghdr.Controllen = uint32(length)
-}
-
-func (cmsg *Cmsghdr) SetLen(length int) {
- cmsg.Len = uint32(length)
-}
-
-func sendfile(outfd int, infd int, offset *int64, count int) (written int, err error) {
- var length = uint64(count)
-
- _, _, e1 := Syscall6(SYS_SENDFILE, uintptr(infd), uintptr(outfd), uintptr(*offset), uintptr(unsafe.Pointer(&length)), 0, 0)
-
- written = int(length)
-
- if e1 != 0 {
- err = e1
- }
- return
-}
-
-func Syscall9(num, a1, a2, a3, a4, a5, a6, a7, a8, a9 uintptr) (r1, r2 uintptr, err syscall.Errno) // sic
-
-// SYS___SYSCTL is used by syscall_bsd.go for all BSDs, but in modern versions
-// of darwin/arm64 the syscall is called sysctl instead of __sysctl.
-const SYS___SYSCTL = SYS_SYSCTL
diff --git a/vendor/golang.org/x/sys/unix/syscall_dragonfly.go b/vendor/golang.org/x/sys/unix/syscall_dragonfly.go
deleted file mode 100644
index fbbe0dce..00000000
--- a/vendor/golang.org/x/sys/unix/syscall_dragonfly.go
+++ /dev/null
@@ -1,411 +0,0 @@
-// Copyright 2009,2010 The Go Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style
-// license that can be found in the LICENSE file.
-
-// FreeBSD system calls.
-// This file is compiled as ordinary Go code,
-// but it is also input to mksyscall,
-// which parses the //sys lines and generates system call stubs.
-// Note that sometimes we use a lowercase //sys name and wrap
-// it in our own nicer implementation, either here or in
-// syscall_bsd.go or syscall_unix.go.
-
-package unix
-
-import "unsafe"
-
-type SockaddrDatalink struct {
- Len uint8
- Family uint8
- Index uint16
- Type uint8
- Nlen uint8
- Alen uint8
- Slen uint8
- Data [12]int8
- Rcf uint16
- Route [16]uint16
- raw RawSockaddrDatalink
-}
-
-// Translate "kern.hostname" to []_C_int{0,1,2,3}.
-func nametomib(name string) (mib []_C_int, err error) {
- const siz = unsafe.Sizeof(mib[0])
-
- // NOTE(rsc): It seems strange to set the buffer to have
- // size CTL_MAXNAME+2 but use only CTL_MAXNAME
- // as the size. I don't know why the +2 is here, but the
- // kernel uses +2 for its own implementation of this function.
- // I am scared that if we don't include the +2 here, the kernel
- // will silently write 2 words farther than we specify
- // and we'll get memory corruption.
- var buf [CTL_MAXNAME + 2]_C_int
- n := uintptr(CTL_MAXNAME) * siz
-
- p := (*byte)(unsafe.Pointer(&buf[0]))
- bytes, err := ByteSliceFromString(name)
- if err != nil {
- return nil, err
- }
-
- // Magic sysctl: "setting" 0.3 to a string name
- // lets you read back the array of integers form.
- if err = sysctl([]_C_int{0, 3}, p, &n, &bytes[0], uintptr(len(name))); err != nil {
- return nil, err
- }
- return buf[0 : n/siz], nil
-}
-
-// ParseDirent parses up to max directory entries in buf,
-// appending the names to names. It returns the number
-// bytes consumed from buf, the number of entries added
-// to names, and the new names slice.
-func ParseDirent(buf []byte, max int, names []string) (consumed int, count int, newnames []string) {
- origlen := len(buf)
- for max != 0 && len(buf) > 0 {
- dirent := (*Dirent)(unsafe.Pointer(&buf[0]))
- reclen := int(16+dirent.Namlen+1+7) & ^7
- buf = buf[reclen:]
- if dirent.Fileno == 0 { // File absent in directory.
- continue
- }
- bytes := (*[10000]byte)(unsafe.Pointer(&dirent.Name[0]))
- var name = string(bytes[0:dirent.Namlen])
- if name == "." || name == ".." { // Useless names
- continue
- }
- max--
- count++
- names = append(names, name)
- }
- return origlen - len(buf), count, names
-}
-
-//sysnb pipe() (r int, w int, err error)
-
-func Pipe(p []int) (err error) {
- if len(p) != 2 {
- return EINVAL
- }
- p[0], p[1], err = pipe()
- return
-}
-
-//sys extpread(fd int, p []byte, flags int, offset int64) (n int, err error)
-func Pread(fd int, p []byte, offset int64) (n int, err error) {
- return extpread(fd, p, 0, offset)
-}
-
-//sys extpwrite(fd int, p []byte, flags int, offset int64) (n int, err error)
-func Pwrite(fd int, p []byte, offset int64) (n int, err error) {
- return extpwrite(fd, p, 0, offset)
-}
-
-func Getfsstat(buf []Statfs_t, flags int) (n int, err error) {
- var _p0 unsafe.Pointer
- var bufsize uintptr
- if len(buf) > 0 {
- _p0 = unsafe.Pointer(&buf[0])
- bufsize = unsafe.Sizeof(Statfs_t{}) * uintptr(len(buf))
- }
- r0, _, e1 := Syscall(SYS_GETFSSTAT, uintptr(_p0), bufsize, uintptr(flags))
- n = int(r0)
- if e1 != 0 {
- err = e1
- }
- return
-}
-
-/*
- * Exposed directly
- */
-//sys Access(path string, mode uint32) (err error)
-//sys Adjtime(delta *Timeval, olddelta *Timeval) (err error)
-//sys Chdir(path string) (err error)
-//sys Chflags(path string, flags int) (err error)
-//sys Chmod(path string, mode uint32) (err error)
-//sys Chown(path string, uid int, gid int) (err error)
-//sys Chroot(path string) (err error)
-//sys Close(fd int) (err error)
-//sys Dup(fd int) (nfd int, err error)
-//sys Dup2(from int, to int) (err error)
-//sys Exit(code int)
-//sys Fchdir(fd int) (err error)
-//sys Fchflags(fd int, flags int) (err error)
-//sys Fchmod(fd int, mode uint32) (err error)
-//sys Fchown(fd int, uid int, gid int) (err error)
-//sys Flock(fd int, how int) (err error)
-//sys Fpathconf(fd int, name int) (val int, err error)
-//sys Fstat(fd int, stat *Stat_t) (err error)
-//sys Fstatfs(fd int, stat *Statfs_t) (err error)
-//sys Fsync(fd int) (err error)
-//sys Ftruncate(fd int, length int64) (err error)
-//sys Getdirentries(fd int, buf []byte, basep *uintptr) (n int, err error)
-//sys Getdtablesize() (size int)
-//sysnb Getegid() (egid int)
-//sysnb Geteuid() (uid int)
-//sysnb Getgid() (gid int)
-//sysnb Getpgid(pid int) (pgid int, err error)
-//sysnb Getpgrp() (pgrp int)
-//sysnb Getpid() (pid int)
-//sysnb Getppid() (ppid int)
-//sys Getpriority(which int, who int) (prio int, err error)
-//sysnb Getrlimit(which int, lim *Rlimit) (err error)
-//sysnb Getrusage(who int, rusage *Rusage) (err error)
-//sysnb Getsid(pid int) (sid int, err error)
-//sysnb Gettimeofday(tv *Timeval) (err error)
-//sysnb Getuid() (uid int)
-//sys Issetugid() (tainted bool)
-//sys Kill(pid int, signum syscall.Signal) (err error)
-//sys Kqueue() (fd int, err error)
-//sys Lchown(path string, uid int, gid int) (err error)
-//sys Link(path string, link string) (err error)
-//sys Listen(s int, backlog int) (err error)
-//sys Lstat(path string, stat *Stat_t) (err error)
-//sys Mkdir(path string, mode uint32) (err error)
-//sys Mkfifo(path string, mode uint32) (err error)
-//sys Mknod(path string, mode uint32, dev int) (err error)
-//sys Mlock(b []byte) (err error)
-//sys Mlockall(flags int) (err error)
-//sys Mprotect(b []byte, prot int) (err error)
-//sys Munlock(b []byte) (err error)
-//sys Munlockall() (err error)
-//sys Nanosleep(time *Timespec, leftover *Timespec) (err error)
-//sys Open(path string, mode int, perm uint32) (fd int, err error)
-//sys Pathconf(path string, name int) (val int, err error)
-//sys read(fd int, p []byte) (n int, err error)
-//sys Readlink(path string, buf []byte) (n int, err error)
-//sys Rename(from string, to string) (err error)
-//sys Revoke(path string) (err error)
-//sys Rmdir(path string) (err error)
-//sys Seek(fd int, offset int64, whence int) (newoffset int64, err error) = SYS_LSEEK
-//sys Select(n int, r *FdSet, w *FdSet, e *FdSet, timeout *Timeval) (err error)
-//sysnb Setegid(egid int) (err error)
-//sysnb Seteuid(euid int) (err error)
-//sysnb Setgid(gid int) (err error)
-//sys Setlogin(name string) (err error)
-//sysnb Setpgid(pid int, pgid int) (err error)
-//sys Setpriority(which int, who int, prio int) (err error)
-//sysnb Setregid(rgid int, egid int) (err error)
-//sysnb Setreuid(ruid int, euid int) (err error)
-//sysnb Setresgid(rgid int, egid int, sgid int) (err error)
-//sysnb Setresuid(ruid int, euid int, suid int) (err error)
-//sysnb Setrlimit(which int, lim *Rlimit) (err error)
-//sysnb Setsid() (pid int, err error)
-//sysnb Settimeofday(tp *Timeval) (err error)
-//sysnb Setuid(uid int) (err error)
-//sys Stat(path string, stat *Stat_t) (err error)
-//sys Statfs(path string, stat *Statfs_t) (err error)
-//sys Symlink(path string, link string) (err error)
-//sys Sync() (err error)
-//sys Truncate(path string, length int64) (err error)
-//sys Umask(newmask int) (oldmask int)
-//sys Undelete(path string) (err error)
-//sys Unlink(path string) (err error)
-//sys Unmount(path string, flags int) (err error)
-//sys write(fd int, p []byte) (n int, err error)
-//sys mmap(addr uintptr, length uintptr, prot int, flag int, fd int, pos int64) (ret uintptr, err error)
-//sys munmap(addr uintptr, length uintptr) (err error)
-//sys readlen(fd int, buf *byte, nbuf int) (n int, err error) = SYS_READ
-//sys writelen(fd int, buf *byte, nbuf int) (n int, err error) = SYS_WRITE
-
-/*
- * Unimplemented
- * TODO(jsing): Update this list for DragonFly.
- */
-// Profil
-// Sigaction
-// Sigprocmask
-// Getlogin
-// Sigpending
-// Sigaltstack
-// Ioctl
-// Reboot
-// Execve
-// Vfork
-// Sbrk
-// Sstk
-// Ovadvise
-// Mincore
-// Setitimer
-// Swapon
-// Select
-// Sigsuspend
-// Readv
-// Writev
-// Nfssvc
-// Getfh
-// Quotactl
-// Mount
-// Csops
-// Waitid
-// Add_profil
-// Kdebug_trace
-// Sigreturn
-// Mmap
-// Atsocket
-// Kqueue_from_portset_np
-// Kqueue_portset
-// Getattrlist
-// Setattrlist
-// Getdirentriesattr
-// Searchfs
-// Delete
-// Copyfile
-// Poll
-// Watchevent
-// Waitevent
-// Modwatch
-// Getxattr
-// Fgetxattr
-// Setxattr
-// Fsetxattr
-// Removexattr
-// Fremovexattr
-// Listxattr
-// Flistxattr
-// Fsctl
-// Initgroups
-// Posix_spawn
-// Nfsclnt
-// Fhopen
-// Minherit
-// Semsys
-// Msgsys
-// Shmsys
-// Semctl
-// Semget
-// Semop
-// Msgctl
-// Msgget
-// Msgsnd
-// Msgrcv
-// Shmat
-// Shmctl
-// Shmdt
-// Shmget
-// Shm_open
-// Shm_unlink
-// Sem_open
-// Sem_close
-// Sem_unlink
-// Sem_wait
-// Sem_trywait
-// Sem_post
-// Sem_getvalue
-// Sem_init
-// Sem_destroy
-// Open_extended
-// Umask_extended
-// Stat_extended
-// Lstat_extended
-// Fstat_extended
-// Chmod_extended
-// Fchmod_extended
-// Access_extended
-// Settid
-// Gettid
-// Setsgroups
-// Getsgroups
-// Setwgroups
-// Getwgroups
-// Mkfifo_extended
-// Mkdir_extended
-// Identitysvc
-// Shared_region_check_np
-// Shared_region_map_np
-// __pthread_mutex_destroy
-// __pthread_mutex_init
-// __pthread_mutex_lock
-// __pthread_mutex_trylock
-// __pthread_mutex_unlock
-// __pthread_cond_init
-// __pthread_cond_destroy
-// __pthread_cond_broadcast
-// __pthread_cond_signal
-// Setsid_with_pid
-// __pthread_cond_timedwait
-// Aio_fsync
-// Aio_return
-// Aio_suspend
-// Aio_cancel
-// Aio_error
-// Aio_read
-// Aio_write
-// Lio_listio
-// __pthread_cond_wait
-// Iopolicysys
-// __pthread_kill
-// __pthread_sigmask
-// __sigwait
-// __disable_threadsignal
-// __pthread_markcancel
-// __pthread_canceled
-// __semwait_signal
-// Proc_info
-// Stat64_extended
-// Lstat64_extended
-// Fstat64_extended
-// __pthread_chdir
-// __pthread_fchdir
-// Audit
-// Auditon
-// Getauid
-// Setauid
-// Getaudit
-// Setaudit
-// Getaudit_addr
-// Setaudit_addr
-// Auditctl
-// Bsdthread_create
-// Bsdthread_terminate
-// Stack_snapshot
-// Bsdthread_register
-// Workq_open
-// Workq_ops
-// __mac_execve
-// __mac_syscall
-// __mac_get_file
-// __mac_set_file
-// __mac_get_link
-// __mac_set_link
-// __mac_get_proc
-// __mac_set_proc
-// __mac_get_fd
-// __mac_set_fd
-// __mac_get_pid
-// __mac_get_lcid
-// __mac_get_lctx
-// __mac_set_lctx
-// Setlcid
-// Read_nocancel
-// Write_nocancel
-// Open_nocancel
-// Close_nocancel
-// Wait4_nocancel
-// Recvmsg_nocancel
-// Sendmsg_nocancel
-// Recvfrom_nocancel
-// Accept_nocancel
-// Msync_nocancel
-// Fcntl_nocancel
-// Select_nocancel
-// Fsync_nocancel
-// Connect_nocancel
-// Sigsuspend_nocancel
-// Readv_nocancel
-// Writev_nocancel
-// Sendto_nocancel
-// Pread_nocancel
-// Pwrite_nocancel
-// Waitid_nocancel
-// Poll_nocancel
-// Msgsnd_nocancel
-// Msgrcv_nocancel
-// Sem_wait_nocancel
-// Aio_suspend_nocancel
-// __sigwait_nocancel
-// __semwait_signal_nocancel
-// __mac_mount
-// __mac_get_mount
-// __mac_getfsstat
diff --git a/vendor/golang.org/x/sys/unix/syscall_dragonfly_386.go b/vendor/golang.org/x/sys/unix/syscall_dragonfly_386.go
deleted file mode 100644
index 41c2e697..00000000
--- a/vendor/golang.org/x/sys/unix/syscall_dragonfly_386.go
+++ /dev/null
@@ -1,63 +0,0 @@
-// Copyright 2009 The Go Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style
-// license that can be found in the LICENSE file.
-
-// +build 386,dragonfly
-
-package unix
-
-import (
- "syscall"
- "unsafe"
-)
-
-func Getpagesize() int { return 4096 }
-
-func TimespecToNsec(ts Timespec) int64 { return int64(ts.Sec)*1e9 + int64(ts.Nsec) }
-
-func NsecToTimespec(nsec int64) (ts Timespec) {
- ts.Sec = int32(nsec / 1e9)
- ts.Nsec = int32(nsec % 1e9)
- return
-}
-
-func TimevalToNsec(tv Timeval) int64 { return int64(tv.Sec)*1e9 + int64(tv.Usec)*1e3 }
-
-func NsecToTimeval(nsec int64) (tv Timeval) {
- nsec += 999 // round up to microsecond
- tv.Usec = int32(nsec % 1e9 / 1e3)
- tv.Sec = int32(nsec / 1e9)
- return
-}
-
-func SetKevent(k *Kevent_t, fd, mode, flags int) {
- k.Ident = uint32(fd)
- k.Filter = int16(mode)
- k.Flags = uint16(flags)
-}
-
-func (iov *Iovec) SetLen(length int) {
- iov.Len = uint32(length)
-}
-
-func (msghdr *Msghdr) SetControllen(length int) {
- msghdr.Controllen = uint32(length)
-}
-
-func (cmsg *Cmsghdr) SetLen(length int) {
- cmsg.Len = uint32(length)
-}
-
-func sendfile(outfd int, infd int, offset *int64, count int) (written int, err error) {
- var writtenOut uint64 = 0
- _, _, e1 := Syscall9(SYS_SENDFILE, uintptr(infd), uintptr(outfd), uintptr(*offset), uintptr((*offset)>>32), uintptr(count), 0, uintptr(unsafe.Pointer(&writtenOut)), 0, 0)
-
- written = int(writtenOut)
-
- if e1 != 0 {
- err = e1
- }
- return
-}
-
-func Syscall9(num, a1, a2, a3, a4, a5, a6, a7, a8, a9 uintptr) (r1, r2 uintptr, err syscall.Errno)
diff --git a/vendor/golang.org/x/sys/unix/syscall_dragonfly_amd64.go b/vendor/golang.org/x/sys/unix/syscall_dragonfly_amd64.go
deleted file mode 100644
index 2ed92590..00000000
--- a/vendor/golang.org/x/sys/unix/syscall_dragonfly_amd64.go
+++ /dev/null
@@ -1,63 +0,0 @@
-// Copyright 2009 The Go Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style
-// license that can be found in the LICENSE file.
-
-// +build amd64,dragonfly
-
-package unix
-
-import (
- "syscall"
- "unsafe"
-)
-
-func Getpagesize() int { return 4096 }
-
-func TimespecToNsec(ts Timespec) int64 { return int64(ts.Sec)*1e9 + int64(ts.Nsec) }
-
-func NsecToTimespec(nsec int64) (ts Timespec) {
- ts.Sec = nsec / 1e9
- ts.Nsec = nsec % 1e9
- return
-}
-
-func TimevalToNsec(tv Timeval) int64 { return int64(tv.Sec)*1e9 + int64(tv.Usec)*1e3 }
-
-func NsecToTimeval(nsec int64) (tv Timeval) {
- nsec += 999 // round up to microsecond
- tv.Usec = nsec % 1e9 / 1e3
- tv.Sec = int64(nsec / 1e9)
- return
-}
-
-func SetKevent(k *Kevent_t, fd, mode, flags int) {
- k.Ident = uint64(fd)
- k.Filter = int16(mode)
- k.Flags = uint16(flags)
-}
-
-func (iov *Iovec) SetLen(length int) {
- iov.Len = uint64(length)
-}
-
-func (msghdr *Msghdr) SetControllen(length int) {
- msghdr.Controllen = uint32(length)
-}
-
-func (cmsg *Cmsghdr) SetLen(length int) {
- cmsg.Len = uint32(length)
-}
-
-func sendfile(outfd int, infd int, offset *int64, count int) (written int, err error) {
- var writtenOut uint64 = 0
- _, _, e1 := Syscall9(SYS_SENDFILE, uintptr(infd), uintptr(outfd), uintptr(*offset), uintptr(count), 0, uintptr(unsafe.Pointer(&writtenOut)), 0, 0, 0)
-
- written = int(writtenOut)
-
- if e1 != 0 {
- err = e1
- }
- return
-}
-
-func Syscall9(num, a1, a2, a3, a4, a5, a6, a7, a8, a9 uintptr) (r1, r2 uintptr, err syscall.Errno)
diff --git a/vendor/golang.org/x/sys/unix/syscall_freebsd.go b/vendor/golang.org/x/sys/unix/syscall_freebsd.go
deleted file mode 100644
index ec56ed60..00000000
--- a/vendor/golang.org/x/sys/unix/syscall_freebsd.go
+++ /dev/null
@@ -1,682 +0,0 @@
-// Copyright 2009,2010 The Go Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style
-// license that can be found in the LICENSE file.
-
-// FreeBSD system calls.
-// This file is compiled as ordinary Go code,
-// but it is also input to mksyscall,
-// which parses the //sys lines and generates system call stubs.
-// Note that sometimes we use a lowercase //sys name and wrap
-// it in our own nicer implementation, either here or in
-// syscall_bsd.go or syscall_unix.go.
-
-package unix
-
-import "unsafe"
-
-type SockaddrDatalink struct {
- Len uint8
- Family uint8
- Index uint16
- Type uint8
- Nlen uint8
- Alen uint8
- Slen uint8
- Data [46]int8
- raw RawSockaddrDatalink
-}
-
-// Translate "kern.hostname" to []_C_int{0,1,2,3}.
-func nametomib(name string) (mib []_C_int, err error) {
- const siz = unsafe.Sizeof(mib[0])
-
- // NOTE(rsc): It seems strange to set the buffer to have
- // size CTL_MAXNAME+2 but use only CTL_MAXNAME
- // as the size. I don't know why the +2 is here, but the
- // kernel uses +2 for its own implementation of this function.
- // I am scared that if we don't include the +2 here, the kernel
- // will silently write 2 words farther than we specify
- // and we'll get memory corruption.
- var buf [CTL_MAXNAME + 2]_C_int
- n := uintptr(CTL_MAXNAME) * siz
-
- p := (*byte)(unsafe.Pointer(&buf[0]))
- bytes, err := ByteSliceFromString(name)
- if err != nil {
- return nil, err
- }
-
- // Magic sysctl: "setting" 0.3 to a string name
- // lets you read back the array of integers form.
- if err = sysctl([]_C_int{0, 3}, p, &n, &bytes[0], uintptr(len(name))); err != nil {
- return nil, err
- }
- return buf[0 : n/siz], nil
-}
-
-// ParseDirent parses up to max directory entries in buf,
-// appending the names to names. It returns the number
-// bytes consumed from buf, the number of entries added
-// to names, and the new names slice.
-func ParseDirent(buf []byte, max int, names []string) (consumed int, count int, newnames []string) {
- origlen := len(buf)
- for max != 0 && len(buf) > 0 {
- dirent := (*Dirent)(unsafe.Pointer(&buf[0]))
- if dirent.Reclen == 0 {
- buf = nil
- break
- }
- buf = buf[dirent.Reclen:]
- if dirent.Fileno == 0 { // File absent in directory.
- continue
- }
- bytes := (*[10000]byte)(unsafe.Pointer(&dirent.Name[0]))
- var name = string(bytes[0:dirent.Namlen])
- if name == "." || name == ".." { // Useless names
- continue
- }
- max--
- count++
- names = append(names, name)
- }
- return origlen - len(buf), count, names
-}
-
-//sysnb pipe() (r int, w int, err error)
-
-func Pipe(p []int) (err error) {
- if len(p) != 2 {
- return EINVAL
- }
- p[0], p[1], err = pipe()
- return
-}
-
-func GetsockoptIPMreqn(fd, level, opt int) (*IPMreqn, error) {
- var value IPMreqn
- vallen := _Socklen(SizeofIPMreqn)
- errno := getsockopt(fd, level, opt, unsafe.Pointer(&value), &vallen)
- return &value, errno
-}
-
-func SetsockoptIPMreqn(fd, level, opt int, mreq *IPMreqn) (err error) {
- return setsockopt(fd, level, opt, unsafe.Pointer(mreq), unsafe.Sizeof(*mreq))
-}
-
-func Accept4(fd, flags int) (nfd int, sa Sockaddr, err error) {
- var rsa RawSockaddrAny
- var len _Socklen = SizeofSockaddrAny
- nfd, err = accept4(fd, &rsa, &len, flags)
- if err != nil {
- return
- }
- if len > SizeofSockaddrAny {
- panic("RawSockaddrAny too small")
- }
- sa, err = anyToSockaddr(&rsa)
- if err != nil {
- Close(nfd)
- nfd = 0
- }
- return
-}
-
-func Getfsstat(buf []Statfs_t, flags int) (n int, err error) {
- var _p0 unsafe.Pointer
- var bufsize uintptr
- if len(buf) > 0 {
- _p0 = unsafe.Pointer(&buf[0])
- bufsize = unsafe.Sizeof(Statfs_t{}) * uintptr(len(buf))
- }
- r0, _, e1 := Syscall(SYS_GETFSSTAT, uintptr(_p0), bufsize, uintptr(flags))
- n = int(r0)
- if e1 != 0 {
- err = e1
- }
- return
-}
-
-// Derive extattr namespace and attribute name
-
-func xattrnamespace(fullattr string) (ns int, attr string, err error) {
- s := -1
- for idx, val := range fullattr {
- if val == '.' {
- s = idx
- break
- }
- }
-
- if s == -1 {
- return -1, "", ENOATTR
- }
-
- namespace := fullattr[0:s]
- attr = fullattr[s+1:]
-
- switch namespace {
- case "user":
- return EXTATTR_NAMESPACE_USER, attr, nil
- case "system":
- return EXTATTR_NAMESPACE_SYSTEM, attr, nil
- default:
- return -1, "", ENOATTR
- }
-}
-
-func initxattrdest(dest []byte, idx int) (d unsafe.Pointer) {
- if len(dest) > idx {
- return unsafe.Pointer(&dest[idx])
- } else {
- return unsafe.Pointer(_zero)
- }
-}
-
-// FreeBSD implements its own syscalls to handle extended attributes
-
-func Getxattr(file string, attr string, dest []byte) (sz int, err error) {
- d := initxattrdest(dest, 0)
- destsize := len(dest)
-
- nsid, a, err := xattrnamespace(attr)
- if err != nil {
- return -1, err
- }
-
- return ExtattrGetFile(file, nsid, a, uintptr(d), destsize)
-}
-
-func Fgetxattr(fd int, attr string, dest []byte) (sz int, err error) {
- d := initxattrdest(dest, 0)
- destsize := len(dest)
-
- nsid, a, err := xattrnamespace(attr)
- if err != nil {
- return -1, err
- }
-
- return ExtattrGetFd(fd, nsid, a, uintptr(d), destsize)
-}
-
-func Lgetxattr(link string, attr string, dest []byte) (sz int, err error) {
- d := initxattrdest(dest, 0)
- destsize := len(dest)
-
- nsid, a, err := xattrnamespace(attr)
- if err != nil {
- return -1, err
- }
-
- return ExtattrGetLink(link, nsid, a, uintptr(d), destsize)
-}
-
-// flags are unused on FreeBSD
-
-func Fsetxattr(fd int, attr string, data []byte, flags int) (err error) {
- d := unsafe.Pointer(&data[0])
- datasiz := len(data)
-
- nsid, a, err := xattrnamespace(attr)
- if err != nil {
- return
- }
-
- _, err = ExtattrSetFd(fd, nsid, a, uintptr(d), datasiz)
- return
-}
-
-func Setxattr(file string, attr string, data []byte, flags int) (err error) {
- d := unsafe.Pointer(&data[0])
- datasiz := len(data)
-
- nsid, a, err := xattrnamespace(attr)
- if err != nil {
- return
- }
-
- _, err = ExtattrSetFile(file, nsid, a, uintptr(d), datasiz)
- return
-}
-
-func Lsetxattr(link string, attr string, data []byte, flags int) (err error) {
- d := unsafe.Pointer(&data[0])
- datasiz := len(data)
-
- nsid, a, err := xattrnamespace(attr)
- if err != nil {
- return
- }
-
- _, err = ExtattrSetLink(link, nsid, a, uintptr(d), datasiz)
- return
-}
-
-func Removexattr(file string, attr string) (err error) {
- nsid, a, err := xattrnamespace(attr)
- if err != nil {
- return
- }
-
- err = ExtattrDeleteFile(file, nsid, a)
- return
-}
-
-func Fremovexattr(fd int, attr string) (err error) {
- nsid, a, err := xattrnamespace(attr)
- if err != nil {
- return
- }
-
- err = ExtattrDeleteFd(fd, nsid, a)
- return
-}
-
-func Lremovexattr(link string, attr string) (err error) {
- nsid, a, err := xattrnamespace(attr)
- if err != nil {
- return
- }
-
- err = ExtattrDeleteLink(link, nsid, a)
- return
-}
-
-func Listxattr(file string, dest []byte) (sz int, err error) {
- d := initxattrdest(dest, 0)
- destsiz := len(dest)
-
- // FreeBSD won't allow you to list xattrs from multiple namespaces
- s := 0
- var e error
- for _, nsid := range [...]int{EXTATTR_NAMESPACE_USER, EXTATTR_NAMESPACE_SYSTEM} {
- stmp, e := ExtattrListFile(file, nsid, uintptr(d), destsiz)
-
- /* Errors accessing system attrs are ignored so that
- * we can implement the Linux-like behavior of omitting errors that
- * we don't have read permissions on
- *
- * Linux will still error if we ask for user attributes on a file that
- * we don't have read permissions on, so don't ignore those errors
- */
- if e != nil && e == EPERM && nsid != EXTATTR_NAMESPACE_USER {
- e = nil
- continue
- } else if e != nil {
- return s, e
- }
-
- s += stmp
- destsiz -= s
- if destsiz < 0 {
- destsiz = 0
- }
- d = initxattrdest(dest, s)
- }
-
- return s, e
-}
-
-func Flistxattr(fd int, dest []byte) (sz int, err error) {
- d := initxattrdest(dest, 0)
- destsiz := len(dest)
-
- s := 0
- var e error
- for _, nsid := range [...]int{EXTATTR_NAMESPACE_USER, EXTATTR_NAMESPACE_SYSTEM} {
- stmp, e := ExtattrListFd(fd, nsid, uintptr(d), destsiz)
- if e != nil && e == EPERM && nsid != EXTATTR_NAMESPACE_USER {
- e = nil
- continue
- } else if e != nil {
- return s, e
- }
-
- s += stmp
- destsiz -= s
- if destsiz < 0 {
- destsiz = 0
- }
- d = initxattrdest(dest, s)
- }
-
- return s, e
-}
-
-func Llistxattr(link string, dest []byte) (sz int, err error) {
- d := initxattrdest(dest, 0)
- destsiz := len(dest)
-
- s := 0
- var e error
- for _, nsid := range [...]int{EXTATTR_NAMESPACE_USER, EXTATTR_NAMESPACE_SYSTEM} {
- stmp, e := ExtattrListLink(link, nsid, uintptr(d), destsiz)
- if e != nil && e == EPERM && nsid != EXTATTR_NAMESPACE_USER {
- e = nil
- continue
- } else if e != nil {
- return s, e
- }
-
- s += stmp
- destsiz -= s
- if destsiz < 0 {
- destsiz = 0
- }
- d = initxattrdest(dest, s)
- }
-
- return s, e
-}
-
-/*
- * Exposed directly
- */
-//sys Access(path string, mode uint32) (err error)
-//sys Adjtime(delta *Timeval, olddelta *Timeval) (err error)
-//sys Chdir(path string) (err error)
-//sys Chflags(path string, flags int) (err error)
-//sys Chmod(path string, mode uint32) (err error)
-//sys Chown(path string, uid int, gid int) (err error)
-//sys Chroot(path string) (err error)
-//sys Close(fd int) (err error)
-//sys Dup(fd int) (nfd int, err error)
-//sys Dup2(from int, to int) (err error)
-//sys Exit(code int)
-//sys ExtattrGetFd(fd int, attrnamespace int, attrname string, data uintptr, nbytes int) (ret int, err error)
-//sys ExtattrSetFd(fd int, attrnamespace int, attrname string, data uintptr, nbytes int) (ret int, err error)
-//sys ExtattrDeleteFd(fd int, attrnamespace int, attrname string) (err error)
-//sys ExtattrListFd(fd int, attrnamespace int, data uintptr, nbytes int) (ret int, err error)
-//sys ExtattrGetFile(file string, attrnamespace int, attrname string, data uintptr, nbytes int) (ret int, err error)
-//sys ExtattrSetFile(file string, attrnamespace int, attrname string, data uintptr, nbytes int) (ret int, err error)
-//sys ExtattrDeleteFile(file string, attrnamespace int, attrname string) (err error)
-//sys ExtattrListFile(file string, attrnamespace int, data uintptr, nbytes int) (ret int, err error)
-//sys ExtattrGetLink(link string, attrnamespace int, attrname string, data uintptr, nbytes int) (ret int, err error)
-//sys ExtattrSetLink(link string, attrnamespace int, attrname string, data uintptr, nbytes int) (ret int, err error)
-//sys ExtattrDeleteLink(link string, attrnamespace int, attrname string) (err error)
-//sys ExtattrListLink(link string, attrnamespace int, data uintptr, nbytes int) (ret int, err error)
-//sys Fadvise(fd int, offset int64, length int64, advice int) (err error) = SYS_POSIX_FADVISE
-//sys Fchdir(fd int) (err error)
-//sys Fchflags(fd int, flags int) (err error)
-//sys Fchmod(fd int, mode uint32) (err error)
-//sys Fchown(fd int, uid int, gid int) (err error)
-//sys Flock(fd int, how int) (err error)
-//sys Fpathconf(fd int, name int) (val int, err error)
-//sys Fstat(fd int, stat *Stat_t) (err error)
-//sys Fstatfs(fd int, stat *Statfs_t) (err error)
-//sys Fsync(fd int) (err error)
-//sys Ftruncate(fd int, length int64) (err error)
-//sys Getdirentries(fd int, buf []byte, basep *uintptr) (n int, err error)
-//sys Getdtablesize() (size int)
-//sysnb Getegid() (egid int)
-//sysnb Geteuid() (uid int)
-//sysnb Getgid() (gid int)
-//sysnb Getpgid(pid int) (pgid int, err error)
-//sysnb Getpgrp() (pgrp int)
-//sysnb Getpid() (pid int)
-//sysnb Getppid() (ppid int)
-//sys Getpriority(which int, who int) (prio int, err error)
-//sysnb Getrlimit(which int, lim *Rlimit) (err error)
-//sysnb Getrusage(who int, rusage *Rusage) (err error)
-//sysnb Getsid(pid int) (sid int, err error)
-//sysnb Gettimeofday(tv *Timeval) (err error)
-//sysnb Getuid() (uid int)
-//sys Issetugid() (tainted bool)
-//sys Kill(pid int, signum syscall.Signal) (err error)
-//sys Kqueue() (fd int, err error)
-//sys Lchown(path string, uid int, gid int) (err error)
-//sys Link(path string, link string) (err error)
-//sys Listen(s int, backlog int) (err error)
-//sys Lstat(path string, stat *Stat_t) (err error)
-//sys Mkdir(path string, mode uint32) (err error)
-//sys Mkfifo(path string, mode uint32) (err error)
-//sys Mknod(path string, mode uint32, dev int) (err error)
-//sys Mlock(b []byte) (err error)
-//sys Mlockall(flags int) (err error)
-//sys Mprotect(b []byte, prot int) (err error)
-//sys Munlock(b []byte) (err error)
-//sys Munlockall() (err error)
-//sys Nanosleep(time *Timespec, leftover *Timespec) (err error)
-//sys Open(path string, mode int, perm uint32) (fd int, err error)
-//sys Pathconf(path string, name int) (val int, err error)
-//sys Pread(fd int, p []byte, offset int64) (n int, err error)
-//sys Pwrite(fd int, p []byte, offset int64) (n int, err error)
-//sys read(fd int, p []byte) (n int, err error)
-//sys Readlink(path string, buf []byte) (n int, err error)
-//sys Rename(from string, to string) (err error)
-//sys Revoke(path string) (err error)
-//sys Rmdir(path string) (err error)
-//sys Seek(fd int, offset int64, whence int) (newoffset int64, err error) = SYS_LSEEK
-//sys Select(n int, r *FdSet, w *FdSet, e *FdSet, timeout *Timeval) (err error)
-//sysnb Setegid(egid int) (err error)
-//sysnb Seteuid(euid int) (err error)
-//sysnb Setgid(gid int) (err error)
-//sys Setlogin(name string) (err error)
-//sysnb Setpgid(pid int, pgid int) (err error)
-//sys Setpriority(which int, who int, prio int) (err error)
-//sysnb Setregid(rgid int, egid int) (err error)
-//sysnb Setreuid(ruid int, euid int) (err error)
-//sysnb Setresgid(rgid int, egid int, sgid int) (err error)
-//sysnb Setresuid(ruid int, euid int, suid int) (err error)
-//sysnb Setrlimit(which int, lim *Rlimit) (err error)
-//sysnb Setsid() (pid int, err error)
-//sysnb Settimeofday(tp *Timeval) (err error)
-//sysnb Setuid(uid int) (err error)
-//sys Stat(path string, stat *Stat_t) (err error)
-//sys Statfs(path string, stat *Statfs_t) (err error)
-//sys Symlink(path string, link string) (err error)
-//sys Sync() (err error)
-//sys Truncate(path string, length int64) (err error)
-//sys Umask(newmask int) (oldmask int)
-//sys Undelete(path string) (err error)
-//sys Unlink(path string) (err error)
-//sys Unmount(path string, flags int) (err error)
-//sys write(fd int, p []byte) (n int, err error)
-//sys mmap(addr uintptr, length uintptr, prot int, flag int, fd int, pos int64) (ret uintptr, err error)
-//sys munmap(addr uintptr, length uintptr) (err error)
-//sys readlen(fd int, buf *byte, nbuf int) (n int, err error) = SYS_READ
-//sys writelen(fd int, buf *byte, nbuf int) (n int, err error) = SYS_WRITE
-//sys accept4(fd int, rsa *RawSockaddrAny, addrlen *_Socklen, flags int) (nfd int, err error)
-
-/*
- * Unimplemented
- */
-// Profil
-// Sigaction
-// Sigprocmask
-// Getlogin
-// Sigpending
-// Sigaltstack
-// Ioctl
-// Reboot
-// Execve
-// Vfork
-// Sbrk
-// Sstk
-// Ovadvise
-// Mincore
-// Setitimer
-// Swapon
-// Select
-// Sigsuspend
-// Readv
-// Writev
-// Nfssvc
-// Getfh
-// Quotactl
-// Mount
-// Csops
-// Waitid
-// Add_profil
-// Kdebug_trace
-// Sigreturn
-// Mmap
-// Mlock
-// Munlock
-// Atsocket
-// Kqueue_from_portset_np
-// Kqueue_portset
-// Getattrlist
-// Setattrlist
-// Getdirentriesattr
-// Searchfs
-// Delete
-// Copyfile
-// Poll
-// Watchevent
-// Waitevent
-// Modwatch
-// Getxattr
-// Fgetxattr
-// Setxattr
-// Fsetxattr
-// Removexattr
-// Fremovexattr
-// Listxattr
-// Flistxattr
-// Fsctl
-// Initgroups
-// Posix_spawn
-// Nfsclnt
-// Fhopen
-// Minherit
-// Semsys
-// Msgsys
-// Shmsys
-// Semctl
-// Semget
-// Semop
-// Msgctl
-// Msgget
-// Msgsnd
-// Msgrcv
-// Shmat
-// Shmctl
-// Shmdt
-// Shmget
-// Shm_open
-// Shm_unlink
-// Sem_open
-// Sem_close
-// Sem_unlink
-// Sem_wait
-// Sem_trywait
-// Sem_post
-// Sem_getvalue
-// Sem_init
-// Sem_destroy
-// Open_extended
-// Umask_extended
-// Stat_extended
-// Lstat_extended
-// Fstat_extended
-// Chmod_extended
-// Fchmod_extended
-// Access_extended
-// Settid
-// Gettid
-// Setsgroups
-// Getsgroups
-// Setwgroups
-// Getwgroups
-// Mkfifo_extended
-// Mkdir_extended
-// Identitysvc
-// Shared_region_check_np
-// Shared_region_map_np
-// __pthread_mutex_destroy
-// __pthread_mutex_init
-// __pthread_mutex_lock
-// __pthread_mutex_trylock
-// __pthread_mutex_unlock
-// __pthread_cond_init
-// __pthread_cond_destroy
-// __pthread_cond_broadcast
-// __pthread_cond_signal
-// Setsid_with_pid
-// __pthread_cond_timedwait
-// Aio_fsync
-// Aio_return
-// Aio_suspend
-// Aio_cancel
-// Aio_error
-// Aio_read
-// Aio_write
-// Lio_listio
-// __pthread_cond_wait
-// Iopolicysys
-// Mlockall
-// Munlockall
-// __pthread_kill
-// __pthread_sigmask
-// __sigwait
-// __disable_threadsignal
-// __pthread_markcancel
-// __pthread_canceled
-// __semwait_signal
-// Proc_info
-// Stat64_extended
-// Lstat64_extended
-// Fstat64_extended
-// __pthread_chdir
-// __pthread_fchdir
-// Audit
-// Auditon
-// Getauid
-// Setauid
-// Getaudit
-// Setaudit
-// Getaudit_addr
-// Setaudit_addr
-// Auditctl
-// Bsdthread_create
-// Bsdthread_terminate
-// Stack_snapshot
-// Bsdthread_register
-// Workq_open
-// Workq_ops
-// __mac_execve
-// __mac_syscall
-// __mac_get_file
-// __mac_set_file
-// __mac_get_link
-// __mac_set_link
-// __mac_get_proc
-// __mac_set_proc
-// __mac_get_fd
-// __mac_set_fd
-// __mac_get_pid
-// __mac_get_lcid
-// __mac_get_lctx
-// __mac_set_lctx
-// Setlcid
-// Read_nocancel
-// Write_nocancel
-// Open_nocancel
-// Close_nocancel
-// Wait4_nocancel
-// Recvmsg_nocancel
-// Sendmsg_nocancel
-// Recvfrom_nocancel
-// Accept_nocancel
-// Msync_nocancel
-// Fcntl_nocancel
-// Select_nocancel
-// Fsync_nocancel
-// Connect_nocancel
-// Sigsuspend_nocancel
-// Readv_nocancel
-// Writev_nocancel
-// Sendto_nocancel
-// Pread_nocancel
-// Pwrite_nocancel
-// Waitid_nocancel
-// Poll_nocancel
-// Msgsnd_nocancel
-// Msgrcv_nocancel
-// Sem_wait_nocancel
-// Aio_suspend_nocancel
-// __sigwait_nocancel
-// __semwait_signal_nocancel
-// __mac_mount
-// __mac_get_mount
-// __mac_getfsstat
diff --git a/vendor/golang.org/x/sys/unix/syscall_freebsd_386.go b/vendor/golang.org/x/sys/unix/syscall_freebsd_386.go
deleted file mode 100644
index 6255d40f..00000000
--- a/vendor/golang.org/x/sys/unix/syscall_freebsd_386.go
+++ /dev/null
@@ -1,63 +0,0 @@
-// Copyright 2009 The Go Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style
-// license that can be found in the LICENSE file.
-
-// +build 386,freebsd
-
-package unix
-
-import (
- "syscall"
- "unsafe"
-)
-
-func Getpagesize() int { return 4096 }
-
-func TimespecToNsec(ts Timespec) int64 { return int64(ts.Sec)*1e9 + int64(ts.Nsec) }
-
-func NsecToTimespec(nsec int64) (ts Timespec) {
- ts.Sec = int32(nsec / 1e9)
- ts.Nsec = int32(nsec % 1e9)
- return
-}
-
-func TimevalToNsec(tv Timeval) int64 { return int64(tv.Sec)*1e9 + int64(tv.Usec)*1e3 }
-
-func NsecToTimeval(nsec int64) (tv Timeval) {
- nsec += 999 // round up to microsecond
- tv.Usec = int32(nsec % 1e9 / 1e3)
- tv.Sec = int32(nsec / 1e9)
- return
-}
-
-func SetKevent(k *Kevent_t, fd, mode, flags int) {
- k.Ident = uint32(fd)
- k.Filter = int16(mode)
- k.Flags = uint16(flags)
-}
-
-func (iov *Iovec) SetLen(length int) {
- iov.Len = uint32(length)
-}
-
-func (msghdr *Msghdr) SetControllen(length int) {
- msghdr.Controllen = uint32(length)
-}
-
-func (cmsg *Cmsghdr) SetLen(length int) {
- cmsg.Len = uint32(length)
-}
-
-func sendfile(outfd int, infd int, offset *int64, count int) (written int, err error) {
- var writtenOut uint64 = 0
- _, _, e1 := Syscall9(SYS_SENDFILE, uintptr(infd), uintptr(outfd), uintptr(*offset), uintptr((*offset)>>32), uintptr(count), 0, uintptr(unsafe.Pointer(&writtenOut)), 0, 0)
-
- written = int(writtenOut)
-
- if e1 != 0 {
- err = e1
- }
- return
-}
-
-func Syscall9(num, a1, a2, a3, a4, a5, a6, a7, a8, a9 uintptr) (r1, r2 uintptr, err syscall.Errno)
diff --git a/vendor/golang.org/x/sys/unix/syscall_freebsd_amd64.go b/vendor/golang.org/x/sys/unix/syscall_freebsd_amd64.go
deleted file mode 100644
index 8b395d59..00000000
--- a/vendor/golang.org/x/sys/unix/syscall_freebsd_amd64.go
+++ /dev/null
@@ -1,63 +0,0 @@
-// Copyright 2009 The Go Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style
-// license that can be found in the LICENSE file.
-
-// +build amd64,freebsd
-
-package unix
-
-import (
- "syscall"
- "unsafe"
-)
-
-func Getpagesize() int { return 4096 }
-
-func TimespecToNsec(ts Timespec) int64 { return int64(ts.Sec)*1e9 + int64(ts.Nsec) }
-
-func NsecToTimespec(nsec int64) (ts Timespec) {
- ts.Sec = nsec / 1e9
- ts.Nsec = nsec % 1e9
- return
-}
-
-func TimevalToNsec(tv Timeval) int64 { return int64(tv.Sec)*1e9 + int64(tv.Usec)*1e3 }
-
-func NsecToTimeval(nsec int64) (tv Timeval) {
- nsec += 999 // round up to microsecond
- tv.Usec = nsec % 1e9 / 1e3
- tv.Sec = int64(nsec / 1e9)
- return
-}
-
-func SetKevent(k *Kevent_t, fd, mode, flags int) {
- k.Ident = uint64(fd)
- k.Filter = int16(mode)
- k.Flags = uint16(flags)
-}
-
-func (iov *Iovec) SetLen(length int) {
- iov.Len = uint64(length)
-}
-
-func (msghdr *Msghdr) SetControllen(length int) {
- msghdr.Controllen = uint32(length)
-}
-
-func (cmsg *Cmsghdr) SetLen(length int) {
- cmsg.Len = uint32(length)
-}
-
-func sendfile(outfd int, infd int, offset *int64, count int) (written int, err error) {
- var writtenOut uint64 = 0
- _, _, e1 := Syscall9(SYS_SENDFILE, uintptr(infd), uintptr(outfd), uintptr(*offset), uintptr(count), 0, uintptr(unsafe.Pointer(&writtenOut)), 0, 0, 0)
-
- written = int(writtenOut)
-
- if e1 != 0 {
- err = e1
- }
- return
-}
-
-func Syscall9(num, a1, a2, a3, a4, a5, a6, a7, a8, a9 uintptr) (r1, r2 uintptr, err syscall.Errno)
diff --git a/vendor/golang.org/x/sys/unix/syscall_freebsd_arm.go b/vendor/golang.org/x/sys/unix/syscall_freebsd_arm.go
deleted file mode 100644
index 4e72d46a..00000000
--- a/vendor/golang.org/x/sys/unix/syscall_freebsd_arm.go
+++ /dev/null
@@ -1,63 +0,0 @@
-// Copyright 2012 The Go Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style
-// license that can be found in the LICENSE file.
-
-// +build arm,freebsd
-
-package unix
-
-import (
- "syscall"
- "unsafe"
-)
-
-func Getpagesize() int { return 4096 }
-
-func TimespecToNsec(ts Timespec) int64 { return ts.Sec*1e9 + int64(ts.Nsec) }
-
-func NsecToTimespec(nsec int64) (ts Timespec) {
- ts.Sec = nsec / 1e9
- ts.Nsec = int32(nsec % 1e9)
- return
-}
-
-func TimevalToNsec(tv Timeval) int64 { return tv.Sec*1e9 + int64(tv.Usec)*1e3 }
-
-func NsecToTimeval(nsec int64) (tv Timeval) {
- nsec += 999 // round up to microsecond
- tv.Usec = int32(nsec % 1e9 / 1e3)
- tv.Sec = nsec / 1e9
- return
-}
-
-func SetKevent(k *Kevent_t, fd, mode, flags int) {
- k.Ident = uint32(fd)
- k.Filter = int16(mode)
- k.Flags = uint16(flags)
-}
-
-func (iov *Iovec) SetLen(length int) {
- iov.Len = uint32(length)
-}
-
-func (msghdr *Msghdr) SetControllen(length int) {
- msghdr.Controllen = uint32(length)
-}
-
-func (cmsg *Cmsghdr) SetLen(length int) {
- cmsg.Len = uint32(length)
-}
-
-func sendfile(outfd int, infd int, offset *int64, count int) (written int, err error) {
- var writtenOut uint64 = 0
- _, _, e1 := Syscall9(SYS_SENDFILE, uintptr(infd), uintptr(outfd), uintptr(*offset), uintptr((*offset)>>32), uintptr(count), 0, uintptr(unsafe.Pointer(&writtenOut)), 0, 0)
-
- written = int(writtenOut)
-
- if e1 != 0 {
- err = e1
- }
- return
-}
-
-func Syscall9(num, a1, a2, a3, a4, a5, a6, a7, a8, a9 uintptr) (r1, r2 uintptr, err syscall.Errno)
diff --git a/vendor/golang.org/x/sys/unix/syscall_linux.go b/vendor/golang.org/x/sys/unix/syscall_linux.go
deleted file mode 100644
index 5048e563..00000000
--- a/vendor/golang.org/x/sys/unix/syscall_linux.go
+++ /dev/null
@@ -1,1086 +0,0 @@
-// Copyright 2009 The Go Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style
-// license that can be found in the LICENSE file.
-
-// Linux system calls.
-// This file is compiled as ordinary Go code,
-// but it is also input to mksyscall,
-// which parses the //sys lines and generates system call stubs.
-// Note that sometimes we use a lowercase //sys name and
-// wrap it in our own nicer implementation.
-
-package unix
-
-import (
- "syscall"
- "unsafe"
-)
-
-/*
- * Wrapped
- */
-
-func Access(path string, mode uint32) (err error) {
- return Faccessat(AT_FDCWD, path, mode, 0)
-}
-
-func Chmod(path string, mode uint32) (err error) {
- return Fchmodat(AT_FDCWD, path, mode, 0)
-}
-
-func Chown(path string, uid int, gid int) (err error) {
- return Fchownat(AT_FDCWD, path, uid, gid, 0)
-}
-
-func Creat(path string, mode uint32) (fd int, err error) {
- return Open(path, O_CREAT|O_WRONLY|O_TRUNC, mode)
-}
-
-//sys linkat(olddirfd int, oldpath string, newdirfd int, newpath string, flags int) (err error)
-
-func Link(oldpath string, newpath string) (err error) {
- return linkat(AT_FDCWD, oldpath, AT_FDCWD, newpath, 0)
-}
-
-func Mkdir(path string, mode uint32) (err error) {
- return Mkdirat(AT_FDCWD, path, mode)
-}
-
-func Mknod(path string, mode uint32, dev int) (err error) {
- return Mknodat(AT_FDCWD, path, mode, dev)
-}
-
-func Open(path string, mode int, perm uint32) (fd int, err error) {
- return openat(AT_FDCWD, path, mode|O_LARGEFILE, perm)
-}
-
-//sys openat(dirfd int, path string, flags int, mode uint32) (fd int, err error)
-
-func Openat(dirfd int, path string, flags int, mode uint32) (fd int, err error) {
- return openat(dirfd, path, flags|O_LARGEFILE, mode)
-}
-
-//sys readlinkat(dirfd int, path string, buf []byte) (n int, err error)
-
-func Readlink(path string, buf []byte) (n int, err error) {
- return readlinkat(AT_FDCWD, path, buf)
-}
-
-func Rename(oldpath string, newpath string) (err error) {
- return Renameat(AT_FDCWD, oldpath, AT_FDCWD, newpath)
-}
-
-func Rmdir(path string) error {
- return unlinkat(AT_FDCWD, path, AT_REMOVEDIR)
-}
-
-//sys symlinkat(oldpath string, newdirfd int, newpath string) (err error)
-
-func Symlink(oldpath string, newpath string) (err error) {
- return symlinkat(oldpath, AT_FDCWD, newpath)
-}
-
-func Unlink(path string) error {
- return unlinkat(AT_FDCWD, path, 0)
-}
-
-//sys unlinkat(dirfd int, path string, flags int) (err error)
-
-func Unlinkat(dirfd int, path string, flags int) error {
- return unlinkat(dirfd, path, flags)
-}
-
-//sys utimes(path string, times *[2]Timeval) (err error)
-
-func Utimes(path string, tv []Timeval) (err error) {
- if tv == nil {
- return utimes(path, nil)
- }
- if len(tv) != 2 {
- return EINVAL
- }
- return utimes(path, (*[2]Timeval)(unsafe.Pointer(&tv[0])))
-}
-
-//sys utimensat(dirfd int, path string, times *[2]Timespec, flags int) (err error)
-
-func UtimesNano(path string, ts []Timespec) error {
- if ts == nil {
- err := utimensat(AT_FDCWD, path, nil, 0)
- if err != ENOSYS {
- return err
- }
- return utimes(path, nil)
- }
- if len(ts) != 2 {
- return EINVAL
- }
- err := utimensat(AT_FDCWD, path, (*[2]Timespec)(unsafe.Pointer(&ts[0])), 0)
- if err != ENOSYS {
- return err
- }
- // If the utimensat syscall isn't available (utimensat was added to Linux
- // in 2.6.22, Released, 8 July 2007) then fall back to utimes
- var tv [2]Timeval
- for i := 0; i < 2; i++ {
- tv[i].Sec = ts[i].Sec
- tv[i].Usec = ts[i].Nsec / 1000
- }
- return utimes(path, (*[2]Timeval)(unsafe.Pointer(&tv[0])))
-}
-
-func UtimesNanoAt(dirfd int, path string, ts []Timespec, flags int) error {
- if ts == nil {
- return utimensat(dirfd, path, nil, flags)
- }
- if len(ts) != 2 {
- return EINVAL
- }
- return utimensat(dirfd, path, (*[2]Timespec)(unsafe.Pointer(&ts[0])), flags)
-}
-
-//sys futimesat(dirfd int, path *byte, times *[2]Timeval) (err error)
-
-func Futimesat(dirfd int, path string, tv []Timeval) error {
- pathp, err := BytePtrFromString(path)
- if err != nil {
- return err
- }
- if tv == nil {
- return futimesat(dirfd, pathp, nil)
- }
- if len(tv) != 2 {
- return EINVAL
- }
- return futimesat(dirfd, pathp, (*[2]Timeval)(unsafe.Pointer(&tv[0])))
-}
-
-func Futimes(fd int, tv []Timeval) (err error) {
- // Believe it or not, this is the best we can do on Linux
- // (and is what glibc does).
- return Utimes("/proc/self/fd/"+itoa(fd), tv)
-}
-
-const ImplementsGetwd = true
-
-//sys Getcwd(buf []byte) (n int, err error)
-
-func Getwd() (wd string, err error) {
- var buf [PathMax]byte
- n, err := Getcwd(buf[0:])
- if err != nil {
- return "", err
- }
- // Getcwd returns the number of bytes written to buf, including the NUL.
- if n < 1 || n > len(buf) || buf[n-1] != 0 {
- return "", EINVAL
- }
- return string(buf[0 : n-1]), nil
-}
-
-func Getgroups() (gids []int, err error) {
- n, err := getgroups(0, nil)
- if err != nil {
- return nil, err
- }
- if n == 0 {
- return nil, nil
- }
-
- // Sanity check group count. Max is 1<<16 on Linux.
- if n < 0 || n > 1<<20 {
- return nil, EINVAL
- }
-
- a := make([]_Gid_t, n)
- n, err = getgroups(n, &a[0])
- if err != nil {
- return nil, err
- }
- gids = make([]int, n)
- for i, v := range a[0:n] {
- gids[i] = int(v)
- }
- return
-}
-
-func Setgroups(gids []int) (err error) {
- if len(gids) == 0 {
- return setgroups(0, nil)
- }
-
- a := make([]_Gid_t, len(gids))
- for i, v := range gids {
- a[i] = _Gid_t(v)
- }
- return setgroups(len(a), &a[0])
-}
-
-type WaitStatus uint32
-
-// Wait status is 7 bits at bottom, either 0 (exited),
-// 0x7F (stopped), or a signal number that caused an exit.
-// The 0x80 bit is whether there was a core dump.
-// An extra number (exit code, signal causing a stop)
-// is in the high bits. At least that's the idea.
-// There are various irregularities. For example, the
-// "continued" status is 0xFFFF, distinguishing itself
-// from stopped via the core dump bit.
-
-const (
- mask = 0x7F
- core = 0x80
- exited = 0x00
- stopped = 0x7F
- shift = 8
-)
-
-func (w WaitStatus) Exited() bool { return w&mask == exited }
-
-func (w WaitStatus) Signaled() bool { return w&mask != stopped && w&mask != exited }
-
-func (w WaitStatus) Stopped() bool { return w&0xFF == stopped }
-
-func (w WaitStatus) Continued() bool { return w == 0xFFFF }
-
-func (w WaitStatus) CoreDump() bool { return w.Signaled() && w&core != 0 }
-
-func (w WaitStatus) ExitStatus() int {
- if !w.Exited() {
- return -1
- }
- return int(w>>shift) & 0xFF
-}
-
-func (w WaitStatus) Signal() syscall.Signal {
- if !w.Signaled() {
- return -1
- }
- return syscall.Signal(w & mask)
-}
-
-func (w WaitStatus) StopSignal() syscall.Signal {
- if !w.Stopped() {
- return -1
- }
- return syscall.Signal(w>>shift) & 0xFF
-}
-
-func (w WaitStatus) TrapCause() int {
- if w.StopSignal() != SIGTRAP {
- return -1
- }
- return int(w>>shift) >> 8
-}
-
-//sys wait4(pid int, wstatus *_C_int, options int, rusage *Rusage) (wpid int, err error)
-
-func Wait4(pid int, wstatus *WaitStatus, options int, rusage *Rusage) (wpid int, err error) {
- var status _C_int
- wpid, err = wait4(pid, &status, options, rusage)
- if wstatus != nil {
- *wstatus = WaitStatus(status)
- }
- return
-}
-
-func Mkfifo(path string, mode uint32) (err error) {
- return Mknod(path, mode|S_IFIFO, 0)
-}
-
-func (sa *SockaddrInet4) sockaddr() (unsafe.Pointer, _Socklen, error) {
- if sa.Port < 0 || sa.Port > 0xFFFF {
- return nil, 0, EINVAL
- }
- sa.raw.Family = AF_INET
- p := (*[2]byte)(unsafe.Pointer(&sa.raw.Port))
- p[0] = byte(sa.Port >> 8)
- p[1] = byte(sa.Port)
- for i := 0; i < len(sa.Addr); i++ {
- sa.raw.Addr[i] = sa.Addr[i]
- }
- return unsafe.Pointer(&sa.raw), SizeofSockaddrInet4, nil
-}
-
-func (sa *SockaddrInet6) sockaddr() (unsafe.Pointer, _Socklen, error) {
- if sa.Port < 0 || sa.Port > 0xFFFF {
- return nil, 0, EINVAL
- }
- sa.raw.Family = AF_INET6
- p := (*[2]byte)(unsafe.Pointer(&sa.raw.Port))
- p[0] = byte(sa.Port >> 8)
- p[1] = byte(sa.Port)
- sa.raw.Scope_id = sa.ZoneId
- for i := 0; i < len(sa.Addr); i++ {
- sa.raw.Addr[i] = sa.Addr[i]
- }
- return unsafe.Pointer(&sa.raw), SizeofSockaddrInet6, nil
-}
-
-func (sa *SockaddrUnix) sockaddr() (unsafe.Pointer, _Socklen, error) {
- name := sa.Name
- n := len(name)
- if n >= len(sa.raw.Path) {
- return nil, 0, EINVAL
- }
- sa.raw.Family = AF_UNIX
- for i := 0; i < n; i++ {
- sa.raw.Path[i] = int8(name[i])
- }
- // length is family (uint16), name, NUL.
- sl := _Socklen(2)
- if n > 0 {
- sl += _Socklen(n) + 1
- }
- if sa.raw.Path[0] == '@' {
- sa.raw.Path[0] = 0
- // Don't count trailing NUL for abstract address.
- sl--
- }
-
- return unsafe.Pointer(&sa.raw), sl, nil
-}
-
-type SockaddrLinklayer struct {
- Protocol uint16
- Ifindex int
- Hatype uint16
- Pkttype uint8
- Halen uint8
- Addr [8]byte
- raw RawSockaddrLinklayer
-}
-
-func (sa *SockaddrLinklayer) sockaddr() (unsafe.Pointer, _Socklen, error) {
- if sa.Ifindex < 0 || sa.Ifindex > 0x7fffffff {
- return nil, 0, EINVAL
- }
- sa.raw.Family = AF_PACKET
- sa.raw.Protocol = sa.Protocol
- sa.raw.Ifindex = int32(sa.Ifindex)
- sa.raw.Hatype = sa.Hatype
- sa.raw.Pkttype = sa.Pkttype
- sa.raw.Halen = sa.Halen
- for i := 0; i < len(sa.Addr); i++ {
- sa.raw.Addr[i] = sa.Addr[i]
- }
- return unsafe.Pointer(&sa.raw), SizeofSockaddrLinklayer, nil
-}
-
-type SockaddrNetlink struct {
- Family uint16
- Pad uint16
- Pid uint32
- Groups uint32
- raw RawSockaddrNetlink
-}
-
-func (sa *SockaddrNetlink) sockaddr() (unsafe.Pointer, _Socklen, error) {
- sa.raw.Family = AF_NETLINK
- sa.raw.Pad = sa.Pad
- sa.raw.Pid = sa.Pid
- sa.raw.Groups = sa.Groups
- return unsafe.Pointer(&sa.raw), SizeofSockaddrNetlink, nil
-}
-
-func anyToSockaddr(rsa *RawSockaddrAny) (Sockaddr, error) {
- switch rsa.Addr.Family {
- case AF_NETLINK:
- pp := (*RawSockaddrNetlink)(unsafe.Pointer(rsa))
- sa := new(SockaddrNetlink)
- sa.Family = pp.Family
- sa.Pad = pp.Pad
- sa.Pid = pp.Pid
- sa.Groups = pp.Groups
- return sa, nil
-
- case AF_PACKET:
- pp := (*RawSockaddrLinklayer)(unsafe.Pointer(rsa))
- sa := new(SockaddrLinklayer)
- sa.Protocol = pp.Protocol
- sa.Ifindex = int(pp.Ifindex)
- sa.Hatype = pp.Hatype
- sa.Pkttype = pp.Pkttype
- sa.Halen = pp.Halen
- for i := 0; i < len(sa.Addr); i++ {
- sa.Addr[i] = pp.Addr[i]
- }
- return sa, nil
-
- case AF_UNIX:
- pp := (*RawSockaddrUnix)(unsafe.Pointer(rsa))
- sa := new(SockaddrUnix)
- if pp.Path[0] == 0 {
- // "Abstract" Unix domain socket.
- // Rewrite leading NUL as @ for textual display.
- // (This is the standard convention.)
- // Not friendly to overwrite in place,
- // but the callers below don't care.
- pp.Path[0] = '@'
- }
-
- // Assume path ends at NUL.
- // This is not technically the Linux semantics for
- // abstract Unix domain sockets--they are supposed
- // to be uninterpreted fixed-size binary blobs--but
- // everyone uses this convention.
- n := 0
- for n < len(pp.Path) && pp.Path[n] != 0 {
- n++
- }
- bytes := (*[10000]byte)(unsafe.Pointer(&pp.Path[0]))[0:n]
- sa.Name = string(bytes)
- return sa, nil
-
- case AF_INET:
- pp := (*RawSockaddrInet4)(unsafe.Pointer(rsa))
- sa := new(SockaddrInet4)
- p := (*[2]byte)(unsafe.Pointer(&pp.Port))
- sa.Port = int(p[0])<<8 + int(p[1])
- for i := 0; i < len(sa.Addr); i++ {
- sa.Addr[i] = pp.Addr[i]
- }
- return sa, nil
-
- case AF_INET6:
- pp := (*RawSockaddrInet6)(unsafe.Pointer(rsa))
- sa := new(SockaddrInet6)
- p := (*[2]byte)(unsafe.Pointer(&pp.Port))
- sa.Port = int(p[0])<<8 + int(p[1])
- sa.ZoneId = pp.Scope_id
- for i := 0; i < len(sa.Addr); i++ {
- sa.Addr[i] = pp.Addr[i]
- }
- return sa, nil
- }
- return nil, EAFNOSUPPORT
-}
-
-func Accept(fd int) (nfd int, sa Sockaddr, err error) {
- var rsa RawSockaddrAny
- var len _Socklen = SizeofSockaddrAny
- nfd, err = accept(fd, &rsa, &len)
- if err != nil {
- return
- }
- sa, err = anyToSockaddr(&rsa)
- if err != nil {
- Close(nfd)
- nfd = 0
- }
- return
-}
-
-func Accept4(fd int, flags int) (nfd int, sa Sockaddr, err error) {
- var rsa RawSockaddrAny
- var len _Socklen = SizeofSockaddrAny
- nfd, err = accept4(fd, &rsa, &len, flags)
- if err != nil {
- return
- }
- if len > SizeofSockaddrAny {
- panic("RawSockaddrAny too small")
- }
- sa, err = anyToSockaddr(&rsa)
- if err != nil {
- Close(nfd)
- nfd = 0
- }
- return
-}
-
-func Getsockname(fd int) (sa Sockaddr, err error) {
- var rsa RawSockaddrAny
- var len _Socklen = SizeofSockaddrAny
- if err = getsockname(fd, &rsa, &len); err != nil {
- return
- }
- return anyToSockaddr(&rsa)
-}
-
-func GetsockoptInet4Addr(fd, level, opt int) (value [4]byte, err error) {
- vallen := _Socklen(4)
- err = getsockopt(fd, level, opt, unsafe.Pointer(&value[0]), &vallen)
- return value, err
-}
-
-func GetsockoptIPMreq(fd, level, opt int) (*IPMreq, error) {
- var value IPMreq
- vallen := _Socklen(SizeofIPMreq)
- err := getsockopt(fd, level, opt, unsafe.Pointer(&value), &vallen)
- return &value, err
-}
-
-func GetsockoptIPMreqn(fd, level, opt int) (*IPMreqn, error) {
- var value IPMreqn
- vallen := _Socklen(SizeofIPMreqn)
- err := getsockopt(fd, level, opt, unsafe.Pointer(&value), &vallen)
- return &value, err
-}
-
-func GetsockoptIPv6Mreq(fd, level, opt int) (*IPv6Mreq, error) {
- var value IPv6Mreq
- vallen := _Socklen(SizeofIPv6Mreq)
- err := getsockopt(fd, level, opt, unsafe.Pointer(&value), &vallen)
- return &value, err
-}
-
-func GetsockoptIPv6MTUInfo(fd, level, opt int) (*IPv6MTUInfo, error) {
- var value IPv6MTUInfo
- vallen := _Socklen(SizeofIPv6MTUInfo)
- err := getsockopt(fd, level, opt, unsafe.Pointer(&value), &vallen)
- return &value, err
-}
-
-func GetsockoptICMPv6Filter(fd, level, opt int) (*ICMPv6Filter, error) {
- var value ICMPv6Filter
- vallen := _Socklen(SizeofICMPv6Filter)
- err := getsockopt(fd, level, opt, unsafe.Pointer(&value), &vallen)
- return &value, err
-}
-
-func GetsockoptUcred(fd, level, opt int) (*Ucred, error) {
- var value Ucred
- vallen := _Socklen(SizeofUcred)
- err := getsockopt(fd, level, opt, unsafe.Pointer(&value), &vallen)
- return &value, err
-}
-
-func SetsockoptIPMreqn(fd, level, opt int, mreq *IPMreqn) (err error) {
- return setsockopt(fd, level, opt, unsafe.Pointer(mreq), unsafe.Sizeof(*mreq))
-}
-
-func Recvmsg(fd int, p, oob []byte, flags int) (n, oobn int, recvflags int, from Sockaddr, err error) {
- var msg Msghdr
- var rsa RawSockaddrAny
- msg.Name = (*byte)(unsafe.Pointer(&rsa))
- msg.Namelen = uint32(SizeofSockaddrAny)
- var iov Iovec
- if len(p) > 0 {
- iov.Base = (*byte)(unsafe.Pointer(&p[0]))
- iov.SetLen(len(p))
- }
- var dummy byte
- if len(oob) > 0 {
- // receive at least one normal byte
- if len(p) == 0 {
- iov.Base = &dummy
- iov.SetLen(1)
- }
- msg.Control = (*byte)(unsafe.Pointer(&oob[0]))
- msg.SetControllen(len(oob))
- }
- msg.Iov = &iov
- msg.Iovlen = 1
- if n, err = recvmsg(fd, &msg, flags); err != nil {
- return
- }
- oobn = int(msg.Controllen)
- recvflags = int(msg.Flags)
- // source address is only specified if the socket is unconnected
- if rsa.Addr.Family != AF_UNSPEC {
- from, err = anyToSockaddr(&rsa)
- }
- return
-}
-
-func Sendmsg(fd int, p, oob []byte, to Sockaddr, flags int) (err error) {
- _, err = SendmsgN(fd, p, oob, to, flags)
- return
-}
-
-func SendmsgN(fd int, p, oob []byte, to Sockaddr, flags int) (n int, err error) {
- var ptr unsafe.Pointer
- var salen _Socklen
- if to != nil {
- var err error
- ptr, salen, err = to.sockaddr()
- if err != nil {
- return 0, err
- }
- }
- var msg Msghdr
- msg.Name = (*byte)(unsafe.Pointer(ptr))
- msg.Namelen = uint32(salen)
- var iov Iovec
- if len(p) > 0 {
- iov.Base = (*byte)(unsafe.Pointer(&p[0]))
- iov.SetLen(len(p))
- }
- var dummy byte
- if len(oob) > 0 {
- // send at least one normal byte
- if len(p) == 0 {
- iov.Base = &dummy
- iov.SetLen(1)
- }
- msg.Control = (*byte)(unsafe.Pointer(&oob[0]))
- msg.SetControllen(len(oob))
- }
- msg.Iov = &iov
- msg.Iovlen = 1
- if n, err = sendmsg(fd, &msg, flags); err != nil {
- return 0, err
- }
- if len(oob) > 0 && len(p) == 0 {
- n = 0
- }
- return n, nil
-}
-
-// BindToDevice binds the socket associated with fd to device.
-func BindToDevice(fd int, device string) (err error) {
- return SetsockoptString(fd, SOL_SOCKET, SO_BINDTODEVICE, device)
-}
-
-//sys ptrace(request int, pid int, addr uintptr, data uintptr) (err error)
-
-func ptracePeek(req int, pid int, addr uintptr, out []byte) (count int, err error) {
- // The peek requests are machine-size oriented, so we wrap it
- // to retrieve arbitrary-length data.
-
- // The ptrace syscall differs from glibc's ptrace.
- // Peeks returns the word in *data, not as the return value.
-
- var buf [sizeofPtr]byte
-
- // Leading edge. PEEKTEXT/PEEKDATA don't require aligned
- // access (PEEKUSER warns that it might), but if we don't
- // align our reads, we might straddle an unmapped page
- // boundary and not get the bytes leading up to the page
- // boundary.
- n := 0
- if addr%sizeofPtr != 0 {
- err = ptrace(req, pid, addr-addr%sizeofPtr, uintptr(unsafe.Pointer(&buf[0])))
- if err != nil {
- return 0, err
- }
- n += copy(out, buf[addr%sizeofPtr:])
- out = out[n:]
- }
-
- // Remainder.
- for len(out) > 0 {
- // We use an internal buffer to guarantee alignment.
- // It's not documented if this is necessary, but we're paranoid.
- err = ptrace(req, pid, addr+uintptr(n), uintptr(unsafe.Pointer(&buf[0])))
- if err != nil {
- return n, err
- }
- copied := copy(out, buf[0:])
- n += copied
- out = out[copied:]
- }
-
- return n, nil
-}
-
-func PtracePeekText(pid int, addr uintptr, out []byte) (count int, err error) {
- return ptracePeek(PTRACE_PEEKTEXT, pid, addr, out)
-}
-
-func PtracePeekData(pid int, addr uintptr, out []byte) (count int, err error) {
- return ptracePeek(PTRACE_PEEKDATA, pid, addr, out)
-}
-
-func ptracePoke(pokeReq int, peekReq int, pid int, addr uintptr, data []byte) (count int, err error) {
- // As for ptracePeek, we need to align our accesses to deal
- // with the possibility of straddling an invalid page.
-
- // Leading edge.
- n := 0
- if addr%sizeofPtr != 0 {
- var buf [sizeofPtr]byte
- err = ptrace(peekReq, pid, addr-addr%sizeofPtr, uintptr(unsafe.Pointer(&buf[0])))
- if err != nil {
- return 0, err
- }
- n += copy(buf[addr%sizeofPtr:], data)
- word := *((*uintptr)(unsafe.Pointer(&buf[0])))
- err = ptrace(pokeReq, pid, addr-addr%sizeofPtr, word)
- if err != nil {
- return 0, err
- }
- data = data[n:]
- }
-
- // Interior.
- for len(data) > sizeofPtr {
- word := *((*uintptr)(unsafe.Pointer(&data[0])))
- err = ptrace(pokeReq, pid, addr+uintptr(n), word)
- if err != nil {
- return n, err
- }
- n += sizeofPtr
- data = data[sizeofPtr:]
- }
-
- // Trailing edge.
- if len(data) > 0 {
- var buf [sizeofPtr]byte
- err = ptrace(peekReq, pid, addr+uintptr(n), uintptr(unsafe.Pointer(&buf[0])))
- if err != nil {
- return n, err
- }
- copy(buf[0:], data)
- word := *((*uintptr)(unsafe.Pointer(&buf[0])))
- err = ptrace(pokeReq, pid, addr+uintptr(n), word)
- if err != nil {
- return n, err
- }
- n += len(data)
- }
-
- return n, nil
-}
-
-func PtracePokeText(pid int, addr uintptr, data []byte) (count int, err error) {
- return ptracePoke(PTRACE_POKETEXT, PTRACE_PEEKTEXT, pid, addr, data)
-}
-
-func PtracePokeData(pid int, addr uintptr, data []byte) (count int, err error) {
- return ptracePoke(PTRACE_POKEDATA, PTRACE_PEEKDATA, pid, addr, data)
-}
-
-func PtraceGetRegs(pid int, regsout *PtraceRegs) (err error) {
- return ptrace(PTRACE_GETREGS, pid, 0, uintptr(unsafe.Pointer(regsout)))
-}
-
-func PtraceSetRegs(pid int, regs *PtraceRegs) (err error) {
- return ptrace(PTRACE_SETREGS, pid, 0, uintptr(unsafe.Pointer(regs)))
-}
-
-func PtraceSetOptions(pid int, options int) (err error) {
- return ptrace(PTRACE_SETOPTIONS, pid, 0, uintptr(options))
-}
-
-func PtraceGetEventMsg(pid int) (msg uint, err error) {
- var data _C_long
- err = ptrace(PTRACE_GETEVENTMSG, pid, 0, uintptr(unsafe.Pointer(&data)))
- msg = uint(data)
- return
-}
-
-func PtraceCont(pid int, signal int) (err error) {
- return ptrace(PTRACE_CONT, pid, 0, uintptr(signal))
-}
-
-func PtraceSyscall(pid int, signal int) (err error) {
- return ptrace(PTRACE_SYSCALL, pid, 0, uintptr(signal))
-}
-
-func PtraceSingleStep(pid int) (err error) { return ptrace(PTRACE_SINGLESTEP, pid, 0, 0) }
-
-func PtraceAttach(pid int) (err error) { return ptrace(PTRACE_ATTACH, pid, 0, 0) }
-
-func PtraceDetach(pid int) (err error) { return ptrace(PTRACE_DETACH, pid, 0, 0) }
-
-//sys reboot(magic1 uint, magic2 uint, cmd int, arg string) (err error)
-
-func Reboot(cmd int) (err error) {
- return reboot(LINUX_REBOOT_MAGIC1, LINUX_REBOOT_MAGIC2, cmd, "")
-}
-
-func clen(n []byte) int {
- for i := 0; i < len(n); i++ {
- if n[i] == 0 {
- return i
- }
- }
- return len(n)
-}
-
-func ReadDirent(fd int, buf []byte) (n int, err error) {
- return Getdents(fd, buf)
-}
-
-func ParseDirent(buf []byte, max int, names []string) (consumed int, count int, newnames []string) {
- origlen := len(buf)
- count = 0
- for max != 0 && len(buf) > 0 {
- dirent := (*Dirent)(unsafe.Pointer(&buf[0]))
- buf = buf[dirent.Reclen:]
- if dirent.Ino == 0 { // File absent in directory.
- continue
- }
- bytes := (*[10000]byte)(unsafe.Pointer(&dirent.Name[0]))
- var name = string(bytes[0:clen(bytes[:])])
- if name == "." || name == ".." { // Useless names
- continue
- }
- max--
- count++
- names = append(names, name)
- }
- return origlen - len(buf), count, names
-}
-
-//sys mount(source string, target string, fstype string, flags uintptr, data *byte) (err error)
-
-func Mount(source string, target string, fstype string, flags uintptr, data string) (err error) {
- // Certain file systems get rather angry and EINVAL if you give
- // them an empty string of data, rather than NULL.
- if data == "" {
- return mount(source, target, fstype, flags, nil)
- }
- datap, err := BytePtrFromString(data)
- if err != nil {
- return err
- }
- return mount(source, target, fstype, flags, datap)
-}
-
-// Sendto
-// Recvfrom
-// Socketpair
-
-/*
- * Direct access
- */
-//sys Acct(path string) (err error)
-//sys Adjtimex(buf *Timex) (state int, err error)
-//sys Chdir(path string) (err error)
-//sys Chroot(path string) (err error)
-//sys ClockGettime(clockid int32, time *Timespec) (err error)
-//sys Close(fd int) (err error)
-//sys Dup(oldfd int) (fd int, err error)
-//sys Dup3(oldfd int, newfd int, flags int) (err error)
-//sysnb EpollCreate(size int) (fd int, err error)
-//sysnb EpollCreate1(flag int) (fd int, err error)
-//sysnb EpollCtl(epfd int, op int, fd int, event *EpollEvent) (err error)
-//sys EpollWait(epfd int, events []EpollEvent, msec int) (n int, err error)
-//sys Exit(code int) = SYS_EXIT_GROUP
-//sys Faccessat(dirfd int, path string, mode uint32, flags int) (err error)
-//sys Fallocate(fd int, mode uint32, off int64, len int64) (err error)
-//sys Fchdir(fd int) (err error)
-//sys Fchmod(fd int, mode uint32) (err error)
-//sys Fchmodat(dirfd int, path string, mode uint32, flags int) (err error)
-//sys Fchownat(dirfd int, path string, uid int, gid int, flags int) (err error)
-//sys fcntl(fd int, cmd int, arg int) (val int, err error)
-//sys Fdatasync(fd int) (err error)
-//sys Flock(fd int, how int) (err error)
-//sys Fsync(fd int) (err error)
-//sys Getdents(fd int, buf []byte) (n int, err error) = SYS_GETDENTS64
-//sysnb Getpgid(pid int) (pgid int, err error)
-
-func Getpgrp() (pid int) {
- pid, _ = Getpgid(0)
- return
-}
-
-//sysnb Getpid() (pid int)
-//sysnb Getppid() (ppid int)
-//sys Getpriority(which int, who int) (prio int, err error)
-//sysnb Getrusage(who int, rusage *Rusage) (err error)
-//sysnb Gettid() (tid int)
-//sys Getxattr(path string, attr string, dest []byte) (sz int, err error)
-//sys InotifyAddWatch(fd int, pathname string, mask uint32) (watchdesc int, err error)
-//sysnb InotifyInit1(flags int) (fd int, err error)
-//sysnb InotifyRmWatch(fd int, watchdesc uint32) (success int, err error)
-//sysnb Kill(pid int, sig syscall.Signal) (err error)
-//sys Klogctl(typ int, buf []byte) (n int, err error) = SYS_SYSLOG
-//sys Listxattr(path string, dest []byte) (sz int, err error)
-//sys Mkdirat(dirfd int, path string, mode uint32) (err error)
-//sys Mknodat(dirfd int, path string, mode uint32, dev int) (err error)
-//sys Nanosleep(time *Timespec, leftover *Timespec) (err error)
-//sys Pause() (err error)
-//sys PivotRoot(newroot string, putold string) (err error) = SYS_PIVOT_ROOT
-//sysnb prlimit(pid int, resource int, old *Rlimit, newlimit *Rlimit) (err error) = SYS_PRLIMIT64
-//sys Prctl(option int, arg2 uintptr, arg3 uintptr, arg4 uintptr, arg5 uintptr) (err error)
-//sys read(fd int, p []byte) (n int, err error)
-//sys Removexattr(path string, attr string) (err error)
-//sys Renameat(olddirfd int, oldpath string, newdirfd int, newpath string) (err error)
-//sys Setdomainname(p []byte) (err error)
-//sys Sethostname(p []byte) (err error)
-//sysnb Setpgid(pid int, pgid int) (err error)
-//sysnb Setsid() (pid int, err error)
-//sysnb Settimeofday(tv *Timeval) (err error)
-
-// issue 1435.
-// On linux Setuid and Setgid only affects the current thread, not the process.
-// This does not match what most callers expect so we must return an error
-// here rather than letting the caller think that the call succeeded.
-
-func Setuid(uid int) (err error) {
- return EOPNOTSUPP
-}
-
-func Setgid(uid int) (err error) {
- return EOPNOTSUPP
-}
-
-//sys Setpriority(which int, who int, prio int) (err error)
-//sys Setxattr(path string, attr string, data []byte, flags int) (err error)
-//sys Sync()
-//sysnb Sysinfo(info *Sysinfo_t) (err error)
-//sys Tee(rfd int, wfd int, len int, flags int) (n int64, err error)
-//sysnb Tgkill(tgid int, tid int, sig syscall.Signal) (err error)
-//sysnb Times(tms *Tms) (ticks uintptr, err error)
-//sysnb Umask(mask int) (oldmask int)
-//sysnb Uname(buf *Utsname) (err error)
-//sys Unmount(target string, flags int) (err error) = SYS_UMOUNT2
-//sys Unshare(flags int) (err error)
-//sys Ustat(dev int, ubuf *Ustat_t) (err error)
-//sys Utime(path string, buf *Utimbuf) (err error)
-//sys write(fd int, p []byte) (n int, err error)
-//sys exitThread(code int) (err error) = SYS_EXIT
-//sys readlen(fd int, p *byte, np int) (n int, err error) = SYS_READ
-//sys writelen(fd int, p *byte, np int) (n int, err error) = SYS_WRITE
-
-// mmap varies by architecture; see syscall_linux_*.go.
-//sys munmap(addr uintptr, length uintptr) (err error)
-
-var mapper = &mmapper{
- active: make(map[*byte][]byte),
- mmap: mmap,
- munmap: munmap,
-}
-
-func Mmap(fd int, offset int64, length int, prot int, flags int) (data []byte, err error) {
- return mapper.Mmap(fd, offset, length, prot, flags)
-}
-
-func Munmap(b []byte) (err error) {
- return mapper.Munmap(b)
-}
-
-//sys Madvise(b []byte, advice int) (err error)
-//sys Mprotect(b []byte, prot int) (err error)
-//sys Mlock(b []byte) (err error)
-//sys Munlock(b []byte) (err error)
-//sys Mlockall(flags int) (err error)
-//sys Munlockall() (err error)
-
-/*
- * Unimplemented
- */
-// AddKey
-// AfsSyscall
-// Alarm
-// ArchPrctl
-// Brk
-// Capget
-// Capset
-// ClockGetres
-// ClockNanosleep
-// ClockSettime
-// Clone
-// CreateModule
-// DeleteModule
-// EpollCtlOld
-// EpollPwait
-// EpollWaitOld
-// Eventfd
-// Execve
-// Fgetxattr
-// Flistxattr
-// Fork
-// Fremovexattr
-// Fsetxattr
-// Futex
-// GetKernelSyms
-// GetMempolicy
-// GetRobustList
-// GetThreadArea
-// Getitimer
-// Getpmsg
-// IoCancel
-// IoDestroy
-// IoGetevents
-// IoSetup
-// IoSubmit
-// Ioctl
-// IoprioGet
-// IoprioSet
-// KexecLoad
-// Keyctl
-// Lgetxattr
-// Llistxattr
-// LookupDcookie
-// Lremovexattr
-// Lsetxattr
-// Mbind
-// MigratePages
-// Mincore
-// ModifyLdt
-// Mount
-// MovePages
-// Mprotect
-// MqGetsetattr
-// MqNotify
-// MqOpen
-// MqTimedreceive
-// MqTimedsend
-// MqUnlink
-// Mremap
-// Msgctl
-// Msgget
-// Msgrcv
-// Msgsnd
-// Msync
-// Newfstatat
-// Nfsservctl
-// Personality
-// Poll
-// Ppoll
-// Pselect6
-// Ptrace
-// Putpmsg
-// QueryModule
-// Quotactl
-// Readahead
-// Readv
-// RemapFilePages
-// RequestKey
-// RestartSyscall
-// RtSigaction
-// RtSigpending
-// RtSigprocmask
-// RtSigqueueinfo
-// RtSigreturn
-// RtSigsuspend
-// RtSigtimedwait
-// SchedGetPriorityMax
-// SchedGetPriorityMin
-// SchedGetaffinity
-// SchedGetparam
-// SchedGetscheduler
-// SchedRrGetInterval
-// SchedSetaffinity
-// SchedSetparam
-// SchedYield
-// Security
-// Semctl
-// Semget
-// Semop
-// Semtimedop
-// SetMempolicy
-// SetRobustList
-// SetThreadArea
-// SetTidAddress
-// Shmat
-// Shmctl
-// Shmdt
-// Shmget
-// Sigaltstack
-// Signalfd
-// Swapoff
-// Swapon
-// Sysfs
-// TimerCreate
-// TimerDelete
-// TimerGetoverrun
-// TimerGettime
-// TimerSettime
-// Timerfd
-// Tkill (obsolete)
-// Tuxcall
-// Umount2
-// Uselib
-// Utimensat
-// Vfork
-// Vhangup
-// Vmsplice
-// Vserver
-// Waitid
-// _Sysctl
diff --git a/vendor/golang.org/x/sys/unix/syscall_linux_386.go b/vendor/golang.org/x/sys/unix/syscall_linux_386.go
deleted file mode 100644
index 7171219a..00000000
--- a/vendor/golang.org/x/sys/unix/syscall_linux_386.go
+++ /dev/null
@@ -1,388 +0,0 @@
-// Copyright 2009 The Go Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style
-// license that can be found in the LICENSE file.
-
-// TODO(rsc): Rewrite all nn(SP) references into name+(nn-8)(FP)
-// so that go vet can check that they are correct.
-
-// +build 386,linux
-
-package unix
-
-import (
- "syscall"
- "unsafe"
-)
-
-func Getpagesize() int { return 4096 }
-
-func TimespecToNsec(ts Timespec) int64 { return int64(ts.Sec)*1e9 + int64(ts.Nsec) }
-
-func NsecToTimespec(nsec int64) (ts Timespec) {
- ts.Sec = int32(nsec / 1e9)
- ts.Nsec = int32(nsec % 1e9)
- return
-}
-
-func TimevalToNsec(tv Timeval) int64 { return int64(tv.Sec)*1e9 + int64(tv.Usec)*1e3 }
-
-func NsecToTimeval(nsec int64) (tv Timeval) {
- nsec += 999 // round up to microsecond
- tv.Sec = int32(nsec / 1e9)
- tv.Usec = int32(nsec % 1e9 / 1e3)
- return
-}
-
-//sysnb pipe(p *[2]_C_int) (err error)
-
-func Pipe(p []int) (err error) {
- if len(p) != 2 {
- return EINVAL
- }
- var pp [2]_C_int
- err = pipe(&pp)
- p[0] = int(pp[0])
- p[1] = int(pp[1])
- return
-}
-
-//sysnb pipe2(p *[2]_C_int, flags int) (err error)
-
-func Pipe2(p []int, flags int) (err error) {
- if len(p) != 2 {
- return EINVAL
- }
- var pp [2]_C_int
- err = pipe2(&pp, flags)
- p[0] = int(pp[0])
- p[1] = int(pp[1])
- return
-}
-
-// 64-bit file system and 32-bit uid calls
-// (386 default is 32-bit file system and 16-bit uid).
-//sys Dup2(oldfd int, newfd int) (err error)
-//sys Fadvise(fd int, offset int64, length int64, advice int) (err error) = SYS_FADVISE64_64
-//sys Fchown(fd int, uid int, gid int) (err error) = SYS_FCHOWN32
-//sys Fstat(fd int, stat *Stat_t) (err error) = SYS_FSTAT64
-//sys Ftruncate(fd int, length int64) (err error) = SYS_FTRUNCATE64
-//sysnb Getegid() (egid int) = SYS_GETEGID32
-//sysnb Geteuid() (euid int) = SYS_GETEUID32
-//sysnb Getgid() (gid int) = SYS_GETGID32
-//sysnb Getuid() (uid int) = SYS_GETUID32
-//sysnb InotifyInit() (fd int, err error)
-//sys Ioperm(from int, num int, on int) (err error)
-//sys Iopl(level int) (err error)
-//sys Lchown(path string, uid int, gid int) (err error) = SYS_LCHOWN32
-//sys Lstat(path string, stat *Stat_t) (err error) = SYS_LSTAT64
-//sys Pread(fd int, p []byte, offset int64) (n int, err error) = SYS_PREAD64
-//sys Pwrite(fd int, p []byte, offset int64) (n int, err error) = SYS_PWRITE64
-//sys sendfile(outfd int, infd int, offset *int64, count int) (written int, err error) = SYS_SENDFILE64
-//sys Setfsgid(gid int) (err error) = SYS_SETFSGID32
-//sys Setfsuid(uid int) (err error) = SYS_SETFSUID32
-//sysnb Setregid(rgid int, egid int) (err error) = SYS_SETREGID32
-//sysnb Setresgid(rgid int, egid int, sgid int) (err error) = SYS_SETRESGID32
-//sysnb Setresuid(ruid int, euid int, suid int) (err error) = SYS_SETRESUID32
-//sysnb Setreuid(ruid int, euid int) (err error) = SYS_SETREUID32
-//sys Splice(rfd int, roff *int64, wfd int, woff *int64, len int, flags int) (n int, err error)
-//sys Stat(path string, stat *Stat_t) (err error) = SYS_STAT64
-//sys SyncFileRange(fd int, off int64, n int64, flags int) (err error)
-//sys Truncate(path string, length int64) (err error) = SYS_TRUNCATE64
-//sysnb getgroups(n int, list *_Gid_t) (nn int, err error) = SYS_GETGROUPS32
-//sysnb setgroups(n int, list *_Gid_t) (err error) = SYS_SETGROUPS32
-//sys Select(nfd int, r *FdSet, w *FdSet, e *FdSet, timeout *Timeval) (n int, err error) = SYS__NEWSELECT
-
-//sys mmap2(addr uintptr, length uintptr, prot int, flags int, fd int, pageOffset uintptr) (xaddr uintptr, err error)
-
-func mmap(addr uintptr, length uintptr, prot int, flags int, fd int, offset int64) (xaddr uintptr, err error) {
- page := uintptr(offset / 4096)
- if offset != int64(page)*4096 {
- return 0, EINVAL
- }
- return mmap2(addr, length, prot, flags, fd, page)
-}
-
-type rlimit32 struct {
- Cur uint32
- Max uint32
-}
-
-//sysnb getrlimit(resource int, rlim *rlimit32) (err error) = SYS_GETRLIMIT
-
-const rlimInf32 = ^uint32(0)
-const rlimInf64 = ^uint64(0)
-
-func Getrlimit(resource int, rlim *Rlimit) (err error) {
- err = prlimit(0, resource, nil, rlim)
- if err != ENOSYS {
- return err
- }
-
- rl := rlimit32{}
- err = getrlimit(resource, &rl)
- if err != nil {
- return
- }
-
- if rl.Cur == rlimInf32 {
- rlim.Cur = rlimInf64
- } else {
- rlim.Cur = uint64(rl.Cur)
- }
-
- if rl.Max == rlimInf32 {
- rlim.Max = rlimInf64
- } else {
- rlim.Max = uint64(rl.Max)
- }
- return
-}
-
-//sysnb setrlimit(resource int, rlim *rlimit32) (err error) = SYS_SETRLIMIT
-
-func Setrlimit(resource int, rlim *Rlimit) (err error) {
- err = prlimit(0, resource, rlim, nil)
- if err != ENOSYS {
- return err
- }
-
- rl := rlimit32{}
- if rlim.Cur == rlimInf64 {
- rl.Cur = rlimInf32
- } else if rlim.Cur < uint64(rlimInf32) {
- rl.Cur = uint32(rlim.Cur)
- } else {
- return EINVAL
- }
- if rlim.Max == rlimInf64 {
- rl.Max = rlimInf32
- } else if rlim.Max < uint64(rlimInf32) {
- rl.Max = uint32(rlim.Max)
- } else {
- return EINVAL
- }
-
- return setrlimit(resource, &rl)
-}
-
-// Underlying system call writes to newoffset via pointer.
-// Implemented in assembly to avoid allocation.
-func seek(fd int, offset int64, whence int) (newoffset int64, err syscall.Errno)
-
-func Seek(fd int, offset int64, whence int) (newoffset int64, err error) {
- newoffset, errno := seek(fd, offset, whence)
- if errno != 0 {
- return 0, errno
- }
- return newoffset, nil
-}
-
-// Vsyscalls on amd64.
-//sysnb Gettimeofday(tv *Timeval) (err error)
-//sysnb Time(t *Time_t) (tt Time_t, err error)
-
-// On x86 Linux, all the socket calls go through an extra indirection,
-// I think because the 5-register system call interface can't handle
-// the 6-argument calls like sendto and recvfrom. Instead the
-// arguments to the underlying system call are the number below
-// and a pointer to an array of uintptr. We hide the pointer in the
-// socketcall assembly to avoid allocation on every system call.
-
-const (
- // see linux/net.h
- _SOCKET = 1
- _BIND = 2
- _CONNECT = 3
- _LISTEN = 4
- _ACCEPT = 5
- _GETSOCKNAME = 6
- _GETPEERNAME = 7
- _SOCKETPAIR = 8
- _SEND = 9
- _RECV = 10
- _SENDTO = 11
- _RECVFROM = 12
- _SHUTDOWN = 13
- _SETSOCKOPT = 14
- _GETSOCKOPT = 15
- _SENDMSG = 16
- _RECVMSG = 17
- _ACCEPT4 = 18
- _RECVMMSG = 19
- _SENDMMSG = 20
-)
-
-func socketcall(call int, a0, a1, a2, a3, a4, a5 uintptr) (n int, err syscall.Errno)
-func rawsocketcall(call int, a0, a1, a2, a3, a4, a5 uintptr) (n int, err syscall.Errno)
-
-func accept(s int, rsa *RawSockaddrAny, addrlen *_Socklen) (fd int, err error) {
- fd, e := socketcall(_ACCEPT, uintptr(s), uintptr(unsafe.Pointer(rsa)), uintptr(unsafe.Pointer(addrlen)), 0, 0, 0)
- if e != 0 {
- err = e
- }
- return
-}
-
-func accept4(s int, rsa *RawSockaddrAny, addrlen *_Socklen, flags int) (fd int, err error) {
- fd, e := socketcall(_ACCEPT4, uintptr(s), uintptr(unsafe.Pointer(rsa)), uintptr(unsafe.Pointer(addrlen)), uintptr(flags), 0, 0)
- if e != 0 {
- err = e
- }
- return
-}
-
-func getsockname(s int, rsa *RawSockaddrAny, addrlen *_Socklen) (err error) {
- _, e := rawsocketcall(_GETSOCKNAME, uintptr(s), uintptr(unsafe.Pointer(rsa)), uintptr(unsafe.Pointer(addrlen)), 0, 0, 0)
- if e != 0 {
- err = e
- }
- return
-}
-
-func getpeername(s int, rsa *RawSockaddrAny, addrlen *_Socklen) (err error) {
- _, e := rawsocketcall(_GETPEERNAME, uintptr(s), uintptr(unsafe.Pointer(rsa)), uintptr(unsafe.Pointer(addrlen)), 0, 0, 0)
- if e != 0 {
- err = e
- }
- return
-}
-
-func socketpair(domain int, typ int, flags int, fd *[2]int32) (err error) {
- _, e := rawsocketcall(_SOCKETPAIR, uintptr(domain), uintptr(typ), uintptr(flags), uintptr(unsafe.Pointer(fd)), 0, 0)
- if e != 0 {
- err = e
- }
- return
-}
-
-func bind(s int, addr unsafe.Pointer, addrlen _Socklen) (err error) {
- _, e := socketcall(_BIND, uintptr(s), uintptr(addr), uintptr(addrlen), 0, 0, 0)
- if e != 0 {
- err = e
- }
- return
-}
-
-func connect(s int, addr unsafe.Pointer, addrlen _Socklen) (err error) {
- _, e := socketcall(_CONNECT, uintptr(s), uintptr(addr), uintptr(addrlen), 0, 0, 0)
- if e != 0 {
- err = e
- }
- return
-}
-
-func socket(domain int, typ int, proto int) (fd int, err error) {
- fd, e := rawsocketcall(_SOCKET, uintptr(domain), uintptr(typ), uintptr(proto), 0, 0, 0)
- if e != 0 {
- err = e
- }
- return
-}
-
-func getsockopt(s int, level int, name int, val unsafe.Pointer, vallen *_Socklen) (err error) {
- _, e := socketcall(_GETSOCKOPT, uintptr(s), uintptr(level), uintptr(name), uintptr(val), uintptr(unsafe.Pointer(vallen)), 0)
- if e != 0 {
- err = e
- }
- return
-}
-
-func setsockopt(s int, level int, name int, val unsafe.Pointer, vallen uintptr) (err error) {
- _, e := socketcall(_SETSOCKOPT, uintptr(s), uintptr(level), uintptr(name), uintptr(val), vallen, 0)
- if e != 0 {
- err = e
- }
- return
-}
-
-func recvfrom(s int, p []byte, flags int, from *RawSockaddrAny, fromlen *_Socklen) (n int, err error) {
- var base uintptr
- if len(p) > 0 {
- base = uintptr(unsafe.Pointer(&p[0]))
- }
- n, e := socketcall(_RECVFROM, uintptr(s), base, uintptr(len(p)), uintptr(flags), uintptr(unsafe.Pointer(from)), uintptr(unsafe.Pointer(fromlen)))
- if e != 0 {
- err = e
- }
- return
-}
-
-func sendto(s int, p []byte, flags int, to unsafe.Pointer, addrlen _Socklen) (err error) {
- var base uintptr
- if len(p) > 0 {
- base = uintptr(unsafe.Pointer(&p[0]))
- }
- _, e := socketcall(_SENDTO, uintptr(s), base, uintptr(len(p)), uintptr(flags), uintptr(to), uintptr(addrlen))
- if e != 0 {
- err = e
- }
- return
-}
-
-func recvmsg(s int, msg *Msghdr, flags int) (n int, err error) {
- n, e := socketcall(_RECVMSG, uintptr(s), uintptr(unsafe.Pointer(msg)), uintptr(flags), 0, 0, 0)
- if e != 0 {
- err = e
- }
- return
-}
-
-func sendmsg(s int, msg *Msghdr, flags int) (n int, err error) {
- n, e := socketcall(_SENDMSG, uintptr(s), uintptr(unsafe.Pointer(msg)), uintptr(flags), 0, 0, 0)
- if e != 0 {
- err = e
- }
- return
-}
-
-func Listen(s int, n int) (err error) {
- _, e := socketcall(_LISTEN, uintptr(s), uintptr(n), 0, 0, 0, 0)
- if e != 0 {
- err = e
- }
- return
-}
-
-func Shutdown(s, how int) (err error) {
- _, e := socketcall(_SHUTDOWN, uintptr(s), uintptr(how), 0, 0, 0, 0)
- if e != 0 {
- err = e
- }
- return
-}
-
-func Fstatfs(fd int, buf *Statfs_t) (err error) {
- _, _, e := Syscall(SYS_FSTATFS64, uintptr(fd), unsafe.Sizeof(*buf), uintptr(unsafe.Pointer(buf)))
- if e != 0 {
- err = e
- }
- return
-}
-
-func Statfs(path string, buf *Statfs_t) (err error) {
- pathp, err := BytePtrFromString(path)
- if err != nil {
- return err
- }
- _, _, e := Syscall(SYS_STATFS64, uintptr(unsafe.Pointer(pathp)), unsafe.Sizeof(*buf), uintptr(unsafe.Pointer(buf)))
- if e != 0 {
- err = e
- }
- return
-}
-
-func (r *PtraceRegs) PC() uint64 { return uint64(uint32(r.Eip)) }
-
-func (r *PtraceRegs) SetPC(pc uint64) { r.Eip = int32(pc) }
-
-func (iov *Iovec) SetLen(length int) {
- iov.Len = uint32(length)
-}
-
-func (msghdr *Msghdr) SetControllen(length int) {
- msghdr.Controllen = uint32(length)
-}
-
-func (cmsg *Cmsghdr) SetLen(length int) {
- cmsg.Len = uint32(length)
-}
diff --git a/vendor/golang.org/x/sys/unix/syscall_linux_amd64.go b/vendor/golang.org/x/sys/unix/syscall_linux_amd64.go
deleted file mode 100644
index ae70c2af..00000000
--- a/vendor/golang.org/x/sys/unix/syscall_linux_amd64.go
+++ /dev/null
@@ -1,146 +0,0 @@
-// Copyright 2009 The Go Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style
-// license that can be found in the LICENSE file.
-
-// +build amd64,linux
-
-package unix
-
-import "syscall"
-
-//sys Dup2(oldfd int, newfd int) (err error)
-//sys Fadvise(fd int, offset int64, length int64, advice int) (err error) = SYS_FADVISE64
-//sys Fchown(fd int, uid int, gid int) (err error)
-//sys Fstat(fd int, stat *Stat_t) (err error)
-//sys Fstatfs(fd int, buf *Statfs_t) (err error)
-//sys Ftruncate(fd int, length int64) (err error)
-//sysnb Getegid() (egid int)
-//sysnb Geteuid() (euid int)
-//sysnb Getgid() (gid int)
-//sysnb Getrlimit(resource int, rlim *Rlimit) (err error)
-//sysnb Getuid() (uid int)
-//sysnb InotifyInit() (fd int, err error)
-//sys Ioperm(from int, num int, on int) (err error)
-//sys Iopl(level int) (err error)
-//sys Lchown(path string, uid int, gid int) (err error)
-//sys Listen(s int, n int) (err error)
-//sys Lstat(path string, stat *Stat_t) (err error)
-//sys Pread(fd int, p []byte, offset int64) (n int, err error) = SYS_PREAD64
-//sys Pwrite(fd int, p []byte, offset int64) (n int, err error) = SYS_PWRITE64
-//sys Seek(fd int, offset int64, whence int) (off int64, err error) = SYS_LSEEK
-//sys Select(nfd int, r *FdSet, w *FdSet, e *FdSet, timeout *Timeval) (n int, err error)
-//sys sendfile(outfd int, infd int, offset *int64, count int) (written int, err error)
-//sys Setfsgid(gid int) (err error)
-//sys Setfsuid(uid int) (err error)
-//sysnb Setregid(rgid int, egid int) (err error)
-//sysnb Setresgid(rgid int, egid int, sgid int) (err error)
-//sysnb Setresuid(ruid int, euid int, suid int) (err error)
-//sysnb Setrlimit(resource int, rlim *Rlimit) (err error)
-//sysnb Setreuid(ruid int, euid int) (err error)
-//sys Shutdown(fd int, how int) (err error)
-//sys Splice(rfd int, roff *int64, wfd int, woff *int64, len int, flags int) (n int64, err error)
-//sys Stat(path string, stat *Stat_t) (err error)
-//sys Statfs(path string, buf *Statfs_t) (err error)
-//sys SyncFileRange(fd int, off int64, n int64, flags int) (err error)
-//sys Truncate(path string, length int64) (err error)
-//sys accept(s int, rsa *RawSockaddrAny, addrlen *_Socklen) (fd int, err error)
-//sys accept4(s int, rsa *RawSockaddrAny, addrlen *_Socklen, flags int) (fd int, err error)
-//sys bind(s int, addr unsafe.Pointer, addrlen _Socklen) (err error)
-//sys connect(s int, addr unsafe.Pointer, addrlen _Socklen) (err error)
-//sysnb getgroups(n int, list *_Gid_t) (nn int, err error)
-//sysnb setgroups(n int, list *_Gid_t) (err error)
-//sys getsockopt(s int, level int, name int, val unsafe.Pointer, vallen *_Socklen) (err error)
-//sys setsockopt(s int, level int, name int, val unsafe.Pointer, vallen uintptr) (err error)
-//sysnb socket(domain int, typ int, proto int) (fd int, err error)
-//sysnb socketpair(domain int, typ int, proto int, fd *[2]int32) (err error)
-//sysnb getpeername(fd int, rsa *RawSockaddrAny, addrlen *_Socklen) (err error)
-//sysnb getsockname(fd int, rsa *RawSockaddrAny, addrlen *_Socklen) (err error)
-//sys recvfrom(fd int, p []byte, flags int, from *RawSockaddrAny, fromlen *_Socklen) (n int, err error)
-//sys sendto(s int, buf []byte, flags int, to unsafe.Pointer, addrlen _Socklen) (err error)
-//sys recvmsg(s int, msg *Msghdr, flags int) (n int, err error)
-//sys sendmsg(s int, msg *Msghdr, flags int) (n int, err error)
-//sys mmap(addr uintptr, length uintptr, prot int, flags int, fd int, offset int64) (xaddr uintptr, err error)
-
-//go:noescape
-func gettimeofday(tv *Timeval) (err syscall.Errno)
-
-func Gettimeofday(tv *Timeval) (err error) {
- errno := gettimeofday(tv)
- if errno != 0 {
- return errno
- }
- return nil
-}
-
-func Getpagesize() int { return 4096 }
-
-func Time(t *Time_t) (tt Time_t, err error) {
- var tv Timeval
- errno := gettimeofday(&tv)
- if errno != 0 {
- return 0, errno
- }
- if t != nil {
- *t = Time_t(tv.Sec)
- }
- return Time_t(tv.Sec), nil
-}
-
-func TimespecToNsec(ts Timespec) int64 { return int64(ts.Sec)*1e9 + int64(ts.Nsec) }
-
-func NsecToTimespec(nsec int64) (ts Timespec) {
- ts.Sec = nsec / 1e9
- ts.Nsec = nsec % 1e9
- return
-}
-
-func TimevalToNsec(tv Timeval) int64 { return int64(tv.Sec)*1e9 + int64(tv.Usec)*1e3 }
-
-func NsecToTimeval(nsec int64) (tv Timeval) {
- nsec += 999 // round up to microsecond
- tv.Sec = nsec / 1e9
- tv.Usec = nsec % 1e9 / 1e3
- return
-}
-
-//sysnb pipe(p *[2]_C_int) (err error)
-
-func Pipe(p []int) (err error) {
- if len(p) != 2 {
- return EINVAL
- }
- var pp [2]_C_int
- err = pipe(&pp)
- p[0] = int(pp[0])
- p[1] = int(pp[1])
- return
-}
-
-//sysnb pipe2(p *[2]_C_int, flags int) (err error)
-
-func Pipe2(p []int, flags int) (err error) {
- if len(p) != 2 {
- return EINVAL
- }
- var pp [2]_C_int
- err = pipe2(&pp, flags)
- p[0] = int(pp[0])
- p[1] = int(pp[1])
- return
-}
-
-func (r *PtraceRegs) PC() uint64 { return r.Rip }
-
-func (r *PtraceRegs) SetPC(pc uint64) { r.Rip = pc }
-
-func (iov *Iovec) SetLen(length int) {
- iov.Len = uint64(length)
-}
-
-func (msghdr *Msghdr) SetControllen(length int) {
- msghdr.Controllen = uint64(length)
-}
-
-func (cmsg *Cmsghdr) SetLen(length int) {
- cmsg.Len = uint64(length)
-}
diff --git a/vendor/golang.org/x/sys/unix/syscall_linux_arm.go b/vendor/golang.org/x/sys/unix/syscall_linux_arm.go
deleted file mode 100644
index abc41c3e..00000000
--- a/vendor/golang.org/x/sys/unix/syscall_linux_arm.go
+++ /dev/null
@@ -1,233 +0,0 @@
-// Copyright 2009 The Go Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style
-// license that can be found in the LICENSE file.
-
-// +build arm,linux
-
-package unix
-
-import (
- "syscall"
- "unsafe"
-)
-
-func Getpagesize() int { return 4096 }
-
-func TimespecToNsec(ts Timespec) int64 { return int64(ts.Sec)*1e9 + int64(ts.Nsec) }
-
-func NsecToTimespec(nsec int64) (ts Timespec) {
- ts.Sec = int32(nsec / 1e9)
- ts.Nsec = int32(nsec % 1e9)
- return
-}
-
-func NsecToTimeval(nsec int64) (tv Timeval) {
- nsec += 999 // round up to microsecond
- tv.Sec = int32(nsec / 1e9)
- tv.Usec = int32(nsec % 1e9 / 1e3)
- return
-}
-
-func Pipe(p []int) (err error) {
- if len(p) != 2 {
- return EINVAL
- }
- var pp [2]_C_int
- err = pipe2(&pp, 0)
- p[0] = int(pp[0])
- p[1] = int(pp[1])
- return
-}
-
-//sysnb pipe2(p *[2]_C_int, flags int) (err error)
-
-func Pipe2(p []int, flags int) (err error) {
- if len(p) != 2 {
- return EINVAL
- }
- var pp [2]_C_int
- err = pipe2(&pp, flags)
- p[0] = int(pp[0])
- p[1] = int(pp[1])
- return
-}
-
-// Underlying system call writes to newoffset via pointer.
-// Implemented in assembly to avoid allocation.
-func seek(fd int, offset int64, whence int) (newoffset int64, err syscall.Errno)
-
-func Seek(fd int, offset int64, whence int) (newoffset int64, err error) {
- newoffset, errno := seek(fd, offset, whence)
- if errno != 0 {
- return 0, errno
- }
- return newoffset, nil
-}
-
-//sys accept(s int, rsa *RawSockaddrAny, addrlen *_Socklen) (fd int, err error)
-//sys accept4(s int, rsa *RawSockaddrAny, addrlen *_Socklen, flags int) (fd int, err error)
-//sys bind(s int, addr unsafe.Pointer, addrlen _Socklen) (err error)
-//sys connect(s int, addr unsafe.Pointer, addrlen _Socklen) (err error)
-//sysnb getgroups(n int, list *_Gid_t) (nn int, err error) = SYS_GETGROUPS32
-//sysnb setgroups(n int, list *_Gid_t) (err error) = SYS_SETGROUPS32
-//sys getsockopt(s int, level int, name int, val unsafe.Pointer, vallen *_Socklen) (err error)
-//sys setsockopt(s int, level int, name int, val unsafe.Pointer, vallen uintptr) (err error)
-//sysnb socket(domain int, typ int, proto int) (fd int, err error)
-//sysnb getpeername(fd int, rsa *RawSockaddrAny, addrlen *_Socklen) (err error)
-//sysnb getsockname(fd int, rsa *RawSockaddrAny, addrlen *_Socklen) (err error)
-//sys recvfrom(fd int, p []byte, flags int, from *RawSockaddrAny, fromlen *_Socklen) (n int, err error)
-//sys sendto(s int, buf []byte, flags int, to unsafe.Pointer, addrlen _Socklen) (err error)
-//sysnb socketpair(domain int, typ int, flags int, fd *[2]int32) (err error)
-//sys recvmsg(s int, msg *Msghdr, flags int) (n int, err error)
-//sys sendmsg(s int, msg *Msghdr, flags int) (n int, err error)
-
-// 64-bit file system and 32-bit uid calls
-// (16-bit uid calls are not always supported in newer kernels)
-//sys Dup2(oldfd int, newfd int) (err error)
-//sys Fchown(fd int, uid int, gid int) (err error) = SYS_FCHOWN32
-//sys Fstat(fd int, stat *Stat_t) (err error) = SYS_FSTAT64
-//sysnb Getegid() (egid int) = SYS_GETEGID32
-//sysnb Geteuid() (euid int) = SYS_GETEUID32
-//sysnb Getgid() (gid int) = SYS_GETGID32
-//sysnb Getuid() (uid int) = SYS_GETUID32
-//sysnb InotifyInit() (fd int, err error)
-//sys Lchown(path string, uid int, gid int) (err error) = SYS_LCHOWN32
-//sys Listen(s int, n int) (err error)
-//sys Lstat(path string, stat *Stat_t) (err error) = SYS_LSTAT64
-//sys sendfile(outfd int, infd int, offset *int64, count int) (written int, err error) = SYS_SENDFILE64
-//sys Select(nfd int, r *FdSet, w *FdSet, e *FdSet, timeout *Timeval) (n int, err error) = SYS__NEWSELECT
-//sys Setfsgid(gid int) (err error) = SYS_SETFSGID32
-//sys Setfsuid(uid int) (err error) = SYS_SETFSUID32
-//sysnb Setregid(rgid int, egid int) (err error) = SYS_SETREGID32
-//sysnb Setresgid(rgid int, egid int, sgid int) (err error) = SYS_SETRESGID32
-//sysnb Setresuid(ruid int, euid int, suid int) (err error) = SYS_SETRESUID32
-//sysnb Setreuid(ruid int, euid int) (err error) = SYS_SETREUID32
-//sys Shutdown(fd int, how int) (err error)
-//sys Splice(rfd int, roff *int64, wfd int, woff *int64, len int, flags int) (n int, err error)
-//sys Stat(path string, stat *Stat_t) (err error) = SYS_STAT64
-
-// Vsyscalls on amd64.
-//sysnb Gettimeofday(tv *Timeval) (err error)
-//sysnb Time(t *Time_t) (tt Time_t, err error)
-
-//sys Pread(fd int, p []byte, offset int64) (n int, err error) = SYS_PREAD64
-//sys Pwrite(fd int, p []byte, offset int64) (n int, err error) = SYS_PWRITE64
-//sys Truncate(path string, length int64) (err error) = SYS_TRUNCATE64
-//sys Ftruncate(fd int, length int64) (err error) = SYS_FTRUNCATE64
-
-func Fadvise(fd int, offset int64, length int64, advice int) (err error) {
- _, _, e1 := Syscall6(SYS_ARM_FADVISE64_64, uintptr(fd), uintptr(advice), uintptr(offset), uintptr(offset>>32), uintptr(length), uintptr(length>>32))
- if e1 != 0 {
- err = errnoErr(e1)
- }
- return
-}
-
-//sys mmap2(addr uintptr, length uintptr, prot int, flags int, fd int, pageOffset uintptr) (xaddr uintptr, err error)
-
-func Fstatfs(fd int, buf *Statfs_t) (err error) {
- _, _, e := Syscall(SYS_FSTATFS64, uintptr(fd), unsafe.Sizeof(*buf), uintptr(unsafe.Pointer(buf)))
- if e != 0 {
- err = e
- }
- return
-}
-
-func Statfs(path string, buf *Statfs_t) (err error) {
- pathp, err := BytePtrFromString(path)
- if err != nil {
- return err
- }
- _, _, e := Syscall(SYS_STATFS64, uintptr(unsafe.Pointer(pathp)), unsafe.Sizeof(*buf), uintptr(unsafe.Pointer(buf)))
- if e != 0 {
- err = e
- }
- return
-}
-
-func mmap(addr uintptr, length uintptr, prot int, flags int, fd int, offset int64) (xaddr uintptr, err error) {
- page := uintptr(offset / 4096)
- if offset != int64(page)*4096 {
- return 0, EINVAL
- }
- return mmap2(addr, length, prot, flags, fd, page)
-}
-
-type rlimit32 struct {
- Cur uint32
- Max uint32
-}
-
-//sysnb getrlimit(resource int, rlim *rlimit32) (err error) = SYS_GETRLIMIT
-
-const rlimInf32 = ^uint32(0)
-const rlimInf64 = ^uint64(0)
-
-func Getrlimit(resource int, rlim *Rlimit) (err error) {
- err = prlimit(0, resource, nil, rlim)
- if err != ENOSYS {
- return err
- }
-
- rl := rlimit32{}
- err = getrlimit(resource, &rl)
- if err != nil {
- return
- }
-
- if rl.Cur == rlimInf32 {
- rlim.Cur = rlimInf64
- } else {
- rlim.Cur = uint64(rl.Cur)
- }
-
- if rl.Max == rlimInf32 {
- rlim.Max = rlimInf64
- } else {
- rlim.Max = uint64(rl.Max)
- }
- return
-}
-
-//sysnb setrlimit(resource int, rlim *rlimit32) (err error) = SYS_SETRLIMIT
-
-func Setrlimit(resource int, rlim *Rlimit) (err error) {
- err = prlimit(0, resource, rlim, nil)
- if err != ENOSYS {
- return err
- }
-
- rl := rlimit32{}
- if rlim.Cur == rlimInf64 {
- rl.Cur = rlimInf32
- } else if rlim.Cur < uint64(rlimInf32) {
- rl.Cur = uint32(rlim.Cur)
- } else {
- return EINVAL
- }
- if rlim.Max == rlimInf64 {
- rl.Max = rlimInf32
- } else if rlim.Max < uint64(rlimInf32) {
- rl.Max = uint32(rlim.Max)
- } else {
- return EINVAL
- }
-
- return setrlimit(resource, &rl)
-}
-
-func (r *PtraceRegs) PC() uint64 { return uint64(r.Uregs[15]) }
-
-func (r *PtraceRegs) SetPC(pc uint64) { r.Uregs[15] = uint32(pc) }
-
-func (iov *Iovec) SetLen(length int) {
- iov.Len = uint32(length)
-}
-
-func (msghdr *Msghdr) SetControllen(length int) {
- msghdr.Controllen = uint32(length)
-}
-
-func (cmsg *Cmsghdr) SetLen(length int) {
- cmsg.Len = uint32(length)
-}
diff --git a/vendor/golang.org/x/sys/unix/syscall_linux_arm64.go b/vendor/golang.org/x/sys/unix/syscall_linux_arm64.go
deleted file mode 100644
index f3d72dfd..00000000
--- a/vendor/golang.org/x/sys/unix/syscall_linux_arm64.go
+++ /dev/null
@@ -1,150 +0,0 @@
-// Copyright 2015 The Go Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style
-// license that can be found in the LICENSE file.
-
-// +build arm64,linux
-
-package unix
-
-const _SYS_dup = SYS_DUP3
-
-//sys Fchown(fd int, uid int, gid int) (err error)
-//sys Fstat(fd int, stat *Stat_t) (err error)
-//sys Fstatat(fd int, path string, stat *Stat_t, flags int) (err error)
-//sys Fstatfs(fd int, buf *Statfs_t) (err error)
-//sys Ftruncate(fd int, length int64) (err error)
-//sysnb Getegid() (egid int)
-//sysnb Geteuid() (euid int)
-//sysnb Getgid() (gid int)
-//sysnb Getrlimit(resource int, rlim *Rlimit) (err error)
-//sysnb Getuid() (uid int)
-//sys Listen(s int, n int) (err error)
-//sys Pread(fd int, p []byte, offset int64) (n int, err error) = SYS_PREAD64
-//sys Pwrite(fd int, p []byte, offset int64) (n int, err error) = SYS_PWRITE64
-//sys Seek(fd int, offset int64, whence int) (off int64, err error) = SYS_LSEEK
-//sys Select(nfd int, r *FdSet, w *FdSet, e *FdSet, timeout *Timeval) (n int, err error) = SYS_PSELECT6
-//sys sendfile(outfd int, infd int, offset *int64, count int) (written int, err error)
-//sys Setfsgid(gid int) (err error)
-//sys Setfsuid(uid int) (err error)
-//sysnb Setregid(rgid int, egid int) (err error)
-//sysnb Setresgid(rgid int, egid int, sgid int) (err error)
-//sysnb Setresuid(ruid int, euid int, suid int) (err error)
-//sysnb Setrlimit(resource int, rlim *Rlimit) (err error)
-//sysnb Setreuid(ruid int, euid int) (err error)
-//sys Shutdown(fd int, how int) (err error)
-//sys Splice(rfd int, roff *int64, wfd int, woff *int64, len int, flags int) (n int64, err error)
-
-func Stat(path string, stat *Stat_t) (err error) {
- return Fstatat(AT_FDCWD, path, stat, 0)
-}
-
-func Lchown(path string, uid int, gid int) (err error) {
- return Fchownat(AT_FDCWD, path, uid, gid, AT_SYMLINK_NOFOLLOW)
-}
-
-func Lstat(path string, stat *Stat_t) (err error) {
- return Fstatat(AT_FDCWD, path, stat, AT_SYMLINK_NOFOLLOW)
-}
-
-//sys Statfs(path string, buf *Statfs_t) (err error)
-//sys SyncFileRange(fd int, off int64, n int64, flags int) (err error)
-//sys Truncate(path string, length int64) (err error)
-//sys accept(s int, rsa *RawSockaddrAny, addrlen *_Socklen) (fd int, err error)
-//sys accept4(s int, rsa *RawSockaddrAny, addrlen *_Socklen, flags int) (fd int, err error)
-//sys bind(s int, addr unsafe.Pointer, addrlen _Socklen) (err error)
-//sys connect(s int, addr unsafe.Pointer, addrlen _Socklen) (err error)
-//sysnb getgroups(n int, list *_Gid_t) (nn int, err error)
-//sysnb setgroups(n int, list *_Gid_t) (err error)
-//sys getsockopt(s int, level int, name int, val unsafe.Pointer, vallen *_Socklen) (err error)
-//sys setsockopt(s int, level int, name int, val unsafe.Pointer, vallen uintptr) (err error)
-//sysnb socket(domain int, typ int, proto int) (fd int, err error)
-//sysnb socketpair(domain int, typ int, proto int, fd *[2]int32) (err error)
-//sysnb getpeername(fd int, rsa *RawSockaddrAny, addrlen *_Socklen) (err error)
-//sysnb getsockname(fd int, rsa *RawSockaddrAny, addrlen *_Socklen) (err error)
-//sys recvfrom(fd int, p []byte, flags int, from *RawSockaddrAny, fromlen *_Socklen) (n int, err error)
-//sys sendto(s int, buf []byte, flags int, to unsafe.Pointer, addrlen _Socklen) (err error)
-//sys recvmsg(s int, msg *Msghdr, flags int) (n int, err error)
-//sys sendmsg(s int, msg *Msghdr, flags int) (n int, err error)
-//sys mmap(addr uintptr, length uintptr, prot int, flags int, fd int, offset int64) (xaddr uintptr, err error)
-
-func Getpagesize() int { return 65536 }
-
-//sysnb Gettimeofday(tv *Timeval) (err error)
-//sysnb Time(t *Time_t) (tt Time_t, err error)
-
-func TimespecToNsec(ts Timespec) int64 { return int64(ts.Sec)*1e9 + int64(ts.Nsec) }
-
-func NsecToTimespec(nsec int64) (ts Timespec) {
- ts.Sec = nsec / 1e9
- ts.Nsec = nsec % 1e9
- return
-}
-
-func TimevalToNsec(tv Timeval) int64 { return int64(tv.Sec)*1e9 + int64(tv.Usec)*1e3 }
-
-func NsecToTimeval(nsec int64) (tv Timeval) {
- nsec += 999 // round up to microsecond
- tv.Sec = nsec / 1e9
- tv.Usec = nsec % 1e9 / 1e3
- return
-}
-
-func Pipe(p []int) (err error) {
- if len(p) != 2 {
- return EINVAL
- }
- var pp [2]_C_int
- err = pipe2(&pp, 0)
- p[0] = int(pp[0])
- p[1] = int(pp[1])
- return
-}
-
-//sysnb pipe2(p *[2]_C_int, flags int) (err error)
-
-func Pipe2(p []int, flags int) (err error) {
- if len(p) != 2 {
- return EINVAL
- }
- var pp [2]_C_int
- err = pipe2(&pp, flags)
- p[0] = int(pp[0])
- p[1] = int(pp[1])
- return
-}
-
-func (r *PtraceRegs) PC() uint64 { return r.Pc }
-
-func (r *PtraceRegs) SetPC(pc uint64) { r.Pc = pc }
-
-func (iov *Iovec) SetLen(length int) {
- iov.Len = uint64(length)
-}
-
-func (msghdr *Msghdr) SetControllen(length int) {
- msghdr.Controllen = uint64(length)
-}
-
-func (cmsg *Cmsghdr) SetLen(length int) {
- cmsg.Len = uint64(length)
-}
-
-func InotifyInit() (fd int, err error) {
- return InotifyInit1(0)
-}
-
-// TODO(dfc): constants that should be in zsysnum_linux_arm64.go, remove
-// these when the deprecated syscalls that the syscall package relies on
-// are removed.
-const (
- SYS_GETPGRP = 1060
- SYS_UTIMES = 1037
- SYS_FUTIMESAT = 1066
- SYS_PAUSE = 1061
- SYS_USTAT = 1070
- SYS_UTIME = 1063
- SYS_LCHOWN = 1032
- SYS_TIME = 1062
- SYS_EPOLL_CREATE = 1042
- SYS_EPOLL_WAIT = 1069
-)
diff --git a/vendor/golang.org/x/sys/unix/syscall_linux_ppc64x.go b/vendor/golang.org/x/sys/unix/syscall_linux_ppc64x.go
deleted file mode 100644
index 67eed633..00000000
--- a/vendor/golang.org/x/sys/unix/syscall_linux_ppc64x.go
+++ /dev/null
@@ -1,96 +0,0 @@
-// Copyright 2009 The Go Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style
-// license that can be found in the LICENSE file.
-
-// +build linux
-// +build ppc64 ppc64le
-
-package unix
-
-//sys Fchown(fd int, uid int, gid int) (err error)
-//sys Fstat(fd int, stat *Stat_t) (err error)
-//sys Fstatfs(fd int, buf *Statfs_t) (err error)
-//sys Ftruncate(fd int, length int64) (err error)
-//sysnb Getegid() (egid int)
-//sysnb Geteuid() (euid int)
-//sysnb Getgid() (gid int)
-//sysnb Getrlimit(resource int, rlim *Rlimit) (err error) = SYS_UGETRLIMIT
-//sysnb Getuid() (uid int)
-//sys Ioperm(from int, num int, on int) (err error)
-//sys Iopl(level int) (err error)
-//sys Lchown(path string, uid int, gid int) (err error)
-//sys Listen(s int, n int) (err error)
-//sys Lstat(path string, stat *Stat_t) (err error)
-//sys Pread(fd int, p []byte, offset int64) (n int, err error) = SYS_PREAD64
-//sys Pwrite(fd int, p []byte, offset int64) (n int, err error) = SYS_PWRITE64
-//sys Seek(fd int, offset int64, whence int) (off int64, err error) = SYS_LSEEK
-//sys Select(nfd int, r *FdSet, w *FdSet, e *FdSet, timeout *Timeval) (n int, err error)
-//sys sendfile(outfd int, infd int, offset *int64, count int) (written int, err error)
-//sys Setfsgid(gid int) (err error)
-//sys Setfsuid(uid int) (err error)
-//sysnb Setregid(rgid int, egid int) (err error)
-//sysnb Setresgid(rgid int, egid int, sgid int) (err error)
-//sysnb Setresuid(ruid int, euid int, suid int) (err error)
-//sysnb Setrlimit(resource int, rlim *Rlimit) (err error)
-//sysnb Setreuid(ruid int, euid int) (err error)
-//sys Shutdown(fd int, how int) (err error)
-//sys Splice(rfd int, roff *int64, wfd int, woff *int64, len int, flags int) (n int64, err error)
-//sys Stat(path string, stat *Stat_t) (err error)
-//sys Statfs(path string, buf *Statfs_t) (err error)
-//sys SyncFileRange(fd int, off int64, n int64, flags int) (err error) = SYS_SYNC_FILE_RANGE2
-//sys Truncate(path string, length int64) (err error)
-//sys accept(s int, rsa *RawSockaddrAny, addrlen *_Socklen) (fd int, err error)
-//sys accept4(s int, rsa *RawSockaddrAny, addrlen *_Socklen, flags int) (fd int, err error)
-//sys bind(s int, addr unsafe.Pointer, addrlen _Socklen) (err error)
-//sys connect(s int, addr unsafe.Pointer, addrlen _Socklen) (err error)
-//sysnb getgroups(n int, list *_Gid_t) (nn int, err error)
-//sysnb setgroups(n int, list *_Gid_t) (err error)
-//sys getsockopt(s int, level int, name int, val unsafe.Pointer, vallen *_Socklen) (err error)
-//sys setsockopt(s int, level int, name int, val unsafe.Pointer, vallen uintptr) (err error)
-//sysnb socket(domain int, typ int, proto int) (fd int, err error)
-//sysnb socketpair(domain int, typ int, proto int, fd *[2]int32) (err error)
-//sysnb getpeername(fd int, rsa *RawSockaddrAny, addrlen *_Socklen) (err error)
-//sysnb getsockname(fd int, rsa *RawSockaddrAny, addrlen *_Socklen) (err error)
-//sys recvfrom(fd int, p []byte, flags int, from *RawSockaddrAny, fromlen *_Socklen) (n int, err error)
-//sys sendto(s int, buf []byte, flags int, to unsafe.Pointer, addrlen _Socklen) (err error)
-//sys recvmsg(s int, msg *Msghdr, flags int) (n int, err error)
-//sys sendmsg(s int, msg *Msghdr, flags int) (n int, err error)
-//sys mmap(addr uintptr, length uintptr, prot int, flags int, fd int, offset int64) (xaddr uintptr, err error)
-
-func Getpagesize() int { return 65536 }
-
-//sysnb Gettimeofday(tv *Timeval) (err error)
-//sysnb Time(t *Time_t) (tt Time_t, err error)
-
-func TimespecToNsec(ts Timespec) int64 { return int64(ts.Sec)*1e9 + int64(ts.Nsec) }
-
-func NsecToTimespec(nsec int64) (ts Timespec) {
- ts.Sec = nsec / 1e9
- ts.Nsec = nsec % 1e9
- return
-}
-
-func TimevalToNsec(tv Timeval) int64 { return int64(tv.Sec)*1e9 + int64(tv.Usec)*1e3 }
-
-func NsecToTimeval(nsec int64) (tv Timeval) {
- nsec += 999 // round up to microsecond
- tv.Sec = nsec / 1e9
- tv.Usec = nsec % 1e9 / 1e3
- return
-}
-
-func (r *PtraceRegs) PC() uint64 { return r.Nip }
-
-func (r *PtraceRegs) SetPC(pc uint64) { r.Nip = pc }
-
-func (iov *Iovec) SetLen(length int) {
- iov.Len = uint64(length)
-}
-
-func (msghdr *Msghdr) SetControllen(length int) {
- msghdr.Controllen = uint64(length)
-}
-
-func (cmsg *Cmsghdr) SetLen(length int) {
- cmsg.Len = uint64(length)
-}
diff --git a/vendor/golang.org/x/sys/unix/syscall_netbsd.go b/vendor/golang.org/x/sys/unix/syscall_netbsd.go
deleted file mode 100644
index c4e945cd..00000000
--- a/vendor/golang.org/x/sys/unix/syscall_netbsd.go
+++ /dev/null
@@ -1,492 +0,0 @@
-// Copyright 2009,2010 The Go Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style
-// license that can be found in the LICENSE file.
-
-// NetBSD system calls.
-// This file is compiled as ordinary Go code,
-// but it is also input to mksyscall,
-// which parses the //sys lines and generates system call stubs.
-// Note that sometimes we use a lowercase //sys name and wrap
-// it in our own nicer implementation, either here or in
-// syscall_bsd.go or syscall_unix.go.
-
-package unix
-
-import (
- "syscall"
- "unsafe"
-)
-
-type SockaddrDatalink struct {
- Len uint8
- Family uint8
- Index uint16
- Type uint8
- Nlen uint8
- Alen uint8
- Slen uint8
- Data [12]int8
- raw RawSockaddrDatalink
-}
-
-func Syscall9(trap, a1, a2, a3, a4, a5, a6, a7, a8, a9 uintptr) (r1, r2 uintptr, err syscall.Errno)
-
-func sysctlNodes(mib []_C_int) (nodes []Sysctlnode, err error) {
- var olen uintptr
-
- // Get a list of all sysctl nodes below the given MIB by performing
- // a sysctl for the given MIB with CTL_QUERY appended.
- mib = append(mib, CTL_QUERY)
- qnode := Sysctlnode{Flags: SYSCTL_VERS_1}
- qp := (*byte)(unsafe.Pointer(&qnode))
- sz := unsafe.Sizeof(qnode)
- if err = sysctl(mib, nil, &olen, qp, sz); err != nil {
- return nil, err
- }
-
- // Now that we know the size, get the actual nodes.
- nodes = make([]Sysctlnode, olen/sz)
- np := (*byte)(unsafe.Pointer(&nodes[0]))
- if err = sysctl(mib, np, &olen, qp, sz); err != nil {
- return nil, err
- }
-
- return nodes, nil
-}
-
-func nametomib(name string) (mib []_C_int, err error) {
-
- // Split name into components.
- var parts []string
- last := 0
- for i := 0; i < len(name); i++ {
- if name[i] == '.' {
- parts = append(parts, name[last:i])
- last = i + 1
- }
- }
- parts = append(parts, name[last:])
-
- // Discover the nodes and construct the MIB OID.
- for partno, part := range parts {
- nodes, err := sysctlNodes(mib)
- if err != nil {
- return nil, err
- }
- for _, node := range nodes {
- n := make([]byte, 0)
- for i := range node.Name {
- if node.Name[i] != 0 {
- n = append(n, byte(node.Name[i]))
- }
- }
- if string(n) == part {
- mib = append(mib, _C_int(node.Num))
- break
- }
- }
- if len(mib) != partno+1 {
- return nil, EINVAL
- }
- }
-
- return mib, nil
-}
-
-// ParseDirent parses up to max directory entries in buf,
-// appending the names to names. It returns the number
-// bytes consumed from buf, the number of entries added
-// to names, and the new names slice.
-func ParseDirent(buf []byte, max int, names []string) (consumed int, count int, newnames []string) {
- origlen := len(buf)
- for max != 0 && len(buf) > 0 {
- dirent := (*Dirent)(unsafe.Pointer(&buf[0]))
- if dirent.Reclen == 0 {
- buf = nil
- break
- }
- buf = buf[dirent.Reclen:]
- if dirent.Fileno == 0 { // File absent in directory.
- continue
- }
- bytes := (*[10000]byte)(unsafe.Pointer(&dirent.Name[0]))
- var name = string(bytes[0:dirent.Namlen])
- if name == "." || name == ".." { // Useless names
- continue
- }
- max--
- count++
- names = append(names, name)
- }
- return origlen - len(buf), count, names
-}
-
-//sysnb pipe() (fd1 int, fd2 int, err error)
-func Pipe(p []int) (err error) {
- if len(p) != 2 {
- return EINVAL
- }
- p[0], p[1], err = pipe()
- return
-}
-
-//sys getdents(fd int, buf []byte) (n int, err error)
-func Getdirentries(fd int, buf []byte, basep *uintptr) (n int, err error) {
- return getdents(fd, buf)
-}
-
-// TODO
-func sendfile(outfd int, infd int, offset *int64, count int) (written int, err error) {
- return -1, ENOSYS
-}
-
-/*
- * Exposed directly
- */
-//sys Access(path string, mode uint32) (err error)
-//sys Adjtime(delta *Timeval, olddelta *Timeval) (err error)
-//sys Chdir(path string) (err error)
-//sys Chflags(path string, flags int) (err error)
-//sys Chmod(path string, mode uint32) (err error)
-//sys Chown(path string, uid int, gid int) (err error)
-//sys Chroot(path string) (err error)
-//sys Close(fd int) (err error)
-//sys Dup(fd int) (nfd int, err error)
-//sys Dup2(from int, to int) (err error)
-//sys Exit(code int)
-//sys Fchdir(fd int) (err error)
-//sys Fchflags(fd int, flags int) (err error)
-//sys Fchmod(fd int, mode uint32) (err error)
-//sys Fchown(fd int, uid int, gid int) (err error)
-//sys Flock(fd int, how int) (err error)
-//sys Fpathconf(fd int, name int) (val int, err error)
-//sys Fstat(fd int, stat *Stat_t) (err error)
-//sys Fsync(fd int) (err error)
-//sys Ftruncate(fd int, length int64) (err error)
-//sysnb Getegid() (egid int)
-//sysnb Geteuid() (uid int)
-//sysnb Getgid() (gid int)
-//sysnb Getpgid(pid int) (pgid int, err error)
-//sysnb Getpgrp() (pgrp int)
-//sysnb Getpid() (pid int)
-//sysnb Getppid() (ppid int)
-//sys Getpriority(which int, who int) (prio int, err error)
-//sysnb Getrlimit(which int, lim *Rlimit) (err error)
-//sysnb Getrusage(who int, rusage *Rusage) (err error)
-//sysnb Getsid(pid int) (sid int, err error)
-//sysnb Gettimeofday(tv *Timeval) (err error)
-//sysnb Getuid() (uid int)
-//sys Issetugid() (tainted bool)
-//sys Kill(pid int, signum syscall.Signal) (err error)
-//sys Kqueue() (fd int, err error)
-//sys Lchown(path string, uid int, gid int) (err error)
-//sys Link(path string, link string) (err error)
-//sys Listen(s int, backlog int) (err error)
-//sys Lstat(path string, stat *Stat_t) (err error)
-//sys Mkdir(path string, mode uint32) (err error)
-//sys Mkfifo(path string, mode uint32) (err error)
-//sys Mknod(path string, mode uint32, dev int) (err error)
-//sys Mlock(b []byte) (err error)
-//sys Mlockall(flags int) (err error)
-//sys Mprotect(b []byte, prot int) (err error)
-//sys Munlock(b []byte) (err error)
-//sys Munlockall() (err error)
-//sys Nanosleep(time *Timespec, leftover *Timespec) (err error)
-//sys Open(path string, mode int, perm uint32) (fd int, err error)
-//sys Pathconf(path string, name int) (val int, err error)
-//sys Pread(fd int, p []byte, offset int64) (n int, err error)
-//sys Pwrite(fd int, p []byte, offset int64) (n int, err error)
-//sys read(fd int, p []byte) (n int, err error)
-//sys Readlink(path string, buf []byte) (n int, err error)
-//sys Rename(from string, to string) (err error)
-//sys Revoke(path string) (err error)
-//sys Rmdir(path string) (err error)
-//sys Seek(fd int, offset int64, whence int) (newoffset int64, err error) = SYS_LSEEK
-//sys Select(n int, r *FdSet, w *FdSet, e *FdSet, timeout *Timeval) (err error)
-//sysnb Setegid(egid int) (err error)
-//sysnb Seteuid(euid int) (err error)
-//sysnb Setgid(gid int) (err error)
-//sysnb Setpgid(pid int, pgid int) (err error)
-//sys Setpriority(which int, who int, prio int) (err error)
-//sysnb Setregid(rgid int, egid int) (err error)
-//sysnb Setreuid(ruid int, euid int) (err error)
-//sysnb Setrlimit(which int, lim *Rlimit) (err error)
-//sysnb Setsid() (pid int, err error)
-//sysnb Settimeofday(tp *Timeval) (err error)
-//sysnb Setuid(uid int) (err error)
-//sys Stat(path string, stat *Stat_t) (err error)
-//sys Symlink(path string, link string) (err error)
-//sys Sync() (err error)
-//sys Truncate(path string, length int64) (err error)
-//sys Umask(newmask int) (oldmask int)
-//sys Unlink(path string) (err error)
-//sys Unmount(path string, flags int) (err error)
-//sys write(fd int, p []byte) (n int, err error)
-//sys mmap(addr uintptr, length uintptr, prot int, flag int, fd int, pos int64) (ret uintptr, err error)
-//sys munmap(addr uintptr, length uintptr) (err error)
-//sys readlen(fd int, buf *byte, nbuf int) (n int, err error) = SYS_READ
-//sys writelen(fd int, buf *byte, nbuf int) (n int, err error) = SYS_WRITE
-
-/*
- * Unimplemented
- */
-// ____semctl13
-// __clone
-// __fhopen40
-// __fhstat40
-// __fhstatvfs140
-// __fstat30
-// __getcwd
-// __getfh30
-// __getlogin
-// __lstat30
-// __mount50
-// __msgctl13
-// __msync13
-// __ntp_gettime30
-// __posix_chown
-// __posix_fadvise50
-// __posix_fchown
-// __posix_lchown
-// __posix_rename
-// __setlogin
-// __shmctl13
-// __sigaction_sigtramp
-// __sigaltstack14
-// __sigpending14
-// __sigprocmask14
-// __sigsuspend14
-// __sigtimedwait
-// __stat30
-// __syscall
-// __vfork14
-// _ksem_close
-// _ksem_destroy
-// _ksem_getvalue
-// _ksem_init
-// _ksem_open
-// _ksem_post
-// _ksem_trywait
-// _ksem_unlink
-// _ksem_wait
-// _lwp_continue
-// _lwp_create
-// _lwp_ctl
-// _lwp_detach
-// _lwp_exit
-// _lwp_getname
-// _lwp_getprivate
-// _lwp_kill
-// _lwp_park
-// _lwp_self
-// _lwp_setname
-// _lwp_setprivate
-// _lwp_suspend
-// _lwp_unpark
-// _lwp_unpark_all
-// _lwp_wait
-// _lwp_wakeup
-// _pset_bind
-// _sched_getaffinity
-// _sched_getparam
-// _sched_setaffinity
-// _sched_setparam
-// acct
-// aio_cancel
-// aio_error
-// aio_fsync
-// aio_read
-// aio_return
-// aio_suspend
-// aio_write
-// break
-// clock_getres
-// clock_gettime
-// clock_settime
-// compat_09_ogetdomainname
-// compat_09_osetdomainname
-// compat_09_ouname
-// compat_10_omsgsys
-// compat_10_osemsys
-// compat_10_oshmsys
-// compat_12_fstat12
-// compat_12_getdirentries
-// compat_12_lstat12
-// compat_12_msync
-// compat_12_oreboot
-// compat_12_oswapon
-// compat_12_stat12
-// compat_13_sigaction13
-// compat_13_sigaltstack13
-// compat_13_sigpending13
-// compat_13_sigprocmask13
-// compat_13_sigreturn13
-// compat_13_sigsuspend13
-// compat_14___semctl
-// compat_14_msgctl
-// compat_14_shmctl
-// compat_16___sigaction14
-// compat_16___sigreturn14
-// compat_20_fhstatfs
-// compat_20_fstatfs
-// compat_20_getfsstat
-// compat_20_statfs
-// compat_30___fhstat30
-// compat_30___fstat13
-// compat_30___lstat13
-// compat_30___stat13
-// compat_30_fhopen
-// compat_30_fhstat
-// compat_30_fhstatvfs1
-// compat_30_getdents
-// compat_30_getfh
-// compat_30_ntp_gettime
-// compat_30_socket
-// compat_40_mount
-// compat_43_fstat43
-// compat_43_lstat43
-// compat_43_oaccept
-// compat_43_ocreat
-// compat_43_oftruncate
-// compat_43_ogetdirentries
-// compat_43_ogetdtablesize
-// compat_43_ogethostid
-// compat_43_ogethostname
-// compat_43_ogetkerninfo
-// compat_43_ogetpagesize
-// compat_43_ogetpeername
-// compat_43_ogetrlimit
-// compat_43_ogetsockname
-// compat_43_okillpg
-// compat_43_olseek
-// compat_43_ommap
-// compat_43_oquota
-// compat_43_orecv
-// compat_43_orecvfrom
-// compat_43_orecvmsg
-// compat_43_osend
-// compat_43_osendmsg
-// compat_43_osethostid
-// compat_43_osethostname
-// compat_43_osetrlimit
-// compat_43_osigblock
-// compat_43_osigsetmask
-// compat_43_osigstack
-// compat_43_osigvec
-// compat_43_otruncate
-// compat_43_owait
-// compat_43_stat43
-// execve
-// extattr_delete_fd
-// extattr_delete_file
-// extattr_delete_link
-// extattr_get_fd
-// extattr_get_file
-// extattr_get_link
-// extattr_list_fd
-// extattr_list_file
-// extattr_list_link
-// extattr_set_fd
-// extattr_set_file
-// extattr_set_link
-// extattrctl
-// fchroot
-// fdatasync
-// fgetxattr
-// fktrace
-// flistxattr
-// fork
-// fremovexattr
-// fsetxattr
-// fstatvfs1
-// fsync_range
-// getcontext
-// getitimer
-// getvfsstat
-// getxattr
-// ioctl
-// ktrace
-// lchflags
-// lchmod
-// lfs_bmapv
-// lfs_markv
-// lfs_segclean
-// lfs_segwait
-// lgetxattr
-// lio_listio
-// listxattr
-// llistxattr
-// lremovexattr
-// lseek
-// lsetxattr
-// lutimes
-// madvise
-// mincore
-// minherit
-// modctl
-// mq_close
-// mq_getattr
-// mq_notify
-// mq_open
-// mq_receive
-// mq_send
-// mq_setattr
-// mq_timedreceive
-// mq_timedsend
-// mq_unlink
-// mremap
-// msgget
-// msgrcv
-// msgsnd
-// nfssvc
-// ntp_adjtime
-// pmc_control
-// pmc_get_info
-// poll
-// pollts
-// preadv
-// profil
-// pselect
-// pset_assign
-// pset_create
-// pset_destroy
-// ptrace
-// pwritev
-// quotactl
-// rasctl
-// readv
-// reboot
-// removexattr
-// sa_enable
-// sa_preempt
-// sa_register
-// sa_setconcurrency
-// sa_stacks
-// sa_yield
-// sbrk
-// sched_yield
-// semconfig
-// semget
-// semop
-// setcontext
-// setitimer
-// setxattr
-// shmat
-// shmdt
-// shmget
-// sstk
-// statvfs1
-// swapctl
-// sysarch
-// syscall
-// timer_create
-// timer_delete
-// timer_getoverrun
-// timer_gettime
-// timer_settime
-// undelete
-// utrace
-// uuidgen
-// vadvise
-// vfork
-// writev
diff --git a/vendor/golang.org/x/sys/unix/syscall_netbsd_386.go b/vendor/golang.org/x/sys/unix/syscall_netbsd_386.go
deleted file mode 100644
index 1b0e1af1..00000000
--- a/vendor/golang.org/x/sys/unix/syscall_netbsd_386.go
+++ /dev/null
@@ -1,44 +0,0 @@
-// Copyright 2009 The Go Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style
-// license that can be found in the LICENSE file.
-
-// +build 386,netbsd
-
-package unix
-
-func Getpagesize() int { return 4096 }
-
-func TimespecToNsec(ts Timespec) int64 { return int64(ts.Sec)*1e9 + int64(ts.Nsec) }
-
-func NsecToTimespec(nsec int64) (ts Timespec) {
- ts.Sec = int64(nsec / 1e9)
- ts.Nsec = int32(nsec % 1e9)
- return
-}
-
-func TimevalToNsec(tv Timeval) int64 { return int64(tv.Sec)*1e9 + int64(tv.Usec)*1e3 }
-
-func NsecToTimeval(nsec int64) (tv Timeval) {
- nsec += 999 // round up to microsecond
- tv.Usec = int32(nsec % 1e9 / 1e3)
- tv.Sec = int64(nsec / 1e9)
- return
-}
-
-func SetKevent(k *Kevent_t, fd, mode, flags int) {
- k.Ident = uint32(fd)
- k.Filter = uint32(mode)
- k.Flags = uint32(flags)
-}
-
-func (iov *Iovec) SetLen(length int) {
- iov.Len = uint32(length)
-}
-
-func (msghdr *Msghdr) SetControllen(length int) {
- msghdr.Controllen = uint32(length)
-}
-
-func (cmsg *Cmsghdr) SetLen(length int) {
- cmsg.Len = uint32(length)
-}
diff --git a/vendor/golang.org/x/sys/unix/syscall_netbsd_amd64.go b/vendor/golang.org/x/sys/unix/syscall_netbsd_amd64.go
deleted file mode 100644
index 1b6dcbe3..00000000
--- a/vendor/golang.org/x/sys/unix/syscall_netbsd_amd64.go
+++ /dev/null
@@ -1,44 +0,0 @@
-// Copyright 2009 The Go Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style
-// license that can be found in the LICENSE file.
-
-// +build amd64,netbsd
-
-package unix
-
-func Getpagesize() int { return 4096 }
-
-func TimespecToNsec(ts Timespec) int64 { return int64(ts.Sec)*1e9 + int64(ts.Nsec) }
-
-func NsecToTimespec(nsec int64) (ts Timespec) {
- ts.Sec = int64(nsec / 1e9)
- ts.Nsec = int64(nsec % 1e9)
- return
-}
-
-func TimevalToNsec(tv Timeval) int64 { return int64(tv.Sec)*1e9 + int64(tv.Usec)*1e3 }
-
-func NsecToTimeval(nsec int64) (tv Timeval) {
- nsec += 999 // round up to microsecond
- tv.Usec = int32(nsec % 1e9 / 1e3)
- tv.Sec = int64(nsec / 1e9)
- return
-}
-
-func SetKevent(k *Kevent_t, fd, mode, flags int) {
- k.Ident = uint64(fd)
- k.Filter = uint32(mode)
- k.Flags = uint32(flags)
-}
-
-func (iov *Iovec) SetLen(length int) {
- iov.Len = uint64(length)
-}
-
-func (msghdr *Msghdr) SetControllen(length int) {
- msghdr.Controllen = uint32(length)
-}
-
-func (cmsg *Cmsghdr) SetLen(length int) {
- cmsg.Len = uint32(length)
-}
diff --git a/vendor/golang.org/x/sys/unix/syscall_netbsd_arm.go b/vendor/golang.org/x/sys/unix/syscall_netbsd_arm.go
deleted file mode 100644
index 87d1d6fe..00000000
--- a/vendor/golang.org/x/sys/unix/syscall_netbsd_arm.go
+++ /dev/null
@@ -1,44 +0,0 @@
-// Copyright 2013 The Go Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style
-// license that can be found in the LICENSE file.
-
-// +build arm,netbsd
-
-package unix
-
-func Getpagesize() int { return 4096 }
-
-func TimespecToNsec(ts Timespec) int64 { return int64(ts.Sec)*1e9 + int64(ts.Nsec) }
-
-func NsecToTimespec(nsec int64) (ts Timespec) {
- ts.Sec = int64(nsec / 1e9)
- ts.Nsec = int32(nsec % 1e9)
- return
-}
-
-func TimevalToNsec(tv Timeval) int64 { return int64(tv.Sec)*1e9 + int64(tv.Usec)*1e3 }
-
-func NsecToTimeval(nsec int64) (tv Timeval) {
- nsec += 999 // round up to microsecond
- tv.Usec = int32(nsec % 1e9 / 1e3)
- tv.Sec = int64(nsec / 1e9)
- return
-}
-
-func SetKevent(k *Kevent_t, fd, mode, flags int) {
- k.Ident = uint32(fd)
- k.Filter = uint32(mode)
- k.Flags = uint32(flags)
-}
-
-func (iov *Iovec) SetLen(length int) {
- iov.Len = uint32(length)
-}
-
-func (msghdr *Msghdr) SetControllen(length int) {
- msghdr.Controllen = uint32(length)
-}
-
-func (cmsg *Cmsghdr) SetLen(length int) {
- cmsg.Len = uint32(length)
-}
diff --git a/vendor/golang.org/x/sys/unix/syscall_no_getwd.go b/vendor/golang.org/x/sys/unix/syscall_no_getwd.go
deleted file mode 100644
index 530792ea..00000000
--- a/vendor/golang.org/x/sys/unix/syscall_no_getwd.go
+++ /dev/null
@@ -1,11 +0,0 @@
-// Copyright 2013 The Go Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style
-// license that can be found in the LICENSE file.
-
-// +build dragonfly freebsd netbsd openbsd
-
-package unix
-
-const ImplementsGetwd = false
-
-func Getwd() (string, error) { return "", ENOTSUP }
diff --git a/vendor/golang.org/x/sys/unix/syscall_openbsd.go b/vendor/golang.org/x/sys/unix/syscall_openbsd.go
deleted file mode 100644
index 246131d2..00000000
--- a/vendor/golang.org/x/sys/unix/syscall_openbsd.go
+++ /dev/null
@@ -1,303 +0,0 @@
-// Copyright 2009,2010 The Go Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style
-// license that can be found in the LICENSE file.
-
-// OpenBSD system calls.
-// This file is compiled as ordinary Go code,
-// but it is also input to mksyscall,
-// which parses the //sys lines and generates system call stubs.
-// Note that sometimes we use a lowercase //sys name and wrap
-// it in our own nicer implementation, either here or in
-// syscall_bsd.go or syscall_unix.go.
-
-package unix
-
-import (
- "syscall"
- "unsafe"
-)
-
-type SockaddrDatalink struct {
- Len uint8
- Family uint8
- Index uint16
- Type uint8
- Nlen uint8
- Alen uint8
- Slen uint8
- Data [24]int8
- raw RawSockaddrDatalink
-}
-
-func Syscall9(trap, a1, a2, a3, a4, a5, a6, a7, a8, a9 uintptr) (r1, r2 uintptr, err syscall.Errno)
-
-func nametomib(name string) (mib []_C_int, err error) {
-
- // Perform lookup via a binary search
- left := 0
- right := len(sysctlMib) - 1
- for {
- idx := left + (right-left)/2
- switch {
- case name == sysctlMib[idx].ctlname:
- return sysctlMib[idx].ctloid, nil
- case name > sysctlMib[idx].ctlname:
- left = idx + 1
- default:
- right = idx - 1
- }
- if left > right {
- break
- }
- }
- return nil, EINVAL
-}
-
-// ParseDirent parses up to max directory entries in buf,
-// appending the names to names. It returns the number
-// bytes consumed from buf, the number of entries added
-// to names, and the new names slice.
-func ParseDirent(buf []byte, max int, names []string) (consumed int, count int, newnames []string) {
- origlen := len(buf)
- for max != 0 && len(buf) > 0 {
- dirent := (*Dirent)(unsafe.Pointer(&buf[0]))
- if dirent.Reclen == 0 {
- buf = nil
- break
- }
- buf = buf[dirent.Reclen:]
- if dirent.Fileno == 0 { // File absent in directory.
- continue
- }
- bytes := (*[10000]byte)(unsafe.Pointer(&dirent.Name[0]))
- var name = string(bytes[0:dirent.Namlen])
- if name == "." || name == ".." { // Useless names
- continue
- }
- max--
- count++
- names = append(names, name)
- }
- return origlen - len(buf), count, names
-}
-
-//sysnb pipe(p *[2]_C_int) (err error)
-func Pipe(p []int) (err error) {
- if len(p) != 2 {
- return EINVAL
- }
- var pp [2]_C_int
- err = pipe(&pp)
- p[0] = int(pp[0])
- p[1] = int(pp[1])
- return
-}
-
-//sys getdents(fd int, buf []byte) (n int, err error)
-func Getdirentries(fd int, buf []byte, basep *uintptr) (n int, err error) {
- return getdents(fd, buf)
-}
-
-// TODO
-func sendfile(outfd int, infd int, offset *int64, count int) (written int, err error) {
- return -1, ENOSYS
-}
-
-func Getfsstat(buf []Statfs_t, flags int) (n int, err error) {
- var _p0 unsafe.Pointer
- var bufsize uintptr
- if len(buf) > 0 {
- _p0 = unsafe.Pointer(&buf[0])
- bufsize = unsafe.Sizeof(Statfs_t{}) * uintptr(len(buf))
- }
- r0, _, e1 := Syscall(SYS_GETFSSTAT, uintptr(_p0), bufsize, uintptr(flags))
- n = int(r0)
- if e1 != 0 {
- err = e1
- }
- return
-}
-
-/*
- * Exposed directly
- */
-//sys Access(path string, mode uint32) (err error)
-//sys Adjtime(delta *Timeval, olddelta *Timeval) (err error)
-//sys Chdir(path string) (err error)
-//sys Chflags(path string, flags int) (err error)
-//sys Chmod(path string, mode uint32) (err error)
-//sys Chown(path string, uid int, gid int) (err error)
-//sys Chroot(path string) (err error)
-//sys Close(fd int) (err error)
-//sys Dup(fd int) (nfd int, err error)
-//sys Dup2(from int, to int) (err error)
-//sys Exit(code int)
-//sys Fchdir(fd int) (err error)
-//sys Fchflags(fd int, flags int) (err error)
-//sys Fchmod(fd int, mode uint32) (err error)
-//sys Fchown(fd int, uid int, gid int) (err error)
-//sys Flock(fd int, how int) (err error)
-//sys Fpathconf(fd int, name int) (val int, err error)
-//sys Fstat(fd int, stat *Stat_t) (err error)
-//sys Fstatfs(fd int, stat *Statfs_t) (err error)
-//sys Fsync(fd int) (err error)
-//sys Ftruncate(fd int, length int64) (err error)
-//sysnb Getegid() (egid int)
-//sysnb Geteuid() (uid int)
-//sysnb Getgid() (gid int)
-//sysnb Getpgid(pid int) (pgid int, err error)
-//sysnb Getpgrp() (pgrp int)
-//sysnb Getpid() (pid int)
-//sysnb Getppid() (ppid int)
-//sys Getpriority(which int, who int) (prio int, err error)
-//sysnb Getrlimit(which int, lim *Rlimit) (err error)
-//sysnb Getrusage(who int, rusage *Rusage) (err error)
-//sysnb Getsid(pid int) (sid int, err error)
-//sysnb Gettimeofday(tv *Timeval) (err error)
-//sysnb Getuid() (uid int)
-//sys Issetugid() (tainted bool)
-//sys Kill(pid int, signum syscall.Signal) (err error)
-//sys Kqueue() (fd int, err error)
-//sys Lchown(path string, uid int, gid int) (err error)
-//sys Link(path string, link string) (err error)
-//sys Listen(s int, backlog int) (err error)
-//sys Lstat(path string, stat *Stat_t) (err error)
-//sys Mkdir(path string, mode uint32) (err error)
-//sys Mkfifo(path string, mode uint32) (err error)
-//sys Mknod(path string, mode uint32, dev int) (err error)
-//sys Mlock(b []byte) (err error)
-//sys Mlockall(flags int) (err error)
-//sys Mprotect(b []byte, prot int) (err error)
-//sys Munlock(b []byte) (err error)
-//sys Munlockall() (err error)
-//sys Nanosleep(time *Timespec, leftover *Timespec) (err error)
-//sys Open(path string, mode int, perm uint32) (fd int, err error)
-//sys Pathconf(path string, name int) (val int, err error)
-//sys Pread(fd int, p []byte, offset int64) (n int, err error)
-//sys Pwrite(fd int, p []byte, offset int64) (n int, err error)
-//sys read(fd int, p []byte) (n int, err error)
-//sys Readlink(path string, buf []byte) (n int, err error)
-//sys Rename(from string, to string) (err error)
-//sys Revoke(path string) (err error)
-//sys Rmdir(path string) (err error)
-//sys Seek(fd int, offset int64, whence int) (newoffset int64, err error) = SYS_LSEEK
-//sys Select(n int, r *FdSet, w *FdSet, e *FdSet, timeout *Timeval) (err error)
-//sysnb Setegid(egid int) (err error)
-//sysnb Seteuid(euid int) (err error)
-//sysnb Setgid(gid int) (err error)
-//sys Setlogin(name string) (err error)
-//sysnb Setpgid(pid int, pgid int) (err error)
-//sys Setpriority(which int, who int, prio int) (err error)
-//sysnb Setregid(rgid int, egid int) (err error)
-//sysnb Setreuid(ruid int, euid int) (err error)
-//sysnb Setresgid(rgid int, egid int, sgid int) (err error)
-//sysnb Setresuid(ruid int, euid int, suid int) (err error)
-//sysnb Setrlimit(which int, lim *Rlimit) (err error)
-//sysnb Setsid() (pid int, err error)
-//sysnb Settimeofday(tp *Timeval) (err error)
-//sysnb Setuid(uid int) (err error)
-//sys Stat(path string, stat *Stat_t) (err error)
-//sys Statfs(path string, stat *Statfs_t) (err error)
-//sys Symlink(path string, link string) (err error)
-//sys Sync() (err error)
-//sys Truncate(path string, length int64) (err error)
-//sys Umask(newmask int) (oldmask int)
-//sys Unlink(path string) (err error)
-//sys Unmount(path string, flags int) (err error)
-//sys write(fd int, p []byte) (n int, err error)
-//sys mmap(addr uintptr, length uintptr, prot int, flag int, fd int, pos int64) (ret uintptr, err error)
-//sys munmap(addr uintptr, length uintptr) (err error)
-//sys readlen(fd int, buf *byte, nbuf int) (n int, err error) = SYS_READ
-//sys writelen(fd int, buf *byte, nbuf int) (n int, err error) = SYS_WRITE
-
-/*
- * Unimplemented
- */
-// __getcwd
-// __semctl
-// __syscall
-// __sysctl
-// adjfreq
-// break
-// clock_getres
-// clock_gettime
-// clock_settime
-// closefrom
-// execve
-// faccessat
-// fchmodat
-// fchownat
-// fcntl
-// fhopen
-// fhstat
-// fhstatfs
-// fork
-// fstatat
-// futimens
-// getfh
-// getgid
-// getitimer
-// getlogin
-// getresgid
-// getresuid
-// getrtable
-// getthrid
-// ioctl
-// ktrace
-// lfs_bmapv
-// lfs_markv
-// lfs_segclean
-// lfs_segwait
-// linkat
-// mincore
-// minherit
-// mkdirat
-// mkfifoat
-// mknodat
-// mount
-// mquery
-// msgctl
-// msgget
-// msgrcv
-// msgsnd
-// nfssvc
-// nnpfspioctl
-// openat
-// poll
-// preadv
-// profil
-// pwritev
-// quotactl
-// readlinkat
-// readv
-// reboot
-// renameat
-// rfork
-// sched_yield
-// semget
-// semop
-// setgroups
-// setitimer
-// setrtable
-// setsockopt
-// shmat
-// shmctl
-// shmdt
-// shmget
-// sigaction
-// sigaltstack
-// sigpending
-// sigprocmask
-// sigreturn
-// sigsuspend
-// symlinkat
-// sysarch
-// syscall
-// threxit
-// thrsigdivert
-// thrsleep
-// thrwakeup
-// unlinkat
-// utimensat
-// vfork
-// writev
diff --git a/vendor/golang.org/x/sys/unix/syscall_openbsd_386.go b/vendor/golang.org/x/sys/unix/syscall_openbsd_386.go
deleted file mode 100644
index 9529b20e..00000000
--- a/vendor/golang.org/x/sys/unix/syscall_openbsd_386.go
+++ /dev/null
@@ -1,44 +0,0 @@
-// Copyright 2009 The Go Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style
-// license that can be found in the LICENSE file.
-
-// +build 386,openbsd
-
-package unix
-
-func Getpagesize() int { return 4096 }
-
-func TimespecToNsec(ts Timespec) int64 { return int64(ts.Sec)*1e9 + int64(ts.Nsec) }
-
-func NsecToTimespec(nsec int64) (ts Timespec) {
- ts.Sec = int64(nsec / 1e9)
- ts.Nsec = int32(nsec % 1e9)
- return
-}
-
-func TimevalToNsec(tv Timeval) int64 { return int64(tv.Sec)*1e9 + int64(tv.Usec)*1e3 }
-
-func NsecToTimeval(nsec int64) (tv Timeval) {
- nsec += 999 // round up to microsecond
- tv.Usec = int32(nsec % 1e9 / 1e3)
- tv.Sec = int64(nsec / 1e9)
- return
-}
-
-func SetKevent(k *Kevent_t, fd, mode, flags int) {
- k.Ident = uint32(fd)
- k.Filter = int16(mode)
- k.Flags = uint16(flags)
-}
-
-func (iov *Iovec) SetLen(length int) {
- iov.Len = uint32(length)
-}
-
-func (msghdr *Msghdr) SetControllen(length int) {
- msghdr.Controllen = uint32(length)
-}
-
-func (cmsg *Cmsghdr) SetLen(length int) {
- cmsg.Len = uint32(length)
-}
diff --git a/vendor/golang.org/x/sys/unix/syscall_openbsd_amd64.go b/vendor/golang.org/x/sys/unix/syscall_openbsd_amd64.go
deleted file mode 100644
index fc640294..00000000
--- a/vendor/golang.org/x/sys/unix/syscall_openbsd_amd64.go
+++ /dev/null
@@ -1,44 +0,0 @@
-// Copyright 2009 The Go Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style
-// license that can be found in the LICENSE file.
-
-// +build amd64,openbsd
-
-package unix
-
-func Getpagesize() int { return 4096 }
-
-func TimespecToNsec(ts Timespec) int64 { return int64(ts.Sec)*1e9 + int64(ts.Nsec) }
-
-func NsecToTimespec(nsec int64) (ts Timespec) {
- ts.Sec = nsec / 1e9
- ts.Nsec = nsec % 1e9
- return
-}
-
-func TimevalToNsec(tv Timeval) int64 { return int64(tv.Sec)*1e9 + int64(tv.Usec)*1e3 }
-
-func NsecToTimeval(nsec int64) (tv Timeval) {
- nsec += 999 // round up to microsecond
- tv.Usec = nsec % 1e9 / 1e3
- tv.Sec = nsec / 1e9
- return
-}
-
-func SetKevent(k *Kevent_t, fd, mode, flags int) {
- k.Ident = uint64(fd)
- k.Filter = int16(mode)
- k.Flags = uint16(flags)
-}
-
-func (iov *Iovec) SetLen(length int) {
- iov.Len = uint64(length)
-}
-
-func (msghdr *Msghdr) SetControllen(length int) {
- msghdr.Controllen = uint32(length)
-}
-
-func (cmsg *Cmsghdr) SetLen(length int) {
- cmsg.Len = uint32(length)
-}
diff --git a/vendor/golang.org/x/sys/unix/syscall_solaris.go b/vendor/golang.org/x/sys/unix/syscall_solaris.go
deleted file mode 100644
index eb489b15..00000000
--- a/vendor/golang.org/x/sys/unix/syscall_solaris.go
+++ /dev/null
@@ -1,713 +0,0 @@
-// Copyright 2009 The Go Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style
-// license that can be found in the LICENSE file.
-
-// Solaris system calls.
-// This file is compiled as ordinary Go code,
-// but it is also input to mksyscall,
-// which parses the //sys lines and generates system call stubs.
-// Note that sometimes we use a lowercase //sys name and wrap
-// it in our own nicer implementation, either here or in
-// syscall_solaris.go or syscall_unix.go.
-
-package unix
-
-import (
- "sync/atomic"
- "syscall"
- "unsafe"
-)
-
-// Implemented in runtime/syscall_solaris.go.
-type syscallFunc uintptr
-
-func rawSysvicall6(trap, nargs, a1, a2, a3, a4, a5, a6 uintptr) (r1, r2 uintptr, err syscall.Errno)
-func sysvicall6(trap, nargs, a1, a2, a3, a4, a5, a6 uintptr) (r1, r2 uintptr, err syscall.Errno)
-
-type SockaddrDatalink struct {
- Family uint16
- Index uint16
- Type uint8
- Nlen uint8
- Alen uint8
- Slen uint8
- Data [244]int8
- raw RawSockaddrDatalink
-}
-
-func clen(n []byte) int {
- for i := 0; i < len(n); i++ {
- if n[i] == 0 {
- return i
- }
- }
- return len(n)
-}
-
-// ParseDirent parses up to max directory entries in buf,
-// appending the names to names. It returns the number
-// bytes consumed from buf, the number of entries added
-// to names, and the new names slice.
-func ParseDirent(buf []byte, max int, names []string) (consumed int, count int, newnames []string) {
- origlen := len(buf)
- for max != 0 && len(buf) > 0 {
- dirent := (*Dirent)(unsafe.Pointer(&buf[0]))
- if dirent.Reclen == 0 {
- buf = nil
- break
- }
- buf = buf[dirent.Reclen:]
- if dirent.Ino == 0 { // File absent in directory.
- continue
- }
- bytes := (*[10000]byte)(unsafe.Pointer(&dirent.Name[0]))
- var name = string(bytes[0:clen(bytes[:])])
- if name == "." || name == ".." { // Useless names
- continue
- }
- max--
- count++
- names = append(names, name)
- }
- return origlen - len(buf), count, names
-}
-
-func pipe() (r uintptr, w uintptr, err uintptr)
-
-func Pipe(p []int) (err error) {
- if len(p) != 2 {
- return EINVAL
- }
- r0, w0, e1 := pipe()
- if e1 != 0 {
- err = syscall.Errno(e1)
- }
- p[0], p[1] = int(r0), int(w0)
- return
-}
-
-func (sa *SockaddrInet4) sockaddr() (unsafe.Pointer, _Socklen, error) {
- if sa.Port < 0 || sa.Port > 0xFFFF {
- return nil, 0, EINVAL
- }
- sa.raw.Family = AF_INET
- p := (*[2]byte)(unsafe.Pointer(&sa.raw.Port))
- p[0] = byte(sa.Port >> 8)
- p[1] = byte(sa.Port)
- for i := 0; i < len(sa.Addr); i++ {
- sa.raw.Addr[i] = sa.Addr[i]
- }
- return unsafe.Pointer(&sa.raw), SizeofSockaddrInet4, nil
-}
-
-func (sa *SockaddrInet6) sockaddr() (unsafe.Pointer, _Socklen, error) {
- if sa.Port < 0 || sa.Port > 0xFFFF {
- return nil, 0, EINVAL
- }
- sa.raw.Family = AF_INET6
- p := (*[2]byte)(unsafe.Pointer(&sa.raw.Port))
- p[0] = byte(sa.Port >> 8)
- p[1] = byte(sa.Port)
- sa.raw.Scope_id = sa.ZoneId
- for i := 0; i < len(sa.Addr); i++ {
- sa.raw.Addr[i] = sa.Addr[i]
- }
- return unsafe.Pointer(&sa.raw), SizeofSockaddrInet6, nil
-}
-
-func (sa *SockaddrUnix) sockaddr() (unsafe.Pointer, _Socklen, error) {
- name := sa.Name
- n := len(name)
- if n >= len(sa.raw.Path) {
- return nil, 0, EINVAL
- }
- sa.raw.Family = AF_UNIX
- for i := 0; i < n; i++ {
- sa.raw.Path[i] = int8(name[i])
- }
- // length is family (uint16), name, NUL.
- sl := _Socklen(2)
- if n > 0 {
- sl += _Socklen(n) + 1
- }
- if sa.raw.Path[0] == '@' {
- sa.raw.Path[0] = 0
- // Don't count trailing NUL for abstract address.
- sl--
- }
-
- return unsafe.Pointer(&sa.raw), sl, nil
-}
-
-//sys getsockname(fd int, rsa *RawSockaddrAny, addrlen *_Socklen) (err error) = libsocket.getsockname
-
-func Getsockname(fd int) (sa Sockaddr, err error) {
- var rsa RawSockaddrAny
- var len _Socklen = SizeofSockaddrAny
- if err = getsockname(fd, &rsa, &len); err != nil {
- return
- }
- return anyToSockaddr(&rsa)
-}
-
-const ImplementsGetwd = true
-
-//sys Getcwd(buf []byte) (n int, err error)
-
-func Getwd() (wd string, err error) {
- var buf [PathMax]byte
- // Getcwd will return an error if it failed for any reason.
- _, err = Getcwd(buf[0:])
- if err != nil {
- return "", err
- }
- n := clen(buf[:])
- if n < 1 {
- return "", EINVAL
- }
- return string(buf[:n]), nil
-}
-
-/*
- * Wrapped
- */
-
-//sysnb getgroups(ngid int, gid *_Gid_t) (n int, err error)
-//sysnb setgroups(ngid int, gid *_Gid_t) (err error)
-
-func Getgroups() (gids []int, err error) {
- n, err := getgroups(0, nil)
- // Check for error and sanity check group count. Newer versions of
- // Solaris allow up to 1024 (NGROUPS_MAX).
- if n < 0 || n > 1024 {
- if err != nil {
- return nil, err
- }
- return nil, EINVAL
- } else if n == 0 {
- return nil, nil
- }
-
- a := make([]_Gid_t, n)
- n, err = getgroups(n, &a[0])
- if n == -1 {
- return nil, err
- }
- gids = make([]int, n)
- for i, v := range a[0:n] {
- gids[i] = int(v)
- }
- return
-}
-
-func Setgroups(gids []int) (err error) {
- if len(gids) == 0 {
- return setgroups(0, nil)
- }
-
- a := make([]_Gid_t, len(gids))
- for i, v := range gids {
- a[i] = _Gid_t(v)
- }
- return setgroups(len(a), &a[0])
-}
-
-func ReadDirent(fd int, buf []byte) (n int, err error) {
- // Final argument is (basep *uintptr) and the syscall doesn't take nil.
- // TODO(rsc): Can we use a single global basep for all calls?
- return Getdents(fd, buf, new(uintptr))
-}
-
-// Wait status is 7 bits at bottom, either 0 (exited),
-// 0x7F (stopped), or a signal number that caused an exit.
-// The 0x80 bit is whether there was a core dump.
-// An extra number (exit code, signal causing a stop)
-// is in the high bits.
-
-type WaitStatus uint32
-
-const (
- mask = 0x7F
- core = 0x80
- shift = 8
-
- exited = 0
- stopped = 0x7F
-)
-
-func (w WaitStatus) Exited() bool { return w&mask == exited }
-
-func (w WaitStatus) ExitStatus() int {
- if w&mask != exited {
- return -1
- }
- return int(w >> shift)
-}
-
-func (w WaitStatus) Signaled() bool { return w&mask != stopped && w&mask != 0 }
-
-func (w WaitStatus) Signal() syscall.Signal {
- sig := syscall.Signal(w & mask)
- if sig == stopped || sig == 0 {
- return -1
- }
- return sig
-}
-
-func (w WaitStatus) CoreDump() bool { return w.Signaled() && w&core != 0 }
-
-func (w WaitStatus) Stopped() bool { return w&mask == stopped && syscall.Signal(w>>shift) != SIGSTOP }
-
-func (w WaitStatus) Continued() bool { return w&mask == stopped && syscall.Signal(w>>shift) == SIGSTOP }
-
-func (w WaitStatus) StopSignal() syscall.Signal {
- if !w.Stopped() {
- return -1
- }
- return syscall.Signal(w>>shift) & 0xFF
-}
-
-func (w WaitStatus) TrapCause() int { return -1 }
-
-func wait4(pid uintptr, wstatus *WaitStatus, options uintptr, rusage *Rusage) (wpid uintptr, err uintptr)
-
-func Wait4(pid int, wstatus *WaitStatus, options int, rusage *Rusage) (wpid int, err error) {
- r0, e1 := wait4(uintptr(pid), wstatus, uintptr(options), rusage)
- if e1 != 0 {
- err = syscall.Errno(e1)
- }
- return int(r0), err
-}
-
-func gethostname() (name string, err uintptr)
-
-func Gethostname() (name string, err error) {
- name, e1 := gethostname()
- if e1 != 0 {
- err = syscall.Errno(e1)
- }
- return name, err
-}
-
-//sys utimes(path string, times *[2]Timeval) (err error)
-
-func Utimes(path string, tv []Timeval) (err error) {
- if tv == nil {
- return utimes(path, nil)
- }
- if len(tv) != 2 {
- return EINVAL
- }
- return utimes(path, (*[2]Timeval)(unsafe.Pointer(&tv[0])))
-}
-
-//sys utimensat(fd int, path string, times *[2]Timespec, flag int) (err error)
-
-func UtimesNano(path string, ts []Timespec) error {
- if ts == nil {
- return utimensat(AT_FDCWD, path, nil, 0)
- }
- if len(ts) != 2 {
- return EINVAL
- }
- return utimensat(AT_FDCWD, path, (*[2]Timespec)(unsafe.Pointer(&ts[0])), 0)
-}
-
-func UtimesNanoAt(dirfd int, path string, ts []Timespec, flags int) error {
- if ts == nil {
- return utimensat(dirfd, path, nil, flags)
- }
- if len(ts) != 2 {
- return EINVAL
- }
- return utimensat(dirfd, path, (*[2]Timespec)(unsafe.Pointer(&ts[0])), flags)
-}
-
-//sys fcntl(fd int, cmd int, arg int) (val int, err error)
-
-// FcntlFlock performs a fcntl syscall for the F_GETLK, F_SETLK or F_SETLKW command.
-func FcntlFlock(fd uintptr, cmd int, lk *Flock_t) error {
- _, _, e1 := sysvicall6(uintptr(unsafe.Pointer(&procfcntl)), 3, uintptr(fd), uintptr(cmd), uintptr(unsafe.Pointer(lk)), 0, 0, 0)
- if e1 != 0 {
- return e1
- }
- return nil
-}
-
-//sys futimesat(fildes int, path *byte, times *[2]Timeval) (err error)
-
-func Futimesat(dirfd int, path string, tv []Timeval) error {
- pathp, err := BytePtrFromString(path)
- if err != nil {
- return err
- }
- if tv == nil {
- return futimesat(dirfd, pathp, nil)
- }
- if len(tv) != 2 {
- return EINVAL
- }
- return futimesat(dirfd, pathp, (*[2]Timeval)(unsafe.Pointer(&tv[0])))
-}
-
-// Solaris doesn't have an futimes function because it allows NULL to be
-// specified as the path for futimesat. However, Go doesn't like
-// NULL-style string interfaces, so this simple wrapper is provided.
-func Futimes(fd int, tv []Timeval) error {
- if tv == nil {
- return futimesat(fd, nil, nil)
- }
- if len(tv) != 2 {
- return EINVAL
- }
- return futimesat(fd, nil, (*[2]Timeval)(unsafe.Pointer(&tv[0])))
-}
-
-func anyToSockaddr(rsa *RawSockaddrAny) (Sockaddr, error) {
- switch rsa.Addr.Family {
- case AF_UNIX:
- pp := (*RawSockaddrUnix)(unsafe.Pointer(rsa))
- sa := new(SockaddrUnix)
- // Assume path ends at NUL.
- // This is not technically the Solaris semantics for
- // abstract Unix domain sockets -- they are supposed
- // to be uninterpreted fixed-size binary blobs -- but
- // everyone uses this convention.
- n := 0
- for n < len(pp.Path) && pp.Path[n] != 0 {
- n++
- }
- bytes := (*[10000]byte)(unsafe.Pointer(&pp.Path[0]))[0:n]
- sa.Name = string(bytes)
- return sa, nil
-
- case AF_INET:
- pp := (*RawSockaddrInet4)(unsafe.Pointer(rsa))
- sa := new(SockaddrInet4)
- p := (*[2]byte)(unsafe.Pointer(&pp.Port))
- sa.Port = int(p[0])<<8 + int(p[1])
- for i := 0; i < len(sa.Addr); i++ {
- sa.Addr[i] = pp.Addr[i]
- }
- return sa, nil
-
- case AF_INET6:
- pp := (*RawSockaddrInet6)(unsafe.Pointer(rsa))
- sa := new(SockaddrInet6)
- p := (*[2]byte)(unsafe.Pointer(&pp.Port))
- sa.Port = int(p[0])<<8 + int(p[1])
- sa.ZoneId = pp.Scope_id
- for i := 0; i < len(sa.Addr); i++ {
- sa.Addr[i] = pp.Addr[i]
- }
- return sa, nil
- }
- return nil, EAFNOSUPPORT
-}
-
-//sys accept(s int, rsa *RawSockaddrAny, addrlen *_Socklen) (fd int, err error) = libsocket.accept
-
-func Accept(fd int) (nfd int, sa Sockaddr, err error) {
- var rsa RawSockaddrAny
- var len _Socklen = SizeofSockaddrAny
- nfd, err = accept(fd, &rsa, &len)
- if nfd == -1 {
- return
- }
- sa, err = anyToSockaddr(&rsa)
- if err != nil {
- Close(nfd)
- nfd = 0
- }
- return
-}
-
-//sys recvmsg(s int, msg *Msghdr, flags int) (n int, err error) = libsocket.recvmsg
-
-func Recvmsg(fd int, p, oob []byte, flags int) (n, oobn int, recvflags int, from Sockaddr, err error) {
- var msg Msghdr
- var rsa RawSockaddrAny
- msg.Name = (*byte)(unsafe.Pointer(&rsa))
- msg.Namelen = uint32(SizeofSockaddrAny)
- var iov Iovec
- if len(p) > 0 {
- iov.Base = (*int8)(unsafe.Pointer(&p[0]))
- iov.SetLen(len(p))
- }
- var dummy int8
- if len(oob) > 0 {
- // receive at least one normal byte
- if len(p) == 0 {
- iov.Base = &dummy
- iov.SetLen(1)
- }
- msg.Accrights = (*int8)(unsafe.Pointer(&oob[0]))
- }
- msg.Iov = &iov
- msg.Iovlen = 1
- if n, err = recvmsg(fd, &msg, flags); n == -1 {
- return
- }
- oobn = int(msg.Accrightslen)
- // source address is only specified if the socket is unconnected
- if rsa.Addr.Family != AF_UNSPEC {
- from, err = anyToSockaddr(&rsa)
- }
- return
-}
-
-func Sendmsg(fd int, p, oob []byte, to Sockaddr, flags int) (err error) {
- _, err = SendmsgN(fd, p, oob, to, flags)
- return
-}
-
-//sys sendmsg(s int, msg *Msghdr, flags int) (n int, err error) = libsocket.sendmsg
-
-func SendmsgN(fd int, p, oob []byte, to Sockaddr, flags int) (n int, err error) {
- var ptr unsafe.Pointer
- var salen _Socklen
- if to != nil {
- ptr, salen, err = to.sockaddr()
- if err != nil {
- return 0, err
- }
- }
- var msg Msghdr
- msg.Name = (*byte)(unsafe.Pointer(ptr))
- msg.Namelen = uint32(salen)
- var iov Iovec
- if len(p) > 0 {
- iov.Base = (*int8)(unsafe.Pointer(&p[0]))
- iov.SetLen(len(p))
- }
- var dummy int8
- if len(oob) > 0 {
- // send at least one normal byte
- if len(p) == 0 {
- iov.Base = &dummy
- iov.SetLen(1)
- }
- msg.Accrights = (*int8)(unsafe.Pointer(&oob[0]))
- }
- msg.Iov = &iov
- msg.Iovlen = 1
- if n, err = sendmsg(fd, &msg, flags); err != nil {
- return 0, err
- }
- if len(oob) > 0 && len(p) == 0 {
- n = 0
- }
- return n, nil
-}
-
-//sys acct(path *byte) (err error)
-
-func Acct(path string) (err error) {
- if len(path) == 0 {
- // Assume caller wants to disable accounting.
- return acct(nil)
- }
-
- pathp, err := BytePtrFromString(path)
- if err != nil {
- return err
- }
- return acct(pathp)
-}
-
-/*
- * Expose the ioctl function
- */
-
-//sys ioctl(fd int, req int, arg uintptr) (err error)
-
-func IoctlSetInt(fd int, req int, value int) (err error) {
- return ioctl(fd, req, uintptr(value))
-}
-
-func IoctlSetWinsize(fd int, req int, value *Winsize) (err error) {
- return ioctl(fd, req, uintptr(unsafe.Pointer(value)))
-}
-
-func IoctlSetTermios(fd int, req int, value *Termios) (err error) {
- return ioctl(fd, req, uintptr(unsafe.Pointer(value)))
-}
-
-func IoctlSetTermio(fd int, req int, value *Termio) (err error) {
- return ioctl(fd, req, uintptr(unsafe.Pointer(value)))
-}
-
-func IoctlGetInt(fd int, req int) (int, error) {
- var value int
- err := ioctl(fd, req, uintptr(unsafe.Pointer(&value)))
- return value, err
-}
-
-func IoctlGetWinsize(fd int, req int) (*Winsize, error) {
- var value Winsize
- err := ioctl(fd, req, uintptr(unsafe.Pointer(&value)))
- return &value, err
-}
-
-func IoctlGetTermios(fd int, req int) (*Termios, error) {
- var value Termios
- err := ioctl(fd, req, uintptr(unsafe.Pointer(&value)))
- return &value, err
-}
-
-func IoctlGetTermio(fd int, req int) (*Termio, error) {
- var value Termio
- err := ioctl(fd, req, uintptr(unsafe.Pointer(&value)))
- return &value, err
-}
-
-/*
- * Exposed directly
- */
-//sys Access(path string, mode uint32) (err error)
-//sys Adjtime(delta *Timeval, olddelta *Timeval) (err error)
-//sys Chdir(path string) (err error)
-//sys Chmod(path string, mode uint32) (err error)
-//sys Chown(path string, uid int, gid int) (err error)
-//sys Chroot(path string) (err error)
-//sys Close(fd int) (err error)
-//sys Creat(path string, mode uint32) (fd int, err error)
-//sys Dup(fd int) (nfd int, err error)
-//sys Dup2(oldfd int, newfd int) (err error)
-//sys Exit(code int)
-//sys Fchdir(fd int) (err error)
-//sys Fchmod(fd int, mode uint32) (err error)
-//sys Fchmodat(dirfd int, path string, mode uint32, flags int) (err error)
-//sys Fchown(fd int, uid int, gid int) (err error)
-//sys Fchownat(dirfd int, path string, uid int, gid int, flags int) (err error)
-//sys Fdatasync(fd int) (err error)
-//sys Fpathconf(fd int, name int) (val int, err error)
-//sys Fstat(fd int, stat *Stat_t) (err error)
-//sys Getdents(fd int, buf []byte, basep *uintptr) (n int, err error)
-//sysnb Getgid() (gid int)
-//sysnb Getpid() (pid int)
-//sysnb Getpgid(pid int) (pgid int, err error)
-//sysnb Getpgrp() (pgid int, err error)
-//sys Geteuid() (euid int)
-//sys Getegid() (egid int)
-//sys Getppid() (ppid int)
-//sys Getpriority(which int, who int) (n int, err error)
-//sysnb Getrlimit(which int, lim *Rlimit) (err error)
-//sysnb Getrusage(who int, rusage *Rusage) (err error)
-//sysnb Gettimeofday(tv *Timeval) (err error)
-//sysnb Getuid() (uid int)
-//sys Kill(pid int, signum syscall.Signal) (err error)
-//sys Lchown(path string, uid int, gid int) (err error)
-//sys Link(path string, link string) (err error)
-//sys Listen(s int, backlog int) (err error) = libsocket.listen
-//sys Lstat(path string, stat *Stat_t) (err error)
-//sys Madvise(b []byte, advice int) (err error)
-//sys Mkdir(path string, mode uint32) (err error)
-//sys Mkdirat(dirfd int, path string, mode uint32) (err error)
-//sys Mkfifo(path string, mode uint32) (err error)
-//sys Mkfifoat(dirfd int, path string, mode uint32) (err error)
-//sys Mknod(path string, mode uint32, dev int) (err error)
-//sys Mknodat(dirfd int, path string, mode uint32, dev int) (err error)
-//sys Mlock(b []byte) (err error)
-//sys Mlockall(flags int) (err error)
-//sys Mprotect(b []byte, prot int) (err error)
-//sys Munlock(b []byte) (err error)
-//sys Munlockall() (err error)
-//sys Nanosleep(time *Timespec, leftover *Timespec) (err error)
-//sys Open(path string, mode int, perm uint32) (fd int, err error)
-//sys Openat(dirfd int, path string, flags int, mode uint32) (fd int, err error)
-//sys Pathconf(path string, name int) (val int, err error)
-//sys Pause() (err error)
-//sys Pread(fd int, p []byte, offset int64) (n int, err error)
-//sys Pwrite(fd int, p []byte, offset int64) (n int, err error)
-//sys read(fd int, p []byte) (n int, err error)
-//sys Readlink(path string, buf []byte) (n int, err error)
-//sys Rename(from string, to string) (err error)
-//sys Renameat(olddirfd int, oldpath string, newdirfd int, newpath string) (err error)
-//sys Rmdir(path string) (err error)
-//sys Seek(fd int, offset int64, whence int) (newoffset int64, err error) = lseek
-//sysnb Setegid(egid int) (err error)
-//sysnb Seteuid(euid int) (err error)
-//sysnb Setgid(gid int) (err error)
-//sys Sethostname(p []byte) (err error)
-//sysnb Setpgid(pid int, pgid int) (err error)
-//sys Setpriority(which int, who int, prio int) (err error)
-//sysnb Setregid(rgid int, egid int) (err error)
-//sysnb Setreuid(ruid int, euid int) (err error)
-//sysnb Setrlimit(which int, lim *Rlimit) (err error)
-//sysnb Setsid() (pid int, err error)
-//sysnb Setuid(uid int) (err error)
-//sys Shutdown(s int, how int) (err error) = libsocket.shutdown
-//sys Stat(path string, stat *Stat_t) (err error)
-//sys Symlink(path string, link string) (err error)
-//sys Sync() (err error)
-//sysnb Times(tms *Tms) (ticks uintptr, err error)
-//sys Truncate(path string, length int64) (err error)
-//sys Fsync(fd int) (err error)
-//sys Ftruncate(fd int, length int64) (err error)
-//sys Umask(mask int) (oldmask int)
-//sysnb Uname(buf *Utsname) (err error)
-//sys Unmount(target string, flags int) (err error) = libc.umount
-//sys Unlink(path string) (err error)
-//sys Unlinkat(dirfd int, path string, flags int) (err error)
-//sys Ustat(dev int, ubuf *Ustat_t) (err error)
-//sys Utime(path string, buf *Utimbuf) (err error)
-//sys bind(s int, addr unsafe.Pointer, addrlen _Socklen) (err error) = libsocket.bind
-//sys connect(s int, addr unsafe.Pointer, addrlen _Socklen) (err error) = libsocket.connect
-//sys mmap(addr uintptr, length uintptr, prot int, flag int, fd int, pos int64) (ret uintptr, err error)
-//sys munmap(addr uintptr, length uintptr) (err error)
-//sys sendto(s int, buf []byte, flags int, to unsafe.Pointer, addrlen _Socklen) (err error) = libsocket.sendto
-//sys socket(domain int, typ int, proto int) (fd int, err error) = libsocket.socket
-//sysnb socketpair(domain int, typ int, proto int, fd *[2]int32) (err error) = libsocket.socketpair
-//sys write(fd int, p []byte) (n int, err error)
-//sys getsockopt(s int, level int, name int, val unsafe.Pointer, vallen *_Socklen) (err error) = libsocket.getsockopt
-//sysnb getpeername(fd int, rsa *RawSockaddrAny, addrlen *_Socklen) (err error) = libsocket.getpeername
-//sys setsockopt(s int, level int, name int, val unsafe.Pointer, vallen uintptr) (err error) = libsocket.setsockopt
-//sys recvfrom(fd int, p []byte, flags int, from *RawSockaddrAny, fromlen *_Socklen) (n int, err error) = libsocket.recvfrom
-
-func readlen(fd int, buf *byte, nbuf int) (n int, err error) {
- r0, _, e1 := sysvicall6(uintptr(unsafe.Pointer(&procread)), 3, uintptr(fd), uintptr(unsafe.Pointer(buf)), uintptr(nbuf), 0, 0, 0)
- n = int(r0)
- if e1 != 0 {
- err = e1
- }
- return
-}
-
-func writelen(fd int, buf *byte, nbuf int) (n int, err error) {
- r0, _, e1 := sysvicall6(uintptr(unsafe.Pointer(&procwrite)), 3, uintptr(fd), uintptr(unsafe.Pointer(buf)), uintptr(nbuf), 0, 0, 0)
- n = int(r0)
- if e1 != 0 {
- err = e1
- }
- return
-}
-
-var mapper = &mmapper{
- active: make(map[*byte][]byte),
- mmap: mmap,
- munmap: munmap,
-}
-
-func Mmap(fd int, offset int64, length int, prot int, flags int) (data []byte, err error) {
- return mapper.Mmap(fd, offset, length, prot, flags)
-}
-
-func Munmap(b []byte) (err error) {
- return mapper.Munmap(b)
-}
-
-//sys sysconf(name int) (n int64, err error)
-
-// pageSize caches the value of Getpagesize, since it can't change
-// once the system is booted.
-var pageSize int64 // accessed atomically
-
-func Getpagesize() int {
- n := atomic.LoadInt64(&pageSize)
- if n == 0 {
- n, _ = sysconf(_SC_PAGESIZE)
- atomic.StoreInt64(&pageSize, n)
- }
- return int(n)
-}
diff --git a/vendor/golang.org/x/sys/unix/syscall_solaris_amd64.go b/vendor/golang.org/x/sys/unix/syscall_solaris_amd64.go
deleted file mode 100644
index 2e44630c..00000000
--- a/vendor/golang.org/x/sys/unix/syscall_solaris_amd64.go
+++ /dev/null
@@ -1,37 +0,0 @@
-// Copyright 2009 The Go Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style
-// license that can be found in the LICENSE file.
-
-// +build amd64,solaris
-
-package unix
-
-func TimespecToNsec(ts Timespec) int64 { return int64(ts.Sec)*1e9 + int64(ts.Nsec) }
-
-func NsecToTimespec(nsec int64) (ts Timespec) {
- ts.Sec = nsec / 1e9
- ts.Nsec = nsec % 1e9
- return
-}
-
-func TimevalToNsec(tv Timeval) int64 { return int64(tv.Sec)*1e9 + int64(tv.Usec)*1e3 }
-
-func NsecToTimeval(nsec int64) (tv Timeval) {
- nsec += 999 // round up to microsecond
- tv.Usec = nsec % 1e9 / 1e3
- tv.Sec = int64(nsec / 1e9)
- return
-}
-
-func (iov *Iovec) SetLen(length int) {
- iov.Len = uint64(length)
-}
-
-func (cmsg *Cmsghdr) SetLen(length int) {
- cmsg.Len = uint32(length)
-}
-
-func sendfile(outfd int, infd int, offset *int64, count int) (written int, err error) {
- // TODO(aram): implement this, see issue 5847.
- panic("unimplemented")
-}
diff --git a/vendor/golang.org/x/sys/unix/syscall_unix.go b/vendor/golang.org/x/sys/unix/syscall_unix.go
deleted file mode 100644
index b46b2502..00000000
--- a/vendor/golang.org/x/sys/unix/syscall_unix.go
+++ /dev/null
@@ -1,297 +0,0 @@
-// Copyright 2009 The Go Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style
-// license that can be found in the LICENSE file.
-
-// +build darwin dragonfly freebsd linux netbsd openbsd solaris
-
-package unix
-
-import (
- "runtime"
- "sync"
- "syscall"
- "unsafe"
-)
-
-var (
- Stdin = 0
- Stdout = 1
- Stderr = 2
-)
-
-const (
- darwin64Bit = runtime.GOOS == "darwin" && sizeofPtr == 8
- dragonfly64Bit = runtime.GOOS == "dragonfly" && sizeofPtr == 8
- netbsd32Bit = runtime.GOOS == "netbsd" && sizeofPtr == 4
-)
-
-// Do the interface allocations only once for common
-// Errno values.
-var (
- errEAGAIN error = syscall.EAGAIN
- errEINVAL error = syscall.EINVAL
- errENOENT error = syscall.ENOENT
-)
-
-// errnoErr returns common boxed Errno values, to prevent
-// allocations at runtime.
-func errnoErr(e syscall.Errno) error {
- switch e {
- case 0:
- return nil
- case EAGAIN:
- return errEAGAIN
- case EINVAL:
- return errEINVAL
- case ENOENT:
- return errENOENT
- }
- return e
-}
-
-func Syscall(trap, a1, a2, a3 uintptr) (r1, r2 uintptr, err syscall.Errno)
-func Syscall6(trap, a1, a2, a3, a4, a5, a6 uintptr) (r1, r2 uintptr, err syscall.Errno)
-func RawSyscall(trap, a1, a2, a3 uintptr) (r1, r2 uintptr, err syscall.Errno)
-func RawSyscall6(trap, a1, a2, a3, a4, a5, a6 uintptr) (r1, r2 uintptr, err syscall.Errno)
-
-// Mmap manager, for use by operating system-specific implementations.
-
-type mmapper struct {
- sync.Mutex
- active map[*byte][]byte // active mappings; key is last byte in mapping
- mmap func(addr, length uintptr, prot, flags, fd int, offset int64) (uintptr, error)
- munmap func(addr uintptr, length uintptr) error
-}
-
-func (m *mmapper) Mmap(fd int, offset int64, length int, prot int, flags int) (data []byte, err error) {
- if length <= 0 {
- return nil, EINVAL
- }
-
- // Map the requested memory.
- addr, errno := m.mmap(0, uintptr(length), prot, flags, fd, offset)
- if errno != nil {
- return nil, errno
- }
-
- // Slice memory layout
- var sl = struct {
- addr uintptr
- len int
- cap int
- }{addr, length, length}
-
- // Use unsafe to turn sl into a []byte.
- b := *(*[]byte)(unsafe.Pointer(&sl))
-
- // Register mapping in m and return it.
- p := &b[cap(b)-1]
- m.Lock()
- defer m.Unlock()
- m.active[p] = b
- return b, nil
-}
-
-func (m *mmapper) Munmap(data []byte) (err error) {
- if len(data) == 0 || len(data) != cap(data) {
- return EINVAL
- }
-
- // Find the base of the mapping.
- p := &data[cap(data)-1]
- m.Lock()
- defer m.Unlock()
- b := m.active[p]
- if b == nil || &b[0] != &data[0] {
- return EINVAL
- }
-
- // Unmap the memory and update m.
- if errno := m.munmap(uintptr(unsafe.Pointer(&b[0])), uintptr(len(b))); errno != nil {
- return errno
- }
- delete(m.active, p)
- return nil
-}
-
-func Read(fd int, p []byte) (n int, err error) {
- n, err = read(fd, p)
- if raceenabled {
- if n > 0 {
- raceWriteRange(unsafe.Pointer(&p[0]), n)
- }
- if err == nil {
- raceAcquire(unsafe.Pointer(&ioSync))
- }
- }
- return
-}
-
-func Write(fd int, p []byte) (n int, err error) {
- if raceenabled {
- raceReleaseMerge(unsafe.Pointer(&ioSync))
- }
- n, err = write(fd, p)
- if raceenabled && n > 0 {
- raceReadRange(unsafe.Pointer(&p[0]), n)
- }
- return
-}
-
-// For testing: clients can set this flag to force
-// creation of IPv6 sockets to return EAFNOSUPPORT.
-var SocketDisableIPv6 bool
-
-type Sockaddr interface {
- sockaddr() (ptr unsafe.Pointer, len _Socklen, err error) // lowercase; only we can define Sockaddrs
-}
-
-type SockaddrInet4 struct {
- Port int
- Addr [4]byte
- raw RawSockaddrInet4
-}
-
-type SockaddrInet6 struct {
- Port int
- ZoneId uint32
- Addr [16]byte
- raw RawSockaddrInet6
-}
-
-type SockaddrUnix struct {
- Name string
- raw RawSockaddrUnix
-}
-
-func Bind(fd int, sa Sockaddr) (err error) {
- ptr, n, err := sa.sockaddr()
- if err != nil {
- return err
- }
- return bind(fd, ptr, n)
-}
-
-func Connect(fd int, sa Sockaddr) (err error) {
- ptr, n, err := sa.sockaddr()
- if err != nil {
- return err
- }
- return connect(fd, ptr, n)
-}
-
-func Getpeername(fd int) (sa Sockaddr, err error) {
- var rsa RawSockaddrAny
- var len _Socklen = SizeofSockaddrAny
- if err = getpeername(fd, &rsa, &len); err != nil {
- return
- }
- return anyToSockaddr(&rsa)
-}
-
-func GetsockoptInt(fd, level, opt int) (value int, err error) {
- var n int32
- vallen := _Socklen(4)
- err = getsockopt(fd, level, opt, unsafe.Pointer(&n), &vallen)
- return int(n), err
-}
-
-func Recvfrom(fd int, p []byte, flags int) (n int, from Sockaddr, err error) {
- var rsa RawSockaddrAny
- var len _Socklen = SizeofSockaddrAny
- if n, err = recvfrom(fd, p, flags, &rsa, &len); err != nil {
- return
- }
- if rsa.Addr.Family != AF_UNSPEC {
- from, err = anyToSockaddr(&rsa)
- }
- return
-}
-
-func Sendto(fd int, p []byte, flags int, to Sockaddr) (err error) {
- ptr, n, err := to.sockaddr()
- if err != nil {
- return err
- }
- return sendto(fd, p, flags, ptr, n)
-}
-
-func SetsockoptByte(fd, level, opt int, value byte) (err error) {
- return setsockopt(fd, level, opt, unsafe.Pointer(&value), 1)
-}
-
-func SetsockoptInt(fd, level, opt int, value int) (err error) {
- var n = int32(value)
- return setsockopt(fd, level, opt, unsafe.Pointer(&n), 4)
-}
-
-func SetsockoptInet4Addr(fd, level, opt int, value [4]byte) (err error) {
- return setsockopt(fd, level, opt, unsafe.Pointer(&value[0]), 4)
-}
-
-func SetsockoptIPMreq(fd, level, opt int, mreq *IPMreq) (err error) {
- return setsockopt(fd, level, opt, unsafe.Pointer(mreq), SizeofIPMreq)
-}
-
-func SetsockoptIPv6Mreq(fd, level, opt int, mreq *IPv6Mreq) (err error) {
- return setsockopt(fd, level, opt, unsafe.Pointer(mreq), SizeofIPv6Mreq)
-}
-
-func SetsockoptICMPv6Filter(fd, level, opt int, filter *ICMPv6Filter) error {
- return setsockopt(fd, level, opt, unsafe.Pointer(filter), SizeofICMPv6Filter)
-}
-
-func SetsockoptLinger(fd, level, opt int, l *Linger) (err error) {
- return setsockopt(fd, level, opt, unsafe.Pointer(l), SizeofLinger)
-}
-
-func SetsockoptString(fd, level, opt int, s string) (err error) {
- return setsockopt(fd, level, opt, unsafe.Pointer(&[]byte(s)[0]), uintptr(len(s)))
-}
-
-func SetsockoptTimeval(fd, level, opt int, tv *Timeval) (err error) {
- return setsockopt(fd, level, opt, unsafe.Pointer(tv), unsafe.Sizeof(*tv))
-}
-
-func Socket(domain, typ, proto int) (fd int, err error) {
- if domain == AF_INET6 && SocketDisableIPv6 {
- return -1, EAFNOSUPPORT
- }
- fd, err = socket(domain, typ, proto)
- return
-}
-
-func Socketpair(domain, typ, proto int) (fd [2]int, err error) {
- var fdx [2]int32
- err = socketpair(domain, typ, proto, &fdx)
- if err == nil {
- fd[0] = int(fdx[0])
- fd[1] = int(fdx[1])
- }
- return
-}
-
-func Sendfile(outfd int, infd int, offset *int64, count int) (written int, err error) {
- if raceenabled {
- raceReleaseMerge(unsafe.Pointer(&ioSync))
- }
- return sendfile(outfd, infd, offset, count)
-}
-
-var ioSync int64
-
-func CloseOnExec(fd int) { fcntl(fd, F_SETFD, FD_CLOEXEC) }
-
-func SetNonblock(fd int, nonblocking bool) (err error) {
- flag, err := fcntl(fd, F_GETFL, 0)
- if err != nil {
- return err
- }
- if nonblocking {
- flag |= O_NONBLOCK
- } else {
- flag &= ^O_NONBLOCK
- }
- _, err = fcntl(fd, F_SETFL, flag)
- return err
-}
diff --git a/vendor/golang.org/x/sys/unix/types_darwin.go b/vendor/golang.org/x/sys/unix/types_darwin.go
deleted file mode 100644
index 11532618..00000000
--- a/vendor/golang.org/x/sys/unix/types_darwin.go
+++ /dev/null
@@ -1,250 +0,0 @@
-// Copyright 2009 The Go Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style
-// license that can be found in the LICENSE file.
-
-// +build ignore
-
-/*
-Input to cgo -godefs. See also mkerrors.sh and mkall.sh
-*/
-
-// +godefs map struct_in_addr [4]byte /* in_addr */
-// +godefs map struct_in6_addr [16]byte /* in6_addr */
-
-package unix
-
-/*
-#define __DARWIN_UNIX03 0
-#define KERNEL
-#define _DARWIN_USE_64_BIT_INODE
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-
-enum {
- sizeofPtr = sizeof(void*),
-};
-
-union sockaddr_all {
- struct sockaddr s1; // this one gets used for fields
- struct sockaddr_in s2; // these pad it out
- struct sockaddr_in6 s3;
- struct sockaddr_un s4;
- struct sockaddr_dl s5;
-};
-
-struct sockaddr_any {
- struct sockaddr addr;
- char pad[sizeof(union sockaddr_all) - sizeof(struct sockaddr)];
-};
-
-*/
-import "C"
-
-// Machine characteristics; for internal use.
-
-const (
- sizeofPtr = C.sizeofPtr
- sizeofShort = C.sizeof_short
- sizeofInt = C.sizeof_int
- sizeofLong = C.sizeof_long
- sizeofLongLong = C.sizeof_longlong
-)
-
-// Basic types
-
-type (
- _C_short C.short
- _C_int C.int
- _C_long C.long
- _C_long_long C.longlong
-)
-
-// Time
-
-type Timespec C.struct_timespec
-
-type Timeval C.struct_timeval
-
-type Timeval32 C.struct_timeval32
-
-// Processes
-
-type Rusage C.struct_rusage
-
-type Rlimit C.struct_rlimit
-
-type _Gid_t C.gid_t
-
-// Files
-
-type Stat_t C.struct_stat64
-
-type Statfs_t C.struct_statfs64
-
-type Flock_t C.struct_flock
-
-type Fstore_t C.struct_fstore
-
-type Radvisory_t C.struct_radvisory
-
-type Fbootstraptransfer_t C.struct_fbootstraptransfer
-
-type Log2phys_t C.struct_log2phys
-
-type Fsid C.struct_fsid
-
-type Dirent C.struct_dirent
-
-// Sockets
-
-type RawSockaddrInet4 C.struct_sockaddr_in
-
-type RawSockaddrInet6 C.struct_sockaddr_in6
-
-type RawSockaddrUnix C.struct_sockaddr_un
-
-type RawSockaddrDatalink C.struct_sockaddr_dl
-
-type RawSockaddr C.struct_sockaddr
-
-type RawSockaddrAny C.struct_sockaddr_any
-
-type _Socklen C.socklen_t
-
-type Linger C.struct_linger
-
-type Iovec C.struct_iovec
-
-type IPMreq C.struct_ip_mreq
-
-type IPv6Mreq C.struct_ipv6_mreq
-
-type Msghdr C.struct_msghdr
-
-type Cmsghdr C.struct_cmsghdr
-
-type Inet4Pktinfo C.struct_in_pktinfo
-
-type Inet6Pktinfo C.struct_in6_pktinfo
-
-type IPv6MTUInfo C.struct_ip6_mtuinfo
-
-type ICMPv6Filter C.struct_icmp6_filter
-
-const (
- SizeofSockaddrInet4 = C.sizeof_struct_sockaddr_in
- SizeofSockaddrInet6 = C.sizeof_struct_sockaddr_in6
- SizeofSockaddrAny = C.sizeof_struct_sockaddr_any
- SizeofSockaddrUnix = C.sizeof_struct_sockaddr_un
- SizeofSockaddrDatalink = C.sizeof_struct_sockaddr_dl
- SizeofLinger = C.sizeof_struct_linger
- SizeofIPMreq = C.sizeof_struct_ip_mreq
- SizeofIPv6Mreq = C.sizeof_struct_ipv6_mreq
- SizeofMsghdr = C.sizeof_struct_msghdr
- SizeofCmsghdr = C.sizeof_struct_cmsghdr
- SizeofInet4Pktinfo = C.sizeof_struct_in_pktinfo
- SizeofInet6Pktinfo = C.sizeof_struct_in6_pktinfo
- SizeofIPv6MTUInfo = C.sizeof_struct_ip6_mtuinfo
- SizeofICMPv6Filter = C.sizeof_struct_icmp6_filter
-)
-
-// Ptrace requests
-
-const (
- PTRACE_TRACEME = C.PT_TRACE_ME
- PTRACE_CONT = C.PT_CONTINUE
- PTRACE_KILL = C.PT_KILL
-)
-
-// Events (kqueue, kevent)
-
-type Kevent_t C.struct_kevent
-
-// Select
-
-type FdSet C.fd_set
-
-// Routing and interface messages
-
-const (
- SizeofIfMsghdr = C.sizeof_struct_if_msghdr
- SizeofIfData = C.sizeof_struct_if_data
- SizeofIfaMsghdr = C.sizeof_struct_ifa_msghdr
- SizeofIfmaMsghdr = C.sizeof_struct_ifma_msghdr
- SizeofIfmaMsghdr2 = C.sizeof_struct_ifma_msghdr2
- SizeofRtMsghdr = C.sizeof_struct_rt_msghdr
- SizeofRtMetrics = C.sizeof_struct_rt_metrics
-)
-
-type IfMsghdr C.struct_if_msghdr
-
-type IfData C.struct_if_data
-
-type IfaMsghdr C.struct_ifa_msghdr
-
-type IfmaMsghdr C.struct_ifma_msghdr
-
-type IfmaMsghdr2 C.struct_ifma_msghdr2
-
-type RtMsghdr C.struct_rt_msghdr
-
-type RtMetrics C.struct_rt_metrics
-
-// Berkeley packet filter
-
-const (
- SizeofBpfVersion = C.sizeof_struct_bpf_version
- SizeofBpfStat = C.sizeof_struct_bpf_stat
- SizeofBpfProgram = C.sizeof_struct_bpf_program
- SizeofBpfInsn = C.sizeof_struct_bpf_insn
- SizeofBpfHdr = C.sizeof_struct_bpf_hdr
-)
-
-type BpfVersion C.struct_bpf_version
-
-type BpfStat C.struct_bpf_stat
-
-type BpfProgram C.struct_bpf_program
-
-type BpfInsn C.struct_bpf_insn
-
-type BpfHdr C.struct_bpf_hdr
-
-// Terminal handling
-
-type Termios C.struct_termios
-
-// fchmodat-like syscalls.
-
-const (
- AT_FDCWD = C.AT_FDCWD
- AT_SYMLINK_NOFOLLOW = C.AT_SYMLINK_NOFOLLOW
-)
diff --git a/vendor/golang.org/x/sys/unix/types_dragonfly.go b/vendor/golang.org/x/sys/unix/types_dragonfly.go
deleted file mode 100644
index f3c971df..00000000
--- a/vendor/golang.org/x/sys/unix/types_dragonfly.go
+++ /dev/null
@@ -1,242 +0,0 @@
-// Copyright 2009 The Go Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style
-// license that can be found in the LICENSE file.
-
-// +build ignore
-
-/*
-Input to cgo -godefs. See also mkerrors.sh and mkall.sh
-*/
-
-// +godefs map struct_in_addr [4]byte /* in_addr */
-// +godefs map struct_in6_addr [16]byte /* in6_addr */
-
-package unix
-
-/*
-#define KERNEL
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-#include