├── .gitignore ├── Godeps ├── Godeps.json └── Readme ├── LICENSE ├── README.md ├── build.sh ├── builder └── xenserver │ ├── common │ ├── artifact.go │ ├── common_config.go │ ├── find_port.go │ ├── find_resident_host.go │ ├── http_upload.go │ ├── interruptible_wait.go │ ├── ssh.go │ ├── ssh_config.go │ ├── step_attach_vdi.go │ ├── step_boot_wait.go │ ├── step_detach_vdi.go │ ├── step_export.go │ ├── step_find_vdi.go │ ├── step_forward_port_over_ssh.go │ ├── step_get_vnc_port.go │ ├── step_http_server.go │ ├── step_iso_download.go │ ├── step_prepare_nfs_export.go │ ├── step_prepare_output_dir.go │ ├── step_shutdown.go │ ├── step_start_on_himn.go │ ├── step_start_vm.go │ ├── step_start_vm_paused.go │ ├── step_type_boot_command.go │ ├── step_upload_vdi.go │ ├── step_wait_for_ip.go │ └── step_wait_for_shutdown.go │ ├── iso │ ├── builder.go │ ├── builder_test.go │ └── step_create_instance.go │ ├── vm │ ├── builder.go │ ├── builder_test.go │ ├── step_copy_clean_script.go │ ├── step_restore_network.go │ └── step_snapshot_instance.go │ └── xva │ ├── builder.go │ ├── builder_test.go │ └── step_import_instance.go ├── examples ├── centos-6.6.json ├── centos-7.json ├── centos-7acs.json ├── centos-7vm-acs.json ├── centos-7vm.json ├── debian-vm-openstack.json ├── debian-vm.json ├── http │ ├── centos6-ks.cfg │ └── centos7-ks.cfg ├── piwigo-acs.json └── win2k12r2base.json ├── html ├── acs │ ├── centos7-reset.sh │ ├── cloud-set-guest-password.service │ └── cloud-set-guest-password.sh └── xenserver │ └── copyiso.sh ├── plugin ├── builder-xenserver-iso │ └── main.go ├── builder-xenserver-vm │ └── main.go ├── builder-xenserver-xva │ └── main.go └── post-processor-cloudstack-xenserver │ └── main.go ├── post-processor ├── cloudstack │ └── xenserver │ │ ├── post-processor.go │ │ └── post-processor_test.go └── openstack │ └── xenserver │ ├── post-processor.go │ └── post-processor_test.go ├── scripts ├── acs │ ├── centos7-reset.sh │ ├── cloud-set-guest-password.service │ └── cloud-set-guest-password.sh ├── copyiso.sh ├── packer-clean.sh └── piwigo │ └── piwigo-reset.sh └── vendor ├── github.com ├── Sirupsen │ └── logrus │ │ ├── .gitignore │ │ ├── .travis.yml │ │ ├── CHANGELOG.md │ │ ├── LICENSE │ │ ├── README.md │ │ ├── doc.go │ │ ├── entry.go │ │ ├── exported.go │ │ ├── formatter.go │ │ ├── hooks.go │ │ ├── json_formatter.go │ │ ├── logger.go │ │ ├── logrus.go │ │ ├── terminal_bsd.go │ │ ├── terminal_linux.go │ │ ├── terminal_notwindows.go │ │ ├── terminal_solaris.go │ │ ├── terminal_windows.go │ │ ├── text_formatter.go │ │ └── writer.go ├── dylanmei │ ├── iso8601 │ │ ├── LICENSE │ │ ├── README.md │ │ └── duration.go │ └── winrmtest │ │ ├── LICENSE │ │ ├── README.md │ │ ├── remote.go │ │ └── wsman.go ├── hashicorp │ ├── errwrap │ │ ├── LICENSE │ │ ├── README.md │ │ └── errwrap.go │ ├── go-multierror │ │ ├── LICENSE │ │ ├── README.md │ │ ├── append.go │ │ ├── flatten.go │ │ ├── format.go │ │ ├── multierror.go │ │ └── prefix.go │ ├── go-version │ │ ├── .travis.yml │ │ ├── LICENSE │ │ ├── README.md │ │ ├── constraint.go │ │ ├── version.go │ │ └── version_collection.go │ └── yamux │ │ ├── .gitignore │ │ ├── LICENSE │ │ ├── README.md │ │ ├── addr.go │ │ ├── const.go │ │ ├── mux.go │ │ ├── session.go │ │ ├── spec.md │ │ ├── stream.go │ │ └── util.go ├── kr │ └── fs │ │ ├── LICENSE │ │ ├── Readme │ │ ├── filesystem.go │ │ └── walk.go ├── masterzen │ ├── simplexml │ │ ├── LICENSE │ │ └── dom │ │ │ ├── document.go │ │ │ ├── element.go │ │ │ └── namespace.go │ ├── winrm │ │ ├── LICENSE │ │ ├── soap │ │ │ ├── header.go │ │ │ ├── message.go │ │ │ └── namespaces.go │ │ └── winrm │ │ │ ├── client.go │ │ │ ├── command.go │ │ │ ├── endpoint.go │ │ │ ├── http.go │ │ │ ├── parameters.go │ │ │ ├── powershell.go │ │ │ ├── request.go │ │ │ ├── response.go │ │ │ └── shell.go │ └── xmlpath │ │ ├── LICENSE │ │ ├── doc.go │ │ ├── parser.go │ │ └── path.go ├── mitchellh │ ├── go-fs │ │ ├── LICENSE │ │ ├── README.md │ │ ├── block_device.go │ │ ├── directory.go │ │ ├── fat │ │ │ ├── boot_sector.go │ │ │ ├── cluster_chain.go │ │ │ ├── directory.go │ │ │ ├── directory_cluster.go │ │ │ ├── fat.go │ │ │ ├── file.go │ │ │ ├── filesystem.go │ │ │ ├── short_name.go │ │ │ ├── super_floppy.go │ │ │ └── type.go │ │ ├── file.go │ │ ├── file_disk.go │ │ └── filesystem.go │ ├── iochan │ │ ├── LICENSE.md │ │ ├── README.md │ │ └── iochan.go │ ├── mapstructure │ │ ├── .travis.yml │ │ ├── LICENSE │ │ ├── README.md │ │ ├── decode_hooks.go │ │ ├── error.go │ │ └── mapstructure.go │ ├── multistep │ │ ├── LICENSE.md │ │ ├── README.md │ │ ├── basic_runner.go │ │ ├── debug_runner.go │ │ ├── multistep.go │ │ └── statebag.go │ ├── osext │ │ ├── LICENSE │ │ ├── README.md │ │ ├── osext.go │ │ ├── osext_plan9.go │ │ ├── osext_procfs.go │ │ ├── osext_sysctl.go │ │ └── osext_windows.go │ ├── packer │ │ ├── LICENSE │ │ ├── common │ │ │ ├── config.go │ │ │ ├── download.go │ │ │ ├── http_config.go │ │ │ ├── iso_config.go │ │ │ ├── multistep_debug.go │ │ │ ├── packer_config.go │ │ │ ├── ssh │ │ │ │ └── key.go │ │ │ ├── step_create_floppy.go │ │ │ ├── step_download.go │ │ │ ├── step_http_server.go │ │ │ ├── step_provision.go │ │ │ └── uuid │ │ │ │ └── uuid.go │ │ ├── communicator │ │ │ ├── none │ │ │ │ └── communicator.go │ │ │ ├── ssh │ │ │ │ ├── communicator.go │ │ │ │ ├── connect.go │ │ │ │ └── password.go │ │ │ └── winrm │ │ │ │ ├── communicator.go │ │ │ │ ├── config.go │ │ │ │ └── time.go │ │ ├── helper │ │ │ ├── communicator │ │ │ │ ├── config.go │ │ │ │ ├── ssh.go │ │ │ │ ├── step_connect.go │ │ │ │ ├── step_connect_ssh.go │ │ │ │ ├── step_connect_winrm.go │ │ │ │ ├── testing.go │ │ │ │ └── winrm.go │ │ │ └── config │ │ │ │ └── decode.go │ │ ├── packer │ │ │ ├── artifact.go │ │ │ ├── artifact_mock.go │ │ │ ├── build.go │ │ │ ├── builder.go │ │ │ ├── builder_mock.go │ │ │ ├── cache.go │ │ │ ├── communicator.go │ │ │ ├── communicator_mock.go │ │ │ ├── config_file.go │ │ │ ├── config_file_unix.go │ │ │ ├── config_file_windows.go │ │ │ ├── core.go │ │ │ ├── hook.go │ │ │ ├── hook_mock.go │ │ │ ├── multi_error.go │ │ │ ├── plugin │ │ │ │ ├── builder.go │ │ │ │ ├── client.go │ │ │ │ ├── hook.go │ │ │ │ ├── post_processor.go │ │ │ │ ├── provisioner.go │ │ │ │ └── server.go │ │ │ ├── post_processor.go │ │ │ ├── post_processor_mock.go │ │ │ ├── provisioner.go │ │ │ ├── provisioner_mock.go │ │ │ ├── rpc │ │ │ │ ├── artifact.go │ │ │ │ ├── build.go │ │ │ │ ├── builder.go │ │ │ │ ├── cache.go │ │ │ │ ├── client.go │ │ │ │ ├── communicator.go │ │ │ │ ├── dial.go │ │ │ │ ├── error.go │ │ │ │ ├── hook.go │ │ │ │ ├── init.go │ │ │ │ ├── mux_broker.go │ │ │ │ ├── post_processor.go │ │ │ │ ├── provisioner.go │ │ │ │ ├── server.go │ │ │ │ └── ui.go │ │ │ ├── testing.go │ │ │ └── ui.go │ │ └── template │ │ │ ├── interpolate │ │ │ ├── funcs.go │ │ │ ├── i.go │ │ │ ├── parse.go │ │ │ └── render.go │ │ │ ├── parse.go │ │ │ └── template.go │ └── reflectwalk │ │ ├── LICENSE │ │ ├── README.md │ │ ├── location.go │ │ ├── location_string.go │ │ └── reflectwalk.go ├── nilshell │ └── xmlrpc │ │ ├── .gitignore │ │ ├── client.go │ │ ├── doc.go │ │ ├── request.go │ │ ├── response.go │ │ ├── result.go │ │ └── xmlrpc.go ├── nu7hatch │ └── gouuid │ │ ├── .gitignore │ │ ├── COPYING │ │ ├── README.md │ │ └── uuid.go ├── packer-community │ └── winrmcp │ │ ├── LICENSE │ │ └── winrmcp │ │ ├── cp.go │ │ ├── endpoint.go │ │ ├── ls.go │ │ ├── path.go │ │ ├── psobject.go │ │ └── winrmcp.go ├── pkg │ ├── errors │ │ ├── .gitignore │ │ ├── .travis.yml │ │ ├── LICENSE │ │ ├── README.md │ │ ├── appveyor.yml │ │ ├── errors.go │ │ └── stack.go │ └── sftp │ │ ├── .gitignore │ │ ├── .travis.yml │ │ ├── CONTRIBUTORS │ │ ├── LICENSE │ │ ├── README.md │ │ ├── attrs.go │ │ ├── attrs_stubs.go │ │ ├── attrs_unix.go │ │ ├── client.go │ │ ├── conn.go │ │ ├── debug.go │ │ ├── packet.go │ │ ├── release.go │ │ ├── server.go │ │ ├── server_statvfs_darwin.go │ │ ├── server_statvfs_impl.go │ │ ├── server_statvfs_linux.go │ │ ├── server_statvfs_stubs.go │ │ ├── server_stubs.go │ │ ├── server_unix.go │ │ └── sftp.go ├── satori │ └── go.uuid │ │ ├── .travis.yml │ │ ├── LICENSE │ │ ├── README.md │ │ └── uuid.go ├── svanharmelen │ └── gocs │ │ ├── .gitignore │ │ ├── LICENSE │ │ ├── README.md │ │ ├── cache.go │ │ ├── doc.go │ │ ├── gocs.go │ │ ├── params.go │ │ └── unmarshaler.go ├── ugorji │ └── go │ │ ├── LICENSE │ │ └── codec │ │ ├── 0doc.go │ │ ├── README.md │ │ ├── binc.go │ │ ├── cbor.go │ │ ├── decode.go │ │ ├── encode.go │ │ ├── fast-path.generated.go │ │ ├── fast-path.go.tmpl │ │ ├── fast-path.not.go │ │ ├── gen-dec-array.go.tmpl │ │ ├── gen-dec-map.go.tmpl │ │ ├── gen-helper.generated.go │ │ ├── gen-helper.go.tmpl │ │ ├── gen.generated.go │ │ ├── gen.go │ │ ├── helper.go │ │ ├── helper_internal.go │ │ ├── helper_not_unsafe.go │ │ ├── helper_unsafe.go │ │ ├── json.go │ │ ├── msgpack.go │ │ ├── noop.go │ │ ├── prebuild.go │ │ ├── prebuild.sh │ │ ├── rpc.go │ │ ├── simple.go │ │ ├── test-cbor-goldens.json │ │ ├── test.py │ │ ├── tests.sh │ │ └── time.go ├── xenserver │ └── go-xenserver-client │ │ ├── .travis.yml │ │ ├── LICENCE │ │ ├── README.md │ │ ├── client.go │ │ ├── host.go │ │ ├── network.go │ │ ├── pif.go │ │ ├── pool.go │ │ ├── sr.go │ │ ├── task.go │ │ ├── vbd.go │ │ ├── vdi.go │ │ ├── vif.go │ │ └── vm.go └── xenserverarmy │ ├── go-osglance │ ├── LICENSE │ ├── identity │ │ └── v2 │ │ │ └── auth.go │ ├── image │ │ └── v1 │ │ │ └── image.go │ └── misc │ │ ├── rfc8601DateTime.go │ │ └── util.go │ └── go-vnc │ ├── LICENSE │ ├── README.md │ ├── client.go │ ├── client_auth.go │ ├── color.go │ ├── encoding.go │ ├── pixel_format.go │ ├── pointer.go │ └── server_messages.go └── golang.org └── x ├── crypto ├── LICENSE ├── PATENTS ├── curve25519 │ ├── const_amd64.s │ ├── cswap_amd64.s │ ├── curve25519.go │ ├── doc.go │ ├── freeze_amd64.s │ ├── ladderstep_amd64.s │ ├── mont25519_amd64.go │ ├── mul_amd64.s │ └── square_amd64.s └── ssh │ ├── agent │ ├── client.go │ ├── forward.go │ ├── keyring.go │ └── server.go │ ├── buffer.go │ ├── certs.go │ ├── channel.go │ ├── cipher.go │ ├── client.go │ ├── client_auth.go │ ├── common.go │ ├── connection.go │ ├── doc.go │ ├── handshake.go │ ├── kex.go │ ├── keys.go │ ├── mac.go │ ├── messages.go │ ├── mux.go │ ├── server.go │ ├── session.go │ ├── tcpip.go │ └── transport.go └── sys ├── LICENSE ├── PATENTS └── unix ├── .gitignore ├── asm.s ├── asm_darwin_386.s ├── asm_darwin_amd64.s ├── asm_darwin_arm.s ├── asm_darwin_arm64.s ├── asm_dragonfly_386.s ├── asm_dragonfly_amd64.s ├── asm_freebsd_386.s ├── asm_freebsd_amd64.s ├── asm_freebsd_arm.s ├── asm_linux_386.s ├── asm_linux_amd64.s ├── asm_linux_arm.s ├── asm_linux_arm64.s ├── asm_linux_ppc64x.s ├── asm_netbsd_386.s ├── asm_netbsd_amd64.s ├── asm_netbsd_arm.s ├── asm_openbsd_386.s ├── asm_openbsd_amd64.s ├── asm_solaris_amd64.s ├── constants.go ├── env_unix.go ├── env_unset.go ├── flock.go ├── flock_linux_32bit.go ├── gccgo.go ├── gccgo_c.c ├── gccgo_linux_amd64.go ├── mkall.sh ├── mkerrors.sh ├── mksyscall.pl ├── mksyscall_solaris.pl ├── mksysctl_openbsd.pl ├── mksysnum_darwin.pl ├── mksysnum_dragonfly.pl ├── mksysnum_freebsd.pl ├── mksysnum_linux.pl ├── mksysnum_netbsd.pl ├── mksysnum_openbsd.pl ├── race.go ├── race0.go ├── sockcmsg_linux.go ├── sockcmsg_unix.go ├── str.go ├── syscall.go ├── syscall_bsd.go ├── syscall_darwin.go ├── syscall_darwin_386.go ├── syscall_darwin_amd64.go ├── syscall_darwin_arm.go ├── syscall_darwin_arm64.go ├── syscall_dragonfly.go ├── syscall_dragonfly_386.go ├── syscall_dragonfly_amd64.go ├── syscall_freebsd.go ├── syscall_freebsd_386.go ├── syscall_freebsd_amd64.go ├── syscall_freebsd_arm.go ├── syscall_linux.go ├── syscall_linux_386.go ├── syscall_linux_amd64.go ├── syscall_linux_arm.go ├── syscall_linux_arm64.go ├── syscall_linux_ppc64x.go ├── syscall_netbsd.go ├── syscall_netbsd_386.go ├── syscall_netbsd_amd64.go ├── syscall_netbsd_arm.go ├── syscall_no_getwd.go ├── syscall_openbsd.go ├── syscall_openbsd_386.go ├── syscall_openbsd_amd64.go ├── syscall_solaris.go ├── syscall_solaris_amd64.go ├── syscall_unix.go ├── types_darwin.go ├── types_dragonfly.go ├── types_freebsd.go ├── types_linux.go ├── types_netbsd.go ├── types_openbsd.go ├── types_solaris.go ├── zerrors_darwin_386.go ├── zerrors_darwin_amd64.go ├── zerrors_darwin_arm.go ├── zerrors_darwin_arm64.go ├── zerrors_dragonfly_386.go ├── zerrors_dragonfly_amd64.go ├── zerrors_freebsd_386.go ├── zerrors_freebsd_amd64.go ├── zerrors_freebsd_arm.go ├── zerrors_linux_386.go ├── zerrors_linux_amd64.go ├── zerrors_linux_arm.go ├── zerrors_linux_arm64.go ├── zerrors_linux_ppc64.go ├── zerrors_linux_ppc64le.go ├── zerrors_netbsd_386.go ├── zerrors_netbsd_amd64.go ├── zerrors_netbsd_arm.go ├── zerrors_openbsd_386.go ├── zerrors_openbsd_amd64.go ├── zerrors_solaris_amd64.go ├── zsyscall_darwin_386.go ├── zsyscall_darwin_amd64.go ├── zsyscall_darwin_arm.go ├── zsyscall_darwin_arm64.go ├── zsyscall_dragonfly_386.go ├── zsyscall_dragonfly_amd64.go ├── zsyscall_freebsd_386.go ├── zsyscall_freebsd_amd64.go ├── zsyscall_freebsd_arm.go ├── zsyscall_linux_386.go ├── zsyscall_linux_amd64.go ├── zsyscall_linux_arm.go ├── zsyscall_linux_arm64.go ├── zsyscall_linux_ppc64.go ├── zsyscall_linux_ppc64le.go ├── zsyscall_netbsd_386.go ├── zsyscall_netbsd_amd64.go ├── zsyscall_netbsd_arm.go ├── zsyscall_openbsd_386.go ├── zsyscall_openbsd_amd64.go ├── zsyscall_solaris_amd64.go ├── zsysctl_openbsd.go ├── zsysnum_darwin_386.go ├── zsysnum_darwin_amd64.go ├── zsysnum_darwin_arm.go ├── zsysnum_darwin_arm64.go ├── zsysnum_dragonfly_386.go ├── zsysnum_dragonfly_amd64.go ├── zsysnum_freebsd_386.go ├── zsysnum_freebsd_amd64.go ├── zsysnum_freebsd_arm.go ├── zsysnum_linux_386.go ├── zsysnum_linux_amd64.go ├── zsysnum_linux_arm.go ├── zsysnum_linux_arm64.go ├── zsysnum_linux_ppc64.go ├── zsysnum_linux_ppc64le.go ├── zsysnum_netbsd_386.go ├── zsysnum_netbsd_amd64.go ├── zsysnum_netbsd_arm.go ├── zsysnum_openbsd_386.go ├── zsysnum_openbsd_amd64.go ├── zsysnum_solaris_amd64.go ├── ztypes_darwin_386.go ├── ztypes_darwin_amd64.go ├── ztypes_darwin_arm.go ├── ztypes_darwin_arm64.go ├── ztypes_dragonfly_386.go ├── ztypes_dragonfly_amd64.go ├── ztypes_freebsd_386.go ├── ztypes_freebsd_amd64.go ├── ztypes_freebsd_arm.go ├── ztypes_linux_386.go ├── ztypes_linux_amd64.go ├── ztypes_linux_arm.go ├── ztypes_linux_arm64.go ├── ztypes_linux_ppc64.go ├── ztypes_linux_ppc64le.go ├── ztypes_netbsd_386.go ├── ztypes_netbsd_amd64.go ├── ztypes_netbsd_arm.go ├── ztypes_openbsd_386.go ├── ztypes_openbsd_amd64.go └── ztypes_solaris_amd64.go /.gitignore: -------------------------------------------------------------------------------- 1 | *.swp 2 | *~ 3 | /bin 4 | /pkg 5 | -------------------------------------------------------------------------------- /Godeps/Readme: -------------------------------------------------------------------------------- 1 | This directory tree is generated automatically by godep. 2 | 3 | Please do not edit. 4 | 5 | See https://github.com/tools/godep for more information. 6 | -------------------------------------------------------------------------------- /build.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | # 3 | # This script builds the application from source for multiple platforms. 4 | # Adapted from from packer/scripts/build.sh 5 | 6 | # Determine the arch/os combos we're building for 7 | XC_OS=${XC_OS:-$(go env GOOS)} 8 | XC_ARCH=${XC_ARCH:-$(go env GOARCH)} 9 | GOPATH=${GOPATH:-$(go env GOPATH)} 10 | 11 | # Install dependencies 12 | 13 | # Delete the old dir 14 | echo "==> Removing old directory..." 15 | rm -f bin/* 16 | rm -rf pkg/* 17 | rm -rf ${GOPATH}/pkg/* 18 | mkdir -p bin/ 19 | 20 | # Install gox, if not already present 21 | go get github.com/mitchellh/gox 22 | 23 | gox \ 24 | -os="${XC_OS}" \ 25 | -arch="${XC_ARCH}" \ 26 | -output "pkg/{{.OS}}_{{.Arch}}/packer-{{.Dir}}" \ 27 | ./... \ 28 | || exit 1 29 | 30 | # Move all the compiled things to the $GOPATH/bin 31 | case $(uname) in 32 | CYGWIN*) 33 | GOPATH="$(cygpath $GOPATH)" 34 | ;; 35 | esac 36 | OLDIFS=$IFS 37 | IFS=: MAIN_GOPATH=($GOPATH) 38 | IFS=$OLDIFS 39 | 40 | # Copy our OS/Arch to the bin/ directory 41 | echo "==> Copying binaries for this platform..." 42 | DEV_PLATFORM="./pkg/$(go env GOOS)_$(go env GOARCH)" 43 | for F in $(find ${DEV_PLATFORM} -mindepth 1 -maxdepth 1 -type f); do 44 | cp -v ${F} bin/ 45 | cp -v ${F} ${MAIN_GOPATH}/bin/ 46 | done 47 | 48 | # Done! 49 | echo 50 | echo "==> Results:" 51 | ls -ahl bin/ 52 | -------------------------------------------------------------------------------- /builder/xenserver/common/artifact.go: -------------------------------------------------------------------------------- 1 | package common 2 | 3 | import ( 4 | "fmt" 5 | "github.com/mitchellh/packer/packer" 6 | "os" 7 | ) 8 | 9 | // This is the common builder ID to all of these artifacts. 10 | const BuilderId = "packer.xenserver" 11 | 12 | type LocalArtifact struct { 13 | dir string 14 | f []string 15 | state map[string]interface{} 16 | } 17 | 18 | func NewArtifact(dir string, state map[string]interface{}, files []string) (packer.Artifact, error) { 19 | return &LocalArtifact{ 20 | dir: dir, 21 | f: files, 22 | state: state, 23 | }, nil 24 | } 25 | 26 | func (*LocalArtifact) BuilderId() string { 27 | return BuilderId 28 | } 29 | 30 | func (a *LocalArtifact) Files() []string { 31 | return a.f 32 | } 33 | 34 | func (*LocalArtifact) Id() string { 35 | return "VM" 36 | } 37 | 38 | func (a *LocalArtifact) String() string { 39 | return fmt.Sprintf("VM files in directory: %s", a.dir) 40 | } 41 | 42 | func (a *LocalArtifact) State(name string) interface{} { 43 | return a.state[name] 44 | } 45 | 46 | func (a *LocalArtifact) Destroy() error { 47 | return os.RemoveAll(a.dir) 48 | } 49 | -------------------------------------------------------------------------------- /builder/xenserver/common/find_port.go: -------------------------------------------------------------------------------- 1 | package common 2 | 3 | import ( 4 | "fmt" 5 | "log" 6 | "net" 7 | ) 8 | 9 | // FindPort finds and starts listening on a port in the range [portMin, portMax] 10 | // returns the listener and the port number on success, or nil, 0 on failure 11 | func FindPort(portMin uint, portMax uint) (net.Listener, uint) { 12 | log.Printf("Looking for an available port between %d and %d", portMin, portMax) 13 | 14 | for port := portMin; port <= portMax; port++ { 15 | log.Printf("Trying port: %d", port) 16 | l, err := net.Listen("tcp", fmt.Sprintf(":%d", port)) 17 | if err == nil { 18 | return l, port 19 | } else { 20 | log.Printf("Port %d unavailable: %s", port, err.Error()) 21 | } 22 | } 23 | 24 | return nil, 0 25 | } 26 | -------------------------------------------------------------------------------- /builder/xenserver/common/find_resident_host.go: -------------------------------------------------------------------------------- 1 | package common 2 | 3 | import ( 4 | "fmt" 5 | "github.com/mitchellh/multistep" 6 | "github.com/mitchellh/packer/packer" 7 | xsclient "github.com/xenserver/go-xenserver-client" 8 | ) 9 | 10 | func FindResidentHost (state multistep.StateBag, instance *xsclient.VM, uuid string) (err error) { 11 | 12 | ui := state.Get("ui").(packer.Ui) 13 | 14 | domid, err := instance.GetDomainId() 15 | if err != nil { 16 | ui.Error(fmt.Sprintf("Unable to get domid of VM with UUID '%s': %s", uuid, err.Error())) 17 | return err 18 | } 19 | state.Put("domid", domid) 20 | 21 | // we are connected to a given host, but that might not be where the VM is running 22 | host, err := instance.GetResidentOn() 23 | if err != nil { 24 | ui.Error(fmt.Sprintf("Unable to determine what host the VM is running on: %s", err.Error())) 25 | return err 26 | } 27 | 28 | hostAddress, err := host.GetAddress() 29 | if err != nil { 30 | ui.Error(fmt.Sprintf("Unable to determine the IP of the host: %s", err.Error())) 31 | return err 32 | } 33 | 34 | 35 | ui.Message(fmt.Sprintf("VM '%s' is running on host with address '%s'", uuid, hostAddress)) 36 | 37 | config := state.Get("commonconfig").(CommonConfig) 38 | config.HostIp = hostAddress 39 | state.Put("commonconfig", config) 40 | 41 | return nil 42 | 43 | } 44 | 45 | -------------------------------------------------------------------------------- /builder/xenserver/common/ssh_config.go: -------------------------------------------------------------------------------- 1 | package common 2 | 3 | import ( 4 | "errors" 5 | "time" 6 | 7 | "github.com/mitchellh/packer/helper/communicator" 8 | "github.com/mitchellh/packer/template/interpolate" 9 | ) 10 | 11 | type SSHConfig struct { 12 | Comm communicator.Config `mapstructure:",squash"` 13 | 14 | SSHHostPortMin uint `mapstructure:"ssh_host_port_min"` 15 | SSHHostPortMax uint `mapstructure:"ssh_host_port_max"` 16 | SSHSkipNatMapping bool `mapstructure:"ssh_skip_nat_mapping"` 17 | 18 | // These are deprecated, but we keep them around for BC 19 | // TODO(@mitchellh): remove 20 | SSHKeyPath string `mapstructure:"ssh_key_path"` 21 | SSHWaitTimeout time.Duration `mapstructure:"ssh_wait_timeout"` 22 | } 23 | 24 | func (c *SSHConfig) Prepare(ctx *interpolate.Context) []error { 25 | if c.SSHHostPortMin == 0 { 26 | c.SSHHostPortMin = 2222 27 | } 28 | 29 | if c.SSHHostPortMax == 0 { 30 | c.SSHHostPortMax = 4444 31 | } 32 | 33 | // TODO: backwards compatibility, write fixer instead 34 | if c.SSHKeyPath != "" { 35 | c.Comm.SSHPrivateKey = c.SSHKeyPath 36 | } 37 | if c.SSHWaitTimeout != 0 { 38 | c.Comm.SSHTimeout = c.SSHWaitTimeout 39 | } 40 | 41 | errs := c.Comm.Prepare(ctx) 42 | if c.SSHHostPortMin > c.SSHHostPortMax { 43 | errs = append(errs, 44 | errors.New("ssh_host_port_min must be less than ssh_host_port_max")) 45 | } 46 | 47 | return errs 48 | } 49 | -------------------------------------------------------------------------------- /builder/xenserver/common/step_boot_wait.go: -------------------------------------------------------------------------------- 1 | package common 2 | 3 | import ( 4 | "fmt" 5 | "strings" 6 | "github.com/mitchellh/multistep" 7 | "github.com/mitchellh/packer/packer" 8 | xsclient "github.com/xenserver/go-xenserver-client" 9 | ) 10 | 11 | type StepBootWait struct{} 12 | 13 | func (self *StepBootWait) Run(state multistep.StateBag) multistep.StepAction { 14 | client := state.Get("client").(xsclient.XenAPIClient) 15 | config := state.Get("commonconfig").(CommonConfig) 16 | ui := state.Get("ui").(packer.Ui) 17 | 18 | instance, _ := client.GetVMByUuid(state.Get("instance_uuid").(string)) 19 | 20 | powerState, _ := instance.GetPowerState() 21 | switch strings.ToLower(powerState) { 22 | case "halted": 23 | ui.Say("Starting VM " + state.Get("instance_uuid").(string)) 24 | instance.Start(false, false) 25 | 26 | case "paused": 27 | ui.Say("Unpaused VM " + state.Get("instance_uuid").(string)) 28 | instance.Unpause() 29 | 30 | case "suspended": 31 | ui.Say("Resuming VM " + state.Get("instance_uuid").(string)) 32 | instance.Resume(false, false) 33 | 34 | /* case "running": 35 | ui.Error("VM " + state.Get("instance_uuid").(string) + " is already running") 36 | instance.Unpause() 37 | */ 38 | 39 | } 40 | 41 | if int64(config.BootWait) > 0 { 42 | ui.Say(fmt.Sprintf("Waiting %s for boot...", config.BootWait)) 43 | err := InterruptibleWait{Timeout: config.BootWait}.Wait(state) 44 | if err != nil { 45 | ui.Error(err.Error()) 46 | return multistep.ActionHalt 47 | } 48 | } 49 | return multistep.ActionContinue 50 | } 51 | 52 | func (self *StepBootWait) Cleanup(state multistep.StateBag) {} 53 | -------------------------------------------------------------------------------- /builder/xenserver/common/step_detach_vdi.go: -------------------------------------------------------------------------------- 1 | package common 2 | 3 | import ( 4 | "fmt" 5 | "github.com/mitchellh/multistep" 6 | "github.com/mitchellh/packer/packer" 7 | xsclient "github.com/xenserver/go-xenserver-client" 8 | "log" 9 | ) 10 | 11 | type StepDetachVdi struct { 12 | VdiUuidKey string 13 | } 14 | 15 | func (self *StepDetachVdi) Run(state multistep.StateBag) multistep.StepAction { 16 | ui := state.Get("ui").(packer.Ui) 17 | client := state.Get("client").(xsclient.XenAPIClient) 18 | 19 | var vdiUuid string 20 | if vdiUuidRaw, ok := state.GetOk(self.VdiUuidKey); ok { 21 | vdiUuid = vdiUuidRaw.(string) 22 | } else { 23 | log.Printf("Skipping detach of '%s'", self.VdiUuidKey) 24 | return multistep.ActionContinue 25 | } 26 | 27 | vdi, err := client.GetVdiByUuid(vdiUuid) 28 | if err != nil { 29 | ui.Error(fmt.Sprintf("Unable to get VDI from UUID '%s': %s", vdiUuid, err.Error())) 30 | return multistep.ActionHalt 31 | } 32 | 33 | uuid := state.Get("instance_uuid").(string) 34 | instance, err := client.GetVMByUuid(uuid) 35 | if err != nil { 36 | ui.Error(fmt.Sprintf("Unable to get VM from UUID '%s': %s", uuid, err.Error())) 37 | return multistep.ActionHalt 38 | } 39 | 40 | err = instance.DisconnectVdi(vdi) 41 | if err != nil { 42 | ui.Error(fmt.Sprintf("Unable to detach VDI '%s': %s", vdiUuid, err.Error())) 43 | //return multistep.ActionHalt 44 | return multistep.ActionContinue 45 | } 46 | 47 | log.Printf("Detached VDI '%s'", vdiUuid) 48 | 49 | return multistep.ActionContinue 50 | } 51 | 52 | func (self *StepDetachVdi) Cleanup(state multistep.StateBag) {} 53 | -------------------------------------------------------------------------------- /builder/xenserver/common/step_find_vdi.go: -------------------------------------------------------------------------------- 1 | package common 2 | 3 | import ( 4 | "fmt" 5 | "github.com/mitchellh/multistep" 6 | "github.com/mitchellh/packer/packer" 7 | xsclient "github.com/xenserver/go-xenserver-client" 8 | ) 9 | 10 | type StepFindVdi struct { 11 | VdiName string 12 | ImagePathFunc func() string 13 | VdiUuidKey string 14 | } 15 | 16 | func (self *StepFindVdi) Run(state multistep.StateBag) multistep.StepAction { 17 | ui := state.Get("ui").(packer.Ui) 18 | client := state.Get("client").(xsclient.XenAPIClient) 19 | 20 | // Ignore if VdiName is not specified 21 | if self.VdiName == "" { 22 | return multistep.ActionContinue 23 | } 24 | vdis, err := client.GetVdiByNameLabel(self.VdiName) 25 | 26 | switch { 27 | case len(vdis) == 0: 28 | ui.Error(fmt.Sprintf("Couldn't find a VDI named '%s'", self.VdiName)) 29 | return multistep.ActionHalt 30 | case len(vdis) > 1: 31 | ui.Error(fmt.Sprintf("Found more than one VDI with name '%s'. Name must be unique", self.VdiName)) 32 | return multistep.ActionHalt 33 | } 34 | 35 | vdi := vdis[0] 36 | 37 | vdiUuid, err := vdi.GetUuid() 38 | if err != nil { 39 | ui.Error(fmt.Sprintf("Unable to get UUID of VDI '%s': %s", self.VdiName, err.Error())) 40 | return multistep.ActionHalt 41 | } 42 | state.Put(self.VdiUuidKey, vdiUuid) 43 | 44 | return multistep.ActionContinue 45 | } 46 | 47 | func (self *StepFindVdi) Cleanup(state multistep.StateBag) {} 48 | -------------------------------------------------------------------------------- /builder/xenserver/common/step_forward_port_over_ssh.go: -------------------------------------------------------------------------------- 1 | package common 2 | 3 | import ( 4 | "fmt" 5 | "github.com/mitchellh/multistep" 6 | "github.com/mitchellh/packer/packer" 7 | ) 8 | 9 | type StepForwardPortOverSSH struct { 10 | RemotePort func(state multistep.StateBag) (uint, error) 11 | RemoteDest func(state multistep.StateBag) (string, error) 12 | 13 | HostPortMin uint 14 | HostPortMax uint 15 | 16 | ResultKey string 17 | } 18 | 19 | func (self *StepForwardPortOverSSH) Run(state multistep.StateBag) multistep.StepAction { 20 | 21 | config := state.Get("commonconfig").(CommonConfig) 22 | ui := state.Get("ui").(packer.Ui) 23 | 24 | // Find a free local port: 25 | 26 | l, sshHostPort := FindPort(self.HostPortMin, self.HostPortMax) 27 | 28 | if l == nil || sshHostPort == 0 { 29 | ui.Error("Error: unable to find free host port. Try providing a larger range [host_port_min, host_port_max]") 30 | return multistep.ActionHalt 31 | } 32 | 33 | ui.Say(fmt.Sprintf("Creating a local port forward over SSH on local port %d", sshHostPort)) 34 | 35 | remotePort, _ := self.RemotePort(state) 36 | remoteDest, _ := self.RemoteDest(state) 37 | 38 | go ssh_port_forward(l, remotePort, remoteDest, config.HostIp, config.Username, config.Password) 39 | ui.Say(fmt.Sprintf("Port forward setup. %d ---> %s:%d on %s", sshHostPort, remoteDest, remotePort, config.HostIp)) 40 | 41 | // Provide the local port to future steps. 42 | state.Put(self.ResultKey, sshHostPort) 43 | 44 | return multistep.ActionContinue 45 | } 46 | 47 | func (self *StepForwardPortOverSSH) Cleanup(state multistep.StateBag) {} 48 | -------------------------------------------------------------------------------- /builder/xenserver/common/step_get_vnc_port.go: -------------------------------------------------------------------------------- 1 | package common 2 | 3 | import ( 4 | "fmt" 5 | "github.com/mitchellh/multistep" 6 | "github.com/mitchellh/packer/packer" 7 | "strconv" 8 | ) 9 | 10 | type StepGetVNCPort struct{} 11 | 12 | func (self *StepGetVNCPort) Run(state multistep.StateBag) multistep.StepAction { 13 | ui := state.Get("ui").(packer.Ui) 14 | 15 | ui.Say("Step: forward the instances VNC port over SSH") 16 | domid := state.Get("domid").(string) 17 | cmd := fmt.Sprintf("xenstore-read /local/domain/%s/console/vnc-port", domid) 18 | 19 | ui.Message(fmt.Sprintf("Finding vnc-port for domain '%s'", domid)) 20 | 21 | remote_vncport, err := ExecuteHostSSHCmd(state, cmd) 22 | if err != nil { 23 | ui.Error(fmt.Sprintf("Unable to get VNC port (is the VM running?): %s", err.Error())) 24 | return multistep.ActionHalt 25 | } 26 | 27 | remote_port, err := strconv.ParseUint(remote_vncport, 10, 16) 28 | 29 | if err != nil { 30 | ui.Error(fmt.Sprintf("Unable to convert '%s' to an int", remote_vncport)) 31 | ui.Error(err.Error()) 32 | return multistep.ActionHalt 33 | } 34 | 35 | state.Put("instance_vnc_port", uint(remote_port)) 36 | 37 | return multistep.ActionContinue 38 | } 39 | 40 | func (self *StepGetVNCPort) Cleanup(state multistep.StateBag) { 41 | } 42 | 43 | func InstanceVNCPort(state multistep.StateBag) (uint, error) { 44 | vncPort := state.Get("instance_vnc_port").(uint) 45 | return vncPort, nil 46 | } 47 | 48 | func InstanceVNCIP(state multistep.StateBag) (string, error) { 49 | // The port is in Dom0, so we want to forward from localhost 50 | return "127.0.0.1", nil 51 | } 52 | -------------------------------------------------------------------------------- /builder/xenserver/common/step_prepare_output_dir.go: -------------------------------------------------------------------------------- 1 | package common 2 | 3 | /* Taken from https://raw.githubusercontent.com/mitchellh/packer/master/builder/qemu/step_prepare_output_dir.go */ 4 | 5 | import ( 6 | "github.com/mitchellh/multistep" 7 | "github.com/mitchellh/packer/packer" 8 | "log" 9 | "os" 10 | "time" 11 | ) 12 | 13 | type StepPrepareOutputDir struct { 14 | Force bool 15 | Path string 16 | } 17 | 18 | func (self *StepPrepareOutputDir) Run(state multistep.StateBag) multistep.StepAction { 19 | ui := state.Get("ui").(packer.Ui) 20 | 21 | if _, err := os.Stat(self.Path); err == nil && self.Force { 22 | ui.Say("Deleting previous output directory...") 23 | os.RemoveAll(self.Path) 24 | } 25 | 26 | if err := os.MkdirAll(self.Path, 0755); err != nil { 27 | state.Put("error", err) 28 | return multistep.ActionHalt 29 | } 30 | 31 | return multistep.ActionContinue 32 | } 33 | 34 | func (self *StepPrepareOutputDir) Cleanup(state multistep.StateBag) { 35 | _, cancelled := state.GetOk(multistep.StateCancelled) 36 | _, halted := state.GetOk(multistep.StateHalted) 37 | 38 | if cancelled || halted { 39 | ui := state.Get("ui").(packer.Ui) 40 | 41 | ui.Say("Deleting output directory...") 42 | for i := 0; i < 5; i++ { 43 | err := os.RemoveAll(self.Path) 44 | if err == nil { 45 | break 46 | } 47 | 48 | log.Printf("Error removing output dir: %s", err) 49 | time.Sleep(2 * time.Second) 50 | } 51 | } 52 | } 53 | -------------------------------------------------------------------------------- /builder/xenserver/common/step_wait_for_shutdown.go: -------------------------------------------------------------------------------- 1 | package common 2 | 3 | import ( 4 | "fmt" 5 | "github.com/mitchellh/multistep" 6 | "github.com/mitchellh/packer/packer" 7 | "time" 8 | xsclient "github.com/xenserver/go-xenserver-client" 9 | ) 10 | 11 | type StepWaitForShutdown struct{} 12 | 13 | func (StepWaitForShutdown) Run(state multistep.StateBag) multistep.StepAction { 14 | //config := state.Get("commonconfig").(CommonConfig) 15 | ui := state.Get("ui").(packer.Ui) 16 | 17 | ui.Say("Step: Waiting for installer to shutdown VM.") 18 | 19 | client := state.Get("client").(xsclient.XenAPIClient) 20 | instance_uuid := state.Get("instance_uuid").(string) 21 | 22 | instance, err := client.GetVMByUuid(instance_uuid) 23 | if err != nil { 24 | ui.Error(fmt.Sprintf("Could not get VM with UUID '%s': %s", instance_uuid, err.Error())) 25 | return multistep.ActionHalt 26 | } 27 | 28 | func() { 29 | err = InterruptibleWait{ 30 | Predicate: func() (bool, error) { 31 | power_state, err := instance.GetPowerState() 32 | return power_state == "Halted", err 33 | }, 34 | PredicateInterval: 20 * time.Second, 35 | Timeout: 3000 * time.Second, 36 | }.Wait(state) 37 | 38 | if err != nil { 39 | ui.Error(fmt.Sprintf("Error waiting for VM installer to halt: %s", err.Error())) 40 | } 41 | 42 | }() 43 | 44 | return multistep.ActionContinue 45 | } 46 | 47 | func (StepWaitForShutdown) Cleanup(state multistep.StateBag) {} 48 | -------------------------------------------------------------------------------- /builder/xenserver/vm/builder_test.go: -------------------------------------------------------------------------------- 1 | package vm 2 | -------------------------------------------------------------------------------- /builder/xenserver/vm/step_copy_clean_script.go: -------------------------------------------------------------------------------- 1 | package vm 2 | 3 | import ( 4 | "fmt" 5 | 6 | "github.com/mitchellh/multistep" 7 | "github.com/mitchellh/packer/packer" 8 | xscommon "github.com/xenserverarmy/packer/builder/xenserver/common" 9 | ) 10 | 11 | type stepCopyCleanScript struct { 12 | ScriptUrl string 13 | } 14 | 15 | func (self *stepCopyCleanScript) Run(state multistep.StateBag) multistep.StepAction { 16 | 17 | ui := state.Get("ui").(packer.Ui) 18 | 19 | ui.Say("Step: Copy clean script") 20 | 21 | err := xscommon.UploadFile ( state, "./scripts/packer-clean.sh", "/opt/xensource/www/packer-clean.sh", true) 22 | 23 | if err != nil { 24 | ui.Error(fmt.Sprintf("Error saving script on XenServer host '%s'.", err)) 25 | return multistep.ActionHalt 26 | } 27 | 28 | ui.Say("Script copy complete") 29 | 30 | return multistep.ActionContinue 31 | 32 | } 33 | 34 | func (self *stepCopyCleanScript) Cleanup(state multistep.StateBag) { 35 | 36 | ui := state.Get("ui").(packer.Ui) 37 | 38 | ui.Say("Step: Cleanup copy script") 39 | 40 | cmds := []string { 41 | "rm -f /opt/xensource/www/packer-clean.sh", 42 | } 43 | 44 | _, err := xscommon.ExecuteHostSSHCmds (state, cmds ) 45 | if err != nil { 46 | ui.Error(fmt.Sprintf("Error removing script on XenServer host '%s'.", err)) 47 | return 48 | } 49 | 50 | ui.Say("Script removal complete") 51 | 52 | return 53 | } 54 | 55 | -------------------------------------------------------------------------------- /examples/centos-6.6.json: -------------------------------------------------------------------------------- 1 | { 2 | "builders": [ 3 | { 4 | "type": "xenserver-iso", 5 | "remote_host": "your-server.example.com", 6 | "remote_username": "root", 7 | "remote_password": "password", 8 | 9 | "boot_command": [ 10 | " text ks=http://{{ .HTTPIP }}:{{ .HTTPPort }}/centos6-ks.cfg" 11 | ], 12 | "boot_wait": "10s", 13 | "http_directory": "http", 14 | "iso_name": "CentOS-6.6-x86_64-minimal.iso", 15 | "iso_sr": "CIFS ISO library", 16 | "script_url": "http://10.204.137.80/packer/xenserver/", 17 | "iso_url": "{{user `mirror`}}/6.6/isos/x86_64/CentOS-6.6-x86_64-minimal.iso", 18 | "output_directory": "packer-centos-6.6-x86_64-xenserver", 19 | "shutdown_command": "/sbin/halt", 20 | "ssh_username": "root", 21 | "ssh_password": "vmpassword", 22 | "ssh_wait_timeout": "10000s", 23 | "vm_name": "packer-centos-6.6-x86_64", 24 | "vm_description": "Build time: {{isotime}}", 25 | "vm_disks": [ 26 | ["rootvol", "40000"] 27 | ] 28 | } 29 | ], 30 | 31 | "variables": { 32 | "mirror": "http://www.mirrorservice.org/sites/mirror.centos.org" 33 | } 34 | } 35 | -------------------------------------------------------------------------------- /examples/centos-7.json: -------------------------------------------------------------------------------- 1 | { 2 | "builders": [ 3 | { 4 | "type": "xenserver-iso", 5 | "remote_host": "10.204.137.60", 6 | "remote_username": "root", 7 | "remote_password": "{{user `xenserver_password`}}", 8 | 9 | "boot_command": [ 10 | " ks=http://10.204.137.80/ks/centos7-ks.cfg" 11 | ], 12 | "boot_wait": "10s", 13 | "disk_size": 40960, 14 | "http_directory": "/var/www/html/packer", 15 | "iso_url": "http://mirrors.seas.harvard.edu/centos/7/isos/x86_64/CentOS-7-x86_64-Minimal-1503-01.iso", 16 | "iso_name": "CentOS-7-x86_64-Minimal-1503-01.iso", 17 | "iso_sr": "CIFS ISO library", 18 | "script_url": "http://10.204.137.80/packer/xenserver/", 19 | "output_directory": "centos-7-x86_64-xenserver-acs-minimal", 20 | "format": "vhd", 21 | "shutdown_command": "", 22 | "ssh_username": "root", 23 | "ssh_password": "Password1", 24 | "ssh_wait_timeout": "10000s", 25 | "sr_name": "NFS Packer", 26 | "vm_name": "packer-centos-7-x86_64-acs-minimal-template", 27 | "vm_memory": "8192", 28 | "vm_vcpus": 1, 29 | "nfs_mount": "10.204.136.41:/vol/exports/packer" 30 | } 31 | ], 32 | 33 | "variables": { 34 | "xenserver_password": "{{env `XS_PASS`}}" 35 | } 36 | } 37 | -------------------------------------------------------------------------------- /examples/debian-vm.json: -------------------------------------------------------------------------------- 1 | { 2 | "builders": [ 3 | { 4 | "type": "xenserver-vm", 5 | "remote_host": "10.204.136.32", 6 | "remote_username": "root", 7 | "remote_password": "{{user `xenserver_password`}}", 8 | 9 | "boot_command": [ 10 | "rootnsroot", 11 | "cp /etc/network/interfaces ./interfaces.bak", 12 | "vi ./interfaces.tmp", 13 | "iauto eth0iface eth0 inet dhcp", 14 | ":wq!", 15 | "cp ./interfaces.tmp /etc/network/interfaces", 16 | "ifdown eth0", 17 | "ifup eth0", 18 | "wget http://169.254.0.1/packer-clean.sh", 19 | "chmod +x packer-clean.sh", 20 | "./packer-clean.sh" 21 | ], 22 | "boot_wait": "180s", 23 | "http_directory": "/var/www/html/packer", 24 | "source_vm": "MySQLDB 01", 25 | 26 | "script_url": "http://10.204.137.80/packer/xenserver/", 27 | "output_directory": "/var/www/html/vhd", 28 | "format": "vhd", 29 | "shutdown_command": "", 30 | "ssh_username": "root", 31 | "ssh_password": "nsroot", 32 | "ssh_wait_timeout": "10000s", 33 | "sr_name": "NFS Packer", 34 | "vm_name": "packer-export-mysql01", 35 | "nfs_mount": "10.204.136.41:/vol/exports/packer" 36 | } 37 | ], 38 | 39 | "variables": { 40 | "xenserver_password": "{{env `XS_PASS`}}" 41 | } 42 | } 43 | -------------------------------------------------------------------------------- /examples/http/centos6-ks.cfg: -------------------------------------------------------------------------------- 1 | install 2 | cdrom 3 | lang en_US.UTF-8 4 | keyboard us 5 | unsupported_hardware 6 | network --bootproto=dhcp 7 | rootpw --iscrypted $1$DIlig7gp$FuhFdeHj.R1VrEzZsI4uo0 8 | firewall --disabled 9 | authconfig --enableshadow --passalgo=sha512 10 | selinux --permissive 11 | timezone UTC 12 | bootloader --location=mbr 13 | text 14 | skipx 15 | zerombr 16 | clearpart --all --initlabel 17 | autopart 18 | auth --useshadow --enablemd5 19 | firstboot --disabled 20 | reboot 21 | 22 | %packages --ignoremissing 23 | @Base 24 | @Core 25 | @Development Tools 26 | openssl-devel 27 | readline-devel 28 | zlib-devel 29 | kernel-devel 30 | vim 31 | wget 32 | %end 33 | 34 | %post 35 | yum -y update 36 | 37 | # setup a firstboot to get the tools installed 38 | echo -e "#!/bin/bash\n\nmkdir /mnt/xs-tools \nmount /dev/cdrom /mnt/xs-tools \n/mnt/xs-tools/Linux/install.sh -n\numount /mnt/xs-tools \nrm /etc/init.d/S99xs-tools.sh \nrm /etc/cron.d/xstools \nreboot" > /etc/init.d/S99xs-tools.sh 39 | chmod +x /etc/init.d/S99xs-tools.sh 40 | echo -e "@reboot root /etc/init.d/S99xs-tools.sh\n" > /etc/cron.d/xstools 41 | 42 | # update root certs 43 | wget -O/etc/pki/tls/certs/ca-bundle.crt http://curl.haxx.se/ca/cacert.pem 44 | 45 | # vagrant 46 | groupadd vagrant -g 999 47 | useradd vagrant -g vagrant -G wheel -u 900 -s /bin/bash 48 | echo "vagrant" | passwd --stdin vagrant 49 | 50 | # sudo 51 | echo "vagrant ALL=(ALL) NOPASSWD: ALL" >> /etc/sudoers 52 | sed -i "s/^.*requiretty/#Defaults requiretty/" /etc/sudoers 53 | %end 54 | -------------------------------------------------------------------------------- /examples/http/centos7-ks.cfg: -------------------------------------------------------------------------------- 1 | install 2 | cdrom 3 | lang en_US.UTF-8 4 | keyboard us 5 | network --activate --bootproto=dhcp 6 | timezone America/New_York 7 | auth --useshadow --enablemd5 8 | selinux --permissive 9 | firewall --disabled 10 | services --enabled=NetworkManager,sshd 11 | eula --agreed 12 | ignoredisk --only-use=xvda 13 | firstboot --disabled 14 | shutdown 15 | #unsupported_hardware 16 | bootloader --location=mbr 17 | zerombr 18 | clearpart --all --initlabel 19 | autopart 20 | rootpw --iscrypted $1$47y60Gfn$krfzoCGgpOBzgmYXCi3.7/ 21 | text 22 | skipx 23 | 24 | %packages --ignoremissing 25 | #@Base 26 | @Core 27 | #@Development Tools 28 | #openssl-devel 29 | #readline-devel 30 | #zlib-devel 31 | #kernel-devel 32 | #vim 33 | wget 34 | docker 35 | %end 36 | 37 | %post 38 | yum -y update 39 | 40 | # setup a firstboot to get the tools installed 41 | echo -e "#!/bin/bash\n\nmkdir /mnt/xs-tools \nmount /dev/cdrom /mnt/xs-tools \n/mnt/xs-tools/Linux/install.sh -n\numount /mnt/xs-tools \nrm /etc/init.d/S99xs-tools.sh \nrm /etc/cron.d/xstools \nreboot" > /etc/init.d/S99xs-tools.sh 42 | chmod +x /etc/init.d/S99xs-tools.sh 43 | echo -e "@reboot root /etc/init.d/S99xs-tools.sh\n" > /etc/cron.d/xstools 44 | 45 | # update root certs 46 | wget -O/etc/pki/tls/certs/ca-bundle.crt http://curl.haxx.se/ca/cacert.pem 47 | 48 | # vagrant 49 | #groupadd vagrant -g 999 50 | #useradd vagrant -g vagrant -G wheel -u 900 -s /bin/bash 51 | #echo "vagrant" | passwd --stdin vagrant 52 | 53 | # sudo 54 | #echo "vagrant ALL=(ALL) NOPASSWD: ALL" >> /etc/sudoers 55 | #sed -i "s/^.*requiretty/#Defaults requiretty/" /etc/sudoers 56 | 57 | %end 58 | -------------------------------------------------------------------------------- /html/acs/centos7-reset.sh: -------------------------------------------------------------------------------- 1 | # remove device rules 2 | rm -f /etc/udev/rules.d/70* 3 | rm -f /var/lib/dhcp/dhclient*.* 4 | rm -f /var/lib/dhclient/dhclient*.* 5 | rm -f /var/lib/NetworkManager/dhclient*.* 6 | 7 | # remove/clear generic log files 8 | cat /dev/null > /var/log/audit/audit.log 2>/dev/null 9 | cat /dev/null > /var/log/wtmp 2>/dev/null 10 | cat /dev/null > /var/log/messages 2>/dev/null 11 | logrotate -f /etc/logrotate.conf 2>/dev/null 12 | rm -f /var/log/*-* /var/log/*.gz 2>/dev/null 13 | 14 | #reset the hostname so we get it automatically upon template provisioning 15 | hostname localhost 16 | echo "localhost" > /etc/hostname 17 | 18 | #clear history 19 | cat /dev/null > ~/.bash_history && history -c && unset HISTFILE 20 | -------------------------------------------------------------------------------- /html/acs/cloud-set-guest-password.service: -------------------------------------------------------------------------------- 1 | [Unit] 2 | Description=CloudStack Password Modification Script 3 | Requires=network.target 4 | After=network.target 5 | 6 | [Service] 7 | Type=oneshot 8 | ExecStart=/usr/local/bin/cloud-set-guest-password.sh 9 | RemainAfterExit=yes 10 | 11 | [Install] 12 | WantedBy=multi-user.target 13 | 14 | -------------------------------------------------------------------------------- /html/xenserver/copyiso.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | # download an ISO to our library 3 | 4 | HOSTNAME=$(hostname) 5 | HOSTUUID=$(xe host-list name-label=$HOSTNAME --minimal) 6 | 7 | SRUUID=$(xe sr-list type=iso name-label="$1" --minimal) 8 | ISOPATH=$(xe pbd-list host-uuid=$HOSTUUID sr-uuid=$SRUUID params=device-config --minimal | egrep -o 'iso_path: /(.+);*$' | cut -d':' -f2 | tr -d '[[:space:]]') 9 | #echo "found $SRUUID path '$ISOPATH' for '$1'" 10 | 11 | DLPATH=$(echo "/var/run/sr-mount/$SRUUID$ISOPATH/$2") 12 | 13 | #Download only if this exists 14 | if ! [ -f $DLPATH ]; then 15 | curl -o $DLPATH $3 16 | fi 17 | 18 | -------------------------------------------------------------------------------- /plugin/builder-xenserver-iso/main.go: -------------------------------------------------------------------------------- 1 | package main 2 | 3 | import ( 4 | "github.com/mitchellh/packer/packer/plugin" 5 | "github.com/xenserverarmy/packer/builder/xenserver/iso" 6 | ) 7 | 8 | func main() { 9 | server, err := plugin.Server() 10 | if err != nil { 11 | panic(err) 12 | } 13 | server.RegisterBuilder(new(iso.Builder)) 14 | server.Serve() 15 | } 16 | -------------------------------------------------------------------------------- /plugin/builder-xenserver-vm/main.go: -------------------------------------------------------------------------------- 1 | package main 2 | 3 | import ( 4 | "github.com/mitchellh/packer/packer/plugin" 5 | "github.com/xenserverarmy/packer/builder/xenserver/vm" 6 | ) 7 | 8 | func main() { 9 | server, err := plugin.Server() 10 | if err != nil { 11 | panic(err) 12 | } 13 | server.RegisterBuilder(new(vm.Builder)) 14 | server.Serve() 15 | } 16 | -------------------------------------------------------------------------------- /plugin/builder-xenserver-xva/main.go: -------------------------------------------------------------------------------- 1 | package main 2 | 3 | import ( 4 | "github.com/mitchellh/packer/packer/plugin" 5 | "github.com/xenserverarmy/packer/builder/xenserver/xva" 6 | ) 7 | 8 | func main() { 9 | server, err := plugin.Server() 10 | if err != nil { 11 | panic(err) 12 | } 13 | server.RegisterBuilder(new(xva.Builder)) 14 | server.Serve() 15 | } 16 | -------------------------------------------------------------------------------- /plugin/post-processor-cloudstack-xenserver/main.go: -------------------------------------------------------------------------------- 1 | package main 2 | 3 | import ( 4 | "github.com/mitchellh/packer/packer/plugin" 5 | "github.com/xenserverarmy/packer/post-processor/cloudstack/xenserver" 6 | ) 7 | 8 | func main() { 9 | server, err := plugin.Server() 10 | if err != nil { 11 | panic(err) 12 | } 13 | server.RegisterPostProcessor(new(xenserver.PostProcessor)) 14 | server.Serve() 15 | } 16 | -------------------------------------------------------------------------------- /post-processor/cloudstack/xenserver/post-processor_test.go: -------------------------------------------------------------------------------- 1 | package xenserver 2 | -------------------------------------------------------------------------------- /post-processor/openstack/xenserver/post-processor_test.go: -------------------------------------------------------------------------------- 1 | package xenserver 2 | -------------------------------------------------------------------------------- /scripts/acs/centos7-reset.sh: -------------------------------------------------------------------------------- 1 | # remove device rules 2 | rm -f /etc/udev/rules.d/70* 3 | rm -f /var/lib/dhcp/dhclient*.* 4 | rm -f /var/lib/dhclient/dhclient*.* 5 | rm -f /var/lib/NetworkManager/dhclient*.* 6 | 7 | # remove/clear generic log files 8 | cat /dev/null > /var/log/audit/audit.log 2>/dev/null 9 | cat /dev/null > /var/log/wtmp 2>/dev/null 10 | cat /dev/null > /var/log/messages 2>/dev/null 11 | logrotate -f /etc/logrotate.conf 2>/dev/null 12 | rm -f /var/log/*-* /var/log/*.gz 2>/dev/null 13 | 14 | #reset the hostname so we get it automatically upon template provisioning 15 | hostname localhost 16 | echo "localhost" > /etc/hostname 17 | 18 | #clear history 19 | cat /dev/null > ~/.bash_history && history -c && unset HISTFILE 20 | -------------------------------------------------------------------------------- /scripts/acs/cloud-set-guest-password.service: -------------------------------------------------------------------------------- 1 | [Unit] 2 | Description=CloudStack Password Modification Script 3 | Requires=network.target 4 | After=network.target 5 | 6 | [Service] 7 | Type=oneshot 8 | ExecStart=/usr/local/bin/cloud-set-guest-password.sh 9 | RemainAfterExit=yes 10 | 11 | [Install] 12 | WantedBy=multi-user.target 13 | 14 | -------------------------------------------------------------------------------- /scripts/copyiso.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | # download an ISO to our library 3 | 4 | HOSTNAME=$(hostname) 5 | HOSTUUID=$(xe host-list name-label=$HOSTNAME --minimal) 6 | 7 | SRUUID=$(xe sr-list type=iso name-label="$1" --minimal) 8 | ISOPATH=$(xe pbd-list host-uuid=$HOSTUUID sr-uuid=$SRUUID params=device-config --minimal | egrep -o 'iso_path: /(.+);*$' | cut -d':' -f2 | tr -d '[[:space:]]') 9 | #echo "found $SRUUID path '$ISOPATH' for '$1'" 10 | 11 | DLPATH=$(echo "/var/run/sr-mount/$SRUUID$ISOPATH/$2") 12 | 13 | #Download only if this exists 14 | if ! [ -f $DLPATH ]; then 15 | curl -f --show-error -s -o $DLPATH $3 16 | fi 17 | 18 | -------------------------------------------------------------------------------- /scripts/packer-clean.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | # perform all the commands necessary to avoid network collision 3 | 4 | 5 | 6 | cd ~ 7 | cp 8 | rm ./packer-clean.sh 9 | shutdown -h now 10 | 11 | -------------------------------------------------------------------------------- /scripts/piwigo/piwigo-reset.sh: -------------------------------------------------------------------------------- 1 | # remove device rules 2 | rm -f /etc/udev/rules.d/70* 3 | rm -f /var/lib/dhcp/dhclient*.* 4 | rm -f /var/lib/dhclient/dhclient*.* 5 | rm -f /var/lib/NetworkManager/dhclient*.* 6 | 7 | # remove/clear generic log files 8 | cat /dev/null > /var/log/audit/audit.log 2>/dev/null 9 | cat /dev/null > /var/log/wtmp 2>/dev/null 10 | cat /dev/null > /var/log/messages 2>/dev/null 11 | logrotate -f /etc/logrotate.conf 2>/dev/null 12 | rm -f /var/log/*-* /var/log/*.gz 2>/dev/null 13 | 14 | #reset the hostname so we get it automatically upon template provisioning 15 | hostname localhost 16 | echo "localhost" > /etc/hostname 17 | 18 | #clear history 19 | cat /dev/null > ~/.bash_history && history -c && unset HISTFILE 20 | -------------------------------------------------------------------------------- /vendor/github.com/Sirupsen/logrus/.gitignore: -------------------------------------------------------------------------------- 1 | logrus 2 | -------------------------------------------------------------------------------- /vendor/github.com/Sirupsen/logrus/.travis.yml: -------------------------------------------------------------------------------- 1 | language: go 2 | go: 3 | - 1.3 4 | - 1.4 5 | - 1.5 6 | - 1.6 7 | - tip 8 | install: 9 | - go get -t ./... 10 | script: GOMAXPROCS=4 GORACE="halt_on_error=1" go test -race -v ./... 11 | -------------------------------------------------------------------------------- /vendor/github.com/Sirupsen/logrus/LICENSE: -------------------------------------------------------------------------------- 1 | The MIT License (MIT) 2 | 3 | Copyright (c) 2014 Simon Eskildsen 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in 13 | all copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 21 | THE SOFTWARE. 22 | -------------------------------------------------------------------------------- /vendor/github.com/Sirupsen/logrus/doc.go: -------------------------------------------------------------------------------- 1 | /* 2 | Package logrus is a structured logger for Go, completely API compatible with the standard library logger. 3 | 4 | 5 | The simplest way to use Logrus is simply the package-level exported logger: 6 | 7 | package main 8 | 9 | import ( 10 | log "github.com/Sirupsen/logrus" 11 | ) 12 | 13 | func main() { 14 | log.WithFields(log.Fields{ 15 | "animal": "walrus", 16 | "number": 1, 17 | "size": 10, 18 | }).Info("A walrus appears") 19 | } 20 | 21 | Output: 22 | time="2015-09-07T08:48:33Z" level=info msg="A walrus appears" animal=walrus number=1 size=10 23 | 24 | For a full guide visit https://github.com/Sirupsen/logrus 25 | */ 26 | package logrus 27 | -------------------------------------------------------------------------------- /vendor/github.com/Sirupsen/logrus/formatter.go: -------------------------------------------------------------------------------- 1 | package logrus 2 | 3 | import "time" 4 | 5 | const DefaultTimestampFormat = time.RFC3339 6 | 7 | // The Formatter interface is used to implement a custom Formatter. It takes an 8 | // `Entry`. It exposes all the fields, including the default ones: 9 | // 10 | // * `entry.Data["msg"]`. The message passed from Info, Warn, Error .. 11 | // * `entry.Data["time"]`. The timestamp. 12 | // * `entry.Data["level"]. The level the entry was logged at. 13 | // 14 | // Any additional fields added with `WithField` or `WithFields` are also in 15 | // `entry.Data`. Format is expected to return an array of bytes which are then 16 | // logged to `logger.Out`. 17 | type Formatter interface { 18 | Format(*Entry) ([]byte, error) 19 | } 20 | 21 | // This is to not silently overwrite `time`, `msg` and `level` fields when 22 | // dumping it. If this code wasn't there doing: 23 | // 24 | // logrus.WithField("level", 1).Info("hello") 25 | // 26 | // Would just silently drop the user provided level. Instead with this code 27 | // it'll logged as: 28 | // 29 | // {"level": "info", "fields.level": 1, "msg": "hello", "time": "..."} 30 | // 31 | // It's not exported because it's still using Data in an opinionated way. It's to 32 | // avoid code duplication between the two default formatters. 33 | func prefixFieldClashes(data Fields) { 34 | if t, ok := data["time"]; ok { 35 | data["fields.time"] = t 36 | } 37 | 38 | if m, ok := data["msg"]; ok { 39 | data["fields.msg"] = m 40 | } 41 | 42 | if l, ok := data["level"]; ok { 43 | data["fields.level"] = l 44 | } 45 | } 46 | -------------------------------------------------------------------------------- /vendor/github.com/Sirupsen/logrus/hooks.go: -------------------------------------------------------------------------------- 1 | package logrus 2 | 3 | // A hook to be fired when logging on the logging levels returned from 4 | // `Levels()` on your implementation of the interface. Note that this is not 5 | // fired in a goroutine or a channel with workers, you should handle such 6 | // functionality yourself if your call is non-blocking and you don't wish for 7 | // the logging calls for levels returned from `Levels()` to block. 8 | type Hook interface { 9 | Levels() []Level 10 | Fire(*Entry) error 11 | } 12 | 13 | // Internal type for storing the hooks on a logger instance. 14 | type LevelHooks map[Level][]Hook 15 | 16 | // Add a hook to an instance of logger. This is called with 17 | // `log.Hooks.Add(new(MyHook))` where `MyHook` implements the `Hook` interface. 18 | func (hooks LevelHooks) Add(hook Hook) { 19 | for _, level := range hook.Levels() { 20 | hooks[level] = append(hooks[level], hook) 21 | } 22 | } 23 | 24 | // Fire all the hooks for the passed level. Used by `entry.log` to fire 25 | // appropriate hooks for a log entry. 26 | func (hooks LevelHooks) Fire(level Level, entry *Entry) error { 27 | for _, hook := range hooks[level] { 28 | if err := hook.Fire(entry); err != nil { 29 | return err 30 | } 31 | } 32 | 33 | return nil 34 | } 35 | -------------------------------------------------------------------------------- /vendor/github.com/Sirupsen/logrus/json_formatter.go: -------------------------------------------------------------------------------- 1 | package logrus 2 | 3 | import ( 4 | "encoding/json" 5 | "fmt" 6 | ) 7 | 8 | type JSONFormatter struct { 9 | // TimestampFormat sets the format used for marshaling timestamps. 10 | TimestampFormat string 11 | } 12 | 13 | func (f *JSONFormatter) Format(entry *Entry) ([]byte, error) { 14 | data := make(Fields, len(entry.Data)+3) 15 | for k, v := range entry.Data { 16 | switch v := v.(type) { 17 | case error: 18 | // Otherwise errors are ignored by `encoding/json` 19 | // https://github.com/Sirupsen/logrus/issues/137 20 | data[k] = v.Error() 21 | default: 22 | data[k] = v 23 | } 24 | } 25 | prefixFieldClashes(data) 26 | 27 | timestampFormat := f.TimestampFormat 28 | if timestampFormat == "" { 29 | timestampFormat = DefaultTimestampFormat 30 | } 31 | 32 | data["time"] = entry.Time.Format(timestampFormat) 33 | data["msg"] = entry.Message 34 | data["level"] = entry.Level.String() 35 | 36 | serialized, err := json.Marshal(data) 37 | if err != nil { 38 | return nil, fmt.Errorf("Failed to marshal fields to JSON, %v", err) 39 | } 40 | return append(serialized, '\n'), nil 41 | } 42 | -------------------------------------------------------------------------------- /vendor/github.com/Sirupsen/logrus/terminal_bsd.go: -------------------------------------------------------------------------------- 1 | // +build darwin freebsd openbsd netbsd dragonfly 2 | 3 | package logrus 4 | 5 | import "syscall" 6 | 7 | const ioctlReadTermios = syscall.TIOCGETA 8 | 9 | type Termios syscall.Termios 10 | -------------------------------------------------------------------------------- /vendor/github.com/Sirupsen/logrus/terminal_linux.go: -------------------------------------------------------------------------------- 1 | // Based on ssh/terminal: 2 | // Copyright 2013 The Go Authors. All rights reserved. 3 | // Use of this source code is governed by a BSD-style 4 | // license that can be found in the LICENSE file. 5 | 6 | package logrus 7 | 8 | import "syscall" 9 | 10 | const ioctlReadTermios = syscall.TCGETS 11 | 12 | type Termios syscall.Termios 13 | -------------------------------------------------------------------------------- /vendor/github.com/Sirupsen/logrus/terminal_notwindows.go: -------------------------------------------------------------------------------- 1 | // Based on ssh/terminal: 2 | // Copyright 2011 The Go Authors. All rights reserved. 3 | // Use of this source code is governed by a BSD-style 4 | // license that can be found in the LICENSE file. 5 | 6 | // +build linux darwin freebsd openbsd netbsd dragonfly 7 | 8 | package logrus 9 | 10 | import ( 11 | "syscall" 12 | "unsafe" 13 | ) 14 | 15 | // IsTerminal returns true if stderr's file descriptor is a terminal. 16 | func IsTerminal() bool { 17 | fd := syscall.Stderr 18 | var termios Termios 19 | _, _, err := syscall.Syscall6(syscall.SYS_IOCTL, uintptr(fd), ioctlReadTermios, uintptr(unsafe.Pointer(&termios)), 0, 0, 0) 20 | return err == 0 21 | } 22 | -------------------------------------------------------------------------------- /vendor/github.com/Sirupsen/logrus/terminal_solaris.go: -------------------------------------------------------------------------------- 1 | // +build solaris 2 | 3 | package logrus 4 | 5 | import ( 6 | "os" 7 | 8 | "golang.org/x/sys/unix" 9 | ) 10 | 11 | // IsTerminal returns true if the given file descriptor is a terminal. 12 | func IsTerminal() bool { 13 | _, err := unix.IoctlGetTermios(int(os.Stdout.Fd()), unix.TCGETA) 14 | return err == nil 15 | } 16 | -------------------------------------------------------------------------------- /vendor/github.com/Sirupsen/logrus/terminal_windows.go: -------------------------------------------------------------------------------- 1 | // Based on ssh/terminal: 2 | // Copyright 2011 The Go Authors. All rights reserved. 3 | // Use of this source code is governed by a BSD-style 4 | // license that can be found in the LICENSE file. 5 | 6 | // +build windows 7 | 8 | package logrus 9 | 10 | import ( 11 | "syscall" 12 | "unsafe" 13 | ) 14 | 15 | var kernel32 = syscall.NewLazyDLL("kernel32.dll") 16 | 17 | var ( 18 | procGetConsoleMode = kernel32.NewProc("GetConsoleMode") 19 | ) 20 | 21 | // IsTerminal returns true if stderr's file descriptor is a terminal. 22 | func IsTerminal() bool { 23 | fd := syscall.Stderr 24 | var st uint32 25 | r, _, e := syscall.Syscall(procGetConsoleMode.Addr(), 2, uintptr(fd), uintptr(unsafe.Pointer(&st)), 0) 26 | return r != 0 && e == 0 27 | } 28 | -------------------------------------------------------------------------------- /vendor/github.com/Sirupsen/logrus/writer.go: -------------------------------------------------------------------------------- 1 | package logrus 2 | 3 | import ( 4 | "bufio" 5 | "io" 6 | "runtime" 7 | ) 8 | 9 | func (logger *Logger) Writer() *io.PipeWriter { 10 | return logger.WriterLevel(InfoLevel) 11 | } 12 | 13 | func (logger *Logger) WriterLevel(level Level) *io.PipeWriter { 14 | reader, writer := io.Pipe() 15 | 16 | var printFunc func(args ...interface{}) 17 | switch level { 18 | case DebugLevel: 19 | printFunc = logger.Debug 20 | case InfoLevel: 21 | printFunc = logger.Info 22 | case WarnLevel: 23 | printFunc = logger.Warn 24 | case ErrorLevel: 25 | printFunc = logger.Error 26 | case FatalLevel: 27 | printFunc = logger.Fatal 28 | case PanicLevel: 29 | printFunc = logger.Panic 30 | default: 31 | printFunc = logger.Print 32 | } 33 | 34 | go logger.writerScanner(reader, printFunc) 35 | runtime.SetFinalizer(writer, writerFinalizer) 36 | 37 | return writer 38 | } 39 | 40 | func (logger *Logger) writerScanner(reader *io.PipeReader, printFunc func(args ...interface{})) { 41 | scanner := bufio.NewScanner(reader) 42 | for scanner.Scan() { 43 | printFunc(scanner.Text()) 44 | } 45 | if err := scanner.Err(); err != nil { 46 | logger.Errorf("Error while reading from Writer: %s", err) 47 | } 48 | reader.Close() 49 | } 50 | 51 | func writerFinalizer(writer *io.PipeWriter) { 52 | writer.Close() 53 | } 54 | -------------------------------------------------------------------------------- /vendor/github.com/dylanmei/iso8601/LICENSE: -------------------------------------------------------------------------------- 1 | The MIT License (MIT) 2 | 3 | Copyright (c) 2015 Dylan Meissner 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /vendor/github.com/dylanmei/iso8601/README.md: -------------------------------------------------------------------------------- 1 | 2 | iso 8601 parser and formatter 3 | ============================= 4 | 5 | An [ISO8601](https://en.wikipedia.org/wiki/ISO_8601) Go utility. 6 | 7 | - *Time* is not yet implemented 8 | - *Duration* is mostly implemented 9 | 10 | -------------------------------------------------------------------------------- /vendor/github.com/dylanmei/winrmtest/LICENSE: -------------------------------------------------------------------------------- 1 | Copyright (c) 2014-2015 Dylan Meissner 2 | 3 | MIT License 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining 6 | a copy of this software and associated documentation files (the 7 | "Software"), to deal in the Software without restriction, including 8 | without limitation the rights to use, copy, modify, merge, publish, 9 | distribute, sublicense, and/or sell copies of the Software, and to 10 | permit persons to whom the Software is furnished to do so, subject to 11 | the following conditions: 12 | 13 | The above copyright notice and this permission notice shall be 14 | included in all copies or substantial portions of the Software. 15 | 16 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 17 | EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 18 | MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 19 | NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE 20 | LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION 21 | OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION 22 | WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 23 | -------------------------------------------------------------------------------- /vendor/github.com/dylanmei/winrmtest/README.md: -------------------------------------------------------------------------------- 1 | 2 | # winrmtest 3 | 4 | An in-progress testing package to compliment the [masterzen/winrm](https://github.com/masterzen/winrm) Go-based winrm library. 5 | 6 | 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. 7 | 8 | ## Example Use 9 | 10 | A fictitious "Windows tools" package. 11 | 12 | ``` 13 | 14 | package wintools 15 | 16 | import ( 17 | "io" 18 | "testing" 19 | "github.com/dylanmei/winrmtest" 20 | ) 21 | 22 | func Test_empty_temp_directory(t *testing.T) { 23 | r := winrmtest.NewRemote() 24 | defer r.Close() 25 | 26 | r.CommandFunc(wimrmtest.MatchText("dir C:\Temp"), func(out, err io.Writer) int { 27 | out.Write([]byte(` Volume in drive C is Windows 2012 R2 28 | Volume Serial Number is XXXX-XXXX 29 | 30 | Directory of C:\ 31 | 32 | File Not Found`)) 33 | return 0 34 | }) 35 | 36 | lister := NewDirectoryLister(r.Host, r.Port) 37 | list, _ := lister.TempDirectory() 38 | 39 | if count := len(list.Dirs()); count != 0 { 40 | t.Errorf("Expected 0 directories but found %d.\n", count) 41 | } 42 | 43 | if count := len(list.Files()); count != 0 { 44 | t.Errorf("Expected 0 files but found %d.\n", count) 45 | } 46 | } 47 | ``` 48 | 49 | -------------------------------------------------------------------------------- /vendor/github.com/hashicorp/go-multierror/append.go: -------------------------------------------------------------------------------- 1 | package multierror 2 | 3 | // Append is a helper function that will append more errors 4 | // onto an Error in order to create a larger multi-error. 5 | // 6 | // If err is not a multierror.Error, then it will be turned into 7 | // one. If any of the errs are multierr.Error, they will be flattened 8 | // one level into err. 9 | func Append(err error, errs ...error) *Error { 10 | switch err := err.(type) { 11 | case *Error: 12 | // Typed nils can reach here, so initialize if we are nil 13 | if err == nil { 14 | err = new(Error) 15 | } 16 | 17 | // Go through each error and flatten 18 | for _, e := range errs { 19 | switch e := e.(type) { 20 | case *Error: 21 | err.Errors = append(err.Errors, e.Errors...) 22 | default: 23 | err.Errors = append(err.Errors, e) 24 | } 25 | } 26 | 27 | return err 28 | default: 29 | newErrs := make([]error, 0, len(errs)+1) 30 | if err != nil { 31 | newErrs = append(newErrs, err) 32 | } 33 | newErrs = append(newErrs, errs...) 34 | 35 | return Append(&Error{}, newErrs...) 36 | } 37 | } 38 | -------------------------------------------------------------------------------- /vendor/github.com/hashicorp/go-multierror/flatten.go: -------------------------------------------------------------------------------- 1 | package multierror 2 | 3 | // Flatten flattens the given error, merging any *Errors together into 4 | // a single *Error. 5 | func Flatten(err error) error { 6 | // If it isn't an *Error, just return the error as-is 7 | if _, ok := err.(*Error); !ok { 8 | return err 9 | } 10 | 11 | // Otherwise, make the result and flatten away! 12 | flatErr := new(Error) 13 | flatten(err, flatErr) 14 | return flatErr 15 | } 16 | 17 | func flatten(err error, flatErr *Error) { 18 | switch err := err.(type) { 19 | case *Error: 20 | for _, e := range err.Errors { 21 | flatten(e, flatErr) 22 | } 23 | default: 24 | flatErr.Errors = append(flatErr.Errors, err) 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /vendor/github.com/hashicorp/go-multierror/format.go: -------------------------------------------------------------------------------- 1 | package multierror 2 | 3 | import ( 4 | "fmt" 5 | "strings" 6 | ) 7 | 8 | // ErrorFormatFunc is a function callback that is called by Error to 9 | // turn the list of errors into a string. 10 | type ErrorFormatFunc func([]error) string 11 | 12 | // ListFormatFunc is a basic formatter that outputs the number of errors 13 | // that occurred along with a bullet point list of the errors. 14 | func ListFormatFunc(es []error) string { 15 | points := make([]string, len(es)) 16 | for i, err := range es { 17 | points[i] = fmt.Sprintf("* %s", err) 18 | } 19 | 20 | return fmt.Sprintf( 21 | "%d error(s) occurred:\n\n%s", 22 | len(es), strings.Join(points, "\n")) 23 | } 24 | -------------------------------------------------------------------------------- /vendor/github.com/hashicorp/go-multierror/multierror.go: -------------------------------------------------------------------------------- 1 | package multierror 2 | 3 | import ( 4 | "fmt" 5 | ) 6 | 7 | // Error is an error type to track multiple errors. This is used to 8 | // accumulate errors in cases and return them as a single "error". 9 | type Error struct { 10 | Errors []error 11 | ErrorFormat ErrorFormatFunc 12 | } 13 | 14 | func (e *Error) Error() string { 15 | fn := e.ErrorFormat 16 | if fn == nil { 17 | fn = ListFormatFunc 18 | } 19 | 20 | return fn(e.Errors) 21 | } 22 | 23 | // ErrorOrNil returns an error interface if this Error represents 24 | // a list of errors, or returns nil if the list of errors is empty. This 25 | // function is useful at the end of accumulation to make sure that the value 26 | // returned represents the existence of errors. 27 | func (e *Error) ErrorOrNil() error { 28 | if e == nil { 29 | return nil 30 | } 31 | if len(e.Errors) == 0 { 32 | return nil 33 | } 34 | 35 | return e 36 | } 37 | 38 | func (e *Error) GoString() string { 39 | return fmt.Sprintf("*%#v", *e) 40 | } 41 | 42 | // WrappedErrors returns the list of errors that this Error is wrapping. 43 | // It is an implementatin of the errwrap.Wrapper interface so that 44 | // multierror.Error can be used with that library. 45 | // 46 | // This method is not safe to be called concurrently and is no different 47 | // than accessing the Errors field directly. It is implementd only to 48 | // satisfy the errwrap.Wrapper interface. 49 | func (e *Error) WrappedErrors() []error { 50 | return e.Errors 51 | } 52 | -------------------------------------------------------------------------------- /vendor/github.com/hashicorp/go-multierror/prefix.go: -------------------------------------------------------------------------------- 1 | package multierror 2 | 3 | import ( 4 | "fmt" 5 | 6 | "github.com/hashicorp/errwrap" 7 | ) 8 | 9 | // Prefix is a helper function that will prefix some text 10 | // to the given error. If the error is a multierror.Error, then 11 | // it will be prefixed to each wrapped error. 12 | // 13 | // This is useful to use when appending multiple multierrors 14 | // together in order to give better scoping. 15 | func Prefix(err error, prefix string) error { 16 | if err == nil { 17 | return nil 18 | } 19 | 20 | format := fmt.Sprintf("%s {{err}}", prefix) 21 | switch err := err.(type) { 22 | case *Error: 23 | // Typed nils can reach here, so initialize if we are nil 24 | if err == nil { 25 | err = new(Error) 26 | } 27 | 28 | // Wrap each of the errors 29 | for i, e := range err.Errors { 30 | err.Errors[i] = errwrap.Wrapf(format, e) 31 | } 32 | 33 | return err 34 | default: 35 | return errwrap.Wrapf(format, err) 36 | } 37 | } 38 | -------------------------------------------------------------------------------- /vendor/github.com/hashicorp/go-version/.travis.yml: -------------------------------------------------------------------------------- 1 | language: go 2 | 3 | go: 4 | - 1.0 5 | - 1.1 6 | - 1.2 7 | - 1.3 8 | - 1.4 9 | 10 | script: 11 | - go test 12 | -------------------------------------------------------------------------------- /vendor/github.com/hashicorp/go-version/version_collection.go: -------------------------------------------------------------------------------- 1 | package version 2 | 3 | // Collection is a type that implements the sort.Interface interface 4 | // so that versions can be sorted. 5 | type Collection []*Version 6 | 7 | func (v Collection) Len() int { 8 | return len(v) 9 | } 10 | 11 | func (v Collection) Less(i, j int) bool { 12 | return v[i].LessThan(v[j]) 13 | } 14 | 15 | func (v Collection) Swap(i, j int) { 16 | v[i], v[j] = v[j], v[i] 17 | } 18 | -------------------------------------------------------------------------------- /vendor/github.com/hashicorp/yamux/.gitignore: -------------------------------------------------------------------------------- 1 | # Compiled Object files, Static and Dynamic libs (Shared Objects) 2 | *.o 3 | *.a 4 | *.so 5 | 6 | # Folders 7 | _obj 8 | _test 9 | 10 | # Architecture specific extensions/prefixes 11 | *.[568vq] 12 | [568vq].out 13 | 14 | *.cgo1.go 15 | *.cgo2.c 16 | _cgo_defun.c 17 | _cgo_gotypes.go 18 | _cgo_export.* 19 | 20 | _testmain.go 21 | 22 | *.exe 23 | *.test 24 | -------------------------------------------------------------------------------- /vendor/github.com/hashicorp/yamux/addr.go: -------------------------------------------------------------------------------- 1 | package yamux 2 | 3 | import ( 4 | "fmt" 5 | "net" 6 | ) 7 | 8 | // hasAddr is used to get the address from the underlying connection 9 | type hasAddr interface { 10 | LocalAddr() net.Addr 11 | RemoteAddr() net.Addr 12 | } 13 | 14 | // yamuxAddr is used when we cannot get the underlying address 15 | type yamuxAddr struct { 16 | Addr string 17 | } 18 | 19 | func (*yamuxAddr) Network() string { 20 | return "yamux" 21 | } 22 | 23 | func (y *yamuxAddr) String() string { 24 | return fmt.Sprintf("yamux:%s", y.Addr) 25 | } 26 | 27 | // Addr is used to get the address of the listener. 28 | func (s *Session) Addr() net.Addr { 29 | return s.LocalAddr() 30 | } 31 | 32 | // LocalAddr is used to get the local address of the 33 | // underlying connection. 34 | func (s *Session) LocalAddr() net.Addr { 35 | addr, ok := s.conn.(hasAddr) 36 | if !ok { 37 | return &yamuxAddr{"local"} 38 | } 39 | return addr.LocalAddr() 40 | } 41 | 42 | // RemoteAddr is used to get the address of remote end 43 | // of the underlying connection 44 | func (s *Session) RemoteAddr() net.Addr { 45 | addr, ok := s.conn.(hasAddr) 46 | if !ok { 47 | return &yamuxAddr{"remote"} 48 | } 49 | return addr.RemoteAddr() 50 | } 51 | 52 | // LocalAddr returns the local address 53 | func (s *Stream) LocalAddr() net.Addr { 54 | return s.session.LocalAddr() 55 | } 56 | 57 | // LocalAddr returns the remote address 58 | func (s *Stream) RemoteAddr() net.Addr { 59 | return s.session.RemoteAddr() 60 | } 61 | -------------------------------------------------------------------------------- /vendor/github.com/hashicorp/yamux/util.go: -------------------------------------------------------------------------------- 1 | package yamux 2 | 3 | // asyncSendErr is used to try an async send of an error 4 | func asyncSendErr(ch chan error, err error) { 5 | if ch == nil { 6 | return 7 | } 8 | select { 9 | case ch <- err: 10 | default: 11 | } 12 | } 13 | 14 | // asyncNotify is used to signal a waiting goroutine 15 | func asyncNotify(ch chan struct{}) { 16 | select { 17 | case ch <- struct{}{}: 18 | default: 19 | } 20 | } 21 | 22 | // min computes the minimum of two values 23 | func min(a, b uint32) uint32 { 24 | if a < b { 25 | return a 26 | } 27 | return b 28 | } 29 | -------------------------------------------------------------------------------- /vendor/github.com/kr/fs/LICENSE: -------------------------------------------------------------------------------- 1 | Copyright (c) 2012 The Go Authors. All rights reserved. 2 | 3 | Redistribution and use in source and binary forms, with or without 4 | modification, are permitted provided that the following conditions are 5 | met: 6 | 7 | * Redistributions of source code must retain the above copyright 8 | notice, this list of conditions and the following disclaimer. 9 | * Redistributions in binary form must reproduce the above 10 | copyright notice, this list of conditions and the following disclaimer 11 | in the documentation and/or other materials provided with the 12 | distribution. 13 | * Neither the name of Google Inc. nor the names of its 14 | contributors may be used to endorse or promote products derived from 15 | this software without specific prior written permission. 16 | 17 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 18 | "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 19 | LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 20 | A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 21 | OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 22 | SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 23 | LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 24 | DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 25 | THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 26 | (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 27 | OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 28 | -------------------------------------------------------------------------------- /vendor/github.com/kr/fs/Readme: -------------------------------------------------------------------------------- 1 | Filesystem Package 2 | 3 | http://godoc.org/github.com/kr/fs 4 | -------------------------------------------------------------------------------- /vendor/github.com/kr/fs/filesystem.go: -------------------------------------------------------------------------------- 1 | package fs 2 | 3 | import ( 4 | "io/ioutil" 5 | "os" 6 | "path/filepath" 7 | ) 8 | 9 | // FileSystem defines the methods of an abstract filesystem. 10 | type FileSystem interface { 11 | 12 | // ReadDir reads the directory named by dirname and returns a 13 | // list of directory entries. 14 | ReadDir(dirname string) ([]os.FileInfo, error) 15 | 16 | // Lstat returns a FileInfo describing the named file. If the file is a 17 | // symbolic link, the returned FileInfo describes the symbolic link. Lstat 18 | // makes no attempt to follow the link. 19 | Lstat(name string) (os.FileInfo, error) 20 | 21 | // Join joins any number of path elements into a single path, adding a 22 | // separator if necessary. The result is Cleaned; in particular, all 23 | // empty strings are ignored. 24 | // 25 | // The separator is FileSystem specific. 26 | Join(elem ...string) string 27 | } 28 | 29 | // fs represents a FileSystem provided by the os package. 30 | type fs struct{} 31 | 32 | func (f *fs) ReadDir(dirname string) ([]os.FileInfo, error) { return ioutil.ReadDir(dirname) } 33 | 34 | func (f *fs) Lstat(name string) (os.FileInfo, error) { return os.Lstat(name) } 35 | 36 | func (f *fs) Join(elem ...string) string { return filepath.Join(elem...) } 37 | -------------------------------------------------------------------------------- /vendor/github.com/masterzen/simplexml/dom/document.go: -------------------------------------------------------------------------------- 1 | package dom 2 | 3 | import ( 4 | "bytes" 5 | "fmt" 6 | ) 7 | 8 | type Document struct { 9 | root *Element 10 | PrettyPrint bool 11 | Indentation string 12 | DocType bool 13 | } 14 | 15 | func CreateDocument() *Document { 16 | return &Document{ PrettyPrint: false, Indentation: " ", DocType: true } 17 | } 18 | 19 | func (doc *Document) SetRoot(node *Element) { 20 | node.parent = nil 21 | doc.root = node 22 | } 23 | 24 | func (doc *Document) String() string { 25 | var b bytes.Buffer 26 | if doc.DocType { 27 | fmt.Fprintln(&b, ``) 28 | } 29 | 30 | if doc.root != nil { 31 | doc.root.Bytes(&b, doc.PrettyPrint, doc.Indentation, 0) 32 | } 33 | 34 | return string(b.Bytes()) 35 | } 36 | -------------------------------------------------------------------------------- /vendor/github.com/masterzen/simplexml/dom/namespace.go: -------------------------------------------------------------------------------- 1 | package dom 2 | 3 | type Namespace struct { 4 | Prefix string 5 | Uri string 6 | } 7 | 8 | func (ns *Namespace) SetTo(node *Element) { 9 | node.SetNamespace(ns.Prefix, ns.Uri) 10 | } 11 | -------------------------------------------------------------------------------- /vendor/github.com/masterzen/winrm/winrm/endpoint.go: -------------------------------------------------------------------------------- 1 | package winrm 2 | 3 | import "fmt" 4 | 5 | type Endpoint struct { 6 | Host string 7 | Port int 8 | HTTPS bool 9 | Insecure bool 10 | CACert *[]byte 11 | } 12 | 13 | func (ep *Endpoint) url() string { 14 | var scheme string 15 | if ep.HTTPS { 16 | scheme = "https" 17 | } else { 18 | scheme = "http" 19 | } 20 | 21 | return fmt.Sprintf("%s://%s:%d/wsman", scheme, ep.Host, ep.Port) 22 | } 23 | -------------------------------------------------------------------------------- /vendor/github.com/masterzen/winrm/winrm/parameters.go: -------------------------------------------------------------------------------- 1 | package winrm 2 | 3 | import ( 4 | "net/http" 5 | ) 6 | 7 | type Parameters struct { 8 | Timeout string 9 | Locale string 10 | EnvelopeSize int 11 | TransportDecorator func(*http.Transport) http.RoundTripper 12 | } 13 | 14 | func DefaultParameters() *Parameters { 15 | return NewParameters("PT60S", "en-US", 153600) 16 | } 17 | 18 | func NewParameters(timeout string, locale string, envelopeSize int) *Parameters { 19 | return &Parameters{Timeout: timeout, Locale: locale, EnvelopeSize: envelopeSize} 20 | } 21 | -------------------------------------------------------------------------------- /vendor/github.com/masterzen/winrm/winrm/powershell.go: -------------------------------------------------------------------------------- 1 | package winrm 2 | 3 | import ( 4 | "encoding/base64" 5 | "fmt" 6 | ) 7 | 8 | // Wraps a PowerShell script and prepares it for execution by the winrm client 9 | func Powershell(psCmd string) string { 10 | // 2 byte chars to make PowerShell happy 11 | wideCmd := "" 12 | for _, b := range []byte(psCmd) { 13 | wideCmd += string(b) + "\x00" 14 | } 15 | 16 | // Base64 encode the command 17 | input := []uint8(wideCmd) 18 | encodedCmd := base64.StdEncoding.EncodeToString(input) 19 | 20 | // Create the powershell.exe command line to execute the script 21 | return fmt.Sprintf("powershell.exe -EncodedCommand %s", encodedCmd) 22 | } 23 | -------------------------------------------------------------------------------- /vendor/github.com/masterzen/winrm/winrm/shell.go: -------------------------------------------------------------------------------- 1 | package winrm 2 | 3 | // Shell is the local view of a WinRM Shell of a given Client 4 | type Shell struct { 5 | client *Client 6 | ShellId string 7 | } 8 | 9 | // Execute command on the given Shell, returning either an error or a Command 10 | func (shell *Shell) Execute(command string, arguments ...string) (cmd *Command, err error) { 11 | request := NewExecuteCommandRequest(shell.client.url, shell.ShellId, command, arguments, &shell.client.Parameters) 12 | defer request.Free() 13 | 14 | response, err := shell.client.sendRequest(request) 15 | if err == nil { 16 | var commandId string 17 | if commandId, err = ParseExecuteCommandResponse(response); err == nil { 18 | cmd = newCommand(shell, commandId) 19 | } 20 | } 21 | return 22 | } 23 | 24 | // Close will terminate this shell. No commands can be issued once the shell is closed. 25 | func (shell *Shell) Close() (err error) { 26 | request := NewDeleteShellRequest(shell.client.url, shell.ShellId, &shell.client.Parameters) 27 | defer request.Free() 28 | 29 | _, err = shell.client.sendRequest(request) 30 | return 31 | } 32 | -------------------------------------------------------------------------------- /vendor/github.com/mitchellh/go-fs/LICENSE: -------------------------------------------------------------------------------- 1 | The MIT License (MIT) 2 | 3 | Copyright (c) 2013 Mitchell Hashimoto 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in 13 | all copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 21 | THE SOFTWARE. 22 | -------------------------------------------------------------------------------- /vendor/github.com/mitchellh/go-fs/block_device.go: -------------------------------------------------------------------------------- 1 | package fs 2 | 3 | // A BlockDevice is the raw device that is meant to store a filesystem. 4 | type BlockDevice interface { 5 | // Closes this block device. No more methods may be called on a 6 | // closed device. 7 | Close() error 8 | 9 | // Len returns the number of bytes in this block device. 10 | Len() int64 11 | 12 | // SectorSize returns the size of a single sector on this device. 13 | SectorSize() int 14 | 15 | // ReadAt reads data from the block device from the given 16 | // offset. See io.ReaderAt for more information on this function. 17 | ReadAt(p []byte, off int64) (n int, err error) 18 | 19 | // WriteAt writes data to the block device at the given offset. 20 | // See io.WriterAt for more information on this function. 21 | WriteAt(p []byte, off int64) (n int, err error) 22 | } 23 | -------------------------------------------------------------------------------- /vendor/github.com/mitchellh/go-fs/directory.go: -------------------------------------------------------------------------------- 1 | package fs 2 | 3 | // Directory is an entry in a filesystem that stores files. 4 | type Directory interface { 5 | Entry(name string) DirectoryEntry 6 | Entries() []DirectoryEntry 7 | AddDirectory(name string) (DirectoryEntry, error) 8 | AddFile(name string) (DirectoryEntry, error) 9 | } 10 | 11 | // DirectoryEntry represents a single entry within a directory, 12 | // which can be either another Directory or a File. 13 | type DirectoryEntry interface { 14 | Name() string 15 | IsDir() bool 16 | Dir() (Directory, error) 17 | File() (File, error) 18 | } 19 | -------------------------------------------------------------------------------- /vendor/github.com/mitchellh/go-fs/fat/file.go: -------------------------------------------------------------------------------- 1 | package fat 2 | 3 | type File struct { 4 | chain *ClusterChain 5 | dir *Directory 6 | entry *DirectoryClusterEntry 7 | } 8 | 9 | func (f *File) Read(p []byte) (n int, err error) { 10 | return f.chain.Read(p) 11 | } 12 | 13 | func (f *File) Write(p []byte) (n int, err error) { 14 | lastByte := f.chain.writeOffset + uint32(len(p)) 15 | if lastByte > f.entry.fileSize { 16 | // Increase the file size since we're writing past the end of the file 17 | f.entry.fileSize = lastByte 18 | 19 | // Write the entry out 20 | if err := f.dir.dirCluster.WriteToDevice(f.dir.device, f.dir.fat); err != nil { 21 | return 0, err 22 | } 23 | } 24 | 25 | return f.chain.Write(p) 26 | } 27 | -------------------------------------------------------------------------------- /vendor/github.com/mitchellh/go-fs/fat/filesystem.go: -------------------------------------------------------------------------------- 1 | package fat 2 | 3 | import ( 4 | "github.com/mitchellh/go-fs" 5 | ) 6 | 7 | // FileSystem is the implementation of fs.FileSystem that can read a 8 | // FAT filesystem. 9 | type FileSystem struct { 10 | bs *BootSectorCommon 11 | device fs.BlockDevice 12 | fat *FAT 13 | rootDir *DirectoryCluster 14 | } 15 | 16 | // New returns a new FileSystem for accessing a previously created 17 | // FAT filesystem. 18 | func New(device fs.BlockDevice) (*FileSystem, error) { 19 | bs, err := DecodeBootSector(device) 20 | if err != nil { 21 | return nil, err 22 | } 23 | 24 | fat, err := DecodeFAT(device, bs, 0) 25 | if err != nil { 26 | return nil, err 27 | } 28 | 29 | var rootDir *DirectoryCluster 30 | if bs.FATType() == FAT32 { 31 | panic("FAT32 not implemented yet") 32 | } else { 33 | rootDir, err = DecodeFAT16RootDirectoryCluster(device, bs) 34 | if err != nil { 35 | return nil, err 36 | } 37 | } 38 | 39 | result := &FileSystem{ 40 | bs: bs, 41 | device: device, 42 | fat: fat, 43 | rootDir: rootDir, 44 | } 45 | 46 | return result, nil 47 | } 48 | 49 | func (f *FileSystem) RootDir() (fs.Directory, error) { 50 | dir := &Directory{ 51 | device: f.device, 52 | dirCluster: f.rootDir, 53 | fat: f.fat, 54 | } 55 | 56 | return dir, nil 57 | } 58 | -------------------------------------------------------------------------------- /vendor/github.com/mitchellh/go-fs/fat/type.go: -------------------------------------------------------------------------------- 1 | package fat 2 | 3 | import "github.com/mitchellh/go-fs" 4 | 5 | // FATType is a simple enum of the available FAT filesystem types. 6 | type FATType uint8 7 | 8 | const ( 9 | FAT12 FATType = iota 10 | FAT16 11 | FAT32 12 | ) 13 | 14 | // TypeForDevice determines the usable FAT type based solely on 15 | // size information about the block device. 16 | func TypeForDevice(device fs.BlockDevice) FATType { 17 | sizeInMB := device.Len() / (1024 * 1024) 18 | switch { 19 | case sizeInMB < 4: 20 | return FAT12 21 | case sizeInMB < 512: 22 | return FAT16 23 | default: 24 | return FAT32 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /vendor/github.com/mitchellh/go-fs/file.go: -------------------------------------------------------------------------------- 1 | package fs 2 | 3 | import "io" 4 | 5 | // File is a single file within a filesystem. 6 | type File interface { 7 | io.Reader 8 | io.Writer 9 | } 10 | -------------------------------------------------------------------------------- /vendor/github.com/mitchellh/go-fs/file_disk.go: -------------------------------------------------------------------------------- 1 | package fs 2 | 3 | import ( 4 | "errors" 5 | "os" 6 | ) 7 | 8 | // A FileDisk is an implementation of a BlockDevice that uses a 9 | // *os.File as its backing store. 10 | type FileDisk struct { 11 | f *os.File 12 | size int64 13 | } 14 | 15 | // NewFileDisk creates a new FileDisk from the given *os.File. The 16 | // file must already be created and set the to the proper size. 17 | func NewFileDisk(f *os.File) (*FileDisk, error) { 18 | fi, err := f.Stat() 19 | if err != nil { 20 | return nil, err 21 | } 22 | 23 | if fi.IsDir() { 24 | return nil, errors.New("file is a directory") 25 | } 26 | 27 | return &FileDisk{ 28 | f: f, 29 | size: fi.Size(), 30 | }, nil 31 | } 32 | 33 | func (f *FileDisk) Close() error { 34 | return f.f.Close() 35 | } 36 | 37 | func (f *FileDisk) Len() int64 { 38 | return f.size 39 | } 40 | 41 | func (f *FileDisk) ReadAt(p []byte, off int64) (int, error) { 42 | return f.f.ReadAt(p, off) 43 | } 44 | 45 | func (f *FileDisk) SectorSize() int { 46 | // Hardcoded for now, one day we may want to make this customizable 47 | return 512 48 | } 49 | 50 | func (f *FileDisk) WriteAt(p []byte, off int64) (int, error) { 51 | return f.f.WriteAt(p, off) 52 | } 53 | -------------------------------------------------------------------------------- /vendor/github.com/mitchellh/go-fs/filesystem.go: -------------------------------------------------------------------------------- 1 | package fs 2 | 3 | // A FileSystem provides access to a tree hierarchy of directories 4 | // and files. 5 | type FileSystem interface { 6 | // RootDir returns the single root directory. 7 | RootDir() (Directory, error) 8 | } 9 | -------------------------------------------------------------------------------- /vendor/github.com/mitchellh/iochan/LICENSE.md: -------------------------------------------------------------------------------- 1 | The MIT License (MIT) 2 | 3 | Copyright (c) 2015 Mitchell Hashimoto 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in 13 | all copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 21 | THE SOFTWARE. 22 | -------------------------------------------------------------------------------- /vendor/github.com/mitchellh/iochan/README.md: -------------------------------------------------------------------------------- 1 | # iochan 2 | 3 | iochan is a Go library for treating `io` readers and writers like channels. 4 | This is useful when sometimes you wish to use `io.Reader` and such in `select` 5 | statements. 6 | 7 | ## Installation 8 | 9 | Standard `go get`: 10 | 11 | ``` 12 | $ go get github.com/mitchellh/iochan 13 | ``` 14 | -------------------------------------------------------------------------------- /vendor/github.com/mitchellh/iochan/iochan.go: -------------------------------------------------------------------------------- 1 | package iochan 2 | 3 | import ( 4 | "bufio" 5 | "io" 6 | ) 7 | 8 | // DelimReader takes an io.Reader and produces the contents of the reader 9 | // on the returned channel. The contents on the channel will be returned 10 | // on boundaries specified by the delim parameter, and will include this 11 | // delimiter. 12 | // 13 | // If an error occurs while reading from the reader, the reading will end. 14 | // 15 | // In the case of an EOF or error, the channel will be closed. 16 | // 17 | // This must only be called once for any individual reader. The behavior is 18 | // unknown and will be unexpected if this is called multiple times with the 19 | // same reader. 20 | func DelimReader(r io.Reader, delim byte) <-chan string { 21 | ch := make(chan string) 22 | 23 | go func() { 24 | buf := bufio.NewReader(r) 25 | 26 | for { 27 | line, err := buf.ReadString(delim) 28 | if line != "" { 29 | ch <- line 30 | } 31 | 32 | if err != nil { 33 | break 34 | } 35 | } 36 | 37 | close(ch) 38 | }() 39 | 40 | return ch 41 | } 42 | -------------------------------------------------------------------------------- /vendor/github.com/mitchellh/mapstructure/.travis.yml: -------------------------------------------------------------------------------- 1 | language: go 2 | 3 | go: 4 | - 1.4 5 | 6 | script: 7 | - go test 8 | -------------------------------------------------------------------------------- /vendor/github.com/mitchellh/mapstructure/LICENSE: -------------------------------------------------------------------------------- 1 | The MIT License (MIT) 2 | 3 | Copyright (c) 2013 Mitchell Hashimoto 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in 13 | all copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 21 | THE SOFTWARE. 22 | -------------------------------------------------------------------------------- /vendor/github.com/mitchellh/mapstructure/error.go: -------------------------------------------------------------------------------- 1 | package mapstructure 2 | 3 | import ( 4 | "errors" 5 | "fmt" 6 | "sort" 7 | "strings" 8 | ) 9 | 10 | // Error implements the error interface and can represents multiple 11 | // errors that occur in the course of a single decode. 12 | type Error struct { 13 | Errors []string 14 | } 15 | 16 | func (e *Error) Error() string { 17 | points := make([]string, len(e.Errors)) 18 | for i, err := range e.Errors { 19 | points[i] = fmt.Sprintf("* %s", err) 20 | } 21 | 22 | sort.Strings(points) 23 | return fmt.Sprintf( 24 | "%d error(s) decoding:\n\n%s", 25 | len(e.Errors), strings.Join(points, "\n")) 26 | } 27 | 28 | // WrappedErrors implements the errwrap.Wrapper interface to make this 29 | // return value more useful with the errwrap and go-multierror libraries. 30 | func (e *Error) WrappedErrors() []error { 31 | if e == nil { 32 | return nil 33 | } 34 | 35 | result := make([]error, len(e.Errors)) 36 | for i, e := range e.Errors { 37 | result[i] = errors.New(e) 38 | } 39 | 40 | return result 41 | } 42 | 43 | func appendErrors(errors []string, err error) []string { 44 | switch e := err.(type) { 45 | case *Error: 46 | return append(errors, e.Errors...) 47 | default: 48 | return append(errors, e.Error()) 49 | } 50 | } 51 | -------------------------------------------------------------------------------- /vendor/github.com/mitchellh/multistep/LICENSE.md: -------------------------------------------------------------------------------- 1 | Copyright (c) 2013 Mitchell Hashimoto 2 | 3 | MIT License 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining 6 | a copy of this software and associated documentation files (the 7 | "Software"), to deal in the Software without restriction, including 8 | without limitation the rights to use, copy, modify, merge, publish, 9 | distribute, sublicense, and/or sell copies of the Software, and to 10 | permit persons to whom the Software is furnished to do so, subject to 11 | the following conditions: 12 | 13 | The above copyright notice and this permission notice shall be 14 | included in all copies or substantial portions of the Software. 15 | 16 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 17 | EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 18 | MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 19 | NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE 20 | LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION 21 | OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION 22 | WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 23 | -------------------------------------------------------------------------------- /vendor/github.com/mitchellh/multistep/README.md: -------------------------------------------------------------------------------- 1 | # multistep 2 | 3 | multistep is a Go library for building up complex actions using discrete, 4 | individual "steps." These steps are strung together and run in sequence 5 | to achieve a more complex goal. The runner handles cleanup, cancelling, etc. 6 | if necessary. 7 | 8 | ## Basic Example 9 | 10 | Make a step to perform some action. The step can access your "state", 11 | which is passed between steps by the runner. 12 | 13 | ```go 14 | type stepAdd struct{} 15 | 16 | func (s *stepAdd) Run(state multistep.StateBag) multistep.StepAction { 17 | // Read our value and assert that it is they type we want 18 | value := state.Get("value").(int) 19 | fmt.Printf("Value is %d\n", value) 20 | 21 | // Store some state back 22 | state.Put("value", value + 1) 23 | return multistep.ActionContinue 24 | } 25 | 26 | func (s *stepAdd) Cleanup(multistep.StateBag) { 27 | // This is called after all the steps have run or if the runner is 28 | // cancelled so that cleanup can be performed. 29 | } 30 | ``` 31 | 32 | Make a runner and call your array of Steps. 33 | 34 | ```go 35 | func main() { 36 | // Our "bag of state" that we read the value from 37 | state := new(multistep.BasicStateBag) 38 | state.Put("value", 0) 39 | 40 | steps := []multistep.Step{ 41 | &stepAdd{}, 42 | &stepAdd{}, 43 | &stepAdd{}, 44 | } 45 | 46 | runner := &multistep.BasicRunner{Steps: steps} 47 | 48 | // Executes the steps 49 | runner.Run(state) 50 | } 51 | ``` 52 | 53 | This will produce: 54 | 55 | ``` 56 | Value is 0 57 | Value is 1 58 | Value is 2 59 | ``` 60 | -------------------------------------------------------------------------------- /vendor/github.com/mitchellh/multistep/statebag.go: -------------------------------------------------------------------------------- 1 | package multistep 2 | 3 | import ( 4 | "sync" 5 | ) 6 | 7 | // StateBag holds the state that is used by the Runner and Steps. The 8 | // StateBag implementation must be safe for concurrent access. 9 | type StateBag interface { 10 | Get(string) interface{} 11 | GetOk(string) (interface{}, bool) 12 | Put(string, interface{}) 13 | } 14 | 15 | // BasicStateBag implements StateBag by using a normal map underneath 16 | // protected by a RWMutex. 17 | type BasicStateBag struct { 18 | data map[string]interface{} 19 | l sync.RWMutex 20 | once sync.Once 21 | } 22 | 23 | func (b *BasicStateBag) Get(k string) interface{} { 24 | result, _ := b.GetOk(k) 25 | return result 26 | } 27 | 28 | func (b *BasicStateBag) GetOk(k string) (interface{}, bool) { 29 | b.l.RLock() 30 | defer b.l.RUnlock() 31 | 32 | result, ok := b.data[k] 33 | return result, ok 34 | } 35 | 36 | func (b *BasicStateBag) Put(k string, v interface{}) { 37 | b.l.Lock() 38 | defer b.l.Unlock() 39 | 40 | // Make sure the map is initialized one time, on write 41 | b.once.Do(func() { 42 | b.data = make(map[string]interface{}) 43 | }) 44 | 45 | // Write the data 46 | b.data[k] = v 47 | } 48 | -------------------------------------------------------------------------------- /vendor/github.com/mitchellh/osext/LICENSE: -------------------------------------------------------------------------------- 1 | Copyright (c) 2012 Daniel Theophanes 2 | 3 | This software is provided 'as-is', without any express or implied 4 | warranty. In no event will the authors be held liable for any damages 5 | arising from the use of this software. 6 | 7 | Permission is granted to anyone to use this software for any purpose, 8 | including commercial applications, and to alter it and redistribute it 9 | freely, subject to the following restrictions: 10 | 11 | 1. The origin of this software must not be misrepresented; you must not 12 | claim that you wrote the original software. If you use this software 13 | in a product, an acknowledgment in the product documentation would be 14 | appreciated but is not required. 15 | 16 | 2. Altered source versions must be plainly marked as such, and must not be 17 | misrepresented as being the original software. 18 | 19 | 3. This notice may not be removed or altered from any source 20 | distribution. 21 | -------------------------------------------------------------------------------- /vendor/github.com/mitchellh/osext/README.md: -------------------------------------------------------------------------------- 1 | # osext 2 | 3 | **Don't use this anymore! Use the official library at: https://github.com/kardianos/osext** 4 | -------------------------------------------------------------------------------- /vendor/github.com/mitchellh/osext/osext.go: -------------------------------------------------------------------------------- 1 | // Copyright 2012 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | // Extensions to the standard "os" package. 6 | package osext 7 | 8 | import "path/filepath" 9 | 10 | // Executable returns an absolute path that can be used to 11 | // re-invoke the current program. 12 | // It may not be valid after the current program exits. 13 | func Executable() (string, error) { 14 | p, err := executable() 15 | return filepath.Clean(p), err 16 | } 17 | 18 | // Returns same path as Executable, returns just the folder 19 | // path. Excludes the executable name. 20 | func ExecutableFolder() (string, error) { 21 | p, err := Executable() 22 | if err != nil { 23 | return "", err 24 | } 25 | folder, _ := filepath.Split(p) 26 | return folder, nil 27 | } 28 | 29 | // Depricated. Same as Executable(). 30 | func GetExePath() (exePath string, err error) { 31 | return Executable() 32 | } 33 | -------------------------------------------------------------------------------- /vendor/github.com/mitchellh/osext/osext_plan9.go: -------------------------------------------------------------------------------- 1 | // Copyright 2012 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | package osext 6 | 7 | import "syscall" 8 | 9 | func executable() (string, error) { 10 | f, err := Open("/proc/" + itoa(Getpid()) + "/text") 11 | if err != nil { 12 | return "", err 13 | } 14 | defer f.Close() 15 | return syscall.Fd2path(int(f.Fd())) 16 | } 17 | -------------------------------------------------------------------------------- /vendor/github.com/mitchellh/osext/osext_procfs.go: -------------------------------------------------------------------------------- 1 | // Copyright 2012 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | // +build linux netbsd openbsd 6 | 7 | package osext 8 | 9 | import ( 10 | "errors" 11 | "os" 12 | "runtime" 13 | ) 14 | 15 | func executable() (string, error) { 16 | switch runtime.GOOS { 17 | case "linux": 18 | return os.Readlink("/proc/self/exe") 19 | case "netbsd": 20 | return os.Readlink("/proc/curproc/exe") 21 | case "openbsd": 22 | return os.Readlink("/proc/curproc/file") 23 | } 24 | return "", errors.New("ExecPath not implemented for " + runtime.GOOS) 25 | } 26 | -------------------------------------------------------------------------------- /vendor/github.com/mitchellh/osext/osext_windows.go: -------------------------------------------------------------------------------- 1 | // Copyright 2012 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | package osext 6 | 7 | import ( 8 | "syscall" 9 | "unicode/utf16" 10 | "unsafe" 11 | ) 12 | 13 | var ( 14 | kernel = syscall.MustLoadDLL("kernel32.dll") 15 | getModuleFileNameProc = kernel.MustFindProc("GetModuleFileNameW") 16 | ) 17 | 18 | // GetModuleFileName() with hModule = NULL 19 | func executable() (exePath string, err error) { 20 | return getModuleFileName() 21 | } 22 | 23 | func getModuleFileName() (string, error) { 24 | var n uint32 25 | b := make([]uint16, syscall.MAX_PATH) 26 | size := uint32(len(b)) 27 | 28 | r0, _, e1 := getModuleFileNameProc.Call(0, uintptr(unsafe.Pointer(&b[0])), uintptr(size)) 29 | n = uint32(r0) 30 | if n == 0 { 31 | return "", e1 32 | } 33 | return string(utf16.Decode(b[0:n])), nil 34 | } 35 | -------------------------------------------------------------------------------- /vendor/github.com/mitchellh/packer/common/http_config.go: -------------------------------------------------------------------------------- 1 | package common 2 | 3 | import ( 4 | "errors" 5 | 6 | "github.com/mitchellh/packer/template/interpolate" 7 | ) 8 | 9 | // HTTPConfig contains configuration for the local HTTP Server 10 | type HTTPConfig struct { 11 | HTTPDir string `mapstructure:"http_directory"` 12 | HTTPPortMin uint `mapstructure:"http_port_min"` 13 | HTTPPortMax uint `mapstructure:"http_port_max"` 14 | } 15 | 16 | func (c *HTTPConfig) Prepare(ctx *interpolate.Context) []error { 17 | // Validation 18 | var errs []error 19 | 20 | if c.HTTPPortMin == 0 { 21 | c.HTTPPortMin = 8000 22 | } 23 | 24 | if c.HTTPPortMax == 0 { 25 | c.HTTPPortMax = 9000 26 | } 27 | 28 | if c.HTTPPortMin > c.HTTPPortMax { 29 | errs = append(errs, 30 | errors.New("http_port_min must be less than http_port_max")) 31 | } 32 | 33 | return errs 34 | } 35 | -------------------------------------------------------------------------------- /vendor/github.com/mitchellh/packer/common/multistep_debug.go: -------------------------------------------------------------------------------- 1 | package common 2 | 3 | import ( 4 | "fmt" 5 | "github.com/mitchellh/multistep" 6 | "github.com/mitchellh/packer/packer" 7 | "log" 8 | "time" 9 | ) 10 | 11 | // MultistepDebugFn will return a proper multistep.DebugPauseFn to 12 | // use for debugging if you're using multistep in your builder. 13 | func MultistepDebugFn(ui packer.Ui) multistep.DebugPauseFn { 14 | return func(loc multistep.DebugLocation, name string, state multistep.StateBag) { 15 | var locationString string 16 | switch loc { 17 | case multistep.DebugLocationAfterRun: 18 | locationString = "after run of" 19 | case multistep.DebugLocationBeforeCleanup: 20 | locationString = "before cleanup of" 21 | default: 22 | locationString = "at" 23 | } 24 | 25 | message := fmt.Sprintf( 26 | "Pausing %s step '%s'. Press enter to continue.", 27 | locationString, name) 28 | 29 | result := make(chan string, 1) 30 | go func() { 31 | line, err := ui.Ask(message) 32 | if err != nil { 33 | log.Printf("Error asking for input: %s", err) 34 | } 35 | 36 | result <- line 37 | }() 38 | 39 | for { 40 | select { 41 | case <-result: 42 | return 43 | case <-time.After(100 * time.Millisecond): 44 | if _, ok := state.GetOk(multistep.StateCancelled); ok { 45 | return 46 | } 47 | } 48 | } 49 | } 50 | } 51 | -------------------------------------------------------------------------------- /vendor/github.com/mitchellh/packer/common/packer_config.go: -------------------------------------------------------------------------------- 1 | package common 2 | 3 | // PackerConfig is a struct that contains the configuration keys that 4 | // are sent by packer, properly tagged already so mapstructure can load 5 | // them. Embed this structure into your configuration class to get it. 6 | type PackerConfig struct { 7 | PackerBuildName string `mapstructure:"packer_build_name"` 8 | PackerBuilderType string `mapstructure:"packer_builder_type"` 9 | PackerDebug bool `mapstructure:"packer_debug"` 10 | PackerForce bool `mapstructure:"packer_force"` 11 | PackerUserVars map[string]string `mapstructure:"packer_user_variables"` 12 | } 13 | -------------------------------------------------------------------------------- /vendor/github.com/mitchellh/packer/common/ssh/key.go: -------------------------------------------------------------------------------- 1 | package ssh 2 | 3 | import ( 4 | "encoding/pem" 5 | "fmt" 6 | "io/ioutil" 7 | "os" 8 | 9 | "golang.org/x/crypto/ssh" 10 | ) 11 | 12 | // FileSigner returns an ssh.Signer for a key file. 13 | func FileSigner(path string) (ssh.Signer, error) { 14 | f, err := os.Open(path) 15 | if err != nil { 16 | return nil, err 17 | } 18 | defer f.Close() 19 | 20 | keyBytes, err := ioutil.ReadAll(f) 21 | if err != nil { 22 | return nil, err 23 | } 24 | 25 | // We parse the private key on our own first so that we can 26 | // show a nicer error if the private key has a password. 27 | block, _ := pem.Decode(keyBytes) 28 | if block == nil { 29 | return nil, fmt.Errorf( 30 | "Failed to read key '%s': no key found", path) 31 | } 32 | if block.Headers["Proc-Type"] == "4,ENCRYPTED" { 33 | return nil, fmt.Errorf( 34 | "Failed to read key '%s': password protected keys are\n"+ 35 | "not supported. Please decrypt the key prior to use.", path) 36 | } 37 | 38 | signer, err := ssh.ParsePrivateKey(keyBytes) 39 | if err != nil { 40 | return nil, fmt.Errorf("Error setting up SSH config: %s", err) 41 | } 42 | 43 | return signer, nil 44 | } 45 | -------------------------------------------------------------------------------- /vendor/github.com/mitchellh/packer/common/step_provision.go: -------------------------------------------------------------------------------- 1 | package common 2 | 3 | import ( 4 | "github.com/mitchellh/multistep" 5 | "github.com/mitchellh/packer/packer" 6 | "log" 7 | "time" 8 | ) 9 | 10 | // StepProvision runs the provisioners. 11 | // 12 | // Uses: 13 | // communicator packer.Communicator 14 | // hook packer.Hook 15 | // ui packer.Ui 16 | // 17 | // Produces: 18 | // 19 | type StepProvision struct { 20 | Comm packer.Communicator 21 | } 22 | 23 | func (s *StepProvision) Run(state multistep.StateBag) multistep.StepAction { 24 | comm := s.Comm 25 | if comm == nil { 26 | raw, ok := state.Get("communicator").(packer.Communicator) 27 | if ok { 28 | comm = raw.(packer.Communicator) 29 | } 30 | } 31 | hook := state.Get("hook").(packer.Hook) 32 | ui := state.Get("ui").(packer.Ui) 33 | 34 | // Run the provisioner in a goroutine so we can continually check 35 | // for cancellations... 36 | log.Println("Running the provision hook") 37 | errCh := make(chan error, 1) 38 | go func() { 39 | errCh <- hook.Run(packer.HookProvision, ui, comm, nil) 40 | }() 41 | 42 | for { 43 | select { 44 | case err := <-errCh: 45 | if err != nil { 46 | state.Put("error", err) 47 | return multistep.ActionHalt 48 | } 49 | 50 | return multistep.ActionContinue 51 | case <-time.After(1 * time.Second): 52 | if _, ok := state.GetOk(multistep.StateCancelled); ok { 53 | log.Println("Cancelling provisioning due to interrupt...") 54 | hook.Cancel() 55 | return multistep.ActionHalt 56 | } 57 | } 58 | } 59 | } 60 | 61 | func (*StepProvision) Cleanup(multistep.StateBag) {} 62 | -------------------------------------------------------------------------------- /vendor/github.com/mitchellh/packer/common/uuid/uuid.go: -------------------------------------------------------------------------------- 1 | package uuid 2 | 3 | import ( 4 | "crypto/rand" 5 | "fmt" 6 | "time" 7 | ) 8 | 9 | // Generates a time ordered UUID. Top 32 bits are a timestamp, 10 | // bottom 96 are random. 11 | func TimeOrderedUUID() string { 12 | unix := uint32(time.Now().UTC().Unix()) 13 | 14 | b := make([]byte, 12) 15 | n, err := rand.Read(b) 16 | if n != len(b) { 17 | err = fmt.Errorf("Not enough entropy available") 18 | } 19 | if err != nil { 20 | panic(err) 21 | } 22 | return fmt.Sprintf("%08x-%04x-%04x-%04x-%04x%08x", 23 | unix, b[0:2], b[2:4], b[4:6], b[6:8], b[8:]) 24 | } 25 | -------------------------------------------------------------------------------- /vendor/github.com/mitchellh/packer/communicator/none/communicator.go: -------------------------------------------------------------------------------- 1 | package none 2 | 3 | import ( 4 | "errors" 5 | "github.com/mitchellh/packer/packer" 6 | "io" 7 | "os" 8 | ) 9 | 10 | type comm struct { 11 | config string 12 | } 13 | 14 | // Creates a null packer.Communicator implementation. This takes 15 | // an already existing configuration. 16 | func New(config string) (result *comm, err error) { 17 | // Establish an initial connection and connect 18 | result = &comm{ 19 | config: config, 20 | } 21 | 22 | return 23 | } 24 | 25 | func (c *comm) Start(cmd *packer.RemoteCmd) (err error) { 26 | cmd.SetExited(0) 27 | return 28 | } 29 | 30 | func (c *comm) Upload(path string, input io.Reader, fi *os.FileInfo) error { 31 | return errors.New("Upload is not implemented when communicator = 'none'") 32 | } 33 | 34 | func (c *comm) UploadDir(dst string, src string, excl []string) error { 35 | return errors.New("UploadDir is not implemented when communicator = 'none'") 36 | } 37 | 38 | func (c *comm) Download(path string, output io.Writer) error { 39 | return errors.New("Download is not implemented when communicator = 'none'") 40 | } 41 | -------------------------------------------------------------------------------- /vendor/github.com/mitchellh/packer/communicator/ssh/password.go: -------------------------------------------------------------------------------- 1 | package ssh 2 | 3 | import ( 4 | "golang.org/x/crypto/ssh" 5 | "log" 6 | ) 7 | 8 | // An implementation of ssh.KeyboardInteractiveChallenge that simply sends 9 | // back the password for all questions. The questions are logged. 10 | func PasswordKeyboardInteractive(password string) ssh.KeyboardInteractiveChallenge { 11 | return func(user, instruction string, questions []string, echos []bool) ([]string, error) { 12 | log.Printf("Keyboard interactive challenge: ") 13 | log.Printf("-- User: %s", user) 14 | log.Printf("-- Instructions: %s", instruction) 15 | for i, question := range questions { 16 | log.Printf("-- Question %d: %s", i+1, question) 17 | } 18 | 19 | // Just send the password back for all questions 20 | answers := make([]string, len(questions)) 21 | for i, _ := range answers { 22 | answers[i] = string(password) 23 | } 24 | 25 | return answers, nil 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /vendor/github.com/mitchellh/packer/communicator/winrm/config.go: -------------------------------------------------------------------------------- 1 | package winrm 2 | 3 | import ( 4 | "net/http" 5 | "time" 6 | ) 7 | 8 | // Config is used to configure the WinRM connection 9 | type Config struct { 10 | Host string 11 | Port int 12 | Username string 13 | Password string 14 | Timeout time.Duration 15 | Https bool 16 | Insecure bool 17 | TransportDecorator func(*http.Transport) http.RoundTripper 18 | } 19 | -------------------------------------------------------------------------------- /vendor/github.com/mitchellh/packer/communicator/winrm/time.go: -------------------------------------------------------------------------------- 1 | package winrm 2 | 3 | import ( 4 | "fmt" 5 | "time" 6 | ) 7 | 8 | // formatDuration formats the given time.Duration into an ISO8601 9 | // duration string. 10 | func formatDuration(duration time.Duration) string { 11 | // We're not supporting negative durations 12 | if duration.Seconds() <= 0 { 13 | return "PT0S" 14 | } 15 | 16 | h := int(duration.Hours()) 17 | m := int(duration.Minutes()) - (h * 60) 18 | s := int(duration.Seconds()) - (h*3600 + m*60) 19 | 20 | res := "PT" 21 | if h > 0 { 22 | res = fmt.Sprintf("%s%dH", res, h) 23 | } 24 | if m > 0 { 25 | res = fmt.Sprintf("%s%dM", res, m) 26 | } 27 | if s > 0 { 28 | res = fmt.Sprintf("%s%dS", res, s) 29 | } 30 | 31 | return res 32 | } 33 | -------------------------------------------------------------------------------- /vendor/github.com/mitchellh/packer/helper/communicator/ssh.go: -------------------------------------------------------------------------------- 1 | package communicator 2 | 3 | import ( 4 | "encoding/pem" 5 | "fmt" 6 | "io/ioutil" 7 | "os" 8 | 9 | "golang.org/x/crypto/ssh" 10 | ) 11 | 12 | // SSHFileSigner returns an ssh.Signer for a key file. 13 | func SSHFileSigner(path string) (ssh.Signer, error) { 14 | f, err := os.Open(path) 15 | if err != nil { 16 | return nil, err 17 | } 18 | defer f.Close() 19 | 20 | keyBytes, err := ioutil.ReadAll(f) 21 | if err != nil { 22 | return nil, err 23 | } 24 | 25 | // We parse the private key on our own first so that we can 26 | // show a nicer error if the private key has a password. 27 | block, _ := pem.Decode(keyBytes) 28 | if block == nil { 29 | return nil, fmt.Errorf( 30 | "Failed to read key '%s': no key found", path) 31 | } 32 | if block.Headers["Proc-Type"] == "4,ENCRYPTED" { 33 | return nil, fmt.Errorf( 34 | "Failed to read key '%s': password protected keys are\n"+ 35 | "not supported. Please decrypt the key prior to use.", path) 36 | } 37 | 38 | signer, err := ssh.ParsePrivateKey(keyBytes) 39 | if err != nil { 40 | return nil, fmt.Errorf("Error setting up SSH config: %s", err) 41 | } 42 | 43 | return signer, nil 44 | } 45 | -------------------------------------------------------------------------------- /vendor/github.com/mitchellh/packer/helper/communicator/winrm.go: -------------------------------------------------------------------------------- 1 | package communicator 2 | 3 | // WinRMConfig is configuration that can be returned at runtime to 4 | // dynamically configure WinRM. 5 | type WinRMConfig struct { 6 | Username string 7 | Password string 8 | } 9 | -------------------------------------------------------------------------------- /vendor/github.com/mitchellh/packer/packer/artifact_mock.go: -------------------------------------------------------------------------------- 1 | package packer 2 | 3 | // MockArtifact is an implementation of Artifact that can be used for tests. 4 | type MockArtifact struct { 5 | BuilderIdValue string 6 | FilesValue []string 7 | IdValue string 8 | StateValues map[string]interface{} 9 | DestroyCalled bool 10 | } 11 | 12 | func (a *MockArtifact) BuilderId() string { 13 | if a.BuilderIdValue == "" { 14 | return "bid" 15 | } 16 | 17 | return a.BuilderIdValue 18 | } 19 | 20 | func (a *MockArtifact) Files() []string { 21 | if a.FilesValue == nil { 22 | return []string{"a", "b"} 23 | } 24 | 25 | return a.FilesValue 26 | } 27 | 28 | func (a *MockArtifact) Id() string { 29 | id := a.IdValue 30 | if id == "" { 31 | id = "id" 32 | } 33 | 34 | return id 35 | } 36 | 37 | func (*MockArtifact) String() string { 38 | return "string" 39 | } 40 | 41 | func (a *MockArtifact) State(name string) interface{} { 42 | value, _ := a.StateValues[name] 43 | return value 44 | } 45 | 46 | func (a *MockArtifact) Destroy() error { 47 | a.DestroyCalled = true 48 | return nil 49 | } 50 | -------------------------------------------------------------------------------- /vendor/github.com/mitchellh/packer/packer/builder_mock.go: -------------------------------------------------------------------------------- 1 | package packer 2 | 3 | import ( 4 | "errors" 5 | ) 6 | 7 | // MockBuilder is an implementation of Builder that can be used for tests. 8 | // You can set some fake return values and you can keep track of what 9 | // methods were called on the builder. It is fairly basic. 10 | type MockBuilder struct { 11 | ArtifactId string 12 | PrepareWarnings []string 13 | RunErrResult bool 14 | RunNilResult bool 15 | 16 | PrepareCalled bool 17 | PrepareConfig []interface{} 18 | RunCalled bool 19 | RunCache Cache 20 | RunHook Hook 21 | RunUi Ui 22 | CancelCalled bool 23 | } 24 | 25 | func (tb *MockBuilder) Prepare(config ...interface{}) ([]string, error) { 26 | tb.PrepareCalled = true 27 | tb.PrepareConfig = config 28 | return tb.PrepareWarnings, nil 29 | } 30 | 31 | func (tb *MockBuilder) Run(ui Ui, h Hook, c Cache) (Artifact, error) { 32 | tb.RunCalled = true 33 | tb.RunHook = h 34 | tb.RunUi = ui 35 | tb.RunCache = c 36 | 37 | if tb.RunErrResult { 38 | return nil, errors.New("foo") 39 | } 40 | 41 | if tb.RunNilResult { 42 | return nil, nil 43 | } 44 | 45 | if h != nil { 46 | if err := h.Run(HookProvision, ui, new(MockCommunicator), nil); err != nil { 47 | return nil, err 48 | } 49 | } 50 | 51 | return &MockArtifact{ 52 | IdValue: tb.ArtifactId, 53 | }, nil 54 | } 55 | 56 | func (tb *MockBuilder) Cancel() { 57 | tb.CancelCalled = true 58 | } 59 | -------------------------------------------------------------------------------- /vendor/github.com/mitchellh/packer/packer/config_file.go: -------------------------------------------------------------------------------- 1 | package packer 2 | 3 | import ( 4 | "os" 5 | "path/filepath" 6 | ) 7 | 8 | // ConfigFile returns the default path to the configuration file. On 9 | // Unix-like systems this is the ".packerconfig" file in the home directory. 10 | // On Windows, this is the "packer.config" file in the application data 11 | // directory. 12 | func ConfigFile() (string, error) { 13 | return configFile() 14 | } 15 | 16 | // ConfigDir returns the configuration directory for Packer. 17 | func ConfigDir() (string, error) { 18 | return configDir() 19 | } 20 | 21 | // ConfigTmpDir returns the configuration tmp directory for Packer 22 | func ConfigTmpDir() (string, error) { 23 | if tmpdir := os.Getenv("PACKER_TMP_DIR"); tmpdir != "" { 24 | return filepath.Abs(tmpdir) 25 | } 26 | configdir, err := configDir() 27 | if err != nil { 28 | return "", err 29 | } 30 | td := filepath.Join(configdir, "tmp") 31 | _, err = os.Stat(td) 32 | if os.IsNotExist(err) { 33 | if err = os.MkdirAll(td, 0755); err != nil { 34 | return "", err 35 | } 36 | } else if err != nil { 37 | return "", err 38 | } 39 | return td, nil 40 | } 41 | -------------------------------------------------------------------------------- /vendor/github.com/mitchellh/packer/packer/config_file_unix.go: -------------------------------------------------------------------------------- 1 | // +build darwin freebsd linux netbsd openbsd 2 | 3 | package packer 4 | 5 | import ( 6 | "bytes" 7 | "errors" 8 | "log" 9 | "os" 10 | "os/exec" 11 | "path/filepath" 12 | "strings" 13 | ) 14 | 15 | func configFile() (string, error) { 16 | dir, err := homeDir() 17 | if err != nil { 18 | return "", err 19 | } 20 | 21 | return filepath.Join(dir, ".packerconfig"), nil 22 | } 23 | 24 | func configDir() (string, error) { 25 | dir, err := homeDir() 26 | if err != nil { 27 | return "", err 28 | } 29 | 30 | return filepath.Join(dir, ".packer.d"), nil 31 | } 32 | 33 | func homeDir() (string, error) { 34 | // First prefer the HOME environmental variable 35 | if home := os.Getenv("HOME"); home != "" { 36 | log.Printf("Detected home directory from env var: %s", home) 37 | return home, nil 38 | } 39 | 40 | // If that fails, try the shell 41 | var stdout bytes.Buffer 42 | cmd := exec.Command("sh", "-c", "eval echo ~$USER") 43 | cmd.Stdout = &stdout 44 | if err := cmd.Run(); err != nil { 45 | return "", err 46 | } 47 | 48 | result := strings.TrimSpace(stdout.String()) 49 | if result == "" { 50 | return "", errors.New("blank output") 51 | } 52 | 53 | return result, nil 54 | } 55 | -------------------------------------------------------------------------------- /vendor/github.com/mitchellh/packer/packer/config_file_windows.go: -------------------------------------------------------------------------------- 1 | // +build windows 2 | 3 | package packer 4 | 5 | import ( 6 | "path/filepath" 7 | "syscall" 8 | "unsafe" 9 | ) 10 | 11 | var ( 12 | shell = syscall.MustLoadDLL("Shell32.dll") 13 | getFolderPath = shell.MustFindProc("SHGetFolderPathW") 14 | ) 15 | 16 | const CSIDL_APPDATA = 26 17 | 18 | func configFile() (string, error) { 19 | dir, err := homeDir() 20 | if err != nil { 21 | return "", err 22 | } 23 | 24 | return filepath.Join(dir, "packer.config"), nil 25 | } 26 | 27 | func configDir() (string, error) { 28 | dir, err := homeDir() 29 | if err != nil { 30 | return "", err 31 | } 32 | 33 | return filepath.Join(dir, "packer.d"), nil 34 | } 35 | 36 | func homeDir() (string, error) { 37 | b := make([]uint16, syscall.MAX_PATH) 38 | 39 | // See: http://msdn.microsoft.com/en-us/library/windows/desktop/bb762181(v=vs.85).aspx 40 | r, _, err := getFolderPath.Call(0, CSIDL_APPDATA, 0, 0, uintptr(unsafe.Pointer(&b[0]))) 41 | if uint32(r) != 0 { 42 | return "", err 43 | } 44 | 45 | return syscall.UTF16ToString(b), nil 46 | } 47 | -------------------------------------------------------------------------------- /vendor/github.com/mitchellh/packer/packer/hook_mock.go: -------------------------------------------------------------------------------- 1 | package packer 2 | 3 | // MockHook is an implementation of Hook that can be used for tests. 4 | type MockHook struct { 5 | RunFunc func() error 6 | 7 | RunCalled bool 8 | RunComm Communicator 9 | RunData interface{} 10 | RunName string 11 | RunUi Ui 12 | CancelCalled bool 13 | } 14 | 15 | func (t *MockHook) Run(name string, ui Ui, comm Communicator, data interface{}) error { 16 | t.RunCalled = true 17 | t.RunComm = comm 18 | t.RunData = data 19 | t.RunName = name 20 | t.RunUi = ui 21 | 22 | if t.RunFunc == nil { 23 | return nil 24 | } 25 | 26 | return t.RunFunc() 27 | } 28 | 29 | func (t *MockHook) Cancel() { 30 | t.CancelCalled = true 31 | } 32 | -------------------------------------------------------------------------------- /vendor/github.com/mitchellh/packer/packer/multi_error.go: -------------------------------------------------------------------------------- 1 | package packer 2 | 3 | import ( 4 | "fmt" 5 | "strings" 6 | ) 7 | 8 | // MultiError is an error type to track multiple errors. This is used to 9 | // accumulate errors in cases such as configuration parsing, and returning 10 | // them as a single error. 11 | type MultiError struct { 12 | Errors []error 13 | } 14 | 15 | func (e *MultiError) Error() string { 16 | points := make([]string, len(e.Errors)) 17 | for i, err := range e.Errors { 18 | points[i] = fmt.Sprintf("* %s", err) 19 | } 20 | 21 | return fmt.Sprintf( 22 | "%d error(s) occurred:\n\n%s", 23 | len(e.Errors), strings.Join(points, "\n")) 24 | } 25 | 26 | // MultiErrorAppend is a helper function that will append more errors 27 | // onto a MultiError in order to create a larger multi-error. If the 28 | // original error is not a MultiError, it will be turned into one. 29 | func MultiErrorAppend(err error, errs ...error) *MultiError { 30 | if err == nil { 31 | err = new(MultiError) 32 | } 33 | 34 | switch err := err.(type) { 35 | case *MultiError: 36 | if err == nil { 37 | err = new(MultiError) 38 | } 39 | 40 | err.Errors = append(err.Errors, errs...) 41 | return err 42 | default: 43 | newErrs := make([]error, len(errs)+1) 44 | newErrs[0] = err 45 | copy(newErrs[1:], errs) 46 | return &MultiError{ 47 | Errors: newErrs, 48 | } 49 | } 50 | } 51 | -------------------------------------------------------------------------------- /vendor/github.com/mitchellh/packer/packer/plugin/builder.go: -------------------------------------------------------------------------------- 1 | package plugin 2 | 3 | import ( 4 | "github.com/mitchellh/packer/packer" 5 | "log" 6 | ) 7 | 8 | type cmdBuilder struct { 9 | builder packer.Builder 10 | client *Client 11 | } 12 | 13 | func (b *cmdBuilder) Prepare(config ...interface{}) ([]string, error) { 14 | defer func() { 15 | r := recover() 16 | b.checkExit(r, nil) 17 | }() 18 | 19 | return b.builder.Prepare(config...) 20 | } 21 | 22 | func (b *cmdBuilder) Run(ui packer.Ui, hook packer.Hook, cache packer.Cache) (packer.Artifact, error) { 23 | defer func() { 24 | r := recover() 25 | b.checkExit(r, nil) 26 | }() 27 | 28 | return b.builder.Run(ui, hook, cache) 29 | } 30 | 31 | func (b *cmdBuilder) Cancel() { 32 | defer func() { 33 | r := recover() 34 | b.checkExit(r, nil) 35 | }() 36 | 37 | b.builder.Cancel() 38 | } 39 | 40 | func (c *cmdBuilder) checkExit(p interface{}, cb func()) { 41 | if c.client.Exited() && cb != nil { 42 | cb() 43 | } else if p != nil && !Killed { 44 | log.Panic(p) 45 | } 46 | } 47 | -------------------------------------------------------------------------------- /vendor/github.com/mitchellh/packer/packer/plugin/hook.go: -------------------------------------------------------------------------------- 1 | package plugin 2 | 3 | import ( 4 | "github.com/mitchellh/packer/packer" 5 | "log" 6 | ) 7 | 8 | type cmdHook struct { 9 | hook packer.Hook 10 | client *Client 11 | } 12 | 13 | func (c *cmdHook) Run(name string, ui packer.Ui, comm packer.Communicator, data interface{}) error { 14 | defer func() { 15 | r := recover() 16 | c.checkExit(r, nil) 17 | }() 18 | 19 | return c.hook.Run(name, ui, comm, data) 20 | } 21 | 22 | func (c *cmdHook) Cancel() { 23 | defer func() { 24 | r := recover() 25 | c.checkExit(r, nil) 26 | }() 27 | 28 | c.hook.Cancel() 29 | } 30 | 31 | func (c *cmdHook) checkExit(p interface{}, cb func()) { 32 | if c.client.Exited() && cb != nil { 33 | cb() 34 | } else if p != nil && !Killed { 35 | log.Panic(p) 36 | } 37 | } 38 | -------------------------------------------------------------------------------- /vendor/github.com/mitchellh/packer/packer/plugin/post_processor.go: -------------------------------------------------------------------------------- 1 | package plugin 2 | 3 | import ( 4 | "github.com/mitchellh/packer/packer" 5 | "log" 6 | ) 7 | 8 | type cmdPostProcessor struct { 9 | p packer.PostProcessor 10 | client *Client 11 | } 12 | 13 | func (c *cmdPostProcessor) Configure(config ...interface{}) error { 14 | defer func() { 15 | r := recover() 16 | c.checkExit(r, nil) 17 | }() 18 | 19 | return c.p.Configure(config...) 20 | } 21 | 22 | func (c *cmdPostProcessor) PostProcess(ui packer.Ui, a packer.Artifact) (packer.Artifact, bool, error) { 23 | defer func() { 24 | r := recover() 25 | c.checkExit(r, nil) 26 | }() 27 | 28 | return c.p.PostProcess(ui, a) 29 | } 30 | 31 | func (c *cmdPostProcessor) checkExit(p interface{}, cb func()) { 32 | if c.client.Exited() && cb != nil { 33 | cb() 34 | } else if p != nil && !Killed { 35 | log.Panic(p) 36 | } 37 | } 38 | -------------------------------------------------------------------------------- /vendor/github.com/mitchellh/packer/packer/plugin/provisioner.go: -------------------------------------------------------------------------------- 1 | package plugin 2 | 3 | import ( 4 | "github.com/mitchellh/packer/packer" 5 | "log" 6 | ) 7 | 8 | type cmdProvisioner struct { 9 | p packer.Provisioner 10 | client *Client 11 | } 12 | 13 | func (c *cmdProvisioner) Prepare(configs ...interface{}) error { 14 | defer func() { 15 | r := recover() 16 | c.checkExit(r, nil) 17 | }() 18 | 19 | return c.p.Prepare(configs...) 20 | } 21 | 22 | func (c *cmdProvisioner) Provision(ui packer.Ui, comm packer.Communicator) error { 23 | defer func() { 24 | r := recover() 25 | c.checkExit(r, nil) 26 | }() 27 | 28 | return c.p.Provision(ui, comm) 29 | } 30 | 31 | func (c *cmdProvisioner) Cancel() { 32 | defer func() { 33 | r := recover() 34 | c.checkExit(r, nil) 35 | }() 36 | 37 | c.p.Cancel() 38 | } 39 | 40 | func (c *cmdProvisioner) checkExit(p interface{}, cb func()) { 41 | if c.client.Exited() && cb != nil { 42 | cb() 43 | } else if p != nil && !Killed { 44 | log.Panic(p) 45 | } 46 | } 47 | -------------------------------------------------------------------------------- /vendor/github.com/mitchellh/packer/packer/post_processor.go: -------------------------------------------------------------------------------- 1 | package packer 2 | 3 | // A PostProcessor is responsible for taking an artifact of a build 4 | // and doing some sort of post-processing to turn this into another 5 | // artifact. An example of a post-processor would be something that takes 6 | // the result of a build, compresses it, and returns a new artifact containing 7 | // a single file of the prior artifact compressed. 8 | type PostProcessor interface { 9 | // Configure is responsible for setting up configuration, storing 10 | // the state for later, and returning and errors, such as validation 11 | // errors. 12 | Configure(...interface{}) error 13 | 14 | // PostProcess takes a previously created Artifact and produces another 15 | // Artifact. If an error occurs, it should return that error. If `keep` 16 | // is to true, then the previous artifact is forcibly kept. 17 | PostProcess(Ui, Artifact) (a Artifact, keep bool, err error) 18 | } 19 | -------------------------------------------------------------------------------- /vendor/github.com/mitchellh/packer/packer/post_processor_mock.go: -------------------------------------------------------------------------------- 1 | package packer 2 | 3 | // MockPostProcessor is an implementation of PostProcessor that can be 4 | // used for tests. 5 | type MockPostProcessor struct { 6 | ArtifactId string 7 | Keep bool 8 | Error error 9 | 10 | ConfigureCalled bool 11 | ConfigureConfigs []interface{} 12 | ConfigureError error 13 | 14 | PostProcessCalled bool 15 | PostProcessArtifact Artifact 16 | PostProcessUi Ui 17 | } 18 | 19 | func (t *MockPostProcessor) Configure(configs ...interface{}) error { 20 | t.ConfigureCalled = true 21 | t.ConfigureConfigs = configs 22 | return t.ConfigureError 23 | } 24 | 25 | func (t *MockPostProcessor) PostProcess(ui Ui, a Artifact) (Artifact, bool, error) { 26 | t.PostProcessCalled = true 27 | t.PostProcessArtifact = a 28 | t.PostProcessUi = ui 29 | 30 | return &MockArtifact{ 31 | IdValue: t.ArtifactId, 32 | }, t.Keep, t.Error 33 | } 34 | -------------------------------------------------------------------------------- /vendor/github.com/mitchellh/packer/packer/provisioner_mock.go: -------------------------------------------------------------------------------- 1 | package packer 2 | 3 | // MockProvisioner is an implementation of Provisioner that can be 4 | // used for tests. 5 | type MockProvisioner struct { 6 | ProvFunc func() error 7 | 8 | PrepCalled bool 9 | PrepConfigs []interface{} 10 | ProvCalled bool 11 | ProvCommunicator Communicator 12 | ProvUi Ui 13 | CancelCalled bool 14 | } 15 | 16 | func (t *MockProvisioner) Prepare(configs ...interface{}) error { 17 | t.PrepCalled = true 18 | t.PrepConfigs = configs 19 | return nil 20 | } 21 | 22 | func (t *MockProvisioner) Provision(ui Ui, comm Communicator) error { 23 | t.ProvCalled = true 24 | t.ProvCommunicator = comm 25 | t.ProvUi = ui 26 | 27 | if t.ProvFunc == nil { 28 | return nil 29 | } 30 | 31 | return t.ProvFunc() 32 | } 33 | 34 | func (t *MockProvisioner) Cancel() { 35 | t.CancelCalled = true 36 | } 37 | -------------------------------------------------------------------------------- /vendor/github.com/mitchellh/packer/packer/rpc/dial.go: -------------------------------------------------------------------------------- 1 | package rpc 2 | 3 | import ( 4 | "net" 5 | "net/rpc" 6 | ) 7 | 8 | // rpcDial makes a TCP connection to a remote RPC server and returns 9 | // the client. This will set the connection up properly so that keep-alives 10 | // are set and so on and should be used to make all RPC connections within 11 | // this package. 12 | func rpcDial(address string) (*rpc.Client, error) { 13 | tcpConn, err := tcpDial(address) 14 | if err != nil { 15 | return nil, err 16 | } 17 | 18 | // Create an RPC client around our connection 19 | return rpc.NewClient(tcpConn), nil 20 | } 21 | 22 | // tcpDial connects via TCP to the designated address. 23 | func tcpDial(address string) (*net.TCPConn, error) { 24 | conn, err := net.Dial("tcp", address) 25 | if err != nil { 26 | return nil, err 27 | } 28 | 29 | // Set a keep-alive so that the connection stays alive even when idle 30 | tcpConn := conn.(*net.TCPConn) 31 | tcpConn.SetKeepAlive(true) 32 | return tcpConn, nil 33 | } 34 | -------------------------------------------------------------------------------- /vendor/github.com/mitchellh/packer/packer/rpc/error.go: -------------------------------------------------------------------------------- 1 | package rpc 2 | 3 | // This is a type that wraps error types so that they can be messaged 4 | // across RPC channels. Since "error" is an interface, we can't always 5 | // gob-encode the underlying structure. This is a valid error interface 6 | // implementer that we will push across. 7 | type BasicError struct { 8 | Message string 9 | } 10 | 11 | func NewBasicError(err error) *BasicError { 12 | if err == nil { 13 | return nil 14 | } 15 | 16 | return &BasicError{err.Error()} 17 | } 18 | 19 | func (e *BasicError) Error() string { 20 | return e.Message 21 | } 22 | -------------------------------------------------------------------------------- /vendor/github.com/mitchellh/packer/packer/rpc/init.go: -------------------------------------------------------------------------------- 1 | package rpc 2 | 3 | import "encoding/gob" 4 | 5 | func init() { 6 | gob.Register(new(map[string]interface{})) 7 | gob.Register(new(map[string]string)) 8 | gob.Register(make([]interface{}, 0)) 9 | gob.Register(new(BasicError)) 10 | } 11 | -------------------------------------------------------------------------------- /vendor/github.com/mitchellh/packer/template/interpolate/parse.go: -------------------------------------------------------------------------------- 1 | package interpolate 2 | 3 | import ( 4 | "fmt" 5 | "text/template" 6 | "text/template/parse" 7 | ) 8 | 9 | // functionsCalled returns a map (to be used as a set) of the functions 10 | // that are called from the given text template. 11 | func functionsCalled(t *template.Template) map[string]struct{} { 12 | result := make(map[string]struct{}) 13 | functionsCalledWalk(t.Tree.Root, result) 14 | return result 15 | } 16 | 17 | func functionsCalledWalk(raw parse.Node, r map[string]struct{}) { 18 | switch node := raw.(type) { 19 | case *parse.ActionNode: 20 | functionsCalledWalk(node.Pipe, r) 21 | case *parse.CommandNode: 22 | if in, ok := node.Args[0].(*parse.IdentifierNode); ok { 23 | r[in.Ident] = struct{}{} 24 | } 25 | 26 | for _, n := range node.Args[1:] { 27 | functionsCalledWalk(n, r) 28 | } 29 | case *parse.ListNode: 30 | for _, n := range node.Nodes { 31 | functionsCalledWalk(n, r) 32 | } 33 | case *parse.PipeNode: 34 | for _, n := range node.Cmds { 35 | functionsCalledWalk(n, r) 36 | } 37 | case *parse.StringNode, *parse.TextNode: 38 | // Ignore 39 | default: 40 | panic(fmt.Sprintf("unknown type: %T", node)) 41 | } 42 | } 43 | -------------------------------------------------------------------------------- /vendor/github.com/mitchellh/reflectwalk/LICENSE: -------------------------------------------------------------------------------- 1 | The MIT License (MIT) 2 | 3 | Copyright (c) 2013 Mitchell Hashimoto 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in 13 | all copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 21 | THE SOFTWARE. 22 | -------------------------------------------------------------------------------- /vendor/github.com/mitchellh/reflectwalk/README.md: -------------------------------------------------------------------------------- 1 | # reflectwalk 2 | 3 | reflectwalk is a Go library for "walking" a value in Go using reflection, 4 | in the same way a directory tree can be "walked" on the filesystem. Walking 5 | a complex structure can allow you to do manipulations on unknown structures 6 | such as those decoded from JSON. 7 | -------------------------------------------------------------------------------- /vendor/github.com/mitchellh/reflectwalk/location.go: -------------------------------------------------------------------------------- 1 | package reflectwalk 2 | 3 | //go:generate stringer -type=Location location.go 4 | 5 | type Location uint 6 | 7 | const ( 8 | None Location = iota 9 | Map 10 | MapKey 11 | MapValue 12 | Slice 13 | SliceElem 14 | Struct 15 | StructField 16 | WalkLoc 17 | ) 18 | -------------------------------------------------------------------------------- /vendor/github.com/mitchellh/reflectwalk/location_string.go: -------------------------------------------------------------------------------- 1 | // generated by stringer -type=Location location.go; DO NOT EDIT 2 | 3 | package reflectwalk 4 | 5 | import "fmt" 6 | 7 | const _Location_name = "NoneMapMapKeyMapValueSliceSliceElemStructStructFieldWalkLoc" 8 | 9 | var _Location_index = [...]uint8{0, 4, 7, 13, 21, 26, 35, 41, 52, 59} 10 | 11 | func (i Location) String() string { 12 | if i+1 >= Location(len(_Location_index)) { 13 | return fmt.Sprintf("Location(%d)", i) 14 | } 15 | return _Location_name[_Location_index[i]:_Location_index[i+1]] 16 | } 17 | -------------------------------------------------------------------------------- /vendor/github.com/nilshell/xmlrpc/.gitignore: -------------------------------------------------------------------------------- 1 | example/example 2 | -------------------------------------------------------------------------------- /vendor/github.com/nilshell/xmlrpc/doc.go: -------------------------------------------------------------------------------- 1 | /* 2 | Package xmlrpc implements the XML-RPC specification: 3 | http://xmlrpc.scripting.com/spec.html 4 | 5 | TODO: Actual usage documentation here 6 | */ 7 | package xmlrpc 8 | -------------------------------------------------------------------------------- /vendor/github.com/nilshell/xmlrpc/response.go: -------------------------------------------------------------------------------- 1 | package xmlrpc 2 | 3 | import ( 4 | "fmt" 5 | "regexp" 6 | ) 7 | 8 | // responseFailed checks whether response failed or not. Response defined as failed if it 9 | // contains ... section. 10 | func responseFailed(response []byte) (bool, error) { 11 | fault := true 12 | faultRegexp, err := regexp.Compile(`(\s|\S)+`) 13 | 14 | if err == nil { 15 | fault = faultRegexp.Match(response) 16 | } 17 | 18 | return fault, err 19 | } 20 | 21 | func parseSuccessfulResponse(response []byte) (interface{}, error) { 22 | valueXml := getValueXml(response) 23 | return parseValue(valueXml) 24 | } 25 | 26 | func parseFailedResponse(response []byte) (err error) { 27 | var valueXml []byte 28 | valueXml = getValueXml(response) 29 | 30 | value, err := parseValue(valueXml) 31 | faultDetails := value.(Struct) 32 | 33 | if err != nil { 34 | return err 35 | } 36 | 37 | return &(xmlrpcError{ 38 | code: fmt.Sprintf("%v", faultDetails["faultCode"]), 39 | message: faultDetails["faultString"].(string), 40 | }) 41 | } 42 | 43 | func getValueXml(rawXml []byte) []byte { 44 | expr, _ := regexp.Compile(`(\s|\S)+`) 45 | return expr.Find(rawXml) 46 | 47 | } 48 | -------------------------------------------------------------------------------- /vendor/github.com/nilshell/xmlrpc/xmlrpc.go: -------------------------------------------------------------------------------- 1 | package xmlrpc 2 | 3 | import ( 4 | "fmt" 5 | ) 6 | 7 | // Struct presents hash type used in xmlprc requests and responses. 8 | type Struct map[string]interface{} 9 | 10 | // Base64 represents base64 data 11 | type Base64 string 12 | 13 | // Params represents a list of parameters to a method. 14 | type Params struct { 15 | Params []interface{} 16 | } 17 | 18 | // xmlrpcError represents errors returned on xmlrpc request. 19 | type xmlrpcError struct { 20 | code string 21 | message string 22 | } 23 | 24 | // Error() method implements Error interface 25 | func (e *xmlrpcError) Error() string { 26 | return fmt.Sprintf("Error: \"%s\" Code: %s", e.message, e.code) 27 | } 28 | -------------------------------------------------------------------------------- /vendor/github.com/nu7hatch/gouuid/.gitignore: -------------------------------------------------------------------------------- 1 | _obj 2 | _test 3 | *.6 4 | *.out 5 | _testmain.go 6 | \#* 7 | .\#* 8 | *.log 9 | _cgo* 10 | *.o 11 | *.a 12 | -------------------------------------------------------------------------------- /vendor/github.com/nu7hatch/gouuid/COPYING: -------------------------------------------------------------------------------- 1 | Copyright (C) 2011 by Krzysztof Kowalik 2 | 3 | Permission is hereby granted, free of charge, to any person obtaining a copy of 4 | this software and associated documentation files (the "Software"), to deal in 5 | the Software without restriction, including without limitation the rights to 6 | use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies 7 | of the Software, and to permit persons to whom the Software is furnished to do 8 | so, subject to the following conditions: 9 | 10 | The above copyright notice and this permission notice shall be included in all 11 | copies or substantial portions of the Software. 12 | 13 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 14 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 15 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 16 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 17 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 18 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 19 | SOFTWARE. -------------------------------------------------------------------------------- /vendor/github.com/nu7hatch/gouuid/README.md: -------------------------------------------------------------------------------- 1 | # Pure Go UUID implementation 2 | 3 | This package provides immutable UUID structs and the functions 4 | NewV3, NewV4, NewV5 and Parse() for generating versions 3, 4 5 | and 5 UUIDs as specified in [RFC 4122](http://www.ietf.org/rfc/rfc4122.txt). 6 | 7 | ## Installation 8 | 9 | Use the `go` tool: 10 | 11 | $ go get github.com/nu7hatch/gouuid 12 | 13 | ## Usage 14 | 15 | See [documentation and examples](http://godoc.org/github.com/nu7hatch/gouuid) 16 | for more information. 17 | 18 | ## Copyright 19 | 20 | Copyright (C) 2011 by Krzysztof Kowalik . See [COPYING](https://github.com/nu7hatch/gouuid/tree/master/COPYING) 21 | file for details. 22 | -------------------------------------------------------------------------------- /vendor/github.com/packer-community/winrmcp/LICENSE: -------------------------------------------------------------------------------- 1 | Copyright (c) 2015 Dylan Meissner 2 | 3 | MIT License 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining 6 | a copy of this software and associated documentation files (the 7 | "Software"), to deal in the Software without restriction, including 8 | without limitation the rights to use, copy, modify, merge, publish, 9 | distribute, sublicense, and/or sell copies of the Software, and to 10 | permit persons to whom the Software is furnished to do so, subject to 11 | the following conditions: 12 | 13 | The above copyright notice and this permission notice shall be 14 | included in all copies or substantial portions of the Software. 15 | 16 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 17 | EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 18 | MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 19 | NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE 20 | LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION 21 | OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION 22 | WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 23 | -------------------------------------------------------------------------------- /vendor/github.com/packer-community/winrmcp/winrmcp/endpoint.go: -------------------------------------------------------------------------------- 1 | package winrmcp 2 | 3 | import ( 4 | "errors" 5 | "fmt" 6 | "net" 7 | "strconv" 8 | "strings" 9 | 10 | "github.com/masterzen/winrm/winrm" 11 | ) 12 | 13 | func parseEndpoint(addr string, https bool, insecure bool, caCert []byte) (*winrm.Endpoint, error) { 14 | var host string 15 | var port int 16 | 17 | if addr == "" { 18 | return nil, errors.New("Couldn't convert \"\" to an address.") 19 | } 20 | if !strings.Contains(addr, ":") { 21 | host = addr 22 | port = 5985 23 | } else { 24 | shost, sport, err := net.SplitHostPort(addr) 25 | if err != nil { 26 | return nil, errors.New(fmt.Sprintf("Couldn't convert \"%s\" to an address.", addr)) 27 | } 28 | host = shost 29 | port, err = strconv.Atoi(sport) 30 | if err != nil { 31 | return nil, errors.New("Couldn't convert \"%s\" to a port number.") 32 | } 33 | } 34 | 35 | return &winrm.Endpoint{ 36 | Host: host, 37 | Port: port, 38 | HTTPS: https, 39 | Insecure: insecure, 40 | CACert: &caCert, 41 | }, nil 42 | } 43 | -------------------------------------------------------------------------------- /vendor/github.com/packer-community/winrmcp/winrmcp/path.go: -------------------------------------------------------------------------------- 1 | package winrmcp 2 | 3 | import ( 4 | "fmt" 5 | "strings" 6 | ) 7 | 8 | func winPath(path string) string { 9 | if len(path) == 0 { 10 | return path 11 | } 12 | 13 | if strings.Contains(path, " ") { 14 | path = fmt.Sprintf("'%s'", strings.Trim(path, "'\"")) 15 | } 16 | 17 | return strings.Replace(path, "/", "\\", -1) 18 | } 19 | -------------------------------------------------------------------------------- /vendor/github.com/packer-community/winrmcp/winrmcp/psobject.go: -------------------------------------------------------------------------------- 1 | package winrmcp 2 | 3 | type pslist struct { 4 | Objects []psobject `xml:"Object"` 5 | } 6 | 7 | type psobject struct { 8 | Properties []psproperty `xml:"Property"` 9 | Value string `xml:",innerxml"` 10 | } 11 | 12 | type psproperty struct { 13 | Name string `xml:"Name,attr"` 14 | Value string `xml:",innerxml"` 15 | } 16 | 17 | 18 | -------------------------------------------------------------------------------- /vendor/github.com/pkg/errors/.gitignore: -------------------------------------------------------------------------------- 1 | # Compiled Object files, Static and Dynamic libs (Shared Objects) 2 | *.o 3 | *.a 4 | *.so 5 | 6 | # Folders 7 | _obj 8 | _test 9 | 10 | # Architecture specific extensions/prefixes 11 | *.[568vq] 12 | [568vq].out 13 | 14 | *.cgo1.go 15 | *.cgo2.c 16 | _cgo_defun.c 17 | _cgo_gotypes.go 18 | _cgo_export.* 19 | 20 | _testmain.go 21 | 22 | *.exe 23 | *.test 24 | *.prof 25 | -------------------------------------------------------------------------------- /vendor/github.com/pkg/errors/.travis.yml: -------------------------------------------------------------------------------- 1 | language: go 2 | go_import_path: github.com/pkg/errors 3 | go: 4 | - 1.4.3 5 | - 1.5.4 6 | - 1.6.2 7 | - tip 8 | 9 | script: 10 | - go test -v ./... 11 | -------------------------------------------------------------------------------- /vendor/github.com/pkg/errors/LICENSE: -------------------------------------------------------------------------------- 1 | Copyright (c) 2015, Dave Cheney 2 | All rights reserved. 3 | 4 | Redistribution and use in source and binary forms, with or without 5 | modification, are permitted provided that the following conditions are met: 6 | 7 | * Redistributions of source code must retain the above copyright notice, this 8 | list of conditions and the following disclaimer. 9 | 10 | * Redistributions in binary form must reproduce the above copyright notice, 11 | this list of conditions and the following disclaimer in the documentation 12 | and/or other materials provided with the distribution. 13 | 14 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 15 | AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 16 | IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 17 | DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE 18 | FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 19 | DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR 20 | SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER 21 | CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, 22 | OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 23 | OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 24 | -------------------------------------------------------------------------------- /vendor/github.com/pkg/errors/appveyor.yml: -------------------------------------------------------------------------------- 1 | version: build-{build}.{branch} 2 | 3 | clone_folder: C:\gopath\src\github.com\pkg\errors 4 | shallow_clone: true # for startup speed 5 | 6 | environment: 7 | GOPATH: C:\gopath 8 | 9 | platform: 10 | - x64 11 | 12 | # http://www.appveyor.com/docs/installed-software 13 | install: 14 | # some helpful output for debugging builds 15 | - go version 16 | - go env 17 | # pre-installed MinGW at C:\MinGW is 32bit only 18 | # but MSYS2 at C:\msys64 has mingw64 19 | - set PATH=C:\msys64\mingw64\bin;%PATH% 20 | - gcc --version 21 | - g++ --version 22 | 23 | build_script: 24 | - go install -v ./... 25 | 26 | test_script: 27 | - set PATH=C:\gopath\bin;%PATH% 28 | - go test -v ./... 29 | 30 | #artifacts: 31 | # - path: '%GOPATH%\bin\*.exe' 32 | deploy: off 33 | -------------------------------------------------------------------------------- /vendor/github.com/pkg/sftp/.gitignore: -------------------------------------------------------------------------------- 1 | .*.swo 2 | .*.swp 3 | 4 | server_standalone/server_standalone 5 | 6 | examples/sftp-server/id_rsa 7 | examples/sftp-server/id_rsa.pub 8 | examples/sftp-server/sftp-server 9 | -------------------------------------------------------------------------------- /vendor/github.com/pkg/sftp/.travis.yml: -------------------------------------------------------------------------------- 1 | language: go 2 | go_import_path: github.com/pkg/sftp 3 | go: 4 | - 1.4.3 5 | - 1.5.2 6 | - 1.6.2 7 | - tip 8 | 9 | sudo: false 10 | 11 | addons: 12 | ssh_known_hosts: 13 | - bitbucket.org 14 | 15 | install: 16 | - go get -t -v ./... 17 | - ssh-keygen -t rsa -q -P "" -f /home/travis/.ssh/id_rsa 18 | 19 | script: 20 | - go test -integration -v ./... 21 | - go test -testserver -v ./... 22 | - go test -integration -testserver -v ./... 23 | - go test -race -integration -v ./... 24 | - go test -race -testserver -v ./... 25 | - go test -race -integration -testserver -v ./... 26 | -------------------------------------------------------------------------------- /vendor/github.com/pkg/sftp/CONTRIBUTORS: -------------------------------------------------------------------------------- 1 | Dave Cheney 2 | Saulius Gurklys 3 | -------------------------------------------------------------------------------- /vendor/github.com/pkg/sftp/LICENSE: -------------------------------------------------------------------------------- 1 | Copyright (c) 2013, Dave Cheney 2 | All rights reserved. 3 | 4 | Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: 5 | 6 | * Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. 7 | * 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. 8 | 9 | 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. 10 | -------------------------------------------------------------------------------- /vendor/github.com/pkg/sftp/README.md: -------------------------------------------------------------------------------- 1 | sftp 2 | ---- 3 | 4 | The `sftp` package provides support for file system operations on remote ssh servers using the SFTP subsystem. 5 | 6 | [![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) 7 | 8 | usage and examples 9 | ------------------ 10 | 11 | See [godoc.org/github.com/pkg/sftp](http://godoc.org/github.com/pkg/sftp) for examples and usage. 12 | 13 | The basic operation of the package mirrors the facilities of the [os](http://golang.org/pkg/os) package. 14 | 15 | The Walker interface for directory traversal is heavily inspired by Keith Rarick's [fs](http://godoc.org/github.com/kr/fs) package. 16 | 17 | roadmap 18 | ------- 19 | 20 | * 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. 21 | 22 | contributing 23 | ------------ 24 | 25 | We welcome pull requests, bug fixes and issue reports. 26 | 27 | Before proposing a large change, first please discuss your change by raising an issue. 28 | -------------------------------------------------------------------------------- /vendor/github.com/pkg/sftp/attrs_stubs.go: -------------------------------------------------------------------------------- 1 | // +build !cgo,!plan9 windows android 2 | 3 | package sftp 4 | 5 | import ( 6 | "os" 7 | ) 8 | 9 | func fileStatFromInfoOs(fi os.FileInfo, flags *uint32, fileStat *FileStat) { 10 | // todo 11 | } 12 | -------------------------------------------------------------------------------- /vendor/github.com/pkg/sftp/attrs_unix.go: -------------------------------------------------------------------------------- 1 | // +build darwin dragonfly freebsd !android,linux netbsd openbsd solaris 2 | // +build cgo 3 | 4 | package sftp 5 | 6 | import ( 7 | "os" 8 | "syscall" 9 | ) 10 | 11 | func fileStatFromInfoOs(fi os.FileInfo, flags *uint32, fileStat *FileStat) { 12 | if statt, ok := fi.Sys().(*syscall.Stat_t); ok { 13 | *flags |= ssh_FILEXFER_ATTR_UIDGID 14 | fileStat.UID = statt.Uid 15 | fileStat.GID = statt.Gid 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /vendor/github.com/pkg/sftp/debug.go: -------------------------------------------------------------------------------- 1 | // +build debug 2 | 3 | package sftp 4 | 5 | import "log" 6 | 7 | func debug(fmt string, args ...interface{}) { 8 | log.Printf(fmt, args...) 9 | } 10 | -------------------------------------------------------------------------------- /vendor/github.com/pkg/sftp/release.go: -------------------------------------------------------------------------------- 1 | // +build !debug 2 | 3 | package sftp 4 | 5 | func debug(fmt string, args ...interface{}) {} 6 | -------------------------------------------------------------------------------- /vendor/github.com/pkg/sftp/server_statvfs_darwin.go: -------------------------------------------------------------------------------- 1 | package sftp 2 | 3 | import ( 4 | "syscall" 5 | ) 6 | 7 | func statvfsFromStatfst(stat *syscall.Statfs_t) (*StatVFS, error) { 8 | return &StatVFS{ 9 | Bsize: uint64(stat.Bsize), 10 | Frsize: uint64(stat.Bsize), // fragment size is a linux thing; use block size here 11 | Blocks: stat.Blocks, 12 | Bfree: stat.Bfree, 13 | Bavail: stat.Bavail, 14 | Files: stat.Files, 15 | Ffree: stat.Ffree, 16 | Favail: stat.Ffree, // not sure how to calculate Favail 17 | Fsid: uint64(uint64(stat.Fsid.Val[1])<<32 | uint64(stat.Fsid.Val[0])), // endianness? 18 | Flag: uint64(stat.Flags), // assuming POSIX? 19 | Namemax: 1024, // man 2 statfs shows: #define MAXPATHLEN 1024 20 | }, nil 21 | } 22 | -------------------------------------------------------------------------------- /vendor/github.com/pkg/sftp/server_statvfs_impl.go: -------------------------------------------------------------------------------- 1 | // +build darwin linux 2 | 3 | // fill in statvfs structure with OS specific values 4 | // Statfs_t is different per-kernel, and only exists on some unixes (not Solaris for instance) 5 | 6 | package sftp 7 | 8 | import ( 9 | "syscall" 10 | ) 11 | 12 | func (p sshFxpExtendedPacketStatVFS) respond(svr *Server) error { 13 | stat := &syscall.Statfs_t{} 14 | if err := syscall.Statfs(p.Path, stat); err != nil { 15 | return svr.sendPacket(statusFromError(p, err)) 16 | } 17 | 18 | retPkt, err := statvfsFromStatfst(stat) 19 | if err != nil { 20 | return svr.sendPacket(statusFromError(p, err)) 21 | } 22 | retPkt.ID = p.ID 23 | 24 | return svr.sendPacket(retPkt) 25 | } 26 | -------------------------------------------------------------------------------- /vendor/github.com/pkg/sftp/server_statvfs_linux.go: -------------------------------------------------------------------------------- 1 | // +build !gccgo,linux 2 | 3 | package sftp 4 | 5 | import ( 6 | "syscall" 7 | ) 8 | 9 | func statvfsFromStatfst(stat *syscall.Statfs_t) (*StatVFS, error) { 10 | return &StatVFS{ 11 | Bsize: uint64(stat.Bsize), 12 | Frsize: uint64(stat.Frsize), 13 | Blocks: stat.Blocks, 14 | Bfree: stat.Bfree, 15 | Bavail: stat.Bavail, 16 | Files: stat.Files, 17 | Ffree: stat.Ffree, 18 | Favail: stat.Ffree, // not sure how to calculate Favail 19 | Fsid: uint64(uint64(stat.Fsid.X__val[1])<<32 | uint64(stat.Fsid.X__val[0])), // endianness? 20 | Flag: uint64(stat.Flags), // assuming POSIX? 21 | Namemax: uint64(stat.Namelen), 22 | }, nil 23 | } 24 | -------------------------------------------------------------------------------- /vendor/github.com/pkg/sftp/server_statvfs_stubs.go: -------------------------------------------------------------------------------- 1 | // +build !darwin,!linux gccgo 2 | 3 | package sftp 4 | 5 | import ( 6 | "syscall" 7 | ) 8 | 9 | func (p sshFxpExtendedPacketStatVFS) respond(svr *Server) error { 10 | return syscall.ENOTSUP 11 | } 12 | -------------------------------------------------------------------------------- /vendor/github.com/pkg/sftp/server_stubs.go: -------------------------------------------------------------------------------- 1 | // +build !cgo,!plan9 windows android 2 | 3 | package sftp 4 | 5 | import ( 6 | "os" 7 | "path" 8 | ) 9 | 10 | func runLs(dirname string, dirent os.FileInfo) string { 11 | return path.Join(dirname, dirent.Name()) 12 | } 13 | -------------------------------------------------------------------------------- /vendor/github.com/satori/go.uuid/.travis.yml: -------------------------------------------------------------------------------- 1 | language: go 2 | go: 3 | - 1.0 4 | - 1.1 5 | - 1.2 6 | - 1.3 7 | - 1.4 8 | - 1.5 9 | sudo: false 10 | notifications: 11 | email: false 12 | -------------------------------------------------------------------------------- /vendor/github.com/satori/go.uuid/LICENSE: -------------------------------------------------------------------------------- 1 | Copyright (C) 2013-2015 by Maxim Bublis 2 | 3 | Permission is hereby granted, free of charge, to any person obtaining 4 | a copy of this software and associated documentation files (the 5 | "Software"), to deal in the Software without restriction, including 6 | without limitation the rights to use, copy, modify, merge, publish, 7 | distribute, sublicense, and/or sell copies of the Software, and to 8 | permit persons to whom the Software is furnished to do so, subject to 9 | the following conditions: 10 | 11 | The above copyright notice and this permission notice shall be 12 | included in all copies or substantial portions of the Software. 13 | 14 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 15 | EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 16 | MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 17 | NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE 18 | LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION 19 | OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION 20 | WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 21 | -------------------------------------------------------------------------------- /vendor/github.com/svanharmelen/gocs/.gitignore: -------------------------------------------------------------------------------- 1 | # Compiled Object files, Static and Dynamic libs (Shared Objects) 2 | *.o 3 | *.a 4 | *.so 5 | 6 | # Folders 7 | _obj 8 | _test 9 | 10 | # Architecture specific extensions/prefixes 11 | *.[568vq] 12 | [568vq].out 13 | 14 | *.cgo1.go 15 | *.cgo2.c 16 | _cgo_defun.c 17 | _cgo_gotypes.go 18 | _cgo_export.* 19 | 20 | _testmain.go 21 | 22 | *.exe 23 | -------------------------------------------------------------------------------- /vendor/github.com/svanharmelen/gocs/README.md: -------------------------------------------------------------------------------- 1 | # gocs 2 | 3 | gocs is a CloudStack client that enables Go programs to interact with the CloudStack API in a simple and uniform way. 4 | The package itself is smart enough to learn the available CloudStack API commands and the required and optional 5 | parameters of all available commands (using the listApis command), so it can be used with any given version of 6 | CloudStack. 7 | 8 | Based on the processed info about all available commands and their details, the request functions will check 9 | if all required parameters have a value and if all other used parameters are valid parameters for the requested 10 | command before actually passing the request to the API. In case of any errors during this validation or when 11 | executing the actual request, detailed error info will be returned to the requesting function making it very 12 | easy to understand and fix the problem. 13 | 14 | 15 | ## Usage 16 | 17 | Install/Update the Go package: 18 | ``` 19 | go get -u github.com/svanharmelen/gocs 20 | ``` 21 | 22 | Add this to your Go program: 23 | ``` 24 | import "github.com/svanharmelen/gocs" 25 | ``` 26 | 27 | 28 | ## Documentation 29 | 30 | Package documentation is dynamically generated from the source code at [GoDoc](http://godoc.org/github.com/svanharmelen/gocs) 31 | -------------------------------------------------------------------------------- /vendor/github.com/ugorji/go/LICENSE: -------------------------------------------------------------------------------- 1 | The MIT License (MIT) 2 | 3 | Copyright (c) 2012-2015 Ugorji Nwoke. 4 | All rights reserved. 5 | 6 | Permission is hereby granted, free of charge, to any person obtaining a copy 7 | of this software and associated documentation files (the "Software"), to deal 8 | in the Software without restriction, including without limitation the rights 9 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 10 | copies of the Software, and to permit persons to whom the Software is 11 | furnished to do so, subject to the following conditions: 12 | 13 | The above copyright notice and this permission notice shall be included in all 14 | copies or substantial portions of the Software. 15 | 16 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 20 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 21 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 22 | SOFTWARE. 23 | -------------------------------------------------------------------------------- /vendor/github.com/ugorji/go/codec/fast-path.not.go: -------------------------------------------------------------------------------- 1 | // +build notfastpath 2 | 3 | package codec 4 | 5 | import "reflect" 6 | 7 | // The generated fast-path code is very large, and adds a few seconds to the build time. 8 | // This causes test execution, execution of small tools which use codec, etc 9 | // to take a long time. 10 | // 11 | // To mitigate, we now support the notfastpath tag. 12 | // This tag disables fastpath during build, allowing for faster build, test execution, 13 | // short-program runs, etc. 14 | 15 | func fastpathDecodeTypeSwitch(iv interface{}, d *Decoder) bool { return false } 16 | func fastpathEncodeTypeSwitch(iv interface{}, e *Encoder) bool { return false } 17 | func fastpathEncodeTypeSwitchSlice(iv interface{}, e *Encoder) bool { return false } 18 | func fastpathEncodeTypeSwitchMap(iv interface{}, e *Encoder) bool { return false } 19 | 20 | type fastpathT struct{} 21 | type fastpathE struct { 22 | rtid uintptr 23 | rt reflect.Type 24 | encfn func(*encFnInfo, reflect.Value) 25 | decfn func(*decFnInfo, reflect.Value) 26 | } 27 | type fastpathA [0]fastpathE 28 | 29 | func (x fastpathA) index(rtid uintptr) int { return -1 } 30 | 31 | var fastpathAV fastpathA 32 | var fastpathTV fastpathT 33 | -------------------------------------------------------------------------------- /vendor/github.com/ugorji/go/codec/helper_not_unsafe.go: -------------------------------------------------------------------------------- 1 | //+build !unsafe 2 | 3 | // Copyright (c) 2012-2015 Ugorji Nwoke. All rights reserved. 4 | // Use of this source code is governed by a MIT license found in the LICENSE file. 5 | 6 | package codec 7 | 8 | // stringView returns a view of the []byte as a string. 9 | // In unsafe mode, it doesn't incur allocation and copying caused by conversion. 10 | // In regular safe mode, it is an allocation and copy. 11 | func stringView(v []byte) string { 12 | return string(v) 13 | } 14 | 15 | // bytesView returns a view of the string as a []byte. 16 | // In unsafe mode, it doesn't incur allocation and copying caused by conversion. 17 | // In regular safe mode, it is an allocation and copy. 18 | func bytesView(v string) []byte { 19 | return []byte(v) 20 | } 21 | -------------------------------------------------------------------------------- /vendor/github.com/ugorji/go/codec/helper_unsafe.go: -------------------------------------------------------------------------------- 1 | //+build unsafe 2 | 3 | // Copyright (c) 2012-2015 Ugorji Nwoke. All rights reserved. 4 | // Use of this source code is governed by a MIT license found in the LICENSE file. 5 | 6 | package codec 7 | 8 | import ( 9 | "unsafe" 10 | ) 11 | 12 | // This file has unsafe variants of some helper methods. 13 | 14 | type unsafeString struct { 15 | Data uintptr 16 | Len int 17 | } 18 | 19 | type unsafeBytes struct { 20 | Data uintptr 21 | Len int 22 | Cap int 23 | } 24 | 25 | // stringView returns a view of the []byte as a string. 26 | // In unsafe mode, it doesn't incur allocation and copying caused by conversion. 27 | // In regular safe mode, it is an allocation and copy. 28 | func stringView(v []byte) string { 29 | if len(v) == 0 { 30 | return "" 31 | } 32 | x := unsafeString{uintptr(unsafe.Pointer(&v[0])), len(v)} 33 | return *(*string)(unsafe.Pointer(&x)) 34 | } 35 | 36 | // bytesView returns a view of the string as a []byte. 37 | // In unsafe mode, it doesn't incur allocation and copying caused by conversion. 38 | // In regular safe mode, it is an allocation and copy. 39 | func bytesView(v string) []byte { 40 | if len(v) == 0 { 41 | return zeroByteSlice 42 | } 43 | x := unsafeBytes{uintptr(unsafe.Pointer(&v)), len(v), len(v)} 44 | return *(*[]byte)(unsafe.Pointer(&x)) 45 | } 46 | -------------------------------------------------------------------------------- /vendor/github.com/ugorji/go/codec/prebuild.go: -------------------------------------------------------------------------------- 1 | package codec 2 | 3 | //go:generate bash prebuild.sh 4 | -------------------------------------------------------------------------------- /vendor/github.com/xenserver/go-xenserver-client/.travis.yml: -------------------------------------------------------------------------------- 1 | language: go 2 | go: 3 | # Test with the first and the latest go release - to ensure compatibility 4 | - 1 5 | - release 6 | script: 7 | - gofmtresult=$(gofmt -s -l .); if [[ -n $gofmtresult ]]; then echo -e "Please run \"gofmt -s -w .\" before committing for the below:\n$gofmtresult"; false; fi 8 | -------------------------------------------------------------------------------- /vendor/github.com/xenserver/go-xenserver-client/LICENCE: -------------------------------------------------------------------------------- 1 | Copyright (c) 2015, Citrix Systems Inc. 2 | All rights reserved. 3 | 4 | Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: 5 | 6 | 1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. 7 | 8 | 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. 9 | 10 | 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. 11 | -------------------------------------------------------------------------------- /vendor/github.com/xenserver/go-xenserver-client/README.md: -------------------------------------------------------------------------------- 1 | [![Build Status](https://travis-ci.org/xenserver/go-xenserver-client.svg?branch=master)](https://travis-ci.org/xenserver/go-xenserver-client) 2 | 3 | go-xenserver-client 4 | =================== 5 | 6 | This is the beginnings of a golang client library for XenAPI. 7 | 8 | 9 | Disclaimer! 10 | ----------- 11 | Please note that this library is currently **experimental** and only 12 | enables a limited subset of XenAPI's interface. 13 | 14 | As with any early beginnings of a project, the interfaces are also subject to 15 | change, so please beware! 16 | 17 | And of course, contributions are most welcome! 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | -------------------------------------------------------------------------------- /vendor/github.com/xenserver/go-xenserver-client/host.go: -------------------------------------------------------------------------------- 1 | package client 2 | 3 | import ( 4 | "github.com/nilshell/xmlrpc" 5 | ) 6 | 7 | type Host XenAPIObject 8 | 9 | func (self *Host) CallPlugin(plugin, method string, params map[string]string) (response string, err error) { 10 | result := APIResult{} 11 | params_rec := make(xmlrpc.Struct) 12 | for key, value := range params { 13 | params_rec[key] = value 14 | } 15 | err = self.Client.APICall(&result, "host.call_plugin", self.Ref, plugin, method, params_rec) 16 | if err != nil { 17 | return "", err 18 | } 19 | response = result.Value.(string) 20 | return 21 | } 22 | 23 | func (self *Host) GetAddress() (address string, err error) { 24 | result := APIResult{} 25 | err = self.Client.APICall(&result, "host.get_address", self.Ref) 26 | if err != nil { 27 | return "", err 28 | } 29 | address = result.Value.(string) 30 | return address, nil 31 | } 32 | 33 | func (self *Host) GetSoftwareVersion() (versions map[string]interface{}, err error) { 34 | versions = make(map[string]interface{}) 35 | 36 | result := APIResult{} 37 | err = self.Client.APICall(&result, "host.get_software_version", self.Ref) 38 | if err != nil { 39 | return nil, err 40 | } 41 | 42 | for k, v := range result.Value.(xmlrpc.Struct) { 43 | versions[k] = v.(string) 44 | } 45 | return 46 | } 47 | -------------------------------------------------------------------------------- /vendor/github.com/xenserver/go-xenserver-client/network.go: -------------------------------------------------------------------------------- 1 | package client 2 | 3 | import ( 4 | "github.com/nilshell/xmlrpc" 5 | ) 6 | 7 | type Network XenAPIObject 8 | 9 | func (self *Network) GetAssignedIPs() (ipMap map[string]string, err error) { 10 | ipMap = make(map[string]string, 0) 11 | result := APIResult{} 12 | err = self.Client.APICall(&result, "network.get_assigned_ips", self.Ref) 13 | if err != nil { 14 | return ipMap, err 15 | } 16 | for k, v := range result.Value.(xmlrpc.Struct) { 17 | ipMap[k] = v.(string) 18 | } 19 | return ipMap, nil 20 | } 21 | 22 | func (self *Network) GetOtherConfig() (otherConfig map[string]string, err error) { 23 | otherConfig = make(map[string]string, 0) 24 | result := APIResult{} 25 | err = self.Client.APICall(&result, "network.get_other_config", self.Ref) 26 | if err != nil { 27 | return otherConfig, err 28 | } 29 | for k, v := range result.Value.(xmlrpc.Struct) { 30 | otherConfig[k] = v.(string) 31 | } 32 | return otherConfig, nil 33 | } 34 | 35 | func (self *Network) IsHostInternalManagementNetwork() (isHostInternalManagementNetwork bool, err error) { 36 | other_config, err := self.GetOtherConfig() 37 | if err != nil { 38 | return false, nil 39 | } 40 | value, ok := other_config["is_host_internal_management_network"] 41 | isHostInternalManagementNetwork = ok && value == "true" 42 | return isHostInternalManagementNetwork, nil 43 | } 44 | 45 | func (self *Network) Destroy() (err error) { 46 | result := APIResult{} 47 | err = self.Client.APICall(&result, "network.destroy", self.Ref) 48 | if err != nil { 49 | return err 50 | } 51 | return 52 | } 53 | -------------------------------------------------------------------------------- /vendor/github.com/xenserver/go-xenserver-client/pif.go: -------------------------------------------------------------------------------- 1 | package client 2 | 3 | import ( 4 | "github.com/nilshell/xmlrpc" 5 | ) 6 | 7 | type PIF XenAPIObject 8 | 9 | func (self *PIF) GetRecord() (record map[string]interface{}, err error) { 10 | record = make(map[string]interface{}) 11 | result := APIResult{} 12 | err = self.Client.APICall(&result, "PIF.get_record", self.Ref) 13 | if err != nil { 14 | return record, err 15 | } 16 | for k, v := range result.Value.(xmlrpc.Struct) { 17 | record[k] = v 18 | } 19 | return record, nil 20 | } 21 | -------------------------------------------------------------------------------- /vendor/github.com/xenserver/go-xenserver-client/pool.go: -------------------------------------------------------------------------------- 1 | package client 2 | 3 | import ( 4 | "github.com/nilshell/xmlrpc" 5 | ) 6 | 7 | type Pool XenAPIObject 8 | 9 | func (self *Pool) GetMaster() (host *Host, err error) { 10 | result := APIResult{} 11 | err = self.Client.APICall(&result, "pool.get_master", self.Ref) 12 | if err != nil { 13 | return nil, err 14 | } 15 | host = new(Host) 16 | host.Ref = result.Value.(string) 17 | host.Client = self.Client 18 | return host, nil 19 | } 20 | 21 | func (self *Pool) GetRecord() (record map[string]interface{}, err error) { 22 | record = make(map[string]interface{}) 23 | result := APIResult{} 24 | err = self.Client.APICall(&result, "pool.get_record", self.Ref) 25 | if err != nil { 26 | return record, err 27 | } 28 | for k, v := range result.Value.(xmlrpc.Struct) { 29 | record[k] = v 30 | } 31 | return record, nil 32 | } 33 | -------------------------------------------------------------------------------- /vendor/github.com/xenserver/go-xenserver-client/sr.go: -------------------------------------------------------------------------------- 1 | package client 2 | 3 | import ( 4 | "fmt" 5 | "github.com/nilshell/xmlrpc" 6 | ) 7 | 8 | type SR XenAPIObject 9 | 10 | func (self *SR) GetUuid() (uuid string, err error) { 11 | result := APIResult{} 12 | err = self.Client.APICall(&result, "SR.get_uuid", self.Ref) 13 | if err != nil { 14 | return "", err 15 | } 16 | uuid = result.Value.(string) 17 | return uuid, nil 18 | } 19 | 20 | func (self *SR) CreateVdi(name_label string, size int64) (vdi *VDI, err error) { 21 | vdi = new(VDI) 22 | 23 | vdi_rec := make(xmlrpc.Struct) 24 | vdi_rec["name_label"] = name_label 25 | vdi_rec["SR"] = self.Ref 26 | vdi_rec["virtual_size"] = fmt.Sprintf("%d", size) 27 | vdi_rec["type"] = "user" 28 | vdi_rec["sharable"] = false 29 | vdi_rec["read_only"] = false 30 | 31 | oc := make(xmlrpc.Struct) 32 | oc["temp"] = "temp" 33 | vdi_rec["other_config"] = oc 34 | 35 | result := APIResult{} 36 | err = self.Client.APICall(&result, "VDI.create", vdi_rec) 37 | if err != nil { 38 | return nil, err 39 | } 40 | 41 | vdi.Ref = result.Value.(string) 42 | vdi.Client = self.Client 43 | 44 | return 45 | } 46 | -------------------------------------------------------------------------------- /vendor/github.com/xenserver/go-xenserver-client/vbd.go: -------------------------------------------------------------------------------- 1 | package client 2 | 3 | import ( 4 | "github.com/nilshell/xmlrpc" 5 | ) 6 | 7 | type VBD XenAPIObject 8 | 9 | func (self *VBD) GetRecord() (record map[string]interface{}, err error) { 10 | record = make(map[string]interface{}) 11 | result := APIResult{} 12 | err = self.Client.APICall(&result, "VBD.get_record", self.Ref) 13 | if err != nil { 14 | return record, err 15 | } 16 | for k, v := range result.Value.(xmlrpc.Struct) { 17 | record[k] = v 18 | } 19 | return record, nil 20 | } 21 | 22 | func (self *VBD) GetVDI() (vdi *VDI, err error) { 23 | vbd_rec, err := self.GetRecord() 24 | if err != nil { 25 | return nil, err 26 | } 27 | 28 | vdi = new(VDI) 29 | vdi.Ref = vbd_rec["VDI"].(string) 30 | vdi.Client = self.Client 31 | 32 | return vdi, nil 33 | } 34 | 35 | func (self *VBD) Eject() (err error) { 36 | result := APIResult{} 37 | err = self.Client.APICall(&result, "VBD.eject", self.Ref) 38 | if err != nil { 39 | return err 40 | } 41 | return nil 42 | } 43 | 44 | func (self *VBD) Unplug() (err error) { 45 | result := APIResult{} 46 | err = self.Client.APICall(&result, "VBD.unplug", self.Ref) 47 | if err != nil { 48 | return err 49 | } 50 | return nil 51 | } 52 | 53 | func (self *VBD) Destroy() (err error) { 54 | result := APIResult{} 55 | err = self.Client.APICall(&result, "VBD.destroy", self.Ref) 56 | if err != nil { 57 | return err 58 | } 59 | return nil 60 | } 61 | -------------------------------------------------------------------------------- /vendor/github.com/xenserver/go-xenserver-client/vif.go: -------------------------------------------------------------------------------- 1 | package client 2 | 3 | type VIF XenAPIObject 4 | 5 | func (self *VIF) Destroy() (err error) { 6 | result := APIResult{} 7 | err = self.Client.APICall(&result, "VIF.destroy", self.Ref) 8 | if err != nil { 9 | return err 10 | } 11 | return nil 12 | } 13 | 14 | func (self *VIF) GetNetwork() (network *Network, err error) { 15 | 16 | network = new(Network) 17 | result := APIResult{} 18 | err = self.Client.APICall(&result, "VIF.get_network", self.Ref) 19 | 20 | if err != nil { 21 | return nil, err 22 | } 23 | network.Ref = result.Value.(string) 24 | network.Client = self.Client 25 | return 26 | 27 | } 28 | -------------------------------------------------------------------------------- /vendor/github.com/xenserverarmy/go-vnc/LICENSE: -------------------------------------------------------------------------------- 1 | The MIT License (MIT) 2 | 3 | Copyright (c) 2013 Mitchell Hashimoto 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in 13 | all copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 21 | THE SOFTWARE. 22 | -------------------------------------------------------------------------------- /vendor/github.com/xenserverarmy/go-vnc/README.md: -------------------------------------------------------------------------------- 1 | # VNC Library for Go 2 | 3 | go-vnc is a VNC library for Go, initially supporting VNC clients but 4 | with the goal of eventually implementing a VNC server. 5 | 6 | This library implements [RFC 6143](http://tools.ietf.org/html/rfc6143). 7 | 8 | ## Usage & Installation 9 | 10 | The library is installable via standard `go get`. The package name is `vnc`. 11 | 12 | ``` 13 | $ go get github.com/mitchellh/go-vnc 14 | ``` 15 | 16 | Documentation is available on GoDoc: http://godoc.org/github.com/mitchellh/go-vnc 17 | -------------------------------------------------------------------------------- /vendor/github.com/xenserverarmy/go-vnc/client_auth.go: -------------------------------------------------------------------------------- 1 | package vnc 2 | 3 | import ( 4 | "net" 5 | ) 6 | 7 | // A ClientAuth implements a method of authenticating with a remote server. 8 | type ClientAuth interface { 9 | // SecurityType returns the byte identifier sent by the server to 10 | // identify this authentication scheme. 11 | SecurityType() uint8 12 | 13 | // Handshake is called when the authentication handshake should be 14 | // performed, as part of the general RFB handshake. (see 7.1.2) 15 | Handshake(net.Conn) error 16 | } 17 | 18 | // ClientAuthNone is the "none" authentication. See 7.1.2 19 | type ClientAuthNone byte 20 | 21 | func (*ClientAuthNone) SecurityType() uint8 { 22 | return 1 23 | } 24 | 25 | func (*ClientAuthNone) Handshake(net.Conn) error { 26 | return nil 27 | } 28 | -------------------------------------------------------------------------------- /vendor/github.com/xenserverarmy/go-vnc/color.go: -------------------------------------------------------------------------------- 1 | package vnc 2 | 3 | // Color represents a single color in a color map. 4 | type Color struct { 5 | R, G, B uint16 6 | } 7 | -------------------------------------------------------------------------------- /vendor/github.com/xenserverarmy/go-vnc/pointer.go: -------------------------------------------------------------------------------- 1 | package vnc 2 | 3 | // ButtonMask represents a mask of pointer presses/releases. 4 | type ButtonMask uint8 5 | 6 | // All available button mask components. 7 | const ( 8 | ButtonLeft ButtonMask = 1 << iota 9 | ButtonMiddle 10 | ButtonRight 11 | Button4 12 | Button5 13 | Button6 14 | Button7 15 | Button8 16 | ) 17 | -------------------------------------------------------------------------------- /vendor/golang.org/x/crypto/LICENSE: -------------------------------------------------------------------------------- 1 | Copyright (c) 2009 The Go Authors. All rights reserved. 2 | 3 | Redistribution and use in source and binary forms, with or without 4 | modification, are permitted provided that the following conditions are 5 | met: 6 | 7 | * Redistributions of source code must retain the above copyright 8 | notice, this list of conditions and the following disclaimer. 9 | * Redistributions in binary form must reproduce the above 10 | copyright notice, this list of conditions and the following disclaimer 11 | in the documentation and/or other materials provided with the 12 | distribution. 13 | * Neither the name of Google Inc. nor the names of its 14 | contributors may be used to endorse or promote products derived from 15 | this software without specific prior written permission. 16 | 17 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 18 | "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 19 | LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 20 | A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 21 | OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 22 | SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 23 | LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 24 | DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 25 | THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 26 | (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 27 | OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 28 | -------------------------------------------------------------------------------- /vendor/golang.org/x/crypto/PATENTS: -------------------------------------------------------------------------------- 1 | Additional IP Rights Grant (Patents) 2 | 3 | "This implementation" means the copyrightable works distributed by 4 | Google as part of the Go project. 5 | 6 | Google hereby grants to You a perpetual, worldwide, non-exclusive, 7 | no-charge, royalty-free, irrevocable (except as stated in this section) 8 | patent license to make, have made, use, offer to sell, sell, import, 9 | transfer and otherwise run, modify and propagate the contents of this 10 | implementation of Go, where such license applies only to those patent 11 | claims, both currently owned or controlled by Google and acquired in 12 | the future, licensable by Google that are necessarily infringed by this 13 | implementation of Go. This grant does not include claims that would be 14 | infringed only as a consequence of further modification of this 15 | implementation. If you or your agent or exclusive licensee institute or 16 | order or agree to the institution of patent litigation against any 17 | entity (including a cross-claim or counterclaim in a lawsuit) alleging 18 | that this implementation of Go or any code incorporated within this 19 | implementation of Go constitutes direct or contributory patent 20 | infringement, or inducement of patent infringement, then any patent 21 | rights granted to you under this License for this implementation of Go 22 | shall terminate as of the date such litigation is filed. 23 | -------------------------------------------------------------------------------- /vendor/golang.org/x/crypto/curve25519/const_amd64.s: -------------------------------------------------------------------------------- 1 | // Copyright 2012 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | // This code was translated into a form compatible with 6a from the public 6 | // domain sources in SUPERCOP: http://bench.cr.yp.to/supercop.html 7 | 8 | // +build amd64,!gccgo,!appengine 9 | 10 | DATA ·REDMASK51(SB)/8, $0x0007FFFFFFFFFFFF 11 | GLOBL ·REDMASK51(SB), 8, $8 12 | 13 | DATA ·_121666_213(SB)/8, $996687872 14 | GLOBL ·_121666_213(SB), 8, $8 15 | 16 | DATA ·_2P0(SB)/8, $0xFFFFFFFFFFFDA 17 | GLOBL ·_2P0(SB), 8, $8 18 | 19 | DATA ·_2P1234(SB)/8, $0xFFFFFFFFFFFFE 20 | GLOBL ·_2P1234(SB), 8, $8 21 | -------------------------------------------------------------------------------- /vendor/golang.org/x/crypto/curve25519/doc.go: -------------------------------------------------------------------------------- 1 | // Copyright 2012 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | // Package curve25519 provides an implementation of scalar multiplication on 6 | // the elliptic curve known as curve25519. See http://cr.yp.to/ecdh.html 7 | package curve25519 8 | 9 | // basePoint is the x coordinate of the generator of the curve. 10 | var basePoint = [32]byte{9, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0} 11 | 12 | // ScalarMult sets dst to the product in*base where dst and base are the x 13 | // coordinates of group points and all values are in little-endian form. 14 | func ScalarMult(dst, in, base *[32]byte) { 15 | scalarMult(dst, in, base) 16 | } 17 | 18 | // ScalarBaseMult sets dst to the product in*base where dst and base are the x 19 | // coordinates of group points, base is the standard generator and all values 20 | // are in little-endian form. 21 | func ScalarBaseMult(dst, in *[32]byte) { 22 | ScalarMult(dst, in, &basePoint) 23 | } 24 | -------------------------------------------------------------------------------- /vendor/golang.org/x/crypto/ssh/doc.go: -------------------------------------------------------------------------------- 1 | // Copyright 2011 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | /* 6 | Package ssh implements an SSH client and server. 7 | 8 | SSH is a transport security protocol, an authentication protocol and a 9 | family of application protocols. The most typical application level 10 | protocol is a remote shell and this is specifically implemented. However, 11 | the multiplexed nature of SSH is exposed to users that wish to support 12 | others. 13 | 14 | References: 15 | [PROTOCOL.certkeys]: http://cvsweb.openbsd.org/cgi-bin/cvsweb/src/usr.bin/ssh/PROTOCOL.certkeys?rev=HEAD 16 | [SSH-PARAMETERS]: http://www.iana.org/assignments/ssh-parameters/ssh-parameters.xml#ssh-parameters-1 17 | */ 18 | package ssh 19 | -------------------------------------------------------------------------------- /vendor/golang.org/x/crypto/ssh/mac.go: -------------------------------------------------------------------------------- 1 | // Copyright 2012 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | package ssh 6 | 7 | // Message authentication support 8 | 9 | import ( 10 | "crypto/hmac" 11 | "crypto/sha1" 12 | "crypto/sha256" 13 | "hash" 14 | ) 15 | 16 | type macMode struct { 17 | keySize int 18 | new func(key []byte) hash.Hash 19 | } 20 | 21 | // truncatingMAC wraps around a hash.Hash and truncates the output digest to 22 | // a given size. 23 | type truncatingMAC struct { 24 | length int 25 | hmac hash.Hash 26 | } 27 | 28 | func (t truncatingMAC) Write(data []byte) (int, error) { 29 | return t.hmac.Write(data) 30 | } 31 | 32 | func (t truncatingMAC) Sum(in []byte) []byte { 33 | out := t.hmac.Sum(in) 34 | return out[:len(in)+t.length] 35 | } 36 | 37 | func (t truncatingMAC) Reset() { 38 | t.hmac.Reset() 39 | } 40 | 41 | func (t truncatingMAC) Size() int { 42 | return t.length 43 | } 44 | 45 | func (t truncatingMAC) BlockSize() int { return t.hmac.BlockSize() } 46 | 47 | var macModes = map[string]*macMode{ 48 | "hmac-sha2-256": {32, func(key []byte) hash.Hash { 49 | return hmac.New(sha256.New, key) 50 | }}, 51 | "hmac-sha1": {20, func(key []byte) hash.Hash { 52 | return hmac.New(sha1.New, key) 53 | }}, 54 | "hmac-sha1-96": {20, func(key []byte) hash.Hash { 55 | return truncatingMAC{12, hmac.New(sha1.New, key)} 56 | }}, 57 | } 58 | -------------------------------------------------------------------------------- /vendor/golang.org/x/sys/LICENSE: -------------------------------------------------------------------------------- 1 | Copyright (c) 2009 The Go Authors. All rights reserved. 2 | 3 | Redistribution and use in source and binary forms, with or without 4 | modification, are permitted provided that the following conditions are 5 | met: 6 | 7 | * Redistributions of source code must retain the above copyright 8 | notice, this list of conditions and the following disclaimer. 9 | * Redistributions in binary form must reproduce the above 10 | copyright notice, this list of conditions and the following disclaimer 11 | in the documentation and/or other materials provided with the 12 | distribution. 13 | * Neither the name of Google Inc. nor the names of its 14 | contributors may be used to endorse or promote products derived from 15 | this software without specific prior written permission. 16 | 17 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 18 | "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 19 | LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 20 | A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 21 | OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 22 | SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 23 | LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 24 | DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 25 | THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 26 | (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 27 | OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 28 | -------------------------------------------------------------------------------- /vendor/golang.org/x/sys/PATENTS: -------------------------------------------------------------------------------- 1 | Additional IP Rights Grant (Patents) 2 | 3 | "This implementation" means the copyrightable works distributed by 4 | Google as part of the Go project. 5 | 6 | Google hereby grants to You a perpetual, worldwide, non-exclusive, 7 | no-charge, royalty-free, irrevocable (except as stated in this section) 8 | patent license to make, have made, use, offer to sell, sell, import, 9 | transfer and otherwise run, modify and propagate the contents of this 10 | implementation of Go, where such license applies only to those patent 11 | claims, both currently owned or controlled by Google and acquired in 12 | the future, licensable by Google that are necessarily infringed by this 13 | implementation of Go. This grant does not include claims that would be 14 | infringed only as a consequence of further modification of this 15 | implementation. If you or your agent or exclusive licensee institute or 16 | order or agree to the institution of patent litigation against any 17 | entity (including a cross-claim or counterclaim in a lawsuit) alleging 18 | that this implementation of Go or any code incorporated within this 19 | implementation of Go constitutes direct or contributory patent 20 | infringement, or inducement of patent infringement, then any patent 21 | rights granted to you under this License for this implementation of Go 22 | shall terminate as of the date such litigation is filed. 23 | -------------------------------------------------------------------------------- /vendor/golang.org/x/sys/unix/.gitignore: -------------------------------------------------------------------------------- 1 | _obj/ 2 | -------------------------------------------------------------------------------- /vendor/golang.org/x/sys/unix/asm.s: -------------------------------------------------------------------------------- 1 | // Copyright 2014 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | // +build !gccgo 6 | 7 | #include "textflag.h" 8 | 9 | TEXT ·use(SB),NOSPLIT,$0 10 | RET 11 | -------------------------------------------------------------------------------- /vendor/golang.org/x/sys/unix/asm_darwin_386.s: -------------------------------------------------------------------------------- 1 | // Copyright 2009 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | // +build !gccgo 6 | 7 | #include "textflag.h" 8 | 9 | // 10 | // System call support for 386, Darwin 11 | // 12 | 13 | // Just jump to package syscall's implementation for all these functions. 14 | // The runtime may know about them. 15 | 16 | TEXT ·Syscall(SB),NOSPLIT,$0-28 17 | JMP syscall·Syscall(SB) 18 | 19 | TEXT ·Syscall6(SB),NOSPLIT,$0-40 20 | JMP syscall·Syscall6(SB) 21 | 22 | TEXT ·Syscall9(SB),NOSPLIT,$0-52 23 | JMP syscall·Syscall9(SB) 24 | 25 | TEXT ·RawSyscall(SB),NOSPLIT,$0-28 26 | JMP syscall·RawSyscall(SB) 27 | 28 | TEXT ·RawSyscall6(SB),NOSPLIT,$0-40 29 | JMP syscall·RawSyscall6(SB) 30 | -------------------------------------------------------------------------------- /vendor/golang.org/x/sys/unix/asm_darwin_amd64.s: -------------------------------------------------------------------------------- 1 | // Copyright 2009 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | // +build !gccgo 6 | 7 | #include "textflag.h" 8 | 9 | // 10 | // System call support for AMD64, Darwin 11 | // 12 | 13 | // Just jump to package syscall's implementation for all these functions. 14 | // The runtime may know about them. 15 | 16 | TEXT ·Syscall(SB),NOSPLIT,$0-56 17 | JMP syscall·Syscall(SB) 18 | 19 | TEXT ·Syscall6(SB),NOSPLIT,$0-80 20 | JMP syscall·Syscall6(SB) 21 | 22 | TEXT ·Syscall9(SB),NOSPLIT,$0-104 23 | JMP syscall·Syscall9(SB) 24 | 25 | TEXT ·RawSyscall(SB),NOSPLIT,$0-56 26 | JMP syscall·RawSyscall(SB) 27 | 28 | TEXT ·RawSyscall6(SB),NOSPLIT,$0-80 29 | JMP syscall·RawSyscall6(SB) 30 | -------------------------------------------------------------------------------- /vendor/golang.org/x/sys/unix/asm_darwin_arm.s: -------------------------------------------------------------------------------- 1 | // Copyright 2015 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | // +build !gccgo 6 | // +build arm,darwin 7 | 8 | #include "textflag.h" 9 | 10 | // 11 | // System call support for ARM, Darwin 12 | // 13 | 14 | // Just jump to package syscall's implementation for all these functions. 15 | // The runtime may know about them. 16 | 17 | TEXT ·Syscall(SB),NOSPLIT,$0-28 18 | B syscall·Syscall(SB) 19 | 20 | TEXT ·Syscall6(SB),NOSPLIT,$0-40 21 | B syscall·Syscall6(SB) 22 | 23 | TEXT ·Syscall9(SB),NOSPLIT,$0-52 24 | B syscall·Syscall9(SB) 25 | 26 | TEXT ·RawSyscall(SB),NOSPLIT,$0-28 27 | B syscall·RawSyscall(SB) 28 | 29 | TEXT ·RawSyscall6(SB),NOSPLIT,$0-40 30 | B syscall·RawSyscall6(SB) 31 | -------------------------------------------------------------------------------- /vendor/golang.org/x/sys/unix/asm_darwin_arm64.s: -------------------------------------------------------------------------------- 1 | // Copyright 2015 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | // +build !gccgo 6 | // +build arm64,darwin 7 | 8 | #include "textflag.h" 9 | 10 | // 11 | // System call support for AMD64, Darwin 12 | // 13 | 14 | // Just jump to package syscall's implementation for all these functions. 15 | // The runtime may know about them. 16 | 17 | TEXT ·Syscall(SB),NOSPLIT,$0-56 18 | B syscall·Syscall(SB) 19 | 20 | TEXT ·Syscall6(SB),NOSPLIT,$0-80 21 | B syscall·Syscall6(SB) 22 | 23 | TEXT ·Syscall9(SB),NOSPLIT,$0-104 24 | B syscall·Syscall9(SB) 25 | 26 | TEXT ·RawSyscall(SB),NOSPLIT,$0-56 27 | B syscall·RawSyscall(SB) 28 | 29 | TEXT ·RawSyscall6(SB),NOSPLIT,$0-80 30 | B syscall·RawSyscall6(SB) 31 | -------------------------------------------------------------------------------- /vendor/golang.org/x/sys/unix/asm_dragonfly_386.s: -------------------------------------------------------------------------------- 1 | // Copyright 2009 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | // +build !gccgo 6 | 7 | #include "textflag.h" 8 | 9 | // 10 | // System call support for 386, FreeBSD 11 | // 12 | 13 | // Just jump to package syscall's implementation for all these functions. 14 | // The runtime may know about them. 15 | 16 | TEXT ·Syscall(SB),NOSPLIT,$0-32 17 | JMP syscall·Syscall(SB) 18 | 19 | TEXT ·Syscall6(SB),NOSPLIT,$0-44 20 | JMP syscall·Syscall6(SB) 21 | 22 | TEXT ·Syscall9(SB),NOSPLIT,$0-56 23 | JMP syscall·Syscall9(SB) 24 | 25 | TEXT ·RawSyscall(SB),NOSPLIT,$0-32 26 | JMP syscall·RawSyscall(SB) 27 | 28 | TEXT ·RawSyscall6(SB),NOSPLIT,$0-44 29 | JMP syscall·RawSyscall6(SB) 30 | -------------------------------------------------------------------------------- /vendor/golang.org/x/sys/unix/asm_dragonfly_amd64.s: -------------------------------------------------------------------------------- 1 | // Copyright 2009 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | // +build !gccgo 6 | 7 | #include "textflag.h" 8 | 9 | // 10 | // System call support for AMD64, DragonFly 11 | // 12 | 13 | // Just jump to package syscall's implementation for all these functions. 14 | // The runtime may know about them. 15 | 16 | TEXT ·Syscall(SB),NOSPLIT,$0-64 17 | JMP syscall·Syscall(SB) 18 | 19 | TEXT ·Syscall6(SB),NOSPLIT,$0-88 20 | JMP syscall·Syscall6(SB) 21 | 22 | TEXT ·Syscall9(SB),NOSPLIT,$0-112 23 | JMP syscall·Syscall9(SB) 24 | 25 | TEXT ·RawSyscall(SB),NOSPLIT,$0-64 26 | JMP syscall·RawSyscall(SB) 27 | 28 | TEXT ·RawSyscall6(SB),NOSPLIT,$0-88 29 | JMP syscall·RawSyscall6(SB) 30 | -------------------------------------------------------------------------------- /vendor/golang.org/x/sys/unix/asm_freebsd_386.s: -------------------------------------------------------------------------------- 1 | // Copyright 2009 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | // +build !gccgo 6 | 7 | #include "textflag.h" 8 | 9 | // 10 | // System call support for 386, FreeBSD 11 | // 12 | 13 | // Just jump to package syscall's implementation for all these functions. 14 | // The runtime may know about them. 15 | 16 | TEXT ·Syscall(SB),NOSPLIT,$0-28 17 | JMP syscall·Syscall(SB) 18 | 19 | TEXT ·Syscall6(SB),NOSPLIT,$0-40 20 | JMP syscall·Syscall6(SB) 21 | 22 | TEXT ·Syscall9(SB),NOSPLIT,$0-52 23 | JMP syscall·Syscall9(SB) 24 | 25 | TEXT ·RawSyscall(SB),NOSPLIT,$0-28 26 | JMP syscall·RawSyscall(SB) 27 | 28 | TEXT ·RawSyscall6(SB),NOSPLIT,$0-40 29 | JMP syscall·RawSyscall6(SB) 30 | -------------------------------------------------------------------------------- /vendor/golang.org/x/sys/unix/asm_freebsd_amd64.s: -------------------------------------------------------------------------------- 1 | // Copyright 2009 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | // +build !gccgo 6 | 7 | #include "textflag.h" 8 | 9 | // 10 | // System call support for AMD64, FreeBSD 11 | // 12 | 13 | // Just jump to package syscall's implementation for all these functions. 14 | // The runtime may know about them. 15 | 16 | TEXT ·Syscall(SB),NOSPLIT,$0-56 17 | JMP syscall·Syscall(SB) 18 | 19 | TEXT ·Syscall6(SB),NOSPLIT,$0-80 20 | JMP syscall·Syscall6(SB) 21 | 22 | TEXT ·Syscall9(SB),NOSPLIT,$0-104 23 | JMP syscall·Syscall9(SB) 24 | 25 | TEXT ·RawSyscall(SB),NOSPLIT,$0-56 26 | JMP syscall·RawSyscall(SB) 27 | 28 | TEXT ·RawSyscall6(SB),NOSPLIT,$0-80 29 | JMP syscall·RawSyscall6(SB) 30 | -------------------------------------------------------------------------------- /vendor/golang.org/x/sys/unix/asm_freebsd_arm.s: -------------------------------------------------------------------------------- 1 | // Copyright 2012 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | // +build !gccgo 6 | 7 | #include "textflag.h" 8 | 9 | // 10 | // System call support for ARM, FreeBSD 11 | // 12 | 13 | // Just jump to package syscall's implementation for all these functions. 14 | // The runtime may know about them. 15 | 16 | TEXT ·Syscall(SB),NOSPLIT,$0-28 17 | B syscall·Syscall(SB) 18 | 19 | TEXT ·Syscall6(SB),NOSPLIT,$0-40 20 | B syscall·Syscall6(SB) 21 | 22 | TEXT ·Syscall9(SB),NOSPLIT,$0-52 23 | B syscall·Syscall9(SB) 24 | 25 | TEXT ·RawSyscall(SB),NOSPLIT,$0-28 26 | B syscall·RawSyscall(SB) 27 | 28 | TEXT ·RawSyscall6(SB),NOSPLIT,$0-40 29 | B syscall·RawSyscall6(SB) 30 | -------------------------------------------------------------------------------- /vendor/golang.org/x/sys/unix/asm_linux_386.s: -------------------------------------------------------------------------------- 1 | // Copyright 2009 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | // +build !gccgo 6 | 7 | #include "textflag.h" 8 | 9 | // 10 | // System calls for 386, Linux 11 | // 12 | 13 | // Just jump to package syscall's implementation for all these functions. 14 | // The runtime may know about them. 15 | 16 | TEXT ·Syscall(SB),NOSPLIT,$0-28 17 | JMP syscall·Syscall(SB) 18 | 19 | TEXT ·Syscall6(SB),NOSPLIT,$0-40 20 | JMP syscall·Syscall6(SB) 21 | 22 | TEXT ·RawSyscall(SB),NOSPLIT,$0-28 23 | JMP syscall·RawSyscall(SB) 24 | 25 | TEXT ·RawSyscall6(SB),NOSPLIT,$0-40 26 | JMP syscall·RawSyscall6(SB) 27 | 28 | TEXT ·socketcall(SB),NOSPLIT,$0-36 29 | JMP syscall·socketcall(SB) 30 | 31 | TEXT ·rawsocketcall(SB),NOSPLIT,$0-36 32 | JMP syscall·rawsocketcall(SB) 33 | 34 | TEXT ·seek(SB),NOSPLIT,$0-28 35 | JMP syscall·seek(SB) 36 | -------------------------------------------------------------------------------- /vendor/golang.org/x/sys/unix/asm_linux_amd64.s: -------------------------------------------------------------------------------- 1 | // Copyright 2009 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | // +build !gccgo 6 | 7 | #include "textflag.h" 8 | 9 | // 10 | // System calls for AMD64, Linux 11 | // 12 | 13 | // Just jump to package syscall's implementation for all these functions. 14 | // The runtime may know about them. 15 | 16 | TEXT ·Syscall(SB),NOSPLIT,$0-56 17 | JMP syscall·Syscall(SB) 18 | 19 | TEXT ·Syscall6(SB),NOSPLIT,$0-80 20 | JMP syscall·Syscall6(SB) 21 | 22 | TEXT ·RawSyscall(SB),NOSPLIT,$0-56 23 | JMP syscall·RawSyscall(SB) 24 | 25 | TEXT ·RawSyscall6(SB),NOSPLIT,$0-80 26 | JMP syscall·RawSyscall6(SB) 27 | 28 | TEXT ·gettimeofday(SB),NOSPLIT,$0-16 29 | JMP syscall·gettimeofday(SB) 30 | -------------------------------------------------------------------------------- /vendor/golang.org/x/sys/unix/asm_linux_arm.s: -------------------------------------------------------------------------------- 1 | // Copyright 2009 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | // +build !gccgo 6 | 7 | #include "textflag.h" 8 | 9 | // 10 | // System calls for arm, Linux 11 | // 12 | 13 | // Just jump to package syscall's implementation for all these functions. 14 | // The runtime may know about them. 15 | 16 | TEXT ·Syscall(SB),NOSPLIT,$0-28 17 | B syscall·Syscall(SB) 18 | 19 | TEXT ·Syscall6(SB),NOSPLIT,$0-40 20 | B syscall·Syscall6(SB) 21 | 22 | TEXT ·RawSyscall(SB),NOSPLIT,$0-28 23 | B syscall·RawSyscall(SB) 24 | 25 | TEXT ·RawSyscall6(SB),NOSPLIT,$0-40 26 | B syscall·RawSyscall6(SB) 27 | 28 | TEXT ·seek(SB),NOSPLIT,$0-32 29 | B syscall·seek(SB) 30 | -------------------------------------------------------------------------------- /vendor/golang.org/x/sys/unix/asm_linux_arm64.s: -------------------------------------------------------------------------------- 1 | // Copyright 2015 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | // +build linux 6 | // +build arm64 7 | // +build !gccgo 8 | 9 | #include "textflag.h" 10 | 11 | // Just jump to package syscall's implementation for all these functions. 12 | // The runtime may know about them. 13 | 14 | TEXT ·Syscall(SB),NOSPLIT,$0-56 15 | B syscall·Syscall(SB) 16 | 17 | TEXT ·Syscall6(SB),NOSPLIT,$0-80 18 | B syscall·Syscall6(SB) 19 | 20 | TEXT ·RawSyscall(SB),NOSPLIT,$0-56 21 | B syscall·RawSyscall(SB) 22 | 23 | TEXT ·RawSyscall6(SB),NOSPLIT,$0-80 24 | B syscall·RawSyscall6(SB) 25 | -------------------------------------------------------------------------------- /vendor/golang.org/x/sys/unix/asm_linux_ppc64x.s: -------------------------------------------------------------------------------- 1 | // Copyright 2014 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | // +build linux 6 | // +build ppc64 ppc64le 7 | // +build !gccgo 8 | 9 | #include "textflag.h" 10 | 11 | // 12 | // System calls for ppc64, Linux 13 | // 14 | 15 | // Just jump to package syscall's implementation for all these functions. 16 | // The runtime may know about them. 17 | 18 | TEXT ·Syscall(SB),NOSPLIT,$0-56 19 | BR syscall·Syscall(SB) 20 | 21 | TEXT ·Syscall6(SB),NOSPLIT,$0-80 22 | BR syscall·Syscall6(SB) 23 | 24 | TEXT ·RawSyscall(SB),NOSPLIT,$0-56 25 | BR syscall·RawSyscall(SB) 26 | 27 | TEXT ·RawSyscall6(SB),NOSPLIT,$0-80 28 | BR syscall·RawSyscall6(SB) 29 | -------------------------------------------------------------------------------- /vendor/golang.org/x/sys/unix/asm_netbsd_386.s: -------------------------------------------------------------------------------- 1 | // Copyright 2009 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | // +build !gccgo 6 | 7 | #include "textflag.h" 8 | 9 | // 10 | // System call support for 386, NetBSD 11 | // 12 | 13 | // Just jump to package syscall's implementation for all these functions. 14 | // The runtime may know about them. 15 | 16 | TEXT ·Syscall(SB),NOSPLIT,$0-28 17 | JMP syscall·Syscall(SB) 18 | 19 | TEXT ·Syscall6(SB),NOSPLIT,$0-40 20 | JMP syscall·Syscall6(SB) 21 | 22 | TEXT ·Syscall9(SB),NOSPLIT,$0-52 23 | JMP syscall·Syscall9(SB) 24 | 25 | TEXT ·RawSyscall(SB),NOSPLIT,$0-28 26 | JMP syscall·RawSyscall(SB) 27 | 28 | TEXT ·RawSyscall6(SB),NOSPLIT,$0-40 29 | JMP syscall·RawSyscall6(SB) 30 | -------------------------------------------------------------------------------- /vendor/golang.org/x/sys/unix/asm_netbsd_amd64.s: -------------------------------------------------------------------------------- 1 | // Copyright 2009 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | // +build !gccgo 6 | 7 | #include "textflag.h" 8 | 9 | // 10 | // System call support for AMD64, NetBSD 11 | // 12 | 13 | // Just jump to package syscall's implementation for all these functions. 14 | // The runtime may know about them. 15 | 16 | TEXT ·Syscall(SB),NOSPLIT,$0-56 17 | JMP syscall·Syscall(SB) 18 | 19 | TEXT ·Syscall6(SB),NOSPLIT,$0-80 20 | JMP syscall·Syscall6(SB) 21 | 22 | TEXT ·Syscall9(SB),NOSPLIT,$0-104 23 | JMP syscall·Syscall9(SB) 24 | 25 | TEXT ·RawSyscall(SB),NOSPLIT,$0-56 26 | JMP syscall·RawSyscall(SB) 27 | 28 | TEXT ·RawSyscall6(SB),NOSPLIT,$0-80 29 | JMP syscall·RawSyscall6(SB) 30 | -------------------------------------------------------------------------------- /vendor/golang.org/x/sys/unix/asm_netbsd_arm.s: -------------------------------------------------------------------------------- 1 | // Copyright 2013 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | // +build !gccgo 6 | 7 | #include "textflag.h" 8 | 9 | // 10 | // System call support for ARM, NetBSD 11 | // 12 | 13 | // Just jump to package syscall's implementation for all these functions. 14 | // The runtime may know about them. 15 | 16 | TEXT ·Syscall(SB),NOSPLIT,$0-28 17 | B syscall·Syscall(SB) 18 | 19 | TEXT ·Syscall6(SB),NOSPLIT,$0-40 20 | B syscall·Syscall6(SB) 21 | 22 | TEXT ·Syscall9(SB),NOSPLIT,$0-52 23 | B syscall·Syscall9(SB) 24 | 25 | TEXT ·RawSyscall(SB),NOSPLIT,$0-28 26 | B syscall·RawSyscall(SB) 27 | 28 | TEXT ·RawSyscall6(SB),NOSPLIT,$0-40 29 | B syscall·RawSyscall6(SB) 30 | -------------------------------------------------------------------------------- /vendor/golang.org/x/sys/unix/asm_openbsd_386.s: -------------------------------------------------------------------------------- 1 | // Copyright 2009 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | // +build !gccgo 6 | 7 | #include "textflag.h" 8 | 9 | // 10 | // System call support for 386, OpenBSD 11 | // 12 | 13 | // Just jump to package syscall's implementation for all these functions. 14 | // The runtime may know about them. 15 | 16 | TEXT ·Syscall(SB),NOSPLIT,$0-28 17 | JMP syscall·Syscall(SB) 18 | 19 | TEXT ·Syscall6(SB),NOSPLIT,$0-40 20 | JMP syscall·Syscall6(SB) 21 | 22 | TEXT ·Syscall9(SB),NOSPLIT,$0-52 23 | JMP syscall·Syscall9(SB) 24 | 25 | TEXT ·RawSyscall(SB),NOSPLIT,$0-28 26 | JMP syscall·RawSyscall(SB) 27 | 28 | TEXT ·RawSyscall6(SB),NOSPLIT,$0-40 29 | JMP syscall·RawSyscall6(SB) 30 | -------------------------------------------------------------------------------- /vendor/golang.org/x/sys/unix/asm_openbsd_amd64.s: -------------------------------------------------------------------------------- 1 | // Copyright 2009 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | // +build !gccgo 6 | 7 | #include "textflag.h" 8 | 9 | // 10 | // System call support for AMD64, OpenBSD 11 | // 12 | 13 | // Just jump to package syscall's implementation for all these functions. 14 | // The runtime may know about them. 15 | 16 | TEXT ·Syscall(SB),NOSPLIT,$0-56 17 | JMP syscall·Syscall(SB) 18 | 19 | TEXT ·Syscall6(SB),NOSPLIT,$0-80 20 | JMP syscall·Syscall6(SB) 21 | 22 | TEXT ·Syscall9(SB),NOSPLIT,$0-104 23 | JMP syscall·Syscall9(SB) 24 | 25 | TEXT ·RawSyscall(SB),NOSPLIT,$0-56 26 | JMP syscall·RawSyscall(SB) 27 | 28 | TEXT ·RawSyscall6(SB),NOSPLIT,$0-80 29 | JMP syscall·RawSyscall6(SB) 30 | -------------------------------------------------------------------------------- /vendor/golang.org/x/sys/unix/asm_solaris_amd64.s: -------------------------------------------------------------------------------- 1 | // Copyright 2014 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | // +build !gccgo 6 | 7 | #include "textflag.h" 8 | 9 | // 10 | // System calls for amd64, Solaris are implemented in runtime/syscall_solaris.go 11 | // 12 | 13 | TEXT ·sysvicall6(SB),NOSPLIT,$0-64 14 | JMP syscall·sysvicall6(SB) 15 | 16 | TEXT ·rawSysvicall6(SB),NOSPLIT,$0-64 17 | JMP syscall·rawSysvicall6(SB) 18 | -------------------------------------------------------------------------------- /vendor/golang.org/x/sys/unix/constants.go: -------------------------------------------------------------------------------- 1 | // Copyright 2015 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | // +build darwin dragonfly freebsd linux netbsd openbsd solaris 6 | 7 | package unix 8 | 9 | const ( 10 | R_OK = 0x4 11 | W_OK = 0x2 12 | X_OK = 0x1 13 | ) 14 | -------------------------------------------------------------------------------- /vendor/golang.org/x/sys/unix/env_unix.go: -------------------------------------------------------------------------------- 1 | // Copyright 2010 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | // +build darwin dragonfly freebsd linux netbsd openbsd solaris 6 | 7 | // Unix environment variables. 8 | 9 | package unix 10 | 11 | import "syscall" 12 | 13 | func Getenv(key string) (value string, found bool) { 14 | return syscall.Getenv(key) 15 | } 16 | 17 | func Setenv(key, value string) error { 18 | return syscall.Setenv(key, value) 19 | } 20 | 21 | func Clearenv() { 22 | syscall.Clearenv() 23 | } 24 | 25 | func Environ() []string { 26 | return syscall.Environ() 27 | } 28 | -------------------------------------------------------------------------------- /vendor/golang.org/x/sys/unix/env_unset.go: -------------------------------------------------------------------------------- 1 | // Copyright 2014 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | // +build go1.4 6 | 7 | package unix 8 | 9 | import "syscall" 10 | 11 | func Unsetenv(key string) error { 12 | // This was added in Go 1.4. 13 | return syscall.Unsetenv(key) 14 | } 15 | -------------------------------------------------------------------------------- /vendor/golang.org/x/sys/unix/flock.go: -------------------------------------------------------------------------------- 1 | // +build linux darwin freebsd openbsd netbsd dragonfly 2 | 3 | // Copyright 2014 The Go Authors. All rights reserved. 4 | // Use of this source code is governed by a BSD-style 5 | // license that can be found in the LICENSE file. 6 | 7 | // +build darwin dragonfly freebsd linux netbsd openbsd 8 | 9 | package unix 10 | 11 | import "unsafe" 12 | 13 | // fcntl64Syscall is usually SYS_FCNTL, but is overridden on 32-bit Linux 14 | // systems by flock_linux_32bit.go to be SYS_FCNTL64. 15 | var fcntl64Syscall uintptr = SYS_FCNTL 16 | 17 | // FcntlFlock performs a fcntl syscall for the F_GETLK, F_SETLK or F_SETLKW command. 18 | func FcntlFlock(fd uintptr, cmd int, lk *Flock_t) error { 19 | _, _, errno := Syscall(fcntl64Syscall, fd, uintptr(cmd), uintptr(unsafe.Pointer(lk))) 20 | if errno == 0 { 21 | return nil 22 | } 23 | return errno 24 | } 25 | -------------------------------------------------------------------------------- /vendor/golang.org/x/sys/unix/flock_linux_32bit.go: -------------------------------------------------------------------------------- 1 | // +build linux,386 linux,arm 2 | 3 | // Copyright 2014 The Go Authors. All rights reserved. 4 | // Use of this source code is governed by a BSD-style 5 | // license that can be found in the LICENSE file. 6 | 7 | package unix 8 | 9 | func init() { 10 | // On 32-bit Linux systems, the fcntl syscall that matches Go's 11 | // Flock_t type is SYS_FCNTL64, not SYS_FCNTL. 12 | fcntl64Syscall = SYS_FCNTL64 13 | } 14 | -------------------------------------------------------------------------------- /vendor/golang.org/x/sys/unix/gccgo_c.c: -------------------------------------------------------------------------------- 1 | // Copyright 2015 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | // +build gccgo 6 | 7 | #include 8 | #include 9 | #include 10 | 11 | #define _STRINGIFY2_(x) #x 12 | #define _STRINGIFY_(x) _STRINGIFY2_(x) 13 | #define GOSYM_PREFIX _STRINGIFY_(__USER_LABEL_PREFIX__) 14 | 15 | // Call syscall from C code because the gccgo support for calling from 16 | // Go to C does not support varargs functions. 17 | 18 | struct ret { 19 | uintptr_t r; 20 | uintptr_t err; 21 | }; 22 | 23 | struct ret 24 | gccgoRealSyscall(uintptr_t trap, uintptr_t a1, uintptr_t a2, uintptr_t a3, uintptr_t a4, uintptr_t a5, uintptr_t a6, uintptr_t a7, uintptr_t a8, uintptr_t a9) 25 | { 26 | struct ret r; 27 | 28 | errno = 0; 29 | r.r = syscall(trap, a1, a2, a3, a4, a5, a6, a7, a8, a9); 30 | r.err = errno; 31 | return r; 32 | } 33 | 34 | // Define the use function in C so that it is not inlined. 35 | 36 | extern void use(void *) __asm__ (GOSYM_PREFIX GOPKGPATH ".use") __attribute__((noinline)); 37 | 38 | void 39 | use(void *p __attribute__ ((unused))) 40 | { 41 | } 42 | -------------------------------------------------------------------------------- /vendor/golang.org/x/sys/unix/gccgo_linux_amd64.go: -------------------------------------------------------------------------------- 1 | // Copyright 2015 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | // +build gccgo,linux,amd64 6 | 7 | package unix 8 | 9 | import "syscall" 10 | 11 | //extern gettimeofday 12 | func realGettimeofday(*Timeval, *byte) int32 13 | 14 | func gettimeofday(tv *Timeval) (err syscall.Errno) { 15 | r := realGettimeofday(tv, nil) 16 | if r < 0 { 17 | return syscall.GetErrno() 18 | } 19 | return 0 20 | } 21 | -------------------------------------------------------------------------------- /vendor/golang.org/x/sys/unix/mksysnum_darwin.pl: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env perl 2 | # Copyright 2009 The Go Authors. All rights reserved. 3 | # Use of this source code is governed by a BSD-style 4 | # license that can be found in the LICENSE file. 5 | # 6 | # Generate system call table for Darwin from sys/syscall.h 7 | 8 | use strict; 9 | 10 | if($ENV{'GOARCH'} eq "" || $ENV{'GOOS'} eq "") { 11 | print STDERR "GOARCH or GOOS not defined in environment\n"; 12 | exit 1; 13 | } 14 | 15 | my $command = "mksysnum_darwin.pl " . join(' ', @ARGV); 16 | 17 | print <){ 29 | if(/^#define\s+SYS_(\w+)\s+([0-9]+)/){ 30 | my $name = $1; 31 | my $num = $2; 32 | $name =~ y/a-z/A-Z/; 33 | print " SYS_$name = $num;" 34 | } 35 | } 36 | 37 | print <){ 30 | if(/^([0-9]+)\s+STD\s+({ \S+\s+(\w+).*)$/){ 31 | my $num = $1; 32 | my $proto = $2; 33 | my $name = "SYS_$3"; 34 | $name =~ y/a-z/A-Z/; 35 | 36 | # There are multiple entries for enosys and nosys, so comment them out. 37 | if($name =~ /^SYS_E?NOSYS$/){ 38 | $name = "// $name"; 39 | } 40 | if($name eq 'SYS_SYS_EXIT'){ 41 | $name = 'SYS_EXIT'; 42 | } 43 | 44 | print " $name = $num; // $proto\n"; 45 | } 46 | } 47 | 48 | print < 999){ 29 | # ignore deprecated syscalls that are no longer implemented 30 | # https://git.kernel.org/cgit/linux/kernel/git/torvalds/linux.git/tree/include/uapi/asm-generic/unistd.h?id=refs/heads/master#n716 31 | return; 32 | } 33 | $name =~ y/a-z/A-Z/; 34 | print " SYS_$name = $num;\n"; 35 | } 36 | 37 | my $prev; 38 | open(GCC, "gcc -E -dD $ARGV[0] |") || die "can't run gcc"; 39 | while(){ 40 | if(/^#define __NR_syscalls\s+/) { 41 | # ignore redefinitions of __NR_syscalls 42 | } 43 | elsif(/^#define __NR_(\w+)\s+([0-9]+)/){ 44 | $prev = $2; 45 | fmt($1, $2); 46 | } 47 | elsif(/^#define __NR3264_(\w+)\s+([0-9]+)/){ 48 | $prev = $2; 49 | fmt($1, $2); 50 | } 51 | elsif(/^#define __NR_(\w+)\s+\(\w+\+\s*([0-9]+)\)/){ 52 | fmt($1, $prev+$2) 53 | } 54 | } 55 | 56 | print <){ 31 | if($line =~ /^(.*)\\$/) { 32 | # Handle continuation 33 | $line = $1; 34 | $_ =~ s/^\s+//; 35 | $line .= $_; 36 | } else { 37 | # New line 38 | $line = $_; 39 | } 40 | next if $line =~ /\\$/; 41 | if($line =~ /^([0-9]+)\s+((STD)|(NOERR))\s+(RUMP\s+)?({\s+\S+\s*\*?\s*\|(\S+)\|(\S*)\|(\w+).*\s+})(\s+(\S+))?$/) { 42 | my $num = $1; 43 | my $proto = $6; 44 | my $compat = $8; 45 | my $name = "$7_$9"; 46 | 47 | $name = "$7_$11" if $11 ne ''; 48 | $name =~ y/a-z/A-Z/; 49 | 50 | if($compat eq '' || $compat eq '30' || $compat eq '50') { 51 | print " $name = $num; // $proto\n"; 52 | } 53 | } 54 | } 55 | 56 | print <){ 30 | if(/^([0-9]+)\s+STD\s+(NOLOCK\s+)?({ \S+\s+\*?(\w+).*)$/){ 31 | my $num = $1; 32 | my $proto = $3; 33 | my $name = $4; 34 | $name =~ y/a-z/A-Z/; 35 | 36 | # There are multiple entries for enosys and nosys, so comment them out. 37 | if($name =~ /^SYS_E?NOSYS$/){ 38 | $name = "// $name"; 39 | } 40 | if($name eq 'SYS_SYS_EXIT'){ 41 | $name = 'SYS_EXIT'; 42 | } 43 | 44 | print " $name = $num; // $proto\n"; 45 | } 46 | } 47 | 48 | print <= 10 { 20 | buf[i] = byte(val%10 + '0') 21 | i-- 22 | val /= 10 23 | } 24 | buf[i] = byte(val + '0') 25 | return string(buf[i:]) 26 | } 27 | -------------------------------------------------------------------------------- /vendor/golang.org/x/sys/unix/syscall_netbsd_386.go: -------------------------------------------------------------------------------- 1 | // Copyright 2009 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | // +build 386,netbsd 6 | 7 | package unix 8 | 9 | func Getpagesize() int { return 4096 } 10 | 11 | func TimespecToNsec(ts Timespec) int64 { return int64(ts.Sec)*1e9 + int64(ts.Nsec) } 12 | 13 | func NsecToTimespec(nsec int64) (ts Timespec) { 14 | ts.Sec = int64(nsec / 1e9) 15 | ts.Nsec = int32(nsec % 1e9) 16 | return 17 | } 18 | 19 | func TimevalToNsec(tv Timeval) int64 { return int64(tv.Sec)*1e9 + int64(tv.Usec)*1e3 } 20 | 21 | func NsecToTimeval(nsec int64) (tv Timeval) { 22 | nsec += 999 // round up to microsecond 23 | tv.Usec = int32(nsec % 1e9 / 1e3) 24 | tv.Sec = int64(nsec / 1e9) 25 | return 26 | } 27 | 28 | func SetKevent(k *Kevent_t, fd, mode, flags int) { 29 | k.Ident = uint32(fd) 30 | k.Filter = uint32(mode) 31 | k.Flags = uint32(flags) 32 | } 33 | 34 | func (iov *Iovec) SetLen(length int) { 35 | iov.Len = uint32(length) 36 | } 37 | 38 | func (msghdr *Msghdr) SetControllen(length int) { 39 | msghdr.Controllen = uint32(length) 40 | } 41 | 42 | func (cmsg *Cmsghdr) SetLen(length int) { 43 | cmsg.Len = uint32(length) 44 | } 45 | -------------------------------------------------------------------------------- /vendor/golang.org/x/sys/unix/syscall_netbsd_amd64.go: -------------------------------------------------------------------------------- 1 | // Copyright 2009 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | // +build amd64,netbsd 6 | 7 | package unix 8 | 9 | func Getpagesize() int { return 4096 } 10 | 11 | func TimespecToNsec(ts Timespec) int64 { return int64(ts.Sec)*1e9 + int64(ts.Nsec) } 12 | 13 | func NsecToTimespec(nsec int64) (ts Timespec) { 14 | ts.Sec = int64(nsec / 1e9) 15 | ts.Nsec = int64(nsec % 1e9) 16 | return 17 | } 18 | 19 | func TimevalToNsec(tv Timeval) int64 { return int64(tv.Sec)*1e9 + int64(tv.Usec)*1e3 } 20 | 21 | func NsecToTimeval(nsec int64) (tv Timeval) { 22 | nsec += 999 // round up to microsecond 23 | tv.Usec = int32(nsec % 1e9 / 1e3) 24 | tv.Sec = int64(nsec / 1e9) 25 | return 26 | } 27 | 28 | func SetKevent(k *Kevent_t, fd, mode, flags int) { 29 | k.Ident = uint64(fd) 30 | k.Filter = uint32(mode) 31 | k.Flags = uint32(flags) 32 | } 33 | 34 | func (iov *Iovec) SetLen(length int) { 35 | iov.Len = uint64(length) 36 | } 37 | 38 | func (msghdr *Msghdr) SetControllen(length int) { 39 | msghdr.Controllen = uint32(length) 40 | } 41 | 42 | func (cmsg *Cmsghdr) SetLen(length int) { 43 | cmsg.Len = uint32(length) 44 | } 45 | -------------------------------------------------------------------------------- /vendor/golang.org/x/sys/unix/syscall_netbsd_arm.go: -------------------------------------------------------------------------------- 1 | // Copyright 2013 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | // +build arm,netbsd 6 | 7 | package unix 8 | 9 | func Getpagesize() int { return 4096 } 10 | 11 | func TimespecToNsec(ts Timespec) int64 { return int64(ts.Sec)*1e9 + int64(ts.Nsec) } 12 | 13 | func NsecToTimespec(nsec int64) (ts Timespec) { 14 | ts.Sec = int64(nsec / 1e9) 15 | ts.Nsec = int32(nsec % 1e9) 16 | return 17 | } 18 | 19 | func TimevalToNsec(tv Timeval) int64 { return int64(tv.Sec)*1e9 + int64(tv.Usec)*1e3 } 20 | 21 | func NsecToTimeval(nsec int64) (tv Timeval) { 22 | nsec += 999 // round up to microsecond 23 | tv.Usec = int32(nsec % 1e9 / 1e3) 24 | tv.Sec = int64(nsec / 1e9) 25 | return 26 | } 27 | 28 | func SetKevent(k *Kevent_t, fd, mode, flags int) { 29 | k.Ident = uint32(fd) 30 | k.Filter = uint32(mode) 31 | k.Flags = uint32(flags) 32 | } 33 | 34 | func (iov *Iovec) SetLen(length int) { 35 | iov.Len = uint32(length) 36 | } 37 | 38 | func (msghdr *Msghdr) SetControllen(length int) { 39 | msghdr.Controllen = uint32(length) 40 | } 41 | 42 | func (cmsg *Cmsghdr) SetLen(length int) { 43 | cmsg.Len = uint32(length) 44 | } 45 | -------------------------------------------------------------------------------- /vendor/golang.org/x/sys/unix/syscall_no_getwd.go: -------------------------------------------------------------------------------- 1 | // Copyright 2013 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | // +build dragonfly freebsd netbsd openbsd 6 | 7 | package unix 8 | 9 | const ImplementsGetwd = false 10 | 11 | func Getwd() (string, error) { return "", ENOTSUP } 12 | -------------------------------------------------------------------------------- /vendor/golang.org/x/sys/unix/syscall_openbsd_386.go: -------------------------------------------------------------------------------- 1 | // Copyright 2009 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | // +build 386,openbsd 6 | 7 | package unix 8 | 9 | func Getpagesize() int { return 4096 } 10 | 11 | func TimespecToNsec(ts Timespec) int64 { return int64(ts.Sec)*1e9 + int64(ts.Nsec) } 12 | 13 | func NsecToTimespec(nsec int64) (ts Timespec) { 14 | ts.Sec = int64(nsec / 1e9) 15 | ts.Nsec = int32(nsec % 1e9) 16 | return 17 | } 18 | 19 | func TimevalToNsec(tv Timeval) int64 { return int64(tv.Sec)*1e9 + int64(tv.Usec)*1e3 } 20 | 21 | func NsecToTimeval(nsec int64) (tv Timeval) { 22 | nsec += 999 // round up to microsecond 23 | tv.Usec = int32(nsec % 1e9 / 1e3) 24 | tv.Sec = int64(nsec / 1e9) 25 | return 26 | } 27 | 28 | func SetKevent(k *Kevent_t, fd, mode, flags int) { 29 | k.Ident = uint32(fd) 30 | k.Filter = int16(mode) 31 | k.Flags = uint16(flags) 32 | } 33 | 34 | func (iov *Iovec) SetLen(length int) { 35 | iov.Len = uint32(length) 36 | } 37 | 38 | func (msghdr *Msghdr) SetControllen(length int) { 39 | msghdr.Controllen = uint32(length) 40 | } 41 | 42 | func (cmsg *Cmsghdr) SetLen(length int) { 43 | cmsg.Len = uint32(length) 44 | } 45 | -------------------------------------------------------------------------------- /vendor/golang.org/x/sys/unix/syscall_openbsd_amd64.go: -------------------------------------------------------------------------------- 1 | // Copyright 2009 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | // +build amd64,openbsd 6 | 7 | package unix 8 | 9 | func Getpagesize() int { return 4096 } 10 | 11 | func TimespecToNsec(ts Timespec) int64 { return int64(ts.Sec)*1e9 + int64(ts.Nsec) } 12 | 13 | func NsecToTimespec(nsec int64) (ts Timespec) { 14 | ts.Sec = nsec / 1e9 15 | ts.Nsec = nsec % 1e9 16 | return 17 | } 18 | 19 | func TimevalToNsec(tv Timeval) int64 { return int64(tv.Sec)*1e9 + int64(tv.Usec)*1e3 } 20 | 21 | func NsecToTimeval(nsec int64) (tv Timeval) { 22 | nsec += 999 // round up to microsecond 23 | tv.Usec = nsec % 1e9 / 1e3 24 | tv.Sec = nsec / 1e9 25 | return 26 | } 27 | 28 | func SetKevent(k *Kevent_t, fd, mode, flags int) { 29 | k.Ident = uint64(fd) 30 | k.Filter = int16(mode) 31 | k.Flags = uint16(flags) 32 | } 33 | 34 | func (iov *Iovec) SetLen(length int) { 35 | iov.Len = uint64(length) 36 | } 37 | 38 | func (msghdr *Msghdr) SetControllen(length int) { 39 | msghdr.Controllen = uint32(length) 40 | } 41 | 42 | func (cmsg *Cmsghdr) SetLen(length int) { 43 | cmsg.Len = uint32(length) 44 | } 45 | -------------------------------------------------------------------------------- /vendor/golang.org/x/sys/unix/syscall_solaris_amd64.go: -------------------------------------------------------------------------------- 1 | // Copyright 2009 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | // +build amd64,solaris 6 | 7 | package unix 8 | 9 | func TimespecToNsec(ts Timespec) int64 { return int64(ts.Sec)*1e9 + int64(ts.Nsec) } 10 | 11 | func NsecToTimespec(nsec int64) (ts Timespec) { 12 | ts.Sec = nsec / 1e9 13 | ts.Nsec = nsec % 1e9 14 | return 15 | } 16 | 17 | func TimevalToNsec(tv Timeval) int64 { return int64(tv.Sec)*1e9 + int64(tv.Usec)*1e3 } 18 | 19 | func NsecToTimeval(nsec int64) (tv Timeval) { 20 | nsec += 999 // round up to microsecond 21 | tv.Usec = nsec % 1e9 / 1e3 22 | tv.Sec = int64(nsec / 1e9) 23 | return 24 | } 25 | 26 | func (iov *Iovec) SetLen(length int) { 27 | iov.Len = uint64(length) 28 | } 29 | 30 | func (cmsg *Cmsghdr) SetLen(length int) { 31 | cmsg.Len = uint32(length) 32 | } 33 | 34 | func sendfile(outfd int, infd int, offset *int64, count int) (written int, err error) { 35 | // TODO(aram): implement this, see issue 5847. 36 | panic("unimplemented") 37 | } 38 | -------------------------------------------------------------------------------- /vendor/golang.org/x/sys/unix/zsysnum_solaris_amd64.go: -------------------------------------------------------------------------------- 1 | // Copyright 2014 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | // +build amd64,solaris 6 | 7 | package unix 8 | 9 | // TODO(aram): remove these before Go 1.3. 10 | const ( 11 | SYS_EXECVE = 59 12 | SYS_FCNTL = 62 13 | ) 14 | --------------------------------------------------------------------------------