From 5047242baf2ba605f2ce62afa9b8c825d401b359 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Wed, 20 Apr 2022 14:34:34 +0000 Subject: [PATCH] Bump github.com/libp2p/go-libp2p from 0.18.0-rc2 to 6.0.23+incompatible Bumps [github.com/libp2p/go-libp2p](https://github.com/libp2p/go-libp2p) from 0.18.0-rc2 to 6.0.23+incompatible. - [Release notes](https://github.com/libp2p/go-libp2p/releases) - [Commits](https://github.com/libp2p/go-libp2p/compare/v0.18.0-rc2...gx/v6.0.23) --- updated-dependencies: - dependency-name: github.com/libp2p/go-libp2p dependency-type: direct:production update-type: version-update:semver-major ... Signed-off-by: dependabot[bot] --- go.mod | 36 +- go.sum | 87 +- vendor/github.com/benbjohnson/clock/LICENSE | 21 - vendor/github.com/benbjohnson/clock/README.md | 105 - vendor/github.com/benbjohnson/clock/clock.go | 378 - .../github.com/benbjohnson/clock/context.go | 86 - vendor/github.com/benbjohnson/clock/go.mod | 3 - vendor/github.com/cheekybits/genny/.gitignore | 26 - .../github.com/cheekybits/genny/.travis.yml | 6 - vendor/github.com/cheekybits/genny/LICENSE | 22 - vendor/github.com/cheekybits/genny/README.md | 245 - vendor/github.com/cheekybits/genny/doc.go | 2 - .../cheekybits/genny/generic/doc.go | 2 - .../cheekybits/genny/generic/generic.go | 13 - vendor/github.com/cheekybits/genny/main.go | 154 - .../cheekybits/genny/out/lazy_file.go | 38 - .../cheekybits/genny/parse/builtins.go | 41 - .../github.com/cheekybits/genny/parse/doc.go | 14 - .../cheekybits/genny/parse/errors.go | 47 - .../cheekybits/genny/parse/parse.go | 298 - .../cheekybits/genny/parse/typesets.go | 89 - .../github.com/containerd/cgroups/.gitignore | 2 - vendor/github.com/containerd/cgroups/Makefile | 24 - .../containerd/cgroups/Protobuild.toml | 46 - .../github.com/containerd/cgroups/README.md | 149 - .../github.com/containerd/cgroups/Vagrantfile | 46 - vendor/github.com/containerd/cgroups/blkio.go | 361 - .../github.com/containerd/cgroups/cgroup.go | 533 - .../github.com/containerd/cgroups/control.go | 99 - vendor/github.com/containerd/cgroups/cpu.go | 125 - .../github.com/containerd/cgroups/cpuacct.go | 123 - .../github.com/containerd/cgroups/cpuset.go | 159 - .../github.com/containerd/cgroups/devices.go | 92 - .../github.com/containerd/cgroups/errors.go | 47 - .../github.com/containerd/cgroups/freezer.go | 82 - vendor/github.com/containerd/cgroups/go.mod | 17 - vendor/github.com/containerd/cgroups/go.sum | 80 - .../containerd/cgroups/hierarchy.go | 20 - .../github.com/containerd/cgroups/hugetlb.go | 109 - .../github.com/containerd/cgroups/memory.go | 480 - vendor/github.com/containerd/cgroups/named.go | 39 - .../github.com/containerd/cgroups/net_cls.go | 61 - .../github.com/containerd/cgroups/net_prio.go | 65 - vendor/github.com/containerd/cgroups/opts.go | 61 - vendor/github.com/containerd/cgroups/paths.go | 106 - .../containerd/cgroups/perf_event.go | 37 - vendor/github.com/containerd/cgroups/pids.go | 86 - vendor/github.com/containerd/cgroups/rdma.go | 154 - vendor/github.com/containerd/cgroups/state.go | 28 - .../containerd/cgroups/stats/v1/doc.go | 17 - .../containerd/cgroups/stats/v1/metrics.pb.go | 6125 --------- .../cgroups/stats/v1/metrics.pb.txt | 790 -- .../containerd/cgroups/stats/v1/metrics.proto | 158 - .../containerd/cgroups/subsystem.go | 116 - .../github.com/containerd/cgroups/systemd.go | 158 - vendor/github.com/containerd/cgroups/ticks.go | 26 - vendor/github.com/containerd/cgroups/utils.go | 383 - vendor/github.com/containerd/cgroups/v1.go | 73 - .../cgroups => coreos/go-semver}/LICENSE | 1 + .../{go-systemd/v22 => go-semver}/NOTICE | 0 .../coreos/go-semver/semver/semver.go | 296 + .../dbus/set.go => go-semver/semver/sort.go} | 39 +- .../github.com/coreos/go-systemd/v22/LICENSE | 191 - .../coreos/go-systemd/v22/dbus/dbus.go | 261 - .../coreos/go-systemd/v22/dbus/methods.go | 830 -- .../coreos/go-systemd/v22/dbus/properties.go | 237 - .../go-systemd/v22/dbus/subscription.go | 333 - .../go-systemd/v22/dbus/subscription_set.go | 57 - .../docker/go-units/CONTRIBUTING.md | 67 - vendor/github.com/docker/go-units/LICENSE | 191 - vendor/github.com/docker/go-units/MAINTAINERS | 46 - vendor/github.com/docker/go-units/README.md | 16 - vendor/github.com/docker/go-units/circle.yml | 11 - vendor/github.com/docker/go-units/duration.go | 35 - vendor/github.com/docker/go-units/size.go | 108 - vendor/github.com/docker/go-units/ulimit.go | 123 - vendor/github.com/elastic/gosigar/.gitignore | 41 - .../github.com/elastic/gosigar/CHANGELOG.md | 219 - vendor/github.com/elastic/gosigar/LICENSE | 201 - vendor/github.com/elastic/gosigar/NOTICE | 9 - vendor/github.com/elastic/gosigar/README.md | 59 - vendor/github.com/elastic/gosigar/Vagrantfile | 25 - vendor/github.com/elastic/gosigar/codecov.yml | 21 - .../elastic/gosigar/concrete_sigar.go | 89 - vendor/github.com/elastic/gosigar/go.mod | 9 - vendor/github.com/elastic/gosigar/go.sum | 15 - .../github.com/elastic/gosigar/sigar_aix.go | 564 - .../elastic/gosigar/sigar_common_darwin.go | 501 - .../elastic/gosigar/sigar_darwin.go | 20 - .../elastic/gosigar/sigar_darwin_386.go | 18 - .../elastic/gosigar/sigar_format.go | 126 - .../elastic/gosigar/sigar_freebsd.go | 158 - .../elastic/gosigar/sigar_interface.go | 240 - .../github.com/elastic/gosigar/sigar_linux.go | 138 - .../elastic/gosigar/sigar_linux_common.go | 457 - .../elastic/gosigar/sigar_openbsd.go | 426 - .../github.com/elastic/gosigar/sigar_stub.go | 75 - .../github.com/elastic/gosigar/sigar_unix.go | 69 - .../github.com/elastic/gosigar/sigar_util.go | 30 - .../elastic/gosigar/sigar_windows.go | 398 - .../elastic/gosigar/sys/windows/doc.go | 8 - .../elastic/gosigar/sys/windows/ntquery.go | 132 - .../elastic/gosigar/sys/windows/privileges.go | 272 - .../gosigar/sys/windows/syscall_windows.go | 630 - .../elastic/gosigar/sys/windows/version.go | 43 - .../gosigar/sys/windows/zsyscall_windows.go | 299 - .../github.com/francoispqt/gojay/.gitignore | 5 - .../github.com/francoispqt/gojay/.travis.yml | 15 - .../github.com/francoispqt/gojay/Gopkg.lock | 163 - .../github.com/francoispqt/gojay/Gopkg.toml | 23 - vendor/github.com/francoispqt/gojay/LICENSE | 21 - vendor/github.com/francoispqt/gojay/Makefile | 11 - vendor/github.com/francoispqt/gojay/README.md | 855 -- vendor/github.com/francoispqt/gojay/decode.go | 386 - .../francoispqt/gojay/decode_array.go | 247 - .../francoispqt/gojay/decode_bool.go | 241 - .../francoispqt/gojay/decode_embedded_json.go | 85 - .../francoispqt/gojay/decode_interface.go | 130 - .../francoispqt/gojay/decode_number.go | 118 - .../francoispqt/gojay/decode_number_float.go | 516 - .../francoispqt/gojay/decode_number_int.go | 1338 -- .../francoispqt/gojay/decode_number_uint.go | 715 - .../francoispqt/gojay/decode_object.go | 407 - .../francoispqt/gojay/decode_pool.go | 64 - .../francoispqt/gojay/decode_slice.go | 89 - .../francoispqt/gojay/decode_sqlnull.go | 157 - .../francoispqt/gojay/decode_stream.go | 115 - .../francoispqt/gojay/decode_stream_pool.go | 59 - .../francoispqt/gojay/decode_string.go | 260 - .../gojay/decode_string_unicode.go | 98 - .../francoispqt/gojay/decode_time.go | 53 - .../francoispqt/gojay/decode_unsafe.go | 120 - vendor/github.com/francoispqt/gojay/encode.go | 202 - .../francoispqt/gojay/encode_array.go | 212 - .../francoispqt/gojay/encode_bool.go | 164 - .../francoispqt/gojay/encode_builder.go | 65 - .../francoispqt/gojay/encode_embedded_json.go | 93 - .../francoispqt/gojay/encode_interface.go | 173 - .../francoispqt/gojay/encode_null.go | 39 - .../francoispqt/gojay/encode_number.go | 1 - .../francoispqt/gojay/encode_number_float.go | 368 - .../francoispqt/gojay/encode_number_int.go | 500 - .../francoispqt/gojay/encode_number_uint.go | 362 - .../francoispqt/gojay/encode_object.go | 400 - .../francoispqt/gojay/encode_pool.go | 50 - .../francoispqt/gojay/encode_slice.go | 113 - .../francoispqt/gojay/encode_sqlnull.go | 377 - .../francoispqt/gojay/encode_stream.go | 205 - .../francoispqt/gojay/encode_stream_pool.go | 38 - .../francoispqt/gojay/encode_string.go | 186 - .../francoispqt/gojay/encode_time.go | 68 - vendor/github.com/francoispqt/gojay/errors.go | 88 - vendor/github.com/francoispqt/gojay/go.mod | 24 - vendor/github.com/francoispqt/gojay/go.sum | 182 - vendor/github.com/francoispqt/gojay/gojay.go | 10 - vendor/github.com/francoispqt/gojay/gojay.png | Bin 44163 -> 0 bytes .../fsnotify/fsnotify/.editorconfig | 12 - .../fsnotify/fsnotify/.gitattributes | 1 - .../github.com/fsnotify/fsnotify/.gitignore | 6 - vendor/github.com/fsnotify/fsnotify/.mailmap | 2 - vendor/github.com/fsnotify/fsnotify/AUTHORS | 62 - .../github.com/fsnotify/fsnotify/CHANGELOG.md | 339 - .../fsnotify/fsnotify/CONTRIBUTING.md | 77 - vendor/github.com/fsnotify/fsnotify/LICENSE | 28 - vendor/github.com/fsnotify/fsnotify/README.md | 130 - vendor/github.com/fsnotify/fsnotify/fen.go | 38 - .../github.com/fsnotify/fsnotify/fsnotify.go | 69 - vendor/github.com/fsnotify/fsnotify/go.mod | 7 - vendor/github.com/fsnotify/fsnotify/go.sum | 2 - .../github.com/fsnotify/fsnotify/inotify.go | 338 - .../fsnotify/fsnotify/inotify_poller.go | 188 - vendor/github.com/fsnotify/fsnotify/kqueue.go | 522 - .../fsnotify/fsnotify/open_mode_bsd.go | 12 - .../fsnotify/fsnotify/open_mode_darwin.go | 13 - .../github.com/fsnotify/fsnotify/windows.go | 562 - .../go-task/slim-sprig/.editorconfig | 14 - .../go-task/slim-sprig/.gitattributes | 1 - .../github.com/go-task/slim-sprig/.gitignore | 2 - .../go-task/slim-sprig/CHANGELOG.md | 364 - .../github.com/go-task/slim-sprig/README.md | 73 - .../go-task/slim-sprig/Taskfile.yml | 12 - .../github.com/go-task/slim-sprig/crypto.go | 24 - vendor/github.com/go-task/slim-sprig/date.go | 152 - .../github.com/go-task/slim-sprig/defaults.go | 163 - vendor/github.com/go-task/slim-sprig/dict.go | 118 - vendor/github.com/go-task/slim-sprig/doc.go | 19 - .../go-task/slim-sprig/functions.go | 317 - vendor/github.com/go-task/slim-sprig/go.mod | 8 - vendor/github.com/go-task/slim-sprig/go.sum | 22 - vendor/github.com/go-task/slim-sprig/list.go | 464 - .../github.com/go-task/slim-sprig/network.go | 12 - .../github.com/go-task/slim-sprig/numeric.go | 228 - .../github.com/go-task/slim-sprig/reflect.go | 28 - vendor/github.com/go-task/slim-sprig/regex.go | 83 - .../github.com/go-task/slim-sprig/strings.go | 189 - vendor/github.com/go-task/slim-sprig/url.go | 66 - .../github.com/godbus/dbus/v5/CONTRIBUTING.md | 50 - vendor/github.com/godbus/dbus/v5/LICENSE | 25 - vendor/github.com/godbus/dbus/v5/MAINTAINERS | 3 - vendor/github.com/godbus/dbus/v5/README.md | 46 - vendor/github.com/godbus/dbus/v5/auth.go | 255 - .../godbus/dbus/v5/auth_anonymous.go | 16 - .../godbus/dbus/v5/auth_external.go | 26 - vendor/github.com/godbus/dbus/v5/auth_sha1.go | 102 - vendor/github.com/godbus/dbus/v5/call.go | 69 - vendor/github.com/godbus/dbus/v5/conn.go | 983 -- .../github.com/godbus/dbus/v5/conn_darwin.go | 37 - .../github.com/godbus/dbus/v5/conn_other.go | 93 - vendor/github.com/godbus/dbus/v5/conn_unix.go | 17 - .../github.com/godbus/dbus/v5/conn_windows.go | 15 - vendor/github.com/godbus/dbus/v5/dbus.go | 432 - vendor/github.com/godbus/dbus/v5/decoder.go | 292 - .../godbus/dbus/v5/default_handler.go | 342 - vendor/github.com/godbus/dbus/v5/doc.go | 69 - vendor/github.com/godbus/dbus/v5/encoder.go | 235 - vendor/github.com/godbus/dbus/v5/export.go | 464 - vendor/github.com/godbus/dbus/v5/go.mod | 3 - vendor/github.com/godbus/dbus/v5/go.sum | 0 vendor/github.com/godbus/dbus/v5/homedir.go | 28 - .../godbus/dbus/v5/homedir_dynamic.go | 15 - .../godbus/dbus/v5/homedir_static.go | 45 - vendor/github.com/godbus/dbus/v5/match.go | 89 - vendor/github.com/godbus/dbus/v5/message.go | 384 - vendor/github.com/godbus/dbus/v5/object.go | 174 - vendor/github.com/godbus/dbus/v5/sequence.go | 24 - .../godbus/dbus/v5/sequential_handler.go | 125 - .../godbus/dbus/v5/server_interfaces.go | 107 - vendor/github.com/godbus/dbus/v5/sig.go | 293 - .../godbus/dbus/v5/transport_darwin.go | 6 - .../godbus/dbus/v5/transport_generic.go | 52 - .../godbus/dbus/v5/transport_nonce_tcp.go | 39 - .../godbus/dbus/v5/transport_tcp.go | 41 - .../godbus/dbus/v5/transport_unix.go | 214 - .../dbus/v5/transport_unixcred_dragonfly.go | 95 - .../dbus/v5/transport_unixcred_freebsd.go | 92 - .../dbus/v5/transport_unixcred_linux.go | 25 - .../dbus/v5/transport_unixcred_netbsd.go | 14 - .../dbus/v5/transport_unixcred_openbsd.go | 14 - vendor/github.com/godbus/dbus/v5/variant.go | 150 - .../godbus/dbus/v5/variant_lexer.go | 284 - .../godbus/dbus/v5/variant_parser.go | 817 -- .../gogo/protobuf/gogoproto/Makefile | 37 - .../github.com/gogo/protobuf/gogoproto/doc.go | 169 - .../gogo/protobuf/gogoproto/gogo.pb.go | 874 -- .../gogo/protobuf/gogoproto/gogo.pb.golden | 45 - .../gogo/protobuf/gogoproto/gogo.proto | 144 - .../gogo/protobuf/gogoproto/helper.go | 415 - vendor/github.com/gogo/protobuf/io/full.go | 102 + vendor/github.com/gogo/protobuf/io/io.go | 70 + vendor/github.com/gogo/protobuf/io/uint32.go | 138 + vendor/github.com/gogo/protobuf/io/varint.go | 133 + .../protoc-gen-gogo/descriptor/Makefile | 36 - .../protoc-gen-gogo/descriptor/descriptor.go | 118 - .../descriptor/descriptor.pb.go | 2865 ---- .../descriptor/descriptor_gostring.gen.go | 752 -- .../protoc-gen-gogo/descriptor/helper.go | 390 - .../github.com/jbenet/goprocess/.travis.yml | 9 + .../goprocess}/LICENSE | 0 vendor/github.com/jbenet/goprocess/README.md | 132 + .../github.com/jbenet/goprocess/background.go | 33 + .../jbenet/goprocess/context/context.go | 117 + .../jbenet/goprocess/context/derive.go | 19 + vendor/github.com/jbenet/goprocess/go.mod | 5 + vendor/github.com/jbenet/goprocess/go.sum | 2 + .../github.com/jbenet/goprocess/goprocess.go | 263 + .../github.com/jbenet/goprocess/impl-mutex.go | 299 + vendor/github.com/jbenet/goprocess/link.go | 128 + .../github.com/jbenet/goprocess/package.json | 14 + .../klauspost/compress/.gitattributes | 2 - .../github.com/klauspost/compress/.gitignore | 25 - .../klauspost/compress/.goreleaser.yml | 141 - .../github.com/klauspost/compress/README.md | 452 - .../klauspost/compress/compressible.go | 85 - .../klauspost/compress/fse/README.md | 79 - .../klauspost/compress/fse/bitreader.go | 122 - .../klauspost/compress/fse/bitwriter.go | 168 - .../klauspost/compress/fse/bytereader.go | 47 - .../klauspost/compress/fse/compress.go | 683 - .../klauspost/compress/fse/decompress.go | 374 - .../github.com/klauspost/compress/fse/fse.go | 144 - vendor/github.com/klauspost/compress/gen.sh | 4 - vendor/github.com/klauspost/compress/go.mod | 3 - vendor/github.com/klauspost/compress/go.sum | 0 .../klauspost/compress/huff0/.gitignore | 1 - .../klauspost/compress/huff0/README.md | 89 - .../klauspost/compress/huff0/bitreader.go | 329 - .../klauspost/compress/huff0/bitwriter.go | 210 - .../klauspost/compress/huff0/bytereader.go | 54 - .../klauspost/compress/huff0/compress.go | 720 -- .../klauspost/compress/huff0/decompress.go | 1387 -- .../klauspost/compress/huff0/huff0.go | 335 - .../compress/internal/snapref/LICENSE | 27 - .../compress/internal/snapref/decode.go | 264 - .../compress/internal/snapref/decode_other.go | 113 - .../compress/internal/snapref/encode.go | 289 - .../compress/internal/snapref/encode_other.go | 236 - .../compress/internal/snapref/snappy.go | 98 - vendor/github.com/klauspost/compress/s2sx.mod | 4 - vendor/github.com/klauspost/compress/s2sx.sum | 0 .../klauspost/compress/zstd/README.md | 441 - .../klauspost/compress/zstd/bitreader.go | 143 - .../klauspost/compress/zstd/bitwriter.go | 189 - .../klauspost/compress/zstd/blockdec.go | 724 -- .../klauspost/compress/zstd/blockenc.go | 871 -- .../compress/zstd/blocktype_string.go | 85 - .../klauspost/compress/zstd/bytebuf.go | 130 - .../klauspost/compress/zstd/bytereader.go | 88 - .../klauspost/compress/zstd/decodeheader.go | 230 - .../klauspost/compress/zstd/decoder.go | 555 - .../compress/zstd/decoder_options.go | 102 - .../klauspost/compress/zstd/dict.go | 122 - .../klauspost/compress/zstd/enc_base.go | 188 - .../klauspost/compress/zstd/enc_best.go | 558 - .../klauspost/compress/zstd/enc_better.go | 1237 -- .../klauspost/compress/zstd/enc_dfast.go | 1124 -- .../klauspost/compress/zstd/enc_fast.go | 898 -- .../klauspost/compress/zstd/encoder.go | 599 - .../compress/zstd/encoder_options.go | 316 - .../klauspost/compress/zstd/framedec.go | 521 - .../klauspost/compress/zstd/frameenc.go | 137 - .../klauspost/compress/zstd/fse_decoder.go | 385 - .../klauspost/compress/zstd/fse_encoder.go | 724 -- .../klauspost/compress/zstd/fse_predefined.go | 158 - .../klauspost/compress/zstd/hash.go | 41 - .../klauspost/compress/zstd/history.go | 89 - .../compress/zstd/internal/xxhash/LICENSE.txt | 22 - .../compress/zstd/internal/xxhash/README.md | 58 - .../compress/zstd/internal/xxhash/xxhash.go | 237 - .../zstd/internal/xxhash/xxhash_amd64.s | 216 - .../zstd/internal/xxhash/xxhash_arm64.s | 186 - .../zstd/internal/xxhash/xxhash_asm.go | 16 - .../zstd/internal/xxhash/xxhash_other.go | 77 - .../zstd/internal/xxhash/xxhash_safe.go | 11 - .../klauspost/compress/zstd/seqdec.go | 492 - .../klauspost/compress/zstd/seqenc.go | 114 - .../klauspost/compress/zstd/snappy.go | 435 - .../github.com/klauspost/compress/zstd/zip.go | 122 - .../klauspost/compress/zstd/zstd.go | 152 - .../libp2p/go-conn-security/.travis.yml | 30 + .../go-conn-security/LICENSE} | 2 + .../libp2p/go-conn-security/README.md | 51 + .../libp2p/go-conn-security/deprecated.go | 10 + .../github.com/libp2p/go-conn-security/go.mod | 8 + .../github.com/libp2p/go-conn-security/go.sum | 73 + .../go-conn-security/insecure/deprecated.go | 21 + .../libp2p/go-eventbus/LICENSE-APACHE | 5 - .../github.com/libp2p/go-eventbus/README.md | 25 - vendor/github.com/libp2p/go-eventbus/basic.go | 353 - vendor/github.com/libp2p/go-eventbus/go.mod | 9 - vendor/github.com/libp2p/go-eventbus/opts.go | 32 - .../libp2p/go-libp2p-blankhost/blank.go | 241 - .../libp2p/go-libp2p-blankhost/go.mod | 13 - .../go-libp2p-blankhost/peer_connectedness.go | 73 - .../LICENSE | 2 +- .../libp2p/go-libp2p-circuit/README.md | 43 + .../codecov.yml | 0 .../client => go-libp2p-circuit}/conn.go | 101 +- .../libp2p/go-libp2p-circuit/dial.go | 57 + .../libp2p/go-libp2p-circuit/go.mod | 15 + .../go.sum | 122 +- .../libp2p/go-libp2p-circuit/listen.go | 61 + .../pb/Makefile | 0 .../pb/relay.pb.go} | 198 +- .../pb/relay.proto} | 2 +- .../libp2p/go-libp2p-circuit/relay.go | 507 + .../libp2p/go-libp2p-circuit/transport.go | 74 + .../util/io.go => go-libp2p-circuit/util.go} | 67 +- .../libp2p/go-libp2p-circuit/version.json | 3 + .../libp2p/go-libp2p-core/helpers/match.go | 42 + .../libp2p/go-libp2p-crypto/.gitignore | 7 + .../libp2p/go-libp2p-crypto/.travis.yml | 30 + .../LICENSE | 0 .../libp2p/go-libp2p-crypto/README.md | 42 + .../codecov.yml | 0 .../go-libp2p-crypto/ecdsa_deprecated.go | 64 + .../go-libp2p-crypto/ed25519_deprecated.go | 28 + .../github.com/libp2p/go-libp2p-crypto/go.mod | 3 + .../github.com/libp2p/go-libp2p-crypto/go.sum | 67 + .../libp2p/go-libp2p-crypto/key_deprecated.go | 108 + .../libp2p/go-libp2p-crypto/rsa_deprecated.go | 31 + .../go-libp2p-crypto/secp256k1_deprecated.go | 28 + .../libp2p/go-libp2p-host/.travis.yml | 30 + .../LICENSE-MIT => go-libp2p-host/LICENSE} | 2 + .../libp2p/go-libp2p-host/README.md | 38 + .../libp2p/go-libp2p-host/codecov.yml | 3 + .../libp2p/go-libp2p-host/deprecated.go | 23 + .../github.com/libp2p/go-libp2p-host/go.mod | 3 + .../github.com/libp2p/go-libp2p-host/go.sum | 71 + .../go-libp2p-interface-connmgr/.travis.yml | 30 + .../go-libp2p-interface-connmgr/LICENSE} | 4 +- .../README.md | 15 +- .../go-libp2p-interface-connmgr/codecov.yml | 3 + .../go-libp2p-interface-connmgr/deprecated.go | 13 + .../libp2p/go-libp2p-interface-connmgr/go.mod | 3 + .../libp2p/go-libp2p-interface-connmgr/go.sum | 69 + .../go-libp2p-interface-pnet/.travis.yml | 30 + .../LICENSE | 3 +- .../libp2p/go-libp2p-interface-pnet/README.md | 42 + .../go-libp2p-interface-pnet/codecov.yml | 3 + .../go-libp2p-interface-pnet/deprecated.go | 31 + .../libp2p/go-libp2p-interface-pnet/go.mod | 5 + .../libp2p/go-libp2p-interface-pnet/go.sum | 53 + .../libp2p/go-libp2p-loggables/.travis.yml | 30 + .../libp2p/go-libp2p-loggables/LICENSE | 21 + .../libp2p/go-libp2p-loggables/README.md | 34 + .../libp2p/go-libp2p-loggables/codecov.yml | 3 + .../libp2p/go-libp2p-loggables/go.mod | 8 + .../libp2p/go-libp2p-loggables/go.sum | 88 + .../libp2p/go-libp2p-loggables/loggables.go | 80 + .../libp2p/go-libp2p-metrics/.travis.yml | 30 + .../libp2p/go-libp2p-metrics/LICENSE | 21 + .../libp2p/go-libp2p-metrics/README.md | 38 + .../libp2p/go-libp2p-metrics/codecov.yml | 3 + .../libp2p/go-libp2p-metrics/deprecated.go | 18 + .../libp2p/go-libp2p-metrics/go.mod | 7 + .../libp2p/go-libp2p-metrics/go.sum | 71 + .../github.com/libp2p/go-libp2p-mplex/conn.go | 43 - .../github.com/libp2p/go-libp2p-mplex/go.mod | 9 - .../github.com/libp2p/go-libp2p-mplex/go.sum | 230 - .../libp2p/go-libp2p-mplex/stream.go | 64 - .../libp2p/go-libp2p-mplex/transport.go | 22 - .../libp2p/go-libp2p-mplex/version.json | 3 - .../libp2p/go-libp2p-net/.travis.yml | 30 + .../github.com/libp2p/go-libp2p-net/LICENSE | 21 + .../github.com/libp2p/go-libp2p-net/README.md | 48 + .../libp2p/go-libp2p-net/codecov.yml | 3 + .../libp2p/go-libp2p-net/deprecated.go | 122 + vendor/github.com/libp2p/go-libp2p-net/go.mod | 3 + vendor/github.com/libp2p/go-libp2p-net/go.sum | 71 + .../libp2p/go-libp2p-peer/.travis.yml | 30 + .../github.com/libp2p/go-libp2p-peer/LICENSE | 21 + .../libp2p/go-libp2p-peer/README.md | 37 + .../libp2p/go-libp2p-peer/codecov.yml | 3 + .../libp2p/go-libp2p-peer/deprecated.go | 65 + .../github.com/libp2p/go-libp2p-peer/go.mod | 7 + .../github.com/libp2p/go-libp2p-peer/go.sum | 70 + .../libp2p/go-libp2p-protocol/.travis.yml | 30 + .../libp2p/go-libp2p-protocol/LICENSE | 21 + .../libp2p/go-libp2p-protocol/README.md | 45 + .../libp2p/go-libp2p-protocol/codecov.yml | 3 + .../libp2p/go-libp2p-protocol/go.mod | 5 + .../libp2p/go-libp2p-protocol/go.sum | 53 + .../libp2p/go-libp2p-protocol/protocol.go | 9 + .../go-libp2p-quic-transport/.gitignore | 3 - .../libp2p/go-libp2p-quic-transport/README.md | 35 - .../libp2p/go-libp2p-quic-transport/conn.go | 100 - .../libp2p/go-libp2p-quic-transport/go.mod | 22 - .../libp2p/go-libp2p-quic-transport/go.sum | 696 - .../go-libp2p-quic-transport/listener.go | 160 - .../quic_multiaddr.go | 30 - .../libp2p/go-libp2p-quic-transport/reuse.go | 231 - .../libp2p/go-libp2p-quic-transport/stream.go | 55 - .../libp2p/go-libp2p-quic-transport/tracer.go | 95 - .../tracer_metrics.go | 387 - .../go-libp2p-quic-transport/transport.go | 407 - .../go-libp2p-quic-transport/version.json | 3 - .../go-libp2p-resource-manager/.gitignore | 15 - .../go-libp2p-resource-manager/README.md | 354 - .../go-libp2p-resource-manager/extapi.go | 147 - .../libp2p/go-libp2p-resource-manager/go.mod | 10 - .../libp2p/go-libp2p-resource-manager/go.sum | 141 - .../go-libp2p-resource-manager/limit.go | 187 - .../limit_config.go | 305 - .../limit_config_test.json | 55 - .../limit_defaults.go | 162 - .../limit_dynamic.go | 128 - .../limit_static.go | 138 - .../go-libp2p-resource-manager/rcmgr.go | 615 - .../go-libp2p-resource-manager/scope.go | 690 - .../go-libp2p-resource-manager/trace.go | 510 - .../go-libp2p-resource-manager/version.json | 3 - .../libp2p/go-libp2p-secio/.travis.yml | 31 + .../github.com/libp2p/go-libp2p-secio/LICENSE | 21 + .../libp2p/go-libp2p-secio/README.md | 95 + .../github.com/libp2p/go-libp2p-secio/al.go | 116 + .../libp2p/go-libp2p-secio/codecov.yml | 3 + .../github.com/libp2p/go-libp2p-secio/go.mod | 14 + .../{go-eventbus => go-libp2p-secio}/go.sum | 96 +- .../circuitv1 => go-libp2p-secio}/pb/Makefile | 2 +- .../libp2p/go-libp2p-secio/pb/spipe.pb.go | 744 ++ .../libp2p/go-libp2p-secio/pb/spipe.proto | 16 + .../libp2p/go-libp2p-secio/protocol.go | 389 + .../github.com/libp2p/go-libp2p-secio/rw.go | 268 + .../libp2p/go-libp2p-secio/transport.go | 84 + .../libp2p/go-libp2p-tls/LICENSE.md | 7 - .../github.com/libp2p/go-libp2p-tls/README.md | 44 - .../libp2p/go-libp2p-tls/codecov.yml | 7 - .../github.com/libp2p/go-libp2p-tls/conn.go | 37 - .../github.com/libp2p/go-libp2p-tls/crypto.go | 237 - .../libp2p/go-libp2p-tls/extension.go | 22 - vendor/github.com/libp2p/go-libp2p-tls/go.mod | 10 - vendor/github.com/libp2p/go-libp2p-tls/go.sum | 108 - .../libp2p/go-libp2p-tls/transport.go | 148 - .../libp2p/go-libp2p-tls/version.json | 3 - .../.gitignore | 0 .../libp2p/go-libp2p-transport/.travis.yml | 30 + .../libp2p/go-libp2p-transport/LICENSE | 21 + .../libp2p/go-libp2p-transport/README.md | 56 + .../libp2p/go-libp2p-transport/codecov.yml | 3 + .../libp2p/go-libp2p-transport/deprecated.go | 23 + .../libp2p/go-libp2p-transport/go.mod | 7 + .../libp2p/go-libp2p-transport/go.sum | 72 + .../libp2p/go-libp2p-yamux/README.md | 25 - .../github.com/libp2p/go-libp2p-yamux/conn.go | 44 - .../github.com/libp2p/go-libp2p-yamux/go.mod | 9 - .../github.com/libp2p/go-libp2p-yamux/go.sum | 172 - .../libp2p/go-libp2p-yamux/stream.go | 64 - .../libp2p/go-libp2p-yamux/transport.go | 50 - .../libp2p/go-libp2p-yamux/version.json | 3 - .../github.com/libp2p/go-libp2p/.codecov.yml | 2 - vendor/github.com/libp2p/go-libp2p/.gitignore | 4 +- .../github.com/libp2p/go-libp2p/.travis.yml | 23 + vendor/github.com/libp2p/go-libp2p/Makefile | 10 + vendor/github.com/libp2p/go-libp2p/NEWS.md | 304 + vendor/github.com/libp2p/go-libp2p/README.md | 264 +- .../github.com/libp2p/go-libp2p/codecov.yml | 3 + .../libp2p/go-libp2p/config/config.go | 352 +- .../go-libp2p/config/constructor_types.go | 78 +- .../libp2p/go-libp2p/config/muxer.go | 24 +- .../go-libp2p/config/reflection_magic.go | 65 +- .../libp2p/go-libp2p/config/security.go | 34 +- .../libp2p/go-libp2p/config/transport.go | 27 +- .../github.com/libp2p/go-libp2p/defaults.go | 69 +- vendor/github.com/libp2p/go-libp2p/go.mod | 63 - vendor/github.com/libp2p/go-libp2p/go.sum | 1269 -- vendor/github.com/libp2p/go-libp2p/libp2p.go | 29 +- vendor/github.com/libp2p/go-libp2p/limits.go | 157 - vendor/github.com/libp2p/go-libp2p/options.go | 255 +- .../libp2p/go-libp2p/options_filter.go | 36 - .../p2p/discovery/routing/routing.go | 112 - .../go-libp2p/p2p/host/autonat/autonat.go | 468 - .../go-libp2p/p2p/host/autonat/client.go | 117 - .../go-libp2p/p2p/host/autonat/dialpolicy.go | 94 - .../go-libp2p/p2p/host/autonat/interface.go | 34 - .../go-libp2p/p2p/host/autonat/notify.go | 36 - .../go-libp2p/p2p/host/autonat/options.go | 144 - .../go-libp2p/p2p/host/autonat/pb/Makefile | 6 - .../p2p/host/autonat/pb/autonat.pb.go | 1246 -- .../p2p/host/autonat/pb/autonat.proto | 37 - .../go-libp2p/p2p/host/autonat/proto.go | 40 - .../libp2p/go-libp2p/p2p/host/autonat/svc.go | 281 - .../p2p/host/autorelay/addrsplosion.go | 165 - .../go-libp2p/p2p/host/autorelay/autorelay.go | 533 - .../go-libp2p/p2p/host/autorelay/doc.go | 28 - .../go-libp2p/p2p/host/autorelay/host.go | 19 - .../go-libp2p/p2p/host/autorelay/log.go | 7 - .../go-libp2p/p2p/host/autorelay/relay.go | 63 - .../go-libp2p/p2p/host/basic/basic_host.go | 955 +- .../libp2p/go-libp2p/p2p/host/basic/natmgr.go | 312 +- .../p2p/host/basic/peer_connectedness.go | 73 - .../p2p/host/pstoremanager/pstoremanager.go | 130 - .../go-libp2p/p2p/host/relaysvc/relay.go | 91 - .../go-libp2p/p2p/host/routed/routed.go | 189 - .../go-libp2p/p2p/net/connmgr/connmgr.go | 694 - .../libp2p/go-libp2p/p2p/net/connmgr/decay.go | 355 - .../go-libp2p/p2p/net/connmgr/options.go | 53 - .../go-libp2p/p2p/net/connmgr/watchdog_cgo.go | 18 - .../p2p/net/connmgr/watchdog_no_cgo.go | 16 - .../p2p/protocol/circuitv1/relay/options.go | 46 - .../p2p/protocol/circuitv1/relay/relay.go | 453 - .../p2p/protocol/circuitv2/client/client.go | 79 - .../p2p/protocol/circuitv2/client/dial.go | 251 - .../p2p/protocol/circuitv2/client/handlers.go | 172 - .../p2p/protocol/circuitv2/client/listen.go | 54 - .../protocol/circuitv2/client/reservation.go | 126 - .../protocol/circuitv2/client/transport.go | 90 - .../p2p/protocol/circuitv2/pb/Makefile | 11 - .../p2p/protocol/circuitv2/pb/circuit.pb.go | 1758 --- .../p2p/protocol/circuitv2/pb/circuit.proto | 60 - .../p2p/protocol/circuitv2/pb/voucher.pb.go | 438 - .../p2p/protocol/circuitv2/pb/voucher.proto | 9 - .../p2p/protocol/circuitv2/proto/protocol.go | 7 - .../p2p/protocol/circuitv2/proto/voucher.go | 72 - .../p2p/protocol/circuitv2/relay/acl.go | 17 - .../protocol/circuitv2/relay/constraints.go | 124 - .../p2p/protocol/circuitv2/relay/options.go | 27 - .../p2p/protocol/circuitv2/relay/relay.go | 597 - .../p2p/protocol/circuitv2/relay/resources.go | 66 - .../p2p/protocol/circuitv2/util/pbconv.go | 97 - .../p2p/protocol/holepunch/coordination.go | 511 - .../p2p/protocol/holepunch/pb/holepunch.pb.go | 415 - .../p2p/protocol/holepunch/pb/holepunch.proto | 14 - .../p2p/protocol/holepunch/tracer.go | 252 - .../go-libp2p/p2p/protocol/identify/id.go | 732 +- .../p2p/protocol/identify/id_delta.go | 83 - .../p2p/protocol/identify/id_push.go | 17 - .../p2p/protocol/identify/obsaddr.go | 587 +- .../go-libp2p/p2p/protocol/identify/opts.go | 24 - .../p2p/protocol/identify/pb/identify.pb.go | 622 +- .../p2p/protocol/identify/pb/identify.proto | 17 - .../p2p/protocol/identify/peer_loop.go | 265 - .../go-libp2p/p2p/protocol/ping/ping.go | 127 +- .../libp2p/go-libp2p/package-list.json | 44 +- .../github.com/libp2p/go-libp2p/package.json | 238 + .../github.com/libp2p/go-libp2p/version.json | 3 - .../.travis.yml | 0 .../github.com/libp2p/go-maddr-filter/LICENSE | 21 + .../libp2p/go-maddr-filter/README.md | 66 + .../libp2p/go-maddr-filter/codecov.yml | 3 + .../libp2p/go-maddr-filter/filter.go | 23 + .../github.com/libp2p/go-maddr-filter/go.mod | 5 + .../github.com/libp2p/go-maddr-filter/go.sum | 22 + .../libp2p/go-stream-muxer-multistream/go.mod | 8 - .../libp2p/go-stream-muxer-multistream/go.sum | 92 - .../go-stream-muxer-multistream/version.json | 3 - .../.gitignore | 0 .../libp2p/go-stream-muxer/.gxignore | 1 + .../libp2p/go-stream-muxer/.travis.yml | 30 + .../LICENSE | 0 .../libp2p/go-stream-muxer/README.md | 120 + .../libp2p/go-stream-muxer/codecov.yml | 3 + .../libp2p/go-stream-muxer/deprecated.go | 18 + .../github.com/libp2p/go-stream-muxer/go.mod | 6 + .../github.com/libp2p/go-stream-muxer/go.sum | 55 + vendor/github.com/libp2p/go-yamux/v3/go.mod | 8 - vendor/github.com/libp2p/go-yamux/v3/go.sum | 13 - vendor/github.com/libp2p/go-yamux/v3/ping.go | 34 - vendor/github.com/libp2p/go-yamux/v3/util.go | 181 - .../libp2p/go-yamux/v3/version.json | 3 - .../lucas-clemente/quic-go/.gitignore | 17 - .../lucas-clemente/quic-go/.golangci.yml | 45 - .../lucas-clemente/quic-go/Changelog.md | 109 - .../github.com/lucas-clemente/quic-go/LICENSE | 21 - .../lucas-clemente/quic-go/README.md | 62 - .../lucas-clemente/quic-go/buffer_pool.go | 80 - .../lucas-clemente/quic-go/client.go | 337 - .../lucas-clemente/quic-go/closed_session.go | 112 - .../lucas-clemente/quic-go/codecov.yml | 21 - .../lucas-clemente/quic-go/config.go | 124 - .../github.com/lucas-clemente/quic-go/conn.go | 65 - .../lucas-clemente/quic-go/conn_generic.go | 18 - .../quic-go/conn_helper_darwin.go | 25 - .../quic-go/conn_helper_freebsd.go | 23 - .../quic-go/conn_helper_linux.go | 23 - .../quic-go/conn_id_generator.go | 140 - .../lucas-clemente/quic-go/conn_id_manager.go | 207 - .../lucas-clemente/quic-go/conn_oob.go | 257 - .../lucas-clemente/quic-go/conn_windows.go | 57 - .../lucas-clemente/quic-go/crypto_stream.go | 115 - .../quic-go/crypto_stream_manager.go | 61 - .../lucas-clemente/quic-go/datagram_queue.go | 87 - .../lucas-clemente/quic-go/errors.go | 58 - .../lucas-clemente/quic-go/frame_sorter.go | 224 - .../lucas-clemente/quic-go/framer.go | 171 - .../github.com/lucas-clemente/quic-go/go.mod | 20 - .../github.com/lucas-clemente/quic-go/go.sum | 285 - .../lucas-clemente/quic-go/interface.go | 330 - .../internal/ackhandler/ack_eliciting.go | 20 - .../quic-go/internal/ackhandler/ackhandler.go | 21 - .../quic-go/internal/ackhandler/frame.go | 9 - .../quic-go/internal/ackhandler/gen.go | 3 - .../quic-go/internal/ackhandler/interfaces.go | 68 - .../quic-go/internal/ackhandler/mockgen.go | 3 - .../internal/ackhandler/packet_linkedlist.go | 217 - .../ackhandler/packet_number_generator.go | 76 - .../ackhandler/received_packet_handler.go | 136 - .../ackhandler/received_packet_history.go | 142 - .../ackhandler/received_packet_tracker.go | 196 - .../quic-go/internal/ackhandler/send_mode.go | 40 - .../ackhandler/sent_packet_handler.go | 838 -- .../ackhandler/sent_packet_history.go | 108 - .../quic-go/internal/congestion/bandwidth.go | 25 - .../quic-go/internal/congestion/clock.go | 18 - .../quic-go/internal/congestion/cubic.go | 214 - .../internal/congestion/cubic_sender.go | 316 - .../internal/congestion/hybrid_slow_start.go | 113 - .../quic-go/internal/congestion/interface.go | 28 - .../quic-go/internal/congestion/pacer.go | 77 - .../flowcontrol/base_flow_controller.go | 125 - .../flowcontrol/connection_flow_controller.go | 112 - .../quic-go/internal/flowcontrol/interface.go | 42 - .../flowcontrol/stream_flow_controller.go | 149 - .../quic-go/internal/handshake/aead.go | 155 - .../internal/handshake/crypto_setup.go | 800 -- .../internal/handshake/header_protector.go | 127 - .../quic-go/internal/handshake/hkdf.go | 29 - .../internal/handshake/initial_aead.go | 64 - .../quic-go/internal/handshake/interface.go | 102 - .../quic-go/internal/handshake/mockgen.go | 3 - .../quic-go/internal/handshake/retry.go | 62 - .../internal/handshake/session_ticket.go | 48 - .../handshake/tls_extension_handler.go | 68 - .../internal/handshake/token_generator.go | 134 - .../internal/handshake/token_protector.go | 89 - .../internal/handshake/updatable_aead.go | 321 - .../quic-go/internal/logutils/frame.go | 33 - .../internal/protocol/connection_id.go | 69 - .../internal/protocol/encryption_level.go | 30 - .../quic-go/internal/protocol/key_phase.go | 36 - .../internal/protocol/packet_number.go | 79 - .../quic-go/internal/protocol/params.go | 195 - .../quic-go/internal/protocol/perspective.go | 26 - .../quic-go/internal/protocol/protocol.go | 97 - .../quic-go/internal/protocol/stream.go | 76 - .../quic-go/internal/protocol/version.go | 111 - .../quic-go/internal/qerr/error_codes.go | 88 - .../quic-go/internal/qerr/errors.go | 124 - .../quic-go/internal/qtls/go116.go | 100 - .../quic-go/internal/qtls/go117.go | 100 - .../quic-go/internal/qtls/go118.go | 100 - .../quic-go/internal/qtls/go119.go | 6 - .../quic-go/internal/utils/atomic_bool.go | 22 - .../internal/utils/buffered_write_closer.go | 26 - .../internal/utils/byteinterval_linkedlist.go | 217 - .../quic-go/internal/utils/byteorder.go | 17 - .../internal/utils/byteorder_big_endian.go | 89 - .../quic-go/internal/utils/gen.go | 5 - .../quic-go/internal/utils/ip.go | 10 - .../quic-go/internal/utils/log.go | 131 - .../quic-go/internal/utils/minmax.go | 170 - .../internal/utils/new_connection_id.go | 12 - .../utils/newconnectionid_linkedlist.go | 217 - .../quic-go/internal/utils/packet_interval.go | 9 - .../utils/packetinterval_linkedlist.go | 217 - .../quic-go/internal/utils/rand.go | 29 - .../quic-go/internal/utils/rtt_stats.go | 127 - .../internal/utils/streamframe_interval.go | 9 - .../quic-go/internal/utils/timer.go | 53 - .../quic-go/internal/wire/ack_frame.go | 251 - .../quic-go/internal/wire/ack_range.go | 14 - .../internal/wire/connection_close_frame.go | 83 - .../quic-go/internal/wire/crypto_frame.go | 102 - .../internal/wire/data_blocked_frame.go | 38 - .../quic-go/internal/wire/datagram_frame.go | 85 - .../quic-go/internal/wire/extended_header.go | 235 - .../quic-go/internal/wire/frame_parser.go | 143 - .../internal/wire/handshake_done_frame.go | 28 - .../quic-go/internal/wire/header.go | 257 - .../quic-go/internal/wire/interface.go | 19 - .../quic-go/internal/wire/log.go | 72 - .../quic-go/internal/wire/max_data_frame.go | 40 - .../internal/wire/max_stream_data_frame.go | 46 - .../internal/wire/max_streams_frame.go | 55 - .../internal/wire/new_connection_id_frame.go | 80 - .../quic-go/internal/wire/new_token_frame.go | 48 - .../internal/wire/path_challenge_frame.go | 38 - .../internal/wire/path_response_frame.go | 38 - .../quic-go/internal/wire/ping_frame.go | 27 - .../quic-go/internal/wire/pool.go | 33 - .../internal/wire/reset_stream_frame.go | 58 - .../wire/retire_connection_id_frame.go | 36 - .../internal/wire/stop_sending_frame.go | 48 - .../wire/stream_data_blocked_frame.go | 46 - .../quic-go/internal/wire/stream_frame.go | 189 - .../internal/wire/streams_blocked_frame.go | 55 - .../internal/wire/transport_parameters.go | 476 - .../internal/wire/version_negotiation.go | 54 - .../lucas-clemente/quic-go/logging/frame.go | 66 - .../quic-go/logging/interface.go | 134 - .../lucas-clemente/quic-go/logging/mockgen.go | 4 - .../quic-go/logging/multiplex.go | 219 - .../quic-go/logging/packet_header.go | 27 - .../lucas-clemente/quic-go/logging/types.go | 94 - .../lucas-clemente/quic-go/mockgen.go | 27 - .../lucas-clemente/quic-go/mockgen_private.sh | 49 - .../lucas-clemente/quic-go/mtu_discoverer.go | 84 - .../lucas-clemente/quic-go/multiplexer.go | 107 - .../quic-go/packet_handler_map.go | 467 - .../lucas-clemente/quic-go/packet_packer.go | 894 -- .../lucas-clemente/quic-go/packet_unpacker.go | 196 - .../lucas-clemente/quic-go/qlog/event.go | 529 - .../lucas-clemente/quic-go/qlog/frame.go | 227 - .../quic-go/qlog/packet_header.go | 119 - .../lucas-clemente/quic-go/qlog/qlog.go | 486 - .../lucas-clemente/quic-go/qlog/trace.go | 66 - .../lucas-clemente/quic-go/qlog/types.go | 320 - .../lucas-clemente/quic-go/quicvarint/io.go | 65 - .../quic-go/quicvarint/varint.go | 139 - .../lucas-clemente/quic-go/receive_stream.go | 323 - .../quic-go/retransmission_queue.go | 131 - .../lucas-clemente/quic-go/send_conn.go | 74 - .../lucas-clemente/quic-go/send_queue.go | 82 - .../lucas-clemente/quic-go/send_stream.go | 488 - .../lucas-clemente/quic-go/server.go | 671 - .../lucas-clemente/quic-go/session.go | 2007 --- .../lucas-clemente/quic-go/stream.go | 149 - .../lucas-clemente/quic-go/streams_map.go | 317 - .../quic-go/streams_map_generic_helper.go | 18 - .../quic-go/streams_map_incoming_bidi.go | 192 - .../quic-go/streams_map_incoming_generic.go | 190 - .../quic-go/streams_map_incoming_uni.go | 192 - .../quic-go/streams_map_outgoing_bidi.go | 226 - .../quic-go/streams_map_outgoing_generic.go | 224 - .../quic-go/streams_map_outgoing_uni.go | 226 - .../lucas-clemente/quic-go/token_store.go | 117 - .../lucas-clemente/quic-go/tools.go | 9 - .../quic-go/window_update_queue.go | 71 - .../marten-seemann/qtls-go1-16/LICENSE | 27 - .../marten-seemann/qtls-go1-16/README.md | 6 - .../marten-seemann/qtls-go1-16/alert.go | 102 - .../marten-seemann/qtls-go1-16/auth.go | 289 - .../qtls-go1-16/cipher_suites.go | 532 - .../marten-seemann/qtls-go1-16/common.go | 1590 --- .../marten-seemann/qtls-go1-16/conn.go | 1536 --- .../marten-seemann/qtls-go1-16/go.mod | 9 - .../marten-seemann/qtls-go1-16/go.sum | 14 - .../qtls-go1-16/handshake_client.go | 1105 -- .../qtls-go1-16/handshake_client_tls13.go | 740 -- .../qtls-go1-16/handshake_messages.go | 1832 --- .../qtls-go1-16/handshake_server.go | 878 -- .../qtls-go1-16/handshake_server_tls13.go | 912 -- .../qtls-go1-16/key_agreement.go | 338 - .../qtls-go1-16/key_schedule.go | 199 - .../marten-seemann/qtls-go1-16/prf.go | 283 - .../marten-seemann/qtls-go1-16/ticket.go | 259 - .../marten-seemann/qtls-go1-16/tls.go | 393 - .../marten-seemann/qtls-go1-16/unsafe.go | 96 - .../marten-seemann/qtls-go1-17/LICENSE | 27 - .../marten-seemann/qtls-go1-17/README.md | 6 - .../marten-seemann/qtls-go1-17/alert.go | 102 - .../marten-seemann/qtls-go1-17/auth.go | 289 - .../qtls-go1-17/cipher_suites.go | 705 - .../marten-seemann/qtls-go1-17/common.go | 1485 --- .../marten-seemann/qtls-go1-17/conn.go | 1590 --- .../marten-seemann/qtls-go1-17/go.mod | 10 - .../marten-seemann/qtls-go1-17/go.sum | 34 - .../qtls-go1-17/handshake_client.go | 1111 -- .../qtls-go1-17/handshake_client_tls13.go | 732 -- .../qtls-go1-17/handshake_messages.go | 1832 --- .../qtls-go1-17/handshake_server.go | 905 -- .../qtls-go1-17/handshake_server_tls13.go | 895 -- .../qtls-go1-17/key_agreement.go | 357 - .../qtls-go1-17/key_schedule.go | 199 - .../marten-seemann/qtls-go1-17/prf.go | 283 - .../marten-seemann/qtls-go1-17/ticket.go | 259 - .../marten-seemann/qtls-go1-17/tls.go | 362 - .../marten-seemann/qtls-go1-17/unsafe.go | 96 - .../marten-seemann/qtls-go1-18/LICENSE | 27 - .../marten-seemann/qtls-go1-18/README.md | 6 - .../marten-seemann/qtls-go1-18/alert.go | 102 - .../marten-seemann/qtls-go1-18/auth.go | 289 - .../qtls-go1-18/cipher_suites.go | 705 - .../marten-seemann/qtls-go1-18/common.go | 1507 --- .../marten-seemann/qtls-go1-18/conn.go | 1597 --- .../marten-seemann/qtls-go1-18/go.mod | 10 - .../marten-seemann/qtls-go1-18/go.sum | 34 - .../qtls-go1-18/handshake_client.go | 1111 -- .../qtls-go1-18/handshake_client_tls13.go | 732 -- .../qtls-go1-18/handshake_messages.go | 1831 --- .../qtls-go1-18/handshake_server.go | 905 -- .../qtls-go1-18/handshake_server_tls13.go | 895 -- .../qtls-go1-18/key_agreement.go | 357 - .../qtls-go1-18/key_schedule.go | 199 - .../marten-seemann/qtls-go1-18/prf.go | 283 - .../marten-seemann/qtls-go1-18/ticket.go | 259 - .../marten-seemann/qtls-go1-18/tls.go | 362 - .../marten-seemann/qtls-go1-18/unsafe.go | 96 - vendor/github.com/nxadm/tail/.gitignore | 3 - vendor/github.com/nxadm/tail/CHANGES.md | 56 - vendor/github.com/nxadm/tail/Dockerfile | 19 - vendor/github.com/nxadm/tail/LICENSE | 21 - vendor/github.com/nxadm/tail/README.md | 44 - vendor/github.com/nxadm/tail/go.mod | 8 - vendor/github.com/nxadm/tail/go.sum | 6 - .../github.com/nxadm/tail/ratelimiter/Licence | 7 - .../nxadm/tail/ratelimiter/leakybucket.go | 97 - .../nxadm/tail/ratelimiter/memory.go | 60 - .../nxadm/tail/ratelimiter/storage.go | 6 - vendor/github.com/nxadm/tail/tail.go | 455 - vendor/github.com/nxadm/tail/tail_posix.go | 17 - vendor/github.com/nxadm/tail/tail_windows.go | 19 - vendor/github.com/nxadm/tail/util/util.go | 49 - .../nxadm/tail/watch/filechanges.go | 37 - vendor/github.com/nxadm/tail/watch/inotify.go | 136 - .../nxadm/tail/watch/inotify_tracker.go | 249 - vendor/github.com/nxadm/tail/watch/polling.go | 119 - vendor/github.com/nxadm/tail/watch/watch.go | 21 - .../github.com/nxadm/tail/winfile/winfile.go | 93 - vendor/github.com/onsi/ginkgo/LICENSE | 20 - .../github.com/onsi/ginkgo/config/config.go | 232 - .../onsi/ginkgo/formatter/formatter.go | 190 - .../onsi/ginkgo/ginkgo/bootstrap_command.go | 201 - .../onsi/ginkgo/ginkgo/build_command.go | 66 - .../ginkgo/ginkgo/convert/ginkgo_ast_nodes.go | 123 - .../onsi/ginkgo/ginkgo/convert/import.go | 90 - .../ginkgo/ginkgo/convert/package_rewriter.go | 128 - .../onsi/ginkgo/ginkgo/convert/test_finder.go | 56 - .../ginkgo/convert/testfile_rewriter.go | 162 - .../ginkgo/convert/testing_t_rewriter.go | 130 - .../onsi/ginkgo/ginkgo/convert_command.go | 51 - .../onsi/ginkgo/ginkgo/generate_command.go | 274 - .../onsi/ginkgo/ginkgo/help_command.go | 33 - .../interrupthandler/interrupt_handler.go | 52 - .../sigquit_swallower_unix.go | 14 - .../sigquit_swallower_windows.go | 7 - vendor/github.com/onsi/ginkgo/ginkgo/main.go | 337 - .../onsi/ginkgo/ginkgo/nodot/nodot.go | 196 - .../onsi/ginkgo/ginkgo/nodot_command.go | 77 - .../onsi/ginkgo/ginkgo/notifications.go | 141 - .../onsi/ginkgo/ginkgo/outline/ginkgo.go | 243 - .../onsi/ginkgo/ginkgo/outline/import.go | 65 - .../onsi/ginkgo/ginkgo/outline/outline.go | 107 - .../onsi/ginkgo/ginkgo/outline_command.go | 95 - .../onsi/ginkgo/ginkgo/run_command.go | 316 - .../run_watch_and_build_command_flags.go | 169 - .../onsi/ginkgo/ginkgo/suite_runner.go | 173 - .../ginkgo/ginkgo/testrunner/build_args.go | 7 - .../ginkgo/testrunner/build_args_old.go | 7 - .../ginkgo/ginkgo/testrunner/log_writer.go | 52 - .../ginkgo/ginkgo/testrunner/run_result.go | 27 - .../ginkgo/ginkgo/testrunner/test_runner.go | 554 - .../ginkgo/ginkgo/testsuite/test_suite.go | 115 - .../ginkgo/testsuite/vendor_check_go15.go | 16 - .../ginkgo/testsuite/vendor_check_go16.go | 15 - .../onsi/ginkgo/ginkgo/unfocus_command.go | 180 - .../onsi/ginkgo/ginkgo/version_command.go | 25 - .../onsi/ginkgo/ginkgo/watch/delta.go | 22 - .../onsi/ginkgo/ginkgo/watch/delta_tracker.go | 75 - .../onsi/ginkgo/ginkgo/watch/dependencies.go | 92 - .../onsi/ginkgo/ginkgo/watch/package_hash.go | 104 - .../ginkgo/ginkgo/watch/package_hashes.go | 85 - .../onsi/ginkgo/ginkgo/watch/suite.go | 87 - .../onsi/ginkgo/ginkgo/watch_command.go | 175 - .../internal/codelocation/code_location.go | 48 - .../internal/containernode/container_node.go | 151 - .../onsi/ginkgo/internal/failer/failer.go | 92 - .../ginkgo/internal/leafnodes/benchmarker.go | 103 - .../ginkgo/internal/leafnodes/interfaces.go | 19 - .../onsi/ginkgo/internal/leafnodes/it_node.go | 47 - .../ginkgo/internal/leafnodes/measure_node.go | 62 - .../onsi/ginkgo/internal/leafnodes/runner.go | 117 - .../ginkgo/internal/leafnodes/setup_nodes.go | 48 - .../ginkgo/internal/leafnodes/suite_nodes.go | 55 - .../synchronized_after_suite_node.go | 90 - .../synchronized_before_suite_node.go | 181 - .../onsi/ginkgo/internal/remote/aggregator.go | 249 - .../internal/remote/forwarding_reporter.go | 147 - .../internal/remote/output_interceptor.go | 13 - .../remote/output_interceptor_unix.go | 82 - .../internal/remote/output_interceptor_win.go | 36 - .../onsi/ginkgo/internal/remote/server.go | 224 - .../onsi/ginkgo/internal/spec/spec.go | 247 - .../onsi/ginkgo/internal/spec/specs.go | 144 - .../internal/spec_iterator/index_computer.go | 55 - .../spec_iterator/parallel_spec_iterator.go | 59 - .../spec_iterator/serial_spec_iterator.go | 45 - .../sharded_parallel_spec_iterator.go | 47 - .../internal/spec_iterator/spec_iterator.go | 20 - .../ginkgo/internal/writer/fake_writer.go | 36 - .../onsi/ginkgo/internal/writer/writer.go | 89 - .../onsi/ginkgo/reporters/default_reporter.go | 87 - .../onsi/ginkgo/reporters/fake_reporter.go | 59 - .../onsi/ginkgo/reporters/junit_reporter.go | 178 - .../onsi/ginkgo/reporters/reporter.go | 15 - .../reporters/stenographer/console_logging.go | 64 - .../stenographer/fake_stenographer.go | 142 - .../reporters/stenographer/stenographer.go | 572 - .../stenographer/support/go-colorable/LICENSE | 21 - .../support/go-colorable/README.md | 43 - .../support/go-colorable/colorable_others.go | 24 - .../support/go-colorable/colorable_windows.go | 783 -- .../support/go-colorable/noncolorable.go | 57 - .../stenographer/support/go-isatty/LICENSE | 9 - .../stenographer/support/go-isatty/README.md | 37 - .../stenographer/support/go-isatty/doc.go | 2 - .../support/go-isatty/isatty_appengine.go | 9 - .../support/go-isatty/isatty_bsd.go | 18 - .../support/go-isatty/isatty_linux.go | 18 - .../support/go-isatty/isatty_solaris.go | 16 - .../support/go-isatty/isatty_windows.go | 19 - .../ginkgo/reporters/teamcity_reporter.go | 106 - .../onsi/ginkgo/types/code_location.go | 15 - .../onsi/ginkgo/types/deprecation_support.go | 160 - .../onsi/ginkgo/types/synchronization.go | 30 - vendor/github.com/onsi/ginkgo/types/types.go | 174 - .../opencontainers/runtime-spec/LICENSE | 191 - .../runtime-spec/specs-go/config.go | 689 - .../runtime-spec/specs-go/state.go | 17 - .../runtime-spec/specs-go/version.go | 18 - vendor/github.com/pbnjay/memory/LICENSE | 29 - vendor/github.com/pbnjay/memory/README.md | 41 - vendor/github.com/pbnjay/memory/doc.go | 24 - vendor/github.com/pbnjay/memory/go.mod | 3 - vendor/github.com/pbnjay/memory/memory_bsd.go | 19 - .../github.com/pbnjay/memory/memory_darwin.go | 49 - .../github.com/pbnjay/memory/memory_linux.go | 29 - .../pbnjay/memory/memory_windows.go | 60 - vendor/github.com/pbnjay/memory/memsysctl.go | 21 - vendor/github.com/pbnjay/memory/stub.go | 10 - vendor/github.com/pkg/errors/.gitignore | 24 - vendor/github.com/pkg/errors/.travis.yml | 10 - vendor/github.com/pkg/errors/LICENSE | 23 - vendor/github.com/pkg/errors/Makefile | 44 - vendor/github.com/pkg/errors/README.md | 59 - vendor/github.com/pkg/errors/appveyor.yml | 32 - vendor/github.com/pkg/errors/errors.go | 288 - vendor/github.com/pkg/errors/go113.go | 38 - vendor/github.com/pkg/errors/stack.go | 177 - vendor/github.com/raulk/clock/LICENSE | 21 - vendor/github.com/raulk/clock/README.md | 104 - vendor/github.com/raulk/clock/clock.go | 344 - vendor/github.com/raulk/clock/go.mod | 3 - .../raulk/go-watchdog/.dockerignore | 1 - .../raulk/go-watchdog/Dockerfile.dlv | 22 - .../raulk/go-watchdog/Dockerfile.test | 10 - .../raulk/go-watchdog/LICENSE-APACHE | 5 - vendor/github.com/raulk/go-watchdog/Makefile | 36 - vendor/github.com/raulk/go-watchdog/README.md | 88 - .../github.com/raulk/go-watchdog/adaptive.go | 31 - vendor/github.com/raulk/go-watchdog/doc.go | 40 - vendor/github.com/raulk/go-watchdog/go.mod | 13 - vendor/github.com/raulk/go-watchdog/go.sum | 57 - vendor/github.com/raulk/go-watchdog/log.go | 38 - .../raulk/go-watchdog/notification.go | 80 - .../github.com/raulk/go-watchdog/watchdog.go | 517 - .../raulk/go-watchdog/watchdog_linux.go | 73 - .../raulk/go-watchdog/watchdog_other.go | 13 - .../raulk/go-watchdog/watermarks.go | 42 - .../go-smux-multiplex}/.gitignore | 0 .../go-smux-multiplex}/LICENSE | 0 .../go-smux-multiplex}/Makefile | 0 .../go-smux-multiplex}/README.md | 6 +- .../go-smux-multiplex/multiplex.go | 41 + .../go-smux-multiplex/package.json | 30 + .../go-smux-multistream/.gitignore | 1 + .../whyrusleeping/go-smux-multistream/LICENSE | 21 + .../go-smux-multistream/Makefile | 19 + .../go-smux-multistream}/README.md | 4 +- .../go-smux-multistream}/multistream.go | 15 +- .../go-smux-multistream/package.json | 30 + .../whyrusleeping/go-smux-yamux/.gitignore | 1 + .../whyrusleeping/go-smux-yamux/LICENSE | 21 + .../whyrusleeping/go-smux-yamux/Makefile | 19 + .../whyrusleeping/go-smux-yamux/README.md | 13 + .../whyrusleeping/go-smux-yamux/package.json | 30 + .../whyrusleeping/go-smux-yamux/yamux.go | 75 + .../v3 => whyrusleeping/yamux}/.gitignore | 0 .../v3 => whyrusleeping/yamux}/LICENSE | 0 .../v3 => whyrusleeping/yamux}/LICENSE-BSD | 0 .../v3 => whyrusleeping/yamux}/README.md | 5 +- .../v3 => whyrusleeping/yamux}/addr.go | 2 +- .../v3 => whyrusleeping/yamux}/const.go | 42 +- .../v3 => whyrusleeping/yamux}/deadline.go | 0 vendor/github.com/whyrusleeping/yamux/go.mod | 5 + vendor/github.com/whyrusleeping/yamux/go.sum | 2 + .../v3 => whyrusleeping/yamux}/mux.go | 52 +- .../whyrusleeping/yamux/package.json | 24 + .../v3 => whyrusleeping/yamux}/session.go | 431 +- .../v3 => whyrusleeping/yamux}/spec.md | 0 .../v3 => whyrusleeping/yamux}/stream.go | 375 +- vendor/github.com/whyrusleeping/yamux/util.go | 36 + vendor/golang.org/x/crypto/hkdf/hkdf.go | 93 - .../x/mod/internal/lazyregexp/lazyre.go | 78 - vendor/golang.org/x/mod/module/module.go | 844 -- vendor/golang.org/x/mod/module/pseudo.go | 250 - .../x/tools/go/ast/astutil/enclosing.go | 639 - .../x/tools/go/ast/astutil/imports.go | 482 - .../x/tools/go/ast/astutil/rewrite.go | 483 - .../golang.org/x/tools/go/ast/astutil/util.go | 18 - .../x/tools/go/ast/inspector/inspector.go | 186 - .../x/tools/go/ast/inspector/typeof.go | 227 - vendor/golang.org/x/tools/imports/forward.go | 77 - .../x/tools/internal/fastwalk/fastwalk.go | 196 - .../fastwalk/fastwalk_dirent_fileno.go | 14 - .../internal/fastwalk/fastwalk_dirent_ino.go | 15 - .../fastwalk/fastwalk_dirent_namlen_bsd.go | 14 - .../fastwalk/fastwalk_dirent_namlen_linux.go | 29 - .../internal/fastwalk/fastwalk_portable.go | 38 - .../tools/internal/fastwalk/fastwalk_unix.go | 153 - .../x/tools/internal/gopathwalk/walk.go | 264 - .../x/tools/internal/imports/fix.go | 1730 --- .../x/tools/internal/imports/imports.go | 346 - .../x/tools/internal/imports/mod.go | 695 - .../x/tools/internal/imports/mod_cache.go | 236 - .../x/tools/internal/imports/sortimports.go | 291 - .../x/tools/internal/imports/zstdlib.go | 10756 ---------------- vendor/gopkg.in/tomb.v1/LICENSE | 29 - vendor/gopkg.in/tomb.v1/README.md | 4 - vendor/gopkg.in/tomb.v1/tomb.go | 176 - vendor/modules.txt | 220 +- 1070 files changed, 10134 insertions(+), 183723 deletions(-) delete mode 100644 vendor/github.com/benbjohnson/clock/LICENSE delete mode 100644 vendor/github.com/benbjohnson/clock/README.md delete mode 100644 vendor/github.com/benbjohnson/clock/clock.go delete mode 100644 vendor/github.com/benbjohnson/clock/context.go delete mode 100644 vendor/github.com/benbjohnson/clock/go.mod delete mode 100644 vendor/github.com/cheekybits/genny/.gitignore delete mode 100644 vendor/github.com/cheekybits/genny/.travis.yml delete mode 100644 vendor/github.com/cheekybits/genny/LICENSE delete mode 100644 vendor/github.com/cheekybits/genny/README.md delete mode 100644 vendor/github.com/cheekybits/genny/doc.go delete mode 100644 vendor/github.com/cheekybits/genny/generic/doc.go delete mode 100644 vendor/github.com/cheekybits/genny/generic/generic.go delete mode 100644 vendor/github.com/cheekybits/genny/main.go delete mode 100644 vendor/github.com/cheekybits/genny/out/lazy_file.go delete mode 100644 vendor/github.com/cheekybits/genny/parse/builtins.go delete mode 100644 vendor/github.com/cheekybits/genny/parse/doc.go delete mode 100644 vendor/github.com/cheekybits/genny/parse/errors.go delete mode 100644 vendor/github.com/cheekybits/genny/parse/parse.go delete mode 100644 vendor/github.com/cheekybits/genny/parse/typesets.go delete mode 100644 vendor/github.com/containerd/cgroups/.gitignore delete mode 100644 vendor/github.com/containerd/cgroups/Makefile delete mode 100644 vendor/github.com/containerd/cgroups/Protobuild.toml delete mode 100644 vendor/github.com/containerd/cgroups/README.md delete mode 100644 vendor/github.com/containerd/cgroups/Vagrantfile delete mode 100644 vendor/github.com/containerd/cgroups/blkio.go delete mode 100644 vendor/github.com/containerd/cgroups/cgroup.go delete mode 100644 vendor/github.com/containerd/cgroups/control.go delete mode 100644 vendor/github.com/containerd/cgroups/cpu.go delete mode 100644 vendor/github.com/containerd/cgroups/cpuacct.go delete mode 100644 vendor/github.com/containerd/cgroups/cpuset.go delete mode 100644 vendor/github.com/containerd/cgroups/devices.go delete mode 100644 vendor/github.com/containerd/cgroups/errors.go delete mode 100644 vendor/github.com/containerd/cgroups/freezer.go delete mode 100644 vendor/github.com/containerd/cgroups/go.mod delete mode 100644 vendor/github.com/containerd/cgroups/go.sum delete mode 100644 vendor/github.com/containerd/cgroups/hierarchy.go delete mode 100644 vendor/github.com/containerd/cgroups/hugetlb.go delete mode 100644 vendor/github.com/containerd/cgroups/memory.go delete mode 100644 vendor/github.com/containerd/cgroups/named.go delete mode 100644 vendor/github.com/containerd/cgroups/net_cls.go delete mode 100644 vendor/github.com/containerd/cgroups/net_prio.go delete mode 100644 vendor/github.com/containerd/cgroups/opts.go delete mode 100644 vendor/github.com/containerd/cgroups/paths.go delete mode 100644 vendor/github.com/containerd/cgroups/perf_event.go delete mode 100644 vendor/github.com/containerd/cgroups/pids.go delete mode 100644 vendor/github.com/containerd/cgroups/rdma.go delete mode 100644 vendor/github.com/containerd/cgroups/state.go delete mode 100644 vendor/github.com/containerd/cgroups/stats/v1/doc.go delete mode 100644 vendor/github.com/containerd/cgroups/stats/v1/metrics.pb.go delete mode 100644 vendor/github.com/containerd/cgroups/stats/v1/metrics.pb.txt delete mode 100644 vendor/github.com/containerd/cgroups/stats/v1/metrics.proto delete mode 100644 vendor/github.com/containerd/cgroups/subsystem.go delete mode 100644 vendor/github.com/containerd/cgroups/systemd.go delete mode 100644 vendor/github.com/containerd/cgroups/ticks.go delete mode 100644 vendor/github.com/containerd/cgroups/utils.go delete mode 100644 vendor/github.com/containerd/cgroups/v1.go rename vendor/github.com/{containerd/cgroups => coreos/go-semver}/LICENSE (99%) rename vendor/github.com/coreos/{go-systemd/v22 => go-semver}/NOTICE (100%) create mode 100644 vendor/github.com/coreos/go-semver/semver/semver.go rename vendor/github.com/coreos/{go-systemd/v22/dbus/set.go => go-semver/semver/sort.go} (52%) delete mode 100644 vendor/github.com/coreos/go-systemd/v22/LICENSE delete mode 100644 vendor/github.com/coreos/go-systemd/v22/dbus/dbus.go delete mode 100644 vendor/github.com/coreos/go-systemd/v22/dbus/methods.go delete mode 100644 vendor/github.com/coreos/go-systemd/v22/dbus/properties.go delete mode 100644 vendor/github.com/coreos/go-systemd/v22/dbus/subscription.go delete mode 100644 vendor/github.com/coreos/go-systemd/v22/dbus/subscription_set.go delete mode 100644 vendor/github.com/docker/go-units/CONTRIBUTING.md delete mode 100644 vendor/github.com/docker/go-units/LICENSE delete mode 100644 vendor/github.com/docker/go-units/MAINTAINERS delete mode 100644 vendor/github.com/docker/go-units/README.md delete mode 100644 vendor/github.com/docker/go-units/circle.yml delete mode 100644 vendor/github.com/docker/go-units/duration.go delete mode 100644 vendor/github.com/docker/go-units/size.go delete mode 100644 vendor/github.com/docker/go-units/ulimit.go delete mode 100644 vendor/github.com/elastic/gosigar/.gitignore delete mode 100644 vendor/github.com/elastic/gosigar/CHANGELOG.md delete mode 100644 vendor/github.com/elastic/gosigar/LICENSE delete mode 100644 vendor/github.com/elastic/gosigar/NOTICE delete mode 100644 vendor/github.com/elastic/gosigar/README.md delete mode 100644 vendor/github.com/elastic/gosigar/Vagrantfile delete mode 100644 vendor/github.com/elastic/gosigar/codecov.yml delete mode 100644 vendor/github.com/elastic/gosigar/concrete_sigar.go delete mode 100644 vendor/github.com/elastic/gosigar/go.mod delete mode 100644 vendor/github.com/elastic/gosigar/go.sum delete mode 100644 vendor/github.com/elastic/gosigar/sigar_aix.go delete mode 100644 vendor/github.com/elastic/gosigar/sigar_common_darwin.go delete mode 100644 vendor/github.com/elastic/gosigar/sigar_darwin.go delete mode 100644 vendor/github.com/elastic/gosigar/sigar_darwin_386.go delete mode 100644 vendor/github.com/elastic/gosigar/sigar_format.go delete mode 100644 vendor/github.com/elastic/gosigar/sigar_freebsd.go delete mode 100644 vendor/github.com/elastic/gosigar/sigar_interface.go delete mode 100644 vendor/github.com/elastic/gosigar/sigar_linux.go delete mode 100644 vendor/github.com/elastic/gosigar/sigar_linux_common.go delete mode 100644 vendor/github.com/elastic/gosigar/sigar_openbsd.go delete mode 100644 vendor/github.com/elastic/gosigar/sigar_stub.go delete mode 100644 vendor/github.com/elastic/gosigar/sigar_unix.go delete mode 100644 vendor/github.com/elastic/gosigar/sigar_util.go delete mode 100644 vendor/github.com/elastic/gosigar/sigar_windows.go delete mode 100644 vendor/github.com/elastic/gosigar/sys/windows/doc.go delete mode 100644 vendor/github.com/elastic/gosigar/sys/windows/ntquery.go delete mode 100644 vendor/github.com/elastic/gosigar/sys/windows/privileges.go delete mode 100644 vendor/github.com/elastic/gosigar/sys/windows/syscall_windows.go delete mode 100644 vendor/github.com/elastic/gosigar/sys/windows/version.go delete mode 100644 vendor/github.com/elastic/gosigar/sys/windows/zsyscall_windows.go delete mode 100644 vendor/github.com/francoispqt/gojay/.gitignore delete mode 100644 vendor/github.com/francoispqt/gojay/.travis.yml delete mode 100644 vendor/github.com/francoispqt/gojay/Gopkg.lock delete mode 100644 vendor/github.com/francoispqt/gojay/Gopkg.toml delete mode 100644 vendor/github.com/francoispqt/gojay/LICENSE delete mode 100644 vendor/github.com/francoispqt/gojay/Makefile delete mode 100644 vendor/github.com/francoispqt/gojay/README.md delete mode 100644 vendor/github.com/francoispqt/gojay/decode.go delete mode 100644 vendor/github.com/francoispqt/gojay/decode_array.go delete mode 100644 vendor/github.com/francoispqt/gojay/decode_bool.go delete mode 100644 vendor/github.com/francoispqt/gojay/decode_embedded_json.go delete mode 100644 vendor/github.com/francoispqt/gojay/decode_interface.go delete mode 100644 vendor/github.com/francoispqt/gojay/decode_number.go delete mode 100644 vendor/github.com/francoispqt/gojay/decode_number_float.go delete mode 100644 vendor/github.com/francoispqt/gojay/decode_number_int.go delete mode 100644 vendor/github.com/francoispqt/gojay/decode_number_uint.go delete mode 100644 vendor/github.com/francoispqt/gojay/decode_object.go delete mode 100644 vendor/github.com/francoispqt/gojay/decode_pool.go delete mode 100644 vendor/github.com/francoispqt/gojay/decode_slice.go delete mode 100644 vendor/github.com/francoispqt/gojay/decode_sqlnull.go delete mode 100644 vendor/github.com/francoispqt/gojay/decode_stream.go delete mode 100644 vendor/github.com/francoispqt/gojay/decode_stream_pool.go delete mode 100644 vendor/github.com/francoispqt/gojay/decode_string.go delete mode 100644 vendor/github.com/francoispqt/gojay/decode_string_unicode.go delete mode 100644 vendor/github.com/francoispqt/gojay/decode_time.go delete mode 100644 vendor/github.com/francoispqt/gojay/decode_unsafe.go delete mode 100644 vendor/github.com/francoispqt/gojay/encode.go delete mode 100644 vendor/github.com/francoispqt/gojay/encode_array.go delete mode 100644 vendor/github.com/francoispqt/gojay/encode_bool.go delete mode 100644 vendor/github.com/francoispqt/gojay/encode_builder.go delete mode 100644 vendor/github.com/francoispqt/gojay/encode_embedded_json.go delete mode 100644 vendor/github.com/francoispqt/gojay/encode_interface.go delete mode 100644 vendor/github.com/francoispqt/gojay/encode_null.go delete mode 100644 vendor/github.com/francoispqt/gojay/encode_number.go delete mode 100644 vendor/github.com/francoispqt/gojay/encode_number_float.go delete mode 100644 vendor/github.com/francoispqt/gojay/encode_number_int.go delete mode 100644 vendor/github.com/francoispqt/gojay/encode_number_uint.go delete mode 100644 vendor/github.com/francoispqt/gojay/encode_object.go delete mode 100644 vendor/github.com/francoispqt/gojay/encode_pool.go delete mode 100644 vendor/github.com/francoispqt/gojay/encode_slice.go delete mode 100644 vendor/github.com/francoispqt/gojay/encode_sqlnull.go delete mode 100644 vendor/github.com/francoispqt/gojay/encode_stream.go delete mode 100644 vendor/github.com/francoispqt/gojay/encode_stream_pool.go delete mode 100644 vendor/github.com/francoispqt/gojay/encode_string.go delete mode 100644 vendor/github.com/francoispqt/gojay/encode_time.go delete mode 100644 vendor/github.com/francoispqt/gojay/errors.go delete mode 100644 vendor/github.com/francoispqt/gojay/go.mod delete mode 100644 vendor/github.com/francoispqt/gojay/go.sum delete mode 100644 vendor/github.com/francoispqt/gojay/gojay.go delete mode 100644 vendor/github.com/francoispqt/gojay/gojay.png delete mode 100644 vendor/github.com/fsnotify/fsnotify/.editorconfig delete mode 100644 vendor/github.com/fsnotify/fsnotify/.gitattributes delete mode 100644 vendor/github.com/fsnotify/fsnotify/.gitignore delete mode 100644 vendor/github.com/fsnotify/fsnotify/.mailmap delete mode 100644 vendor/github.com/fsnotify/fsnotify/AUTHORS delete mode 100644 vendor/github.com/fsnotify/fsnotify/CHANGELOG.md delete mode 100644 vendor/github.com/fsnotify/fsnotify/CONTRIBUTING.md delete mode 100644 vendor/github.com/fsnotify/fsnotify/LICENSE delete mode 100644 vendor/github.com/fsnotify/fsnotify/README.md delete mode 100644 vendor/github.com/fsnotify/fsnotify/fen.go delete mode 100644 vendor/github.com/fsnotify/fsnotify/fsnotify.go delete mode 100644 vendor/github.com/fsnotify/fsnotify/go.mod delete mode 100644 vendor/github.com/fsnotify/fsnotify/go.sum delete mode 100644 vendor/github.com/fsnotify/fsnotify/inotify.go delete mode 100644 vendor/github.com/fsnotify/fsnotify/inotify_poller.go delete mode 100644 vendor/github.com/fsnotify/fsnotify/kqueue.go delete mode 100644 vendor/github.com/fsnotify/fsnotify/open_mode_bsd.go delete mode 100644 vendor/github.com/fsnotify/fsnotify/open_mode_darwin.go delete mode 100644 vendor/github.com/fsnotify/fsnotify/windows.go delete mode 100644 vendor/github.com/go-task/slim-sprig/.editorconfig delete mode 100644 vendor/github.com/go-task/slim-sprig/.gitattributes delete mode 100644 vendor/github.com/go-task/slim-sprig/.gitignore delete mode 100644 vendor/github.com/go-task/slim-sprig/CHANGELOG.md delete mode 100644 vendor/github.com/go-task/slim-sprig/README.md delete mode 100644 vendor/github.com/go-task/slim-sprig/Taskfile.yml delete mode 100644 vendor/github.com/go-task/slim-sprig/crypto.go delete mode 100644 vendor/github.com/go-task/slim-sprig/date.go delete mode 100644 vendor/github.com/go-task/slim-sprig/defaults.go delete mode 100644 vendor/github.com/go-task/slim-sprig/dict.go delete mode 100644 vendor/github.com/go-task/slim-sprig/doc.go delete mode 100644 vendor/github.com/go-task/slim-sprig/functions.go delete mode 100644 vendor/github.com/go-task/slim-sprig/go.mod delete mode 100644 vendor/github.com/go-task/slim-sprig/go.sum delete mode 100644 vendor/github.com/go-task/slim-sprig/list.go delete mode 100644 vendor/github.com/go-task/slim-sprig/network.go delete mode 100644 vendor/github.com/go-task/slim-sprig/numeric.go delete mode 100644 vendor/github.com/go-task/slim-sprig/reflect.go delete mode 100644 vendor/github.com/go-task/slim-sprig/regex.go delete mode 100644 vendor/github.com/go-task/slim-sprig/strings.go delete mode 100644 vendor/github.com/go-task/slim-sprig/url.go delete mode 100644 vendor/github.com/godbus/dbus/v5/CONTRIBUTING.md delete mode 100644 vendor/github.com/godbus/dbus/v5/LICENSE delete mode 100644 vendor/github.com/godbus/dbus/v5/MAINTAINERS delete mode 100644 vendor/github.com/godbus/dbus/v5/README.md delete mode 100644 vendor/github.com/godbus/dbus/v5/auth.go delete mode 100644 vendor/github.com/godbus/dbus/v5/auth_anonymous.go delete mode 100644 vendor/github.com/godbus/dbus/v5/auth_external.go delete mode 100644 vendor/github.com/godbus/dbus/v5/auth_sha1.go delete mode 100644 vendor/github.com/godbus/dbus/v5/call.go delete mode 100644 vendor/github.com/godbus/dbus/v5/conn.go delete mode 100644 vendor/github.com/godbus/dbus/v5/conn_darwin.go delete mode 100644 vendor/github.com/godbus/dbus/v5/conn_other.go delete mode 100644 vendor/github.com/godbus/dbus/v5/conn_unix.go delete mode 100644 vendor/github.com/godbus/dbus/v5/conn_windows.go delete mode 100644 vendor/github.com/godbus/dbus/v5/dbus.go delete mode 100644 vendor/github.com/godbus/dbus/v5/decoder.go delete mode 100644 vendor/github.com/godbus/dbus/v5/default_handler.go delete mode 100644 vendor/github.com/godbus/dbus/v5/doc.go delete mode 100644 vendor/github.com/godbus/dbus/v5/encoder.go delete mode 100644 vendor/github.com/godbus/dbus/v5/export.go delete mode 100644 vendor/github.com/godbus/dbus/v5/go.mod delete mode 100644 vendor/github.com/godbus/dbus/v5/go.sum delete mode 100644 vendor/github.com/godbus/dbus/v5/homedir.go delete mode 100644 vendor/github.com/godbus/dbus/v5/homedir_dynamic.go delete mode 100644 vendor/github.com/godbus/dbus/v5/homedir_static.go delete mode 100644 vendor/github.com/godbus/dbus/v5/match.go delete mode 100644 vendor/github.com/godbus/dbus/v5/message.go delete mode 100644 vendor/github.com/godbus/dbus/v5/object.go delete mode 100644 vendor/github.com/godbus/dbus/v5/sequence.go delete mode 100644 vendor/github.com/godbus/dbus/v5/sequential_handler.go delete mode 100644 vendor/github.com/godbus/dbus/v5/server_interfaces.go delete mode 100644 vendor/github.com/godbus/dbus/v5/sig.go delete mode 100644 vendor/github.com/godbus/dbus/v5/transport_darwin.go delete mode 100644 vendor/github.com/godbus/dbus/v5/transport_generic.go delete mode 100644 vendor/github.com/godbus/dbus/v5/transport_nonce_tcp.go delete mode 100644 vendor/github.com/godbus/dbus/v5/transport_tcp.go delete mode 100644 vendor/github.com/godbus/dbus/v5/transport_unix.go delete mode 100644 vendor/github.com/godbus/dbus/v5/transport_unixcred_dragonfly.go delete mode 100644 vendor/github.com/godbus/dbus/v5/transport_unixcred_freebsd.go delete mode 100644 vendor/github.com/godbus/dbus/v5/transport_unixcred_linux.go delete mode 100644 vendor/github.com/godbus/dbus/v5/transport_unixcred_netbsd.go delete mode 100644 vendor/github.com/godbus/dbus/v5/transport_unixcred_openbsd.go delete mode 100644 vendor/github.com/godbus/dbus/v5/variant.go delete mode 100644 vendor/github.com/godbus/dbus/v5/variant_lexer.go delete mode 100644 vendor/github.com/godbus/dbus/v5/variant_parser.go delete mode 100644 vendor/github.com/gogo/protobuf/gogoproto/Makefile delete mode 100644 vendor/github.com/gogo/protobuf/gogoproto/doc.go delete mode 100644 vendor/github.com/gogo/protobuf/gogoproto/gogo.pb.go delete mode 100644 vendor/github.com/gogo/protobuf/gogoproto/gogo.pb.golden delete mode 100644 vendor/github.com/gogo/protobuf/gogoproto/gogo.proto delete mode 100644 vendor/github.com/gogo/protobuf/gogoproto/helper.go create mode 100644 vendor/github.com/gogo/protobuf/io/full.go create mode 100644 vendor/github.com/gogo/protobuf/io/io.go create mode 100644 vendor/github.com/gogo/protobuf/io/uint32.go create mode 100644 vendor/github.com/gogo/protobuf/io/varint.go delete mode 100644 vendor/github.com/gogo/protobuf/protoc-gen-gogo/descriptor/Makefile delete mode 100644 vendor/github.com/gogo/protobuf/protoc-gen-gogo/descriptor/descriptor.go delete mode 100644 vendor/github.com/gogo/protobuf/protoc-gen-gogo/descriptor/descriptor.pb.go delete mode 100644 vendor/github.com/gogo/protobuf/protoc-gen-gogo/descriptor/descriptor_gostring.gen.go delete mode 100644 vendor/github.com/gogo/protobuf/protoc-gen-gogo/descriptor/helper.go create mode 100644 vendor/github.com/jbenet/goprocess/.travis.yml rename vendor/github.com/{libp2p/go-libp2p-mplex => jbenet/goprocess}/LICENSE (100%) create mode 100644 vendor/github.com/jbenet/goprocess/README.md create mode 100644 vendor/github.com/jbenet/goprocess/background.go create mode 100644 vendor/github.com/jbenet/goprocess/context/context.go create mode 100644 vendor/github.com/jbenet/goprocess/context/derive.go create mode 100644 vendor/github.com/jbenet/goprocess/go.mod create mode 100644 vendor/github.com/jbenet/goprocess/go.sum create mode 100644 vendor/github.com/jbenet/goprocess/goprocess.go create mode 100644 vendor/github.com/jbenet/goprocess/impl-mutex.go create mode 100644 vendor/github.com/jbenet/goprocess/link.go create mode 100644 vendor/github.com/jbenet/goprocess/package.json delete mode 100644 vendor/github.com/klauspost/compress/.gitattributes delete mode 100644 vendor/github.com/klauspost/compress/.gitignore delete mode 100644 vendor/github.com/klauspost/compress/.goreleaser.yml delete mode 100644 vendor/github.com/klauspost/compress/README.md delete mode 100644 vendor/github.com/klauspost/compress/compressible.go delete mode 100644 vendor/github.com/klauspost/compress/fse/README.md delete mode 100644 vendor/github.com/klauspost/compress/fse/bitreader.go delete mode 100644 vendor/github.com/klauspost/compress/fse/bitwriter.go delete mode 100644 vendor/github.com/klauspost/compress/fse/bytereader.go delete mode 100644 vendor/github.com/klauspost/compress/fse/compress.go delete mode 100644 vendor/github.com/klauspost/compress/fse/decompress.go delete mode 100644 vendor/github.com/klauspost/compress/fse/fse.go delete mode 100644 vendor/github.com/klauspost/compress/gen.sh delete mode 100644 vendor/github.com/klauspost/compress/go.mod delete mode 100644 vendor/github.com/klauspost/compress/go.sum delete mode 100644 vendor/github.com/klauspost/compress/huff0/.gitignore delete mode 100644 vendor/github.com/klauspost/compress/huff0/README.md delete mode 100644 vendor/github.com/klauspost/compress/huff0/bitreader.go delete mode 100644 vendor/github.com/klauspost/compress/huff0/bitwriter.go delete mode 100644 vendor/github.com/klauspost/compress/huff0/bytereader.go delete mode 100644 vendor/github.com/klauspost/compress/huff0/compress.go delete mode 100644 vendor/github.com/klauspost/compress/huff0/decompress.go delete mode 100644 vendor/github.com/klauspost/compress/huff0/huff0.go delete mode 100644 vendor/github.com/klauspost/compress/internal/snapref/LICENSE delete mode 100644 vendor/github.com/klauspost/compress/internal/snapref/decode.go delete mode 100644 vendor/github.com/klauspost/compress/internal/snapref/decode_other.go delete mode 100644 vendor/github.com/klauspost/compress/internal/snapref/encode.go delete mode 100644 vendor/github.com/klauspost/compress/internal/snapref/encode_other.go delete mode 100644 vendor/github.com/klauspost/compress/internal/snapref/snappy.go delete mode 100644 vendor/github.com/klauspost/compress/s2sx.mod delete mode 100644 vendor/github.com/klauspost/compress/s2sx.sum delete mode 100644 vendor/github.com/klauspost/compress/zstd/README.md delete mode 100644 vendor/github.com/klauspost/compress/zstd/bitreader.go delete mode 100644 vendor/github.com/klauspost/compress/zstd/bitwriter.go delete mode 100644 vendor/github.com/klauspost/compress/zstd/blockdec.go delete mode 100644 vendor/github.com/klauspost/compress/zstd/blockenc.go delete mode 100644 vendor/github.com/klauspost/compress/zstd/blocktype_string.go delete mode 100644 vendor/github.com/klauspost/compress/zstd/bytebuf.go delete mode 100644 vendor/github.com/klauspost/compress/zstd/bytereader.go delete mode 100644 vendor/github.com/klauspost/compress/zstd/decodeheader.go delete mode 100644 vendor/github.com/klauspost/compress/zstd/decoder.go delete mode 100644 vendor/github.com/klauspost/compress/zstd/decoder_options.go delete mode 100644 vendor/github.com/klauspost/compress/zstd/dict.go delete mode 100644 vendor/github.com/klauspost/compress/zstd/enc_base.go delete mode 100644 vendor/github.com/klauspost/compress/zstd/enc_best.go delete mode 100644 vendor/github.com/klauspost/compress/zstd/enc_better.go delete mode 100644 vendor/github.com/klauspost/compress/zstd/enc_dfast.go delete mode 100644 vendor/github.com/klauspost/compress/zstd/enc_fast.go delete mode 100644 vendor/github.com/klauspost/compress/zstd/encoder.go delete mode 100644 vendor/github.com/klauspost/compress/zstd/encoder_options.go delete mode 100644 vendor/github.com/klauspost/compress/zstd/framedec.go delete mode 100644 vendor/github.com/klauspost/compress/zstd/frameenc.go delete mode 100644 vendor/github.com/klauspost/compress/zstd/fse_decoder.go delete mode 100644 vendor/github.com/klauspost/compress/zstd/fse_encoder.go delete mode 100644 vendor/github.com/klauspost/compress/zstd/fse_predefined.go delete mode 100644 vendor/github.com/klauspost/compress/zstd/hash.go delete mode 100644 vendor/github.com/klauspost/compress/zstd/history.go delete mode 100644 vendor/github.com/klauspost/compress/zstd/internal/xxhash/LICENSE.txt delete mode 100644 vendor/github.com/klauspost/compress/zstd/internal/xxhash/README.md delete mode 100644 vendor/github.com/klauspost/compress/zstd/internal/xxhash/xxhash.go delete mode 100644 vendor/github.com/klauspost/compress/zstd/internal/xxhash/xxhash_amd64.s delete mode 100644 vendor/github.com/klauspost/compress/zstd/internal/xxhash/xxhash_arm64.s delete mode 100644 vendor/github.com/klauspost/compress/zstd/internal/xxhash/xxhash_asm.go delete mode 100644 vendor/github.com/klauspost/compress/zstd/internal/xxhash/xxhash_other.go delete mode 100644 vendor/github.com/klauspost/compress/zstd/internal/xxhash/xxhash_safe.go delete mode 100644 vendor/github.com/klauspost/compress/zstd/seqdec.go delete mode 100644 vendor/github.com/klauspost/compress/zstd/seqenc.go delete mode 100644 vendor/github.com/klauspost/compress/zstd/snappy.go delete mode 100644 vendor/github.com/klauspost/compress/zstd/zip.go delete mode 100644 vendor/github.com/klauspost/compress/zstd/zstd.go create mode 100644 vendor/github.com/libp2p/go-conn-security/.travis.yml rename vendor/github.com/{raulk/go-watchdog/LICENSE-MIT => libp2p/go-conn-security/LICENSE} (96%) create mode 100644 vendor/github.com/libp2p/go-conn-security/README.md create mode 100644 vendor/github.com/libp2p/go-conn-security/deprecated.go create mode 100644 vendor/github.com/libp2p/go-conn-security/go.mod create mode 100644 vendor/github.com/libp2p/go-conn-security/go.sum create mode 100644 vendor/github.com/libp2p/go-conn-security/insecure/deprecated.go delete mode 100644 vendor/github.com/libp2p/go-eventbus/LICENSE-APACHE delete mode 100644 vendor/github.com/libp2p/go-eventbus/README.md delete mode 100644 vendor/github.com/libp2p/go-eventbus/basic.go delete mode 100644 vendor/github.com/libp2p/go-eventbus/go.mod delete mode 100644 vendor/github.com/libp2p/go-eventbus/opts.go delete mode 100644 vendor/github.com/libp2p/go-libp2p-blankhost/blank.go delete mode 100644 vendor/github.com/libp2p/go-libp2p-blankhost/go.mod delete mode 100644 vendor/github.com/libp2p/go-libp2p-blankhost/peer_connectedness.go rename vendor/github.com/libp2p/{go-libp2p-quic-transport => go-libp2p-circuit}/LICENSE (96%) create mode 100644 vendor/github.com/libp2p/go-libp2p-circuit/README.md rename vendor/github.com/libp2p/{go-eventbus => go-libp2p-circuit}/codecov.yml (100%) rename vendor/github.com/libp2p/{go-libp2p/p2p/protocol/circuitv2/client => go-libp2p-circuit}/conn.go (61%) create mode 100644 vendor/github.com/libp2p/go-libp2p-circuit/dial.go create mode 100644 vendor/github.com/libp2p/go-libp2p-circuit/go.mod rename vendor/github.com/libp2p/{go-libp2p-blankhost => go-libp2p-circuit}/go.sum (93%) create mode 100644 vendor/github.com/libp2p/go-libp2p-circuit/listen.go rename vendor/github.com/libp2p/{go-libp2p/p2p/protocol/holepunch => go-libp2p-circuit}/pb/Makefile (100%) rename vendor/github.com/libp2p/{go-libp2p/p2p/protocol/circuitv1/pb/circuitv1.pb.go => go-libp2p-circuit/pb/relay.pb.go} (74%) rename vendor/github.com/libp2p/{go-libp2p/p2p/protocol/circuitv1/pb/circuitv1.proto => go-libp2p-circuit/pb/relay.proto} (98%) create mode 100644 vendor/github.com/libp2p/go-libp2p-circuit/relay.go create mode 100644 vendor/github.com/libp2p/go-libp2p-circuit/transport.go rename vendor/github.com/libp2p/{go-libp2p/p2p/protocol/circuitv2/util/io.go => go-libp2p-circuit/util.go} (50%) create mode 100644 vendor/github.com/libp2p/go-libp2p-circuit/version.json create mode 100644 vendor/github.com/libp2p/go-libp2p-core/helpers/match.go create mode 100644 vendor/github.com/libp2p/go-libp2p-crypto/.gitignore create mode 100644 vendor/github.com/libp2p/go-libp2p-crypto/.travis.yml rename vendor/github.com/libp2p/{go-libp2p-blankhost => go-libp2p-crypto}/LICENSE (100%) create mode 100644 vendor/github.com/libp2p/go-libp2p-crypto/README.md rename vendor/github.com/libp2p/{go-libp2p-blankhost => go-libp2p-crypto}/codecov.yml (100%) create mode 100644 vendor/github.com/libp2p/go-libp2p-crypto/ecdsa_deprecated.go create mode 100644 vendor/github.com/libp2p/go-libp2p-crypto/ed25519_deprecated.go create mode 100644 vendor/github.com/libp2p/go-libp2p-crypto/go.mod create mode 100644 vendor/github.com/libp2p/go-libp2p-crypto/go.sum create mode 100644 vendor/github.com/libp2p/go-libp2p-crypto/key_deprecated.go create mode 100644 vendor/github.com/libp2p/go-libp2p-crypto/rsa_deprecated.go create mode 100644 vendor/github.com/libp2p/go-libp2p-crypto/secp256k1_deprecated.go create mode 100644 vendor/github.com/libp2p/go-libp2p-host/.travis.yml rename vendor/github.com/libp2p/{go-eventbus/LICENSE-MIT => go-libp2p-host/LICENSE} (96%) create mode 100644 vendor/github.com/libp2p/go-libp2p-host/README.md create mode 100644 vendor/github.com/libp2p/go-libp2p-host/codecov.yml create mode 100644 vendor/github.com/libp2p/go-libp2p-host/deprecated.go create mode 100644 vendor/github.com/libp2p/go-libp2p-host/go.mod create mode 100644 vendor/github.com/libp2p/go-libp2p-host/go.sum create mode 100644 vendor/github.com/libp2p/go-libp2p-interface-connmgr/.travis.yml rename vendor/github.com/{go-task/slim-sprig/LICENSE.txt => libp2p/go-libp2p-interface-connmgr/LICENSE} (94%) rename vendor/github.com/libp2p/{go-libp2p-blankhost => go-libp2p-interface-connmgr}/README.md (62%) create mode 100644 vendor/github.com/libp2p/go-libp2p-interface-connmgr/codecov.yml create mode 100644 vendor/github.com/libp2p/go-libp2p-interface-connmgr/deprecated.go create mode 100644 vendor/github.com/libp2p/go-libp2p-interface-connmgr/go.mod create mode 100644 vendor/github.com/libp2p/go-libp2p-interface-connmgr/go.sum create mode 100644 vendor/github.com/libp2p/go-libp2p-interface-pnet/.travis.yml rename vendor/github.com/libp2p/{go-libp2p-resource-manager => go-libp2p-interface-pnet}/LICENSE (96%) create mode 100644 vendor/github.com/libp2p/go-libp2p-interface-pnet/README.md create mode 100644 vendor/github.com/libp2p/go-libp2p-interface-pnet/codecov.yml create mode 100644 vendor/github.com/libp2p/go-libp2p-interface-pnet/deprecated.go create mode 100644 vendor/github.com/libp2p/go-libp2p-interface-pnet/go.mod create mode 100644 vendor/github.com/libp2p/go-libp2p-interface-pnet/go.sum create mode 100644 vendor/github.com/libp2p/go-libp2p-loggables/.travis.yml create mode 100644 vendor/github.com/libp2p/go-libp2p-loggables/LICENSE create mode 100644 vendor/github.com/libp2p/go-libp2p-loggables/README.md create mode 100644 vendor/github.com/libp2p/go-libp2p-loggables/codecov.yml create mode 100644 vendor/github.com/libp2p/go-libp2p-loggables/go.mod create mode 100644 vendor/github.com/libp2p/go-libp2p-loggables/go.sum create mode 100644 vendor/github.com/libp2p/go-libp2p-loggables/loggables.go create mode 100644 vendor/github.com/libp2p/go-libp2p-metrics/.travis.yml create mode 100644 vendor/github.com/libp2p/go-libp2p-metrics/LICENSE create mode 100644 vendor/github.com/libp2p/go-libp2p-metrics/README.md create mode 100644 vendor/github.com/libp2p/go-libp2p-metrics/codecov.yml create mode 100644 vendor/github.com/libp2p/go-libp2p-metrics/deprecated.go create mode 100644 vendor/github.com/libp2p/go-libp2p-metrics/go.mod create mode 100644 vendor/github.com/libp2p/go-libp2p-metrics/go.sum delete mode 100644 vendor/github.com/libp2p/go-libp2p-mplex/conn.go delete mode 100644 vendor/github.com/libp2p/go-libp2p-mplex/go.mod delete mode 100644 vendor/github.com/libp2p/go-libp2p-mplex/go.sum delete mode 100644 vendor/github.com/libp2p/go-libp2p-mplex/stream.go delete mode 100644 vendor/github.com/libp2p/go-libp2p-mplex/transport.go delete mode 100644 vendor/github.com/libp2p/go-libp2p-mplex/version.json create mode 100644 vendor/github.com/libp2p/go-libp2p-net/.travis.yml create mode 100644 vendor/github.com/libp2p/go-libp2p-net/LICENSE create mode 100644 vendor/github.com/libp2p/go-libp2p-net/README.md create mode 100644 vendor/github.com/libp2p/go-libp2p-net/codecov.yml create mode 100644 vendor/github.com/libp2p/go-libp2p-net/deprecated.go create mode 100644 vendor/github.com/libp2p/go-libp2p-net/go.mod create mode 100644 vendor/github.com/libp2p/go-libp2p-net/go.sum create mode 100644 vendor/github.com/libp2p/go-libp2p-peer/.travis.yml create mode 100644 vendor/github.com/libp2p/go-libp2p-peer/LICENSE create mode 100644 vendor/github.com/libp2p/go-libp2p-peer/README.md create mode 100644 vendor/github.com/libp2p/go-libp2p-peer/codecov.yml create mode 100644 vendor/github.com/libp2p/go-libp2p-peer/deprecated.go create mode 100644 vendor/github.com/libp2p/go-libp2p-peer/go.mod create mode 100644 vendor/github.com/libp2p/go-libp2p-peer/go.sum create mode 100644 vendor/github.com/libp2p/go-libp2p-protocol/.travis.yml create mode 100644 vendor/github.com/libp2p/go-libp2p-protocol/LICENSE create mode 100644 vendor/github.com/libp2p/go-libp2p-protocol/README.md create mode 100644 vendor/github.com/libp2p/go-libp2p-protocol/codecov.yml create mode 100644 vendor/github.com/libp2p/go-libp2p-protocol/go.mod create mode 100644 vendor/github.com/libp2p/go-libp2p-protocol/go.sum create mode 100644 vendor/github.com/libp2p/go-libp2p-protocol/protocol.go delete mode 100644 vendor/github.com/libp2p/go-libp2p-quic-transport/.gitignore delete mode 100644 vendor/github.com/libp2p/go-libp2p-quic-transport/README.md delete mode 100644 vendor/github.com/libp2p/go-libp2p-quic-transport/conn.go delete mode 100644 vendor/github.com/libp2p/go-libp2p-quic-transport/go.mod delete mode 100644 vendor/github.com/libp2p/go-libp2p-quic-transport/go.sum delete mode 100644 vendor/github.com/libp2p/go-libp2p-quic-transport/listener.go delete mode 100644 vendor/github.com/libp2p/go-libp2p-quic-transport/quic_multiaddr.go delete mode 100644 vendor/github.com/libp2p/go-libp2p-quic-transport/reuse.go delete mode 100644 vendor/github.com/libp2p/go-libp2p-quic-transport/stream.go delete mode 100644 vendor/github.com/libp2p/go-libp2p-quic-transport/tracer.go delete mode 100644 vendor/github.com/libp2p/go-libp2p-quic-transport/tracer_metrics.go delete mode 100644 vendor/github.com/libp2p/go-libp2p-quic-transport/transport.go delete mode 100644 vendor/github.com/libp2p/go-libp2p-quic-transport/version.json delete mode 100644 vendor/github.com/libp2p/go-libp2p-resource-manager/.gitignore delete mode 100644 vendor/github.com/libp2p/go-libp2p-resource-manager/README.md delete mode 100644 vendor/github.com/libp2p/go-libp2p-resource-manager/extapi.go delete mode 100644 vendor/github.com/libp2p/go-libp2p-resource-manager/go.mod delete mode 100644 vendor/github.com/libp2p/go-libp2p-resource-manager/go.sum delete mode 100644 vendor/github.com/libp2p/go-libp2p-resource-manager/limit.go delete mode 100644 vendor/github.com/libp2p/go-libp2p-resource-manager/limit_config.go delete mode 100644 vendor/github.com/libp2p/go-libp2p-resource-manager/limit_config_test.json delete mode 100644 vendor/github.com/libp2p/go-libp2p-resource-manager/limit_defaults.go delete mode 100644 vendor/github.com/libp2p/go-libp2p-resource-manager/limit_dynamic.go delete mode 100644 vendor/github.com/libp2p/go-libp2p-resource-manager/limit_static.go delete mode 100644 vendor/github.com/libp2p/go-libp2p-resource-manager/rcmgr.go delete mode 100644 vendor/github.com/libp2p/go-libp2p-resource-manager/scope.go delete mode 100644 vendor/github.com/libp2p/go-libp2p-resource-manager/trace.go delete mode 100644 vendor/github.com/libp2p/go-libp2p-resource-manager/version.json create mode 100644 vendor/github.com/libp2p/go-libp2p-secio/.travis.yml create mode 100644 vendor/github.com/libp2p/go-libp2p-secio/LICENSE create mode 100644 vendor/github.com/libp2p/go-libp2p-secio/README.md create mode 100644 vendor/github.com/libp2p/go-libp2p-secio/al.go create mode 100644 vendor/github.com/libp2p/go-libp2p-secio/codecov.yml create mode 100644 vendor/github.com/libp2p/go-libp2p-secio/go.mod rename vendor/github.com/libp2p/{go-eventbus => go-libp2p-secio}/go.sum (67%) rename vendor/github.com/libp2p/{go-libp2p/p2p/protocol/circuitv1 => go-libp2p-secio}/pb/Makefile (66%) create mode 100644 vendor/github.com/libp2p/go-libp2p-secio/pb/spipe.pb.go create mode 100644 vendor/github.com/libp2p/go-libp2p-secio/pb/spipe.proto create mode 100644 vendor/github.com/libp2p/go-libp2p-secio/protocol.go create mode 100644 vendor/github.com/libp2p/go-libp2p-secio/rw.go create mode 100644 vendor/github.com/libp2p/go-libp2p-secio/transport.go delete mode 100644 vendor/github.com/libp2p/go-libp2p-tls/LICENSE.md delete mode 100644 vendor/github.com/libp2p/go-libp2p-tls/README.md delete mode 100644 vendor/github.com/libp2p/go-libp2p-tls/codecov.yml delete mode 100644 vendor/github.com/libp2p/go-libp2p-tls/conn.go delete mode 100644 vendor/github.com/libp2p/go-libp2p-tls/crypto.go delete mode 100644 vendor/github.com/libp2p/go-libp2p-tls/extension.go delete mode 100644 vendor/github.com/libp2p/go-libp2p-tls/go.mod delete mode 100644 vendor/github.com/libp2p/go-libp2p-tls/go.sum delete mode 100644 vendor/github.com/libp2p/go-libp2p-tls/transport.go delete mode 100644 vendor/github.com/libp2p/go-libp2p-tls/version.json rename vendor/github.com/libp2p/{go-libp2p-mplex => go-libp2p-transport}/.gitignore (100%) create mode 100644 vendor/github.com/libp2p/go-libp2p-transport/.travis.yml create mode 100644 vendor/github.com/libp2p/go-libp2p-transport/LICENSE create mode 100644 vendor/github.com/libp2p/go-libp2p-transport/README.md create mode 100644 vendor/github.com/libp2p/go-libp2p-transport/codecov.yml create mode 100644 vendor/github.com/libp2p/go-libp2p-transport/deprecated.go create mode 100644 vendor/github.com/libp2p/go-libp2p-transport/go.mod create mode 100644 vendor/github.com/libp2p/go-libp2p-transport/go.sum delete mode 100644 vendor/github.com/libp2p/go-libp2p-yamux/README.md delete mode 100644 vendor/github.com/libp2p/go-libp2p-yamux/conn.go delete mode 100644 vendor/github.com/libp2p/go-libp2p-yamux/go.mod delete mode 100644 vendor/github.com/libp2p/go-libp2p-yamux/go.sum delete mode 100644 vendor/github.com/libp2p/go-libp2p-yamux/stream.go delete mode 100644 vendor/github.com/libp2p/go-libp2p-yamux/transport.go delete mode 100644 vendor/github.com/libp2p/go-libp2p-yamux/version.json delete mode 100644 vendor/github.com/libp2p/go-libp2p/.codecov.yml create mode 100644 vendor/github.com/libp2p/go-libp2p/.travis.yml create mode 100644 vendor/github.com/libp2p/go-libp2p/Makefile create mode 100644 vendor/github.com/libp2p/go-libp2p/NEWS.md create mode 100644 vendor/github.com/libp2p/go-libp2p/codecov.yml delete mode 100644 vendor/github.com/libp2p/go-libp2p/go.mod delete mode 100644 vendor/github.com/libp2p/go-libp2p/go.sum delete mode 100644 vendor/github.com/libp2p/go-libp2p/limits.go delete mode 100644 vendor/github.com/libp2p/go-libp2p/options_filter.go delete mode 100644 vendor/github.com/libp2p/go-libp2p/p2p/discovery/routing/routing.go delete mode 100644 vendor/github.com/libp2p/go-libp2p/p2p/host/autonat/autonat.go delete mode 100644 vendor/github.com/libp2p/go-libp2p/p2p/host/autonat/client.go delete mode 100644 vendor/github.com/libp2p/go-libp2p/p2p/host/autonat/dialpolicy.go delete mode 100644 vendor/github.com/libp2p/go-libp2p/p2p/host/autonat/interface.go delete mode 100644 vendor/github.com/libp2p/go-libp2p/p2p/host/autonat/notify.go delete mode 100644 vendor/github.com/libp2p/go-libp2p/p2p/host/autonat/options.go delete mode 100644 vendor/github.com/libp2p/go-libp2p/p2p/host/autonat/pb/Makefile delete mode 100644 vendor/github.com/libp2p/go-libp2p/p2p/host/autonat/pb/autonat.pb.go delete mode 100644 vendor/github.com/libp2p/go-libp2p/p2p/host/autonat/pb/autonat.proto delete mode 100644 vendor/github.com/libp2p/go-libp2p/p2p/host/autonat/proto.go delete mode 100644 vendor/github.com/libp2p/go-libp2p/p2p/host/autonat/svc.go delete mode 100644 vendor/github.com/libp2p/go-libp2p/p2p/host/autorelay/addrsplosion.go delete mode 100644 vendor/github.com/libp2p/go-libp2p/p2p/host/autorelay/autorelay.go delete mode 100644 vendor/github.com/libp2p/go-libp2p/p2p/host/autorelay/doc.go delete mode 100644 vendor/github.com/libp2p/go-libp2p/p2p/host/autorelay/host.go delete mode 100644 vendor/github.com/libp2p/go-libp2p/p2p/host/autorelay/log.go delete mode 100644 vendor/github.com/libp2p/go-libp2p/p2p/host/autorelay/relay.go delete mode 100644 vendor/github.com/libp2p/go-libp2p/p2p/host/basic/peer_connectedness.go delete mode 100644 vendor/github.com/libp2p/go-libp2p/p2p/host/pstoremanager/pstoremanager.go delete mode 100644 vendor/github.com/libp2p/go-libp2p/p2p/host/relaysvc/relay.go delete mode 100644 vendor/github.com/libp2p/go-libp2p/p2p/host/routed/routed.go delete mode 100644 vendor/github.com/libp2p/go-libp2p/p2p/net/connmgr/connmgr.go delete mode 100644 vendor/github.com/libp2p/go-libp2p/p2p/net/connmgr/decay.go delete mode 100644 vendor/github.com/libp2p/go-libp2p/p2p/net/connmgr/options.go delete mode 100644 vendor/github.com/libp2p/go-libp2p/p2p/net/connmgr/watchdog_cgo.go delete mode 100644 vendor/github.com/libp2p/go-libp2p/p2p/net/connmgr/watchdog_no_cgo.go delete mode 100644 vendor/github.com/libp2p/go-libp2p/p2p/protocol/circuitv1/relay/options.go delete mode 100644 vendor/github.com/libp2p/go-libp2p/p2p/protocol/circuitv1/relay/relay.go delete mode 100644 vendor/github.com/libp2p/go-libp2p/p2p/protocol/circuitv2/client/client.go delete mode 100644 vendor/github.com/libp2p/go-libp2p/p2p/protocol/circuitv2/client/dial.go delete mode 100644 vendor/github.com/libp2p/go-libp2p/p2p/protocol/circuitv2/client/handlers.go delete mode 100644 vendor/github.com/libp2p/go-libp2p/p2p/protocol/circuitv2/client/listen.go delete mode 100644 vendor/github.com/libp2p/go-libp2p/p2p/protocol/circuitv2/client/reservation.go delete mode 100644 vendor/github.com/libp2p/go-libp2p/p2p/protocol/circuitv2/client/transport.go delete mode 100644 vendor/github.com/libp2p/go-libp2p/p2p/protocol/circuitv2/pb/Makefile delete mode 100644 vendor/github.com/libp2p/go-libp2p/p2p/protocol/circuitv2/pb/circuit.pb.go delete mode 100644 vendor/github.com/libp2p/go-libp2p/p2p/protocol/circuitv2/pb/circuit.proto delete mode 100644 vendor/github.com/libp2p/go-libp2p/p2p/protocol/circuitv2/pb/voucher.pb.go delete mode 100644 vendor/github.com/libp2p/go-libp2p/p2p/protocol/circuitv2/pb/voucher.proto delete mode 100644 vendor/github.com/libp2p/go-libp2p/p2p/protocol/circuitv2/proto/protocol.go delete mode 100644 vendor/github.com/libp2p/go-libp2p/p2p/protocol/circuitv2/proto/voucher.go delete mode 100644 vendor/github.com/libp2p/go-libp2p/p2p/protocol/circuitv2/relay/acl.go delete mode 100644 vendor/github.com/libp2p/go-libp2p/p2p/protocol/circuitv2/relay/constraints.go delete mode 100644 vendor/github.com/libp2p/go-libp2p/p2p/protocol/circuitv2/relay/options.go delete mode 100644 vendor/github.com/libp2p/go-libp2p/p2p/protocol/circuitv2/relay/relay.go delete mode 100644 vendor/github.com/libp2p/go-libp2p/p2p/protocol/circuitv2/relay/resources.go delete mode 100644 vendor/github.com/libp2p/go-libp2p/p2p/protocol/circuitv2/util/pbconv.go delete mode 100644 vendor/github.com/libp2p/go-libp2p/p2p/protocol/holepunch/coordination.go delete mode 100644 vendor/github.com/libp2p/go-libp2p/p2p/protocol/holepunch/pb/holepunch.pb.go delete mode 100644 vendor/github.com/libp2p/go-libp2p/p2p/protocol/holepunch/pb/holepunch.proto delete mode 100644 vendor/github.com/libp2p/go-libp2p/p2p/protocol/holepunch/tracer.go delete mode 100644 vendor/github.com/libp2p/go-libp2p/p2p/protocol/identify/id_delta.go delete mode 100644 vendor/github.com/libp2p/go-libp2p/p2p/protocol/identify/id_push.go delete mode 100644 vendor/github.com/libp2p/go-libp2p/p2p/protocol/identify/opts.go delete mode 100644 vendor/github.com/libp2p/go-libp2p/p2p/protocol/identify/peer_loop.go create mode 100644 vendor/github.com/libp2p/go-libp2p/package.json delete mode 100644 vendor/github.com/libp2p/go-libp2p/version.json rename vendor/github.com/libp2p/{go-eventbus => go-maddr-filter}/.travis.yml (100%) create mode 100644 vendor/github.com/libp2p/go-maddr-filter/LICENSE create mode 100644 vendor/github.com/libp2p/go-maddr-filter/README.md create mode 100644 vendor/github.com/libp2p/go-maddr-filter/codecov.yml create mode 100644 vendor/github.com/libp2p/go-maddr-filter/filter.go create mode 100644 vendor/github.com/libp2p/go-maddr-filter/go.mod create mode 100644 vendor/github.com/libp2p/go-maddr-filter/go.sum delete mode 100644 vendor/github.com/libp2p/go-stream-muxer-multistream/go.mod delete mode 100644 vendor/github.com/libp2p/go-stream-muxer-multistream/go.sum delete mode 100644 vendor/github.com/libp2p/go-stream-muxer-multistream/version.json rename vendor/github.com/libp2p/{go-libp2p-yamux => go-stream-muxer}/.gitignore (100%) create mode 100644 vendor/github.com/libp2p/go-stream-muxer/.gxignore create mode 100644 vendor/github.com/libp2p/go-stream-muxer/.travis.yml rename vendor/github.com/libp2p/{go-libp2p-yamux => go-stream-muxer}/LICENSE (100%) create mode 100644 vendor/github.com/libp2p/go-stream-muxer/README.md create mode 100644 vendor/github.com/libp2p/go-stream-muxer/codecov.yml create mode 100644 vendor/github.com/libp2p/go-stream-muxer/deprecated.go create mode 100644 vendor/github.com/libp2p/go-stream-muxer/go.mod create mode 100644 vendor/github.com/libp2p/go-stream-muxer/go.sum delete mode 100644 vendor/github.com/libp2p/go-yamux/v3/go.mod delete mode 100644 vendor/github.com/libp2p/go-yamux/v3/go.sum delete mode 100644 vendor/github.com/libp2p/go-yamux/v3/ping.go delete mode 100644 vendor/github.com/libp2p/go-yamux/v3/util.go delete mode 100644 vendor/github.com/libp2p/go-yamux/v3/version.json delete mode 100644 vendor/github.com/lucas-clemente/quic-go/.gitignore delete mode 100644 vendor/github.com/lucas-clemente/quic-go/.golangci.yml delete mode 100644 vendor/github.com/lucas-clemente/quic-go/Changelog.md delete mode 100644 vendor/github.com/lucas-clemente/quic-go/LICENSE delete mode 100644 vendor/github.com/lucas-clemente/quic-go/README.md delete mode 100644 vendor/github.com/lucas-clemente/quic-go/buffer_pool.go delete mode 100644 vendor/github.com/lucas-clemente/quic-go/client.go delete mode 100644 vendor/github.com/lucas-clemente/quic-go/closed_session.go delete mode 100644 vendor/github.com/lucas-clemente/quic-go/codecov.yml delete mode 100644 vendor/github.com/lucas-clemente/quic-go/config.go delete mode 100644 vendor/github.com/lucas-clemente/quic-go/conn.go delete mode 100644 vendor/github.com/lucas-clemente/quic-go/conn_generic.go delete mode 100644 vendor/github.com/lucas-clemente/quic-go/conn_helper_darwin.go delete mode 100644 vendor/github.com/lucas-clemente/quic-go/conn_helper_freebsd.go delete mode 100644 vendor/github.com/lucas-clemente/quic-go/conn_helper_linux.go delete mode 100644 vendor/github.com/lucas-clemente/quic-go/conn_id_generator.go delete mode 100644 vendor/github.com/lucas-clemente/quic-go/conn_id_manager.go delete mode 100644 vendor/github.com/lucas-clemente/quic-go/conn_oob.go delete mode 100644 vendor/github.com/lucas-clemente/quic-go/conn_windows.go delete mode 100644 vendor/github.com/lucas-clemente/quic-go/crypto_stream.go delete mode 100644 vendor/github.com/lucas-clemente/quic-go/crypto_stream_manager.go delete mode 100644 vendor/github.com/lucas-clemente/quic-go/datagram_queue.go delete mode 100644 vendor/github.com/lucas-clemente/quic-go/errors.go delete mode 100644 vendor/github.com/lucas-clemente/quic-go/frame_sorter.go delete mode 100644 vendor/github.com/lucas-clemente/quic-go/framer.go delete mode 100644 vendor/github.com/lucas-clemente/quic-go/go.mod delete mode 100644 vendor/github.com/lucas-clemente/quic-go/go.sum delete mode 100644 vendor/github.com/lucas-clemente/quic-go/interface.go delete mode 100644 vendor/github.com/lucas-clemente/quic-go/internal/ackhandler/ack_eliciting.go delete mode 100644 vendor/github.com/lucas-clemente/quic-go/internal/ackhandler/ackhandler.go delete mode 100644 vendor/github.com/lucas-clemente/quic-go/internal/ackhandler/frame.go delete mode 100644 vendor/github.com/lucas-clemente/quic-go/internal/ackhandler/gen.go delete mode 100644 vendor/github.com/lucas-clemente/quic-go/internal/ackhandler/interfaces.go delete mode 100644 vendor/github.com/lucas-clemente/quic-go/internal/ackhandler/mockgen.go delete mode 100644 vendor/github.com/lucas-clemente/quic-go/internal/ackhandler/packet_linkedlist.go delete mode 100644 vendor/github.com/lucas-clemente/quic-go/internal/ackhandler/packet_number_generator.go delete mode 100644 vendor/github.com/lucas-clemente/quic-go/internal/ackhandler/received_packet_handler.go delete mode 100644 vendor/github.com/lucas-clemente/quic-go/internal/ackhandler/received_packet_history.go delete mode 100644 vendor/github.com/lucas-clemente/quic-go/internal/ackhandler/received_packet_tracker.go delete mode 100644 vendor/github.com/lucas-clemente/quic-go/internal/ackhandler/send_mode.go delete mode 100644 vendor/github.com/lucas-clemente/quic-go/internal/ackhandler/sent_packet_handler.go delete mode 100644 vendor/github.com/lucas-clemente/quic-go/internal/ackhandler/sent_packet_history.go delete mode 100644 vendor/github.com/lucas-clemente/quic-go/internal/congestion/bandwidth.go delete mode 100644 vendor/github.com/lucas-clemente/quic-go/internal/congestion/clock.go delete mode 100644 vendor/github.com/lucas-clemente/quic-go/internal/congestion/cubic.go delete mode 100644 vendor/github.com/lucas-clemente/quic-go/internal/congestion/cubic_sender.go delete mode 100644 vendor/github.com/lucas-clemente/quic-go/internal/congestion/hybrid_slow_start.go delete mode 100644 vendor/github.com/lucas-clemente/quic-go/internal/congestion/interface.go delete mode 100644 vendor/github.com/lucas-clemente/quic-go/internal/congestion/pacer.go delete mode 100644 vendor/github.com/lucas-clemente/quic-go/internal/flowcontrol/base_flow_controller.go delete mode 100644 vendor/github.com/lucas-clemente/quic-go/internal/flowcontrol/connection_flow_controller.go delete mode 100644 vendor/github.com/lucas-clemente/quic-go/internal/flowcontrol/interface.go delete mode 100644 vendor/github.com/lucas-clemente/quic-go/internal/flowcontrol/stream_flow_controller.go delete mode 100644 vendor/github.com/lucas-clemente/quic-go/internal/handshake/aead.go delete mode 100644 vendor/github.com/lucas-clemente/quic-go/internal/handshake/crypto_setup.go delete mode 100644 vendor/github.com/lucas-clemente/quic-go/internal/handshake/header_protector.go delete mode 100644 vendor/github.com/lucas-clemente/quic-go/internal/handshake/hkdf.go delete mode 100644 vendor/github.com/lucas-clemente/quic-go/internal/handshake/initial_aead.go delete mode 100644 vendor/github.com/lucas-clemente/quic-go/internal/handshake/interface.go delete mode 100644 vendor/github.com/lucas-clemente/quic-go/internal/handshake/mockgen.go delete mode 100644 vendor/github.com/lucas-clemente/quic-go/internal/handshake/retry.go delete mode 100644 vendor/github.com/lucas-clemente/quic-go/internal/handshake/session_ticket.go delete mode 100644 vendor/github.com/lucas-clemente/quic-go/internal/handshake/tls_extension_handler.go delete mode 100644 vendor/github.com/lucas-clemente/quic-go/internal/handshake/token_generator.go delete mode 100644 vendor/github.com/lucas-clemente/quic-go/internal/handshake/token_protector.go delete mode 100644 vendor/github.com/lucas-clemente/quic-go/internal/handshake/updatable_aead.go delete mode 100644 vendor/github.com/lucas-clemente/quic-go/internal/logutils/frame.go delete mode 100644 vendor/github.com/lucas-clemente/quic-go/internal/protocol/connection_id.go delete mode 100644 vendor/github.com/lucas-clemente/quic-go/internal/protocol/encryption_level.go delete mode 100644 vendor/github.com/lucas-clemente/quic-go/internal/protocol/key_phase.go delete mode 100644 vendor/github.com/lucas-clemente/quic-go/internal/protocol/packet_number.go delete mode 100644 vendor/github.com/lucas-clemente/quic-go/internal/protocol/params.go delete mode 100644 vendor/github.com/lucas-clemente/quic-go/internal/protocol/perspective.go delete mode 100644 vendor/github.com/lucas-clemente/quic-go/internal/protocol/protocol.go delete mode 100644 vendor/github.com/lucas-clemente/quic-go/internal/protocol/stream.go delete mode 100644 vendor/github.com/lucas-clemente/quic-go/internal/protocol/version.go delete mode 100644 vendor/github.com/lucas-clemente/quic-go/internal/qerr/error_codes.go delete mode 100644 vendor/github.com/lucas-clemente/quic-go/internal/qerr/errors.go delete mode 100644 vendor/github.com/lucas-clemente/quic-go/internal/qtls/go116.go delete mode 100644 vendor/github.com/lucas-clemente/quic-go/internal/qtls/go117.go delete mode 100644 vendor/github.com/lucas-clemente/quic-go/internal/qtls/go118.go delete mode 100644 vendor/github.com/lucas-clemente/quic-go/internal/qtls/go119.go delete mode 100644 vendor/github.com/lucas-clemente/quic-go/internal/utils/atomic_bool.go delete mode 100644 vendor/github.com/lucas-clemente/quic-go/internal/utils/buffered_write_closer.go delete mode 100644 vendor/github.com/lucas-clemente/quic-go/internal/utils/byteinterval_linkedlist.go delete mode 100644 vendor/github.com/lucas-clemente/quic-go/internal/utils/byteorder.go delete mode 100644 vendor/github.com/lucas-clemente/quic-go/internal/utils/byteorder_big_endian.go delete mode 100644 vendor/github.com/lucas-clemente/quic-go/internal/utils/gen.go delete mode 100644 vendor/github.com/lucas-clemente/quic-go/internal/utils/ip.go delete mode 100644 vendor/github.com/lucas-clemente/quic-go/internal/utils/log.go delete mode 100644 vendor/github.com/lucas-clemente/quic-go/internal/utils/minmax.go delete mode 100644 vendor/github.com/lucas-clemente/quic-go/internal/utils/new_connection_id.go delete mode 100644 vendor/github.com/lucas-clemente/quic-go/internal/utils/newconnectionid_linkedlist.go delete mode 100644 vendor/github.com/lucas-clemente/quic-go/internal/utils/packet_interval.go delete mode 100644 vendor/github.com/lucas-clemente/quic-go/internal/utils/packetinterval_linkedlist.go delete mode 100644 vendor/github.com/lucas-clemente/quic-go/internal/utils/rand.go delete mode 100644 vendor/github.com/lucas-clemente/quic-go/internal/utils/rtt_stats.go delete mode 100644 vendor/github.com/lucas-clemente/quic-go/internal/utils/streamframe_interval.go delete mode 100644 vendor/github.com/lucas-clemente/quic-go/internal/utils/timer.go delete mode 100644 vendor/github.com/lucas-clemente/quic-go/internal/wire/ack_frame.go delete mode 100644 vendor/github.com/lucas-clemente/quic-go/internal/wire/ack_range.go delete mode 100644 vendor/github.com/lucas-clemente/quic-go/internal/wire/connection_close_frame.go delete mode 100644 vendor/github.com/lucas-clemente/quic-go/internal/wire/crypto_frame.go delete mode 100644 vendor/github.com/lucas-clemente/quic-go/internal/wire/data_blocked_frame.go delete mode 100644 vendor/github.com/lucas-clemente/quic-go/internal/wire/datagram_frame.go delete mode 100644 vendor/github.com/lucas-clemente/quic-go/internal/wire/extended_header.go delete mode 100644 vendor/github.com/lucas-clemente/quic-go/internal/wire/frame_parser.go delete mode 100644 vendor/github.com/lucas-clemente/quic-go/internal/wire/handshake_done_frame.go delete mode 100644 vendor/github.com/lucas-clemente/quic-go/internal/wire/header.go delete mode 100644 vendor/github.com/lucas-clemente/quic-go/internal/wire/interface.go delete mode 100644 vendor/github.com/lucas-clemente/quic-go/internal/wire/log.go delete mode 100644 vendor/github.com/lucas-clemente/quic-go/internal/wire/max_data_frame.go delete mode 100644 vendor/github.com/lucas-clemente/quic-go/internal/wire/max_stream_data_frame.go delete mode 100644 vendor/github.com/lucas-clemente/quic-go/internal/wire/max_streams_frame.go delete mode 100644 vendor/github.com/lucas-clemente/quic-go/internal/wire/new_connection_id_frame.go delete mode 100644 vendor/github.com/lucas-clemente/quic-go/internal/wire/new_token_frame.go delete mode 100644 vendor/github.com/lucas-clemente/quic-go/internal/wire/path_challenge_frame.go delete mode 100644 vendor/github.com/lucas-clemente/quic-go/internal/wire/path_response_frame.go delete mode 100644 vendor/github.com/lucas-clemente/quic-go/internal/wire/ping_frame.go delete mode 100644 vendor/github.com/lucas-clemente/quic-go/internal/wire/pool.go delete mode 100644 vendor/github.com/lucas-clemente/quic-go/internal/wire/reset_stream_frame.go delete mode 100644 vendor/github.com/lucas-clemente/quic-go/internal/wire/retire_connection_id_frame.go delete mode 100644 vendor/github.com/lucas-clemente/quic-go/internal/wire/stop_sending_frame.go delete mode 100644 vendor/github.com/lucas-clemente/quic-go/internal/wire/stream_data_blocked_frame.go delete mode 100644 vendor/github.com/lucas-clemente/quic-go/internal/wire/stream_frame.go delete mode 100644 vendor/github.com/lucas-clemente/quic-go/internal/wire/streams_blocked_frame.go delete mode 100644 vendor/github.com/lucas-clemente/quic-go/internal/wire/transport_parameters.go delete mode 100644 vendor/github.com/lucas-clemente/quic-go/internal/wire/version_negotiation.go delete mode 100644 vendor/github.com/lucas-clemente/quic-go/logging/frame.go delete mode 100644 vendor/github.com/lucas-clemente/quic-go/logging/interface.go delete mode 100644 vendor/github.com/lucas-clemente/quic-go/logging/mockgen.go delete mode 100644 vendor/github.com/lucas-clemente/quic-go/logging/multiplex.go delete mode 100644 vendor/github.com/lucas-clemente/quic-go/logging/packet_header.go delete mode 100644 vendor/github.com/lucas-clemente/quic-go/logging/types.go delete mode 100644 vendor/github.com/lucas-clemente/quic-go/mockgen.go delete mode 100644 vendor/github.com/lucas-clemente/quic-go/mockgen_private.sh delete mode 100644 vendor/github.com/lucas-clemente/quic-go/mtu_discoverer.go delete mode 100644 vendor/github.com/lucas-clemente/quic-go/multiplexer.go delete mode 100644 vendor/github.com/lucas-clemente/quic-go/packet_handler_map.go delete mode 100644 vendor/github.com/lucas-clemente/quic-go/packet_packer.go delete mode 100644 vendor/github.com/lucas-clemente/quic-go/packet_unpacker.go delete mode 100644 vendor/github.com/lucas-clemente/quic-go/qlog/event.go delete mode 100644 vendor/github.com/lucas-clemente/quic-go/qlog/frame.go delete mode 100644 vendor/github.com/lucas-clemente/quic-go/qlog/packet_header.go delete mode 100644 vendor/github.com/lucas-clemente/quic-go/qlog/qlog.go delete mode 100644 vendor/github.com/lucas-clemente/quic-go/qlog/trace.go delete mode 100644 vendor/github.com/lucas-clemente/quic-go/qlog/types.go delete mode 100644 vendor/github.com/lucas-clemente/quic-go/quicvarint/io.go delete mode 100644 vendor/github.com/lucas-clemente/quic-go/quicvarint/varint.go delete mode 100644 vendor/github.com/lucas-clemente/quic-go/receive_stream.go delete mode 100644 vendor/github.com/lucas-clemente/quic-go/retransmission_queue.go delete mode 100644 vendor/github.com/lucas-clemente/quic-go/send_conn.go delete mode 100644 vendor/github.com/lucas-clemente/quic-go/send_queue.go delete mode 100644 vendor/github.com/lucas-clemente/quic-go/send_stream.go delete mode 100644 vendor/github.com/lucas-clemente/quic-go/server.go delete mode 100644 vendor/github.com/lucas-clemente/quic-go/session.go delete mode 100644 vendor/github.com/lucas-clemente/quic-go/stream.go delete mode 100644 vendor/github.com/lucas-clemente/quic-go/streams_map.go delete mode 100644 vendor/github.com/lucas-clemente/quic-go/streams_map_generic_helper.go delete mode 100644 vendor/github.com/lucas-clemente/quic-go/streams_map_incoming_bidi.go delete mode 100644 vendor/github.com/lucas-clemente/quic-go/streams_map_incoming_generic.go delete mode 100644 vendor/github.com/lucas-clemente/quic-go/streams_map_incoming_uni.go delete mode 100644 vendor/github.com/lucas-clemente/quic-go/streams_map_outgoing_bidi.go delete mode 100644 vendor/github.com/lucas-clemente/quic-go/streams_map_outgoing_generic.go delete mode 100644 vendor/github.com/lucas-clemente/quic-go/streams_map_outgoing_uni.go delete mode 100644 vendor/github.com/lucas-clemente/quic-go/token_store.go delete mode 100644 vendor/github.com/lucas-clemente/quic-go/tools.go delete mode 100644 vendor/github.com/lucas-clemente/quic-go/window_update_queue.go delete mode 100644 vendor/github.com/marten-seemann/qtls-go1-16/LICENSE delete mode 100644 vendor/github.com/marten-seemann/qtls-go1-16/README.md delete mode 100644 vendor/github.com/marten-seemann/qtls-go1-16/alert.go delete mode 100644 vendor/github.com/marten-seemann/qtls-go1-16/auth.go delete mode 100644 vendor/github.com/marten-seemann/qtls-go1-16/cipher_suites.go delete mode 100644 vendor/github.com/marten-seemann/qtls-go1-16/common.go delete mode 100644 vendor/github.com/marten-seemann/qtls-go1-16/conn.go delete mode 100644 vendor/github.com/marten-seemann/qtls-go1-16/go.mod delete mode 100644 vendor/github.com/marten-seemann/qtls-go1-16/go.sum delete mode 100644 vendor/github.com/marten-seemann/qtls-go1-16/handshake_client.go delete mode 100644 vendor/github.com/marten-seemann/qtls-go1-16/handshake_client_tls13.go delete mode 100644 vendor/github.com/marten-seemann/qtls-go1-16/handshake_messages.go delete mode 100644 vendor/github.com/marten-seemann/qtls-go1-16/handshake_server.go delete mode 100644 vendor/github.com/marten-seemann/qtls-go1-16/handshake_server_tls13.go delete mode 100644 vendor/github.com/marten-seemann/qtls-go1-16/key_agreement.go delete mode 100644 vendor/github.com/marten-seemann/qtls-go1-16/key_schedule.go delete mode 100644 vendor/github.com/marten-seemann/qtls-go1-16/prf.go delete mode 100644 vendor/github.com/marten-seemann/qtls-go1-16/ticket.go delete mode 100644 vendor/github.com/marten-seemann/qtls-go1-16/tls.go delete mode 100644 vendor/github.com/marten-seemann/qtls-go1-16/unsafe.go delete mode 100644 vendor/github.com/marten-seemann/qtls-go1-17/LICENSE delete mode 100644 vendor/github.com/marten-seemann/qtls-go1-17/README.md delete mode 100644 vendor/github.com/marten-seemann/qtls-go1-17/alert.go delete mode 100644 vendor/github.com/marten-seemann/qtls-go1-17/auth.go delete mode 100644 vendor/github.com/marten-seemann/qtls-go1-17/cipher_suites.go delete mode 100644 vendor/github.com/marten-seemann/qtls-go1-17/common.go delete mode 100644 vendor/github.com/marten-seemann/qtls-go1-17/conn.go delete mode 100644 vendor/github.com/marten-seemann/qtls-go1-17/go.mod delete mode 100644 vendor/github.com/marten-seemann/qtls-go1-17/go.sum delete mode 100644 vendor/github.com/marten-seemann/qtls-go1-17/handshake_client.go delete mode 100644 vendor/github.com/marten-seemann/qtls-go1-17/handshake_client_tls13.go delete mode 100644 vendor/github.com/marten-seemann/qtls-go1-17/handshake_messages.go delete mode 100644 vendor/github.com/marten-seemann/qtls-go1-17/handshake_server.go delete mode 100644 vendor/github.com/marten-seemann/qtls-go1-17/handshake_server_tls13.go delete mode 100644 vendor/github.com/marten-seemann/qtls-go1-17/key_agreement.go delete mode 100644 vendor/github.com/marten-seemann/qtls-go1-17/key_schedule.go delete mode 100644 vendor/github.com/marten-seemann/qtls-go1-17/prf.go delete mode 100644 vendor/github.com/marten-seemann/qtls-go1-17/ticket.go delete mode 100644 vendor/github.com/marten-seemann/qtls-go1-17/tls.go delete mode 100644 vendor/github.com/marten-seemann/qtls-go1-17/unsafe.go delete mode 100644 vendor/github.com/marten-seemann/qtls-go1-18/LICENSE delete mode 100644 vendor/github.com/marten-seemann/qtls-go1-18/README.md delete mode 100644 vendor/github.com/marten-seemann/qtls-go1-18/alert.go delete mode 100644 vendor/github.com/marten-seemann/qtls-go1-18/auth.go delete mode 100644 vendor/github.com/marten-seemann/qtls-go1-18/cipher_suites.go delete mode 100644 vendor/github.com/marten-seemann/qtls-go1-18/common.go delete mode 100644 vendor/github.com/marten-seemann/qtls-go1-18/conn.go delete mode 100644 vendor/github.com/marten-seemann/qtls-go1-18/go.mod delete mode 100644 vendor/github.com/marten-seemann/qtls-go1-18/go.sum delete mode 100644 vendor/github.com/marten-seemann/qtls-go1-18/handshake_client.go delete mode 100644 vendor/github.com/marten-seemann/qtls-go1-18/handshake_client_tls13.go delete mode 100644 vendor/github.com/marten-seemann/qtls-go1-18/handshake_messages.go delete mode 100644 vendor/github.com/marten-seemann/qtls-go1-18/handshake_server.go delete mode 100644 vendor/github.com/marten-seemann/qtls-go1-18/handshake_server_tls13.go delete mode 100644 vendor/github.com/marten-seemann/qtls-go1-18/key_agreement.go delete mode 100644 vendor/github.com/marten-seemann/qtls-go1-18/key_schedule.go delete mode 100644 vendor/github.com/marten-seemann/qtls-go1-18/prf.go delete mode 100644 vendor/github.com/marten-seemann/qtls-go1-18/ticket.go delete mode 100644 vendor/github.com/marten-seemann/qtls-go1-18/tls.go delete mode 100644 vendor/github.com/marten-seemann/qtls-go1-18/unsafe.go delete mode 100644 vendor/github.com/nxadm/tail/.gitignore delete mode 100644 vendor/github.com/nxadm/tail/CHANGES.md delete mode 100644 vendor/github.com/nxadm/tail/Dockerfile delete mode 100644 vendor/github.com/nxadm/tail/LICENSE delete mode 100644 vendor/github.com/nxadm/tail/README.md delete mode 100644 vendor/github.com/nxadm/tail/go.mod delete mode 100644 vendor/github.com/nxadm/tail/go.sum delete mode 100644 vendor/github.com/nxadm/tail/ratelimiter/Licence delete mode 100644 vendor/github.com/nxadm/tail/ratelimiter/leakybucket.go delete mode 100644 vendor/github.com/nxadm/tail/ratelimiter/memory.go delete mode 100644 vendor/github.com/nxadm/tail/ratelimiter/storage.go delete mode 100644 vendor/github.com/nxadm/tail/tail.go delete mode 100644 vendor/github.com/nxadm/tail/tail_posix.go delete mode 100644 vendor/github.com/nxadm/tail/tail_windows.go delete mode 100644 vendor/github.com/nxadm/tail/util/util.go delete mode 100644 vendor/github.com/nxadm/tail/watch/filechanges.go delete mode 100644 vendor/github.com/nxadm/tail/watch/inotify.go delete mode 100644 vendor/github.com/nxadm/tail/watch/inotify_tracker.go delete mode 100644 vendor/github.com/nxadm/tail/watch/polling.go delete mode 100644 vendor/github.com/nxadm/tail/watch/watch.go delete mode 100644 vendor/github.com/nxadm/tail/winfile/winfile.go delete mode 100644 vendor/github.com/onsi/ginkgo/LICENSE delete mode 100644 vendor/github.com/onsi/ginkgo/config/config.go delete mode 100644 vendor/github.com/onsi/ginkgo/formatter/formatter.go delete mode 100644 vendor/github.com/onsi/ginkgo/ginkgo/bootstrap_command.go delete mode 100644 vendor/github.com/onsi/ginkgo/ginkgo/build_command.go delete mode 100644 vendor/github.com/onsi/ginkgo/ginkgo/convert/ginkgo_ast_nodes.go delete mode 100644 vendor/github.com/onsi/ginkgo/ginkgo/convert/import.go delete mode 100644 vendor/github.com/onsi/ginkgo/ginkgo/convert/package_rewriter.go delete mode 100644 vendor/github.com/onsi/ginkgo/ginkgo/convert/test_finder.go delete mode 100644 vendor/github.com/onsi/ginkgo/ginkgo/convert/testfile_rewriter.go delete mode 100644 vendor/github.com/onsi/ginkgo/ginkgo/convert/testing_t_rewriter.go delete mode 100644 vendor/github.com/onsi/ginkgo/ginkgo/convert_command.go delete mode 100644 vendor/github.com/onsi/ginkgo/ginkgo/generate_command.go delete mode 100644 vendor/github.com/onsi/ginkgo/ginkgo/help_command.go delete mode 100644 vendor/github.com/onsi/ginkgo/ginkgo/interrupthandler/interrupt_handler.go delete mode 100644 vendor/github.com/onsi/ginkgo/ginkgo/interrupthandler/sigquit_swallower_unix.go delete mode 100644 vendor/github.com/onsi/ginkgo/ginkgo/interrupthandler/sigquit_swallower_windows.go delete mode 100644 vendor/github.com/onsi/ginkgo/ginkgo/main.go delete mode 100644 vendor/github.com/onsi/ginkgo/ginkgo/nodot/nodot.go delete mode 100644 vendor/github.com/onsi/ginkgo/ginkgo/nodot_command.go delete mode 100644 vendor/github.com/onsi/ginkgo/ginkgo/notifications.go delete mode 100644 vendor/github.com/onsi/ginkgo/ginkgo/outline/ginkgo.go delete mode 100644 vendor/github.com/onsi/ginkgo/ginkgo/outline/import.go delete mode 100644 vendor/github.com/onsi/ginkgo/ginkgo/outline/outline.go delete mode 100644 vendor/github.com/onsi/ginkgo/ginkgo/outline_command.go delete mode 100644 vendor/github.com/onsi/ginkgo/ginkgo/run_command.go delete mode 100644 vendor/github.com/onsi/ginkgo/ginkgo/run_watch_and_build_command_flags.go delete mode 100644 vendor/github.com/onsi/ginkgo/ginkgo/suite_runner.go delete mode 100644 vendor/github.com/onsi/ginkgo/ginkgo/testrunner/build_args.go delete mode 100644 vendor/github.com/onsi/ginkgo/ginkgo/testrunner/build_args_old.go delete mode 100644 vendor/github.com/onsi/ginkgo/ginkgo/testrunner/log_writer.go delete mode 100644 vendor/github.com/onsi/ginkgo/ginkgo/testrunner/run_result.go delete mode 100644 vendor/github.com/onsi/ginkgo/ginkgo/testrunner/test_runner.go delete mode 100644 vendor/github.com/onsi/ginkgo/ginkgo/testsuite/test_suite.go delete mode 100644 vendor/github.com/onsi/ginkgo/ginkgo/testsuite/vendor_check_go15.go delete mode 100644 vendor/github.com/onsi/ginkgo/ginkgo/testsuite/vendor_check_go16.go delete mode 100644 vendor/github.com/onsi/ginkgo/ginkgo/unfocus_command.go delete mode 100644 vendor/github.com/onsi/ginkgo/ginkgo/version_command.go delete mode 100644 vendor/github.com/onsi/ginkgo/ginkgo/watch/delta.go delete mode 100644 vendor/github.com/onsi/ginkgo/ginkgo/watch/delta_tracker.go delete mode 100644 vendor/github.com/onsi/ginkgo/ginkgo/watch/dependencies.go delete mode 100644 vendor/github.com/onsi/ginkgo/ginkgo/watch/package_hash.go delete mode 100644 vendor/github.com/onsi/ginkgo/ginkgo/watch/package_hashes.go delete mode 100644 vendor/github.com/onsi/ginkgo/ginkgo/watch/suite.go delete mode 100644 vendor/github.com/onsi/ginkgo/ginkgo/watch_command.go delete mode 100644 vendor/github.com/onsi/ginkgo/internal/codelocation/code_location.go delete mode 100644 vendor/github.com/onsi/ginkgo/internal/containernode/container_node.go delete mode 100644 vendor/github.com/onsi/ginkgo/internal/failer/failer.go delete mode 100644 vendor/github.com/onsi/ginkgo/internal/leafnodes/benchmarker.go delete mode 100644 vendor/github.com/onsi/ginkgo/internal/leafnodes/interfaces.go delete mode 100644 vendor/github.com/onsi/ginkgo/internal/leafnodes/it_node.go delete mode 100644 vendor/github.com/onsi/ginkgo/internal/leafnodes/measure_node.go delete mode 100644 vendor/github.com/onsi/ginkgo/internal/leafnodes/runner.go delete mode 100644 vendor/github.com/onsi/ginkgo/internal/leafnodes/setup_nodes.go delete mode 100644 vendor/github.com/onsi/ginkgo/internal/leafnodes/suite_nodes.go delete mode 100644 vendor/github.com/onsi/ginkgo/internal/leafnodes/synchronized_after_suite_node.go delete mode 100644 vendor/github.com/onsi/ginkgo/internal/leafnodes/synchronized_before_suite_node.go delete mode 100644 vendor/github.com/onsi/ginkgo/internal/remote/aggregator.go delete mode 100644 vendor/github.com/onsi/ginkgo/internal/remote/forwarding_reporter.go delete mode 100644 vendor/github.com/onsi/ginkgo/internal/remote/output_interceptor.go delete mode 100644 vendor/github.com/onsi/ginkgo/internal/remote/output_interceptor_unix.go delete mode 100644 vendor/github.com/onsi/ginkgo/internal/remote/output_interceptor_win.go delete mode 100644 vendor/github.com/onsi/ginkgo/internal/remote/server.go delete mode 100644 vendor/github.com/onsi/ginkgo/internal/spec/spec.go delete mode 100644 vendor/github.com/onsi/ginkgo/internal/spec/specs.go delete mode 100644 vendor/github.com/onsi/ginkgo/internal/spec_iterator/index_computer.go delete mode 100644 vendor/github.com/onsi/ginkgo/internal/spec_iterator/parallel_spec_iterator.go delete mode 100644 vendor/github.com/onsi/ginkgo/internal/spec_iterator/serial_spec_iterator.go delete mode 100644 vendor/github.com/onsi/ginkgo/internal/spec_iterator/sharded_parallel_spec_iterator.go delete mode 100644 vendor/github.com/onsi/ginkgo/internal/spec_iterator/spec_iterator.go delete mode 100644 vendor/github.com/onsi/ginkgo/internal/writer/fake_writer.go delete mode 100644 vendor/github.com/onsi/ginkgo/internal/writer/writer.go delete mode 100644 vendor/github.com/onsi/ginkgo/reporters/default_reporter.go delete mode 100644 vendor/github.com/onsi/ginkgo/reporters/fake_reporter.go delete mode 100644 vendor/github.com/onsi/ginkgo/reporters/junit_reporter.go delete mode 100644 vendor/github.com/onsi/ginkgo/reporters/reporter.go delete mode 100644 vendor/github.com/onsi/ginkgo/reporters/stenographer/console_logging.go delete mode 100644 vendor/github.com/onsi/ginkgo/reporters/stenographer/fake_stenographer.go delete mode 100644 vendor/github.com/onsi/ginkgo/reporters/stenographer/stenographer.go delete mode 100644 vendor/github.com/onsi/ginkgo/reporters/stenographer/support/go-colorable/LICENSE delete mode 100644 vendor/github.com/onsi/ginkgo/reporters/stenographer/support/go-colorable/README.md delete mode 100644 vendor/github.com/onsi/ginkgo/reporters/stenographer/support/go-colorable/colorable_others.go delete mode 100644 vendor/github.com/onsi/ginkgo/reporters/stenographer/support/go-colorable/colorable_windows.go delete mode 100644 vendor/github.com/onsi/ginkgo/reporters/stenographer/support/go-colorable/noncolorable.go delete mode 100644 vendor/github.com/onsi/ginkgo/reporters/stenographer/support/go-isatty/LICENSE delete mode 100644 vendor/github.com/onsi/ginkgo/reporters/stenographer/support/go-isatty/README.md delete mode 100644 vendor/github.com/onsi/ginkgo/reporters/stenographer/support/go-isatty/doc.go delete mode 100644 vendor/github.com/onsi/ginkgo/reporters/stenographer/support/go-isatty/isatty_appengine.go delete mode 100644 vendor/github.com/onsi/ginkgo/reporters/stenographer/support/go-isatty/isatty_bsd.go delete mode 100644 vendor/github.com/onsi/ginkgo/reporters/stenographer/support/go-isatty/isatty_linux.go delete mode 100644 vendor/github.com/onsi/ginkgo/reporters/stenographer/support/go-isatty/isatty_solaris.go delete mode 100644 vendor/github.com/onsi/ginkgo/reporters/stenographer/support/go-isatty/isatty_windows.go delete mode 100644 vendor/github.com/onsi/ginkgo/reporters/teamcity_reporter.go delete mode 100644 vendor/github.com/onsi/ginkgo/types/code_location.go delete mode 100644 vendor/github.com/onsi/ginkgo/types/deprecation_support.go delete mode 100644 vendor/github.com/onsi/ginkgo/types/synchronization.go delete mode 100644 vendor/github.com/onsi/ginkgo/types/types.go delete mode 100644 vendor/github.com/opencontainers/runtime-spec/LICENSE delete mode 100644 vendor/github.com/opencontainers/runtime-spec/specs-go/config.go delete mode 100644 vendor/github.com/opencontainers/runtime-spec/specs-go/state.go delete mode 100644 vendor/github.com/opencontainers/runtime-spec/specs-go/version.go delete mode 100644 vendor/github.com/pbnjay/memory/LICENSE delete mode 100644 vendor/github.com/pbnjay/memory/README.md delete mode 100644 vendor/github.com/pbnjay/memory/doc.go delete mode 100644 vendor/github.com/pbnjay/memory/go.mod delete mode 100644 vendor/github.com/pbnjay/memory/memory_bsd.go delete mode 100644 vendor/github.com/pbnjay/memory/memory_darwin.go delete mode 100644 vendor/github.com/pbnjay/memory/memory_linux.go delete mode 100644 vendor/github.com/pbnjay/memory/memory_windows.go delete mode 100644 vendor/github.com/pbnjay/memory/memsysctl.go delete mode 100644 vendor/github.com/pbnjay/memory/stub.go delete mode 100644 vendor/github.com/pkg/errors/.gitignore delete mode 100644 vendor/github.com/pkg/errors/.travis.yml delete mode 100644 vendor/github.com/pkg/errors/LICENSE delete mode 100644 vendor/github.com/pkg/errors/Makefile delete mode 100644 vendor/github.com/pkg/errors/README.md delete mode 100644 vendor/github.com/pkg/errors/appveyor.yml delete mode 100644 vendor/github.com/pkg/errors/errors.go delete mode 100644 vendor/github.com/pkg/errors/go113.go delete mode 100644 vendor/github.com/pkg/errors/stack.go delete mode 100644 vendor/github.com/raulk/clock/LICENSE delete mode 100644 vendor/github.com/raulk/clock/README.md delete mode 100644 vendor/github.com/raulk/clock/clock.go delete mode 100644 vendor/github.com/raulk/clock/go.mod delete mode 100644 vendor/github.com/raulk/go-watchdog/.dockerignore delete mode 100644 vendor/github.com/raulk/go-watchdog/Dockerfile.dlv delete mode 100644 vendor/github.com/raulk/go-watchdog/Dockerfile.test delete mode 100644 vendor/github.com/raulk/go-watchdog/LICENSE-APACHE delete mode 100644 vendor/github.com/raulk/go-watchdog/Makefile delete mode 100644 vendor/github.com/raulk/go-watchdog/README.md delete mode 100644 vendor/github.com/raulk/go-watchdog/adaptive.go delete mode 100644 vendor/github.com/raulk/go-watchdog/doc.go delete mode 100644 vendor/github.com/raulk/go-watchdog/go.mod delete mode 100644 vendor/github.com/raulk/go-watchdog/go.sum delete mode 100644 vendor/github.com/raulk/go-watchdog/log.go delete mode 100644 vendor/github.com/raulk/go-watchdog/notification.go delete mode 100644 vendor/github.com/raulk/go-watchdog/watchdog.go delete mode 100644 vendor/github.com/raulk/go-watchdog/watchdog_linux.go delete mode 100644 vendor/github.com/raulk/go-watchdog/watchdog_other.go delete mode 100644 vendor/github.com/raulk/go-watchdog/watermarks.go rename vendor/github.com/{libp2p/go-stream-muxer-multistream => whyrusleeping/go-smux-multiplex}/.gitignore (100%) rename vendor/github.com/{libp2p/go-stream-muxer-multistream => whyrusleeping/go-smux-multiplex}/LICENSE (100%) rename vendor/github.com/{libp2p/go-stream-muxer-multistream => whyrusleeping/go-smux-multiplex}/Makefile (100%) rename vendor/github.com/{libp2p/go-libp2p-mplex => whyrusleeping/go-smux-multiplex}/README.md (76%) create mode 100644 vendor/github.com/whyrusleeping/go-smux-multiplex/multiplex.go create mode 100644 vendor/github.com/whyrusleeping/go-smux-multiplex/package.json create mode 100644 vendor/github.com/whyrusleeping/go-smux-multistream/.gitignore create mode 100644 vendor/github.com/whyrusleeping/go-smux-multistream/LICENSE create mode 100644 vendor/github.com/whyrusleeping/go-smux-multistream/Makefile rename vendor/github.com/{libp2p/go-stream-muxer-multistream => whyrusleeping/go-smux-multistream}/README.md (84%) rename vendor/github.com/{libp2p/go-stream-muxer-multistream => whyrusleeping/go-smux-multistream}/multistream.go (73%) create mode 100644 vendor/github.com/whyrusleeping/go-smux-multistream/package.json create mode 100644 vendor/github.com/whyrusleeping/go-smux-yamux/.gitignore create mode 100644 vendor/github.com/whyrusleeping/go-smux-yamux/LICENSE create mode 100644 vendor/github.com/whyrusleeping/go-smux-yamux/Makefile create mode 100644 vendor/github.com/whyrusleeping/go-smux-yamux/README.md create mode 100644 vendor/github.com/whyrusleeping/go-smux-yamux/package.json create mode 100644 vendor/github.com/whyrusleeping/go-smux-yamux/yamux.go rename vendor/github.com/{libp2p/go-yamux/v3 => whyrusleeping/yamux}/.gitignore (100%) rename vendor/github.com/{libp2p/go-yamux/v3 => whyrusleeping/yamux}/LICENSE (100%) rename vendor/github.com/{libp2p/go-yamux/v3 => whyrusleeping/yamux}/LICENSE-BSD (100%) rename vendor/github.com/{libp2p/go-yamux/v3 => whyrusleeping/yamux}/README.md (92%) rename vendor/github.com/{libp2p/go-yamux/v3 => whyrusleeping/yamux}/addr.go (96%) rename vendor/github.com/{libp2p/go-yamux/v3 => whyrusleeping/yamux}/const.go (73%) rename vendor/github.com/{libp2p/go-yamux/v3 => whyrusleeping/yamux}/deadline.go (100%) create mode 100644 vendor/github.com/whyrusleeping/yamux/go.mod create mode 100644 vendor/github.com/whyrusleeping/yamux/go.sum rename vendor/github.com/{libp2p/go-yamux/v3 => whyrusleeping/yamux}/mux.go (62%) create mode 100644 vendor/github.com/whyrusleeping/yamux/package.json rename vendor/github.com/{libp2p/go-yamux/v3 => whyrusleeping/yamux}/session.go (59%) rename vendor/github.com/{libp2p/go-yamux/v3 => whyrusleeping/yamux}/spec.md (100%) rename vendor/github.com/{libp2p/go-yamux/v3 => whyrusleeping/yamux}/stream.go (56%) create mode 100644 vendor/github.com/whyrusleeping/yamux/util.go delete mode 100644 vendor/golang.org/x/crypto/hkdf/hkdf.go delete mode 100644 vendor/golang.org/x/mod/internal/lazyregexp/lazyre.go delete mode 100644 vendor/golang.org/x/mod/module/module.go delete mode 100644 vendor/golang.org/x/mod/module/pseudo.go delete mode 100644 vendor/golang.org/x/tools/go/ast/astutil/enclosing.go delete mode 100644 vendor/golang.org/x/tools/go/ast/astutil/imports.go delete mode 100644 vendor/golang.org/x/tools/go/ast/astutil/rewrite.go delete mode 100644 vendor/golang.org/x/tools/go/ast/astutil/util.go delete mode 100644 vendor/golang.org/x/tools/go/ast/inspector/inspector.go delete mode 100644 vendor/golang.org/x/tools/go/ast/inspector/typeof.go delete mode 100644 vendor/golang.org/x/tools/imports/forward.go delete mode 100644 vendor/golang.org/x/tools/internal/fastwalk/fastwalk.go delete mode 100644 vendor/golang.org/x/tools/internal/fastwalk/fastwalk_dirent_fileno.go delete mode 100644 vendor/golang.org/x/tools/internal/fastwalk/fastwalk_dirent_ino.go delete mode 100644 vendor/golang.org/x/tools/internal/fastwalk/fastwalk_dirent_namlen_bsd.go delete mode 100644 vendor/golang.org/x/tools/internal/fastwalk/fastwalk_dirent_namlen_linux.go delete mode 100644 vendor/golang.org/x/tools/internal/fastwalk/fastwalk_portable.go delete mode 100644 vendor/golang.org/x/tools/internal/fastwalk/fastwalk_unix.go delete mode 100644 vendor/golang.org/x/tools/internal/gopathwalk/walk.go delete mode 100644 vendor/golang.org/x/tools/internal/imports/fix.go delete mode 100644 vendor/golang.org/x/tools/internal/imports/imports.go delete mode 100644 vendor/golang.org/x/tools/internal/imports/mod.go delete mode 100644 vendor/golang.org/x/tools/internal/imports/mod_cache.go delete mode 100644 vendor/golang.org/x/tools/internal/imports/sortimports.go delete mode 100644 vendor/golang.org/x/tools/internal/imports/zstdlib.go delete mode 100644 vendor/gopkg.in/tomb.v1/LICENSE delete mode 100644 vendor/gopkg.in/tomb.v1/README.md delete mode 100644 vendor/gopkg.in/tomb.v1/tomb.go diff --git a/go.mod b/go.mod index 3b501e4ec1..23e1294b59 100644 --- a/go.mod +++ b/go.mod @@ -4,8 +4,6 @@ go 1.16 require ( github.com/btcsuite/btcd v0.22.0-beta - github.com/containerd/cgroups v1.0.2 // indirect - github.com/elastic/gosigar v0.14.2 // indirect github.com/go-kit/kit v0.12.0 github.com/golang/protobuf v1.5.2 github.com/google/uuid v1.3.0 @@ -16,7 +14,7 @@ require ( github.com/hashicorp/golang-lru v0.5.4 github.com/hashicorp/hcl v1.0.0 github.com/hashicorp/vault/api v1.3.1 - github.com/libp2p/go-libp2p v0.18.0-rc2 + github.com/libp2p/go-libp2p v6.0.23+incompatible github.com/libp2p/go-libp2p-core v0.15.0 github.com/libp2p/go-libp2p-kbucket v0.4.7 github.com/libp2p/go-libp2p-noise v0.3.0 @@ -44,16 +42,44 @@ require ( github.com/armon/go-metrics v0.3.10 // indirect github.com/aws/aws-sdk-go v1.43.41 github.com/benbjohnson/clock v1.3.0 // indirect + github.com/davidlazar/go-crypto v0.0.0-20200604182044-b73af7476f6c // indirect github.com/fatih/color v1.13.0 // indirect github.com/fsnotify/fsnotify v1.5.1 // indirect - github.com/godbus/dbus/v5 v5.0.6 // indirect + github.com/huin/goupnp v1.0.2 // indirect github.com/ipfs/go-cid v0.1.0 // indirect github.com/klauspost/compress v1.14.2 // indirect + github.com/koron/go-ssdp v0.0.2 // indirect + github.com/libp2p/go-conn-security v0.1.0 // indirect + github.com/libp2p/go-libp2p-asn-util v0.1.0 // indirect + github.com/libp2p/go-libp2p-blankhost v0.3.0 // indirect + github.com/libp2p/go-libp2p-circuit v0.6.0 // indirect + github.com/libp2p/go-libp2p-host v0.1.0 // indirect + github.com/libp2p/go-libp2p-interface-connmgr v0.1.0 // indirect + github.com/libp2p/go-libp2p-interface-pnet v0.1.0 // indirect + github.com/libp2p/go-libp2p-loggables v0.1.0 // indirect + github.com/libp2p/go-libp2p-metrics v0.1.0 // indirect + github.com/libp2p/go-libp2p-nat v0.1.0 // indirect + github.com/libp2p/go-libp2p-net v0.1.0 // indirect + github.com/libp2p/go-libp2p-peer v0.2.0 // indirect + github.com/libp2p/go-libp2p-protocol v0.1.0 // indirect + github.com/libp2p/go-libp2p-secio v0.2.3 // indirect + github.com/libp2p/go-libp2p-swarm v0.10.1 // indirect + github.com/libp2p/go-libp2p-tls v0.3.1 // indirect + github.com/libp2p/go-libp2p-transport v0.1.0 // indirect + github.com/libp2p/go-msgio v0.1.0 // indirect + github.com/libp2p/go-stream-muxer v0.1.0 // indirect + github.com/libp2p/go-testutil v0.1.0 // indirect + github.com/libp2p/go-ws-transport v0.6.0 // indirect github.com/mattn/go-colorable v0.1.12 // indirect github.com/mitchellh/mapstructure v1.4.3 // indirect + github.com/multiformats/go-multiaddr-dns v0.3.1 // indirect + github.com/multiformats/go-multistream v0.2.2 // indirect github.com/valyala/fastjson v1.6.3 // indirect + github.com/whyrusleeping/go-smux-multiplex v3.0.16+incompatible // indirect + github.com/whyrusleeping/go-smux-multistream v2.0.2+incompatible // indirect + github.com/whyrusleeping/go-smux-yamux v2.0.9+incompatible // indirect + github.com/whyrusleeping/yamux v1.2.0 // indirect go.uber.org/zap v1.20.0 // indirect - golang.org/x/sync v0.0.0-20210220032951-036812b2e83c golang.org/x/sys v0.0.0-20220227234510-4e6760a101f9 // indirect golang.org/x/tools v0.1.9 // indirect google.golang.org/genproto v0.0.0-20211208223120-3a66f561d7aa // indirect diff --git a/go.sum b/go.sum index f28dea5a21..5a57137e84 100644 --- a/go.sum +++ b/go.sum @@ -101,12 +101,14 @@ github.com/beorn7/perks v1.0.1/go.mod h1:G2ZrVWU2WbWT9wwq4/hrbKbnv/1ERSJQ0ibhJ6r github.com/bgentry/speakeasy v0.1.0/go.mod h1:+zsyZBPWlz7T6j88CTgSN5bM796AkVf0kBD4zp0CCIs= github.com/boltdb/bolt v1.3.1/go.mod h1:clJnj/oiGkjum5o1McbSZDSLxVThjynRyGBgiAx27Ps= github.com/bradfitz/go-smtpd v0.0.0-20170404230938-deb6d6237625/go.mod h1:HYsPBTaaSFSlLx/70C2HPIMNZpVV8+vt/A+FMnYP11g= +github.com/btcsuite/btcd v0.0.0-20190213025234-306aecffea32/go.mod h1:DrZx5ec/dmnfpw9KyYoQyYo7d0KEvTkk/5M/vbZjAr8= github.com/btcsuite/btcd v0.0.0-20190523000118-16327141da8c/go.mod h1:3J08xEfcugPacsc34/LKRU2yO7YmuT8yt28J8k2+rrI= github.com/btcsuite/btcd v0.20.1-beta/go.mod h1:wVuoA8VJLEcwgqHBwHmzLRazpKxTv13Px/pDuV7OomQ= github.com/btcsuite/btcd v0.21.0-beta/go.mod h1:ZSWyehm27aAuS9bvkATT+Xte3hjHZ+MRgMY/8NJ7K94= github.com/btcsuite/btcd v0.22.0-beta h1:LTDpDKUM5EeOFBPM8IXpinEcmZ6FWfNZbE3lfrfdnWo= github.com/btcsuite/btcd v0.22.0-beta/go.mod h1:9n5ntfhhHQBIhUvlhDvD3Qg6fRUj4jkN0VB8L8svzOA= github.com/btcsuite/btclog v0.0.0-20170628155309-84c8d2346e9f/go.mod h1:TdznJufoqS23FtqVCzL0ZqgP5MqXbb4fg/WgDys70nA= +github.com/btcsuite/btcutil v0.0.0-20190207003914-4c204d697803/go.mod h1:+5NJ2+qvTyV9exUAL/rxXi3DcLg2Ts+ymUAY5y4NvMg= github.com/btcsuite/btcutil v0.0.0-20190425235716-9e5f4b9a998d/go.mod h1:+5NJ2+qvTyV9exUAL/rxXi3DcLg2Ts+ymUAY5y4NvMg= github.com/btcsuite/btcutil v1.0.2/go.mod h1:j9HUFwoQRsZL3V4n+qG+CUnEGHOarIxfC3Le2Yhbcts= github.com/btcsuite/btcutil v1.0.3-0.20201208143702-a53e38424cce/go.mod h1:0DVlHczLPewLcPGEIeUEzfOJhqGPQ0mJJRDBtD307+o= @@ -136,8 +138,6 @@ github.com/cheekybits/genny v1.0.0/go.mod h1:+tQajlRqAUrPI7DOSpB0XAqZYtQakVtB7wX github.com/chzyer/logex v1.1.10/go.mod h1:+Ywpsq7O8HXn0nuIou7OrIPyXbp3wmkHB+jjWRnGsAI= github.com/chzyer/readline v0.0.0-20180603132655-2972be24d48e/go.mod h1:nSuG5e5PlCu98SY8svDHJxuZscDgtXS6KTTbou5AhLI= github.com/chzyer/test v0.0.0-20180213035817-a1ea475d72b1/go.mod h1:Q3SI9o4m/ZMnBNeIyt5eFwwo7qiLfzFZmjNmxjkiQlU= -github.com/cilium/ebpf v0.2.0/go.mod h1:To2CFviqOWL/M0gIMsvSMlqe7em/l1ALkX1PyjrX2Qs= -github.com/cilium/ebpf v0.4.0/go.mod h1:4tRaxcgiL706VnOzHOdBlY8IEAIdxINsQBcU4xJJXRs= github.com/circonus-labs/circonus-gometrics v2.3.1+incompatible/go.mod h1:nmEj6Dob7S7YxXgwXpfOuvO54S+tGdZdw9fuRZt25Ag= github.com/circonus-labs/circonusllhist v0.1.3/go.mod h1:kMXHVDlOchFAehlya5ePtbp5jckzBHf4XRpQvBOLI+I= github.com/clbanning/mxj v1.8.4/go.mod h1:BVjHeAH+rl9rs6f+QIpeRl0tfu10SXn1pUSa5PVGJng= @@ -152,9 +152,6 @@ github.com/cncf/xds/go v0.0.0-20210922020428-25de7278fc84/go.mod h1:eXthEFrGJvWH github.com/cncf/xds/go v0.0.0-20211011173535-cb28da3451f1/go.mod h1:eXthEFrGJvWHgFFCl3hGmgk+/aYT6PnTQLykKQRLhEs= github.com/cockroachdb/datadriven v0.0.0-20190809214429-80d97fb3cbaa/go.mod h1:zn76sxSg3SzpJ0PPJaLDCu+Bu0Lg3sKTORVIj19EIF8= github.com/codahale/hdrhistogram v0.0.0-20161010025455-3a0bb77429bd/go.mod h1:sE/e/2PUdi/liOCUjSTXgM1o87ZssimdTWN964YiIeI= -github.com/containerd/cgroups v0.0.0-20201119153540-4cbc285b3327/go.mod h1:ZJeTFisyysqgcCdecO57Dj79RfL0LNeGiFUqLYQRYLE= -github.com/containerd/cgroups v1.0.2 h1:mZBclaSgNDfPWtfhj2xJY28LZ9nYIgzB0pwSURPl6JM= -github.com/containerd/cgroups v1.0.2/go.mod h1:qpbpJ1jmlqsR9f2IyaLPsdkCdnt0rbDVqIDlhuu5tRY= github.com/containerd/continuity v0.0.0-20191214063359-1097c8bae83b h1:pik3LX++5O3UiNWv45wfP/WT81l7ukBJzd3uUiifbSU= github.com/containerd/continuity v0.0.0-20191214063359-1097c8bae83b/go.mod h1:Dq467ZllaHgAtVp4p1xUQWBrFXR9s/wyoTpG8zOJGkY= github.com/coreos/etcd v3.3.10+incompatible/go.mod h1:uF7uidLiAD3TWHmW31ZFd/JWoc32PjwdhPthX9715RE= @@ -163,15 +160,11 @@ github.com/coreos/go-semver v0.2.0/go.mod h1:nnelYz7RCh+5ahJtPPxZlU+153eP4D4r3Ee github.com/coreos/go-semver v0.3.0 h1:wkHLiw0WNATZnSG7epLsujiMCgPAc9xhjJ4tgnAxmfM= github.com/coreos/go-semver v0.3.0/go.mod h1:nnelYz7RCh+5ahJtPPxZlU+153eP4D4r3EedlOD2RNk= github.com/coreos/go-systemd v0.0.0-20180511133405-39ca1b05acc7/go.mod h1:F5haX7vjVVG0kc13fIWeqUViNPyEJxv/OmvnBo0Yme4= -github.com/coreos/go-systemd v0.0.0-20181012123002-c6f51f82210d h1:t5Wuyh53qYyg9eqn4BbnlIT+vmhyww0TatL+zT3uWgI= github.com/coreos/go-systemd v0.0.0-20181012123002-c6f51f82210d/go.mod h1:F5haX7vjVVG0kc13fIWeqUViNPyEJxv/OmvnBo0Yme4= -github.com/coreos/go-systemd/v22 v22.1.0/go.mod h1:xO0FLkIi5MaZafQlIrOotqXZ90ih+1atmu1JpKERPPk= -github.com/coreos/go-systemd/v22 v22.3.2 h1:D9/bQk5vlXQFZ6Kwuu6zaiXJ9oTPe68++AzAJc1DzSI= github.com/coreos/go-systemd/v22 v22.3.2/go.mod h1:Y58oyj3AT4RCenI/lSvhwexgC+NSVTIJ3seZv2GcEnc= github.com/coreos/pkg v0.0.0-20160727233714-3ac0863d7acf/go.mod h1:E3G3o1h8I7cfcXa63jLwjI0eiQQMgzzUDFVpN/nH/eA= github.com/cpuguy83/go-md2man v1.0.10/go.mod h1:SmD6nW6nTyfqj6ABTjUi3V3JVMnlJmwcJI5acqYI6dE= github.com/cpuguy83/go-md2man/v2 v2.0.0-20190314233015-f79a8a8ca69d/go.mod h1:maD7wRr/U5Z6m/iR4s+kqSMx2CaBsrgA7czyZG/E6dU= -github.com/cpuguy83/go-md2man/v2 v2.0.0/go.mod h1:maD7wRr/U5Z6m/iR4s+kqSMx2CaBsrgA7czyZG/E6dU= github.com/cpuguy83/go-md2man/v2 v2.0.1/go.mod h1:tgQtvFlXSQOSOSIRvRPT7W67SCa46tRHOmNcaadrF8o= github.com/creack/pty v1.1.7/go.mod h1:lj5s0c3V2DBrqTV7llrYr5NG6My20zk30Fl46Y7DoTY= github.com/creack/pty v1.1.9/go.mod h1:oKZEueFk5CKHvIhNR5MUki03XCEU+Q6VDXinZuGJ33E= @@ -198,9 +191,6 @@ github.com/eapache/go-resiliency v1.1.0/go.mod h1:kFI+JgMyC7bLPUVY133qvEBtVayf5m github.com/eapache/go-xerial-snappy v0.0.0-20180814174437-776d5712da21/go.mod h1:+020luEh2TKB4/GOp8oxxtq0Daoen/Cii55CzbTV6DU= github.com/eapache/queue v1.1.0/go.mod h1:6eCeP0CKFpHLu8blIFXhExK/dRa7WDZfr6jVFPTqq+I= github.com/edsrzf/mmap-go v1.0.0/go.mod h1:YO35OhQPt3KJa3ryjFM5Bs14WD66h8eGKpfaBNrHW5M= -github.com/elastic/gosigar v0.12.0/go.mod h1:iXRIGg2tLnu7LBdpqzyQfGDEidKCfWcCMS0WKyPWoMs= -github.com/elastic/gosigar v0.14.2 h1:Dg80n8cr90OZ7x+bAax/QjoW/XqTI11RmA79ZwIm9/4= -github.com/elastic/gosigar v0.14.2/go.mod h1:iXRIGg2tLnu7LBdpqzyQfGDEidKCfWcCMS0WKyPWoMs= github.com/envoyproxy/go-control-plane v0.6.9/go.mod h1:SBwIajubJHhxtWwsL9s8ss4safvEdbitLhGGK48rN6g= github.com/envoyproxy/go-control-plane v0.9.0/go.mod h1:YTl/9mNaCwkRvm6d1a2C3ymFceY/DCBVvsKhRF0iEA4= github.com/envoyproxy/go-control-plane v0.9.1-0.20191026205805-5f8ba28d4473/go.mod h1:YTl/9mNaCwkRvm6d1a2C3ymFceY/DCBVvsKhRF0iEA4= @@ -228,7 +218,6 @@ github.com/franela/goblin v0.0.0-20200105215937-c9ffbefa60db/go.mod h1:7dvUGVsVB github.com/franela/goblin v0.0.0-20210519012713-85d372ac71e2/go.mod h1:VzmDKDJVZI3aJmnRI9VjAn9nJ8qPPsN1fqzr9dqInIo= github.com/franela/goreq v0.0.0-20171204163338-bcd34c9993f8/go.mod h1:ZhphrRTfi2rbfLwlschooIH4+wKKDR4Pdxhh+TRoA20= github.com/frankban/quicktest v1.10.0/go.mod h1:ui7WezCLWMWxVWr1GETZY3smRy0G4KWq9vcPtJmFl7Y= -github.com/frankban/quicktest v1.11.3/go.mod h1:wRf/ReqHper53s+kmmSZizM8NamnL3IM0I9ntUbOk+k= github.com/frankban/quicktest v1.13.0 h1:yNZif1OkDfNoDfb9zZa9aXIpejNR4F23Wely0c+Qdqk= github.com/frankban/quicktest v1.13.0/go.mod h1:qLE0fzW0VuyUAJgPU19zByoIr0HtCHN/r/VLSOOIySU= github.com/fsnotify/fsnotify v1.4.7/go.mod h1:jwhsz4b93w/PPRr/qN1Yymfu8t87LnFCMoQvtojpjFo= @@ -262,10 +251,7 @@ github.com/go-task/slim-sprig v0.0.0-20210107165309-348f09dbbbc0/go.mod h1:fyg78 github.com/go-test/deep v1.0.2 h1:onZX1rnHT3Wv6cqNgYyFOOlgVKJrksuCMCRvJStbMYw= github.com/go-test/deep v1.0.2/go.mod h1:wGDj63lr65AM2AQyKZd/NYHGb0R+1RLqB8NKt3aSFNA= github.com/go-zookeeper/zk v1.0.2/go.mod h1:nOB03cncLtlp4t+UAkGSV+9beXP/akpekBwL+UX1Qcw= -github.com/godbus/dbus/v5 v5.0.3/go.mod h1:xhWf0FNVPg57R7Z0UbKHbJfkEywrmjJnf7w5xrFpKfA= github.com/godbus/dbus/v5 v5.0.4/go.mod h1:xhWf0FNVPg57R7Z0UbKHbJfkEywrmjJnf7w5xrFpKfA= -github.com/godbus/dbus/v5 v5.0.6 h1:mkgN1ofwASrYnJ5W6U/BxG15eXXXjirgZc7CLqkcaro= -github.com/godbus/dbus/v5 v5.0.6/go.mod h1:xhWf0FNVPg57R7Z0UbKHbJfkEywrmjJnf7w5xrFpKfA= github.com/gogo/googleapis v1.1.0/go.mod h1:gf4bu3Q80BeJ6H1S1vYPm8/ELATdvryBaNFGgqEef3s= github.com/gogo/protobuf v1.1.1/go.mod h1:r8qH/GZQm5c6nD/R0oafs1akxWv10x8SbQlK7atdtwQ= github.com/gogo/protobuf v1.2.0/go.mod h1:r8qH/GZQm5c6nD/R0oafs1akxWv10x8SbQlK7atdtwQ= @@ -321,7 +307,6 @@ github.com/google/go-cmp v0.4.0/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/ github.com/google/go-cmp v0.4.1/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= github.com/google/go-cmp v0.5.0/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= github.com/google/go-cmp v0.5.1/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= -github.com/google/go-cmp v0.5.2/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= github.com/google/go-cmp v0.5.3/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= github.com/google/go-cmp v0.5.4/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= github.com/google/go-cmp v0.5.5/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= @@ -457,6 +442,7 @@ github.com/inconshreveable/mousetrap v1.0.0 h1:Z8tu5sraLXCXIcARxBp/8cbvlwVa7Z1NH github.com/inconshreveable/mousetrap v1.0.0/go.mod h1:PxqpIevigyE2G7u3NXJIT2ANytuPF1OarO4DADm73n8= github.com/influxdata/influxdb1-client v0.0.0-20191209144304-8bf82d3c094d/go.mod h1:qj24IKcXYK6Iy9ceXlo3Tc+vtHo9lIhSX5JddghvEPo= github.com/influxdata/influxdb1-client v0.0.0-20200827194710-b269163b24ab/go.mod h1:qj24IKcXYK6Iy9ceXlo3Tc+vtHo9lIhSX5JddghvEPo= +github.com/ipfs/go-cid v0.0.1/go.mod h1:GHWU/WuQdMPmIosc4Yn1bcCT7dSeX4lBafM7iqUPQvM= github.com/ipfs/go-cid v0.0.2/go.mod h1:GHWU/WuQdMPmIosc4Yn1bcCT7dSeX4lBafM7iqUPQvM= github.com/ipfs/go-cid v0.0.3/go.mod h1:GHWU/WuQdMPmIosc4Yn1bcCT7dSeX4lBafM7iqUPQvM= github.com/ipfs/go-cid v0.0.5/go.mod h1:plgt+Y5MnOey4vO4UlUazGqdbEXuFYitED67FexhXog= @@ -494,6 +480,7 @@ github.com/jbenet/go-temp-err-catcher v0.1.0 h1:zpb3ZH6wIE8Shj2sKS+khgRvf7T7RABo github.com/jbenet/go-temp-err-catcher v0.1.0/go.mod h1:0kJRvmDZXNMIiJirNPEYfhpPwbGVtZVWC34vc5WLsDk= github.com/jbenet/goprocess v0.0.0-20160826012719-b497e2f366b8/go.mod h1:Ly/wlsjFq/qrU3Rar62tu1gASgGw6chQbSh/XgIIXCY= github.com/jbenet/goprocess v0.1.3/go.mod h1:5yspPrukOVuOLORacaBi858NqyClJPQxYZlqdZVfqY4= +github.com/jbenet/goprocess v0.1.4 h1:DRGOFReOMqqDNXwW70QkacFW0YN9QnwLV0Vqk+3oU0o= github.com/jbenet/goprocess v0.1.4/go.mod h1:5yspPrukOVuOLORacaBi858NqyClJPQxYZlqdZVfqY4= github.com/jellevandenhooff/dkim v0.0.0-20150330215556-f50fe3d243e1/go.mod h1:E0B/fFc00Y+Rasa88328GlI/XbtyysCtTHZS8h7IrBU= github.com/jessevdk/go-flags v0.0.0-20141203071132-1679536dcc89/go.mod h1:4FA24M0QyGHXBuZZK/XkWh8h0e1EYbRYJSGM75WSRxI= @@ -564,6 +551,8 @@ github.com/libp2p/go-buffer-pool v0.0.2 h1:QNK2iAFa8gjAe1SPz6mHSMuCcjs+X1wlHzeOS github.com/libp2p/go-buffer-pool v0.0.2/go.mod h1:MvaB6xw5vOrDl8rYZGLFdKAuk/hRoRZd1Vi32+RXyFM= github.com/libp2p/go-cidranger v1.1.0 h1:ewPN8EZ0dd1LSnrtuwd4709PXVcITVeuwbag38yPW7c= github.com/libp2p/go-cidranger v1.1.0/go.mod h1:KWZTfSr+r9qEo9OkI9/SIEeAtw+NNoU0dXIXt15Okic= +github.com/libp2p/go-conn-security v0.1.0 h1:q8ii9TUOtSBD1gIoKTSOZIzPFP/agPM28amrCCoeIIA= +github.com/libp2p/go-conn-security v0.1.0/go.mod h1:NQdPF4opCZ5twtEUadzPL0tNSdkrbFc/HmLO7eWqEzY= github.com/libp2p/go-conn-security-multistream v0.3.0 h1:9UCIKlBL1hC9u7nkMXpD1nkc/T53PKMAn3/k9ivBAVc= github.com/libp2p/go-conn-security-multistream v0.3.0/go.mod h1:EEP47t4fw/bTelVmEzIDqSe69hO/ip52xBEhZMLWAHM= github.com/libp2p/go-eventbus v0.2.1 h1:VanAdErQnpTioN2TowqNcOijf6YwhuODe4pPKSDpxGc= @@ -571,8 +560,8 @@ github.com/libp2p/go-eventbus v0.2.1/go.mod h1:jc2S4SoEVPP48H9Wpzm5aiGwUCBMfGhVh github.com/libp2p/go-flow-metrics v0.0.1/go.mod h1:Iv1GH0sG8DtYN3SVJ2eG221wMiNpZxBdp967ls1g+k8= github.com/libp2p/go-flow-metrics v0.0.3 h1:8tAs/hSdNvUiLgtlSy3mxwxWP4I9y/jlkPFT7epKdeM= github.com/libp2p/go-flow-metrics v0.0.3/go.mod h1:HeoSNUrOJVK1jEpDqVEiUOIXqhbnS27omG0uWU5slZs= -github.com/libp2p/go-libp2p v0.18.0-rc2 h1:ZLzGMdp1cVwxmA0vFpPVUDPQYUdHHGX7I58nXwpNr7Y= -github.com/libp2p/go-libp2p v0.18.0-rc2/go.mod h1:gGNCvn0T19AzyNPDWej2vsAlZFZVnS+IxqckjnsOyM0= +github.com/libp2p/go-libp2p v6.0.23+incompatible h1:J/h9LNTeQwMhJeg3M96r/UOPLGxJn1vqJBb3LeKufpM= +github.com/libp2p/go-libp2p v6.0.23+incompatible/go.mod h1:CyUlFa6Mw04PkmMg8gBIlHUl8j3TrEiA6oFiF4SgD8w= github.com/libp2p/go-libp2p-asn-util v0.0.0-20200825225859-85005c6cf052/go.mod h1:nRMRTab+kZuk0LnKZpxhOVH/ndsdr2Nr//Zltc/vwgo= github.com/libp2p/go-libp2p-asn-util v0.1.0 h1:rABPCO77SjdbJ/eJ/ynIo8vWICy1VEnL5JAxJbQLo1E= github.com/libp2p/go-libp2p-asn-util v0.1.0/go.mod h1:wu+AnM9Ii2KgO5jMmS1rz9dvzTdj8BXqsPR9HR0XB7I= @@ -583,6 +572,7 @@ github.com/libp2p/go-libp2p-circuit v0.6.0 h1:rw/HlhmUB3OktS/Ygz6+2XABOmHKzZpPUu github.com/libp2p/go-libp2p-circuit v0.6.0/go.mod h1:kB8hY+zCpMeScyvFrKrGicRdid6vNXbunKE4rXATZ0M= github.com/libp2p/go-libp2p-connmgr v0.2.4 h1:TMS0vc0TCBomtQJyWr7fYxcVYYhx+q/2gF++G5Jkl/w= github.com/libp2p/go-libp2p-connmgr v0.2.4/go.mod h1:YV0b/RIm8NGPnnNWM7hG9Q38OeQiQfKhHCCs1++ufn0= +github.com/libp2p/go-libp2p-core v0.0.1/go.mod h1:g/VxnTZ/1ygHxH3dKok7Vno1VfpvGcGip57wjTU4fco= github.com/libp2p/go-libp2p-core v0.2.0/go.mod h1:X0eyB0Gy93v0DZtSYbEM7RnMChm9Uv3j7yRXjO77xSI= github.com/libp2p/go-libp2p-core v0.3.0/go.mod h1:ACp3DmS3/N64c2jDzcV429ukDpicbL6+TrrxANBjPGw= github.com/libp2p/go-libp2p-core v0.5.0/go.mod h1:49XGI+kc38oGVwqSBhDEwytaAxgZasHhFfQKibzTls0= @@ -599,34 +589,54 @@ github.com/libp2p/go-libp2p-core v0.12.0/go.mod h1:ECdxehoYosLYHgDDFa2N4yE8Y7aQR github.com/libp2p/go-libp2p-core v0.14.0/go.mod h1:tLasfcVdTXnixsLB0QYaT1syJOhsbrhG7q6pGrHtBg8= github.com/libp2p/go-libp2p-core v0.15.0 h1:hKpgy/bRVwO7Ah5x9u92Vo+gogAaOolafZF5kW0rVm0= github.com/libp2p/go-libp2p-core v0.15.0/go.mod h1:agSaboYM4hzB1cWekgVReqV5M4g5M+2eNNejV+1EEhs= +github.com/libp2p/go-libp2p-crypto v0.1.0 h1:k9MFy+o2zGDNGsaoZl0MA3iZ75qXxr9OOoAZF+sD5OQ= +github.com/libp2p/go-libp2p-crypto v0.1.0/go.mod h1:sPUokVISZiy+nNuTTH/TY+leRSxnFj/2GLjtOTW90hI= github.com/libp2p/go-libp2p-discovery v0.6.0 h1:1XdPmhMJr8Tmj/yUfkJMIi8mgwWrLUsCB3bMxdT+DSo= github.com/libp2p/go-libp2p-discovery v0.6.0/go.mod h1:/u1voHt0tKIe5oIA1RHBKQLVCWPna2dXmPNHc2zR9S8= +github.com/libp2p/go-libp2p-host v0.1.0 h1:OZwENiFm6JOK3YR5PZJxkXlJE8a5u8g4YvAUrEV2MjM= +github.com/libp2p/go-libp2p-host v0.1.0/go.mod h1:5+fWuLbDn8OxoxPN3CV0vsLe1hAKScSMbT84qRfxum8= +github.com/libp2p/go-libp2p-interface-connmgr v0.1.0 h1:dFYeUNi5NjKIAVE+yQJULS99CovMUx9p/IgxI+2e+uc= +github.com/libp2p/go-libp2p-interface-connmgr v0.1.0/go.mod h1:bmmppYG/Bc6FTdLYEdpuSfifDa5Nr+5Ia1Mm6lE2+Eg= +github.com/libp2p/go-libp2p-interface-pnet v0.1.0 h1:PaofJtuDcrGBukgTymiGyuI313nxARRQFmE/oxZXlog= +github.com/libp2p/go-libp2p-interface-pnet v0.1.0/go.mod h1:8+FQ08+xMxR6BjG0tUZoQzKxPAV2W7ck6IxjCWqZ6ek= github.com/libp2p/go-libp2p-kbucket v0.4.7 h1:spZAcgxifvFZHBD8tErvppbnNiKA5uokDu3CV7axu70= github.com/libp2p/go-libp2p-kbucket v0.4.7/go.mod h1:XyVo99AfQH0foSf176k4jY1xUJ2+jUJIZCSDm7r2YKk= +github.com/libp2p/go-libp2p-loggables v0.1.0 h1:h3w8QFfCt2UJl/0/NW4K829HX/0S4KD31PQ7m8UXXO8= +github.com/libp2p/go-libp2p-loggables v0.1.0/go.mod h1:EyumB2Y6PrYjr55Q3/tiJ/o3xoDasoRYM7nOzEpoa90= +github.com/libp2p/go-libp2p-metrics v0.1.0 h1:v7YMUTHNobFaQeqaMfJJMbnK3EPlZeb6/KFm4gE9dks= +github.com/libp2p/go-libp2p-metrics v0.1.0/go.mod h1:rpoJmXWFxnj7qs5sJ02sxSzrhaZvpqBn8GCG6Sx6E1k= github.com/libp2p/go-libp2p-mplex v0.4.1/go.mod h1:cmy+3GfqfM1PceHTLL7zQzAAYaryDu6iPSC+CIb094g= github.com/libp2p/go-libp2p-mplex v0.5.0 h1:vt3k4E4HSND9XH4Z8rUpacPJFSAgLOv6HDvG8W9Ks9E= github.com/libp2p/go-libp2p-mplex v0.5.0/go.mod h1:eLImPJLkj3iG5t5lq68w3Vm5NAQ5BcKwrrb2VmOYb3M= github.com/libp2p/go-libp2p-nat v0.1.0 h1:vigUi2MEN+fwghe5ijpScxtbbDz+L/6y8XwlzYOJgSY= github.com/libp2p/go-libp2p-nat v0.1.0/go.mod h1:DQzAG+QbDYjN1/C3B6vXucLtz3u9rEonLVPtZVzQqks= +github.com/libp2p/go-libp2p-net v0.1.0 h1:3t23V5cR4GXcNoFriNoZKFdUZEUDZgUkvfwkD2INvQE= +github.com/libp2p/go-libp2p-net v0.1.0/go.mod h1:R5VZbutk75tkC5YJJS61OCO1NWoajxYjCEV2RoHh3FY= github.com/libp2p/go-libp2p-noise v0.3.0 h1:NCVH7evhVt9njbTQshzT7N1S3Q6fjj9M11FCgfH5+cA= github.com/libp2p/go-libp2p-noise v0.3.0/go.mod h1:JNjHbociDJKHD64KTkzGnzqJ0FEV5gHJa6AB00kbCNQ= +github.com/libp2p/go-libp2p-peer v0.2.0 h1:EQ8kMjaCUwt/Y5uLgjT8iY2qg0mGUT0N1zUjer50DsY= +github.com/libp2p/go-libp2p-peer v0.2.0/go.mod h1:RCffaCvUyW2CJmG2gAWVqwePwW7JMgxjsHm7+J5kjWY= github.com/libp2p/go-libp2p-peerstore v0.2.6/go.mod h1:ss/TWTgHZTMpsU/oKVVPQCGuDHItOpf2W8RxAi50P2s= github.com/libp2p/go-libp2p-peerstore v0.4.0/go.mod h1:rDJUFyzEWPpXpEwywkcTYYzDHlwza8riYMaUzaN6hX0= github.com/libp2p/go-libp2p-peerstore v0.6.0 h1:HJminhQSGISBIRb93N6WK3t6Fa8OOTnHd/VBjL4mY5A= github.com/libp2p/go-libp2p-peerstore v0.6.0/go.mod h1:DGEmKdXrcYpK9Jha3sS7MhqYdInxJy84bIPtSu65bKc= github.com/libp2p/go-libp2p-pnet v0.2.0 h1:J6htxttBipJujEjz1y0a5+eYoiPcFHhSYHH6na5f0/k= github.com/libp2p/go-libp2p-pnet v0.2.0/go.mod h1:Qqvq6JH/oMZGwqs3N1Fqhv8NVhrdYcO0BW4wssv21LA= +github.com/libp2p/go-libp2p-protocol v0.1.0 h1:HdqhEyhg0ToCaxgMhnOmUO8snQtt/kQlcjVk3UoJU3c= +github.com/libp2p/go-libp2p-protocol v0.1.0/go.mod h1:KQPHpAabB57XQxGrXCNvbL6UEXfQqUgC/1adR2Xtflk= github.com/libp2p/go-libp2p-pubsub v0.6.1 h1:wycbV+f4rreCoVY61Do6g/BUk0RIrbNRcYVbn+QkjGk= github.com/libp2p/go-libp2p-pubsub v0.6.1/go.mod h1:nJv87QM2cU0w45KPR1rZicq+FmFIOD16zmT+ep1nOmg= github.com/libp2p/go-libp2p-quic-transport v0.13.0/go.mod h1:39/ZWJ1TW/jx1iFkKzzUg00W6tDJh73FC0xYudjr7Hc= github.com/libp2p/go-libp2p-quic-transport v0.16.0 h1:aVg9/jr+R2esov5sH7wkXrmYmqJiUjtLMLYX3L9KYdY= github.com/libp2p/go-libp2p-quic-transport v0.16.0/go.mod h1:1BXjVMzr+w7EkPfiHkKnwsWjPjtfaNT0q8RS3tGDvEQ= -github.com/libp2p/go-libp2p-resource-manager v0.1.2 h1:t66B/6EF6ivWEUgvO34NKOT3oPtkb+JTBJHdsIMx+mg= -github.com/libp2p/go-libp2p-resource-manager v0.1.2/go.mod h1:wJPNjeE4XQlxeidwqVY5G6DLOKqFK33u2n8blpl0I6Y= +github.com/libp2p/go-libp2p-secio v0.2.3 h1:I5XCkgHtqP3p3Z1EjXKkCdQsSHtWW0YiiNro7/a3H8Y= +github.com/libp2p/go-libp2p-secio v0.2.3/go.mod h1:wP3bS+m5AUnFA+OFO7Er03uO1mncHG0uVwGrwvjYlNY= github.com/libp2p/go-libp2p-swarm v0.8.0/go.mod h1:sOMp6dPuqco0r0GHTzfVheVBh6UEL0L1lXUZ5ot2Fvc= github.com/libp2p/go-libp2p-swarm v0.10.0/go.mod h1:71ceMcV6Rg/0rIQ97rsZWMzto1l9LnNquef+efcRbmA= github.com/libp2p/go-libp2p-swarm v0.10.1 h1:lXW3pgGt+BVmkzcFX61erX7l6Lt+WAamNhwa2Kf3eJM= github.com/libp2p/go-libp2p-swarm v0.10.1/go.mod h1:Pdkq0QU5a+qu+oyqIV3bknMsnzk9lnNyKvB9acJ5aZs= +github.com/libp2p/go-libp2p-testing v0.0.1/go.mod h1:gvchhf3FQOtBdr+eFUABet5a4MBLK8jM3V4Zghvmi+E= +github.com/libp2p/go-libp2p-testing v0.0.2/go.mod h1:gvchhf3FQOtBdr+eFUABet5a4MBLK8jM3V4Zghvmi+E= github.com/libp2p/go-libp2p-testing v0.1.1/go.mod h1:xaZWMJrPUM5GlDBxCeGUi7kI4eqnjVyavGroI2nxEM0= github.com/libp2p/go-libp2p-testing v0.1.2-0.20200422005655-8775583591d8/go.mod h1:Qy8sAncLKpwXtS2dSnDOP8ktexIAHKu+J+pnZOFZLTc= github.com/libp2p/go-libp2p-testing v0.4.0/go.mod h1:Q+PFXYoiYFN5CAEG2w3gLPEzotlKsNSbKQ/lImlOWF0= @@ -636,6 +646,8 @@ github.com/libp2p/go-libp2p-testing v0.7.0/go.mod h1:OLbdn9DbgdMwv00v+tlp1l3oe2C github.com/libp2p/go-libp2p-tls v0.3.0/go.mod h1:fwF5X6PWGxm6IDRwF3V8AVCCj/hOd5oFlg+wo2FxJDY= github.com/libp2p/go-libp2p-tls v0.3.1 h1:lsE2zYte+rZCEOHF72J1Fg3XK3dGQyKvI6i5ehJfEp0= github.com/libp2p/go-libp2p-tls v0.3.1/go.mod h1:fwF5X6PWGxm6IDRwF3V8AVCCj/hOd5oFlg+wo2FxJDY= +github.com/libp2p/go-libp2p-transport v0.1.0 h1:q68SOTvX+71mk+n5eE3+FnUEPY5UL1CSFImH0bq0Vg8= +github.com/libp2p/go-libp2p-transport v0.1.0/go.mod h1:iL3c2tV3OVldqSwJrds8pmIWf4t/TwiF+eI/mhw/jjQ= github.com/libp2p/go-libp2p-transport-upgrader v0.5.0/go.mod h1:Rc+XODlB3yce7dvFV4q/RmyJGsFcCZRkeZMu/Zdg0mo= github.com/libp2p/go-libp2p-transport-upgrader v0.7.0 h1:ADnLrL7fC4Vy7HPjk9oGof7nDeTqGXuof85Ar6kin9Q= github.com/libp2p/go-libp2p-transport-upgrader v0.7.0/go.mod h1:GIR2aTRp1J5yjVlkUoFqMkdobfob6RnAwYg/RZPhrzg= @@ -643,6 +655,7 @@ github.com/libp2p/go-libp2p-yamux v0.5.0/go.mod h1:AyR8k5EzyM2QN9Bbdg6X1SkVVuqLw github.com/libp2p/go-libp2p-yamux v0.8.0/go.mod h1:yTkPgN2ib8FHyU1ZcVD7aelzyAqXXwEPbyx+aSKm9h8= github.com/libp2p/go-libp2p-yamux v0.8.1 h1:pi7zUeZ4Z9TpbUMntvSvoP3dFD4SEw/VPybxBcOZGzg= github.com/libp2p/go-libp2p-yamux v0.8.1/go.mod h1:rUozF8Jah2dL9LLGyBaBeTQeARdwhefMCTQVQt6QobE= +github.com/libp2p/go-maddr-filter v0.1.0 h1:4ACqZKw8AqiuJfwFGq1CYDFugfXTOos+qQ3DETkhtCE= github.com/libp2p/go-maddr-filter v0.1.0/go.mod h1:VzZhTXkMucEGGEOSKddrwGiOv0tUhgnKqNEmIAz/bPU= github.com/libp2p/go-mplex v0.3.0/go.mod h1:0Oy/A9PQlwBytDRp4wSkFnzHYDKcpLot35JQ6msjvYQ= github.com/libp2p/go-mplex v0.4.0 h1:Ukkez9/4EOX5rTw4sHefNJp10dksftAA05ZgyjplUbM= @@ -668,12 +681,16 @@ github.com/libp2p/go-reuseport-transport v0.1.0 h1:C3PHeHjmnz8m6f0uydObj02tMEoi7 github.com/libp2p/go-reuseport-transport v0.1.0/go.mod h1:vev0C0uMkzriDY59yFHD9v+ujJvYmDQVLowvAjEOmfw= github.com/libp2p/go-sockaddr v0.0.2/go.mod h1:syPvOmNs24S3dFVGJA1/mrqdeijPxLV2Le3BRLKd68k= github.com/libp2p/go-sockaddr v0.1.0/go.mod h1:syPvOmNs24S3dFVGJA1/mrqdeijPxLV2Le3BRLKd68k= +github.com/libp2p/go-stream-muxer v0.1.0 h1:3ToDXUzx8pDC6RfuOzGsUYP5roMDthbUKRdMRRhqAqY= +github.com/libp2p/go-stream-muxer v0.1.0/go.mod h1:8JAVsjeRBCWwPoZeH0W1imLOcriqXJyFvB0mR4A04sQ= github.com/libp2p/go-stream-muxer-multistream v0.3.0/go.mod h1:yDh8abSIzmZtqtOt64gFJUXEryejzNb0lisTt+fAMJA= github.com/libp2p/go-stream-muxer-multistream v0.4.0 h1:HsM/9OdtqnIzjVXcxTXjmqKrj3gJ8kacaOJwJS1ipaY= github.com/libp2p/go-stream-muxer-multistream v0.4.0/go.mod h1:nb+dGViZleRP4XcyHuZSVrJCBl55nRBOMmiSL/dyziw= github.com/libp2p/go-tcp-transport v0.4.0/go.mod h1:0y52Rwrn4076xdJYu/51/qJIdxz+EWDAOG2S45sV3VI= github.com/libp2p/go-tcp-transport v0.5.0 h1:3ZPW8HAuyRAuFzyabE0hSrCXKKSWzROnZZX7DtcIatY= github.com/libp2p/go-tcp-transport v0.5.0/go.mod h1:UPPL0DIjQqiWRwVAb+CEQlaAG0rp/mCqJfIhFcLHc4Y= +github.com/libp2p/go-testutil v0.1.0 h1:4QhjaWGO89udplblLVpgGDOQjzFlRavZOjuEnz2rLMc= +github.com/libp2p/go-testutil v0.1.0/go.mod h1:81b2n5HypcVyrCg/MJx4Wgfp/VHojytjVe/gLzZ2Ehc= github.com/libp2p/go-ws-transport v0.6.0 h1:326XBL6Q+5CQ2KtjXz32+eGu02W/Kz2+Fm4SpXdr0q4= github.com/libp2p/go-ws-transport v0.6.0/go.mod h1:dXqtI9e2JV9FtF1NOtWVZSKXh5zXvnuwPXfj8GPBbYU= github.com/libp2p/go-yamux v1.4.1 h1:P1Fe9vF4th5JOxxgQvfbOHkrGqIZniTLf+ddhZp8YTI= @@ -681,7 +698,6 @@ github.com/libp2p/go-yamux v1.4.1/go.mod h1:fr7aVgmdNGJK+N1g+b6DW6VxzbRCjCOejR/h github.com/libp2p/go-yamux/v3 v3.0.1/go.mod h1:s2LsDhHbh+RfCsQoICSYt58U2f8ijtPANFD8BmE74Bo= github.com/libp2p/go-yamux/v3 v3.0.2 h1:LW0q5+A1Wy0npEsPJP9wmare2NH4ohNluN5EWVwv2mE= github.com/libp2p/go-yamux/v3 v3.0.2/go.mod h1:s2LsDhHbh+RfCsQoICSYt58U2f8ijtPANFD8BmE74Bo= -github.com/libp2p/zeroconf/v2 v2.1.1/go.mod h1:fuJqLnUwZTshS3U/bMRJ3+ow/v9oid1n0DmyYyNO1Xs= github.com/lightstep/lightstep-tracer-common/golang/gogo v0.0.0-20190605223551-bc2310a04743/go.mod h1:qklhhLq1aX+mtWk9cPHPzaBjWImj5ULL6C7HFJtXQMM= github.com/lightstep/lightstep-tracer-go v0.18.1/go.mod h1:jlF1pusYV4pidLvZ+XD0UBX0ZE6WURAspgAczcDHrL4= github.com/lucas-clemente/quic-go v0.23.0/go.mod h1:paZuzjXCE5mj6sikVLMvqXk8lJV2AsqtJ6bDhjEfxx0= @@ -776,6 +792,7 @@ github.com/modern-go/reflect2 v0.0.0-20180701023420-4b7aa43c6742/go.mod h1:bx2lN github.com/modern-go/reflect2 v1.0.1/go.mod h1:bx2lNnkwVCuqBIxFjflWJWanXIb3RllmbCylyMrvgv0= github.com/modern-go/reflect2 v1.0.2/go.mod h1:yWuevngMOJpCy52FWWMvUC8ws7m/LJsjYzDa0/r8luk= github.com/mr-tron/base58 v1.1.0/go.mod h1:xcD2VGqlgYjBdcBLw+TuYLr8afG+Hj8g2eTVqeSzSU8= +github.com/mr-tron/base58 v1.1.1/go.mod h1:xcD2VGqlgYjBdcBLw+TuYLr8afG+Hj8g2eTVqeSzSU8= github.com/mr-tron/base58 v1.1.2/go.mod h1:BinMc/sQntlIE1frQmRFPUoPA1Zkr8VRgBdjWI2mNwc= github.com/mr-tron/base58 v1.1.3/go.mod h1:BinMc/sQntlIE1frQmRFPUoPA1Zkr8VRgBdjWI2mNwc= github.com/mr-tron/base58 v1.2.0 h1:T/HDJBh4ZCPbU39/+c3rRvE0uKBQlU27+QI8LJ4t64o= @@ -785,6 +802,7 @@ github.com/multiformats/go-base32 v0.0.4 h1:+qMh4a2f37b4xTNs6mqitDinryCI+tfO2dRV github.com/multiformats/go-base32 v0.0.4/go.mod h1:jNLFzjPZtp3aIARHbJRZIaPuspdH0J6q39uUM5pnABM= github.com/multiformats/go-base36 v0.1.0 h1:JR6TyF7JjGd3m6FbLU2cOxhC0Li8z8dLNGQ89tUg4F4= github.com/multiformats/go-base36 v0.1.0/go.mod h1:kFGE83c6s80PklsHO9sRn2NCoffoRdUUOENyW/Vv6sM= +github.com/multiformats/go-multiaddr v0.0.2/go.mod h1:xKVEak1K9cS1VdmPZW3LSIb6lgmoS58qz/pzqmAxV44= github.com/multiformats/go-multiaddr v0.0.4/go.mod h1:xKVEak1K9cS1VdmPZW3LSIb6lgmoS58qz/pzqmAxV44= github.com/multiformats/go-multiaddr v0.1.1/go.mod h1:aMKBKNEYmzmDmxfX88/vz+J5IU55txyt0p4aiWVohjo= github.com/multiformats/go-multiaddr v0.2.0/go.mod h1:0nO36NvPpyV4QzvTLi/lafl2y95ncPj0vFwVF6k6wJ4= @@ -876,8 +894,6 @@ github.com/opencontainers/image-spec v1.0.1 h1:JMemWkRwHx4Zj+fVxWoMCFm/8sYGGrUVo github.com/opencontainers/image-spec v1.0.1/go.mod h1:BtxoFyWECRxE4U/7sNtV5W15zMzWCbyJoFRP3s7yZA0= github.com/opencontainers/runc v0.1.1 h1:GlxAyO6x8rfZYN9Tt0Kti5a/cP41iuiO2yYT0IJGY8Y= github.com/opencontainers/runc v0.1.1/go.mod h1:qT5XzbpPznkRYVz/mWwUaVBUv2rmF59PVA73FjuZG0U= -github.com/opencontainers/runtime-spec v1.0.2 h1:UfAcuLBJB9Coz72x1hgl8O5RVzTdNiaglX6v2DM6FI0= -github.com/opencontainers/runtime-spec v1.0.2/go.mod h1:jwyrGlmzljRJv/Fgzds9SsS/C5hL+LL3ko9hs6T5lQ0= github.com/opentracing-contrib/go-observer v0.0.0-20170622124052-a52f23424492/go.mod h1:Ngi6UdF0k5OKD5t5wlmGhe/EDKPoUM3BXZSSfIuJbis= github.com/opentracing/basictracer-go v1.0.0/go.mod h1:QfBfYuafItcjQuMwinw9GhYKwFXS9KnPs5lxoYwgW74= github.com/opentracing/opentracing-go v1.0.2/go.mod h1:UkNAQd3GIcIGf0SeVgPpRdFStlNbqXla1AfSYxPUl2o= @@ -896,8 +912,6 @@ github.com/pact-foundation/pact-go v1.0.4/go.mod h1:uExwJY4kCzNPcHRj+hCR/HBbOOIw github.com/pascaldekloe/goe v0.0.0-20180627143212-57f6aae5913c/go.mod h1:lzWF7FIEvWOWxwDKqyGYQf6ZUaNfKdP144TG7ZOy1lc= github.com/pascaldekloe/goe v0.1.0 h1:cBOtyMzM9HTpWjXfbbunk26uA6nG3a8n06Wieeh0MwY= github.com/pascaldekloe/goe v0.1.0/go.mod h1:lzWF7FIEvWOWxwDKqyGYQf6ZUaNfKdP144TG7ZOy1lc= -github.com/pbnjay/memory v0.0.0-20210728143218-7b4eea64cf58 h1:onHthvaw9LFnH4t2DcNVpwGmV9E1BkGknEliJkfwQj0= -github.com/pbnjay/memory v0.0.0-20210728143218-7b4eea64cf58/go.mod h1:DXv8WO4yhMYhSNPKjeNKa5WY9YCIEBRbNzFFPJbWO6Y= github.com/pborman/uuid v1.2.0/go.mod h1:X/NO0urCmaxf9VXbdlT7C2Yzkj2IKimNn4k+gtPdI/k= github.com/pelletier/go-toml v1.2.0/go.mod h1:5z9KED0ma1S8pY6P1sdut58dfprrGBbd/94hg7ilaic= github.com/performancecopilot/speed v3.0.0+incompatible/go.mod h1:/CLtqpZ5gBg1M9iaPbIdPPGyKcA8hKdoy6hAWba7Yac= @@ -957,10 +971,6 @@ github.com/prometheus/procfs v0.2.0/go.mod h1:lV6e/gmhEcM9IjHGsFOCxxuZ+z1YqCvr4O github.com/prometheus/procfs v0.6.0/go.mod h1:cz+aTbrPOrUb4q7XlbU9ygM+/jj0fzG6c1xBZuNvfVA= github.com/prometheus/procfs v0.7.3 h1:4jVXhlkAyzOScmCkXBTOLRLTz8EeU+eyjrwB/EPq0VU= github.com/prometheus/procfs v0.7.3/go.mod h1:cz+aTbrPOrUb4q7XlbU9ygM+/jj0fzG6c1xBZuNvfVA= -github.com/raulk/clock v1.1.0 h1:dpb29+UKMbLqiU/jqIJptgLR1nn23HLgMY0sTCDza5Y= -github.com/raulk/clock v1.1.0/go.mod h1:3MpVxdZ/ODBQDxbN+kzshf5OSZwPjtMDx6BBXBmOeY0= -github.com/raulk/go-watchdog v1.2.0 h1:konN75pw2BMmZ+AfuAm5rtFsWcJpKF3m02rKituuXNo= -github.com/raulk/go-watchdog v1.2.0/go.mod h1:lzSbAl5sh4rtI8tYHU01BWIDzgzqaQLj6RcA1i4mlqI= github.com/rcrowley/go-metrics v0.0.0-20181016184325-3113b8401b8a/go.mod h1:bCqnVzQkZxMG4s8nGwiZ5l3QUCyqpo9Y+/ZMZ9VjZe4= github.com/rogpeppe/fastuuid v0.0.0-20150106093220-6724a57986af/go.mod h1:XWv6SoW27p1b0cqNHllgS5HIMJraePCO15w5zCzIWYg= github.com/rogpeppe/fastuuid v1.2.0/go.mod h1:jVj6XXZzXRy/MSR5jhDC/2q6DgLz+nrA6LYCDYWNEvQ= @@ -1005,7 +1015,6 @@ github.com/sirupsen/logrus v1.2.0/go.mod h1:LxeOpSwHxABJmUn/MG1IvRgCAasNZTLOkJPx github.com/sirupsen/logrus v1.4.1/go.mod h1:ni0Sbl8bgC9z8RoU9G6nDWqqs/fq4eDPysMBDgk/93Q= github.com/sirupsen/logrus v1.4.2/go.mod h1:tLMulIdttU9McNUspp0xgXVQah82FyeX6MwdIuYE2rE= github.com/sirupsen/logrus v1.6.0/go.mod h1:7uNnSEd1DgxDLC74fIahvMZmmYsHGZGEOFrfsX/uA88= -github.com/sirupsen/logrus v1.7.0/go.mod h1:yWOB1SBYBC5VeMP7gHvWumXLIWorT60ONWic61uBYv0= github.com/sirupsen/logrus v1.8.1 h1:dJKuHgqk1NNQlqoA6BTlM1Wf9DOH3NBjQyu0h9+AZZE= github.com/sirupsen/logrus v1.8.1/go.mod h1:yWOB1SBYBC5VeMP7gHvWumXLIWorT60ONWic61uBYv0= github.com/smartystreets/assertions v0.0.0-20180927180507-b2de0cb4f26d/go.mod h1:OnSkiWE9lh6wB0YB77sQom3nweQdgAjqCqsofrRNTgc= @@ -1068,7 +1077,6 @@ github.com/umbracle/go-web3 v0.0.0-20220224145938-aaa1038c1b69 h1:SrIRL9SlfBp4nO github.com/umbracle/go-web3 v0.0.0-20220224145938-aaa1038c1b69/go.mod h1:Go3c6psJU9tbUhrYLuuKIWJrN0ntpoxucp4MlV56k4w= github.com/urfave/cli v1.20.0/go.mod h1:70zkFmudgCuE/ngEzBv17Jvp/497gISqfk5gWijbERA= github.com/urfave/cli v1.22.1/go.mod h1:Gos4lmkARVdJ6EkW0WaNv/tZAAMe9V7XWyB60NtXRu0= -github.com/urfave/cli v1.22.2/go.mod h1:Gos4lmkARVdJ6EkW0WaNv/tZAAMe9V7XWyB60NtXRu0= github.com/valyala/bytebufferpool v1.0.0 h1:GqA5TC/0021Y/b9FG4Oi9Mr3q7XYx6KllzawFIhcdPw= github.com/valyala/bytebufferpool v1.0.0/go.mod h1:6bBcMArwyJ5K/AmCkWv1jt77kVWyCJ6HpOuEn7z0Csc= github.com/valyala/fasthttp v1.4.0 h1:PuaTGZIw3mjYhhhbVbCQp8aciRZN9YdoB7MGX9Ko76A= @@ -1081,11 +1089,18 @@ github.com/viant/assertly v0.4.8/go.mod h1:aGifi++jvCrUaklKEKT0BU95igDNaqkvz+49u github.com/viant/toolbox v0.24.0/go.mod h1:OxMCG57V0PXuIP2HNQrtJf2CjqdmbrOx5EkMILuUhzM= github.com/whyrusleeping/go-keyspace v0.0.0-20160322163242-5b898ac5add1/go.mod h1:8UvriyWtv5Q5EOgjHaSseUEdkQfvwFv1I/In/O2M9gc= github.com/whyrusleeping/go-logging v0.0.0-20170515211332-0457bb6b88fc/go.mod h1:bopw91TMyo8J3tvftk8xmU2kPmlrt4nScJQZU2hE5EM= -github.com/whyrusleeping/mdns v0.0.0-20190826153040-b9b60ed33aa9/go.mod h1:j4l84WPFclQPj320J9gp0XwNKBb3U0zt5CBqjPp22G4= +github.com/whyrusleeping/go-smux-multiplex v3.0.16+incompatible h1:iqksILj8STw03EJQe7Laj4ubnw+ojOyik18cd5vPL1o= +github.com/whyrusleeping/go-smux-multiplex v3.0.16+incompatible/go.mod h1:34LEDbeKFZInPUrAG+bjuJmUXONGdEFW7XL0SpTY1y4= +github.com/whyrusleeping/go-smux-multistream v2.0.2+incompatible h1:BdYHctE9HJZLquG9tpTdwWcbG4FaX6tVKPGjCGgiVxo= +github.com/whyrusleeping/go-smux-multistream v2.0.2+incompatible/go.mod h1:dRWHHvc4HDQSHh9gbKEBbUZ+f2Q8iZTPG3UOGYODxSQ= +github.com/whyrusleeping/go-smux-yamux v2.0.9+incompatible h1:nVkExQ7pYlN9e45LcqTCOiDD0904fjtm0flnHZGbXkw= +github.com/whyrusleeping/go-smux-yamux v2.0.9+incompatible/go.mod h1:6qHUzBXUbB9MXmw3AUdB52L8sEb/hScCqOdW2kj/wuI= github.com/whyrusleeping/multiaddr-filter v0.0.0-20160516205228-e903e4adabd7 h1:E9S12nwJwEOXe2d6gT6qxdvqMnNq+VnSsKPgm2ZZNds= github.com/whyrusleeping/multiaddr-filter v0.0.0-20160516205228-e903e4adabd7/go.mod h1:X2c0RVCI1eSUFI8eLcY3c0423ykwiUdxLJtkDvruhjI= github.com/whyrusleeping/timecache v0.0.0-20160911033111-cfcb2f1abfee h1:lYbXeSvJi5zk5GLKVuid9TVjS9a0OmLIDKTfoZBL6Ow= github.com/whyrusleeping/timecache v0.0.0-20160911033111-cfcb2f1abfee/go.mod h1:m2aV4LZI4Aez7dP5PMyVKEHhUyEJ/RjmPEDOpDvudHg= +github.com/whyrusleeping/yamux v1.2.0 h1:PzUrk7/Z0g/N5V4/+DesmKXYcCToALgj+SbATgs0B34= +github.com/whyrusleeping/yamux v1.2.0/go.mod h1:Cgw3gpb4DrDZ1FrP/5pxg/cpiY54Gr5uCXwUylwi2GE= github.com/x-cray/logrus-prefixed-formatter v0.5.2/go.mod h1:2duySbKsL6M18s5GU7VPsoEPHyzalCE06qoARUCeBBE= github.com/xiang90/probing v0.0.0-20190116061207-43a291ad63a2/go.mod h1:UETIi67q53MR2AWcXfiuqkDkRtnGDLqkBTpCHuJHxtU= github.com/xordataexchange/crypt v0.0.3-0.20170626215501-b2862e3d0a77/go.mod h1:aYKd//L2LvnjZzWKhF00oedf4jCCReLcmhLdhm1A27Q= @@ -1148,6 +1163,8 @@ golang.org/x/crypto v0.0.0-20181029021203-45a5f77698d3/go.mod h1:6SG95UA2DQfeDnf golang.org/x/crypto v0.0.0-20181030102418-4d3f4d9ffa16/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4= golang.org/x/crypto v0.0.0-20181203042331-505ab145d0a9/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4= golang.org/x/crypto v0.0.0-20190211182817-74369b46fc67/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4= +golang.org/x/crypto v0.0.0-20190225124518-7f87c0fbb88b/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4= +golang.org/x/crypto v0.0.0-20190228161510-8dd112bcdc25/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= golang.org/x/crypto v0.0.0-20190313024323-a1f597ede03a/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= golang.org/x/crypto v0.0.0-20190426145343-a29dc8fdc734/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= @@ -1171,7 +1188,6 @@ golang.org/x/crypto v0.0.0-20210322153248-0c34fe9e7dc2/go.mod h1:T9bdIzuCu7OtxOm golang.org/x/crypto v0.0.0-20210506145944-38f3c27a63bf/go.mod h1:P+XmwS30IXTQdn5tA2iutPOUgjI07+tq3H3K9MVA1s8= golang.org/x/crypto v0.0.0-20210616213533-5ff15b29337e/go.mod h1:GvvjBRRGRdwPK5ydBHafDWAxML/pGHZbMvKqRZ5+Abc= golang.org/x/crypto v0.0.0-20210711020723-a769d52b0f97/go.mod h1:GvvjBRRGRdwPK5ydBHafDWAxML/pGHZbMvKqRZ5+Abc= -golang.org/x/crypto v0.0.0-20210813211128-0a44fdfbc16e/go.mod h1:GvvjBRRGRdwPK5ydBHafDWAxML/pGHZbMvKqRZ5+Abc= golang.org/x/crypto v0.0.0-20210915214749-c084706c2272/go.mod h1:GvvjBRRGRdwPK5ydBHafDWAxML/pGHZbMvKqRZ5+Abc= golang.org/x/crypto v0.0.0-20220214200702-86341886e292 h1:f+lwQ+GtmgoY+A2YaQxlSOnDjXcQ7ZRLWOHbC6HtRqE= golang.org/x/crypto v0.0.0-20220214200702-86341886e292/go.mod h1:IxCIyHEi3zRg3s0A5j5BB6A9Jmi73HwBIUl50j+osU4= @@ -1271,7 +1287,6 @@ golang.org/x/net v0.0.0-20210428140749-89ef3d95e781/go.mod h1:OJAsFXCWl8Ukc7SiCT golang.org/x/net v0.0.0-20210525063256-abc453219eb5/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y= golang.org/x/net v0.0.0-20210614182718-04defd469f4e/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y= golang.org/x/net v0.0.0-20210726213435-c6fcb2dbf985/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y= -golang.org/x/net v0.0.0-20210813160813-60bc85c4be6d/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y= golang.org/x/net v0.0.0-20210917221730-978cfadd31cf/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y= golang.org/x/net v0.0.0-20211015210444-4f30a5c0130f/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y= golang.org/x/net v0.0.0-20211112202133-69e39bad7dc2/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y= @@ -1298,7 +1313,6 @@ golang.org/x/sync v0.0.0-20201020160332-67f06af15bc9/go.mod h1:RxMgew5VJxzue5/jJ golang.org/x/sync v0.0.0-20201207232520-09787c993a3a/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20210220032951-036812b2e83c h1:5KslGYwFpkhGh+Q16bwMP3cOontH8FOep7tGV86Y7SQ= golang.org/x/sync v0.0.0-20210220032951-036812b2e83c/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= -golang.org/x/sys v0.0.0-20180810173357-98c5dad5d1a0/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20180823144017-11551d06cbcc/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20180830151530-49385e6e1522/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20180905080454-ebe1bf3edb33/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= @@ -1377,7 +1391,6 @@ golang.org/x/sys v0.0.0-20210511113859-b0526f3d8744/go.mod h1:oPkhp1MJrh7nUepCBc golang.org/x/sys v0.0.0-20210603081109-ebe580a85c40/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20210615035016-665e8c7367d1/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20210630005230-0f9fa26af87c/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.0.0-20210816183151-1e6c022a8912/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20210917161153-d61c044b1678/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20210927094055-39ccf1dd6fa6/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20211019181941-9d821ace8654/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= diff --git a/vendor/github.com/benbjohnson/clock/LICENSE b/vendor/github.com/benbjohnson/clock/LICENSE deleted file mode 100644 index ce212cb1ce..0000000000 --- a/vendor/github.com/benbjohnson/clock/LICENSE +++ /dev/null @@ -1,21 +0,0 @@ -The MIT License (MIT) - -Copyright (c) 2014 Ben Johnson - -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is -furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in all -copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -SOFTWARE. diff --git a/vendor/github.com/benbjohnson/clock/README.md b/vendor/github.com/benbjohnson/clock/README.md deleted file mode 100644 index 4f1f82fc6d..0000000000 --- a/vendor/github.com/benbjohnson/clock/README.md +++ /dev/null @@ -1,105 +0,0 @@ -clock -===== - -[![go.dev reference](https://img.shields.io/badge/go.dev-reference-007d9c?logo=go&logoColor=white&style=flat-square)](https://pkg.go.dev/mod/github.com/benbjohnson/clock) - -Clock is a small library for mocking time in Go. It provides an interface -around the standard library's [`time`][time] package so that the application -can use the realtime clock while tests can use the mock clock. - -The module is currently maintained by @djmitche. - -[time]: https://pkg.go.dev/github.com/benbjohnson/clock - -## Usage - -### Realtime Clock - -Your application can maintain a `Clock` variable that will allow realtime and -mock clocks to be interchangeable. For example, if you had an `Application` type: - -```go -import "github.com/benbjohnson/clock" - -type Application struct { - Clock clock.Clock -} -``` - -You could initialize it to use the realtime clock like this: - -```go -var app Application -app.Clock = clock.New() -... -``` - -Then all timers and time-related functionality should be performed from the -`Clock` variable. - - -### Mocking time - -In your tests, you will want to use a `Mock` clock: - -```go -import ( - "testing" - - "github.com/benbjohnson/clock" -) - -func TestApplication_DoSomething(t *testing.T) { - mock := clock.NewMock() - app := Application{Clock: mock} - ... -} -``` - -Now that you've initialized your application to use the mock clock, you can -adjust the time programmatically. The mock clock always starts from the Unix -epoch (midnight UTC on Jan 1, 1970). - - -### Controlling time - -The mock clock provides the same functions that the standard library's `time` -package provides. For example, to find the current time, you use the `Now()` -function: - -```go -mock := clock.NewMock() - -// Find the current time. -mock.Now().UTC() // 1970-01-01 00:00:00 +0000 UTC - -// Move the clock forward. -mock.Add(2 * time.Hour) - -// Check the time again. It's 2 hours later! -mock.Now().UTC() // 1970-01-01 02:00:00 +0000 UTC -``` - -Timers and Tickers are also controlled by this same mock clock. They will only -execute when the clock is moved forward: - -```go -mock := clock.NewMock() -count := 0 - -// Kick off a timer to increment every 1 mock second. -go func() { - ticker := mock.Ticker(1 * time.Second) - for { - <-ticker.C - count++ - } -}() -runtime.Gosched() - -// Move the clock forward 10 seconds. -mock.Add(10 * time.Second) - -// This prints 10. -fmt.Println(count) -``` diff --git a/vendor/github.com/benbjohnson/clock/clock.go b/vendor/github.com/benbjohnson/clock/clock.go deleted file mode 100644 index 40555b3037..0000000000 --- a/vendor/github.com/benbjohnson/clock/clock.go +++ /dev/null @@ -1,378 +0,0 @@ -package clock - -import ( - "context" - "sort" - "sync" - "time" -) - -// Re-export of time.Duration -type Duration = time.Duration - -// Clock represents an interface to the functions in the standard library time -// package. Two implementations are available in the clock package. The first -// is a real-time clock which simply wraps the time package's functions. The -// second is a mock clock which will only change when -// programmatically adjusted. -type Clock interface { - After(d time.Duration) <-chan time.Time - AfterFunc(d time.Duration, f func()) *Timer - Now() time.Time - Since(t time.Time) time.Duration - Until(t time.Time) time.Duration - Sleep(d time.Duration) - Tick(d time.Duration) <-chan time.Time - Ticker(d time.Duration) *Ticker - Timer(d time.Duration) *Timer - WithDeadline(parent context.Context, d time.Time) (context.Context, context.CancelFunc) - WithTimeout(parent context.Context, t time.Duration) (context.Context, context.CancelFunc) -} - -// New returns an instance of a real-time clock. -func New() Clock { - return &clock{} -} - -// clock implements a real-time clock by simply wrapping the time package functions. -type clock struct{} - -func (c *clock) After(d time.Duration) <-chan time.Time { return time.After(d) } - -func (c *clock) AfterFunc(d time.Duration, f func()) *Timer { - return &Timer{timer: time.AfterFunc(d, f)} -} - -func (c *clock) Now() time.Time { return time.Now() } - -func (c *clock) Since(t time.Time) time.Duration { return time.Since(t) } - -func (c *clock) Until(t time.Time) time.Duration { return time.Until(t) } - -func (c *clock) Sleep(d time.Duration) { time.Sleep(d) } - -func (c *clock) Tick(d time.Duration) <-chan time.Time { return time.Tick(d) } - -func (c *clock) Ticker(d time.Duration) *Ticker { - t := time.NewTicker(d) - return &Ticker{C: t.C, ticker: t} -} - -func (c *clock) Timer(d time.Duration) *Timer { - t := time.NewTimer(d) - return &Timer{C: t.C, timer: t} -} - -func (c *clock) WithDeadline(parent context.Context, d time.Time) (context.Context, context.CancelFunc) { - return context.WithDeadline(parent, d) -} - -func (c *clock) WithTimeout(parent context.Context, t time.Duration) (context.Context, context.CancelFunc) { - return context.WithTimeout(parent, t) -} - -// Mock represents a mock clock that only moves forward programmically. -// It can be preferable to a real-time clock when testing time-based functionality. -type Mock struct { - mu sync.Mutex - now time.Time // current time - timers clockTimers // tickers & timers -} - -// NewMock returns an instance of a mock clock. -// The current time of the mock clock on initialization is the Unix epoch. -func NewMock() *Mock { - return &Mock{now: time.Unix(0, 0)} -} - -// Add moves the current time of the mock clock forward by the specified duration. -// This should only be called from a single goroutine at a time. -func (m *Mock) Add(d time.Duration) { - // Calculate the final current time. - t := m.now.Add(d) - - // Continue to execute timers until there are no more before the new time. - for { - if !m.runNextTimer(t) { - break - } - } - - // Ensure that we end with the new time. - m.mu.Lock() - m.now = t - m.mu.Unlock() - - // Give a small buffer to make sure that other goroutines get handled. - gosched() -} - -// Set sets the current time of the mock clock to a specific one. -// This should only be called from a single goroutine at a time. -func (m *Mock) Set(t time.Time) { - // Continue to execute timers until there are no more before the new time. - for { - if !m.runNextTimer(t) { - break - } - } - - // Ensure that we end with the new time. - m.mu.Lock() - m.now = t - m.mu.Unlock() - - // Give a small buffer to make sure that other goroutines get handled. - gosched() -} - -// runNextTimer executes the next timer in chronological order and moves the -// current time to the timer's next tick time. The next time is not executed if -// its next time is after the max time. Returns true if a timer was executed. -func (m *Mock) runNextTimer(max time.Time) bool { - m.mu.Lock() - - // Sort timers by time. - sort.Sort(m.timers) - - // If we have no more timers then exit. - if len(m.timers) == 0 { - m.mu.Unlock() - return false - } - - // Retrieve next timer. Exit if next tick is after new time. - t := m.timers[0] - if t.Next().After(max) { - m.mu.Unlock() - return false - } - - // Move "now" forward and unlock clock. - m.now = t.Next() - m.mu.Unlock() - - // Execute timer. - t.Tick(m.now) - return true -} - -// After waits for the duration to elapse and then sends the current time on the returned channel. -func (m *Mock) After(d time.Duration) <-chan time.Time { - return m.Timer(d).C -} - -// AfterFunc waits for the duration to elapse and then executes a function. -// A Timer is returned that can be stopped. -func (m *Mock) AfterFunc(d time.Duration, f func()) *Timer { - t := m.Timer(d) - t.C = nil - t.fn = f - return t -} - -// Now returns the current wall time on the mock clock. -func (m *Mock) Now() time.Time { - m.mu.Lock() - defer m.mu.Unlock() - return m.now -} - -// Since returns time since `t` using the mock clock's wall time. -func (m *Mock) Since(t time.Time) time.Duration { - return m.Now().Sub(t) -} - -// Until returns time until `t` using the mock clock's wall time. -func (m *Mock) Until(t time.Time) time.Duration { - return t.Sub(m.Now()) -} - -// Sleep pauses the goroutine for the given duration on the mock clock. -// The clock must be moved forward in a separate goroutine. -func (m *Mock) Sleep(d time.Duration) { - <-m.After(d) -} - -// Tick is a convenience function for Ticker(). -// It will return a ticker channel that cannot be stopped. -func (m *Mock) Tick(d time.Duration) <-chan time.Time { - return m.Ticker(d).C -} - -// Ticker creates a new instance of Ticker. -func (m *Mock) Ticker(d time.Duration) *Ticker { - m.mu.Lock() - defer m.mu.Unlock() - ch := make(chan time.Time, 1) - t := &Ticker{ - C: ch, - c: ch, - mock: m, - d: d, - next: m.now.Add(d), - } - m.timers = append(m.timers, (*internalTicker)(t)) - return t -} - -// Timer creates a new instance of Timer. -func (m *Mock) Timer(d time.Duration) *Timer { - m.mu.Lock() - defer m.mu.Unlock() - ch := make(chan time.Time, 1) - t := &Timer{ - C: ch, - c: ch, - mock: m, - next: m.now.Add(d), - stopped: false, - } - m.timers = append(m.timers, (*internalTimer)(t)) - return t -} - -func (m *Mock) removeClockTimer(t clockTimer) { - for i, timer := range m.timers { - if timer == t { - copy(m.timers[i:], m.timers[i+1:]) - m.timers[len(m.timers)-1] = nil - m.timers = m.timers[:len(m.timers)-1] - break - } - } - sort.Sort(m.timers) -} - -// clockTimer represents an object with an associated start time. -type clockTimer interface { - Next() time.Time - Tick(time.Time) -} - -// clockTimers represents a list of sortable timers. -type clockTimers []clockTimer - -func (a clockTimers) Len() int { return len(a) } -func (a clockTimers) Swap(i, j int) { a[i], a[j] = a[j], a[i] } -func (a clockTimers) Less(i, j int) bool { return a[i].Next().Before(a[j].Next()) } - -// Timer represents a single event. -// The current time will be sent on C, unless the timer was created by AfterFunc. -type Timer struct { - C <-chan time.Time - c chan time.Time - timer *time.Timer // realtime impl, if set - next time.Time // next tick time - mock *Mock // mock clock, if set - fn func() // AfterFunc function, if set - stopped bool // True if stopped, false if running -} - -// Stop turns off the ticker. -func (t *Timer) Stop() bool { - if t.timer != nil { - return t.timer.Stop() - } - - t.mock.mu.Lock() - registered := !t.stopped - t.mock.removeClockTimer((*internalTimer)(t)) - t.stopped = true - t.mock.mu.Unlock() - return registered -} - -// Reset changes the expiry time of the timer -func (t *Timer) Reset(d time.Duration) bool { - if t.timer != nil { - return t.timer.Reset(d) - } - - t.mock.mu.Lock() - t.next = t.mock.now.Add(d) - defer t.mock.mu.Unlock() - - registered := !t.stopped - if t.stopped { - t.mock.timers = append(t.mock.timers, (*internalTimer)(t)) - } - - t.stopped = false - return registered -} - -type internalTimer Timer - -func (t *internalTimer) Next() time.Time { return t.next } -func (t *internalTimer) Tick(now time.Time) { - // a gosched() after ticking, to allow any consequences of the - // tick to complete - defer gosched() - - t.mock.mu.Lock() - if t.fn != nil { - // defer function execution until the lock is released, and - defer t.fn() - } else { - t.c <- now - } - t.mock.removeClockTimer((*internalTimer)(t)) - t.stopped = true - t.mock.mu.Unlock() -} - -// Ticker holds a channel that receives "ticks" at regular intervals. -type Ticker struct { - C <-chan time.Time - c chan time.Time - ticker *time.Ticker // realtime impl, if set - next time.Time // next tick time - mock *Mock // mock clock, if set - d time.Duration // time between ticks -} - -// Stop turns off the ticker. -func (t *Ticker) Stop() { - if t.ticker != nil { - t.ticker.Stop() - } else { - t.mock.mu.Lock() - t.mock.removeClockTimer((*internalTicker)(t)) - t.mock.mu.Unlock() - } -} - -// Reset resets the ticker to a new duration. -func (t *Ticker) Reset(dur time.Duration) { - if t.ticker != nil { - t.ticker.Reset(dur) - return - } - - t.mock.mu.Lock() - defer t.mock.mu.Unlock() - - t.d = dur - t.next = t.mock.now.Add(dur) -} - -type internalTicker Ticker - -func (t *internalTicker) Next() time.Time { return t.next } -func (t *internalTicker) Tick(now time.Time) { - select { - case t.c <- now: - default: - } - t.next = now.Add(t.d) - gosched() -} - -// Sleep momentarily so that other goroutines can process. -func gosched() { time.Sleep(1 * time.Millisecond) } - -var ( - // type checking - _ Clock = &Mock{} -) diff --git a/vendor/github.com/benbjohnson/clock/context.go b/vendor/github.com/benbjohnson/clock/context.go deleted file mode 100644 index eb67594f2c..0000000000 --- a/vendor/github.com/benbjohnson/clock/context.go +++ /dev/null @@ -1,86 +0,0 @@ -package clock - -import ( - "context" - "fmt" - "sync" - "time" -) - -func (m *Mock) WithTimeout(parent context.Context, timeout time.Duration) (context.Context, context.CancelFunc) { - return m.WithDeadline(parent, m.Now().Add(timeout)) -} - -func (m *Mock) WithDeadline(parent context.Context, deadline time.Time) (context.Context, context.CancelFunc) { - if cur, ok := parent.Deadline(); ok && cur.Before(deadline) { - // The current deadline is already sooner than the new one. - return context.WithCancel(parent) - } - ctx := &timerCtx{clock: m, parent: parent, deadline: deadline, done: make(chan struct{})} - propagateCancel(parent, ctx) - dur := m.Until(deadline) - if dur <= 0 { - ctx.cancel(context.DeadlineExceeded) // deadline has already passed - return ctx, func() {} - } - ctx.Lock() - defer ctx.Unlock() - if ctx.err == nil { - ctx.timer = m.AfterFunc(dur, func() { - ctx.cancel(context.DeadlineExceeded) - }) - } - return ctx, func() { ctx.cancel(context.Canceled) } -} - -// propagateCancel arranges for child to be canceled when parent is. -func propagateCancel(parent context.Context, child *timerCtx) { - if parent.Done() == nil { - return // parent is never canceled - } - go func() { - select { - case <-parent.Done(): - child.cancel(parent.Err()) - case <-child.Done(): - } - }() -} - -type timerCtx struct { - sync.Mutex - - clock Clock - parent context.Context - deadline time.Time - done chan struct{} - - err error - timer *Timer -} - -func (c *timerCtx) cancel(err error) { - c.Lock() - defer c.Unlock() - if c.err != nil { - return // already canceled - } - c.err = err - close(c.done) - if c.timer != nil { - c.timer.Stop() - c.timer = nil - } -} - -func (c *timerCtx) Deadline() (deadline time.Time, ok bool) { return c.deadline, true } - -func (c *timerCtx) Done() <-chan struct{} { return c.done } - -func (c *timerCtx) Err() error { return c.err } - -func (c *timerCtx) Value(key interface{}) interface{} { return c.parent.Value(key) } - -func (c *timerCtx) String() string { - return fmt.Sprintf("clock.WithDeadline(%s [%s])", c.deadline, c.deadline.Sub(c.clock.Now())) -} diff --git a/vendor/github.com/benbjohnson/clock/go.mod b/vendor/github.com/benbjohnson/clock/go.mod deleted file mode 100644 index 758903a683..0000000000 --- a/vendor/github.com/benbjohnson/clock/go.mod +++ /dev/null @@ -1,3 +0,0 @@ -module github.com/benbjohnson/clock - -go 1.15 diff --git a/vendor/github.com/cheekybits/genny/.gitignore b/vendor/github.com/cheekybits/genny/.gitignore deleted file mode 100644 index c62d148c2b..0000000000 --- a/vendor/github.com/cheekybits/genny/.gitignore +++ /dev/null @@ -1,26 +0,0 @@ -# Compiled Object files, Static and Dynamic libs (Shared Objects) -*.o -*.a -*.so - -# Folders -_obj -_test - -# Architecture specific extensions/prefixes -*.[568vq] -[568vq].out - -*.cgo1.go -*.cgo2.c -_cgo_defun.c -_cgo_gotypes.go -_cgo_export.* - -_testmain.go - -*.exe -*.test -*.prof - -genny diff --git a/vendor/github.com/cheekybits/genny/.travis.yml b/vendor/github.com/cheekybits/genny/.travis.yml deleted file mode 100644 index 78ba5f2d10..0000000000 --- a/vendor/github.com/cheekybits/genny/.travis.yml +++ /dev/null @@ -1,6 +0,0 @@ -language: go - -go: - - 1.7 - - 1.8 - - 1.9 diff --git a/vendor/github.com/cheekybits/genny/LICENSE b/vendor/github.com/cheekybits/genny/LICENSE deleted file mode 100644 index 519d7f2272..0000000000 --- a/vendor/github.com/cheekybits/genny/LICENSE +++ /dev/null @@ -1,22 +0,0 @@ -The MIT License (MIT) - -Copyright (c) 2014 cheekybits - -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is -furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in all -copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -SOFTWARE. - diff --git a/vendor/github.com/cheekybits/genny/README.md b/vendor/github.com/cheekybits/genny/README.md deleted file mode 100644 index 64a28ac724..0000000000 --- a/vendor/github.com/cheekybits/genny/README.md +++ /dev/null @@ -1,245 +0,0 @@ -# genny - Generics for Go - -[![Build Status](https://travis-ci.org/cheekybits/genny.svg?branch=master)](https://travis-ci.org/cheekybits/genny) [![GoDoc](https://godoc.org/github.com/cheekybits/genny/parse?status.png)](http://godoc.org/github.com/cheekybits/genny/parse) - -Install: - -``` -go get github.com/cheekybits/genny -``` - -===== - -(pron. Jenny) by Mat Ryer ([@matryer](https://twitter.com/matryer)) and Tyler Bunnell ([@TylerJBunnell](https://twitter.com/TylerJBunnell)). - -Until the Go core team include support for [generics in Go](http://golang.org/doc/faq#generics), `genny` is a code-generation generics solution. It allows you write normal buildable and testable Go code which, when processed by the `genny gen` tool, will replace the generics with specific types. - - * Generic code is valid Go code - * Generic code compiles and can be tested - * Use `stdin` and `stdout` or specify in and out files - * Supports Go 1.4's [go generate](http://tip.golang.org/doc/go1.4#gogenerate) - * Multiple specific types will generate every permutation - * Use `BUILTINS` and `NUMBERS` wildtype to generate specific code for all built-in (and number) Go types - * Function names and comments also get updated - -## Library - -We have started building a [library of common things](https://github.com/cheekybits/gennylib), and you can use `genny get` to generate the specific versions you need. - -For example: `genny get maps/concurrentmap.go "KeyType=BUILTINS ValueType=BUILTINS"` will print out generated code for all types for a concurrent map. Any file in the library may be generated locally in this way using all the same options given to `genny gen`. - -## Usage - -``` -genny [{flags}] gen "{types}" - -gen - generates type specific code from generic code. -get - fetch a generic template from the online library and gen it. - -{flags} - (optional) Command line flags (see below) -{types} - (required) Specific types for each generic type in the source -{types} format: {generic}={specific}[,another][ {generic2}={specific2}] - -Examples: - Generic=Specific - Generic1=Specific1 Generic2=Specific2 - Generic1=Specific1,Specific2 Generic2=Specific3,Specific4 - -Flags: - -in="": file to parse instead of stdin - -out="": file to save output to instead of stdout - -pkg="": package name for generated files -``` - - * Comma separated type lists will generate code for each type - -### Flags - - * `-in` - specify the input file (rather than using stdin) - * `-out` - specify the output file (rather than using stdout) - -### go generate - -To use Go 1.4's `go generate` capability, insert the following comment in your source code file: - -``` -//go:generate genny -in=$GOFILE -out=gen-$GOFILE gen "KeyType=string,int ValueType=string,int" -``` - - * Start the line with `//go:generate ` - * Use the `-in` and `-out` flags to specify the files to work on - * Use the `genny` command as usual after the flags - -Now, running `go generate` (in a shell) for the package will cause the generic versions of the files to be generated. - - * The output file will be overwritten, so it's safe to call `go generate` many times - * Use `$GOFILE` to refer to the current file - * The `//go:generate` line will be removed from the output - -To see a real example of how to use `genny` with `go generate`, look in the [example/go-generate directory](https://github.com/cheekybits/genny/tree/master/examples/go-generate). - -## How it works - -Define your generic types using the special `generic.Type` placeholder type: - -```go -type KeyType generic.Type -type ValueType generic.Type -``` - - * You can use as many as you like - * Give them meaningful names - -Then write the generic code referencing the types as your normally would: - -```go -func SetValueTypeForKeyType(key KeyType, value ValueType) { /* ... */ } -``` - - * Generic type names will also be replaced in comments and function names (see Real example below) - -Since `generic.Type` is a real Go type, your code will compile, and you can even write unit tests against your generic code. - -#### Generating specific versions - -Pass the file through the `genny gen` tool with the specific types as the argument: - -``` -cat generic.go | genny gen "KeyType=string ValueType=interface{}" -``` - -The output will be the complete Go source file with the generic types replaced with the types specified in the arguments. - -## Real example - -Given [this generic Go code](https://github.com/cheekybits/genny/tree/master/examples/queue) which compiles and is tested: - -```go -package queue - -import "github.com/cheekybits/genny/generic" - -// NOTE: this is how easy it is to define a generic type -type Something generic.Type - -// SomethingQueue is a queue of Somethings. -type SomethingQueue struct { - items []Something -} - -func NewSomethingQueue() *SomethingQueue { - return &SomethingQueue{items: make([]Something, 0)} -} -func (q *SomethingQueue) Push(item Something) { - q.items = append(q.items, item) -} -func (q *SomethingQueue) Pop() Something { - item := q.items[0] - q.items = q.items[1:] - return item -} -``` - -When `genny gen` is invoked like this: - -``` -cat source.go | genny gen "Something=string" -``` - -It outputs: - -```go -// This file was automatically generated by genny. -// Any changes will be lost if this file is regenerated. -// see https://github.com/cheekybits/genny - -package queue - -// StringQueue is a queue of Strings. -type StringQueue struct { - items []string -} - -func NewStringQueue() *StringQueue { - return &StringQueue{items: make([]string, 0)} -} -func (q *StringQueue) Push(item string) { - q.items = append(q.items, item) -} -func (q *StringQueue) Pop() string { - item := q.items[0] - q.items = q.items[1:] - return item -} -``` - -To get a _something_ for every built-in Go type plus one of your own types, you could run: - -``` -cat source.go | genny gen "Something=BUILTINS,*MyType" -``` - -#### More examples - -Check out the [test code files](https://github.com/cheekybits/genny/tree/master/parse/test) for more real examples. - -## Writing test code - -Once you have defined a generic type with some code worth testing: - -```go -package slice - -import ( - "log" - "reflect" - - "github.com/stretchr/gogen/generic" -) - -type MyType generic.Type - -func EnsureMyTypeSlice(objectOrSlice interface{}) []MyType { - log.Printf("%v", reflect.TypeOf(objectOrSlice)) - switch obj := objectOrSlice.(type) { - case []MyType: - log.Println(" returning it untouched") - return obj - case MyType: - log.Println(" wrapping in slice") - return []MyType{obj} - default: - panic("ensure slice needs MyType or []MyType") - } -} -``` - -You can treat it like any normal Go type in your test code: - -```go -func TestEnsureMyTypeSlice(t *testing.T) { - - myType := new(MyType) - slice := EnsureMyTypeSlice(myType) - if assert.NotNil(t, slice) { - assert.Equal(t, slice[0], myType) - } - - slice = EnsureMyTypeSlice(slice) - log.Printf("%#v", slice[0]) - if assert.NotNil(t, slice) { - assert.Equal(t, slice[0], myType) - } - -} -``` - -### Understanding what `generic.Type` is - -Because `generic.Type` is an empty interface type (literally `interface{}`) every other type will be considered to be a `generic.Type` if you are switching on the type of an object. Of course, once the specific versions are generated, this issue goes away but it's worth knowing when you are writing your tests against generic code. - -### Contributions - - * See the [API documentation for the parse package](http://godoc.org/github.com/cheekybits/genny/parse) - * Please do TDD - * All input welcome diff --git a/vendor/github.com/cheekybits/genny/doc.go b/vendor/github.com/cheekybits/genny/doc.go deleted file mode 100644 index 4c31e22bc4..0000000000 --- a/vendor/github.com/cheekybits/genny/doc.go +++ /dev/null @@ -1,2 +0,0 @@ -// Package main is the command line tool for Genny. -package main diff --git a/vendor/github.com/cheekybits/genny/generic/doc.go b/vendor/github.com/cheekybits/genny/generic/doc.go deleted file mode 100644 index 3bd6c869c0..0000000000 --- a/vendor/github.com/cheekybits/genny/generic/doc.go +++ /dev/null @@ -1,2 +0,0 @@ -// Package generic contains the generic marker types. -package generic diff --git a/vendor/github.com/cheekybits/genny/generic/generic.go b/vendor/github.com/cheekybits/genny/generic/generic.go deleted file mode 100644 index 04a2306cbf..0000000000 --- a/vendor/github.com/cheekybits/genny/generic/generic.go +++ /dev/null @@ -1,13 +0,0 @@ -package generic - -// Type is the placeholder type that indicates a generic value. -// When genny is executed, variables of this type will be replaced with -// references to the specific types. -// var GenericType generic.Type -type Type interface{} - -// Number is the placehoder type that indiccates a generic numerical value. -// When genny is executed, variables of this type will be replaced with -// references to the specific types. -// var GenericType generic.Number -type Number float64 diff --git a/vendor/github.com/cheekybits/genny/main.go b/vendor/github.com/cheekybits/genny/main.go deleted file mode 100644 index fe06a6c034..0000000000 --- a/vendor/github.com/cheekybits/genny/main.go +++ /dev/null @@ -1,154 +0,0 @@ -package main - -import ( - "bytes" - "flag" - "fmt" - "io" - "io/ioutil" - "net/http" - "os" - "strings" - - "github.com/cheekybits/genny/out" - "github.com/cheekybits/genny/parse" -) - -/* - - source | genny gen [-in=""] [-out=""] [-pkg=""] "KeyType=string,int ValueType=string,int" - -*/ - -const ( - _ = iota - exitcodeInvalidArgs - exitcodeInvalidTypeSet - exitcodeStdinFailed - exitcodeGenFailed - exitcodeGetFailed - exitcodeSourceFileInvalid - exitcodeDestFileFailed -) - -func main() { - var ( - in = flag.String("in", "", "file to parse instead of stdin") - out = flag.String("out", "", "file to save output to instead of stdout") - pkgName = flag.String("pkg", "", "package name for generated files") - prefix = "https://github.com/metabition/gennylib/raw/master/" - ) - flag.Parse() - args := flag.Args() - - if len(args) < 2 { - usage() - os.Exit(exitcodeInvalidArgs) - } - - if strings.ToLower(args[0]) != "gen" && strings.ToLower(args[0]) != "get" { - usage() - os.Exit(exitcodeInvalidArgs) - } - - // parse the typesets - var setsArg = args[1] - if strings.ToLower(args[0]) == "get" { - setsArg = args[2] - } - typeSets, err := parse.TypeSet(setsArg) - if err != nil { - fatal(exitcodeInvalidTypeSet, err) - } - - outWriter := newWriter(*out) - - if strings.ToLower(args[0]) == "get" { - if len(args) != 3 { - fmt.Println("not enough arguments to get") - usage() - os.Exit(exitcodeInvalidArgs) - } - r, err := http.Get(prefix + args[1]) - if err != nil { - fatal(exitcodeGetFailed, err) - } - b, err := ioutil.ReadAll(r.Body) - if err != nil { - fatal(exitcodeGetFailed, err) - } - r.Body.Close() - br := bytes.NewReader(b) - err = gen(*in, *pkgName, br, typeSets, outWriter) - } else if len(*in) > 0 { - var file *os.File - file, err = os.Open(*in) - if err != nil { - fatal(exitcodeSourceFileInvalid, err) - } - defer file.Close() - err = gen(*in, *pkgName, file, typeSets, outWriter) - } else { - var source []byte - source, err = ioutil.ReadAll(os.Stdin) - if err != nil { - fatal(exitcodeStdinFailed, err) - } - reader := bytes.NewReader(source) - err = gen("stdin", *pkgName, reader, typeSets, outWriter) - } - - // do the work - if err != nil { - fatal(exitcodeGenFailed, err) - } - -} - -func usage() { - fmt.Fprintln(os.Stderr, `usage: genny [{flags}] gen "{types}" - -gen - generates type specific code from generic code. -get - fetch a generic template from the online library and gen it. - -{flags} - (optional) Command line flags (see below) -{types} - (required) Specific types for each generic type in the source -{types} format: {generic}={specific}[,another][ {generic2}={specific2}] - -Examples: - Generic=Specific - Generic1=Specific1 Generic2=Specific2 - Generic1=Specific1,Specific2 Generic2=Specific3,Specific4 - -Flags:`) - flag.PrintDefaults() -} - -func newWriter(fileName string) io.Writer { - if fileName == "" { - return os.Stdout - } - lf := &out.LazyFile{FileName: fileName} - defer lf.Close() - return lf -} - -func fatal(code int, a ...interface{}) { - fmt.Println(a...) - os.Exit(code) -} - -// gen performs the generic generation. -func gen(filename, pkgName string, in io.ReadSeeker, typesets []map[string]string, out io.Writer) error { - - var output []byte - var err error - - output, err = parse.Generics(filename, pkgName, in, typesets) - if err != nil { - return err - } - - out.Write(output) - return nil -} diff --git a/vendor/github.com/cheekybits/genny/out/lazy_file.go b/vendor/github.com/cheekybits/genny/out/lazy_file.go deleted file mode 100644 index 7c8815f5f9..0000000000 --- a/vendor/github.com/cheekybits/genny/out/lazy_file.go +++ /dev/null @@ -1,38 +0,0 @@ -package out - -import ( - "os" - "path" -) - -// LazyFile is an io.WriteCloser which defers creation of the file it is supposed to write in -// till the first call to its write function in order to prevent creation of file, if no write -// is supposed to happen. -type LazyFile struct { - // FileName is path to the file to which genny will write. - FileName string - file *os.File -} - -// Close closes the file if it is created. Returns nil if no file is created. -func (lw *LazyFile) Close() error { - if lw.file != nil { - return lw.file.Close() - } - return nil -} - -// Write writes to the specified file and creates the file first time it is called. -func (lw *LazyFile) Write(p []byte) (int, error) { - if lw.file == nil { - err := os.MkdirAll(path.Dir(lw.FileName), 0755) - if err != nil { - return 0, err - } - lw.file, err = os.Create(lw.FileName) - if err != nil { - return 0, err - } - } - return lw.file.Write(p) -} diff --git a/vendor/github.com/cheekybits/genny/parse/builtins.go b/vendor/github.com/cheekybits/genny/parse/builtins.go deleted file mode 100644 index e02995444c..0000000000 --- a/vendor/github.com/cheekybits/genny/parse/builtins.go +++ /dev/null @@ -1,41 +0,0 @@ -package parse - -// Builtins contains a slice of all built-in Go types. -var Builtins = []string{ - "bool", - "byte", - "complex128", - "complex64", - "error", - "float32", - "float64", - "int", - "int16", - "int32", - "int64", - "int8", - "rune", - "string", - "uint", - "uint16", - "uint32", - "uint64", - "uint8", - "uintptr", -} - -// Numbers contains a slice of all built-in number types. -var Numbers = []string{ - "float32", - "float64", - "int", - "int16", - "int32", - "int64", - "int8", - "uint", - "uint16", - "uint32", - "uint64", - "uint8", -} diff --git a/vendor/github.com/cheekybits/genny/parse/doc.go b/vendor/github.com/cheekybits/genny/parse/doc.go deleted file mode 100644 index 1be4fed8b4..0000000000 --- a/vendor/github.com/cheekybits/genny/parse/doc.go +++ /dev/null @@ -1,14 +0,0 @@ -// Package parse contains the generic code generation capabilities -// that power genny. -// -// genny gen "{types}" -// -// gen - generates type specific code (to stdout) from generic code (via stdin) -// -// {types} - (required) Specific types for each generic type in the source -// {types} format: {generic}={specific}[,another][ {generic2}={specific2}] -// Examples: -// Generic=Specific -// Generic1=Specific1 Generic2=Specific2 -// Generic1=Specific1,Specific2 Generic2=Specific3,Specific4 -package parse diff --git a/vendor/github.com/cheekybits/genny/parse/errors.go b/vendor/github.com/cheekybits/genny/parse/errors.go deleted file mode 100644 index ab812bf908..0000000000 --- a/vendor/github.com/cheekybits/genny/parse/errors.go +++ /dev/null @@ -1,47 +0,0 @@ -package parse - -import ( - "errors" -) - -// errMissingSpecificType represents an error when a generic type is not -// satisfied by a specific type. -type errMissingSpecificType struct { - GenericType string -} - -// Error gets a human readable string describing this error. -func (e errMissingSpecificType) Error() string { - return "Missing specific type for '" + e.GenericType + "' generic type" -} - -// errImports represents an error from goimports. -type errImports struct { - Err error -} - -// Error gets a human readable string describing this error. -func (e errImports) Error() string { - return "Failed to goimports the generated code: " + e.Err.Error() -} - -// errSource represents an error with the source file. -type errSource struct { - Err error -} - -// Error gets a human readable string describing this error. -func (e errSource) Error() string { - return "Failed to parse source file: " + e.Err.Error() -} - -type errBadTypeArgs struct { - Message string - Arg string -} - -func (e errBadTypeArgs) Error() string { - return "\"" + e.Arg + "\" is bad: " + e.Message -} - -var errMissingTypeInformation = errors.New("No type arguments were specified and no \"// +gogen\" tag was found in the source.") diff --git a/vendor/github.com/cheekybits/genny/parse/parse.go b/vendor/github.com/cheekybits/genny/parse/parse.go deleted file mode 100644 index 08eb48b113..0000000000 --- a/vendor/github.com/cheekybits/genny/parse/parse.go +++ /dev/null @@ -1,298 +0,0 @@ -package parse - -import ( - "bufio" - "bytes" - "fmt" - "go/ast" - "go/parser" - "go/scanner" - "go/token" - "io" - "os" - "strings" - "unicode" - - "golang.org/x/tools/imports" -) - -var header = []byte(` - -// This file was automatically generated by genny. -// Any changes will be lost if this file is regenerated. -// see https://github.com/cheekybits/genny - -`) - -var ( - packageKeyword = []byte("package") - importKeyword = []byte("import") - openBrace = []byte("(") - closeBrace = []byte(")") - genericPackage = "generic" - genericType = "generic.Type" - genericNumber = "generic.Number" - linefeed = "\r\n" -) -var unwantedLinePrefixes = [][]byte{ - []byte("//go:generate genny "), -} - -func subIntoLiteral(lit, typeTemplate, specificType string) string { - if lit == typeTemplate { - return specificType - } - if !strings.Contains(lit, typeTemplate) { - return lit - } - specificLg := wordify(specificType, true) - specificSm := wordify(specificType, false) - result := strings.Replace(lit, typeTemplate, specificLg, -1) - if strings.HasPrefix(result, specificLg) && !isExported(lit) { - return strings.Replace(result, specificLg, specificSm, 1) - } - return result -} - -func subTypeIntoComment(line, typeTemplate, specificType string) string { - var subbed string - for _, w := range strings.Fields(line) { - subbed = subbed + subIntoLiteral(w, typeTemplate, specificType) + " " - } - return subbed -} - -// Does the heavy lifting of taking a line of our code and -// sbustituting a type into there for our generic type -func subTypeIntoLine(line, typeTemplate, specificType string) string { - src := []byte(line) - var s scanner.Scanner - fset := token.NewFileSet() - file := fset.AddFile("", fset.Base(), len(src)) - s.Init(file, src, nil, scanner.ScanComments) - output := "" - for { - _, tok, lit := s.Scan() - if tok == token.EOF { - break - } else if tok == token.COMMENT { - subbed := subTypeIntoComment(lit, typeTemplate, specificType) - output = output + subbed + " " - } else if tok.IsLiteral() { - subbed := subIntoLiteral(lit, typeTemplate, specificType) - output = output + subbed + " " - } else { - output = output + tok.String() + " " - } - } - return output -} - -// typeSet looks like "KeyType: int, ValueType: string" -func generateSpecific(filename string, in io.ReadSeeker, typeSet map[string]string) ([]byte, error) { - - // ensure we are at the beginning of the file - in.Seek(0, os.SEEK_SET) - - // parse the source file - fs := token.NewFileSet() - file, err := parser.ParseFile(fs, filename, in, 0) - if err != nil { - return nil, &errSource{Err: err} - } - - // make sure every generic.Type is represented in the types - // argument. - for _, decl := range file.Decls { - switch it := decl.(type) { - case *ast.GenDecl: - for _, spec := range it.Specs { - ts, ok := spec.(*ast.TypeSpec) - if !ok { - continue - } - switch tt := ts.Type.(type) { - case *ast.SelectorExpr: - if name, ok := tt.X.(*ast.Ident); ok { - if name.Name == genericPackage { - if _, ok := typeSet[ts.Name.Name]; !ok { - return nil, &errMissingSpecificType{GenericType: ts.Name.Name} - } - } - } - } - } - } - } - - in.Seek(0, os.SEEK_SET) - - var buf bytes.Buffer - - comment := "" - scanner := bufio.NewScanner(in) - for scanner.Scan() { - - line := scanner.Text() - - // does this line contain generic.Type? - if strings.Contains(line, genericType) || strings.Contains(line, genericNumber) { - comment = "" - continue - } - - for t, specificType := range typeSet { - if strings.Contains(line, t) { - newLine := subTypeIntoLine(line, t, specificType) - line = newLine - } - } - - if comment != "" { - buf.WriteString(makeLine(comment)) - comment = "" - } - - // is this line a comment? - // TODO: should we handle /* */ comments? - if strings.HasPrefix(line, "//") { - // record this line to print later - comment = line - continue - } - - // write the line - buf.WriteString(makeLine(line)) - } - - // write it out - return buf.Bytes(), nil -} - -// Generics parses the source file and generates the bytes replacing the -// generic types for the keys map with the specific types (its value). -func Generics(filename, pkgName string, in io.ReadSeeker, typeSets []map[string]string) ([]byte, error) { - - totalOutput := header - - for _, typeSet := range typeSets { - - // generate the specifics - parsed, err := generateSpecific(filename, in, typeSet) - if err != nil { - return nil, err - } - - totalOutput = append(totalOutput, parsed...) - - } - - // clean up the code line by line - packageFound := false - insideImportBlock := false - var cleanOutputLines []string - scanner := bufio.NewScanner(bytes.NewReader(totalOutput)) - for scanner.Scan() { - - // end of imports block? - if insideImportBlock { - if bytes.HasSuffix(scanner.Bytes(), closeBrace) { - insideImportBlock = false - } - continue - } - - if bytes.HasPrefix(scanner.Bytes(), packageKeyword) { - if packageFound { - continue - } else { - packageFound = true - } - } else if bytes.HasPrefix(scanner.Bytes(), importKeyword) { - if bytes.HasSuffix(scanner.Bytes(), openBrace) { - insideImportBlock = true - } - continue - } - - // check all unwantedLinePrefixes - and skip them - skipline := false - for _, prefix := range unwantedLinePrefixes { - if bytes.HasPrefix(scanner.Bytes(), prefix) { - skipline = true - continue - } - } - - if skipline { - continue - } - - cleanOutputLines = append(cleanOutputLines, makeLine(scanner.Text())) - } - - cleanOutput := strings.Join(cleanOutputLines, "") - - output := []byte(cleanOutput) - var err error - - // change package name - if pkgName != "" { - output = changePackage(bytes.NewReader([]byte(output)), pkgName) - } - // fix the imports - output, err = imports.Process(filename, output, nil) - if err != nil { - return nil, &errImports{Err: err} - } - - return output, nil -} - -func makeLine(s string) string { - return fmt.Sprintln(strings.TrimRight(s, linefeed)) -} - -// isAlphaNumeric gets whether the rune is alphanumeric or _. -func isAlphaNumeric(r rune) bool { - return r == '_' || unicode.IsLetter(r) || unicode.IsDigit(r) -} - -// wordify turns a type into a nice word for function and type -// names etc. -func wordify(s string, exported bool) string { - s = strings.TrimRight(s, "{}") - s = strings.TrimLeft(s, "*&") - s = strings.Replace(s, ".", "", -1) - if !exported { - return s - } - return strings.ToUpper(string(s[0])) + s[1:] -} - -func changePackage(r io.Reader, pkgName string) []byte { - var out bytes.Buffer - sc := bufio.NewScanner(r) - done := false - - for sc.Scan() { - s := sc.Text() - - if !done && strings.HasPrefix(s, "package") { - parts := strings.Split(s, " ") - parts[1] = pkgName - s = strings.Join(parts, " ") - done = true - } - - fmt.Fprintln(&out, s) - } - return out.Bytes() -} - -func isExported(lit string) bool { - if len(lit) == 0 { - return false - } - return unicode.IsUpper(rune(lit[0])) -} diff --git a/vendor/github.com/cheekybits/genny/parse/typesets.go b/vendor/github.com/cheekybits/genny/parse/typesets.go deleted file mode 100644 index c30b97289a..0000000000 --- a/vendor/github.com/cheekybits/genny/parse/typesets.go +++ /dev/null @@ -1,89 +0,0 @@ -package parse - -import "strings" - -const ( - typeSep = " " - keyValueSep = "=" - valuesSep = "," - builtins = "BUILTINS" - numbers = "NUMBERS" -) - -// TypeSet turns a type string into a []map[string]string -// that can be given to parse.Generics for it to do its magic. -// -// Acceptable args are: -// -// Person=man -// Person=man Animal=dog -// Person=man Animal=dog Animal2=cat -// Person=man,woman Animal=dog,cat -// Person=man,woman,child Animal=dog,cat Place=london,paris -func TypeSet(arg string) ([]map[string]string, error) { - - types := make(map[string][]string) - var keys []string - for _, pair := range strings.Split(arg, typeSep) { - segs := strings.Split(pair, keyValueSep) - if len(segs) != 2 { - return nil, &errBadTypeArgs{Arg: arg, Message: "Generic=Specific expected"} - } - key := segs[0] - keys = append(keys, key) - types[key] = make([]string, 0) - for _, t := range strings.Split(segs[1], valuesSep) { - if t == builtins { - types[key] = append(types[key], Builtins...) - } else if t == numbers { - types[key] = append(types[key], Numbers...) - } else { - types[key] = append(types[key], t) - } - } - } - - cursors := make(map[string]int) - for _, key := range keys { - cursors[key] = 0 - } - - outChan := make(chan map[string]string) - go func() { - buildTypeSet(keys, 0, cursors, types, outChan) - close(outChan) - }() - - var typeSets []map[string]string - for typeSet := range outChan { - typeSets = append(typeSets, typeSet) - } - - return typeSets, nil - -} - -func buildTypeSet(keys []string, keyI int, cursors map[string]int, types map[string][]string, out chan<- map[string]string) { - key := keys[keyI] - for cursors[key] < len(types[key]) { - if keyI < len(keys)-1 { - buildTypeSet(keys, keyI+1, copycursors(cursors), types, out) - } else { - // build the typeset for this combination - ts := make(map[string]string) - for k, vals := range types { - ts[k] = vals[cursors[k]] - } - out <- ts - } - cursors[key]++ - } -} - -func copycursors(source map[string]int) map[string]int { - copy := make(map[string]int) - for k, v := range source { - copy[k] = v - } - return copy -} diff --git a/vendor/github.com/containerd/cgroups/.gitignore b/vendor/github.com/containerd/cgroups/.gitignore deleted file mode 100644 index 3465c14cf7..0000000000 --- a/vendor/github.com/containerd/cgroups/.gitignore +++ /dev/null @@ -1,2 +0,0 @@ -example/example -cmd/cgctl/cgctl diff --git a/vendor/github.com/containerd/cgroups/Makefile b/vendor/github.com/containerd/cgroups/Makefile deleted file mode 100644 index 19e6607561..0000000000 --- a/vendor/github.com/containerd/cgroups/Makefile +++ /dev/null @@ -1,24 +0,0 @@ -# Copyright The containerd Authors. - -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at - -# http://www.apache.org/licenses/LICENSE-2.0 - -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -PACKAGES=$(shell go list ./... | grep -v /vendor/) - -all: cgutil - go build -v - -cgutil: - cd cmd/cgctl && go build -v - -proto: - protobuild --quiet ${PACKAGES} diff --git a/vendor/github.com/containerd/cgroups/Protobuild.toml b/vendor/github.com/containerd/cgroups/Protobuild.toml deleted file mode 100644 index 1c4c802fe1..0000000000 --- a/vendor/github.com/containerd/cgroups/Protobuild.toml +++ /dev/null @@ -1,46 +0,0 @@ -version = "unstable" -generator = "gogoctrd" -plugins = ["grpc"] - -# Control protoc include paths. Below are usually some good defaults, but feel -# free to try it without them if it works for your project. -[includes] - # Include paths that will be added before all others. Typically, you want to - # treat the root of the project as an include, but this may not be necessary. - # before = ["."] - - # Paths that should be treated as include roots in relation to the vendor - # directory. These will be calculated with the vendor directory nearest the - # target package. - # vendored = ["github.com/gogo/protobuf"] - packages = ["github.com/gogo/protobuf"] - - # Paths that will be added untouched to the end of the includes. We use - # `/usr/local/include` to pickup the common install location of protobuf. - # This is the default. - after = ["/usr/local/include", "/usr/include"] - -# This section maps protobuf imports to Go packages. These will become -# `-M` directives in the call to the go protobuf generator. -[packages] - "gogoproto/gogo.proto" = "github.com/gogo/protobuf/gogoproto" - "google/protobuf/any.proto" = "github.com/gogo/protobuf/types" - "google/protobuf/descriptor.proto" = "github.com/gogo/protobuf/protoc-gen-gogo/descriptor" - "google/protobuf/field_mask.proto" = "github.com/gogo/protobuf/types" - "google/protobuf/timestamp.proto" = "github.com/gogo/protobuf/types" - -# Aggregrate the API descriptors to lock down API changes. -[[descriptors]] -prefix = "github.com/containerd/cgroups/stats/v1" -target = "stats/v1/metrics.pb.txt" -ignore_files = [ - "google/protobuf/descriptor.proto", - "gogoproto/gogo.proto" -] -[[descriptors]] -prefix = "github.com/containerd/cgroups/v2/stats" -target = "v2/stats/metrics.pb.txt" -ignore_files = [ - "google/protobuf/descriptor.proto", - "gogoproto/gogo.proto" -] diff --git a/vendor/github.com/containerd/cgroups/README.md b/vendor/github.com/containerd/cgroups/README.md deleted file mode 100644 index fc2c7a9be4..0000000000 --- a/vendor/github.com/containerd/cgroups/README.md +++ /dev/null @@ -1,149 +0,0 @@ -# cgroups - -[![Build Status](https://github.com/containerd/cgroups/workflows/CI/badge.svg)](https://github.com/containerd/cgroups/actions?query=workflow%3ACI) -[![codecov](https://codecov.io/gh/containerd/cgroups/branch/main/graph/badge.svg)](https://codecov.io/gh/containerd/cgroups) -[![GoDoc](https://godoc.org/github.com/containerd/cgroups?status.svg)](https://godoc.org/github.com/containerd/cgroups) -[![Go Report Card](https://goreportcard.com/badge/github.com/containerd/cgroups)](https://goreportcard.com/report/github.com/containerd/cgroups) - -Go package for creating, managing, inspecting, and destroying cgroups. -The resources format for settings on the cgroup uses the OCI runtime-spec found -[here](https://github.com/opencontainers/runtime-spec). - -## Examples - -### Create a new cgroup - -This creates a new cgroup using a static path for all subsystems under `/test`. - -* /sys/fs/cgroup/cpu/test -* /sys/fs/cgroup/memory/test -* etc.... - -It uses a single hierarchy and specifies cpu shares as a resource constraint and -uses the v1 implementation of cgroups. - - -```go -shares := uint64(100) -control, err := cgroups.New(cgroups.V1, cgroups.StaticPath("/test"), &specs.LinuxResources{ - CPU: &specs.CPU{ - Shares: &shares, - }, -}) -defer control.Delete() -``` - -### Create with systemd slice support - - -```go -control, err := cgroups.New(cgroups.Systemd, cgroups.Slice("system.slice", "runc-test"), &specs.LinuxResources{ - CPU: &specs.CPU{ - Shares: &shares, - }, -}) - -``` - -### Load an existing cgroup - -```go -control, err = cgroups.Load(cgroups.V1, cgroups.StaticPath("/test")) -``` - -### Add a process to the cgroup - -```go -if err := control.Add(cgroups.Process{Pid:1234}); err != nil { -} -``` - -### Update the cgroup - -To update the resources applied in the cgroup - -```go -shares = uint64(200) -if err := control.Update(&specs.LinuxResources{ - CPU: &specs.LinuxCPU{ - Shares: &shares, - }, -}); err != nil { -} -``` - -### Freeze and Thaw the cgroup - -```go -if err := control.Freeze(); err != nil { -} -if err := control.Thaw(); err != nil { -} -``` - -### List all processes in the cgroup or recursively - -```go -processes, err := control.Processes(cgroups.Devices, recursive) -``` - -### Get Stats on the cgroup - -```go -stats, err := control.Stat() -``` - -By adding `cgroups.IgnoreNotExist` all non-existent files will be ignored, e.g. swap memory stats without swap enabled -```go -stats, err := control.Stat(cgroups.IgnoreNotExist) -``` - -### Move process across cgroups - -This allows you to take processes from one cgroup and move them to another. - -```go -err := control.MoveTo(destination) -``` - -### Create subcgroup - -```go -subCgroup, err := control.New("child", resources) -``` - -### Registering for memory events - -This allows you to get notified by an eventfd for v1 memory cgroups events. - -```go -event := cgroups.MemoryThresholdEvent(50 * 1024 * 1024, false) -efd, err := control.RegisterMemoryEvent(event) -``` - -```go -event := cgroups.MemoryPressureEvent(cgroups.MediumPressure, cgroups.DefaultMode) -efd, err := control.RegisterMemoryEvent(event) -``` - -```go -efd, err := control.OOMEventFD() -// or by using RegisterMemoryEvent -event := cgroups.OOMEvent() -efd, err := control.RegisterMemoryEvent(event) -``` - -### Attention - -All static path should not include `/sys/fs/cgroup/` prefix, it should start with your own cgroups name - -## Project details - -Cgroups is a containerd sub-project, licensed under the [Apache 2.0 license](./LICENSE). -As a containerd sub-project, you will find the: - - * [Project governance](https://github.com/containerd/project/blob/main/GOVERNANCE.md), - * [Maintainers](https://github.com/containerd/project/blob/main/MAINTAINERS), - * and [Contributing guidelines](https://github.com/containerd/project/blob/main/CONTRIBUTING.md) - -information in our [`containerd/project`](https://github.com/containerd/project) repository. diff --git a/vendor/github.com/containerd/cgroups/Vagrantfile b/vendor/github.com/containerd/cgroups/Vagrantfile deleted file mode 100644 index 4596ad8a7d..0000000000 --- a/vendor/github.com/containerd/cgroups/Vagrantfile +++ /dev/null @@ -1,46 +0,0 @@ -# -*- mode: ruby -*- -# vi: set ft=ruby : - -Vagrant.configure("2") do |config| -# Fedora box is used for testing cgroup v2 support - config.vm.box = "fedora/32-cloud-base" - config.vm.provider :virtualbox do |v| - v.memory = 2048 - v.cpus = 2 - end - config.vm.provider :libvirt do |v| - v.memory = 2048 - v.cpus = 2 - end - config.vm.provision "shell", inline: <<-SHELL - set -eux -o pipefail - # configuration - GO_VERSION="1.15" - - # install gcc and Golang - dnf -y install gcc - curl -fsSL "https://dl.google.com/go/go${GO_VERSION}.linux-amd64.tar.gz" | tar Cxz /usr/local - - # setup env vars - cat >> /etc/profile.d/sh.local < /test.sh < 0 { - return nil - } - - // Even the kernel is compiled with the CFQ scheduler, the cgroup may not use - // block devices with the CFQ scheduler. If so, we should fallback to throttle.* files. - settings = []blkioStatSettings{ - { - name: "throttle.io_serviced", - entry: &stats.Blkio.IoServicedRecursive, - }, - { - name: "throttle.io_service_bytes", - entry: &stats.Blkio.IoServiceBytesRecursive, - }, - } - for _, t := range settings { - if err := b.readEntry(devices, path, t.name, t.entry); err != nil { - return err - } - } - return nil -} - -func (b *blkioController) readEntry(devices map[deviceKey]string, path, name string, entry *[]*v1.BlkIOEntry) error { - f, err := os.Open(filepath.Join(b.Path(path), "blkio."+name)) - if err != nil { - return err - } - defer f.Close() - sc := bufio.NewScanner(f) - for sc.Scan() { - // format: dev type amount - fields := strings.FieldsFunc(sc.Text(), splitBlkIOStatLine) - if len(fields) < 3 { - if len(fields) == 2 && fields[0] == "Total" { - // skip total line - continue - } else { - return fmt.Errorf("invalid line found while parsing %s: %s", path, sc.Text()) - } - } - major, err := strconv.ParseUint(fields[0], 10, 64) - if err != nil { - return err - } - minor, err := strconv.ParseUint(fields[1], 10, 64) - if err != nil { - return err - } - op := "" - valueField := 2 - if len(fields) == 4 { - op = fields[2] - valueField = 3 - } - v, err := strconv.ParseUint(fields[valueField], 10, 64) - if err != nil { - return err - } - *entry = append(*entry, &v1.BlkIOEntry{ - Device: devices[deviceKey{major, minor}], - Major: major, - Minor: minor, - Op: op, - Value: v, - }) - } - return sc.Err() -} - -func createBlkioSettings(blkio *specs.LinuxBlockIO) []blkioSettings { - settings := []blkioSettings{} - - if blkio.Weight != nil { - settings = append(settings, - blkioSettings{ - name: "weight", - value: blkio.Weight, - format: uintf, - }) - } - if blkio.LeafWeight != nil { - settings = append(settings, - blkioSettings{ - name: "leaf_weight", - value: blkio.LeafWeight, - format: uintf, - }) - } - for _, wd := range blkio.WeightDevice { - if wd.Weight != nil { - settings = append(settings, - blkioSettings{ - name: "weight_device", - value: wd, - format: weightdev, - }) - } - if wd.LeafWeight != nil { - settings = append(settings, - blkioSettings{ - name: "leaf_weight_device", - value: wd, - format: weightleafdev, - }) - } - } - for _, t := range []struct { - name string - list []specs.LinuxThrottleDevice - }{ - { - name: "throttle.read_bps_device", - list: blkio.ThrottleReadBpsDevice, - }, - { - name: "throttle.read_iops_device", - list: blkio.ThrottleReadIOPSDevice, - }, - { - name: "throttle.write_bps_device", - list: blkio.ThrottleWriteBpsDevice, - }, - { - name: "throttle.write_iops_device", - list: blkio.ThrottleWriteIOPSDevice, - }, - } { - for _, td := range t.list { - settings = append(settings, blkioSettings{ - name: t.name, - value: td, - format: throttleddev, - }) - } - } - return settings -} - -type blkioSettings struct { - name string - value interface{} - format func(v interface{}) []byte -} - -type blkioStatSettings struct { - name string - entry *[]*v1.BlkIOEntry -} - -func uintf(v interface{}) []byte { - return []byte(strconv.FormatUint(uint64(*v.(*uint16)), 10)) -} - -func weightdev(v interface{}) []byte { - wd := v.(specs.LinuxWeightDevice) - return []byte(fmt.Sprintf("%d:%d %d", wd.Major, wd.Minor, *wd.Weight)) -} - -func weightleafdev(v interface{}) []byte { - wd := v.(specs.LinuxWeightDevice) - return []byte(fmt.Sprintf("%d:%d %d", wd.Major, wd.Minor, *wd.LeafWeight)) -} - -func throttleddev(v interface{}) []byte { - td := v.(specs.LinuxThrottleDevice) - return []byte(fmt.Sprintf("%d:%d %d", td.Major, td.Minor, td.Rate)) -} - -func splitBlkIOStatLine(r rune) bool { - return r == ' ' || r == ':' -} - -type deviceKey struct { - major, minor uint64 -} - -// getDevices makes a best effort attempt to read all the devices into a map -// keyed by major and minor number. Since devices may be mapped multiple times, -// we err on taking the first occurrence. -func getDevices(r io.Reader) (map[deviceKey]string, error) { - - var ( - s = bufio.NewScanner(r) - devices = make(map[deviceKey]string) - ) - for i := 0; s.Scan(); i++ { - if i < 2 { - continue - } - fields := strings.Fields(s.Text()) - major, err := strconv.Atoi(fields[0]) - if err != nil { - return nil, err - } - minor, err := strconv.Atoi(fields[1]) - if err != nil { - return nil, err - } - key := deviceKey{ - major: uint64(major), - minor: uint64(minor), - } - if _, ok := devices[key]; ok { - continue - } - devices[key] = filepath.Join("/dev", fields[3]) - } - return devices, s.Err() -} diff --git a/vendor/github.com/containerd/cgroups/cgroup.go b/vendor/github.com/containerd/cgroups/cgroup.go deleted file mode 100644 index 0fab1cecfe..0000000000 --- a/vendor/github.com/containerd/cgroups/cgroup.go +++ /dev/null @@ -1,533 +0,0 @@ -/* - Copyright The containerd Authors. - - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. -*/ - -package cgroups - -import ( - "errors" - "fmt" - "os" - "path/filepath" - "strconv" - "strings" - "sync" - - v1 "github.com/containerd/cgroups/stats/v1" - - "github.com/opencontainers/runtime-spec/specs-go" -) - -// New returns a new control via the cgroup cgroups interface -func New(hierarchy Hierarchy, path Path, resources *specs.LinuxResources, opts ...InitOpts) (Cgroup, error) { - config := newInitConfig() - for _, o := range opts { - if err := o(config); err != nil { - return nil, err - } - } - subsystems, err := hierarchy() - if err != nil { - return nil, err - } - var active []Subsystem - for _, s := range subsystems { - // check if subsystem exists - if err := initializeSubsystem(s, path, resources); err != nil { - if err == ErrControllerNotActive { - if config.InitCheck != nil { - if skerr := config.InitCheck(s, path, err); skerr != nil { - if skerr != ErrIgnoreSubsystem { - return nil, skerr - } - } - } - continue - } - return nil, err - } - active = append(active, s) - } - return &cgroup{ - path: path, - subsystems: active, - }, nil -} - -// Load will load an existing cgroup and allow it to be controlled -// All static path should not include `/sys/fs/cgroup/` prefix, it should start with your own cgroups name -func Load(hierarchy Hierarchy, path Path, opts ...InitOpts) (Cgroup, error) { - config := newInitConfig() - for _, o := range opts { - if err := o(config); err != nil { - return nil, err - } - } - var activeSubsystems []Subsystem - subsystems, err := hierarchy() - if err != nil { - return nil, err - } - // check that the subsystems still exist, and keep only those that actually exist - for _, s := range pathers(subsystems) { - p, err := path(s.Name()) - if err != nil { - if errors.Is(err, os.ErrNotExist) { - return nil, ErrCgroupDeleted - } - if err == ErrControllerNotActive { - if config.InitCheck != nil { - if skerr := config.InitCheck(s, path, err); skerr != nil { - if skerr != ErrIgnoreSubsystem { - return nil, skerr - } - } - } - continue - } - return nil, err - } - if _, err := os.Lstat(s.Path(p)); err != nil { - if os.IsNotExist(err) { - continue - } - return nil, err - } - activeSubsystems = append(activeSubsystems, s) - } - // if we do not have any active systems then the cgroup is deleted - if len(activeSubsystems) == 0 { - return nil, ErrCgroupDeleted - } - return &cgroup{ - path: path, - subsystems: activeSubsystems, - }, nil -} - -type cgroup struct { - path Path - - subsystems []Subsystem - mu sync.Mutex - err error -} - -// New returns a new sub cgroup -func (c *cgroup) New(name string, resources *specs.LinuxResources) (Cgroup, error) { - c.mu.Lock() - defer c.mu.Unlock() - if c.err != nil { - return nil, c.err - } - path := subPath(c.path, name) - for _, s := range c.subsystems { - if err := initializeSubsystem(s, path, resources); err != nil { - return nil, err - } - } - return &cgroup{ - path: path, - subsystems: c.subsystems, - }, nil -} - -// Subsystems returns all the subsystems that are currently being -// consumed by the group -func (c *cgroup) Subsystems() []Subsystem { - return c.subsystems -} - -func (c *cgroup) subsystemsFilter(subsystems ...Name) []Subsystem { - if len(subsystems) == 0 { - return c.subsystems - } - - var filteredSubsystems = []Subsystem{} - for _, s := range c.subsystems { - for _, f := range subsystems { - if s.Name() == f { - filteredSubsystems = append(filteredSubsystems, s) - break - } - } - } - - return filteredSubsystems -} - -// Add moves the provided process into the new cgroup. -// Without additional arguments, the process is added to all the cgroup subsystems. -// When giving Add a list of subsystem names, the process is only added to those -// subsystems, provided that they are active in the targeted cgroup. -func (c *cgroup) Add(process Process, subsystems ...Name) error { - return c.add(process, cgroupProcs, subsystems...) -} - -// AddProc moves the provided process id into the new cgroup. -// Without additional arguments, the process with the given id is added to all -// the cgroup subsystems. When giving AddProc a list of subsystem names, the process -// id is only added to those subsystems, provided that they are active in the targeted -// cgroup. -func (c *cgroup) AddProc(pid uint64, subsystems ...Name) error { - return c.add(Process{Pid: int(pid)}, cgroupProcs, subsystems...) -} - -// AddTask moves the provided tasks (threads) into the new cgroup. -// Without additional arguments, the task is added to all the cgroup subsystems. -// When giving AddTask a list of subsystem names, the task is only added to those -// subsystems, provided that they are active in the targeted cgroup. -func (c *cgroup) AddTask(process Process, subsystems ...Name) error { - return c.add(process, cgroupTasks, subsystems...) -} - -func (c *cgroup) add(process Process, pType procType, subsystems ...Name) error { - if process.Pid <= 0 { - return ErrInvalidPid - } - c.mu.Lock() - defer c.mu.Unlock() - if c.err != nil { - return c.err - } - for _, s := range pathers(c.subsystemsFilter(subsystems...)) { - p, err := c.path(s.Name()) - if err != nil { - return err - } - err = retryingWriteFile( - filepath.Join(s.Path(p), pType), - []byte(strconv.Itoa(process.Pid)), - defaultFilePerm, - ) - if err != nil { - return err - } - } - return nil -} - -// Delete will remove the control group from each of the subsystems registered -func (c *cgroup) Delete() error { - c.mu.Lock() - defer c.mu.Unlock() - if c.err != nil { - return c.err - } - var errs []string - for _, s := range c.subsystems { - if d, ok := s.(deleter); ok { - sp, err := c.path(s.Name()) - if err != nil { - return err - } - if err := d.Delete(sp); err != nil { - errs = append(errs, string(s.Name())) - } - continue - } - if p, ok := s.(pather); ok { - sp, err := c.path(s.Name()) - if err != nil { - return err - } - path := p.Path(sp) - if err := remove(path); err != nil { - errs = append(errs, path) - } - } - } - if len(errs) > 0 { - return fmt.Errorf("cgroups: unable to remove paths %s", strings.Join(errs, ", ")) - } - c.err = ErrCgroupDeleted - return nil -} - -// Stat returns the current metrics for the cgroup -func (c *cgroup) Stat(handlers ...ErrorHandler) (*v1.Metrics, error) { - c.mu.Lock() - defer c.mu.Unlock() - if c.err != nil { - return nil, c.err - } - if len(handlers) == 0 { - handlers = append(handlers, errPassthrough) - } - var ( - stats = &v1.Metrics{ - CPU: &v1.CPUStat{ - Throttling: &v1.Throttle{}, - Usage: &v1.CPUUsage{}, - }, - } - wg = &sync.WaitGroup{} - errs = make(chan error, len(c.subsystems)) - ) - for _, s := range c.subsystems { - if ss, ok := s.(stater); ok { - sp, err := c.path(s.Name()) - if err != nil { - return nil, err - } - wg.Add(1) - go func() { - defer wg.Done() - if err := ss.Stat(sp, stats); err != nil { - for _, eh := range handlers { - if herr := eh(err); herr != nil { - errs <- herr - } - } - } - }() - } - } - wg.Wait() - close(errs) - for err := range errs { - return nil, err - } - return stats, nil -} - -// Update updates the cgroup with the new resource values provided -// -// Be prepared to handle EBUSY when trying to update a cgroup with -// live processes and other operations like Stats being performed at the -// same time -func (c *cgroup) Update(resources *specs.LinuxResources) error { - c.mu.Lock() - defer c.mu.Unlock() - if c.err != nil { - return c.err - } - for _, s := range c.subsystems { - if u, ok := s.(updater); ok { - sp, err := c.path(s.Name()) - if err != nil { - return err - } - if err := u.Update(sp, resources); err != nil { - return err - } - } - } - return nil -} - -// Processes returns the processes running inside the cgroup along -// with the subsystem used, pid, and path -func (c *cgroup) Processes(subsystem Name, recursive bool) ([]Process, error) { - c.mu.Lock() - defer c.mu.Unlock() - if c.err != nil { - return nil, c.err - } - return c.processes(subsystem, recursive, cgroupProcs) -} - -// Tasks returns the tasks running inside the cgroup along -// with the subsystem used, pid, and path -func (c *cgroup) Tasks(subsystem Name, recursive bool) ([]Task, error) { - c.mu.Lock() - defer c.mu.Unlock() - if c.err != nil { - return nil, c.err - } - return c.processes(subsystem, recursive, cgroupTasks) -} - -func (c *cgroup) processes(subsystem Name, recursive bool, pType procType) ([]Process, error) { - s := c.getSubsystem(subsystem) - sp, err := c.path(subsystem) - if err != nil { - return nil, err - } - if s == nil { - return nil, fmt.Errorf("cgroups: %s doesn't exist in %s subsystem", sp, subsystem) - } - path := s.(pather).Path(sp) - var processes []Process - err = filepath.Walk(path, func(p string, info os.FileInfo, err error) error { - if err != nil { - return err - } - if !recursive && info.IsDir() { - if p == path { - return nil - } - return filepath.SkipDir - } - dir, name := filepath.Split(p) - if name != pType { - return nil - } - procs, err := readPids(dir, subsystem, pType) - if err != nil { - return err - } - processes = append(processes, procs...) - return nil - }) - return processes, err -} - -// Freeze freezes the entire cgroup and all the processes inside it -func (c *cgroup) Freeze() error { - c.mu.Lock() - defer c.mu.Unlock() - if c.err != nil { - return c.err - } - s := c.getSubsystem(Freezer) - if s == nil { - return ErrFreezerNotSupported - } - sp, err := c.path(Freezer) - if err != nil { - return err - } - return s.(*freezerController).Freeze(sp) -} - -// Thaw thaws out the cgroup and all the processes inside it -func (c *cgroup) Thaw() error { - c.mu.Lock() - defer c.mu.Unlock() - if c.err != nil { - return c.err - } - s := c.getSubsystem(Freezer) - if s == nil { - return ErrFreezerNotSupported - } - sp, err := c.path(Freezer) - if err != nil { - return err - } - return s.(*freezerController).Thaw(sp) -} - -// OOMEventFD returns the memory cgroup's out of memory event fd that triggers -// when processes inside the cgroup receive an oom event. Returns -// ErrMemoryNotSupported if memory cgroups is not supported. -func (c *cgroup) OOMEventFD() (uintptr, error) { - c.mu.Lock() - defer c.mu.Unlock() - if c.err != nil { - return 0, c.err - } - s := c.getSubsystem(Memory) - if s == nil { - return 0, ErrMemoryNotSupported - } - sp, err := c.path(Memory) - if err != nil { - return 0, err - } - return s.(*memoryController).memoryEvent(sp, OOMEvent()) -} - -// RegisterMemoryEvent allows the ability to register for all v1 memory cgroups -// notifications. -func (c *cgroup) RegisterMemoryEvent(event MemoryEvent) (uintptr, error) { - c.mu.Lock() - defer c.mu.Unlock() - if c.err != nil { - return 0, c.err - } - s := c.getSubsystem(Memory) - if s == nil { - return 0, ErrMemoryNotSupported - } - sp, err := c.path(Memory) - if err != nil { - return 0, err - } - return s.(*memoryController).memoryEvent(sp, event) -} - -// State returns the state of the cgroup and its processes -func (c *cgroup) State() State { - c.mu.Lock() - defer c.mu.Unlock() - c.checkExists() - if c.err != nil && c.err == ErrCgroupDeleted { - return Deleted - } - s := c.getSubsystem(Freezer) - if s == nil { - return Thawed - } - sp, err := c.path(Freezer) - if err != nil { - return Unknown - } - state, err := s.(*freezerController).state(sp) - if err != nil { - return Unknown - } - return state -} - -// MoveTo does a recursive move subsystem by subsystem of all the processes -// inside the group -func (c *cgroup) MoveTo(destination Cgroup) error { - c.mu.Lock() - defer c.mu.Unlock() - if c.err != nil { - return c.err - } - for _, s := range c.subsystems { - processes, err := c.processes(s.Name(), true, cgroupProcs) - if err != nil { - return err - } - for _, p := range processes { - if err := destination.Add(p); err != nil { - if strings.Contains(err.Error(), "no such process") { - continue - } - return err - } - } - } - return nil -} - -func (c *cgroup) getSubsystem(n Name) Subsystem { - for _, s := range c.subsystems { - if s.Name() == n { - return s - } - } - return nil -} - -func (c *cgroup) checkExists() { - for _, s := range pathers(c.subsystems) { - p, err := c.path(s.Name()) - if err != nil { - return - } - if _, err := os.Lstat(s.Path(p)); err != nil { - if os.IsNotExist(err) { - c.err = ErrCgroupDeleted - return - } - } - } -} diff --git a/vendor/github.com/containerd/cgroups/control.go b/vendor/github.com/containerd/cgroups/control.go deleted file mode 100644 index 5fcaac6d05..0000000000 --- a/vendor/github.com/containerd/cgroups/control.go +++ /dev/null @@ -1,99 +0,0 @@ -/* - Copyright The containerd Authors. - - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. -*/ - -package cgroups - -import ( - "os" - - v1 "github.com/containerd/cgroups/stats/v1" - specs "github.com/opencontainers/runtime-spec/specs-go" -) - -type procType = string - -const ( - cgroupProcs procType = "cgroup.procs" - cgroupTasks procType = "tasks" - defaultDirPerm = 0755 -) - -// defaultFilePerm is a var so that the test framework can change the filemode -// of all files created when the tests are running. The difference between the -// tests and real world use is that files like "cgroup.procs" will exist when writing -// to a read cgroup filesystem and do not exist prior when running in the tests. -// this is set to a non 0 value in the test code -var defaultFilePerm = os.FileMode(0) - -type Process struct { - // Subsystem is the name of the subsystem that the process / task is in. - Subsystem Name - // Pid is the process id of the process / task. - Pid int - // Path is the full path of the subsystem and location that the process / task is in. - Path string -} - -type Task = Process - -// Cgroup handles interactions with the individual groups to perform -// actions on them as them main interface to this cgroup package -type Cgroup interface { - // New creates a new cgroup under the calling cgroup - New(string, *specs.LinuxResources) (Cgroup, error) - // Add adds a process to the cgroup (cgroup.procs). Without additional arguments, - // the process is added to all the cgroup subsystems. When giving Add a list of - // subsystem names, the process is only added to those subsystems, provided that - // they are active in the targeted cgroup. - Add(Process, ...Name) error - // AddProc adds the process with the given id to the cgroup (cgroup.procs). - // Without additional arguments, the process with the given id is added to all - // the cgroup subsystems. When giving AddProc a list of subsystem names, the process - // id is only added to those subsystems, provided that they are active in the targeted - // cgroup. - AddProc(uint64, ...Name) error - // AddTask adds a process to the cgroup (tasks). Without additional arguments, the - // task is added to all the cgroup subsystems. When giving AddTask a list of subsystem - // names, the task is only added to those subsystems, provided that they are active in - // the targeted cgroup. - AddTask(Process, ...Name) error - // Delete removes the cgroup as a whole - Delete() error - // MoveTo moves all the processes under the calling cgroup to the provided one - // subsystems are moved one at a time - MoveTo(Cgroup) error - // Stat returns the stats for all subsystems in the cgroup - Stat(...ErrorHandler) (*v1.Metrics, error) - // Update updates all the subsystems with the provided resource changes - Update(resources *specs.LinuxResources) error - // Processes returns all the processes in a select subsystem for the cgroup - Processes(Name, bool) ([]Process, error) - // Tasks returns all the tasks in a select subsystem for the cgroup - Tasks(Name, bool) ([]Task, error) - // Freeze freezes or pauses all processes inside the cgroup - Freeze() error - // Thaw thaw or resumes all processes inside the cgroup - Thaw() error - // OOMEventFD returns the memory subsystem's event fd for OOM events - OOMEventFD() (uintptr, error) - // RegisterMemoryEvent returns the memory subsystems event fd for whatever memory event was - // registered for. Can alternatively register for the oom event with this method. - RegisterMemoryEvent(MemoryEvent) (uintptr, error) - // State returns the cgroups current state - State() State - // Subsystems returns all the subsystems in the cgroup - Subsystems() []Subsystem -} diff --git a/vendor/github.com/containerd/cgroups/cpu.go b/vendor/github.com/containerd/cgroups/cpu.go deleted file mode 100644 index 27024f17b8..0000000000 --- a/vendor/github.com/containerd/cgroups/cpu.go +++ /dev/null @@ -1,125 +0,0 @@ -/* - Copyright The containerd Authors. - - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. -*/ - -package cgroups - -import ( - "bufio" - "os" - "path/filepath" - "strconv" - - v1 "github.com/containerd/cgroups/stats/v1" - specs "github.com/opencontainers/runtime-spec/specs-go" -) - -func NewCpu(root string) *cpuController { - return &cpuController{ - root: filepath.Join(root, string(Cpu)), - } -} - -type cpuController struct { - root string -} - -func (c *cpuController) Name() Name { - return Cpu -} - -func (c *cpuController) Path(path string) string { - return filepath.Join(c.root, path) -} - -func (c *cpuController) Create(path string, resources *specs.LinuxResources) error { - if err := os.MkdirAll(c.Path(path), defaultDirPerm); err != nil { - return err - } - if cpu := resources.CPU; cpu != nil { - for _, t := range []struct { - name string - ivalue *int64 - uvalue *uint64 - }{ - { - name: "rt_period_us", - uvalue: cpu.RealtimePeriod, - }, - { - name: "rt_runtime_us", - ivalue: cpu.RealtimeRuntime, - }, - { - name: "shares", - uvalue: cpu.Shares, - }, - { - name: "cfs_period_us", - uvalue: cpu.Period, - }, - { - name: "cfs_quota_us", - ivalue: cpu.Quota, - }, - } { - var value []byte - if t.uvalue != nil { - value = []byte(strconv.FormatUint(*t.uvalue, 10)) - } else if t.ivalue != nil { - value = []byte(strconv.FormatInt(*t.ivalue, 10)) - } - if value != nil { - if err := retryingWriteFile( - filepath.Join(c.Path(path), "cpu."+t.name), - value, - defaultFilePerm, - ); err != nil { - return err - } - } - } - } - return nil -} - -func (c *cpuController) Update(path string, resources *specs.LinuxResources) error { - return c.Create(path, resources) -} - -func (c *cpuController) Stat(path string, stats *v1.Metrics) error { - f, err := os.Open(filepath.Join(c.Path(path), "cpu.stat")) - if err != nil { - return err - } - defer f.Close() - // get or create the cpu field because cpuacct can also set values on this struct - sc := bufio.NewScanner(f) - for sc.Scan() { - key, v, err := parseKV(sc.Text()) - if err != nil { - return err - } - switch key { - case "nr_periods": - stats.CPU.Throttling.Periods = v - case "nr_throttled": - stats.CPU.Throttling.ThrottledPeriods = v - case "throttled_time": - stats.CPU.Throttling.ThrottledTime = v - } - } - return sc.Err() -} diff --git a/vendor/github.com/containerd/cgroups/cpuacct.go b/vendor/github.com/containerd/cgroups/cpuacct.go deleted file mode 100644 index e5fc864bd7..0000000000 --- a/vendor/github.com/containerd/cgroups/cpuacct.go +++ /dev/null @@ -1,123 +0,0 @@ -/* - Copyright The containerd Authors. - - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. -*/ - -package cgroups - -import ( - "fmt" - "io/ioutil" - "path/filepath" - "strconv" - "strings" - - v1 "github.com/containerd/cgroups/stats/v1" -) - -const nanosecondsInSecond = 1000000000 - -var clockTicks = getClockTicks() - -func NewCpuacct(root string) *cpuacctController { - return &cpuacctController{ - root: filepath.Join(root, string(Cpuacct)), - } -} - -type cpuacctController struct { - root string -} - -func (c *cpuacctController) Name() Name { - return Cpuacct -} - -func (c *cpuacctController) Path(path string) string { - return filepath.Join(c.root, path) -} - -func (c *cpuacctController) Stat(path string, stats *v1.Metrics) error { - user, kernel, err := c.getUsage(path) - if err != nil { - return err - } - total, err := readUint(filepath.Join(c.Path(path), "cpuacct.usage")) - if err != nil { - return err - } - percpu, err := c.percpuUsage(path) - if err != nil { - return err - } - stats.CPU.Usage.Total = total - stats.CPU.Usage.User = user - stats.CPU.Usage.Kernel = kernel - stats.CPU.Usage.PerCPU = percpu - return nil -} - -func (c *cpuacctController) percpuUsage(path string) ([]uint64, error) { - var usage []uint64 - data, err := ioutil.ReadFile(filepath.Join(c.Path(path), "cpuacct.usage_percpu")) - if err != nil { - return nil, err - } - for _, v := range strings.Fields(string(data)) { - u, err := strconv.ParseUint(v, 10, 64) - if err != nil { - return nil, err - } - usage = append(usage, u) - } - return usage, nil -} - -func (c *cpuacctController) getUsage(path string) (user uint64, kernel uint64, err error) { - statPath := filepath.Join(c.Path(path), "cpuacct.stat") - data, err := ioutil.ReadFile(statPath) - if err != nil { - return 0, 0, err - } - fields := strings.Fields(string(data)) - if len(fields) != 4 { - return 0, 0, fmt.Errorf("%q is expected to have 4 fields", statPath) - } - for _, t := range []struct { - index int - name string - value *uint64 - }{ - { - index: 0, - name: "user", - value: &user, - }, - { - index: 2, - name: "system", - value: &kernel, - }, - } { - if fields[t.index] != t.name { - return 0, 0, fmt.Errorf("expected field %q but found %q in %q", t.name, fields[t.index], statPath) - } - v, err := strconv.ParseUint(fields[t.index+1], 10, 64) - if err != nil { - return 0, 0, err - } - *t.value = v - } - return (user * nanosecondsInSecond) / clockTicks, (kernel * nanosecondsInSecond) / clockTicks, nil -} diff --git a/vendor/github.com/containerd/cgroups/cpuset.go b/vendor/github.com/containerd/cgroups/cpuset.go deleted file mode 100644 index 3cae173bdd..0000000000 --- a/vendor/github.com/containerd/cgroups/cpuset.go +++ /dev/null @@ -1,159 +0,0 @@ -/* - Copyright The containerd Authors. - - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. -*/ - -package cgroups - -import ( - "bytes" - "fmt" - "io/ioutil" - "os" - "path/filepath" - - specs "github.com/opencontainers/runtime-spec/specs-go" -) - -func NewCpuset(root string) *cpusetController { - return &cpusetController{ - root: filepath.Join(root, string(Cpuset)), - } -} - -type cpusetController struct { - root string -} - -func (c *cpusetController) Name() Name { - return Cpuset -} - -func (c *cpusetController) Path(path string) string { - return filepath.Join(c.root, path) -} - -func (c *cpusetController) Create(path string, resources *specs.LinuxResources) error { - if err := c.ensureParent(c.Path(path), c.root); err != nil { - return err - } - if err := os.MkdirAll(c.Path(path), defaultDirPerm); err != nil { - return err - } - if err := c.copyIfNeeded(c.Path(path), filepath.Dir(c.Path(path))); err != nil { - return err - } - if resources.CPU != nil { - for _, t := range []struct { - name string - value string - }{ - { - name: "cpus", - value: resources.CPU.Cpus, - }, - { - name: "mems", - value: resources.CPU.Mems, - }, - } { - if t.value != "" { - if err := retryingWriteFile( - filepath.Join(c.Path(path), "cpuset."+t.name), - []byte(t.value), - defaultFilePerm, - ); err != nil { - return err - } - } - } - } - return nil -} - -func (c *cpusetController) Update(path string, resources *specs.LinuxResources) error { - return c.Create(path, resources) -} - -func (c *cpusetController) getValues(path string) (cpus []byte, mems []byte, err error) { - if cpus, err = ioutil.ReadFile(filepath.Join(path, "cpuset.cpus")); err != nil && !os.IsNotExist(err) { - return - } - if mems, err = ioutil.ReadFile(filepath.Join(path, "cpuset.mems")); err != nil && !os.IsNotExist(err) { - return - } - return cpus, mems, nil -} - -// ensureParent makes sure that the parent directory of current is created -// and populated with the proper cpus and mems files copied from -// it's parent. -func (c *cpusetController) ensureParent(current, root string) error { - parent := filepath.Dir(current) - if _, err := filepath.Rel(root, parent); err != nil { - return nil - } - // Avoid infinite recursion. - if parent == current { - return fmt.Errorf("cpuset: cgroup parent path outside cgroup root") - } - if cleanPath(parent) != root { - if err := c.ensureParent(parent, root); err != nil { - return err - } - } - if err := os.MkdirAll(current, defaultDirPerm); err != nil { - return err - } - return c.copyIfNeeded(current, parent) -} - -// copyIfNeeded copies the cpuset.cpus and cpuset.mems from the parent -// directory to the current directory if the file's contents are 0 -func (c *cpusetController) copyIfNeeded(current, parent string) error { - var ( - err error - currentCpus, currentMems []byte - parentCpus, parentMems []byte - ) - if currentCpus, currentMems, err = c.getValues(current); err != nil { - return err - } - if parentCpus, parentMems, err = c.getValues(parent); err != nil { - return err - } - if isEmpty(currentCpus) { - if err := retryingWriteFile( - filepath.Join(current, "cpuset.cpus"), - parentCpus, - defaultFilePerm, - ); err != nil { - return err - } - } - if isEmpty(currentMems) { - if err := retryingWriteFile( - filepath.Join(current, "cpuset.mems"), - parentMems, - defaultFilePerm, - ); err != nil { - return err - } - } - return nil -} - -func isEmpty(b []byte) bool { - return len(bytes.Trim(b, "\n")) == 0 -} diff --git a/vendor/github.com/containerd/cgroups/devices.go b/vendor/github.com/containerd/cgroups/devices.go deleted file mode 100644 index 7792566d5e..0000000000 --- a/vendor/github.com/containerd/cgroups/devices.go +++ /dev/null @@ -1,92 +0,0 @@ -/* - Copyright The containerd Authors. - - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. -*/ - -package cgroups - -import ( - "fmt" - "os" - "path/filepath" - - specs "github.com/opencontainers/runtime-spec/specs-go" -) - -const ( - allowDeviceFile = "devices.allow" - denyDeviceFile = "devices.deny" - wildcard = -1 -) - -func NewDevices(root string) *devicesController { - return &devicesController{ - root: filepath.Join(root, string(Devices)), - } -} - -type devicesController struct { - root string -} - -func (d *devicesController) Name() Name { - return Devices -} - -func (d *devicesController) Path(path string) string { - return filepath.Join(d.root, path) -} - -func (d *devicesController) Create(path string, resources *specs.LinuxResources) error { - if err := os.MkdirAll(d.Path(path), defaultDirPerm); err != nil { - return err - } - for _, device := range resources.Devices { - file := denyDeviceFile - if device.Allow { - file = allowDeviceFile - } - if device.Type == "" { - device.Type = "a" - } - if err := retryingWriteFile( - filepath.Join(d.Path(path), file), - []byte(deviceString(device)), - defaultFilePerm, - ); err != nil { - return err - } - } - return nil -} - -func (d *devicesController) Update(path string, resources *specs.LinuxResources) error { - return d.Create(path, resources) -} - -func deviceString(device specs.LinuxDeviceCgroup) string { - return fmt.Sprintf("%s %s:%s %s", - device.Type, - deviceNumber(device.Major), - deviceNumber(device.Minor), - device.Access, - ) -} - -func deviceNumber(number *int64) string { - if number == nil || *number == wildcard { - return "*" - } - return fmt.Sprint(*number) -} diff --git a/vendor/github.com/containerd/cgroups/errors.go b/vendor/github.com/containerd/cgroups/errors.go deleted file mode 100644 index f1ad8315c8..0000000000 --- a/vendor/github.com/containerd/cgroups/errors.go +++ /dev/null @@ -1,47 +0,0 @@ -/* - Copyright The containerd Authors. - - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. -*/ - -package cgroups - -import ( - "errors" - "os" -) - -var ( - ErrInvalidPid = errors.New("cgroups: pid must be greater than 0") - ErrMountPointNotExist = errors.New("cgroups: cgroup mountpoint does not exist") - ErrInvalidFormat = errors.New("cgroups: parsing file with invalid format failed") - ErrFreezerNotSupported = errors.New("cgroups: freezer cgroup not supported on this system") - ErrMemoryNotSupported = errors.New("cgroups: memory cgroup not supported on this system") - ErrCgroupDeleted = errors.New("cgroups: cgroup deleted") - ErrNoCgroupMountDestination = errors.New("cgroups: cannot find cgroup mount destination") -) - -// ErrorHandler is a function that handles and acts on errors -type ErrorHandler func(err error) error - -// IgnoreNotExist ignores any errors that are for not existing files -func IgnoreNotExist(err error) error { - if os.IsNotExist(err) { - return nil - } - return err -} - -func errPassthrough(err error) error { - return err -} diff --git a/vendor/github.com/containerd/cgroups/freezer.go b/vendor/github.com/containerd/cgroups/freezer.go deleted file mode 100644 index 59a7e71283..0000000000 --- a/vendor/github.com/containerd/cgroups/freezer.go +++ /dev/null @@ -1,82 +0,0 @@ -/* - Copyright The containerd Authors. - - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. -*/ - -package cgroups - -import ( - "io/ioutil" - "path/filepath" - "strings" - "time" -) - -func NewFreezer(root string) *freezerController { - return &freezerController{ - root: filepath.Join(root, string(Freezer)), - } -} - -type freezerController struct { - root string -} - -func (f *freezerController) Name() Name { - return Freezer -} - -func (f *freezerController) Path(path string) string { - return filepath.Join(f.root, path) -} - -func (f *freezerController) Freeze(path string) error { - return f.waitState(path, Frozen) -} - -func (f *freezerController) Thaw(path string) error { - return f.waitState(path, Thawed) -} - -func (f *freezerController) changeState(path string, state State) error { - return retryingWriteFile( - filepath.Join(f.root, path, "freezer.state"), - []byte(strings.ToUpper(string(state))), - defaultFilePerm, - ) -} - -func (f *freezerController) state(path string) (State, error) { - current, err := ioutil.ReadFile(filepath.Join(f.root, path, "freezer.state")) - if err != nil { - return "", err - } - return State(strings.ToLower(strings.TrimSpace(string(current)))), nil -} - -func (f *freezerController) waitState(path string, state State) error { - for { - if err := f.changeState(path, state); err != nil { - return err - } - current, err := f.state(path) - if err != nil { - return err - } - if current == state { - return nil - } - time.Sleep(1 * time.Millisecond) - } -} diff --git a/vendor/github.com/containerd/cgroups/go.mod b/vendor/github.com/containerd/cgroups/go.mod deleted file mode 100644 index b3df917d52..0000000000 --- a/vendor/github.com/containerd/cgroups/go.mod +++ /dev/null @@ -1,17 +0,0 @@ -module github.com/containerd/cgroups - -go 1.16 - -require ( - github.com/cilium/ebpf v0.4.0 - github.com/coreos/go-systemd/v22 v22.3.2 - github.com/cpuguy83/go-md2man/v2 v2.0.0 // indirect - github.com/docker/go-units v0.4.0 - github.com/godbus/dbus/v5 v5.0.4 - github.com/gogo/protobuf v1.3.2 - github.com/opencontainers/runtime-spec v1.0.2 - github.com/sirupsen/logrus v1.8.1 - github.com/stretchr/testify v1.6.1 - github.com/urfave/cli v1.22.2 - golang.org/x/sys v0.0.0-20210124154548-22da62e12c0c -) diff --git a/vendor/github.com/containerd/cgroups/go.sum b/vendor/github.com/containerd/cgroups/go.sum deleted file mode 100644 index 20ed896adc..0000000000 --- a/vendor/github.com/containerd/cgroups/go.sum +++ /dev/null @@ -1,80 +0,0 @@ -github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03qcyfWMU= -github.com/cilium/ebpf v0.4.0 h1:QlHdikaxALkqWasW8hAC1mfR0jdmvbfaBdBPFmRSglA= -github.com/cilium/ebpf v0.4.0/go.mod h1:4tRaxcgiL706VnOzHOdBlY8IEAIdxINsQBcU4xJJXRs= -github.com/coreos/go-systemd/v22 v22.3.2 h1:D9/bQk5vlXQFZ6Kwuu6zaiXJ9oTPe68++AzAJc1DzSI= -github.com/coreos/go-systemd/v22 v22.3.2/go.mod h1:Y58oyj3AT4RCenI/lSvhwexgC+NSVTIJ3seZv2GcEnc= -github.com/cpuguy83/go-md2man/v2 v2.0.0-20190314233015-f79a8a8ca69d/go.mod h1:maD7wRr/U5Z6m/iR4s+kqSMx2CaBsrgA7czyZG/E6dU= -github.com/cpuguy83/go-md2man/v2 v2.0.0 h1:EoUDS0afbrsXAZ9YQ9jdu/mZ2sXgT1/2yyNng4PGlyM= -github.com/cpuguy83/go-md2man/v2 v2.0.0/go.mod h1:maD7wRr/U5Z6m/iR4s+kqSMx2CaBsrgA7czyZG/E6dU= -github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= -github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= -github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= -github.com/docker/go-units v0.4.0 h1:3uh0PgVws3nIA0Q+MwDC8yjEPf9zjRfZZWXZYDct3Tw= -github.com/docker/go-units v0.4.0/go.mod h1:fgPhTUdO+D/Jk86RDLlptpiXQzgHJF7gydDDbaIK4Dk= -github.com/frankban/quicktest v1.11.3 h1:8sXhOn0uLys67V8EsXLc6eszDs8VXWxL3iRvebPhedY= -github.com/frankban/quicktest v1.11.3/go.mod h1:wRf/ReqHper53s+kmmSZizM8NamnL3IM0I9ntUbOk+k= -github.com/godbus/dbus/v5 v5.0.4 h1:9349emZab16e7zQvpmsbtjc18ykshndd8y2PG3sgJbA= -github.com/godbus/dbus/v5 v5.0.4/go.mod h1:xhWf0FNVPg57R7Z0UbKHbJfkEywrmjJnf7w5xrFpKfA= -github.com/gogo/protobuf v1.3.2 h1:Ov1cvc58UF3b5XjBnZv7+opcTcQFZebYjWzi34vdm4Q= -github.com/gogo/protobuf v1.3.2/go.mod h1:P1XiOD3dCwIKUDQYPy72D8LYyHL2YPYrpS2s69NZV8Q= -github.com/google/go-cmp v0.5.4 h1:L8R9j+yAqZuZjsqh/z+F1NCffTKKLShY6zXTItVIZ8M= -github.com/google/go-cmp v0.5.4/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= -github.com/kisielk/errcheck v1.5.0/go.mod h1:pFxgyoBC7bSaBwPgfKdkLd5X25qrDl4LWUI2bnpBCr8= -github.com/kisielk/gotool v1.0.0/go.mod h1:XhKaO+MFFWcvkIS/tQcRk01m1F5IRFswLeQ+oQHNcck= -github.com/kr/pretty v0.2.1 h1:Fmg33tUaq4/8ym9TJN1x7sLJnHVwhP33CNkpYV/7rwI= -github.com/kr/pretty v0.2.1/go.mod h1:ipq/a2n7PKx3OHsz4KJII5eveXtPO4qwEXGdVfWzfnI= -github.com/kr/pty v1.1.1/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ= -github.com/kr/text v0.1.0 h1:45sCR5RtlFHMR4UwH9sdQ5TC8v0qDQCHnXt+kaKSTVE= -github.com/kr/text v0.1.0/go.mod h1:4Jbv+DJW3UT/LiOwJeYQe1efqtUx/iVham/4vfdArNI= -github.com/opencontainers/runtime-spec v1.0.2 h1:UfAcuLBJB9Coz72x1hgl8O5RVzTdNiaglX6v2DM6FI0= -github.com/opencontainers/runtime-spec v1.0.2/go.mod h1:jwyrGlmzljRJv/Fgzds9SsS/C5hL+LL3ko9hs6T5lQ0= -github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= -github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= -github.com/russross/blackfriday/v2 v2.0.1 h1:lPqVAte+HuHNfhJ/0LC98ESWRz8afy9tM/0RK8m9o+Q= -github.com/russross/blackfriday/v2 v2.0.1/go.mod h1:+Rmxgy9KzJVeS9/2gXHxylqXiyQDYRxCVz55jmeOWTM= -github.com/shurcooL/sanitized_anchor_name v1.0.0 h1:PdmoCO6wvbs+7yrJyMORt4/BmY5IYyJwS/kOiWx8mHo= -github.com/shurcooL/sanitized_anchor_name v1.0.0/go.mod h1:1NzhyTcUVG4SuEtjjoZeVRXNmyL/1OwPU0+IJeTBvfc= -github.com/sirupsen/logrus v1.8.1 h1:dJKuHgqk1NNQlqoA6BTlM1Wf9DOH3NBjQyu0h9+AZZE= -github.com/sirupsen/logrus v1.8.1/go.mod h1:yWOB1SBYBC5VeMP7gHvWumXLIWorT60ONWic61uBYv0= -github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= -github.com/stretchr/testify v1.2.2/go.mod h1:a8OnRcib4nhh0OaRAV+Yts87kKdq0PP7pXfy6kDkUVs= -github.com/stretchr/testify v1.6.1 h1:hDPOHmpOpP40lSULcqw7IrRb/u7w6RpDC9399XyoNd0= -github.com/stretchr/testify v1.6.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= -github.com/urfave/cli v1.22.2 h1:gsqYFH8bb9ekPA12kRo0hfjngWQjkJPlN9R0N78BoUo= -github.com/urfave/cli v1.22.2/go.mod h1:Gos4lmkARVdJ6EkW0WaNv/tZAAMe9V7XWyB60NtXRu0= -github.com/yuin/goldmark v1.1.27/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= -github.com/yuin/goldmark v1.2.1/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= -golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= -golang.org/x/crypto v0.0.0-20191011191535-87dc89f01550/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= -golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= -golang.org/x/mod v0.2.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= -golang.org/x/mod v0.3.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= -golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= -golang.org/x/net v0.0.0-20190620200207-3b0461eec859/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= -golang.org/x/net v0.0.0-20200226121028-0de0cce0169b/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= -golang.org/x/net v0.0.0-20201021035429-f5854403a974/go.mod h1:sp8m0HH+o8qH0wwXwYZr8TS3Oi6o0r6Gce1SSxlDquU= -golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= -golang.org/x/sync v0.0.0-20190911185100-cd5d95a43a6e/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= -golang.org/x/sync v0.0.0-20201020160332-67f06af15bc9/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= -golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= -golang.org/x/sys v0.0.0-20190412213103-97732733099d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20191026070338-33540a1f6037/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20200930185726-fdedc70b468f/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20210124154548-22da62e12c0c h1:VwygUrnw9jn88c4u8GD3rZQbqrP/tgas88tPUbBxQrk= -golang.org/x/sys v0.0.0-20210124154548-22da62e12c0c/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= -golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= -golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= -golang.org/x/tools v0.0.0-20191119224855-298f0cb1881e/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= -golang.org/x/tools v0.0.0-20200619180055-7c47624df98f/go.mod h1:EkVYQZoAsY45+roYkvgYkIh4xh/qjgUK9TdY2XT94GE= -golang.org/x/tools v0.0.0-20210106214847-113979e3529a/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA= -golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= -golang.org/x/xerrors v0.0.0-20191011141410-1b5146add898/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= -golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= -golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1 h1:go1bK/D/BFZV2I8cIQd1NKEZ+0owSTG1fDTci4IqFcE= -golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= -gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405 h1:yhCVgyC4o1eVCa2tZl7eS0r+SDo693bJlVdllGtEeKM= -gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= -gopkg.in/yaml.v2 v2.2.2/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= -gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c h1:dUUwHk2QECo/6vqA44rthZ8ie2QXMNeKRTHCNY2nXvo= -gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= diff --git a/vendor/github.com/containerd/cgroups/hierarchy.go b/vendor/github.com/containerd/cgroups/hierarchy.go deleted file mode 100644 index ca3f1b9380..0000000000 --- a/vendor/github.com/containerd/cgroups/hierarchy.go +++ /dev/null @@ -1,20 +0,0 @@ -/* - Copyright The containerd Authors. - - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. -*/ - -package cgroups - -// Hierarchy enables both unified and split hierarchy for cgroups -type Hierarchy func() ([]Subsystem, error) diff --git a/vendor/github.com/containerd/cgroups/hugetlb.go b/vendor/github.com/containerd/cgroups/hugetlb.go deleted file mode 100644 index c0eb03b24d..0000000000 --- a/vendor/github.com/containerd/cgroups/hugetlb.go +++ /dev/null @@ -1,109 +0,0 @@ -/* - Copyright The containerd Authors. - - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. -*/ - -package cgroups - -import ( - "os" - "path/filepath" - "strconv" - "strings" - - v1 "github.com/containerd/cgroups/stats/v1" - specs "github.com/opencontainers/runtime-spec/specs-go" -) - -func NewHugetlb(root string) (*hugetlbController, error) { - sizes, err := hugePageSizes() - if err != nil { - return nil, err - } - - return &hugetlbController{ - root: filepath.Join(root, string(Hugetlb)), - sizes: sizes, - }, nil -} - -type hugetlbController struct { - root string - sizes []string -} - -func (h *hugetlbController) Name() Name { - return Hugetlb -} - -func (h *hugetlbController) Path(path string) string { - return filepath.Join(h.root, path) -} - -func (h *hugetlbController) Create(path string, resources *specs.LinuxResources) error { - if err := os.MkdirAll(h.Path(path), defaultDirPerm); err != nil { - return err - } - for _, limit := range resources.HugepageLimits { - if err := retryingWriteFile( - filepath.Join(h.Path(path), strings.Join([]string{"hugetlb", limit.Pagesize, "limit_in_bytes"}, ".")), - []byte(strconv.FormatUint(limit.Limit, 10)), - defaultFilePerm, - ); err != nil { - return err - } - } - return nil -} - -func (h *hugetlbController) Stat(path string, stats *v1.Metrics) error { - for _, size := range h.sizes { - s, err := h.readSizeStat(path, size) - if err != nil { - return err - } - stats.Hugetlb = append(stats.Hugetlb, s) - } - return nil -} - -func (h *hugetlbController) readSizeStat(path, size string) (*v1.HugetlbStat, error) { - s := v1.HugetlbStat{ - Pagesize: size, - } - for _, t := range []struct { - name string - value *uint64 - }{ - { - name: "usage_in_bytes", - value: &s.Usage, - }, - { - name: "max_usage_in_bytes", - value: &s.Max, - }, - { - name: "failcnt", - value: &s.Failcnt, - }, - } { - v, err := readUint(filepath.Join(h.Path(path), strings.Join([]string{"hugetlb", size, t.name}, "."))) - if err != nil { - return nil, err - } - *t.value = v - } - return &s, nil -} diff --git a/vendor/github.com/containerd/cgroups/memory.go b/vendor/github.com/containerd/cgroups/memory.go deleted file mode 100644 index e271866ef9..0000000000 --- a/vendor/github.com/containerd/cgroups/memory.go +++ /dev/null @@ -1,480 +0,0 @@ -/* - Copyright The containerd Authors. - - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. -*/ - -package cgroups - -import ( - "bufio" - "fmt" - "io" - "os" - "path/filepath" - "strconv" - "strings" - - v1 "github.com/containerd/cgroups/stats/v1" - specs "github.com/opencontainers/runtime-spec/specs-go" - "golang.org/x/sys/unix" -) - -// MemoryEvent is an interface that V1 memory Cgroup notifications implement. Arg returns the -// file name whose fd should be written to "cgroups.event_control". EventFile returns the name of -// the file that supports the notification api e.g. "memory.usage_in_bytes". -type MemoryEvent interface { - Arg() string - EventFile() string -} - -type memoryThresholdEvent struct { - threshold uint64 - swap bool -} - -// MemoryThresholdEvent returns a new memory threshold event to be used with RegisterMemoryEvent. -// If swap is true, the event will be registered using memory.memsw.usage_in_bytes -func MemoryThresholdEvent(threshold uint64, swap bool) MemoryEvent { - return &memoryThresholdEvent{ - threshold, - swap, - } -} - -func (m *memoryThresholdEvent) Arg() string { - return strconv.FormatUint(m.threshold, 10) -} - -func (m *memoryThresholdEvent) EventFile() string { - if m.swap { - return "memory.memsw.usage_in_bytes" - } - return "memory.usage_in_bytes" -} - -type oomEvent struct{} - -// OOMEvent returns a new oom event to be used with RegisterMemoryEvent. -func OOMEvent() MemoryEvent { - return &oomEvent{} -} - -func (oom *oomEvent) Arg() string { - return "" -} - -func (oom *oomEvent) EventFile() string { - return "memory.oom_control" -} - -type memoryPressureEvent struct { - pressureLevel MemoryPressureLevel - hierarchy EventNotificationMode -} - -// MemoryPressureEvent returns a new memory pressure event to be used with RegisterMemoryEvent. -func MemoryPressureEvent(pressureLevel MemoryPressureLevel, hierarchy EventNotificationMode) MemoryEvent { - return &memoryPressureEvent{ - pressureLevel, - hierarchy, - } -} - -func (m *memoryPressureEvent) Arg() string { - return string(m.pressureLevel) + "," + string(m.hierarchy) -} - -func (m *memoryPressureEvent) EventFile() string { - return "memory.pressure_level" -} - -// MemoryPressureLevel corresponds to the memory pressure levels defined -// for memory cgroups. -type MemoryPressureLevel string - -// The three memory pressure levels are as follows. -// - The "low" level means that the system is reclaiming memory for new -// allocations. Monitoring this reclaiming activity might be useful for -// maintaining cache level. Upon notification, the program (typically -// "Activity Manager") might analyze vmstat and act in advance (i.e. -// prematurely shutdown unimportant services). -// - The "medium" level means that the system is experiencing medium memory -// pressure, the system might be making swap, paging out active file caches, -// etc. Upon this event applications may decide to further analyze -// vmstat/zoneinfo/memcg or internal memory usage statistics and free any -// resources that can be easily reconstructed or re-read from a disk. -// - The "critical" level means that the system is actively thrashing, it is -// about to out of memory (OOM) or even the in-kernel OOM killer is on its -// way to trigger. Applications should do whatever they can to help the -// system. It might be too late to consult with vmstat or any other -// statistics, so it is advisable to take an immediate action. -// "https://www.kernel.org/doc/Documentation/cgroup-v1/memory.txt" Section 11 -const ( - LowPressure MemoryPressureLevel = "low" - MediumPressure MemoryPressureLevel = "medium" - CriticalPressure MemoryPressureLevel = "critical" -) - -// EventNotificationMode corresponds to the notification modes -// for the memory cgroups pressure level notifications. -type EventNotificationMode string - -// There are three optional modes that specify different propagation behavior: -// - "default": this is the default behavior specified above. This mode is the -// same as omitting the optional mode parameter, preserved by backwards -// compatibility. -// - "hierarchy": events always propagate up to the root, similar to the default -// behavior, except that propagation continues regardless of whether there are -// event listeners at each level, with the "hierarchy" mode. In the above -// example, groups A, B, and C will receive notification of memory pressure. -// - "local": events are pass-through, i.e. they only receive notifications when -// memory pressure is experienced in the memcg for which the notification is -// registered. In the above example, group C will receive notification if -// registered for "local" notification and the group experiences memory -// pressure. However, group B will never receive notification, regardless if -// there is an event listener for group C or not, if group B is registered for -// local notification. -// "https://www.kernel.org/doc/Documentation/cgroup-v1/memory.txt" Section 11 -const ( - DefaultMode EventNotificationMode = "default" - LocalMode EventNotificationMode = "local" - HierarchyMode EventNotificationMode = "hierarchy" -) - -// NewMemory returns a Memory controller given the root folder of cgroups. -// It may optionally accept other configuration options, such as IgnoreModules(...) -func NewMemory(root string, options ...func(*memoryController)) *memoryController { - mc := &memoryController{ - root: filepath.Join(root, string(Memory)), - ignored: map[string]struct{}{}, - } - for _, opt := range options { - opt(mc) - } - return mc -} - -// IgnoreModules configure the memory controller to not read memory metrics for some -// module names (e.g. passing "memsw" would avoid all the memory.memsw.* entries) -func IgnoreModules(names ...string) func(*memoryController) { - return func(mc *memoryController) { - for _, name := range names { - mc.ignored[name] = struct{}{} - } - } -} - -// OptionalSwap allows the memory controller to not fail if cgroups is not accounting -// Swap memory (there are no memory.memsw.* entries) -func OptionalSwap() func(*memoryController) { - return func(mc *memoryController) { - _, err := os.Stat(filepath.Join(mc.root, "memory.memsw.usage_in_bytes")) - if os.IsNotExist(err) { - mc.ignored["memsw"] = struct{}{} - } - } -} - -type memoryController struct { - root string - ignored map[string]struct{} -} - -func (m *memoryController) Name() Name { - return Memory -} - -func (m *memoryController) Path(path string) string { - return filepath.Join(m.root, path) -} - -func (m *memoryController) Create(path string, resources *specs.LinuxResources) error { - if err := os.MkdirAll(m.Path(path), defaultDirPerm); err != nil { - return err - } - if resources.Memory == nil { - return nil - } - return m.set(path, getMemorySettings(resources)) -} - -func (m *memoryController) Update(path string, resources *specs.LinuxResources) error { - if resources.Memory == nil { - return nil - } - g := func(v *int64) bool { - return v != nil && *v > 0 - } - settings := getMemorySettings(resources) - if g(resources.Memory.Limit) && g(resources.Memory.Swap) { - // if the updated swap value is larger than the current memory limit set the swap changes first - // then set the memory limit as swap must always be larger than the current limit - current, err := readUint(filepath.Join(m.Path(path), "memory.limit_in_bytes")) - if err != nil { - return err - } - if current < uint64(*resources.Memory.Swap) { - settings[0], settings[1] = settings[1], settings[0] - } - } - return m.set(path, settings) -} - -func (m *memoryController) Stat(path string, stats *v1.Metrics) error { - fMemStat, err := os.Open(filepath.Join(m.Path(path), "memory.stat")) - if err != nil { - return err - } - defer fMemStat.Close() - stats.Memory = &v1.MemoryStat{ - Usage: &v1.MemoryEntry{}, - Swap: &v1.MemoryEntry{}, - Kernel: &v1.MemoryEntry{}, - KernelTCP: &v1.MemoryEntry{}, - } - if err := m.parseStats(fMemStat, stats.Memory); err != nil { - return err - } - - fMemOomControl, err := os.Open(filepath.Join(m.Path(path), "memory.oom_control")) - if err != nil { - return err - } - defer fMemOomControl.Close() - stats.MemoryOomControl = &v1.MemoryOomControl{} - if err := m.parseOomControlStats(fMemOomControl, stats.MemoryOomControl); err != nil { - return err - } - for _, t := range []struct { - module string - entry *v1.MemoryEntry - }{ - { - module: "", - entry: stats.Memory.Usage, - }, - { - module: "memsw", - entry: stats.Memory.Swap, - }, - { - module: "kmem", - entry: stats.Memory.Kernel, - }, - { - module: "kmem.tcp", - entry: stats.Memory.KernelTCP, - }, - } { - if _, ok := m.ignored[t.module]; ok { - continue - } - for _, tt := range []struct { - name string - value *uint64 - }{ - { - name: "usage_in_bytes", - value: &t.entry.Usage, - }, - { - name: "max_usage_in_bytes", - value: &t.entry.Max, - }, - { - name: "failcnt", - value: &t.entry.Failcnt, - }, - { - name: "limit_in_bytes", - value: &t.entry.Limit, - }, - } { - parts := []string{"memory"} - if t.module != "" { - parts = append(parts, t.module) - } - parts = append(parts, tt.name) - v, err := readUint(filepath.Join(m.Path(path), strings.Join(parts, "."))) - if err != nil { - return err - } - *tt.value = v - } - } - return nil -} - -func (m *memoryController) parseStats(r io.Reader, stat *v1.MemoryStat) error { - var ( - raw = make(map[string]uint64) - sc = bufio.NewScanner(r) - line int - ) - for sc.Scan() { - key, v, err := parseKV(sc.Text()) - if err != nil { - return fmt.Errorf("%d: %v", line, err) - } - raw[key] = v - line++ - } - if err := sc.Err(); err != nil { - return err - } - stat.Cache = raw["cache"] - stat.RSS = raw["rss"] - stat.RSSHuge = raw["rss_huge"] - stat.MappedFile = raw["mapped_file"] - stat.Dirty = raw["dirty"] - stat.Writeback = raw["writeback"] - stat.PgPgIn = raw["pgpgin"] - stat.PgPgOut = raw["pgpgout"] - stat.PgFault = raw["pgfault"] - stat.PgMajFault = raw["pgmajfault"] - stat.InactiveAnon = raw["inactive_anon"] - stat.ActiveAnon = raw["active_anon"] - stat.InactiveFile = raw["inactive_file"] - stat.ActiveFile = raw["active_file"] - stat.Unevictable = raw["unevictable"] - stat.HierarchicalMemoryLimit = raw["hierarchical_memory_limit"] - stat.HierarchicalSwapLimit = raw["hierarchical_memsw_limit"] - stat.TotalCache = raw["total_cache"] - stat.TotalRSS = raw["total_rss"] - stat.TotalRSSHuge = raw["total_rss_huge"] - stat.TotalMappedFile = raw["total_mapped_file"] - stat.TotalDirty = raw["total_dirty"] - stat.TotalWriteback = raw["total_writeback"] - stat.TotalPgPgIn = raw["total_pgpgin"] - stat.TotalPgPgOut = raw["total_pgpgout"] - stat.TotalPgFault = raw["total_pgfault"] - stat.TotalPgMajFault = raw["total_pgmajfault"] - stat.TotalInactiveAnon = raw["total_inactive_anon"] - stat.TotalActiveAnon = raw["total_active_anon"] - stat.TotalInactiveFile = raw["total_inactive_file"] - stat.TotalActiveFile = raw["total_active_file"] - stat.TotalUnevictable = raw["total_unevictable"] - return nil -} - -func (m *memoryController) parseOomControlStats(r io.Reader, stat *v1.MemoryOomControl) error { - var ( - raw = make(map[string]uint64) - sc = bufio.NewScanner(r) - line int - ) - for sc.Scan() { - key, v, err := parseKV(sc.Text()) - if err != nil { - return fmt.Errorf("%d: %v", line, err) - } - raw[key] = v - line++ - } - if err := sc.Err(); err != nil { - return err - } - stat.OomKillDisable = raw["oom_kill_disable"] - stat.UnderOom = raw["under_oom"] - stat.OomKill = raw["oom_kill"] - return nil -} - -func (m *memoryController) set(path string, settings []memorySettings) error { - for _, t := range settings { - if t.value != nil { - if err := retryingWriteFile( - filepath.Join(m.Path(path), "memory."+t.name), - []byte(strconv.FormatInt(*t.value, 10)), - defaultFilePerm, - ); err != nil { - return err - } - } - } - return nil -} - -type memorySettings struct { - name string - value *int64 -} - -func getMemorySettings(resources *specs.LinuxResources) []memorySettings { - mem := resources.Memory - var swappiness *int64 - if mem.Swappiness != nil { - v := int64(*mem.Swappiness) - swappiness = &v - } - return []memorySettings{ - { - name: "limit_in_bytes", - value: mem.Limit, - }, - { - name: "soft_limit_in_bytes", - value: mem.Reservation, - }, - { - name: "memsw.limit_in_bytes", - value: mem.Swap, - }, - { - name: "kmem.limit_in_bytes", - value: mem.Kernel, - }, - { - name: "kmem.tcp.limit_in_bytes", - value: mem.KernelTCP, - }, - { - name: "oom_control", - value: getOomControlValue(mem), - }, - { - name: "swappiness", - value: swappiness, - }, - } -} - -func getOomControlValue(mem *specs.LinuxMemory) *int64 { - if mem.DisableOOMKiller != nil && *mem.DisableOOMKiller { - i := int64(1) - return &i - } - return nil -} - -func (m *memoryController) memoryEvent(path string, event MemoryEvent) (uintptr, error) { - root := m.Path(path) - efd, err := unix.Eventfd(0, unix.EFD_CLOEXEC) - if err != nil { - return 0, err - } - evtFile, err := os.Open(filepath.Join(root, event.EventFile())) - if err != nil { - unix.Close(efd) - return 0, err - } - defer evtFile.Close() - data := fmt.Sprintf("%d %d %s", efd, evtFile.Fd(), event.Arg()) - evctlPath := filepath.Join(root, "cgroup.event_control") - if err := retryingWriteFile(evctlPath, []byte(data), 0700); err != nil { - unix.Close(efd) - return 0, err - } - return uintptr(efd), nil -} diff --git a/vendor/github.com/containerd/cgroups/named.go b/vendor/github.com/containerd/cgroups/named.go deleted file mode 100644 index 06b16c3b15..0000000000 --- a/vendor/github.com/containerd/cgroups/named.go +++ /dev/null @@ -1,39 +0,0 @@ -/* - Copyright The containerd Authors. - - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. -*/ - -package cgroups - -import "path/filepath" - -func NewNamed(root string, name Name) *namedController { - return &namedController{ - root: root, - name: name, - } -} - -type namedController struct { - root string - name Name -} - -func (n *namedController) Name() Name { - return n.name -} - -func (n *namedController) Path(path string) string { - return filepath.Join(n.root, string(n.name), path) -} diff --git a/vendor/github.com/containerd/cgroups/net_cls.go b/vendor/github.com/containerd/cgroups/net_cls.go deleted file mode 100644 index 839b06de08..0000000000 --- a/vendor/github.com/containerd/cgroups/net_cls.go +++ /dev/null @@ -1,61 +0,0 @@ -/* - Copyright The containerd Authors. - - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. -*/ - -package cgroups - -import ( - "os" - "path/filepath" - "strconv" - - specs "github.com/opencontainers/runtime-spec/specs-go" -) - -func NewNetCls(root string) *netclsController { - return &netclsController{ - root: filepath.Join(root, string(NetCLS)), - } -} - -type netclsController struct { - root string -} - -func (n *netclsController) Name() Name { - return NetCLS -} - -func (n *netclsController) Path(path string) string { - return filepath.Join(n.root, path) -} - -func (n *netclsController) Create(path string, resources *specs.LinuxResources) error { - if err := os.MkdirAll(n.Path(path), defaultDirPerm); err != nil { - return err - } - if resources.Network != nil && resources.Network.ClassID != nil && *resources.Network.ClassID > 0 { - return retryingWriteFile( - filepath.Join(n.Path(path), "net_cls.classid"), - []byte(strconv.FormatUint(uint64(*resources.Network.ClassID), 10)), - defaultFilePerm, - ) - } - return nil -} - -func (n *netclsController) Update(path string, resources *specs.LinuxResources) error { - return n.Create(path, resources) -} diff --git a/vendor/github.com/containerd/cgroups/net_prio.go b/vendor/github.com/containerd/cgroups/net_prio.go deleted file mode 100644 index 6362fd084f..0000000000 --- a/vendor/github.com/containerd/cgroups/net_prio.go +++ /dev/null @@ -1,65 +0,0 @@ -/* - Copyright The containerd Authors. - - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. -*/ - -package cgroups - -import ( - "fmt" - "os" - "path/filepath" - - specs "github.com/opencontainers/runtime-spec/specs-go" -) - -func NewNetPrio(root string) *netprioController { - return &netprioController{ - root: filepath.Join(root, string(NetPrio)), - } -} - -type netprioController struct { - root string -} - -func (n *netprioController) Name() Name { - return NetPrio -} - -func (n *netprioController) Path(path string) string { - return filepath.Join(n.root, path) -} - -func (n *netprioController) Create(path string, resources *specs.LinuxResources) error { - if err := os.MkdirAll(n.Path(path), defaultDirPerm); err != nil { - return err - } - if resources.Network != nil { - for _, prio := range resources.Network.Priorities { - if err := retryingWriteFile( - filepath.Join(n.Path(path), "net_prio.ifpriomap"), - formatPrio(prio.Name, prio.Priority), - defaultFilePerm, - ); err != nil { - return err - } - } - } - return nil -} - -func formatPrio(name string, prio uint32) []byte { - return []byte(fmt.Sprintf("%s %d", name, prio)) -} diff --git a/vendor/github.com/containerd/cgroups/opts.go b/vendor/github.com/containerd/cgroups/opts.go deleted file mode 100644 index 1e428d0480..0000000000 --- a/vendor/github.com/containerd/cgroups/opts.go +++ /dev/null @@ -1,61 +0,0 @@ -/* - Copyright The containerd Authors. - - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. -*/ - -package cgroups - -import ( - "errors" -) - -var ( - // ErrIgnoreSubsystem allows the specific subsystem to be skipped - ErrIgnoreSubsystem = errors.New("skip subsystem") - // ErrDevicesRequired is returned when the devices subsystem is required but - // does not exist or is not active - ErrDevicesRequired = errors.New("devices subsystem is required") -) - -// InitOpts allows configuration for the creation or loading of a cgroup -type InitOpts func(*InitConfig) error - -// InitConfig provides configuration options for the creation -// or loading of a cgroup and its subsystems -type InitConfig struct { - // InitCheck can be used to check initialization errors from the subsystem - InitCheck InitCheck -} - -func newInitConfig() *InitConfig { - return &InitConfig{ - InitCheck: RequireDevices, - } -} - -// InitCheck allows subsystems errors to be checked when initialized or loaded -type InitCheck func(Subsystem, Path, error) error - -// AllowAny allows any subsystem errors to be skipped -func AllowAny(_ Subsystem, _ Path, _ error) error { - return ErrIgnoreSubsystem -} - -// RequireDevices requires the device subsystem but no others -func RequireDevices(s Subsystem, _ Path, _ error) error { - if s.Name() == Devices { - return ErrDevicesRequired - } - return ErrIgnoreSubsystem -} diff --git a/vendor/github.com/containerd/cgroups/paths.go b/vendor/github.com/containerd/cgroups/paths.go deleted file mode 100644 index bddc4e9cdc..0000000000 --- a/vendor/github.com/containerd/cgroups/paths.go +++ /dev/null @@ -1,106 +0,0 @@ -/* - Copyright The containerd Authors. - - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. -*/ - -package cgroups - -import ( - "errors" - "fmt" - "path/filepath" -) - -type Path func(subsystem Name) (string, error) - -func RootPath(subsystem Name) (string, error) { - return "/", nil -} - -// StaticPath returns a static path to use for all cgroups -func StaticPath(path string) Path { - return func(_ Name) (string, error) { - return path, nil - } -} - -// NestedPath will nest the cgroups based on the calling processes cgroup -// placing its child processes inside its own path -func NestedPath(suffix string) Path { - paths, err := ParseCgroupFile("/proc/self/cgroup") - if err != nil { - return errorPath(err) - } - return existingPath(paths, suffix) -} - -// PidPath will return the correct cgroup paths for an existing process running inside a cgroup -// This is commonly used for the Load function to restore an existing container -func PidPath(pid int) Path { - p := fmt.Sprintf("/proc/%d/cgroup", pid) - paths, err := ParseCgroupFile(p) - if err != nil { - return errorPath(fmt.Errorf("parse cgroup file %s: %w", p, err)) - } - return existingPath(paths, "") -} - -// ErrControllerNotActive is returned when a controller is not supported or enabled -var ErrControllerNotActive = errors.New("controller is not supported") - -func existingPath(paths map[string]string, suffix string) Path { - // localize the paths based on the root mount dest for nested cgroups - for n, p := range paths { - dest, err := getCgroupDestination(n) - if err != nil { - return errorPath(err) - } - rel, err := filepath.Rel(dest, p) - if err != nil { - return errorPath(err) - } - if rel == "." { - rel = dest - } - paths[n] = filepath.Join("/", rel) - } - return func(name Name) (string, error) { - root, ok := paths[string(name)] - if !ok { - if root, ok = paths["name="+string(name)]; !ok { - return "", ErrControllerNotActive - } - } - if suffix != "" { - return filepath.Join(root, suffix), nil - } - return root, nil - } -} - -func subPath(path Path, subName string) Path { - return func(name Name) (string, error) { - p, err := path(name) - if err != nil { - return "", err - } - return filepath.Join(p, subName), nil - } -} - -func errorPath(err error) Path { - return func(_ Name) (string, error) { - return "", err - } -} diff --git a/vendor/github.com/containerd/cgroups/perf_event.go b/vendor/github.com/containerd/cgroups/perf_event.go deleted file mode 100644 index 648786db68..0000000000 --- a/vendor/github.com/containerd/cgroups/perf_event.go +++ /dev/null @@ -1,37 +0,0 @@ -/* - Copyright The containerd Authors. - - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. -*/ - -package cgroups - -import "path/filepath" - -func NewPerfEvent(root string) *PerfEventController { - return &PerfEventController{ - root: filepath.Join(root, string(PerfEvent)), - } -} - -type PerfEventController struct { - root string -} - -func (p *PerfEventController) Name() Name { - return PerfEvent -} - -func (p *PerfEventController) Path(path string) string { - return filepath.Join(p.root, path) -} diff --git a/vendor/github.com/containerd/cgroups/pids.go b/vendor/github.com/containerd/cgroups/pids.go deleted file mode 100644 index ce78e44c18..0000000000 --- a/vendor/github.com/containerd/cgroups/pids.go +++ /dev/null @@ -1,86 +0,0 @@ -/* - Copyright The containerd Authors. - - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. -*/ - -package cgroups - -import ( - "io/ioutil" - "os" - "path/filepath" - "strconv" - "strings" - - v1 "github.com/containerd/cgroups/stats/v1" - specs "github.com/opencontainers/runtime-spec/specs-go" -) - -func NewPids(root string) *pidsController { - return &pidsController{ - root: filepath.Join(root, string(Pids)), - } -} - -type pidsController struct { - root string -} - -func (p *pidsController) Name() Name { - return Pids -} - -func (p *pidsController) Path(path string) string { - return filepath.Join(p.root, path) -} - -func (p *pidsController) Create(path string, resources *specs.LinuxResources) error { - if err := os.MkdirAll(p.Path(path), defaultDirPerm); err != nil { - return err - } - if resources.Pids != nil && resources.Pids.Limit > 0 { - return retryingWriteFile( - filepath.Join(p.Path(path), "pids.max"), - []byte(strconv.FormatInt(resources.Pids.Limit, 10)), - defaultFilePerm, - ) - } - return nil -} - -func (p *pidsController) Update(path string, resources *specs.LinuxResources) error { - return p.Create(path, resources) -} - -func (p *pidsController) Stat(path string, stats *v1.Metrics) error { - current, err := readUint(filepath.Join(p.Path(path), "pids.current")) - if err != nil { - return err - } - var max uint64 - maxData, err := ioutil.ReadFile(filepath.Join(p.Path(path), "pids.max")) - if err != nil { - return err - } - if maxS := strings.TrimSpace(string(maxData)); maxS != "max" { - if max, err = parseUint(maxS, 10, 64); err != nil { - return err - } - } - stats.Pids = &v1.PidsStat{ - Current: current, - Limit: max, - } - return nil -} diff --git a/vendor/github.com/containerd/cgroups/rdma.go b/vendor/github.com/containerd/cgroups/rdma.go deleted file mode 100644 index b6f0d416c7..0000000000 --- a/vendor/github.com/containerd/cgroups/rdma.go +++ /dev/null @@ -1,154 +0,0 @@ -/* - Copyright The containerd Authors. - - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. -*/ - -package cgroups - -import ( - "io/ioutil" - "math" - "os" - "path/filepath" - "strconv" - "strings" - - v1 "github.com/containerd/cgroups/stats/v1" - specs "github.com/opencontainers/runtime-spec/specs-go" -) - -type rdmaController struct { - root string -} - -func (p *rdmaController) Name() Name { - return Rdma -} - -func (p *rdmaController) Path(path string) string { - return filepath.Join(p.root, path) -} - -func NewRdma(root string) *rdmaController { - return &rdmaController{ - root: filepath.Join(root, string(Rdma)), - } -} - -func createCmdString(device string, limits *specs.LinuxRdma) string { - var cmdString string - - cmdString = device - if limits.HcaHandles != nil { - cmdString = cmdString + " " + "hca_handle=" + strconv.FormatUint(uint64(*limits.HcaHandles), 10) - } - - if limits.HcaObjects != nil { - cmdString = cmdString + " " + "hca_object=" + strconv.FormatUint(uint64(*limits.HcaObjects), 10) - } - return cmdString -} - -func (p *rdmaController) Create(path string, resources *specs.LinuxResources) error { - if err := os.MkdirAll(p.Path(path), defaultDirPerm); err != nil { - return err - } - - for device, limit := range resources.Rdma { - if device != "" && (limit.HcaHandles != nil || limit.HcaObjects != nil) { - return retryingWriteFile( - filepath.Join(p.Path(path), "rdma.max"), - []byte(createCmdString(device, &limit)), - defaultFilePerm, - ) - } - } - return nil -} - -func (p *rdmaController) Update(path string, resources *specs.LinuxResources) error { - return p.Create(path, resources) -} - -func parseRdmaKV(raw string, entry *v1.RdmaEntry) { - var value uint64 - var err error - - parts := strings.Split(raw, "=") - switch len(parts) { - case 2: - if parts[1] == "max" { - value = math.MaxUint32 - } else { - value, err = parseUint(parts[1], 10, 32) - if err != nil { - return - } - } - if parts[0] == "hca_handle" { - entry.HcaHandles = uint32(value) - } else if parts[0] == "hca_object" { - entry.HcaObjects = uint32(value) - } - } -} - -func toRdmaEntry(strEntries []string) []*v1.RdmaEntry { - var rdmaEntries []*v1.RdmaEntry - for i := range strEntries { - parts := strings.Fields(strEntries[i]) - switch len(parts) { - case 3: - entry := new(v1.RdmaEntry) - entry.Device = parts[0] - parseRdmaKV(parts[1], entry) - parseRdmaKV(parts[2], entry) - - rdmaEntries = append(rdmaEntries, entry) - default: - continue - } - } - return rdmaEntries -} - -func (p *rdmaController) Stat(path string, stats *v1.Metrics) error { - - currentData, err := ioutil.ReadFile(filepath.Join(p.Path(path), "rdma.current")) - if err != nil { - return err - } - currentPerDevices := strings.Split(string(currentData), "\n") - - maxData, err := ioutil.ReadFile(filepath.Join(p.Path(path), "rdma.max")) - if err != nil { - return err - } - maxPerDevices := strings.Split(string(maxData), "\n") - - // If device got removed between reading two files, ignore returning - // stats. - if len(currentPerDevices) != len(maxPerDevices) { - return nil - } - - currentEntries := toRdmaEntry(currentPerDevices) - maxEntries := toRdmaEntry(maxPerDevices) - - stats.Rdma = &v1.RdmaStat{ - Current: currentEntries, - Limit: maxEntries, - } - return nil -} diff --git a/vendor/github.com/containerd/cgroups/state.go b/vendor/github.com/containerd/cgroups/state.go deleted file mode 100644 index cfeabbbc60..0000000000 --- a/vendor/github.com/containerd/cgroups/state.go +++ /dev/null @@ -1,28 +0,0 @@ -/* - Copyright The containerd Authors. - - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. -*/ - -package cgroups - -// State is a type that represents the state of the current cgroup -type State string - -const ( - Unknown State = "" - Thawed State = "thawed" - Frozen State = "frozen" - Freezing State = "freezing" - Deleted State = "deleted" -) diff --git a/vendor/github.com/containerd/cgroups/stats/v1/doc.go b/vendor/github.com/containerd/cgroups/stats/v1/doc.go deleted file mode 100644 index 23f3cdd4b3..0000000000 --- a/vendor/github.com/containerd/cgroups/stats/v1/doc.go +++ /dev/null @@ -1,17 +0,0 @@ -/* - Copyright The containerd Authors. - - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. -*/ - -package v1 diff --git a/vendor/github.com/containerd/cgroups/stats/v1/metrics.pb.go b/vendor/github.com/containerd/cgroups/stats/v1/metrics.pb.go deleted file mode 100644 index 6d2d41770b..0000000000 --- a/vendor/github.com/containerd/cgroups/stats/v1/metrics.pb.go +++ /dev/null @@ -1,6125 +0,0 @@ -// Code generated by protoc-gen-gogo. DO NOT EDIT. -// source: github.com/containerd/cgroups/stats/v1/metrics.proto - -package v1 - -import ( - fmt "fmt" - _ "github.com/gogo/protobuf/gogoproto" - proto "github.com/gogo/protobuf/proto" - io "io" - math "math" - math_bits "math/bits" - reflect "reflect" - strings "strings" -) - -// Reference imports to suppress errors if they are not otherwise used. -var _ = proto.Marshal -var _ = fmt.Errorf -var _ = math.Inf - -// This is a compile-time assertion to ensure that this generated file -// is compatible with the proto package it is being compiled against. -// A compilation error at this line likely means your copy of the -// proto package needs to be updated. -const _ = proto.GoGoProtoPackageIsVersion3 // please upgrade the proto package - -type Metrics struct { - Hugetlb []*HugetlbStat `protobuf:"bytes,1,rep,name=hugetlb,proto3" json:"hugetlb,omitempty"` - Pids *PidsStat `protobuf:"bytes,2,opt,name=pids,proto3" json:"pids,omitempty"` - CPU *CPUStat `protobuf:"bytes,3,opt,name=cpu,proto3" json:"cpu,omitempty"` - Memory *MemoryStat `protobuf:"bytes,4,opt,name=memory,proto3" json:"memory,omitempty"` - Blkio *BlkIOStat `protobuf:"bytes,5,opt,name=blkio,proto3" json:"blkio,omitempty"` - Rdma *RdmaStat `protobuf:"bytes,6,opt,name=rdma,proto3" json:"rdma,omitempty"` - Network []*NetworkStat `protobuf:"bytes,7,rep,name=network,proto3" json:"network,omitempty"` - CgroupStats *CgroupStats `protobuf:"bytes,8,opt,name=cgroup_stats,json=cgroupStats,proto3" json:"cgroup_stats,omitempty"` - MemoryOomControl *MemoryOomControl `protobuf:"bytes,9,opt,name=memory_oom_control,json=memoryOomControl,proto3" json:"memory_oom_control,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` -} - -func (m *Metrics) Reset() { *m = Metrics{} } -func (*Metrics) ProtoMessage() {} -func (*Metrics) Descriptor() ([]byte, []int) { - return fileDescriptor_a17b2d87c332bfaa, []int{0} -} -func (m *Metrics) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *Metrics) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_Metrics.Marshal(b, m, deterministic) - } else { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) - if err != nil { - return nil, err - } - return b[:n], nil - } -} -func (m *Metrics) XXX_Merge(src proto.Message) { - xxx_messageInfo_Metrics.Merge(m, src) -} -func (m *Metrics) XXX_Size() int { - return m.Size() -} -func (m *Metrics) XXX_DiscardUnknown() { - xxx_messageInfo_Metrics.DiscardUnknown(m) -} - -var xxx_messageInfo_Metrics proto.InternalMessageInfo - -type HugetlbStat struct { - Usage uint64 `protobuf:"varint,1,opt,name=usage,proto3" json:"usage,omitempty"` - Max uint64 `protobuf:"varint,2,opt,name=max,proto3" json:"max,omitempty"` - Failcnt uint64 `protobuf:"varint,3,opt,name=failcnt,proto3" json:"failcnt,omitempty"` - Pagesize string `protobuf:"bytes,4,opt,name=pagesize,proto3" json:"pagesize,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` -} - -func (m *HugetlbStat) Reset() { *m = HugetlbStat{} } -func (*HugetlbStat) ProtoMessage() {} -func (*HugetlbStat) Descriptor() ([]byte, []int) { - return fileDescriptor_a17b2d87c332bfaa, []int{1} -} -func (m *HugetlbStat) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *HugetlbStat) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_HugetlbStat.Marshal(b, m, deterministic) - } else { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) - if err != nil { - return nil, err - } - return b[:n], nil - } -} -func (m *HugetlbStat) XXX_Merge(src proto.Message) { - xxx_messageInfo_HugetlbStat.Merge(m, src) -} -func (m *HugetlbStat) XXX_Size() int { - return m.Size() -} -func (m *HugetlbStat) XXX_DiscardUnknown() { - xxx_messageInfo_HugetlbStat.DiscardUnknown(m) -} - -var xxx_messageInfo_HugetlbStat proto.InternalMessageInfo - -type PidsStat struct { - Current uint64 `protobuf:"varint,1,opt,name=current,proto3" json:"current,omitempty"` - Limit uint64 `protobuf:"varint,2,opt,name=limit,proto3" json:"limit,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` -} - -func (m *PidsStat) Reset() { *m = PidsStat{} } -func (*PidsStat) ProtoMessage() {} -func (*PidsStat) Descriptor() ([]byte, []int) { - return fileDescriptor_a17b2d87c332bfaa, []int{2} -} -func (m *PidsStat) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *PidsStat) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_PidsStat.Marshal(b, m, deterministic) - } else { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) - if err != nil { - return nil, err - } - return b[:n], nil - } -} -func (m *PidsStat) XXX_Merge(src proto.Message) { - xxx_messageInfo_PidsStat.Merge(m, src) -} -func (m *PidsStat) XXX_Size() int { - return m.Size() -} -func (m *PidsStat) XXX_DiscardUnknown() { - xxx_messageInfo_PidsStat.DiscardUnknown(m) -} - -var xxx_messageInfo_PidsStat proto.InternalMessageInfo - -type CPUStat struct { - Usage *CPUUsage `protobuf:"bytes,1,opt,name=usage,proto3" json:"usage,omitempty"` - Throttling *Throttle `protobuf:"bytes,2,opt,name=throttling,proto3" json:"throttling,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` -} - -func (m *CPUStat) Reset() { *m = CPUStat{} } -func (*CPUStat) ProtoMessage() {} -func (*CPUStat) Descriptor() ([]byte, []int) { - return fileDescriptor_a17b2d87c332bfaa, []int{3} -} -func (m *CPUStat) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *CPUStat) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_CPUStat.Marshal(b, m, deterministic) - } else { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) - if err != nil { - return nil, err - } - return b[:n], nil - } -} -func (m *CPUStat) XXX_Merge(src proto.Message) { - xxx_messageInfo_CPUStat.Merge(m, src) -} -func (m *CPUStat) XXX_Size() int { - return m.Size() -} -func (m *CPUStat) XXX_DiscardUnknown() { - xxx_messageInfo_CPUStat.DiscardUnknown(m) -} - -var xxx_messageInfo_CPUStat proto.InternalMessageInfo - -type CPUUsage struct { - // values in nanoseconds - Total uint64 `protobuf:"varint,1,opt,name=total,proto3" json:"total,omitempty"` - Kernel uint64 `protobuf:"varint,2,opt,name=kernel,proto3" json:"kernel,omitempty"` - User uint64 `protobuf:"varint,3,opt,name=user,proto3" json:"user,omitempty"` - PerCPU []uint64 `protobuf:"varint,4,rep,packed,name=per_cpu,json=perCpu,proto3" json:"per_cpu,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` -} - -func (m *CPUUsage) Reset() { *m = CPUUsage{} } -func (*CPUUsage) ProtoMessage() {} -func (*CPUUsage) Descriptor() ([]byte, []int) { - return fileDescriptor_a17b2d87c332bfaa, []int{4} -} -func (m *CPUUsage) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *CPUUsage) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_CPUUsage.Marshal(b, m, deterministic) - } else { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) - if err != nil { - return nil, err - } - return b[:n], nil - } -} -func (m *CPUUsage) XXX_Merge(src proto.Message) { - xxx_messageInfo_CPUUsage.Merge(m, src) -} -func (m *CPUUsage) XXX_Size() int { - return m.Size() -} -func (m *CPUUsage) XXX_DiscardUnknown() { - xxx_messageInfo_CPUUsage.DiscardUnknown(m) -} - -var xxx_messageInfo_CPUUsage proto.InternalMessageInfo - -type Throttle struct { - Periods uint64 `protobuf:"varint,1,opt,name=periods,proto3" json:"periods,omitempty"` - ThrottledPeriods uint64 `protobuf:"varint,2,opt,name=throttled_periods,json=throttledPeriods,proto3" json:"throttled_periods,omitempty"` - ThrottledTime uint64 `protobuf:"varint,3,opt,name=throttled_time,json=throttledTime,proto3" json:"throttled_time,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` -} - -func (m *Throttle) Reset() { *m = Throttle{} } -func (*Throttle) ProtoMessage() {} -func (*Throttle) Descriptor() ([]byte, []int) { - return fileDescriptor_a17b2d87c332bfaa, []int{5} -} -func (m *Throttle) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *Throttle) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_Throttle.Marshal(b, m, deterministic) - } else { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) - if err != nil { - return nil, err - } - return b[:n], nil - } -} -func (m *Throttle) XXX_Merge(src proto.Message) { - xxx_messageInfo_Throttle.Merge(m, src) -} -func (m *Throttle) XXX_Size() int { - return m.Size() -} -func (m *Throttle) XXX_DiscardUnknown() { - xxx_messageInfo_Throttle.DiscardUnknown(m) -} - -var xxx_messageInfo_Throttle proto.InternalMessageInfo - -type MemoryStat struct { - Cache uint64 `protobuf:"varint,1,opt,name=cache,proto3" json:"cache,omitempty"` - RSS uint64 `protobuf:"varint,2,opt,name=rss,proto3" json:"rss,omitempty"` - RSSHuge uint64 `protobuf:"varint,3,opt,name=rss_huge,json=rssHuge,proto3" json:"rss_huge,omitempty"` - MappedFile uint64 `protobuf:"varint,4,opt,name=mapped_file,json=mappedFile,proto3" json:"mapped_file,omitempty"` - Dirty uint64 `protobuf:"varint,5,opt,name=dirty,proto3" json:"dirty,omitempty"` - Writeback uint64 `protobuf:"varint,6,opt,name=writeback,proto3" json:"writeback,omitempty"` - PgPgIn uint64 `protobuf:"varint,7,opt,name=pg_pg_in,json=pgPgIn,proto3" json:"pg_pg_in,omitempty"` - PgPgOut uint64 `protobuf:"varint,8,opt,name=pg_pg_out,json=pgPgOut,proto3" json:"pg_pg_out,omitempty"` - PgFault uint64 `protobuf:"varint,9,opt,name=pg_fault,json=pgFault,proto3" json:"pg_fault,omitempty"` - PgMajFault uint64 `protobuf:"varint,10,opt,name=pg_maj_fault,json=pgMajFault,proto3" json:"pg_maj_fault,omitempty"` - InactiveAnon uint64 `protobuf:"varint,11,opt,name=inactive_anon,json=inactiveAnon,proto3" json:"inactive_anon,omitempty"` - ActiveAnon uint64 `protobuf:"varint,12,opt,name=active_anon,json=activeAnon,proto3" json:"active_anon,omitempty"` - InactiveFile uint64 `protobuf:"varint,13,opt,name=inactive_file,json=inactiveFile,proto3" json:"inactive_file,omitempty"` - ActiveFile uint64 `protobuf:"varint,14,opt,name=active_file,json=activeFile,proto3" json:"active_file,omitempty"` - Unevictable uint64 `protobuf:"varint,15,opt,name=unevictable,proto3" json:"unevictable,omitempty"` - HierarchicalMemoryLimit uint64 `protobuf:"varint,16,opt,name=hierarchical_memory_limit,json=hierarchicalMemoryLimit,proto3" json:"hierarchical_memory_limit,omitempty"` - HierarchicalSwapLimit uint64 `protobuf:"varint,17,opt,name=hierarchical_swap_limit,json=hierarchicalSwapLimit,proto3" json:"hierarchical_swap_limit,omitempty"` - TotalCache uint64 `protobuf:"varint,18,opt,name=total_cache,json=totalCache,proto3" json:"total_cache,omitempty"` - TotalRSS uint64 `protobuf:"varint,19,opt,name=total_rss,json=totalRss,proto3" json:"total_rss,omitempty"` - TotalRSSHuge uint64 `protobuf:"varint,20,opt,name=total_rss_huge,json=totalRssHuge,proto3" json:"total_rss_huge,omitempty"` - TotalMappedFile uint64 `protobuf:"varint,21,opt,name=total_mapped_file,json=totalMappedFile,proto3" json:"total_mapped_file,omitempty"` - TotalDirty uint64 `protobuf:"varint,22,opt,name=total_dirty,json=totalDirty,proto3" json:"total_dirty,omitempty"` - TotalWriteback uint64 `protobuf:"varint,23,opt,name=total_writeback,json=totalWriteback,proto3" json:"total_writeback,omitempty"` - TotalPgPgIn uint64 `protobuf:"varint,24,opt,name=total_pg_pg_in,json=totalPgPgIn,proto3" json:"total_pg_pg_in,omitempty"` - TotalPgPgOut uint64 `protobuf:"varint,25,opt,name=total_pg_pg_out,json=totalPgPgOut,proto3" json:"total_pg_pg_out,omitempty"` - TotalPgFault uint64 `protobuf:"varint,26,opt,name=total_pg_fault,json=totalPgFault,proto3" json:"total_pg_fault,omitempty"` - TotalPgMajFault uint64 `protobuf:"varint,27,opt,name=total_pg_maj_fault,json=totalPgMajFault,proto3" json:"total_pg_maj_fault,omitempty"` - TotalInactiveAnon uint64 `protobuf:"varint,28,opt,name=total_inactive_anon,json=totalInactiveAnon,proto3" json:"total_inactive_anon,omitempty"` - TotalActiveAnon uint64 `protobuf:"varint,29,opt,name=total_active_anon,json=totalActiveAnon,proto3" json:"total_active_anon,omitempty"` - TotalInactiveFile uint64 `protobuf:"varint,30,opt,name=total_inactive_file,json=totalInactiveFile,proto3" json:"total_inactive_file,omitempty"` - TotalActiveFile uint64 `protobuf:"varint,31,opt,name=total_active_file,json=totalActiveFile,proto3" json:"total_active_file,omitempty"` - TotalUnevictable uint64 `protobuf:"varint,32,opt,name=total_unevictable,json=totalUnevictable,proto3" json:"total_unevictable,omitempty"` - Usage *MemoryEntry `protobuf:"bytes,33,opt,name=usage,proto3" json:"usage,omitempty"` - Swap *MemoryEntry `protobuf:"bytes,34,opt,name=swap,proto3" json:"swap,omitempty"` - Kernel *MemoryEntry `protobuf:"bytes,35,opt,name=kernel,proto3" json:"kernel,omitempty"` - KernelTCP *MemoryEntry `protobuf:"bytes,36,opt,name=kernel_tcp,json=kernelTcp,proto3" json:"kernel_tcp,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` -} - -func (m *MemoryStat) Reset() { *m = MemoryStat{} } -func (*MemoryStat) ProtoMessage() {} -func (*MemoryStat) Descriptor() ([]byte, []int) { - return fileDescriptor_a17b2d87c332bfaa, []int{6} -} -func (m *MemoryStat) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *MemoryStat) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_MemoryStat.Marshal(b, m, deterministic) - } else { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) - if err != nil { - return nil, err - } - return b[:n], nil - } -} -func (m *MemoryStat) XXX_Merge(src proto.Message) { - xxx_messageInfo_MemoryStat.Merge(m, src) -} -func (m *MemoryStat) XXX_Size() int { - return m.Size() -} -func (m *MemoryStat) XXX_DiscardUnknown() { - xxx_messageInfo_MemoryStat.DiscardUnknown(m) -} - -var xxx_messageInfo_MemoryStat proto.InternalMessageInfo - -type MemoryEntry struct { - Limit uint64 `protobuf:"varint,1,opt,name=limit,proto3" json:"limit,omitempty"` - Usage uint64 `protobuf:"varint,2,opt,name=usage,proto3" json:"usage,omitempty"` - Max uint64 `protobuf:"varint,3,opt,name=max,proto3" json:"max,omitempty"` - Failcnt uint64 `protobuf:"varint,4,opt,name=failcnt,proto3" json:"failcnt,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` -} - -func (m *MemoryEntry) Reset() { *m = MemoryEntry{} } -func (*MemoryEntry) ProtoMessage() {} -func (*MemoryEntry) Descriptor() ([]byte, []int) { - return fileDescriptor_a17b2d87c332bfaa, []int{7} -} -func (m *MemoryEntry) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *MemoryEntry) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_MemoryEntry.Marshal(b, m, deterministic) - } else { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) - if err != nil { - return nil, err - } - return b[:n], nil - } -} -func (m *MemoryEntry) XXX_Merge(src proto.Message) { - xxx_messageInfo_MemoryEntry.Merge(m, src) -} -func (m *MemoryEntry) XXX_Size() int { - return m.Size() -} -func (m *MemoryEntry) XXX_DiscardUnknown() { - xxx_messageInfo_MemoryEntry.DiscardUnknown(m) -} - -var xxx_messageInfo_MemoryEntry proto.InternalMessageInfo - -type MemoryOomControl struct { - OomKillDisable uint64 `protobuf:"varint,1,opt,name=oom_kill_disable,json=oomKillDisable,proto3" json:"oom_kill_disable,omitempty"` - UnderOom uint64 `protobuf:"varint,2,opt,name=under_oom,json=underOom,proto3" json:"under_oom,omitempty"` - OomKill uint64 `protobuf:"varint,3,opt,name=oom_kill,json=oomKill,proto3" json:"oom_kill,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` -} - -func (m *MemoryOomControl) Reset() { *m = MemoryOomControl{} } -func (*MemoryOomControl) ProtoMessage() {} -func (*MemoryOomControl) Descriptor() ([]byte, []int) { - return fileDescriptor_a17b2d87c332bfaa, []int{8} -} -func (m *MemoryOomControl) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *MemoryOomControl) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_MemoryOomControl.Marshal(b, m, deterministic) - } else { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) - if err != nil { - return nil, err - } - return b[:n], nil - } -} -func (m *MemoryOomControl) XXX_Merge(src proto.Message) { - xxx_messageInfo_MemoryOomControl.Merge(m, src) -} -func (m *MemoryOomControl) XXX_Size() int { - return m.Size() -} -func (m *MemoryOomControl) XXX_DiscardUnknown() { - xxx_messageInfo_MemoryOomControl.DiscardUnknown(m) -} - -var xxx_messageInfo_MemoryOomControl proto.InternalMessageInfo - -type BlkIOStat struct { - IoServiceBytesRecursive []*BlkIOEntry `protobuf:"bytes,1,rep,name=io_service_bytes_recursive,json=ioServiceBytesRecursive,proto3" json:"io_service_bytes_recursive,omitempty"` - IoServicedRecursive []*BlkIOEntry `protobuf:"bytes,2,rep,name=io_serviced_recursive,json=ioServicedRecursive,proto3" json:"io_serviced_recursive,omitempty"` - IoQueuedRecursive []*BlkIOEntry `protobuf:"bytes,3,rep,name=io_queued_recursive,json=ioQueuedRecursive,proto3" json:"io_queued_recursive,omitempty"` - IoServiceTimeRecursive []*BlkIOEntry `protobuf:"bytes,4,rep,name=io_service_time_recursive,json=ioServiceTimeRecursive,proto3" json:"io_service_time_recursive,omitempty"` - IoWaitTimeRecursive []*BlkIOEntry `protobuf:"bytes,5,rep,name=io_wait_time_recursive,json=ioWaitTimeRecursive,proto3" json:"io_wait_time_recursive,omitempty"` - IoMergedRecursive []*BlkIOEntry `protobuf:"bytes,6,rep,name=io_merged_recursive,json=ioMergedRecursive,proto3" json:"io_merged_recursive,omitempty"` - IoTimeRecursive []*BlkIOEntry `protobuf:"bytes,7,rep,name=io_time_recursive,json=ioTimeRecursive,proto3" json:"io_time_recursive,omitempty"` - SectorsRecursive []*BlkIOEntry `protobuf:"bytes,8,rep,name=sectors_recursive,json=sectorsRecursive,proto3" json:"sectors_recursive,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` -} - -func (m *BlkIOStat) Reset() { *m = BlkIOStat{} } -func (*BlkIOStat) ProtoMessage() {} -func (*BlkIOStat) Descriptor() ([]byte, []int) { - return fileDescriptor_a17b2d87c332bfaa, []int{9} -} -func (m *BlkIOStat) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *BlkIOStat) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_BlkIOStat.Marshal(b, m, deterministic) - } else { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) - if err != nil { - return nil, err - } - return b[:n], nil - } -} -func (m *BlkIOStat) XXX_Merge(src proto.Message) { - xxx_messageInfo_BlkIOStat.Merge(m, src) -} -func (m *BlkIOStat) XXX_Size() int { - return m.Size() -} -func (m *BlkIOStat) XXX_DiscardUnknown() { - xxx_messageInfo_BlkIOStat.DiscardUnknown(m) -} - -var xxx_messageInfo_BlkIOStat proto.InternalMessageInfo - -type BlkIOEntry struct { - Op string `protobuf:"bytes,1,opt,name=op,proto3" json:"op,omitempty"` - Device string `protobuf:"bytes,2,opt,name=device,proto3" json:"device,omitempty"` - Major uint64 `protobuf:"varint,3,opt,name=major,proto3" json:"major,omitempty"` - Minor uint64 `protobuf:"varint,4,opt,name=minor,proto3" json:"minor,omitempty"` - Value uint64 `protobuf:"varint,5,opt,name=value,proto3" json:"value,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` -} - -func (m *BlkIOEntry) Reset() { *m = BlkIOEntry{} } -func (*BlkIOEntry) ProtoMessage() {} -func (*BlkIOEntry) Descriptor() ([]byte, []int) { - return fileDescriptor_a17b2d87c332bfaa, []int{10} -} -func (m *BlkIOEntry) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *BlkIOEntry) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_BlkIOEntry.Marshal(b, m, deterministic) - } else { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) - if err != nil { - return nil, err - } - return b[:n], nil - } -} -func (m *BlkIOEntry) XXX_Merge(src proto.Message) { - xxx_messageInfo_BlkIOEntry.Merge(m, src) -} -func (m *BlkIOEntry) XXX_Size() int { - return m.Size() -} -func (m *BlkIOEntry) XXX_DiscardUnknown() { - xxx_messageInfo_BlkIOEntry.DiscardUnknown(m) -} - -var xxx_messageInfo_BlkIOEntry proto.InternalMessageInfo - -type RdmaStat struct { - Current []*RdmaEntry `protobuf:"bytes,1,rep,name=current,proto3" json:"current,omitempty"` - Limit []*RdmaEntry `protobuf:"bytes,2,rep,name=limit,proto3" json:"limit,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` -} - -func (m *RdmaStat) Reset() { *m = RdmaStat{} } -func (*RdmaStat) ProtoMessage() {} -func (*RdmaStat) Descriptor() ([]byte, []int) { - return fileDescriptor_a17b2d87c332bfaa, []int{11} -} -func (m *RdmaStat) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *RdmaStat) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_RdmaStat.Marshal(b, m, deterministic) - } else { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) - if err != nil { - return nil, err - } - return b[:n], nil - } -} -func (m *RdmaStat) XXX_Merge(src proto.Message) { - xxx_messageInfo_RdmaStat.Merge(m, src) -} -func (m *RdmaStat) XXX_Size() int { - return m.Size() -} -func (m *RdmaStat) XXX_DiscardUnknown() { - xxx_messageInfo_RdmaStat.DiscardUnknown(m) -} - -var xxx_messageInfo_RdmaStat proto.InternalMessageInfo - -type RdmaEntry struct { - Device string `protobuf:"bytes,1,opt,name=device,proto3" json:"device,omitempty"` - HcaHandles uint32 `protobuf:"varint,2,opt,name=hca_handles,json=hcaHandles,proto3" json:"hca_handles,omitempty"` - HcaObjects uint32 `protobuf:"varint,3,opt,name=hca_objects,json=hcaObjects,proto3" json:"hca_objects,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` -} - -func (m *RdmaEntry) Reset() { *m = RdmaEntry{} } -func (*RdmaEntry) ProtoMessage() {} -func (*RdmaEntry) Descriptor() ([]byte, []int) { - return fileDescriptor_a17b2d87c332bfaa, []int{12} -} -func (m *RdmaEntry) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *RdmaEntry) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_RdmaEntry.Marshal(b, m, deterministic) - } else { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) - if err != nil { - return nil, err - } - return b[:n], nil - } -} -func (m *RdmaEntry) XXX_Merge(src proto.Message) { - xxx_messageInfo_RdmaEntry.Merge(m, src) -} -func (m *RdmaEntry) XXX_Size() int { - return m.Size() -} -func (m *RdmaEntry) XXX_DiscardUnknown() { - xxx_messageInfo_RdmaEntry.DiscardUnknown(m) -} - -var xxx_messageInfo_RdmaEntry proto.InternalMessageInfo - -type NetworkStat struct { - Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"` - RxBytes uint64 `protobuf:"varint,2,opt,name=rx_bytes,json=rxBytes,proto3" json:"rx_bytes,omitempty"` - RxPackets uint64 `protobuf:"varint,3,opt,name=rx_packets,json=rxPackets,proto3" json:"rx_packets,omitempty"` - RxErrors uint64 `protobuf:"varint,4,opt,name=rx_errors,json=rxErrors,proto3" json:"rx_errors,omitempty"` - RxDropped uint64 `protobuf:"varint,5,opt,name=rx_dropped,json=rxDropped,proto3" json:"rx_dropped,omitempty"` - TxBytes uint64 `protobuf:"varint,6,opt,name=tx_bytes,json=txBytes,proto3" json:"tx_bytes,omitempty"` - TxPackets uint64 `protobuf:"varint,7,opt,name=tx_packets,json=txPackets,proto3" json:"tx_packets,omitempty"` - TxErrors uint64 `protobuf:"varint,8,opt,name=tx_errors,json=txErrors,proto3" json:"tx_errors,omitempty"` - TxDropped uint64 `protobuf:"varint,9,opt,name=tx_dropped,json=txDropped,proto3" json:"tx_dropped,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` -} - -func (m *NetworkStat) Reset() { *m = NetworkStat{} } -func (*NetworkStat) ProtoMessage() {} -func (*NetworkStat) Descriptor() ([]byte, []int) { - return fileDescriptor_a17b2d87c332bfaa, []int{13} -} -func (m *NetworkStat) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *NetworkStat) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_NetworkStat.Marshal(b, m, deterministic) - } else { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) - if err != nil { - return nil, err - } - return b[:n], nil - } -} -func (m *NetworkStat) XXX_Merge(src proto.Message) { - xxx_messageInfo_NetworkStat.Merge(m, src) -} -func (m *NetworkStat) XXX_Size() int { - return m.Size() -} -func (m *NetworkStat) XXX_DiscardUnknown() { - xxx_messageInfo_NetworkStat.DiscardUnknown(m) -} - -var xxx_messageInfo_NetworkStat proto.InternalMessageInfo - -// CgroupStats exports per-cgroup statistics. -type CgroupStats struct { - // number of tasks sleeping - NrSleeping uint64 `protobuf:"varint,1,opt,name=nr_sleeping,json=nrSleeping,proto3" json:"nr_sleeping,omitempty"` - // number of tasks running - NrRunning uint64 `protobuf:"varint,2,opt,name=nr_running,json=nrRunning,proto3" json:"nr_running,omitempty"` - // number of tasks in stopped state - NrStopped uint64 `protobuf:"varint,3,opt,name=nr_stopped,json=nrStopped,proto3" json:"nr_stopped,omitempty"` - // number of tasks in uninterruptible state - NrUninterruptible uint64 `protobuf:"varint,4,opt,name=nr_uninterruptible,json=nrUninterruptible,proto3" json:"nr_uninterruptible,omitempty"` - // number of tasks waiting on IO - NrIoWait uint64 `protobuf:"varint,5,opt,name=nr_io_wait,json=nrIoWait,proto3" json:"nr_io_wait,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` -} - -func (m *CgroupStats) Reset() { *m = CgroupStats{} } -func (*CgroupStats) ProtoMessage() {} -func (*CgroupStats) Descriptor() ([]byte, []int) { - return fileDescriptor_a17b2d87c332bfaa, []int{14} -} -func (m *CgroupStats) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *CgroupStats) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_CgroupStats.Marshal(b, m, deterministic) - } else { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) - if err != nil { - return nil, err - } - return b[:n], nil - } -} -func (m *CgroupStats) XXX_Merge(src proto.Message) { - xxx_messageInfo_CgroupStats.Merge(m, src) -} -func (m *CgroupStats) XXX_Size() int { - return m.Size() -} -func (m *CgroupStats) XXX_DiscardUnknown() { - xxx_messageInfo_CgroupStats.DiscardUnknown(m) -} - -var xxx_messageInfo_CgroupStats proto.InternalMessageInfo - -func init() { - proto.RegisterType((*Metrics)(nil), "io.containerd.cgroups.v1.Metrics") - proto.RegisterType((*HugetlbStat)(nil), "io.containerd.cgroups.v1.HugetlbStat") - proto.RegisterType((*PidsStat)(nil), "io.containerd.cgroups.v1.PidsStat") - proto.RegisterType((*CPUStat)(nil), "io.containerd.cgroups.v1.CPUStat") - proto.RegisterType((*CPUUsage)(nil), "io.containerd.cgroups.v1.CPUUsage") - proto.RegisterType((*Throttle)(nil), "io.containerd.cgroups.v1.Throttle") - proto.RegisterType((*MemoryStat)(nil), "io.containerd.cgroups.v1.MemoryStat") - proto.RegisterType((*MemoryEntry)(nil), "io.containerd.cgroups.v1.MemoryEntry") - proto.RegisterType((*MemoryOomControl)(nil), "io.containerd.cgroups.v1.MemoryOomControl") - proto.RegisterType((*BlkIOStat)(nil), "io.containerd.cgroups.v1.BlkIOStat") - proto.RegisterType((*BlkIOEntry)(nil), "io.containerd.cgroups.v1.BlkIOEntry") - proto.RegisterType((*RdmaStat)(nil), "io.containerd.cgroups.v1.RdmaStat") - proto.RegisterType((*RdmaEntry)(nil), "io.containerd.cgroups.v1.RdmaEntry") - proto.RegisterType((*NetworkStat)(nil), "io.containerd.cgroups.v1.NetworkStat") - proto.RegisterType((*CgroupStats)(nil), "io.containerd.cgroups.v1.CgroupStats") -} - -func init() { - proto.RegisterFile("github.com/containerd/cgroups/stats/v1/metrics.proto", fileDescriptor_a17b2d87c332bfaa) -} - -var fileDescriptor_a17b2d87c332bfaa = []byte{ - // 1749 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x94, 0x58, 0xcd, 0x72, 0xe3, 0xc6, - 0x11, 0x36, 0x45, 0x48, 0x24, 0x9a, 0x92, 0x56, 0x9a, 0xfd, 0x83, 0xe4, 0xb5, 0x28, 0x53, 0xbb, - 0x89, 0xe2, 0xad, 0x48, 0x65, 0x27, 0xb5, 0x95, 0x75, 0xec, 0x4a, 0x59, 0x5a, 0xbb, 0x76, 0xcb, - 0x51, 0x44, 0x83, 0x52, 0xd9, 0x39, 0xa1, 0x40, 0x70, 0x16, 0x9c, 0x15, 0x80, 0x81, 0x07, 0x03, - 0x89, 0xca, 0x29, 0x87, 0x54, 0xe5, 0x94, 0x07, 0xca, 0x1b, 0xf8, 0x98, 0x4b, 0x52, 0xc9, 0x45, - 0x15, 0xf3, 0x49, 0x52, 0x33, 0x3d, 0xf8, 0xa1, 0xbc, 0x5a, 0x85, 0x37, 0x76, 0xcf, 0xd7, 0x5f, - 0xf7, 0x34, 0xbe, 0x19, 0x34, 0x08, 0xbf, 0x0e, 0x99, 0x1c, 0xe7, 0xc3, 0xbd, 0x80, 0xc7, 0xfb, - 0x01, 0x4f, 0xa4, 0xcf, 0x12, 0x2a, 0x46, 0xfb, 0x41, 0x28, 0x78, 0x9e, 0x66, 0xfb, 0x99, 0xf4, - 0x65, 0xb6, 0x7f, 0xfe, 0xf1, 0x7e, 0x4c, 0xa5, 0x60, 0x41, 0xb6, 0x97, 0x0a, 0x2e, 0x39, 0x71, - 0x18, 0xdf, 0xab, 0xd0, 0x7b, 0x06, 0xbd, 0x77, 0xfe, 0xf1, 0xe6, 0xbd, 0x90, 0x87, 0x5c, 0x83, - 0xf6, 0xd5, 0x2f, 0xc4, 0xf7, 0xfe, 0x65, 0x41, 0xeb, 0x08, 0x19, 0xc8, 0xef, 0xa0, 0x35, 0xce, - 0x43, 0x2a, 0xa3, 0xa1, 0xd3, 0xd8, 0x6e, 0xee, 0x76, 0x3e, 0x79, 0xb2, 0x77, 0x13, 0xdb, 0xde, - 0x4b, 0x04, 0x0e, 0xa4, 0x2f, 0xdd, 0x22, 0x8a, 0x3c, 0x03, 0x2b, 0x65, 0xa3, 0xcc, 0x59, 0xd8, - 0x6e, 0xec, 0x76, 0x3e, 0xe9, 0xdd, 0x1c, 0xdd, 0x67, 0xa3, 0x4c, 0x87, 0x6a, 0x3c, 0xf9, 0x0c, - 0x9a, 0x41, 0x9a, 0x3b, 0x4d, 0x1d, 0xf6, 0xe1, 0xcd, 0x61, 0x87, 0xfd, 0x53, 0x15, 0x75, 0xd0, - 0x9a, 0x5e, 0x75, 0x9b, 0x87, 0xfd, 0x53, 0x57, 0x85, 0x91, 0xcf, 0x60, 0x29, 0xa6, 0x31, 0x17, - 0x97, 0x8e, 0xa5, 0x09, 0x1e, 0xdf, 0x4c, 0x70, 0xa4, 0x71, 0x3a, 0xb3, 0x89, 0x21, 0xcf, 0x61, - 0x71, 0x18, 0x9d, 0x31, 0xee, 0x2c, 0xea, 0xe0, 0x9d, 0x9b, 0x83, 0x0f, 0xa2, 0xb3, 0x57, 0xc7, - 0x3a, 0x16, 0x23, 0xd4, 0x76, 0xc5, 0x28, 0xf6, 0x9d, 0xa5, 0xdb, 0xb6, 0xeb, 0x8e, 0x62, 0x1f, - 0xb7, 0xab, 0xf0, 0xaa, 0xcf, 0x09, 0x95, 0x17, 0x5c, 0x9c, 0x39, 0xad, 0xdb, 0xfa, 0xfc, 0x07, - 0x04, 0x62, 0x9f, 0x4d, 0x14, 0x79, 0x09, 0xcb, 0x08, 0xf1, 0xb4, 0x0a, 0x9c, 0xb6, 0x2e, 0xe0, - 0x1d, 0x2c, 0x87, 0xfa, 0xa7, 0x22, 0xc9, 0xdc, 0x4e, 0x50, 0x19, 0xe4, 0x3b, 0x20, 0xd8, 0x07, - 0x8f, 0xf3, 0xd8, 0x53, 0xc1, 0x82, 0x47, 0x8e, 0xad, 0xf9, 0x3e, 0xba, 0xad, 0x8f, 0xc7, 0x3c, - 0x3e, 0xc4, 0x08, 0x77, 0x2d, 0xbe, 0xe6, 0xe9, 0x9d, 0x41, 0xa7, 0xa6, 0x11, 0x72, 0x0f, 0x16, - 0xf3, 0xcc, 0x0f, 0xa9, 0xd3, 0xd8, 0x6e, 0xec, 0x5a, 0x2e, 0x1a, 0x64, 0x0d, 0x9a, 0xb1, 0x3f, - 0xd1, 0x7a, 0xb1, 0x5c, 0xf5, 0x93, 0x38, 0xd0, 0x7a, 0xed, 0xb3, 0x28, 0x48, 0xa4, 0x96, 0x83, - 0xe5, 0x16, 0x26, 0xd9, 0x84, 0x76, 0xea, 0x87, 0x34, 0x63, 0x7f, 0xa2, 0xfa, 0x41, 0xdb, 0x6e, - 0x69, 0xf7, 0x3e, 0x85, 0x76, 0x21, 0x29, 0xc5, 0x10, 0xe4, 0x42, 0xd0, 0x44, 0x9a, 0x5c, 0x85, - 0xa9, 0x6a, 0x88, 0x58, 0xcc, 0xa4, 0xc9, 0x87, 0x46, 0xef, 0xaf, 0x0d, 0x68, 0x19, 0x61, 0x91, - 0xdf, 0xd4, 0xab, 0x7c, 0xe7, 0x23, 0x3d, 0xec, 0x9f, 0x9e, 0x2a, 0x64, 0xb1, 0x93, 0x03, 0x00, - 0x39, 0x16, 0x5c, 0xca, 0x88, 0x25, 0xe1, 0xed, 0x07, 0xe0, 0x04, 0xb1, 0xd4, 0xad, 0x45, 0xf5, - 0xbe, 0x87, 0x76, 0x41, 0xab, 0x6a, 0x95, 0x5c, 0xfa, 0x51, 0xd1, 0x2f, 0x6d, 0x90, 0x07, 0xb0, - 0x74, 0x46, 0x45, 0x42, 0x23, 0xb3, 0x05, 0x63, 0x11, 0x02, 0x56, 0x9e, 0x51, 0x61, 0x5a, 0xa6, - 0x7f, 0x93, 0x1d, 0x68, 0xa5, 0x54, 0x78, 0xea, 0x60, 0x59, 0xdb, 0xcd, 0x5d, 0xeb, 0x00, 0xa6, - 0x57, 0xdd, 0xa5, 0x3e, 0x15, 0xea, 0xe0, 0x2c, 0xa5, 0x54, 0x1c, 0xa6, 0x79, 0x6f, 0x02, 0xed, - 0xa2, 0x14, 0xd5, 0xb8, 0x94, 0x0a, 0xc6, 0x47, 0x59, 0xd1, 0x38, 0x63, 0x92, 0xa7, 0xb0, 0x6e, - 0xca, 0xa4, 0x23, 0xaf, 0xc0, 0x60, 0x05, 0x6b, 0xe5, 0x42, 0xdf, 0x80, 0x9f, 0xc0, 0x6a, 0x05, - 0x96, 0x2c, 0xa6, 0xa6, 0xaa, 0x95, 0xd2, 0x7b, 0xc2, 0x62, 0xda, 0xfb, 0x4f, 0x07, 0xa0, 0x3a, - 0x8e, 0x6a, 0xbf, 0x81, 0x1f, 0x8c, 0x4b, 0x7d, 0x68, 0x83, 0x6c, 0x40, 0x53, 0x64, 0x26, 0x15, - 0x9e, 0x7a, 0x77, 0x30, 0x70, 0x95, 0x8f, 0xfc, 0x0c, 0xda, 0x22, 0xcb, 0x3c, 0x75, 0xf5, 0x60, - 0x82, 0x83, 0xce, 0xf4, 0xaa, 0xdb, 0x72, 0x07, 0x03, 0x25, 0x3b, 0xb7, 0x25, 0xb2, 0x4c, 0xfd, - 0x20, 0x5d, 0xe8, 0xc4, 0x7e, 0x9a, 0xd2, 0x91, 0xf7, 0x9a, 0x45, 0xa8, 0x1c, 0xcb, 0x05, 0x74, - 0x7d, 0xc5, 0x22, 0xdd, 0xe9, 0x11, 0x13, 0xf2, 0x52, 0x5f, 0x00, 0x96, 0x8b, 0x06, 0x79, 0x04, - 0xf6, 0x85, 0x60, 0x92, 0x0e, 0xfd, 0xe0, 0x4c, 0x1f, 0x70, 0xcb, 0xad, 0x1c, 0xc4, 0x81, 0x76, - 0x1a, 0x7a, 0x69, 0xe8, 0xb1, 0xc4, 0x69, 0xe1, 0x93, 0x48, 0xc3, 0x7e, 0xf8, 0x2a, 0x21, 0x9b, - 0x60, 0xe3, 0x0a, 0xcf, 0xa5, 0x3e, 0x97, 0xaa, 0x8d, 0x61, 0x3f, 0x3c, 0xce, 0x25, 0xd9, 0xd0, - 0x51, 0xaf, 0xfd, 0x3c, 0x92, 0xfa, 0x88, 0xe9, 0xa5, 0xaf, 0x94, 0x49, 0xb6, 0x61, 0x39, 0x0d, - 0xbd, 0xd8, 0x7f, 0x63, 0x96, 0x01, 0xcb, 0x4c, 0xc3, 0x23, 0xff, 0x0d, 0x22, 0x76, 0x60, 0x85, - 0x25, 0x7e, 0x20, 0xd9, 0x39, 0xf5, 0xfc, 0x84, 0x27, 0x4e, 0x47, 0x43, 0x96, 0x0b, 0xe7, 0x17, - 0x09, 0x4f, 0xd4, 0x66, 0xeb, 0x90, 0x65, 0x64, 0xa9, 0x01, 0xea, 0x2c, 0xba, 0x1f, 0x2b, 0xb3, - 0x2c, 0xba, 0x23, 0x15, 0x8b, 0x86, 0xac, 0xd6, 0x59, 0x34, 0x60, 0x1b, 0x3a, 0x79, 0x42, 0xcf, - 0x59, 0x20, 0xfd, 0x61, 0x44, 0x9d, 0x3b, 0x1a, 0x50, 0x77, 0x91, 0x4f, 0x61, 0x63, 0xcc, 0xa8, - 0xf0, 0x45, 0x30, 0x66, 0x81, 0x1f, 0x79, 0xe6, 0x92, 0xc1, 0xe3, 0xb7, 0xa6, 0xf1, 0x0f, 0xeb, - 0x00, 0x54, 0xc2, 0xef, 0xd5, 0x32, 0x79, 0x06, 0x33, 0x4b, 0x5e, 0x76, 0xe1, 0xa7, 0x26, 0x72, - 0x5d, 0x47, 0xde, 0xaf, 0x2f, 0x0f, 0x2e, 0xfc, 0x14, 0xe3, 0xba, 0xd0, 0xd1, 0xa7, 0xc4, 0x43, - 0x21, 0x11, 0x2c, 0x5b, 0xbb, 0x0e, 0xb5, 0x9a, 0x7e, 0x01, 0x36, 0x02, 0x94, 0xa6, 0xee, 0x6a, - 0xcd, 0x2c, 0x4f, 0xaf, 0xba, 0xed, 0x13, 0xe5, 0x54, 0xc2, 0x6a, 0xeb, 0x65, 0x37, 0xcb, 0xc8, - 0x33, 0x58, 0x2d, 0xa1, 0xa8, 0xb1, 0x7b, 0x1a, 0xbf, 0x36, 0xbd, 0xea, 0x2e, 0x17, 0x78, 0x2d, - 0xb4, 0xe5, 0x22, 0x46, 0xab, 0xed, 0x23, 0x58, 0xc7, 0xb8, 0xba, 0xe6, 0xee, 0xeb, 0x4a, 0xee, - 0xe8, 0x85, 0xa3, 0x4a, 0x78, 0x65, 0xbd, 0x28, 0xbf, 0x07, 0xb5, 0x7a, 0x5f, 0x68, 0x0d, 0xfe, - 0x1c, 0x30, 0xc6, 0xab, 0x94, 0xf8, 0x50, 0x83, 0xb0, 0xb6, 0x6f, 0x4b, 0x39, 0xee, 0x14, 0xd5, - 0x96, 0xa2, 0x74, 0xf0, 0x91, 0x68, 0x6f, 0x1f, 0x95, 0xf9, 0xa4, 0x60, 0xab, 0xf4, 0xb9, 0x81, - 0x0f, 0xbf, 0x44, 0x29, 0x91, 0x3e, 0xae, 0x71, 0xa1, 0x16, 0x37, 0x67, 0x50, 0xa8, 0xc6, 0xa7, - 0x40, 0x4a, 0x54, 0xa5, 0xda, 0xf7, 0x6b, 0x1b, 0xed, 0x57, 0xd2, 0xdd, 0x83, 0xbb, 0x08, 0x9e, - 0x15, 0xf0, 0x23, 0x8d, 0xc6, 0x7e, 0xbd, 0xaa, 0xab, 0xb8, 0x6c, 0x62, 0x1d, 0xfd, 0x41, 0x8d, - 0xfb, 0x8b, 0x0a, 0xfb, 0x53, 0x6e, 0xdd, 0xf2, 0xad, 0xb7, 0x70, 0xeb, 0xa6, 0x5f, 0xe7, 0xd6, - 0xe8, 0xee, 0x4f, 0xb8, 0x35, 0xf6, 0x69, 0x81, 0xad, 0x8b, 0x7d, 0xdb, 0x5c, 0x7b, 0x6a, 0xe1, - 0xb4, 0xa6, 0xf8, 0xdf, 0x16, 0xaf, 0x8e, 0x0f, 0x6f, 0x7b, 0x19, 0xa3, 0xd6, 0xbf, 0x4c, 0xa4, - 0xb8, 0x2c, 0xde, 0x1e, 0xcf, 0xc1, 0x52, 0x2a, 0x77, 0x7a, 0xf3, 0xc4, 0xea, 0x10, 0xf2, 0x79, - 0xf9, 0x4a, 0xd8, 0x99, 0x27, 0xb8, 0x78, 0x73, 0x0c, 0x00, 0xf0, 0x97, 0x27, 0x83, 0xd4, 0x79, - 0x3c, 0x07, 0xc5, 0xc1, 0xca, 0xf4, 0xaa, 0x6b, 0x7f, 0xad, 0x83, 0x4f, 0x0e, 0xfb, 0xae, 0x8d, - 0x3c, 0x27, 0x41, 0xda, 0xa3, 0xd0, 0xa9, 0x01, 0xab, 0xf7, 0x6e, 0xa3, 0xf6, 0xde, 0xad, 0x26, - 0x82, 0x85, 0xb7, 0x4c, 0x04, 0xcd, 0xb7, 0x4e, 0x04, 0xd6, 0xcc, 0x44, 0xd0, 0x93, 0xb0, 0x76, - 0x7d, 0x10, 0x21, 0xbb, 0xb0, 0xa6, 0x26, 0x99, 0x33, 0x16, 0xa9, 0x73, 0x95, 0xe9, 0x47, 0x86, - 0x69, 0x57, 0x39, 0x8f, 0xbf, 0x66, 0x51, 0xf4, 0x02, 0xbd, 0xe4, 0x7d, 0xb0, 0xf3, 0x64, 0x44, - 0x85, 0x9a, 0x7c, 0x4c, 0x0d, 0x6d, 0xed, 0x38, 0xe6, 0xb1, 0xba, 0xaa, 0x0b, 0x9a, 0x62, 0x0e, - 0x31, 0xe1, 0xbd, 0x7f, 0x2e, 0x82, 0x5d, 0x8e, 0x82, 0xc4, 0x87, 0x4d, 0xc6, 0xbd, 0x8c, 0x8a, - 0x73, 0x16, 0x50, 0x6f, 0x78, 0x29, 0x69, 0xe6, 0x09, 0x1a, 0xe4, 0x22, 0x63, 0xe7, 0xd4, 0x8c, - 0xd1, 0x8f, 0x6f, 0x99, 0x29, 0xf1, 0x89, 0x3c, 0x64, 0x7c, 0x80, 0x34, 0x07, 0x8a, 0xc5, 0x2d, - 0x48, 0xc8, 0x77, 0x70, 0xbf, 0x4a, 0x31, 0xaa, 0xb1, 0x2f, 0xcc, 0xc1, 0x7e, 0xb7, 0x64, 0x1f, - 0x55, 0xcc, 0x27, 0x70, 0x97, 0x71, 0xef, 0xfb, 0x9c, 0xe6, 0x33, 0xbc, 0xcd, 0x39, 0x78, 0xd7, - 0x19, 0xff, 0x46, 0xc7, 0x57, 0xac, 0x1e, 0x6c, 0xd4, 0x5a, 0xa2, 0x26, 0x80, 0x1a, 0xb7, 0x35, - 0x07, 0xf7, 0x83, 0xb2, 0x66, 0x35, 0x31, 0x54, 0x09, 0xfe, 0x08, 0x0f, 0x18, 0xf7, 0x2e, 0x7c, - 0x26, 0xaf, 0xb3, 0x2f, 0xce, 0xd7, 0x91, 0x6f, 0x7d, 0x26, 0x67, 0xa9, 0xb1, 0x23, 0x31, 0x15, - 0xe1, 0x4c, 0x47, 0x96, 0xe6, 0xeb, 0xc8, 0x91, 0x8e, 0xaf, 0x58, 0xfb, 0xb0, 0xce, 0xf8, 0xf5, - 0x5a, 0x5b, 0x73, 0x70, 0xde, 0x61, 0x7c, 0xb6, 0xce, 0x6f, 0x60, 0x3d, 0xa3, 0x81, 0xe4, 0xa2, - 0xae, 0xb6, 0xf6, 0x1c, 0x8c, 0x6b, 0x26, 0xbc, 0xa4, 0xec, 0x9d, 0x03, 0x54, 0xeb, 0x64, 0x15, - 0x16, 0x78, 0xaa, 0x4f, 0x8e, 0xed, 0x2e, 0xf0, 0x54, 0x4d, 0x9e, 0x23, 0x75, 0xd9, 0xe1, 0x71, - 0xb5, 0x5d, 0x63, 0xa9, 0x53, 0x1c, 0xfb, 0x6f, 0x78, 0x31, 0x7a, 0xa2, 0xa1, 0xbd, 0x2c, 0xe1, - 0xc2, 0x9c, 0x58, 0x34, 0x94, 0xf7, 0xdc, 0x8f, 0x72, 0x5a, 0x4c, 0x5a, 0xda, 0xe8, 0xfd, 0xa5, - 0x01, 0xed, 0xe2, 0x03, 0x89, 0x7c, 0x5e, 0x1f, 0xde, 0x9b, 0xef, 0xfe, 0x1e, 0x53, 0x41, 0xb8, - 0x99, 0x72, 0xc2, 0x7f, 0x5e, 0x4d, 0xf8, 0xff, 0x77, 0xb0, 0xf9, 0x0c, 0xa0, 0x60, 0x97, 0xbe, - 0xda, 0x6e, 0x1b, 0x33, 0xbb, 0xed, 0x42, 0x67, 0x1c, 0xf8, 0xde, 0xd8, 0x4f, 0x46, 0x11, 0xc5, - 0xb9, 0x74, 0xc5, 0x85, 0x71, 0xe0, 0xbf, 0x44, 0x4f, 0x01, 0xe0, 0xc3, 0x37, 0x34, 0x90, 0x99, - 0x6e, 0x0a, 0x02, 0x8e, 0xd1, 0xd3, 0xfb, 0xdb, 0x02, 0x74, 0x6a, 0xdf, 0x74, 0x6a, 0x72, 0x4f, - 0xfc, 0xb8, 0xc8, 0xa3, 0x7f, 0xab, 0xcb, 0x47, 0x4c, 0xf0, 0x2e, 0x31, 0x17, 0x53, 0x4b, 0x4c, - 0xf4, 0xa5, 0x40, 0x3e, 0x00, 0x10, 0x13, 0x2f, 0xf5, 0x83, 0x33, 0x6a, 0xe8, 0x2d, 0xd7, 0x16, - 0x93, 0x3e, 0x3a, 0xd4, 0x9d, 0x26, 0x26, 0x1e, 0x15, 0x82, 0x8b, 0xcc, 0xf4, 0xbe, 0x2d, 0x26, - 0x5f, 0x6a, 0xdb, 0xc4, 0x8e, 0x04, 0x57, 0x13, 0x88, 0x79, 0x06, 0xb6, 0x98, 0xbc, 0x40, 0x87, - 0xca, 0x2a, 0x8b, 0xac, 0x38, 0xf0, 0xb6, 0x64, 0x95, 0x55, 0x56, 0x59, 0x71, 0xe0, 0xb5, 0x65, - 0x3d, 0xab, 0x2c, 0xb3, 0xe2, 0xcc, 0xdb, 0x96, 0xb5, 0xac, 0xb2, 0xca, 0x6a, 0x17, 0xb1, 0x26, - 0x6b, 0xef, 0xef, 0x0d, 0xe8, 0xd4, 0xbe, 0x4e, 0x55, 0x03, 0x13, 0xe1, 0x65, 0x11, 0xa5, 0xa9, - 0xfa, 0x90, 0xc2, 0xab, 0x1b, 0x12, 0x31, 0x30, 0x1e, 0xc5, 0x97, 0x08, 0x4f, 0xe4, 0x49, 0x52, - 0x7c, 0x68, 0x59, 0xae, 0x9d, 0x08, 0x17, 0x1d, 0x66, 0x39, 0x93, 0x98, 0xae, 0x59, 0x2c, 0x0f, - 0xd0, 0x41, 0x7e, 0x09, 0x24, 0x11, 0x5e, 0x9e, 0xb0, 0x44, 0x52, 0x21, 0xf2, 0x54, 0xb2, 0x61, - 0xf9, 0x51, 0xb0, 0x9e, 0x88, 0xd3, 0xd9, 0x05, 0xf2, 0x48, 0xb3, 0x99, 0xcb, 0xc6, 0xb4, 0xac, - 0x9d, 0x88, 0x57, 0xfa, 0xe6, 0x38, 0x70, 0x7e, 0xf8, 0x71, 0xeb, 0xbd, 0x7f, 0xff, 0xb8, 0xf5, - 0xde, 0x9f, 0xa7, 0x5b, 0x8d, 0x1f, 0xa6, 0x5b, 0x8d, 0x7f, 0x4c, 0xb7, 0x1a, 0xff, 0x9d, 0x6e, - 0x35, 0x86, 0x4b, 0xfa, 0xcf, 0x95, 0x5f, 0xfd, 0x2f, 0x00, 0x00, 0xff, 0xff, 0xc4, 0x4e, 0x24, - 0x22, 0xc4, 0x11, 0x00, 0x00, -} - -func (m *Metrics) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *Metrics) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *Metrics) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if m.XXX_unrecognized != nil { - i -= len(m.XXX_unrecognized) - copy(dAtA[i:], m.XXX_unrecognized) - } - if m.MemoryOomControl != nil { - { - size, err := m.MemoryOomControl.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintMetrics(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x4a - } - if m.CgroupStats != nil { - { - size, err := m.CgroupStats.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintMetrics(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x42 - } - if len(m.Network) > 0 { - for iNdEx := len(m.Network) - 1; iNdEx >= 0; iNdEx-- { - { - size, err := m.Network[iNdEx].MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintMetrics(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x3a - } - } - if m.Rdma != nil { - { - size, err := m.Rdma.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintMetrics(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x32 - } - if m.Blkio != nil { - { - size, err := m.Blkio.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintMetrics(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x2a - } - if m.Memory != nil { - { - size, err := m.Memory.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintMetrics(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x22 - } - if m.CPU != nil { - { - size, err := m.CPU.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintMetrics(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x1a - } - if m.Pids != nil { - { - size, err := m.Pids.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintMetrics(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x12 - } - if len(m.Hugetlb) > 0 { - for iNdEx := len(m.Hugetlb) - 1; iNdEx >= 0; iNdEx-- { - { - size, err := m.Hugetlb[iNdEx].MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintMetrics(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0xa - } - } - return len(dAtA) - i, nil -} - -func (m *HugetlbStat) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *HugetlbStat) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *HugetlbStat) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if m.XXX_unrecognized != nil { - i -= len(m.XXX_unrecognized) - copy(dAtA[i:], m.XXX_unrecognized) - } - if len(m.Pagesize) > 0 { - i -= len(m.Pagesize) - copy(dAtA[i:], m.Pagesize) - i = encodeVarintMetrics(dAtA, i, uint64(len(m.Pagesize))) - i-- - dAtA[i] = 0x22 - } - if m.Failcnt != 0 { - i = encodeVarintMetrics(dAtA, i, uint64(m.Failcnt)) - i-- - dAtA[i] = 0x18 - } - if m.Max != 0 { - i = encodeVarintMetrics(dAtA, i, uint64(m.Max)) - i-- - dAtA[i] = 0x10 - } - if m.Usage != 0 { - i = encodeVarintMetrics(dAtA, i, uint64(m.Usage)) - i-- - dAtA[i] = 0x8 - } - return len(dAtA) - i, nil -} - -func (m *PidsStat) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *PidsStat) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *PidsStat) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if m.XXX_unrecognized != nil { - i -= len(m.XXX_unrecognized) - copy(dAtA[i:], m.XXX_unrecognized) - } - if m.Limit != 0 { - i = encodeVarintMetrics(dAtA, i, uint64(m.Limit)) - i-- - dAtA[i] = 0x10 - } - if m.Current != 0 { - i = encodeVarintMetrics(dAtA, i, uint64(m.Current)) - i-- - dAtA[i] = 0x8 - } - return len(dAtA) - i, nil -} - -func (m *CPUStat) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *CPUStat) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *CPUStat) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if m.XXX_unrecognized != nil { - i -= len(m.XXX_unrecognized) - copy(dAtA[i:], m.XXX_unrecognized) - } - if m.Throttling != nil { - { - size, err := m.Throttling.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintMetrics(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x12 - } - if m.Usage != nil { - { - size, err := m.Usage.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintMetrics(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0xa - } - return len(dAtA) - i, nil -} - -func (m *CPUUsage) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *CPUUsage) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *CPUUsage) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if m.XXX_unrecognized != nil { - i -= len(m.XXX_unrecognized) - copy(dAtA[i:], m.XXX_unrecognized) - } - if len(m.PerCPU) > 0 { - dAtA11 := make([]byte, len(m.PerCPU)*10) - var j10 int - for _, num := range m.PerCPU { - for num >= 1<<7 { - dAtA11[j10] = uint8(uint64(num)&0x7f | 0x80) - num >>= 7 - j10++ - } - dAtA11[j10] = uint8(num) - j10++ - } - i -= j10 - copy(dAtA[i:], dAtA11[:j10]) - i = encodeVarintMetrics(dAtA, i, uint64(j10)) - i-- - dAtA[i] = 0x22 - } - if m.User != 0 { - i = encodeVarintMetrics(dAtA, i, uint64(m.User)) - i-- - dAtA[i] = 0x18 - } - if m.Kernel != 0 { - i = encodeVarintMetrics(dAtA, i, uint64(m.Kernel)) - i-- - dAtA[i] = 0x10 - } - if m.Total != 0 { - i = encodeVarintMetrics(dAtA, i, uint64(m.Total)) - i-- - dAtA[i] = 0x8 - } - return len(dAtA) - i, nil -} - -func (m *Throttle) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *Throttle) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *Throttle) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if m.XXX_unrecognized != nil { - i -= len(m.XXX_unrecognized) - copy(dAtA[i:], m.XXX_unrecognized) - } - if m.ThrottledTime != 0 { - i = encodeVarintMetrics(dAtA, i, uint64(m.ThrottledTime)) - i-- - dAtA[i] = 0x18 - } - if m.ThrottledPeriods != 0 { - i = encodeVarintMetrics(dAtA, i, uint64(m.ThrottledPeriods)) - i-- - dAtA[i] = 0x10 - } - if m.Periods != 0 { - i = encodeVarintMetrics(dAtA, i, uint64(m.Periods)) - i-- - dAtA[i] = 0x8 - } - return len(dAtA) - i, nil -} - -func (m *MemoryStat) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *MemoryStat) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *MemoryStat) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if m.XXX_unrecognized != nil { - i -= len(m.XXX_unrecognized) - copy(dAtA[i:], m.XXX_unrecognized) - } - if m.KernelTCP != nil { - { - size, err := m.KernelTCP.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintMetrics(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x2 - i-- - dAtA[i] = 0xa2 - } - if m.Kernel != nil { - { - size, err := m.Kernel.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintMetrics(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x2 - i-- - dAtA[i] = 0x9a - } - if m.Swap != nil { - { - size, err := m.Swap.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintMetrics(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x2 - i-- - dAtA[i] = 0x92 - } - if m.Usage != nil { - { - size, err := m.Usage.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintMetrics(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x2 - i-- - dAtA[i] = 0x8a - } - if m.TotalUnevictable != 0 { - i = encodeVarintMetrics(dAtA, i, uint64(m.TotalUnevictable)) - i-- - dAtA[i] = 0x2 - i-- - dAtA[i] = 0x80 - } - if m.TotalActiveFile != 0 { - i = encodeVarintMetrics(dAtA, i, uint64(m.TotalActiveFile)) - i-- - dAtA[i] = 0x1 - i-- - dAtA[i] = 0xf8 - } - if m.TotalInactiveFile != 0 { - i = encodeVarintMetrics(dAtA, i, uint64(m.TotalInactiveFile)) - i-- - dAtA[i] = 0x1 - i-- - dAtA[i] = 0xf0 - } - if m.TotalActiveAnon != 0 { - i = encodeVarintMetrics(dAtA, i, uint64(m.TotalActiveAnon)) - i-- - dAtA[i] = 0x1 - i-- - dAtA[i] = 0xe8 - } - if m.TotalInactiveAnon != 0 { - i = encodeVarintMetrics(dAtA, i, uint64(m.TotalInactiveAnon)) - i-- - dAtA[i] = 0x1 - i-- - dAtA[i] = 0xe0 - } - if m.TotalPgMajFault != 0 { - i = encodeVarintMetrics(dAtA, i, uint64(m.TotalPgMajFault)) - i-- - dAtA[i] = 0x1 - i-- - dAtA[i] = 0xd8 - } - if m.TotalPgFault != 0 { - i = encodeVarintMetrics(dAtA, i, uint64(m.TotalPgFault)) - i-- - dAtA[i] = 0x1 - i-- - dAtA[i] = 0xd0 - } - if m.TotalPgPgOut != 0 { - i = encodeVarintMetrics(dAtA, i, uint64(m.TotalPgPgOut)) - i-- - dAtA[i] = 0x1 - i-- - dAtA[i] = 0xc8 - } - if m.TotalPgPgIn != 0 { - i = encodeVarintMetrics(dAtA, i, uint64(m.TotalPgPgIn)) - i-- - dAtA[i] = 0x1 - i-- - dAtA[i] = 0xc0 - } - if m.TotalWriteback != 0 { - i = encodeVarintMetrics(dAtA, i, uint64(m.TotalWriteback)) - i-- - dAtA[i] = 0x1 - i-- - dAtA[i] = 0xb8 - } - if m.TotalDirty != 0 { - i = encodeVarintMetrics(dAtA, i, uint64(m.TotalDirty)) - i-- - dAtA[i] = 0x1 - i-- - dAtA[i] = 0xb0 - } - if m.TotalMappedFile != 0 { - i = encodeVarintMetrics(dAtA, i, uint64(m.TotalMappedFile)) - i-- - dAtA[i] = 0x1 - i-- - dAtA[i] = 0xa8 - } - if m.TotalRSSHuge != 0 { - i = encodeVarintMetrics(dAtA, i, uint64(m.TotalRSSHuge)) - i-- - dAtA[i] = 0x1 - i-- - dAtA[i] = 0xa0 - } - if m.TotalRSS != 0 { - i = encodeVarintMetrics(dAtA, i, uint64(m.TotalRSS)) - i-- - dAtA[i] = 0x1 - i-- - dAtA[i] = 0x98 - } - if m.TotalCache != 0 { - i = encodeVarintMetrics(dAtA, i, uint64(m.TotalCache)) - i-- - dAtA[i] = 0x1 - i-- - dAtA[i] = 0x90 - } - if m.HierarchicalSwapLimit != 0 { - i = encodeVarintMetrics(dAtA, i, uint64(m.HierarchicalSwapLimit)) - i-- - dAtA[i] = 0x1 - i-- - dAtA[i] = 0x88 - } - if m.HierarchicalMemoryLimit != 0 { - i = encodeVarintMetrics(dAtA, i, uint64(m.HierarchicalMemoryLimit)) - i-- - dAtA[i] = 0x1 - i-- - dAtA[i] = 0x80 - } - if m.Unevictable != 0 { - i = encodeVarintMetrics(dAtA, i, uint64(m.Unevictable)) - i-- - dAtA[i] = 0x78 - } - if m.ActiveFile != 0 { - i = encodeVarintMetrics(dAtA, i, uint64(m.ActiveFile)) - i-- - dAtA[i] = 0x70 - } - if m.InactiveFile != 0 { - i = encodeVarintMetrics(dAtA, i, uint64(m.InactiveFile)) - i-- - dAtA[i] = 0x68 - } - if m.ActiveAnon != 0 { - i = encodeVarintMetrics(dAtA, i, uint64(m.ActiveAnon)) - i-- - dAtA[i] = 0x60 - } - if m.InactiveAnon != 0 { - i = encodeVarintMetrics(dAtA, i, uint64(m.InactiveAnon)) - i-- - dAtA[i] = 0x58 - } - if m.PgMajFault != 0 { - i = encodeVarintMetrics(dAtA, i, uint64(m.PgMajFault)) - i-- - dAtA[i] = 0x50 - } - if m.PgFault != 0 { - i = encodeVarintMetrics(dAtA, i, uint64(m.PgFault)) - i-- - dAtA[i] = 0x48 - } - if m.PgPgOut != 0 { - i = encodeVarintMetrics(dAtA, i, uint64(m.PgPgOut)) - i-- - dAtA[i] = 0x40 - } - if m.PgPgIn != 0 { - i = encodeVarintMetrics(dAtA, i, uint64(m.PgPgIn)) - i-- - dAtA[i] = 0x38 - } - if m.Writeback != 0 { - i = encodeVarintMetrics(dAtA, i, uint64(m.Writeback)) - i-- - dAtA[i] = 0x30 - } - if m.Dirty != 0 { - i = encodeVarintMetrics(dAtA, i, uint64(m.Dirty)) - i-- - dAtA[i] = 0x28 - } - if m.MappedFile != 0 { - i = encodeVarintMetrics(dAtA, i, uint64(m.MappedFile)) - i-- - dAtA[i] = 0x20 - } - if m.RSSHuge != 0 { - i = encodeVarintMetrics(dAtA, i, uint64(m.RSSHuge)) - i-- - dAtA[i] = 0x18 - } - if m.RSS != 0 { - i = encodeVarintMetrics(dAtA, i, uint64(m.RSS)) - i-- - dAtA[i] = 0x10 - } - if m.Cache != 0 { - i = encodeVarintMetrics(dAtA, i, uint64(m.Cache)) - i-- - dAtA[i] = 0x8 - } - return len(dAtA) - i, nil -} - -func (m *MemoryEntry) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *MemoryEntry) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *MemoryEntry) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if m.XXX_unrecognized != nil { - i -= len(m.XXX_unrecognized) - copy(dAtA[i:], m.XXX_unrecognized) - } - if m.Failcnt != 0 { - i = encodeVarintMetrics(dAtA, i, uint64(m.Failcnt)) - i-- - dAtA[i] = 0x20 - } - if m.Max != 0 { - i = encodeVarintMetrics(dAtA, i, uint64(m.Max)) - i-- - dAtA[i] = 0x18 - } - if m.Usage != 0 { - i = encodeVarintMetrics(dAtA, i, uint64(m.Usage)) - i-- - dAtA[i] = 0x10 - } - if m.Limit != 0 { - i = encodeVarintMetrics(dAtA, i, uint64(m.Limit)) - i-- - dAtA[i] = 0x8 - } - return len(dAtA) - i, nil -} - -func (m *MemoryOomControl) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *MemoryOomControl) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *MemoryOomControl) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if m.XXX_unrecognized != nil { - i -= len(m.XXX_unrecognized) - copy(dAtA[i:], m.XXX_unrecognized) - } - if m.OomKill != 0 { - i = encodeVarintMetrics(dAtA, i, uint64(m.OomKill)) - i-- - dAtA[i] = 0x18 - } - if m.UnderOom != 0 { - i = encodeVarintMetrics(dAtA, i, uint64(m.UnderOom)) - i-- - dAtA[i] = 0x10 - } - if m.OomKillDisable != 0 { - i = encodeVarintMetrics(dAtA, i, uint64(m.OomKillDisable)) - i-- - dAtA[i] = 0x8 - } - return len(dAtA) - i, nil -} - -func (m *BlkIOStat) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *BlkIOStat) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *BlkIOStat) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if m.XXX_unrecognized != nil { - i -= len(m.XXX_unrecognized) - copy(dAtA[i:], m.XXX_unrecognized) - } - if len(m.SectorsRecursive) > 0 { - for iNdEx := len(m.SectorsRecursive) - 1; iNdEx >= 0; iNdEx-- { - { - size, err := m.SectorsRecursive[iNdEx].MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintMetrics(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x42 - } - } - if len(m.IoTimeRecursive) > 0 { - for iNdEx := len(m.IoTimeRecursive) - 1; iNdEx >= 0; iNdEx-- { - { - size, err := m.IoTimeRecursive[iNdEx].MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintMetrics(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x3a - } - } - if len(m.IoMergedRecursive) > 0 { - for iNdEx := len(m.IoMergedRecursive) - 1; iNdEx >= 0; iNdEx-- { - { - size, err := m.IoMergedRecursive[iNdEx].MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintMetrics(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x32 - } - } - if len(m.IoWaitTimeRecursive) > 0 { - for iNdEx := len(m.IoWaitTimeRecursive) - 1; iNdEx >= 0; iNdEx-- { - { - size, err := m.IoWaitTimeRecursive[iNdEx].MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintMetrics(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x2a - } - } - if len(m.IoServiceTimeRecursive) > 0 { - for iNdEx := len(m.IoServiceTimeRecursive) - 1; iNdEx >= 0; iNdEx-- { - { - size, err := m.IoServiceTimeRecursive[iNdEx].MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintMetrics(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x22 - } - } - if len(m.IoQueuedRecursive) > 0 { - for iNdEx := len(m.IoQueuedRecursive) - 1; iNdEx >= 0; iNdEx-- { - { - size, err := m.IoQueuedRecursive[iNdEx].MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintMetrics(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x1a - } - } - if len(m.IoServicedRecursive) > 0 { - for iNdEx := len(m.IoServicedRecursive) - 1; iNdEx >= 0; iNdEx-- { - { - size, err := m.IoServicedRecursive[iNdEx].MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintMetrics(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x12 - } - } - if len(m.IoServiceBytesRecursive) > 0 { - for iNdEx := len(m.IoServiceBytesRecursive) - 1; iNdEx >= 0; iNdEx-- { - { - size, err := m.IoServiceBytesRecursive[iNdEx].MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintMetrics(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0xa - } - } - return len(dAtA) - i, nil -} - -func (m *BlkIOEntry) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *BlkIOEntry) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *BlkIOEntry) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if m.XXX_unrecognized != nil { - i -= len(m.XXX_unrecognized) - copy(dAtA[i:], m.XXX_unrecognized) - } - if m.Value != 0 { - i = encodeVarintMetrics(dAtA, i, uint64(m.Value)) - i-- - dAtA[i] = 0x28 - } - if m.Minor != 0 { - i = encodeVarintMetrics(dAtA, i, uint64(m.Minor)) - i-- - dAtA[i] = 0x20 - } - if m.Major != 0 { - i = encodeVarintMetrics(dAtA, i, uint64(m.Major)) - i-- - dAtA[i] = 0x18 - } - if len(m.Device) > 0 { - i -= len(m.Device) - copy(dAtA[i:], m.Device) - i = encodeVarintMetrics(dAtA, i, uint64(len(m.Device))) - i-- - dAtA[i] = 0x12 - } - if len(m.Op) > 0 { - i -= len(m.Op) - copy(dAtA[i:], m.Op) - i = encodeVarintMetrics(dAtA, i, uint64(len(m.Op))) - i-- - dAtA[i] = 0xa - } - return len(dAtA) - i, nil -} - -func (m *RdmaStat) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *RdmaStat) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *RdmaStat) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if m.XXX_unrecognized != nil { - i -= len(m.XXX_unrecognized) - copy(dAtA[i:], m.XXX_unrecognized) - } - if len(m.Limit) > 0 { - for iNdEx := len(m.Limit) - 1; iNdEx >= 0; iNdEx-- { - { - size, err := m.Limit[iNdEx].MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintMetrics(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x12 - } - } - if len(m.Current) > 0 { - for iNdEx := len(m.Current) - 1; iNdEx >= 0; iNdEx-- { - { - size, err := m.Current[iNdEx].MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintMetrics(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0xa - } - } - return len(dAtA) - i, nil -} - -func (m *RdmaEntry) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *RdmaEntry) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *RdmaEntry) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if m.XXX_unrecognized != nil { - i -= len(m.XXX_unrecognized) - copy(dAtA[i:], m.XXX_unrecognized) - } - if m.HcaObjects != 0 { - i = encodeVarintMetrics(dAtA, i, uint64(m.HcaObjects)) - i-- - dAtA[i] = 0x18 - } - if m.HcaHandles != 0 { - i = encodeVarintMetrics(dAtA, i, uint64(m.HcaHandles)) - i-- - dAtA[i] = 0x10 - } - if len(m.Device) > 0 { - i -= len(m.Device) - copy(dAtA[i:], m.Device) - i = encodeVarintMetrics(dAtA, i, uint64(len(m.Device))) - i-- - dAtA[i] = 0xa - } - return len(dAtA) - i, nil -} - -func (m *NetworkStat) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *NetworkStat) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *NetworkStat) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if m.XXX_unrecognized != nil { - i -= len(m.XXX_unrecognized) - copy(dAtA[i:], m.XXX_unrecognized) - } - if m.TxDropped != 0 { - i = encodeVarintMetrics(dAtA, i, uint64(m.TxDropped)) - i-- - dAtA[i] = 0x48 - } - if m.TxErrors != 0 { - i = encodeVarintMetrics(dAtA, i, uint64(m.TxErrors)) - i-- - dAtA[i] = 0x40 - } - if m.TxPackets != 0 { - i = encodeVarintMetrics(dAtA, i, uint64(m.TxPackets)) - i-- - dAtA[i] = 0x38 - } - if m.TxBytes != 0 { - i = encodeVarintMetrics(dAtA, i, uint64(m.TxBytes)) - i-- - dAtA[i] = 0x30 - } - if m.RxDropped != 0 { - i = encodeVarintMetrics(dAtA, i, uint64(m.RxDropped)) - i-- - dAtA[i] = 0x28 - } - if m.RxErrors != 0 { - i = encodeVarintMetrics(dAtA, i, uint64(m.RxErrors)) - i-- - dAtA[i] = 0x20 - } - if m.RxPackets != 0 { - i = encodeVarintMetrics(dAtA, i, uint64(m.RxPackets)) - i-- - dAtA[i] = 0x18 - } - if m.RxBytes != 0 { - i = encodeVarintMetrics(dAtA, i, uint64(m.RxBytes)) - i-- - dAtA[i] = 0x10 - } - if len(m.Name) > 0 { - i -= len(m.Name) - copy(dAtA[i:], m.Name) - i = encodeVarintMetrics(dAtA, i, uint64(len(m.Name))) - i-- - dAtA[i] = 0xa - } - return len(dAtA) - i, nil -} - -func (m *CgroupStats) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *CgroupStats) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *CgroupStats) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if m.XXX_unrecognized != nil { - i -= len(m.XXX_unrecognized) - copy(dAtA[i:], m.XXX_unrecognized) - } - if m.NrIoWait != 0 { - i = encodeVarintMetrics(dAtA, i, uint64(m.NrIoWait)) - i-- - dAtA[i] = 0x28 - } - if m.NrUninterruptible != 0 { - i = encodeVarintMetrics(dAtA, i, uint64(m.NrUninterruptible)) - i-- - dAtA[i] = 0x20 - } - if m.NrStopped != 0 { - i = encodeVarintMetrics(dAtA, i, uint64(m.NrStopped)) - i-- - dAtA[i] = 0x18 - } - if m.NrRunning != 0 { - i = encodeVarintMetrics(dAtA, i, uint64(m.NrRunning)) - i-- - dAtA[i] = 0x10 - } - if m.NrSleeping != 0 { - i = encodeVarintMetrics(dAtA, i, uint64(m.NrSleeping)) - i-- - dAtA[i] = 0x8 - } - return len(dAtA) - i, nil -} - -func encodeVarintMetrics(dAtA []byte, offset int, v uint64) int { - offset -= sovMetrics(v) - base := offset - for v >= 1<<7 { - dAtA[offset] = uint8(v&0x7f | 0x80) - v >>= 7 - offset++ - } - dAtA[offset] = uint8(v) - return base -} -func (m *Metrics) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - if len(m.Hugetlb) > 0 { - for _, e := range m.Hugetlb { - l = e.Size() - n += 1 + l + sovMetrics(uint64(l)) - } - } - if m.Pids != nil { - l = m.Pids.Size() - n += 1 + l + sovMetrics(uint64(l)) - } - if m.CPU != nil { - l = m.CPU.Size() - n += 1 + l + sovMetrics(uint64(l)) - } - if m.Memory != nil { - l = m.Memory.Size() - n += 1 + l + sovMetrics(uint64(l)) - } - if m.Blkio != nil { - l = m.Blkio.Size() - n += 1 + l + sovMetrics(uint64(l)) - } - if m.Rdma != nil { - l = m.Rdma.Size() - n += 1 + l + sovMetrics(uint64(l)) - } - if len(m.Network) > 0 { - for _, e := range m.Network { - l = e.Size() - n += 1 + l + sovMetrics(uint64(l)) - } - } - if m.CgroupStats != nil { - l = m.CgroupStats.Size() - n += 1 + l + sovMetrics(uint64(l)) - } - if m.MemoryOomControl != nil { - l = m.MemoryOomControl.Size() - n += 1 + l + sovMetrics(uint64(l)) - } - if m.XXX_unrecognized != nil { - n += len(m.XXX_unrecognized) - } - return n -} - -func (m *HugetlbStat) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - if m.Usage != 0 { - n += 1 + sovMetrics(uint64(m.Usage)) - } - if m.Max != 0 { - n += 1 + sovMetrics(uint64(m.Max)) - } - if m.Failcnt != 0 { - n += 1 + sovMetrics(uint64(m.Failcnt)) - } - l = len(m.Pagesize) - if l > 0 { - n += 1 + l + sovMetrics(uint64(l)) - } - if m.XXX_unrecognized != nil { - n += len(m.XXX_unrecognized) - } - return n -} - -func (m *PidsStat) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - if m.Current != 0 { - n += 1 + sovMetrics(uint64(m.Current)) - } - if m.Limit != 0 { - n += 1 + sovMetrics(uint64(m.Limit)) - } - if m.XXX_unrecognized != nil { - n += len(m.XXX_unrecognized) - } - return n -} - -func (m *CPUStat) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - if m.Usage != nil { - l = m.Usage.Size() - n += 1 + l + sovMetrics(uint64(l)) - } - if m.Throttling != nil { - l = m.Throttling.Size() - n += 1 + l + sovMetrics(uint64(l)) - } - if m.XXX_unrecognized != nil { - n += len(m.XXX_unrecognized) - } - return n -} - -func (m *CPUUsage) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - if m.Total != 0 { - n += 1 + sovMetrics(uint64(m.Total)) - } - if m.Kernel != 0 { - n += 1 + sovMetrics(uint64(m.Kernel)) - } - if m.User != 0 { - n += 1 + sovMetrics(uint64(m.User)) - } - if len(m.PerCPU) > 0 { - l = 0 - for _, e := range m.PerCPU { - l += sovMetrics(uint64(e)) - } - n += 1 + sovMetrics(uint64(l)) + l - } - if m.XXX_unrecognized != nil { - n += len(m.XXX_unrecognized) - } - return n -} - -func (m *Throttle) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - if m.Periods != 0 { - n += 1 + sovMetrics(uint64(m.Periods)) - } - if m.ThrottledPeriods != 0 { - n += 1 + sovMetrics(uint64(m.ThrottledPeriods)) - } - if m.ThrottledTime != 0 { - n += 1 + sovMetrics(uint64(m.ThrottledTime)) - } - if m.XXX_unrecognized != nil { - n += len(m.XXX_unrecognized) - } - return n -} - -func (m *MemoryStat) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - if m.Cache != 0 { - n += 1 + sovMetrics(uint64(m.Cache)) - } - if m.RSS != 0 { - n += 1 + sovMetrics(uint64(m.RSS)) - } - if m.RSSHuge != 0 { - n += 1 + sovMetrics(uint64(m.RSSHuge)) - } - if m.MappedFile != 0 { - n += 1 + sovMetrics(uint64(m.MappedFile)) - } - if m.Dirty != 0 { - n += 1 + sovMetrics(uint64(m.Dirty)) - } - if m.Writeback != 0 { - n += 1 + sovMetrics(uint64(m.Writeback)) - } - if m.PgPgIn != 0 { - n += 1 + sovMetrics(uint64(m.PgPgIn)) - } - if m.PgPgOut != 0 { - n += 1 + sovMetrics(uint64(m.PgPgOut)) - } - if m.PgFault != 0 { - n += 1 + sovMetrics(uint64(m.PgFault)) - } - if m.PgMajFault != 0 { - n += 1 + sovMetrics(uint64(m.PgMajFault)) - } - if m.InactiveAnon != 0 { - n += 1 + sovMetrics(uint64(m.InactiveAnon)) - } - if m.ActiveAnon != 0 { - n += 1 + sovMetrics(uint64(m.ActiveAnon)) - } - if m.InactiveFile != 0 { - n += 1 + sovMetrics(uint64(m.InactiveFile)) - } - if m.ActiveFile != 0 { - n += 1 + sovMetrics(uint64(m.ActiveFile)) - } - if m.Unevictable != 0 { - n += 1 + sovMetrics(uint64(m.Unevictable)) - } - if m.HierarchicalMemoryLimit != 0 { - n += 2 + sovMetrics(uint64(m.HierarchicalMemoryLimit)) - } - if m.HierarchicalSwapLimit != 0 { - n += 2 + sovMetrics(uint64(m.HierarchicalSwapLimit)) - } - if m.TotalCache != 0 { - n += 2 + sovMetrics(uint64(m.TotalCache)) - } - if m.TotalRSS != 0 { - n += 2 + sovMetrics(uint64(m.TotalRSS)) - } - if m.TotalRSSHuge != 0 { - n += 2 + sovMetrics(uint64(m.TotalRSSHuge)) - } - if m.TotalMappedFile != 0 { - n += 2 + sovMetrics(uint64(m.TotalMappedFile)) - } - if m.TotalDirty != 0 { - n += 2 + sovMetrics(uint64(m.TotalDirty)) - } - if m.TotalWriteback != 0 { - n += 2 + sovMetrics(uint64(m.TotalWriteback)) - } - if m.TotalPgPgIn != 0 { - n += 2 + sovMetrics(uint64(m.TotalPgPgIn)) - } - if m.TotalPgPgOut != 0 { - n += 2 + sovMetrics(uint64(m.TotalPgPgOut)) - } - if m.TotalPgFault != 0 { - n += 2 + sovMetrics(uint64(m.TotalPgFault)) - } - if m.TotalPgMajFault != 0 { - n += 2 + sovMetrics(uint64(m.TotalPgMajFault)) - } - if m.TotalInactiveAnon != 0 { - n += 2 + sovMetrics(uint64(m.TotalInactiveAnon)) - } - if m.TotalActiveAnon != 0 { - n += 2 + sovMetrics(uint64(m.TotalActiveAnon)) - } - if m.TotalInactiveFile != 0 { - n += 2 + sovMetrics(uint64(m.TotalInactiveFile)) - } - if m.TotalActiveFile != 0 { - n += 2 + sovMetrics(uint64(m.TotalActiveFile)) - } - if m.TotalUnevictable != 0 { - n += 2 + sovMetrics(uint64(m.TotalUnevictable)) - } - if m.Usage != nil { - l = m.Usage.Size() - n += 2 + l + sovMetrics(uint64(l)) - } - if m.Swap != nil { - l = m.Swap.Size() - n += 2 + l + sovMetrics(uint64(l)) - } - if m.Kernel != nil { - l = m.Kernel.Size() - n += 2 + l + sovMetrics(uint64(l)) - } - if m.KernelTCP != nil { - l = m.KernelTCP.Size() - n += 2 + l + sovMetrics(uint64(l)) - } - if m.XXX_unrecognized != nil { - n += len(m.XXX_unrecognized) - } - return n -} - -func (m *MemoryEntry) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - if m.Limit != 0 { - n += 1 + sovMetrics(uint64(m.Limit)) - } - if m.Usage != 0 { - n += 1 + sovMetrics(uint64(m.Usage)) - } - if m.Max != 0 { - n += 1 + sovMetrics(uint64(m.Max)) - } - if m.Failcnt != 0 { - n += 1 + sovMetrics(uint64(m.Failcnt)) - } - if m.XXX_unrecognized != nil { - n += len(m.XXX_unrecognized) - } - return n -} - -func (m *MemoryOomControl) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - if m.OomKillDisable != 0 { - n += 1 + sovMetrics(uint64(m.OomKillDisable)) - } - if m.UnderOom != 0 { - n += 1 + sovMetrics(uint64(m.UnderOom)) - } - if m.OomKill != 0 { - n += 1 + sovMetrics(uint64(m.OomKill)) - } - if m.XXX_unrecognized != nil { - n += len(m.XXX_unrecognized) - } - return n -} - -func (m *BlkIOStat) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - if len(m.IoServiceBytesRecursive) > 0 { - for _, e := range m.IoServiceBytesRecursive { - l = e.Size() - n += 1 + l + sovMetrics(uint64(l)) - } - } - if len(m.IoServicedRecursive) > 0 { - for _, e := range m.IoServicedRecursive { - l = e.Size() - n += 1 + l + sovMetrics(uint64(l)) - } - } - if len(m.IoQueuedRecursive) > 0 { - for _, e := range m.IoQueuedRecursive { - l = e.Size() - n += 1 + l + sovMetrics(uint64(l)) - } - } - if len(m.IoServiceTimeRecursive) > 0 { - for _, e := range m.IoServiceTimeRecursive { - l = e.Size() - n += 1 + l + sovMetrics(uint64(l)) - } - } - if len(m.IoWaitTimeRecursive) > 0 { - for _, e := range m.IoWaitTimeRecursive { - l = e.Size() - n += 1 + l + sovMetrics(uint64(l)) - } - } - if len(m.IoMergedRecursive) > 0 { - for _, e := range m.IoMergedRecursive { - l = e.Size() - n += 1 + l + sovMetrics(uint64(l)) - } - } - if len(m.IoTimeRecursive) > 0 { - for _, e := range m.IoTimeRecursive { - l = e.Size() - n += 1 + l + sovMetrics(uint64(l)) - } - } - if len(m.SectorsRecursive) > 0 { - for _, e := range m.SectorsRecursive { - l = e.Size() - n += 1 + l + sovMetrics(uint64(l)) - } - } - if m.XXX_unrecognized != nil { - n += len(m.XXX_unrecognized) - } - return n -} - -func (m *BlkIOEntry) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - l = len(m.Op) - if l > 0 { - n += 1 + l + sovMetrics(uint64(l)) - } - l = len(m.Device) - if l > 0 { - n += 1 + l + sovMetrics(uint64(l)) - } - if m.Major != 0 { - n += 1 + sovMetrics(uint64(m.Major)) - } - if m.Minor != 0 { - n += 1 + sovMetrics(uint64(m.Minor)) - } - if m.Value != 0 { - n += 1 + sovMetrics(uint64(m.Value)) - } - if m.XXX_unrecognized != nil { - n += len(m.XXX_unrecognized) - } - return n -} - -func (m *RdmaStat) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - if len(m.Current) > 0 { - for _, e := range m.Current { - l = e.Size() - n += 1 + l + sovMetrics(uint64(l)) - } - } - if len(m.Limit) > 0 { - for _, e := range m.Limit { - l = e.Size() - n += 1 + l + sovMetrics(uint64(l)) - } - } - if m.XXX_unrecognized != nil { - n += len(m.XXX_unrecognized) - } - return n -} - -func (m *RdmaEntry) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - l = len(m.Device) - if l > 0 { - n += 1 + l + sovMetrics(uint64(l)) - } - if m.HcaHandles != 0 { - n += 1 + sovMetrics(uint64(m.HcaHandles)) - } - if m.HcaObjects != 0 { - n += 1 + sovMetrics(uint64(m.HcaObjects)) - } - if m.XXX_unrecognized != nil { - n += len(m.XXX_unrecognized) - } - return n -} - -func (m *NetworkStat) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - l = len(m.Name) - if l > 0 { - n += 1 + l + sovMetrics(uint64(l)) - } - if m.RxBytes != 0 { - n += 1 + sovMetrics(uint64(m.RxBytes)) - } - if m.RxPackets != 0 { - n += 1 + sovMetrics(uint64(m.RxPackets)) - } - if m.RxErrors != 0 { - n += 1 + sovMetrics(uint64(m.RxErrors)) - } - if m.RxDropped != 0 { - n += 1 + sovMetrics(uint64(m.RxDropped)) - } - if m.TxBytes != 0 { - n += 1 + sovMetrics(uint64(m.TxBytes)) - } - if m.TxPackets != 0 { - n += 1 + sovMetrics(uint64(m.TxPackets)) - } - if m.TxErrors != 0 { - n += 1 + sovMetrics(uint64(m.TxErrors)) - } - if m.TxDropped != 0 { - n += 1 + sovMetrics(uint64(m.TxDropped)) - } - if m.XXX_unrecognized != nil { - n += len(m.XXX_unrecognized) - } - return n -} - -func (m *CgroupStats) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - if m.NrSleeping != 0 { - n += 1 + sovMetrics(uint64(m.NrSleeping)) - } - if m.NrRunning != 0 { - n += 1 + sovMetrics(uint64(m.NrRunning)) - } - if m.NrStopped != 0 { - n += 1 + sovMetrics(uint64(m.NrStopped)) - } - if m.NrUninterruptible != 0 { - n += 1 + sovMetrics(uint64(m.NrUninterruptible)) - } - if m.NrIoWait != 0 { - n += 1 + sovMetrics(uint64(m.NrIoWait)) - } - if m.XXX_unrecognized != nil { - n += len(m.XXX_unrecognized) - } - return n -} - -func sovMetrics(x uint64) (n int) { - return (math_bits.Len64(x|1) + 6) / 7 -} -func sozMetrics(x uint64) (n int) { - return sovMetrics(uint64((x << 1) ^ uint64((int64(x) >> 63)))) -} -func (this *Metrics) String() string { - if this == nil { - return "nil" - } - repeatedStringForHugetlb := "[]*HugetlbStat{" - for _, f := range this.Hugetlb { - repeatedStringForHugetlb += strings.Replace(f.String(), "HugetlbStat", "HugetlbStat", 1) + "," - } - repeatedStringForHugetlb += "}" - repeatedStringForNetwork := "[]*NetworkStat{" - for _, f := range this.Network { - repeatedStringForNetwork += strings.Replace(f.String(), "NetworkStat", "NetworkStat", 1) + "," - } - repeatedStringForNetwork += "}" - s := strings.Join([]string{`&Metrics{`, - `Hugetlb:` + repeatedStringForHugetlb + `,`, - `Pids:` + strings.Replace(this.Pids.String(), "PidsStat", "PidsStat", 1) + `,`, - `CPU:` + strings.Replace(this.CPU.String(), "CPUStat", "CPUStat", 1) + `,`, - `Memory:` + strings.Replace(this.Memory.String(), "MemoryStat", "MemoryStat", 1) + `,`, - `Blkio:` + strings.Replace(this.Blkio.String(), "BlkIOStat", "BlkIOStat", 1) + `,`, - `Rdma:` + strings.Replace(this.Rdma.String(), "RdmaStat", "RdmaStat", 1) + `,`, - `Network:` + repeatedStringForNetwork + `,`, - `CgroupStats:` + strings.Replace(this.CgroupStats.String(), "CgroupStats", "CgroupStats", 1) + `,`, - `MemoryOomControl:` + strings.Replace(this.MemoryOomControl.String(), "MemoryOomControl", "MemoryOomControl", 1) + `,`, - `XXX_unrecognized:` + fmt.Sprintf("%v", this.XXX_unrecognized) + `,`, - `}`, - }, "") - return s -} -func (this *HugetlbStat) String() string { - if this == nil { - return "nil" - } - s := strings.Join([]string{`&HugetlbStat{`, - `Usage:` + fmt.Sprintf("%v", this.Usage) + `,`, - `Max:` + fmt.Sprintf("%v", this.Max) + `,`, - `Failcnt:` + fmt.Sprintf("%v", this.Failcnt) + `,`, - `Pagesize:` + fmt.Sprintf("%v", this.Pagesize) + `,`, - `XXX_unrecognized:` + fmt.Sprintf("%v", this.XXX_unrecognized) + `,`, - `}`, - }, "") - return s -} -func (this *PidsStat) String() string { - if this == nil { - return "nil" - } - s := strings.Join([]string{`&PidsStat{`, - `Current:` + fmt.Sprintf("%v", this.Current) + `,`, - `Limit:` + fmt.Sprintf("%v", this.Limit) + `,`, - `XXX_unrecognized:` + fmt.Sprintf("%v", this.XXX_unrecognized) + `,`, - `}`, - }, "") - return s -} -func (this *CPUStat) String() string { - if this == nil { - return "nil" - } - s := strings.Join([]string{`&CPUStat{`, - `Usage:` + strings.Replace(this.Usage.String(), "CPUUsage", "CPUUsage", 1) + `,`, - `Throttling:` + strings.Replace(this.Throttling.String(), "Throttle", "Throttle", 1) + `,`, - `XXX_unrecognized:` + fmt.Sprintf("%v", this.XXX_unrecognized) + `,`, - `}`, - }, "") - return s -} -func (this *CPUUsage) String() string { - if this == nil { - return "nil" - } - s := strings.Join([]string{`&CPUUsage{`, - `Total:` + fmt.Sprintf("%v", this.Total) + `,`, - `Kernel:` + fmt.Sprintf("%v", this.Kernel) + `,`, - `User:` + fmt.Sprintf("%v", this.User) + `,`, - `PerCPU:` + fmt.Sprintf("%v", this.PerCPU) + `,`, - `XXX_unrecognized:` + fmt.Sprintf("%v", this.XXX_unrecognized) + `,`, - `}`, - }, "") - return s -} -func (this *Throttle) String() string { - if this == nil { - return "nil" - } - s := strings.Join([]string{`&Throttle{`, - `Periods:` + fmt.Sprintf("%v", this.Periods) + `,`, - `ThrottledPeriods:` + fmt.Sprintf("%v", this.ThrottledPeriods) + `,`, - `ThrottledTime:` + fmt.Sprintf("%v", this.ThrottledTime) + `,`, - `XXX_unrecognized:` + fmt.Sprintf("%v", this.XXX_unrecognized) + `,`, - `}`, - }, "") - return s -} -func (this *MemoryStat) String() string { - if this == nil { - return "nil" - } - s := strings.Join([]string{`&MemoryStat{`, - `Cache:` + fmt.Sprintf("%v", this.Cache) + `,`, - `RSS:` + fmt.Sprintf("%v", this.RSS) + `,`, - `RSSHuge:` + fmt.Sprintf("%v", this.RSSHuge) + `,`, - `MappedFile:` + fmt.Sprintf("%v", this.MappedFile) + `,`, - `Dirty:` + fmt.Sprintf("%v", this.Dirty) + `,`, - `Writeback:` + fmt.Sprintf("%v", this.Writeback) + `,`, - `PgPgIn:` + fmt.Sprintf("%v", this.PgPgIn) + `,`, - `PgPgOut:` + fmt.Sprintf("%v", this.PgPgOut) + `,`, - `PgFault:` + fmt.Sprintf("%v", this.PgFault) + `,`, - `PgMajFault:` + fmt.Sprintf("%v", this.PgMajFault) + `,`, - `InactiveAnon:` + fmt.Sprintf("%v", this.InactiveAnon) + `,`, - `ActiveAnon:` + fmt.Sprintf("%v", this.ActiveAnon) + `,`, - `InactiveFile:` + fmt.Sprintf("%v", this.InactiveFile) + `,`, - `ActiveFile:` + fmt.Sprintf("%v", this.ActiveFile) + `,`, - `Unevictable:` + fmt.Sprintf("%v", this.Unevictable) + `,`, - `HierarchicalMemoryLimit:` + fmt.Sprintf("%v", this.HierarchicalMemoryLimit) + `,`, - `HierarchicalSwapLimit:` + fmt.Sprintf("%v", this.HierarchicalSwapLimit) + `,`, - `TotalCache:` + fmt.Sprintf("%v", this.TotalCache) + `,`, - `TotalRSS:` + fmt.Sprintf("%v", this.TotalRSS) + `,`, - `TotalRSSHuge:` + fmt.Sprintf("%v", this.TotalRSSHuge) + `,`, - `TotalMappedFile:` + fmt.Sprintf("%v", this.TotalMappedFile) + `,`, - `TotalDirty:` + fmt.Sprintf("%v", this.TotalDirty) + `,`, - `TotalWriteback:` + fmt.Sprintf("%v", this.TotalWriteback) + `,`, - `TotalPgPgIn:` + fmt.Sprintf("%v", this.TotalPgPgIn) + `,`, - `TotalPgPgOut:` + fmt.Sprintf("%v", this.TotalPgPgOut) + `,`, - `TotalPgFault:` + fmt.Sprintf("%v", this.TotalPgFault) + `,`, - `TotalPgMajFault:` + fmt.Sprintf("%v", this.TotalPgMajFault) + `,`, - `TotalInactiveAnon:` + fmt.Sprintf("%v", this.TotalInactiveAnon) + `,`, - `TotalActiveAnon:` + fmt.Sprintf("%v", this.TotalActiveAnon) + `,`, - `TotalInactiveFile:` + fmt.Sprintf("%v", this.TotalInactiveFile) + `,`, - `TotalActiveFile:` + fmt.Sprintf("%v", this.TotalActiveFile) + `,`, - `TotalUnevictable:` + fmt.Sprintf("%v", this.TotalUnevictable) + `,`, - `Usage:` + strings.Replace(this.Usage.String(), "MemoryEntry", "MemoryEntry", 1) + `,`, - `Swap:` + strings.Replace(this.Swap.String(), "MemoryEntry", "MemoryEntry", 1) + `,`, - `Kernel:` + strings.Replace(this.Kernel.String(), "MemoryEntry", "MemoryEntry", 1) + `,`, - `KernelTCP:` + strings.Replace(this.KernelTCP.String(), "MemoryEntry", "MemoryEntry", 1) + `,`, - `XXX_unrecognized:` + fmt.Sprintf("%v", this.XXX_unrecognized) + `,`, - `}`, - }, "") - return s -} -func (this *MemoryEntry) String() string { - if this == nil { - return "nil" - } - s := strings.Join([]string{`&MemoryEntry{`, - `Limit:` + fmt.Sprintf("%v", this.Limit) + `,`, - `Usage:` + fmt.Sprintf("%v", this.Usage) + `,`, - `Max:` + fmt.Sprintf("%v", this.Max) + `,`, - `Failcnt:` + fmt.Sprintf("%v", this.Failcnt) + `,`, - `XXX_unrecognized:` + fmt.Sprintf("%v", this.XXX_unrecognized) + `,`, - `}`, - }, "") - return s -} -func (this *MemoryOomControl) String() string { - if this == nil { - return "nil" - } - s := strings.Join([]string{`&MemoryOomControl{`, - `OomKillDisable:` + fmt.Sprintf("%v", this.OomKillDisable) + `,`, - `UnderOom:` + fmt.Sprintf("%v", this.UnderOom) + `,`, - `OomKill:` + fmt.Sprintf("%v", this.OomKill) + `,`, - `XXX_unrecognized:` + fmt.Sprintf("%v", this.XXX_unrecognized) + `,`, - `}`, - }, "") - return s -} -func (this *BlkIOStat) String() string { - if this == nil { - return "nil" - } - repeatedStringForIoServiceBytesRecursive := "[]*BlkIOEntry{" - for _, f := range this.IoServiceBytesRecursive { - repeatedStringForIoServiceBytesRecursive += strings.Replace(f.String(), "BlkIOEntry", "BlkIOEntry", 1) + "," - } - repeatedStringForIoServiceBytesRecursive += "}" - repeatedStringForIoServicedRecursive := "[]*BlkIOEntry{" - for _, f := range this.IoServicedRecursive { - repeatedStringForIoServicedRecursive += strings.Replace(f.String(), "BlkIOEntry", "BlkIOEntry", 1) + "," - } - repeatedStringForIoServicedRecursive += "}" - repeatedStringForIoQueuedRecursive := "[]*BlkIOEntry{" - for _, f := range this.IoQueuedRecursive { - repeatedStringForIoQueuedRecursive += strings.Replace(f.String(), "BlkIOEntry", "BlkIOEntry", 1) + "," - } - repeatedStringForIoQueuedRecursive += "}" - repeatedStringForIoServiceTimeRecursive := "[]*BlkIOEntry{" - for _, f := range this.IoServiceTimeRecursive { - repeatedStringForIoServiceTimeRecursive += strings.Replace(f.String(), "BlkIOEntry", "BlkIOEntry", 1) + "," - } - repeatedStringForIoServiceTimeRecursive += "}" - repeatedStringForIoWaitTimeRecursive := "[]*BlkIOEntry{" - for _, f := range this.IoWaitTimeRecursive { - repeatedStringForIoWaitTimeRecursive += strings.Replace(f.String(), "BlkIOEntry", "BlkIOEntry", 1) + "," - } - repeatedStringForIoWaitTimeRecursive += "}" - repeatedStringForIoMergedRecursive := "[]*BlkIOEntry{" - for _, f := range this.IoMergedRecursive { - repeatedStringForIoMergedRecursive += strings.Replace(f.String(), "BlkIOEntry", "BlkIOEntry", 1) + "," - } - repeatedStringForIoMergedRecursive += "}" - repeatedStringForIoTimeRecursive := "[]*BlkIOEntry{" - for _, f := range this.IoTimeRecursive { - repeatedStringForIoTimeRecursive += strings.Replace(f.String(), "BlkIOEntry", "BlkIOEntry", 1) + "," - } - repeatedStringForIoTimeRecursive += "}" - repeatedStringForSectorsRecursive := "[]*BlkIOEntry{" - for _, f := range this.SectorsRecursive { - repeatedStringForSectorsRecursive += strings.Replace(f.String(), "BlkIOEntry", "BlkIOEntry", 1) + "," - } - repeatedStringForSectorsRecursive += "}" - s := strings.Join([]string{`&BlkIOStat{`, - `IoServiceBytesRecursive:` + repeatedStringForIoServiceBytesRecursive + `,`, - `IoServicedRecursive:` + repeatedStringForIoServicedRecursive + `,`, - `IoQueuedRecursive:` + repeatedStringForIoQueuedRecursive + `,`, - `IoServiceTimeRecursive:` + repeatedStringForIoServiceTimeRecursive + `,`, - `IoWaitTimeRecursive:` + repeatedStringForIoWaitTimeRecursive + `,`, - `IoMergedRecursive:` + repeatedStringForIoMergedRecursive + `,`, - `IoTimeRecursive:` + repeatedStringForIoTimeRecursive + `,`, - `SectorsRecursive:` + repeatedStringForSectorsRecursive + `,`, - `XXX_unrecognized:` + fmt.Sprintf("%v", this.XXX_unrecognized) + `,`, - `}`, - }, "") - return s -} -func (this *BlkIOEntry) String() string { - if this == nil { - return "nil" - } - s := strings.Join([]string{`&BlkIOEntry{`, - `Op:` + fmt.Sprintf("%v", this.Op) + `,`, - `Device:` + fmt.Sprintf("%v", this.Device) + `,`, - `Major:` + fmt.Sprintf("%v", this.Major) + `,`, - `Minor:` + fmt.Sprintf("%v", this.Minor) + `,`, - `Value:` + fmt.Sprintf("%v", this.Value) + `,`, - `XXX_unrecognized:` + fmt.Sprintf("%v", this.XXX_unrecognized) + `,`, - `}`, - }, "") - return s -} -func (this *RdmaStat) String() string { - if this == nil { - return "nil" - } - repeatedStringForCurrent := "[]*RdmaEntry{" - for _, f := range this.Current { - repeatedStringForCurrent += strings.Replace(f.String(), "RdmaEntry", "RdmaEntry", 1) + "," - } - repeatedStringForCurrent += "}" - repeatedStringForLimit := "[]*RdmaEntry{" - for _, f := range this.Limit { - repeatedStringForLimit += strings.Replace(f.String(), "RdmaEntry", "RdmaEntry", 1) + "," - } - repeatedStringForLimit += "}" - s := strings.Join([]string{`&RdmaStat{`, - `Current:` + repeatedStringForCurrent + `,`, - `Limit:` + repeatedStringForLimit + `,`, - `XXX_unrecognized:` + fmt.Sprintf("%v", this.XXX_unrecognized) + `,`, - `}`, - }, "") - return s -} -func (this *RdmaEntry) String() string { - if this == nil { - return "nil" - } - s := strings.Join([]string{`&RdmaEntry{`, - `Device:` + fmt.Sprintf("%v", this.Device) + `,`, - `HcaHandles:` + fmt.Sprintf("%v", this.HcaHandles) + `,`, - `HcaObjects:` + fmt.Sprintf("%v", this.HcaObjects) + `,`, - `XXX_unrecognized:` + fmt.Sprintf("%v", this.XXX_unrecognized) + `,`, - `}`, - }, "") - return s -} -func (this *NetworkStat) String() string { - if this == nil { - return "nil" - } - s := strings.Join([]string{`&NetworkStat{`, - `Name:` + fmt.Sprintf("%v", this.Name) + `,`, - `RxBytes:` + fmt.Sprintf("%v", this.RxBytes) + `,`, - `RxPackets:` + fmt.Sprintf("%v", this.RxPackets) + `,`, - `RxErrors:` + fmt.Sprintf("%v", this.RxErrors) + `,`, - `RxDropped:` + fmt.Sprintf("%v", this.RxDropped) + `,`, - `TxBytes:` + fmt.Sprintf("%v", this.TxBytes) + `,`, - `TxPackets:` + fmt.Sprintf("%v", this.TxPackets) + `,`, - `TxErrors:` + fmt.Sprintf("%v", this.TxErrors) + `,`, - `TxDropped:` + fmt.Sprintf("%v", this.TxDropped) + `,`, - `XXX_unrecognized:` + fmt.Sprintf("%v", this.XXX_unrecognized) + `,`, - `}`, - }, "") - return s -} -func (this *CgroupStats) String() string { - if this == nil { - return "nil" - } - s := strings.Join([]string{`&CgroupStats{`, - `NrSleeping:` + fmt.Sprintf("%v", this.NrSleeping) + `,`, - `NrRunning:` + fmt.Sprintf("%v", this.NrRunning) + `,`, - `NrStopped:` + fmt.Sprintf("%v", this.NrStopped) + `,`, - `NrUninterruptible:` + fmt.Sprintf("%v", this.NrUninterruptible) + `,`, - `NrIoWait:` + fmt.Sprintf("%v", this.NrIoWait) + `,`, - `XXX_unrecognized:` + fmt.Sprintf("%v", this.XXX_unrecognized) + `,`, - `}`, - }, "") - return s -} -func valueToStringMetrics(v interface{}) string { - rv := reflect.ValueOf(v) - if rv.IsNil() { - return "nil" - } - pv := reflect.Indirect(rv).Interface() - return fmt.Sprintf("*%v", pv) -} -func (m *Metrics) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowMetrics - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: Metrics: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: Metrics: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Hugetlb", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowMetrics - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthMetrics - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthMetrics - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Hugetlb = append(m.Hugetlb, &HugetlbStat{}) - if err := m.Hugetlb[len(m.Hugetlb)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Pids", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowMetrics - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthMetrics - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthMetrics - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if m.Pids == nil { - m.Pids = &PidsStat{} - } - if err := m.Pids.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 3: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field CPU", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowMetrics - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthMetrics - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthMetrics - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if m.CPU == nil { - m.CPU = &CPUStat{} - } - if err := m.CPU.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 4: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Memory", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowMetrics - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthMetrics - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthMetrics - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if m.Memory == nil { - m.Memory = &MemoryStat{} - } - if err := m.Memory.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 5: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Blkio", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowMetrics - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthMetrics - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthMetrics - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if m.Blkio == nil { - m.Blkio = &BlkIOStat{} - } - if err := m.Blkio.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 6: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Rdma", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowMetrics - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthMetrics - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthMetrics - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if m.Rdma == nil { - m.Rdma = &RdmaStat{} - } - if err := m.Rdma.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 7: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Network", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowMetrics - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthMetrics - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthMetrics - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Network = append(m.Network, &NetworkStat{}) - if err := m.Network[len(m.Network)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 8: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field CgroupStats", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowMetrics - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthMetrics - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthMetrics - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if m.CgroupStats == nil { - m.CgroupStats = &CgroupStats{} - } - if err := m.CgroupStats.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 9: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field MemoryOomControl", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowMetrics - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthMetrics - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthMetrics - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if m.MemoryOomControl == nil { - m.MemoryOomControl = &MemoryOomControl{} - } - if err := m.MemoryOomControl.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipMetrics(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthMetrics - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...) - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *HugetlbStat) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowMetrics - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: HugetlbStat: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: HugetlbStat: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field Usage", wireType) - } - m.Usage = 0 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowMetrics - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - m.Usage |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - case 2: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field Max", wireType) - } - m.Max = 0 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowMetrics - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - m.Max |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - case 3: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field Failcnt", wireType) - } - m.Failcnt = 0 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowMetrics - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - m.Failcnt |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - case 4: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Pagesize", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowMetrics - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLengthMetrics - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthMetrics - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Pagesize = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipMetrics(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthMetrics - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...) - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *PidsStat) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowMetrics - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: PidsStat: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: PidsStat: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field Current", wireType) - } - m.Current = 0 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowMetrics - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - m.Current |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - case 2: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field Limit", wireType) - } - m.Limit = 0 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowMetrics - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - m.Limit |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - default: - iNdEx = preIndex - skippy, err := skipMetrics(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthMetrics - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...) - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *CPUStat) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowMetrics - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: CPUStat: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: CPUStat: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Usage", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowMetrics - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthMetrics - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthMetrics - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if m.Usage == nil { - m.Usage = &CPUUsage{} - } - if err := m.Usage.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Throttling", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowMetrics - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthMetrics - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthMetrics - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if m.Throttling == nil { - m.Throttling = &Throttle{} - } - if err := m.Throttling.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipMetrics(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthMetrics - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...) - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *CPUUsage) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowMetrics - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: CPUUsage: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: CPUUsage: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field Total", wireType) - } - m.Total = 0 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowMetrics - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - m.Total |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - case 2: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field Kernel", wireType) - } - m.Kernel = 0 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowMetrics - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - m.Kernel |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - case 3: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field User", wireType) - } - m.User = 0 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowMetrics - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - m.User |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - case 4: - if wireType == 0 { - var v uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowMetrics - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - v |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - m.PerCPU = append(m.PerCPU, v) - } else if wireType == 2 { - var packedLen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowMetrics - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - packedLen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if packedLen < 0 { - return ErrInvalidLengthMetrics - } - postIndex := iNdEx + packedLen - if postIndex < 0 { - return ErrInvalidLengthMetrics - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - var elementCount int - var count int - for _, integer := range dAtA[iNdEx:postIndex] { - if integer < 128 { - count++ - } - } - elementCount = count - if elementCount != 0 && len(m.PerCPU) == 0 { - m.PerCPU = make([]uint64, 0, elementCount) - } - for iNdEx < postIndex { - var v uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowMetrics - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - v |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - m.PerCPU = append(m.PerCPU, v) - } - } else { - return fmt.Errorf("proto: wrong wireType = %d for field PerCPU", wireType) - } - default: - iNdEx = preIndex - skippy, err := skipMetrics(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthMetrics - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...) - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *Throttle) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowMetrics - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: Throttle: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: Throttle: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field Periods", wireType) - } - m.Periods = 0 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowMetrics - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - m.Periods |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - case 2: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field ThrottledPeriods", wireType) - } - m.ThrottledPeriods = 0 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowMetrics - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - m.ThrottledPeriods |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - case 3: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field ThrottledTime", wireType) - } - m.ThrottledTime = 0 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowMetrics - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - m.ThrottledTime |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - default: - iNdEx = preIndex - skippy, err := skipMetrics(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthMetrics - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...) - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *MemoryStat) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowMetrics - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: MemoryStat: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: MemoryStat: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field Cache", wireType) - } - m.Cache = 0 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowMetrics - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - m.Cache |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - case 2: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field RSS", wireType) - } - m.RSS = 0 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowMetrics - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - m.RSS |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - case 3: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field RSSHuge", wireType) - } - m.RSSHuge = 0 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowMetrics - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - m.RSSHuge |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - case 4: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field MappedFile", wireType) - } - m.MappedFile = 0 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowMetrics - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - m.MappedFile |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - case 5: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field Dirty", wireType) - } - m.Dirty = 0 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowMetrics - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - m.Dirty |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - case 6: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field Writeback", wireType) - } - m.Writeback = 0 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowMetrics - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - m.Writeback |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - case 7: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field PgPgIn", wireType) - } - m.PgPgIn = 0 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowMetrics - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - m.PgPgIn |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - case 8: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field PgPgOut", wireType) - } - m.PgPgOut = 0 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowMetrics - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - m.PgPgOut |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - case 9: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field PgFault", wireType) - } - m.PgFault = 0 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowMetrics - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - m.PgFault |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - case 10: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field PgMajFault", wireType) - } - m.PgMajFault = 0 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowMetrics - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - m.PgMajFault |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - case 11: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field InactiveAnon", wireType) - } - m.InactiveAnon = 0 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowMetrics - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - m.InactiveAnon |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - case 12: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field ActiveAnon", wireType) - } - m.ActiveAnon = 0 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowMetrics - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - m.ActiveAnon |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - case 13: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field InactiveFile", wireType) - } - m.InactiveFile = 0 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowMetrics - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - m.InactiveFile |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - case 14: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field ActiveFile", wireType) - } - m.ActiveFile = 0 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowMetrics - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - m.ActiveFile |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - case 15: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field Unevictable", wireType) - } - m.Unevictable = 0 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowMetrics - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - m.Unevictable |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - case 16: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field HierarchicalMemoryLimit", wireType) - } - m.HierarchicalMemoryLimit = 0 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowMetrics - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - m.HierarchicalMemoryLimit |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - case 17: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field HierarchicalSwapLimit", wireType) - } - m.HierarchicalSwapLimit = 0 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowMetrics - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - m.HierarchicalSwapLimit |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - case 18: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field TotalCache", wireType) - } - m.TotalCache = 0 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowMetrics - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - m.TotalCache |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - case 19: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field TotalRSS", wireType) - } - m.TotalRSS = 0 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowMetrics - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - m.TotalRSS |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - case 20: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field TotalRSSHuge", wireType) - } - m.TotalRSSHuge = 0 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowMetrics - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - m.TotalRSSHuge |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - case 21: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field TotalMappedFile", wireType) - } - m.TotalMappedFile = 0 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowMetrics - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - m.TotalMappedFile |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - case 22: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field TotalDirty", wireType) - } - m.TotalDirty = 0 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowMetrics - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - m.TotalDirty |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - case 23: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field TotalWriteback", wireType) - } - m.TotalWriteback = 0 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowMetrics - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - m.TotalWriteback |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - case 24: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field TotalPgPgIn", wireType) - } - m.TotalPgPgIn = 0 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowMetrics - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - m.TotalPgPgIn |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - case 25: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field TotalPgPgOut", wireType) - } - m.TotalPgPgOut = 0 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowMetrics - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - m.TotalPgPgOut |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - case 26: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field TotalPgFault", wireType) - } - m.TotalPgFault = 0 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowMetrics - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - m.TotalPgFault |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - case 27: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field TotalPgMajFault", wireType) - } - m.TotalPgMajFault = 0 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowMetrics - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - m.TotalPgMajFault |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - case 28: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field TotalInactiveAnon", wireType) - } - m.TotalInactiveAnon = 0 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowMetrics - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - m.TotalInactiveAnon |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - case 29: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field TotalActiveAnon", wireType) - } - m.TotalActiveAnon = 0 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowMetrics - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - m.TotalActiveAnon |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - case 30: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field TotalInactiveFile", wireType) - } - m.TotalInactiveFile = 0 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowMetrics - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - m.TotalInactiveFile |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - case 31: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field TotalActiveFile", wireType) - } - m.TotalActiveFile = 0 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowMetrics - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - m.TotalActiveFile |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - case 32: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field TotalUnevictable", wireType) - } - m.TotalUnevictable = 0 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowMetrics - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - m.TotalUnevictable |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - case 33: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Usage", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowMetrics - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthMetrics - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthMetrics - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if m.Usage == nil { - m.Usage = &MemoryEntry{} - } - if err := m.Usage.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 34: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Swap", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowMetrics - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthMetrics - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthMetrics - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if m.Swap == nil { - m.Swap = &MemoryEntry{} - } - if err := m.Swap.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 35: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Kernel", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowMetrics - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthMetrics - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthMetrics - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if m.Kernel == nil { - m.Kernel = &MemoryEntry{} - } - if err := m.Kernel.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 36: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field KernelTCP", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowMetrics - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthMetrics - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthMetrics - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if m.KernelTCP == nil { - m.KernelTCP = &MemoryEntry{} - } - if err := m.KernelTCP.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipMetrics(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthMetrics - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...) - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *MemoryEntry) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowMetrics - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: MemoryEntry: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: MemoryEntry: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field Limit", wireType) - } - m.Limit = 0 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowMetrics - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - m.Limit |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - case 2: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field Usage", wireType) - } - m.Usage = 0 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowMetrics - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - m.Usage |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - case 3: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field Max", wireType) - } - m.Max = 0 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowMetrics - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - m.Max |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - case 4: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field Failcnt", wireType) - } - m.Failcnt = 0 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowMetrics - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - m.Failcnt |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - default: - iNdEx = preIndex - skippy, err := skipMetrics(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthMetrics - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...) - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *MemoryOomControl) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowMetrics - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: MemoryOomControl: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: MemoryOomControl: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field OomKillDisable", wireType) - } - m.OomKillDisable = 0 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowMetrics - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - m.OomKillDisable |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - case 2: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field UnderOom", wireType) - } - m.UnderOom = 0 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowMetrics - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - m.UnderOom |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - case 3: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field OomKill", wireType) - } - m.OomKill = 0 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowMetrics - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - m.OomKill |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - default: - iNdEx = preIndex - skippy, err := skipMetrics(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthMetrics - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...) - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *BlkIOStat) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowMetrics - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: BlkIOStat: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: BlkIOStat: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field IoServiceBytesRecursive", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowMetrics - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthMetrics - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthMetrics - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.IoServiceBytesRecursive = append(m.IoServiceBytesRecursive, &BlkIOEntry{}) - if err := m.IoServiceBytesRecursive[len(m.IoServiceBytesRecursive)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field IoServicedRecursive", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowMetrics - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthMetrics - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthMetrics - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.IoServicedRecursive = append(m.IoServicedRecursive, &BlkIOEntry{}) - if err := m.IoServicedRecursive[len(m.IoServicedRecursive)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 3: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field IoQueuedRecursive", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowMetrics - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthMetrics - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthMetrics - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.IoQueuedRecursive = append(m.IoQueuedRecursive, &BlkIOEntry{}) - if err := m.IoQueuedRecursive[len(m.IoQueuedRecursive)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 4: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field IoServiceTimeRecursive", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowMetrics - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthMetrics - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthMetrics - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.IoServiceTimeRecursive = append(m.IoServiceTimeRecursive, &BlkIOEntry{}) - if err := m.IoServiceTimeRecursive[len(m.IoServiceTimeRecursive)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 5: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field IoWaitTimeRecursive", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowMetrics - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthMetrics - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthMetrics - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.IoWaitTimeRecursive = append(m.IoWaitTimeRecursive, &BlkIOEntry{}) - if err := m.IoWaitTimeRecursive[len(m.IoWaitTimeRecursive)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 6: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field IoMergedRecursive", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowMetrics - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthMetrics - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthMetrics - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.IoMergedRecursive = append(m.IoMergedRecursive, &BlkIOEntry{}) - if err := m.IoMergedRecursive[len(m.IoMergedRecursive)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 7: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field IoTimeRecursive", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowMetrics - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthMetrics - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthMetrics - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.IoTimeRecursive = append(m.IoTimeRecursive, &BlkIOEntry{}) - if err := m.IoTimeRecursive[len(m.IoTimeRecursive)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 8: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field SectorsRecursive", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowMetrics - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthMetrics - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthMetrics - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.SectorsRecursive = append(m.SectorsRecursive, &BlkIOEntry{}) - if err := m.SectorsRecursive[len(m.SectorsRecursive)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipMetrics(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthMetrics - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...) - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *BlkIOEntry) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowMetrics - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: BlkIOEntry: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: BlkIOEntry: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Op", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowMetrics - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLengthMetrics - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthMetrics - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Op = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Device", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowMetrics - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLengthMetrics - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthMetrics - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Device = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 3: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field Major", wireType) - } - m.Major = 0 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowMetrics - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - m.Major |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - case 4: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field Minor", wireType) - } - m.Minor = 0 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowMetrics - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - m.Minor |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - case 5: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field Value", wireType) - } - m.Value = 0 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowMetrics - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - m.Value |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - default: - iNdEx = preIndex - skippy, err := skipMetrics(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthMetrics - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...) - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *RdmaStat) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowMetrics - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: RdmaStat: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: RdmaStat: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Current", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowMetrics - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthMetrics - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthMetrics - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Current = append(m.Current, &RdmaEntry{}) - if err := m.Current[len(m.Current)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Limit", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowMetrics - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthMetrics - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthMetrics - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Limit = append(m.Limit, &RdmaEntry{}) - if err := m.Limit[len(m.Limit)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipMetrics(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthMetrics - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...) - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *RdmaEntry) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowMetrics - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: RdmaEntry: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: RdmaEntry: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Device", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowMetrics - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLengthMetrics - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthMetrics - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Device = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 2: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field HcaHandles", wireType) - } - m.HcaHandles = 0 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowMetrics - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - m.HcaHandles |= uint32(b&0x7F) << shift - if b < 0x80 { - break - } - } - case 3: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field HcaObjects", wireType) - } - m.HcaObjects = 0 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowMetrics - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - m.HcaObjects |= uint32(b&0x7F) << shift - if b < 0x80 { - break - } - } - default: - iNdEx = preIndex - skippy, err := skipMetrics(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthMetrics - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...) - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *NetworkStat) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowMetrics - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: NetworkStat: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: NetworkStat: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Name", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowMetrics - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLengthMetrics - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthMetrics - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Name = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 2: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field RxBytes", wireType) - } - m.RxBytes = 0 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowMetrics - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - m.RxBytes |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - case 3: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field RxPackets", wireType) - } - m.RxPackets = 0 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowMetrics - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - m.RxPackets |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - case 4: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field RxErrors", wireType) - } - m.RxErrors = 0 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowMetrics - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - m.RxErrors |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - case 5: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field RxDropped", wireType) - } - m.RxDropped = 0 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowMetrics - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - m.RxDropped |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - case 6: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field TxBytes", wireType) - } - m.TxBytes = 0 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowMetrics - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - m.TxBytes |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - case 7: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field TxPackets", wireType) - } - m.TxPackets = 0 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowMetrics - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - m.TxPackets |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - case 8: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field TxErrors", wireType) - } - m.TxErrors = 0 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowMetrics - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - m.TxErrors |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - case 9: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field TxDropped", wireType) - } - m.TxDropped = 0 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowMetrics - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - m.TxDropped |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - default: - iNdEx = preIndex - skippy, err := skipMetrics(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthMetrics - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...) - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *CgroupStats) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowMetrics - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: CgroupStats: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: CgroupStats: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field NrSleeping", wireType) - } - m.NrSleeping = 0 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowMetrics - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - m.NrSleeping |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - case 2: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field NrRunning", wireType) - } - m.NrRunning = 0 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowMetrics - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - m.NrRunning |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - case 3: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field NrStopped", wireType) - } - m.NrStopped = 0 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowMetrics - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - m.NrStopped |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - case 4: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field NrUninterruptible", wireType) - } - m.NrUninterruptible = 0 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowMetrics - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - m.NrUninterruptible |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - case 5: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field NrIoWait", wireType) - } - m.NrIoWait = 0 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowMetrics - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - m.NrIoWait |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - default: - iNdEx = preIndex - skippy, err := skipMetrics(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthMetrics - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...) - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func skipMetrics(dAtA []byte) (n int, err error) { - l := len(dAtA) - iNdEx := 0 - depth := 0 - for iNdEx < l { - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return 0, ErrIntOverflowMetrics - } - if iNdEx >= l { - return 0, io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= (uint64(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - wireType := int(wire & 0x7) - switch wireType { - case 0: - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return 0, ErrIntOverflowMetrics - } - if iNdEx >= l { - return 0, io.ErrUnexpectedEOF - } - iNdEx++ - if dAtA[iNdEx-1] < 0x80 { - break - } - } - case 1: - iNdEx += 8 - case 2: - var length int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return 0, ErrIntOverflowMetrics - } - if iNdEx >= l { - return 0, io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - length |= (int(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - if length < 0 { - return 0, ErrInvalidLengthMetrics - } - iNdEx += length - case 3: - depth++ - case 4: - if depth == 0 { - return 0, ErrUnexpectedEndOfGroupMetrics - } - depth-- - case 5: - iNdEx += 4 - default: - return 0, fmt.Errorf("proto: illegal wireType %d", wireType) - } - if iNdEx < 0 { - return 0, ErrInvalidLengthMetrics - } - if depth == 0 { - return iNdEx, nil - } - } - return 0, io.ErrUnexpectedEOF -} - -var ( - ErrInvalidLengthMetrics = fmt.Errorf("proto: negative length found during unmarshaling") - ErrIntOverflowMetrics = fmt.Errorf("proto: integer overflow") - ErrUnexpectedEndOfGroupMetrics = fmt.Errorf("proto: unexpected end of group") -) diff --git a/vendor/github.com/containerd/cgroups/stats/v1/metrics.pb.txt b/vendor/github.com/containerd/cgroups/stats/v1/metrics.pb.txt deleted file mode 100644 index e476cea641..0000000000 --- a/vendor/github.com/containerd/cgroups/stats/v1/metrics.pb.txt +++ /dev/null @@ -1,790 +0,0 @@ -file { - name: "github.com/containerd/cgroups/stats/v1/metrics.proto" - package: "io.containerd.cgroups.v1" - dependency: "gogoproto/gogo.proto" - message_type { - name: "Metrics" - field { - name: "hugetlb" - number: 1 - label: LABEL_REPEATED - type: TYPE_MESSAGE - type_name: ".io.containerd.cgroups.v1.HugetlbStat" - json_name: "hugetlb" - } - field { - name: "pids" - number: 2 - label: LABEL_OPTIONAL - type: TYPE_MESSAGE - type_name: ".io.containerd.cgroups.v1.PidsStat" - json_name: "pids" - } - field { - name: "cpu" - number: 3 - label: LABEL_OPTIONAL - type: TYPE_MESSAGE - type_name: ".io.containerd.cgroups.v1.CPUStat" - options { - 65004: "CPU" - } - json_name: "cpu" - } - field { - name: "memory" - number: 4 - label: LABEL_OPTIONAL - type: TYPE_MESSAGE - type_name: ".io.containerd.cgroups.v1.MemoryStat" - json_name: "memory" - } - field { - name: "blkio" - number: 5 - label: LABEL_OPTIONAL - type: TYPE_MESSAGE - type_name: ".io.containerd.cgroups.v1.BlkIOStat" - json_name: "blkio" - } - field { - name: "rdma" - number: 6 - label: LABEL_OPTIONAL - type: TYPE_MESSAGE - type_name: ".io.containerd.cgroups.v1.RdmaStat" - json_name: "rdma" - } - field { - name: "network" - number: 7 - label: LABEL_REPEATED - type: TYPE_MESSAGE - type_name: ".io.containerd.cgroups.v1.NetworkStat" - json_name: "network" - } - field { - name: "cgroup_stats" - number: 8 - label: LABEL_OPTIONAL - type: TYPE_MESSAGE - type_name: ".io.containerd.cgroups.v1.CgroupStats" - json_name: "cgroupStats" - } - field { - name: "memory_oom_control" - number: 9 - label: LABEL_OPTIONAL - type: TYPE_MESSAGE - type_name: ".io.containerd.cgroups.v1.MemoryOomControl" - json_name: "memoryOomControl" - } - } - message_type { - name: "HugetlbStat" - field { - name: "usage" - number: 1 - label: LABEL_OPTIONAL - type: TYPE_UINT64 - json_name: "usage" - } - field { - name: "max" - number: 2 - label: LABEL_OPTIONAL - type: TYPE_UINT64 - json_name: "max" - } - field { - name: "failcnt" - number: 3 - label: LABEL_OPTIONAL - type: TYPE_UINT64 - json_name: "failcnt" - } - field { - name: "pagesize" - number: 4 - label: LABEL_OPTIONAL - type: TYPE_STRING - json_name: "pagesize" - } - } - message_type { - name: "PidsStat" - field { - name: "current" - number: 1 - label: LABEL_OPTIONAL - type: TYPE_UINT64 - json_name: "current" - } - field { - name: "limit" - number: 2 - label: LABEL_OPTIONAL - type: TYPE_UINT64 - json_name: "limit" - } - } - message_type { - name: "CPUStat" - field { - name: "usage" - number: 1 - label: LABEL_OPTIONAL - type: TYPE_MESSAGE - type_name: ".io.containerd.cgroups.v1.CPUUsage" - json_name: "usage" - } - field { - name: "throttling" - number: 2 - label: LABEL_OPTIONAL - type: TYPE_MESSAGE - type_name: ".io.containerd.cgroups.v1.Throttle" - json_name: "throttling" - } - } - message_type { - name: "CPUUsage" - field { - name: "total" - number: 1 - label: LABEL_OPTIONAL - type: TYPE_UINT64 - json_name: "total" - } - field { - name: "kernel" - number: 2 - label: LABEL_OPTIONAL - type: TYPE_UINT64 - json_name: "kernel" - } - field { - name: "user" - number: 3 - label: LABEL_OPTIONAL - type: TYPE_UINT64 - json_name: "user" - } - field { - name: "per_cpu" - number: 4 - label: LABEL_REPEATED - type: TYPE_UINT64 - options { - 65004: "PerCPU" - } - json_name: "perCpu" - } - } - message_type { - name: "Throttle" - field { - name: "periods" - number: 1 - label: LABEL_OPTIONAL - type: TYPE_UINT64 - json_name: "periods" - } - field { - name: "throttled_periods" - number: 2 - label: LABEL_OPTIONAL - type: TYPE_UINT64 - json_name: "throttledPeriods" - } - field { - name: "throttled_time" - number: 3 - label: LABEL_OPTIONAL - type: TYPE_UINT64 - json_name: "throttledTime" - } - } - message_type { - name: "MemoryStat" - field { - name: "cache" - number: 1 - label: LABEL_OPTIONAL - type: TYPE_UINT64 - json_name: "cache" - } - field { - name: "rss" - number: 2 - label: LABEL_OPTIONAL - type: TYPE_UINT64 - options { - 65004: "RSS" - } - json_name: "rss" - } - field { - name: "rss_huge" - number: 3 - label: LABEL_OPTIONAL - type: TYPE_UINT64 - options { - 65004: "RSSHuge" - } - json_name: "rssHuge" - } - field { - name: "mapped_file" - number: 4 - label: LABEL_OPTIONAL - type: TYPE_UINT64 - json_name: "mappedFile" - } - field { - name: "dirty" - number: 5 - label: LABEL_OPTIONAL - type: TYPE_UINT64 - json_name: "dirty" - } - field { - name: "writeback" - number: 6 - label: LABEL_OPTIONAL - type: TYPE_UINT64 - json_name: "writeback" - } - field { - name: "pg_pg_in" - number: 7 - label: LABEL_OPTIONAL - type: TYPE_UINT64 - json_name: "pgPgIn" - } - field { - name: "pg_pg_out" - number: 8 - label: LABEL_OPTIONAL - type: TYPE_UINT64 - json_name: "pgPgOut" - } - field { - name: "pg_fault" - number: 9 - label: LABEL_OPTIONAL - type: TYPE_UINT64 - json_name: "pgFault" - } - field { - name: "pg_maj_fault" - number: 10 - label: LABEL_OPTIONAL - type: TYPE_UINT64 - json_name: "pgMajFault" - } - field { - name: "inactive_anon" - number: 11 - label: LABEL_OPTIONAL - type: TYPE_UINT64 - json_name: "inactiveAnon" - } - field { - name: "active_anon" - number: 12 - label: LABEL_OPTIONAL - type: TYPE_UINT64 - json_name: "activeAnon" - } - field { - name: "inactive_file" - number: 13 - label: LABEL_OPTIONAL - type: TYPE_UINT64 - json_name: "inactiveFile" - } - field { - name: "active_file" - number: 14 - label: LABEL_OPTIONAL - type: TYPE_UINT64 - json_name: "activeFile" - } - field { - name: "unevictable" - number: 15 - label: LABEL_OPTIONAL - type: TYPE_UINT64 - json_name: "unevictable" - } - field { - name: "hierarchical_memory_limit" - number: 16 - label: LABEL_OPTIONAL - type: TYPE_UINT64 - json_name: "hierarchicalMemoryLimit" - } - field { - name: "hierarchical_swap_limit" - number: 17 - label: LABEL_OPTIONAL - type: TYPE_UINT64 - json_name: "hierarchicalSwapLimit" - } - field { - name: "total_cache" - number: 18 - label: LABEL_OPTIONAL - type: TYPE_UINT64 - json_name: "totalCache" - } - field { - name: "total_rss" - number: 19 - label: LABEL_OPTIONAL - type: TYPE_UINT64 - options { - 65004: "TotalRSS" - } - json_name: "totalRss" - } - field { - name: "total_rss_huge" - number: 20 - label: LABEL_OPTIONAL - type: TYPE_UINT64 - options { - 65004: "TotalRSSHuge" - } - json_name: "totalRssHuge" - } - field { - name: "total_mapped_file" - number: 21 - label: LABEL_OPTIONAL - type: TYPE_UINT64 - json_name: "totalMappedFile" - } - field { - name: "total_dirty" - number: 22 - label: LABEL_OPTIONAL - type: TYPE_UINT64 - json_name: "totalDirty" - } - field { - name: "total_writeback" - number: 23 - label: LABEL_OPTIONAL - type: TYPE_UINT64 - json_name: "totalWriteback" - } - field { - name: "total_pg_pg_in" - number: 24 - label: LABEL_OPTIONAL - type: TYPE_UINT64 - json_name: "totalPgPgIn" - } - field { - name: "total_pg_pg_out" - number: 25 - label: LABEL_OPTIONAL - type: TYPE_UINT64 - json_name: "totalPgPgOut" - } - field { - name: "total_pg_fault" - number: 26 - label: LABEL_OPTIONAL - type: TYPE_UINT64 - json_name: "totalPgFault" - } - field { - name: "total_pg_maj_fault" - number: 27 - label: LABEL_OPTIONAL - type: TYPE_UINT64 - json_name: "totalPgMajFault" - } - field { - name: "total_inactive_anon" - number: 28 - label: LABEL_OPTIONAL - type: TYPE_UINT64 - json_name: "totalInactiveAnon" - } - field { - name: "total_active_anon" - number: 29 - label: LABEL_OPTIONAL - type: TYPE_UINT64 - json_name: "totalActiveAnon" - } - field { - name: "total_inactive_file" - number: 30 - label: LABEL_OPTIONAL - type: TYPE_UINT64 - json_name: "totalInactiveFile" - } - field { - name: "total_active_file" - number: 31 - label: LABEL_OPTIONAL - type: TYPE_UINT64 - json_name: "totalActiveFile" - } - field { - name: "total_unevictable" - number: 32 - label: LABEL_OPTIONAL - type: TYPE_UINT64 - json_name: "totalUnevictable" - } - field { - name: "usage" - number: 33 - label: LABEL_OPTIONAL - type: TYPE_MESSAGE - type_name: ".io.containerd.cgroups.v1.MemoryEntry" - json_name: "usage" - } - field { - name: "swap" - number: 34 - label: LABEL_OPTIONAL - type: TYPE_MESSAGE - type_name: ".io.containerd.cgroups.v1.MemoryEntry" - json_name: "swap" - } - field { - name: "kernel" - number: 35 - label: LABEL_OPTIONAL - type: TYPE_MESSAGE - type_name: ".io.containerd.cgroups.v1.MemoryEntry" - json_name: "kernel" - } - field { - name: "kernel_tcp" - number: 36 - label: LABEL_OPTIONAL - type: TYPE_MESSAGE - type_name: ".io.containerd.cgroups.v1.MemoryEntry" - options { - 65004: "KernelTCP" - } - json_name: "kernelTcp" - } - } - message_type { - name: "MemoryEntry" - field { - name: "limit" - number: 1 - label: LABEL_OPTIONAL - type: TYPE_UINT64 - json_name: "limit" - } - field { - name: "usage" - number: 2 - label: LABEL_OPTIONAL - type: TYPE_UINT64 - json_name: "usage" - } - field { - name: "max" - number: 3 - label: LABEL_OPTIONAL - type: TYPE_UINT64 - json_name: "max" - } - field { - name: "failcnt" - number: 4 - label: LABEL_OPTIONAL - type: TYPE_UINT64 - json_name: "failcnt" - } - } - message_type { - name: "MemoryOomControl" - field { - name: "oom_kill_disable" - number: 1 - label: LABEL_OPTIONAL - type: TYPE_UINT64 - json_name: "oomKillDisable" - } - field { - name: "under_oom" - number: 2 - label: LABEL_OPTIONAL - type: TYPE_UINT64 - json_name: "underOom" - } - field { - name: "oom_kill" - number: 3 - label: LABEL_OPTIONAL - type: TYPE_UINT64 - json_name: "oomKill" - } - } - message_type { - name: "BlkIOStat" - field { - name: "io_service_bytes_recursive" - number: 1 - label: LABEL_REPEATED - type: TYPE_MESSAGE - type_name: ".io.containerd.cgroups.v1.BlkIOEntry" - json_name: "ioServiceBytesRecursive" - } - field { - name: "io_serviced_recursive" - number: 2 - label: LABEL_REPEATED - type: TYPE_MESSAGE - type_name: ".io.containerd.cgroups.v1.BlkIOEntry" - json_name: "ioServicedRecursive" - } - field { - name: "io_queued_recursive" - number: 3 - label: LABEL_REPEATED - type: TYPE_MESSAGE - type_name: ".io.containerd.cgroups.v1.BlkIOEntry" - json_name: "ioQueuedRecursive" - } - field { - name: "io_service_time_recursive" - number: 4 - label: LABEL_REPEATED - type: TYPE_MESSAGE - type_name: ".io.containerd.cgroups.v1.BlkIOEntry" - json_name: "ioServiceTimeRecursive" - } - field { - name: "io_wait_time_recursive" - number: 5 - label: LABEL_REPEATED - type: TYPE_MESSAGE - type_name: ".io.containerd.cgroups.v1.BlkIOEntry" - json_name: "ioWaitTimeRecursive" - } - field { - name: "io_merged_recursive" - number: 6 - label: LABEL_REPEATED - type: TYPE_MESSAGE - type_name: ".io.containerd.cgroups.v1.BlkIOEntry" - json_name: "ioMergedRecursive" - } - field { - name: "io_time_recursive" - number: 7 - label: LABEL_REPEATED - type: TYPE_MESSAGE - type_name: ".io.containerd.cgroups.v1.BlkIOEntry" - json_name: "ioTimeRecursive" - } - field { - name: "sectors_recursive" - number: 8 - label: LABEL_REPEATED - type: TYPE_MESSAGE - type_name: ".io.containerd.cgroups.v1.BlkIOEntry" - json_name: "sectorsRecursive" - } - } - message_type { - name: "BlkIOEntry" - field { - name: "op" - number: 1 - label: LABEL_OPTIONAL - type: TYPE_STRING - json_name: "op" - } - field { - name: "device" - number: 2 - label: LABEL_OPTIONAL - type: TYPE_STRING - json_name: "device" - } - field { - name: "major" - number: 3 - label: LABEL_OPTIONAL - type: TYPE_UINT64 - json_name: "major" - } - field { - name: "minor" - number: 4 - label: LABEL_OPTIONAL - type: TYPE_UINT64 - json_name: "minor" - } - field { - name: "value" - number: 5 - label: LABEL_OPTIONAL - type: TYPE_UINT64 - json_name: "value" - } - } - message_type { - name: "RdmaStat" - field { - name: "current" - number: 1 - label: LABEL_REPEATED - type: TYPE_MESSAGE - type_name: ".io.containerd.cgroups.v1.RdmaEntry" - json_name: "current" - } - field { - name: "limit" - number: 2 - label: LABEL_REPEATED - type: TYPE_MESSAGE - type_name: ".io.containerd.cgroups.v1.RdmaEntry" - json_name: "limit" - } - } - message_type { - name: "RdmaEntry" - field { - name: "device" - number: 1 - label: LABEL_OPTIONAL - type: TYPE_STRING - json_name: "device" - } - field { - name: "hca_handles" - number: 2 - label: LABEL_OPTIONAL - type: TYPE_UINT32 - json_name: "hcaHandles" - } - field { - name: "hca_objects" - number: 3 - label: LABEL_OPTIONAL - type: TYPE_UINT32 - json_name: "hcaObjects" - } - } - message_type { - name: "NetworkStat" - field { - name: "name" - number: 1 - label: LABEL_OPTIONAL - type: TYPE_STRING - json_name: "name" - } - field { - name: "rx_bytes" - number: 2 - label: LABEL_OPTIONAL - type: TYPE_UINT64 - json_name: "rxBytes" - } - field { - name: "rx_packets" - number: 3 - label: LABEL_OPTIONAL - type: TYPE_UINT64 - json_name: "rxPackets" - } - field { - name: "rx_errors" - number: 4 - label: LABEL_OPTIONAL - type: TYPE_UINT64 - json_name: "rxErrors" - } - field { - name: "rx_dropped" - number: 5 - label: LABEL_OPTIONAL - type: TYPE_UINT64 - json_name: "rxDropped" - } - field { - name: "tx_bytes" - number: 6 - label: LABEL_OPTIONAL - type: TYPE_UINT64 - json_name: "txBytes" - } - field { - name: "tx_packets" - number: 7 - label: LABEL_OPTIONAL - type: TYPE_UINT64 - json_name: "txPackets" - } - field { - name: "tx_errors" - number: 8 - label: LABEL_OPTIONAL - type: TYPE_UINT64 - json_name: "txErrors" - } - field { - name: "tx_dropped" - number: 9 - label: LABEL_OPTIONAL - type: TYPE_UINT64 - json_name: "txDropped" - } - } - message_type { - name: "CgroupStats" - field { - name: "nr_sleeping" - number: 1 - label: LABEL_OPTIONAL - type: TYPE_UINT64 - json_name: "nrSleeping" - } - field { - name: "nr_running" - number: 2 - label: LABEL_OPTIONAL - type: TYPE_UINT64 - json_name: "nrRunning" - } - field { - name: "nr_stopped" - number: 3 - label: LABEL_OPTIONAL - type: TYPE_UINT64 - json_name: "nrStopped" - } - field { - name: "nr_uninterruptible" - number: 4 - label: LABEL_OPTIONAL - type: TYPE_UINT64 - json_name: "nrUninterruptible" - } - field { - name: "nr_io_wait" - number: 5 - label: LABEL_OPTIONAL - type: TYPE_UINT64 - json_name: "nrIoWait" - } - } - syntax: "proto3" -} diff --git a/vendor/github.com/containerd/cgroups/stats/v1/metrics.proto b/vendor/github.com/containerd/cgroups/stats/v1/metrics.proto deleted file mode 100644 index b3f6cc37d8..0000000000 --- a/vendor/github.com/containerd/cgroups/stats/v1/metrics.proto +++ /dev/null @@ -1,158 +0,0 @@ -syntax = "proto3"; - -package io.containerd.cgroups.v1; - -import "gogoproto/gogo.proto"; - -message Metrics { - repeated HugetlbStat hugetlb = 1; - PidsStat pids = 2; - CPUStat cpu = 3 [(gogoproto.customname) = "CPU"]; - MemoryStat memory = 4; - BlkIOStat blkio = 5; - RdmaStat rdma = 6; - repeated NetworkStat network = 7; - CgroupStats cgroup_stats = 8; - MemoryOomControl memory_oom_control = 9; -} - -message HugetlbStat { - uint64 usage = 1; - uint64 max = 2; - uint64 failcnt = 3; - string pagesize = 4; -} - -message PidsStat { - uint64 current = 1; - uint64 limit = 2; -} - -message CPUStat { - CPUUsage usage = 1; - Throttle throttling = 2; -} - -message CPUUsage { - // values in nanoseconds - uint64 total = 1; - uint64 kernel = 2; - uint64 user = 3; - repeated uint64 per_cpu = 4 [(gogoproto.customname) = "PerCPU"]; - -} - -message Throttle { - uint64 periods = 1; - uint64 throttled_periods = 2; - uint64 throttled_time = 3; -} - -message MemoryStat { - uint64 cache = 1; - uint64 rss = 2 [(gogoproto.customname) = "RSS"]; - uint64 rss_huge = 3 [(gogoproto.customname) = "RSSHuge"]; - uint64 mapped_file = 4; - uint64 dirty = 5; - uint64 writeback = 6; - uint64 pg_pg_in = 7; - uint64 pg_pg_out = 8; - uint64 pg_fault = 9; - uint64 pg_maj_fault = 10; - uint64 inactive_anon = 11; - uint64 active_anon = 12; - uint64 inactive_file = 13; - uint64 active_file = 14; - uint64 unevictable = 15; - uint64 hierarchical_memory_limit = 16; - uint64 hierarchical_swap_limit = 17; - uint64 total_cache = 18; - uint64 total_rss = 19 [(gogoproto.customname) = "TotalRSS"]; - uint64 total_rss_huge = 20 [(gogoproto.customname) = "TotalRSSHuge"]; - uint64 total_mapped_file = 21; - uint64 total_dirty = 22; - uint64 total_writeback = 23; - uint64 total_pg_pg_in = 24; - uint64 total_pg_pg_out = 25; - uint64 total_pg_fault = 26; - uint64 total_pg_maj_fault = 27; - uint64 total_inactive_anon = 28; - uint64 total_active_anon = 29; - uint64 total_inactive_file = 30; - uint64 total_active_file = 31; - uint64 total_unevictable = 32; - MemoryEntry usage = 33; - MemoryEntry swap = 34; - MemoryEntry kernel = 35; - MemoryEntry kernel_tcp = 36 [(gogoproto.customname) = "KernelTCP"]; - -} - -message MemoryEntry { - uint64 limit = 1; - uint64 usage = 2; - uint64 max = 3; - uint64 failcnt = 4; -} - -message MemoryOomControl { - uint64 oom_kill_disable = 1; - uint64 under_oom = 2; - uint64 oom_kill = 3; -} - -message BlkIOStat { - repeated BlkIOEntry io_service_bytes_recursive = 1; - repeated BlkIOEntry io_serviced_recursive = 2; - repeated BlkIOEntry io_queued_recursive = 3; - repeated BlkIOEntry io_service_time_recursive = 4; - repeated BlkIOEntry io_wait_time_recursive = 5; - repeated BlkIOEntry io_merged_recursive = 6; - repeated BlkIOEntry io_time_recursive = 7; - repeated BlkIOEntry sectors_recursive = 8; -} - -message BlkIOEntry { - string op = 1; - string device = 2; - uint64 major = 3; - uint64 minor = 4; - uint64 value = 5; -} - -message RdmaStat { - repeated RdmaEntry current = 1; - repeated RdmaEntry limit = 2; -} - -message RdmaEntry { - string device = 1; - uint32 hca_handles = 2; - uint32 hca_objects = 3; -} - -message NetworkStat { - string name = 1; - uint64 rx_bytes = 2; - uint64 rx_packets = 3; - uint64 rx_errors = 4; - uint64 rx_dropped = 5; - uint64 tx_bytes = 6; - uint64 tx_packets = 7; - uint64 tx_errors = 8; - uint64 tx_dropped = 9; -} - -// CgroupStats exports per-cgroup statistics. -message CgroupStats { - // number of tasks sleeping - uint64 nr_sleeping = 1; - // number of tasks running - uint64 nr_running = 2; - // number of tasks in stopped state - uint64 nr_stopped = 3; - // number of tasks in uninterruptible state - uint64 nr_uninterruptible = 4; - // number of tasks waiting on IO - uint64 nr_io_wait = 5; -} diff --git a/vendor/github.com/containerd/cgroups/subsystem.go b/vendor/github.com/containerd/cgroups/subsystem.go deleted file mode 100644 index b2f41854d2..0000000000 --- a/vendor/github.com/containerd/cgroups/subsystem.go +++ /dev/null @@ -1,116 +0,0 @@ -/* - Copyright The containerd Authors. - - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. -*/ - -package cgroups - -import ( - "fmt" - "os" - - v1 "github.com/containerd/cgroups/stats/v1" - specs "github.com/opencontainers/runtime-spec/specs-go" -) - -// Name is a typed name for a cgroup subsystem -type Name string - -const ( - Devices Name = "devices" - Hugetlb Name = "hugetlb" - Freezer Name = "freezer" - Pids Name = "pids" - NetCLS Name = "net_cls" - NetPrio Name = "net_prio" - PerfEvent Name = "perf_event" - Cpuset Name = "cpuset" - Cpu Name = "cpu" - Cpuacct Name = "cpuacct" - Memory Name = "memory" - Blkio Name = "blkio" - Rdma Name = "rdma" -) - -// Subsystems returns a complete list of the default cgroups -// available on most linux systems -func Subsystems() []Name { - n := []Name{ - Freezer, - Pids, - NetCLS, - NetPrio, - PerfEvent, - Cpuset, - Cpu, - Cpuacct, - Memory, - Blkio, - Rdma, - } - if !RunningInUserNS() { - n = append(n, Devices) - } - if _, err := os.Stat("/sys/kernel/mm/hugepages"); err == nil { - n = append(n, Hugetlb) - } - return n -} - -type Subsystem interface { - Name() Name -} - -type pather interface { - Subsystem - Path(path string) string -} - -type creator interface { - Subsystem - Create(path string, resources *specs.LinuxResources) error -} - -type deleter interface { - Subsystem - Delete(path string) error -} - -type stater interface { - Subsystem - Stat(path string, stats *v1.Metrics) error -} - -type updater interface { - Subsystem - Update(path string, resources *specs.LinuxResources) error -} - -// SingleSubsystem returns a single cgroup subsystem within the base Hierarchy -func SingleSubsystem(baseHierarchy Hierarchy, subsystem Name) Hierarchy { - return func() ([]Subsystem, error) { - subsystems, err := baseHierarchy() - if err != nil { - return nil, err - } - for _, s := range subsystems { - if s.Name() == subsystem { - return []Subsystem{ - s, - }, nil - } - } - return nil, fmt.Errorf("unable to find subsystem %s", subsystem) - } -} diff --git a/vendor/github.com/containerd/cgroups/systemd.go b/vendor/github.com/containerd/cgroups/systemd.go deleted file mode 100644 index 4da57cb4b0..0000000000 --- a/vendor/github.com/containerd/cgroups/systemd.go +++ /dev/null @@ -1,158 +0,0 @@ -/* - Copyright The containerd Authors. - - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. -*/ - -package cgroups - -import ( - "context" - "path/filepath" - "strings" - "sync" - - systemdDbus "github.com/coreos/go-systemd/v22/dbus" - "github.com/godbus/dbus/v5" - specs "github.com/opencontainers/runtime-spec/specs-go" -) - -const ( - SystemdDbus Name = "systemd" - defaultSlice = "system.slice" -) - -var ( - canDelegate bool - once sync.Once -) - -func Systemd() ([]Subsystem, error) { - root, err := v1MountPoint() - if err != nil { - return nil, err - } - defaultSubsystems, err := defaults(root) - if err != nil { - return nil, err - } - s, err := NewSystemd(root) - if err != nil { - return nil, err - } - // make sure the systemd controller is added first - return append([]Subsystem{s}, defaultSubsystems...), nil -} - -func Slice(slice, name string) Path { - if slice == "" { - slice = defaultSlice - } - return func(subsystem Name) (string, error) { - return filepath.Join(slice, name), nil - } -} - -func NewSystemd(root string) (*SystemdController, error) { - return &SystemdController{ - root: root, - }, nil -} - -type SystemdController struct { - mu sync.Mutex - root string -} - -func (s *SystemdController) Name() Name { - return SystemdDbus -} - -func (s *SystemdController) Create(path string, _ *specs.LinuxResources) error { - ctx := context.TODO() - conn, err := systemdDbus.NewWithContext(ctx) - if err != nil { - return err - } - defer conn.Close() - slice, name := splitName(path) - // We need to see if systemd can handle the delegate property - // Systemd will return an error if it cannot handle delegate regardless - // of its bool setting. - checkDelegate := func() { - canDelegate = true - dlSlice := newProperty("Delegate", true) - if _, err := conn.StartTransientUnitContext(ctx, slice, "testdelegate", []systemdDbus.Property{dlSlice}, nil); err != nil { - if dbusError, ok := err.(dbus.Error); ok { - // Starting with systemd v237, Delegate is not even a property of slices anymore, - // so the D-Bus call fails with "InvalidArgs" error. - if strings.Contains(dbusError.Name, "org.freedesktop.DBus.Error.PropertyReadOnly") || strings.Contains(dbusError.Name, "org.freedesktop.DBus.Error.InvalidArgs") { - canDelegate = false - } - } - } - - _, _ = conn.StopUnitContext(ctx, slice, "testDelegate", nil) - } - once.Do(checkDelegate) - properties := []systemdDbus.Property{ - systemdDbus.PropDescription("cgroup " + name), - systemdDbus.PropWants(slice), - newProperty("DefaultDependencies", false), - newProperty("MemoryAccounting", true), - newProperty("CPUAccounting", true), - newProperty("BlockIOAccounting", true), - } - - // If we can delegate, we add the property back in - if canDelegate { - properties = append(properties, newProperty("Delegate", true)) - } - - ch := make(chan string) - _, err = conn.StartTransientUnitContext(ctx, name, "replace", properties, ch) - if err != nil { - return err - } - <-ch - return nil -} - -func (s *SystemdController) Delete(path string) error { - ctx := context.TODO() - conn, err := systemdDbus.NewWithContext(ctx) - if err != nil { - return err - } - defer conn.Close() - _, name := splitName(path) - ch := make(chan string) - _, err = conn.StopUnitContext(ctx, name, "replace", ch) - if err != nil { - return err - } - <-ch - return nil -} - -func newProperty(name string, units interface{}) systemdDbus.Property { - return systemdDbus.Property{ - Name: name, - Value: dbus.MakeVariant(units), - } -} - -func splitName(path string) (slice string, unit string) { - slice, unit = filepath.Split(path) - return strings.TrimSuffix(slice, "/"), unit -} diff --git a/vendor/github.com/containerd/cgroups/ticks.go b/vendor/github.com/containerd/cgroups/ticks.go deleted file mode 100644 index 84dc38d0cc..0000000000 --- a/vendor/github.com/containerd/cgroups/ticks.go +++ /dev/null @@ -1,26 +0,0 @@ -/* - Copyright The containerd Authors. - - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. -*/ - -package cgroups - -func getClockTicks() uint64 { - // The value comes from `C.sysconf(C._SC_CLK_TCK)`, and - // on Linux it's a constant which is safe to be hard coded, - // so we can avoid using cgo here. - // See https://github.com/containerd/cgroups/pull/12 for - // more details. - return 100 -} diff --git a/vendor/github.com/containerd/cgroups/utils.go b/vendor/github.com/containerd/cgroups/utils.go deleted file mode 100644 index 2297980d93..0000000000 --- a/vendor/github.com/containerd/cgroups/utils.go +++ /dev/null @@ -1,383 +0,0 @@ -/* - Copyright The containerd Authors. - - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. -*/ - -package cgroups - -import ( - "bufio" - "errors" - "fmt" - "io" - "io/ioutil" - "os" - "path/filepath" - "strconv" - "strings" - "sync" - "syscall" - "time" - - units "github.com/docker/go-units" - specs "github.com/opencontainers/runtime-spec/specs-go" - "golang.org/x/sys/unix" -) - -var ( - nsOnce sync.Once - inUserNS bool - checkMode sync.Once - cgMode CGMode -) - -const unifiedMountpoint = "/sys/fs/cgroup" - -// CGMode is the cgroups mode of the host system -type CGMode int - -const ( - // Unavailable cgroup mountpoint - Unavailable CGMode = iota - // Legacy cgroups v1 - Legacy - // Hybrid with cgroups v1 and v2 controllers mounted - Hybrid - // Unified with only cgroups v2 mounted - Unified -) - -// Mode returns the cgroups mode running on the host -func Mode() CGMode { - checkMode.Do(func() { - var st unix.Statfs_t - if err := unix.Statfs(unifiedMountpoint, &st); err != nil { - cgMode = Unavailable - return - } - switch st.Type { - case unix.CGROUP2_SUPER_MAGIC: - cgMode = Unified - default: - cgMode = Legacy - if err := unix.Statfs(filepath.Join(unifiedMountpoint, "unified"), &st); err != nil { - return - } - if st.Type == unix.CGROUP2_SUPER_MAGIC { - cgMode = Hybrid - } - } - }) - return cgMode -} - -// RunningInUserNS detects whether we are currently running in a user namespace. -// Copied from github.com/lxc/lxd/shared/util.go -func RunningInUserNS() bool { - nsOnce.Do(func() { - file, err := os.Open("/proc/self/uid_map") - if err != nil { - // This kernel-provided file only exists if user namespaces are supported - return - } - defer file.Close() - - buf := bufio.NewReader(file) - l, _, err := buf.ReadLine() - if err != nil { - return - } - - line := string(l) - var a, b, c int64 - fmt.Sscanf(line, "%d %d %d", &a, &b, &c) - - /* - * We assume we are in the initial user namespace if we have a full - * range - 4294967295 uids starting at uid 0. - */ - if a == 0 && b == 0 && c == 4294967295 { - return - } - inUserNS = true - }) - return inUserNS -} - -// defaults returns all known groups -func defaults(root string) ([]Subsystem, error) { - h, err := NewHugetlb(root) - if err != nil && !os.IsNotExist(err) { - return nil, err - } - s := []Subsystem{ - NewNamed(root, "systemd"), - NewFreezer(root), - NewPids(root), - NewNetCls(root), - NewNetPrio(root), - NewPerfEvent(root), - NewCpuset(root), - NewCpu(root), - NewCpuacct(root), - NewMemory(root), - NewBlkio(root), - NewRdma(root), - } - // only add the devices cgroup if we are not in a user namespace - // because modifications are not allowed - if !RunningInUserNS() { - s = append(s, NewDevices(root)) - } - // add the hugetlb cgroup if error wasn't due to missing hugetlb - // cgroup support on the host - if err == nil { - s = append(s, h) - } - return s, nil -} - -// remove will remove a cgroup path handling EAGAIN and EBUSY errors and -// retrying the remove after a exp timeout -func remove(path string) error { - delay := 10 * time.Millisecond - for i := 0; i < 5; i++ { - if i != 0 { - time.Sleep(delay) - delay *= 2 - } - if err := os.RemoveAll(path); err == nil { - return nil - } - } - return fmt.Errorf("cgroups: unable to remove path %q", path) -} - -// readPids will read all the pids of processes or tasks in a cgroup by the provided path -func readPids(path string, subsystem Name, pType procType) ([]Process, error) { - f, err := os.Open(filepath.Join(path, pType)) - if err != nil { - return nil, err - } - defer f.Close() - var ( - out []Process - s = bufio.NewScanner(f) - ) - for s.Scan() { - if t := s.Text(); t != "" { - pid, err := strconv.Atoi(t) - if err != nil { - return nil, err - } - out = append(out, Process{ - Pid: pid, - Subsystem: subsystem, - Path: path, - }) - } - } - if err := s.Err(); err != nil { - // failed to read all pids? - return nil, err - } - return out, nil -} - -func hugePageSizes() ([]string, error) { - var ( - pageSizes []string - sizeList = []string{"B", "KB", "MB", "GB", "TB", "PB"} - ) - files, err := ioutil.ReadDir("/sys/kernel/mm/hugepages") - if err != nil { - return nil, err - } - for _, st := range files { - nameArray := strings.Split(st.Name(), "-") - pageSize, err := units.RAMInBytes(nameArray[1]) - if err != nil { - return nil, err - } - pageSizes = append(pageSizes, units.CustomSize("%g%s", float64(pageSize), 1024.0, sizeList)) - } - return pageSizes, nil -} - -func readUint(path string) (uint64, error) { - v, err := ioutil.ReadFile(path) - if err != nil { - return 0, err - } - return parseUint(strings.TrimSpace(string(v)), 10, 64) -} - -func parseUint(s string, base, bitSize int) (uint64, error) { - v, err := strconv.ParseUint(s, base, bitSize) - if err != nil { - intValue, intErr := strconv.ParseInt(s, base, bitSize) - // 1. Handle negative values greater than MinInt64 (and) - // 2. Handle negative values lesser than MinInt64 - if intErr == nil && intValue < 0 { - return 0, nil - } else if intErr != nil && - intErr.(*strconv.NumError).Err == strconv.ErrRange && - intValue < 0 { - return 0, nil - } - return 0, err - } - return v, nil -} - -func parseKV(raw string) (string, uint64, error) { - parts := strings.Fields(raw) - switch len(parts) { - case 2: - v, err := parseUint(parts[1], 10, 64) - if err != nil { - return "", 0, err - } - return parts[0], v, nil - default: - return "", 0, ErrInvalidFormat - } -} - -// ParseCgroupFile parses the given cgroup file, typically /proc/self/cgroup -// or /proc//cgroup, into a map of subsystems to cgroup paths, e.g. -// "cpu": "/user.slice/user-1000.slice" -// "pids": "/user.slice/user-1000.slice" -// etc. -// -// Note that for cgroup v2 unified hierarchy, there are no per-controller -// cgroup paths, so the resulting map will have a single element where the key -// is empty string ("") and the value is the cgroup path the is in. -func ParseCgroupFile(path string) (map[string]string, error) { - f, err := os.Open(path) - if err != nil { - return nil, err - } - defer f.Close() - return parseCgroupFromReader(f) -} - -func parseCgroupFromReader(r io.Reader) (map[string]string, error) { - var ( - cgroups = make(map[string]string) - s = bufio.NewScanner(r) - ) - for s.Scan() { - var ( - text = s.Text() - parts = strings.SplitN(text, ":", 3) - ) - if len(parts) < 3 { - return nil, fmt.Errorf("invalid cgroup entry: %q", text) - } - for _, subs := range strings.Split(parts[1], ",") { - if subs != "" { - cgroups[subs] = parts[2] - } - } - } - if err := s.Err(); err != nil { - return nil, err - } - return cgroups, nil -} - -func getCgroupDestination(subsystem string) (string, error) { - f, err := os.Open("/proc/self/mountinfo") - if err != nil { - return "", err - } - defer f.Close() - s := bufio.NewScanner(f) - for s.Scan() { - fields := strings.Split(s.Text(), " ") - if len(fields) < 10 { - // broken mountinfo? - continue - } - if fields[len(fields)-3] != "cgroup" { - continue - } - for _, opt := range strings.Split(fields[len(fields)-1], ",") { - if opt == subsystem { - return fields[3], nil - } - } - } - if err := s.Err(); err != nil { - return "", err - } - return "", ErrNoCgroupMountDestination -} - -func pathers(subystems []Subsystem) []pather { - var out []pather - for _, s := range subystems { - if p, ok := s.(pather); ok { - out = append(out, p) - } - } - return out -} - -func initializeSubsystem(s Subsystem, path Path, resources *specs.LinuxResources) error { - if c, ok := s.(creator); ok { - p, err := path(s.Name()) - if err != nil { - return err - } - if err := c.Create(p, resources); err != nil { - return err - } - } else if c, ok := s.(pather); ok { - p, err := path(s.Name()) - if err != nil { - return err - } - // do the default create if the group does not have a custom one - if err := os.MkdirAll(c.Path(p), defaultDirPerm); err != nil { - return err - } - } - return nil -} - -func cleanPath(path string) string { - if path == "" { - return "" - } - path = filepath.Clean(path) - if !filepath.IsAbs(path) { - path, _ = filepath.Rel(string(os.PathSeparator), filepath.Clean(string(os.PathSeparator)+path)) - } - return path -} - -func retryingWriteFile(path string, data []byte, mode os.FileMode) error { - // Retry writes on EINTR; see: - // https://github.com/golang/go/issues/38033 - for { - err := ioutil.WriteFile(path, data, mode) - if err == nil { - return nil - } else if !errors.Is(err, syscall.EINTR) { - return err - } - } -} diff --git a/vendor/github.com/containerd/cgroups/v1.go b/vendor/github.com/containerd/cgroups/v1.go deleted file mode 100644 index 2ec215c06f..0000000000 --- a/vendor/github.com/containerd/cgroups/v1.go +++ /dev/null @@ -1,73 +0,0 @@ -/* - Copyright The containerd Authors. - - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. -*/ - -package cgroups - -import ( - "bufio" - "fmt" - "os" - "path/filepath" - "strings" -) - -// V1 returns all the groups in the default cgroups mountpoint in a single hierarchy -func V1() ([]Subsystem, error) { - root, err := v1MountPoint() - if err != nil { - return nil, err - } - subsystems, err := defaults(root) - if err != nil { - return nil, err - } - var enabled []Subsystem - for _, s := range pathers(subsystems) { - // check and remove the default groups that do not exist - if _, err := os.Lstat(s.Path("/")); err == nil { - enabled = append(enabled, s) - } - } - return enabled, nil -} - -// v1MountPoint returns the mount point where the cgroup -// mountpoints are mounted in a single hiearchy -func v1MountPoint() (string, error) { - f, err := os.Open("/proc/self/mountinfo") - if err != nil { - return "", err - } - defer f.Close() - scanner := bufio.NewScanner(f) - for scanner.Scan() { - var ( - text = scanner.Text() - fields = strings.Split(text, " ") - numFields = len(fields) - ) - if numFields < 10 { - return "", fmt.Errorf("mountinfo: bad entry %q", text) - } - if fields[numFields-3] == "cgroup" { - return filepath.Dir(fields[4]), nil - } - } - if err := scanner.Err(); err != nil { - return "", err - } - return "", ErrMountPointNotExist -} diff --git a/vendor/github.com/containerd/cgroups/LICENSE b/vendor/github.com/coreos/go-semver/LICENSE similarity index 99% rename from vendor/github.com/containerd/cgroups/LICENSE rename to vendor/github.com/coreos/go-semver/LICENSE index 261eeb9e9f..d645695673 100644 --- a/vendor/github.com/containerd/cgroups/LICENSE +++ b/vendor/github.com/coreos/go-semver/LICENSE @@ -1,3 +1,4 @@ + Apache License Version 2.0, January 2004 http://www.apache.org/licenses/ diff --git a/vendor/github.com/coreos/go-systemd/v22/NOTICE b/vendor/github.com/coreos/go-semver/NOTICE similarity index 100% rename from vendor/github.com/coreos/go-systemd/v22/NOTICE rename to vendor/github.com/coreos/go-semver/NOTICE diff --git a/vendor/github.com/coreos/go-semver/semver/semver.go b/vendor/github.com/coreos/go-semver/semver/semver.go new file mode 100644 index 0000000000..76cf4852c7 --- /dev/null +++ b/vendor/github.com/coreos/go-semver/semver/semver.go @@ -0,0 +1,296 @@ +// Copyright 2013-2015 CoreOS, Inc. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +// Semantic Versions http://semver.org +package semver + +import ( + "bytes" + "errors" + "fmt" + "regexp" + "strconv" + "strings" +) + +type Version struct { + Major int64 + Minor int64 + Patch int64 + PreRelease PreRelease + Metadata string +} + +type PreRelease string + +func splitOff(input *string, delim string) (val string) { + parts := strings.SplitN(*input, delim, 2) + + if len(parts) == 2 { + *input = parts[0] + val = parts[1] + } + + return val +} + +func New(version string) *Version { + return Must(NewVersion(version)) +} + +func NewVersion(version string) (*Version, error) { + v := Version{} + + if err := v.Set(version); err != nil { + return nil, err + } + + return &v, nil +} + +// Must is a helper for wrapping NewVersion and will panic if err is not nil. +func Must(v *Version, err error) *Version { + if err != nil { + panic(err) + } + return v +} + +// Set parses and updates v from the given version string. Implements flag.Value +func (v *Version) Set(version string) error { + metadata := splitOff(&version, "+") + preRelease := PreRelease(splitOff(&version, "-")) + dotParts := strings.SplitN(version, ".", 3) + + if len(dotParts) != 3 { + return fmt.Errorf("%s is not in dotted-tri format", version) + } + + if err := validateIdentifier(string(preRelease)); err != nil { + return fmt.Errorf("failed to validate pre-release: %v", err) + } + + if err := validateIdentifier(metadata); err != nil { + return fmt.Errorf("failed to validate metadata: %v", err) + } + + parsed := make([]int64, 3, 3) + + for i, v := range dotParts[:3] { + val, err := strconv.ParseInt(v, 10, 64) + parsed[i] = val + if err != nil { + return err + } + } + + v.Metadata = metadata + v.PreRelease = preRelease + v.Major = parsed[0] + v.Minor = parsed[1] + v.Patch = parsed[2] + return nil +} + +func (v Version) String() string { + var buffer bytes.Buffer + + fmt.Fprintf(&buffer, "%d.%d.%d", v.Major, v.Minor, v.Patch) + + if v.PreRelease != "" { + fmt.Fprintf(&buffer, "-%s", v.PreRelease) + } + + if v.Metadata != "" { + fmt.Fprintf(&buffer, "+%s", v.Metadata) + } + + return buffer.String() +} + +func (v *Version) UnmarshalYAML(unmarshal func(interface{}) error) error { + var data string + if err := unmarshal(&data); err != nil { + return err + } + return v.Set(data) +} + +func (v Version) MarshalJSON() ([]byte, error) { + return []byte(`"` + v.String() + `"`), nil +} + +func (v *Version) UnmarshalJSON(data []byte) error { + l := len(data) + if l == 0 || string(data) == `""` { + return nil + } + if l < 2 || data[0] != '"' || data[l-1] != '"' { + return errors.New("invalid semver string") + } + return v.Set(string(data[1 : l-1])) +} + +// Compare tests if v is less than, equal to, or greater than versionB, +// returning -1, 0, or +1 respectively. +func (v Version) Compare(versionB Version) int { + if cmp := recursiveCompare(v.Slice(), versionB.Slice()); cmp != 0 { + return cmp + } + return preReleaseCompare(v, versionB) +} + +// Equal tests if v is equal to versionB. +func (v Version) Equal(versionB Version) bool { + return v.Compare(versionB) == 0 +} + +// LessThan tests if v is less than versionB. +func (v Version) LessThan(versionB Version) bool { + return v.Compare(versionB) < 0 +} + +// Slice converts the comparable parts of the semver into a slice of integers. +func (v Version) Slice() []int64 { + return []int64{v.Major, v.Minor, v.Patch} +} + +func (p PreRelease) Slice() []string { + preRelease := string(p) + return strings.Split(preRelease, ".") +} + +func preReleaseCompare(versionA Version, versionB Version) int { + a := versionA.PreRelease + b := versionB.PreRelease + + /* Handle the case where if two versions are otherwise equal it is the + * one without a PreRelease that is greater */ + if len(a) == 0 && (len(b) > 0) { + return 1 + } else if len(b) == 0 && (len(a) > 0) { + return -1 + } + + // If there is a prerelease, check and compare each part. + return recursivePreReleaseCompare(a.Slice(), b.Slice()) +} + +func recursiveCompare(versionA []int64, versionB []int64) int { + if len(versionA) == 0 { + return 0 + } + + a := versionA[0] + b := versionB[0] + + if a > b { + return 1 + } else if a < b { + return -1 + } + + return recursiveCompare(versionA[1:], versionB[1:]) +} + +func recursivePreReleaseCompare(versionA []string, versionB []string) int { + // A larger set of pre-release fields has a higher precedence than a smaller set, + // if all of the preceding identifiers are equal. + if len(versionA) == 0 { + if len(versionB) > 0 { + return -1 + } + return 0 + } else if len(versionB) == 0 { + // We're longer than versionB so return 1. + return 1 + } + + a := versionA[0] + b := versionB[0] + + aInt := false + bInt := false + + aI, err := strconv.Atoi(versionA[0]) + if err == nil { + aInt = true + } + + bI, err := strconv.Atoi(versionB[0]) + if err == nil { + bInt = true + } + + // Numeric identifiers always have lower precedence than non-numeric identifiers. + if aInt && !bInt { + return -1 + } else if !aInt && bInt { + return 1 + } + + // Handle Integer Comparison + if aInt && bInt { + if aI > bI { + return 1 + } else if aI < bI { + return -1 + } + } + + // Handle String Comparison + if a > b { + return 1 + } else if a < b { + return -1 + } + + return recursivePreReleaseCompare(versionA[1:], versionB[1:]) +} + +// BumpMajor increments the Major field by 1 and resets all other fields to their default values +func (v *Version) BumpMajor() { + v.Major += 1 + v.Minor = 0 + v.Patch = 0 + v.PreRelease = PreRelease("") + v.Metadata = "" +} + +// BumpMinor increments the Minor field by 1 and resets all other fields to their default values +func (v *Version) BumpMinor() { + v.Minor += 1 + v.Patch = 0 + v.PreRelease = PreRelease("") + v.Metadata = "" +} + +// BumpPatch increments the Patch field by 1 and resets all other fields to their default values +func (v *Version) BumpPatch() { + v.Patch += 1 + v.PreRelease = PreRelease("") + v.Metadata = "" +} + +// validateIdentifier makes sure the provided identifier satisfies semver spec +func validateIdentifier(id string) error { + if id != "" && !reIdentifier.MatchString(id) { + return fmt.Errorf("%s is not a valid semver identifier", id) + } + return nil +} + +// reIdentifier is a regular expression used to check that pre-release and metadata +// identifiers satisfy the spec requirements +var reIdentifier = regexp.MustCompile(`^[0-9A-Za-z-]+(\.[0-9A-Za-z-]+)*$`) diff --git a/vendor/github.com/coreos/go-systemd/v22/dbus/set.go b/vendor/github.com/coreos/go-semver/semver/sort.go similarity index 52% rename from vendor/github.com/coreos/go-systemd/v22/dbus/set.go rename to vendor/github.com/coreos/go-semver/semver/sort.go index 17c5d48565..e256b41a5d 100644 --- a/vendor/github.com/coreos/go-systemd/v22/dbus/set.go +++ b/vendor/github.com/coreos/go-semver/semver/sort.go @@ -1,4 +1,4 @@ -// Copyright 2015 CoreOS, Inc. +// Copyright 2013-2015 CoreOS, Inc. // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. @@ -12,36 +12,27 @@ // See the License for the specific language governing permissions and // limitations under the License. -package dbus +package semver -type set struct { - data map[string]bool -} - -func (s *set) Add(value string) { - s.data[value] = true -} +import ( + "sort" +) -func (s *set) Remove(value string) { - delete(s.data, value) -} +type Versions []*Version -func (s *set) Contains(value string) (exists bool) { - _, exists = s.data[value] - return +func (s Versions) Len() int { + return len(s) } -func (s *set) Length() int { - return len(s.data) +func (s Versions) Swap(i, j int) { + s[i], s[j] = s[j], s[i] } -func (s *set) Values() (values []string) { - for val := range s.data { - values = append(values, val) - } - return +func (s Versions) Less(i, j int) bool { + return s[i].LessThan(*s[j]) } -func newSet() *set { - return &set{make(map[string]bool)} +// Sort sorts the given slice of Version +func Sort(versions []*Version) { + sort.Sort(Versions(versions)) } diff --git a/vendor/github.com/coreos/go-systemd/v22/LICENSE b/vendor/github.com/coreos/go-systemd/v22/LICENSE deleted file mode 100644 index 37ec93a14f..0000000000 --- a/vendor/github.com/coreos/go-systemd/v22/LICENSE +++ /dev/null @@ -1,191 +0,0 @@ -Apache License -Version 2.0, January 2004 -http://www.apache.org/licenses/ - -TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION - -1. Definitions. - -"License" shall mean the terms and conditions for use, reproduction, and -distribution as defined by Sections 1 through 9 of this document. - -"Licensor" shall mean the copyright owner or entity authorized by the copyright -owner that is granting the License. - -"Legal Entity" shall mean the union of the acting entity and all other entities -that control, are controlled by, or are under common control with that entity. -For the purposes of this definition, "control" means (i) the power, direct or -indirect, to cause the direction or management of such entity, whether by -contract or otherwise, or (ii) ownership of fifty percent (50%) or more of the -outstanding shares, or (iii) beneficial ownership of such entity. - -"You" (or "Your") shall mean an individual or Legal Entity exercising -permissions granted by this License. - -"Source" form shall mean the preferred form for making modifications, including -but not limited to software source code, documentation source, and configuration -files. - -"Object" form shall mean any form resulting from mechanical transformation or -translation of a Source form, including but not limited to compiled object code, -generated documentation, and conversions to other media types. - -"Work" shall mean the work of authorship, whether in Source or Object form, made -available under the License, as indicated by a copyright notice that is included -in or attached to the work (an example is provided in the Appendix below). - -"Derivative Works" shall mean any work, whether in Source or Object form, that -is based on (or derived from) the Work and for which the editorial revisions, -annotations, elaborations, or other modifications represent, as a whole, an -original work of authorship. For the purposes of this License, Derivative Works -shall not include works that remain separable from, or merely link (or bind by -name) to the interfaces of, the Work and Derivative Works thereof. - -"Contribution" shall mean any work of authorship, including the original version -of the Work and any modifications or additions to that Work or Derivative Works -thereof, that is intentionally submitted to Licensor for inclusion in the Work -by the copyright owner or by an individual or Legal Entity authorized to submit -on behalf of the copyright owner. For the purposes of this definition, -"submitted" means any form of electronic, verbal, or written communication sent -to the Licensor or its representatives, including but not limited to -communication on electronic mailing lists, source code control systems, and -issue tracking systems that are managed by, or on behalf of, the Licensor for -the purpose of discussing and improving the Work, but excluding communication -that is conspicuously marked or otherwise designated in writing by the copyright -owner as "Not a Contribution." - -"Contributor" shall mean Licensor and any individual or Legal Entity on behalf -of whom a Contribution has been received by Licensor and subsequently -incorporated within the Work. - -2. Grant of Copyright License. - -Subject to the terms and conditions of this License, each Contributor hereby -grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free, -irrevocable copyright license to reproduce, prepare Derivative Works of, -publicly display, publicly perform, sublicense, and distribute the Work and such -Derivative Works in Source or Object form. - -3. Grant of Patent License. - -Subject to the terms and conditions of this License, each Contributor hereby -grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free, -irrevocable (except as stated in this section) patent license to make, have -made, use, offer to sell, sell, import, and otherwise transfer the Work, where -such license applies only to those patent claims licensable by such Contributor -that are necessarily infringed by their Contribution(s) alone or by combination -of their Contribution(s) with the Work to which such Contribution(s) was -submitted. If You institute patent litigation against any entity (including a -cross-claim or counterclaim in a lawsuit) alleging that the Work or a -Contribution incorporated within the Work constitutes direct or contributory -patent infringement, then any patent licenses granted to You under this License -for that Work shall terminate as of the date such litigation is filed. - -4. Redistribution. - -You may reproduce and distribute copies of the Work or Derivative Works thereof -in any medium, with or without modifications, and in Source or Object form, -provided that You meet the following conditions: - -You must give any other recipients of the Work or Derivative Works a copy of -this License; and -You must cause any modified files to carry prominent notices stating that You -changed the files; and -You must retain, in the Source form of any Derivative Works that You distribute, -all copyright, patent, trademark, and attribution notices from the Source form -of the Work, excluding those notices that do not pertain to any part of the -Derivative Works; and -If the Work includes a "NOTICE" text file as part of its distribution, then any -Derivative Works that You distribute must include a readable copy of the -attribution notices contained within such NOTICE file, excluding those notices -that do not pertain to any part of the Derivative Works, in at least one of the -following places: within a NOTICE text file distributed as part of the -Derivative Works; within the Source form or documentation, if provided along -with the Derivative Works; or, within a display generated by the Derivative -Works, if and wherever such third-party notices normally appear. The contents of -the NOTICE file are for informational purposes only and do not modify the -License. You may add Your own attribution notices within Derivative Works that -You distribute, alongside or as an addendum to the NOTICE text from the Work, -provided that such additional attribution notices cannot be construed as -modifying the License. -You may add Your own copyright statement to Your modifications and may provide -additional or different license terms and conditions for use, reproduction, or -distribution of Your modifications, or for any such Derivative Works as a whole, -provided Your use, reproduction, and distribution of the Work otherwise complies -with the conditions stated in this License. - -5. Submission of Contributions. - -Unless You explicitly state otherwise, any Contribution intentionally submitted -for inclusion in the Work by You to the Licensor shall be under the terms and -conditions of this License, without any additional terms or conditions. -Notwithstanding the above, nothing herein shall supersede or modify the terms of -any separate license agreement you may have executed with Licensor regarding -such Contributions. - -6. Trademarks. - -This License does not grant permission to use the trade names, trademarks, -service marks, or product names of the Licensor, except as required for -reasonable and customary use in describing the origin of the Work and -reproducing the content of the NOTICE file. - -7. Disclaimer of Warranty. - -Unless required by applicable law or agreed to in writing, Licensor provides the -Work (and each Contributor provides its Contributions) on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied, -including, without limitation, any warranties or conditions of TITLE, -NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A PARTICULAR PURPOSE. You are -solely responsible for determining the appropriateness of using or -redistributing the Work and assume any risks associated with Your exercise of -permissions under this License. - -8. Limitation of Liability. - -In no event and under no legal theory, whether in tort (including negligence), -contract, or otherwise, unless required by applicable law (such as deliberate -and grossly negligent acts) or agreed to in writing, shall any Contributor be -liable to You for damages, including any direct, indirect, special, incidental, -or consequential damages of any character arising as a result of this License or -out of the use or inability to use the Work (including but not limited to -damages for loss of goodwill, work stoppage, computer failure or malfunction, or -any and all other commercial damages or losses), even if such Contributor has -been advised of the possibility of such damages. - -9. Accepting Warranty or Additional Liability. - -While redistributing the Work or Derivative Works thereof, You may choose to -offer, and charge a fee for, acceptance of support, warranty, indemnity, or -other liability obligations and/or rights consistent with this License. However, -in accepting such obligations, You may act only on Your own behalf and on Your -sole responsibility, not on behalf of any other Contributor, and only if You -agree to indemnify, defend, and hold each Contributor harmless for any liability -incurred by, or claims asserted against, such Contributor by reason of your -accepting any such warranty or additional liability. - -END OF TERMS AND CONDITIONS - -APPENDIX: How to apply the Apache License to your work - -To apply the Apache License to your work, attach the following boilerplate -notice, with the fields enclosed by brackets "[]" replaced with your own -identifying information. (Don't include the brackets!) The text should be -enclosed in the appropriate comment syntax for the file format. We also -recommend that a file or class name and description of purpose be included on -the same "printed page" as the copyright notice for easier identification within -third-party archives. - - Copyright [yyyy] [name of copyright owner] - - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. diff --git a/vendor/github.com/coreos/go-systemd/v22/dbus/dbus.go b/vendor/github.com/coreos/go-systemd/v22/dbus/dbus.go deleted file mode 100644 index cff5af1a64..0000000000 --- a/vendor/github.com/coreos/go-systemd/v22/dbus/dbus.go +++ /dev/null @@ -1,261 +0,0 @@ -// Copyright 2015 CoreOS, Inc. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -// Integration with the systemd D-Bus API. See http://www.freedesktop.org/wiki/Software/systemd/dbus/ -package dbus - -import ( - "context" - "encoding/hex" - "fmt" - "os" - "strconv" - "strings" - "sync" - - "github.com/godbus/dbus/v5" -) - -const ( - alpha = `abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ` - num = `0123456789` - alphanum = alpha + num - signalBuffer = 100 -) - -// needsEscape checks whether a byte in a potential dbus ObjectPath needs to be escaped -func needsEscape(i int, b byte) bool { - // Escape everything that is not a-z-A-Z-0-9 - // Also escape 0-9 if it's the first character - return strings.IndexByte(alphanum, b) == -1 || - (i == 0 && strings.IndexByte(num, b) != -1) -} - -// PathBusEscape sanitizes a constituent string of a dbus ObjectPath using the -// rules that systemd uses for serializing special characters. -func PathBusEscape(path string) string { - // Special case the empty string - if len(path) == 0 { - return "_" - } - n := []byte{} - for i := 0; i < len(path); i++ { - c := path[i] - if needsEscape(i, c) { - e := fmt.Sprintf("_%x", c) - n = append(n, []byte(e)...) - } else { - n = append(n, c) - } - } - return string(n) -} - -// pathBusUnescape is the inverse of PathBusEscape. -func pathBusUnescape(path string) string { - if path == "_" { - return "" - } - n := []byte{} - for i := 0; i < len(path); i++ { - c := path[i] - if c == '_' && i+2 < len(path) { - res, err := hex.DecodeString(path[i+1 : i+3]) - if err == nil { - n = append(n, res...) - } - i += 2 - } else { - n = append(n, c) - } - } - return string(n) -} - -// Conn is a connection to systemd's dbus endpoint. -type Conn struct { - // sysconn/sysobj are only used to call dbus methods - sysconn *dbus.Conn - sysobj dbus.BusObject - - // sigconn/sigobj are only used to receive dbus signals - sigconn *dbus.Conn - sigobj dbus.BusObject - - jobListener struct { - jobs map[dbus.ObjectPath]chan<- string - sync.Mutex - } - subStateSubscriber struct { - updateCh chan<- *SubStateUpdate - errCh chan<- error - sync.Mutex - ignore map[dbus.ObjectPath]int64 - cleanIgnore int64 - } - propertiesSubscriber struct { - updateCh chan<- *PropertiesUpdate - errCh chan<- error - sync.Mutex - } -} - -// Deprecated: use NewWithContext instead. -func New() (*Conn, error) { - return NewWithContext(context.Background()) -} - -// NewWithContext establishes a connection to any available bus and authenticates. -// Callers should call Close() when done with the connection. -func NewWithContext(ctx context.Context) (*Conn, error) { - conn, err := NewSystemConnectionContext(ctx) - if err != nil && os.Geteuid() == 0 { - return NewSystemdConnectionContext(ctx) - } - return conn, err -} - -// Deprecated: use NewSystemConnectionContext instead. -func NewSystemConnection() (*Conn, error) { - return NewSystemConnectionContext(context.Background()) -} - -// NewSystemConnectionContext establishes a connection to the system bus and authenticates. -// Callers should call Close() when done with the connection. -func NewSystemConnectionContext(ctx context.Context) (*Conn, error) { - return NewConnection(func() (*dbus.Conn, error) { - return dbusAuthHelloConnection(ctx, dbus.SystemBusPrivate) - }) -} - -// Deprecated: use NewUserConnectionContext instead. -func NewUserConnection() (*Conn, error) { - return NewUserConnectionContext(context.Background()) -} - -// NewUserConnectionContext establishes a connection to the session bus and -// authenticates. This can be used to connect to systemd user instances. -// Callers should call Close() when done with the connection. -func NewUserConnectionContext(ctx context.Context) (*Conn, error) { - return NewConnection(func() (*dbus.Conn, error) { - return dbusAuthHelloConnection(ctx, dbus.SessionBusPrivate) - }) -} - -// Deprecated: use NewSystemdConnectionContext instead. -func NewSystemdConnection() (*Conn, error) { - return NewSystemdConnectionContext(context.Background()) -} - -// NewSystemdConnectionContext establishes a private, direct connection to systemd. -// This can be used for communicating with systemd without a dbus daemon. -// Callers should call Close() when done with the connection. -func NewSystemdConnectionContext(ctx context.Context) (*Conn, error) { - return NewConnection(func() (*dbus.Conn, error) { - // We skip Hello when talking directly to systemd. - return dbusAuthConnection(ctx, func(opts ...dbus.ConnOption) (*dbus.Conn, error) { - return dbus.Dial("unix:path=/run/systemd/private", opts...) - }) - }) -} - -// Close closes an established connection. -func (c *Conn) Close() { - c.sysconn.Close() - c.sigconn.Close() -} - -// NewConnection establishes a connection to a bus using a caller-supplied function. -// This allows connecting to remote buses through a user-supplied mechanism. -// The supplied function may be called multiple times, and should return independent connections. -// The returned connection must be fully initialised: the org.freedesktop.DBus.Hello call must have succeeded, -// and any authentication should be handled by the function. -func NewConnection(dialBus func() (*dbus.Conn, error)) (*Conn, error) { - sysconn, err := dialBus() - if err != nil { - return nil, err - } - - sigconn, err := dialBus() - if err != nil { - sysconn.Close() - return nil, err - } - - c := &Conn{ - sysconn: sysconn, - sysobj: systemdObject(sysconn), - sigconn: sigconn, - sigobj: systemdObject(sigconn), - } - - c.subStateSubscriber.ignore = make(map[dbus.ObjectPath]int64) - c.jobListener.jobs = make(map[dbus.ObjectPath]chan<- string) - - // Setup the listeners on jobs so that we can get completions - c.sigconn.BusObject().Call("org.freedesktop.DBus.AddMatch", 0, - "type='signal', interface='org.freedesktop.systemd1.Manager', member='JobRemoved'") - - c.dispatch() - return c, nil -} - -// GetManagerProperty returns the value of a property on the org.freedesktop.systemd1.Manager -// interface. The value is returned in its string representation, as defined at -// https://developer.gnome.org/glib/unstable/gvariant-text.html. -func (c *Conn) GetManagerProperty(prop string) (string, error) { - variant, err := c.sysobj.GetProperty("org.freedesktop.systemd1.Manager." + prop) - if err != nil { - return "", err - } - return variant.String(), nil -} - -func dbusAuthConnection(ctx context.Context, createBus func(opts ...dbus.ConnOption) (*dbus.Conn, error)) (*dbus.Conn, error) { - conn, err := createBus(dbus.WithContext(ctx)) - if err != nil { - return nil, err - } - - // Only use EXTERNAL method, and hardcode the uid (not username) - // to avoid a username lookup (which requires a dynamically linked - // libc) - methods := []dbus.Auth{dbus.AuthExternal(strconv.Itoa(os.Getuid()))} - - err = conn.Auth(methods) - if err != nil { - conn.Close() - return nil, err - } - - return conn, nil -} - -func dbusAuthHelloConnection(ctx context.Context, createBus func(opts ...dbus.ConnOption) (*dbus.Conn, error)) (*dbus.Conn, error) { - conn, err := dbusAuthConnection(ctx, createBus) - if err != nil { - return nil, err - } - - if err = conn.Hello(); err != nil { - conn.Close() - return nil, err - } - - return conn, nil -} - -func systemdObject(conn *dbus.Conn) dbus.BusObject { - return conn.Object("org.freedesktop.systemd1", dbus.ObjectPath("/org/freedesktop/systemd1")) -} diff --git a/vendor/github.com/coreos/go-systemd/v22/dbus/methods.go b/vendor/github.com/coreos/go-systemd/v22/dbus/methods.go deleted file mode 100644 index fa04afc708..0000000000 --- a/vendor/github.com/coreos/go-systemd/v22/dbus/methods.go +++ /dev/null @@ -1,830 +0,0 @@ -// Copyright 2015, 2018 CoreOS, Inc. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -package dbus - -import ( - "context" - "errors" - "fmt" - "path" - "strconv" - - "github.com/godbus/dbus/v5" -) - -// Who can be used to specify which process to kill in the unit via the KillUnitWithTarget API -type Who string - -const ( - // All sends the signal to all processes in the unit - All Who = "all" - // Main sends the signal to the main process of the unit - Main Who = "main" - // Control sends the signal to the control process of the unit - Control Who = "control" -) - -func (c *Conn) jobComplete(signal *dbus.Signal) { - var id uint32 - var job dbus.ObjectPath - var unit string - var result string - dbus.Store(signal.Body, &id, &job, &unit, &result) - c.jobListener.Lock() - out, ok := c.jobListener.jobs[job] - if ok { - out <- result - delete(c.jobListener.jobs, job) - } - c.jobListener.Unlock() -} - -func (c *Conn) startJob(ctx context.Context, ch chan<- string, job string, args ...interface{}) (int, error) { - if ch != nil { - c.jobListener.Lock() - defer c.jobListener.Unlock() - } - - var p dbus.ObjectPath - err := c.sysobj.CallWithContext(ctx, job, 0, args...).Store(&p) - if err != nil { - return 0, err - } - - if ch != nil { - c.jobListener.jobs[p] = ch - } - - // ignore error since 0 is fine if conversion fails - jobID, _ := strconv.Atoi(path.Base(string(p))) - - return jobID, nil -} - -// Deprecated: use StartUnitContext instead. -func (c *Conn) StartUnit(name string, mode string, ch chan<- string) (int, error) { - return c.StartUnitContext(context.Background(), name, mode, ch) -} - -// StartUnitContext enqueues a start job and depending jobs, if any (unless otherwise -// specified by the mode string). -// -// Takes the unit to activate, plus a mode string. The mode needs to be one of -// replace, fail, isolate, ignore-dependencies, ignore-requirements. If -// "replace" the call will start the unit and its dependencies, possibly -// replacing already queued jobs that conflict with this. If "fail" the call -// will start the unit and its dependencies, but will fail if this would change -// an already queued job. If "isolate" the call will start the unit in question -// and terminate all units that aren't dependencies of it. If -// "ignore-dependencies" it will start a unit but ignore all its dependencies. -// If "ignore-requirements" it will start a unit but only ignore the -// requirement dependencies. It is not recommended to make use of the latter -// two options. -// -// If the provided channel is non-nil, a result string will be sent to it upon -// job completion: one of done, canceled, timeout, failed, dependency, skipped. -// done indicates successful execution of a job. canceled indicates that a job -// has been canceled before it finished execution. timeout indicates that the -// job timeout was reached. failed indicates that the job failed. dependency -// indicates that a job this job has been depending on failed and the job hence -// has been removed too. skipped indicates that a job was skipped because it -// didn't apply to the units current state. -// -// If no error occurs, the ID of the underlying systemd job will be returned. There -// does exist the possibility for no error to be returned, but for the returned job -// ID to be 0. In this case, the actual underlying ID is not 0 and this datapoint -// should not be considered authoritative. -// -// If an error does occur, it will be returned to the user alongside a job ID of 0. -func (c *Conn) StartUnitContext(ctx context.Context, name string, mode string, ch chan<- string) (int, error) { - return c.startJob(ctx, ch, "org.freedesktop.systemd1.Manager.StartUnit", name, mode) -} - -// Deprecated: use StopUnitContext instead. -func (c *Conn) StopUnit(name string, mode string, ch chan<- string) (int, error) { - return c.StopUnitContext(context.Background(), name, mode, ch) -} - -// StopUnitContext is similar to StartUnitContext, but stops the specified unit -// rather than starting it. -func (c *Conn) StopUnitContext(ctx context.Context, name string, mode string, ch chan<- string) (int, error) { - return c.startJob(ctx, ch, "org.freedesktop.systemd1.Manager.StopUnit", name, mode) -} - -// Deprecated: use ReloadUnitContext instead. -func (c *Conn) ReloadUnit(name string, mode string, ch chan<- string) (int, error) { - return c.ReloadUnitContext(context.Background(), name, mode, ch) -} - -// ReloadUnitContext reloads a unit. Reloading is done only if the unit -// is already running, and fails otherwise. -func (c *Conn) ReloadUnitContext(ctx context.Context, name string, mode string, ch chan<- string) (int, error) { - return c.startJob(ctx, ch, "org.freedesktop.systemd1.Manager.ReloadUnit", name, mode) -} - -// Deprecated: use RestartUnitContext instead. -func (c *Conn) RestartUnit(name string, mode string, ch chan<- string) (int, error) { - return c.RestartUnitContext(context.Background(), name, mode, ch) -} - -// RestartUnitContext restarts a service. If a service is restarted that isn't -// running it will be started. -func (c *Conn) RestartUnitContext(ctx context.Context, name string, mode string, ch chan<- string) (int, error) { - return c.startJob(ctx, ch, "org.freedesktop.systemd1.Manager.RestartUnit", name, mode) -} - -// Deprecated: use TryRestartUnitContext instead. -func (c *Conn) TryRestartUnit(name string, mode string, ch chan<- string) (int, error) { - return c.TryRestartUnitContext(context.Background(), name, mode, ch) -} - -// TryRestartUnitContext is like RestartUnitContext, except that a service that -// isn't running is not affected by the restart. -func (c *Conn) TryRestartUnitContext(ctx context.Context, name string, mode string, ch chan<- string) (int, error) { - return c.startJob(ctx, ch, "org.freedesktop.systemd1.Manager.TryRestartUnit", name, mode) -} - -// Deprecated: use ReloadOrRestartUnitContext instead. -func (c *Conn) ReloadOrRestartUnit(name string, mode string, ch chan<- string) (int, error) { - return c.ReloadOrRestartUnitContext(context.Background(), name, mode, ch) -} - -// ReloadOrRestartUnitContext attempts a reload if the unit supports it and use -// a restart otherwise. -func (c *Conn) ReloadOrRestartUnitContext(ctx context.Context, name string, mode string, ch chan<- string) (int, error) { - return c.startJob(ctx, ch, "org.freedesktop.systemd1.Manager.ReloadOrRestartUnit", name, mode) -} - -// Deprecated: use ReloadOrTryRestartUnitContext instead. -func (c *Conn) ReloadOrTryRestartUnit(name string, mode string, ch chan<- string) (int, error) { - return c.ReloadOrTryRestartUnitContext(context.Background(), name, mode, ch) -} - -// ReloadOrTryRestartUnitContext attempts a reload if the unit supports it, -// and use a "Try" flavored restart otherwise. -func (c *Conn) ReloadOrTryRestartUnitContext(ctx context.Context, name string, mode string, ch chan<- string) (int, error) { - return c.startJob(ctx, ch, "org.freedesktop.systemd1.Manager.ReloadOrTryRestartUnit", name, mode) -} - -// Deprecated: use StartTransientUnitContext instead. -func (c *Conn) StartTransientUnit(name string, mode string, properties []Property, ch chan<- string) (int, error) { - return c.StartTransientUnitContext(context.Background(), name, mode, properties, ch) -} - -// StartTransientUnitContext may be used to create and start a transient unit, which -// will be released as soon as it is not running or referenced anymore or the -// system is rebooted. name is the unit name including suffix, and must be -// unique. mode is the same as in StartUnitContext, properties contains properties -// of the unit. -func (c *Conn) StartTransientUnitContext(ctx context.Context, name string, mode string, properties []Property, ch chan<- string) (int, error) { - return c.startJob(ctx, ch, "org.freedesktop.systemd1.Manager.StartTransientUnit", name, mode, properties, make([]PropertyCollection, 0)) -} - -// Deprecated: use KillUnitContext instead. -func (c *Conn) KillUnit(name string, signal int32) { - c.KillUnitContext(context.Background(), name, signal) -} - -// KillUnitContext takes the unit name and a UNIX signal number to send. -// All of the unit's processes are killed. -func (c *Conn) KillUnitContext(ctx context.Context, name string, signal int32) { - c.KillUnitWithTarget(ctx, name, All, signal) -} - -// KillUnitWithTarget is like KillUnitContext, but allows you to specify which -// process in the unit to send the signal to. -func (c *Conn) KillUnitWithTarget(ctx context.Context, name string, target Who, signal int32) error { - return c.sysobj.CallWithContext(ctx, "org.freedesktop.systemd1.Manager.KillUnit", 0, name, string(target), signal).Store() -} - -// Deprecated: use ResetFailedUnitContext instead. -func (c *Conn) ResetFailedUnit(name string) error { - return c.ResetFailedUnitContext(context.Background(), name) -} - -// ResetFailedUnitContext resets the "failed" state of a specific unit. -func (c *Conn) ResetFailedUnitContext(ctx context.Context, name string) error { - return c.sysobj.CallWithContext(ctx, "org.freedesktop.systemd1.Manager.ResetFailedUnit", 0, name).Store() -} - -// Deprecated: use SystemStateContext instead. -func (c *Conn) SystemState() (*Property, error) { - return c.SystemStateContext(context.Background()) -} - -// SystemStateContext returns the systemd state. Equivalent to -// systemctl is-system-running. -func (c *Conn) SystemStateContext(ctx context.Context) (*Property, error) { - var err error - var prop dbus.Variant - - obj := c.sysconn.Object("org.freedesktop.systemd1", "/org/freedesktop/systemd1") - err = obj.CallWithContext(ctx, "org.freedesktop.DBus.Properties.Get", 0, "org.freedesktop.systemd1.Manager", "SystemState").Store(&prop) - if err != nil { - return nil, err - } - - return &Property{Name: "SystemState", Value: prop}, nil -} - -// getProperties takes the unit path and returns all of its dbus object properties, for the given dbus interface. -func (c *Conn) getProperties(ctx context.Context, path dbus.ObjectPath, dbusInterface string) (map[string]interface{}, error) { - var err error - var props map[string]dbus.Variant - - if !path.IsValid() { - return nil, fmt.Errorf("invalid unit name: %v", path) - } - - obj := c.sysconn.Object("org.freedesktop.systemd1", path) - err = obj.CallWithContext(ctx, "org.freedesktop.DBus.Properties.GetAll", 0, dbusInterface).Store(&props) - if err != nil { - return nil, err - } - - out := make(map[string]interface{}, len(props)) - for k, v := range props { - out[k] = v.Value() - } - - return out, nil -} - -// Deprecated: use GetUnitPropertiesContext instead. -func (c *Conn) GetUnitProperties(unit string) (map[string]interface{}, error) { - return c.GetUnitPropertiesContext(context.Background(), unit) -} - -// GetUnitPropertiesContext takes the (unescaped) unit name and returns all of -// its dbus object properties. -func (c *Conn) GetUnitPropertiesContext(ctx context.Context, unit string) (map[string]interface{}, error) { - path := unitPath(unit) - return c.getProperties(ctx, path, "org.freedesktop.systemd1.Unit") -} - -// Deprecated: use GetUnitPathPropertiesContext instead. -func (c *Conn) GetUnitPathProperties(path dbus.ObjectPath) (map[string]interface{}, error) { - return c.GetUnitPathPropertiesContext(context.Background(), path) -} - -// GetUnitPathPropertiesContext takes the (escaped) unit path and returns all -// of its dbus object properties. -func (c *Conn) GetUnitPathPropertiesContext(ctx context.Context, path dbus.ObjectPath) (map[string]interface{}, error) { - return c.getProperties(ctx, path, "org.freedesktop.systemd1.Unit") -} - -// Deprecated: use GetAllPropertiesContext instead. -func (c *Conn) GetAllProperties(unit string) (map[string]interface{}, error) { - return c.GetAllPropertiesContext(context.Background(), unit) -} - -// GetAllPropertiesContext takes the (unescaped) unit name and returns all of -// its dbus object properties. -func (c *Conn) GetAllPropertiesContext(ctx context.Context, unit string) (map[string]interface{}, error) { - path := unitPath(unit) - return c.getProperties(ctx, path, "") -} - -func (c *Conn) getProperty(ctx context.Context, unit string, dbusInterface string, propertyName string) (*Property, error) { - var err error - var prop dbus.Variant - - path := unitPath(unit) - if !path.IsValid() { - return nil, errors.New("invalid unit name: " + unit) - } - - obj := c.sysconn.Object("org.freedesktop.systemd1", path) - err = obj.CallWithContext(ctx, "org.freedesktop.DBus.Properties.Get", 0, dbusInterface, propertyName).Store(&prop) - if err != nil { - return nil, err - } - - return &Property{Name: propertyName, Value: prop}, nil -} - -// Deprecated: use GetUnitPropertyContext instead. -func (c *Conn) GetUnitProperty(unit string, propertyName string) (*Property, error) { - return c.GetUnitPropertyContext(context.Background(), unit, propertyName) -} - -// GetUnitPropertyContext takes an (unescaped) unit name, and a property name, -// and returns the property value. -func (c *Conn) GetUnitPropertyContext(ctx context.Context, unit string, propertyName string) (*Property, error) { - return c.getProperty(ctx, unit, "org.freedesktop.systemd1.Unit", propertyName) -} - -// Deprecated: use GetServicePropertyContext instead. -func (c *Conn) GetServiceProperty(service string, propertyName string) (*Property, error) { - return c.GetServicePropertyContext(context.Background(), service, propertyName) -} - -// GetServiceProperty returns property for given service name and property name. -func (c *Conn) GetServicePropertyContext(ctx context.Context, service string, propertyName string) (*Property, error) { - return c.getProperty(ctx, service, "org.freedesktop.systemd1.Service", propertyName) -} - -// Deprecated: use GetUnitTypePropertiesContext instead. -func (c *Conn) GetUnitTypeProperties(unit string, unitType string) (map[string]interface{}, error) { - return c.GetUnitTypePropertiesContext(context.Background(), unit, unitType) -} - -// GetUnitTypePropertiesContext returns the extra properties for a unit, specific to the unit type. -// Valid values for unitType: Service, Socket, Target, Device, Mount, Automount, Snapshot, Timer, Swap, Path, Slice, Scope. -// Returns "dbus.Error: Unknown interface" error if the unitType is not the correct type of the unit. -func (c *Conn) GetUnitTypePropertiesContext(ctx context.Context, unit string, unitType string) (map[string]interface{}, error) { - path := unitPath(unit) - return c.getProperties(ctx, path, "org.freedesktop.systemd1."+unitType) -} - -// Deprecated: use SetUnitPropertiesContext instead. -func (c *Conn) SetUnitProperties(name string, runtime bool, properties ...Property) error { - return c.SetUnitPropertiesContext(context.Background(), name, runtime, properties...) -} - -// SetUnitPropertiesContext may be used to modify certain unit properties at runtime. -// Not all properties may be changed at runtime, but many resource management -// settings (primarily those in systemd.cgroup(5)) may. The changes are applied -// instantly, and stored on disk for future boots, unless runtime is true, in which -// case the settings only apply until the next reboot. name is the name of the unit -// to modify. properties are the settings to set, encoded as an array of property -// name and value pairs. -func (c *Conn) SetUnitPropertiesContext(ctx context.Context, name string, runtime bool, properties ...Property) error { - return c.sysobj.CallWithContext(ctx, "org.freedesktop.systemd1.Manager.SetUnitProperties", 0, name, runtime, properties).Store() -} - -// Deprecated: use GetUnitTypePropertyContext instead. -func (c *Conn) GetUnitTypeProperty(unit string, unitType string, propertyName string) (*Property, error) { - return c.GetUnitTypePropertyContext(context.Background(), unit, unitType, propertyName) -} - -// GetUnitTypePropertyContext takes a property name, a unit name, and a unit type, -// and returns a property value. For valid values of unitType, see GetUnitTypePropertiesContext. -func (c *Conn) GetUnitTypePropertyContext(ctx context.Context, unit string, unitType string, propertyName string) (*Property, error) { - return c.getProperty(ctx, unit, "org.freedesktop.systemd1."+unitType, propertyName) -} - -type UnitStatus struct { - Name string // The primary unit name as string - Description string // The human readable description string - LoadState string // The load state (i.e. whether the unit file has been loaded successfully) - ActiveState string // The active state (i.e. whether the unit is currently started or not) - SubState string // The sub state (a more fine-grained version of the active state that is specific to the unit type, which the active state is not) - Followed string // A unit that is being followed in its state by this unit, if there is any, otherwise the empty string. - Path dbus.ObjectPath // The unit object path - JobId uint32 // If there is a job queued for the job unit the numeric job id, 0 otherwise - JobType string // The job type as string - JobPath dbus.ObjectPath // The job object path -} - -type storeFunc func(retvalues ...interface{}) error - -func (c *Conn) listUnitsInternal(f storeFunc) ([]UnitStatus, error) { - result := make([][]interface{}, 0) - err := f(&result) - if err != nil { - return nil, err - } - - resultInterface := make([]interface{}, len(result)) - for i := range result { - resultInterface[i] = result[i] - } - - status := make([]UnitStatus, len(result)) - statusInterface := make([]interface{}, len(status)) - for i := range status { - statusInterface[i] = &status[i] - } - - err = dbus.Store(resultInterface, statusInterface...) - if err != nil { - return nil, err - } - - return status, nil -} - -// Deprecated: use ListUnitsContext instead. -func (c *Conn) ListUnits() ([]UnitStatus, error) { - return c.ListUnitsContext(context.Background()) -} - -// ListUnitsContext returns an array with all currently loaded units. Note that -// units may be known by multiple names at the same time, and hence there might -// be more unit names loaded than actual units behind them. -// Also note that a unit is only loaded if it is active and/or enabled. -// Units that are both disabled and inactive will thus not be returned. -func (c *Conn) ListUnitsContext(ctx context.Context) ([]UnitStatus, error) { - return c.listUnitsInternal(c.sysobj.CallWithContext(ctx, "org.freedesktop.systemd1.Manager.ListUnits", 0).Store) -} - -// Deprecated: use ListUnitsFilteredContext instead. -func (c *Conn) ListUnitsFiltered(states []string) ([]UnitStatus, error) { - return c.ListUnitsFilteredContext(context.Background(), states) -} - -// ListUnitsFilteredContext returns an array with units filtered by state. -// It takes a list of units' statuses to filter. -func (c *Conn) ListUnitsFilteredContext(ctx context.Context, states []string) ([]UnitStatus, error) { - return c.listUnitsInternal(c.sysobj.CallWithContext(ctx, "org.freedesktop.systemd1.Manager.ListUnitsFiltered", 0, states).Store) -} - -// Deprecated: use ListUnitsByPatternsContext instead. -func (c *Conn) ListUnitsByPatterns(states []string, patterns []string) ([]UnitStatus, error) { - return c.ListUnitsByPatternsContext(context.Background(), states, patterns) -} - -// ListUnitsByPatternsContext returns an array with units. -// It takes a list of units' statuses and names to filter. -// Note that units may be known by multiple names at the same time, -// and hence there might be more unit names loaded than actual units behind them. -func (c *Conn) ListUnitsByPatternsContext(ctx context.Context, states []string, patterns []string) ([]UnitStatus, error) { - return c.listUnitsInternal(c.sysobj.CallWithContext(ctx, "org.freedesktop.systemd1.Manager.ListUnitsByPatterns", 0, states, patterns).Store) -} - -// Deprecated: use ListUnitsByNamesContext instead. -func (c *Conn) ListUnitsByNames(units []string) ([]UnitStatus, error) { - return c.ListUnitsByNamesContext(context.Background(), units) -} - -// ListUnitsByNamesContext returns an array with units. It takes a list of units' -// names and returns an UnitStatus array. Comparing to ListUnitsByPatternsContext -// method, this method returns statuses even for inactive or non-existing -// units. Input array should contain exact unit names, but not patterns. -// -// Requires systemd v230 or higher. -func (c *Conn) ListUnitsByNamesContext(ctx context.Context, units []string) ([]UnitStatus, error) { - return c.listUnitsInternal(c.sysobj.CallWithContext(ctx, "org.freedesktop.systemd1.Manager.ListUnitsByNames", 0, units).Store) -} - -type UnitFile struct { - Path string - Type string -} - -func (c *Conn) listUnitFilesInternal(f storeFunc) ([]UnitFile, error) { - result := make([][]interface{}, 0) - err := f(&result) - if err != nil { - return nil, err - } - - resultInterface := make([]interface{}, len(result)) - for i := range result { - resultInterface[i] = result[i] - } - - files := make([]UnitFile, len(result)) - fileInterface := make([]interface{}, len(files)) - for i := range files { - fileInterface[i] = &files[i] - } - - err = dbus.Store(resultInterface, fileInterface...) - if err != nil { - return nil, err - } - - return files, nil -} - -// Deprecated: use ListUnitFilesContext instead. -func (c *Conn) ListUnitFiles() ([]UnitFile, error) { - return c.ListUnitFilesContext(context.Background()) -} - -// ListUnitFiles returns an array of all available units on disk. -func (c *Conn) ListUnitFilesContext(ctx context.Context) ([]UnitFile, error) { - return c.listUnitFilesInternal(c.sysobj.CallWithContext(ctx, "org.freedesktop.systemd1.Manager.ListUnitFiles", 0).Store) -} - -// Deprecated: use ListUnitFilesByPatternsContext instead. -func (c *Conn) ListUnitFilesByPatterns(states []string, patterns []string) ([]UnitFile, error) { - return c.ListUnitFilesByPatternsContext(context.Background(), states, patterns) -} - -// ListUnitFilesByPatternsContext returns an array of all available units on disk matched the patterns. -func (c *Conn) ListUnitFilesByPatternsContext(ctx context.Context, states []string, patterns []string) ([]UnitFile, error) { - return c.listUnitFilesInternal(c.sysobj.CallWithContext(ctx, "org.freedesktop.systemd1.Manager.ListUnitFilesByPatterns", 0, states, patterns).Store) -} - -type LinkUnitFileChange EnableUnitFileChange - -// Deprecated: use LinkUnitFilesContext instead. -func (c *Conn) LinkUnitFiles(files []string, runtime bool, force bool) ([]LinkUnitFileChange, error) { - return c.LinkUnitFilesContext(context.Background(), files, runtime, force) -} - -// LinkUnitFilesContext links unit files (that are located outside of the -// usual unit search paths) into the unit search path. -// -// It takes a list of absolute paths to unit files to link and two -// booleans. -// -// The first boolean controls whether the unit shall be -// enabled for runtime only (true, /run), or persistently (false, -// /etc). -// -// The second controls whether symlinks pointing to other units shall -// be replaced if necessary. -// -// This call returns a list of the changes made. The list consists of -// structures with three strings: the type of the change (one of symlink -// or unlink), the file name of the symlink and the destination of the -// symlink. -func (c *Conn) LinkUnitFilesContext(ctx context.Context, files []string, runtime bool, force bool) ([]LinkUnitFileChange, error) { - result := make([][]interface{}, 0) - err := c.sysobj.CallWithContext(ctx, "org.freedesktop.systemd1.Manager.LinkUnitFiles", 0, files, runtime, force).Store(&result) - if err != nil { - return nil, err - } - - resultInterface := make([]interface{}, len(result)) - for i := range result { - resultInterface[i] = result[i] - } - - changes := make([]LinkUnitFileChange, len(result)) - changesInterface := make([]interface{}, len(changes)) - for i := range changes { - changesInterface[i] = &changes[i] - } - - err = dbus.Store(resultInterface, changesInterface...) - if err != nil { - return nil, err - } - - return changes, nil -} - -// Deprecated: use EnableUnitFilesContext instead. -func (c *Conn) EnableUnitFiles(files []string, runtime bool, force bool) (bool, []EnableUnitFileChange, error) { - return c.EnableUnitFilesContext(context.Background(), files, runtime, force) -} - -// EnableUnitFilesContext may be used to enable one or more units in the system -// (by creating symlinks to them in /etc or /run). -// -// It takes a list of unit files to enable (either just file names or full -// absolute paths if the unit files are residing outside the usual unit -// search paths), and two booleans: the first controls whether the unit shall -// be enabled for runtime only (true, /run), or persistently (false, /etc). -// The second one controls whether symlinks pointing to other units shall -// be replaced if necessary. -// -// This call returns one boolean and an array with the changes made. The -// boolean signals whether the unit files contained any enablement -// information (i.e. an [Install]) section. The changes list consists of -// structures with three strings: the type of the change (one of symlink -// or unlink), the file name of the symlink and the destination of the -// symlink. -func (c *Conn) EnableUnitFilesContext(ctx context.Context, files []string, runtime bool, force bool) (bool, []EnableUnitFileChange, error) { - var carries_install_info bool - - result := make([][]interface{}, 0) - err := c.sysobj.CallWithContext(ctx, "org.freedesktop.systemd1.Manager.EnableUnitFiles", 0, files, runtime, force).Store(&carries_install_info, &result) - if err != nil { - return false, nil, err - } - - resultInterface := make([]interface{}, len(result)) - for i := range result { - resultInterface[i] = result[i] - } - - changes := make([]EnableUnitFileChange, len(result)) - changesInterface := make([]interface{}, len(changes)) - for i := range changes { - changesInterface[i] = &changes[i] - } - - err = dbus.Store(resultInterface, changesInterface...) - if err != nil { - return false, nil, err - } - - return carries_install_info, changes, nil -} - -type EnableUnitFileChange struct { - Type string // Type of the change (one of symlink or unlink) - Filename string // File name of the symlink - Destination string // Destination of the symlink -} - -// Deprecated: use DisableUnitFilesContext instead. -func (c *Conn) DisableUnitFiles(files []string, runtime bool) ([]DisableUnitFileChange, error) { - return c.DisableUnitFilesContext(context.Background(), files, runtime) -} - -// DisableUnitFilesContext may be used to disable one or more units in the -// system (by removing symlinks to them from /etc or /run). -// -// It takes a list of unit files to disable (either just file names or full -// absolute paths if the unit files are residing outside the usual unit -// search paths), and one boolean: whether the unit was enabled for runtime -// only (true, /run), or persistently (false, /etc). -// -// This call returns an array with the changes made. The changes list -// consists of structures with three strings: the type of the change (one of -// symlink or unlink), the file name of the symlink and the destination of the -// symlink. -func (c *Conn) DisableUnitFilesContext(ctx context.Context, files []string, runtime bool) ([]DisableUnitFileChange, error) { - result := make([][]interface{}, 0) - err := c.sysobj.CallWithContext(ctx, "org.freedesktop.systemd1.Manager.DisableUnitFiles", 0, files, runtime).Store(&result) - if err != nil { - return nil, err - } - - resultInterface := make([]interface{}, len(result)) - for i := range result { - resultInterface[i] = result[i] - } - - changes := make([]DisableUnitFileChange, len(result)) - changesInterface := make([]interface{}, len(changes)) - for i := range changes { - changesInterface[i] = &changes[i] - } - - err = dbus.Store(resultInterface, changesInterface...) - if err != nil { - return nil, err - } - - return changes, nil -} - -type DisableUnitFileChange struct { - Type string // Type of the change (one of symlink or unlink) - Filename string // File name of the symlink - Destination string // Destination of the symlink -} - -// Deprecated: use MaskUnitFilesContext instead. -func (c *Conn) MaskUnitFiles(files []string, runtime bool, force bool) ([]MaskUnitFileChange, error) { - return c.MaskUnitFilesContext(context.Background(), files, runtime, force) -} - -// MaskUnitFilesContext masks one or more units in the system. -// -// The files argument contains a list of units to mask (either just file names -// or full absolute paths if the unit files are residing outside the usual unit -// search paths). -// -// The runtime argument is used to specify whether the unit was enabled for -// runtime only (true, /run/systemd/..), or persistently (false, -// /etc/systemd/..). -func (c *Conn) MaskUnitFilesContext(ctx context.Context, files []string, runtime bool, force bool) ([]MaskUnitFileChange, error) { - result := make([][]interface{}, 0) - err := c.sysobj.CallWithContext(ctx, "org.freedesktop.systemd1.Manager.MaskUnitFiles", 0, files, runtime, force).Store(&result) - if err != nil { - return nil, err - } - - resultInterface := make([]interface{}, len(result)) - for i := range result { - resultInterface[i] = result[i] - } - - changes := make([]MaskUnitFileChange, len(result)) - changesInterface := make([]interface{}, len(changes)) - for i := range changes { - changesInterface[i] = &changes[i] - } - - err = dbus.Store(resultInterface, changesInterface...) - if err != nil { - return nil, err - } - - return changes, nil -} - -type MaskUnitFileChange struct { - Type string // Type of the change (one of symlink or unlink) - Filename string // File name of the symlink - Destination string // Destination of the symlink -} - -// Deprecated: use UnmaskUnitFilesContext instead. -func (c *Conn) UnmaskUnitFiles(files []string, runtime bool) ([]UnmaskUnitFileChange, error) { - return c.UnmaskUnitFilesContext(context.Background(), files, runtime) -} - -// UnmaskUnitFilesContext unmasks one or more units in the system. -// -// It takes the list of unit files to mask (either just file names or full -// absolute paths if the unit files are residing outside the usual unit search -// paths), and a boolean runtime flag to specify whether the unit was enabled -// for runtime only (true, /run/systemd/..), or persistently (false, -// /etc/systemd/..). -func (c *Conn) UnmaskUnitFilesContext(ctx context.Context, files []string, runtime bool) ([]UnmaskUnitFileChange, error) { - result := make([][]interface{}, 0) - err := c.sysobj.CallWithContext(ctx, "org.freedesktop.systemd1.Manager.UnmaskUnitFiles", 0, files, runtime).Store(&result) - if err != nil { - return nil, err - } - - resultInterface := make([]interface{}, len(result)) - for i := range result { - resultInterface[i] = result[i] - } - - changes := make([]UnmaskUnitFileChange, len(result)) - changesInterface := make([]interface{}, len(changes)) - for i := range changes { - changesInterface[i] = &changes[i] - } - - err = dbus.Store(resultInterface, changesInterface...) - if err != nil { - return nil, err - } - - return changes, nil -} - -type UnmaskUnitFileChange struct { - Type string // Type of the change (one of symlink or unlink) - Filename string // File name of the symlink - Destination string // Destination of the symlink -} - -// Deprecated: use ReloadContext instead. -func (c *Conn) Reload() error { - return c.ReloadContext(context.Background()) -} - -// ReloadContext instructs systemd to scan for and reload unit files. This is -// an equivalent to systemctl daemon-reload. -func (c *Conn) ReloadContext(ctx context.Context) error { - return c.sysobj.CallWithContext(ctx, "org.freedesktop.systemd1.Manager.Reload", 0).Store() -} - -func unitPath(name string) dbus.ObjectPath { - return dbus.ObjectPath("/org/freedesktop/systemd1/unit/" + PathBusEscape(name)) -} - -// unitName returns the unescaped base element of the supplied escaped path. -func unitName(dpath dbus.ObjectPath) string { - return pathBusUnescape(path.Base(string(dpath))) -} - -// JobStatus holds a currently queued job definition. -type JobStatus struct { - Id uint32 // The numeric job id - Unit string // The primary unit name for this job - JobType string // The job type as string - Status string // The job state as string - JobPath dbus.ObjectPath // The job object path - UnitPath dbus.ObjectPath // The unit object path -} - -// Deprecated: use ListJobsContext instead. -func (c *Conn) ListJobs() ([]JobStatus, error) { - return c.ListJobsContext(context.Background()) -} - -// ListJobsContext returns an array with all currently queued jobs. -func (c *Conn) ListJobsContext(ctx context.Context) ([]JobStatus, error) { - return c.listJobsInternal(ctx) -} - -func (c *Conn) listJobsInternal(ctx context.Context) ([]JobStatus, error) { - result := make([][]interface{}, 0) - if err := c.sysobj.CallWithContext(ctx, "org.freedesktop.systemd1.Manager.ListJobs", 0).Store(&result); err != nil { - return nil, err - } - - resultInterface := make([]interface{}, len(result)) - for i := range result { - resultInterface[i] = result[i] - } - - status := make([]JobStatus, len(result)) - statusInterface := make([]interface{}, len(status)) - for i := range status { - statusInterface[i] = &status[i] - } - - if err := dbus.Store(resultInterface, statusInterface...); err != nil { - return nil, err - } - - return status, nil -} diff --git a/vendor/github.com/coreos/go-systemd/v22/dbus/properties.go b/vendor/github.com/coreos/go-systemd/v22/dbus/properties.go deleted file mode 100644 index fb42b62733..0000000000 --- a/vendor/github.com/coreos/go-systemd/v22/dbus/properties.go +++ /dev/null @@ -1,237 +0,0 @@ -// Copyright 2015 CoreOS, Inc. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -package dbus - -import ( - "github.com/godbus/dbus/v5" -) - -// From the systemd docs: -// -// The properties array of StartTransientUnit() may take many of the settings -// that may also be configured in unit files. Not all parameters are currently -// accepted though, but we plan to cover more properties with future release. -// Currently you may set the Description, Slice and all dependency types of -// units, as well as RemainAfterExit, ExecStart for service units, -// TimeoutStopUSec and PIDs for scope units, and CPUAccounting, CPUShares, -// BlockIOAccounting, BlockIOWeight, BlockIOReadBandwidth, -// BlockIOWriteBandwidth, BlockIODeviceWeight, MemoryAccounting, MemoryLimit, -// DevicePolicy, DeviceAllow for services/scopes/slices. These fields map -// directly to their counterparts in unit files and as normal D-Bus object -// properties. The exception here is the PIDs field of scope units which is -// used for construction of the scope only and specifies the initial PIDs to -// add to the scope object. - -type Property struct { - Name string - Value dbus.Variant -} - -type PropertyCollection struct { - Name string - Properties []Property -} - -type execStart struct { - Path string // the binary path to execute - Args []string // an array with all arguments to pass to the executed command, starting with argument 0 - UncleanIsFailure bool // a boolean whether it should be considered a failure if the process exits uncleanly -} - -// PropExecStart sets the ExecStart service property. The first argument is a -// slice with the binary path to execute followed by the arguments to pass to -// the executed command. See -// http://www.freedesktop.org/software/systemd/man/systemd.service.html#ExecStart= -func PropExecStart(command []string, uncleanIsFailure bool) Property { - execStarts := []execStart{ - { - Path: command[0], - Args: command, - UncleanIsFailure: uncleanIsFailure, - }, - } - - return Property{ - Name: "ExecStart", - Value: dbus.MakeVariant(execStarts), - } -} - -// PropRemainAfterExit sets the RemainAfterExit service property. See -// http://www.freedesktop.org/software/systemd/man/systemd.service.html#RemainAfterExit= -func PropRemainAfterExit(b bool) Property { - return Property{ - Name: "RemainAfterExit", - Value: dbus.MakeVariant(b), - } -} - -// PropType sets the Type service property. See -// http://www.freedesktop.org/software/systemd/man/systemd.service.html#Type= -func PropType(t string) Property { - return Property{ - Name: "Type", - Value: dbus.MakeVariant(t), - } -} - -// PropDescription sets the Description unit property. See -// http://www.freedesktop.org/software/systemd/man/systemd.unit#Description= -func PropDescription(desc string) Property { - return Property{ - Name: "Description", - Value: dbus.MakeVariant(desc), - } -} - -func propDependency(name string, units []string) Property { - return Property{ - Name: name, - Value: dbus.MakeVariant(units), - } -} - -// PropRequires sets the Requires unit property. See -// http://www.freedesktop.org/software/systemd/man/systemd.unit.html#Requires= -func PropRequires(units ...string) Property { - return propDependency("Requires", units) -} - -// PropRequiresOverridable sets the RequiresOverridable unit property. See -// http://www.freedesktop.org/software/systemd/man/systemd.unit.html#RequiresOverridable= -func PropRequiresOverridable(units ...string) Property { - return propDependency("RequiresOverridable", units) -} - -// PropRequisite sets the Requisite unit property. See -// http://www.freedesktop.org/software/systemd/man/systemd.unit.html#Requisite= -func PropRequisite(units ...string) Property { - return propDependency("Requisite", units) -} - -// PropRequisiteOverridable sets the RequisiteOverridable unit property. See -// http://www.freedesktop.org/software/systemd/man/systemd.unit.html#RequisiteOverridable= -func PropRequisiteOverridable(units ...string) Property { - return propDependency("RequisiteOverridable", units) -} - -// PropWants sets the Wants unit property. See -// http://www.freedesktop.org/software/systemd/man/systemd.unit.html#Wants= -func PropWants(units ...string) Property { - return propDependency("Wants", units) -} - -// PropBindsTo sets the BindsTo unit property. See -// http://www.freedesktop.org/software/systemd/man/systemd.unit.html#BindsTo= -func PropBindsTo(units ...string) Property { - return propDependency("BindsTo", units) -} - -// PropRequiredBy sets the RequiredBy unit property. See -// http://www.freedesktop.org/software/systemd/man/systemd.unit.html#RequiredBy= -func PropRequiredBy(units ...string) Property { - return propDependency("RequiredBy", units) -} - -// PropRequiredByOverridable sets the RequiredByOverridable unit property. See -// http://www.freedesktop.org/software/systemd/man/systemd.unit.html#RequiredByOverridable= -func PropRequiredByOverridable(units ...string) Property { - return propDependency("RequiredByOverridable", units) -} - -// PropWantedBy sets the WantedBy unit property. See -// http://www.freedesktop.org/software/systemd/man/systemd.unit.html#WantedBy= -func PropWantedBy(units ...string) Property { - return propDependency("WantedBy", units) -} - -// PropBoundBy sets the BoundBy unit property. See -// http://www.freedesktop.org/software/systemd/main/systemd.unit.html#BoundBy= -func PropBoundBy(units ...string) Property { - return propDependency("BoundBy", units) -} - -// PropConflicts sets the Conflicts unit property. See -// http://www.freedesktop.org/software/systemd/man/systemd.unit.html#Conflicts= -func PropConflicts(units ...string) Property { - return propDependency("Conflicts", units) -} - -// PropConflictedBy sets the ConflictedBy unit property. See -// http://www.freedesktop.org/software/systemd/man/systemd.unit.html#ConflictedBy= -func PropConflictedBy(units ...string) Property { - return propDependency("ConflictedBy", units) -} - -// PropBefore sets the Before unit property. See -// http://www.freedesktop.org/software/systemd/man/systemd.unit.html#Before= -func PropBefore(units ...string) Property { - return propDependency("Before", units) -} - -// PropAfter sets the After unit property. See -// http://www.freedesktop.org/software/systemd/man/systemd.unit.html#After= -func PropAfter(units ...string) Property { - return propDependency("After", units) -} - -// PropOnFailure sets the OnFailure unit property. See -// http://www.freedesktop.org/software/systemd/man/systemd.unit.html#OnFailure= -func PropOnFailure(units ...string) Property { - return propDependency("OnFailure", units) -} - -// PropTriggers sets the Triggers unit property. See -// http://www.freedesktop.org/software/systemd/man/systemd.unit.html#Triggers= -func PropTriggers(units ...string) Property { - return propDependency("Triggers", units) -} - -// PropTriggeredBy sets the TriggeredBy unit property. See -// http://www.freedesktop.org/software/systemd/man/systemd.unit.html#TriggeredBy= -func PropTriggeredBy(units ...string) Property { - return propDependency("TriggeredBy", units) -} - -// PropPropagatesReloadTo sets the PropagatesReloadTo unit property. See -// http://www.freedesktop.org/software/systemd/man/systemd.unit.html#PropagatesReloadTo= -func PropPropagatesReloadTo(units ...string) Property { - return propDependency("PropagatesReloadTo", units) -} - -// PropRequiresMountsFor sets the RequiresMountsFor unit property. See -// http://www.freedesktop.org/software/systemd/man/systemd.unit.html#RequiresMountsFor= -func PropRequiresMountsFor(units ...string) Property { - return propDependency("RequiresMountsFor", units) -} - -// PropSlice sets the Slice unit property. See -// http://www.freedesktop.org/software/systemd/man/systemd.resource-control.html#Slice= -func PropSlice(slice string) Property { - return Property{ - Name: "Slice", - Value: dbus.MakeVariant(slice), - } -} - -// PropPids sets the PIDs field of scope units used in the initial construction -// of the scope only and specifies the initial PIDs to add to the scope object. -// See https://www.freedesktop.org/wiki/Software/systemd/ControlGroupInterface/#properties -func PropPids(pids ...uint32) Property { - return Property{ - Name: "PIDs", - Value: dbus.MakeVariant(pids), - } -} diff --git a/vendor/github.com/coreos/go-systemd/v22/dbus/subscription.go b/vendor/github.com/coreos/go-systemd/v22/dbus/subscription.go deleted file mode 100644 index 7e370fea21..0000000000 --- a/vendor/github.com/coreos/go-systemd/v22/dbus/subscription.go +++ /dev/null @@ -1,333 +0,0 @@ -// Copyright 2015 CoreOS, Inc. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -package dbus - -import ( - "errors" - "log" - "time" - - "github.com/godbus/dbus/v5" -) - -const ( - cleanIgnoreInterval = int64(10 * time.Second) - ignoreInterval = int64(30 * time.Millisecond) -) - -// Subscribe sets up this connection to subscribe to all systemd dbus events. -// This is required before calling SubscribeUnits. When the connection closes -// systemd will automatically stop sending signals so there is no need to -// explicitly call Unsubscribe(). -func (c *Conn) Subscribe() error { - c.sigconn.BusObject().Call("org.freedesktop.DBus.AddMatch", 0, - "type='signal',interface='org.freedesktop.systemd1.Manager',member='UnitNew'") - c.sigconn.BusObject().Call("org.freedesktop.DBus.AddMatch", 0, - "type='signal',interface='org.freedesktop.DBus.Properties',member='PropertiesChanged'") - - return c.sigobj.Call("org.freedesktop.systemd1.Manager.Subscribe", 0).Store() -} - -// Unsubscribe this connection from systemd dbus events. -func (c *Conn) Unsubscribe() error { - return c.sigobj.Call("org.freedesktop.systemd1.Manager.Unsubscribe", 0).Store() -} - -func (c *Conn) dispatch() { - ch := make(chan *dbus.Signal, signalBuffer) - - c.sigconn.Signal(ch) - - go func() { - for { - signal, ok := <-ch - if !ok { - return - } - - if signal.Name == "org.freedesktop.systemd1.Manager.JobRemoved" { - c.jobComplete(signal) - } - - if c.subStateSubscriber.updateCh == nil && - c.propertiesSubscriber.updateCh == nil { - continue - } - - var unitPath dbus.ObjectPath - switch signal.Name { - case "org.freedesktop.systemd1.Manager.JobRemoved": - unitName := signal.Body[2].(string) - c.sysobj.Call("org.freedesktop.systemd1.Manager.GetUnit", 0, unitName).Store(&unitPath) - case "org.freedesktop.systemd1.Manager.UnitNew": - unitPath = signal.Body[1].(dbus.ObjectPath) - case "org.freedesktop.DBus.Properties.PropertiesChanged": - if signal.Body[0].(string) == "org.freedesktop.systemd1.Unit" { - unitPath = signal.Path - - if len(signal.Body) >= 2 { - if changed, ok := signal.Body[1].(map[string]dbus.Variant); ok { - c.sendPropertiesUpdate(unitPath, changed) - } - } - } - } - - if unitPath == dbus.ObjectPath("") { - continue - } - - c.sendSubStateUpdate(unitPath) - } - }() -} - -// SubscribeUnits returns two unbuffered channels which will receive all changed units every -// interval. Deleted units are sent as nil. -func (c *Conn) SubscribeUnits(interval time.Duration) (<-chan map[string]*UnitStatus, <-chan error) { - return c.SubscribeUnitsCustom(interval, 0, func(u1, u2 *UnitStatus) bool { return *u1 != *u2 }, nil) -} - -// SubscribeUnitsCustom is like SubscribeUnits but lets you specify the buffer -// size of the channels, the comparison function for detecting changes and a filter -// function for cutting down on the noise that your channel receives. -func (c *Conn) SubscribeUnitsCustom(interval time.Duration, buffer int, isChanged func(*UnitStatus, *UnitStatus) bool, filterUnit func(string) bool) (<-chan map[string]*UnitStatus, <-chan error) { - old := make(map[string]*UnitStatus) - statusChan := make(chan map[string]*UnitStatus, buffer) - errChan := make(chan error, buffer) - - go func() { - for { - timerChan := time.After(interval) - - units, err := c.ListUnits() - if err == nil { - cur := make(map[string]*UnitStatus) - for i := range units { - if filterUnit != nil && filterUnit(units[i].Name) { - continue - } - cur[units[i].Name] = &units[i] - } - - // add all new or changed units - changed := make(map[string]*UnitStatus) - for n, u := range cur { - if oldU, ok := old[n]; !ok || isChanged(oldU, u) { - changed[n] = u - } - delete(old, n) - } - - // add all deleted units - for oldN := range old { - changed[oldN] = nil - } - - old = cur - - if len(changed) != 0 { - statusChan <- changed - } - } else { - errChan <- err - } - - <-timerChan - } - }() - - return statusChan, errChan -} - -type SubStateUpdate struct { - UnitName string - SubState string -} - -// SetSubStateSubscriber writes to updateCh when any unit's substate changes. -// Although this writes to updateCh on every state change, the reported state -// may be more recent than the change that generated it (due to an unavoidable -// race in the systemd dbus interface). That is, this method provides a good -// way to keep a current view of all units' states, but is not guaranteed to -// show every state transition they go through. Furthermore, state changes -// will only be written to the channel with non-blocking writes. If updateCh -// is full, it attempts to write an error to errCh; if errCh is full, the error -// passes silently. -func (c *Conn) SetSubStateSubscriber(updateCh chan<- *SubStateUpdate, errCh chan<- error) { - if c == nil { - msg := "nil receiver" - select { - case errCh <- errors.New(msg): - default: - log.Printf("full error channel while reporting: %s\n", msg) - } - return - } - - c.subStateSubscriber.Lock() - defer c.subStateSubscriber.Unlock() - c.subStateSubscriber.updateCh = updateCh - c.subStateSubscriber.errCh = errCh -} - -func (c *Conn) sendSubStateUpdate(unitPath dbus.ObjectPath) { - c.subStateSubscriber.Lock() - defer c.subStateSubscriber.Unlock() - - if c.subStateSubscriber.updateCh == nil { - return - } - - isIgnored := c.shouldIgnore(unitPath) - defer c.cleanIgnore() - if isIgnored { - return - } - - info, err := c.GetUnitPathProperties(unitPath) - if err != nil { - select { - case c.subStateSubscriber.errCh <- err: - default: - log.Printf("full error channel while reporting: %s\n", err) - } - return - } - defer c.updateIgnore(unitPath, info) - - name, ok := info["Id"].(string) - if !ok { - msg := "failed to cast info.Id" - select { - case c.subStateSubscriber.errCh <- errors.New(msg): - default: - log.Printf("full error channel while reporting: %s\n", err) - } - return - } - substate, ok := info["SubState"].(string) - if !ok { - msg := "failed to cast info.SubState" - select { - case c.subStateSubscriber.errCh <- errors.New(msg): - default: - log.Printf("full error channel while reporting: %s\n", msg) - } - return - } - - update := &SubStateUpdate{name, substate} - select { - case c.subStateSubscriber.updateCh <- update: - default: - msg := "update channel is full" - select { - case c.subStateSubscriber.errCh <- errors.New(msg): - default: - log.Printf("full error channel while reporting: %s\n", msg) - } - return - } -} - -// The ignore functions work around a wart in the systemd dbus interface. -// Requesting the properties of an unloaded unit will cause systemd to send a -// pair of UnitNew/UnitRemoved signals. Because we need to get a unit's -// properties on UnitNew (as that's the only indication of a new unit coming up -// for the first time), we would enter an infinite loop if we did not attempt -// to detect and ignore these spurious signals. The signal themselves are -// indistinguishable from relevant ones, so we (somewhat hackishly) ignore an -// unloaded unit's signals for a short time after requesting its properties. -// This means that we will miss e.g. a transient unit being restarted -// *immediately* upon failure and also a transient unit being started -// immediately after requesting its status (with systemctl status, for example, -// because this causes a UnitNew signal to be sent which then causes us to fetch -// the properties). - -func (c *Conn) shouldIgnore(path dbus.ObjectPath) bool { - t, ok := c.subStateSubscriber.ignore[path] - return ok && t >= time.Now().UnixNano() -} - -func (c *Conn) updateIgnore(path dbus.ObjectPath, info map[string]interface{}) { - loadState, ok := info["LoadState"].(string) - if !ok { - return - } - - // unit is unloaded - it will trigger bad systemd dbus behavior - if loadState == "not-found" { - c.subStateSubscriber.ignore[path] = time.Now().UnixNano() + ignoreInterval - } -} - -// without this, ignore would grow unboundedly over time -func (c *Conn) cleanIgnore() { - now := time.Now().UnixNano() - if c.subStateSubscriber.cleanIgnore < now { - c.subStateSubscriber.cleanIgnore = now + cleanIgnoreInterval - - for p, t := range c.subStateSubscriber.ignore { - if t < now { - delete(c.subStateSubscriber.ignore, p) - } - } - } -} - -// PropertiesUpdate holds a map of a unit's changed properties -type PropertiesUpdate struct { - UnitName string - Changed map[string]dbus.Variant -} - -// SetPropertiesSubscriber writes to updateCh when any unit's properties -// change. Every property change reported by systemd will be sent; that is, no -// transitions will be "missed" (as they might be with SetSubStateSubscriber). -// However, state changes will only be written to the channel with non-blocking -// writes. If updateCh is full, it attempts to write an error to errCh; if -// errCh is full, the error passes silently. -func (c *Conn) SetPropertiesSubscriber(updateCh chan<- *PropertiesUpdate, errCh chan<- error) { - c.propertiesSubscriber.Lock() - defer c.propertiesSubscriber.Unlock() - c.propertiesSubscriber.updateCh = updateCh - c.propertiesSubscriber.errCh = errCh -} - -// we don't need to worry about shouldIgnore() here because -// sendPropertiesUpdate doesn't call GetProperties() -func (c *Conn) sendPropertiesUpdate(unitPath dbus.ObjectPath, changedProps map[string]dbus.Variant) { - c.propertiesSubscriber.Lock() - defer c.propertiesSubscriber.Unlock() - - if c.propertiesSubscriber.updateCh == nil { - return - } - - update := &PropertiesUpdate{unitName(unitPath), changedProps} - - select { - case c.propertiesSubscriber.updateCh <- update: - default: - msg := "update channel is full" - select { - case c.propertiesSubscriber.errCh <- errors.New(msg): - default: - log.Printf("full error channel while reporting: %s\n", msg) - } - return - } -} diff --git a/vendor/github.com/coreos/go-systemd/v22/dbus/subscription_set.go b/vendor/github.com/coreos/go-systemd/v22/dbus/subscription_set.go deleted file mode 100644 index 5b408d5847..0000000000 --- a/vendor/github.com/coreos/go-systemd/v22/dbus/subscription_set.go +++ /dev/null @@ -1,57 +0,0 @@ -// Copyright 2015 CoreOS, Inc. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -package dbus - -import ( - "time" -) - -// SubscriptionSet returns a subscription set which is like conn.Subscribe but -// can filter to only return events for a set of units. -type SubscriptionSet struct { - *set - conn *Conn -} - -func (s *SubscriptionSet) filter(unit string) bool { - return !s.Contains(unit) -} - -// Subscribe starts listening for dbus events for all of the units in the set. -// Returns channels identical to conn.SubscribeUnits. -func (s *SubscriptionSet) Subscribe() (<-chan map[string]*UnitStatus, <-chan error) { - // TODO: Make fully evented by using systemd 209 with properties changed values - return s.conn.SubscribeUnitsCustom(time.Second, 0, - mismatchUnitStatus, - func(unit string) bool { return s.filter(unit) }, - ) -} - -// NewSubscriptionSet returns a new subscription set. -func (conn *Conn) NewSubscriptionSet() *SubscriptionSet { - return &SubscriptionSet{newSet(), conn} -} - -// mismatchUnitStatus returns true if the provided UnitStatus objects -// are not equivalent. false is returned if the objects are equivalent. -// Only the Name, Description and state-related fields are used in -// the comparison. -func mismatchUnitStatus(u1, u2 *UnitStatus) bool { - return u1.Name != u2.Name || - u1.Description != u2.Description || - u1.LoadState != u2.LoadState || - u1.ActiveState != u2.ActiveState || - u1.SubState != u2.SubState -} diff --git a/vendor/github.com/docker/go-units/CONTRIBUTING.md b/vendor/github.com/docker/go-units/CONTRIBUTING.md deleted file mode 100644 index 9ea86d784e..0000000000 --- a/vendor/github.com/docker/go-units/CONTRIBUTING.md +++ /dev/null @@ -1,67 +0,0 @@ -# Contributing to go-units - -Want to hack on go-units? Awesome! Here are instructions to get you started. - -go-units is a part of the [Docker](https://www.docker.com) project, and follows -the same rules and principles. If you're already familiar with the way -Docker does things, you'll feel right at home. - -Otherwise, go read Docker's -[contributions guidelines](https://github.com/docker/docker/blob/master/CONTRIBUTING.md), -[issue triaging](https://github.com/docker/docker/blob/master/project/ISSUE-TRIAGE.md), -[review process](https://github.com/docker/docker/blob/master/project/REVIEWING.md) and -[branches and tags](https://github.com/docker/docker/blob/master/project/BRANCHES-AND-TAGS.md). - -### Sign your work - -The sign-off is a simple line at the end of the explanation for the patch. Your -signature certifies that you wrote the patch or otherwise have the right to pass -it on as an open-source patch. The rules are pretty simple: if you can certify -the below (from [developercertificate.org](http://developercertificate.org/)): - -``` -Developer Certificate of Origin -Version 1.1 - -Copyright (C) 2004, 2006 The Linux Foundation and its contributors. -660 York Street, Suite 102, -San Francisco, CA 94110 USA - -Everyone is permitted to copy and distribute verbatim copies of this -license document, but changing it is not allowed. - -Developer's Certificate of Origin 1.1 - -By making a contribution to this project, I certify that: - -(a) The contribution was created in whole or in part by me and I - have the right to submit it under the open source license - indicated in the file; or - -(b) The contribution is based upon previous work that, to the best - of my knowledge, is covered under an appropriate open source - license and I have the right under that license to submit that - work with modifications, whether created in whole or in part - by me, under the same open source license (unless I am - permitted to submit under a different license), as indicated - in the file; or - -(c) The contribution was provided directly to me by some other - person who certified (a), (b) or (c) and I have not modified - it. - -(d) I understand and agree that this project and the contribution - are public and that a record of the contribution (including all - personal information I submit with it, including my sign-off) is - maintained indefinitely and may be redistributed consistent with - this project or the open source license(s) involved. -``` - -Then you just add a line to every git commit message: - - Signed-off-by: Joe Smith - -Use your real name (sorry, no pseudonyms or anonymous contributions.) - -If you set your `user.name` and `user.email` git configs, you can sign your -commit automatically with `git commit -s`. diff --git a/vendor/github.com/docker/go-units/LICENSE b/vendor/github.com/docker/go-units/LICENSE deleted file mode 100644 index b55b37bc31..0000000000 --- a/vendor/github.com/docker/go-units/LICENSE +++ /dev/null @@ -1,191 +0,0 @@ - - Apache License - Version 2.0, January 2004 - https://www.apache.org/licenses/ - - TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION - - 1. Definitions. - - "License" shall mean the terms and conditions for use, reproduction, - and distribution as defined by Sections 1 through 9 of this document. - - "Licensor" shall mean the copyright owner or entity authorized by - the copyright owner that is granting the License. - - "Legal Entity" shall mean the union of the acting entity and all - other entities that control, are controlled by, or are under common - control with that entity. For the purposes of this definition, - "control" means (i) the power, direct or indirect, to cause the - direction or management of such entity, whether by contract or - otherwise, or (ii) ownership of fifty percent (50%) or more of the - outstanding shares, or (iii) beneficial ownership of such entity. - - "You" (or "Your") shall mean an individual or Legal Entity - exercising permissions granted by this License. - - "Source" form shall mean the preferred form for making modifications, - including but not limited to software source code, documentation - source, and configuration files. - - "Object" form shall mean any form resulting from mechanical - transformation or translation of a Source form, including but - not limited to compiled object code, generated documentation, - and conversions to other media types. - - "Work" shall mean the work of authorship, whether in Source or - Object form, made available under the License, as indicated by a - copyright notice that is included in or attached to the work - (an example is provided in the Appendix below). - - "Derivative Works" shall mean any work, whether in Source or Object - form, that is based on (or derived from) the Work and for which the - editorial revisions, annotations, elaborations, or other modifications - represent, as a whole, an original work of authorship. For the purposes - of this License, Derivative Works shall not include works that remain - separable from, or merely link (or bind by name) to the interfaces of, - the Work and Derivative Works thereof. - - "Contribution" shall mean any work of authorship, including - the original version of the Work and any modifications or additions - to that Work or Derivative Works thereof, that is intentionally - submitted to Licensor for inclusion in the Work by the copyright owner - or by an individual or Legal Entity authorized to submit on behalf of - the copyright owner. For the purposes of this definition, "submitted" - means any form of electronic, verbal, or written communication sent - to the Licensor or its representatives, including but not limited to - communication on electronic mailing lists, source code control systems, - and issue tracking systems that are managed by, or on behalf of, the - Licensor for the purpose of discussing and improving the Work, but - excluding communication that is conspicuously marked or otherwise - designated in writing by the copyright owner as "Not a Contribution." - - "Contributor" shall mean Licensor and any individual or Legal Entity - on behalf of whom a Contribution has been received by Licensor and - subsequently incorporated within the Work. - - 2. Grant of Copyright License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - copyright license to reproduce, prepare Derivative Works of, - publicly display, publicly perform, sublicense, and distribute the - Work and such Derivative Works in Source or Object form. - - 3. Grant of Patent License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - (except as stated in this section) patent license to make, have made, - use, offer to sell, sell, import, and otherwise transfer the Work, - where such license applies only to those patent claims licensable - by such Contributor that are necessarily infringed by their - Contribution(s) alone or by combination of their Contribution(s) - with the Work to which such Contribution(s) was submitted. If You - institute patent litigation against any entity (including a - cross-claim or counterclaim in a lawsuit) alleging that the Work - or a Contribution incorporated within the Work constitutes direct - or contributory patent infringement, then any patent licenses - granted to You under this License for that Work shall terminate - as of the date such litigation is filed. - - 4. Redistribution. You may reproduce and distribute copies of the - Work or Derivative Works thereof in any medium, with or without - modifications, and in Source or Object form, provided that You - meet the following conditions: - - (a) You must give any other recipients of the Work or - Derivative Works a copy of this License; and - - (b) You must cause any modified files to carry prominent notices - stating that You changed the files; and - - (c) You must retain, in the Source form of any Derivative Works - that You distribute, all copyright, patent, trademark, and - attribution notices from the Source form of the Work, - excluding those notices that do not pertain to any part of - the Derivative Works; and - - (d) If the Work includes a "NOTICE" text file as part of its - distribution, then any Derivative Works that You distribute must - include a readable copy of the attribution notices contained - within such NOTICE file, excluding those notices that do not - pertain to any part of the Derivative Works, in at least one - of the following places: within a NOTICE text file distributed - as part of the Derivative Works; within the Source form or - documentation, if provided along with the Derivative Works; or, - within a display generated by the Derivative Works, if and - wherever such third-party notices normally appear. The contents - of the NOTICE file are for informational purposes only and - do not modify the License. You may add Your own attribution - notices within Derivative Works that You distribute, alongside - or as an addendum to the NOTICE text from the Work, provided - that such additional attribution notices cannot be construed - as modifying the License. - - You may add Your own copyright statement to Your modifications and - may provide additional or different license terms and conditions - for use, reproduction, or distribution of Your modifications, or - for any such Derivative Works as a whole, provided Your use, - reproduction, and distribution of the Work otherwise complies with - the conditions stated in this License. - - 5. Submission of Contributions. Unless You explicitly state otherwise, - any Contribution intentionally submitted for inclusion in the Work - by You to the Licensor shall be under the terms and conditions of - this License, without any additional terms or conditions. - Notwithstanding the above, nothing herein shall supersede or modify - the terms of any separate license agreement you may have executed - with Licensor regarding such Contributions. - - 6. Trademarks. This License does not grant permission to use the trade - names, trademarks, service marks, or product names of the Licensor, - except as required for reasonable and customary use in describing the - origin of the Work and reproducing the content of the NOTICE file. - - 7. Disclaimer of Warranty. Unless required by applicable law or - agreed to in writing, Licensor provides the Work (and each - Contributor provides its Contributions) on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or - implied, including, without limitation, any warranties or conditions - of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A - PARTICULAR PURPOSE. You are solely responsible for determining the - appropriateness of using or redistributing the Work and assume any - risks associated with Your exercise of permissions under this License. - - 8. Limitation of Liability. In no event and under no legal theory, - whether in tort (including negligence), contract, or otherwise, - unless required by applicable law (such as deliberate and grossly - negligent acts) or agreed to in writing, shall any Contributor be - liable to You for damages, including any direct, indirect, special, - incidental, or consequential damages of any character arising as a - result of this License or out of the use or inability to use the - Work (including but not limited to damages for loss of goodwill, - work stoppage, computer failure or malfunction, or any and all - other commercial damages or losses), even if such Contributor - has been advised of the possibility of such damages. - - 9. Accepting Warranty or Additional Liability. While redistributing - the Work or Derivative Works thereof, You may choose to offer, - and charge a fee for, acceptance of support, warranty, indemnity, - or other liability obligations and/or rights consistent with this - License. However, in accepting such obligations, You may act only - on Your own behalf and on Your sole responsibility, not on behalf - of any other Contributor, and only if You agree to indemnify, - defend, and hold each Contributor harmless for any liability - incurred by, or claims asserted against, such Contributor by reason - of your accepting any such warranty or additional liability. - - END OF TERMS AND CONDITIONS - - Copyright 2015 Docker, Inc. - - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - https://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. diff --git a/vendor/github.com/docker/go-units/MAINTAINERS b/vendor/github.com/docker/go-units/MAINTAINERS deleted file mode 100644 index 4aac7c7411..0000000000 --- a/vendor/github.com/docker/go-units/MAINTAINERS +++ /dev/null @@ -1,46 +0,0 @@ -# go-units maintainers file -# -# This file describes who runs the docker/go-units project and how. -# This is a living document - if you see something out of date or missing, speak up! -# -# It is structured to be consumable by both humans and programs. -# To extract its contents programmatically, use any TOML-compliant parser. -# -# This file is compiled into the MAINTAINERS file in docker/opensource. -# -[Org] - [Org."Core maintainers"] - people = [ - "akihirosuda", - "dnephin", - "thajeztah", - "vdemeester", - ] - -[people] - -# A reference list of all people associated with the project. -# All other sections should refer to people by their canonical key -# in the people section. - - # ADD YOURSELF HERE IN ALPHABETICAL ORDER - - [people.akihirosuda] - Name = "Akihiro Suda" - Email = "akihiro.suda.cz@hco.ntt.co.jp" - GitHub = "AkihiroSuda" - - [people.dnephin] - Name = "Daniel Nephin" - Email = "dnephin@gmail.com" - GitHub = "dnephin" - - [people.thajeztah] - Name = "Sebastiaan van Stijn" - Email = "github@gone.nl" - GitHub = "thaJeztah" - - [people.vdemeester] - Name = "Vincent Demeester" - Email = "vincent@sbr.pm" - GitHub = "vdemeester" \ No newline at end of file diff --git a/vendor/github.com/docker/go-units/README.md b/vendor/github.com/docker/go-units/README.md deleted file mode 100644 index 4f70a4e134..0000000000 --- a/vendor/github.com/docker/go-units/README.md +++ /dev/null @@ -1,16 +0,0 @@ -[![GoDoc](https://godoc.org/github.com/docker/go-units?status.svg)](https://godoc.org/github.com/docker/go-units) - -# Introduction - -go-units is a library to transform human friendly measurements into machine friendly values. - -## Usage - -See the [docs in godoc](https://godoc.org/github.com/docker/go-units) for examples and documentation. - -## Copyright and license - -Copyright © 2015 Docker, Inc. - -go-units is licensed under the Apache License, Version 2.0. -See [LICENSE](LICENSE) for the full text of the license. diff --git a/vendor/github.com/docker/go-units/circle.yml b/vendor/github.com/docker/go-units/circle.yml deleted file mode 100644 index af9d605529..0000000000 --- a/vendor/github.com/docker/go-units/circle.yml +++ /dev/null @@ -1,11 +0,0 @@ -dependencies: - post: - # install golint - - go get golang.org/x/lint/golint - -test: - pre: - # run analysis before tests - - go vet ./... - - test -z "$(golint ./... | tee /dev/stderr)" - - test -z "$(gofmt -s -l . | tee /dev/stderr)" diff --git a/vendor/github.com/docker/go-units/duration.go b/vendor/github.com/docker/go-units/duration.go deleted file mode 100644 index 48dd8744d4..0000000000 --- a/vendor/github.com/docker/go-units/duration.go +++ /dev/null @@ -1,35 +0,0 @@ -// Package units provides helper function to parse and print size and time units -// in human-readable format. -package units - -import ( - "fmt" - "time" -) - -// HumanDuration returns a human-readable approximation of a duration -// (eg. "About a minute", "4 hours ago", etc.). -func HumanDuration(d time.Duration) string { - if seconds := int(d.Seconds()); seconds < 1 { - return "Less than a second" - } else if seconds == 1 { - return "1 second" - } else if seconds < 60 { - return fmt.Sprintf("%d seconds", seconds) - } else if minutes := int(d.Minutes()); minutes == 1 { - return "About a minute" - } else if minutes < 60 { - return fmt.Sprintf("%d minutes", minutes) - } else if hours := int(d.Hours() + 0.5); hours == 1 { - return "About an hour" - } else if hours < 48 { - return fmt.Sprintf("%d hours", hours) - } else if hours < 24*7*2 { - return fmt.Sprintf("%d days", hours/24) - } else if hours < 24*30*2 { - return fmt.Sprintf("%d weeks", hours/24/7) - } else if hours < 24*365*2 { - return fmt.Sprintf("%d months", hours/24/30) - } - return fmt.Sprintf("%d years", int(d.Hours())/24/365) -} diff --git a/vendor/github.com/docker/go-units/size.go b/vendor/github.com/docker/go-units/size.go deleted file mode 100644 index 85f6ab0715..0000000000 --- a/vendor/github.com/docker/go-units/size.go +++ /dev/null @@ -1,108 +0,0 @@ -package units - -import ( - "fmt" - "regexp" - "strconv" - "strings" -) - -// See: http://en.wikipedia.org/wiki/Binary_prefix -const ( - // Decimal - - KB = 1000 - MB = 1000 * KB - GB = 1000 * MB - TB = 1000 * GB - PB = 1000 * TB - - // Binary - - KiB = 1024 - MiB = 1024 * KiB - GiB = 1024 * MiB - TiB = 1024 * GiB - PiB = 1024 * TiB -) - -type unitMap map[string]int64 - -var ( - decimalMap = unitMap{"k": KB, "m": MB, "g": GB, "t": TB, "p": PB} - binaryMap = unitMap{"k": KiB, "m": MiB, "g": GiB, "t": TiB, "p": PiB} - sizeRegex = regexp.MustCompile(`^(\d+(\.\d+)*) ?([kKmMgGtTpP])?[iI]?[bB]?$`) -) - -var decimapAbbrs = []string{"B", "kB", "MB", "GB", "TB", "PB", "EB", "ZB", "YB"} -var binaryAbbrs = []string{"B", "KiB", "MiB", "GiB", "TiB", "PiB", "EiB", "ZiB", "YiB"} - -func getSizeAndUnit(size float64, base float64, _map []string) (float64, string) { - i := 0 - unitsLimit := len(_map) - 1 - for size >= base && i < unitsLimit { - size = size / base - i++ - } - return size, _map[i] -} - -// CustomSize returns a human-readable approximation of a size -// using custom format. -func CustomSize(format string, size float64, base float64, _map []string) string { - size, unit := getSizeAndUnit(size, base, _map) - return fmt.Sprintf(format, size, unit) -} - -// HumanSizeWithPrecision allows the size to be in any precision, -// instead of 4 digit precision used in units.HumanSize. -func HumanSizeWithPrecision(size float64, precision int) string { - size, unit := getSizeAndUnit(size, 1000.0, decimapAbbrs) - return fmt.Sprintf("%.*g%s", precision, size, unit) -} - -// HumanSize returns a human-readable approximation of a size -// capped at 4 valid numbers (eg. "2.746 MB", "796 KB"). -func HumanSize(size float64) string { - return HumanSizeWithPrecision(size, 4) -} - -// BytesSize returns a human-readable size in bytes, kibibytes, -// mebibytes, gibibytes, or tebibytes (eg. "44kiB", "17MiB"). -func BytesSize(size float64) string { - return CustomSize("%.4g%s", size, 1024.0, binaryAbbrs) -} - -// FromHumanSize returns an integer from a human-readable specification of a -// size using SI standard (eg. "44kB", "17MB"). -func FromHumanSize(size string) (int64, error) { - return parseSize(size, decimalMap) -} - -// RAMInBytes parses a human-readable string representing an amount of RAM -// in bytes, kibibytes, mebibytes, gibibytes, or tebibytes and -// returns the number of bytes, or -1 if the string is unparseable. -// Units are case-insensitive, and the 'b' suffix is optional. -func RAMInBytes(size string) (int64, error) { - return parseSize(size, binaryMap) -} - -// Parses the human-readable size string into the amount it represents. -func parseSize(sizeStr string, uMap unitMap) (int64, error) { - matches := sizeRegex.FindStringSubmatch(sizeStr) - if len(matches) != 4 { - return -1, fmt.Errorf("invalid size: '%s'", sizeStr) - } - - size, err := strconv.ParseFloat(matches[1], 64) - if err != nil { - return -1, err - } - - unitPrefix := strings.ToLower(matches[3]) - if mul, ok := uMap[unitPrefix]; ok { - size *= float64(mul) - } - - return int64(size), nil -} diff --git a/vendor/github.com/docker/go-units/ulimit.go b/vendor/github.com/docker/go-units/ulimit.go deleted file mode 100644 index fca0400cc8..0000000000 --- a/vendor/github.com/docker/go-units/ulimit.go +++ /dev/null @@ -1,123 +0,0 @@ -package units - -import ( - "fmt" - "strconv" - "strings" -) - -// Ulimit is a human friendly version of Rlimit. -type Ulimit struct { - Name string - Hard int64 - Soft int64 -} - -// Rlimit specifies the resource limits, such as max open files. -type Rlimit struct { - Type int `json:"type,omitempty"` - Hard uint64 `json:"hard,omitempty"` - Soft uint64 `json:"soft,omitempty"` -} - -const ( - // magic numbers for making the syscall - // some of these are defined in the syscall package, but not all. - // Also since Windows client doesn't get access to the syscall package, need to - // define these here - rlimitAs = 9 - rlimitCore = 4 - rlimitCPU = 0 - rlimitData = 2 - rlimitFsize = 1 - rlimitLocks = 10 - rlimitMemlock = 8 - rlimitMsgqueue = 12 - rlimitNice = 13 - rlimitNofile = 7 - rlimitNproc = 6 - rlimitRss = 5 - rlimitRtprio = 14 - rlimitRttime = 15 - rlimitSigpending = 11 - rlimitStack = 3 -) - -var ulimitNameMapping = map[string]int{ - //"as": rlimitAs, // Disabled since this doesn't seem usable with the way Docker inits a container. - "core": rlimitCore, - "cpu": rlimitCPU, - "data": rlimitData, - "fsize": rlimitFsize, - "locks": rlimitLocks, - "memlock": rlimitMemlock, - "msgqueue": rlimitMsgqueue, - "nice": rlimitNice, - "nofile": rlimitNofile, - "nproc": rlimitNproc, - "rss": rlimitRss, - "rtprio": rlimitRtprio, - "rttime": rlimitRttime, - "sigpending": rlimitSigpending, - "stack": rlimitStack, -} - -// ParseUlimit parses and returns a Ulimit from the specified string. -func ParseUlimit(val string) (*Ulimit, error) { - parts := strings.SplitN(val, "=", 2) - if len(parts) != 2 { - return nil, fmt.Errorf("invalid ulimit argument: %s", val) - } - - if _, exists := ulimitNameMapping[parts[0]]; !exists { - return nil, fmt.Errorf("invalid ulimit type: %s", parts[0]) - } - - var ( - soft int64 - hard = &soft // default to soft in case no hard was set - temp int64 - err error - ) - switch limitVals := strings.Split(parts[1], ":"); len(limitVals) { - case 2: - temp, err = strconv.ParseInt(limitVals[1], 10, 64) - if err != nil { - return nil, err - } - hard = &temp - fallthrough - case 1: - soft, err = strconv.ParseInt(limitVals[0], 10, 64) - if err != nil { - return nil, err - } - default: - return nil, fmt.Errorf("too many limit value arguments - %s, can only have up to two, `soft[:hard]`", parts[1]) - } - - if *hard != -1 { - if soft == -1 { - return nil, fmt.Errorf("ulimit soft limit must be less than or equal to hard limit: soft: -1 (unlimited), hard: %d", *hard) - } - if soft > *hard { - return nil, fmt.Errorf("ulimit soft limit must be less than or equal to hard limit: %d > %d", soft, *hard) - } - } - - return &Ulimit{Name: parts[0], Soft: soft, Hard: *hard}, nil -} - -// GetRlimit returns the RLimit corresponding to Ulimit. -func (u *Ulimit) GetRlimit() (*Rlimit, error) { - t, exists := ulimitNameMapping[u.Name] - if !exists { - return nil, fmt.Errorf("invalid ulimit name %s", u.Name) - } - - return &Rlimit{Type: t, Soft: uint64(u.Soft), Hard: uint64(u.Hard)}, nil -} - -func (u *Ulimit) String() string { - return fmt.Sprintf("%s=%d:%d", u.Name, u.Soft, u.Hard) -} diff --git a/vendor/github.com/elastic/gosigar/.gitignore b/vendor/github.com/elastic/gosigar/.gitignore deleted file mode 100644 index 6f145056f4..0000000000 --- a/vendor/github.com/elastic/gosigar/.gitignore +++ /dev/null @@ -1,41 +0,0 @@ -# Directories -/.vagrant -/.idea -/build - -# Files -.DS_Store -/*.iml -*.h - -# Editor swap files -*.swp -*.swo -*.swn - -# Compiled Object files, Static and Dynamic libs (Shared Objects) -*.o -*.a -*.so -*.exe -*.test -*.prof -*.pyc -*.swp - -# Example binaries -examples/df/df -examples/df/df.exe -examples/free/free -examples/free/free.exe -examples/ps/ps -examples/ps/ps.exe -examples/ss/ss -examples/ss/ss.exe -examples/uptime/uptime -examples/uptime/uptime.exe - -# Test Data -cgroup/testdata/* -!cgroup/testdata/*.zip - diff --git a/vendor/github.com/elastic/gosigar/CHANGELOG.md b/vendor/github.com/elastic/gosigar/CHANGELOG.md deleted file mode 100644 index ebc11d8164..0000000000 --- a/vendor/github.com/elastic/gosigar/CHANGELOG.md +++ /dev/null @@ -1,219 +0,0 @@ -# elastic/gosigar Changelog - -All notable changes to this project will be documented in this file. - -The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), -and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). - -## [Unreleased] - -### Added - -### Fixed - -### Changed - -### Deprecated - -## [0.14.2] - -### Fixed - -- Fix again unsupported devices for filesystem. [#164](https://github.com/elastic/gosigar/pull/164) - -## [0.14.1] - -### Fixed - -- Fix unsupported devices for filesystem. [#159](https://github.com/elastic/gosigar/pull/159) - -## [0.14.0] - -### Addded - -- Add darwin ARM support. [#152](https://github.com/elastic/gosigar/pull/152) - -## [0.13.0] - -### Added - -- Add method of overriding the /sys/fs/cgroup hierarchy, for reading cgroup metrics inside Docker [#148](https://github.com/elastic/gosigar/pull/148) - -## [0.12.0] - -### Added - -- Add `Cached` data to Memory [#145](https://github.com/elastic/gosigar/pull/145) -- Add `SysTypeName` support on Windows [#146](https://github.com/elastic/gosigar/pull/146) - -## [0.11.0] - -### Added - -- Added support for AIX. [#133](https://github.com/elastic/gosigar/pull/133) - -### Fixed - -- Fixed the `ss` example by replacing the Logrus package with the stdlib `log` package. [#123](https://github.com/elastic/gosigar/issues/123) [#136](https://github.com/elastic/gosigar/pull/136) -- Replaced `bytePtrToString` and cleaned up darwin code. [#138](https://github.com/elastic/gosigar/issues/138) [#141](https://github.com/elastic/gosigar/pull/141) - -## [0.10.5] - -### Fixed - -- Fixed uptime calculation under Windows. [#126](https://github.com/elastic/gosigar/pull/126) -- Fixed compilation issue for darwin/386. [#128](https://github.com/elastic/gosigar/pull/128) - -### Changed - -- Load DLLs only from Windows system directory. [#132](https://github.com/elastic/gosigar/pull/132) - -## [0.10.4] - -### Fixed - -- Fixed a crash when splitting command-line arguments under Windows. [#124](https://github.com/elastic/gosigar/pull/124) - -## [0.10.3] - -### Fixed -- ProcState.Get() doesn't fail under Windows when it cannot obtain process ownership information. [#121](https://github.com/elastic/gosigar/pull/121) - -## [0.10.2] - -### Fixed -- Fix memory leak when getting process arguments. [#119](https://github.com/elastic/gosigar/pull/119) - -## [0.10.1] - -### Fixed -- Replaced the WMI queries with win32 apis due to high CPU usage. [#116](https://github.com/elastic/gosigar/pull/116) - -## [0.10.0] - -### Added -- List filesystems on Windows that have an access path but not an assigned letter. [#112](https://github.com/elastic/gosigar/pull/112) - -### Fixed -- Added missing runtime import for FreeBSD. [#104](https://github.com/elastic/gosigar/pull/104) -- Handle nil command line in Windows processes. [#110](https://github.com/elastic/gosigar/pull/110) - -## [0.9.0] - -### Added -- Added support for huge TLB pages on Linux [#97](https://github.com/elastic/gosigar/pull/97) -- Added support for big endian platform [#100](https://github.com/elastic/gosigar/pull/100) - -### Fixed -- Add missing method for OpenBSD [#99](https://github.com/elastic/gosigar/pull/99) - -## [0.8.0] - -### Added -- Added partial `getrusage` support for Windows to retrieve system CPU time and user CPU time. [#95](https://github.com/elastic/gosigar/pull/95) -- Added full `getrusage` support for Unix. [#95](https://github.com/elastic/gosigar/pull/95) - -## [0.7.0] - -### Added -- Added method stubs for process handling for operating system that are not supported - by gosigar. All methods return `ErrNotImplemented` on such systems. [#88](https://github.com/elastic/gosigar/pull/88) - -### Fixed -- Fix freebsd build by using the common version of Get(pid). [#91](https://github.com/elastic/gosigar/pull/91) - -### Changed -- Fixed issues in cgroup package by adding missing error checks and closing - file handles. [#92](https://github.com/elastic/gosigar/pull/92) - -## [0.6.0] - -### Added -- Added method stubs to enable compilation for operating systems that are not - supported by gosigar. All methods return `ErrNotImplemented` on these unsupported - operating systems. [#83](https://github.com/elastic/gosigar/pull/83) -- FreeBSD returns `ErrNotImplemented` for `ProcTime.Get`. [#83](https://github.com/elastic/gosigar/pull/83) - -### Changed -- OpenBSD returns `ErrNotImplemented` for `ProcTime.Get` instead of `nil`. [#83](https://github.com/elastic/gosigar/pull/83) -- Fixed incorrect `Mem.Used` calculation under linux. [#82](https://github.com/elastic/gosigar/pull/82) -- Fixed `ProcState` on Linux and FreeBSD when process names contain parentheses. [#81](https://github.com/elastic/gosigar/pull/81) - -### Removed -- Remove NetBSD build from sigar_unix.go as it is not supported by gosigar. [#83](https://github.com/elastic/gosigar/pull/83) - -## [0.5.0] - -### Changed -- Fixed Trim environment variables when comparing values in the test suite. [#79](https://github.com/elastic/gosigar/pull/79) -- Make `kern_procargs` more robust under darwin when we cannot retrieve - all the information about a process. [#78](https://github.com/elastic/gosigar/pull/78) - -## [0.4.0] - -### Changed -- Fixed Windows issue that caused a hang during `init()` if WMI wasn't ready. [#74](https://github.com/elastic/gosigar/pull/74) - -## [0.3.0] - -### Added -- Read `MemAvailable` value for kernel 3.14+ [#71](https://github.com/elastic/gosigar/pull/71) - -## [0.2.0] - -### Added -- Added `ErrCgroupsMissing` to indicate that /proc/cgroups is missing which is - an indicator that cgroups were disabled at compile time. [#64](https://github.com/elastic/gosigar/pull/64) - -### Changed -- Changed `cgroup.SupportedSubsystems()` to honor the "enabled" column in the - /proc/cgroups file. [#64](https://github.com/elastic/gosigar/pull/64) - -## [0.1.0] - -### Added -- Added `CpuList` implementation for Windows that returns CPU timing information - on a per CPU basis. [#55](https://github.com/elastic/gosigar/pull/55) -- Added `Uptime` implementation for Windows. [#55](https://github.com/elastic/gosigar/pull/55) -- Added `Swap` implementation for Windows based on page file metrics. [#55](https://github.com/elastic/gosigar/pull/55) -- Added support to `github.com/gosigar/sys/windows` for querying and enabling - privileges in a process token. -- Added utility code for interfacing with linux NETLINK_INET_DIAG. [#60](https://github.com/elastic/gosigar/pull/60) -- Added `ProcEnv` for getting a process's environment variables. [#61](https://github.com/elastic/gosigar/pull/61) - -### Changed -- Changed several `OpenProcess` calls on Windows to request the lowest possible - access privileges. [#50](https://github.com/elastic/gosigar/pull/50) -- Removed cgo usage from Windows code. -- Added OS version checks to `ProcArgs.Get` on Windows because the - `Win32_Process` WMI query is not available prior to Windows vista. On XP and - Windows 2003, this method returns `ErrNotImplemented`. [#55](https://github.com/elastic/gosigar/pull/55) - -### Fixed -- Fixed value of `Mem.ActualFree` and `Mem.ActualUsed` on Windows. [#49](https://github.com/elastic/gosigar/pull/49) -- Fixed `ProcTime.StartTime` on Windows to report value in milliseconds since - Unix epoch. [#51](https://github.com/elastic/gosigar/pull/51) -- Fixed `ProcStatus.PPID` value is wrong on Windows. [#55](https://github.com/elastic/gosigar/pull/55) -- Fixed `ProcStatus.Username` error on Windows XP [#56](https://github.com/elastic/gosigar/pull/56) - -[Unreleased]: https://github.com/elastic/gosigar/compare/v0.14.1...HEAD -[0.14.1]: https://github.com/elastic/gosigar/releases/tag/v0.14.1 -[0.14.0]: https://github.com/elastic/gosigar/releases/tag/v0.14.0 -[0.13.0]: https://github.com/elastic/gosigar/releases/tag/v0.13.0 -[0.12.0]: https://github.com/elastic/gosigar/releases/tag/v0.12.0 -[0.11.0]: https://github.com/elastic/gosigar/releases/tag/v0.11.0 -[0.10.5]: https://github.com/elastic/gosigar/releases/tag/v0.10.5 -[0.10.4]: https://github.com/elastic/gosigar/releases/tag/v0.10.4 -[0.10.3]: https://github.com/elastic/gosigar/releases/tag/v0.10.3 -[0.10.2]: https://github.com/elastic/gosigar/releases/tag/v0.10.2 -[0.10.1]: https://github.com/elastic/gosigar/releases/tag/v0.10.1 -[0.10.0]: https://github.com/elastic/gosigar/releases/tag/v0.10.0 -[0.9.0]: https://github.com/elastic/gosigar/releases/tag/v0.9.0 -[0.8.0]: https://github.com/elastic/gosigar/releases/tag/v0.8.0 -[0.7.0]: https://github.com/elastic/gosigar/releases/tag/v0.7.0 -[0.6.0]: https://github.com/elastic/gosigar/releases/tag/v0.6.0 -[0.5.0]: https://github.com/elastic/gosigar/releases/tag/v0.5.0 -[0.4.0]: https://github.com/elastic/gosigar/releases/tag/v0.4.0 -[0.3.0]: https://github.com/elastic/gosigar/releases/tag/v0.3.0 -[0.2.0]: https://github.com/elastic/gosigar/releases/tag/v0.2.0 -[0.1.0]: https://github.com/elastic/gosigar/releases/tag/v0.1.0 diff --git a/vendor/github.com/elastic/gosigar/LICENSE b/vendor/github.com/elastic/gosigar/LICENSE deleted file mode 100644 index 11069edd79..0000000000 --- a/vendor/github.com/elastic/gosigar/LICENSE +++ /dev/null @@ -1,201 +0,0 @@ - Apache License - Version 2.0, January 2004 - http://www.apache.org/licenses/ - -TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION - -1. Definitions. - - "License" shall mean the terms and conditions for use, reproduction, - and distribution as defined by Sections 1 through 9 of this document. - - "Licensor" shall mean the copyright owner or entity authorized by - the copyright owner that is granting the License. - - "Legal Entity" shall mean the union of the acting entity and all - other entities that control, are controlled by, or are under common - control with that entity. For the purposes of this definition, - "control" means (i) the power, direct or indirect, to cause the - direction or management of such entity, whether by contract or - otherwise, or (ii) ownership of fifty percent (50%) or more of the - outstanding shares, or (iii) beneficial ownership of such entity. - - "You" (or "Your") shall mean an individual or Legal Entity - exercising permissions granted by this License. - - "Source" form shall mean the preferred form for making modifications, - including but not limited to software source code, documentation - source, and configuration files. - - "Object" form shall mean any form resulting from mechanical - transformation or translation of a Source form, including but - not limited to compiled object code, generated documentation, - and conversions to other media types. - - "Work" shall mean the work of authorship, whether in Source or - Object form, made available under the License, as indicated by a - copyright notice that is included in or attached to the work - (an example is provided in the Appendix below). - - "Derivative Works" shall mean any work, whether in Source or Object - form, that is based on (or derived from) the Work and for which the - editorial revisions, annotations, elaborations, or other modifications - represent, as a whole, an original work of authorship. For the purposes - of this License, Derivative Works shall not include works that remain - separable from, or merely link (or bind by name) to the interfaces of, - the Work and Derivative Works thereof. - - "Contribution" shall mean any work of authorship, including - the original version of the Work and any modifications or additions - to that Work or Derivative Works thereof, that is intentionally - submitted to Licensor for inclusion in the Work by the copyright owner - or by an individual or Legal Entity authorized to submit on behalf of - the copyright owner. For the purposes of this definition, "submitted" - means any form of electronic, verbal, or written communication sent - to the Licensor or its representatives, including but not limited to - communication on electronic mailing lists, source code control systems, - and issue tracking systems that are managed by, or on behalf of, the - Licensor for the purpose of discussing and improving the Work, but - excluding communication that is conspicuously marked or otherwise - designated in writing by the copyright owner as "Not a Contribution." - - "Contributor" shall mean Licensor and any individual or Legal Entity - on behalf of whom a Contribution has been received by Licensor and - subsequently incorporated within the Work. - -2. Grant of Copyright License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - copyright license to reproduce, prepare Derivative Works of, - publicly display, publicly perform, sublicense, and distribute the - Work and such Derivative Works in Source or Object form. - -3. Grant of Patent License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - (except as stated in this section) patent license to make, have made, - use, offer to sell, sell, import, and otherwise transfer the Work, - where such license applies only to those patent claims licensable - by such Contributor that are necessarily infringed by their - Contribution(s) alone or by combination of their Contribution(s) - with the Work to which such Contribution(s) was submitted. If You - institute patent litigation against any entity (including a - cross-claim or counterclaim in a lawsuit) alleging that the Work - or a Contribution incorporated within the Work constitutes direct - or contributory patent infringement, then any patent licenses - granted to You under this License for that Work shall terminate - as of the date such litigation is filed. - -4. Redistribution. You may reproduce and distribute copies of the - Work or Derivative Works thereof in any medium, with or without - modifications, and in Source or Object form, provided that You - meet the following conditions: - - (a) You must give any other recipients of the Work or - Derivative Works a copy of this License; and - - (b) You must cause any modified files to carry prominent notices - stating that You changed the files; and - - (c) You must retain, in the Source form of any Derivative Works - that You distribute, all copyright, patent, trademark, and - attribution notices from the Source form of the Work, - excluding those notices that do not pertain to any part of - the Derivative Works; and - - (d) If the Work includes a "NOTICE" text file as part of its - distribution, then any Derivative Works that You distribute must - include a readable copy of the attribution notices contained - within such NOTICE file, excluding those notices that do not - pertain to any part of the Derivative Works, in at least one - of the following places: within a NOTICE text file distributed - as part of the Derivative Works; within the Source form or - documentation, if provided along with the Derivative Works; or, - within a display generated by the Derivative Works, if and - wherever such third-party notices normally appear. The contents - of the NOTICE file are for informational purposes only and - do not modify the License. You may add Your own attribution - notices within Derivative Works that You distribute, alongside - or as an addendum to the NOTICE text from the Work, provided - that such additional attribution notices cannot be construed - as modifying the License. - - You may add Your own copyright statement to Your modifications and - may provide additional or different license terms and conditions - for use, reproduction, or distribution of Your modifications, or - for any such Derivative Works as a whole, provided Your use, - reproduction, and distribution of the Work otherwise complies with - the conditions stated in this License. - -5. Submission of Contributions. Unless You explicitly state otherwise, - any Contribution intentionally submitted for inclusion in the Work - by You to the Licensor shall be under the terms and conditions of - this License, without any additional terms or conditions. - Notwithstanding the above, nothing herein shall supersede or modify - the terms of any separate license agreement you may have executed - with Licensor regarding such Contributions. - -6. Trademarks. This License does not grant permission to use the trade - names, trademarks, service marks, or product names of the Licensor, - except as required for reasonable and customary use in describing the - origin of the Work and reproducing the content of the NOTICE file. - -7. Disclaimer of Warranty. Unless required by applicable law or - agreed to in writing, Licensor provides the Work (and each - Contributor provides its Contributions) on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or - implied, including, without limitation, any warranties or conditions - of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A - PARTICULAR PURPOSE. You are solely responsible for determining the - appropriateness of using or redistributing the Work and assume any - risks associated with Your exercise of permissions under this License. - -8. Limitation of Liability. In no event and under no legal theory, - whether in tort (including negligence), contract, or otherwise, - unless required by applicable law (such as deliberate and grossly - negligent acts) or agreed to in writing, shall any Contributor be - liable to You for damages, including any direct, indirect, special, - incidental, or consequential damages of any character arising as a - result of this License or out of the use or inability to use the - Work (including but not limited to damages for loss of goodwill, - work stoppage, computer failure or malfunction, or any and all - other commercial damages or losses), even if such Contributor - has been advised of the possibility of such damages. - -9. Accepting Warranty or Additional Liability. While redistributing - the Work or Derivative Works thereof, You may choose to offer, - and charge a fee for, acceptance of support, warranty, indemnity, - or other liability obligations and/or rights consistent with this - License. However, in accepting such obligations, You may act only - on Your own behalf and on Your sole responsibility, not on behalf - of any other Contributor, and only if You agree to indemnify, - defend, and hold each Contributor harmless for any liability - incurred by, or claims asserted against, such Contributor by reason - of your accepting any such warranty or additional liability. - -END OF TERMS AND CONDITIONS - -APPENDIX: How to apply the Apache License to your work. - - To apply the Apache License to your work, attach the following - boilerplate notice, with the fields enclosed by brackets "[]" - replaced with your own identifying information. (Don't include - the brackets!) The text should be enclosed in the appropriate - comment syntax for the file format. We also recommend that a - file or class name and description of purpose be included on the - same "printed page" as the copyright notice for easier - identification within third-party archives. - -Copyright [yyyy] [name of copyright owner] - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. diff --git a/vendor/github.com/elastic/gosigar/NOTICE b/vendor/github.com/elastic/gosigar/NOTICE deleted file mode 100644 index fda553b5c3..0000000000 --- a/vendor/github.com/elastic/gosigar/NOTICE +++ /dev/null @@ -1,9 +0,0 @@ -Copyright (c) [2009-2011] VMware, Inc. All Rights Reserved. - -This product is licensed to you under the Apache License, Version 2.0 (the "License"). -You may not use this product except in compliance with the License. - -This product includes a number of subcomponents with -separate copyright notices and license terms. Your use of these -subcomponents is subject to the terms and conditions of the -subcomponent's license, as noted in the LICENSE file. \ No newline at end of file diff --git a/vendor/github.com/elastic/gosigar/README.md b/vendor/github.com/elastic/gosigar/README.md deleted file mode 100644 index ab8f5bcfe6..0000000000 --- a/vendor/github.com/elastic/gosigar/README.md +++ /dev/null @@ -1,59 +0,0 @@ -# Go sigar [![Build Status](https://beats-ci.elastic.co/job/Beats/job/gosigar/job/master/badge/icon)](https://beats-ci.elastic.co/job/Beats/job/gosigar/job/master/) - - -## Overview - -Go sigar is a golang implementation of the -[sigar API](https://github.com/hyperic/sigar). The Go version of -sigar has a very similar interface, but is being written from scratch -in pure go/cgo, rather than cgo bindings for libsigar. - -## Test drive - - $ go get github.com/elastic/gosigar - $ cd $GOPATH/src/github.com/elastic/gosigar/examples/ps - $ go build - $ ./ps - -## Supported platforms - -The features vary by operating system. - -| Feature | Linux | Darwin | Windows | OpenBSD | FreeBSD | AIX | -|-----------------|:-----:|:------:|:-------:|:-------:|:-------:|:-------:| -| Cpu | X | X | X | X | X | X | -| CpuList | X | X | | X | X | X | -| FDUsage | X | | | | X | | -| FileSystemList | X | X | X | X | X | X | -| FileSystemUsage | X | X | X | X | X | X | -| HugeTLBPages | X | | | | | | -| LoadAverage | X | X | | X | X | X | -| Mem | X | X | X | X | X | X | -| ProcArgs | X | X | X | | X | X | -| ProcEnv | X | X | | | X | X | -| ProcExe | X | X | | | X | X | -| ProcFDUsage | X | | | | X | | -| ProcList | X | X | X | | X | X | -| ProcMem | X | X | X | | X | X | -| ProcState | X | X | X | | X | X | -| ProcTime | X | X | X | | X | X | -| Rusage | X | | X | | | X | -| Swap | X | X | | X | X | X | -| Uptime | X | X | | X | X | X | - -## OS Specific Notes - -### FreeBSD - -Mount both `linprocfs` and `procfs` for compatability. Consider adding these -mounts to your `/etc/fstab` file so they are mounted automatically at boot. - -``` -sudo mount -t procfs proc /proc -sudo mkdir -p /compat/linux/proc -sudo mount -t linprocfs /dev/null /compat/linux/proc -``` - -## License - -Apache 2.0 diff --git a/vendor/github.com/elastic/gosigar/Vagrantfile b/vendor/github.com/elastic/gosigar/Vagrantfile deleted file mode 100644 index 6fd990c141..0000000000 --- a/vendor/github.com/elastic/gosigar/Vagrantfile +++ /dev/null @@ -1,25 +0,0 @@ -# Vagrantfile API/syntax version. Don't touch unless you know what you're doing! -VAGRANTFILE_API_VERSION = "2" - -Vagrant.configure(VAGRANTFILE_API_VERSION) do |config| - config.vm.box = "hashicorp/precise64" - config.vm.provision "shell", inline: "mkdir -p /home/vagrant/go" - config.vm.synced_folder ".", "/home/vagrant/go/src/github.com/cloudfoundry/gosigar" - config.vm.provision "shell", inline: "chown -R vagrant:vagrant /home/vagrant/go" - install_go = <<-BASH - set -e - -if [ ! -d "/usr/local/go" ]; then - cd /tmp && wget https://storage.googleapis.com/golang/go1.3.3.linux-amd64.tar.gz - cd /usr/local - tar xvzf /tmp/go1.3.3.linux-amd64.tar.gz - echo 'export GOPATH=/home/vagrant/go; export PATH=/usr/local/go/bin:$PATH:$GOPATH/bin' >> /home/vagrant/.bashrc -fi -export GOPATH=/home/vagrant/go -export PATH=/usr/local/go/bin:$PATH:$GOPATH/bin -/usr/local/go/bin/go get -u github.com/onsi/ginkgo/ginkgo -/usr/local/go/bin/go get -u github.com/onsi/gomega; -BASH - config.vm.provision "shell", inline: 'apt-get install -y git-core' - config.vm.provision "shell", inline: install_go -end diff --git a/vendor/github.com/elastic/gosigar/codecov.yml b/vendor/github.com/elastic/gosigar/codecov.yml deleted file mode 100644 index 76ade0fdb0..0000000000 --- a/vendor/github.com/elastic/gosigar/codecov.yml +++ /dev/null @@ -1,21 +0,0 @@ -# Enable coverage report message for diff on commit -coverage: - status: - project: off - patch: - default: - # basic - target: auto - threshold: null - base: auto - # advanced - branches: null - if_no_uploads: error - if_not_found: success - if_ci_failed: error - only_pulls: false - flags: null - paths: null - -# Disable comments on Pull Requests -comment: false diff --git a/vendor/github.com/elastic/gosigar/concrete_sigar.go b/vendor/github.com/elastic/gosigar/concrete_sigar.go deleted file mode 100644 index e3ee80a980..0000000000 --- a/vendor/github.com/elastic/gosigar/concrete_sigar.go +++ /dev/null @@ -1,89 +0,0 @@ -package gosigar - -import ( - "time" -) - -type ConcreteSigar struct{} - -func (c *ConcreteSigar) CollectCpuStats(collectionInterval time.Duration) (<-chan Cpu, chan<- struct{}) { - // samplesCh is buffered to 1 value to immediately return first CPU sample - samplesCh := make(chan Cpu, 1) - - stopCh := make(chan struct{}) - - go func() { - var cpuUsage Cpu - - // Immediately provide non-delta value. - // samplesCh is buffered to 1 value, so it will not block. - cpuUsage.Get() - samplesCh <- cpuUsage - - ticker := time.NewTicker(collectionInterval) - - for { - select { - case <-ticker.C: - previousCpuUsage := cpuUsage - - cpuUsage.Get() - - select { - case samplesCh <- cpuUsage.Delta(previousCpuUsage): - default: - // Include default to avoid channel blocking - } - - case <-stopCh: - return - } - } - }() - - return samplesCh, stopCh -} - -func (c *ConcreteSigar) GetLoadAverage() (LoadAverage, error) { - l := LoadAverage{} - err := l.Get() - return l, err -} - -func (c *ConcreteSigar) GetMem() (Mem, error) { - m := Mem{} - err := m.Get() - return m, err -} - -func (c *ConcreteSigar) GetSwap() (Swap, error) { - s := Swap{} - err := s.Get() - return s, err -} - -func (c *ConcreteSigar) GetHugeTLBPages() (HugeTLBPages, error) { - p := HugeTLBPages{} - err := p.Get() - return p, err -} - -func (c *ConcreteSigar) GetFileSystemUsage(path string) (FileSystemUsage, error) { - f := FileSystemUsage{} - err := f.Get(path) - return f, err -} - -func (c *ConcreteSigar) GetFDUsage() (FDUsage, error) { - fd := FDUsage{} - err := fd.Get() - return fd, err -} - -// GetRusage return the resource usage of the process -// Possible params: 0 = RUSAGE_SELF, 1 = RUSAGE_CHILDREN, 2 = RUSAGE_THREAD -func (c *ConcreteSigar) GetRusage(who int) (Rusage, error) { - r := Rusage{} - err := r.Get(who) - return r, err -} diff --git a/vendor/github.com/elastic/gosigar/go.mod b/vendor/github.com/elastic/gosigar/go.mod deleted file mode 100644 index 977b07db46..0000000000 --- a/vendor/github.com/elastic/gosigar/go.mod +++ /dev/null @@ -1,9 +0,0 @@ -module github.com/elastic/gosigar - -go 1.14 - -require ( - github.com/pkg/errors v0.9.1 - github.com/stretchr/testify v1.4.0 - golang.org/x/sys v0.0.0-20180810173357-98c5dad5d1a0 -) diff --git a/vendor/github.com/elastic/gosigar/go.sum b/vendor/github.com/elastic/gosigar/go.sum deleted file mode 100644 index 3a816f7154..0000000000 --- a/vendor/github.com/elastic/gosigar/go.sum +++ /dev/null @@ -1,15 +0,0 @@ -github.com/davecgh/go-spew v1.1.0 h1:ZDRjVQ15GmhC3fiQ8ni8+OwkZQO4DARzQgrnXU1Liz8= -github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= -github.com/pkg/errors v0.9.1 h1:FEBLx1zS214owpjy7qsBeixbURkuhQAwrK5UwLGTwt4= -github.com/pkg/errors v0.9.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= -github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= -github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= -github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= -github.com/stretchr/testify v1.4.0 h1:2E4SXV/wtOkTonXsotYi4li6zVWxYlZuYNCXe9XRJyk= -github.com/stretchr/testify v1.4.0/go.mod h1:j7eGeouHqKxXV5pUuKE4zz7dFj8WfuZ+81PSLYec5m4= -golang.org/x/sys v0.0.0-20180810173357-98c5dad5d1a0 h1:8H8QZJ30plJyIVj60H3lr8TZGIq2Fh3Cyrs/ZNg1foU= -golang.org/x/sys v0.0.0-20180810173357-98c5dad5d1a0/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= -gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405 h1:yhCVgyC4o1eVCa2tZl7eS0r+SDo693bJlVdllGtEeKM= -gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= -gopkg.in/yaml.v2 v2.2.2 h1:ZCJp+EgiOT7lHqUV2J862kp8Qj64Jo6az82+3Td9dZw= -gopkg.in/yaml.v2 v2.2.2/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= diff --git a/vendor/github.com/elastic/gosigar/sigar_aix.go b/vendor/github.com/elastic/gosigar/sigar_aix.go deleted file mode 100644 index bcdb7ca7a4..0000000000 --- a/vendor/github.com/elastic/gosigar/sigar_aix.go +++ /dev/null @@ -1,564 +0,0 @@ -// +build aix - -package gosigar - -/* -#cgo LDFLAGS: -L/usr/lib -lperfstat - -#include -#include -#include -#include -#include -#include -#include -#include - -*/ -import "C" - -import ( - "bytes" - "encoding/binary" - "fmt" - "io" - "os" - "os/user" - "runtime" - "strconv" - "syscall" - "time" - "unsafe" -) - -var system struct { - ticks uint64 - btime uint64 - pagesize uint64 -} - -func init() { - // sysconf(_SC_CLK_TCK) returns the number of ticks by second. - system.ticks = uint64(C.sysconf(C._SC_CLK_TCK)) - system.pagesize = uint64(os.Getpagesize()) -} - -// utmp can't be used by "encoding/binary" if generated by cgo, -// some pads will be explicitly missing. -type utmp struct { - User [256]uint8 - ID [14]uint8 - Line [64]uint8 - XPad1 int16 - Pid int32 - Type int16 - XPad2 int16 - Time int64 - Termination int16 - Exit int16 - Host [256]uint8 - XdblWordPad int32 - XreservedA [2]int32 - XreservedV [6]int32 -} - -func bootTime() (uint64, error) { - if system.btime != 0 { - return system.btime, nil - } - - // Get boot time from /etc/utmp - file, err := os.Open("/etc/utmp") - if err != nil { - return 0, fmt.Errorf("error while opening /etc/utmp: %s", err) - } - - defer file.Close() - - for { - var utmp utmp - if err := binary.Read(file, binary.BigEndian, &utmp); err != nil { - break - } - - if utmp.Type == C.BOOT_TIME { - system.btime = uint64(utmp.Time) - break - } - } - return system.btime, nil -} - -func tick2msec(val uint64) uint64 { - return val * 1000 / system.ticks -} - -// Get returns the list of file systems -func (self *FileSystemList) Get() error { - var size C.int - _, err := C.mntctl(C.MCTL_QUERY, C.sizeof_int, (*C.char)(unsafe.Pointer(&size))) - if err != nil { - return fmt.Errorf("error while retrieving file system number: %s", err) - } - - buf := make([]byte, size) - num, err := C.mntctl(C.MCTL_QUERY, C.ulong(size), (*C.char)(&buf[0])) - if err != nil { - return fmt.Errorf("error while retrieving file system list: %s", err) - } - - // Vmount structure has a fixed size area for common data (type, - // offsets, etc) and another area with variable length data (devname, - // options, etc). These data can be accessed based on the offsets - // stored in an array inside the fixed part. They can be retrieve - // using index given by C define. - vmt2data := func(buf []byte, ent *C.struct_vmount, idx int, baseOff int) []byte { - off := int(ent.vmt_data[idx].vmt_off) - size := int(ent.vmt_data[idx].vmt_size) - return buf[baseOff+off : baseOff+off+size] - } - - entOff := 0 - - fslist := make([]FileSystem, num) - for i := 0; i < int(num); i++ { - ent := (*C.struct_vmount)(unsafe.Pointer(&buf[entOff])) - fs := &fslist[i] - - // Correspondances taken for /etc/vfs - switch ent.vmt_gfstype { - case C.MNT_AIX: - fs.SysTypeName = "jfs2" - case C.MNT_NAMEFS: - fs.SysTypeName = "namefs" - case C.MNT_NFS: - fs.SysTypeName = "nfs" - case C.MNT_JFS: - fs.SysTypeName = "jfs" - case C.MNT_CDROM: - fs.SysTypeName = "cdrom" - case C.MNT_PROCFS: - fs.SysTypeName = "proc" - case C.MNT_SFS: - fs.SysTypeName = "sfs" - case C.MNT_CACHEFS: - fs.SysTypeName = "cachefs" - case C.MNT_NFS3: - fs.SysTypeName = "nfs3" - case C.MNT_AUTOFS: - fs.SysTypeName = "autofs" - case C.MNT_POOLFS: - fs.SysTypeName = "poolfs" - case C.MNT_UDF: - fs.SysTypeName = "udfs" - case C.MNT_NFS4: - fs.SysTypeName = "nfs4" - case C.MNT_CIFS: - fs.SysTypeName = "cifs" - case C.MNT_PMEMFS: - fs.SysTypeName = "pmemfs" - case C.MNT_AHAFS: - fs.SysTypeName = "ahafs" - case C.MNT_STNFS: - fs.SysTypeName = "stnfs" - default: - if ent.vmt_flags&C.MNT_REMOTE != 0 { - fs.SysTypeName = "network" - } else { - fs.SysTypeName = "none" - } - } - - fs.DirName = convertBytesToString(vmt2data(buf, ent, C.VMT_STUB, entOff)) - fs.Options = convertBytesToString(vmt2data(buf, ent, C.VMT_ARGS, entOff)) - devname := convertBytesToString(vmt2data(buf, ent, C.VMT_OBJECT, entOff)) - if ent.vmt_flags&C.MNT_REMOTE != 0 { - hostname := convertBytesToString(vmt2data(buf, ent, C.VMT_OBJECT, entOff)) - fs.DevName = hostname + ":" + devname - } else { - fs.DevName = devname - } - - entOff += int(ent.vmt_length) - } - - self.List = fslist - - return nil -} - -// Get returns the CPU load average -func (self *LoadAverage) Get() error { - cpudata := C.perfstat_cpu_total_t{} - - if _, err := C.perfstat_cpu_total(nil, &cpudata, C.sizeof_perfstat_cpu_total_t, 1); err != nil { - return fmt.Errorf("perfstat_cpu_total: %s", err) - } - - // from libperfstat.h: - // "To calculate the load average, divide the numbers by (1<." - fixedToFloat64 := func(x uint64) float64 { - return float64(x) / (1 << C.SBITS) - } - self.One = fixedToFloat64(uint64(cpudata.loadavg[0])) - self.Five = fixedToFloat64(uint64(cpudata.loadavg[1])) - self.Fifteen = fixedToFloat64(uint64(cpudata.loadavg[2])) - - return nil -} - -// Get returns the system uptime -func (self *Uptime) Get() error { - btime, err := bootTime() - if err != nil { - return err - } - uptime := time.Now().Sub(time.Unix(int64(btime), 0)) - self.Length = uptime.Seconds() - return nil -} - -// Get returns the current system memory -func (self *Mem) Get() error { - meminfo := C.perfstat_memory_total_t{} - _, err := C.perfstat_memory_total(nil, &meminfo, C.sizeof_perfstat_memory_total_t, 1) - if err != nil { - return fmt.Errorf("perfstat_memory_total: %s", err) - } - - self.Total = uint64(meminfo.real_total) * system.pagesize - self.Free = uint64(meminfo.real_free) * system.pagesize - - kern := uint64(meminfo.numperm) * system.pagesize // number of pages in file cache - - self.Used = self.Total - self.Free - self.ActualFree = self.Free + kern - self.ActualUsed = self.Used - kern - - return nil -} - -// Get returns the current system swap memory -func (self *Swap) Get() error { - ps := C.perfstat_pagingspace_t{} - id := C.perfstat_id_t{} - - id.name[0] = 0 - - for { - // errno can be set during perfstat_pagingspace's call even - // if it succeeds. Thus, only check it when the result is -1. - if r, err := C.perfstat_pagingspace(&id, &ps, C.sizeof_perfstat_pagingspace_t, 1); r == -1 && err != nil { - return fmt.Errorf("perfstat_memory_total: %s", err) - } - - if ps.active != 1 { - continue - } - - // convert MB sizes to bytes - self.Total += uint64(ps.mb_size) * 1024 * 1024 - self.Used += uint64(ps.mb_used) * 1024 * 1024 - - if id.name[0] == 0 { - break - } - } - - self.Free = self.Total - self.Used - - return nil -} - -// Get returns information about a CPU -func (self *Cpu) Get() error { - cpudata := C.perfstat_cpu_total_t{} - - if _, err := C.perfstat_cpu_total(nil, &cpudata, C.sizeof_perfstat_cpu_total_t, 1); err != nil { - return fmt.Errorf("perfstat_cpu_total: %s", err) - } - - self.User = tick2msec(uint64(cpudata.user)) - self.Sys = tick2msec(uint64(cpudata.sys)) - self.Idle = tick2msec(uint64(cpudata.idle)) - self.Wait = tick2msec(uint64(cpudata.wait)) - - return nil -} - -// Get returns the list of CPU used by the system -func (self *CpuList) Get() error { - cpudata := C.perfstat_cpu_t{} - id := C.perfstat_id_t{} - id.name[0] = 0 - - // Retrieve the number of cpu using perfstat_cpu - capacity, err := C.perfstat_cpu(nil, nil, C.sizeof_perfstat_cpu_t, 0) - if err != nil { - return fmt.Errorf("error while retrieving CPU number: %s", err) - } - list := make([]Cpu, 0, capacity) - - for { - if _, err := C.perfstat_cpu(&id, &cpudata, C.sizeof_perfstat_cpu_t, 1); err != nil { - return fmt.Errorf("perfstat_cpu: %s", err) - } - - cpu := Cpu{} - cpu.User = tick2msec(uint64(cpudata.user)) - cpu.Sys = tick2msec(uint64(cpudata.sys)) - cpu.Idle = tick2msec(uint64(cpudata.idle)) - cpu.Wait = tick2msec(uint64(cpudata.wait)) - - list = append(list, cpu) - - if id.name[0] == 0 { - break - } - } - - self.List = list - - return nil -} - -// Get returns the list of all active processes -func (self *ProcList) Get() error { - info := C.struct_procsinfo64{} - pid := C.pid_t(0) - - var list []int - - for { - // getprocs first argument is a void* - num, err := C.getprocs(unsafe.Pointer(&info), C.sizeof_struct_procsinfo64, nil, 0, &pid, 1) - if err != nil { - return err - } - - list = append(list, int(info.pi_pid)) - - if num == 0 { - break - } - } - - self.List = list - - return nil -} - -// Get returns information about a process -func (self *ProcState) Get(pid int) error { - info := C.struct_procsinfo64{} - cpid := C.pid_t(pid) - - num, err := C.getprocs(unsafe.Pointer(&info), C.sizeof_struct_procsinfo64, nil, 0, &cpid, 1) - if err != nil { - return err - } - if num != 1 { - return syscall.ESRCH - } - - self.Name = C.GoString(&info.pi_comm[0]) - self.Ppid = int(info.pi_ppid) - self.Pgid = int(info.pi_pgrp) - self.Nice = int(info.pi_nice) - self.Tty = int(info.pi_ttyd) - self.Priority = int(info.pi_pri) - - switch info.pi_state { - case C.SACTIVE: - self.State = RunStateRun - case C.SIDL: - self.State = RunStateIdle - case C.SSTOP: - self.State = RunStateStop - case C.SZOMB: - self.State = RunStateZombie - case C.SSWAP: - self.State = RunStateSleep - default: - self.State = RunStateUnknown - } - - // Get process username. Fallback to UID if username is not available. - uid := strconv.Itoa(int(info.pi_uid)) - userID, err := user.LookupId(uid) - if err == nil && userID.Username != "" { - self.Username = userID.Username - } else { - self.Username = uid - } - - thrinfo := C.struct_thrdsinfo64{} - tid := C.tid_t(0) - - if _, err := C.getthrds(cpid, unsafe.Pointer(&thrinfo), C.sizeof_struct_thrdsinfo64, &tid, 1); err != nil { - self.Processor = int(thrinfo.ti_affinity) - } - - return nil -} - -//Get returns the current memory usage of a process -func (self *ProcMem) Get(pid int) error { - info := C.struct_procsinfo64{} - cpid := C.pid_t(pid) - - num, err := C.getprocs(unsafe.Pointer(&info), C.sizeof_struct_procsinfo64, nil, 0, &cpid, 1) - if err != nil { - return err - } - if num != 1 { - return syscall.ESRCH - } - - self.Size = uint64(info.pi_size) * system.pagesize - self.Share = uint64(info.pi_sdsize) * system.pagesize - self.Resident = uint64(info.pi_drss+info.pi_trss) * system.pagesize - - self.MinorFaults = uint64(info.pi_minflt) - self.MajorFaults = uint64(info.pi_majflt) - self.PageFaults = self.MinorFaults + self.MajorFaults - - return nil -} - -// Get returns a process uptime -func (self *ProcTime) Get(pid int) error { - info := C.struct_procsinfo64{} - cpid := C.pid_t(pid) - - num, err := C.getprocs(unsafe.Pointer(&info), C.sizeof_struct_procsinfo64, nil, 0, &cpid, 1) - if err != nil { - return err - } - if num != 1 { - return syscall.ESRCH - } - - self.StartTime = uint64(info.pi_start) * 1000 - self.User = uint64(info.pi_utime) * 1000 - self.Sys = uint64(info.pi_stime) * 1000 - self.Total = self.User + self.Sys - - return nil -} - -// Get returns arguments of a process -func (self *ProcArgs) Get(pid int) error { - /* If buffer is not large enough, args are truncated */ - buf := make([]byte, 8192) - info := C.struct_procsinfo64{} - info.pi_pid = C.pid_t(pid) - - if _, err := C.getargs(unsafe.Pointer(&info), C.sizeof_struct_procsinfo64, (*C.char)(&buf[0]), 8192); err != nil { - return err - } - - bbuf := bytes.NewBuffer(buf) - - var args []string - - for { - arg, err := bbuf.ReadBytes(0) - if err == io.EOF || arg[0] == 0 { - break - } - if err != nil { - return err - } - - args = append(args, string(chop(arg))) - } - - self.List = args - return nil -} - -// Get returns the environment of a process -func (self *ProcEnv) Get(pid int) error { - if self.Vars == nil { - self.Vars = map[string]string{} - } - - /* If buffer is not large enough, args are truncated */ - buf := make([]byte, 8192) - info := C.struct_procsinfo64{} - info.pi_pid = C.pid_t(pid) - - if _, err := C.getevars(unsafe.Pointer(&info), C.sizeof_struct_procsinfo64, (*C.char)(&buf[0]), 8192); err != nil { - return err - } - - bbuf := bytes.NewBuffer(buf) - - delim := []byte{61} // "=" - - for { - line, err := bbuf.ReadBytes(0) - if err == io.EOF || line[0] == 0 { - break - } - if err != nil { - return err - } - - pair := bytes.SplitN(chop(line), delim, 2) - if len(pair) != 2 { - return fmt.Errorf("Error reading process environment for PID: %d", pid) - } - self.Vars[string(pair[0])] = string(pair[1]) - } - - return nil -} - -// Get returns the path of the process executable -func (self *ProcExe) Get(pid int) error { - /* If buffer is not large enough, args are truncated */ - buf := make([]byte, 8192) - info := C.struct_procsinfo64{} - info.pi_pid = C.pid_t(pid) - - if _, err := C.getargs(unsafe.Pointer(&info), C.sizeof_struct_procsinfo64, (*C.char)(&buf[0]), 8192); err != nil { - return err - } - - bbuf := bytes.NewBuffer(buf) - - // retrieve the first argument - cmd, err := bbuf.ReadBytes(0) - if err != nil { - return err - } - self.Name = string(chop(cmd)) - - cwd, err := os.Readlink("/proc/" + strconv.Itoa(pid) + "/cwd") - if err != nil { - if !os.IsNotExist(err) { - return err - } - } - self.Cwd = cwd - - return nil -} - -// Get returns process filesystem usage. Not implimented on AIX. -func (*ProcFDUsage) Get(_ int) error { - return ErrNotImplemented{runtime.GOOS} -} - -// Get returns filesytem usage. Not implimented on AIX. -func (*FDUsage) Get() error { - return ErrNotImplemented{runtime.GOOS} -} - -// Get returns huge pages info. Not implimented on AIX. -func (*HugeTLBPages) Get() error { - return ErrNotImplemented{runtime.GOOS} -} diff --git a/vendor/github.com/elastic/gosigar/sigar_common_darwin.go b/vendor/github.com/elastic/gosigar/sigar_common_darwin.go deleted file mode 100644 index db02df71d5..0000000000 --- a/vendor/github.com/elastic/gosigar/sigar_common_darwin.go +++ /dev/null @@ -1,501 +0,0 @@ -// Copyright (c) 2012 VMware, Inc. - -package gosigar - -/* -#include -#include -#include -#include -#include -#include -#include -#include -#include -*/ -import "C" - -import ( - "bytes" - "encoding/binary" - "fmt" - "io" - "os/user" - "runtime" - "strconv" - "syscall" - "time" - "unsafe" -) - -// Get fetches LoadAverage data -func (self *LoadAverage) Get() error { - avg := []C.double{0, 0, 0} - - C.getloadavg(&avg[0], C.int(len(avg))) - - self.One = float64(avg[0]) - self.Five = float64(avg[1]) - self.Fifteen = float64(avg[2]) - - return nil -} - -// Get fetches memory data -func (self *Mem) Get() error { - var vmstat C.vm_statistics_data_t - - if err := sysctlbyname("hw.memsize", &self.Total); err != nil { - return err - } - - if err := vmInfo(&vmstat); err != nil { - return err - } - - kern := uint64(vmstat.inactive_count) << 12 - self.Free = uint64(vmstat.free_count) << 12 - - self.Used = self.Total - self.Free - self.ActualFree = self.Free + kern - self.ActualUsed = self.Used - kern - - return nil -} - -type xswUsage struct { - Total, Avail, Used uint64 -} - -// Get fetches swap data -func (self *Swap) Get() error { - swUsage := xswUsage{} - - if err := sysctlbyname("vm.swapusage", &swUsage); err != nil { - return err - } - - self.Total = swUsage.Total - self.Used = swUsage.Used - self.Free = swUsage.Avail - - return nil -} - -// Get fetches hugepages data -func (self *HugeTLBPages) Get() error { - return ErrNotImplemented{runtime.GOOS} -} - -// Get fetches CPU data -func (self *Cpu) Get() error { - var count C.mach_msg_type_number_t = C.HOST_CPU_LOAD_INFO_COUNT - var cpuload C.host_cpu_load_info_data_t - - status := C.host_statistics(C.host_t(C.mach_host_self()), - C.HOST_CPU_LOAD_INFO, - C.host_info_t(unsafe.Pointer(&cpuload)), - &count) - - if status != C.KERN_SUCCESS { - return fmt.Errorf("host_statistics error=%d", status) - } - - self.User = uint64(cpuload.cpu_ticks[C.CPU_STATE_USER]) - self.Sys = uint64(cpuload.cpu_ticks[C.CPU_STATE_SYSTEM]) - self.Idle = uint64(cpuload.cpu_ticks[C.CPU_STATE_IDLE]) - self.Nice = uint64(cpuload.cpu_ticks[C.CPU_STATE_NICE]) - - return nil -} - -// Get fetches CPU list data -func (self *CpuList) Get() error { - var count C.mach_msg_type_number_t - var cpuload *C.processor_cpu_load_info_data_t - var ncpu C.natural_t - - status := C.host_processor_info(C.host_t(C.mach_host_self()), - C.PROCESSOR_CPU_LOAD_INFO, - &ncpu, - (*C.processor_info_array_t)(unsafe.Pointer(&cpuload)), - &count) - - if status != C.KERN_SUCCESS { - return fmt.Errorf("host_processor_info error=%d", status) - } - - // jump through some cgo casting hoops and ensure we properly free - // the memory that cpuload points to - target := C.vm_map_t(C.mach_task_self_) - address := C.vm_address_t(uintptr(unsafe.Pointer(cpuload))) - defer C.vm_deallocate(target, address, C.vm_size_t(ncpu)) - - // the body of struct processor_cpu_load_info - // aka processor_cpu_load_info_data_t - var cpuTicks [C.CPU_STATE_MAX]uint32 - - // copy the cpuload array to a []byte buffer - // where we can binary.Read the data - size := int(ncpu) * binary.Size(cpuTicks) - buf := C.GoBytes(unsafe.Pointer(cpuload), C.int(size)) - - bbuf := bytes.NewBuffer(buf) - - self.List = make([]Cpu, 0, ncpu) - - for i := 0; i < int(ncpu); i++ { - cpu := Cpu{} - - err := binary.Read(bbuf, binary.LittleEndian, &cpuTicks) - if err != nil { - return err - } - - cpu.User = uint64(cpuTicks[C.CPU_STATE_USER]) - cpu.Sys = uint64(cpuTicks[C.CPU_STATE_SYSTEM]) - cpu.Idle = uint64(cpuTicks[C.CPU_STATE_IDLE]) - cpu.Nice = uint64(cpuTicks[C.CPU_STATE_NICE]) - - self.List = append(self.List, cpu) - } - - return nil -} - -// Get returns FD usage data -func (self *FDUsage) Get() error { - return ErrNotImplemented{runtime.GOOS} -} - -// Get returns filesystem data -func (self *FileSystemList) Get() error { - num, err := syscall.Getfsstat(nil, C.MNT_NOWAIT) - if err != nil { - return err - } - - buf := make([]syscall.Statfs_t, num) - - _, err = syscall.Getfsstat(buf, C.MNT_NOWAIT) - if err != nil { - return err - } - - fslist := make([]FileSystem, 0, num) - - for i := 0; i < num; i++ { - fs := FileSystem{} - fs.DirName = byteListToString(buf[i].Mntonname[:]) - fs.DevName = byteListToString(buf[i].Mntfromname[:]) - fs.SysTypeName = byteListToString(buf[i].Fstypename[:]) - - fslist = append(fslist, fs) - } - - self.List = fslist - - return err -} - -// Get returns a process list -func (self *ProcList) Get() error { - n := C.proc_listpids(C.PROC_ALL_PIDS, 0, nil, 0) - if n <= 0 { - return syscall.EINVAL - } - buf := make([]byte, n) - n = C.proc_listpids(C.PROC_ALL_PIDS, 0, unsafe.Pointer(&buf[0]), n) - if n <= 0 { - return syscall.ENOMEM - } - - var pid int32 - num := int(n) / binary.Size(pid) - list := make([]int, 0, num) - bbuf := bytes.NewBuffer(buf) - - for i := 0; i < num; i++ { - if err := binary.Read(bbuf, binary.LittleEndian, &pid); err != nil { - return err - } - if pid == 0 { - continue - } - - list = append(list, int(pid)) - } - - self.List = list - - return nil -} - -// Get returns process state data -func (self *ProcState) Get(pid int) error { - info := C.struct_proc_taskallinfo{} - - if err := taskInfo(pid, &info); err != nil { - return err - } - - self.Name = C.GoString(&info.pbsd.pbi_comm[0]) - - switch info.pbsd.pbi_status { - case C.SIDL: - self.State = RunStateIdle - case C.SRUN: - self.State = RunStateRun - case C.SSLEEP: - self.State = RunStateSleep - case C.SSTOP: - self.State = RunStateStop - case C.SZOMB: - self.State = RunStateZombie - default: - self.State = RunStateUnknown - } - - self.Ppid = int(info.pbsd.pbi_ppid) - - self.Pgid = int(info.pbsd.pbi_pgid) - - self.Tty = int(info.pbsd.e_tdev) - - self.Priority = int(info.ptinfo.pti_priority) - - self.Nice = int(info.pbsd.pbi_nice) - - // Get process username. Fallback to UID if username is not available. - uid := strconv.Itoa(int(info.pbsd.pbi_uid)) - user, err := user.LookupId(uid) - if err == nil && user.Username != "" { - self.Username = user.Username - } else { - self.Username = uid - } - - return nil -} - -// Get returns process memory data -func (self *ProcMem) Get(pid int) error { - info := C.struct_proc_taskallinfo{} - - if err := taskInfo(pid, &info); err != nil { - return err - } - - self.Size = uint64(info.ptinfo.pti_virtual_size) - self.Resident = uint64(info.ptinfo.pti_resident_size) - self.PageFaults = uint64(info.ptinfo.pti_faults) - - return nil -} - -// Get returns process time data -func (self *ProcTime) Get(pid int) error { - info := C.struct_proc_taskallinfo{} - - if err := taskInfo(pid, &info); err != nil { - return err - } - - self.User = - uint64(info.ptinfo.pti_total_user) / uint64(time.Millisecond) - - self.Sys = - uint64(info.ptinfo.pti_total_system) / uint64(time.Millisecond) - - self.Total = self.User + self.Sys - - self.StartTime = (uint64(info.pbsd.pbi_start_tvsec) * 1000) + - (uint64(info.pbsd.pbi_start_tvusec) / 1000) - - return nil -} - -// Get returns process arg data -func (self *ProcArgs) Get(pid int) error { - var args []string - - argv := func(arg string) { - args = append(args, arg) - } - - err := kernProcargs(pid, nil, argv, nil) - - self.List = args - - return err -} - -// Get returns process environment data -func (self *ProcEnv) Get(pid int) error { - if self.Vars == nil { - self.Vars = map[string]string{} - } - - env := func(k, v string) { - self.Vars[k] = v - } - - return kernProcargs(pid, nil, nil, env) -} - -// Get returns process exec data -func (self *ProcExe) Get(pid int) error { - exe := func(arg string) { - self.Name = arg - } - - return kernProcargs(pid, exe, nil, nil) -} - -// Get returns process file usage -func (self *ProcFDUsage) Get(pid int) error { - return ErrNotImplemented{runtime.GOOS} -} - -// kernProcargs is a wrapper around sysctl KERN_PROCARGS2 -// callbacks params are optional, -// up to the caller as to which pieces of data they want -func kernProcargs(pid int, - exe func(string), - argv func(string), - env func(string, string)) error { - - mib := []C.int{C.CTL_KERN, C.KERN_PROCARGS2, C.int(pid)} - argmax := uintptr(C.ARG_MAX) - buf := make([]byte, argmax) - err := sysctl(mib, &buf[0], &argmax, nil, 0) - if err != nil { - return nil - } - - bbuf := bytes.NewBuffer(buf) - bbuf.Truncate(int(argmax)) - - var argc int32 - binary.Read(bbuf, binary.LittleEndian, &argc) - - path, err := bbuf.ReadBytes(0) - if err != nil { - return fmt.Errorf("Error reading the argv[0]: %v", err) - } - if exe != nil { - exe(string(chop(path))) - } - - // skip trailing \0's - for { - c, err := bbuf.ReadByte() - if err != nil { - return fmt.Errorf("Error skipping nils: %v", err) - } - if c != 0 { - bbuf.UnreadByte() - break // start of argv[0] - } - } - - for i := 0; i < int(argc); i++ { - arg, err := bbuf.ReadBytes(0) - if err == io.EOF { - break - } - if err != nil { - return fmt.Errorf("Error reading args: %v", err) - } - if argv != nil { - argv(string(chop(arg))) - } - } - - if env == nil { - return nil - } - - delim := []byte{61} // "=" - - for { - line, err := bbuf.ReadBytes(0) - if err == io.EOF || line[0] == 0 { - break - } - if err != nil { - return fmt.Errorf("Error reading args: %v", err) - } - pair := bytes.SplitN(chop(line), delim, 2) - - if len(pair) != 2 { - return fmt.Errorf("Error reading process information for PID: %d", pid) - } - - env(string(pair[0]), string(pair[1])) - } - - return nil -} - -// XXX copied from zsyscall_darwin_amd64.go -func sysctl(mib []C.int, old *byte, oldlen *uintptr, - new *byte, newlen uintptr) (err error) { - var p0 unsafe.Pointer - p0 = unsafe.Pointer(&mib[0]) - _, _, e1 := syscall.Syscall6(syscall.SYS___SYSCTL, uintptr(p0), - uintptr(len(mib)), - uintptr(unsafe.Pointer(old)), uintptr(unsafe.Pointer(oldlen)), - uintptr(unsafe.Pointer(new)), uintptr(newlen)) - if e1 != 0 { - err = e1 - } - return -} - -func vmInfo(vmstat *C.vm_statistics_data_t) error { - var count C.mach_msg_type_number_t = C.HOST_VM_INFO_COUNT - - status := C.host_statistics( - C.host_t(C.mach_host_self()), - C.HOST_VM_INFO, - C.host_info_t(unsafe.Pointer(vmstat)), - &count) - - if status != C.KERN_SUCCESS { - return fmt.Errorf("host_statistics=%d", status) - } - - return nil -} - -// generic Sysctl buffer unmarshalling -func sysctlbyname(name string, data interface{}) (err error) { - val, err := syscall.Sysctl(name) - if err != nil { - return err - } - - buf := []byte(val) - - switch v := data.(type) { - case *uint64: - *v = *(*uint64)(unsafe.Pointer(&buf[0])) - return - } - - bbuf := bytes.NewBuffer([]byte(val)) - return binary.Read(bbuf, binary.LittleEndian, data) -} - -func taskInfo(pid int, info *C.struct_proc_taskallinfo) error { - size := C.int(unsafe.Sizeof(*info)) - ptr := unsafe.Pointer(info) - - n := C.proc_pidinfo(C.int(pid), C.PROC_PIDTASKALLINFO, 0, ptr, size) - if n != size { - return fmt.Errorf("Could not read process info for pid %d", pid) - } - - return nil -} diff --git a/vendor/github.com/elastic/gosigar/sigar_darwin.go b/vendor/github.com/elastic/gosigar/sigar_darwin.go deleted file mode 100644 index 8de53229e6..0000000000 --- a/vendor/github.com/elastic/gosigar/sigar_darwin.go +++ /dev/null @@ -1,20 +0,0 @@ -// +build !386 - -package gosigar - -import ( - "syscall" - "time" -) - -func (self *Uptime) Get() error { - tv := syscall.Timeval32{} - - if err := sysctlbyname("kern.boottime", &tv); err != nil { - return err - } - - self.Length = time.Since(time.Unix(int64(tv.Sec), int64(tv.Usec)*1000)).Seconds() - - return nil -} diff --git a/vendor/github.com/elastic/gosigar/sigar_darwin_386.go b/vendor/github.com/elastic/gosigar/sigar_darwin_386.go deleted file mode 100644 index 92c7ff040e..0000000000 --- a/vendor/github.com/elastic/gosigar/sigar_darwin_386.go +++ /dev/null @@ -1,18 +0,0 @@ -package gosigar - -import ( - "syscall" - "time" -) - -func (self *Uptime) Get() error { - tv := syscall.Timeval{} - - if err := sysctlbyname("kern.boottime", &tv); err != nil { - return err - } - - self.Length = time.Since(time.Unix(int64(tv.Sec), int64(tv.Usec)*1000)).Seconds() - - return nil -} diff --git a/vendor/github.com/elastic/gosigar/sigar_format.go b/vendor/github.com/elastic/gosigar/sigar_format.go deleted file mode 100644 index ac56c9873c..0000000000 --- a/vendor/github.com/elastic/gosigar/sigar_format.go +++ /dev/null @@ -1,126 +0,0 @@ -// Copyright (c) 2012 VMware, Inc. - -package gosigar - -import ( - "bufio" - "bytes" - "fmt" - "strconv" - "time" -) - -// Go version of apr_strfsize -func FormatSize(size uint64) string { - ord := []string{"K", "M", "G", "T", "P", "E"} - o := 0 - buf := new(bytes.Buffer) - w := bufio.NewWriter(buf) - - if size < 973 { - fmt.Fprintf(w, "%3d ", size) - w.Flush() - return buf.String() - } - - for { - remain := size & 1023 - size >>= 10 - - if size >= 973 { - o++ - continue - } - - if size < 9 || (size == 9 && remain < 973) { - remain = ((remain * 5) + 256) / 512 - if remain >= 10 { - size++ - remain = 0 - } - - fmt.Fprintf(w, "%d.%d%s", size, remain, ord[o]) - break - } - - if remain >= 512 { - size++ - } - - fmt.Fprintf(w, "%3d%s", size, ord[o]) - break - } - - w.Flush() - return buf.String() -} - -func FormatPercent(percent float64) string { - return strconv.FormatFloat(percent, 'f', -1, 64) + "%" -} - -func (self *FileSystemUsage) UsePercent() float64 { - b_used := (self.Total - self.Free) / 1024 - b_avail := self.Avail / 1024 - utotal := b_used + b_avail - used := b_used - - if utotal != 0 { - u100 := used * 100 - pct := u100 / utotal - if u100%utotal != 0 { - pct += 1 - } - return (float64(pct) / float64(100)) * 100.0 - } - - return 0.0 -} - -func (self *Uptime) Format() string { - buf := new(bytes.Buffer) - w := bufio.NewWriter(buf) - uptime := uint64(self.Length) - - days := uptime / (60 * 60 * 24) - - if days != 0 { - s := "" - if days > 1 { - s = "s" - } - fmt.Fprintf(w, "%d day%s, ", days, s) - } - - minutes := uptime / 60 - hours := minutes / 60 - hours %= 24 - minutes %= 60 - - fmt.Fprintf(w, "%2d:%02d", hours, minutes) - - w.Flush() - return buf.String() -} - -func (self *ProcTime) FormatStartTime() string { - if self.StartTime == 0 { - return "00:00" - } - start := time.Unix(int64(self.StartTime)/1000, 0) - format := "Jan02" - if time.Since(start).Seconds() < (60 * 60 * 24) { - format = "15:04" - } - return start.Format(format) -} - -func (self *ProcTime) FormatTotal() string { - t := self.Total / 1000 - ss := t % 60 - t /= 60 - mm := t % 60 - t /= 60 - hh := t % 24 - return fmt.Sprintf("%02d:%02d:%02d", hh, mm, ss) -} diff --git a/vendor/github.com/elastic/gosigar/sigar_freebsd.go b/vendor/github.com/elastic/gosigar/sigar_freebsd.go deleted file mode 100644 index 51dd84aae2..0000000000 --- a/vendor/github.com/elastic/gosigar/sigar_freebsd.go +++ /dev/null @@ -1,158 +0,0 @@ -// Copied and modified from sigar_linux.go. - -package gosigar - -import ( - "io/ioutil" - "runtime" - "strconv" - "strings" - "unsafe" -) - -/* -#include -#include -#include -#include -#include -#include -#include -#include -#include -*/ -import "C" - -func init() { - system.ticks = uint64(C.sysconf(C._SC_CLK_TCK)) - - Procd = "/compat/linux/proc" - - getLinuxBootTime() -} - -func getMountTableFileName() string { - return Procd + "/mtab" -} - -func (self *Uptime) Get() error { - ts := C.struct_timespec{} - - if _, err := C.clock_gettime(C.CLOCK_UPTIME, &ts); err != nil { - return err - } - - self.Length = float64(ts.tv_sec) + 1e-9*float64(ts.tv_nsec) - - return nil -} - -func (self *FDUsage) Get() error { - val := C.uint32_t(0) - sc := C.size_t(4) - - name := C.CString("kern.openfiles") - _, err := C.sysctlbyname(name, unsafe.Pointer(&val), &sc, nil, 0) - C.free(unsafe.Pointer(name)) - if err != nil { - return err - } - self.Open = uint64(val) - - name = C.CString("kern.maxfiles") - _, err = C.sysctlbyname(name, unsafe.Pointer(&val), &sc, nil, 0) - C.free(unsafe.Pointer(name)) - if err != nil { - return err - } - self.Max = uint64(val) - - self.Unused = self.Max - self.Open - - return nil -} - -func (self *ProcFDUsage) Get(pid int) error { - err := readFile("/proc/"+strconv.Itoa(pid)+"/rlimit", func(line string) bool { - if strings.HasPrefix(line, "nofile") { - fields := strings.Fields(line) - if len(fields) == 3 { - self.SoftLimit, _ = strconv.ParseUint(fields[1], 10, 64) - self.HardLimit, _ = strconv.ParseUint(fields[2], 10, 64) - } - return false - } - return true - }) - if err != nil { - return err - } - - // linprocfs only provides this information for this process (self). - fds, err := ioutil.ReadDir(procFileName(pid, "fd")) - if err != nil { - return err - } - self.Open = uint64(len(fds)) - - return nil -} - -func (self *HugeTLBPages) Get() error { - return ErrNotImplemented{runtime.GOOS} -} - -func parseCpuStat(self *Cpu, line string) error { - fields := strings.Fields(line) - - self.User, _ = strtoull(fields[1]) - self.Nice, _ = strtoull(fields[2]) - self.Sys, _ = strtoull(fields[3]) - self.Idle, _ = strtoull(fields[4]) - return nil -} - -func (self *Mem) Get() error { - val := C.uint32_t(0) - sc := C.size_t(4) - - name := C.CString("vm.stats.vm.v_page_count") - _, err := C.sysctlbyname(name, unsafe.Pointer(&val), &sc, nil, 0) - C.free(unsafe.Pointer(name)) - if err != nil { - return err - } - pagecount := uint64(val) - - name = C.CString("vm.stats.vm.v_page_size") - _, err = C.sysctlbyname(name, unsafe.Pointer(&val), &sc, nil, 0) - C.free(unsafe.Pointer(name)) - if err != nil { - return err - } - pagesize := uint64(val) - - name = C.CString("vm.stats.vm.v_free_count") - _, err = C.sysctlbyname(name, unsafe.Pointer(&val), &sc, nil, 0) - C.free(unsafe.Pointer(name)) - if err != nil { - return err - } - self.Free = uint64(val) * pagesize - - name = C.CString("vm.stats.vm.v_inactive_count") - _, err = C.sysctlbyname(name, unsafe.Pointer(&val), &sc, nil, 0) - C.free(unsafe.Pointer(name)) - if err != nil { - return err - } - kern := uint64(val) - - self.Total = uint64(pagecount * pagesize) - - self.Used = self.Total - self.Free - self.ActualFree = self.Free + (kern * pagesize) - self.ActualUsed = self.Used - (kern * pagesize) - - return nil -} diff --git a/vendor/github.com/elastic/gosigar/sigar_interface.go b/vendor/github.com/elastic/gosigar/sigar_interface.go deleted file mode 100644 index ee5e56bb85..0000000000 --- a/vendor/github.com/elastic/gosigar/sigar_interface.go +++ /dev/null @@ -1,240 +0,0 @@ -package gosigar - -import ( - "time" -) - -// ErrNotImplemented is returned when a particular statistic isn't implemented on the host OS. -type ErrNotImplemented struct { - OS string -} - -func (e ErrNotImplemented) Error() string { - return "not implemented on " + e.OS -} - -// IsNotImplemented returns true if the error is ErrNotImplemented -func IsNotImplemented(err error) bool { - switch err.(type) { - case ErrNotImplemented, *ErrNotImplemented: - return true - default: - return false - } -} - -// Sigar is an interface for gathering system host stats -type Sigar interface { - CollectCpuStats(collectionInterval time.Duration) (<-chan Cpu, chan<- struct{}) - GetLoadAverage() (LoadAverage, error) - GetMem() (Mem, error) - GetSwap() (Swap, error) - GetHugeTLBPages(HugeTLBPages, error) - GetFileSystemUsage(string) (FileSystemUsage, error) - GetFDUsage() (FDUsage, error) - GetRusage(who int) (Rusage, error) -} - -// Cpu contains CPU time stats -type Cpu struct { - User uint64 - Nice uint64 - Sys uint64 - Idle uint64 - Wait uint64 - Irq uint64 - SoftIrq uint64 - Stolen uint64 -} - -// Total returns total CPU time -func (cpu *Cpu) Total() uint64 { - return cpu.User + cpu.Nice + cpu.Sys + cpu.Idle + - cpu.Wait + cpu.Irq + cpu.SoftIrq + cpu.Stolen -} - -// Delta returns the difference between two Cpu stat objects -func (cpu Cpu) Delta(other Cpu) Cpu { - return Cpu{ - User: cpu.User - other.User, - Nice: cpu.Nice - other.Nice, - Sys: cpu.Sys - other.Sys, - Idle: cpu.Idle - other.Idle, - Wait: cpu.Wait - other.Wait, - Irq: cpu.Irq - other.Irq, - SoftIrq: cpu.SoftIrq - other.SoftIrq, - Stolen: cpu.Stolen - other.Stolen, - } -} - -// LoadAverage reports standard load averages -type LoadAverage struct { - One, Five, Fifteen float64 -} - -// Uptime reports system uptime -type Uptime struct { - Length float64 -} - -// Mem contains host memory stats -type Mem struct { - Total uint64 - Used uint64 - Free uint64 - Cached uint64 - ActualFree uint64 - ActualUsed uint64 -} - -// Swap contains stats on swap space -type Swap struct { - Total uint64 - Used uint64 - Free uint64 -} - -// HugeTLBPages contains HugePages stats -type HugeTLBPages struct { - Total uint64 - Free uint64 - Reserved uint64 - Surplus uint64 - DefaultSize uint64 - TotalAllocatedSize uint64 -} - -// CpuList contains a list of CPUs on the host system -type CpuList struct { - List []Cpu -} - -// FDUsage contains stats on filesystem usage -type FDUsage struct { - Open uint64 - Unused uint64 - Max uint64 -} - -// FileSystem contains basic information about a given mounted filesystem -type FileSystem struct { - DirName string - DevName string - TypeName string - SysTypeName string - Options string - Flags uint32 -} - -// FileSystemList gets a list of mounted filesystems -type FileSystemList struct { - List []FileSystem -} - -// FileSystemUsage contains basic stats for the specified filesystem -type FileSystemUsage struct { - Total uint64 - Used uint64 - Free uint64 - Avail uint64 - Files uint64 - FreeFiles uint64 -} - -// ProcList contains a list of processes found on the host system -type ProcList struct { - List []int -} - -// RunState is a byte-long code used to specify the current runtime state of a process -type RunState byte - -const ( - // RunStateSleep corresponds to a sleep state - RunStateSleep = 'S' - // RunStateRun corresponds to a running state - RunStateRun = 'R' - // RunStateStop corresponds to a stopped state - RunStateStop = 'T' - // RunStateZombie marks a zombie process - RunStateZombie = 'Z' - // RunStateIdle corresponds to an idle state - RunStateIdle = 'D' - // RunStateUnknown corresponds to a process in an unknown state - RunStateUnknown = '?' -) - -// ProcState contains basic metadata and process ownership info for the specified process -type ProcState struct { - Name string - Username string - State RunState - Ppid int - Pgid int - Tty int - Priority int - Nice int - Processor int -} - -// ProcMem contains memory statistics for a specified process -type ProcMem struct { - Size uint64 - Resident uint64 - Share uint64 - MinorFaults uint64 - MajorFaults uint64 - PageFaults uint64 -} - -// ProcTime contains run time statistics for a specified process -type ProcTime struct { - StartTime uint64 - User uint64 - Sys uint64 - Total uint64 -} - -// ProcArgs contains a list of args for a specified process -type ProcArgs struct { - List []string -} - -// ProcEnv contains a map of environment variables for specified process -type ProcEnv struct { - Vars map[string]string -} - -// ProcExe contains basic data about a specified process -type ProcExe struct { - Name string - Cwd string - Root string -} - -// ProcFDUsage contains data on file limits and usage -type ProcFDUsage struct { - Open uint64 - SoftLimit uint64 - HardLimit uint64 -} - -// Rusage contains data on resource usage for a specified process -type Rusage struct { - Utime time.Duration - Stime time.Duration - Maxrss int64 - Ixrss int64 - Idrss int64 - Isrss int64 - Minflt int64 - Majflt int64 - Nswap int64 - Inblock int64 - Oublock int64 - Msgsnd int64 - Msgrcv int64 - Nsignals int64 - Nvcsw int64 - Nivcsw int64 -} diff --git a/vendor/github.com/elastic/gosigar/sigar_linux.go b/vendor/github.com/elastic/gosigar/sigar_linux.go deleted file mode 100644 index 930caf60d9..0000000000 --- a/vendor/github.com/elastic/gosigar/sigar_linux.go +++ /dev/null @@ -1,138 +0,0 @@ -// Copyright (c) 2012 VMware, Inc. - -package gosigar - -import ( - "io/ioutil" - "strconv" - "strings" - "syscall" -) - -func init() { - system.ticks = 100 // C.sysconf(C._SC_CLK_TCK) - - Procd = "/proc" - - getLinuxBootTime() -} - -func getMountTableFileName() string { - return "/etc/mtab" -} - -// Get returns uptime data -func (self *Uptime) Get() error { - sysinfo := syscall.Sysinfo_t{} - - if err := syscall.Sysinfo(&sysinfo); err != nil { - return err - } - - self.Length = float64(sysinfo.Uptime) - - return nil -} - -// Get returns FD usage data -func (self *FDUsage) Get() error { - return readFile(Procd+"/sys/fs/file-nr", func(line string) bool { - fields := strings.Fields(line) - if len(fields) == 3 { - self.Open, _ = strconv.ParseUint(fields[0], 10, 64) - self.Unused, _ = strconv.ParseUint(fields[1], 10, 64) - self.Max, _ = strconv.ParseUint(fields[2], 10, 64) - } - return false - }) -} - -// Get returns hugepages data -func (self *HugeTLBPages) Get() error { - table, err := parseMeminfo() - if err != nil { - return err - } - - self.Total, _ = table["HugePages_Total"] - self.Free, _ = table["HugePages_Free"] - self.Reserved, _ = table["HugePages_Rsvd"] - self.Surplus, _ = table["HugePages_Surp"] - self.DefaultSize, _ = table["Hugepagesize"] - - if totalSize, found := table["Hugetlb"]; found { - self.TotalAllocatedSize = totalSize - } else { - // If Hugetlb is not present, or huge pages of different sizes - // are used, this figure can be unaccurate. - // TODO (jsoriano): Extract information from /sys/kernel/mm/hugepages too - self.TotalAllocatedSize = (self.Total - self.Free + self.Reserved) * self.DefaultSize - } - - return nil -} - -// Get returns process FD usage -func (self *ProcFDUsage) Get(pid int) error { - err := readFile(procFileName(pid, "limits"), func(line string) bool { - if strings.HasPrefix(line, "Max open files") { - fields := strings.Fields(line) - if len(fields) == 6 { - self.SoftLimit, _ = strconv.ParseUint(fields[3], 10, 64) - self.HardLimit, _ = strconv.ParseUint(fields[4], 10, 64) - } - return false - } - return true - }) - if err != nil { - return err - } - fds, err := ioutil.ReadDir(procFileName(pid, "fd")) - if err != nil { - return err - } - self.Open = uint64(len(fds)) - return nil -} - -func parseCpuStat(self *Cpu, line string) error { - fields := strings.Fields(line) - - self.User, _ = strtoull(fields[1]) - self.Nice, _ = strtoull(fields[2]) - self.Sys, _ = strtoull(fields[3]) - self.Idle, _ = strtoull(fields[4]) - self.Wait, _ = strtoull(fields[5]) - self.Irq, _ = strtoull(fields[6]) - self.SoftIrq, _ = strtoull(fields[7]) - self.Stolen, _ = strtoull(fields[8]) - - return nil -} - -// Get returns memory data -func (self *Mem) Get() error { - - table, err := parseMeminfo() - if err != nil { - return err - } - - self.Total, _ = table["MemTotal"] - self.Free, _ = table["MemFree"] - buffers, _ := table["Buffers"] - self.Cached, _ = table["Cached"] - - if available, ok := table["MemAvailable"]; ok { - // MemAvailable is in /proc/meminfo (kernel 3.14+) - self.ActualFree = available - } else { - self.ActualFree = self.Free + buffers + self.Cached - } - - self.Used = self.Total - self.Free - self.ActualUsed = self.Total - self.ActualFree - - return nil -} diff --git a/vendor/github.com/elastic/gosigar/sigar_linux_common.go b/vendor/github.com/elastic/gosigar/sigar_linux_common.go deleted file mode 100644 index e2c5e246d5..0000000000 --- a/vendor/github.com/elastic/gosigar/sigar_linux_common.go +++ /dev/null @@ -1,457 +0,0 @@ -// Copyright (c) 2012 VMware, Inc. - -// +build freebsd linux - -package gosigar - -import ( - "bufio" - "bytes" - "fmt" - "io" - "io/ioutil" - "os" - "os/user" - "path/filepath" - "strconv" - "strings" - "syscall" -) - -var system struct { - ticks uint64 - btime uint64 -} - -var Procd string - -func getLinuxBootTime() { - // grab system boot time - readFile(Procd+"/stat", func(line string) bool { - if strings.HasPrefix(line, "btime") { - system.btime, _ = strtoull(line[6:]) - return false // stop reading - } - return true - }) -} - -func (self *LoadAverage) Get() error { - line, err := ioutil.ReadFile(Procd + "/loadavg") - if err != nil { - return nil - } - - fields := strings.Fields(string(line)) - - self.One, _ = strconv.ParseFloat(fields[0], 64) - self.Five, _ = strconv.ParseFloat(fields[1], 64) - self.Fifteen, _ = strconv.ParseFloat(fields[2], 64) - - return nil -} - -func (self *Swap) Get() error { - - table, err := parseMeminfo() - if err != nil { - return err - } - self.Total, _ = table["SwapTotal"] - self.Free, _ = table["SwapFree"] - - self.Used = self.Total - self.Free - return nil -} - -func (self *Cpu) Get() error { - return readFile(Procd+"/stat", func(line string) bool { - if len(line) > 4 && line[0:4] == "cpu " { - parseCpuStat(self, line) - return false - } - return true - - }) -} - -func (self *CpuList) Get() error { - capacity := len(self.List) - if capacity == 0 { - capacity = 4 - } - list := make([]Cpu, 0, capacity) - - err := readFile(Procd+"/stat", func(line string) bool { - if len(line) > 3 && line[0:3] == "cpu" && line[3] != ' ' { - cpu := Cpu{} - parseCpuStat(&cpu, line) - list = append(list, cpu) - } - return true - }) - - self.List = list - - return err -} - -func (self *FileSystemList) Get() error { - capacity := len(self.List) - if capacity == 0 { - capacity = 10 - } - fslist := make([]FileSystem, 0, capacity) - - err := readFile(getMountTableFileName(), func(line string) bool { - fields := strings.Fields(line) - - fs := FileSystem{} - fs.DevName = fields[0] - fs.DirName = fields[1] - fs.SysTypeName = fields[2] - fs.Options = fields[3] - - fslist = append(fslist, fs) - - return true - }) - - self.List = fslist - - return err -} - -func (self *ProcList) Get() error { - dir, err := os.Open(Procd) - if err != nil { - return err - } - defer dir.Close() - - const readAllDirnames = -1 // see os.File.Readdirnames doc - - names, err := dir.Readdirnames(readAllDirnames) - if err != nil { - return err - } - - capacity := len(names) - list := make([]int, 0, capacity) - - for _, name := range names { - if name[0] < '0' || name[0] > '9' { - continue - } - pid, err := strconv.Atoi(name) - if err == nil { - list = append(list, pid) - } - } - - self.List = list - - return nil -} - -func (self *ProcState) Get(pid int) error { - data, err := readProcFile(pid, "stat") - if err != nil { - return err - } - - // Extract the comm value with is surrounded by parentheses. - lIdx := bytes.Index(data, []byte("(")) - rIdx := bytes.LastIndex(data, []byte(")")) - if lIdx < 0 || rIdx < 0 || lIdx >= rIdx || rIdx+2 >= len(data) { - return fmt.Errorf("failed to extract comm for pid %d from '%v'", pid, string(data)) - } - self.Name = string(data[lIdx+1 : rIdx]) - - // Extract the rest of the fields that we are interested in. - fields := bytes.Fields(data[rIdx+2:]) - if len(fields) <= 36 { - return fmt.Errorf("expected more stat fields for pid %d from '%v'", pid, string(data)) - } - - interests := bytes.Join([][]byte{ - fields[0], // state - fields[1], // ppid - fields[2], // pgrp - fields[4], // tty_nr - fields[15], // priority - fields[16], // nice - fields[36], // processor (last processor executed on) - }, []byte(" ")) - - var state string - _, err = fmt.Fscan(bytes.NewBuffer(interests), - &state, - &self.Ppid, - &self.Pgid, - &self.Tty, - &self.Priority, - &self.Nice, - &self.Processor, - ) - if err != nil { - return fmt.Errorf("failed to parse stat fields for pid %d from '%v': %v", pid, string(data), err) - } - self.State = RunState(state[0]) - - // Read /proc/[pid]/status to get the uid, then lookup uid to get username. - status, err := getProcStatus(pid) - if err != nil { - return fmt.Errorf("failed to read process status for pid %d: %v", pid, err) - } - uids, err := getUIDs(status) - if err != nil { - return fmt.Errorf("failed to read process status for pid %d: %v", pid, err) - } - user, err := user.LookupId(uids[0]) - if err == nil { - self.Username = user.Username - } else { - self.Username = uids[0] - } - - return nil -} - -func (self *ProcMem) Get(pid int) error { - contents, err := readProcFile(pid, "statm") - if err != nil { - return err - } - - fields := strings.Fields(string(contents)) - - size, _ := strtoull(fields[0]) - self.Size = size << 12 - - rss, _ := strtoull(fields[1]) - self.Resident = rss << 12 - - share, _ := strtoull(fields[2]) - self.Share = share << 12 - - contents, err = readProcFile(pid, "stat") - if err != nil { - return err - } - - fields = strings.Fields(string(contents)) - - self.MinorFaults, _ = strtoull(fields[10]) - self.MajorFaults, _ = strtoull(fields[12]) - self.PageFaults = self.MinorFaults + self.MajorFaults - - return nil -} - -func (self *ProcTime) Get(pid int) error { - contents, err := readProcFile(pid, "stat") - if err != nil { - return err - } - - fields := strings.Fields(string(contents)) - - user, _ := strtoull(fields[13]) - sys, _ := strtoull(fields[14]) - // convert to millis - self.User = user * (1000 / system.ticks) - self.Sys = sys * (1000 / system.ticks) - self.Total = self.User + self.Sys - - // convert to millis - self.StartTime, _ = strtoull(fields[21]) - self.StartTime /= system.ticks - self.StartTime += system.btime - self.StartTime *= 1000 - - return nil -} - -func (self *ProcArgs) Get(pid int) error { - contents, err := readProcFile(pid, "cmdline") - if err != nil { - return err - } - - bbuf := bytes.NewBuffer(contents) - - var args []string - - for { - arg, err := bbuf.ReadBytes(0) - if err == io.EOF { - break - } - args = append(args, string(chop(arg))) - } - - self.List = args - - return nil -} - -func (self *ProcEnv) Get(pid int) error { - contents, err := readProcFile(pid, "environ") - if err != nil { - return err - } - - if self.Vars == nil { - self.Vars = map[string]string{} - } - - pairs := bytes.Split(contents, []byte{0}) - for _, kv := range pairs { - parts := bytes.SplitN(kv, []byte{'='}, 2) - if len(parts) != 2 { - continue - } - - key := string(bytes.TrimSpace(parts[0])) - if key == "" { - continue - } - - self.Vars[key] = string(bytes.TrimSpace(parts[1])) - } - - return nil -} - -func (self *ProcExe) Get(pid int) error { - fields := map[string]*string{ - "exe": &self.Name, - "cwd": &self.Cwd, - "root": &self.Root, - } - - for name, field := range fields { - val, err := os.Readlink(procFileName(pid, name)) - - if err != nil { - return err - } - - *field = val - } - - return nil -} - -func parseMeminfo() (map[string]uint64, error) { - table := map[string]uint64{} - - err := readFile(Procd+"/meminfo", func(line string) bool { - fields := strings.Split(line, ":") - - if len(fields) != 2 { - return true // skip on errors - } - - valueUnit := strings.Fields(fields[1]) - value, err := strtoull(valueUnit[0]) - if err != nil { - return true // skip on errors - } - - if len(valueUnit) > 1 && valueUnit[1] == "kB" { - value *= 1024 - } - table[fields[0]] = value - - return true - }) - return table, err -} - -func readFile(file string, handler func(string) bool) error { - contents, err := ioutil.ReadFile(file) - if err != nil { - return err - } - - reader := bufio.NewReader(bytes.NewBuffer(contents)) - - for { - line, _, err := reader.ReadLine() - if err == io.EOF { - break - } - if !handler(string(line)) { - break - } - } - - return nil -} - -func strtoull(val string) (uint64, error) { - return strconv.ParseUint(val, 10, 64) -} - -func procFileName(pid int, name string) string { - return Procd + "/" + strconv.Itoa(pid) + "/" + name -} - -func readProcFile(pid int, name string) (content []byte, err error) { - path := procFileName(pid, name) - - // Panics have been reported when reading proc files, let's recover and - // report the path if this happens - // See https://github.com/elastic/beats/issues/6692 - defer func() { - if r := recover(); r != nil { - content = nil - err = fmt.Errorf("recovered panic when reading proc file '%s': %v", path, r) - } - }() - contents, err := ioutil.ReadFile(path) - - if err != nil { - if perr, ok := err.(*os.PathError); ok { - if perr.Err == syscall.ENOENT { - return nil, syscall.ESRCH - } - } - } - - return contents, err -} - -// getProcStatus reads /proc/[pid]/status which contains process status -// information in human readable form. -func getProcStatus(pid int) (map[string]string, error) { - status := make(map[string]string, 42) - path := filepath.Join(Procd, strconv.Itoa(pid), "status") - err := readFile(path, func(line string) bool { - fields := strings.SplitN(line, ":", 2) - if len(fields) == 2 { - status[fields[0]] = strings.TrimSpace(fields[1]) - } - - return true - }) - return status, err -} - -// getUIDs reads the "Uid" value from status and splits it into four values -- -// real, effective, saved set, and file system UIDs. -func getUIDs(status map[string]string) ([]string, error) { - uidLine, ok := status["Uid"] - if !ok { - return nil, fmt.Errorf("Uid not found in proc status") - } - - uidStrs := strings.Fields(uidLine) - if len(uidStrs) != 4 { - return nil, fmt.Errorf("Uid line ('%s') did not contain four values", uidLine) - } - - return uidStrs, nil -} diff --git a/vendor/github.com/elastic/gosigar/sigar_openbsd.go b/vendor/github.com/elastic/gosigar/sigar_openbsd.go deleted file mode 100644 index c537f029f7..0000000000 --- a/vendor/github.com/elastic/gosigar/sigar_openbsd.go +++ /dev/null @@ -1,426 +0,0 @@ -// Copyright (c) 2016 Jasper Lievisse Adriaanse . - -// +build openbsd - -package gosigar - -/* -#include -#include -#include -#include -#include -#include -#include -#include -*/ -import "C" - -//import "github.com/davecgh/go-spew/spew" - -import ( - "runtime" - "syscall" - "time" - "unsafe" -) - -type Uvmexp struct { - pagesize uint32 - pagemask uint32 - pageshift uint32 - npages uint32 - free uint32 - active uint32 - inactive uint32 - paging uint32 - wired uint32 - zeropages uint32 - reserve_pagedaemon uint32 - reserve_kernel uint32 - anonpages uint32 - vnodepages uint32 - vtextpages uint32 - freemin uint32 - freetarg uint32 - inactarg uint32 - wiredmax uint32 - anonmin uint32 - vtextmin uint32 - vnodemin uint32 - anonminpct uint32 - vtextmi uint32 - npct uint32 - vnodeminpct uint32 - nswapdev uint32 - swpages uint32 - swpginuse uint32 - swpgonly uint32 - nswget uint32 - nanon uint32 - nanonneeded uint32 - nfreeanon uint32 - faults uint32 - traps uint32 - intrs uint32 - swtch uint32 - softs uint32 - syscalls uint32 - pageins uint32 - obsolete_swapins uint32 - obsolete_swapouts uint32 - pgswapin uint32 - pgswapout uint32 - forks uint32 - forks_ppwait uint32 - forks_sharevm uint32 - pga_zerohit uint32 - pga_zeromiss uint32 - zeroaborts uint32 - fltnoram uint32 - fltnoanon uint32 - fltpgwait uint32 - fltpgrele uint32 - fltrelck uint32 - fltrelckok uint32 - fltanget uint32 - fltanretry uint32 - fltamcopy uint32 - fltnamap uint32 - fltnomap uint32 - fltlget uint32 - fltget uint32 - flt_anon uint32 - flt_acow uint32 - flt_obj uint32 - flt_prcopy uint32 - flt_przero uint32 - pdwoke uint32 - pdrevs uint32 - pdswout uint32 - pdfreed uint32 - pdscans uint32 - pdanscan uint32 - pdobscan uint32 - pdreact uint32 - pdbusy uint32 - pdpageouts uint32 - pdpending uint32 - pddeact uint32 - pdreanon uint32 - pdrevnode uint32 - pdrevtext uint32 - fpswtch uint32 - kmapent uint32 -} - -type Bcachestats struct { - numbufs uint64 - numbufpages uint64 - numdirtypages uint64 - numcleanpages uint64 - pendingwrites uint64 - pendingreads uint64 - numwrites uint64 - numreads uint64 - cachehits uint64 - busymapped uint64 - dmapages uint64 - highpages uint64 - delwribufs uint64 - kvaslots uint64 - kvaslots_avail uint64 -} - -type Swapent struct { - se_dev C.dev_t - se_flags int32 - se_nblks int32 - se_inuse int32 - se_priority int32 - sw_path []byte -} - -func (self *FileSystemList) Get() error { - num, err := syscall.Getfsstat(nil, C.MNT_NOWAIT) - if err != nil { - return err - } - - buf := make([]syscall.Statfs_t, num) - - _, err = syscall.Getfsstat(buf, C.MNT_NOWAIT) - if err != nil { - return err - } - - fslist := make([]FileSystem, 0, num) - - for i := 0; i < num; i++ { - fs := FileSystem{} - - fs.DirName = byteListToString(buf[i].F_mntonname[:]) - fs.DevName = byteListToString(buf[i].F_mntfromname[:]) - fs.SysTypeName = byteListToString(buf[i].F_fstypename[:]) - - fslist = append(fslist, fs) - } - - self.List = fslist - - return err -} - -func (self *FileSystemUsage) Get(path string) error { - stat := syscall.Statfs_t{} - err := syscall.Statfs(path, &stat) - if err != nil { - return err - } - - self.Total = uint64(stat.F_blocks) * uint64(stat.F_bsize) - self.Free = uint64(stat.F_bfree) * uint64(stat.F_bsize) - self.Avail = uint64(stat.F_bavail) * uint64(stat.F_bsize) - self.Used = self.Total - self.Free - self.Files = stat.F_files - self.FreeFiles = stat.F_ffree - - return nil -} - -func (self *FDUsage) Get() error { - return ErrNotImplemented{runtime.GOOS} -} - -func (self *LoadAverage) Get() error { - avg := []C.double{0, 0, 0} - - C.getloadavg(&avg[0], C.int(len(avg))) - - self.One = float64(avg[0]) - self.Five = float64(avg[1]) - self.Fifteen = float64(avg[2]) - - return nil -} - -func (self *Uptime) Get() error { - tv := syscall.Timeval{} - mib := [2]int32{C.CTL_KERN, C.KERN_BOOTTIME} - - n := uintptr(0) - // First we determine how much memory we'll need to pass later on (via `n`) - _, _, errno := syscall.Syscall6(syscall.SYS___SYSCTL, uintptr(unsafe.Pointer(&mib[0])), 2, 0, uintptr(unsafe.Pointer(&n)), 0, 0) - - if errno != 0 || n == 0 { - return nil - } - - // Now perform the actual sysctl(3) call, storing the result in tv - _, _, errno = syscall.Syscall6(syscall.SYS___SYSCTL, uintptr(unsafe.Pointer(&mib[0])), 2, uintptr(unsafe.Pointer(&tv)), uintptr(unsafe.Pointer(&n)), 0, 0) - - if errno != 0 || n == 0 { - return nil - } - - self.Length = time.Since(time.Unix(int64(tv.Sec), int64(tv.Usec)*1000)).Seconds() - - return nil -} - -func (self *Mem) Get() error { - n := uintptr(0) - - var uvmexp Uvmexp - mib := [2]int32{C.CTL_VM, C.VM_UVMEXP} - n = uintptr(0) - // First we determine how much memory we'll need to pass later on (via `n`) - _, _, errno := syscall.Syscall6(syscall.SYS___SYSCTL, uintptr(unsafe.Pointer(&mib[0])), 2, 0, uintptr(unsafe.Pointer(&n)), 0, 0) - if errno != 0 || n == 0 { - return nil - } - - _, _, errno = syscall.Syscall6(syscall.SYS___SYSCTL, uintptr(unsafe.Pointer(&mib[0])), 2, uintptr(unsafe.Pointer(&uvmexp)), uintptr(unsafe.Pointer(&n)), 0, 0) - if errno != 0 || n == 0 { - return nil - } - - var bcachestats Bcachestats - mib3 := [3]int32{C.CTL_VFS, C.VFS_GENERIC, C.VFS_BCACHESTAT} - n = uintptr(0) - _, _, errno = syscall.Syscall6(syscall.SYS___SYSCTL, uintptr(unsafe.Pointer(&mib3[0])), 3, 0, uintptr(unsafe.Pointer(&n)), 0, 0) - if errno != 0 || n == 0 { - return nil - } - _, _, errno = syscall.Syscall6(syscall.SYS___SYSCTL, uintptr(unsafe.Pointer(&mib3[0])), 3, uintptr(unsafe.Pointer(&bcachestats)), uintptr(unsafe.Pointer(&n)), 0, 0) - if errno != 0 || n == 0 { - return nil - } - - self.Total = uint64(uvmexp.npages) << uvmexp.pageshift - self.Used = uint64(uvmexp.npages-uvmexp.free) << uvmexp.pageshift - self.Free = uint64(uvmexp.free) << uvmexp.pageshift - - self.ActualFree = self.Free + (uint64(bcachestats.numbufpages) << uvmexp.pageshift) - self.ActualUsed = self.Used - (uint64(bcachestats.numbufpages) << uvmexp.pageshift) - - return nil -} - -func (self *Swap) Get() error { - nswap := C.swapctl(C.SWAP_NSWAP, unsafe.Pointer(uintptr(0)), 0) - - // If there are no swap devices, nothing to do here. - if nswap == 0 { - return nil - } - - swdev := make([]Swapent, nswap) - - rnswap := C.swapctl(C.SWAP_STATS, unsafe.Pointer(&swdev[0]), nswap) - if rnswap == 0 { - return nil - } - - for i := 0; i < int(nswap); i++ { - if swdev[i].se_flags&C.SWF_ENABLE == 2 { - self.Used = self.Used + uint64(swdev[i].se_inuse/(1024/C.DEV_BSIZE)) - self.Total = self.Total + uint64(swdev[i].se_nblks/(1024/C.DEV_BSIZE)) - } - } - - self.Free = self.Total - self.Used - - return nil -} - -func (self *HugeTLBPages) Get() error { - return ErrNotImplemented{runtime.GOOS} -} - -func (self *Cpu) Get() error { - load := [C.CPUSTATES]C.long{C.CP_USER, C.CP_NICE, C.CP_SYS, C.CP_INTR, C.CP_IDLE} - - mib := [2]int32{C.CTL_KERN, C.KERN_CPTIME} - n := uintptr(0) - // First we determine how much memory we'll need to pass later on (via `n`) - _, _, errno := syscall.Syscall6(syscall.SYS___SYSCTL, uintptr(unsafe.Pointer(&mib[0])), 2, 0, uintptr(unsafe.Pointer(&n)), 0, 0) - if errno != 0 || n == 0 { - return nil - } - - _, _, errno = syscall.Syscall6(syscall.SYS___SYSCTL, uintptr(unsafe.Pointer(&mib[0])), 2, uintptr(unsafe.Pointer(&load)), uintptr(unsafe.Pointer(&n)), 0, 0) - if errno != 0 || n == 0 { - return nil - } - - self.User = uint64(load[0]) - self.Nice = uint64(load[1]) - self.Sys = uint64(load[2]) - self.Irq = uint64(load[3]) - self.Idle = uint64(load[4]) - - return nil -} - -func (self *CpuList) Get() error { - mib := [2]int32{C.CTL_HW, C.HW_NCPU} - var ncpu int - - n := uintptr(0) - // First we determine how much memory we'll need to pass later on (via `n`) - _, _, errno := syscall.Syscall6(syscall.SYS___SYSCTL, uintptr(unsafe.Pointer(&mib[0])), 2, 0, uintptr(unsafe.Pointer(&n)), 0, 0) - - if errno != 0 || n == 0 { - return nil - } - - // Now perform the actual sysctl(3) call, storing the result in ncpu - _, _, errno = syscall.Syscall6(syscall.SYS___SYSCTL, uintptr(unsafe.Pointer(&mib[0])), 2, uintptr(unsafe.Pointer(&ncpu)), uintptr(unsafe.Pointer(&n)), 0, 0) - - if errno != 0 || n == 0 { - return nil - } - - load := [C.CPUSTATES]C.long{C.CP_USER, C.CP_NICE, C.CP_SYS, C.CP_INTR, C.CP_IDLE} - - self.List = make([]Cpu, ncpu) - for curcpu := range self.List { - sysctlCptime(ncpu, curcpu, &load) - fillCpu(&self.List[curcpu], load) - } - - return nil -} - -func (self *ProcList) Get() error { - return nil -} - -func (self *ProcArgs) Get(pid int) error { - return nil -} - -func (self *ProcEnv) Get(pid int) error { - return ErrNotImplemented{runtime.GOOS} -} - -func (self *ProcState) Get(pid int) error { - return nil -} - -func (self *ProcMem) Get(pid int) error { - return nil -} - -func (self *ProcTime) Get(pid int) error { - return ErrNotImplemented{runtime.GOOS} -} - -func (self *ProcExe) Get(pid int) error { - return nil -} - -func (self *ProcFDUsage) Get(pid int) error { - return ErrNotImplemented{runtime.GOOS} -} - -func (self *Rusage) Get(pid int) error { - return ErrNotImplemented{runtime.GOOS} -} - -func fillCpu(cpu *Cpu, load [C.CPUSTATES]C.long) { - cpu.User = uint64(load[0]) - cpu.Nice = uint64(load[1]) - cpu.Sys = uint64(load[2]) - cpu.Irq = uint64(load[3]) - cpu.Idle = uint64(load[4]) -} - -func sysctlCptime(ncpu int, curcpu int, load *[C.CPUSTATES]C.long) error { - var mib []int32 - - // Use the correct mib based on the number of CPUs and fill out the - // current CPU number in case of SMP. (0 indexed cf. self.List) - if ncpu == 0 { - mib = []int32{C.CTL_KERN, C.KERN_CPTIME} - } else { - mib = []int32{C.CTL_KERN, C.KERN_CPTIME2, int32(curcpu)} - } - - len := len(mib) - - n := uintptr(0) - // First we determine how much memory we'll need to pass later on (via `n`) - _, _, errno := syscall.Syscall6(syscall.SYS___SYSCTL, uintptr(unsafe.Pointer(&mib[0])), uintptr(len), 0, uintptr(unsafe.Pointer(&n)), 0, 0) - if errno != 0 || n == 0 { - return nil - } - - _, _, errno = syscall.Syscall6(syscall.SYS___SYSCTL, uintptr(unsafe.Pointer(&mib[0])), uintptr(len), uintptr(unsafe.Pointer(load)), uintptr(unsafe.Pointer(&n)), 0, 0) - if errno != 0 || n == 0 { - return nil - } - - return nil -} diff --git a/vendor/github.com/elastic/gosigar/sigar_stub.go b/vendor/github.com/elastic/gosigar/sigar_stub.go deleted file mode 100644 index 4156439dfb..0000000000 --- a/vendor/github.com/elastic/gosigar/sigar_stub.go +++ /dev/null @@ -1,75 +0,0 @@ -// +build !aix,!darwin,!freebsd,!linux,!openbsd,!windows - -package gosigar - -import ( - "runtime" -) - -func (c *Cpu) Get() error { - return ErrNotImplemented{runtime.GOOS} -} - -func (l *LoadAverage) Get() error { - return ErrNotImplemented{runtime.GOOS} -} - -func (m *Mem) Get() error { - return ErrNotImplemented{runtime.GOOS} -} - -func (s *Swap) Get() error { - return ErrNotImplemented{runtime.GOOS} -} - -func (s *HugeTLBPages) Get() error { - return ErrNotImplemented{runtime.GOOS} -} - -func (f *FDUsage) Get() error { - return ErrNotImplemented{runtime.GOOS} -} - -func (p *ProcTime) Get(int) error { - return ErrNotImplemented{runtime.GOOS} -} - -func (self *FileSystemUsage) Get(path string) error { - return ErrNotImplemented{runtime.GOOS} -} - -func (self *CpuList) Get() error { - return ErrNotImplemented{runtime.GOOS} -} - -func (p *ProcState) Get(int) error { - return ErrNotImplemented{runtime.GOOS} -} - -func (p *ProcExe) Get(int) error { - return ErrNotImplemented{runtime.GOOS} -} - -func (p *ProcMem) Get(int) error { - return ErrNotImplemented{runtime.GOOS} -} - -func (p *ProcFDUsage) Get(int) error { - return ErrNotImplemented{runtime.GOOS} -} - -func (p *ProcEnv) Get(int) error { - return ErrNotImplemented{runtime.GOOS} -} - -func (p *ProcList) Get() error { - return ErrNotImplemented{runtime.GOOS} -} - -func (p *ProcArgs) Get(int) error { - return ErrNotImplemented{runtime.GOOS} -} - -func (self *Rusage) Get(int) error { - return ErrNotImplemented{runtime.GOOS} -} diff --git a/vendor/github.com/elastic/gosigar/sigar_unix.go b/vendor/github.com/elastic/gosigar/sigar_unix.go deleted file mode 100644 index e423419f93..0000000000 --- a/vendor/github.com/elastic/gosigar/sigar_unix.go +++ /dev/null @@ -1,69 +0,0 @@ -// Copyright (c) 2012 VMware, Inc. - -// +build aix darwin freebsd linux - -package gosigar - -import ( - "syscall" - "time" - - "golang.org/x/sys/unix" -) - -func (self *FileSystemUsage) Get(path string) error { - stat := syscall.Statfs_t{} - err := syscall.Statfs(path, &stat) - if err != nil { - return err - } - - self.Total = uint64(stat.Blocks) * uint64(stat.Bsize) - self.Free = uint64(stat.Bfree) * uint64(stat.Bsize) - self.Avail = uint64(stat.Bavail) * uint64(stat.Bsize) - self.Used = self.Total - self.Free - self.Files = stat.Files - self.FreeFiles = uint64(stat.Ffree) - - return nil -} - -func (r *Rusage) Get(who int) error { - ru, err := getResourceUsage(who) - if err != nil { - return err - } - - uTime := convertRtimeToDur(ru.Utime) - sTime := convertRtimeToDur(ru.Stime) - - r.Utime = uTime - r.Stime = sTime - r.Maxrss = int64(ru.Maxrss) - r.Ixrss = int64(ru.Ixrss) - r.Idrss = int64(ru.Idrss) - r.Isrss = int64(ru.Isrss) - r.Minflt = int64(ru.Minflt) - r.Majflt = int64(ru.Majflt) - r.Nswap = int64(ru.Nswap) - r.Inblock = int64(ru.Inblock) - r.Oublock = int64(ru.Oublock) - r.Msgsnd = int64(ru.Msgsnd) - r.Msgrcv = int64(ru.Msgrcv) - r.Nsignals = int64(ru.Nsignals) - r.Nvcsw = int64(ru.Nvcsw) - r.Nivcsw = int64(ru.Nivcsw) - - return nil -} - -func getResourceUsage(who int) (unix.Rusage, error) { - r := unix.Rusage{} - err := unix.Getrusage(who, &r) - - return r, err -} - -func convertRtimeToDur(t unix.Timeval) time.Duration { - return time.Duration(t.Nano()) -} diff --git a/vendor/github.com/elastic/gosigar/sigar_util.go b/vendor/github.com/elastic/gosigar/sigar_util.go deleted file mode 100644 index 586d4889e1..0000000000 --- a/vendor/github.com/elastic/gosigar/sigar_util.go +++ /dev/null @@ -1,30 +0,0 @@ -// Copyright (c) 2012 VMware, Inc. - -package gosigar - -import ( - "bytes" -) - -// byteListToString converts the raw byte arrays we get into a string. This is a bit of a process, as byte strings are normally []uint8 -func byteListToString(raw []int8) string { - byteList := make([]byte, len(raw)) - - for pos, singleByte := range raw { - byteList[pos] = byte(singleByte) - if singleByte == 0 { - break - } - } - - return string(bytes.Trim(byteList, "\x00")) -} - -func chop(buf []byte) []byte { - return buf[0 : len(buf)-1] -} - -// convertBytesToString trims null bytes and returns a string -func convertBytesToString(arr []byte) string { - return string(bytes.Trim(arr, "\x00")) -} diff --git a/vendor/github.com/elastic/gosigar/sigar_windows.go b/vendor/github.com/elastic/gosigar/sigar_windows.go deleted file mode 100644 index 7d9652686c..0000000000 --- a/vendor/github.com/elastic/gosigar/sigar_windows.go +++ /dev/null @@ -1,398 +0,0 @@ -// Copyright (c) 2012 VMware, Inc. - -package gosigar - -import ( - "fmt" - "os" - "path/filepath" - "runtime" - "strings" - "syscall" - "time" - - "github.com/elastic/gosigar/sys/windows" - "github.com/pkg/errors" -) - -var ( - // version is Windows version of the host OS. - version = windows.GetWindowsVersion() - - // processQueryLimitedInfoAccess is set to PROCESS_QUERY_INFORMATION for Windows - // 2003 and XP where PROCESS_QUERY_LIMITED_INFORMATION is unknown. For all newer - // OS versions it is set to PROCESS_QUERY_LIMITED_INFORMATION. - processQueryLimitedInfoAccess = windows.PROCESS_QUERY_LIMITED_INFORMATION -) - -func init() { - if !version.IsWindowsVistaOrGreater() { - // PROCESS_QUERY_LIMITED_INFORMATION cannot be used on 2003 or XP. - processQueryLimitedInfoAccess = syscall.PROCESS_QUERY_INFORMATION - } -} - -func (self *LoadAverage) Get() error { - return ErrNotImplemented{runtime.GOOS} -} - -func (self *FDUsage) Get() error { - return ErrNotImplemented{runtime.GOOS} -} - -func (self *ProcEnv) Get(pid int) error { - return ErrNotImplemented{runtime.GOOS} -} - -func (self *ProcExe) Get(pid int) error { - return ErrNotImplemented{runtime.GOOS} -} - -func (self *ProcFDUsage) Get(pid int) error { - return ErrNotImplemented{runtime.GOOS} -} - -func (self *Uptime) Get() error { - // Minimum supported OS is Windows Vista. - if !version.IsWindowsVistaOrGreater() { - return ErrNotImplemented{runtime.GOOS} - } - uptimeMs, err := windows.GetTickCount64() - if err != nil { - return errors.Wrap(err, "failed to get boot time using GetTickCount64 api") - } - self.Length = float64(time.Duration(uptimeMs)*time.Millisecond) / float64(time.Second) - return nil -} - -func (self *Mem) Get() error { - memoryStatusEx, err := windows.GlobalMemoryStatusEx() - if err != nil { - return errors.Wrap(err, "GlobalMemoryStatusEx failed") - } - - self.Total = memoryStatusEx.TotalPhys - self.Free = memoryStatusEx.AvailPhys - self.Used = self.Total - self.Free - self.ActualFree = self.Free - self.ActualUsed = self.Used - return nil -} - -func (self *Swap) Get() error { - memoryStatusEx, err := windows.GlobalMemoryStatusEx() - if err != nil { - return errors.Wrap(err, "GlobalMemoryStatusEx failed") - } - - self.Total = memoryStatusEx.TotalPageFile - self.Free = memoryStatusEx.AvailPageFile - self.Used = self.Total - self.Free - return nil -} - -func (self *HugeTLBPages) Get() error { - return ErrNotImplemented{runtime.GOOS} -} - -func (self *Cpu) Get() error { - idle, kernel, user, err := windows.GetSystemTimes() - if err != nil { - return errors.Wrap(err, "GetSystemTimes failed") - } - - // CPU times are reported in milliseconds by gosigar. - self.Idle = uint64(idle / time.Millisecond) - self.Sys = uint64(kernel / time.Millisecond) - self.User = uint64(user / time.Millisecond) - return nil -} - -func (self *CpuList) Get() error { - cpus, err := windows.NtQuerySystemProcessorPerformanceInformation() - if err != nil { - return errors.Wrap(err, "NtQuerySystemProcessorPerformanceInformation failed") - } - - self.List = make([]Cpu, 0, len(cpus)) - for _, cpu := range cpus { - self.List = append(self.List, Cpu{ - Idle: uint64(cpu.IdleTime / time.Millisecond), - Sys: uint64(cpu.KernelTime / time.Millisecond), - User: uint64(cpu.UserTime / time.Millisecond), - }) - } - return nil -} - -func (self *FileSystemList) Get() error { - drives, err := windows.GetAccessPaths() - if err != nil { - return errors.Wrap(err, "GetAccessPaths failed") - } - for _, drive := range drives { - dt, err := windows.GetDriveType(drive) - if err != nil { - return errors.Wrapf(err, "GetDriveType failed") - } - fsType, err := windows.GetFilesystemType(drive) - if err != nil { - return errors.Wrapf(err, "GetFilesystemType failed") - } - self.List = append(self.List, FileSystem{ - DirName: drive, - DevName: drive, - TypeName: dt.String(), - SysTypeName: fsType, - }) - } - return nil -} - -// Get retrieves a list of all process identifiers (PIDs) in the system. -func (self *ProcList) Get() error { - pids, err := windows.EnumProcesses() - if err != nil { - return errors.Wrap(err, "EnumProcesses failed") - } - - // Convert uint32 PIDs to int. - self.List = make([]int, 0, len(pids)) - for _, pid := range pids { - self.List = append(self.List, int(pid)) - } - return nil -} - -func (self *ProcState) Get(pid int) error { - var errs []error - - var err error - self.Name, err = getProcName(pid) - if err != nil { - errs = append(errs, errors.Wrap(err, "getProcName failed")) - } - - self.State, err = getProcStatus(pid) - if err != nil { - errs = append(errs, errors.Wrap(err, "getProcStatus failed")) - } - - self.Ppid, err = getParentPid(pid) - if err != nil { - errs = append(errs, errors.Wrap(err, "getParentPid failed")) - } - - // getProcCredName will often fail when run as a non-admin user. This is - // caused by strict ACL of the process token belonging to other users. - // Instead of failing completely, ignore this error and still return most - // data with an empty Username. - self.Username, _ = getProcCredName(pid) - - if len(errs) > 0 { - errStrs := make([]string, 0, len(errs)) - for _, e := range errs { - errStrs = append(errStrs, e.Error()) - } - return errors.New(strings.Join(errStrs, "; ")) - } - return nil -} - -// getProcName returns the process name associated with the PID. -func getProcName(pid int) (string, error) { - handle, err := syscall.OpenProcess(processQueryLimitedInfoAccess, false, uint32(pid)) - if err != nil { - return "", errors.Wrapf(err, "OpenProcess failed for pid=%v", pid) - } - defer syscall.CloseHandle(handle) - - filename, err := windows.GetProcessImageFileName(handle) - if err != nil { - return "", errors.Wrapf(err, "GetProcessImageFileName failed for pid=%v", pid) - } - - return filepath.Base(filename), nil -} - -// getProcStatus returns the status of a process. -func getProcStatus(pid int) (RunState, error) { - handle, err := syscall.OpenProcess(processQueryLimitedInfoAccess, false, uint32(pid)) - if err != nil { - return RunStateUnknown, errors.Wrapf(err, "OpenProcess failed for pid=%v", pid) - } - defer syscall.CloseHandle(handle) - - var exitCode uint32 - err = syscall.GetExitCodeProcess(handle, &exitCode) - if err != nil { - return RunStateUnknown, errors.Wrapf(err, "GetExitCodeProcess failed for pid=%v", pid) - } - - if exitCode == 259 { //still active - return RunStateRun, nil - } - return RunStateSleep, nil -} - -// getParentPid returns the parent process ID of a process. -func getParentPid(pid int) (int, error) { - handle, err := syscall.OpenProcess(processQueryLimitedInfoAccess, false, uint32(pid)) - if err != nil { - return RunStateUnknown, errors.Wrapf(err, "OpenProcess failed for pid=%v", pid) - } - defer syscall.CloseHandle(handle) - - procInfo, err := windows.NtQueryProcessBasicInformation(handle) - if err != nil { - return 0, errors.Wrapf(err, "NtQueryProcessBasicInformation failed for pid=%v", pid) - } - - return int(procInfo.InheritedFromUniqueProcessID), nil -} - -func getProcCredName(pid int) (string, error) { - handle, err := syscall.OpenProcess(syscall.PROCESS_QUERY_INFORMATION, false, uint32(pid)) - if err != nil { - return "", errors.Wrapf(err, "OpenProcess failed for pid=%v", pid) - } - defer syscall.CloseHandle(handle) - - // Find process token via win32. - var token syscall.Token - err = syscall.OpenProcessToken(handle, syscall.TOKEN_QUERY, &token) - if err != nil { - return "", errors.Wrapf(err, "OpenProcessToken failed for pid=%v", pid) - } - // Close token to prevent handle leaks. - defer token.Close() - - // Find the token user. - tokenUser, err := token.GetTokenUser() - if err != nil { - return "", errors.Wrapf(err, "GetTokenInformation failed for pid=%v", pid) - } - - // Look up domain account by SID. - account, domain, _, err := tokenUser.User.Sid.LookupAccount("") - if err != nil { - sid, sidErr := tokenUser.User.Sid.String() - if sidErr != nil { - return "", errors.Wrapf(err, "failed while looking up account name for pid=%v", pid) - } - return "", errors.Wrapf(err, "failed while looking up account name for SID=%v of pid=%v", sid, pid) - } - - return fmt.Sprintf(`%s\%s`, domain, account), nil -} - -func (self *ProcMem) Get(pid int) error { - handle, err := syscall.OpenProcess(processQueryLimitedInfoAccess|windows.PROCESS_VM_READ, false, uint32(pid)) - if err != nil { - return errors.Wrapf(err, "OpenProcess failed for pid=%v", pid) - } - defer syscall.CloseHandle(handle) - - counters, err := windows.GetProcessMemoryInfo(handle) - if err != nil { - return errors.Wrapf(err, "GetProcessMemoryInfo failed for pid=%v", pid) - } - - self.Resident = uint64(counters.WorkingSetSize) - self.Size = uint64(counters.PrivateUsage) - return nil -} - -func (self *ProcTime) Get(pid int) error { - cpu, err := getProcTimes(pid) - if err != nil { - return err - } - - // Windows epoch times are expressed as time elapsed since midnight on - // January 1, 1601 at Greenwich, England. This converts the Filetime to - // unix epoch in milliseconds. - self.StartTime = uint64(cpu.CreationTime.Nanoseconds() / 1e6) - - // Convert to millis. - self.User = uint64(windows.FiletimeToDuration(&cpu.UserTime).Nanoseconds() / 1e6) - self.Sys = uint64(windows.FiletimeToDuration(&cpu.KernelTime).Nanoseconds() / 1e6) - self.Total = self.User + self.Sys - - return nil -} - -func getProcTimes(pid int) (*syscall.Rusage, error) { - handle, err := syscall.OpenProcess(processQueryLimitedInfoAccess, false, uint32(pid)) - if err != nil { - return nil, errors.Wrapf(err, "OpenProcess failed for pid=%v", pid) - } - defer syscall.CloseHandle(handle) - - var cpu syscall.Rusage - if err := syscall.GetProcessTimes(handle, &cpu.CreationTime, &cpu.ExitTime, &cpu.KernelTime, &cpu.UserTime); err != nil { - return nil, errors.Wrapf(err, "GetProcessTimes failed for pid=%v", pid) - } - - return &cpu, nil -} - -func (self *ProcArgs) Get(pid int) error { - // The minimum supported client for Win32_Process is Windows Vista. - if !version.IsWindowsVistaOrGreater() { - return ErrNotImplemented{runtime.GOOS} - } - handle, err := syscall.OpenProcess(processQueryLimitedInfoAccess|windows.PROCESS_VM_READ, false, uint32(pid)) - if err != nil { - return errors.Wrapf(err, "OpenProcess failed for pid=%v", pid) - } - defer syscall.CloseHandle(handle) - pbi, err := windows.NtQueryProcessBasicInformation(handle) - if err != nil { - return errors.Wrapf(err, "NtQueryProcessBasicInformation failed for pid=%v", pid) - } - if err != nil { - return nil - } - userProcParams, err := windows.GetUserProcessParams(handle, pbi) - if err != nil { - return nil - } - if argsW, err := windows.ReadProcessUnicodeString(handle, &userProcParams.CommandLine); err == nil { - self.List, err = windows.ByteSliceToStringSlice(argsW) - if err != nil { - return err - } - } - return nil -} - -func (self *FileSystemUsage) Get(path string) error { - freeBytesAvailable, totalNumberOfBytes, totalNumberOfFreeBytes, err := windows.GetDiskFreeSpaceEx(path) - if err != nil { - return errors.Wrap(err, "GetDiskFreeSpaceEx failed") - } - - self.Total = totalNumberOfBytes - self.Free = totalNumberOfFreeBytes - self.Used = self.Total - self.Free - self.Avail = freeBytesAvailable - return nil -} - -func (self *Rusage) Get(who int) error { - if who != 0 { - return ErrNotImplemented{runtime.GOOS} - } - - pid := os.Getpid() - cpu, err := getProcTimes(pid) - if err != nil { - return err - } - - self.Utime = windows.FiletimeToDuration(&cpu.UserTime) - self.Stime = windows.FiletimeToDuration(&cpu.KernelTime) - - return nil -} diff --git a/vendor/github.com/elastic/gosigar/sys/windows/doc.go b/vendor/github.com/elastic/gosigar/sys/windows/doc.go deleted file mode 100644 index 9dca125040..0000000000 --- a/vendor/github.com/elastic/gosigar/sys/windows/doc.go +++ /dev/null @@ -1,8 +0,0 @@ -// Package windows contains various Windows system call. -package windows - -// Use "go generate -v -x ." to generate the source. - -// Add -trace to enable debug prints around syscalls. -//go:generate go run $GOROOT/src/syscall/mksyscall_windows.go -systemdll=true -output zsyscall_windows.go syscall_windows.go -//go:generate go run fix_generated.go -input zsyscall_windows.go diff --git a/vendor/github.com/elastic/gosigar/sys/windows/ntquery.go b/vendor/github.com/elastic/gosigar/sys/windows/ntquery.go deleted file mode 100644 index 85de365e1a..0000000000 --- a/vendor/github.com/elastic/gosigar/sys/windows/ntquery.go +++ /dev/null @@ -1,132 +0,0 @@ -// +build windows - -package windows - -import ( - "bytes" - "encoding/binary" - "io" - "runtime" - "syscall" - "time" - "unsafe" - - "github.com/pkg/errors" -) - -// On both 32-bit and 64-bit systems NtQuerySystemInformation expects the -// size of SYSTEM_PROCESSOR_PERFORMANCE_INFORMATION to be 48. -const sizeofSystemProcessorPerformanceInformation = 48 - -// ProcessBasicInformation is an equivalent representation of -// PROCESS_BASIC_INFORMATION in the Windows API. -// https://msdn.microsoft.com/en-us/library/windows/desktop/ms684280(v=vs.85).aspx -type ProcessBasicInformation struct { - ExitStatus uint - PebBaseAddress uintptr - AffinityMask uint - BasePriority uint - UniqueProcessID uint - InheritedFromUniqueProcessID uint -} - -// NtQueryProcessBasicInformation queries basic information about the process -// associated with the given handle (provided by OpenProcess). It uses the -// NtQueryInformationProcess function to collect the data. -// https://msdn.microsoft.com/en-us/library/windows/desktop/ms684280(v=vs.85).aspx -func NtQueryProcessBasicInformation(handle syscall.Handle) (ProcessBasicInformation, error) { - var processBasicInfo ProcessBasicInformation - processBasicInfoPtr := (*byte)(unsafe.Pointer(&processBasicInfo)) - size := uint32(unsafe.Sizeof(processBasicInfo)) - ntStatus, _ := _NtQueryInformationProcess(handle, 0, processBasicInfoPtr, size, nil) - if ntStatus != 0 { - return ProcessBasicInformation{}, errors.Errorf("NtQueryInformationProcess failed, NTSTATUS=0x%X", ntStatus) - } - - return processBasicInfo, nil -} - -// SystemProcessorPerformanceInformation contains CPU performance information -// for a single CPU. -type SystemProcessorPerformanceInformation struct { - IdleTime time.Duration // Amount of time spent idle. - KernelTime time.Duration // Kernel time does NOT include time spent in idle. - UserTime time.Duration // Amount of time spent executing in user mode. -} - -// _SYSTEM_PROCESSOR_PERFORMANCE_INFORMATION is an equivalent representation of -// SYSTEM_PROCESSOR_PERFORMANCE_INFORMATION in the Windows API. This struct is -// used internally with NtQuerySystemInformation call and is not exported. The -// exported equivalent is SystemProcessorPerformanceInformation. -// https://msdn.microsoft.com/en-us/library/windows/desktop/ms724509(v=vs.85).aspx -type _SYSTEM_PROCESSOR_PERFORMANCE_INFORMATION struct { - IdleTime int64 - KernelTime int64 - UserTime int64 - Reserved1 [2]int64 - Reserved2 uint32 -} - -// NtQuerySystemProcessorPerformanceInformation queries CPU performance -// information for each CPU. It uses the NtQuerySystemInformation function to -// collect the SystemProcessorPerformanceInformation. -// https://msdn.microsoft.com/en-us/library/windows/desktop/ms724509(v=vs.85).aspx -func NtQuerySystemProcessorPerformanceInformation() ([]SystemProcessorPerformanceInformation, error) { - // NTSTATUS code for success. - // https://msdn.microsoft.com/en-us/library/cc704588.aspx - const STATUS_SUCCESS = 0 - - // From the _SYSTEM_INFORMATION_CLASS enum. - // http://processhacker.sourceforge.net/doc/ntexapi_8h.html#ad5d815b48e8f4da1ef2eb7a2f18a54e0 - const systemProcessorPerformanceInformation = 8 - - // Create a buffer large enough to hold an entry for each processor. - b := make([]byte, runtime.NumCPU()*sizeofSystemProcessorPerformanceInformation) - - // Query the performance information. Note that this function uses 0 to - // indicate success. Most other Windows functions use non-zero for success. - var returnLength uint32 - ntStatus, _ := _NtQuerySystemInformation(systemProcessorPerformanceInformation, &b[0], uint32(len(b)), &returnLength) - if ntStatus != STATUS_SUCCESS { - return nil, errors.Errorf("NtQuerySystemInformation failed, NTSTATUS=0x%X, bufLength=%v, returnLength=%v", ntStatus, len(b), returnLength) - } - - return readSystemProcessorPerformanceInformationBuffer(b) -} - -// readSystemProcessorPerformanceInformationBuffer reads from a buffer -// containing SYSTEM_PROCESSOR_PERFORMANCE_INFORMATION data. The buffer should -// contain one entry for each CPU. -// https://msdn.microsoft.com/en-us/library/windows/desktop/ms724509(v=vs.85).aspx -func readSystemProcessorPerformanceInformationBuffer(b []byte) ([]SystemProcessorPerformanceInformation, error) { - n := len(b) / sizeofSystemProcessorPerformanceInformation - r := bytes.NewReader(b) - - rtn := make([]SystemProcessorPerformanceInformation, 0, n) - for i := 0; i < n; i++ { - _, err := r.Seek(int64(i*sizeofSystemProcessorPerformanceInformation), io.SeekStart) - if err != nil { - return nil, errors.Wrapf(err, "failed to seek to cpuN=%v in buffer", i) - } - - times := make([]uint64, 3) - for j := range times { - err := binary.Read(r, binary.LittleEndian, ×[j]) - if err != nil { - return nil, errors.Wrapf(err, "failed reading cpu times for cpuN=%v", i) - } - } - - idleTime := time.Duration(times[0] * 100) - kernelTime := time.Duration(times[1] * 100) - userTime := time.Duration(times[2] * 100) - - rtn = append(rtn, SystemProcessorPerformanceInformation{ - IdleTime: idleTime, - KernelTime: kernelTime - idleTime, // Subtract out idle time from kernel time. - UserTime: userTime, - }) - } - - return rtn, nil -} diff --git a/vendor/github.com/elastic/gosigar/sys/windows/privileges.go b/vendor/github.com/elastic/gosigar/sys/windows/privileges.go deleted file mode 100644 index 28c78fd228..0000000000 --- a/vendor/github.com/elastic/gosigar/sys/windows/privileges.go +++ /dev/null @@ -1,272 +0,0 @@ -// +build windows - -package windows - -import ( - "bytes" - "encoding/binary" - "encoding/json" - "fmt" - "runtime" - "strings" - "sync" - "syscall" - - "github.com/pkg/errors" - "golang.org/x/sys/windows" -) - -// Cache of privilege names to LUIDs. -var ( - privNames = make(map[string]int64) - privNameMutex sync.Mutex -) - -const ( - // SeDebugPrivilege is the name of the privilege used to debug programs. - SeDebugPrivilege = "SeDebugPrivilege" -) - -// Errors returned by AdjustTokenPrivileges. -const ( - ERROR_NOT_ALL_ASSIGNED syscall.Errno = 1300 -) - -// Attribute bits for privileges. -const ( - _SE_PRIVILEGE_ENABLED_BY_DEFAULT uint32 = 0x00000001 - _SE_PRIVILEGE_ENABLED uint32 = 0x00000002 - _SE_PRIVILEGE_REMOVED uint32 = 0x00000004 - _SE_PRIVILEGE_USED_FOR_ACCESS uint32 = 0x80000000 -) - -// Privilege contains information about a single privilege associated with a -// Token. -type Privilege struct { - LUID int64 `json:"-"` // Locally unique identifier (guaranteed only until the system is restarted). - Name string `json:"-"` - EnabledByDefault bool `json:"enabled_by_default,omitempty"` - Enabled bool `json:"enabled"` - Removed bool `json:"removed,omitempty"` - Used bool `json:"used,omitempty"` -} - -func (p Privilege) String() string { - var buf bytes.Buffer - buf.WriteString(p.Name) - buf.WriteString("=(") - - opts := make([]string, 0, 4) - if p.EnabledByDefault { - opts = append(opts, "Default") - } - if p.Enabled { - opts = append(opts, "Enabled") - } - if !p.EnabledByDefault && !p.Enabled { - opts = append(opts, "Disabled") - } - if p.Removed { - opts = append(opts, "Removed") - } - if p.Used { - opts = append(opts, "Used") - } - - buf.WriteString(strings.Join(opts, ", ")) - buf.WriteString(")") - - // Example: SeDebugPrivilege=(Default, Enabled) - return buf.String() -} - -// User represent the information about a Windows account. -type User struct { - SID string - Account string - Domain string - Type uint32 -} - -func (u User) String() string { - return fmt.Sprintf(`User:%v\%v, SID:%v, Type:%v`, u.Domain, u.Account, u.SID, u.Type) -} - -// DebugInfo contains general debug info about the current process. -type DebugInfo struct { - OSVersion Version // OS version info. - Arch string // Architecture of the machine. - NumCPU int // Number of CPUs. - User User // User that this process is running as. - ProcessPrivs map[string]Privilege // Privileges held by the process. -} - -func (d DebugInfo) String() string { - bytes, _ := json.Marshal(d) - return string(bytes) -} - -// LookupPrivilegeName looks up a privilege name given a LUID value. -func LookupPrivilegeName(systemName string, luid int64) (string, error) { - buf := make([]uint16, 256) - bufSize := uint32(len(buf)) - err := _LookupPrivilegeName(systemName, &luid, &buf[0], &bufSize) - if err != nil { - return "", errors.Wrapf(err, "LookupPrivilegeName failed for luid=%v", luid) - } - - return syscall.UTF16ToString(buf), nil -} - -// mapPrivileges maps privilege names to LUID values. -func mapPrivileges(names []string) ([]int64, error) { - var privileges []int64 - privNameMutex.Lock() - defer privNameMutex.Unlock() - for _, name := range names { - p, ok := privNames[name] - if !ok { - err := _LookupPrivilegeValue("", name, &p) - if err != nil { - return nil, errors.Wrapf(err, "LookupPrivilegeValue failed on '%v'", name) - } - privNames[name] = p - } - privileges = append(privileges, p) - } - return privileges, nil -} - -// EnableTokenPrivileges enables the specified privileges in the given -// Token. The token must have TOKEN_ADJUST_PRIVILEGES access. If the token -// does not already contain the privilege it cannot be enabled. -func EnableTokenPrivileges(token syscall.Token, privileges ...string) error { - privValues, err := mapPrivileges(privileges) - if err != nil { - return err - } - - var b bytes.Buffer - binary.Write(&b, binary.LittleEndian, uint32(len(privValues))) - for _, p := range privValues { - binary.Write(&b, binary.LittleEndian, p) - binary.Write(&b, binary.LittleEndian, uint32(_SE_PRIVILEGE_ENABLED)) - } - - success, err := _AdjustTokenPrivileges(token, false, &b.Bytes()[0], uint32(b.Len()), nil, nil) - if !success { - return err - } - if err == ERROR_NOT_ALL_ASSIGNED { - return errors.Wrap(err, "error not all privileges were assigned") - } - - return nil -} - -// GetTokenPrivileges returns a list of privileges associated with a token. -// The provided token must have at a minimum TOKEN_QUERY access. This is a -// wrapper around the GetTokenInformation function. -// https://msdn.microsoft.com/en-us/library/windows/desktop/aa446671(v=vs.85).aspx -func GetTokenPrivileges(token syscall.Token) (map[string]Privilege, error) { - // Determine the required buffer size. - var size uint32 - syscall.GetTokenInformation(token, syscall.TokenPrivileges, nil, 0, &size) - - // This buffer will receive a TOKEN_PRIVILEGE structure. - b := bytes.NewBuffer(make([]byte, size)) - err := syscall.GetTokenInformation(token, syscall.TokenPrivileges, &b.Bytes()[0], uint32(b.Len()), &size) - if err != nil { - return nil, errors.Wrap(err, "GetTokenInformation failed") - } - - var privilegeCount uint32 - err = binary.Read(b, binary.LittleEndian, &privilegeCount) - if err != nil { - return nil, errors.Wrap(err, "failed to read PrivilegeCount") - } - - rtn := make(map[string]Privilege, privilegeCount) - for i := 0; i < int(privilegeCount); i++ { - var luid int64 - err = binary.Read(b, binary.LittleEndian, &luid) - if err != nil { - return nil, errors.Wrap(err, "failed to read LUID value") - } - - var attributes uint32 - err = binary.Read(b, binary.LittleEndian, &attributes) - if err != nil { - return nil, errors.Wrap(err, "failed to read attributes") - } - - name, err := LookupPrivilegeName("", luid) - if err != nil { - return nil, errors.Wrapf(err, "LookupPrivilegeName failed for LUID=%v", luid) - } - - rtn[name] = Privilege{ - LUID: luid, - Name: name, - EnabledByDefault: (attributes & _SE_PRIVILEGE_ENABLED_BY_DEFAULT) > 0, - Enabled: (attributes & _SE_PRIVILEGE_ENABLED) > 0, - Removed: (attributes & _SE_PRIVILEGE_REMOVED) > 0, - Used: (attributes & _SE_PRIVILEGE_USED_FOR_ACCESS) > 0, - } - } - - return rtn, nil -} - -// GetTokenUser returns the User associated with the given Token. -func GetTokenUser(token syscall.Token) (User, error) { - tokenUser, err := token.GetTokenUser() - if err != nil { - return User{}, errors.Wrap(err, "GetTokenUser failed") - } - - var user User - user.SID, err = tokenUser.User.Sid.String() - if err != nil { - return user, errors.Wrap(err, "ConvertSidToStringSid failed") - } - - user.Account, user.Domain, user.Type, err = tokenUser.User.Sid.LookupAccount("") - if err != nil { - return user, errors.Wrap(err, "LookupAccountSid failed") - } - - return user, nil -} - -// GetDebugInfo returns general debug info about the current process. -func GetDebugInfo() (*DebugInfo, error) { - h, err := windows.GetCurrentProcess() - if err != nil { - return nil, err - } - - var token syscall.Token - err = syscall.OpenProcessToken(syscall.Handle(h), syscall.TOKEN_QUERY, &token) - if err != nil { - return nil, err - } - - privs, err := GetTokenPrivileges(token) - if err != nil { - return nil, err - } - - user, err := GetTokenUser(token) - if err != nil { - return nil, err - } - - return &DebugInfo{ - User: user, - ProcessPrivs: privs, - OSVersion: GetWindowsVersion(), - Arch: runtime.GOARCH, - NumCPU: runtime.NumCPU(), - }, nil -} diff --git a/vendor/github.com/elastic/gosigar/sys/windows/syscall_windows.go b/vendor/github.com/elastic/gosigar/sys/windows/syscall_windows.go deleted file mode 100644 index b5c1b064c1..0000000000 --- a/vendor/github.com/elastic/gosigar/sys/windows/syscall_windows.go +++ /dev/null @@ -1,630 +0,0 @@ -package windows - -import ( - "fmt" - "strings" - "syscall" - "time" - "unsafe" - - "github.com/pkg/errors" -) - -var ( - sizeofUint32 = 4 - sizeofProcessEntry32 = uint32(unsafe.Sizeof(ProcessEntry32{})) - sizeofProcessMemoryCountersEx = uint32(unsafe.Sizeof(ProcessMemoryCountersEx{})) - sizeofMemoryStatusEx = uint32(unsafe.Sizeof(MemoryStatusEx{})) -) - -// Process-specific access rights. Others are declared in the syscall package. -// https://msdn.microsoft.com/en-us/library/windows/desktop/ms684880(v=vs.85).aspx -const ( - PROCESS_QUERY_LIMITED_INFORMATION uint32 = 0x1000 - PROCESS_VM_READ uint32 = 0x0010 -) - -// error codes for GetVolumeInformation function -const ( - ERROR_INVALID_FUNCTION syscall.Errno = 1 - ERROR_NOT_READY syscall.Errno = 21 -) - -// SizeOfRtlUserProcessParameters gives the size -// of the RtlUserProcessParameters struct. -const SizeOfRtlUserProcessParameters = unsafe.Sizeof(RtlUserProcessParameters{}) - -// MAX_PATH is the maximum length for a path in Windows. -// https://msdn.microsoft.com/en-us/library/windows/desktop/aa365247(v=vs.85).aspx -const MAX_PATH = 260 - -// DriveType represents a type of drive (removable, fixed, CD-ROM, RAM disk, or -// network drive). -type DriveType uint32 - -// Drive types as returned by GetDriveType. -// https://msdn.microsoft.com/en-us/library/windows/desktop/aa364939(v=vs.85).aspx -const ( - DRIVE_UNKNOWN DriveType = iota - DRIVE_NO_ROOT_DIR - DRIVE_REMOVABLE - DRIVE_FIXED - DRIVE_REMOTE - DRIVE_CDROM - DRIVE_RAMDISK -) - -// UnicodeString is Go's equivalent for the _UNICODE_STRING struct. -type UnicodeString struct { - Size uint16 - MaximumLength uint16 - Buffer uintptr -} - -// RtlUserProcessParameters is Go's equivalent for the -// _RTL_USER_PROCESS_PARAMETERS struct. -// A few undocumented fields are exposed. -type RtlUserProcessParameters struct { - Reserved1 [16]byte - Reserved2 [5]uintptr - CurrentDirectoryPath UnicodeString - CurrentDirectoryHandle uintptr - DllPath UnicodeString - ImagePathName UnicodeString - CommandLine UnicodeString -} - -func (dt DriveType) String() string { - names := map[DriveType]string{ - DRIVE_UNKNOWN: "unknown", - DRIVE_NO_ROOT_DIR: "invalid", - DRIVE_REMOVABLE: "removable", - DRIVE_FIXED: "fixed", - DRIVE_REMOTE: "remote", - DRIVE_CDROM: "cdrom", - DRIVE_RAMDISK: "ramdisk", - } - - name, found := names[dt] - if !found { - return "unknown DriveType value" - } - return name -} - -// Flags that can be used with CreateToolhelp32Snapshot. -const ( - TH32CS_INHERIT uint32 = 0x80000000 // Indicates that the snapshot handle is to be inheritable. - TH32CS_SNAPHEAPLIST uint32 = 0x00000001 // Includes all heaps of the process specified in th32ProcessID in the snapshot. - TH32CS_SNAPMODULE uint32 = 0x00000008 // Includes all modules of the process specified in th32ProcessID in the snapshot. - TH32CS_SNAPMODULE32 uint32 = 0x00000010 // Includes all 32-bit modules of the process specified in th32ProcessID in the snapshot when called from a 64-bit process. - TH32CS_SNAPPROCESS uint32 = 0x00000002 // Includes all processes in the system in the snapshot. - TH32CS_SNAPTHREAD uint32 = 0x00000004 // Includes all threads in the system in the snapshot. -) - -// ProcessEntry32 is an equivalent representation of PROCESSENTRY32 in the -// Windows API. It contains a process's information. Do not modify or reorder. -// https://msdn.microsoft.com/en-us/library/windows/desktop/ms684839(v=vs.85).aspx -type ProcessEntry32 struct { - size uint32 - CntUsage uint32 - ProcessID uint32 - DefaultHeapID uintptr - ModuleID uint32 - CntThreads uint32 - ParentProcessID uint32 - PriorityClassBase int32 - Flags uint32 - exeFile [MAX_PATH]uint16 -} - -// ExeFile returns the name of the executable file for the process. It does -// not contain the full path. -func (p ProcessEntry32) ExeFile() string { - return syscall.UTF16ToString(p.exeFile[:]) -} - -func (p ProcessEntry32) String() string { - return fmt.Sprintf("{CntUsage:%v ProcessID:%v DefaultHeapID:%v ModuleID:%v "+ - "CntThreads:%v ParentProcessID:%v PriorityClassBase:%v Flags:%v ExeFile:%v", - p.CntUsage, p.ProcessID, p.DefaultHeapID, p.ModuleID, p.CntThreads, - p.ParentProcessID, p.PriorityClassBase, p.Flags, p.ExeFile()) -} - -// MemoryStatusEx is an equivalent representation of MEMORYSTATUSEX in the -// Windows API. It contains information about the current state of both physical -// and virtual memory, including extended memory. -// https://msdn.microsoft.com/en-us/library/windows/desktop/aa366770 -type MemoryStatusEx struct { - length uint32 - MemoryLoad uint32 - TotalPhys uint64 - AvailPhys uint64 - TotalPageFile uint64 - AvailPageFile uint64 - TotalVirtual uint64 - AvailVirtual uint64 - AvailExtendedVirtual uint64 -} - -// ProcessMemoryCountersEx is an equivalent representation of -// PROCESS_MEMORY_COUNTERS_EX in the Windows API. -// https://msdn.microsoft.com/en-us/library/windows/desktop/ms684874(v=vs.85).aspx -type ProcessMemoryCountersEx struct { - cb uint32 - PageFaultCount uint32 - PeakWorkingSetSize uintptr - WorkingSetSize uintptr - QuotaPeakPagedPoolUsage uintptr - QuotaPagedPoolUsage uintptr - QuotaPeakNonPagedPoolUsage uintptr - QuotaNonPagedPoolUsage uintptr - PagefileUsage uintptr - PeakPagefileUsage uintptr - PrivateUsage uintptr -} - -// GetLogicalDriveStrings returns a list of drives in the system. -// https://msdn.microsoft.com/en-us/library/windows/desktop/aa364975(v=vs.85).aspx -func GetLogicalDriveStrings() ([]string, error) { - // Determine the size of the buffer required to receive all drives. - bufferLength, err := _GetLogicalDriveStringsW(0, nil) - if err != nil { - return nil, errors.Wrap(err, "GetLogicalDriveStringsW failed to get buffer length") - } - if bufferLength < 0 { - return nil, errors.New("GetLogicalDriveStringsW returned an invalid buffer length") - } - - buffer := make([]uint16, bufferLength) - _, err = _GetLogicalDriveStringsW(uint32(len(buffer)), &buffer[0]) - if err != nil { - return nil, errors.Wrap(err, "GetLogicalDriveStringsW failed") - } - - return UTF16SliceToStringSlice(buffer), nil -} - -// GetAccessPaths returns the list of access paths for volumes in the system. -func GetAccessPaths() ([]string, error) { - volumes, err := GetVolumes() - if err != nil { - return nil, errors.Wrap(err, "GetVolumes failed") - } - - var paths []string - for _, volumeName := range volumes { - volumePaths, err := GetVolumePathsForVolume(volumeName) - if err != nil { - return nil, errors.Wrapf(err, "failed to get list of access paths for volume '%s'", volumeName) - } - if len(volumePaths) == 0 { - continue - } - - // Get only the first path - paths = append(paths, volumePaths[0]) - } - - return paths, nil -} - -// GetVolumes returs the list of volumes in the system. -// https://docs.microsoft.com/es-es/windows/desktop/api/fileapi/nf-fileapi-findfirstvolumew -func GetVolumes() ([]string, error) { - buffer := make([]uint16, MAX_PATH+1) - - var volumes []string - - h, err := _FindFirstVolume(&buffer[0], uint32(len(buffer))) - if err != nil { - return nil, errors.Wrap(err, "FindFirstVolumeW failed") - } - defer _FindVolumeClose(h) - - for { - volumes = append(volumes, syscall.UTF16ToString(buffer)) - - err = _FindNextVolume(h, &buffer[0], uint32(len(buffer))) - if err != nil { - if errors.Cause(err) == syscall.ERROR_NO_MORE_FILES { - break - } - return nil, errors.Wrap(err, "FindNextVolumeW failed") - } - } - - return volumes, nil -} - -// GetVolumePathsForVolume returns the list of volume paths for a volume. -// https://docs.microsoft.com/en-us/windows/desktop/api/FileAPI/nf-fileapi-getvolumepathnamesforvolumenamew -func GetVolumePathsForVolume(volumeName string) ([]string, error) { - var length uint32 - err := _GetVolumePathNamesForVolumeName(volumeName, nil, 0, &length) - if errors.Cause(err) != syscall.ERROR_MORE_DATA { - return nil, errors.Wrap(err, "GetVolumePathNamesForVolumeNameW failed to get needed buffer length") - } - if length == 0 { - // Not mounted, no paths, that's ok - return nil, nil - } - - buffer := make([]uint16, length*(MAX_PATH+1)) - err = _GetVolumePathNamesForVolumeName(volumeName, &buffer[0], length, &length) - if err != nil { - return nil, errors.Wrap(err, "GetVolumePathNamesForVolumeNameW failed") - } - - return UTF16SliceToStringSlice(buffer), nil -} - -// GlobalMemoryStatusEx retrieves information about the system's current usage -// of both physical and virtual memory. -// https://msdn.microsoft.com/en-us/library/windows/desktop/aa366589(v=vs.85).aspx -func GlobalMemoryStatusEx() (MemoryStatusEx, error) { - memoryStatusEx := MemoryStatusEx{length: sizeofMemoryStatusEx} - err := _GlobalMemoryStatusEx(&memoryStatusEx) - if err != nil { - return MemoryStatusEx{}, errors.Wrap(err, "GlobalMemoryStatusEx failed") - } - - return memoryStatusEx, nil -} - -// GetProcessMemoryInfo retrieves information about the memory usage of the -// specified process. -// https://msdn.microsoft.com/en-us/library/windows/desktop/ms683219(v=vs.85).aspx -func GetProcessMemoryInfo(handle syscall.Handle) (ProcessMemoryCountersEx, error) { - processMemoryCountersEx := ProcessMemoryCountersEx{cb: sizeofProcessMemoryCountersEx} - err := _GetProcessMemoryInfo(handle, &processMemoryCountersEx, processMemoryCountersEx.cb) - if err != nil { - return ProcessMemoryCountersEx{}, errors.Wrap(err, "GetProcessMemoryInfo failed") - } - - return processMemoryCountersEx, nil -} - -// GetProcessImageFileName Retrieves the name of the executable file for the -// specified process. -// https://msdn.microsoft.com/en-us/library/windows/desktop/ms683217(v=vs.85).aspx -func GetProcessImageFileName(handle syscall.Handle) (string, error) { - buffer := make([]uint16, MAX_PATH) - _, err := _GetProcessImageFileName(handle, &buffer[0], uint32(len(buffer))) - if err != nil { - return "", errors.Wrap(err, "GetProcessImageFileName failed") - } - - return syscall.UTF16ToString(buffer), nil -} - -// GetSystemTimes retrieves system timing information. On a multiprocessor -// system, the values returned are the sum of the designated times across all -// processors. The returned kernel time does not include the system idle time. -// https://msdn.microsoft.com/en-us/library/windows/desktop/ms724400(v=vs.85).aspx -func GetSystemTimes() (idle, kernel, user time.Duration, err error) { - var idleTime, kernelTime, userTime syscall.Filetime - err = _GetSystemTimes(&idleTime, &kernelTime, &userTime) - if err != nil { - return 0, 0, 0, errors.Wrap(err, "GetSystemTimes failed") - } - - idle = FiletimeToDuration(&idleTime) - kernel = FiletimeToDuration(&kernelTime) // Kernel time includes idle time so we subtract it out. - user = FiletimeToDuration(&userTime) - - return idle, kernel - idle, user, nil -} - -// FiletimeToDuration converts a Filetime to a time.Duration. Do not use this -// method to convert a Filetime to an actual clock time, for that use -// Filetime.Nanosecond(). -func FiletimeToDuration(ft *syscall.Filetime) time.Duration { - n := int64(ft.HighDateTime)<<32 + int64(ft.LowDateTime) // in 100-nanosecond intervals - return time.Duration(n * 100) -} - -// GetDriveType Determines whether a disk drive is a removable, fixed, CD-ROM, -// RAM disk, or network drive. A trailing backslash is required on the -// rootPathName. -// https://msdn.microsoft.com/en-us/library/windows/desktop/aa364939 -func GetDriveType(rootPathName string) (DriveType, error) { - rootPathNamePtr, err := syscall.UTF16PtrFromString(rootPathName) - if err != nil { - return DRIVE_UNKNOWN, errors.Wrapf(err, "UTF16PtrFromString failed for rootPathName=%v", rootPathName) - } - - dt, err := _GetDriveType(rootPathNamePtr) - if err != nil { - return DRIVE_UNKNOWN, errors.Wrapf(err, "GetDriveType failed for rootPathName=%v", rootPathName) - } - - return dt, nil -} - -// GetFilesystemType returns file system type information at the given root path. -// https://docs.microsoft.com/en-us/windows/win32/api/fileapi/nf-fileapi-getvolumeinformationw -func GetFilesystemType(rootPathName string) (string, error) { - rootPathNamePtr, err := syscall.UTF16PtrFromString(rootPathName) - var systemType = "unavailable" - if err != nil { - return "", errors.Wrapf(err, "UTF16PtrFromString failed for rootPathName=%v", rootPathName) - } - buffer := make([]uint16, MAX_PATH+1) - // _GetVolumeInformation will fail for external drives like CD-ROM or other type with error codes as ERROR_NOT_READY. ERROR_INVALID_FUNCTION, ERROR_INVALID_PARAMETER, etc., these types of errors will be ignored - success, err := _GetVolumeInformation(rootPathNamePtr, nil, 0, nil, nil, nil, &buffer[0], MAX_PATH) - if success { - systemType = strings.ToLower(syscall.UTF16ToString(buffer)) - } - return systemType, nil -} - -// EnumProcesses retrieves the process identifier for each process object in the -// system. This function can return a max of 65536 PIDs. If there are more -// processes than that then this will not return them all. -// https://msdn.microsoft.com/en-us/library/windows/desktop/ms682629(v=vs.85).aspx -func EnumProcesses() ([]uint32, error) { - enumProcesses := func(size int) ([]uint32, error) { - var ( - pids = make([]uint32, size) - sizeBytes = len(pids) * sizeofUint32 - bytesWritten uint32 - ) - - err := _EnumProcesses(&pids[0], uint32(sizeBytes), &bytesWritten) - - pidsWritten := int(bytesWritten) / sizeofUint32 - if int(bytesWritten)%sizeofUint32 != 0 || pidsWritten > len(pids) { - return nil, errors.Errorf("EnumProcesses returned an invalid bytesWritten value of %v", bytesWritten) - } - pids = pids[:pidsWritten] - - return pids, err - } - - // Retry the EnumProcesses call with larger arrays if needed. - size := 2048 - var pids []uint32 - for tries := 0; tries < 5; tries++ { - var err error - pids, err = enumProcesses(size) - if err != nil { - return nil, errors.Wrap(err, "EnumProcesses failed") - } - - if len(pids) < size { - break - } - - // Increase the size the pids array and retry the enumProcesses call - // because the array wasn't large enough to hold all of the processes. - size *= 2 - } - - return pids, nil -} - -// GetDiskFreeSpaceEx retrieves information about the amount of space that is -// available on a disk volume, which is the total amount of space, the total -// amount of free space, and the total amount of free space available to the -// user that is associated with the calling thread. -// https://msdn.microsoft.com/en-us/library/windows/desktop/aa364937(v=vs.85).aspx -func GetDiskFreeSpaceEx(directoryName string) (freeBytesAvailable, totalNumberOfBytes, totalNumberOfFreeBytes uint64, err error) { - directoryNamePtr, err := syscall.UTF16PtrFromString(directoryName) - if err != nil { - return 0, 0, 0, errors.Wrapf(err, "UTF16PtrFromString failed for directoryName=%v", directoryName) - } - - err = _GetDiskFreeSpaceEx(directoryNamePtr, &freeBytesAvailable, &totalNumberOfBytes, &totalNumberOfFreeBytes) - if err != nil { - return 0, 0, 0, err - } - - return freeBytesAvailable, totalNumberOfBytes, totalNumberOfFreeBytes, nil -} - -// CreateToolhelp32Snapshot takes a snapshot of the specified processes, as well -// as the heaps, modules, and threads used by these processes. -// https://msdn.microsoft.com/en-us/library/windows/desktop/ms682489(v=vs.85).aspx -func CreateToolhelp32Snapshot(flags, pid uint32) (syscall.Handle, error) { - h, err := _CreateToolhelp32Snapshot(flags, pid) - if err != nil { - return syscall.InvalidHandle, err - } - if h == syscall.InvalidHandle { - return syscall.InvalidHandle, syscall.GetLastError() - } - - return h, nil -} - -// Process32First retrieves information about the first process encountered in a -// system snapshot. -// https://msdn.microsoft.com/en-us/library/windows/desktop/ms684834 -func Process32First(handle syscall.Handle) (ProcessEntry32, error) { - processEntry32 := ProcessEntry32{size: sizeofProcessEntry32} - err := _Process32First(handle, &processEntry32) - if err != nil { - return ProcessEntry32{}, errors.Wrap(err, "Process32First failed") - } - - return processEntry32, nil -} - -// Process32Next retrieves information about the next process recorded in a -// system snapshot. When there are no more processes to iterate then -// syscall.ERROR_NO_MORE_FILES is returned (use errors.Cause() to unwrap). -// https://msdn.microsoft.com/en-us/library/windows/desktop/ms684836 -func Process32Next(handle syscall.Handle) (ProcessEntry32, error) { - processEntry32 := ProcessEntry32{size: sizeofProcessEntry32} - err := _Process32Next(handle, &processEntry32) - if err != nil { - return ProcessEntry32{}, errors.Wrap(err, "Process32Next failed") - } - - return processEntry32, nil -} - -// UTF16SliceToStringSlice converts slice of uint16 containing a list of UTF16 -// strings to a slice of strings. -func UTF16SliceToStringSlice(buffer []uint16) []string { - // Split the uint16 slice at null-terminators. - var startIdx int - var stringsUTF16 [][]uint16 - for i, value := range buffer { - if value == 0 { - stringsUTF16 = append(stringsUTF16, buffer[startIdx:i]) - startIdx = i + 1 - } - } - - // Convert the utf16 slices to strings. - result := make([]string, 0, len(stringsUTF16)) - for _, stringUTF16 := range stringsUTF16 { - if len(stringUTF16) > 0 { - result = append(result, syscall.UTF16ToString(stringUTF16)) - } - } - - return result -} - -func GetUserProcessParams(handle syscall.Handle, pbi ProcessBasicInformation) (params RtlUserProcessParameters, err error) { - const is32bitProc = unsafe.Sizeof(uintptr(0)) == 4 - - // Offset of params field within PEB structure. - // This structure is different in 32 and 64 bit. - paramsOffset := 0x20 - if is32bitProc { - paramsOffset = 0x10 - } - - // Read the PEB from the target process memory - pebSize := paramsOffset + 8 - peb := make([]byte, pebSize) - nRead, err := ReadProcessMemory(handle, pbi.PebBaseAddress, peb) - if err != nil { - return params, err - } - if nRead != uintptr(pebSize) { - return params, errors.Errorf("PEB: short read (%d/%d)", nRead, pebSize) - } - - // Get the RTL_USER_PROCESS_PARAMETERS struct pointer from the PEB - paramsAddr := *(*uintptr)(unsafe.Pointer(&peb[paramsOffset])) - - // Read the RTL_USER_PROCESS_PARAMETERS from the target process memory - paramsBuf := make([]byte, SizeOfRtlUserProcessParameters) - nRead, err = ReadProcessMemory(handle, paramsAddr, paramsBuf) - if err != nil { - return params, err - } - if nRead != uintptr(SizeOfRtlUserProcessParameters) { - return params, errors.Errorf("RTL_USER_PROCESS_PARAMETERS: short read (%d/%d)", nRead, SizeOfRtlUserProcessParameters) - } - - params = *(*RtlUserProcessParameters)(unsafe.Pointer(¶msBuf[0])) - return params, nil -} - -// ReadProcessUnicodeString returns a zero-terminated UTF-16 string from another -// process's memory. -func ReadProcessUnicodeString(handle syscall.Handle, s *UnicodeString) ([]byte, error) { - // Allocate an extra UTF-16 null character at the end in case the read string - // is not terminated. - extra := 2 - if s.Size&1 != 0 { - extra = 3 // If size is odd, need 3 nulls to terminate. - } - buf := make([]byte, int(s.Size)+extra) - nRead, err := ReadProcessMemory(handle, s.Buffer, buf[:s.Size]) - if err != nil { - return nil, err - } - if nRead != uintptr(s.Size) { - return nil, errors.Errorf("unicode string: short read: (%d/%d)", nRead, s.Size) - } - return buf, nil -} - -// ByteSliceToStringSlice uses CommandLineToArgv API to split an UTF-16 command -// line string into a list of parameters. -func ByteSliceToStringSlice(utf16 []byte) ([]string, error) { - n := len(utf16) - // Discard odd byte - if n&1 != 0 { - n-- - utf16 = utf16[:n] - } - if n == 0 { - return nil, nil - } - terminated := false - for i := 0; i < n && !terminated; i += 2 { - terminated = utf16[i] == 0 && utf16[i+1] == 0 - } - if !terminated { - // Append a null uint16 at the end if terminator is missing - utf16 = append(utf16, 0, 0) - } - var numArgs int32 - argsWide, err := syscall.CommandLineToArgv((*uint16)(unsafe.Pointer(&utf16[0])), &numArgs) - if err != nil { - return nil, err - } - - // Free memory allocated for CommandLineToArgvW arguments. - defer syscall.LocalFree((syscall.Handle)(unsafe.Pointer(argsWide))) - - args := make([]string, numArgs) - for idx := range args { - args[idx] = syscall.UTF16ToString(argsWide[idx][:]) - } - return args, nil -} - -// ReadProcessMemory reads from another process memory. The Handle needs to have -// the PROCESS_VM_READ right. -// A zero-byte read is a no-op, no error is returned. -func ReadProcessMemory(handle syscall.Handle, baseAddress uintptr, dest []byte) (numRead uintptr, err error) { - n := len(dest) - if n == 0 { - return 0, nil - } - if err = _ReadProcessMemory(handle, baseAddress, uintptr(unsafe.Pointer(&dest[0])), uintptr(n), &numRead); err != nil { - return 0, err - } - return numRead, nil -} - -func GetTickCount64() (uptime uint64, err error) { - if uptime, err = _GetTickCount64(); err != nil { - return 0, err - } - return uptime, nil -} - -// Windows API calls -//sys _GlobalMemoryStatusEx(buffer *MemoryStatusEx) (err error) = kernel32.GlobalMemoryStatusEx -//sys _GetLogicalDriveStringsW(bufferLength uint32, buffer *uint16) (length uint32, err error) = kernel32.GetLogicalDriveStringsW -//sys _GetProcessMemoryInfo(handle syscall.Handle, psmemCounters *ProcessMemoryCountersEx, cb uint32) (err error) = psapi.GetProcessMemoryInfo -//sys _GetProcessImageFileName(handle syscall.Handle, outImageFileName *uint16, size uint32) (length uint32, err error) = psapi.GetProcessImageFileNameW -//sys _GetSystemTimes(idleTime *syscall.Filetime, kernelTime *syscall.Filetime, userTime *syscall.Filetime) (err error) = kernel32.GetSystemTimes -//sys _GetDriveType(rootPathName *uint16) (dt DriveType, err error) = kernel32.GetDriveTypeW -//sys _GetVolumeInformation(rootPathName *uint16, volumeName *uint16, volumeNameSize uint32, volumeSerialNumber *uint32, maximumComponentLength *uint32, fileSystemFlags *uint32, fileSystemName *uint16, fileSystemNameSize uint32) (success bool, err error) [true] = kernel32.GetVolumeInformationW -//sys _EnumProcesses(processIds *uint32, sizeBytes uint32, bytesReturned *uint32) (err error) = psapi.EnumProcesses -//sys _GetDiskFreeSpaceEx(directoryName *uint16, freeBytesAvailable *uint64, totalNumberOfBytes *uint64, totalNumberOfFreeBytes *uint64) (err error) = kernel32.GetDiskFreeSpaceExW -//sys _Process32First(handle syscall.Handle, processEntry32 *ProcessEntry32) (err error) = kernel32.Process32FirstW -//sys _Process32Next(handle syscall.Handle, processEntry32 *ProcessEntry32) (err error) = kernel32.Process32NextW -//sys _CreateToolhelp32Snapshot(flags uint32, processID uint32) (handle syscall.Handle, err error) = kernel32.CreateToolhelp32Snapshot -//sys _NtQuerySystemInformation(systemInformationClass uint32, systemInformation *byte, systemInformationLength uint32, returnLength *uint32) (ntstatus uint32, err error) = ntdll.NtQuerySystemInformation -//sys _NtQueryInformationProcess(processHandle syscall.Handle, processInformationClass uint32, processInformation *byte, processInformationLength uint32, returnLength *uint32) (ntstatus uint32, err error) = ntdll.NtQueryInformationProcess -//sys _LookupPrivilegeName(systemName string, luid *int64, buffer *uint16, size *uint32) (err error) = advapi32.LookupPrivilegeNameW -//sys _LookupPrivilegeValue(systemName string, name string, luid *int64) (err error) = advapi32.LookupPrivilegeValueW -//sys _AdjustTokenPrivileges(token syscall.Token, releaseAll bool, input *byte, outputSize uint32, output *byte, requiredSize *uint32) (success bool, err error) [true] = advapi32.AdjustTokenPrivileges -//sys _FindFirstVolume(volumeName *uint16, size uint32) (handle syscall.Handle, err error) = kernel32.FindFirstVolumeW -//sys _FindNextVolume(handle syscall.Handle, volumeName *uint16, size uint32) (err error) = kernel32.FindNextVolumeW -//sys _FindVolumeClose(handle syscall.Handle) (err error) = kernel32.FindVolumeClose -//sys _GetVolumePathNamesForVolumeName(volumeName string, buffer *uint16, bufferSize uint32, length *uint32) (err error) = kernel32.GetVolumePathNamesForVolumeNameW -//sys _ReadProcessMemory(handle syscall.Handle, baseAddress uintptr, buffer uintptr, size uintptr, numRead *uintptr) (err error) = kernel32.ReadProcessMemory -//sys _GetTickCount64() (uptime uint64, err error) = kernel32.GetTickCount64 diff --git a/vendor/github.com/elastic/gosigar/sys/windows/version.go b/vendor/github.com/elastic/gosigar/sys/windows/version.go deleted file mode 100644 index d0bca89c14..0000000000 --- a/vendor/github.com/elastic/gosigar/sys/windows/version.go +++ /dev/null @@ -1,43 +0,0 @@ -// +build windows - -package windows - -import ( - "fmt" - "syscall" -) - -// Version identifies a Windows version by major, minor, and build number. -type Version struct { - Major int - Minor int - Build int -} - -// GetWindowsVersion returns the Windows version information. Applications not -// manifested for Windows 8.1 or Windows 10 will return the Windows 8 OS version -// value (6.2). -// -// For a table of version numbers see: -// https://msdn.microsoft.com/en-us/library/windows/desktop/ms724833(v=vs.85).aspx -func GetWindowsVersion() Version { - // https://msdn.microsoft.com/en-us/library/windows/desktop/ms724439(v=vs.85).aspx - ver, err := syscall.GetVersion() - if err != nil { - // GetVersion should never return an error. - panic(fmt.Errorf("GetVersion failed: %v", err)) - } - - return Version{ - Major: int(ver & 0xFF), - Minor: int(ver >> 8 & 0xFF), - Build: int(ver >> 16), - } -} - -// IsWindowsVistaOrGreater returns true if the Windows version is Vista or -// greater. -func (v Version) IsWindowsVistaOrGreater() bool { - // Vista is 6.0. - return v.Major >= 6 && v.Minor >= 0 -} diff --git a/vendor/github.com/elastic/gosigar/sys/windows/zsyscall_windows.go b/vendor/github.com/elastic/gosigar/sys/windows/zsyscall_windows.go deleted file mode 100644 index 63db70e922..0000000000 --- a/vendor/github.com/elastic/gosigar/sys/windows/zsyscall_windows.go +++ /dev/null @@ -1,299 +0,0 @@ -// Code generated by 'go generate'; DO NOT EDIT. - -package windows - -import ( - "syscall" - "unsafe" - - "golang.org/x/sys/windows" -) - -var _ unsafe.Pointer - -// Do the interface allocations only once for common -// Errno values. -const ( - errnoERROR_IO_PENDING = 997 -) - -var ( - errERROR_IO_PENDING error = syscall.Errno(errnoERROR_IO_PENDING) - errERROR_EINVAL error = syscall.EINVAL -) - -// errnoErr returns common boxed Errno values, to prevent -// allocations at runtime. -func errnoErr(e syscall.Errno) error { - switch e { - case 0: - return errERROR_EINVAL - case errnoERROR_IO_PENDING: - return errERROR_IO_PENDING - } - // TODO: add more here, after collecting data on the common - // error values see on Windows. (perhaps when running - // all.bat?) - return e -} - -var ( - modadvapi32 = windows.NewLazySystemDLL("advapi32.dll") - modkernel32 = windows.NewLazySystemDLL("kernel32.dll") - modntdll = windows.NewLazySystemDLL("ntdll.dll") - modpsapi = windows.NewLazySystemDLL("psapi.dll") - - procAdjustTokenPrivileges = modadvapi32.NewProc("AdjustTokenPrivileges") - procLookupPrivilegeNameW = modadvapi32.NewProc("LookupPrivilegeNameW") - procLookupPrivilegeValueW = modadvapi32.NewProc("LookupPrivilegeValueW") - procCreateToolhelp32Snapshot = modkernel32.NewProc("CreateToolhelp32Snapshot") - procFindFirstVolumeW = modkernel32.NewProc("FindFirstVolumeW") - procFindNextVolumeW = modkernel32.NewProc("FindNextVolumeW") - procFindVolumeClose = modkernel32.NewProc("FindVolumeClose") - procGetDiskFreeSpaceExW = modkernel32.NewProc("GetDiskFreeSpaceExW") - procGetDriveTypeW = modkernel32.NewProc("GetDriveTypeW") - procGetLogicalDriveStringsW = modkernel32.NewProc("GetLogicalDriveStringsW") - procGetSystemTimes = modkernel32.NewProc("GetSystemTimes") - procGetTickCount64 = modkernel32.NewProc("GetTickCount64") - procGetVolumeInformationW = modkernel32.NewProc("GetVolumeInformationW") - procGetVolumePathNamesForVolumeNameW = modkernel32.NewProc("GetVolumePathNamesForVolumeNameW") - procGlobalMemoryStatusEx = modkernel32.NewProc("GlobalMemoryStatusEx") - procProcess32FirstW = modkernel32.NewProc("Process32FirstW") - procProcess32NextW = modkernel32.NewProc("Process32NextW") - procReadProcessMemory = modkernel32.NewProc("ReadProcessMemory") - procNtQueryInformationProcess = modntdll.NewProc("NtQueryInformationProcess") - procNtQuerySystemInformation = modntdll.NewProc("NtQuerySystemInformation") - procEnumProcesses = modpsapi.NewProc("EnumProcesses") - procGetProcessImageFileNameW = modpsapi.NewProc("GetProcessImageFileNameW") - procGetProcessMemoryInfo = modpsapi.NewProc("GetProcessMemoryInfo") -) - -func _AdjustTokenPrivileges(token syscall.Token, releaseAll bool, input *byte, outputSize uint32, output *byte, requiredSize *uint32) (success bool, err error) { - var _p0 uint32 - if releaseAll { - _p0 = 1 - } - r0, _, e1 := syscall.Syscall6(procAdjustTokenPrivileges.Addr(), 6, uintptr(token), uintptr(_p0), uintptr(unsafe.Pointer(input)), uintptr(outputSize), uintptr(unsafe.Pointer(output)), uintptr(unsafe.Pointer(requiredSize))) - success = r0 != 0 - if true { - err = errnoErr(e1) - } - return -} - -func _LookupPrivilegeName(systemName string, luid *int64, buffer *uint16, size *uint32) (err error) { - var _p0 *uint16 - _p0, err = syscall.UTF16PtrFromString(systemName) - if err != nil { - return - } - return __LookupPrivilegeName(_p0, luid, buffer, size) -} - -func __LookupPrivilegeName(systemName *uint16, luid *int64, buffer *uint16, size *uint32) (err error) { - r1, _, e1 := syscall.Syscall6(procLookupPrivilegeNameW.Addr(), 4, uintptr(unsafe.Pointer(systemName)), uintptr(unsafe.Pointer(luid)), uintptr(unsafe.Pointer(buffer)), uintptr(unsafe.Pointer(size)), 0, 0) - if r1 == 0 { - err = errnoErr(e1) - } - return -} - -func _LookupPrivilegeValue(systemName string, name string, luid *int64) (err error) { - var _p0 *uint16 - _p0, err = syscall.UTF16PtrFromString(systemName) - if err != nil { - return - } - var _p1 *uint16 - _p1, err = syscall.UTF16PtrFromString(name) - if err != nil { - return - } - return __LookupPrivilegeValue(_p0, _p1, luid) -} - -func __LookupPrivilegeValue(systemName *uint16, name *uint16, luid *int64) (err error) { - r1, _, e1 := syscall.Syscall(procLookupPrivilegeValueW.Addr(), 3, uintptr(unsafe.Pointer(systemName)), uintptr(unsafe.Pointer(name)), uintptr(unsafe.Pointer(luid))) - if r1 == 0 { - err = errnoErr(e1) - } - return -} - -func _CreateToolhelp32Snapshot(flags uint32, processID uint32) (handle syscall.Handle, err error) { - r0, _, e1 := syscall.Syscall(procCreateToolhelp32Snapshot.Addr(), 2, uintptr(flags), uintptr(processID), 0) - handle = syscall.Handle(r0) - if handle == 0 { - err = errnoErr(e1) - } - return -} - -func _FindFirstVolume(volumeName *uint16, size uint32) (handle syscall.Handle, err error) { - r0, _, e1 := syscall.Syscall(procFindFirstVolumeW.Addr(), 2, uintptr(unsafe.Pointer(volumeName)), uintptr(size), 0) - handle = syscall.Handle(r0) - if handle == 0 { - err = errnoErr(e1) - } - return -} - -func _FindNextVolume(handle syscall.Handle, volumeName *uint16, size uint32) (err error) { - r1, _, e1 := syscall.Syscall(procFindNextVolumeW.Addr(), 3, uintptr(handle), uintptr(unsafe.Pointer(volumeName)), uintptr(size)) - if r1 == 0 { - err = errnoErr(e1) - } - return -} - -func _FindVolumeClose(handle syscall.Handle) (err error) { - r1, _, e1 := syscall.Syscall(procFindVolumeClose.Addr(), 1, uintptr(handle), 0, 0) - if r1 == 0 { - err = errnoErr(e1) - } - return -} - -func _GetDiskFreeSpaceEx(directoryName *uint16, freeBytesAvailable *uint64, totalNumberOfBytes *uint64, totalNumberOfFreeBytes *uint64) (err error) { - r1, _, e1 := syscall.Syscall6(procGetDiskFreeSpaceExW.Addr(), 4, uintptr(unsafe.Pointer(directoryName)), uintptr(unsafe.Pointer(freeBytesAvailable)), uintptr(unsafe.Pointer(totalNumberOfBytes)), uintptr(unsafe.Pointer(totalNumberOfFreeBytes)), 0, 0) - if r1 == 0 { - err = errnoErr(e1) - } - return -} - -func _GetDriveType(rootPathName *uint16) (dt DriveType, err error) { - r0, _, e1 := syscall.Syscall(procGetDriveTypeW.Addr(), 1, uintptr(unsafe.Pointer(rootPathName)), 0, 0) - dt = DriveType(r0) - if dt == 0 { - err = errnoErr(e1) - } - return -} - -func _GetLogicalDriveStringsW(bufferLength uint32, buffer *uint16) (length uint32, err error) { - r0, _, e1 := syscall.Syscall(procGetLogicalDriveStringsW.Addr(), 2, uintptr(bufferLength), uintptr(unsafe.Pointer(buffer)), 0) - length = uint32(r0) - if length == 0 { - err = errnoErr(e1) - } - return -} - -func _GetSystemTimes(idleTime *syscall.Filetime, kernelTime *syscall.Filetime, userTime *syscall.Filetime) (err error) { - r1, _, e1 := syscall.Syscall(procGetSystemTimes.Addr(), 3, uintptr(unsafe.Pointer(idleTime)), uintptr(unsafe.Pointer(kernelTime)), uintptr(unsafe.Pointer(userTime))) - if r1 == 0 { - err = errnoErr(e1) - } - return -} - -func _GetTickCount64() (uptime uint64, err error) { - r0, _, e1 := syscall.Syscall(procGetTickCount64.Addr(), 0, 0, 0, 0) - uptime = uint64(r0) - if uptime == 0 { - err = errnoErr(e1) - } - return -} - -func _GetVolumeInformation(rootPathName *uint16, volumeName *uint16, volumeNameSize uint32, volumeSerialNumber *uint32, maximumComponentLength *uint32, fileSystemFlags *uint32, fileSystemName *uint16, fileSystemNameSize uint32) (success bool, err error) { - r0, _, e1 := syscall.Syscall9(procGetVolumeInformationW.Addr(), 8, uintptr(unsafe.Pointer(rootPathName)), uintptr(unsafe.Pointer(volumeName)), uintptr(volumeNameSize), uintptr(unsafe.Pointer(volumeSerialNumber)), uintptr(unsafe.Pointer(maximumComponentLength)), uintptr(unsafe.Pointer(fileSystemFlags)), uintptr(unsafe.Pointer(fileSystemName)), uintptr(fileSystemNameSize), 0) - success = r0 != 0 - if true { - err = errnoErr(e1) - } - return -} - -func _GetVolumePathNamesForVolumeName(volumeName string, buffer *uint16, bufferSize uint32, length *uint32) (err error) { - var _p0 *uint16 - _p0, err = syscall.UTF16PtrFromString(volumeName) - if err != nil { - return - } - return __GetVolumePathNamesForVolumeName(_p0, buffer, bufferSize, length) -} - -func __GetVolumePathNamesForVolumeName(volumeName *uint16, buffer *uint16, bufferSize uint32, length *uint32) (err error) { - r1, _, e1 := syscall.Syscall6(procGetVolumePathNamesForVolumeNameW.Addr(), 4, uintptr(unsafe.Pointer(volumeName)), uintptr(unsafe.Pointer(buffer)), uintptr(bufferSize), uintptr(unsafe.Pointer(length)), 0, 0) - if r1 == 0 { - err = errnoErr(e1) - } - return -} - -func _GlobalMemoryStatusEx(buffer *MemoryStatusEx) (err error) { - r1, _, e1 := syscall.Syscall(procGlobalMemoryStatusEx.Addr(), 1, uintptr(unsafe.Pointer(buffer)), 0, 0) - if r1 == 0 { - err = errnoErr(e1) - } - return -} - -func _Process32First(handle syscall.Handle, processEntry32 *ProcessEntry32) (err error) { - r1, _, e1 := syscall.Syscall(procProcess32FirstW.Addr(), 2, uintptr(handle), uintptr(unsafe.Pointer(processEntry32)), 0) - if r1 == 0 { - err = errnoErr(e1) - } - return -} - -func _Process32Next(handle syscall.Handle, processEntry32 *ProcessEntry32) (err error) { - r1, _, e1 := syscall.Syscall(procProcess32NextW.Addr(), 2, uintptr(handle), uintptr(unsafe.Pointer(processEntry32)), 0) - if r1 == 0 { - err = errnoErr(e1) - } - return -} - -func _ReadProcessMemory(handle syscall.Handle, baseAddress uintptr, buffer uintptr, size uintptr, numRead *uintptr) (err error) { - r1, _, e1 := syscall.Syscall6(procReadProcessMemory.Addr(), 5, uintptr(handle), uintptr(baseAddress), uintptr(buffer), uintptr(size), uintptr(unsafe.Pointer(numRead)), 0) - if r1 == 0 { - err = errnoErr(e1) - } - return -} - -func _NtQueryInformationProcess(processHandle syscall.Handle, processInformationClass uint32, processInformation *byte, processInformationLength uint32, returnLength *uint32) (ntstatus uint32, err error) { - r0, _, e1 := syscall.Syscall6(procNtQueryInformationProcess.Addr(), 5, uintptr(processHandle), uintptr(processInformationClass), uintptr(unsafe.Pointer(processInformation)), uintptr(processInformationLength), uintptr(unsafe.Pointer(returnLength)), 0) - ntstatus = uint32(r0) - if ntstatus == 0 { - err = errnoErr(e1) - } - return -} - -func _NtQuerySystemInformation(systemInformationClass uint32, systemInformation *byte, systemInformationLength uint32, returnLength *uint32) (ntstatus uint32, err error) { - r0, _, e1 := syscall.Syscall6(procNtQuerySystemInformation.Addr(), 4, uintptr(systemInformationClass), uintptr(unsafe.Pointer(systemInformation)), uintptr(systemInformationLength), uintptr(unsafe.Pointer(returnLength)), 0, 0) - ntstatus = uint32(r0) - if ntstatus == 0 { - err = errnoErr(e1) - } - return -} - -func _EnumProcesses(processIds *uint32, sizeBytes uint32, bytesReturned *uint32) (err error) { - r1, _, e1 := syscall.Syscall(procEnumProcesses.Addr(), 3, uintptr(unsafe.Pointer(processIds)), uintptr(sizeBytes), uintptr(unsafe.Pointer(bytesReturned))) - if r1 == 0 { - err = errnoErr(e1) - } - return -} - -func _GetProcessImageFileName(handle syscall.Handle, outImageFileName *uint16, size uint32) (length uint32, err error) { - r0, _, e1 := syscall.Syscall(procGetProcessImageFileNameW.Addr(), 3, uintptr(handle), uintptr(unsafe.Pointer(outImageFileName)), uintptr(size)) - length = uint32(r0) - if length == 0 { - err = errnoErr(e1) - } - return -} - -func _GetProcessMemoryInfo(handle syscall.Handle, psmemCounters *ProcessMemoryCountersEx, cb uint32) (err error) { - r1, _, e1 := syscall.Syscall(procGetProcessMemoryInfo.Addr(), 3, uintptr(handle), uintptr(unsafe.Pointer(psmemCounters)), uintptr(cb)) - if r1 == 0 { - err = errnoErr(e1) - } - return -} diff --git a/vendor/github.com/francoispqt/gojay/.gitignore b/vendor/github.com/francoispqt/gojay/.gitignore deleted file mode 100644 index 43ebdc4b99..0000000000 --- a/vendor/github.com/francoispqt/gojay/.gitignore +++ /dev/null @@ -1,5 +0,0 @@ -vendor -*.out -*.log -*.test -.vscode diff --git a/vendor/github.com/francoispqt/gojay/.travis.yml b/vendor/github.com/francoispqt/gojay/.travis.yml deleted file mode 100644 index df04aa240d..0000000000 --- a/vendor/github.com/francoispqt/gojay/.travis.yml +++ /dev/null @@ -1,15 +0,0 @@ -language: go - -go: - - "1.10.x" - - "1.11.x" - - "1.12.x" - -script: - - go get github.com/golang/dep/cmd/dep github.com/stretchr/testify - - dep ensure -v -vendor-only - - go test ./gojay/codegen/test/... -race - - go test -race -coverprofile=coverage.txt -covermode=atomic - -after_success: - - bash <(curl -s https://codecov.io/bash) diff --git a/vendor/github.com/francoispqt/gojay/Gopkg.lock b/vendor/github.com/francoispqt/gojay/Gopkg.lock deleted file mode 100644 index d642e9a753..0000000000 --- a/vendor/github.com/francoispqt/gojay/Gopkg.lock +++ /dev/null @@ -1,163 +0,0 @@ -# This file is autogenerated, do not edit; changes may be undone by the next 'dep ensure'. - - -[[projects]] - digest = "1:1a37f9f2ae10d161d9688fb6008ffa14e1631e5068cc3e9698008b9e8d40d575" - name = "cloud.google.com/go" - packages = ["compute/metadata"] - pruneopts = "" - revision = "457ea5c15ccf3b87db582c450e80101989da35f7" - version = "v0.40.0" - -[[projects]] - digest = "1:968d8903d598e3fae738325d3410f33f07ea6a2b9ee5591e9c262ee37df6845a" - name = "github.com/go-errors/errors" - packages = ["."] - pruneopts = "" - revision = "a6af135bd4e28680facf08a3d206b454abc877a4" - version = "v1.0.1" - -[[projects]] - digest = "1:529d738b7976c3848cae5cf3a8036440166835e389c1f617af701eeb12a0518d" - name = "github.com/golang/protobuf" - packages = ["proto"] - pruneopts = "" - revision = "b5d812f8a3706043e23a9cd5babf2e5423744d30" - version = "v1.3.1" - -[[projects]] - branch = "master" - digest = "1:cae59d7b8243c671c9f544965522ba35c0fec48ee80adb9f1400cd2f33abbbec" - name = "github.com/mailru/easyjson" - packages = [ - ".", - "buffer", - "jlexer", - "jwriter", - ] - pruneopts = "" - revision = "1ea4449da9834f4d333f1cc461c374aea217d249" - -[[projects]] - digest = "1:1d7e1867c49a6dd9856598ef7c3123604ea3daabf5b83f303ff457bcbc410b1d" - name = "github.com/pkg/errors" - packages = ["."] - pruneopts = "" - revision = "ba968bfe8b2f7e042a574c888954fccecfa385b4" - version = "v0.8.1" - -[[projects]] - digest = "1:8d4bbd8ab012efc77ab6b97286f2aff262bcdeac9803bb57d75cf7d0a5e6a877" - name = "github.com/viant/assertly" - packages = ["."] - pruneopts = "" - revision = "04f45e0aeb6f3455884877b047a97bcc95dc9493" - version = "v0.4.8" - -[[projects]] - digest = "1:5913451bc2d274673c0716efe226a137625740cd9380641f4d8300ff4f2d82a0" - name = "github.com/viant/toolbox" - packages = [ - ".", - "cred", - "data", - "storage", - "url", - ] - pruneopts = "" - revision = "1be8e4d172138324f40d55ea61a2aeab0c5ce864" - version = "v0.24.0" - -[[projects]] - branch = "master" - digest = "1:9d150270ca2c3356f2224a0878daa1652e4d0b25b345f18b4f6e156cc4b8ec5e" - name = "golang.org/x/crypto" - packages = [ - "blowfish", - "curve25519", - "ed25519", - "ed25519/internal/edwards25519", - "internal/chacha20", - "internal/subtle", - "poly1305", - "ssh", - ] - pruneopts = "" - revision = "f99c8df09eb5bff426315721bfa5f16a99cad32c" - -[[projects]] - branch = "master" - digest = "1:5a56f211e7c12a65c5585c629457a2fb91d8719844ee8fab92727ea8adb5721c" - name = "golang.org/x/net" - packages = [ - "context", - "context/ctxhttp", - "websocket", - ] - pruneopts = "" - revision = "461777fb6f67e8cb9d70cda16573678d085a74cf" - -[[projects]] - branch = "master" - digest = "1:01bdbbc604dcd5afb6f66a717f69ad45e9643c72d5bc11678d44ffa5c50f9e42" - name = "golang.org/x/oauth2" - packages = [ - ".", - "google", - "internal", - "jws", - "jwt", - ] - pruneopts = "" - revision = "0f29369cfe4552d0e4bcddc57cc75f4d7e672a33" - -[[projects]] - branch = "master" - digest = "1:8ddb956f67d4c176abbbc42b7514aaeaf9ea30daa24e27d2cf30ad82f9334a2c" - name = "golang.org/x/sys" - packages = ["cpu"] - pruneopts = "" - revision = "1e42afee0f762ed3d76e6dd942e4181855fd1849" - -[[projects]] - digest = "1:47f391ee443f578f01168347818cb234ed819521e49e4d2c8dd2fb80d48ee41a" - name = "google.golang.org/appengine" - packages = [ - ".", - "internal", - "internal/app_identity", - "internal/base", - "internal/datastore", - "internal/log", - "internal/modules", - "internal/remote_api", - "internal/urlfetch", - "urlfetch", - ] - pruneopts = "" - revision = "b2f4a3cf3c67576a2ee09e1fe62656a5086ce880" - version = "v1.6.1" - -[[projects]] - digest = "1:cedccf16b71e86db87a24f8d4c70b0a855872eb967cb906a66b95de56aefbd0d" - name = "gopkg.in/yaml.v2" - packages = ["."] - pruneopts = "" - revision = "51d6538a90f86fe93ac480b35f37b2be17fef232" - version = "v2.2.2" - -[solve-meta] - analyzer-name = "dep" - analyzer-version = 1 - input-imports = [ - "github.com/go-errors/errors", - "github.com/mailru/easyjson", - "github.com/mailru/easyjson/jlexer", - "github.com/mailru/easyjson/jwriter", - "github.com/viant/assertly", - "github.com/viant/toolbox", - "github.com/viant/toolbox/url", - "golang.org/x/net/websocket", - ] - solver-name = "gps-cdcl" - solver-version = 1 diff --git a/vendor/github.com/francoispqt/gojay/Gopkg.toml b/vendor/github.com/francoispqt/gojay/Gopkg.toml deleted file mode 100644 index fa607923a4..0000000000 --- a/vendor/github.com/francoispqt/gojay/Gopkg.toml +++ /dev/null @@ -1,23 +0,0 @@ -# Gopkg.toml example -# -# Refer to https://github.com/golang/dep/blob/master/docs/Gopkg.toml.md -# for detailed Gopkg.toml documentation. -# -# required = ["github.com/user/thing/cmd/thing"] -# ignored = ["github.com/user/project/pkgX", "bitbucket.org/user/project/pkgA/pkgY"] -# -# [[constraint]] -# name = "github.com/user/project" -# version = "1.0.0" -# -# [[constraint]] -# name = "github.com/user/project2" -# branch = "dev" -# source = "github.com/myfork/project2" -# -# [[override]] -# name = "github.com/x/y" -# version = "2.4.0" - - -ignored = ["github.com/francoispqt/benchmarks*","github.com/stretchr/testify*","github.com/stretchr/testify","github.com/json-iterator/go","github.com/buger/jsonparser"] diff --git a/vendor/github.com/francoispqt/gojay/LICENSE b/vendor/github.com/francoispqt/gojay/LICENSE deleted file mode 100644 index df215964ee..0000000000 --- a/vendor/github.com/francoispqt/gojay/LICENSE +++ /dev/null @@ -1,21 +0,0 @@ -MIT License - -Copyright (c) 2016 gojay - -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is -furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in all -copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -SOFTWARE. \ No newline at end of file diff --git a/vendor/github.com/francoispqt/gojay/Makefile b/vendor/github.com/francoispqt/gojay/Makefile deleted file mode 100644 index ce9572391e..0000000000 --- a/vendor/github.com/francoispqt/gojay/Makefile +++ /dev/null @@ -1,11 +0,0 @@ -.PHONY: test -test: - go test -race -run=^Test -v - -.PHONY: cover -cover: - go test -coverprofile=coverage.out -covermode=atomic - -.PHONY: coverhtml -coverhtml: - go tool cover -html=coverage.out \ No newline at end of file diff --git a/vendor/github.com/francoispqt/gojay/README.md b/vendor/github.com/francoispqt/gojay/README.md deleted file mode 100644 index b2abd291d8..0000000000 --- a/vendor/github.com/francoispqt/gojay/README.md +++ /dev/null @@ -1,855 +0,0 @@ -[![Build Status](https://travis-ci.org/francoispqt/gojay.svg?branch=master)](https://travis-ci.org/francoispqt/gojay) -[![codecov](https://codecov.io/gh/francoispqt/gojay/branch/master/graph/badge.svg)](https://codecov.io/gh/francoispqt/gojay) -[![Go Report Card](https://goreportcard.com/badge/github.com/francoispqt/gojay)](https://goreportcard.com/report/github.com/francoispqt/gojay) -[![Go doc](http://img.shields.io/badge/go-documentation-blue.svg?style=flat-square -)](https://godoc.org/github.com/francoispqt/gojay) -![MIT License](https://img.shields.io/badge/license-mit-blue.svg?style=flat-square) -[![Sourcegraph](https://sourcegraph.com/github.com/francoispqt/gojay/-/badge.svg)](https://sourcegraph.com/github.com/francoispqt/gojay) -![stability-stable](https://img.shields.io/badge/stability-stable-green.svg) - -# GoJay - - - -GoJay is a performant JSON encoder/decoder for Golang (currently the most performant, [see benchmarks](#benchmark-results)). - -It has a simple API and doesn't use reflection. It relies on small interfaces to decode/encode structures and slices. - -Gojay also comes with powerful stream decoding features and an even faster [Unsafe](#unsafe-api) API. - -There is also a [code generation tool](https://github.com/francoispqt/gojay/tree/master/gojay) to make usage easier and faster. - -# Why another JSON parser? - -I looked at other fast decoder/encoder and realised it was mostly hardly readable static code generation or a lot of reflection, poor streaming features, and not so fast in the end. - -Also, I wanted to build a decoder that could consume an io.Reader of line or comma delimited JSON, in a JIT way. To consume a flow of JSON objects from a TCP connection for example or from a standard output. Same way I wanted to build an encoder that could encode a flow of data to a io.Writer. - -This is how GoJay aims to be a very fast, JIT stream parser with 0 reflection, low allocation with a friendly API. - -# Get started - -```bash -go get github.com/francoispqt/gojay -``` - -* [Encoder](#encoding) -* [Decoder](#decoding) -* [Stream API](#stream-api) -* [Code Generation](https://github.com/francoispqt/gojay/tree/master/gojay) - -## Decoding - -Decoding is done through two different API similar to standard `encoding/json`: -* [Unmarshal](#unmarshal-api) -* [Decode](#decode-api) - - -Example of basic stucture decoding with Unmarshal: -```go -import "github.com/francoispqt/gojay" - -type user struct { - id int - name string - email string -} -// implement gojay.UnmarshalerJSONObject -func (u *user) UnmarshalJSONObject(dec *gojay.Decoder, key string) error { - switch key { - case "id": - return dec.Int(&u.id) - case "name": - return dec.String(&u.name) - case "email": - return dec.String(&u.email) - } - return nil -} -func (u *user) NKeys() int { - return 3 -} - -func main() { - u := &user{} - d := []byte(`{"id":1,"name":"gojay","email":"gojay@email.com"}`) - err := gojay.UnmarshalJSONObject(d, u) - if err != nil { - log.Fatal(err) - } -} -``` - -with Decode: -```go -func main() { - u := &user{} - dec := gojay.NewDecoder(bytes.NewReader([]byte(`{"id":1,"name":"gojay","email":"gojay@email.com"}`))) - err := dec.DecodeObject(d, u) - if err != nil { - log.Fatal(err) - } -} -``` - -### Unmarshal API - -Unmarshal API decodes a `[]byte` to a given pointer with a single function. - -Behind the doors, Unmarshal API borrows a `*gojay.Decoder` resets its settings and decodes the data to the given pointer and releases the `*gojay.Decoder` to the pool when it finishes, whether it encounters an error or not. - -If it cannot find the right Decoding strategy for the type of the given pointer, it returns an `InvalidUnmarshalError`. You can test the error returned by doing `if ok := err.(InvalidUnmarshalError); ok {}`. - -Unmarshal API comes with three functions: -* Unmarshal -```go -func Unmarshal(data []byte, v interface{}) error -``` - -* UnmarshalJSONObject -```go -func UnmarshalJSONObject(data []byte, v gojay.UnmarshalerJSONObject) error -``` - -* UnmarshalJSONArray -```go -func UnmarshalJSONArray(data []byte, v gojay.UnmarshalerJSONArray) error -``` - - -### Decode API - -Decode API decodes a `[]byte` to a given pointer by creating or borrowing a `*gojay.Decoder` with an `io.Reader` and calling `Decode` methods. - -__Getting a *gojay.Decoder or Borrowing__ - -You can either get a fresh `*gojay.Decoder` calling `dec := gojay.NewDecoder(io.Reader)` or borrow one from the pool by calling `dec := gojay.BorrowDecoder(io.Reader)`. - -After using a decoder, you can release it by calling `dec.Release()`. Beware, if you reuse the decoder after releasing it, it will panic with an error of type `InvalidUsagePooledDecoderError`. If you want to fully benefit from the pooling, you must release your decoders after using. - -Example getting a fresh an releasing: -```go -str := "" -dec := gojay.NewDecoder(strings.NewReader(`"test"`)) -defer dec.Release() -if err := dec.Decode(&str); err != nil { - log.Fatal(err) -} -``` -Example borrowing a decoder and releasing: -```go -str := "" -dec := gojay.BorrowDecoder(strings.NewReader(`"test"`)) -defer dec.Release() -if err := dec.Decode(&str); err != nil { - log.Fatal(err) -} -``` - -`*gojay.Decoder` has multiple methods to decode to specific types: -* Decode -```go -func (dec *gojay.Decoder) Decode(v interface{}) error -``` -* DecodeObject -```go -func (dec *gojay.Decoder) DecodeObject(v gojay.UnmarshalerJSONObject) error -``` -* DecodeArray -```go -func (dec *gojay.Decoder) DecodeArray(v gojay.UnmarshalerJSONArray) error -``` -* DecodeInt -```go -func (dec *gojay.Decoder) DecodeInt(v *int) error -``` -* DecodeBool -```go -func (dec *gojay.Decoder) DecodeBool(v *bool) error -``` -* DecodeString -```go -func (dec *gojay.Decoder) DecodeString(v *string) error -``` - -All DecodeXxx methods are used to decode top level JSON values. If you are decoding keys or items of a JSON object or array, don't use the Decode methods. - -Example: -```go -reader := strings.NewReader(`"John Doe"`) -dec := NewDecoder(reader) - -var str string -err := dec.DecodeString(&str) -if err != nil { - log.Fatal(err) -} - -fmt.Println(str) // John Doe -``` - -### Structs and Maps -#### UnmarshalerJSONObject Interface - -To unmarshal a JSON object to a structure, the structure must implement the `UnmarshalerJSONObject` interface: -```go -type UnmarshalerJSONObject interface { - UnmarshalJSONObject(*gojay.Decoder, string) error - NKeys() int -} -``` -`UnmarshalJSONObject` method takes two arguments, the first one is a pointer to the Decoder (*gojay.Decoder) and the second one is the string value of the current key being parsed. If the JSON data is not an object, the UnmarshalJSONObject method will never be called. - -`NKeys` method must return the number of keys to Unmarshal in the JSON object or 0. If zero is returned, all keys will be parsed. - -Example of implementation for a struct: -```go -type user struct { - id int - name string - email string -} -// implement UnmarshalerJSONObject -func (u *user) UnmarshalJSONObject(dec *gojay.Decoder, key string) error { - switch key { - case "id": - return dec.Int(&u.id) - case "name": - return dec.String(&u.name) - case "email": - return dec.String(&u.email) - } - return nil -} -func (u *user) NKeys() int { - return 3 -} -``` - -Example of implementation for a `map[string]string`: -```go -// define our custom map type implementing UnmarshalerJSONObject -type message map[string]string - -// Implementing Unmarshaler -func (m message) UnmarshalJSONObject(dec *gojay.Decoder, k string) error { - str := "" - err := dec.String(&str) - if err != nil { - return err - } - m[k] = str - return nil -} - -// we return 0, it tells the Decoder to decode all keys -func (m message) NKeys() int { - return 0 -} -``` - -### Arrays, Slices and Channels - -To unmarshal a JSON object to a slice an array or a channel, it must implement the UnmarshalerJSONArray interface: -```go -type UnmarshalerJSONArray interface { - UnmarshalJSONArray(*gojay.Decoder) error -} -``` -UnmarshalJSONArray method takes one argument, a pointer to the Decoder (*gojay.Decoder). If the JSON data is not an array, the Unmarshal method will never be called. - -Example of implementation with a slice: -```go -type testSlice []string -// implement UnmarshalerJSONArray -func (t *testSlice) UnmarshalJSONArray(dec *gojay.Decoder) error { - str := "" - if err := dec.String(&str); err != nil { - return err - } - *t = append(*t, str) - return nil -} - -func main() { - dec := gojay.BorrowDecoder(strings.NewReader(`["Tom", "Jim"]`)) - var slice testSlice - err := dec.DecodeArray(&slice) - if err != nil { - log.Fatal(err) - } - fmt.Println(slice) // [Tom Jim] - dec.Release() -} -``` - -Example of implementation with a channel: -```go -type testChannel chan string -// implement UnmarshalerJSONArray -func (c testChannel) UnmarshalJSONArray(dec *gojay.Decoder) error { - str := "" - if err := dec.String(&str); err != nil { - return err - } - c <- str - return nil -} - -func main() { - dec := gojay.BorrowDecoder(strings.NewReader(`["Tom", "Jim"]`)) - c := make(testChannel, 2) - err := dec.DecodeArray(c) - if err != nil { - log.Fatal(err) - } - for i := 0; i < 2; i++ { - fmt.Println(<-c) - } - close(c) - dec.Release() -} -``` - -Example of implementation with an array: -```go -type testArray [3]string -// implement UnmarshalerJSONArray -func (a *testArray) UnmarshalJSONArray(dec *Decoder) error { - var str string - if err := dec.String(&str); err != nil { - return err - } - a[dec.Index()] = str - return nil -} - -func main() { - dec := gojay.BorrowDecoder(strings.NewReader(`["Tom", "Jim", "Bob"]`)) - var a testArray - err := dec.DecodeArray(&a) - fmt.Println(a) // [Tom Jim Bob] - dec.Release() -} -``` - -### Other types -To decode other types (string, int, int32, int64, uint32, uint64, float, booleans), you don't need to implement any interface. - -Example of encoding strings: -```go -func main() { - json := []byte(`"Jay"`) - var v string - err := gojay.Unmarshal(json, &v) - if err != nil { - log.Fatal(err) - } - fmt.Println(v) // Jay -} -``` - -### Decode values methods -When decoding a JSON object of a JSON array using `UnmarshalerJSONObject` or `UnmarshalerJSONArray` interface, the `gojay.Decoder` provides dozens of methods to Decode multiple types. - -Non exhaustive list of methods available (to see all methods, check the godoc): -```go -dec.Int -dec.Int8 -dec.Int16 -dec.Int32 -dec.Int64 -dec.Uint8 -dec.Uint16 -dec.Uint32 -dec.Uint64 -dec.String -dec.Time -dec.Bool -dec.SQLNullString -dec.SQLNullInt64 -``` - - -## Encoding - -Encoding is done through two different API similar to standard `encoding/json`: -* [Marshal](#marshal-api) -* [Encode](#encode-api) - -Example of basic structure encoding with Marshal: -```go -import "github.com/francoispqt/gojay" - -type user struct { - id int - name string - email string -} - -// implement MarshalerJSONObject -func (u *user) MarshalJSONObject(enc *gojay.Encoder) { - enc.IntKey("id", u.id) - enc.StringKey("name", u.name) - enc.StringKey("email", u.email) -} -func (u *user) IsNil() bool { - return u == nil -} - -func main() { - u := &user{1, "gojay", "gojay@email.com"} - b, err := gojay.MarshalJSONObject(u) - if err != nil { - log.Fatal(err) - } - fmt.Println(string(b)) // {"id":1,"name":"gojay","email":"gojay@email.com"} -} -``` - -with Encode: -```go -func main() { - u := &user{1, "gojay", "gojay@email.com"} - b := strings.Builder{} - enc := gojay.NewEncoder(&b) - if err := enc.Encode(u); err != nil { - log.Fatal(err) - } - fmt.Println(b.String()) // {"id":1,"name":"gojay","email":"gojay@email.com"} -} -``` - -### Marshal API - -Marshal API encodes a value to a JSON `[]byte` with a single function. - -Behind the doors, Marshal API borrows a `*gojay.Encoder` resets its settings and encodes the data to an internal byte buffer and releases the `*gojay.Encoder` to the pool when it finishes, whether it encounters an error or not. - -If it cannot find the right Encoding strategy for the type of the given value, it returns an `InvalidMarshalError`. You can test the error returned by doing `if ok := err.(InvalidMarshalError); ok {}`. - -Marshal API comes with three functions: -* Marshal -```go -func Marshal(v interface{}) ([]byte, error) -``` - -* MarshalJSONObject -```go -func MarshalJSONObject(v gojay.MarshalerJSONObject) ([]byte, error) -``` - -* MarshalJSONArray -```go -func MarshalJSONArray(v gojay.MarshalerJSONArray) ([]byte, error) -``` - -### Encode API - -Encode API decodes a value to JSON by creating or borrowing a `*gojay.Encoder` sending it to an `io.Writer` and calling `Encode` methods. - -__Getting a *gojay.Encoder or Borrowing__ - -You can either get a fresh `*gojay.Encoder` calling `enc := gojay.NewEncoder(io.Writer)` or borrow one from the pool by calling `enc := gojay.BorrowEncoder(io.Writer)`. - -After using an encoder, you can release it by calling `enc.Release()`. Beware, if you reuse the encoder after releasing it, it will panic with an error of type `InvalidUsagePooledEncoderError`. If you want to fully benefit from the pooling, you must release your encoders after using. - -Example getting a fresh encoder an releasing: -```go -str := "test" -b := strings.Builder{} -enc := gojay.NewEncoder(&b) -defer enc.Release() -if err := enc.Encode(str); err != nil { - log.Fatal(err) -} -``` -Example borrowing an encoder and releasing: -```go -str := "test" -b := strings.Builder{} -enc := gojay.BorrowEncoder(b) -defer enc.Release() -if err := enc.Encode(str); err != nil { - log.Fatal(err) -} -``` - -`*gojay.Encoder` has multiple methods to encoder specific types to JSON: -* Encode -```go -func (enc *gojay.Encoder) Encode(v interface{}) error -``` -* EncodeObject -```go -func (enc *gojay.Encoder) EncodeObject(v gojay.MarshalerJSONObject) error -``` -* EncodeArray -```go -func (enc *gojay.Encoder) EncodeArray(v gojay.MarshalerJSONArray) error -``` -* EncodeInt -```go -func (enc *gojay.Encoder) EncodeInt(n int) error -``` -* EncodeInt64 -```go -func (enc *gojay.Encoder) EncodeInt64(n int64) error -``` -* EncodeFloat -```go -func (enc *gojay.Encoder) EncodeFloat(n float64) error -``` -* EncodeBool -```go -func (enc *gojay.Encoder) EncodeBool(v bool) error -``` -* EncodeString -```go -func (enc *gojay.Encoder) EncodeString(s string) error -``` - -### Structs and Maps - -To encode a structure, the structure must implement the MarshalerJSONObject interface: -```go -type MarshalerJSONObject interface { - MarshalJSONObject(enc *gojay.Encoder) - IsNil() bool -} -``` -`MarshalJSONObject` method takes one argument, a pointer to the Encoder (*gojay.Encoder). The method must add all the keys in the JSON Object by calling Decoder's methods. - -IsNil method returns a boolean indicating if the interface underlying value is nil or not. It is used to safely ensure that the underlying value is not nil without using Reflection. - -Example of implementation for a struct: -```go -type user struct { - id int - name string - email string -} - -// implement MarshalerJSONObject -func (u *user) MarshalJSONObject(enc *gojay.Encoder) { - enc.IntKey("id", u.id) - enc.StringKey("name", u.name) - enc.StringKey("email", u.email) -} -func (u *user) IsNil() bool { - return u == nil -} -``` - -Example of implementation for a `map[string]string`: -```go -// define our custom map type implementing MarshalerJSONObject -type message map[string]string - -// Implementing Marshaler -func (m message) MarshalJSONObject(enc *gojay.Encoder) { - for k, v := range m { - enc.StringKey(k, v) - } -} - -func (m message) IsNil() bool { - return m == nil -} -``` - -### Arrays and Slices -To encode an array or a slice, the slice/array must implement the MarshalerJSONArray interface: -```go -type MarshalerJSONArray interface { - MarshalJSONArray(enc *gojay.Encoder) - IsNil() bool -} -``` -`MarshalJSONArray` method takes one argument, a pointer to the Encoder (*gojay.Encoder). The method must add all element in the JSON Array by calling Decoder's methods. - -`IsNil` method returns a boolean indicating if the interface underlying value is nil(empty) or not. It is used to safely ensure that the underlying value is not nil without using Reflection and also to in `OmitEmpty` feature. - -Example of implementation: -```go -type users []*user -// implement MarshalerJSONArray -func (u *users) MarshalJSONArray(enc *gojay.Encoder) { - for _, e := range u { - enc.Object(e) - } -} -func (u *users) IsNil() bool { - return len(u) == 0 -} -``` - -### Other types -To encode other types (string, int, float, booleans), you don't need to implement any interface. - -Example of encoding strings: -```go -func main() { - name := "Jay" - b, err := gojay.Marshal(name) - if err != nil { - log.Fatal(err) - } - fmt.Println(string(b)) // "Jay" -} -``` - -# Stream API - -### Stream Decoding -GoJay ships with a powerful stream decoder. - -It allows to read continuously from an io.Reader stream and do JIT decoding writing unmarshalled JSON to a channel to allow async consuming. - -When using the Stream API, the Decoder implements context.Context to provide graceful cancellation. - -To decode a stream of JSON, you must call `gojay.Stream.DecodeStream` and pass it a `UnmarshalerStream` implementation. - -```go -type UnmarshalerStream interface { - UnmarshalStream(*StreamDecoder) error -} -``` - -Example of implementation of stream reading from a WebSocket connection: -```go -// implement UnmarshalerStream -type ChannelStream chan *user - -func (c ChannelStream) UnmarshalStream(dec *gojay.StreamDecoder) error { - u := &user{} - if err := dec.Object(u); err != nil { - return err - } - c <- u - return nil -} - -func main() { - // get our websocket connection - origin := "http://localhost/" - url := "ws://localhost:12345/ws" - ws, err := websocket.Dial(url, "", origin) - if err != nil { - log.Fatal(err) - } - // create our channel which will receive our objects - streamChan := ChannelStream(make(chan *user)) - // borrow a decoder - dec := gojay.Stream.BorrowDecoder(ws) - // start decoding, it will block until a JSON message is decoded from the WebSocket - // or until Done channel is closed - go dec.DecodeStream(streamChan) - for { - select { - case v := <-streamChan: - // Got something from my websocket! - log.Println(v) - case <-dec.Done(): - log.Println("finished reading from WebSocket") - os.Exit(0) - } - } -} -``` - -### Stream Encoding -GoJay ships with a powerful stream encoder part of the Stream API. - -It allows to write continuously to an io.Writer and do JIT encoding of data fed to a channel to allow async consuming. You can set multiple consumers on the channel to be as performant as possible. Consumers are non blocking and are scheduled individually in their own go routine. - -When using the Stream API, the Encoder implements context.Context to provide graceful cancellation. - -To encode a stream of data, you must call `EncodeStream` and pass it a `MarshalerStream` implementation. - -```go -type MarshalerStream interface { - MarshalStream(enc *gojay.StreamEncoder) -} -``` - -Example of implementation of stream writing to a WebSocket: -```go -// Our structure which will be pushed to our stream -type user struct { - id int - name string - email string -} - -func (u *user) MarshalJSONObject(enc *gojay.Encoder) { - enc.IntKey("id", u.id) - enc.StringKey("name", u.name) - enc.StringKey("email", u.email) -} -func (u *user) IsNil() bool { - return u == nil -} - -// Our MarshalerStream implementation -type StreamChan chan *user - -func (s StreamChan) MarshalStream(enc *gojay.StreamEncoder) { - select { - case <-enc.Done(): - return - case o := <-s: - enc.Object(o) - } -} - -// Our main function -func main() { - // get our websocket connection - origin := "http://localhost/" - url := "ws://localhost:12345/ws" - ws, err := websocket.Dial(url, "", origin) - if err != nil { - log.Fatal(err) - } - // we borrow an encoder set stdout as the writer, - // set the number of consumer to 10 - // and tell the encoder to separate each encoded element - // added to the channel by a new line character - enc := gojay.Stream.BorrowEncoder(ws).NConsumer(10).LineDelimited() - // instantiate our MarshalerStream - s := StreamChan(make(chan *user)) - // start the stream encoder - // will block its goroutine until enc.Cancel(error) is called - // or until something is written to the channel - go enc.EncodeStream(s) - // write to our MarshalerStream - for i := 0; i < 1000; i++ { - s <- &user{i, "username", "user@email.com"} - } - // Wait - <-enc.Done() -} -``` - -# Unsafe API - -Unsafe API has the same functions than the regular API, it only has `Unmarshal API` for now. It is unsafe because it makes assumptions on the quality of the given JSON. - -If you are not sure if your JSON is valid, don't use the Unsafe API. - -Also, the `Unsafe` API does not copy the buffer when using Unmarshal API, which, in case of string decoding, can lead to data corruption if a byte buffer is reused. Using the `Decode` API makes `Unsafe` API safer as the io.Reader relies on `copy` builtin method and `Decoder` will have its own internal buffer :) - -Access the `Unsafe` API this way: -```go -gojay.Unsafe.Unmarshal(b, v) -``` - - -# Benchmarks - -Benchmarks encode and decode three different data based on size (small, medium, large). - -To run benchmark for decoder: -```bash -cd $GOPATH/src/github.com/francoispqt/gojay/benchmarks/decoder && make bench -``` - -To run benchmark for encoder: -```bash -cd $GOPATH/src/github.com/francoispqt/gojay/benchmarks/encoder && make bench -``` - -# Benchmark Results -## Decode - - - -### Small Payload -[benchmark code is here](https://github.com/francoispqt/gojay/blob/master/benchmarks/decoder/decoder_bench_small_test.go) - -[benchmark data is here](https://github.com/francoispqt/gojay/blob/master/benchmarks/benchmarks_small.go) - -| | ns/op | bytes/op | allocs/op | -|-----------------|-----------|--------------|-----------| -| Std Library | 2547 | 496 | 4 | -| JsonIter | 2046 | 312 | 12 | -| JsonParser | 1408 | 0 | 0 | -| EasyJson | 929 | 240 | 2 | -| **GoJay** | **807** | **256** | **2** | -| **GoJay-unsafe**| **712** | **112** | **1** | - -### Medium Payload -[benchmark code is here](https://github.com/francoispqt/gojay/blob/master/benchmarks/decoder/decoder_bench_medium_test.go) - -[benchmark data is here](https://github.com/francoispqt/gojay/blob/master/benchmarks/benchmarks_medium.go) - -| | ns/op | bytes/op | allocs/op | -|-----------------|-----------|----------|-----------| -| Std Library | 30148 | 2152 | 496 | -| JsonIter | 16309 | 2976 | 80 | -| JsonParser | 7793 | 0 | 0 | -| EasyJson | 7957 | 232 | 6 | -| **GoJay** | **4984** | **2448** | **8** | -| **GoJay-unsafe**| **4809** | **144** | **7** | - -### Large Payload -[benchmark code is here](https://github.com/francoispqt/gojay/blob/master/benchmarks/decoder/decoder_bench_large_test.go) - -[benchmark data is here](https://github.com/francoispqt/gojay/blob/master/benchmarks/benchmarks_large.go) - -| | ns/op | bytes/op | allocs/op | -|-----------------|-----------|-------------|-----------| -| JsonIter | 210078 | 41712 | 1136 | -| EasyJson | 106626 | 160 | 2 | -| JsonParser | 66813 | 0 | 0 | -| **GoJay** | **52153** | **31241** | **77** | -| **GoJay-unsafe**| **48277** | **2561** | **76** | - -## Encode - - - -### Small Struct -[benchmark code is here](https://github.com/francoispqt/gojay/blob/master/benchmarks/encoder/encoder_bench_small_test.go) - -[benchmark data is here](https://github.com/francoispqt/gojay/blob/master/benchmarks/benchmarks_small.go) - -| | ns/op | bytes/op | allocs/op | -|----------------|----------|--------------|-----------| -| Std Library | 1280 | 464 | 3 | -| EasyJson | 871 | 944 | 6 | -| JsonIter | 866 | 272 | 3 | -| **GoJay** | **543** | **112** | **1** | -| **GoJay-func** | **347** | **0** | **0** | - -### Medium Struct -[benchmark code is here](https://github.com/francoispqt/gojay/blob/master/benchmarks/encoder/encoder_bench_medium_test.go) - -[benchmark data is here](https://github.com/francoispqt/gojay/blob/master/benchmarks/benchmarks_medium.go) - -| | ns/op | bytes/op | allocs/op | -|-------------|----------|--------------|-----------| -| Std Library | 5006 | 1496 | 25 | -| JsonIter | 2232 | 1544 | 20 | -| EasyJson | 1997 | 1544 | 19 | -| **GoJay** | **1522** | **312** | **14** | - -### Large Struct -[benchmark code is here](https://github.com/francoispqt/gojay/blob/master/benchmarks/encoder/encoder_bench_large_test.go) - -[benchmark data is here](https://github.com/francoispqt/gojay/blob/master/benchmarks/benchmarks_large.go) - -| | ns/op | bytes/op | allocs/op | -|-------------|-----------|--------------|-----------| -| Std Library | 66441 | 20576 | 332 | -| JsonIter | 35247 | 20255 | 328 | -| EasyJson | 32053 | 15474 | 327 | -| **GoJay** | **27847** | **9802** | **318** | - -# Contributing - -Contributions are welcome :) - -If you encounter issues please report it in Github and/or send an email at [francois@parquet.ninja](mailto:francois@parquet.ninja) - diff --git a/vendor/github.com/francoispqt/gojay/decode.go b/vendor/github.com/francoispqt/gojay/decode.go deleted file mode 100644 index fbd07f76c2..0000000000 --- a/vendor/github.com/francoispqt/gojay/decode.go +++ /dev/null @@ -1,386 +0,0 @@ -package gojay - -import ( - "fmt" - "io" -) - -// UnmarshalJSONArray parses the JSON-encoded data and stores the result in the value pointed to by v. -// -// v must implement UnmarshalerJSONArray. -// -// If a JSON value is not appropriate for a given target type, or if a JSON number -// overflows the target type, UnmarshalJSONArray skips that field and completes the unmarshaling as best it can. -func UnmarshalJSONArray(data []byte, v UnmarshalerJSONArray) error { - dec := borrowDecoder(nil, 0) - defer dec.Release() - dec.data = make([]byte, len(data)) - copy(dec.data, data) - dec.length = len(data) - _, err := dec.decodeArray(v) - if err != nil { - return err - } - if dec.err != nil { - return dec.err - } - return nil -} - -// UnmarshalJSONObject parses the JSON-encoded data and stores the result in the value pointed to by v. -// -// v must implement UnmarshalerJSONObject. -// -// If a JSON value is not appropriate for a given target type, or if a JSON number -// overflows the target type, UnmarshalJSONObject skips that field and completes the unmarshaling as best it can. -func UnmarshalJSONObject(data []byte, v UnmarshalerJSONObject) error { - dec := borrowDecoder(nil, 0) - defer dec.Release() - dec.data = make([]byte, len(data)) - copy(dec.data, data) - dec.length = len(data) - _, err := dec.decodeObject(v) - if err != nil { - return err - } - if dec.err != nil { - return dec.err - } - return nil -} - -// Unmarshal parses the JSON-encoded data and stores the result in the value pointed to by v. -// If v is nil, not an implementation of UnmarshalerJSONObject or UnmarshalerJSONArray or not one of the following types: -// *string, **string, *int, **int, *int8, **int8, *int16, **int16, *int32, **int32, *int64, **int64, *uint8, **uint8, *uint16, **uint16, -// *uint32, **uint32, *uint64, **uint64, *float64, **float64, *float32, **float32, *bool, **bool -// Unmarshal returns an InvalidUnmarshalError. -// -// -// If a JSON value is not appropriate for a given target type, or if a JSON number -// overflows the target type, Unmarshal skips that field and completes the unmarshaling as best it can. -// If no more serious errors are encountered, Unmarshal returns an UnmarshalTypeError describing the earliest such error. -// In any case, it's not guaranteed that all the remaining fields following the problematic one will be unmarshaled into the target object. -func Unmarshal(data []byte, v interface{}) error { - var err error - var dec *Decoder - switch vt := v.(type) { - case *string: - dec = borrowDecoder(nil, 0) - dec.length = len(data) - dec.data = data - err = dec.decodeString(vt) - case **string: - dec = borrowDecoder(nil, 0) - dec.length = len(data) - dec.data = data - err = dec.decodeStringNull(vt) - case *int: - dec = borrowDecoder(nil, 0) - dec.length = len(data) - dec.data = data - err = dec.decodeInt(vt) - case **int: - dec = borrowDecoder(nil, 0) - dec.length = len(data) - dec.data = data - err = dec.decodeIntNull(vt) - case *int8: - dec = borrowDecoder(nil, 0) - dec.length = len(data) - dec.data = data - err = dec.decodeInt8(vt) - case **int8: - dec = borrowDecoder(nil, 0) - dec.length = len(data) - dec.data = data - err = dec.decodeInt8Null(vt) - case *int16: - dec = borrowDecoder(nil, 0) - dec.length = len(data) - dec.data = data - err = dec.decodeInt16(vt) - case **int16: - dec = borrowDecoder(nil, 0) - dec.length = len(data) - dec.data = data - err = dec.decodeInt16Null(vt) - case *int32: - dec = borrowDecoder(nil, 0) - dec.length = len(data) - dec.data = data - err = dec.decodeInt32(vt) - case **int32: - dec = borrowDecoder(nil, 0) - dec.length = len(data) - dec.data = data - err = dec.decodeInt32Null(vt) - case *int64: - dec = borrowDecoder(nil, 0) - dec.length = len(data) - dec.data = data - err = dec.decodeInt64(vt) - case **int64: - dec = borrowDecoder(nil, 0) - dec.length = len(data) - dec.data = data - err = dec.decodeInt64Null(vt) - case *uint8: - dec = borrowDecoder(nil, 0) - dec.length = len(data) - dec.data = data - err = dec.decodeUint8(vt) - case **uint8: - dec = borrowDecoder(nil, 0) - dec.length = len(data) - dec.data = data - err = dec.decodeUint8Null(vt) - case *uint16: - dec = borrowDecoder(nil, 0) - dec.length = len(data) - dec.data = data - err = dec.decodeUint16(vt) - case **uint16: - dec = borrowDecoder(nil, 0) - dec.length = len(data) - dec.data = data - err = dec.decodeUint16Null(vt) - case *uint32: - dec = borrowDecoder(nil, 0) - dec.length = len(data) - dec.data = data - err = dec.decodeUint32(vt) - case **uint32: - dec = borrowDecoder(nil, 0) - dec.length = len(data) - dec.data = data - err = dec.decodeUint32Null(vt) - case *uint64: - dec = borrowDecoder(nil, 0) - dec.length = len(data) - dec.data = data - err = dec.decodeUint64(vt) - case **uint64: - dec = borrowDecoder(nil, 0) - dec.length = len(data) - dec.data = data - err = dec.decodeUint64Null(vt) - case *float64: - dec = borrowDecoder(nil, 0) - dec.length = len(data) - dec.data = data - err = dec.decodeFloat64(vt) - case **float64: - dec = borrowDecoder(nil, 0) - dec.length = len(data) - dec.data = data - err = dec.decodeFloat64Null(vt) - case *float32: - dec = borrowDecoder(nil, 0) - dec.length = len(data) - dec.data = data - err = dec.decodeFloat32(vt) - case **float32: - dec = borrowDecoder(nil, 0) - dec.length = len(data) - dec.data = data - err = dec.decodeFloat32Null(vt) - case *bool: - dec = borrowDecoder(nil, 0) - dec.length = len(data) - dec.data = data - err = dec.decodeBool(vt) - case **bool: - dec = borrowDecoder(nil, 0) - dec.length = len(data) - dec.data = data - err = dec.decodeBoolNull(vt) - case UnmarshalerJSONObject: - dec = borrowDecoder(nil, 0) - dec.length = len(data) - dec.data = make([]byte, len(data)) - copy(dec.data, data) - _, err = dec.decodeObject(vt) - case UnmarshalerJSONArray: - dec = borrowDecoder(nil, 0) - dec.length = len(data) - dec.data = make([]byte, len(data)) - copy(dec.data, data) - _, err = dec.decodeArray(vt) - case *interface{}: - dec = borrowDecoder(nil, 0) - dec.length = len(data) - dec.data = make([]byte, len(data)) - copy(dec.data, data) - err = dec.decodeInterface(vt) - default: - return InvalidUnmarshalError(fmt.Sprintf(invalidUnmarshalErrorMsg, vt)) - } - defer dec.Release() - if err != nil { - return err - } - return dec.err -} - -// UnmarshalerJSONObject is the interface to implement to decode a JSON Object. -type UnmarshalerJSONObject interface { - UnmarshalJSONObject(*Decoder, string) error - NKeys() int -} - -// UnmarshalerJSONArray is the interface to implement to decode a JSON Array. -type UnmarshalerJSONArray interface { - UnmarshalJSONArray(*Decoder) error -} - -// A Decoder reads and decodes JSON values from an input stream. -type Decoder struct { - r io.Reader - data []byte - err error - isPooled byte - called byte - child byte - cursor int - length int - keysDone int - arrayIndex int -} - -// Decode reads the next JSON-encoded value from the decoder's input (io.Reader) and stores it in the value pointed to by v. -// -// See the documentation for Unmarshal for details about the conversion of JSON into a Go value. -// The differences between Decode and Unmarshal are: -// - Decode reads from an io.Reader in the Decoder, whereas Unmarshal reads from a []byte -// - Decode leaves to the user the option of borrowing and releasing a Decoder, whereas Unmarshal internally always borrows a Decoder and releases it when the unmarshaling is completed -func (dec *Decoder) Decode(v interface{}) error { - if dec.isPooled == 1 { - panic(InvalidUsagePooledDecoderError("Invalid usage of pooled decoder")) - } - var err error - switch vt := v.(type) { - case *string: - err = dec.decodeString(vt) - case **string: - err = dec.decodeStringNull(vt) - case *int: - err = dec.decodeInt(vt) - case **int: - err = dec.decodeIntNull(vt) - case *int8: - err = dec.decodeInt8(vt) - case **int8: - err = dec.decodeInt8Null(vt) - case *int16: - err = dec.decodeInt16(vt) - case **int16: - err = dec.decodeInt16Null(vt) - case *int32: - err = dec.decodeInt32(vt) - case **int32: - err = dec.decodeInt32Null(vt) - case *int64: - err = dec.decodeInt64(vt) - case **int64: - err = dec.decodeInt64Null(vt) - case *uint8: - err = dec.decodeUint8(vt) - case **uint8: - err = dec.decodeUint8Null(vt) - case *uint16: - err = dec.decodeUint16(vt) - case **uint16: - err = dec.decodeUint16Null(vt) - case *uint32: - err = dec.decodeUint32(vt) - case **uint32: - err = dec.decodeUint32Null(vt) - case *uint64: - err = dec.decodeUint64(vt) - case **uint64: - err = dec.decodeUint64Null(vt) - case *float64: - err = dec.decodeFloat64(vt) - case **float64: - err = dec.decodeFloat64Null(vt) - case *float32: - err = dec.decodeFloat32(vt) - case **float32: - err = dec.decodeFloat32Null(vt) - case *bool: - err = dec.decodeBool(vt) - case **bool: - err = dec.decodeBoolNull(vt) - case UnmarshalerJSONObject: - _, err = dec.decodeObject(vt) - case UnmarshalerJSONArray: - _, err = dec.decodeArray(vt) - case *EmbeddedJSON: - err = dec.decodeEmbeddedJSON(vt) - case *interface{}: - err = dec.decodeInterface(vt) - default: - return InvalidUnmarshalError(fmt.Sprintf(invalidUnmarshalErrorMsg, vt)) - } - if err != nil { - return err - } - return dec.err -} - -// Non exported - -func isDigit(b byte) bool { - switch b { - case '0', '1', '2', '3', '4', '5', '6', '7', '8', '9': - return true - default: - return false - } -} - -func (dec *Decoder) read() bool { - if dec.r != nil { - // if we reach the end, double the buffer to ensure there's always more space - if len(dec.data) == dec.length { - nLen := dec.length * 2 - if nLen == 0 { - nLen = 512 - } - Buf := make([]byte, nLen, nLen) - copy(Buf, dec.data) - dec.data = Buf - } - var n int - var err error - for n == 0 { - n, err = dec.r.Read(dec.data[dec.length:]) - if err != nil { - if err != io.EOF { - dec.err = err - return false - } - if n == 0 { - return false - } - dec.length = dec.length + n - return true - } - } - dec.length = dec.length + n - return true - } - return false -} - -func (dec *Decoder) nextChar() byte { - for ; dec.cursor < dec.length || dec.read(); dec.cursor++ { - switch dec.data[dec.cursor] { - case ' ', '\n', '\t', '\r', ',': - continue - } - d := dec.data[dec.cursor] - return d - } - return 0 -} diff --git a/vendor/github.com/francoispqt/gojay/decode_array.go b/vendor/github.com/francoispqt/gojay/decode_array.go deleted file mode 100644 index 297f2ee744..0000000000 --- a/vendor/github.com/francoispqt/gojay/decode_array.go +++ /dev/null @@ -1,247 +0,0 @@ -package gojay - -import "reflect" - -// DecodeArray reads the next JSON-encoded value from the decoder's input (io.Reader) -// and stores it in the value pointed to by v. -// -// v must implement UnmarshalerJSONArray. -// -// See the documentation for Unmarshal for details about the conversion of JSON into a Go value. -func (dec *Decoder) DecodeArray(v UnmarshalerJSONArray) error { - if dec.isPooled == 1 { - panic(InvalidUsagePooledDecoderError("Invalid usage of pooled decoder")) - } - _, err := dec.decodeArray(v) - return err -} -func (dec *Decoder) decodeArray(arr UnmarshalerJSONArray) (int, error) { - // remember last array index in case of nested arrays - lastArrayIndex := dec.arrayIndex - dec.arrayIndex = 0 - defer func() { - dec.arrayIndex = lastArrayIndex - }() - for ; dec.cursor < dec.length || dec.read(); dec.cursor++ { - switch dec.data[dec.cursor] { - case ' ', '\n', '\t', '\r', ',': - continue - case '[': - dec.cursor = dec.cursor + 1 - // array is open, char is not space start readings - for dec.nextChar() != 0 { - // closing array - if dec.data[dec.cursor] == ']' { - dec.cursor = dec.cursor + 1 - return dec.cursor, nil - } - // calling unmarshall function for each element of the slice - err := arr.UnmarshalJSONArray(dec) - if err != nil { - return 0, err - } - dec.arrayIndex++ - } - return 0, dec.raiseInvalidJSONErr(dec.cursor) - case 'n': - // is null - dec.cursor++ - err := dec.assertNull() - if err != nil { - return 0, err - } - return dec.cursor, nil - case '{', '"', 'f', 't', '0', '1', '2', '3', '4', '5', '6', '7', '8', '9': - // can't unmarshall to struct - // we skip array and set Error - dec.err = dec.makeInvalidUnmarshalErr(arr) - err := dec.skipData() - if err != nil { - return 0, err - } - return dec.cursor, nil - default: - return 0, dec.raiseInvalidJSONErr(dec.cursor) - } - } - return 0, dec.raiseInvalidJSONErr(dec.cursor) -} -func (dec *Decoder) decodeArrayNull(v interface{}) (int, error) { - // remember last array index in case of nested arrays - lastArrayIndex := dec.arrayIndex - dec.arrayIndex = 0 - defer func() { - dec.arrayIndex = lastArrayIndex - }() - vv := reflect.ValueOf(v) - vvt := vv.Type() - if vvt.Kind() != reflect.Ptr || vvt.Elem().Kind() != reflect.Ptr { - dec.err = ErrUnmarshalPtrExpected - return 0, dec.err - } - // not an array not an error, but do not know what to do - // do not check syntax - for ; dec.cursor < dec.length || dec.read(); dec.cursor++ { - switch dec.data[dec.cursor] { - case ' ', '\n', '\t', '\r', ',': - continue - case '[': - dec.cursor = dec.cursor + 1 - // create our new type - elt := vv.Elem() - n := reflect.New(elt.Type().Elem()) - var arr UnmarshalerJSONArray - var ok bool - if arr, ok = n.Interface().(UnmarshalerJSONArray); !ok { - dec.err = dec.makeInvalidUnmarshalErr((UnmarshalerJSONArray)(nil)) - return 0, dec.err - } - // array is open, char is not space start readings - for dec.nextChar() != 0 { - // closing array - if dec.data[dec.cursor] == ']' { - elt.Set(n) - dec.cursor = dec.cursor + 1 - return dec.cursor, nil - } - // calling unmarshall function for each element of the slice - err := arr.UnmarshalJSONArray(dec) - if err != nil { - return 0, err - } - dec.arrayIndex++ - } - return 0, dec.raiseInvalidJSONErr(dec.cursor) - case 'n': - // is null - dec.cursor++ - err := dec.assertNull() - if err != nil { - return 0, err - } - return dec.cursor, nil - case '{', '"', 'f', 't', '0', '1', '2', '3', '4', '5', '6', '7', '8', '9': - // can't unmarshall to struct - // we skip array and set Error - dec.err = dec.makeInvalidUnmarshalErr((UnmarshalerJSONArray)(nil)) - err := dec.skipData() - if err != nil { - return 0, err - } - return dec.cursor, nil - default: - return 0, dec.raiseInvalidJSONErr(dec.cursor) - } - } - return 0, dec.raiseInvalidJSONErr(dec.cursor) -} - -func (dec *Decoder) skipArray() (int, error) { - var arraysOpen = 1 - var arraysClosed = 0 - // var stringOpen byte = 0 - for j := dec.cursor; j < dec.length || dec.read(); j++ { - switch dec.data[j] { - case ']': - arraysClosed++ - // everything is closed return - if arraysOpen == arraysClosed { - // add char to object data - return j + 1, nil - } - case '[': - arraysOpen++ - case '"': - j++ - var isInEscapeSeq bool - var isFirstQuote = true - for ; j < dec.length || dec.read(); j++ { - if dec.data[j] != '"' { - continue - } - if dec.data[j-1] != '\\' || (!isInEscapeSeq && !isFirstQuote) { - break - } else { - isInEscapeSeq = false - } - if isFirstQuote { - isFirstQuote = false - } - // loop backward and count how many anti slash found - // to see if string is effectively escaped - ct := 0 - for i := j - 1; i > 0; i-- { - if dec.data[i] != '\\' { - break - } - ct++ - } - // is pair number of slashes, quote is not escaped - if ct&1 == 0 { - break - } - isInEscapeSeq = true - } - default: - continue - } - } - return 0, dec.raiseInvalidJSONErr(dec.cursor) -} - -// DecodeArrayFunc is a func type implementing UnmarshalerJSONArray. -// Use it to cast a `func(*Decoder) error` to Unmarshal an array on the fly. - -type DecodeArrayFunc func(*Decoder) error - -// UnmarshalJSONArray implements UnmarshalerJSONArray. -func (f DecodeArrayFunc) UnmarshalJSONArray(dec *Decoder) error { - return f(dec) -} - -// IsNil implements UnmarshalerJSONArray. -func (f DecodeArrayFunc) IsNil() bool { - return f == nil -} - -// Add Values functions - -// AddArray decodes the JSON value within an object or an array to a UnmarshalerJSONArray. -func (dec *Decoder) AddArray(v UnmarshalerJSONArray) error { - return dec.Array(v) -} - -// AddArrayNull decodes the JSON value within an object or an array to a UnmarshalerJSONArray. -func (dec *Decoder) AddArrayNull(v interface{}) error { - return dec.ArrayNull(v) -} - -// Array decodes the JSON value within an object or an array to a UnmarshalerJSONArray. -func (dec *Decoder) Array(v UnmarshalerJSONArray) error { - newCursor, err := dec.decodeArray(v) - if err != nil { - return err - } - dec.cursor = newCursor - dec.called |= 1 - return nil -} - -// ArrayNull decodes the JSON value within an object or an array to a UnmarshalerJSONArray. -// v should be a pointer to an UnmarshalerJSONArray, -// if `null` value is encountered in JSON, it will leave the value v untouched, -// else it will create a new instance of the UnmarshalerJSONArray behind v. -func (dec *Decoder) ArrayNull(v interface{}) error { - newCursor, err := dec.decodeArrayNull(v) - if err != nil { - return err - } - dec.cursor = newCursor - dec.called |= 1 - return nil -} - -// Index returns the index of an array being decoded. -func (dec *Decoder) Index() int { - return dec.arrayIndex -} diff --git a/vendor/github.com/francoispqt/gojay/decode_bool.go b/vendor/github.com/francoispqt/gojay/decode_bool.go deleted file mode 100644 index 1dc304ba77..0000000000 --- a/vendor/github.com/francoispqt/gojay/decode_bool.go +++ /dev/null @@ -1,241 +0,0 @@ -package gojay - -// DecodeBool reads the next JSON-encoded value from the decoder's input (io.Reader) -// and stores it in the boolean pointed to by v. -// -// See the documentation for Unmarshal for details about the conversion of JSON into a Go value. -func (dec *Decoder) DecodeBool(v *bool) error { - if dec.isPooled == 1 { - panic(InvalidUsagePooledDecoderError("Invalid usage of pooled decoder")) - } - return dec.decodeBool(v) -} -func (dec *Decoder) decodeBool(v *bool) error { - for ; dec.cursor < dec.length || dec.read(); dec.cursor++ { - switch dec.data[dec.cursor] { - case ' ', '\n', '\t', '\r', ',': - continue - case 't': - dec.cursor++ - err := dec.assertTrue() - if err != nil { - return err - } - *v = true - return nil - case 'f': - dec.cursor++ - err := dec.assertFalse() - if err != nil { - return err - } - *v = false - return nil - case 'n': - dec.cursor++ - err := dec.assertNull() - if err != nil { - return err - } - *v = false - return nil - default: - dec.err = dec.makeInvalidUnmarshalErr(v) - err := dec.skipData() - if err != nil { - return err - } - return nil - } - } - return nil -} -func (dec *Decoder) decodeBoolNull(v **bool) error { - for ; dec.cursor < dec.length || dec.read(); dec.cursor++ { - switch dec.data[dec.cursor] { - case ' ', '\n', '\t', '\r', ',': - continue - case 't': - dec.cursor++ - err := dec.assertTrue() - if err != nil { - return err - } - if *v == nil { - *v = new(bool) - } - **v = true - return nil - case 'f': - dec.cursor++ - err := dec.assertFalse() - if err != nil { - return err - } - if *v == nil { - *v = new(bool) - } - **v = false - return nil - case 'n': - dec.cursor++ - err := dec.assertNull() - if err != nil { - return err - } - return nil - default: - dec.err = dec.makeInvalidUnmarshalErr(v) - err := dec.skipData() - if err != nil { - return err - } - return nil - } - } - return nil -} - -func (dec *Decoder) assertTrue() error { - i := 0 - for ; dec.cursor < dec.length || dec.read(); dec.cursor++ { - switch i { - case 0: - if dec.data[dec.cursor] != 'r' { - return dec.raiseInvalidJSONErr(dec.cursor) - } - case 1: - if dec.data[dec.cursor] != 'u' { - return dec.raiseInvalidJSONErr(dec.cursor) - } - case 2: - if dec.data[dec.cursor] != 'e' { - return dec.raiseInvalidJSONErr(dec.cursor) - } - case 3: - switch dec.data[dec.cursor] { - case ' ', '\b', '\t', '\n', ',', ']', '}': - // dec.cursor-- - return nil - default: - return dec.raiseInvalidJSONErr(dec.cursor) - } - } - i++ - } - if i == 3 { - return nil - } - return dec.raiseInvalidJSONErr(dec.cursor) -} - -func (dec *Decoder) assertNull() error { - i := 0 - for ; dec.cursor < dec.length || dec.read(); dec.cursor++ { - switch i { - case 0: - if dec.data[dec.cursor] != 'u' { - return dec.raiseInvalidJSONErr(dec.cursor) - } - case 1: - if dec.data[dec.cursor] != 'l' { - return dec.raiseInvalidJSONErr(dec.cursor) - } - case 2: - if dec.data[dec.cursor] != 'l' { - return dec.raiseInvalidJSONErr(dec.cursor) - } - case 3: - switch dec.data[dec.cursor] { - case ' ', '\t', '\n', ',', ']', '}': - // dec.cursor-- - return nil - default: - return dec.raiseInvalidJSONErr(dec.cursor) - } - } - i++ - } - if i == 3 { - return nil - } - return dec.raiseInvalidJSONErr(dec.cursor) -} - -func (dec *Decoder) assertFalse() error { - i := 0 - for ; dec.cursor < dec.length || dec.read(); dec.cursor++ { - switch i { - case 0: - if dec.data[dec.cursor] != 'a' { - return dec.raiseInvalidJSONErr(dec.cursor) - } - case 1: - if dec.data[dec.cursor] != 'l' { - return dec.raiseInvalidJSONErr(dec.cursor) - } - case 2: - if dec.data[dec.cursor] != 's' { - return dec.raiseInvalidJSONErr(dec.cursor) - } - case 3: - if dec.data[dec.cursor] != 'e' { - return dec.raiseInvalidJSONErr(dec.cursor) - } - case 4: - switch dec.data[dec.cursor] { - case ' ', '\t', '\n', ',', ']', '}': - // dec.cursor-- - return nil - default: - return dec.raiseInvalidJSONErr(dec.cursor) - } - } - i++ - } - if i == 4 { - return nil - } - return dec.raiseInvalidJSONErr(dec.cursor) -} - -// Add Values functions - -// AddBool decodes the JSON value within an object or an array to a *bool. -// If next key is neither null nor a JSON boolean, an InvalidUnmarshalError will be returned. -// If next key is null, bool will be false. -func (dec *Decoder) AddBool(v *bool) error { - return dec.Bool(v) -} - -// AddBoolNull decodes the JSON value within an object or an array to a *bool. -// If next key is neither null nor a JSON boolean, an InvalidUnmarshalError will be returned. -// If next key is null, bool will be false. -// If a `null` is encountered, gojay does not change the value of the pointer. -func (dec *Decoder) AddBoolNull(v **bool) error { - return dec.BoolNull(v) -} - -// Bool decodes the JSON value within an object or an array to a *bool. -// If next key is neither null nor a JSON boolean, an InvalidUnmarshalError will be returned. -// If next key is null, bool will be false. -func (dec *Decoder) Bool(v *bool) error { - err := dec.decodeBool(v) - if err != nil { - return err - } - dec.called |= 1 - return nil -} - -// BoolNull decodes the JSON value within an object or an array to a *bool. -// If next key is neither null nor a JSON boolean, an InvalidUnmarshalError will be returned. -// If next key is null, bool will be false. -func (dec *Decoder) BoolNull(v **bool) error { - err := dec.decodeBoolNull(v) - if err != nil { - return err - } - dec.called |= 1 - return nil -} diff --git a/vendor/github.com/francoispqt/gojay/decode_embedded_json.go b/vendor/github.com/francoispqt/gojay/decode_embedded_json.go deleted file mode 100644 index 67fcc2eaed..0000000000 --- a/vendor/github.com/francoispqt/gojay/decode_embedded_json.go +++ /dev/null @@ -1,85 +0,0 @@ -package gojay - -// EmbeddedJSON is a raw encoded JSON value. -// It can be used to delay JSON decoding or precompute a JSON encoding. -type EmbeddedJSON []byte - -func (dec *Decoder) decodeEmbeddedJSON(ej *EmbeddedJSON) error { - var err error - if ej == nil { - return InvalidUnmarshalError("Invalid nil pointer given") - } - var beginOfEmbeddedJSON int - for ; dec.cursor < dec.length || dec.read(); dec.cursor++ { - switch dec.data[dec.cursor] { - case ' ', '\n', '\t', '\r', ',': - continue - // is null - case 'n': - beginOfEmbeddedJSON = dec.cursor - dec.cursor++ - err := dec.assertNull() - if err != nil { - return err - } - case 't': - beginOfEmbeddedJSON = dec.cursor - dec.cursor++ - err := dec.assertTrue() - if err != nil { - return err - } - // is false - case 'f': - beginOfEmbeddedJSON = dec.cursor - dec.cursor++ - err := dec.assertFalse() - if err != nil { - return err - } - // is an object - case '{': - beginOfEmbeddedJSON = dec.cursor - dec.cursor = dec.cursor + 1 - dec.cursor, err = dec.skipObject() - // is string - case '"': - beginOfEmbeddedJSON = dec.cursor - dec.cursor = dec.cursor + 1 - err = dec.skipString() // why no new dec.cursor in result? - // is array - case '[': - beginOfEmbeddedJSON = dec.cursor - dec.cursor = dec.cursor + 1 - dec.cursor, err = dec.skipArray() - case '0', '1', '2', '3', '4', '5', '6', '7', '8', '9', '-': - beginOfEmbeddedJSON = dec.cursor - dec.cursor, err = dec.skipNumber() - } - break - } - if err == nil { - if dec.cursor-1 >= beginOfEmbeddedJSON { - *ej = append(*ej, dec.data[beginOfEmbeddedJSON:dec.cursor]...) - } - dec.called |= 1 - } - return err -} - -// AddEmbeddedJSON adds an EmbeddedsJSON to the value pointed by v. -// It can be used to delay JSON decoding or precompute a JSON encoding. -func (dec *Decoder) AddEmbeddedJSON(v *EmbeddedJSON) error { - return dec.EmbeddedJSON(v) -} - -// EmbeddedJSON adds an EmbeddedsJSON to the value pointed by v. -// It can be used to delay JSON decoding or precompute a JSON encoding. -func (dec *Decoder) EmbeddedJSON(v *EmbeddedJSON) error { - err := dec.decodeEmbeddedJSON(v) - if err != nil { - return err - } - dec.called |= 1 - return nil -} diff --git a/vendor/github.com/francoispqt/gojay/decode_interface.go b/vendor/github.com/francoispqt/gojay/decode_interface.go deleted file mode 100644 index 015790d854..0000000000 --- a/vendor/github.com/francoispqt/gojay/decode_interface.go +++ /dev/null @@ -1,130 +0,0 @@ -package gojay - -// TODO @afiune for now we are using the standard json unmarshaling but in -// the future it would be great to implement one here inside this repo -import "encoding/json" - -// DecodeInterface reads the next JSON-encoded value from the decoder's input (io.Reader) and stores it in the value pointed to by i. -// -// i must be an interface poiter -func (dec *Decoder) DecodeInterface(i *interface{}) error { - if dec.isPooled == 1 { - panic(InvalidUsagePooledDecoderError("Invalid usage of pooled decoder")) - } - err := dec.decodeInterface(i) - return err -} - -func (dec *Decoder) decodeInterface(i *interface{}) error { - start, end, err := dec.getObject() - if err != nil { - dec.cursor = start - return err - } - - // if start & end are equal the object is a null, don't unmarshal - if start == end { - return nil - } - - object := dec.data[start:end] - if err = json.Unmarshal(object, i); err != nil { - return err - } - - dec.cursor = end - return nil -} - -// @afiune Maybe return the type as well? -func (dec *Decoder) getObject() (start int, end int, err error) { - // start cursor - for ; dec.cursor < dec.length || dec.read(); dec.cursor++ { - switch dec.data[dec.cursor] { - case ' ', '\n', '\t', '\r', ',': - continue - // is null - case 'n': - dec.cursor++ - err = dec.assertNull() - if err != nil { - return - } - // Set start & end to the same cursor to indicate the object - // is a null and should not be unmarshal - start = dec.cursor - end = dec.cursor - return - case 't': - start = dec.cursor - dec.cursor++ - err = dec.assertTrue() - if err != nil { - return - } - end = dec.cursor - dec.cursor++ - return - // is false - case 'f': - start = dec.cursor - dec.cursor++ - err = dec.assertFalse() - if err != nil { - return - } - end = dec.cursor - dec.cursor++ - return - // is an object - case '{': - start = dec.cursor - dec.cursor++ - end, err = dec.skipObject() - dec.cursor = end - return - // is string - case '"': - start = dec.cursor - dec.cursor++ - start, end, err = dec.getString() - start-- - dec.cursor = end - return - // is array - case '[': - start = dec.cursor - dec.cursor++ - end, err = dec.skipArray() - dec.cursor = end - return - case '0', '1', '2', '3', '4', '5', '6', '7', '8', '9', '-': - start = dec.cursor - end, err = dec.skipNumber() - dec.cursor = end - return - default: - err = dec.raiseInvalidJSONErr(dec.cursor) - return - } - } - err = dec.raiseInvalidJSONErr(dec.cursor) - return -} - -// Add Values functions - -// AddInterface decodes the JSON value within an object or an array to a interface{}. -func (dec *Decoder) AddInterface(v *interface{}) error { - return dec.Interface(v) -} - -// Interface decodes the JSON value within an object or an array to an interface{}. -func (dec *Decoder) Interface(value *interface{}) error { - err := dec.decodeInterface(value) - if err != nil { - return err - } - dec.called |= 1 - return nil -} diff --git a/vendor/github.com/francoispqt/gojay/decode_number.go b/vendor/github.com/francoispqt/gojay/decode_number.go deleted file mode 100644 index 0042b471e2..0000000000 --- a/vendor/github.com/francoispqt/gojay/decode_number.go +++ /dev/null @@ -1,118 +0,0 @@ -package gojay - -import ( - "math" -) - -var digits []int8 - -const maxInt64toMultiply = math.MaxInt64 / 10 -const maxInt32toMultiply = math.MaxInt32 / 10 -const maxInt16toMultiply = math.MaxInt16 / 10 -const maxInt8toMultiply = math.MaxInt8 / 10 -const maxUint8toMultiply = math.MaxUint8 / 10 -const maxUint16toMultiply = math.MaxUint16 / 10 -const maxUint32toMultiply = math.MaxUint32 / 10 -const maxUint64toMultiply = math.MaxUint64 / 10 -const maxUint32Length = 10 -const maxUint64Length = 20 -const maxUint16Length = 5 -const maxUint8Length = 3 -const maxInt32Length = 10 -const maxInt64Length = 19 -const maxInt16Length = 5 -const maxInt8Length = 3 -const invalidNumber = int8(-1) - -var pow10uint64 = [21]uint64{ - 0, - 1, - 10, - 100, - 1000, - 10000, - 100000, - 1000000, - 10000000, - 100000000, - 1000000000, - 10000000000, - 100000000000, - 1000000000000, - 10000000000000, - 100000000000000, - 1000000000000000, - 10000000000000000, - 100000000000000000, - 1000000000000000000, - 10000000000000000000, -} - -var skipNumberEndCursorIncrement [256]int - -func init() { - digits = make([]int8, 256) - for i := 0; i < len(digits); i++ { - digits[i] = invalidNumber - } - for i := int8('0'); i <= int8('9'); i++ { - digits[i] = i - int8('0') - } - - for i := 0; i < 256; i++ { - switch i { - case '0', '1', '2', '3', '4', '5', '6', '7', '8', '9', '.', 'e', 'E', '+', '-': - skipNumberEndCursorIncrement[i] = 1 - } - } -} - -func (dec *Decoder) skipNumber() (int, error) { - end := dec.cursor + 1 - // look for following numbers - for j := dec.cursor + 1; j < dec.length || dec.read(); j++ { - end += skipNumberEndCursorIncrement[dec.data[j]] - - switch dec.data[j] { - case '0', '1', '2', '3', '4', '5', '6', '7', '8', '9', '.', 'e', 'E', '+', '-', ' ', '\n', '\t', '\r': - continue - case ',', '}', ']': - return end, nil - default: - // invalid json we expect numbers, dot (single one), comma, or spaces - return end, dec.raiseInvalidJSONErr(dec.cursor) - } - } - - return end, nil -} - -func (dec *Decoder) getExponent() (int64, error) { - start := dec.cursor - end := dec.cursor - for ; dec.cursor < dec.length || dec.read(); dec.cursor++ { - switch dec.data[dec.cursor] { // is positive - case '0', '1', '2', '3', '4', '5', '6', '7', '8', '9': - end = dec.cursor + 1 - case '-': - dec.cursor++ - exp, err := dec.getExponent() - return -exp, err - case '+': - dec.cursor++ - return dec.getExponent() - default: - // if nothing return 0 - // could raise error - if start == end { - return 0, dec.raiseInvalidJSONErr(dec.cursor) - } - return dec.atoi64(start, end-1), nil - } - } - if start == end { - - return 0, dec.raiseInvalidJSONErr(dec.cursor) - } - return dec.atoi64(start, end-1), nil -} diff --git a/vendor/github.com/francoispqt/gojay/decode_number_float.go b/vendor/github.com/francoispqt/gojay/decode_number_float.go deleted file mode 100644 index f76c5861e5..0000000000 --- a/vendor/github.com/francoispqt/gojay/decode_number_float.go +++ /dev/null @@ -1,516 +0,0 @@ -package gojay - -// DecodeFloat64 reads the next JSON-encoded value from the decoder's input (io.Reader) and stores it in the float64 pointed to by v. -// -// See the documentation for Unmarshal for details about the conversion of JSON into a Go value. -func (dec *Decoder) DecodeFloat64(v *float64) error { - if dec.isPooled == 1 { - panic(InvalidUsagePooledDecoderError("Invalid usage of pooled decoder")) - } - return dec.decodeFloat64(v) -} -func (dec *Decoder) decodeFloat64(v *float64) error { - for ; dec.cursor < dec.length || dec.read(); dec.cursor++ { - switch c := dec.data[dec.cursor]; c { - case ' ', '\n', '\t', '\r', ',': - continue - case '0', '1', '2', '3', '4', '5', '6', '7', '8', '9': - val, err := dec.getFloat() - if err != nil { - return err - } - *v = val - return nil - case '-': - dec.cursor = dec.cursor + 1 - val, err := dec.getFloatNegative() - if err != nil { - return err - } - *v = -val - return nil - case 'n': - dec.cursor++ - err := dec.assertNull() - if err != nil { - return err - } - return nil - default: - dec.err = dec.makeInvalidUnmarshalErr(v) - err := dec.skipData() - if err != nil { - return err - } - return nil - } - } - return dec.raiseInvalidJSONErr(dec.cursor) -} -func (dec *Decoder) decodeFloat64Null(v **float64) error { - for ; dec.cursor < dec.length || dec.read(); dec.cursor++ { - switch c := dec.data[dec.cursor]; c { - case ' ', '\n', '\t', '\r', ',': - continue - case '0', '1', '2', '3', '4', '5', '6', '7', '8', '9': - val, err := dec.getFloat() - if err != nil { - return err - } - if *v == nil { - *v = new(float64) - } - **v = val - return nil - case '-': - dec.cursor = dec.cursor + 1 - val, err := dec.getFloatNegative() - if err != nil { - return err - } - if *v == nil { - *v = new(float64) - } - **v = -val - return nil - case 'n': - dec.cursor++ - err := dec.assertNull() - if err != nil { - return err - } - return nil - default: - dec.err = dec.makeInvalidUnmarshalErr(v) - err := dec.skipData() - if err != nil { - return err - } - return nil - } - } - return dec.raiseInvalidJSONErr(dec.cursor) -} - -func (dec *Decoder) getFloatNegative() (float64, error) { - // look for following numbers - for ; dec.cursor < dec.length || dec.read(); dec.cursor++ { - switch dec.data[dec.cursor] { - case '0', '1', '2', '3', '4', '5', '6', '7', '8', '9': - return dec.getFloat() - default: - return 0, dec.raiseInvalidJSONErr(dec.cursor) - } - } - return 0, dec.raiseInvalidJSONErr(dec.cursor) -} - -func (dec *Decoder) getFloat() (float64, error) { - var end = dec.cursor - var start = dec.cursor - // look for following numbers - for j := dec.cursor + 1; j < dec.length || dec.read(); j++ { - switch dec.data[j] { - case '0', '1', '2', '3', '4', '5', '6', '7', '8', '9': - end = j - continue - case '.': - // we get part before decimal as integer - beforeDecimal := dec.atoi64(start, end) - // then we get part after decimal as integer - start = j + 1 - // get number after the decimal point - for i := j + 1; i < dec.length || dec.read(); i++ { - c := dec.data[i] - if isDigit(c) { - end = i - // multiply the before decimal point portion by 10 using bitwise - // make sure it doesn't overflow - if end-start < 18 { - beforeDecimal = (beforeDecimal << 3) + (beforeDecimal << 1) - } - continue - } else if (c == 'e' || c == 'E') && j < i-1 { - // we have an exponent, convert first the value we got before the exponent - var afterDecimal int64 - expI := end - start + 2 - // if exp is too long, it means number is too long, just truncate the number - if expI >= len(pow10uint64) || expI < 0 { - expI = len(pow10uint64) - 2 - afterDecimal = dec.atoi64(start, start+expI-2) - } else { - // then we add both integers - // then we divide the number by the power found - afterDecimal = dec.atoi64(start, end) - } - dec.cursor = i + 1 - pow := pow10uint64[expI] - floatVal := float64(beforeDecimal+afterDecimal) / float64(pow) - exp, err := dec.getExponent() - if err != nil { - return 0, err - } - pExp := (exp + (exp >> 31)) ^ (exp >> 31) + 1 // absolute exponent - if pExp >= int64(len(pow10uint64)) || pExp < 0 { - return 0, dec.raiseInvalidJSONErr(dec.cursor) - } - // if exponent is negative - if exp < 0 { - return float64(floatVal) * (1 / float64(pow10uint64[pExp])), nil - } - return float64(floatVal) * float64(pow10uint64[pExp]), nil - } - dec.cursor = i - break - } - if end >= dec.length || end < start { - return 0, dec.raiseInvalidJSONErr(dec.cursor) - } - var afterDecimal int64 - expI := end - start + 2 - // if exp is too long, it means number is too long, just truncate the number - if expI >= len(pow10uint64) || expI < 0 { - expI = 19 - afterDecimal = dec.atoi64(start, start+expI-2) - } else { - afterDecimal = dec.atoi64(start, end) - } - - pow := pow10uint64[expI] - // then we add both integers - // then we divide the number by the power found - return float64(beforeDecimal+afterDecimal) / float64(pow), nil - case 'e', 'E': - dec.cursor = j + 1 - // we get part before decimal as integer - beforeDecimal := uint64(dec.atoi64(start, end)) - // get exponent - exp, err := dec.getExponent() - if err != nil { - return 0, err - } - pExp := (exp + (exp >> 31)) ^ (exp >> 31) + 1 // abs - if pExp >= int64(len(pow10uint64)) || pExp < 0 { - return 0, dec.raiseInvalidJSONErr(dec.cursor) - } - // if exponent is negative - if exp < 0 { - return float64(beforeDecimal) * (1 / float64(pow10uint64[pExp])), nil - } - return float64(beforeDecimal) * float64(pow10uint64[pExp]), nil - case ' ', '\n', '\t', '\r', ',', '}', ']': // does not have decimal - dec.cursor = j - return float64(dec.atoi64(start, end)), nil - } - // invalid json we expect numbers, dot (single one), comma, or spaces - return 0, dec.raiseInvalidJSONErr(dec.cursor) - } - return float64(dec.atoi64(start, end)), nil -} - -// DecodeFloat32 reads the next JSON-encoded value from the decoder's input (io.Reader) and stores it in the float32 pointed to by v. -// -// See the documentation for Unmarshal for details about the conversion of JSON into a Go value. -func (dec *Decoder) DecodeFloat32(v *float32) error { - if dec.isPooled == 1 { - panic(InvalidUsagePooledDecoderError("Invalid usage of pooled decoder")) - } - return dec.decodeFloat32(v) -} -func (dec *Decoder) decodeFloat32(v *float32) error { - for ; dec.cursor < dec.length || dec.read(); dec.cursor++ { - switch c := dec.data[dec.cursor]; c { - case ' ', '\n', '\t', '\r', ',': - continue - case '0', '1', '2', '3', '4', '5', '6', '7', '8', '9': - val, err := dec.getFloat32() - if err != nil { - return err - } - *v = val - return nil - case '-': - dec.cursor = dec.cursor + 1 - val, err := dec.getFloat32Negative() - if err != nil { - return err - } - *v = -val - return nil - case 'n': - dec.cursor++ - err := dec.assertNull() - if err != nil { - return err - } - return nil - default: - dec.err = dec.makeInvalidUnmarshalErr(v) - err := dec.skipData() - if err != nil { - return err - } - return nil - } - } - return dec.raiseInvalidJSONErr(dec.cursor) -} -func (dec *Decoder) decodeFloat32Null(v **float32) error { - for ; dec.cursor < dec.length || dec.read(); dec.cursor++ { - switch c := dec.data[dec.cursor]; c { - case ' ', '\n', '\t', '\r', ',': - continue - case '0', '1', '2', '3', '4', '5', '6', '7', '8', '9': - val, err := dec.getFloat32() - if err != nil { - return err - } - if *v == nil { - *v = new(float32) - } - **v = val - return nil - case '-': - dec.cursor = dec.cursor + 1 - val, err := dec.getFloat32Negative() - if err != nil { - return err - } - if *v == nil { - *v = new(float32) - } - **v = -val - return nil - case 'n': - dec.cursor++ - err := dec.assertNull() - if err != nil { - return err - } - return nil - default: - dec.err = dec.makeInvalidUnmarshalErr(v) - err := dec.skipData() - if err != nil { - return err - } - return nil - } - } - return dec.raiseInvalidJSONErr(dec.cursor) -} - -func (dec *Decoder) getFloat32Negative() (float32, error) { - // look for following numbers - for ; dec.cursor < dec.length || dec.read(); dec.cursor++ { - switch dec.data[dec.cursor] { - case '0', '1', '2', '3', '4', '5', '6', '7', '8', '9': - return dec.getFloat32() - default: - return 0, dec.raiseInvalidJSONErr(dec.cursor) - } - } - return 0, dec.raiseInvalidJSONErr(dec.cursor) -} - -func (dec *Decoder) getFloat32() (float32, error) { - var end = dec.cursor - var start = dec.cursor - // look for following numbers - for j := dec.cursor + 1; j < dec.length || dec.read(); j++ { - switch dec.data[j] { - case '0', '1', '2', '3', '4', '5', '6', '7', '8', '9': - end = j - continue - case '.': - // we get part before decimal as integer - beforeDecimal := dec.atoi64(start, end) - // then we get part after decimal as integer - start = j + 1 - // get number after the decimal point - // multiple the before decimal point portion by 10 using bitwise - for i := j + 1; i < dec.length || dec.read(); i++ { - c := dec.data[i] - if isDigit(c) { - end = i - // multiply the before decimal point portion by 10 using bitwise - // make sure it desn't overflow - if end-start < 9 { - beforeDecimal = (beforeDecimal << 3) + (beforeDecimal << 1) - } - continue - } else if (c == 'e' || c == 'E') && j < i-1 { - // we get the number before decimal - var afterDecimal int64 - expI := end - start + 2 - // if exp is too long, it means number is too long, just truncate the number - if expI >= 12 || expI < 0 { - expI = 10 - afterDecimal = dec.atoi64(start, start+expI-2) - } else { - afterDecimal = dec.atoi64(start, end) - } - dec.cursor = i + 1 - pow := pow10uint64[expI] - // then we add both integers - // then we divide the number by the power found - floatVal := float32(beforeDecimal+afterDecimal) / float32(pow) - exp, err := dec.getExponent() - if err != nil { - return 0, err - } - pExp := (exp + (exp >> 31)) ^ (exp >> 31) + 1 // abs - if pExp >= int64(len(pow10uint64)) || pExp < 0 { - return 0, dec.raiseInvalidJSONErr(dec.cursor) - } - // if exponent is negative - if exp < 0 { - return float32(floatVal) * (1 / float32(pow10uint64[pExp])), nil - } - return float32(floatVal) * float32(pow10uint64[pExp]), nil - } - dec.cursor = i - break - } - if end >= dec.length || end < start { - return 0, dec.raiseInvalidJSONErr(dec.cursor) - } - // then we add both integers - // then we divide the number by the power found - var afterDecimal int64 - expI := end - start + 2 - // if exp is too long, it means number is too long, just truncate the number - if expI >= 12 || expI < 0 { - expI = 10 - afterDecimal = dec.atoi64(start, start+expI-2) - } else { - // then we add both integers - // then we divide the number by the power found - afterDecimal = dec.atoi64(start, end) - } - pow := pow10uint64[expI] - return float32(beforeDecimal+afterDecimal) / float32(pow), nil - case 'e', 'E': - dec.cursor = j + 1 - // we get part before decimal as integer - beforeDecimal := dec.atoi64(start, end) - // get exponent - exp, err := dec.getExponent() - if err != nil { - return 0, err - } - pExp := (exp + (exp >> 31)) ^ (exp >> 31) + 1 - if pExp >= int64(len(pow10uint64)) || pExp < 0 { - return 0, dec.raiseInvalidJSONErr(dec.cursor) - } - // if exponent is negative - if exp < 0 { - return float32(beforeDecimal) * (1 / float32(pow10uint64[pExp])), nil - } - return float32(beforeDecimal) * float32(pow10uint64[pExp]), nil - case ' ', '\n', '\t', '\r', ',', '}', ']': // does not have decimal - dec.cursor = j - return float32(dec.atoi64(start, end)), nil - } - // invalid json we expect numbers, dot (single one), comma, or spaces - return 0, dec.raiseInvalidJSONErr(dec.cursor) - } - return float32(dec.atoi64(start, end)), nil -} - -// Add Values functions - -// AddFloat decodes the JSON value within an object or an array to a *float64. -// If next key value overflows float64, an InvalidUnmarshalError error will be returned. -func (dec *Decoder) AddFloat(v *float64) error { - return dec.Float64(v) -} - -// AddFloatNull decodes the JSON value within an object or an array to a *float64. -// If next key value overflows float64, an InvalidUnmarshalError error will be returned. -// If a `null` is encountered, gojay does not change the value of the pointer. -func (dec *Decoder) AddFloatNull(v **float64) error { - return dec.Float64Null(v) -} - -// AddFloat64 decodes the JSON value within an object or an array to a *float64. -// If next key value overflows float64, an InvalidUnmarshalError error will be returned. -func (dec *Decoder) AddFloat64(v *float64) error { - return dec.Float64(v) -} - -// AddFloat64Null decodes the JSON value within an object or an array to a *float64. -// If next key value overflows float64, an InvalidUnmarshalError error will be returned. -// If a `null` is encountered, gojay does not change the value of the pointer. -func (dec *Decoder) AddFloat64Null(v **float64) error { - return dec.Float64Null(v) -} - -// AddFloat32 decodes the JSON value within an object or an array to a *float64. -// If next key value overflows float64, an InvalidUnmarshalError error will be returned. -func (dec *Decoder) AddFloat32(v *float32) error { - return dec.Float32(v) -} - -// AddFloat32Null decodes the JSON value within an object or an array to a *float64. -// If next key value overflows float64, an InvalidUnmarshalError error will be returned. -// If a `null` is encountered, gojay does not change the value of the pointer. -func (dec *Decoder) AddFloat32Null(v **float32) error { - return dec.Float32Null(v) -} - -// Float decodes the JSON value within an object or an array to a *float64. -// If next key value overflows float64, an InvalidUnmarshalError error will be returned. -func (dec *Decoder) Float(v *float64) error { - return dec.Float64(v) -} - -// FloatNull decodes the JSON value within an object or an array to a *float64. -// If next key value overflows float64, an InvalidUnmarshalError error will be returned. -func (dec *Decoder) FloatNull(v **float64) error { - return dec.Float64Null(v) -} - -// Float64 decodes the JSON value within an object or an array to a *float64. -// If next key value overflows float64, an InvalidUnmarshalError error will be returned. -func (dec *Decoder) Float64(v *float64) error { - err := dec.decodeFloat64(v) - if err != nil { - return err - } - dec.called |= 1 - return nil -} - -// Float64Null decodes the JSON value within an object or an array to a *float64. -// If next key value overflows float64, an InvalidUnmarshalError error will be returned. -func (dec *Decoder) Float64Null(v **float64) error { - err := dec.decodeFloat64Null(v) - if err != nil { - return err - } - dec.called |= 1 - return nil -} - -// Float32 decodes the JSON value within an object or an array to a *float64. -// If next key value overflows float64, an InvalidUnmarshalError error will be returned. -func (dec *Decoder) Float32(v *float32) error { - err := dec.decodeFloat32(v) - if err != nil { - return err - } - dec.called |= 1 - return nil -} - -// Float32Null decodes the JSON value within an object or an array to a *float64. -// If next key value overflows float64, an InvalidUnmarshalError error will be returned. -func (dec *Decoder) Float32Null(v **float32) error { - err := dec.decodeFloat32Null(v) - if err != nil { - return err - } - dec.called |= 1 - return nil -} diff --git a/vendor/github.com/francoispqt/gojay/decode_number_int.go b/vendor/github.com/francoispqt/gojay/decode_number_int.go deleted file mode 100644 index 8429049fbf..0000000000 --- a/vendor/github.com/francoispqt/gojay/decode_number_int.go +++ /dev/null @@ -1,1338 +0,0 @@ -package gojay - -import ( - "fmt" - "math" -) - -// DecodeInt reads the next JSON-encoded value from the decoder's input (io.Reader) and stores it in the int pointed to by v. -// -// See the documentation for Unmarshal for details about the conversion of JSON into a Go value. -func (dec *Decoder) DecodeInt(v *int) error { - if dec.isPooled == 1 { - panic(InvalidUsagePooledDecoderError("Invalid usage of pooled decoder")) - } - return dec.decodeInt(v) -} -func (dec *Decoder) decodeInt(v *int) error { - for ; dec.cursor < dec.length || dec.read(); dec.cursor++ { - switch c := dec.data[dec.cursor]; c { - case ' ', '\n', '\t', '\r', ',': - continue - // we don't look for 0 as leading zeros are invalid per RFC - case '0', '1', '2', '3', '4', '5', '6', '7', '8', '9': - val, err := dec.getInt64() - if err != nil { - return err - } - *v = int(val) - return nil - case '-': - dec.cursor = dec.cursor + 1 - val, err := dec.getInt64Negative() - if err != nil { - return err - } - *v = -int(val) - return nil - case 'n': - dec.cursor++ - err := dec.assertNull() - if err != nil { - return err - } - return nil - default: - dec.err = InvalidUnmarshalError( - fmt.Sprintf( - "Cannot unmarshall to int, wrong char '%s' found at pos %d", - string(dec.data[dec.cursor]), - dec.cursor, - ), - ) - err := dec.skipData() - if err != nil { - return err - } - return nil - } - } - return dec.raiseInvalidJSONErr(dec.cursor) -} - -func (dec *Decoder) decodeIntNull(v **int) error { - for ; dec.cursor < dec.length || dec.read(); dec.cursor++ { - switch c := dec.data[dec.cursor]; c { - case ' ', '\n', '\t', '\r', ',': - continue - // we don't look for 0 as leading zeros are invalid per RFC - case '0', '1', '2', '3', '4', '5', '6', '7', '8', '9': - val, err := dec.getInt64() - if err != nil { - return err - } - if *v == nil { - *v = new(int) - } - **v = int(val) - return nil - case '-': - dec.cursor = dec.cursor + 1 - val, err := dec.getInt64Negative() - if err != nil { - return err - } - if *v == nil { - *v = new(int) - } - **v = -int(val) - return nil - case 'n': - dec.cursor++ - err := dec.assertNull() - if err != nil { - return err - } - return nil - default: - dec.err = InvalidUnmarshalError( - fmt.Sprintf( - "Cannot unmarshall to int, wrong char '%s' found at pos %d", - string(dec.data[dec.cursor]), - dec.cursor, - ), - ) - err := dec.skipData() - if err != nil { - return err - } - return nil - } - } - return dec.raiseInvalidJSONErr(dec.cursor) -} - -// DecodeInt16 reads the next JSON-encoded value from the decoder's input (io.Reader) and stores it in the int16 pointed to by v. -// -// See the documentation for Unmarshal for details about the conversion of JSON into a Go value. -func (dec *Decoder) DecodeInt16(v *int16) error { - if dec.isPooled == 1 { - panic(InvalidUsagePooledDecoderError("Invalid usage of pooled decoder")) - } - return dec.decodeInt16(v) -} -func (dec *Decoder) decodeInt16(v *int16) error { - for ; dec.cursor < dec.length || dec.read(); dec.cursor++ { - switch c := dec.data[dec.cursor]; c { - case ' ', '\n', '\t', '\r', ',': - continue - // we don't look for 0 as leading zeros are invalid per RFC - case '0', '1', '2', '3', '4', '5', '6', '7', '8', '9': - val, err := dec.getInt16() - if err != nil { - return err - } - *v = val - return nil - case '-': - dec.cursor = dec.cursor + 1 - val, err := dec.getInt16Negative() - if err != nil { - return err - } - *v = -val - return nil - case 'n': - dec.cursor++ - err := dec.assertNull() - if err != nil { - return err - } - return nil - default: - dec.err = dec.makeInvalidUnmarshalErr(v) - err := dec.skipData() - if err != nil { - return err - } - return nil - } - } - return dec.raiseInvalidJSONErr(dec.cursor) -} -func (dec *Decoder) decodeInt16Null(v **int16) error { - for ; dec.cursor < dec.length || dec.read(); dec.cursor++ { - switch c := dec.data[dec.cursor]; c { - case ' ', '\n', '\t', '\r', ',': - continue - // we don't look for 0 as leading zeros are invalid per RFC - case '0', '1', '2', '3', '4', '5', '6', '7', '8', '9': - val, err := dec.getInt16() - if err != nil { - return err - } - if *v == nil { - *v = new(int16) - } - **v = val - return nil - case '-': - dec.cursor = dec.cursor + 1 - val, err := dec.getInt16Negative() - if err != nil { - return err - } - if *v == nil { - *v = new(int16) - } - **v = -val - return nil - case 'n': - dec.cursor++ - err := dec.assertNull() - if err != nil { - return err - } - return nil - default: - dec.err = dec.makeInvalidUnmarshalErr(v) - err := dec.skipData() - if err != nil { - return err - } - return nil - } - } - return dec.raiseInvalidJSONErr(dec.cursor) -} - -func (dec *Decoder) getInt16Negative() (int16, error) { - // look for following numbers - for ; dec.cursor < dec.length || dec.read(); dec.cursor++ { - switch dec.data[dec.cursor] { - case '1', '2', '3', '4', '5', '6', '7', '8', '9': - return dec.getInt16() - default: - return 0, dec.raiseInvalidJSONErr(dec.cursor) - } - } - return 0, dec.raiseInvalidJSONErr(dec.cursor) -} - -func (dec *Decoder) getInt16() (int16, error) { - var end = dec.cursor - var start = dec.cursor - // look for following numbers - for j := dec.cursor + 1; j < dec.length || dec.read(); j++ { - switch dec.data[j] { - case '0', '1', '2', '3', '4', '5', '6', '7', '8', '9': - end = j - continue - case '.': - // if dot is found - // look for exponent (e,E) as exponent can change the - // way number should be parsed to int. - // if no exponent found, just unmarshal the number before decimal point - j++ - startDecimal := j - endDecimal := j - 1 - for ; j < dec.length || dec.read(); j++ { - switch dec.data[j] { - case '0', '1', '2', '3', '4', '5', '6', '7', '8', '9': - endDecimal = j - continue - case 'e', 'E': - if startDecimal > endDecimal { - return 0, dec.raiseInvalidJSONErr(dec.cursor) - } - dec.cursor = j + 1 - // can try unmarshalling to int as Exponent might change decimal number to non decimal - // let's get the float value first - // we get part before decimal as integer - beforeDecimal := dec.atoi16(start, end) - // get number after the decimal point - // multiple the before decimal point portion by 10 using bitwise - for i := startDecimal; i <= endDecimal; i++ { - beforeDecimal = (beforeDecimal << 3) + (beforeDecimal << 1) - } - // then we add both integers - // then we divide the number by the power found - afterDecimal := dec.atoi16(startDecimal, endDecimal) - expI := endDecimal - startDecimal + 2 - if expI >= len(pow10uint64) || expI < 0 { - return 0, dec.raiseInvalidJSONErr(dec.cursor) - } - pow := pow10uint64[expI] - floatVal := float64(beforeDecimal+afterDecimal) / float64(pow) - // we have the floating value, now multiply by the exponent - exp, err := dec.getExponent() - if err != nil { - return 0, err - } - pExp := (exp + (exp >> 31)) ^ (exp >> 31) + 1 // abs - if pExp >= int64(len(pow10uint64)) || pExp < 0 { - return 0, dec.raiseInvalidJSONErr(dec.cursor) - } - val := floatVal * float64(pow10uint64[pExp]) - return int16(val), nil - case ' ', '\t', '\n', ',', ']', '}': - dec.cursor = j - return dec.atoi16(start, end), nil - default: - dec.cursor = j - return 0, dec.raiseInvalidJSONErr(dec.cursor) - } - } - return dec.atoi16(start, end), nil - case 'e', 'E': - // get init n - dec.cursor = j + 1 - return dec.getInt16WithExp(dec.atoi16(start, end)) - case ' ', '\n', '\t', '\r', ',', '}', ']': - dec.cursor = j - return dec.atoi16(start, end), nil - } - // invalid json we expect numbers, dot (single one), comma, or spaces - return 0, dec.raiseInvalidJSONErr(dec.cursor) - } - return dec.atoi16(start, end), nil -} - -func (dec *Decoder) getInt16WithExp(init int16) (int16, error) { - var exp uint16 - var sign = int16(1) - for ; dec.cursor < dec.length || dec.read(); dec.cursor++ { - switch dec.data[dec.cursor] { - case '+': - continue - case '-': - sign = -1 - case '0', '1', '2', '3', '4', '5', '6', '7', '8', '9': - uintv := uint16(digits[dec.data[dec.cursor]]) - exp = (exp << 3) + (exp << 1) + uintv - dec.cursor++ - for ; dec.cursor < dec.length || dec.read(); dec.cursor++ { - switch dec.data[dec.cursor] { - case '0', '1', '2', '3', '4', '5', '6', '7', '8', '9': - uintv := uint16(digits[dec.data[dec.cursor]]) - exp = (exp << 3) + (exp << 1) + uintv - case ' ', '\t', '\n', '}', ',', ']': - exp = exp + 1 - if exp >= uint16(len(pow10uint64)) { - return 0, dec.raiseInvalidJSONErr(dec.cursor) - } - if sign == -1 { - return init * (1 / int16(pow10uint64[exp])), nil - } - return init * int16(pow10uint64[exp]), nil - default: - return 0, dec.raiseInvalidJSONErr(dec.cursor) - } - } - exp = exp + 1 - if exp >= uint16(len(pow10uint64)) { - return 0, dec.raiseInvalidJSONErr(dec.cursor) - } - if sign == -1 { - return init * (1 / int16(pow10uint64[exp])), nil - } - return init * int16(pow10uint64[exp]), nil - default: - return 0, dec.raiseInvalidJSONErr(dec.cursor) - } - } - return 0, dec.raiseInvalidJSONErr(dec.cursor) -} - -// DecodeInt8 reads the next JSON-encoded value from the decoder's input (io.Reader) and stores it in the int8 pointed to by v. -// -// See the documentation for Unmarshal for details about the conversion of JSON into a Go value. -func (dec *Decoder) DecodeInt8(v *int8) error { - if dec.isPooled == 1 { - panic(InvalidUsagePooledDecoderError("Invalid usage of pooled decoder")) - } - return dec.decodeInt8(v) -} -func (dec *Decoder) decodeInt8(v *int8) error { - for ; dec.cursor < dec.length || dec.read(); dec.cursor++ { - switch c := dec.data[dec.cursor]; c { - case ' ', '\n', '\t', '\r', ',': - continue - // we don't look for 0 as leading zeros are invalid per RFC - case '0', '1', '2', '3', '4', '5', '6', '7', '8', '9': - val, err := dec.getInt8() - if err != nil { - return err - } - *v = val - return nil - case '-': - dec.cursor = dec.cursor + 1 - val, err := dec.getInt8Negative() - if err != nil { - return err - } - *v = -val - return nil - case 'n': - dec.cursor++ - err := dec.assertNull() - if err != nil { - return err - } - return nil - default: - dec.err = dec.makeInvalidUnmarshalErr(v) - err := dec.skipData() - if err != nil { - return err - } - return nil - } - } - return dec.raiseInvalidJSONErr(dec.cursor) -} -func (dec *Decoder) decodeInt8Null(v **int8) error { - for ; dec.cursor < dec.length || dec.read(); dec.cursor++ { - switch c := dec.data[dec.cursor]; c { - case ' ', '\n', '\t', '\r', ',': - continue - // we don't look for 0 as leading zeros are invalid per RFC - case '0', '1', '2', '3', '4', '5', '6', '7', '8', '9': - val, err := dec.getInt8() - if err != nil { - return err - } - if *v == nil { - *v = new(int8) - } - **v = val - return nil - case '-': - dec.cursor = dec.cursor + 1 - val, err := dec.getInt8Negative() - if err != nil { - return err - } - if *v == nil { - *v = new(int8) - } - **v = -val - return nil - case 'n': - dec.cursor++ - err := dec.assertNull() - if err != nil { - return err - } - return nil - default: - dec.err = dec.makeInvalidUnmarshalErr(v) - err := dec.skipData() - if err != nil { - return err - } - return nil - } - } - return dec.raiseInvalidJSONErr(dec.cursor) -} - -func (dec *Decoder) getInt8Negative() (int8, error) { - // look for following numbers - for ; dec.cursor < dec.length || dec.read(); dec.cursor++ { - switch dec.data[dec.cursor] { - case '1', '2', '3', '4', '5', '6', '7', '8', '9': - return dec.getInt8() - default: - return 0, dec.raiseInvalidJSONErr(dec.cursor) - } - } - return 0, dec.raiseInvalidJSONErr(dec.cursor) -} - -func (dec *Decoder) getInt8() (int8, error) { - var end = dec.cursor - var start = dec.cursor - // look for following numbers - for j := dec.cursor + 1; j < dec.length || dec.read(); j++ { - switch dec.data[j] { - case '0', '1', '2', '3', '4', '5', '6', '7', '8', '9': - end = j - continue - case '.': - // if dot is found - // look for exponent (e,E) as exponent can change the - // way number should be parsed to int. - // if no exponent found, just unmarshal the number before decimal point - j++ - startDecimal := j - endDecimal := j - 1 - for ; j < dec.length || dec.read(); j++ { - switch dec.data[j] { - case '0', '1', '2', '3', '4', '5', '6', '7', '8', '9': - endDecimal = j - continue - case 'e', 'E': - if startDecimal > endDecimal { - return 0, dec.raiseInvalidJSONErr(dec.cursor) - } - dec.cursor = j + 1 - // can try unmarshalling to int as Exponent might change decimal number to non decimal - // let's get the float value first - // we get part before decimal as integer - beforeDecimal := dec.atoi8(start, end) - // get number after the decimal point - // multiple the before decimal point portion by 10 using bitwise - for i := startDecimal; i <= endDecimal; i++ { - beforeDecimal = (beforeDecimal << 3) + (beforeDecimal << 1) - } - // then we add both integers - // then we divide the number by the power found - afterDecimal := dec.atoi8(startDecimal, endDecimal) - expI := endDecimal - startDecimal + 2 - if expI >= len(pow10uint64) || expI < 0 { - return 0, dec.raiseInvalidJSONErr(dec.cursor) - } - pow := pow10uint64[expI] - floatVal := float64(beforeDecimal+afterDecimal) / float64(pow) - // we have the floating value, now multiply by the exponent - exp, err := dec.getExponent() - if err != nil { - return 0, err - } - pExp := (exp + (exp >> 31)) ^ (exp >> 31) + 1 // abs - if pExp >= int64(len(pow10uint64)) || pExp < 0 { - return 0, dec.raiseInvalidJSONErr(dec.cursor) - } - val := floatVal * float64(pow10uint64[pExp]) - return int8(val), nil - case ' ', '\t', '\n', ',', ']', '}': - dec.cursor = j - return dec.atoi8(start, end), nil - default: - dec.cursor = j - return 0, dec.raiseInvalidJSONErr(dec.cursor) - } - } - return dec.atoi8(start, end), nil - case 'e', 'E': - // get init n - dec.cursor = j + 1 - return dec.getInt8WithExp(dec.atoi8(start, end)) - case ' ', '\n', '\t', '\r', ',', '}', ']': - dec.cursor = j - return dec.atoi8(start, end), nil - } - // invalid json we expect numbers, dot (single one), comma, or spaces - return 0, dec.raiseInvalidJSONErr(dec.cursor) - } - return dec.atoi8(start, end), nil -} - -func (dec *Decoder) getInt8WithExp(init int8) (int8, error) { - var exp uint8 - var sign = int8(1) - for ; dec.cursor < dec.length || dec.read(); dec.cursor++ { - switch dec.data[dec.cursor] { - case '+': - continue - case '-': - sign = -1 - case '0', '1', '2', '3', '4', '5', '6', '7', '8', '9': - uintv := uint8(digits[dec.data[dec.cursor]]) - exp = (exp << 3) + (exp << 1) + uintv - dec.cursor++ - for ; dec.cursor < dec.length || dec.read(); dec.cursor++ { - switch dec.data[dec.cursor] { - case '0', '1', '2', '3', '4', '5', '6', '7', '8', '9': - uintv := uint8(digits[dec.data[dec.cursor]]) - exp = (exp << 3) + (exp << 1) + uintv - case ' ', '\t', '\n', '}', ',', ']': - if exp+1 >= uint8(len(pow10uint64)) { - return 0, dec.raiseInvalidJSONErr(dec.cursor) - } - if sign == -1 { - return init * (1 / int8(pow10uint64[exp+1])), nil - } - return init * int8(pow10uint64[exp+1]), nil - default: - return 0, dec.raiseInvalidJSONErr(dec.cursor) - } - } - if exp+1 >= uint8(len(pow10uint64)) { - return 0, dec.raiseInvalidJSONErr(dec.cursor) - } - if sign == -1 { - return init * (1 / int8(pow10uint64[exp+1])), nil - } - return init * int8(pow10uint64[exp+1]), nil - default: - dec.err = dec.raiseInvalidJSONErr(dec.cursor) - return 0, dec.err - } - } - return 0, dec.raiseInvalidJSONErr(dec.cursor) -} - -// DecodeInt32 reads the next JSON-encoded value from the decoder's input (io.Reader) and stores it in the int32 pointed to by v. -// -// See the documentation for Unmarshal for details about the conversion of JSON into a Go value. -func (dec *Decoder) DecodeInt32(v *int32) error { - if dec.isPooled == 1 { - panic(InvalidUsagePooledDecoderError("Invalid usage of pooled decoder")) - } - return dec.decodeInt32(v) -} -func (dec *Decoder) decodeInt32(v *int32) error { - for ; dec.cursor < dec.length || dec.read(); dec.cursor++ { - switch c := dec.data[dec.cursor]; c { - case ' ', '\n', '\t', '\r', ',': - continue - case '0', '1', '2', '3', '4', '5', '6', '7', '8', '9': - val, err := dec.getInt32() - if err != nil { - return err - } - *v = val - return nil - case '-': - dec.cursor = dec.cursor + 1 - val, err := dec.getInt32Negative() - if err != nil { - return err - } - *v = -val - return nil - case 'n': - dec.cursor++ - err := dec.assertNull() - if err != nil { - return err - } - return nil - default: - dec.err = dec.makeInvalidUnmarshalErr(v) - err := dec.skipData() - if err != nil { - return err - } - return nil - } - } - return dec.raiseInvalidJSONErr(dec.cursor) -} -func (dec *Decoder) decodeInt32Null(v **int32) error { - for ; dec.cursor < dec.length || dec.read(); dec.cursor++ { - switch c := dec.data[dec.cursor]; c { - case ' ', '\n', '\t', '\r', ',': - continue - case '0', '1', '2', '3', '4', '5', '6', '7', '8', '9': - val, err := dec.getInt32() - if err != nil { - return err - } - if *v == nil { - *v = new(int32) - } - **v = val - return nil - case '-': - dec.cursor = dec.cursor + 1 - val, err := dec.getInt32Negative() - if err != nil { - return err - } - if *v == nil { - *v = new(int32) - } - **v = -val - return nil - case 'n': - dec.cursor++ - err := dec.assertNull() - if err != nil { - return err - } - return nil - default: - dec.err = dec.makeInvalidUnmarshalErr(v) - err := dec.skipData() - if err != nil { - return err - } - return nil - } - } - return dec.raiseInvalidJSONErr(dec.cursor) -} - -func (dec *Decoder) getInt32Negative() (int32, error) { - // look for following numbers - for ; dec.cursor < dec.length || dec.read(); dec.cursor++ { - switch dec.data[dec.cursor] { - case '1', '2', '3', '4', '5', '6', '7', '8', '9': - return dec.getInt32() - default: - return 0, dec.raiseInvalidJSONErr(dec.cursor) - } - } - return 0, dec.raiseInvalidJSONErr(dec.cursor) -} - -func (dec *Decoder) getInt32() (int32, error) { - var end = dec.cursor - var start = dec.cursor - // look for following numbers - for j := dec.cursor + 1; j < dec.length || dec.read(); j++ { - switch dec.data[j] { - case '0', '1', '2', '3', '4', '5', '6', '7', '8', '9': - end = j - continue - case '.': - // if dot is found - // look for exponent (e,E) as exponent can change the - // way number should be parsed to int. - // if no exponent found, just unmarshal the number before decimal point - j++ - startDecimal := j - endDecimal := j - 1 - for ; j < dec.length || dec.read(); j++ { - switch dec.data[j] { - case '0', '1', '2', '3', '4', '5', '6', '7', '8', '9': - endDecimal = j - continue - case 'e', 'E': - // if eg 1.E - if startDecimal > endDecimal { - return 0, dec.raiseInvalidJSONErr(dec.cursor) - } - dec.cursor = j + 1 - // can try unmarshalling to int as Exponent might change decimal number to non decimal - // let's get the float value first - // we get part before decimal as integer - beforeDecimal := dec.atoi64(start, end) - // get number after the decimal point - // multiple the before decimal point portion by 10 using bitwise - for i := startDecimal; i <= endDecimal; i++ { - beforeDecimal = (beforeDecimal << 3) + (beforeDecimal << 1) - } - // then we add both integers - // then we divide the number by the power found - afterDecimal := dec.atoi64(startDecimal, endDecimal) - expI := endDecimal - startDecimal + 2 - if expI >= len(pow10uint64) || expI < 0 { - return 0, dec.raiseInvalidJSONErr(dec.cursor) - } - pow := pow10uint64[expI] - floatVal := float64(beforeDecimal+afterDecimal) / float64(pow) - // we have the floating value, now multiply by the exponent - exp, err := dec.getExponent() - if err != nil { - return 0, err - } - pExp := (exp + (exp >> 31)) ^ (exp >> 31) + 1 // abs - if pExp >= int64(len(pow10uint64)) || pExp < 0 { - return 0, dec.raiseInvalidJSONErr(dec.cursor) - } - val := floatVal * float64(pow10uint64[pExp]) - return int32(val), nil - case ' ', '\t', '\n', ',', ']', '}': - dec.cursor = j - return dec.atoi32(start, end), nil - default: - dec.cursor = j - return 0, dec.raiseInvalidJSONErr(dec.cursor) - } - } - return dec.atoi32(start, end), nil - case 'e', 'E': - // get init n - dec.cursor = j + 1 - return dec.getInt32WithExp(dec.atoi32(start, end)) - case ' ', '\n', '\t', '\r', ',', '}', ']': - dec.cursor = j - return dec.atoi32(start, end), nil - } - // invalid json we expect numbers, dot (single one), comma, or spaces - return 0, dec.raiseInvalidJSONErr(dec.cursor) - } - return dec.atoi32(start, end), nil -} - -func (dec *Decoder) getInt32WithExp(init int32) (int32, error) { - var exp uint32 - var sign = int32(1) - for ; dec.cursor < dec.length || dec.read(); dec.cursor++ { - switch dec.data[dec.cursor] { - case '+': - continue - case '-': - sign = -1 - case '0', '1', '2', '3', '4', '5', '6', '7', '8', '9': - uintv := uint32(digits[dec.data[dec.cursor]]) - exp = (exp << 3) + (exp << 1) + uintv - dec.cursor++ - for ; dec.cursor < dec.length || dec.read(); dec.cursor++ { - switch dec.data[dec.cursor] { - case '0', '1', '2', '3', '4', '5', '6', '7', '8', '9': - uintv := uint32(digits[dec.data[dec.cursor]]) - exp = (exp << 3) + (exp << 1) + uintv - case ' ', '\t', '\n', '}', ',', ']': - if exp+1 >= uint32(len(pow10uint64)) { - return 0, dec.raiseInvalidJSONErr(dec.cursor) - } - if sign == -1 { - return init * (1 / int32(pow10uint64[exp+1])), nil - } - return init * int32(pow10uint64[exp+1]), nil - default: - return 0, dec.raiseInvalidJSONErr(dec.cursor) - } - } - if exp+1 >= uint32(len(pow10uint64)) { - return 0, dec.raiseInvalidJSONErr(dec.cursor) - } - if sign == -1 { - return init * (1 / int32(pow10uint64[exp+1])), nil - } - return init * int32(pow10uint64[exp+1]), nil - default: - dec.err = dec.raiseInvalidJSONErr(dec.cursor) - return 0, dec.err - } - } - return 0, dec.raiseInvalidJSONErr(dec.cursor) -} - -// DecodeInt64 reads the next JSON-encoded value from the decoder's input (io.Reader) and stores it in the int64 pointed to by v. -// -// See the documentation for Unmarshal for details about the conversion of JSON into a Go value. -func (dec *Decoder) DecodeInt64(v *int64) error { - if dec.isPooled == 1 { - panic(InvalidUsagePooledDecoderError("Invalid usage of pooled decoder")) - } - return dec.decodeInt64(v) -} - -func (dec *Decoder) decodeInt64(v *int64) error { - for ; dec.cursor < dec.length || dec.read(); dec.cursor++ { - switch c := dec.data[dec.cursor]; c { - case ' ', '\n', '\t', '\r', ',': - continue - case '0', '1', '2', '3', '4', '5', '6', '7', '8', '9': - val, err := dec.getInt64() - if err != nil { - return err - } - *v = val - return nil - case '-': - dec.cursor = dec.cursor + 1 - val, err := dec.getInt64Negative() - if err != nil { - return err - } - *v = -val - return nil - case 'n': - dec.cursor++ - err := dec.assertNull() - if err != nil { - return err - } - return nil - default: - dec.err = dec.makeInvalidUnmarshalErr(v) - err := dec.skipData() - if err != nil { - return err - } - return nil - } - } - return dec.raiseInvalidJSONErr(dec.cursor) -} -func (dec *Decoder) decodeInt64Null(v **int64) error { - for ; dec.cursor < dec.length || dec.read(); dec.cursor++ { - switch c := dec.data[dec.cursor]; c { - case ' ', '\n', '\t', '\r', ',': - continue - case '0', '1', '2', '3', '4', '5', '6', '7', '8', '9': - val, err := dec.getInt64() - if err != nil { - return err - } - if *v == nil { - *v = new(int64) - } - **v = val - return nil - case '-': - dec.cursor = dec.cursor + 1 - val, err := dec.getInt64Negative() - if err != nil { - return err - } - if *v == nil { - *v = new(int64) - } - **v = -val - return nil - case 'n': - dec.cursor++ - err := dec.assertNull() - if err != nil { - return err - } - return nil - default: - dec.err = dec.makeInvalidUnmarshalErr(v) - err := dec.skipData() - if err != nil { - return err - } - return nil - } - } - return dec.raiseInvalidJSONErr(dec.cursor) -} - -func (dec *Decoder) getInt64Negative() (int64, error) { - // look for following numbers - for ; dec.cursor < dec.length || dec.read(); dec.cursor++ { - switch dec.data[dec.cursor] { - case '1', '2', '3', '4', '5', '6', '7', '8', '9': - return dec.getInt64() - default: - return 0, dec.raiseInvalidJSONErr(dec.cursor) - } - } - return 0, dec.raiseInvalidJSONErr(dec.cursor) -} - -func (dec *Decoder) getInt64() (int64, error) { - var end = dec.cursor - var start = dec.cursor - // look for following numbers - for j := dec.cursor + 1; j < dec.length || dec.read(); j++ { - switch dec.data[j] { - case '0', '1', '2', '3', '4', '5', '6', '7', '8', '9': - end = j - continue - case ' ', '\t', '\n', ',', '}', ']': - dec.cursor = j - return dec.atoi64(start, end), nil - case '.': - // if dot is found - // look for exponent (e,E) as exponent can change the - // way number should be parsed to int. - // if no exponent found, just unmarshal the number before decimal point - j++ - startDecimal := j - endDecimal := j - 1 - for ; j < dec.length || dec.read(); j++ { - switch dec.data[j] { - case '0', '1', '2', '3', '4', '5', '6', '7', '8', '9': - endDecimal = j - continue - case 'e', 'E': - // if eg 1.E - if startDecimal > endDecimal { - return 0, dec.raiseInvalidJSONErr(dec.cursor) - } - dec.cursor = j + 1 - // can try unmarshalling to int as Exponent might change decimal number to non decimal - // let's get the float value first - // we get part before decimal as integer - beforeDecimal := dec.atoi64(start, end) - // get number after the decimal point - // multiple the before decimal point portion by 10 using bitwise - for i := startDecimal; i <= endDecimal; i++ { - beforeDecimal = (beforeDecimal << 3) + (beforeDecimal << 1) - } - // then we add both integers - // then we divide the number by the power found - afterDecimal := dec.atoi64(startDecimal, endDecimal) - expI := endDecimal - startDecimal + 2 - if expI >= len(pow10uint64) || expI < 0 { - return 0, dec.raiseInvalidJSONErr(dec.cursor) - } - pow := pow10uint64[expI] - floatVal := float64(beforeDecimal+afterDecimal) / float64(pow) - // we have the floating value, now multiply by the exponent - exp, err := dec.getExponent() - if err != nil { - return 0, err - } - pExp := (exp + (exp >> 31)) ^ (exp >> 31) + 1 // abs - if pExp >= int64(len(pow10uint64)) || pExp < 0 { - return 0, dec.raiseInvalidJSONErr(dec.cursor) - } - val := floatVal * float64(pow10uint64[pExp]) - return int64(val), nil - case ' ', '\t', '\n', ',', ']', '}': - dec.cursor = j - return dec.atoi64(start, end), nil - default: - dec.cursor = j - return 0, dec.raiseInvalidJSONErr(dec.cursor) - } - } - return dec.atoi64(start, end), nil - case 'e', 'E': - // get init n - dec.cursor = j + 1 - return dec.getInt64WithExp(dec.atoi64(start, end)) - } - // invalid json we expect numbers, dot (single one), comma, or spaces - return 0, dec.raiseInvalidJSONErr(dec.cursor) - } - return dec.atoi64(start, end), nil -} - -func (dec *Decoder) getInt64WithExp(init int64) (int64, error) { - var exp uint64 - var sign = int64(1) - for ; dec.cursor < dec.length || dec.read(); dec.cursor++ { - switch dec.data[dec.cursor] { - case '+': - continue - case '-': - sign = -1 - case '0', '1', '2', '3', '4', '5', '6', '7', '8', '9': - uintv := uint64(digits[dec.data[dec.cursor]]) - exp = (exp << 3) + (exp << 1) + uintv - dec.cursor++ - for ; dec.cursor < dec.length || dec.read(); dec.cursor++ { - switch dec.data[dec.cursor] { - case '0', '1', '2', '3', '4', '5', '6', '7', '8', '9': - uintv := uint64(digits[dec.data[dec.cursor]]) - exp = (exp << 3) + (exp << 1) + uintv - case ' ', '\t', '\n', '}', ',', ']': - if exp+1 >= uint64(len(pow10uint64)) { - return 0, dec.raiseInvalidJSONErr(dec.cursor) - } - if sign == -1 { - return init * (1 / int64(pow10uint64[exp+1])), nil - } - return init * int64(pow10uint64[exp+1]), nil - default: - return 0, dec.raiseInvalidJSONErr(dec.cursor) - } - } - if exp+1 >= uint64(len(pow10uint64)) { - return 0, dec.raiseInvalidJSONErr(dec.cursor) - } - if sign == -1 { - return init * (1 / int64(pow10uint64[exp+1])), nil - } - return init * int64(pow10uint64[exp+1]), nil - default: - return 0, dec.raiseInvalidJSONErr(dec.cursor) - } - } - return 0, dec.raiseInvalidJSONErr(dec.cursor) -} - -func (dec *Decoder) atoi64(start, end int) int64 { - var ll = end + 1 - start - var val = int64(digits[dec.data[start]]) - end = end + 1 - if ll < maxInt64Length { - for i := start + 1; i < end; i++ { - intv := int64(digits[dec.data[i]]) - val = (val << 3) + (val << 1) + intv - } - return val - } else if ll == maxInt64Length { - for i := start + 1; i < end; i++ { - intv := int64(digits[dec.data[i]]) - if val > maxInt64toMultiply { - dec.err = dec.makeInvalidUnmarshalErr(val) - return 0 - } - val = (val << 3) + (val << 1) - if math.MaxInt64-val < intv { - dec.err = dec.makeInvalidUnmarshalErr(val) - return 0 - } - val += intv - } - } else { - dec.err = dec.makeInvalidUnmarshalErr(val) - return 0 - } - return val -} - -func (dec *Decoder) atoi32(start, end int) int32 { - var ll = end + 1 - start - var val = int32(digits[dec.data[start]]) - end = end + 1 - - // overflowing - if ll < maxInt32Length { - for i := start + 1; i < end; i++ { - intv := int32(digits[dec.data[i]]) - val = (val << 3) + (val << 1) + intv - } - } else if ll == maxInt32Length { - for i := start + 1; i < end; i++ { - intv := int32(digits[dec.data[i]]) - if val > maxInt32toMultiply { - dec.err = dec.makeInvalidUnmarshalErr(val) - return 0 - } - val = (val << 3) + (val << 1) - if math.MaxInt32-val < intv { - dec.err = dec.makeInvalidUnmarshalErr(val) - return 0 - } - val += intv - } - } else { - dec.err = dec.makeInvalidUnmarshalErr(val) - return 0 - } - return val -} - -func (dec *Decoder) atoi16(start, end int) int16 { - var ll = end + 1 - start - var val = int16(digits[dec.data[start]]) - end = end + 1 - // overflowing - if ll < maxInt16Length { - for i := start + 1; i < end; i++ { - intv := int16(digits[dec.data[i]]) - val = (val << 3) + (val << 1) + intv - } - } else if ll == maxInt16Length { - for i := start + 1; i < end; i++ { - intv := int16(digits[dec.data[i]]) - if val > maxInt16toMultiply { - dec.err = dec.makeInvalidUnmarshalErr(val) - return 0 - } - val = (val << 3) + (val << 1) - if math.MaxInt16-val < intv { - dec.err = dec.makeInvalidUnmarshalErr(val) - return 0 - } - val += intv - } - } else { - dec.err = dec.makeInvalidUnmarshalErr(val) - return 0 - } - return val -} - -func (dec *Decoder) atoi8(start, end int) int8 { - var ll = end + 1 - start - var val = int8(digits[dec.data[start]]) - end = end + 1 - // overflowing - if ll < maxInt8Length { - for i := start + 1; i < end; i++ { - intv := int8(digits[dec.data[i]]) - val = (val << 3) + (val << 1) + intv - } - } else if ll == maxInt8Length { - for i := start + 1; i < end; i++ { - intv := int8(digits[dec.data[i]]) - if val > maxInt8toMultiply { - dec.err = dec.makeInvalidUnmarshalErr(val) - return 0 - } - val = (val << 3) + (val << 1) - if math.MaxInt8-val < intv { - dec.err = dec.makeInvalidUnmarshalErr(val) - return 0 - } - val += intv - } - } else { - dec.err = dec.makeInvalidUnmarshalErr(val) - return 0 - } - return val -} - -// Add Values functions - -// AddInt decodes the JSON value within an object or an array to an *int. -// If next key value overflows int, an InvalidUnmarshalError error will be returned. -func (dec *Decoder) AddInt(v *int) error { - return dec.Int(v) -} - -// AddIntNull decodes the JSON value within an object or an array to an *int. -// If next key value overflows int, an InvalidUnmarshalError error will be returned. -// If a `null` is encountered, gojay does not change the value of the pointer. -func (dec *Decoder) AddIntNull(v **int) error { - return dec.IntNull(v) -} - -// AddInt8 decodes the JSON value within an object or an array to an *int. -// If next key value overflows int8, an InvalidUnmarshalError error will be returned. -func (dec *Decoder) AddInt8(v *int8) error { - return dec.Int8(v) -} - -// AddInt8Null decodes the JSON value within an object or an array to an *int. -// If next key value overflows int8, an InvalidUnmarshalError error will be returned. -// If a `null` is encountered, gojay does not change the value of the pointer. -func (dec *Decoder) AddInt8Null(v **int8) error { - return dec.Int8Null(v) -} - -// AddInt16 decodes the JSON value within an object or an array to an *int. -// If next key value overflows int16, an InvalidUnmarshalError error will be returned. -func (dec *Decoder) AddInt16(v *int16) error { - return dec.Int16(v) -} - -// AddInt16Null decodes the JSON value within an object or an array to an *int. -// If next key value overflows int16, an InvalidUnmarshalError error will be returned. -// If a `null` is encountered, gojay does not change the value of the pointer. -func (dec *Decoder) AddInt16Null(v **int16) error { - return dec.Int16Null(v) -} - -// AddInt32 decodes the JSON value within an object or an array to an *int. -// If next key value overflows int32, an InvalidUnmarshalError error will be returned. -func (dec *Decoder) AddInt32(v *int32) error { - return dec.Int32(v) -} - -// AddInt32Null decodes the JSON value within an object or an array to an *int. -// If next key value overflows int32, an InvalidUnmarshalError error will be returned. -// If a `null` is encountered, gojay does not change the value of the pointer. -func (dec *Decoder) AddInt32Null(v **int32) error { - return dec.Int32Null(v) -} - -// AddInt64 decodes the JSON value within an object or an array to an *int. -// If next key value overflows int64, an InvalidUnmarshalError error will be returned. -func (dec *Decoder) AddInt64(v *int64) error { - return dec.Int64(v) -} - -// AddInt64Null decodes the JSON value within an object or an array to an *int. -// If next key value overflows int64, an InvalidUnmarshalError error will be returned. -// If a `null` is encountered, gojay does not change the value of the pointer. -func (dec *Decoder) AddInt64Null(v **int64) error { - return dec.Int64Null(v) -} - -// Int decodes the JSON value within an object or an array to an *int. -// If next key value overflows int, an InvalidUnmarshalError error will be returned. -func (dec *Decoder) Int(v *int) error { - err := dec.decodeInt(v) - if err != nil { - return err - } - dec.called |= 1 - return nil -} - -// IntNull decodes the JSON value within an object or an array to an *int. -// If next key value overflows int, an InvalidUnmarshalError error will be returned. -func (dec *Decoder) IntNull(v **int) error { - err := dec.decodeIntNull(v) - if err != nil { - return err - } - dec.called |= 1 - return nil -} - -// Int8 decodes the JSON value within an object or an array to an *int. -// If next key value overflows int8, an InvalidUnmarshalError error will be returned. -func (dec *Decoder) Int8(v *int8) error { - err := dec.decodeInt8(v) - if err != nil { - return err - } - dec.called |= 1 - return nil -} - -// Int8Null decodes the JSON value within an object or an array to an *int. -// If next key value overflows int8, an InvalidUnmarshalError error will be returned. -func (dec *Decoder) Int8Null(v **int8) error { - err := dec.decodeInt8Null(v) - if err != nil { - return err - } - dec.called |= 1 - return nil -} - -// Int16 decodes the JSON value within an object or an array to an *int. -// If next key value overflows int16, an InvalidUnmarshalError error will be returned. -func (dec *Decoder) Int16(v *int16) error { - err := dec.decodeInt16(v) - if err != nil { - return err - } - dec.called |= 1 - return nil -} - -// Int16Null decodes the JSON value within an object or an array to an *int. -// If next key value overflows int16, an InvalidUnmarshalError error will be returned. -func (dec *Decoder) Int16Null(v **int16) error { - err := dec.decodeInt16Null(v) - if err != nil { - return err - } - dec.called |= 1 - return nil -} - -// Int32 decodes the JSON value within an object or an array to an *int. -// If next key value overflows int32, an InvalidUnmarshalError error will be returned. -func (dec *Decoder) Int32(v *int32) error { - err := dec.decodeInt32(v) - if err != nil { - return err - } - dec.called |= 1 - return nil -} - -// Int32Null decodes the JSON value within an object or an array to an *int. -// If next key value overflows int32, an InvalidUnmarshalError error will be returned. -func (dec *Decoder) Int32Null(v **int32) error { - err := dec.decodeInt32Null(v) - if err != nil { - return err - } - dec.called |= 1 - return nil -} - -// Int64 decodes the JSON value within an object or an array to an *int. -// If next key value overflows int64, an InvalidUnmarshalError error will be returned. -func (dec *Decoder) Int64(v *int64) error { - err := dec.decodeInt64(v) - if err != nil { - return err - } - dec.called |= 1 - return nil -} - -// Int64Null decodes the JSON value within an object or an array to an *int. -// If next key value overflows int64, an InvalidUnmarshalError error will be returned. -func (dec *Decoder) Int64Null(v **int64) error { - err := dec.decodeInt64Null(v) - if err != nil { - return err - } - dec.called |= 1 - return nil -} diff --git a/vendor/github.com/francoispqt/gojay/decode_number_uint.go b/vendor/github.com/francoispqt/gojay/decode_number_uint.go deleted file mode 100644 index b57ef7ab63..0000000000 --- a/vendor/github.com/francoispqt/gojay/decode_number_uint.go +++ /dev/null @@ -1,715 +0,0 @@ -package gojay - -import ( - "math" -) - -// DecodeUint8 reads the next JSON-encoded value from the decoder's input (io.Reader) and stores it in the uint8 pointed to by v. -// -// See the documentation for Unmarshal for details about the conversion of JSON into a Go value. -func (dec *Decoder) DecodeUint8(v *uint8) error { - if dec.isPooled == 1 { - panic(InvalidUsagePooledDecoderError("Invalid usage of pooled decoder")) - } - return dec.decodeUint8(v) -} - -func (dec *Decoder) decodeUint8(v *uint8) error { - for ; dec.cursor < dec.length || dec.read(); dec.cursor++ { - switch c := dec.data[dec.cursor]; c { - case ' ', '\n', '\t', '\r', ',': - continue - case '0', '1', '2', '3', '4', '5', '6', '7', '8', '9': - val, err := dec.getUint8() - if err != nil { - return err - } - *v = val - return nil - case '-': // if negative, we just set it to 0 and set error - dec.err = dec.makeInvalidUnmarshalErr(v) - err := dec.skipData() - if err != nil { - return err - } - return nil - case 'n': - dec.cursor++ - err := dec.assertNull() - if err != nil { - return err - } - return nil - default: - dec.err = dec.makeInvalidUnmarshalErr(v) - err := dec.skipData() - if err != nil { - return err - } - return nil - } - } - return dec.raiseInvalidJSONErr(dec.cursor) -} -func (dec *Decoder) decodeUint8Null(v **uint8) error { - for ; dec.cursor < dec.length || dec.read(); dec.cursor++ { - switch c := dec.data[dec.cursor]; c { - case ' ', '\n', '\t', '\r', ',': - continue - case '0', '1', '2', '3', '4', '5', '6', '7', '8', '9': - val, err := dec.getUint8() - if err != nil { - return err - } - if *v == nil { - *v = new(uint8) - } - **v = val - return nil - case '-': // if negative, we just set it to 0 and set error - dec.err = dec.makeInvalidUnmarshalErr(v) - err := dec.skipData() - if err != nil { - return err - } - if *v == nil { - *v = new(uint8) - } - return nil - case 'n': - dec.cursor++ - err := dec.assertNull() - if err != nil { - return err - } - return nil - default: - dec.err = dec.makeInvalidUnmarshalErr(v) - err := dec.skipData() - if err != nil { - return err - } - return nil - } - } - return dec.raiseInvalidJSONErr(dec.cursor) -} - -func (dec *Decoder) getUint8() (uint8, error) { - var end = dec.cursor - var start = dec.cursor - // look for following numbers - for j := dec.cursor + 1; j < dec.length || dec.read(); j++ { - switch dec.data[j] { - case '0', '1', '2', '3', '4', '5', '6', '7', '8', '9': - end = j - continue - case ' ', '\n', '\t', '\r': - continue - case '.', ',', '}', ']': - dec.cursor = j - return dec.atoui8(start, end), nil - } - // invalid json we expect numbers, dot (single one), comma, or spaces - return 0, dec.raiseInvalidJSONErr(dec.cursor) - } - return dec.atoui8(start, end), nil -} - -// DecodeUint16 reads the next JSON-encoded value from the decoder's input (io.Reader) and stores it in the uint16 pointed to by v. -// -// See the documentation for Unmarshal for details about the conversion of JSON into a Go value. -func (dec *Decoder) DecodeUint16(v *uint16) error { - if dec.isPooled == 1 { - panic(InvalidUsagePooledDecoderError("Invalid usage of pooled decoder")) - } - return dec.decodeUint16(v) -} - -func (dec *Decoder) decodeUint16(v *uint16) error { - for ; dec.cursor < dec.length || dec.read(); dec.cursor++ { - switch c := dec.data[dec.cursor]; c { - case ' ', '\n', '\t', '\r', ',': - continue - case '0', '1', '2', '3', '4', '5', '6', '7', '8', '9': - val, err := dec.getUint16() - if err != nil { - return err - } - *v = val - return nil - case '-': - dec.err = dec.makeInvalidUnmarshalErr(v) - err := dec.skipData() - if err != nil { - return err - } - return nil - case 'n': - dec.cursor++ - err := dec.assertNull() - if err != nil { - return err - } - return nil - default: - dec.err = dec.makeInvalidUnmarshalErr(v) - err := dec.skipData() - if err != nil { - return err - } - return nil - } - } - return dec.raiseInvalidJSONErr(dec.cursor) -} -func (dec *Decoder) decodeUint16Null(v **uint16) error { - for ; dec.cursor < dec.length || dec.read(); dec.cursor++ { - switch c := dec.data[dec.cursor]; c { - case ' ', '\n', '\t', '\r', ',': - continue - case '0', '1', '2', '3', '4', '5', '6', '7', '8', '9': - val, err := dec.getUint16() - if err != nil { - return err - } - if *v == nil { - *v = new(uint16) - } - **v = val - return nil - case '-': - dec.err = dec.makeInvalidUnmarshalErr(v) - err := dec.skipData() - if err != nil { - return err - } - if *v == nil { - *v = new(uint16) - } - return nil - case 'n': - dec.cursor++ - err := dec.assertNull() - if err != nil { - return err - } - return nil - default: - dec.err = dec.makeInvalidUnmarshalErr(v) - err := dec.skipData() - if err != nil { - return err - } - return nil - } - } - return dec.raiseInvalidJSONErr(dec.cursor) -} - -func (dec *Decoder) getUint16() (uint16, error) { - var end = dec.cursor - var start = dec.cursor - // look for following numbers - for j := dec.cursor + 1; j < dec.length || dec.read(); j++ { - switch dec.data[j] { - case '0', '1', '2', '3', '4', '5', '6', '7', '8', '9': - end = j - continue - case ' ', '\n', '\t', '\r': - continue - case '.', ',', '}', ']': - dec.cursor = j - return dec.atoui16(start, end), nil - } - // invalid json we expect numbers, dot (single one), comma, or spaces - return 0, dec.raiseInvalidJSONErr(dec.cursor) - } - return dec.atoui16(start, end), nil -} - -// DecodeUint32 reads the next JSON-encoded value from the decoder's input (io.Reader) and stores it in the uint32 pointed to by v. -// -// See the documentation for Unmarshal for details about the conversion of JSON into a Go value. -func (dec *Decoder) DecodeUint32(v *uint32) error { - if dec.isPooled == 1 { - panic(InvalidUsagePooledDecoderError("Invalid usage of pooled decoder")) - } - return dec.decodeUint32(v) -} - -func (dec *Decoder) decodeUint32(v *uint32) error { - for ; dec.cursor < dec.length || dec.read(); dec.cursor++ { - switch c := dec.data[dec.cursor]; c { - case ' ', '\n', '\t', '\r', ',': - continue - case '0', '1', '2', '3', '4', '5', '6', '7', '8', '9': - val, err := dec.getUint32() - if err != nil { - return err - } - *v = val - return nil - case '-': - dec.err = dec.makeInvalidUnmarshalErr(v) - err := dec.skipData() - if err != nil { - return err - } - return nil - case 'n': - dec.cursor++ - err := dec.assertNull() - if err != nil { - return err - } - return nil - default: - dec.err = dec.makeInvalidUnmarshalErr(v) - err := dec.skipData() - if err != nil { - return err - } - return nil - } - } - return dec.raiseInvalidJSONErr(dec.cursor) -} -func (dec *Decoder) decodeUint32Null(v **uint32) error { - for ; dec.cursor < dec.length || dec.read(); dec.cursor++ { - switch c := dec.data[dec.cursor]; c { - case ' ', '\n', '\t', '\r', ',': - continue - case '0', '1', '2', '3', '4', '5', '6', '7', '8', '9': - val, err := dec.getUint32() - if err != nil { - return err - } - if *v == nil { - *v = new(uint32) - } - **v = val - return nil - case '-': - dec.err = dec.makeInvalidUnmarshalErr(v) - err := dec.skipData() - if err != nil { - return err - } - if *v == nil { - *v = new(uint32) - } - return nil - case 'n': - dec.cursor++ - err := dec.assertNull() - if err != nil { - return err - } - return nil - default: - dec.err = dec.makeInvalidUnmarshalErr(v) - err := dec.skipData() - if err != nil { - return err - } - return nil - } - } - return dec.raiseInvalidJSONErr(dec.cursor) -} - -func (dec *Decoder) getUint32() (uint32, error) { - var end = dec.cursor - var start = dec.cursor - // look for following numbers - for j := dec.cursor + 1; j < dec.length || dec.read(); j++ { - switch dec.data[j] { - case '0', '1', '2', '3', '4', '5', '6', '7', '8', '9': - end = j - continue - case ' ', '\n', '\t', '\r': - continue - case '.', ',', '}', ']': - dec.cursor = j - return dec.atoui32(start, end), nil - } - // invalid json we expect numbers, dot (single one), comma, or spaces - return 0, dec.raiseInvalidJSONErr(dec.cursor) - } - return dec.atoui32(start, end), nil -} - -// DecodeUint64 reads the next JSON-encoded value from the decoder's input (io.Reader) and stores it in the uint64 pointed to by v. -// -// See the documentation for Unmarshal for details about the conversion of JSON into a Go value. -func (dec *Decoder) DecodeUint64(v *uint64) error { - if dec.isPooled == 1 { - panic(InvalidUsagePooledDecoderError("Invalid usage of pooled decoder")) - } - return dec.decodeUint64(v) -} -func (dec *Decoder) decodeUint64(v *uint64) error { - for ; dec.cursor < dec.length || dec.read(); dec.cursor++ { - switch c := dec.data[dec.cursor]; c { - case ' ', '\n', '\t', '\r', ',': - continue - case '0', '1', '2', '3', '4', '5', '6', '7', '8', '9': - val, err := dec.getUint64() - if err != nil { - return err - } - *v = val - return nil - case '-': - dec.err = dec.makeInvalidUnmarshalErr(v) - err := dec.skipData() - if err != nil { - return err - } - return nil - case 'n': - dec.cursor++ - err := dec.assertNull() - if err != nil { - return err - } - return nil - default: - dec.err = dec.makeInvalidUnmarshalErr(v) - err := dec.skipData() - if err != nil { - return err - } - return nil - } - } - return dec.raiseInvalidJSONErr(dec.cursor) -} -func (dec *Decoder) decodeUint64Null(v **uint64) error { - for ; dec.cursor < dec.length || dec.read(); dec.cursor++ { - switch c := dec.data[dec.cursor]; c { - case ' ', '\n', '\t', '\r', ',': - continue - case '0', '1', '2', '3', '4', '5', '6', '7', '8', '9': - val, err := dec.getUint64() - if err != nil { - return err - } - if *v == nil { - *v = new(uint64) - } - **v = val - return nil - case '-': - dec.err = dec.makeInvalidUnmarshalErr(v) - err := dec.skipData() - if err != nil { - return err - } - if *v == nil { - *v = new(uint64) - } - return nil - case 'n': - dec.cursor++ - err := dec.assertNull() - if err != nil { - return err - } - return nil - default: - dec.err = dec.makeInvalidUnmarshalErr(v) - err := dec.skipData() - if err != nil { - return err - } - return nil - } - } - return dec.raiseInvalidJSONErr(dec.cursor) -} - -func (dec *Decoder) getUint64() (uint64, error) { - var end = dec.cursor - var start = dec.cursor - // look for following numbers - for j := dec.cursor + 1; j < dec.length || dec.read(); j++ { - switch dec.data[j] { - case '0', '1', '2', '3', '4', '5', '6', '7', '8', '9': - end = j - continue - case ' ', '\n', '\t', '\r', '.', ',', '}', ']': - dec.cursor = j - return dec.atoui64(start, end), nil - } - // invalid json we expect numbers, dot (single one), comma, or spaces - return 0, dec.raiseInvalidJSONErr(dec.cursor) - } - return dec.atoui64(start, end), nil -} - -func (dec *Decoder) atoui64(start, end int) uint64 { - var ll = end + 1 - start - var val = uint64(digits[dec.data[start]]) - end = end + 1 - if ll < maxUint64Length { - for i := start + 1; i < end; i++ { - uintv := uint64(digits[dec.data[i]]) - val = (val << 3) + (val << 1) + uintv - } - } else if ll == maxUint64Length { - for i := start + 1; i < end; i++ { - uintv := uint64(digits[dec.data[i]]) - if val > maxUint64toMultiply { - dec.err = dec.makeInvalidUnmarshalErr(val) - return 0 - } - val = (val << 3) + (val << 1) - if math.MaxUint64-val < uintv { - dec.err = dec.makeInvalidUnmarshalErr(val) - return 0 - } - val += uintv - } - } else { - dec.err = dec.makeInvalidUnmarshalErr(val) - return 0 - } - return val -} - -func (dec *Decoder) atoui32(start, end int) uint32 { - var ll = end + 1 - start - var val uint32 - val = uint32(digits[dec.data[start]]) - end = end + 1 - if ll < maxUint32Length { - for i := start + 1; i < end; i++ { - uintv := uint32(digits[dec.data[i]]) - val = (val << 3) + (val << 1) + uintv - } - } else if ll == maxUint32Length { - for i := start + 1; i < end; i++ { - uintv := uint32(digits[dec.data[i]]) - if val > maxUint32toMultiply { - dec.err = dec.makeInvalidUnmarshalErr(val) - return 0 - } - val = (val << 3) + (val << 1) - if math.MaxUint32-val < uintv { - dec.err = dec.makeInvalidUnmarshalErr(val) - return 0 - } - val += uintv - } - } else if ll > maxUint32Length { - dec.err = dec.makeInvalidUnmarshalErr(val) - val = 0 - } - return val -} - -func (dec *Decoder) atoui16(start, end int) uint16 { - var ll = end + 1 - start - var val uint16 - val = uint16(digits[dec.data[start]]) - end = end + 1 - if ll < maxUint16Length { - for i := start + 1; i < end; i++ { - uintv := uint16(digits[dec.data[i]]) - val = (val << 3) + (val << 1) + uintv - } - } else if ll == maxUint16Length { - for i := start + 1; i < end; i++ { - uintv := uint16(digits[dec.data[i]]) - if val > maxUint16toMultiply { - dec.err = dec.makeInvalidUnmarshalErr(val) - return 0 - } - val = (val << 3) + (val << 1) - if math.MaxUint16-val < uintv { - dec.err = dec.makeInvalidUnmarshalErr(val) - return 0 - } - val += uintv - } - } else if ll > maxUint16Length { - dec.err = dec.makeInvalidUnmarshalErr(val) - val = 0 - } - return val -} - -func (dec *Decoder) atoui8(start, end int) uint8 { - var ll = end + 1 - start - var val uint8 - val = uint8(digits[dec.data[start]]) - end = end + 1 - if ll < maxUint8Length { - for i := start + 1; i < end; i++ { - uintv := uint8(digits[dec.data[i]]) - val = (val << 3) + (val << 1) + uintv - } - } else if ll == maxUint8Length { - for i := start + 1; i < end; i++ { - uintv := uint8(digits[dec.data[i]]) - if val > maxUint8toMultiply { - dec.err = dec.makeInvalidUnmarshalErr(val) - return 0 - } - val = (val << 3) + (val << 1) - if math.MaxUint8-val < uintv { - dec.err = dec.makeInvalidUnmarshalErr(val) - return 0 - } - val += uintv - } - } else if ll > maxUint8Length { - dec.err = dec.makeInvalidUnmarshalErr(val) - val = 0 - } - return val -} - -// Add Values functions - -// AddUint8 decodes the JSON value within an object or an array to an *int. -// If next key value overflows uint8, an InvalidUnmarshalError error will be returned. -func (dec *Decoder) AddUint8(v *uint8) error { - return dec.Uint8(v) -} - -// AddUint8Null decodes the JSON value within an object or an array to an *int. -// If next key value overflows uint8, an InvalidUnmarshalError error will be returned. -// If a `null` is encountered, gojay does not change the value of the pointer. -func (dec *Decoder) AddUint8Null(v **uint8) error { - return dec.Uint8Null(v) -} - -// AddUint16 decodes the JSON value within an object or an array to an *int. -// If next key value overflows uint16, an InvalidUnmarshalError error will be returned. -func (dec *Decoder) AddUint16(v *uint16) error { - return dec.Uint16(v) -} - -// AddUint16Null decodes the JSON value within an object or an array to an *int. -// If next key value overflows uint16, an InvalidUnmarshalError error will be returned. -// If a `null` is encountered, gojay does not change the value of the pointer. -func (dec *Decoder) AddUint16Null(v **uint16) error { - return dec.Uint16Null(v) -} - -// AddUint32 decodes the JSON value within an object or an array to an *int. -// If next key value overflows uint32, an InvalidUnmarshalError error will be returned. -func (dec *Decoder) AddUint32(v *uint32) error { - return dec.Uint32(v) -} - -// AddUint32Null decodes the JSON value within an object or an array to an *int. -// If next key value overflows uint32, an InvalidUnmarshalError error will be returned. -// If a `null` is encountered, gojay does not change the value of the pointer. -func (dec *Decoder) AddUint32Null(v **uint32) error { - return dec.Uint32Null(v) -} - -// AddUint64 decodes the JSON value within an object or an array to an *int. -// If next key value overflows uint64, an InvalidUnmarshalError error will be returned. -func (dec *Decoder) AddUint64(v *uint64) error { - return dec.Uint64(v) -} - -// AddUint64Null decodes the JSON value within an object or an array to an *int. -// If next key value overflows uint64, an InvalidUnmarshalError error will be returned. -// If a `null` is encountered, gojay does not change the value of the pointer. -func (dec *Decoder) AddUint64Null(v **uint64) error { - return dec.Uint64Null(v) -} - -// Uint8 decodes the JSON value within an object or an array to an *int. -// If next key value overflows uint8, an InvalidUnmarshalError error will be returned. -func (dec *Decoder) Uint8(v *uint8) error { - err := dec.decodeUint8(v) - if err != nil { - return err - } - dec.called |= 1 - return nil -} - -// Uint8Null decodes the JSON value within an object or an array to an *int. -// If next key value overflows uint8, an InvalidUnmarshalError error will be returned. -func (dec *Decoder) Uint8Null(v **uint8) error { - err := dec.decodeUint8Null(v) - if err != nil { - return err - } - dec.called |= 1 - return nil -} - -// Uint16 decodes the JSON value within an object or an array to an *int. -// If next key value overflows uint16, an InvalidUnmarshalError error will be returned. -func (dec *Decoder) Uint16(v *uint16) error { - err := dec.decodeUint16(v) - if err != nil { - return err - } - dec.called |= 1 - return nil -} - -// Uint16Null decodes the JSON value within an object or an array to an *int. -// If next key value overflows uint16, an InvalidUnmarshalError error will be returned. -func (dec *Decoder) Uint16Null(v **uint16) error { - err := dec.decodeUint16Null(v) - if err != nil { - return err - } - dec.called |= 1 - return nil -} - -// Uint32 decodes the JSON value within an object or an array to an *int. -// If next key value overflows uint32, an InvalidUnmarshalError error will be returned. -func (dec *Decoder) Uint32(v *uint32) error { - err := dec.decodeUint32(v) - if err != nil { - return err - } - dec.called |= 1 - return nil -} - -// Uint32Null decodes the JSON value within an object or an array to an *int. -// If next key value overflows uint32, an InvalidUnmarshalError error will be returned. -func (dec *Decoder) Uint32Null(v **uint32) error { - err := dec.decodeUint32Null(v) - if err != nil { - return err - } - dec.called |= 1 - return nil -} - -// Uint64 decodes the JSON value within an object or an array to an *int. -// If next key value overflows uint64, an InvalidUnmarshalError error will be returned. -func (dec *Decoder) Uint64(v *uint64) error { - err := dec.decodeUint64(v) - if err != nil { - return err - } - dec.called |= 1 - return nil -} - -// Uint64Null decodes the JSON value within an object or an array to an *int. -// If next key value overflows uint64, an InvalidUnmarshalError error will be returned. -func (dec *Decoder) Uint64Null(v **uint64) error { - err := dec.decodeUint64Null(v) - if err != nil { - return err - } - dec.called |= 1 - return nil -} diff --git a/vendor/github.com/francoispqt/gojay/decode_object.go b/vendor/github.com/francoispqt/gojay/decode_object.go deleted file mode 100644 index 0fec9d24ed..0000000000 --- a/vendor/github.com/francoispqt/gojay/decode_object.go +++ /dev/null @@ -1,407 +0,0 @@ -package gojay - -import ( - "reflect" - "unsafe" -) - -// DecodeObject reads the next JSON-encoded value from the decoder's input (io.Reader) and stores it in the value pointed to by v. -// -// v must implement UnmarshalerJSONObject. -// -// See the documentation for Unmarshal for details about the conversion of JSON into a Go value. -func (dec *Decoder) DecodeObject(j UnmarshalerJSONObject) error { - if dec.isPooled == 1 { - panic(InvalidUsagePooledDecoderError("Invalid usage of pooled decoder")) - } - _, err := dec.decodeObject(j) - return err -} -func (dec *Decoder) decodeObject(j UnmarshalerJSONObject) (int, error) { - keys := j.NKeys() - for ; dec.cursor < dec.length || dec.read(); dec.cursor++ { - switch dec.data[dec.cursor] { - case ' ', '\n', '\t', '\r', ',': - case '{': - dec.cursor = dec.cursor + 1 - // if keys is zero we will parse all keys - // we run two loops for micro optimization - if keys == 0 { - for dec.cursor < dec.length || dec.read() { - k, done, err := dec.nextKey() - if err != nil { - return 0, err - } else if done { - return dec.cursor, nil - } - err = j.UnmarshalJSONObject(dec, k) - if err != nil { - dec.err = err - return 0, err - } else if dec.called&1 == 0 { - err := dec.skipData() - if err != nil { - return 0, err - } - } else { - dec.keysDone++ - } - dec.called &= 0 - } - } else { - for (dec.cursor < dec.length || dec.read()) && dec.keysDone < keys { - k, done, err := dec.nextKey() - if err != nil { - return 0, err - } else if done { - return dec.cursor, nil - } - err = j.UnmarshalJSONObject(dec, k) - if err != nil { - dec.err = err - return 0, err - } else if dec.called&1 == 0 { - err := dec.skipData() - if err != nil { - return 0, err - } - } else { - dec.keysDone++ - } - dec.called &= 0 - } - } - // will get to that point when keysDone is not lower than keys anymore - // in that case, we make sure cursor goes to the end of object, but we skip - // unmarshalling - if dec.child&1 != 0 { - end, err := dec.skipObject() - dec.cursor = end - return dec.cursor, err - } - return dec.cursor, nil - case 'n': - dec.cursor++ - err := dec.assertNull() - if err != nil { - return 0, err - } - return dec.cursor, nil - default: - // can't unmarshal to struct - dec.err = dec.makeInvalidUnmarshalErr(j) - err := dec.skipData() - if err != nil { - return 0, err - } - return dec.cursor, nil - } - } - return 0, dec.raiseInvalidJSONErr(dec.cursor) -} - -func (dec *Decoder) decodeObjectNull(v interface{}) (int, error) { - // make sure the value is a pointer - vv := reflect.ValueOf(v) - vvt := vv.Type() - if vvt.Kind() != reflect.Ptr || vvt.Elem().Kind() != reflect.Ptr { - dec.err = ErrUnmarshalPtrExpected - return 0, dec.err - } - for ; dec.cursor < dec.length || dec.read(); dec.cursor++ { - switch dec.data[dec.cursor] { - case ' ', '\n', '\t', '\r', ',': - case '{': - elt := vv.Elem() - n := reflect.New(elt.Type().Elem()) - elt.Set(n) - var j UnmarshalerJSONObject - var ok bool - if j, ok = n.Interface().(UnmarshalerJSONObject); !ok { - dec.err = dec.makeInvalidUnmarshalErr((UnmarshalerJSONObject)(nil)) - return 0, dec.err - } - keys := j.NKeys() - dec.cursor = dec.cursor + 1 - // if keys is zero we will parse all keys - // we run two loops for micro optimization - if keys == 0 { - for dec.cursor < dec.length || dec.read() { - k, done, err := dec.nextKey() - if err != nil { - return 0, err - } else if done { - return dec.cursor, nil - } - err = j.UnmarshalJSONObject(dec, k) - if err != nil { - dec.err = err - return 0, err - } else if dec.called&1 == 0 { - err := dec.skipData() - if err != nil { - return 0, err - } - } else { - dec.keysDone++ - } - dec.called &= 0 - } - } else { - for (dec.cursor < dec.length || dec.read()) && dec.keysDone < keys { - k, done, err := dec.nextKey() - if err != nil { - return 0, err - } else if done { - return dec.cursor, nil - } - err = j.UnmarshalJSONObject(dec, k) - if err != nil { - dec.err = err - return 0, err - } else if dec.called&1 == 0 { - err := dec.skipData() - if err != nil { - return 0, err - } - } else { - dec.keysDone++ - } - dec.called &= 0 - } - } - // will get to that point when keysDone is not lower than keys anymore - // in that case, we make sure cursor goes to the end of object, but we skip - // unmarshalling - if dec.child&1 != 0 { - end, err := dec.skipObject() - dec.cursor = end - return dec.cursor, err - } - return dec.cursor, nil - case 'n': - dec.cursor++ - err := dec.assertNull() - if err != nil { - return 0, err - } - return dec.cursor, nil - default: - // can't unmarshal to struct - dec.err = dec.makeInvalidUnmarshalErr((UnmarshalerJSONObject)(nil)) - err := dec.skipData() - if err != nil { - return 0, err - } - return dec.cursor, nil - } - } - return 0, dec.raiseInvalidJSONErr(dec.cursor) -} - -func (dec *Decoder) skipObject() (int, error) { - var objectsOpen = 1 - var objectsClosed = 0 - for j := dec.cursor; j < dec.length || dec.read(); j++ { - switch dec.data[j] { - case '}': - objectsClosed++ - // everything is closed return - if objectsOpen == objectsClosed { - // add char to object data - return j + 1, nil - } - case '{': - objectsOpen++ - case '"': - j++ - var isInEscapeSeq bool - var isFirstQuote = true - for ; j < dec.length || dec.read(); j++ { - if dec.data[j] != '"' { - continue - } - if dec.data[j-1] != '\\' || (!isInEscapeSeq && !isFirstQuote) { - break - } else { - isInEscapeSeq = false - } - if isFirstQuote { - isFirstQuote = false - } - // loop backward and count how many anti slash found - // to see if string is effectively escaped - ct := 0 - for i := j - 1; i > 0; i-- { - if dec.data[i] != '\\' { - break - } - ct++ - } - // is pair number of slashes, quote is not escaped - if ct&1 == 0 { - break - } - isInEscapeSeq = true - } - default: - continue - } - } - return 0, dec.raiseInvalidJSONErr(dec.cursor) -} - -func (dec *Decoder) nextKey() (string, bool, error) { - for ; dec.cursor < dec.length || dec.read(); dec.cursor++ { - switch dec.data[dec.cursor] { - case ' ', '\n', '\t', '\r', ',': - continue - case '"': - dec.cursor = dec.cursor + 1 - start, end, err := dec.getString() - if err != nil { - return "", false, err - } - var found byte - for ; dec.cursor < dec.length || dec.read(); dec.cursor++ { - if dec.data[dec.cursor] == ':' { - found |= 1 - break - } - } - if found&1 != 0 { - dec.cursor++ - d := dec.data[start : end-1] - return *(*string)(unsafe.Pointer(&d)), false, nil - } - return "", false, dec.raiseInvalidJSONErr(dec.cursor) - case '}': - dec.cursor = dec.cursor + 1 - return "", true, nil - default: - // can't unmarshall to struct - return "", false, dec.raiseInvalidJSONErr(dec.cursor) - } - } - return "", false, dec.raiseInvalidJSONErr(dec.cursor) -} - -func (dec *Decoder) skipData() error { - for ; dec.cursor < dec.length || dec.read(); dec.cursor++ { - switch dec.data[dec.cursor] { - case ' ', '\n', '\t', '\r', ',': - continue - // is null - case 'n': - dec.cursor++ - err := dec.assertNull() - if err != nil { - return err - } - return nil - case 't': - dec.cursor++ - err := dec.assertTrue() - if err != nil { - return err - } - return nil - // is false - case 'f': - dec.cursor++ - err := dec.assertFalse() - if err != nil { - return err - } - return nil - // is an object - case '{': - dec.cursor = dec.cursor + 1 - end, err := dec.skipObject() - dec.cursor = end - return err - // is string - case '"': - dec.cursor = dec.cursor + 1 - err := dec.skipString() - return err - // is array - case '[': - dec.cursor = dec.cursor + 1 - end, err := dec.skipArray() - dec.cursor = end - return err - case '0', '1', '2', '3', '4', '5', '6', '7', '8', '9', '-': - end, err := dec.skipNumber() - dec.cursor = end - return err - } - return dec.raiseInvalidJSONErr(dec.cursor) - } - return dec.raiseInvalidJSONErr(dec.cursor) -} - -// DecodeObjectFunc is a func type implementing UnmarshalerJSONObject. -// Use it to cast a `func(*Decoder, k string) error` to Unmarshal an object on the fly. -type DecodeObjectFunc func(*Decoder, string) error - -// UnmarshalJSONObject implements UnmarshalerJSONObject. -func (f DecodeObjectFunc) UnmarshalJSONObject(dec *Decoder, k string) error { - return f(dec, k) -} - -// NKeys implements UnmarshalerJSONObject. -func (f DecodeObjectFunc) NKeys() int { - return 0 -} - -// Add Values functions - -// AddObject decodes the JSON value within an object or an array to a UnmarshalerJSONObject. -func (dec *Decoder) AddObject(v UnmarshalerJSONObject) error { - return dec.Object(v) -} - -// AddObjectNull decodes the JSON value within an object or an array to a UnmarshalerJSONObject. -func (dec *Decoder) AddObjectNull(v interface{}) error { - return dec.ObjectNull(v) -} - -// Object decodes the JSON value within an object or an array to a UnmarshalerJSONObject. -func (dec *Decoder) Object(value UnmarshalerJSONObject) error { - initialKeysDone := dec.keysDone - initialChild := dec.child - dec.keysDone = 0 - dec.called = 0 - dec.child |= 1 - newCursor, err := dec.decodeObject(value) - if err != nil { - return err - } - dec.cursor = newCursor - dec.keysDone = initialKeysDone - dec.child = initialChild - dec.called |= 1 - return nil -} - -// ObjectNull decodes the JSON value within an object or an array to a UnmarshalerJSONObject. -// v should be a pointer to an UnmarshalerJSONObject, -// if `null` value is encountered in JSON, it will leave the value v untouched, -// else it will create a new instance of the UnmarshalerJSONObject behind v. -func (dec *Decoder) ObjectNull(v interface{}) error { - initialKeysDone := dec.keysDone - initialChild := dec.child - dec.keysDone = 0 - dec.called = 0 - dec.child |= 1 - newCursor, err := dec.decodeObjectNull(v) - if err != nil { - return err - } - dec.cursor = newCursor - dec.keysDone = initialKeysDone - dec.child = initialChild - dec.called |= 1 - return nil -} diff --git a/vendor/github.com/francoispqt/gojay/decode_pool.go b/vendor/github.com/francoispqt/gojay/decode_pool.go deleted file mode 100644 index 68c57138a6..0000000000 --- a/vendor/github.com/francoispqt/gojay/decode_pool.go +++ /dev/null @@ -1,64 +0,0 @@ -package gojay - -import ( - "io" - "sync" -) - -var decPool = sync.Pool{ - New: newDecoderPool, -} - -func init() { - for i := 0; i < 32; i++ { - decPool.Put(NewDecoder(nil)) - } -} - -// NewDecoder returns a new decoder. -// It takes an io.Reader implementation as data input. -func NewDecoder(r io.Reader) *Decoder { - return &Decoder{ - called: 0, - cursor: 0, - keysDone: 0, - err: nil, - r: r, - data: make([]byte, 512), - length: 0, - isPooled: 0, - } -} -func newDecoderPool() interface{} { - return NewDecoder(nil) -} - -// BorrowDecoder borrows a Decoder from the pool. -// It takes an io.Reader implementation as data input. -// -// In order to benefit from the pool, a borrowed decoder must be released after usage. -func BorrowDecoder(r io.Reader) *Decoder { - return borrowDecoder(r, 512) -} -func borrowDecoder(r io.Reader, bufSize int) *Decoder { - dec := decPool.Get().(*Decoder) - dec.called = 0 - dec.keysDone = 0 - dec.cursor = 0 - dec.err = nil - dec.r = r - dec.length = 0 - dec.isPooled = 0 - if bufSize > 0 { - dec.data = make([]byte, bufSize) - } - return dec -} - -// Release sends back a Decoder to the pool. -// If a decoder is used after calling Release -// a panic will be raised with an InvalidUsagePooledDecoderError error. -func (dec *Decoder) Release() { - dec.isPooled = 1 - decPool.Put(dec) -} diff --git a/vendor/github.com/francoispqt/gojay/decode_slice.go b/vendor/github.com/francoispqt/gojay/decode_slice.go deleted file mode 100644 index dbbb4bf3aa..0000000000 --- a/vendor/github.com/francoispqt/gojay/decode_slice.go +++ /dev/null @@ -1,89 +0,0 @@ -package gojay - -// AddSliceString unmarshals the next JSON array of strings to the given *[]string s -func (dec *Decoder) AddSliceString(s *[]string) error { - return dec.SliceString(s) -} - -// SliceString unmarshals the next JSON array of strings to the given *[]string s -func (dec *Decoder) SliceString(s *[]string) error { - err := dec.Array(DecodeArrayFunc(func(dec *Decoder) error { - var str string - if err := dec.String(&str); err != nil { - return err - } - *s = append(*s, str) - return nil - })) - - if err != nil { - return err - } - return nil -} - -// AddSliceInt unmarshals the next JSON array of integers to the given *[]int s -func (dec *Decoder) AddSliceInt(s *[]int) error { - return dec.SliceInt(s) -} - -// SliceInt unmarshals the next JSON array of integers to the given *[]int s -func (dec *Decoder) SliceInt(s *[]int) error { - err := dec.Array(DecodeArrayFunc(func(dec *Decoder) error { - var i int - if err := dec.Int(&i); err != nil { - return err - } - *s = append(*s, i) - return nil - })) - - if err != nil { - return err - } - return nil -} - -// AddFloat64 unmarshals the next JSON array of floats to the given *[]float64 s -func (dec *Decoder) AddSliceFloat64(s *[]float64) error { - return dec.SliceFloat64(s) -} - -// SliceFloat64 unmarshals the next JSON array of floats to the given *[]float64 s -func (dec *Decoder) SliceFloat64(s *[]float64) error { - err := dec.Array(DecodeArrayFunc(func(dec *Decoder) error { - var i float64 - if err := dec.Float64(&i); err != nil { - return err - } - *s = append(*s, i) - return nil - })) - - if err != nil { - return err - } - return nil -} - -// AddBool unmarshals the next JSON array of boolegers to the given *[]bool s -func (dec *Decoder) AddSliceBool(s *[]bool) error { - return dec.SliceBool(s) -} - -// SliceBool unmarshals the next JSON array of boolegers to the given *[]bool s -func (dec *Decoder) SliceBool(s *[]bool) error { - err := dec.Array(DecodeArrayFunc(func(dec *Decoder) error { - var b bool - if err := dec.Bool(&b); err != nil { - return err - } - *s = append(*s, b) - return nil - })) - - if err != nil { - return err - } - return nil -} diff --git a/vendor/github.com/francoispqt/gojay/decode_sqlnull.go b/vendor/github.com/francoispqt/gojay/decode_sqlnull.go deleted file mode 100644 index c25549f52b..0000000000 --- a/vendor/github.com/francoispqt/gojay/decode_sqlnull.go +++ /dev/null @@ -1,157 +0,0 @@ -package gojay - -import "database/sql" - -// DecodeSQLNullString decodes a sql.NullString -func (dec *Decoder) DecodeSQLNullString(v *sql.NullString) error { - if dec.isPooled == 1 { - panic(InvalidUsagePooledDecoderError("Invalid usage of pooled decoder")) - } - return dec.decodeSQLNullString(v) -} - -func (dec *Decoder) decodeSQLNullString(v *sql.NullString) error { - var str string - if err := dec.decodeString(&str); err != nil { - return err - } - v.String = str - v.Valid = true - return nil -} - -// DecodeSQLNullInt64 decodes a sql.NullInt64 -func (dec *Decoder) DecodeSQLNullInt64(v *sql.NullInt64) error { - if dec.isPooled == 1 { - panic(InvalidUsagePooledDecoderError("Invalid usage of pooled decoder")) - } - return dec.decodeSQLNullInt64(v) -} - -func (dec *Decoder) decodeSQLNullInt64(v *sql.NullInt64) error { - var i int64 - if err := dec.decodeInt64(&i); err != nil { - return err - } - v.Int64 = i - v.Valid = true - return nil -} - -// DecodeSQLNullFloat64 decodes a sql.NullString with the given format -func (dec *Decoder) DecodeSQLNullFloat64(v *sql.NullFloat64) error { - if dec.isPooled == 1 { - panic(InvalidUsagePooledDecoderError("Invalid usage of pooled decoder")) - } - return dec.decodeSQLNullFloat64(v) -} - -func (dec *Decoder) decodeSQLNullFloat64(v *sql.NullFloat64) error { - var i float64 - if err := dec.decodeFloat64(&i); err != nil { - return err - } - v.Float64 = i - v.Valid = true - return nil -} - -// DecodeSQLNullBool decodes a sql.NullString with the given format -func (dec *Decoder) DecodeSQLNullBool(v *sql.NullBool) error { - if dec.isPooled == 1 { - panic(InvalidUsagePooledDecoderError("Invalid usage of pooled decoder")) - } - return dec.decodeSQLNullBool(v) -} - -func (dec *Decoder) decodeSQLNullBool(v *sql.NullBool) error { - var b bool - if err := dec.decodeBool(&b); err != nil { - return err - } - v.Bool = b - v.Valid = true - return nil -} - -// Add Values functions - -// AddSQLNullString decodes the JSON value within an object or an array to qn *sql.NullString -func (dec *Decoder) AddSQLNullString(v *sql.NullString) error { - return dec.SQLNullString(v) -} - -// SQLNullString decodes the JSON value within an object or an array to an *sql.NullString -func (dec *Decoder) SQLNullString(v *sql.NullString) error { - var b *string - if err := dec.StringNull(&b); err != nil { - return err - } - if b == nil { - v.Valid = false - } else { - v.String = *b - v.Valid = true - } - return nil -} - -// AddSQLNullInt64 decodes the JSON value within an object or an array to qn *sql.NullInt64 -func (dec *Decoder) AddSQLNullInt64(v *sql.NullInt64) error { - return dec.SQLNullInt64(v) -} - -// SQLNullInt64 decodes the JSON value within an object or an array to an *sql.NullInt64 -func (dec *Decoder) SQLNullInt64(v *sql.NullInt64) error { - var b *int64 - if err := dec.Int64Null(&b); err != nil { - return err - } - if b == nil { - v.Valid = false - } else { - v.Int64 = *b - v.Valid = true - } - return nil -} - -// AddSQLNullFloat64 decodes the JSON value within an object or an array to qn *sql.NullFloat64 -func (dec *Decoder) AddSQLNullFloat64(v *sql.NullFloat64) error { - return dec.SQLNullFloat64(v) -} - -// SQLNullFloat64 decodes the JSON value within an object or an array to an *sql.NullFloat64 -func (dec *Decoder) SQLNullFloat64(v *sql.NullFloat64) error { - var b *float64 - if err := dec.Float64Null(&b); err != nil { - return err - } - if b == nil { - v.Valid = false - } else { - v.Float64 = *b - v.Valid = true - } - return nil -} - -// AddSQLNullBool decodes the JSON value within an object or an array to an *sql.NullBool -func (dec *Decoder) AddSQLNullBool(v *sql.NullBool) error { - return dec.SQLNullBool(v) -} - -// SQLNullBool decodes the JSON value within an object or an array to an *sql.NullBool -func (dec *Decoder) SQLNullBool(v *sql.NullBool) error { - var b *bool - if err := dec.BoolNull(&b); err != nil { - return err - } - if b == nil { - v.Valid = false - } else { - v.Bool = *b - v.Valid = true - } - return nil -} diff --git a/vendor/github.com/francoispqt/gojay/decode_stream.go b/vendor/github.com/francoispqt/gojay/decode_stream.go deleted file mode 100644 index 74beee4d75..0000000000 --- a/vendor/github.com/francoispqt/gojay/decode_stream.go +++ /dev/null @@ -1,115 +0,0 @@ -package gojay - -import ( - "sync" - "time" -) - -// UnmarshalerStream is the interface to implement for a slice, an array or a slice -// to decode a line delimited JSON to. -type UnmarshalerStream interface { - UnmarshalStream(*StreamDecoder) error -} - -// Stream is a struct holding the Stream api -var Stream = stream{} - -type stream struct{} - -// A StreamDecoder reads and decodes JSON values from an input stream. -// -// It implements conext.Context and provide a channel to notify interruption. -type StreamDecoder struct { - mux sync.RWMutex - *Decoder - done chan struct{} - deadline *time.Time -} - -// DecodeStream reads the next line delimited JSON-encoded value from the decoder's input (io.Reader) and stores it in the value pointed to by c. -// -// c must implement UnmarshalerStream. Ideally c is a channel. See example for implementation. -// -// See the documentation for Unmarshal for details about the conversion of JSON into a Go value. -func (dec *StreamDecoder) DecodeStream(c UnmarshalerStream) error { - if dec.isPooled == 1 { - panic(InvalidUsagePooledDecoderError("Invalid usage of pooled decoder")) - } - if dec.r == nil { - dec.err = NoReaderError("No reader given to decode stream") - close(dec.done) - return dec.err - } - for ; dec.cursor < dec.length || dec.read(); dec.cursor++ { - switch dec.data[dec.cursor] { - case ' ', '\n', '\t', '\r', ',': - continue - default: - // char is not space start reading - for dec.nextChar() != 0 { - // calling unmarshal stream - err := c.UnmarshalStream(dec) - if err != nil { - dec.err = err - close(dec.done) - return err - } - // garbage collects buffer - // we don't want the buffer to grow extensively - dec.data = dec.data[dec.cursor:] - dec.length = dec.length - dec.cursor - dec.cursor = 0 - } - // close the done channel to signal the end of the job - close(dec.done) - return nil - } - } - close(dec.done) - dec.mux.Lock() - err := dec.raiseInvalidJSONErr(dec.cursor) - dec.mux.Unlock() - return err -} - -// context.Context implementation - -// Done returns a channel that's closed when work is done. -// It implements context.Context -func (dec *StreamDecoder) Done() <-chan struct{} { - return dec.done -} - -// Deadline returns the time when work done on behalf of this context -// should be canceled. Deadline returns ok==false when no deadline is -// set. Successive calls to Deadline return the same results. -func (dec *StreamDecoder) Deadline() (time.Time, bool) { - if dec.deadline != nil { - return *dec.deadline, true - } - return time.Time{}, false -} - -// SetDeadline sets the deadline -func (dec *StreamDecoder) SetDeadline(t time.Time) { - dec.deadline = &t -} - -// Err returns nil if Done is not yet closed. -// If Done is closed, Err returns a non-nil error explaining why. -// It implements context.Context -func (dec *StreamDecoder) Err() error { - select { - case <-dec.done: - dec.mux.RLock() - defer dec.mux.RUnlock() - return dec.err - default: - return nil - } -} - -// Value implements context.Context -func (dec *StreamDecoder) Value(key interface{}) interface{} { - return nil -} diff --git a/vendor/github.com/francoispqt/gojay/decode_stream_pool.go b/vendor/github.com/francoispqt/gojay/decode_stream_pool.go deleted file mode 100644 index 8e1863b920..0000000000 --- a/vendor/github.com/francoispqt/gojay/decode_stream_pool.go +++ /dev/null @@ -1,59 +0,0 @@ -package gojay - -import ( - "io" - "sync" -) - -var streamDecPool = sync.Pool{ - New: newStreamDecoderPool, -} - -// NewDecoder returns a new StreamDecoder. -// It takes an io.Reader implementation as data input. -// It initiates the done channel returned by Done(). -func (s stream) NewDecoder(r io.Reader) *StreamDecoder { - dec := NewDecoder(r) - streamDec := &StreamDecoder{ - Decoder: dec, - done: make(chan struct{}, 1), - mux: sync.RWMutex{}, - } - return streamDec -} -func newStreamDecoderPool() interface{} { - return Stream.NewDecoder(nil) -} - -// BorrowDecoder borrows a StreamDecoder from the pool. -// It takes an io.Reader implementation as data input. -// It initiates the done channel returned by Done(). -// -// If no StreamEncoder is available in the pool, it returns a fresh one -func (s stream) BorrowDecoder(r io.Reader) *StreamDecoder { - return s.borrowDecoder(r, 512) -} - -func (s stream) borrowDecoder(r io.Reader, bufSize int) *StreamDecoder { - streamDec := streamDecPool.Get().(*StreamDecoder) - streamDec.called = 0 - streamDec.keysDone = 0 - streamDec.cursor = 0 - streamDec.err = nil - streamDec.r = r - streamDec.length = 0 - streamDec.isPooled = 0 - streamDec.done = make(chan struct{}, 1) - if bufSize > 0 { - streamDec.data = make([]byte, bufSize) - } - return streamDec -} - -// Release sends back a Decoder to the pool. -// If a decoder is used after calling Release -// a panic will be raised with an InvalidUsagePooledDecoderError error. -func (dec *StreamDecoder) Release() { - dec.isPooled = 1 - streamDecPool.Put(dec) -} diff --git a/vendor/github.com/francoispqt/gojay/decode_string.go b/vendor/github.com/francoispqt/gojay/decode_string.go deleted file mode 100644 index 694359c7b6..0000000000 --- a/vendor/github.com/francoispqt/gojay/decode_string.go +++ /dev/null @@ -1,260 +0,0 @@ -package gojay - -import ( - "unsafe" -) - -// DecodeString reads the next JSON-encoded value from the decoder's input (io.Reader) and stores it in the string pointed to by v. -// -// See the documentation for Unmarshal for details about the conversion of JSON into a Go value. -func (dec *Decoder) DecodeString(v *string) error { - if dec.isPooled == 1 { - panic(InvalidUsagePooledDecoderError("Invalid usage of pooled decoder")) - } - return dec.decodeString(v) -} -func (dec *Decoder) decodeString(v *string) error { - for ; dec.cursor < dec.length || dec.read(); dec.cursor++ { - switch dec.data[dec.cursor] { - case ' ', '\n', '\t', '\r', ',': - // is string - continue - case '"': - dec.cursor++ - start, end, err := dec.getString() - if err != nil { - return err - } - // we do minus one to remove the last quote - d := dec.data[start : end-1] - *v = *(*string)(unsafe.Pointer(&d)) - dec.cursor = end - return nil - // is nil - case 'n': - dec.cursor++ - err := dec.assertNull() - if err != nil { - return err - } - return nil - default: - dec.err = dec.makeInvalidUnmarshalErr(v) - err := dec.skipData() - if err != nil { - return err - } - return nil - } - } - return nil -} - -func (dec *Decoder) decodeStringNull(v **string) error { - for ; dec.cursor < dec.length || dec.read(); dec.cursor++ { - switch dec.data[dec.cursor] { - case ' ', '\n', '\t', '\r', ',': - // is string - continue - case '"': - dec.cursor++ - start, end, err := dec.getString() - - if err != nil { - return err - } - if *v == nil { - *v = new(string) - } - // we do minus one to remove the last quote - d := dec.data[start : end-1] - **v = *(*string)(unsafe.Pointer(&d)) - dec.cursor = end - return nil - // is nil - case 'n': - dec.cursor++ - err := dec.assertNull() - if err != nil { - return err - } - return nil - default: - dec.err = dec.makeInvalidUnmarshalErr(v) - err := dec.skipData() - if err != nil { - return err - } - return nil - } - } - return nil -} - -func (dec *Decoder) parseEscapedString() error { - if dec.cursor >= dec.length && !dec.read() { - return dec.raiseInvalidJSONErr(dec.cursor) - } - switch dec.data[dec.cursor] { - case '"': - dec.data[dec.cursor] = '"' - case '\\': - dec.data[dec.cursor] = '\\' - case '/': - dec.data[dec.cursor] = '/' - case 'b': - dec.data[dec.cursor] = '\b' - case 'f': - dec.data[dec.cursor] = '\f' - case 'n': - dec.data[dec.cursor] = '\n' - case 'r': - dec.data[dec.cursor] = '\r' - case 't': - dec.data[dec.cursor] = '\t' - case 'u': - start := dec.cursor - dec.cursor++ - str, err := dec.parseUnicode() - if err != nil { - return err - } - diff := dec.cursor - start - dec.data = append(append(dec.data[:start-1], str...), dec.data[dec.cursor:]...) - dec.length = len(dec.data) - dec.cursor += len(str) - diff - 1 - - return nil - default: - return dec.raiseInvalidJSONErr(dec.cursor) - } - - dec.data = append(dec.data[:dec.cursor-1], dec.data[dec.cursor:]...) - dec.length-- - - // Since we've lost a character, our dec.cursor offset is now - // 1 past the escaped character which is precisely where we - // want it. - - return nil -} - -func (dec *Decoder) getString() (int, int, error) { - // extract key - var keyStart = dec.cursor - // var str *Builder - for dec.cursor < dec.length || dec.read() { - switch dec.data[dec.cursor] { - // string found - case '"': - dec.cursor = dec.cursor + 1 - return keyStart, dec.cursor, nil - // slash found - case '\\': - dec.cursor = dec.cursor + 1 - err := dec.parseEscapedString() - if err != nil { - return 0, 0, err - } - default: - dec.cursor = dec.cursor + 1 - continue - } - } - return 0, 0, dec.raiseInvalidJSONErr(dec.cursor) -} - -func (dec *Decoder) skipEscapedString() error { - start := dec.cursor - for ; dec.cursor < dec.length || dec.read(); dec.cursor++ { - if dec.data[dec.cursor] != '\\' { - d := dec.data[dec.cursor] - dec.cursor = dec.cursor + 1 - nSlash := dec.cursor - start - switch d { - case '"': - // nSlash must be odd - if nSlash&1 != 1 { - return dec.raiseInvalidJSONErr(dec.cursor) - } - return nil - case 'u': // is unicode, we skip the following characters and place the cursor one one byte backward to avoid it breaking when returning to skipString - if err := dec.skipString(); err != nil { - return err - } - dec.cursor-- - return nil - case 'n', 'r', 't', '/', 'f', 'b': - return nil - default: - // nSlash must be even - if nSlash&1 == 1 { - return dec.raiseInvalidJSONErr(dec.cursor) - } - return nil - } - } - } - return dec.raiseInvalidJSONErr(dec.cursor) -} - -func (dec *Decoder) skipString() error { - for dec.cursor < dec.length || dec.read() { - switch dec.data[dec.cursor] { - // found the closing quote - // let's return - case '"': - dec.cursor = dec.cursor + 1 - return nil - // solidus found start parsing an escaped string - case '\\': - dec.cursor = dec.cursor + 1 - err := dec.skipEscapedString() - if err != nil { - return err - } - default: - dec.cursor = dec.cursor + 1 - continue - } - } - return dec.raiseInvalidJSONErr(len(dec.data) - 1) -} - -// Add Values functions - -// AddString decodes the JSON value within an object or an array to a *string. -// If next key is not a JSON string nor null, InvalidUnmarshalError will be returned. -func (dec *Decoder) AddString(v *string) error { - return dec.String(v) -} - -// AddStringNull decodes the JSON value within an object or an array to a *string. -// If next key is not a JSON string nor null, InvalidUnmarshalError will be returned. -// If a `null` is encountered, gojay does not change the value of the pointer. -func (dec *Decoder) AddStringNull(v **string) error { - return dec.StringNull(v) -} - -// String decodes the JSON value within an object or an array to a *string. -// If next key is not a JSON string nor null, InvalidUnmarshalError will be returned. -func (dec *Decoder) String(v *string) error { - err := dec.decodeString(v) - if err != nil { - return err - } - dec.called |= 1 - return nil -} - -// StringNull decodes the JSON value within an object or an array to a **string. -// If next key is not a JSON string nor null, InvalidUnmarshalError will be returned. -// If a `null` is encountered, gojay does not change the value of the pointer. -func (dec *Decoder) StringNull(v **string) error { - err := dec.decodeStringNull(v) - if err != nil { - return err - } - dec.called |= 1 - return nil -} diff --git a/vendor/github.com/francoispqt/gojay/decode_string_unicode.go b/vendor/github.com/francoispqt/gojay/decode_string_unicode.go deleted file mode 100644 index 9e14d52b07..0000000000 --- a/vendor/github.com/francoispqt/gojay/decode_string_unicode.go +++ /dev/null @@ -1,98 +0,0 @@ -package gojay - -import ( - "unicode/utf16" - "unicode/utf8" -) - -func (dec *Decoder) getUnicode() (rune, error) { - i := 0 - r := rune(0) - for ; (dec.cursor < dec.length || dec.read()) && i < 4; dec.cursor++ { - c := dec.data[dec.cursor] - if c >= '0' && c <= '9' { - r = r*16 + rune(c-'0') - } else if c >= 'a' && c <= 'f' { - r = r*16 + rune(c-'a'+10) - } else if c >= 'A' && c <= 'F' { - r = r*16 + rune(c-'A'+10) - } else { - return 0, InvalidJSONError("Invalid unicode code point") - } - i++ - } - return r, nil -} - -func (dec *Decoder) appendEscapeChar(str []byte, c byte) ([]byte, error) { - switch c { - case 't': - str = append(str, '\t') - case 'n': - str = append(str, '\n') - case 'r': - str = append(str, '\r') - case 'b': - str = append(str, '\b') - case 'f': - str = append(str, '\f') - case '\\': - str = append(str, '\\') - default: - return nil, InvalidJSONError("Invalid JSON") - } - return str, nil -} - -func (dec *Decoder) parseUnicode() ([]byte, error) { - // get unicode after u - r, err := dec.getUnicode() - if err != nil { - return nil, err - } - // no error start making new string - str := make([]byte, 16, 16) - i := 0 - // check if code can be a surrogate utf16 - if utf16.IsSurrogate(r) { - if dec.cursor >= dec.length && !dec.read() { - return nil, dec.raiseInvalidJSONErr(dec.cursor) - } - c := dec.data[dec.cursor] - if c != '\\' { - i += utf8.EncodeRune(str, r) - return str[:i], nil - } - dec.cursor++ - if dec.cursor >= dec.length && !dec.read() { - return nil, dec.raiseInvalidJSONErr(dec.cursor) - } - c = dec.data[dec.cursor] - if c != 'u' { - i += utf8.EncodeRune(str, r) - str, err = dec.appendEscapeChar(str[:i], c) - if err != nil { - dec.err = err - return nil, err - } - i++ - dec.cursor++ - return str[:i], nil - } - dec.cursor++ - r2, err := dec.getUnicode() - if err != nil { - return nil, err - } - combined := utf16.DecodeRune(r, r2) - if combined == '\uFFFD' { - i += utf8.EncodeRune(str, r) - i += utf8.EncodeRune(str, r2) - } else { - i += utf8.EncodeRune(str, combined) - } - return str[:i], nil - } - i += utf8.EncodeRune(str, r) - return str[:i], nil -} diff --git a/vendor/github.com/francoispqt/gojay/decode_time.go b/vendor/github.com/francoispqt/gojay/decode_time.go deleted file mode 100644 index 68f906d7f2..0000000000 --- a/vendor/github.com/francoispqt/gojay/decode_time.go +++ /dev/null @@ -1,53 +0,0 @@ -package gojay - -import ( - "time" -) - -// DecodeTime decodes time with the given format -func (dec *Decoder) DecodeTime(v *time.Time, format string) error { - if dec.isPooled == 1 { - panic(InvalidUsagePooledDecoderError("Invalid usage of pooled decoder")) - } - return dec.decodeTime(v, format) -} - -func (dec *Decoder) decodeTime(v *time.Time, format string) error { - if format == time.RFC3339 { - var ej = make(EmbeddedJSON, 0, 20) - if err := dec.decodeEmbeddedJSON(&ej); err != nil { - return err - } - if err := v.UnmarshalJSON(ej); err != nil { - return err - } - return nil - } - var str string - if err := dec.decodeString(&str); err != nil { - return err - } - tt, err := time.Parse(format, str) - if err != nil { - return err - } - *v = tt - return nil -} - -// Add Values functions - -// AddTime decodes the JSON value within an object or an array to a *time.Time with the given format -func (dec *Decoder) AddTime(v *time.Time, format string) error { - return dec.Time(v, format) -} - -// Time decodes the JSON value within an object or an array to a *time.Time with the given format -func (dec *Decoder) Time(v *time.Time, format string) error { - err := dec.decodeTime(v, format) - if err != nil { - return err - } - dec.called |= 1 - return nil -} diff --git a/vendor/github.com/francoispqt/gojay/decode_unsafe.go b/vendor/github.com/francoispqt/gojay/decode_unsafe.go deleted file mode 100644 index 54448fba73..0000000000 --- a/vendor/github.com/francoispqt/gojay/decode_unsafe.go +++ /dev/null @@ -1,120 +0,0 @@ -package gojay - -import ( - "fmt" -) - -// Unsafe is the structure holding the unsafe version of the API. -// The difference between unsafe api and regular api is that the regular API -// copies the buffer passed to Unmarshal functions to a new internal buffer. -// Making it safer because internally GoJay uses unsafe.Pointer to transform slice of bytes into a string. -var Unsafe = decUnsafe{} - -type decUnsafe struct{} - -func (u decUnsafe) UnmarshalJSONArray(data []byte, v UnmarshalerJSONArray) error { - dec := borrowDecoder(nil, 0) - defer dec.Release() - dec.data = data - dec.length = len(data) - _, err := dec.decodeArray(v) - return err -} - -func (u decUnsafe) UnmarshalJSONObject(data []byte, v UnmarshalerJSONObject) error { - dec := borrowDecoder(nil, 0) - defer dec.Release() - dec.data = data - dec.length = len(data) - _, err := dec.decodeObject(v) - return err -} - -func (u decUnsafe) Unmarshal(data []byte, v interface{}) error { - var err error - var dec *Decoder - switch vt := v.(type) { - case *string: - dec = borrowDecoder(nil, 0) - dec.length = len(data) - dec.data = data - err = dec.decodeString(vt) - case *int: - dec = borrowDecoder(nil, 0) - dec.length = len(data) - dec.data = data - err = dec.decodeInt(vt) - case *int8: - dec = borrowDecoder(nil, 0) - dec.length = len(data) - dec.data = data - err = dec.decodeInt8(vt) - case *int16: - dec = borrowDecoder(nil, 0) - dec.length = len(data) - dec.data = data - err = dec.decodeInt16(vt) - case *int32: - dec = borrowDecoder(nil, 0) - dec.length = len(data) - dec.data = data - err = dec.decodeInt32(vt) - case *int64: - dec = borrowDecoder(nil, 0) - dec.length = len(data) - dec.data = data - err = dec.decodeInt64(vt) - case *uint8: - dec = borrowDecoder(nil, 0) - dec.length = len(data) - dec.data = data - err = dec.decodeUint8(vt) - case *uint16: - dec = borrowDecoder(nil, 0) - dec.length = len(data) - dec.data = data - err = dec.decodeUint16(vt) - case *uint32: - dec = borrowDecoder(nil, 0) - dec.length = len(data) - dec.data = data - err = dec.decodeUint32(vt) - case *uint64: - dec = borrowDecoder(nil, 0) - dec.length = len(data) - dec.data = data - err = dec.decodeUint64(vt) - case *float64: - dec = borrowDecoder(nil, 0) - dec.length = len(data) - dec.data = data - err = dec.decodeFloat64(vt) - case *float32: - dec = borrowDecoder(nil, 0) - dec.length = len(data) - dec.data = data - err = dec.decodeFloat32(vt) - case *bool: - dec = borrowDecoder(nil, 0) - dec.length = len(data) - dec.data = data - err = dec.decodeBool(vt) - case UnmarshalerJSONObject: - dec = borrowDecoder(nil, 0) - dec.length = len(data) - dec.data = data - _, err = dec.decodeObject(vt) - case UnmarshalerJSONArray: - dec = borrowDecoder(nil, 0) - dec.length = len(data) - dec.data = data - _, err = dec.decodeArray(vt) - default: - return InvalidUnmarshalError(fmt.Sprintf(invalidUnmarshalErrorMsg, vt)) - } - defer dec.Release() - if err != nil { - return err - } - return dec.err -} diff --git a/vendor/github.com/francoispqt/gojay/encode.go b/vendor/github.com/francoispqt/gojay/encode.go deleted file mode 100644 index 92edaafa06..0000000000 --- a/vendor/github.com/francoispqt/gojay/encode.go +++ /dev/null @@ -1,202 +0,0 @@ -package gojay - -import ( - "encoding/json" - "fmt" - "io" -) - -var nullBytes = []byte("null") - -// MarshalJSONArray returns the JSON encoding of v, an implementation of MarshalerJSONArray. -// -// -// Example: -// type TestSlice []*TestStruct -// -// func (t TestSlice) MarshalJSONArray(enc *Encoder) { -// for _, e := range t { -// enc.AddObject(e) -// } -// } -// -// func main() { -// test := &TestSlice{ -// &TestStruct{123456}, -// &TestStruct{7890}, -// } -// b, _ := Marshal(test) -// fmt.Println(b) // [{"id":123456},{"id":7890}] -// } -func MarshalJSONArray(v MarshalerJSONArray) ([]byte, error) { - enc := BorrowEncoder(nil) - enc.grow(512) - enc.writeByte('[') - v.(MarshalerJSONArray).MarshalJSONArray(enc) - enc.writeByte(']') - - defer func() { - enc.buf = make([]byte, 0, 512) - enc.Release() - }() - - return enc.buf, nil -} - -// MarshalJSONObject returns the JSON encoding of v, an implementation of MarshalerJSONObject. -// -// Example: -// type Object struct { -// id int -// } -// func (s *Object) MarshalJSONObject(enc *gojay.Encoder) { -// enc.IntKey("id", s.id) -// } -// func (s *Object) IsNil() bool { -// return s == nil -// } -// -// func main() { -// test := &Object{ -// id: 123456, -// } -// b, _ := gojay.Marshal(test) -// fmt.Println(b) // {"id":123456} -// } -func MarshalJSONObject(v MarshalerJSONObject) ([]byte, error) { - enc := BorrowEncoder(nil) - enc.grow(512) - - defer func() { - enc.buf = make([]byte, 0, 512) - enc.Release() - }() - - return enc.encodeObject(v) -} - -// Marshal returns the JSON encoding of v. -// -// If v is nil, not an implementation MarshalerJSONObject or MarshalerJSONArray or not one of the following types: -// string, int, int8, int16, int32, int64, uint8, uint16, uint32, uint64, float64, float32, bool -// Marshal returns an InvalidMarshalError. -func Marshal(v interface{}) ([]byte, error) { - return marshal(v, false) -} - -// MarshalAny returns the JSON encoding of v. -// -// If v is nil, not an implementation MarshalerJSONObject or MarshalerJSONArray or not one of the following types: -// string, int, int8, int16, int32, int64, uint8, uint16, uint32, uint64, float64, float32, bool -// MarshalAny falls back to "json/encoding" package to marshal the value. -func MarshalAny(v interface{}) ([]byte, error) { - return marshal(v, true) -} - -func marshal(v interface{}, any bool) ([]byte, error) { - var ( - enc = BorrowEncoder(nil) - - buf []byte - err error - ) - - defer func() { - enc.buf = make([]byte, 0, 512) - enc.Release() - }() - - buf, err = func() ([]byte, error) { - switch vt := v.(type) { - case MarshalerJSONObject: - return enc.encodeObject(vt) - case MarshalerJSONArray: - return enc.encodeArray(vt) - case string: - return enc.encodeString(vt) - case bool: - return enc.encodeBool(vt) - case int: - return enc.encodeInt(vt) - case int64: - return enc.encodeInt64(vt) - case int32: - return enc.encodeInt(int(vt)) - case int16: - return enc.encodeInt(int(vt)) - case int8: - return enc.encodeInt(int(vt)) - case uint64: - return enc.encodeInt(int(vt)) - case uint32: - return enc.encodeInt(int(vt)) - case uint16: - return enc.encodeInt(int(vt)) - case uint8: - return enc.encodeInt(int(vt)) - case float64: - return enc.encodeFloat(vt) - case float32: - return enc.encodeFloat32(vt) - case *EmbeddedJSON: - return enc.encodeEmbeddedJSON(vt) - default: - if any { - return json.Marshal(vt) - } - - return nil, InvalidMarshalError(fmt.Sprintf(invalidMarshalErrorMsg, vt)) - } - }() - return buf, err -} - -// MarshalerJSONObject is the interface to implement for struct to be encoded -type MarshalerJSONObject interface { - MarshalJSONObject(enc *Encoder) - IsNil() bool -} - -// MarshalerJSONArray is the interface to implement -// for a slice or an array to be encoded -type MarshalerJSONArray interface { - MarshalJSONArray(enc *Encoder) - IsNil() bool -} - -// An Encoder writes JSON values to an output stream. -type Encoder struct { - buf []byte - isPooled byte - w io.Writer - err error - hasKeys bool - keys []string -} - -// AppendBytes allows a modular usage by appending bytes manually to the current state of the buffer. -func (enc *Encoder) AppendBytes(b []byte) { - enc.writeBytes(b) -} - -// AppendByte allows a modular usage by appending a single byte manually to the current state of the buffer. -func (enc *Encoder) AppendByte(b byte) { - enc.writeByte(b) -} - -// Buf returns the Encoder's buffer. -func (enc *Encoder) Buf() []byte { - return enc.buf -} - -// Write writes to the io.Writer and resets the buffer. -func (enc *Encoder) Write() (int, error) { - i, err := enc.w.Write(enc.buf) - enc.buf = enc.buf[:0] - return i, err -} - -func (enc *Encoder) getPreviousRune() byte { - last := len(enc.buf) - 1 - return enc.buf[last] -} diff --git a/vendor/github.com/francoispqt/gojay/encode_array.go b/vendor/github.com/francoispqt/gojay/encode_array.go deleted file mode 100644 index 5e9d49e825..0000000000 --- a/vendor/github.com/francoispqt/gojay/encode_array.go +++ /dev/null @@ -1,212 +0,0 @@ -package gojay - -// EncodeArray encodes an implementation of MarshalerJSONArray to JSON -func (enc *Encoder) EncodeArray(v MarshalerJSONArray) error { - if enc.isPooled == 1 { - panic(InvalidUsagePooledEncoderError("Invalid usage of pooled encoder")) - } - _, _ = enc.encodeArray(v) - _, err := enc.Write() - if err != nil { - enc.err = err - return err - } - return nil -} -func (enc *Encoder) encodeArray(v MarshalerJSONArray) ([]byte, error) { - enc.grow(200) - enc.writeByte('[') - v.MarshalJSONArray(enc) - enc.writeByte(']') - return enc.buf, enc.err -} - -// AddArray adds an implementation of MarshalerJSONArray to be encoded, must be used inside a slice or array encoding (does not encode a key) -// value must implement Marshaler -func (enc *Encoder) AddArray(v MarshalerJSONArray) { - enc.Array(v) -} - -// AddArrayOmitEmpty adds an array or slice to be encoded, must be used inside a slice or array encoding (does not encode a key) -// value must implement MarshalerAddArrayOmitEmpty -func (enc *Encoder) AddArrayOmitEmpty(v MarshalerJSONArray) { - enc.ArrayOmitEmpty(v) -} - -// AddArrayNullEmpty adds an array or slice to be encoded, must be used inside a slice or array encoding (does not encode a key) -// value must implement Marshaler, if v is empty, `null` will be encoded` -func (enc *Encoder) AddArrayNullEmpty(v MarshalerJSONArray) { - enc.ArrayNullEmpty(v) -} - -// AddArrayKey adds an array or slice to be encoded, must be used inside an object as it will encode a key -// value must implement Marshaler -func (enc *Encoder) AddArrayKey(key string, v MarshalerJSONArray) { - enc.ArrayKey(key, v) -} - -// AddArrayKeyOmitEmpty adds an array or slice to be encoded and skips it if it is nil. -// Must be called inside an object as it will encode a key. -func (enc *Encoder) AddArrayKeyOmitEmpty(key string, v MarshalerJSONArray) { - enc.ArrayKeyOmitEmpty(key, v) -} - -// AddArrayKeyNullEmpty adds an array or slice to be encoded and skips it if it is nil. -// Must be called inside an object as it will encode a key. `null` will be encoded` -func (enc *Encoder) AddArrayKeyNullEmpty(key string, v MarshalerJSONArray) { - enc.ArrayKeyNullEmpty(key, v) -} - -// Array adds an implementation of MarshalerJSONArray to be encoded, must be used inside a slice or array encoding (does not encode a key) -// value must implement Marshaler -func (enc *Encoder) Array(v MarshalerJSONArray) { - if v.IsNil() { - enc.grow(3) - r := enc.getPreviousRune() - if r != '[' { - enc.writeByte(',') - } - enc.writeByte('[') - enc.writeByte(']') - return - } - enc.grow(100) - r := enc.getPreviousRune() - if r != '[' { - enc.writeByte(',') - } - enc.writeByte('[') - v.MarshalJSONArray(enc) - enc.writeByte(']') -} - -// ArrayOmitEmpty adds an array or slice to be encoded, must be used inside a slice or array encoding (does not encode a key) -// value must implement Marshaler -func (enc *Encoder) ArrayOmitEmpty(v MarshalerJSONArray) { - if v.IsNil() { - return - } - enc.grow(4) - r := enc.getPreviousRune() - if r != '[' { - enc.writeByte(',') - } - enc.writeByte('[') - v.MarshalJSONArray(enc) - enc.writeByte(']') -} - -// ArrayNullEmpty adds an array or slice to be encoded, must be used inside a slice or array encoding (does not encode a key) -// value must implement Marshaler -func (enc *Encoder) ArrayNullEmpty(v MarshalerJSONArray) { - enc.grow(4) - r := enc.getPreviousRune() - if r != '[' { - enc.writeByte(',') - } - if v.IsNil() { - enc.writeBytes(nullBytes) - return - } - enc.writeByte('[') - v.MarshalJSONArray(enc) - enc.writeByte(']') -} - -// ArrayKey adds an array or slice to be encoded, must be used inside an object as it will encode a key -// value must implement Marshaler -func (enc *Encoder) ArrayKey(key string, v MarshalerJSONArray) { - if enc.hasKeys { - if !enc.keyExists(key) { - return - } - } - if v.IsNil() { - enc.grow(2 + len(key)) - r := enc.getPreviousRune() - if r != '{' { - enc.writeByte(',') - } - enc.writeByte('"') - enc.writeStringEscape(key) - enc.writeBytes(objKeyArr) - enc.writeByte(']') - return - } - enc.grow(5 + len(key)) - r := enc.getPreviousRune() - if r != '{' { - enc.writeByte(',') - } - enc.writeByte('"') - enc.writeStringEscape(key) - enc.writeBytes(objKeyArr) - v.MarshalJSONArray(enc) - enc.writeByte(']') -} - -// ArrayKeyOmitEmpty adds an array or slice to be encoded and skips if it is nil. -// Must be called inside an object as it will encode a key. -func (enc *Encoder) ArrayKeyOmitEmpty(key string, v MarshalerJSONArray) { - if enc.hasKeys { - if !enc.keyExists(key) { - return - } - } - if v.IsNil() { - return - } - enc.grow(5 + len(key)) - r := enc.getPreviousRune() - if r != '{' { - enc.writeByte(',') - } - enc.writeByte('"') - enc.writeStringEscape(key) - enc.writeBytes(objKeyArr) - v.MarshalJSONArray(enc) - enc.writeByte(']') -} - -// ArrayKeyNullEmpty adds an array or slice to be encoded and encodes `null`` if it is nil. -// Must be called inside an object as it will encode a key. -func (enc *Encoder) ArrayKeyNullEmpty(key string, v MarshalerJSONArray) { - if enc.hasKeys { - if !enc.keyExists(key) { - return - } - } - enc.grow(5 + len(key)) - r := enc.getPreviousRune() - if r != '{' { - enc.writeByte(',') - } - if v.IsNil() { - enc.writeBytes(nullBytes) - return - } - enc.writeByte('"') - enc.writeStringEscape(key) - enc.writeBytes(objKeyArr) - v.MarshalJSONArray(enc) - enc.writeByte(']') -} - -// EncodeArrayFunc is a custom func type implementing MarshaleArray. -// Use it to cast a func(*Encoder) to Marshal an object. -// -// enc := gojay.NewEncoder(io.Writer) -// enc.EncodeArray(gojay.EncodeArrayFunc(func(enc *gojay.Encoder) { -// enc.AddStringKey("hello", "world") -// })) -type EncodeArrayFunc func(*Encoder) - -// MarshalJSONArray implements MarshalerJSONArray. -func (f EncodeArrayFunc) MarshalJSONArray(enc *Encoder) { - f(enc) -} - -// IsNil implements MarshalerJSONArray. -func (f EncodeArrayFunc) IsNil() bool { - return f == nil -} diff --git a/vendor/github.com/francoispqt/gojay/encode_bool.go b/vendor/github.com/francoispqt/gojay/encode_bool.go deleted file mode 100644 index 253e037893..0000000000 --- a/vendor/github.com/francoispqt/gojay/encode_bool.go +++ /dev/null @@ -1,164 +0,0 @@ -package gojay - -import "strconv" - -// EncodeBool encodes a bool to JSON -func (enc *Encoder) EncodeBool(v bool) error { - if enc.isPooled == 1 { - panic(InvalidUsagePooledEncoderError("Invalid usage of pooled encoder")) - } - _, _ = enc.encodeBool(v) - _, err := enc.Write() - if err != nil { - enc.err = err - return err - } - return nil -} - -// encodeBool encodes a bool to JSON -func (enc *Encoder) encodeBool(v bool) ([]byte, error) { - enc.grow(5) - if v { - enc.writeString("true") - } else { - enc.writeString("false") - } - return enc.buf, enc.err -} - -// AddBool adds a bool to be encoded, must be used inside a slice or array encoding (does not encode a key) -func (enc *Encoder) AddBool(v bool) { - enc.Bool(v) -} - -// AddBoolOmitEmpty adds a bool to be encoded, must be used inside a slice or array encoding (does not encode a key) -func (enc *Encoder) AddBoolOmitEmpty(v bool) { - enc.BoolOmitEmpty(v) -} - -// AddBoolNullEmpty adds a bool to be encoded, must be used inside a slice or array encoding (does not encode a key) -func (enc *Encoder) AddBoolNullEmpty(v bool) { - enc.BoolNullEmpty(v) -} - -// AddBoolKey adds a bool to be encoded, must be used inside an object as it will encode a key. -func (enc *Encoder) AddBoolKey(key string, v bool) { - enc.BoolKey(key, v) -} - -// AddBoolKeyOmitEmpty adds a bool to be encoded and skips if it is zero value. -// Must be used inside an object as it will encode a key. -func (enc *Encoder) AddBoolKeyOmitEmpty(key string, v bool) { - enc.BoolKeyOmitEmpty(key, v) -} - -// AddBoolKeyNullEmpty adds a bool to be encoded and encodes `null` if it is zero value. -// Must be used inside an object as it will encode a key. -func (enc *Encoder) AddBoolKeyNullEmpty(key string, v bool) { - enc.BoolKeyNullEmpty(key, v) -} - -// Bool adds a bool to be encoded, must be used inside a slice or array encoding (does not encode a key) -func (enc *Encoder) Bool(v bool) { - enc.grow(5) - r := enc.getPreviousRune() - if r != '[' { - enc.writeByte(',') - } - if v { - enc.writeString("true") - } else { - enc.writeString("false") - } -} - -// BoolOmitEmpty adds a bool to be encoded, must be used inside a slice or array encoding (does not encode a key) -func (enc *Encoder) BoolOmitEmpty(v bool) { - if v == false { - return - } - enc.grow(5) - r := enc.getPreviousRune() - if r != '[' { - enc.writeByte(',') - } - enc.writeString("true") -} - -// BoolNullEmpty adds a bool to be encoded, must be used inside a slice or array encoding (does not encode a key) -func (enc *Encoder) BoolNullEmpty(v bool) { - enc.grow(5) - r := enc.getPreviousRune() - if r != '[' { - enc.writeByte(',') - } - if v == false { - enc.writeBytes(nullBytes) - return - } - enc.writeString("true") -} - -// BoolKey adds a bool to be encoded, must be used inside an object as it will encode a key. -func (enc *Encoder) BoolKey(key string, value bool) { - if enc.hasKeys { - if !enc.keyExists(key) { - return - } - } - enc.grow(5 + len(key)) - r := enc.getPreviousRune() - if r != '{' { - enc.writeByte(',') - } - enc.writeByte('"') - enc.writeStringEscape(key) - enc.writeBytes(objKey) - enc.buf = strconv.AppendBool(enc.buf, value) -} - -// BoolKeyOmitEmpty adds a bool to be encoded and skips it if it is zero value. -// Must be used inside an object as it will encode a key. -func (enc *Encoder) BoolKeyOmitEmpty(key string, v bool) { - if enc.hasKeys { - if !enc.keyExists(key) { - return - } - } - if v == false { - return - } - enc.grow(5 + len(key)) - r := enc.getPreviousRune() - if r != '{' { - enc.writeByte(',') - } - enc.writeByte('"') - enc.writeStringEscape(key) - enc.writeBytes(objKey) - enc.buf = strconv.AppendBool(enc.buf, v) -} - -// BoolKeyNullEmpty adds a bool to be encoded and skips it if it is zero value. -// Must be used inside an object as it will encode a key. -func (enc *Encoder) BoolKeyNullEmpty(key string, v bool) { - if enc.hasKeys { - if !enc.keyExists(key) { - return - } - } - enc.grow(5 + len(key)) - r := enc.getPreviousRune() - if r != '{' { - enc.writeByte(',') - } - enc.writeByte('"') - enc.writeStringEscape(key) - enc.writeBytes(objKey) - if v == false { - enc.writeBytes(nullBytes) - return - } - enc.buf = strconv.AppendBool(enc.buf, v) -} diff --git a/vendor/github.com/francoispqt/gojay/encode_builder.go b/vendor/github.com/francoispqt/gojay/encode_builder.go deleted file mode 100644 index 2895ba34a1..0000000000 --- a/vendor/github.com/francoispqt/gojay/encode_builder.go +++ /dev/null @@ -1,65 +0,0 @@ -package gojay - -const hex = "0123456789abcdef" - -// grow grows b's capacity, if necessary, to guarantee space for -// another n bytes. After grow(n), at least n bytes can be written to b -// without another allocation. If n is negative, grow panics. -func (enc *Encoder) grow(n int) { - if cap(enc.buf)-len(enc.buf) < n { - Buf := make([]byte, len(enc.buf), 2*cap(enc.buf)+n) - copy(Buf, enc.buf) - enc.buf = Buf - } -} - -// Write appends the contents of p to b's Buffer. -// Write always returns len(p), nil. -func (enc *Encoder) writeBytes(p []byte) { - enc.buf = append(enc.buf, p...) -} - -func (enc *Encoder) writeTwoBytes(b1 byte, b2 byte) { - enc.buf = append(enc.buf, b1, b2) -} - -// WriteByte appends the byte c to b's Buffer. -// The returned error is always nil. -func (enc *Encoder) writeByte(c byte) { - enc.buf = append(enc.buf, c) -} - -// WriteString appends the contents of s to b's Buffer. -// It returns the length of s and a nil error. -func (enc *Encoder) writeString(s string) { - enc.buf = append(enc.buf, s...) -} - -func (enc *Encoder) writeStringEscape(s string) { - l := len(s) - for i := 0; i < l; i++ { - c := s[i] - if c >= 0x20 && c != '\\' && c != '"' { - enc.writeByte(c) - continue - } - switch c { - case '\\', '"': - enc.writeTwoBytes('\\', c) - case '\n': - enc.writeTwoBytes('\\', 'n') - case '\f': - enc.writeTwoBytes('\\', 'f') - case '\b': - enc.writeTwoBytes('\\', 'b') - case '\r': - enc.writeTwoBytes('\\', 'r') - case '\t': - enc.writeTwoBytes('\\', 't') - default: - enc.writeString(`\u00`) - enc.writeTwoBytes(hex[c>>4], hex[c&0xF]) - } - continue - } -} diff --git a/vendor/github.com/francoispqt/gojay/encode_embedded_json.go b/vendor/github.com/francoispqt/gojay/encode_embedded_json.go deleted file mode 100644 index 4c99a05789..0000000000 --- a/vendor/github.com/francoispqt/gojay/encode_embedded_json.go +++ /dev/null @@ -1,93 +0,0 @@ -package gojay - -// EncodeEmbeddedJSON encodes an embedded JSON. -// is basically sets the internal buf as the value pointed by v and calls the io.Writer.Write() -func (enc *Encoder) EncodeEmbeddedJSON(v *EmbeddedJSON) error { - if enc.isPooled == 1 { - panic(InvalidUsagePooledEncoderError("Invalid usage of pooled encoder")) - } - enc.buf = *v - _, err := enc.Write() - if err != nil { - return err - } - return nil -} - -func (enc *Encoder) encodeEmbeddedJSON(v *EmbeddedJSON) ([]byte, error) { - enc.writeBytes(*v) - return enc.buf, nil -} - -// AddEmbeddedJSON adds an EmbeddedJSON to be encoded. -// -// It basically blindly writes the bytes to the final buffer. Therefore, -// it expects the JSON to be of proper format. -func (enc *Encoder) AddEmbeddedJSON(v *EmbeddedJSON) { - enc.grow(len(*v) + 4) - r := enc.getPreviousRune() - if r != '[' { - enc.writeByte(',') - } - enc.writeBytes(*v) -} - -// AddEmbeddedJSONOmitEmpty adds an EmbeddedJSON to be encoded or skips it if nil pointer or empty. -// -// It basically blindly writes the bytes to the final buffer. Therefore, -// it expects the JSON to be of proper format. -func (enc *Encoder) AddEmbeddedJSONOmitEmpty(v *EmbeddedJSON) { - if v == nil || len(*v) == 0 { - return - } - r := enc.getPreviousRune() - if r != '[' { - enc.writeByte(',') - } - enc.writeBytes(*v) -} - -// AddEmbeddedJSONKey adds an EmbeddedJSON and a key to be encoded. -// -// It basically blindly writes the bytes to the final buffer. Therefore, -// it expects the JSON to be of proper format. -func (enc *Encoder) AddEmbeddedJSONKey(key string, v *EmbeddedJSON) { - if enc.hasKeys { - if !enc.keyExists(key) { - return - } - } - enc.grow(len(key) + len(*v) + 5) - r := enc.getPreviousRune() - if r != '{' { - enc.writeByte(',') - } - enc.writeByte('"') - enc.writeStringEscape(key) - enc.writeBytes(objKey) - enc.writeBytes(*v) -} - -// AddEmbeddedJSONKeyOmitEmpty adds an EmbeddedJSON and a key to be encoded or skips it if nil pointer or empty. -// -// It basically blindly writes the bytes to the final buffer. Therefore, -// it expects the JSON to be of proper format. -func (enc *Encoder) AddEmbeddedJSONKeyOmitEmpty(key string, v *EmbeddedJSON) { - if enc.hasKeys { - if !enc.keyExists(key) { - return - } - } - if v == nil || len(*v) == 0 { - return - } - enc.grow(len(key) + len(*v) + 5) - r := enc.getPreviousRune() - if r != '{' { - enc.writeByte(',') - } - enc.writeByte('"') - enc.writeStringEscape(key) - enc.writeBytes(objKey) - enc.writeBytes(*v) -} diff --git a/vendor/github.com/francoispqt/gojay/encode_interface.go b/vendor/github.com/francoispqt/gojay/encode_interface.go deleted file mode 100644 index c4692e5fce..0000000000 --- a/vendor/github.com/francoispqt/gojay/encode_interface.go +++ /dev/null @@ -1,173 +0,0 @@ -package gojay - -import ( - "fmt" -) - -// Encode encodes a value to JSON. -// -// If Encode cannot find a way to encode the type to JSON -// it will return an InvalidMarshalError. -func (enc *Encoder) Encode(v interface{}) error { - if enc.isPooled == 1 { - panic(InvalidUsagePooledEncoderError("Invalid usage of pooled encoder")) - } - switch vt := v.(type) { - case string: - return enc.EncodeString(vt) - case bool: - return enc.EncodeBool(vt) - case MarshalerJSONArray: - return enc.EncodeArray(vt) - case MarshalerJSONObject: - return enc.EncodeObject(vt) - case int: - return enc.EncodeInt(vt) - case int64: - return enc.EncodeInt64(vt) - case int32: - return enc.EncodeInt(int(vt)) - case int8: - return enc.EncodeInt(int(vt)) - case uint64: - return enc.EncodeUint64(vt) - case uint32: - return enc.EncodeInt(int(vt)) - case uint16: - return enc.EncodeInt(int(vt)) - case uint8: - return enc.EncodeInt(int(vt)) - case float64: - return enc.EncodeFloat(vt) - case float32: - return enc.EncodeFloat32(vt) - case *EmbeddedJSON: - return enc.EncodeEmbeddedJSON(vt) - default: - return InvalidMarshalError(fmt.Sprintf(invalidMarshalErrorMsg, vt)) - } -} - -// AddInterface adds an interface{} to be encoded, must be used inside a slice or array encoding (does not encode a key) -func (enc *Encoder) AddInterface(value interface{}) { - switch vt := value.(type) { - case string: - enc.AddString(vt) - case bool: - enc.AddBool(vt) - case MarshalerJSONArray: - enc.AddArray(vt) - case MarshalerJSONObject: - enc.AddObject(vt) - case int: - enc.AddInt(vt) - case int64: - enc.AddInt(int(vt)) - case int32: - enc.AddInt(int(vt)) - case int8: - enc.AddInt(int(vt)) - case uint64: - enc.AddUint64(vt) - case uint32: - enc.AddInt(int(vt)) - case uint16: - enc.AddInt(int(vt)) - case uint8: - enc.AddInt(int(vt)) - case float64: - enc.AddFloat(vt) - case float32: - enc.AddFloat32(vt) - default: - if vt != nil { - enc.err = InvalidMarshalError(fmt.Sprintf(invalidMarshalErrorMsg, vt)) - return - } - return - } -} - -// AddInterfaceKey adds an interface{} to be encoded, must be used inside an object as it will encode a key -func (enc *Encoder) AddInterfaceKey(key string, value interface{}) { - switch vt := value.(type) { - case string: - enc.AddStringKey(key, vt) - case bool: - enc.AddBoolKey(key, vt) - case MarshalerJSONArray: - enc.AddArrayKey(key, vt) - case MarshalerJSONObject: - enc.AddObjectKey(key, vt) - case int: - enc.AddIntKey(key, vt) - case int64: - enc.AddIntKey(key, int(vt)) - case int32: - enc.AddIntKey(key, int(vt)) - case int16: - enc.AddIntKey(key, int(vt)) - case int8: - enc.AddIntKey(key, int(vt)) - case uint64: - enc.AddIntKey(key, int(vt)) - case uint32: - enc.AddIntKey(key, int(vt)) - case uint16: - enc.AddIntKey(key, int(vt)) - case uint8: - enc.AddIntKey(key, int(vt)) - case float64: - enc.AddFloatKey(key, vt) - case float32: - enc.AddFloat32Key(key, vt) - default: - if vt != nil { - enc.err = InvalidMarshalError(fmt.Sprintf(invalidMarshalErrorMsg, vt)) - return - } - return - } -} - -// AddInterfaceKeyOmitEmpty adds an interface{} to be encoded, must be used inside an object as it will encode a key -func (enc *Encoder) AddInterfaceKeyOmitEmpty(key string, v interface{}) { - switch vt := v.(type) { - case string: - enc.AddStringKeyOmitEmpty(key, vt) - case bool: - enc.AddBoolKeyOmitEmpty(key, vt) - case MarshalerJSONArray: - enc.AddArrayKeyOmitEmpty(key, vt) - case MarshalerJSONObject: - enc.AddObjectKeyOmitEmpty(key, vt) - case int: - enc.AddIntKeyOmitEmpty(key, vt) - case int64: - enc.AddIntKeyOmitEmpty(key, int(vt)) - case int32: - enc.AddIntKeyOmitEmpty(key, int(vt)) - case int16: - enc.AddIntKeyOmitEmpty(key, int(vt)) - case int8: - enc.AddIntKeyOmitEmpty(key, int(vt)) - case uint64: - enc.AddIntKeyOmitEmpty(key, int(vt)) - case uint32: - enc.AddIntKeyOmitEmpty(key, int(vt)) - case uint16: - enc.AddIntKeyOmitEmpty(key, int(vt)) - case uint8: - enc.AddIntKeyOmitEmpty(key, int(vt)) - case float64: - enc.AddFloatKeyOmitEmpty(key, vt) - case float32: - enc.AddFloat32KeyOmitEmpty(key, vt) - default: - if vt != nil { - enc.err = InvalidMarshalError(fmt.Sprintf(invalidMarshalErrorMsg, vt)) - return - } - return - } -} diff --git a/vendor/github.com/francoispqt/gojay/encode_null.go b/vendor/github.com/francoispqt/gojay/encode_null.go deleted file mode 100644 index cec4e639a0..0000000000 --- a/vendor/github.com/francoispqt/gojay/encode_null.go +++ /dev/null @@ -1,39 +0,0 @@ -package gojay - -// AddNull adds a `null` to be encoded. Must be used while encoding an array.` -func (enc *Encoder) AddNull() { - enc.Null() -} - -// Null adds a `null` to be encoded. Must be used while encoding an array.` -func (enc *Encoder) Null() { - enc.grow(5) - r := enc.getPreviousRune() - if r != '[' { - enc.writeByte(',') - } - enc.writeBytes(nullBytes) -} - -// AddNullKey adds a `null` to be encoded. Must be used while encoding an array.` -func (enc *Encoder) AddNullKey(key string) { - enc.NullKey(key) -} - -// NullKey adds a `null` to be encoded. Must be used while encoding an array.` -func (enc *Encoder) NullKey(key string) { - if enc.hasKeys { - if !enc.keyExists(key) { - return - } - } - enc.grow(5 + len(key)) - r := enc.getPreviousRune() - if r != '{' { - enc.writeByte(',') - } - enc.writeByte('"') - enc.writeStringEscape(key) - enc.writeBytes(objKey) - enc.writeBytes(nullBytes) -} diff --git a/vendor/github.com/francoispqt/gojay/encode_number.go b/vendor/github.com/francoispqt/gojay/encode_number.go deleted file mode 100644 index 53affb903f..0000000000 --- a/vendor/github.com/francoispqt/gojay/encode_number.go +++ /dev/null @@ -1 +0,0 @@ -package gojay diff --git a/vendor/github.com/francoispqt/gojay/encode_number_float.go b/vendor/github.com/francoispqt/gojay/encode_number_float.go deleted file mode 100644 index b45f8442ab..0000000000 --- a/vendor/github.com/francoispqt/gojay/encode_number_float.go +++ /dev/null @@ -1,368 +0,0 @@ -package gojay - -import "strconv" - -// EncodeFloat encodes a float64 to JSON -func (enc *Encoder) EncodeFloat(n float64) error { - if enc.isPooled == 1 { - panic(InvalidUsagePooledEncoderError("Invalid usage of pooled encoder")) - } - _, _ = enc.encodeFloat(n) - _, err := enc.Write() - if err != nil { - return err - } - return nil -} - -// encodeFloat encodes a float64 to JSON -func (enc *Encoder) encodeFloat(n float64) ([]byte, error) { - enc.buf = strconv.AppendFloat(enc.buf, n, 'f', -1, 64) - return enc.buf, nil -} - -// EncodeFloat32 encodes a float32 to JSON -func (enc *Encoder) EncodeFloat32(n float32) error { - if enc.isPooled == 1 { - panic(InvalidUsagePooledEncoderError("Invalid usage of pooled encoder")) - } - _, _ = enc.encodeFloat32(n) - _, err := enc.Write() - if err != nil { - return err - } - return nil -} - -func (enc *Encoder) encodeFloat32(n float32) ([]byte, error) { - enc.buf = strconv.AppendFloat(enc.buf, float64(n), 'f', -1, 32) - return enc.buf, nil -} - -// AddFloat adds a float64 to be encoded, must be used inside a slice or array encoding (does not encode a key) -func (enc *Encoder) AddFloat(v float64) { - enc.Float64(v) -} - -// AddFloatOmitEmpty adds a float64 to be encoded and skips it if its value is 0, -// must be used inside a slice or array encoding (does not encode a key). -func (enc *Encoder) AddFloatOmitEmpty(v float64) { - enc.Float64OmitEmpty(v) -} - -// AddFloatNullEmpty adds a float64 to be encoded and skips it if its value is 0, -// must be used inside a slice or array encoding (does not encode a key). -func (enc *Encoder) AddFloatNullEmpty(v float64) { - enc.Float64NullEmpty(v) -} - -// Float adds a float64 to be encoded, must be used inside a slice or array encoding (does not encode a key) -func (enc *Encoder) Float(v float64) { - enc.Float64(v) -} - -// FloatOmitEmpty adds a float64 to be encoded and skips it if its value is 0, -// must be used inside a slice or array encoding (does not encode a key). -func (enc *Encoder) FloatOmitEmpty(v float64) { - enc.Float64OmitEmpty(v) -} - -// FloatNullEmpty adds a float64 to be encoded and skips it if its value is 0, -// must be used inside a slice or array encoding (does not encode a key). -func (enc *Encoder) FloatNullEmpty(v float64) { - enc.Float64NullEmpty(v) -} - -// AddFloatKey adds a float64 to be encoded, must be used inside an object as it will encode a key -func (enc *Encoder) AddFloatKey(key string, v float64) { - enc.Float64Key(key, v) -} - -// AddFloatKeyOmitEmpty adds a float64 to be encoded and skips it if its value is 0. -// Must be used inside an object as it will encode a key -func (enc *Encoder) AddFloatKeyOmitEmpty(key string, v float64) { - enc.Float64KeyOmitEmpty(key, v) -} - -// AddFloatKeyNullEmpty adds a float64 to be encoded and skips it if its value is 0. -// Must be used inside an object as it will encode a key -func (enc *Encoder) AddFloatKeyNullEmpty(key string, v float64) { - enc.Float64KeyNullEmpty(key, v) -} - -// FloatKey adds a float64 to be encoded, must be used inside an object as it will encode a key -func (enc *Encoder) FloatKey(key string, v float64) { - enc.Float64Key(key, v) -} - -// FloatKeyOmitEmpty adds a float64 to be encoded and skips it if its value is 0. -// Must be used inside an object as it will encode a key -func (enc *Encoder) FloatKeyOmitEmpty(key string, v float64) { - enc.Float64KeyOmitEmpty(key, v) -} - -// FloatKeyNullEmpty adds a float64 to be encoded and skips it if its value is 0. -// Must be used inside an object as it will encode a key -func (enc *Encoder) FloatKeyNullEmpty(key string, v float64) { - enc.Float64KeyNullEmpty(key, v) -} - -// AddFloat64 adds a float64 to be encoded, must be used inside a slice or array encoding (does not encode a key) -func (enc *Encoder) AddFloat64(v float64) { - enc.Float(v) -} - -// AddFloat64OmitEmpty adds a float64 to be encoded and skips it if its value is 0, -// must be used inside a slice or array encoding (does not encode a key). -func (enc *Encoder) AddFloat64OmitEmpty(v float64) { - enc.FloatOmitEmpty(v) -} - -// Float64 adds a float64 to be encoded, must be used inside a slice or array encoding (does not encode a key) -func (enc *Encoder) Float64(v float64) { - enc.grow(10) - r := enc.getPreviousRune() - if r != '[' { - enc.writeByte(',') - } - enc.buf = strconv.AppendFloat(enc.buf, v, 'f', -1, 64) -} - -// Float64OmitEmpty adds a float64 to be encoded and skips it if its value is 0, -// must be used inside a slice or array encoding (does not encode a key). -func (enc *Encoder) Float64OmitEmpty(v float64) { - if v == 0 { - return - } - enc.grow(10) - r := enc.getPreviousRune() - if r != '[' { - enc.writeByte(',') - } - enc.buf = strconv.AppendFloat(enc.buf, v, 'f', -1, 64) -} - -// Float64NullEmpty adds a float64 to be encoded and skips it if its value is 0, -// must be used inside a slice or array encoding (does not encode a key). -func (enc *Encoder) Float64NullEmpty(v float64) { - enc.grow(10) - r := enc.getPreviousRune() - if r != '[' { - enc.writeByte(',') - } - if v == 0 { - enc.writeBytes(nullBytes) - return - } - enc.buf = strconv.AppendFloat(enc.buf, v, 'f', -1, 64) -} - -// AddFloat64Key adds a float64 to be encoded, must be used inside an object as it will encode a key -func (enc *Encoder) AddFloat64Key(key string, v float64) { - enc.FloatKey(key, v) -} - -// AddFloat64KeyOmitEmpty adds a float64 to be encoded and skips it if its value is 0. -// Must be used inside an object as it will encode a key -func (enc *Encoder) AddFloat64KeyOmitEmpty(key string, v float64) { - enc.FloatKeyOmitEmpty(key, v) -} - -// Float64Key adds a float64 to be encoded, must be used inside an object as it will encode a key -func (enc *Encoder) Float64Key(key string, value float64) { - if enc.hasKeys { - if !enc.keyExists(key) { - return - } - } - r := enc.getPreviousRune() - if r != '{' { - enc.writeByte(',') - } - enc.grow(10) - enc.writeByte('"') - enc.writeStringEscape(key) - enc.writeBytes(objKey) - enc.buf = strconv.AppendFloat(enc.buf, value, 'f', -1, 64) -} - -// Float64KeyOmitEmpty adds a float64 to be encoded and skips it if its value is 0. -// Must be used inside an object as it will encode a key -func (enc *Encoder) Float64KeyOmitEmpty(key string, v float64) { - if enc.hasKeys { - if !enc.keyExists(key) { - return - } - } - if v == 0 { - return - } - enc.grow(10 + len(key)) - r := enc.getPreviousRune() - if r != '{' { - enc.writeByte(',') - } - enc.writeByte('"') - enc.writeStringEscape(key) - enc.writeBytes(objKey) - enc.buf = strconv.AppendFloat(enc.buf, v, 'f', -1, 64) -} - -// Float64KeyNullEmpty adds a float64 to be encoded and skips it if its value is 0, -// must be used inside a slice or array encoding (does not encode a key). -func (enc *Encoder) Float64KeyNullEmpty(key string, v float64) { - if enc.hasKeys { - if !enc.keyExists(key) { - return - } - } - enc.grow(10 + len(key)) - r := enc.getPreviousRune() - if r != '{' { - enc.writeByte(',') - } - enc.writeByte('"') - enc.writeStringEscape(key) - enc.writeBytes(objKey) - if v == 0 { - enc.writeBytes(nullBytes) - return - } - enc.buf = strconv.AppendFloat(enc.buf, v, 'f', -1, 64) -} - -// AddFloat32 adds a float32 to be encoded, must be used inside a slice or array encoding (does not encode a key) -func (enc *Encoder) AddFloat32(v float32) { - enc.Float32(v) -} - -// AddFloat32OmitEmpty adds an int to be encoded and skips it if its value is 0, -// must be used inside a slice or array encoding (does not encode a key). -func (enc *Encoder) AddFloat32OmitEmpty(v float32) { - enc.Float32OmitEmpty(v) -} - -// AddFloat32NullEmpty adds an int to be encoded and skips it if its value is 0, -// must be used inside a slice or array encoding (does not encode a key). -func (enc *Encoder) AddFloat32NullEmpty(v float32) { - enc.Float32NullEmpty(v) -} - -// Float32 adds a float32 to be encoded, must be used inside a slice or array encoding (does not encode a key) -func (enc *Encoder) Float32(v float32) { - r := enc.getPreviousRune() - if r != '[' { - enc.writeByte(',') - } - enc.buf = strconv.AppendFloat(enc.buf, float64(v), 'f', -1, 32) -} - -// Float32OmitEmpty adds an int to be encoded and skips it if its value is 0, -// must be used inside a slice or array encoding (does not encode a key). -func (enc *Encoder) Float32OmitEmpty(v float32) { - if v == 0 { - return - } - enc.grow(10) - r := enc.getPreviousRune() - if r != '[' { - enc.writeByte(',') - } - enc.buf = strconv.AppendFloat(enc.buf, float64(v), 'f', -1, 32) -} - -// Float32NullEmpty adds an int to be encoded and skips it if its value is 0, -// must be used inside a slice or array encoding (does not encode a key). -func (enc *Encoder) Float32NullEmpty(v float32) { - enc.grow(10) - r := enc.getPreviousRune() - if r != '[' { - enc.writeByte(',') - } - if v == 0 { - enc.writeBytes(nullBytes) - return - } - enc.buf = strconv.AppendFloat(enc.buf, float64(v), 'f', -1, 32) -} - -// AddFloat32Key adds a float32 to be encoded, must be used inside an object as it will encode a key -func (enc *Encoder) AddFloat32Key(key string, v float32) { - enc.Float32Key(key, v) -} - -// AddFloat32KeyOmitEmpty adds a float64 to be encoded and skips it if its value is 0. -// Must be used inside an object as it will encode a key -func (enc *Encoder) AddFloat32KeyOmitEmpty(key string, v float32) { - enc.Float32KeyOmitEmpty(key, v) -} - -// AddFloat32KeyNullEmpty adds a float64 to be encoded and skips it if its value is 0. -// Must be used inside an object as it will encode a key -func (enc *Encoder) AddFloat32KeyNullEmpty(key string, v float32) { - enc.Float32KeyNullEmpty(key, v) -} - -// Float32Key adds a float32 to be encoded, must be used inside an object as it will encode a key -func (enc *Encoder) Float32Key(key string, v float32) { - if enc.hasKeys { - if !enc.keyExists(key) { - return - } - } - enc.grow(10 + len(key)) - r := enc.getPreviousRune() - if r != '{' { - enc.writeByte(',') - } - enc.writeByte('"') - enc.writeStringEscape(key) - enc.writeByte('"') - enc.writeByte(':') - enc.buf = strconv.AppendFloat(enc.buf, float64(v), 'f', -1, 32) -} - -// Float32KeyOmitEmpty adds a float64 to be encoded and skips it if its value is 0. -// Must be used inside an object as it will encode a key -func (enc *Encoder) Float32KeyOmitEmpty(key string, v float32) { - if enc.hasKeys { - if !enc.keyExists(key) { - return - } - } - if v == 0 { - return - } - enc.grow(10 + len(key)) - r := enc.getPreviousRune() - if r != '{' { - enc.writeByte(',') - } - enc.writeByte('"') - enc.writeStringEscape(key) - enc.writeBytes(objKey) - enc.buf = strconv.AppendFloat(enc.buf, float64(v), 'f', -1, 32) -} - -// Float32KeyNullEmpty adds a float64 to be encoded and skips it if its value is 0. -// Must be used inside an object as it will encode a key -func (enc *Encoder) Float32KeyNullEmpty(key string, v float32) { - if enc.hasKeys { - if !enc.keyExists(key) { - return - } - } - enc.grow(10 + len(key)) - r := enc.getPreviousRune() - if r != '{' { - enc.writeByte(',') - } - enc.writeByte('"') - enc.writeStringEscape(key) - enc.writeBytes(objKey) - if v == 0 { - enc.writeBytes(nullBytes) - return - } - enc.buf = strconv.AppendFloat(enc.buf, float64(v), 'f', -1, 32) -} diff --git a/vendor/github.com/francoispqt/gojay/encode_number_int.go b/vendor/github.com/francoispqt/gojay/encode_number_int.go deleted file mode 100644 index 2c4bbe343d..0000000000 --- a/vendor/github.com/francoispqt/gojay/encode_number_int.go +++ /dev/null @@ -1,500 +0,0 @@ -package gojay - -import "strconv" - -// EncodeInt encodes an int to JSON -func (enc *Encoder) EncodeInt(n int) error { - if enc.isPooled == 1 { - panic(InvalidUsagePooledEncoderError("Invalid usage of pooled encoder")) - } - _, _ = enc.encodeInt(n) - _, err := enc.Write() - if err != nil { - return err - } - return nil -} - -// encodeInt encodes an int to JSON -func (enc *Encoder) encodeInt(n int) ([]byte, error) { - enc.buf = strconv.AppendInt(enc.buf, int64(n), 10) - return enc.buf, nil -} - -// EncodeInt64 encodes an int64 to JSON -func (enc *Encoder) EncodeInt64(n int64) error { - if enc.isPooled == 1 { - panic(InvalidUsagePooledEncoderError("Invalid usage of pooled encoder")) - } - _, _ = enc.encodeInt64(n) - _, err := enc.Write() - if err != nil { - return err - } - return nil -} - -// encodeInt64 encodes an int to JSON -func (enc *Encoder) encodeInt64(n int64) ([]byte, error) { - enc.buf = strconv.AppendInt(enc.buf, n, 10) - return enc.buf, nil -} - -// AddInt adds an int to be encoded, must be used inside a slice or array encoding (does not encode a key) -func (enc *Encoder) AddInt(v int) { - enc.Int(v) -} - -// AddIntOmitEmpty adds an int to be encoded and skips it if its value is 0, -// must be used inside a slice or array encoding (does not encode a key). -func (enc *Encoder) AddIntOmitEmpty(v int) { - enc.IntOmitEmpty(v) -} - -// AddIntNullEmpty adds an int to be encoded and skips it if its value is 0, -// must be used inside a slice or array encoding (does not encode a key). -func (enc *Encoder) AddIntNullEmpty(v int) { - enc.IntNullEmpty(v) -} - -// Int adds an int to be encoded, must be used inside a slice or array encoding (does not encode a key) -func (enc *Encoder) Int(v int) { - enc.grow(10) - r := enc.getPreviousRune() - if r != '[' { - enc.writeByte(',') - } - enc.buf = strconv.AppendInt(enc.buf, int64(v), 10) -} - -// IntOmitEmpty adds an int to be encoded and skips it if its value is 0, -// must be used inside a slice or array encoding (does not encode a key). -func (enc *Encoder) IntOmitEmpty(v int) { - if v == 0 { - return - } - enc.grow(10) - r := enc.getPreviousRune() - if r != '[' { - enc.writeByte(',') - } - enc.buf = strconv.AppendInt(enc.buf, int64(v), 10) -} - -// IntNullEmpty adds an int to be encoded and skips it if its value is 0, -// must be used inside a slice or array encoding (does not encode a key). -func (enc *Encoder) IntNullEmpty(v int) { - enc.grow(10) - r := enc.getPreviousRune() - if r != '[' { - enc.writeByte(',') - } - if v == 0 { - enc.writeBytes(nullBytes) - return - } - enc.buf = strconv.AppendInt(enc.buf, int64(v), 10) -} - -// AddIntKey adds an int to be encoded, must be used inside an object as it will encode a key -func (enc *Encoder) AddIntKey(key string, v int) { - enc.IntKey(key, v) -} - -// AddIntKeyOmitEmpty adds an int to be encoded and skips it if its value is 0. -// Must be used inside an object as it will encode a key. -func (enc *Encoder) AddIntKeyOmitEmpty(key string, v int) { - enc.IntKeyOmitEmpty(key, v) -} - -// AddIntKeyNullEmpty adds an int to be encoded and skips it if its value is 0. -// Must be used inside an object as it will encode a key. -func (enc *Encoder) AddIntKeyNullEmpty(key string, v int) { - enc.IntKeyNullEmpty(key, v) -} - -// IntKey adds an int to be encoded, must be used inside an object as it will encode a key -func (enc *Encoder) IntKey(key string, v int) { - if enc.hasKeys { - if !enc.keyExists(key) { - return - } - } - enc.grow(10 + len(key)) - r := enc.getPreviousRune() - if r != '{' { - enc.writeByte(',') - } - enc.writeByte('"') - enc.writeStringEscape(key) - enc.writeBytes(objKey) - enc.buf = strconv.AppendInt(enc.buf, int64(v), 10) -} - -// IntKeyOmitEmpty adds an int to be encoded and skips it if its value is 0. -// Must be used inside an object as it will encode a key. -func (enc *Encoder) IntKeyOmitEmpty(key string, v int) { - if enc.hasKeys { - if !enc.keyExists(key) { - return - } - } - if v == 0 { - return - } - enc.grow(10 + len(key)) - r := enc.getPreviousRune() - if r != '{' && r != '[' { - enc.writeByte(',') - } - enc.writeByte('"') - enc.writeStringEscape(key) - enc.writeBytes(objKey) - enc.buf = strconv.AppendInt(enc.buf, int64(v), 10) -} - -// IntKeyNullEmpty adds an int to be encoded and skips it if its value is 0. -// Must be used inside an object as it will encode a key. -func (enc *Encoder) IntKeyNullEmpty(key string, v int) { - if enc.hasKeys { - if !enc.keyExists(key) { - return - } - } - enc.grow(10 + len(key)) - r := enc.getPreviousRune() - if r != '{' && r != '[' { - enc.writeByte(',') - } - enc.writeByte('"') - enc.writeStringEscape(key) - enc.writeBytes(objKey) - if v == 0 { - enc.writeBytes(nullBytes) - return - } - enc.buf = strconv.AppendInt(enc.buf, int64(v), 10) -} - -// AddInt64 adds an int to be encoded, must be used inside a slice or array encoding (does not encode a key) -func (enc *Encoder) AddInt64(v int64) { - enc.Int64(v) -} - -// AddInt64OmitEmpty adds an int to be encoded and skips it if its value is 0, -// must be used inside a slice or array encoding (does not encode a key). -func (enc *Encoder) AddInt64OmitEmpty(v int64) { - enc.Int64OmitEmpty(v) -} - -// AddInt64NullEmpty adds an int to be encoded and skips it if its value is 0, -// must be used inside a slice or array encoding (does not encode a key). -func (enc *Encoder) AddInt64NullEmpty(v int64) { - enc.Int64NullEmpty(v) -} - -// Int64 adds an int to be encoded, must be used inside a slice or array encoding (does not encode a key) -func (enc *Encoder) Int64(v int64) { - enc.grow(10) - r := enc.getPreviousRune() - if r != '[' { - enc.writeByte(',') - } - enc.buf = strconv.AppendInt(enc.buf, v, 10) -} - -// Int64OmitEmpty adds an int to be encoded and skips it if its value is 0, -// must be used inside a slice or array encoding (does not encode a key). -func (enc *Encoder) Int64OmitEmpty(v int64) { - if v == 0 { - return - } - enc.grow(10) - r := enc.getPreviousRune() - if r != '[' { - enc.writeByte(',') - } - enc.buf = strconv.AppendInt(enc.buf, v, 10) -} - -// Int64NullEmpty adds an int to be encoded and skips it if its value is 0, -// must be used inside a slice or array encoding (does not encode a key). -func (enc *Encoder) Int64NullEmpty(v int64) { - enc.grow(10) - r := enc.getPreviousRune() - if r != '[' { - enc.writeByte(',') - } - if v == 0 { - enc.writeBytes(nullBytes) - return - } - enc.buf = strconv.AppendInt(enc.buf, v, 10) -} - -// AddInt64Key adds an int64 to be encoded, must be used inside an object as it will encode a key -func (enc *Encoder) AddInt64Key(key string, v int64) { - enc.Int64Key(key, v) -} - -// AddInt64KeyOmitEmpty adds an int64 to be encoded and skips it if its value is 0. -// Must be used inside an object as it will encode a key. -func (enc *Encoder) AddInt64KeyOmitEmpty(key string, v int64) { - enc.Int64KeyOmitEmpty(key, v) -} - -// AddInt64KeyNullEmpty adds an int64 to be encoded and skips it if its value is 0. -// Must be used inside an object as it will encode a key. -func (enc *Encoder) AddInt64KeyNullEmpty(key string, v int64) { - enc.Int64KeyNullEmpty(key, v) -} - -// Int64Key adds an int64 to be encoded, must be used inside an object as it will encode a key -func (enc *Encoder) Int64Key(key string, v int64) { - if enc.hasKeys { - if !enc.keyExists(key) { - return - } - } - enc.grow(10 + len(key)) - r := enc.getPreviousRune() - if r != '{' { - enc.writeByte(',') - } - enc.writeByte('"') - enc.writeStringEscape(key) - enc.writeBytes(objKey) - enc.buf = strconv.AppendInt(enc.buf, v, 10) -} - -// Int64KeyOmitEmpty adds an int64 to be encoded and skips it if its value is 0. -// Must be used inside an object as it will encode a key. -func (enc *Encoder) Int64KeyOmitEmpty(key string, v int64) { - if v == 0 { - return - } - enc.grow(10 + len(key)) - r := enc.getPreviousRune() - if r != '{' { - enc.writeByte(',') - } - enc.writeByte('"') - enc.writeStringEscape(key) - enc.writeBytes(objKey) - enc.buf = strconv.AppendInt(enc.buf, v, 10) -} - -// Int64KeyNullEmpty adds an int64 to be encoded and skips it if its value is 0. -// Must be used inside an object as it will encode a key. -func (enc *Encoder) Int64KeyNullEmpty(key string, v int64) { - if enc.hasKeys { - if !enc.keyExists(key) { - return - } - } - enc.grow(10 + len(key)) - r := enc.getPreviousRune() - if r != '{' { - enc.writeByte(',') - } - enc.writeByte('"') - enc.writeStringEscape(key) - enc.writeBytes(objKey) - if v == 0 { - enc.writeBytes(nullBytes) - return - } - enc.buf = strconv.AppendInt(enc.buf, v, 10) -} - -// AddInt32 adds an int to be encoded, must be used inside a slice or array encoding (does not encode a key) -func (enc *Encoder) AddInt32(v int32) { - enc.Int64(int64(v)) -} - -// AddInt32OmitEmpty adds an int to be encoded and skips it if its value is 0, -// must be used inside a slice or array encoding (does not encode a key). -func (enc *Encoder) AddInt32OmitEmpty(v int32) { - enc.Int64OmitEmpty(int64(v)) -} - -// AddInt32NullEmpty adds an int to be encoded and skips it if its value is 0, -// must be used inside a slice or array encoding (does not encode a key). -func (enc *Encoder) AddInt32NullEmpty(v int32) { - enc.Int64NullEmpty(int64(v)) -} - -// Int32 adds an int to be encoded, must be used inside a slice or array encoding (does not encode a key) -func (enc *Encoder) Int32(v int32) { - enc.Int64(int64(v)) -} - -// Int32OmitEmpty adds an int to be encoded and skips it if its value is 0, -// must be used inside a slice or array encoding (does not encode a key). -func (enc *Encoder) Int32OmitEmpty(v int32) { - enc.Int64OmitEmpty(int64(v)) -} - -// Int32NullEmpty adds an int to be encoded and skips it if its value is 0, -// must be used inside a slice or array encoding (does not encode a key). -func (enc *Encoder) Int32NullEmpty(v int32) { - enc.Int64NullEmpty(int64(v)) -} - -// AddInt32Key adds an int32 to be encoded, must be used inside an object as it will encode a key -func (enc *Encoder) AddInt32Key(key string, v int32) { - enc.Int64Key(key, int64(v)) -} - -// AddInt32KeyOmitEmpty adds an int32 to be encoded and skips it if its value is 0. -// Must be used inside an object as it will encode a key. -func (enc *Encoder) AddInt32KeyOmitEmpty(key string, v int32) { - enc.Int64KeyOmitEmpty(key, int64(v)) -} - -// Int32Key adds an int32 to be encoded, must be used inside an object as it will encode a key -func (enc *Encoder) Int32Key(key string, v int32) { - enc.Int64Key(key, int64(v)) -} - -// Int32KeyOmitEmpty adds an int32 to be encoded and skips it if its value is 0. -// Must be used inside an object as it will encode a key. -func (enc *Encoder) Int32KeyOmitEmpty(key string, v int32) { - enc.Int64KeyOmitEmpty(key, int64(v)) -} - -// Int32KeyNullEmpty adds an int32 to be encoded and skips it if its value is 0. -// Must be used inside an object as it will encode a key. -func (enc *Encoder) Int32KeyNullEmpty(key string, v int32) { - enc.Int64KeyNullEmpty(key, int64(v)) -} - -// AddInt16 adds an int to be encoded, must be used inside a slice or array encoding (does not encode a key) -func (enc *Encoder) AddInt16(v int16) { - enc.Int64(int64(v)) -} - -// AddInt16OmitEmpty adds an int to be encoded and skips it if its value is 0, -// must be used inside a slice or array encoding (does not encode a key). -func (enc *Encoder) AddInt16OmitEmpty(v int16) { - enc.Int64OmitEmpty(int64(v)) -} - -// Int16 adds an int to be encoded, must be used inside a slice or array encoding (does not encode a key) -func (enc *Encoder) Int16(v int16) { - enc.Int64(int64(v)) -} - -// Int16OmitEmpty adds an int to be encoded and skips it if its value is 0, -// must be used inside a slice or array encoding (does not encode a key). -func (enc *Encoder) Int16OmitEmpty(v int16) { - enc.Int64OmitEmpty(int64(v)) -} - -// Int16NullEmpty adds an int to be encoded and skips it if its value is 0, -// must be used inside a slice or array encoding (does not encode a key). -func (enc *Encoder) Int16NullEmpty(v int16) { - enc.Int64NullEmpty(int64(v)) -} - -// AddInt16Key adds an int16 to be encoded, must be used inside an object as it will encode a key -func (enc *Encoder) AddInt16Key(key string, v int16) { - enc.Int64Key(key, int64(v)) -} - -// AddInt16KeyOmitEmpty adds an int16 to be encoded and skips it if its value is 0. -// Must be used inside an object as it will encode a key. -func (enc *Encoder) AddInt16KeyOmitEmpty(key string, v int16) { - enc.Int64KeyOmitEmpty(key, int64(v)) -} - -// AddInt16KeyNullEmpty adds an int16 to be encoded and skips it if its value is 0. -// Must be used inside an object as it will encode a key. -func (enc *Encoder) AddInt16KeyNullEmpty(key string, v int16) { - enc.Int64KeyNullEmpty(key, int64(v)) -} - -// Int16Key adds an int16 to be encoded, must be used inside an object as it will encode a key -func (enc *Encoder) Int16Key(key string, v int16) { - enc.Int64Key(key, int64(v)) -} - -// Int16KeyOmitEmpty adds an int16 to be encoded and skips it if its value is 0. -// Must be used inside an object as it will encode a key. -func (enc *Encoder) Int16KeyOmitEmpty(key string, v int16) { - enc.Int64KeyOmitEmpty(key, int64(v)) -} - -// Int16KeyNullEmpty adds an int16 to be encoded and skips it if its value is 0. -// Must be used inside an object as it will encode a key. -func (enc *Encoder) Int16KeyNullEmpty(key string, v int16) { - enc.Int64KeyNullEmpty(key, int64(v)) -} - -// AddInt8 adds an int to be encoded, must be used inside a slice or array encoding (does not encode a key) -func (enc *Encoder) AddInt8(v int8) { - enc.Int64(int64(v)) -} - -// AddInt8OmitEmpty adds an int to be encoded and skips it if its value is 0, -// must be used inside a slice or array encoding (does not encode a key). -func (enc *Encoder) AddInt8OmitEmpty(v int8) { - enc.Int64OmitEmpty(int64(v)) -} - -// AddInt8NullEmpty adds an int to be encoded and skips it if its value is 0, -// must be used inside a slice or array encoding (does not encode a key). -func (enc *Encoder) AddInt8NullEmpty(v int8) { - enc.Int64NullEmpty(int64(v)) -} - -// Int8 adds an int to be encoded, must be used inside a slice or array encoding (does not encode a key) -func (enc *Encoder) Int8(v int8) { - enc.Int64(int64(v)) -} - -// Int8OmitEmpty adds an int to be encoded and skips it if its value is 0, -// must be used inside a slice or array encoding (does not encode a key). -func (enc *Encoder) Int8OmitEmpty(v int8) { - enc.Int64OmitEmpty(int64(v)) -} - -// Int8NullEmpty adds an int to be encoded and skips it if its value is 0, -// must be used inside a slice or array encoding (does not encode a key). -func (enc *Encoder) Int8NullEmpty(v int8) { - enc.Int64NullEmpty(int64(v)) -} - -// AddInt8Key adds an int8 to be encoded, must be used inside an object as it will encode a key -func (enc *Encoder) AddInt8Key(key string, v int8) { - enc.Int64Key(key, int64(v)) -} - -// AddInt8KeyOmitEmpty adds an int8 to be encoded and skips it if its value is 0. -// Must be used inside an object as it will encode a key. -func (enc *Encoder) AddInt8KeyOmitEmpty(key string, v int8) { - enc.Int64KeyOmitEmpty(key, int64(v)) -} - -// AddInt8KeyNullEmpty adds an int8 to be encoded and skips it if its value is 0. -// Must be used inside an object as it will encode a key. -func (enc *Encoder) AddInt8KeyNullEmpty(key string, v int8) { - enc.Int64KeyNullEmpty(key, int64(v)) -} - -// Int8Key adds an int8 to be encoded, must be used inside an object as it will encode a key -func (enc *Encoder) Int8Key(key string, v int8) { - enc.Int64Key(key, int64(v)) -} - -// Int8KeyOmitEmpty adds an int8 to be encoded and skips it if its value is 0. -// Must be used inside an object as it will encode a key. -func (enc *Encoder) Int8KeyOmitEmpty(key string, v int8) { - enc.Int64KeyOmitEmpty(key, int64(v)) -} - -// Int8KeyNullEmpty adds an int8 to be encoded and skips it if its value is 0. -// Must be used inside an object as it will encode a key. -func (enc *Encoder) Int8KeyNullEmpty(key string, v int8) { - enc.Int64KeyNullEmpty(key, int64(v)) -} diff --git a/vendor/github.com/francoispqt/gojay/encode_number_uint.go b/vendor/github.com/francoispqt/gojay/encode_number_uint.go deleted file mode 100644 index cd69b13fd1..0000000000 --- a/vendor/github.com/francoispqt/gojay/encode_number_uint.go +++ /dev/null @@ -1,362 +0,0 @@ -package gojay - -import "strconv" - -// EncodeUint64 encodes an int64 to JSON -func (enc *Encoder) EncodeUint64(n uint64) error { - if enc.isPooled == 1 { - panic(InvalidUsagePooledEncoderError("Invalid usage of pooled encoder")) - } - _, _ = enc.encodeUint64(n) - _, err := enc.Write() - if err != nil { - return err - } - return nil -} - -// encodeUint64 encodes an int to JSON -func (enc *Encoder) encodeUint64(n uint64) ([]byte, error) { - enc.buf = strconv.AppendUint(enc.buf, n, 10) - return enc.buf, nil -} - -// AddUint64 adds an int to be encoded, must be used inside a slice or array encoding (does not encode a key) -func (enc *Encoder) AddUint64(v uint64) { - enc.Uint64(v) -} - -// AddUint64OmitEmpty adds an int to be encoded and skips it if its value is 0, -// must be used inside a slice or array encoding (does not encode a key). -func (enc *Encoder) AddUint64OmitEmpty(v uint64) { - enc.Uint64OmitEmpty(v) -} - -// AddUint64NullEmpty adds an int to be encoded and skips it if its value is 0, -// must be used inside a slice or array encoding (does not encode a key). -func (enc *Encoder) AddUint64NullEmpty(v uint64) { - enc.Uint64NullEmpty(v) -} - -// Uint64 adds an int to be encoded, must be used inside a slice or array encoding (does not encode a key) -func (enc *Encoder) Uint64(v uint64) { - enc.grow(10) - r := enc.getPreviousRune() - if r != '[' { - enc.writeByte(',') - } - enc.buf = strconv.AppendUint(enc.buf, v, 10) -} - -// Uint64OmitEmpty adds an int to be encoded and skips it if its value is 0, -// must be used inside a slice or array encoding (does not encode a key). -func (enc *Encoder) Uint64OmitEmpty(v uint64) { - if v == 0 { - return - } - enc.grow(10) - r := enc.getPreviousRune() - if r != '[' { - enc.writeByte(',') - } - enc.buf = strconv.AppendUint(enc.buf, v, 10) -} - -// Uint64NullEmpty adds an int to be encoded and skips it if its value is 0, -// must be used inside a slice or array encoding (does not encode a key). -func (enc *Encoder) Uint64NullEmpty(v uint64) { - enc.grow(10) - r := enc.getPreviousRune() - if r != '[' { - enc.writeByte(',') - } - if v == 0 { - enc.writeBytes(nullBytes) - return - } - enc.buf = strconv.AppendUint(enc.buf, v, 10) -} - -// AddUint64Key adds an int to be encoded, must be used inside an object as it will encode a key -func (enc *Encoder) AddUint64Key(key string, v uint64) { - enc.Uint64Key(key, v) -} - -// AddUint64KeyOmitEmpty adds an int to be encoded and skips it if its value is 0. -// Must be used inside an object as it will encode a key. -func (enc *Encoder) AddUint64KeyOmitEmpty(key string, v uint64) { - enc.Uint64KeyOmitEmpty(key, v) -} - -// AddUint64KeyNullEmpty adds an int to be encoded and skips it if its value is 0. -// Must be used inside an object as it will encode a key. -func (enc *Encoder) AddUint64KeyNullEmpty(key string, v uint64) { - enc.Uint64KeyNullEmpty(key, v) -} - -// Uint64Key adds an int to be encoded, must be used inside an object as it will encode a key -func (enc *Encoder) Uint64Key(key string, v uint64) { - if enc.hasKeys { - if !enc.keyExists(key) { - return - } - } - enc.grow(10 + len(key)) - r := enc.getPreviousRune() - if r != '{' { - enc.writeByte(',') - } - enc.writeByte('"') - enc.writeStringEscape(key) - enc.writeBytes(objKey) - enc.buf = strconv.AppendUint(enc.buf, v, 10) -} - -// Uint64KeyOmitEmpty adds an int to be encoded and skips it if its value is 0. -// Must be used inside an object as it will encode a key. -func (enc *Encoder) Uint64KeyOmitEmpty(key string, v uint64) { - if enc.hasKeys { - if !enc.keyExists(key) { - return - } - } - if v == 0 { - return - } - enc.grow(10 + len(key)) - r := enc.getPreviousRune() - if r != '{' && r != '[' { - enc.writeByte(',') - } - enc.writeByte('"') - enc.writeStringEscape(key) - enc.writeBytes(objKey) - enc.buf = strconv.AppendUint(enc.buf, v, 10) -} - -// Uint64KeyNullEmpty adds an int to be encoded and skips it if its value is 0. -// Must be used inside an object as it will encode a key. -func (enc *Encoder) Uint64KeyNullEmpty(key string, v uint64) { - if enc.hasKeys { - if !enc.keyExists(key) { - return - } - } - enc.grow(10 + len(key)) - r := enc.getPreviousRune() - if r != '{' && r != '[' { - enc.writeByte(',') - } - enc.writeByte('"') - enc.writeStringEscape(key) - enc.writeBytes(objKey) - if v == 0 { - enc.writeBytes(nullBytes) - return - } - enc.buf = strconv.AppendUint(enc.buf, v, 10) -} - -// AddUint32 adds an int to be encoded, must be used inside a slice or array encoding (does not encode a key) -func (enc *Encoder) AddUint32(v uint32) { - enc.Uint64(uint64(v)) -} - -// AddUint32OmitEmpty adds an int to be encoded and skips it if its value is 0, -// must be used inside a slice or array encoding (does not encode a key). -func (enc *Encoder) AddUint32OmitEmpty(v uint32) { - enc.Uint64OmitEmpty(uint64(v)) -} - -// AddUint32NullEmpty adds an int to be encoded and skips it if its value is 0, -// must be used inside a slice or array encoding (does not encode a key). -func (enc *Encoder) AddUint32NullEmpty(v uint32) { - enc.Uint64NullEmpty(uint64(v)) -} - -// Uint32 adds an int to be encoded, must be used inside a slice or array encoding (does not encode a key) -func (enc *Encoder) Uint32(v uint32) { - enc.Uint64(uint64(v)) -} - -// Uint32OmitEmpty adds an int to be encoded and skips it if its value is 0, -// must be used inside a slice or array encoding (does not encode a key). -func (enc *Encoder) Uint32OmitEmpty(v uint32) { - enc.Uint64OmitEmpty(uint64(v)) -} - -// Uint32NullEmpty adds an int to be encoded and skips it if its value is 0, -// must be used inside a slice or array encoding (does not encode a key). -func (enc *Encoder) Uint32NullEmpty(v uint32) { - enc.Uint64NullEmpty(uint64(v)) -} - -// AddUint32Key adds an int to be encoded, must be used inside an object as it will encode a key -func (enc *Encoder) AddUint32Key(key string, v uint32) { - enc.Uint64Key(key, uint64(v)) -} - -// AddUint32KeyOmitEmpty adds an int to be encoded and skips it if its value is 0. -// Must be used inside an object as it will encode a key. -func (enc *Encoder) AddUint32KeyOmitEmpty(key string, v uint32) { - enc.Uint64KeyOmitEmpty(key, uint64(v)) -} - -// AddUint32KeyNullEmpty adds an int to be encoded and skips it if its value is 0. -// Must be used inside an object as it will encode a key. -func (enc *Encoder) AddUint32KeyNullEmpty(key string, v uint32) { - enc.Uint64KeyNullEmpty(key, uint64(v)) -} - -// Uint32Key adds an int to be encoded, must be used inside an object as it will encode a key -func (enc *Encoder) Uint32Key(key string, v uint32) { - enc.Uint64Key(key, uint64(v)) -} - -// Uint32KeyOmitEmpty adds an int to be encoded and skips it if its value is 0. -// Must be used inside an object as it will encode a key. -func (enc *Encoder) Uint32KeyOmitEmpty(key string, v uint32) { - enc.Uint64KeyOmitEmpty(key, uint64(v)) -} - -// Uint32KeyNullEmpty adds an int to be encoded and skips it if its value is 0. -// Must be used inside an object as it will encode a key. -func (enc *Encoder) Uint32KeyNullEmpty(key string, v uint32) { - enc.Uint64KeyNullEmpty(key, uint64(v)) -} - -// AddUint16 adds an int to be encoded, must be used inside a slice or array encoding (does not encode a key) -func (enc *Encoder) AddUint16(v uint16) { - enc.Uint64(uint64(v)) -} - -// AddUint16OmitEmpty adds an int to be encoded and skips it if its value is 0, -// must be used inside a slice or array encoding (does not encode a key). -func (enc *Encoder) AddUint16OmitEmpty(v uint16) { - enc.Uint64OmitEmpty(uint64(v)) -} - -// AddUint16NullEmpty adds an int to be encoded and skips it if its value is 0, -// must be used inside a slice or array encoding (does not encode a key). -func (enc *Encoder) AddUint16NullEmpty(v uint16) { - enc.Uint64NullEmpty(uint64(v)) -} - -// Uint16 adds an int to be encoded, must be used inside a slice or array encoding (does not encode a key) -func (enc *Encoder) Uint16(v uint16) { - enc.Uint64(uint64(v)) -} - -// Uint16OmitEmpty adds an int to be encoded and skips it if its value is 0, -// must be used inside a slice or array encoding (does not encode a key). -func (enc *Encoder) Uint16OmitEmpty(v uint16) { - enc.Uint64OmitEmpty(uint64(v)) -} - -// Uint16NullEmpty adds an int to be encoded and skips it if its value is 0, -// must be used inside a slice or array encoding (does not encode a key). -func (enc *Encoder) Uint16NullEmpty(v uint16) { - enc.Uint64NullEmpty(uint64(v)) -} - -// AddUint16Key adds an int to be encoded, must be used inside an object as it will encode a key -func (enc *Encoder) AddUint16Key(key string, v uint16) { - enc.Uint64Key(key, uint64(v)) -} - -// AddUint16KeyOmitEmpty adds an int to be encoded and skips it if its value is 0. -// Must be used inside an object as it will encode a key. -func (enc *Encoder) AddUint16KeyOmitEmpty(key string, v uint16) { - enc.Uint64KeyOmitEmpty(key, uint64(v)) -} - -// AddUint16KeyNullEmpty adds an int to be encoded and skips it if its value is 0. -// Must be used inside an object as it will encode a key. -func (enc *Encoder) AddUint16KeyNullEmpty(key string, v uint16) { - enc.Uint64KeyNullEmpty(key, uint64(v)) -} - -// Uint16Key adds an int to be encoded, must be used inside an object as it will encode a key -func (enc *Encoder) Uint16Key(key string, v uint16) { - enc.Uint64Key(key, uint64(v)) -} - -// Uint16KeyOmitEmpty adds an int to be encoded and skips it if its value is 0. -// Must be used inside an object as it will encode a key. -func (enc *Encoder) Uint16KeyOmitEmpty(key string, v uint16) { - enc.Uint64KeyOmitEmpty(key, uint64(v)) -} - -// Uint16KeyNullEmpty adds an int to be encoded and skips it if its value is 0. -// Must be used inside an object as it will encode a key. -func (enc *Encoder) Uint16KeyNullEmpty(key string, v uint16) { - enc.Uint64KeyNullEmpty(key, uint64(v)) -} - -// AddUint8 adds an int to be encoded, must be used inside a slice or array encoding (does not encode a key) -func (enc *Encoder) AddUint8(v uint8) { - enc.Uint64(uint64(v)) -} - -// AddUint8OmitEmpty adds an int to be encoded and skips it if its value is 0, -// must be used inside a slice or array encoding (does not encode a key). -func (enc *Encoder) AddUint8OmitEmpty(v uint8) { - enc.Uint64OmitEmpty(uint64(v)) -} - -// AddUint8NullEmpty adds an int to be encoded and skips it if its value is 0, -// must be used inside a slice or array encoding (does not encode a key). -func (enc *Encoder) AddUint8NullEmpty(v uint8) { - enc.Uint64NullEmpty(uint64(v)) -} - -// Uint8 adds an int to be encoded, must be used inside a slice or array encoding (does not encode a key) -func (enc *Encoder) Uint8(v uint8) { - enc.Uint64(uint64(v)) -} - -// Uint8OmitEmpty adds an int to be encoded and skips it if its value is 0, -// must be used inside a slice or array encoding (does not encode a key). -func (enc *Encoder) Uint8OmitEmpty(v uint8) { - enc.Uint64OmitEmpty(uint64(v)) -} - -// Uint8NullEmpty adds an int to be encoded and skips it if its value is 0, -// must be used inside a slice or array encoding (does not encode a key). -func (enc *Encoder) Uint8NullEmpty(v uint8) { - enc.Uint64NullEmpty(uint64(v)) -} - -// AddUint8Key adds an int to be encoded, must be used inside an object as it will encode a key -func (enc *Encoder) AddUint8Key(key string, v uint8) { - enc.Uint64Key(key, uint64(v)) -} - -// AddUint8KeyOmitEmpty adds an int to be encoded and skips it if its value is 0. -// Must be used inside an object as it will encode a key. -func (enc *Encoder) AddUint8KeyOmitEmpty(key string, v uint8) { - enc.Uint64KeyOmitEmpty(key, uint64(v)) -} - -// AddUint8KeyNullEmpty adds an int to be encoded and skips it if its value is 0. -// Must be used inside an object as it will encode a key. -func (enc *Encoder) AddUint8KeyNullEmpty(key string, v uint8) { - enc.Uint64KeyNullEmpty(key, uint64(v)) -} - -// Uint8Key adds an int to be encoded, must be used inside an object as it will encode a key -func (enc *Encoder) Uint8Key(key string, v uint8) { - enc.Uint64Key(key, uint64(v)) -} - -// Uint8KeyOmitEmpty adds an int to be encoded and skips it if its value is 0. -// Must be used inside an object as it will encode a key. -func (enc *Encoder) Uint8KeyOmitEmpty(key string, v uint8) { - enc.Uint64KeyOmitEmpty(key, uint64(v)) -} - -// Uint8KeyNullEmpty adds an int to be encoded and skips it if its value is 0. -// Must be used inside an object as it will encode a key. -func (enc *Encoder) Uint8KeyNullEmpty(key string, v uint8) { - enc.Uint64KeyNullEmpty(key, uint64(v)) -} diff --git a/vendor/github.com/francoispqt/gojay/encode_object.go b/vendor/github.com/francoispqt/gojay/encode_object.go deleted file mode 100644 index 5f2c8cf3f6..0000000000 --- a/vendor/github.com/francoispqt/gojay/encode_object.go +++ /dev/null @@ -1,400 +0,0 @@ -package gojay - -var objKeyStr = []byte(`":"`) -var objKeyObj = []byte(`":{`) -var objKeyArr = []byte(`":[`) -var objKey = []byte(`":`) - -// EncodeObject encodes an object to JSON -func (enc *Encoder) EncodeObject(v MarshalerJSONObject) error { - if enc.isPooled == 1 { - panic(InvalidUsagePooledEncoderError("Invalid usage of pooled encoder")) - } - _, err := enc.encodeObject(v) - if err != nil { - enc.err = err - return err - } - _, err = enc.Write() - if err != nil { - enc.err = err - return err - } - return nil -} - -// EncodeObjectKeys encodes an object to JSON -func (enc *Encoder) EncodeObjectKeys(v MarshalerJSONObject, keys []string) error { - if enc.isPooled == 1 { - panic(InvalidUsagePooledEncoderError("Invalid usage of pooled encoder")) - } - enc.hasKeys = true - enc.keys = keys - _, err := enc.encodeObject(v) - if err != nil { - enc.err = err - return err - } - _, err = enc.Write() - if err != nil { - enc.err = err - return err - } - return nil -} - -func (enc *Encoder) encodeObject(v MarshalerJSONObject) ([]byte, error) { - enc.grow(512) - enc.writeByte('{') - if !v.IsNil() { - v.MarshalJSONObject(enc) - } - if enc.hasKeys { - enc.hasKeys = false - enc.keys = nil - } - enc.writeByte('}') - return enc.buf, enc.err -} - -// AddObject adds an object to be encoded, must be used inside a slice or array encoding (does not encode a key) -// value must implement MarshalerJSONObject -func (enc *Encoder) AddObject(v MarshalerJSONObject) { - enc.Object(v) -} - -// AddObjectOmitEmpty adds an object to be encoded or skips it if IsNil returns true. -// Must be used inside a slice or array encoding (does not encode a key) -// value must implement MarshalerJSONObject -func (enc *Encoder) AddObjectOmitEmpty(v MarshalerJSONObject) { - enc.ObjectOmitEmpty(v) -} - -// AddObjectNullEmpty adds an object to be encoded or skips it if IsNil returns true. -// Must be used inside a slice or array encoding (does not encode a key) -// value must implement MarshalerJSONObject -func (enc *Encoder) AddObjectNullEmpty(v MarshalerJSONObject) { - enc.ObjectNullEmpty(v) -} - -// AddObjectKey adds a struct to be encoded, must be used inside an object as it will encode a key -// value must implement MarshalerJSONObject -func (enc *Encoder) AddObjectKey(key string, v MarshalerJSONObject) { - enc.ObjectKey(key, v) -} - -// AddObjectKeyOmitEmpty adds an object to be encoded or skips it if IsNil returns true. -// Must be used inside a slice or array encoding (does not encode a key) -// value must implement MarshalerJSONObject -func (enc *Encoder) AddObjectKeyOmitEmpty(key string, v MarshalerJSONObject) { - enc.ObjectKeyOmitEmpty(key, v) -} - -// AddObjectKeyNullEmpty adds an object to be encoded or skips it if IsNil returns true. -// Must be used inside a slice or array encoding (does not encode a key) -// value must implement MarshalerJSONObject -func (enc *Encoder) AddObjectKeyNullEmpty(key string, v MarshalerJSONObject) { - enc.ObjectKeyNullEmpty(key, v) -} - -// Object adds an object to be encoded, must be used inside a slice or array encoding (does not encode a key) -// value must implement MarshalerJSONObject -func (enc *Encoder) Object(v MarshalerJSONObject) { - if v.IsNil() { - enc.grow(2) - r := enc.getPreviousRune() - if r != '{' && r != '[' { - enc.writeByte(',') - } - enc.writeByte('{') - enc.writeByte('}') - return - } - enc.grow(4) - r := enc.getPreviousRune() - if r != '[' { - enc.writeByte(',') - } - enc.writeByte('{') - - var origHasKeys = enc.hasKeys - var origKeys = enc.keys - enc.hasKeys = false - enc.keys = nil - - v.MarshalJSONObject(enc) - - enc.hasKeys = origHasKeys - enc.keys = origKeys - - enc.writeByte('}') -} - -// ObjectWithKeys adds an object to be encoded, must be used inside a slice or array encoding (does not encode a key) -// value must implement MarshalerJSONObject. It will only encode the keys in keys. -func (enc *Encoder) ObjectWithKeys(v MarshalerJSONObject, keys []string) { - if v.IsNil() { - enc.grow(2) - r := enc.getPreviousRune() - if r != '{' && r != '[' { - enc.writeByte(',') - } - enc.writeByte('{') - enc.writeByte('}') - return - } - enc.grow(4) - r := enc.getPreviousRune() - if r != '[' { - enc.writeByte(',') - } - enc.writeByte('{') - - var origKeys = enc.keys - var origHasKeys = enc.hasKeys - enc.hasKeys = true - enc.keys = keys - - v.MarshalJSONObject(enc) - - enc.hasKeys = origHasKeys - enc.keys = origKeys - - enc.writeByte('}') -} - -// ObjectOmitEmpty adds an object to be encoded or skips it if IsNil returns true. -// Must be used inside a slice or array encoding (does not encode a key) -// value must implement MarshalerJSONObject -func (enc *Encoder) ObjectOmitEmpty(v MarshalerJSONObject) { - if v.IsNil() { - return - } - enc.grow(2) - r := enc.getPreviousRune() - if r != '[' { - enc.writeByte(',') - } - enc.writeByte('{') - - var origHasKeys = enc.hasKeys - var origKeys = enc.keys - enc.hasKeys = false - enc.keys = nil - - v.MarshalJSONObject(enc) - - enc.hasKeys = origHasKeys - enc.keys = origKeys - - enc.writeByte('}') -} - -// ObjectNullEmpty adds an object to be encoded or skips it if IsNil returns true. -// Must be used inside a slice or array encoding (does not encode a key) -// value must implement MarshalerJSONObject -func (enc *Encoder) ObjectNullEmpty(v MarshalerJSONObject) { - enc.grow(2) - r := enc.getPreviousRune() - if r != '[' { - enc.writeByte(',') - } - if v.IsNil() { - enc.writeBytes(nullBytes) - return - } - enc.writeByte('{') - - var origHasKeys = enc.hasKeys - var origKeys = enc.keys - enc.hasKeys = false - enc.keys = nil - - v.MarshalJSONObject(enc) - - enc.hasKeys = origHasKeys - enc.keys = origKeys - - enc.writeByte('}') -} - -// ObjectKey adds a struct to be encoded, must be used inside an object as it will encode a key -// value must implement MarshalerJSONObject -func (enc *Encoder) ObjectKey(key string, v MarshalerJSONObject) { - if enc.hasKeys { - if !enc.keyExists(key) { - return - } - } - if v.IsNil() { - enc.grow(2 + len(key)) - r := enc.getPreviousRune() - if r != '{' { - enc.writeByte(',') - } - enc.writeByte('"') - enc.writeStringEscape(key) - enc.writeBytes(objKeyObj) - enc.writeByte('}') - return - } - enc.grow(5 + len(key)) - r := enc.getPreviousRune() - if r != '{' { - enc.writeByte(',') - } - enc.writeByte('"') - enc.writeStringEscape(key) - enc.writeBytes(objKeyObj) - - var origHasKeys = enc.hasKeys - var origKeys = enc.keys - enc.hasKeys = false - enc.keys = nil - - v.MarshalJSONObject(enc) - - enc.hasKeys = origHasKeys - enc.keys = origKeys - - enc.writeByte('}') -} - -// ObjectKeyWithKeys adds a struct to be encoded, must be used inside an object as it will encode a key. -// Value must implement MarshalerJSONObject. It will only encode the keys in keys. -func (enc *Encoder) ObjectKeyWithKeys(key string, value MarshalerJSONObject, keys []string) { - if enc.hasKeys { - if !enc.keyExists(key) { - return - } - } - if value.IsNil() { - enc.grow(2 + len(key)) - r := enc.getPreviousRune() - if r != '{' { - enc.writeByte(',') - } - enc.writeByte('"') - enc.writeStringEscape(key) - enc.writeBytes(objKeyObj) - enc.writeByte('}') - return - } - enc.grow(5 + len(key)) - r := enc.getPreviousRune() - if r != '{' { - enc.writeByte(',') - } - enc.writeByte('"') - enc.writeStringEscape(key) - enc.writeBytes(objKeyObj) - var origKeys = enc.keys - var origHasKeys = enc.hasKeys - enc.hasKeys = true - enc.keys = keys - value.MarshalJSONObject(enc) - enc.hasKeys = origHasKeys - enc.keys = origKeys - enc.writeByte('}') -} - -// ObjectKeyOmitEmpty adds an object to be encoded or skips it if IsNil returns true. -// Must be used inside a slice or array encoding (does not encode a key) -// value must implement MarshalerJSONObject -func (enc *Encoder) ObjectKeyOmitEmpty(key string, v MarshalerJSONObject) { - if enc.hasKeys { - if !enc.keyExists(key) { - return - } - } - if v.IsNil() { - return - } - enc.grow(5 + len(key)) - r := enc.getPreviousRune() - if r != '{' { - enc.writeByte(',') - } - enc.writeByte('"') - enc.writeStringEscape(key) - enc.writeBytes(objKeyObj) - - var origHasKeys = enc.hasKeys - var origKeys = enc.keys - enc.hasKeys = false - enc.keys = nil - - v.MarshalJSONObject(enc) - - enc.hasKeys = origHasKeys - enc.keys = origKeys - - enc.writeByte('}') -} - -// ObjectKeyNullEmpty adds an object to be encoded or skips it if IsNil returns true. -// Must be used inside a slice or array encoding (does not encode a key) -// value must implement MarshalerJSONObject -func (enc *Encoder) ObjectKeyNullEmpty(key string, v MarshalerJSONObject) { - if enc.hasKeys { - if !enc.keyExists(key) { - return - } - } - enc.grow(5 + len(key)) - r := enc.getPreviousRune() - if r != '{' { - enc.writeByte(',') - } - enc.writeByte('"') - enc.writeStringEscape(key) - enc.writeBytes(objKey) - if v.IsNil() { - enc.writeBytes(nullBytes) - return - } - enc.writeByte('{') - - var origHasKeys = enc.hasKeys - var origKeys = enc.keys - enc.hasKeys = false - enc.keys = nil - - v.MarshalJSONObject(enc) - - enc.hasKeys = origHasKeys - enc.keys = origKeys - - enc.writeByte('}') -} - -// EncodeObjectFunc is a custom func type implementing MarshaleObject. -// Use it to cast a func(*Encoder) to Marshal an object. -// -// enc := gojay.NewEncoder(io.Writer) -// enc.EncodeObject(gojay.EncodeObjectFunc(func(enc *gojay.Encoder) { -// enc.AddStringKey("hello", "world") -// })) -type EncodeObjectFunc func(*Encoder) - -// MarshalJSONObject implements MarshalerJSONObject. -func (f EncodeObjectFunc) MarshalJSONObject(enc *Encoder) { - f(enc) -} - -// IsNil implements MarshalerJSONObject. -func (f EncodeObjectFunc) IsNil() bool { - return f == nil -} - -func (enc *Encoder) keyExists(k string) bool { - if enc.keys == nil { - return false - } - for _, key := range enc.keys { - if key == k { - return true - } - } - return false -} diff --git a/vendor/github.com/francoispqt/gojay/encode_pool.go b/vendor/github.com/francoispqt/gojay/encode_pool.go deleted file mode 100644 index 3b26322530..0000000000 --- a/vendor/github.com/francoispqt/gojay/encode_pool.go +++ /dev/null @@ -1,50 +0,0 @@ -package gojay - -import ( - "io" - "sync" -) - -var encPool = sync.Pool{ - New: func() interface{} { - return NewEncoder(nil) - }, -} - -var streamEncPool = sync.Pool{ - New: func() interface{} { - return Stream.NewEncoder(nil) - }, -} - -func init() { - for i := 0; i < 32; i++ { - encPool.Put(NewEncoder(nil)) - } - for i := 0; i < 32; i++ { - streamEncPool.Put(Stream.NewEncoder(nil)) - } -} - -// NewEncoder returns a new encoder or borrows one from the pool -func NewEncoder(w io.Writer) *Encoder { - return &Encoder{w: w} -} - -// BorrowEncoder borrows an Encoder from the pool. -func BorrowEncoder(w io.Writer) *Encoder { - enc := encPool.Get().(*Encoder) - enc.w = w - enc.buf = enc.buf[:0] - enc.isPooled = 0 - enc.err = nil - enc.hasKeys = false - enc.keys = nil - return enc -} - -// Release sends back a Encoder to the pool. -func (enc *Encoder) Release() { - enc.isPooled = 1 - encPool.Put(enc) -} diff --git a/vendor/github.com/francoispqt/gojay/encode_slice.go b/vendor/github.com/francoispqt/gojay/encode_slice.go deleted file mode 100644 index 7d964df97a..0000000000 --- a/vendor/github.com/francoispqt/gojay/encode_slice.go +++ /dev/null @@ -1,113 +0,0 @@ -package gojay - -// AddSliceString marshals the given []string s -func (enc *Encoder) AddSliceString(s []string) { - enc.SliceString(s) -} - -// SliceString marshals the given []string s -func (enc *Encoder) SliceString(s []string) { - enc.Array(EncodeArrayFunc(func(enc *Encoder) { - for _, str := range s { - enc.String(str) - } - })) -} - -// AddSliceStringKey marshals the given []string s -func (enc *Encoder) AddSliceStringKey(k string, s []string) { - enc.SliceStringKey(k, s) -} - -// SliceStringKey marshals the given []string s -func (enc *Encoder) SliceStringKey(k string, s []string) { - enc.ArrayKey(k, EncodeArrayFunc(func(enc *Encoder) { - for _, str := range s { - enc.String(str) - } - })) -} - -// AddSliceInt marshals the given []int s -func (enc *Encoder) AddSliceInt(s []int) { - enc.SliceInt(s) -} - -// SliceInt marshals the given []int s -func (enc *Encoder) SliceInt(s []int) { - enc.Array(EncodeArrayFunc(func(enc *Encoder) { - for _, i := range s { - enc.Int(i) - } - })) -} - -// AddSliceIntKey marshals the given []int s -func (enc *Encoder) AddSliceIntKey(k string, s []int) { - enc.SliceIntKey(k, s) -} - -// SliceIntKey marshals the given []int s -func (enc *Encoder) SliceIntKey(k string, s []int) { - enc.ArrayKey(k, EncodeArrayFunc(func(enc *Encoder) { - for _, i := range s { - enc.Int(i) - } - })) -} - -// AddSliceFloat64 marshals the given []float64 s -func (enc *Encoder) AddSliceFloat64(s []float64) { - enc.SliceFloat64(s) -} - -// SliceFloat64 marshals the given []float64 s -func (enc *Encoder) SliceFloat64(s []float64) { - enc.Array(EncodeArrayFunc(func(enc *Encoder) { - for _, i := range s { - enc.Float64(i) - } - })) -} - -// AddSliceFloat64Key marshals the given []float64 s -func (enc *Encoder) AddSliceFloat64Key(k string, s []float64) { - enc.SliceFloat64Key(k, s) -} - -// SliceFloat64Key marshals the given []float64 s -func (enc *Encoder) SliceFloat64Key(k string, s []float64) { - enc.ArrayKey(k, EncodeArrayFunc(func(enc *Encoder) { - for _, i := range s { - enc.Float64(i) - } - })) -} - -// AddSliceBool marshals the given []bool s -func (enc *Encoder) AddSliceBool(s []bool) { - enc.SliceBool(s) -} - -// SliceBool marshals the given []bool s -func (enc *Encoder) SliceBool(s []bool) { - enc.Array(EncodeArrayFunc(func(enc *Encoder) { - for _, i := range s { - enc.Bool(i) - } - })) -} - -// AddSliceBoolKey marshals the given []bool s -func (enc *Encoder) AddSliceBoolKey(k string, s []bool) { - enc.SliceBoolKey(k, s) -} - -// SliceBoolKey marshals the given []bool s -func (enc *Encoder) SliceBoolKey(k string, s []bool) { - enc.ArrayKey(k, EncodeArrayFunc(func(enc *Encoder) { - for _, i := range s { - enc.Bool(i) - } - })) -} diff --git a/vendor/github.com/francoispqt/gojay/encode_sqlnull.go b/vendor/github.com/francoispqt/gojay/encode_sqlnull.go deleted file mode 100644 index 04ff5962a5..0000000000 --- a/vendor/github.com/francoispqt/gojay/encode_sqlnull.go +++ /dev/null @@ -1,377 +0,0 @@ -package gojay - -import "database/sql" - -// EncodeSQLNullString encodes a string to -func (enc *Encoder) EncodeSQLNullString(v *sql.NullString) error { - if enc.isPooled == 1 { - panic(InvalidUsagePooledEncoderError("Invalid usage of pooled encoder")) - } - _, _ = enc.encodeString(v.String) - _, err := enc.Write() - if err != nil { - enc.err = err - return err - } - return nil -} - -// AddSQLNullString adds a string to be encoded, must be used inside a slice or array encoding (does not encode a key) -func (enc *Encoder) AddSQLNullString(v *sql.NullString) { - enc.String(v.String) -} - -// AddSQLNullStringOmitEmpty adds a string to be encoded or skips it if it is zero value. -// Must be used inside a slice or array encoding (does not encode a key) -func (enc *Encoder) AddSQLNullStringOmitEmpty(v *sql.NullString) { - if v != nil && v.Valid && v.String != "" { - enc.StringOmitEmpty(v.String) - } -} - -// AddSQLNullStringNullEmpty adds a string to be encoded or skips it if it is zero value. -// Must be used inside a slice or array encoding (does not encode a key) -func (enc *Encoder) AddSQLNullStringNullEmpty(v *sql.NullString) { - if v != nil && v.Valid { - enc.StringNullEmpty(v.String) - } -} - -// AddSQLNullStringKey adds a string to be encoded, must be used inside an object as it will encode a key -func (enc *Encoder) AddSQLNullStringKey(key string, v *sql.NullString) { - enc.StringKey(key, v.String) -} - -// AddSQLNullStringKeyOmitEmpty adds a string to be encoded or skips it if it is zero value. -// Must be used inside an object as it will encode a key -func (enc *Encoder) AddSQLNullStringKeyOmitEmpty(key string, v *sql.NullString) { - if v != nil && v.Valid && v.String != "" { - enc.StringKeyOmitEmpty(key, v.String) - } -} - -// SQLNullString adds a string to be encoded, must be used inside an object as it will encode a key -func (enc *Encoder) SQLNullString(v *sql.NullString) { - enc.String(v.String) -} - -// SQLNullStringOmitEmpty adds a string to be encoded, must be used inside an object as it will encode a key -func (enc *Encoder) SQLNullStringOmitEmpty(v *sql.NullString) { - if v != nil && v.Valid && v.String != "" { - enc.String(v.String) - } -} - -// SQLNullStringNullEmpty adds a string to be encoded, must be used inside an object as it will encode a key -func (enc *Encoder) SQLNullStringNullEmpty(v *sql.NullString) { - if v != nil && v.Valid { - enc.StringNullEmpty(v.String) - } -} - -// SQLNullStringKey adds a string to be encoded, must be used inside an object as it will encode a key -func (enc *Encoder) SQLNullStringKey(key string, v *sql.NullString) { - enc.StringKey(key, v.String) -} - -// SQLNullStringKeyOmitEmpty adds a string to be encoded or skips it if it is zero value. -// Must be used inside an object as it will encode a key -func (enc *Encoder) SQLNullStringKeyOmitEmpty(key string, v *sql.NullString) { - if v != nil && v.Valid && v.String != "" { - enc.StringKeyOmitEmpty(key, v.String) - } -} - -// SQLNullStringKeyNullEmpty adds a string to be encoded or skips it if it is zero value. -// Must be used inside an object as it will encode a key -func (enc *Encoder) SQLNullStringKeyNullEmpty(key string, v *sql.NullString) { - if v != nil && v.Valid { - enc.StringKeyNullEmpty(key, v.String) - } -} - -// NullInt64 - -// EncodeSQLNullInt64 encodes a string to -func (enc *Encoder) EncodeSQLNullInt64(v *sql.NullInt64) error { - if enc.isPooled == 1 { - panic(InvalidUsagePooledEncoderError("Invalid usage of pooled encoder")) - } - _, _ = enc.encodeInt64(v.Int64) - _, err := enc.Write() - if err != nil { - enc.err = err - return err - } - return nil -} - -// AddSQLNullInt64 adds a string to be encoded, must be used inside a slice or array encoding (does not encode a key) -func (enc *Encoder) AddSQLNullInt64(v *sql.NullInt64) { - enc.Int64(v.Int64) -} - -// AddSQLNullInt64OmitEmpty adds a string to be encoded or skips it if it is zero value. -// Must be used inside a slice or array encoding (does not encode a key) -func (enc *Encoder) AddSQLNullInt64OmitEmpty(v *sql.NullInt64) { - if v != nil && v.Valid && v.Int64 != 0 { - enc.Int64OmitEmpty(v.Int64) - } -} - -// AddSQLNullInt64NullEmpty adds a string to be encoded or skips it if it is zero value. -// Must be used inside a slice or array encoding (does not encode a key) -func (enc *Encoder) AddSQLNullInt64NullEmpty(v *sql.NullInt64) { - if v != nil && v.Valid { - enc.Int64NullEmpty(v.Int64) - } -} - -// AddSQLNullInt64Key adds a string to be encoded, must be used inside an object as it will encode a key -func (enc *Encoder) AddSQLNullInt64Key(key string, v *sql.NullInt64) { - enc.Int64Key(key, v.Int64) -} - -// AddSQLNullInt64KeyOmitEmpty adds a string to be encoded or skips it if it is zero value. -// Must be used inside an object as it will encode a key -func (enc *Encoder) AddSQLNullInt64KeyOmitEmpty(key string, v *sql.NullInt64) { - if v != nil && v.Valid && v.Int64 != 0 { - enc.Int64KeyOmitEmpty(key, v.Int64) - } -} - -// AddSQLNullInt64KeyNullEmpty adds a string to be encoded or skips it if it is zero value. -// Must be used inside an object as it will encode a key -func (enc *Encoder) AddSQLNullInt64KeyNullEmpty(key string, v *sql.NullInt64) { - if v != nil && v.Valid { - enc.Int64KeyNullEmpty(key, v.Int64) - } -} - -// SQLNullInt64 adds a string to be encoded, must be used inside an object as it will encode a key -func (enc *Encoder) SQLNullInt64(v *sql.NullInt64) { - enc.Int64(v.Int64) -} - -// SQLNullInt64OmitEmpty adds a string to be encoded, must be used inside an object as it will encode a key -func (enc *Encoder) SQLNullInt64OmitEmpty(v *sql.NullInt64) { - if v != nil && v.Valid && v.Int64 != 0 { - enc.Int64(v.Int64) - } -} - -// SQLNullInt64NullEmpty adds a string to be encoded, must be used inside an object as it will encode a key -func (enc *Encoder) SQLNullInt64NullEmpty(v *sql.NullInt64) { - if v != nil && v.Valid { - enc.Int64NullEmpty(v.Int64) - } -} - -// SQLNullInt64Key adds a string to be encoded, must be used inside an object as it will encode a key -func (enc *Encoder) SQLNullInt64Key(key string, v *sql.NullInt64) { - enc.Int64Key(key, v.Int64) -} - -// SQLNullInt64KeyOmitEmpty adds a string to be encoded or skips it if it is zero value. -// Must be used inside an object as it will encode a key -func (enc *Encoder) SQLNullInt64KeyOmitEmpty(key string, v *sql.NullInt64) { - if v != nil && v.Valid && v.Int64 != 0 { - enc.Int64KeyOmitEmpty(key, v.Int64) - } -} - -// SQLNullInt64KeyNullEmpty adds a string to be encoded or skips it if it is zero value. -// Must be used inside an object as it will encode a key -func (enc *Encoder) SQLNullInt64KeyNullEmpty(key string, v *sql.NullInt64) { - if v != nil && v.Valid { - enc.Int64KeyNullEmpty(key, v.Int64) - } -} - -// NullFloat64 - -// EncodeSQLNullFloat64 encodes a string to -func (enc *Encoder) EncodeSQLNullFloat64(v *sql.NullFloat64) error { - if enc.isPooled == 1 { - panic(InvalidUsagePooledEncoderError("Invalid usage of pooled encoder")) - } - _, _ = enc.encodeFloat(v.Float64) - _, err := enc.Write() - if err != nil { - enc.err = err - return err - } - return nil -} - -// AddSQLNullFloat64 adds a string to be encoded, must be used inside a slice or array encoding (does not encode a key) -func (enc *Encoder) AddSQLNullFloat64(v *sql.NullFloat64) { - enc.Float64(v.Float64) -} - -// AddSQLNullFloat64OmitEmpty adds a string to be encoded or skips it if it is zero value. -// Must be used inside a slice or array encoding (does not encode a key) -func (enc *Encoder) AddSQLNullFloat64OmitEmpty(v *sql.NullFloat64) { - if v != nil && v.Valid && v.Float64 != 0 { - enc.Float64OmitEmpty(v.Float64) - } -} - -// AddSQLNullFloat64NullEmpty adds a string to be encoded or skips it if it is zero value. -// Must be used inside a slice or array encoding (does not encode a key) -func (enc *Encoder) AddSQLNullFloat64NullEmpty(v *sql.NullFloat64) { - if v != nil && v.Valid { - enc.Float64NullEmpty(v.Float64) - } -} - -// AddSQLNullFloat64Key adds a string to be encoded, must be used inside an object as it will encode a key -func (enc *Encoder) AddSQLNullFloat64Key(key string, v *sql.NullFloat64) { - enc.Float64Key(key, v.Float64) -} - -// AddSQLNullFloat64KeyOmitEmpty adds a string to be encoded or skips it if it is zero value. -// Must be used inside an object as it will encode a key -func (enc *Encoder) AddSQLNullFloat64KeyOmitEmpty(key string, v *sql.NullFloat64) { - if v != nil && v.Valid && v.Float64 != 0 { - enc.Float64KeyOmitEmpty(key, v.Float64) - } -} - -// AddSQLNullFloat64KeyNullEmpty adds a string to be encoded or skips it if it is zero value. -// Must be used inside an object as it will encode a key -func (enc *Encoder) AddSQLNullFloat64KeyNullEmpty(key string, v *sql.NullFloat64) { - if v != nil && v.Valid { - enc.Float64KeyNullEmpty(key, v.Float64) - } -} - -// SQLNullFloat64 adds a string to be encoded, must be used inside an object as it will encode a key -func (enc *Encoder) SQLNullFloat64(v *sql.NullFloat64) { - enc.Float64(v.Float64) -} - -// SQLNullFloat64OmitEmpty adds a string to be encoded, must be used inside an object as it will encode a key -func (enc *Encoder) SQLNullFloat64OmitEmpty(v *sql.NullFloat64) { - if v != nil && v.Valid && v.Float64 != 0 { - enc.Float64(v.Float64) - } -} - -// SQLNullFloat64NullEmpty adds a string to be encoded, must be used inside an object as it will encode a key -func (enc *Encoder) SQLNullFloat64NullEmpty(v *sql.NullFloat64) { - if v != nil && v.Valid { - enc.Float64NullEmpty(v.Float64) - } -} - -// SQLNullFloat64Key adds a string to be encoded, must be used inside an object as it will encode a key -func (enc *Encoder) SQLNullFloat64Key(key string, v *sql.NullFloat64) { - enc.Float64Key(key, v.Float64) -} - -// SQLNullFloat64KeyOmitEmpty adds a string to be encoded or skips it if it is zero value. -// Must be used inside an object as it will encode a key -func (enc *Encoder) SQLNullFloat64KeyOmitEmpty(key string, v *sql.NullFloat64) { - if v != nil && v.Valid && v.Float64 != 0 { - enc.Float64KeyOmitEmpty(key, v.Float64) - } -} - -// SQLNullFloat64KeyNullEmpty adds a string to be encoded or skips it if it is zero value. -// Must be used inside an object as it will encode a key -func (enc *Encoder) SQLNullFloat64KeyNullEmpty(key string, v *sql.NullFloat64) { - if v != nil && v.Valid { - enc.Float64KeyNullEmpty(key, v.Float64) - } -} - -// NullBool - -// EncodeSQLNullBool encodes a string to -func (enc *Encoder) EncodeSQLNullBool(v *sql.NullBool) error { - if enc.isPooled == 1 { - panic(InvalidUsagePooledEncoderError("Invalid usage of pooled encoder")) - } - _, _ = enc.encodeBool(v.Bool) - _, err := enc.Write() - if err != nil { - enc.err = err - return err - } - return nil -} - -// AddSQLNullBool adds a string to be encoded, must be used inside a slice or array encoding (does not encode a key) -func (enc *Encoder) AddSQLNullBool(v *sql.NullBool) { - enc.Bool(v.Bool) -} - -// AddSQLNullBoolOmitEmpty adds a string to be encoded or skips it if it is zero value. -// Must be used inside a slice or array encoding (does not encode a key) -func (enc *Encoder) AddSQLNullBoolOmitEmpty(v *sql.NullBool) { - if v != nil && v.Valid && v.Bool != false { - enc.BoolOmitEmpty(v.Bool) - } -} - -// AddSQLNullBoolKey adds a string to be encoded, must be used inside an object as it will encode a key -func (enc *Encoder) AddSQLNullBoolKey(key string, v *sql.NullBool) { - enc.BoolKey(key, v.Bool) -} - -// AddSQLNullBoolKeyOmitEmpty adds a string to be encoded or skips it if it is zero value. -// Must be used inside an object as it will encode a key -func (enc *Encoder) AddSQLNullBoolKeyOmitEmpty(key string, v *sql.NullBool) { - if v != nil && v.Valid && v.Bool != false { - enc.BoolKeyOmitEmpty(key, v.Bool) - } -} - -// AddSQLNullBoolKeyNullEmpty adds a string to be encoded or skips it if it is zero value. -// Must be used inside an object as it will encode a key -func (enc *Encoder) AddSQLNullBoolKeyNullEmpty(key string, v *sql.NullBool) { - if v != nil && v.Valid { - enc.BoolKeyNullEmpty(key, v.Bool) - } -} - -// SQLNullBool adds a string to be encoded, must be used inside an object as it will encode a key -func (enc *Encoder) SQLNullBool(v *sql.NullBool) { - enc.Bool(v.Bool) -} - -// SQLNullBoolOmitEmpty adds a string to be encoded, must be used inside an object as it will encode a key -func (enc *Encoder) SQLNullBoolOmitEmpty(v *sql.NullBool) { - if v != nil && v.Valid && v.Bool != false { - enc.Bool(v.Bool) - } -} - -// SQLNullBoolNullEmpty adds a string to be encoded, must be used inside an object as it will encode a key -func (enc *Encoder) SQLNullBoolNullEmpty(v *sql.NullBool) { - if v != nil && v.Valid { - enc.BoolNullEmpty(v.Bool) - } -} - -// SQLNullBoolKey adds a string to be encoded, must be used inside an object as it will encode a key -func (enc *Encoder) SQLNullBoolKey(key string, v *sql.NullBool) { - enc.BoolKey(key, v.Bool) -} - -// SQLNullBoolKeyOmitEmpty adds a string to be encoded or skips it if it is zero value. -// Must be used inside an object as it will encode a key -func (enc *Encoder) SQLNullBoolKeyOmitEmpty(key string, v *sql.NullBool) { - if v != nil && v.Valid && v.Bool != false { - enc.BoolKeyOmitEmpty(key, v.Bool) - } -} - -// SQLNullBoolKeyNullEmpty adds a string to be encoded or skips it if it is zero value. -// Must be used inside an object as it will encode a key -func (enc *Encoder) SQLNullBoolKeyNullEmpty(key string, v *sql.NullBool) { - if v != nil && v.Valid { - enc.BoolKeyNullEmpty(key, v.Bool) - } -} diff --git a/vendor/github.com/francoispqt/gojay/encode_stream.go b/vendor/github.com/francoispqt/gojay/encode_stream.go deleted file mode 100644 index fae8a17cf8..0000000000 --- a/vendor/github.com/francoispqt/gojay/encode_stream.go +++ /dev/null @@ -1,205 +0,0 @@ -package gojay - -import ( - "strconv" - "sync" - "time" -) - -// MarshalerStream is the interface to implement -// to continuously encode of stream of data. -type MarshalerStream interface { - MarshalStream(enc *StreamEncoder) -} - -// A StreamEncoder reads and encodes values to JSON from an input stream. -// -// It implements conext.Context and provide a channel to notify interruption. -type StreamEncoder struct { - mux *sync.RWMutex - *Encoder - nConsumer int - delimiter byte - deadline *time.Time - done chan struct{} -} - -// EncodeStream spins up a defined number of non blocking consumers of the MarshalerStream m. -// -// m must implement MarshalerStream. Ideally m is a channel. See example for implementation. -// -// See the documentation for Marshal for details about the conversion of Go value to JSON. -func (s *StreamEncoder) EncodeStream(m MarshalerStream) { - // if a single consumer, just use this encoder - if s.nConsumer == 1 { - go consume(s, s, m) - return - } - // else use this Encoder only for first consumer - // and use new encoders for other consumers - // this is to avoid concurrent writing to same buffer - // resulting in a weird JSON - go consume(s, s, m) - for i := 1; i < s.nConsumer; i++ { - s.mux.RLock() - select { - case <-s.done: - default: - ss := Stream.borrowEncoder(s.w) - ss.mux.Lock() - ss.done = s.done - ss.buf = make([]byte, 0, 512) - ss.delimiter = s.delimiter - go consume(s, ss, m) - ss.mux.Unlock() - } - s.mux.RUnlock() - } - return -} - -// LineDelimited sets the delimiter to a new line character. -// -// It will add a new line after each JSON marshaled by the MarshalerStream -func (s *StreamEncoder) LineDelimited() *StreamEncoder { - s.delimiter = '\n' - return s -} - -// CommaDelimited sets the delimiter to a comma. -// -// It will add a new line after each JSON marshaled by the MarshalerStream -func (s *StreamEncoder) CommaDelimited() *StreamEncoder { - s.delimiter = ',' - return s -} - -// NConsumer sets the number of non blocking go routine to consume the stream. -func (s *StreamEncoder) NConsumer(n int) *StreamEncoder { - s.nConsumer = n - return s -} - -// Release sends back a Decoder to the pool. -// If a decoder is used after calling Release -// a panic will be raised with an InvalidUsagePooledDecoderError error. -func (s *StreamEncoder) Release() { - s.isPooled = 1 - streamEncPool.Put(s) -} - -// Done returns a channel that's closed when work is done. -// It implements context.Context -func (s *StreamEncoder) Done() <-chan struct{} { - return s.done -} - -// Err returns nil if Done is not yet closed. -// If Done is closed, Err returns a non-nil error explaining why. -// It implements context.Context -func (s *StreamEncoder) Err() error { - return s.err -} - -// Deadline returns the time when work done on behalf of this context -// should be canceled. Deadline returns ok==false when no deadline is -// set. Successive calls to Deadline return the same results. -func (s *StreamEncoder) Deadline() (time.Time, bool) { - if s.deadline != nil { - return *s.deadline, true - } - return time.Time{}, false -} - -// SetDeadline sets the deadline -func (s *StreamEncoder) SetDeadline(t time.Time) { - s.deadline = &t -} - -// Value implements context.Context -func (s *StreamEncoder) Value(key interface{}) interface{} { - return nil -} - -// Cancel cancels the consumers of the stream, interrupting the stream encoding. -// -// After calling cancel, Done() will return a closed channel. -func (s *StreamEncoder) Cancel(err error) { - s.mux.Lock() - defer s.mux.Unlock() - - select { - case <-s.done: - default: - s.err = err - close(s.done) - } -} - -// AddObject adds an object to be encoded. -// value must implement MarshalerJSONObject. -func (s *StreamEncoder) AddObject(v MarshalerJSONObject) { - if v.IsNil() { - return - } - s.Encoder.writeByte('{') - v.MarshalJSONObject(s.Encoder) - s.Encoder.writeByte('}') - s.Encoder.writeByte(s.delimiter) -} - -// AddString adds a string to be encoded. -func (s *StreamEncoder) AddString(v string) { - s.Encoder.writeByte('"') - s.Encoder.writeString(v) - s.Encoder.writeByte('"') - s.Encoder.writeByte(s.delimiter) -} - -// AddArray adds an implementation of MarshalerJSONArray to be encoded. -func (s *StreamEncoder) AddArray(v MarshalerJSONArray) { - s.Encoder.writeByte('[') - v.MarshalJSONArray(s.Encoder) - s.Encoder.writeByte(']') - s.Encoder.writeByte(s.delimiter) -} - -// AddInt adds an int to be encoded. -func (s *StreamEncoder) AddInt(value int) { - s.buf = strconv.AppendInt(s.buf, int64(value), 10) - s.Encoder.writeByte(s.delimiter) -} - -// AddFloat64 adds a float64 to be encoded. -func (s *StreamEncoder) AddFloat64(value float64) { - s.buf = strconv.AppendFloat(s.buf, value, 'f', -1, 64) - s.Encoder.writeByte(s.delimiter) -} - -// AddFloat adds a float64 to be encoded. -func (s *StreamEncoder) AddFloat(value float64) { - s.AddFloat64(value) -} - -// Non exposed - -func consume(init *StreamEncoder, s *StreamEncoder, m MarshalerStream) { - defer s.Release() - for { - select { - case <-init.Done(): - return - default: - m.MarshalStream(s) - if s.Encoder.err != nil { - init.Cancel(s.Encoder.err) - return - } - i, err := s.Encoder.Write() - if err != nil || i == 0 { - init.Cancel(err) - return - } - } - } -} diff --git a/vendor/github.com/francoispqt/gojay/encode_stream_pool.go b/vendor/github.com/francoispqt/gojay/encode_stream_pool.go deleted file mode 100644 index 3bb8b1af06..0000000000 --- a/vendor/github.com/francoispqt/gojay/encode_stream_pool.go +++ /dev/null @@ -1,38 +0,0 @@ -package gojay - -import ( - "io" - "sync" -) - -// NewEncoder returns a new StreamEncoder. -// It takes an io.Writer implementation to output data. -// It initiates the done channel returned by Done(). -func (s stream) NewEncoder(w io.Writer) *StreamEncoder { - enc := BorrowEncoder(w) - return &StreamEncoder{Encoder: enc, nConsumer: 1, done: make(chan struct{}, 1), mux: &sync.RWMutex{}} -} - -// BorrowEncoder borrows a StreamEncoder from the pool. -// It takes an io.Writer implementation to output data. -// It initiates the done channel returned by Done(). -// -// If no StreamEncoder is available in the pool, it returns a fresh one -func (s stream) BorrowEncoder(w io.Writer) *StreamEncoder { - streamEnc := streamEncPool.Get().(*StreamEncoder) - streamEnc.w = w - streamEnc.Encoder.err = nil - streamEnc.done = make(chan struct{}, 1) - streamEnc.Encoder.buf = streamEnc.buf[:0] - streamEnc.nConsumer = 1 - streamEnc.isPooled = 0 - return streamEnc -} - -func (s stream) borrowEncoder(w io.Writer) *StreamEncoder { - streamEnc := streamEncPool.Get().(*StreamEncoder) - streamEnc.isPooled = 0 - streamEnc.w = w - streamEnc.Encoder.err = nil - return streamEnc -} diff --git a/vendor/github.com/francoispqt/gojay/encode_string.go b/vendor/github.com/francoispqt/gojay/encode_string.go deleted file mode 100644 index 438c773fcb..0000000000 --- a/vendor/github.com/francoispqt/gojay/encode_string.go +++ /dev/null @@ -1,186 +0,0 @@ -package gojay - -// EncodeString encodes a string to -func (enc *Encoder) EncodeString(s string) error { - if enc.isPooled == 1 { - panic(InvalidUsagePooledEncoderError("Invalid usage of pooled encoder")) - } - _, _ = enc.encodeString(s) - _, err := enc.Write() - if err != nil { - enc.err = err - return err - } - return nil -} - -// encodeString encodes a string to -func (enc *Encoder) encodeString(v string) ([]byte, error) { - enc.writeByte('"') - enc.writeStringEscape(v) - enc.writeByte('"') - return enc.buf, nil -} - -// AppendString appends a string to the buffer -func (enc *Encoder) AppendString(v string) { - enc.grow(len(v) + 2) - enc.writeByte('"') - enc.writeStringEscape(v) - enc.writeByte('"') -} - -// AddString adds a string to be encoded, must be used inside a slice or array encoding (does not encode a key) -func (enc *Encoder) AddString(v string) { - enc.String(v) -} - -// AddStringOmitEmpty adds a string to be encoded or skips it if it is zero value. -// Must be used inside a slice or array encoding (does not encode a key) -func (enc *Encoder) AddStringOmitEmpty(v string) { - enc.StringOmitEmpty(v) -} - -// AddStringNullEmpty adds a string to be encoded or skips it if it is zero value. -// Must be used inside a slice or array encoding (does not encode a key) -func (enc *Encoder) AddStringNullEmpty(v string) { - enc.StringNullEmpty(v) -} - -// AddStringKey adds a string to be encoded, must be used inside an object as it will encode a key -func (enc *Encoder) AddStringKey(key, v string) { - enc.StringKey(key, v) -} - -// AddStringKeyOmitEmpty adds a string to be encoded or skips it if it is zero value. -// Must be used inside an object as it will encode a key -func (enc *Encoder) AddStringKeyOmitEmpty(key, v string) { - enc.StringKeyOmitEmpty(key, v) -} - -// AddStringKeyNullEmpty adds a string to be encoded or skips it if it is zero value. -// Must be used inside an object as it will encode a key -func (enc *Encoder) AddStringKeyNullEmpty(key, v string) { - enc.StringKeyNullEmpty(key, v) -} - -// String adds a string to be encoded, must be used inside a slice or array encoding (does not encode a key) -func (enc *Encoder) String(v string) { - enc.grow(len(v) + 4) - r := enc.getPreviousRune() - if r != '[' { - enc.writeTwoBytes(',', '"') - } else { - enc.writeByte('"') - } - enc.writeStringEscape(v) - enc.writeByte('"') -} - -// StringOmitEmpty adds a string to be encoded or skips it if it is zero value. -// Must be used inside a slice or array encoding (does not encode a key) -func (enc *Encoder) StringOmitEmpty(v string) { - if v == "" { - return - } - r := enc.getPreviousRune() - if r != '[' { - enc.writeTwoBytes(',', '"') - } else { - enc.writeByte('"') - } - enc.writeStringEscape(v) - enc.writeByte('"') -} - -// StringNullEmpty adds a string to be encoded or skips it if it is zero value. -// Must be used inside a slice or array encoding (does not encode a key) -func (enc *Encoder) StringNullEmpty(v string) { - r := enc.getPreviousRune() - if v == "" { - if r != '[' { - enc.writeByte(',') - enc.writeBytes(nullBytes) - } else { - enc.writeBytes(nullBytes) - } - return - } - if r != '[' { - enc.writeTwoBytes(',', '"') - } else { - enc.writeByte('"') - } - enc.writeStringEscape(v) - enc.writeByte('"') -} - -// StringKey adds a string to be encoded, must be used inside an object as it will encode a key -func (enc *Encoder) StringKey(key, v string) { - if enc.hasKeys { - if !enc.keyExists(key) { - return - } - } - enc.grow(len(key) + len(v) + 5) - r := enc.getPreviousRune() - if r != '{' { - enc.writeTwoBytes(',', '"') - } else { - enc.writeByte('"') - } - enc.writeStringEscape(key) - enc.writeBytes(objKeyStr) - enc.writeStringEscape(v) - enc.writeByte('"') -} - -// StringKeyOmitEmpty adds a string to be encoded or skips it if it is zero value. -// Must be used inside an object as it will encode a key -func (enc *Encoder) StringKeyOmitEmpty(key, v string) { - if enc.hasKeys { - if !enc.keyExists(key) { - return - } - } - if v == "" { - return - } - enc.grow(len(key) + len(v) + 5) - r := enc.getPreviousRune() - if r != '{' { - enc.writeTwoBytes(',', '"') - } else { - enc.writeByte('"') - } - enc.writeStringEscape(key) - enc.writeBytes(objKeyStr) - enc.writeStringEscape(v) - enc.writeByte('"') -} - -// StringKeyNullEmpty adds a string to be encoded or skips it if it is zero value. -// Must be used inside an object as it will encode a key -func (enc *Encoder) StringKeyNullEmpty(key, v string) { - if enc.hasKeys { - if !enc.keyExists(key) { - return - } - } - enc.grow(len(key) + len(v) + 5) - r := enc.getPreviousRune() - if r != '{' { - enc.writeTwoBytes(',', '"') - } else { - enc.writeByte('"') - } - enc.writeStringEscape(key) - enc.writeBytes(objKey) - if v == "" { - enc.writeBytes(nullBytes) - return - } - enc.writeByte('"') - enc.writeStringEscape(v) - enc.writeByte('"') -} diff --git a/vendor/github.com/francoispqt/gojay/encode_time.go b/vendor/github.com/francoispqt/gojay/encode_time.go deleted file mode 100644 index 6f99e3426c..0000000000 --- a/vendor/github.com/francoispqt/gojay/encode_time.go +++ /dev/null @@ -1,68 +0,0 @@ -package gojay - -import ( - "time" -) - -// EncodeTime encodes a *time.Time to JSON with the given format -func (enc *Encoder) EncodeTime(t *time.Time, format string) error { - if enc.isPooled == 1 { - panic(InvalidUsagePooledEncoderError("Invalid usage of pooled encoder")) - } - _, _ = enc.encodeTime(t, format) - _, err := enc.Write() - if err != nil { - return err - } - return nil -} - -// encodeInt encodes an int to JSON -func (enc *Encoder) encodeTime(t *time.Time, format string) ([]byte, error) { - enc.writeByte('"') - enc.buf = t.AppendFormat(enc.buf, format) - enc.writeByte('"') - return enc.buf, nil -} - -// AddTimeKey adds an *time.Time to be encoded with the given format, must be used inside an object as it will encode a key -func (enc *Encoder) AddTimeKey(key string, t *time.Time, format string) { - enc.TimeKey(key, t, format) -} - -// TimeKey adds an *time.Time to be encoded with the given format, must be used inside an object as it will encode a key -func (enc *Encoder) TimeKey(key string, t *time.Time, format string) { - if enc.hasKeys { - if !enc.keyExists(key) { - return - } - } - enc.grow(10 + len(key)) - r := enc.getPreviousRune() - if r != '{' { - enc.writeTwoBytes(',', '"') - } else { - enc.writeByte('"') - } - enc.writeStringEscape(key) - enc.writeBytes(objKeyStr) - enc.buf = t.AppendFormat(enc.buf, format) - enc.writeByte('"') -} - -// AddTime adds an *time.Time to be encoded with the given format, must be used inside a slice or array encoding (does not encode a key) -func (enc *Encoder) AddTime(t *time.Time, format string) { - enc.Time(t, format) -} - -// Time adds an *time.Time to be encoded with the given format, must be used inside a slice or array encoding (does not encode a key) -func (enc *Encoder) Time(t *time.Time, format string) { - enc.grow(10) - r := enc.getPreviousRune() - if r != '[' { - enc.writeByte(',') - } - enc.writeByte('"') - enc.buf = t.AppendFormat(enc.buf, format) - enc.writeByte('"') -} diff --git a/vendor/github.com/francoispqt/gojay/errors.go b/vendor/github.com/francoispqt/gojay/errors.go deleted file mode 100644 index 0fd52e6633..0000000000 --- a/vendor/github.com/francoispqt/gojay/errors.go +++ /dev/null @@ -1,88 +0,0 @@ -package gojay - -import ( - "errors" - "fmt" -) - -const invalidJSONCharErrorMsg = "Invalid JSON, wrong char '%c' found at position %d" - -// InvalidJSONError is a type representing an error returned when -// Decoding encounters invalid JSON. -type InvalidJSONError string - -func (err InvalidJSONError) Error() string { - return string(err) -} - -func (dec *Decoder) raiseInvalidJSONErr(pos int) error { - var c byte - if len(dec.data) > pos { - c = dec.data[pos] - } - dec.err = InvalidJSONError( - fmt.Sprintf( - invalidJSONCharErrorMsg, - c, - pos, - ), - ) - return dec.err -} - -const invalidUnmarshalErrorMsg = "Cannot unmarshal JSON to type '%T'" - -// InvalidUnmarshalError is a type representing an error returned when -// Decoding cannot unmarshal JSON to the receiver type for various reasons. -type InvalidUnmarshalError string - -func (err InvalidUnmarshalError) Error() string { - return string(err) -} - -func (dec *Decoder) makeInvalidUnmarshalErr(v interface{}) error { - return InvalidUnmarshalError( - fmt.Sprintf( - invalidUnmarshalErrorMsg, - v, - ), - ) -} - -const invalidMarshalErrorMsg = "Invalid type %T provided to Marshal" - -// InvalidMarshalError is a type representing an error returned when -// Encoding did not find the proper way to encode -type InvalidMarshalError string - -func (err InvalidMarshalError) Error() string { - return string(err) -} - -// NoReaderError is a type representing an error returned when -// decoding requires a reader and none was given -type NoReaderError string - -func (err NoReaderError) Error() string { - return string(err) -} - -// InvalidUsagePooledDecoderError is a type representing an error returned -// when decoding is called on a still pooled Decoder -type InvalidUsagePooledDecoderError string - -func (err InvalidUsagePooledDecoderError) Error() string { - return string(err) -} - -// InvalidUsagePooledEncoderError is a type representing an error returned -// when decoding is called on a still pooled Encoder -type InvalidUsagePooledEncoderError string - -func (err InvalidUsagePooledEncoderError) Error() string { - return string(err) -} - -// ErrUnmarshalPtrExpected is the error returned when unmarshal expects a pointer value, -// When using `dec.ObjectNull` or `dec.ArrayNull` for example. -var ErrUnmarshalPtrExpected = errors.New("Cannot unmarshal to given value, a pointer is expected") diff --git a/vendor/github.com/francoispqt/gojay/go.mod b/vendor/github.com/francoispqt/gojay/go.mod deleted file mode 100644 index 76814eb386..0000000000 --- a/vendor/github.com/francoispqt/gojay/go.mod +++ /dev/null @@ -1,24 +0,0 @@ -module github.com/francoispqt/gojay - -go 1.12 - -require ( - cloud.google.com/go v0.37.0 // indirect - github.com/buger/jsonparser v0.0.0-20181115193947-bf1c66bbce23 - github.com/go-errors/errors v1.0.1 - github.com/golang/protobuf v1.3.1 // indirect - github.com/json-iterator/go v1.1.6 - github.com/lunixbochs/vtclean v1.0.0 // indirect - github.com/mailru/easyjson v0.0.0-20190312143242-1de009706dbe - github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd // indirect - github.com/modern-go/reflect2 v1.0.1 // indirect - github.com/pkg/errors v0.8.1 // indirect - github.com/stretchr/testify v1.2.2 - github.com/viant/assertly v0.4.8 - github.com/viant/toolbox v0.24.0 - golang.org/x/crypto v0.0.0-20190313024323-a1f597ede03a // indirect - golang.org/x/net v0.0.0-20190313220215-9f648a60d977 - golang.org/x/oauth2 v0.0.0-20190226205417-e64efc72b421 // indirect - golang.org/x/sys v0.0.0-20190316082340-a2f829d7f35f // indirect - gopkg.in/yaml.v2 v2.2.2 // indirect -) diff --git a/vendor/github.com/francoispqt/gojay/go.sum b/vendor/github.com/francoispqt/gojay/go.sum deleted file mode 100644 index 06c27493af..0000000000 --- a/vendor/github.com/francoispqt/gojay/go.sum +++ /dev/null @@ -1,182 +0,0 @@ -cloud.google.com/go v0.26.0/go.mod h1:aQUYkXzVsufM+DwF1aE+0xfcU+56JwCaLick0ClmMTw= -cloud.google.com/go v0.31.0/go.mod h1:aQUYkXzVsufM+DwF1aE+0xfcU+56JwCaLick0ClmMTw= -cloud.google.com/go v0.34.0/go.mod h1:aQUYkXzVsufM+DwF1aE+0xfcU+56JwCaLick0ClmMTw= -cloud.google.com/go v0.37.0 h1:69FNAINiZfsEuwH3fKq8QrAAnHz+2m4XL4kVYi5BX0Q= -cloud.google.com/go v0.37.0/go.mod h1:TS1dMSSfndXH133OKGwekG838Om/cQT0BUHV3HcBgoo= -dmitri.shuralyov.com/app/changes v0.0.0-20180602232624-0a106ad413e3/go.mod h1:Yl+fi1br7+Rr3LqpNJf1/uxUdtRUV+Tnj0o93V2B9MU= -dmitri.shuralyov.com/html/belt v0.0.0-20180602232347-f7d459c86be0/go.mod h1:JLBrvjyP0v+ecvNYvCpyZgu5/xkfAUhi6wJj28eUfSU= -dmitri.shuralyov.com/service/change v0.0.0-20181023043359-a85b471d5412/go.mod h1:a1inKt/atXimZ4Mv927x+r7UpyzRUf4emIoiiSC2TN4= -dmitri.shuralyov.com/state v0.0.0-20180228185332-28bcc343414c/go.mod h1:0PRwlb0D6DFvNNtx+9ybjezNCa8XF0xaYcETyp6rHWU= -git.apache.org/thrift.git v0.0.0-20180902110319-2566ecd5d999/go.mod h1:fPE2ZNJGynbRyZ4dJvy6G277gSllfV2HJqblrnkyeyg= -github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03qcyfWMU= -github.com/anmitsu/go-shlex v0.0.0-20161002113705-648efa622239/go.mod h1:2FmKhYUyUczH0OGQWaF5ceTx0UBShxjsH6f8oGKYe2c= -github.com/beorn7/perks v0.0.0-20180321164747-3a771d992973/go.mod h1:Dwedo/Wpr24TaqPxmxbtue+5NUziq4I4S80YR8gNf3Q= -github.com/bradfitz/go-smtpd v0.0.0-20170404230938-deb6d6237625/go.mod h1:HYsPBTaaSFSlLx/70C2HPIMNZpVV8+vt/A+FMnYP11g= -github.com/buger/jsonparser v0.0.0-20181115193947-bf1c66bbce23 h1:D21IyuvjDCshj1/qq+pCNd3VZOAEI9jy6Bi131YlXgI= -github.com/buger/jsonparser v0.0.0-20181115193947-bf1c66bbce23/go.mod h1:bbYlZJ7hK1yFx9hf58LP0zeX7UjIGs20ufpu3evjr+s= -github.com/client9/misspell v0.3.4/go.mod h1:qj6jICC3Q7zFZvVWo7KLAzC3yx5G7kyvSDkc90ppPyw= -github.com/coreos/go-systemd v0.0.0-20181012123002-c6f51f82210d/go.mod h1:F5haX7vjVVG0kc13fIWeqUViNPyEJxv/OmvnBo0Yme4= -github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= -github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= -github.com/dustin/go-humanize v1.0.0/go.mod h1:HtrtbFcZ19U5GC7JDqmcUSB87Iq5E25KnS6fMYU6eOk= -github.com/flynn/go-shlex v0.0.0-20150515145356-3f9db97f8568/go.mod h1:xEzjJPgXI435gkrCt3MPfRiAkVrwSbHsst4LCFVfpJc= -github.com/fsnotify/fsnotify v1.4.7/go.mod h1:jwhsz4b93w/PPRr/qN1Yymfu8t87LnFCMoQvtojpjFo= -github.com/ghodss/yaml v1.0.0/go.mod h1:4dBDuWmgqj2HViK6kFavaiC9ZROes6MMH2rRYeMEF04= -github.com/gliderlabs/ssh v0.1.1/go.mod h1:U7qILu1NlMHj9FlMhZLlkCdDnU1DBEAqr0aevW3Awn0= -github.com/go-errors/errors v1.0.1 h1:LUHzmkK3GUKUrL/1gfBUxAHzcev3apQlezX/+O7ma6w= -github.com/go-errors/errors v1.0.1/go.mod h1:f4zRHt4oKfwPJE5k8C9vpYG+aDHdBFUsgrm6/TyX73Q= -github.com/gogo/protobuf v1.1.1/go.mod h1:r8qH/GZQm5c6nD/R0oafs1akxWv10x8SbQlK7atdtwQ= -github.com/golang/glog v0.0.0-20160126235308-23def4e6c14b/go.mod h1:SBH7ygxi8pfUlaOkMMuAQtPIUF8ecWP5IEl/CR7VP2Q= -github.com/golang/lint v0.0.0-20180702182130-06c8688daad7/go.mod h1:tluoj9z5200jBnyusfRPU2LqT6J+DAorxEvtC7LHB+E= -github.com/golang/mock v1.1.1/go.mod h1:oTYuIxOrZwtPieC+H1uAHpcLFnEyAGVDL/k47Jfbm0A= -github.com/golang/mock v1.2.0/go.mod h1:oTYuIxOrZwtPieC+H1uAHpcLFnEyAGVDL/k47Jfbm0A= -github.com/golang/protobuf v1.2.0/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= -github.com/golang/protobuf v1.3.1 h1:YF8+flBXS5eO826T4nzqPrxfhQThhXl0YzfuUPu4SBg= -github.com/golang/protobuf v1.3.1/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= -github.com/google/btree v0.0.0-20180813153112-4030bb1f1f0c/go.mod h1:lNA+9X1NB3Zf8V7Ke586lFgjr2dZNuvo3lPJSGZ5JPQ= -github.com/google/go-cmp v0.2.0/go.mod h1:oXzfMopK8JAjlY9xF4vHSVASa0yLyX7SntLO5aqRK0M= -github.com/google/go-github v17.0.0+incompatible/go.mod h1:zLgOLi98H3fifZn+44m+umXrS52loVEgC2AApnigrVQ= -github.com/google/go-querystring v1.0.0/go.mod h1:odCYkC5MyYFN7vkCjXpyrEuKhc/BUO6wN/zVPAxq5ck= -github.com/google/martian v2.1.0+incompatible/go.mod h1:9I4somxYTbIHy5NJKHRl3wXiIaQGbYVAs8BPL6v8lEs= -github.com/google/pprof v0.0.0-20181206194817-3ea8567a2e57/go.mod h1:zfwlbNMJ+OItoe0UupaVj+oy1omPYYDuagoSzA8v9mc= -github.com/googleapis/gax-go v2.0.0+incompatible/go.mod h1:SFVmujtThgffbyetf+mdk2eWhX2bMyUtNHzFKcPA9HY= -github.com/googleapis/gax-go/v2 v2.0.3/go.mod h1:LLvjysVCY1JZeum8Z6l8qUty8fiNwE08qbEPm1M08qg= -github.com/gopherjs/gopherjs v0.0.0-20181017120253-0766667cb4d1/go.mod h1:wJfORRmW1u3UXTncJ5qlYoELFm8eSnnEO6hX4iZ3EWY= -github.com/gregjones/httpcache v0.0.0-20180305231024-9cad4c3443a7/go.mod h1:FecbI9+v66THATjSRHfNgh1IVFe/9kFxbXtjV0ctIMA= -github.com/grpc-ecosystem/grpc-gateway v1.5.0/go.mod h1:RSKVYQBd5MCa4OVpNdGskqpgL2+G+NZTnrVHpWWfpdw= -github.com/jellevandenhooff/dkim v0.0.0-20150330215556-f50fe3d243e1/go.mod h1:E0B/fFc00Y+Rasa88328GlI/XbtyysCtTHZS8h7IrBU= -github.com/json-iterator/go v1.1.6 h1:MrUvLMLTMxbqFJ9kzlvat/rYZqZnW3u4wkLzWTaFwKs= -github.com/json-iterator/go v1.1.6/go.mod h1:+SdeFBvtyEkXs7REEP0seUULqWtbJapLOCVDaaPEHmU= -github.com/jstemmer/go-junit-report v0.0.0-20190106144839-af01ea7f8024/go.mod h1:6v2b51hI/fHJwM22ozAgKL4VKDeJcHhJFhtBdhmNjmU= -github.com/kisielk/gotool v1.0.0/go.mod h1:XhKaO+MFFWcvkIS/tQcRk01m1F5IRFswLeQ+oQHNcck= -github.com/kr/pretty v0.1.0/go.mod h1:dAy3ld7l9f0ibDNOQOHHMYYIIbhfbHSm3C4ZsoJORNo= -github.com/kr/pty v1.1.1/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ= -github.com/kr/pty v1.1.3/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ= -github.com/kr/text v0.1.0/go.mod h1:4Jbv+DJW3UT/LiOwJeYQe1efqtUx/iVham/4vfdArNI= -github.com/lunixbochs/vtclean v1.0.0 h1:xu2sLAri4lGiovBDQKxl5mrXyESr3gUr5m5SM5+LVb8= -github.com/lunixbochs/vtclean v1.0.0/go.mod h1:pHhQNgMf3btfWnGBVipUOjRYhoOsdGqdm/+2c2E2WMI= -github.com/mailru/easyjson v0.0.0-20190312143242-1de009706dbe h1:W/GaMY0y69G4cFlmsC6B9sbuo2fP8OFP1ABjt4kPz+w= -github.com/mailru/easyjson v0.0.0-20190312143242-1de009706dbe/go.mod h1:C1wdFJiN94OJF2b5HbByQZoLdCWB1Yqtg26g4irojpc= -github.com/matttproud/golang_protobuf_extensions v1.0.1/go.mod h1:D8He9yQNgCq6Z5Ld7szi9bcBfOoFv/3dc6xSMkL2PC0= -github.com/microcosm-cc/bluemonday v1.0.1/go.mod h1:hsXNsILzKxV+sX77C5b8FSuKF00vh2OMYv+xgHpAMF4= -github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd h1:TRLaZ9cD/w8PVh93nsPXa1VrQ6jlwL5oN8l14QlcNfg= -github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd/go.mod h1:6dJC0mAP4ikYIbvyc7fijjWJddQyLn8Ig3JB5CqoB9Q= -github.com/modern-go/reflect2 v1.0.1 h1:9f412s+6RmYXLWZSEzVVgPGK7C2PphHj5RJrvfx9AWI= -github.com/modern-go/reflect2 v1.0.1/go.mod h1:bx2lNnkwVCuqBIxFjflWJWanXIb3RllmbCylyMrvgv0= -github.com/neelance/astrewrite v0.0.0-20160511093645-99348263ae86/go.mod h1:kHJEU3ofeGjhHklVoIGuVj85JJwZ6kWPaJwCIxgnFmo= -github.com/neelance/sourcemap v0.0.0-20151028013722-8c68805598ab/go.mod h1:Qr6/a/Q4r9LP1IltGz7tA7iOK1WonHEYhu1HRBA7ZiM= -github.com/openzipkin/zipkin-go v0.1.1/go.mod h1:NtoC/o8u3JlF1lSlyPNswIbeQH9bJTmOf0Erfk+hxe8= -github.com/pkg/errors v0.8.1 h1:iURUrRGxPUNPdy5/HRSm+Yj6okJ6UtLINN0Q9M4+h3I= -github.com/pkg/errors v0.8.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= -github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= -github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= -github.com/prometheus/client_golang v0.8.0/go.mod h1:7SWBe2y4D6OKWSNQJUaRYU/AaXPKyh/dDVn+NZz0KFw= -github.com/prometheus/client_model v0.0.0-20180712105110-5c3871d89910/go.mod h1:MbSGuTsp3dbXC40dX6PRTWyKYBIrTGTE9sqQNg2J8bo= -github.com/prometheus/common v0.0.0-20180801064454-c7de2306084e/go.mod h1:daVV7qP5qjZbuso7PdcryaAu0sAZbrN9i7WWcTMWvro= -github.com/prometheus/procfs v0.0.0-20180725123919-05ee40e3a273/go.mod h1:c3At6R/oaqEKCNdg8wHV1ftS6bRYblBhIjjI8uT2IGk= -github.com/russross/blackfriday v1.5.2/go.mod h1:JO/DiYxRf+HjHt06OyowR9PTA263kcR/rfWxYHBV53g= -github.com/sergi/go-diff v1.0.0/go.mod h1:0CfEIISq7TuYL3j771MWULgwwjU+GofnZX9QAmXWZgo= -github.com/shurcooL/component v0.0.0-20170202220835-f88ec8f54cc4/go.mod h1:XhFIlyj5a1fBNx5aJTbKoIq0mNaPvOagO+HjB3EtxrY= -github.com/shurcooL/events v0.0.0-20181021180414-410e4ca65f48/go.mod h1:5u70Mqkb5O5cxEA8nxTsgrgLehJeAw6Oc4Ab1c/P1HM= -github.com/shurcooL/github_flavored_markdown v0.0.0-20181002035957-2122de532470/go.mod h1:2dOwnU2uBioM+SGy2aZoq1f/Sd1l9OkAeAUvjSyvgU0= -github.com/shurcooL/go v0.0.0-20180423040247-9e1955d9fb6e/go.mod h1:TDJrrUr11Vxrven61rcy3hJMUqaf/CLWYhHNPmT14Lk= -github.com/shurcooL/go-goon v0.0.0-20170922171312-37c2f522c041/go.mod h1:N5mDOmsrJOB+vfqUK+7DmDyjhSLIIBnXo9lvZJj3MWQ= -github.com/shurcooL/gofontwoff v0.0.0-20180329035133-29b52fc0a18d/go.mod h1:05UtEgK5zq39gLST6uB0cf3NEHjETfB4Fgr3Gx5R9Vw= -github.com/shurcooL/gopherjslib v0.0.0-20160914041154-feb6d3990c2c/go.mod h1:8d3azKNyqcHP1GaQE/c6dDgjkgSx2BZ4IoEi4F1reUI= -github.com/shurcooL/highlight_diff v0.0.0-20170515013008-09bb4053de1b/go.mod h1:ZpfEhSmds4ytuByIcDnOLkTHGUI6KNqRNPDLHDk+mUU= -github.com/shurcooL/highlight_go v0.0.0-20181028180052-98c3abbbae20/go.mod h1:UDKB5a1T23gOMUJrI+uSuH0VRDStOiUVSjBTRDVBVag= -github.com/shurcooL/home v0.0.0-20181020052607-80b7ffcb30f9/go.mod h1:+rgNQw2P9ARFAs37qieuu7ohDNQ3gds9msbT2yn85sg= -github.com/shurcooL/htmlg v0.0.0-20170918183704-d01228ac9e50/go.mod h1:zPn1wHpTIePGnXSHpsVPWEktKXHr6+SS6x/IKRb7cpw= -github.com/shurcooL/httperror v0.0.0-20170206035902-86b7830d14cc/go.mod h1:aYMfkZ6DWSJPJ6c4Wwz3QtW22G7mf/PEgaB9k/ik5+Y= -github.com/shurcooL/httpfs v0.0.0-20171119174359-809beceb2371/go.mod h1:ZY1cvUeJuFPAdZ/B6v7RHavJWZn2YPVFQ1OSXhCGOkg= -github.com/shurcooL/httpgzip v0.0.0-20180522190206-b1c53ac65af9/go.mod h1:919LwcH0M7/W4fcZ0/jy0qGght1GIhqyS/EgWGH2j5Q= -github.com/shurcooL/issues v0.0.0-20181008053335-6292fdc1e191/go.mod h1:e2qWDig5bLteJ4fwvDAc2NHzqFEthkqn7aOZAOpj+PQ= -github.com/shurcooL/issuesapp v0.0.0-20180602232740-048589ce2241/go.mod h1:NPpHK2TI7iSaM0buivtFUc9offApnI0Alt/K8hcHy0I= -github.com/shurcooL/notifications v0.0.0-20181007000457-627ab5aea122/go.mod h1:b5uSkrEVM1jQUspwbixRBhaIjIzL2xazXp6kntxYle0= -github.com/shurcooL/octicon v0.0.0-20181028054416-fa4f57f9efb2/go.mod h1:eWdoE5JD4R5UVWDucdOPg1g2fqQRq78IQa9zlOV1vpQ= -github.com/shurcooL/reactions v0.0.0-20181006231557-f2e0b4ca5b82/go.mod h1:TCR1lToEk4d2s07G3XGfz2QrgHXg4RJBvjrOozvoWfk= -github.com/shurcooL/sanitized_anchor_name v0.0.0-20170918181015-86672fcb3f95/go.mod h1:1NzhyTcUVG4SuEtjjoZeVRXNmyL/1OwPU0+IJeTBvfc= -github.com/shurcooL/users v0.0.0-20180125191416-49c67e49c537/go.mod h1:QJTqeLYEDaXHZDBsXlPCDqdhQuJkuw4NOtaxYe3xii4= -github.com/shurcooL/webdavfs v0.0.0-20170829043945-18c3829fa133/go.mod h1:hKmq5kWdCj2z2KEozexVbfEZIWiTjhE0+UjmZgPqehw= -github.com/sourcegraph/annotate v0.0.0-20160123013949-f4cad6c6324d/go.mod h1:UdhH50NIW0fCiwBSr0co2m7BnFLdv4fQTgdqdJTHFeE= -github.com/sourcegraph/syntaxhighlight v0.0.0-20170531221838-bd320f5d308e/go.mod h1:HuIsMU8RRBOtsCgI77wP899iHVBQpCmg4ErYMZB+2IA= -github.com/stretchr/testify v1.2.2 h1:bSDNvY7ZPG5RlJ8otE/7V6gMiyenm9RtJ7IUVIAoJ1w= -github.com/stretchr/testify v1.2.2/go.mod h1:a8OnRcib4nhh0OaRAV+Yts87kKdq0PP7pXfy6kDkUVs= -github.com/tarm/serial v0.0.0-20180830185346-98f6abe2eb07/go.mod h1:kDXzergiv9cbyO7IOYJZWg1U88JhDg3PB6klq9Hg2pA= -github.com/viant/assertly v0.4.8 h1:5x1GzBaRteIwTr5RAGFVG14uNeRFxVNbXPWrK2qAgpc= -github.com/viant/assertly v0.4.8/go.mod h1:aGifi++jvCrUaklKEKT0BU95igDNaqkvz+49uaYMPRU= -github.com/viant/toolbox v0.24.0 h1:6TteTDQ68CjgcCe8wH3D3ZhUQQOJXMTbj/D9rkk2a1k= -github.com/viant/toolbox v0.24.0/go.mod h1:OxMCG57V0PXuIP2HNQrtJf2CjqdmbrOx5EkMILuUhzM= -go.opencensus.io v0.18.0/go.mod h1:vKdFvxhtzZ9onBp9VKHK8z/sRpBMnKAsufL7wlDrCOA= -go4.org v0.0.0-20180809161055-417644f6feb5/go.mod h1:MkTOUMDaeVYJUOUsaDXIhWPZYa1yOyC1qaOBpL57BhE= -golang.org/x/build v0.0.0-20190111050920-041ab4dc3f9d/go.mod h1:OWs+y06UdEOHN4y+MfF/py+xQ/tYqIWW03b70/CG9Rw= -golang.org/x/crypto v0.0.0-20181030102418-4d3f4d9ffa16/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4= -golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= -golang.org/x/crypto v0.0.0-20190313024323-a1f597ede03a h1:YX8ljsm6wXlHZO+aRz9Exqr0evNhKRNe5K/gi+zKh4U= -golang.org/x/crypto v0.0.0-20190313024323-a1f597ede03a/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= -golang.org/x/exp v0.0.0-20190121172915-509febef88a4/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA= -golang.org/x/lint v0.0.0-20180702182130-06c8688daad7/go.mod h1:UVdnD1Gm6xHRNCYTkRU2/jEulfH38KcIWyp/GAMgvoE= -golang.org/x/lint v0.0.0-20181026193005-c67002cb31c3/go.mod h1:UVdnD1Gm6xHRNCYTkRU2/jEulfH38KcIWyp/GAMgvoE= -golang.org/x/lint v0.0.0-20190227174305-5b3e6a55c961/go.mod h1:wehouNa3lNwaWXcvxsM5YxQ5yQlVC4a0KAMCusXpPoU= -golang.org/x/net v0.0.0-20180724234803-3673e40ba225/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= -golang.org/x/net v0.0.0-20180826012351-8a410e7b638d/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= -golang.org/x/net v0.0.0-20180906233101-161cd47e91fd/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= -golang.org/x/net v0.0.0-20181029044818-c44066c5c816/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= -golang.org/x/net v0.0.0-20181106065722-10aee1819953/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= -golang.org/x/net v0.0.0-20190108225652-1e06a53dbb7e/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= -golang.org/x/net v0.0.0-20190213061140-3a22650c66bd/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= -golang.org/x/net v0.0.0-20190313220215-9f648a60d977 h1:actzWV6iWn3GLqN8dZjzsB+CLt+gaV2+wsxroxiQI8I= -golang.org/x/net v0.0.0-20190313220215-9f648a60d977/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= -golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U= -golang.org/x/oauth2 v0.0.0-20181017192945-9dcd33a902f4/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U= -golang.org/x/oauth2 v0.0.0-20181203162652-d668ce993890/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U= -golang.org/x/oauth2 v0.0.0-20190226205417-e64efc72b421 h1:Wo7BWFiOk0QRFMLYMqJGFMd9CgUAcGx7V+qEg/h5IBI= -golang.org/x/oauth2 v0.0.0-20190226205417-e64efc72b421/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw= -golang.org/x/perf v0.0.0-20180704124530-6e6d33e29852/go.mod h1:JLpeXjPJfIyPr5TlbXLkXWLhP8nz10XfvxElABhCtcw= -golang.org/x/sync v0.0.0-20180314180146-1d60e4601c6f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= -golang.org/x/sync v0.0.0-20181108010431-42b317875d0f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= -golang.org/x/sync v0.0.0-20181221193216-37e7f081c4d4/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= -golang.org/x/sync v0.0.0-20190227155943-e225da77a7e6/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= -golang.org/x/sys v0.0.0-20180830151530-49385e6e1522/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= -golang.org/x/sys v0.0.0-20180909124046-d0be0721c37e/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= -golang.org/x/sys v0.0.0-20181029174526-d69651ed3497/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= -golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= -golang.org/x/sys v0.0.0-20190316082340-a2f829d7f35f h1:yCrMx/EeIue0+Qca57bWZS7VX6ymEoypmhWyPhz0NHM= -golang.org/x/sys v0.0.0-20190316082340-a2f829d7f35f/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= -golang.org/x/text v0.3.1-0.20180807135948-17ff2d5776d2/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= -golang.org/x/time v0.0.0-20180412165947-fbb02b2291d2/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= -golang.org/x/time v0.0.0-20181108054448-85acf8d2951c/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= -golang.org/x/tools v0.0.0-20180828015842-6cd1fcedba52/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= -golang.org/x/tools v0.0.0-20181030000716-a0a13e073c7b/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= -golang.org/x/tools v0.0.0-20190114222345-bf090417da8b/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= -golang.org/x/tools v0.0.0-20190226205152-f727befe758c/go.mod h1:9Yl7xja0Znq3iFh3HoIrodX9oNMXvdceNzlUR8zjMvY= -google.golang.org/api v0.0.0-20180910000450-7ca32eb868bf/go.mod h1:4mhQ8q/RsB7i+udVvVy5NUi08OU8ZlA0gRVgrF7VFY0= -google.golang.org/api v0.0.0-20181030000543-1d582fd0359e/go.mod h1:4mhQ8q/RsB7i+udVvVy5NUi08OU8ZlA0gRVgrF7VFY0= -google.golang.org/api v0.1.0/go.mod h1:UGEZY7KEX120AnNLIHFMKIo4obdJhkp2tPbaPlQx13Y= -google.golang.org/appengine v1.1.0/go.mod h1:EbEs0AVv82hx2wNQdGPgUI5lhzA/G0D9YwlJXL52JkM= -google.golang.org/appengine v1.2.0/go.mod h1:xpcJRLb0r/rnEns0DIKYYv+WjYCduHsrkT7/EB5XEv4= -google.golang.org/appengine v1.3.0/go.mod h1:xpcJRLb0r/rnEns0DIKYYv+WjYCduHsrkT7/EB5XEv4= -google.golang.org/appengine v1.4.0 h1:/wp5JvzpHIxhs/dumFmF7BXTf3Z+dd4uXta4kVyO508= -google.golang.org/appengine v1.4.0/go.mod h1:xpcJRLb0r/rnEns0DIKYYv+WjYCduHsrkT7/EB5XEv4= -google.golang.org/genproto v0.0.0-20180817151627-c66870c02cf8/go.mod h1:JiN7NxoALGmiZfu7CAH4rXhgtRTLTxftemlI0sWmxmc= -google.golang.org/genproto v0.0.0-20180831171423-11092d34479b/go.mod h1:JiN7NxoALGmiZfu7CAH4rXhgtRTLTxftemlI0sWmxmc= -google.golang.org/genproto v0.0.0-20181029155118-b69ba1387ce2/go.mod h1:JiN7NxoALGmiZfu7CAH4rXhgtRTLTxftemlI0sWmxmc= -google.golang.org/genproto v0.0.0-20181202183823-bd91e49a0898/go.mod h1:7Ep/1NZk928CDR8SjdVbjWNpdIf6nzjE3BTgJDr2Atg= -google.golang.org/genproto v0.0.0-20190306203927-b5d61aea6440/go.mod h1:VzzqZJRnGkLBvHegQrXjBqPurQTc5/KpmUdxsrq26oE= -google.golang.org/grpc v1.14.0/go.mod h1:yo6s7OP7yaDglbqo1J04qKzAhqBH6lvTonzMVmEdcZw= -google.golang.org/grpc v1.16.0/go.mod h1:0JHn/cJsOMiMfNA9+DeHDlAU7KAAB5GDlYFpa9MZMio= -google.golang.org/grpc v1.17.0/go.mod h1:6QZJwpn2B+Zp71q/5VxRsJ6NXXVCE5NRUHRo+f3cWCs= -google.golang.org/grpc v1.19.0/go.mod h1:mqu4LbDTu4XGKhr4mRzUsmM4RtVoemTSY81AxZiDr8c= -gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405 h1:yhCVgyC4o1eVCa2tZl7eS0r+SDo693bJlVdllGtEeKM= -gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= -gopkg.in/inf.v0 v0.9.1/go.mod h1:cWUDdTG/fYaXco+Dcufb5Vnc6Gp2YChqWtbxRZE0mXw= -gopkg.in/yaml.v2 v2.2.1/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= -gopkg.in/yaml.v2 v2.2.2 h1:ZCJp+EgiOT7lHqUV2J862kp8Qj64Jo6az82+3Td9dZw= -gopkg.in/yaml.v2 v2.2.2/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= -grpc.go4.org v0.0.0-20170609214715-11d0a25b4919/go.mod h1:77eQGdRu53HpSqPFJFmuJdjuHRquDANNeA4x7B8WQ9o= -honnef.co/go/tools v0.0.0-20180728063816-88497007e858/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4= -honnef.co/go/tools v0.0.0-20190102054323-c2f93a96b099/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4= -honnef.co/go/tools v0.0.0-20190106161140-3f1c8253044a/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4= -sourcegraph.com/sourcegraph/go-diff v0.5.0/go.mod h1:kuch7UrkMzY0X+p9CRK03kfuPQ2zzQcaEFbx8wA8rck= -sourcegraph.com/sqs/pbtypes v0.0.0-20180604144634-d3ebe8f20ae4/go.mod h1:ketZ/q3QxT9HOBeFhu6RdvsftgpsbFHBF5Cas6cDKZ0= diff --git a/vendor/github.com/francoispqt/gojay/gojay.go b/vendor/github.com/francoispqt/gojay/gojay.go deleted file mode 100644 index d0c542f6b7..0000000000 --- a/vendor/github.com/francoispqt/gojay/gojay.go +++ /dev/null @@ -1,10 +0,0 @@ -// Package gojay implements encoding and decoding of JSON as defined in RFC 7159. -// The mapping between JSON and Go values is described -// in the documentation for the Marshal and Unmarshal functions. -// -// It aims at performance and usability by relying on simple interfaces -// to decode and encode structures, slices, arrays and even channels. -// -// On top of the simple interfaces to implement, gojay provides lots of helpers to decode and encode -// multiple of different types natively such as bit.Int, sql.NullString or time.Time -package gojay diff --git a/vendor/github.com/francoispqt/gojay/gojay.png b/vendor/github.com/francoispqt/gojay/gojay.png deleted file mode 100644 index 21090bdd20877f745003b24a4e8667f57b67a1a3..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 44163 zcmeEthd6l??>n)c?&Eu7 z!-#n95jDI@a%%7|H6hC~Q+-SO$%^j!8=_AS6xRJWt4tdT z^@(||c)umOL2(}cj;I2Wy6zVevR-n_8Z|tnxgDGl5rG|_!oDABUXu0bJ0W<*M)rTd z|8EB_cL0KJ8xDx}j4bUif5S~%2qzPil3B~e zd${#dTkH&s4GuY#4)O8wj;da{j9EoO5luv!@YNpStJf}e{G0f$w$cCDIl4yL8gtYy z9DS$EE+|Yn?K>UO1M1gLBQ5C(Dci{EiT0nAj|Dupj`9_M5Yi*-D}2@ZP5kT2J20I2 zUz>1s{cG_Wp0LLHtbnHJ>q~VHhQvM89rMYgB?bB)OS_?{S4Ro#sxLN z?%DNjO9siOIK0?z+9a6$=PQGe4y6P;4mPwf z49&7EWy;!HsUfJ!OX4O3342hr3A@B!zYZSq0i7cZQR9>D66@{nuJ+y|*)PoFIIDk2 zT3=1|fByR~0~k*Nz1*mgYgC+=Y0SWIK*gv(tbHL1JU&_dC!fmEKXVJUwYABI=WVhNZe*_?pdSR=HGD35(<(~dC?sis0~|33T>JNPmm}W za4-|K4cjxsmtu?+v_f_*d72QZ3xN)0{i{-J7&I<`tNKOicmEAojI6UZz1tBW4 zEmOpU0A5Ax#)QZuo7IP$i>IbZwyvU7tDRlrCuvg{MgOpz2*ZPVaon)`Jj!7ffBTb$;Ux(93=-i1FJ}Z?bMkzJhJs-M_SgT~8kNNjl!wXLJXh(SJTEV= zTmr}CwN?JQwr8eWw{E%kU(J*9_=zjfR|~g@&V_MH!%PH&&Gt6~BE2i~2l70?m5ZHd`&N)|pG}eZe0v zWPHWx%{AKjtZqMkJ^h6OT!F`5*w=TC>YYkKEWXFqNu%_U!K8{%D;+d?eX!GL?Iu#J zs_fM@2m}KwbRWM$#!W&1yHdkDoNy0B9Fbe2$N72e6OX=_{|F|)&nKUKXuGjuVzj#F zFT}&ghv(|x1c?C30#|-0a+!cbid8}AHSNMMxvg#9@HN}%jgnOXSXN|V`yMkfTgR;% zl`8gd9clfC&c#t(0k9j_2k*RBe|K+WKLQ-(c`q)6lzQ0cpscX)8RtWxVgGn1dJni! z770Y*QH5M+ z0(9^C;1bkK@)(JHs8*EYFvKlkzjxSG^0^2%NvvSEH1iMAg4~`71UF}(&90Gz3Tcjy zRA2Pb+9QkE*9!dD9jVu-&wUqkJ+&0~eCRfS1A9E}d7kG?Baj+zU5NJBID>L8|e%@Vd( z(~XZFJ-T08QL!D&QQu4w6?g@qohs=xQCuqGS|QpQjkM<#t(s7g#`@{9QTx)*CoBE> zl10Z+x$!%Oxp>iJ7(Kcxf(tCtT}769q0pnedFKtze-8h$p9ZCT=ENFnsHTqolP zP=F-}H9*c!LAwyYU9Rtg%*KpnyvmIjRiTJM91LzC5XG2-bVc`7FlF?ekk2m)Gsptw2 zugLt@jjx@-a0CNIB~wNRsgbC#1p=34b@EnKmWP6XoOR# z9buu|Sq;)j)^T)wW&W&$_CK50TV!lh3MylN)F8~S>LAA7Q`W_uV!c;wGbm7(%bg7_ zGVQnAWUrj6xTk^t?AW(_ELR*& zBDV8ocqH|Glx<_u+i@S@?%a%v>ZN;LH*ek~ey3Dg-=xWw69JvhfaG`0zN-l&zhEvz zh<-$-K5w4X=s~(a$ORYOxH-A(7H7PxdL;Rvf-3E4TyAdewQ$Qu4P<|9y9v$U??$X1 z)pe0_dGK}`Y&q7jT50@3f^KF?zMsT-W7lJQfka}R+EVdfI}8YOlg`X`5s!;wIoF(^0R}8st4ErGh&Js0R9#^3!-pM7`3`0dhNCLb+vMch5H@Q1kMUA*Sd5pH zlaFUTgt`t%!%n+!sj%m^i({aqlHVyvjR`aB!zuK#kgcf&+4?j5Hz~X$#i7QX!-~5vrR`IrwfNPR9bcKe*f2Sc=Ot0e6oWY< zW$pk|YU`;r!DguqRD=zu6I3uNw(>7_C1y%Oa#Ota*ij$S-Fd5>rM+AawvGZXMvTlC z>nlN$JEu0^7Kw34u@l{ih`sOaY~MBPEgK>5@UG&loaJHya+e3CZ##`aUvnd&jokC~ z9Ju9su8fq2-6g-^%;9L6xp+_33=$OjFtAwK~;y9af_PWUgqueu`H^;?pXo zzvJ-nx_CbDYf2s+6}977iWl`T=1{X-tX34~T*`nUzDJiw7fW6PZ<`gza8V&qYO@)~P|G6k@jaS;I-TA}7a6lhVcn zVqORw)jnK3tD8-t1bWumQKm zP~b~!IngISkQ$lS*yrhBwbZRgQ2qLx(*sCeWQPNCMR*L#Pn-EG{$!8%BQY}bM5j66 z>w9ii`L>0BX{|VJw%_DOzEHrMgR)3_N|aCJGIPsJOT|5}r_@F7UA``&_JFtTUdj^^fkTaC8h*FT8`Ov*8&dXg!Rt2*4f* zf-G$ZcAIV8dar>mo||Tn*Y+OVzaV89w~@QfxpEJ6!IPJNbat+td)w*GvQn}nYhjc8 z0SHXfF5CrMPSn9;t~(Gd!LyurBT3)C-*0~2J|H1{*`d8JWqTc-KF^Q)OUYIgUcPZV z=b&n|9H8Es|FZ5@IzEuNY7L0m zPL=O+y?%vaQb*dcSC&sVWghQ=CULI8XY>4_nn!shcyB(GFGot_*$}s*N!A1?VL_Fn zV^A$qwkh0&UV$CnL^zwyPW&(`RgVO>G9jYL2mpxbu(4CKT(}>~S3CjOX64ruHR7bwaHR|Cmk(V()pa-tR1kw}B3mXetSzV9UiF za71>xDFM9)60lv;Ej%b&!E|e9+I1_fKYsjJgI$HWX;6LT z6a8U|8~>dw^v5l{g5=n8?D%{9Z&k!95jEYpcwtt4;LBk|l2z)l62Kv)w4W?ttaHI< zQm%=%r$JQjY-JrVgem>tftyYv^sRXEmxsyWa5Y8L}n1a(((2ug} zJtI32xjg<*Y=P9uhn3u2<&dEfx>8FW%dI{_z;&W?}sR8 zRzhOuJZ$CCv0!)R3d#2gICx)NXgQ^?A3ryzn4qSks~OolBV>HH*nLMewQ7`3`l*e) zT}{}Q-P);roA5TowER2Z8LkJC$&Z)1^WoFsa`xIi*@2V}CMf*Ijhi+%XqRkn(E57DzExtpPuTexxr?==2dy;In;_S8ns!BustiCVl(QyFlUz9-cE2?ZIXb4?K?y!~ z;i$)ZtS#w*&N59pGgo)_g(%BfjWKZMbE##^mxQ?w2ruy zCUfU7<7B8>KU6!@scJ=LNl*ZM25#K%k6pI_R{E{3QzHYQSJI;zw)F7uFyylT8k4P}Y!l{%e9_C(V9R{OUu7MTZqcGp&iIoLaH|jr>v#Zl z$Sj!P>8tfDw{wzUI2PTY z9exh~Rxcjy_QpS=oUT9Qq1Q^e3`T1qbV3vxgWDrU7w^&E0(?&l^!0C~<{yEk!1?(n{z>{X*W^w zDAu04{91Zy=>RjbSN_ptue3TBXcN9iA1*?oAl)qh-%aKKw2p;sF#O5qw=+IgSPFqU z0zPqS_Ljep+b`=gAG^(!20ia8)4Zw;Lbk@ocjK_GdTOQjt}f8E37Z}GH`QSC{jMoW zbABuS$j89fgskk7l=+x&^GTyaiqh4#XZ<+sZ{z;TNI+>cyM%@pfFPQQ*Ll{c
  • @ zdYQ4oTFdr*Wtf>~$Xg^?y-0*Rgrfz*Eq`P4$93F`{f2b&C%dowfbain8d><~nR)J} z1^7f^|KY<>UOv9}RimnaZY>>^f@eFM81X#0ew9Q$(mttkfyYT83i=}2xvOGdtmlhL zNzhA4tErj!k2@(Aa-;c}KdTcOrWLy^_9I>zidN_KOGKB!-rC{!yPiIlxnfo>@gA+r z`Fo2SH-;2*c=TY9fDCTuQln)6(LY2M)CxL5t~_}xH#WmLmUY?ynMOvu4JmHU_C4Q- znpMUyggk!u@S%L(@Czu`YLOGh6q#bGv=Ip@e&re^JWNF2voB5ROB4UQmiROd^zKcW z*iACyVWYL7f_2A+3R;2y5Ko=B737Wm&!$to&p+_LAw+?MeSp|uM()0|F*K+qU}q&X zi1x5Oe~o7OahE^Xw0>q8QQ*|cf)sm)F8ju6&BaeDJpQlst}*|^0Zy((Qz$T;mo8Fo z+g6JiuOZO;lB|P3-cBgd+IouIe+(_an2rNflqyrOn|)wO zO7&B}IOPTQ=pjRhq~TbXdXTqt?>As2$^V0;llkiv%m_zQL9eC1SAops?P|**heDUx zEJppaYv~o&A)l47V^q6^(&ebYjuWzB(GyZpwYt!09__&pSr|i*KY)2hy>+6XgOeoB zem3OH) z%P)psCL|<$fcrE5$)KE6Kpq$;?lHAffW^`5u}Q#u+a;@#C7UEQxb19WR|wc>TIKgS z>S~Yf(?YBe?~6z+q$$wl%GT{i$j>cuGETJ z$9sACJUf_D{c!UwsVWn;L*#%}s>fHA7Qz5NWJ&9R6xUz$NekkBSsdK~&dihTyv zjBGXY;_Q&S_fTPpHsXdV^sKBi@6mniIXl#EmVXz`IjN(Un*k_KF^x!*wAxkUSpAz8 z{8ld|(7PnpSrKnq0GeqM2w#nd{TkOu&D!>FGPuw3W0G&b<-f&%@G|`FJI``~P*5{L z2dgs@jp>I?TH>oq!l)m(-dH<@zs?VXEP|$SMJk=2TA9k@Q@U_T3;o8#H3Yt9PEA=k zIXS{V9d?caBS=EOI-%{UQ41eKHu$aTrCk??eNyAHeD36oxY5>#>~sK_SpFRy7JLIm z31!7gRoyD%dI~zm9$d}0n|smdQ7D;>*00CL%zx#Ti<2BRuYB?B}Qb{H^u*ZJAms-Ar|eq4|<$nloN6MZEz5vUlm;*+{k2*(0P6 zCC}aKq*|pazakJjrfvfML|f!2V}QPeE*E03c4`VONfx*+_NGa(k%XPna?}@3oUE$Z z2D2!*@OO6X`!}iZ<(1hk#ubvwQoLp=k(n@I+6Pg6bo0rkSLb3pSLbVATkfO{&+R=~ zz~Q-)5H4@16*0Z`ws_5BxtMlYpxLJE*Zu>^3AFwTra>l9>s5U9rqbQ4ShiQq+9L8) z3cklGW_hF`4WjYnpIt;r*3W z)$9&f5@HdTJSyu&NlTdj)>!Vh`=Q6*QCUKyZVad&0MoX4Z%#A6|J+DJLqk`)*n+ZRb87ND0+K{7@HXyrSI8IjA58my+A)J+T$-f0Jy zJ-|v~0JK2_5K?TsqU6eF+jz$CxGS@QudC$=AeupS5Er#}H$Ng;0+KkBkJxRSf8_D? zBp-cW{I6ZiCnZ71r%m{L_4g~zkr(}d;HaW(AgYN-gkLnfJ+;~yO zP`q@~0@_{|5MSCI?h~fd3kt}E>H04mt5MtuxUR$ zC}DL|H*alG;H$MsK1sh(b+n^b7E~Nsn+vw2Kw#no>=jM1_|hS9q!{HBjSS|j;s8#rSOvU7YysT-QT>-D{jAf{;Oz>K1$xn` zDtR4+3Bj1P!_m)?(xfWVn&75V347f4KDiQZ2|!o$_pE8L-no1ST3DA`dmtUk7{CxJ z8WFnHwgIoyjNZHa=M->F<*qL#+|Z_9({#b(8s8g=>XieOZN7w028VObH%{ZmwV9fN z&%*6Yo7-R(AD!{mM(Te+I2gbO-$PfIewG`pMcMXdG>eY@Oi7Sjbb>mi#($c)|F0LI z-~orfo4e}I^g)gHU&2ZSP@npb9#%V>zao=Nbr{O;H3!gvm2^vD><=Ip0UF`QV_qv; z1|J9(IFz!Iy1nvPVJzL-17uzCZ6BlTFcknDL8bTzJ+tlH6k zX8@Y23DLx`IY{I39+7@L@Ts>t&jJ(Cbpy#DP+s^cTmHME#lNoxb>7WO1kx&g05|#q z0NHC2wLg!aR-RQEJbfCBdVE(8`h-0a#aDY6Srb?AJFz1&31&M#&2{2jV{85NG0)WO zz}5PKwr@ai$RqRkXWkYID+6^pnlC|1wK1#CC`gP^FWyz5|bCv{PO;{)*5`5=(XZ;7#7~!4pNq3G%sCI z0xs|gpq}f*4RSzYAy(8<`F2wDK3=yRaOMQ>()|D;1>{G1V#QN<45}>e;_jh8R zNhgj5KEX2j5<4TIxsw@l6b&Fa3($!ETWpa|`hmX73A&N(2gMT4!`Q?`l*XKo1HqD1 z$^Pb8*lu*-fRbJN*uCH;Sv?^4h@MRUXzm4!e$(AIM^4bUSk+{7c$K#Zl{J1}!f1^G z7JonKn(d-b&GVzVW_qs}=3&RGqDMO{T2`S>Fi)2*`!#)39U=5Md1n zTScWU$xzaf%V7ZY>3G?s7$$w4-H&>1-*~3E$w#rvcGoa&c zNiyO?MuGgoO4$_>ObsL%Y6QlIR=y@-(&6Q+jO1ir2=ygx$il?LM4!m>ztLY`u#$K$ z2XM8%h0+h}xY`MxvVl_fkCAt~$^rs5)sBD3+ty5iKMyzzN2p6acBB#O_|5xs| zkwaP~;ziMDJuAu_J`uV7X>6_3gM}e{5J2}1NYGpGtT0|m8l0GAQIR6Q+pKESO#fZ} z=GI$oq9_W=wrBqVt*1NPf7kVM8c^0;NT|&Qn}tE%^WaDiH&%|7)^{>R@lv^M0z&?! zetOfwp8qCCPC&XIi1>VlshCf@6 z3M|2y%|U%$T72=kN$b;1Cw4{mszR}@3M1atN>&}4(uj+t1Cp%a8OP(k>n)P-RvV-k zyL8>I7xV94&Ga%5N>tQ?cRA{nc*F@58ao&KlzF`5A$i5k*36lxO&?Ls9Ww|4^M&FO zJ2v2grQEL4vFFNZo;$|Kn-kA+LL>+w;Qgrlt%0EP0MhEO(dPrzf^4@L5W20nWl0y$)VJhNVxyVksRKH;@u3ioCkc{ z5H65gvHWK+XlrFXr}7Q*xX61WFAo$HntspKIs)Mlv0lO$!ImQ)i^&5s$&lElcTlg`)depDjhC+I!X|M|ZO0CsOjV_-xOEU}>XLIZ;K*lQJK<6?F=}MJIgJ4ME$>D8l5S z*+bALaDGVVvh^17mUcCtF?T$wK-<%!NGkvbQscApN?GgY4ECrlMebQ8{zMPJwQ({@ zF<$SV@)N)agL%BZZ3lZz=SbTQ7){CCEc^GvGTFrFViTb_;-jOsDMYJ)7+|O+5&trt?hwgyV&SlNzXY>dqF8wZg!R7jvdz>I^?P6-j)z zR{c&^#ZV{L#`-k9L${WoEP3lofJQnpns)}v4olUFim{T!*~?GNIQ)SjBndKE{k>M8 zG#ZR|8Ca#P=u@&60b#GrnZrmuA>a`@ww4}hOMBe#grZ(|)ze^!bjQ|-jCxigETJUs*a|%6;hwLp4u-G{>q6z z{?A0W`$>#&=nHz(cE_LZX3S0ef)Y=u2ay~Tb0$)xeJr43_I>m~M@Tm#Ru})8*1kx7 z4)@l9gJJ&JD#vQ?gMoAl*0}|AGpWAX)QbPUUZTxSRdELAd0^_H#KI+DIkp zl9 z?eKT~d2r-RBYCSQgt>L_^kNMHKf-~8uOwdMvsDC?gr}DZ^$j{Hiw-oXh zE=2C;7pGuqdz*N893vo?>@;L#BNCSy>a|w@WVMfQ$I6+zbeog z{-)}@3)JJaHOWthR}|DrhyG^AB0X=SSV_vq-B9{G*$I)yG7x84HNtGasPj`+YW{fd zNOv%N4*QbNH2v&G5lakaM^N^3^xsO- z|5?iN>YNaDMv=5#=jFR-j5{?8_D{m(KD|;J19IVb?1c|-BkcK?$C+I5%Xq_+d~|S4 z$LZ`AiY3n1(9I+BRsC36HTzn5CdxcRAmHlR@%(UFYvcXRV6U!QRC+E& zF2Ch5&yyv$T!2u`W7T=b6aC8az*3AZTvY2eOPZZa4*gcr`vGOQ`%=I7SOgHRya-mx zS$oJ7Iz->aV&A7NAPeLxA`6*XwQTokbR-e3uum+l;ox9P-%myt=E+%t{&Ok$$dSXJ zLr(4-56o)X#vU2%9Tq8C=&XiwWMN_AKpu&k0IFmEdJD1R7?V|vR>5ZP=nqoAiL*S7Yp(np&8g=3O31KCIdrKK2@ve-lY2QZ1uEq zI1f6$n`fr_=+Ux{nc1{sjq~@MtcDt@pj(loF5}y6L4`(Mr3t$IQCSkq!7UfoZNhJ0 zxl+cz&J%$M?4+aCXHe+=!~H)cmr9)0VGd>`lYF+U{`{%a89BW7BX(voP`G7VrsFI69_r3b!^$s0O@QI=I1ZuvM;~Ke)-`?Kdge5~0V~f+(&O%yh zYCpJgI1_YLVE5l)G2A(%Rip8liALlWB8tu3<^Vh-dP&CM_Et4+-dcRhC|2kFLyOS*v=-*s0=m&d$YNP}zxBtEQH|H)_UROfC7G={o z=^a}tNEKA*)f;zsYxw^>grvc$ojTV@0T`b70v^vq^U&*p)-jp0*+ zo(eR&?@o?N}LROjs zfJU2VBHgjoI=gqBYQ!j$S;=wM%Fr9*L%X8CiLgBJ9 zd82uWD6FKplk8{lv7*bT_*0O#_`4wQ9ElWyEnl&agYQ-GuTl3@gyXBver`-PguFre zp9Wu?1h<4V&TPtGX&uDLz}cxn-j53S=D2~Nrd!POkyG~%4M(hh=_N*bMh(@N*rhD) zm5Q)hsSRij$q+q(k8Oc) zIx0%C!TMfQ4uS0^0i4EX{$dJ5rUKFrH;KW@U+(8~Gk?3tCo>A5+RA>#?WEtkj~9;q zfE@VXRK@&z^+pJ~9RWCCPncV>NBx(o@^{g~>ZYAKpY;JKSu`67wy>V`0QFuHwYjEH5v;>gb-i^QvgON*{p@@q1qAQll6-vi zUm>uKzC9J!kavHW8QYq@1z{@;;-@FixKJM8D2A)Ej8G(GMl$Q984{v#rGC_3-k@{e z_%#XKMaZ}(PZb&8QC6`@)8YB6?;^5*@ekFm<|m9j5#Jdn$H$!+vAWw1A}FlUTGBDs zuZYn2SM{X@CX33$nMY_$dRI<%(Y5-N=NS^Ie>%~v#N*;O+I4F z8-4>0UF8|6gu1qlM0ilOA0<4@hbKl@b7y^YyQXuvTHJPHc9ptDW%+YweQZnOBK4rw z^FmAdxe9r%H>%^|A3Ktj5_IKC_o$&dfCpTm44cKeK7D^@;xk5Dxw7Ufs}esY0tc^N ztSwbm@g*Mi)>meCMivSKTKYREHJwIkrdSYq^A)1-J#Ljkpl^%g-D zi(c~X(r{CW+^l7X6%oh&x36*{JsP}>RFO?sKS2}?Y<&Xn3hw^ZEDAVtcGX5!Jkb2T zwF0KU;*7C=QMw;nD@x{{oipEvc|Zhg<+CEV& z?s}-;e1E%iUqi+fB_X;^6$ zo?9kILBh&_*1AXe7fioaDlg%hIf#@!W zDuB`B0HTwbKT06XXDdsIpmeMxP;S_fo-sCtGY{7` zW5mbGr&FZH^S>?ps~j?lklr>2`B(U1?(nD^q4navj#{|sP?ozkV0jwn(a%*NCG1hG zTz-fI3a}vEb44#~!FB15iE9M{s{sIMb;)S=etf?aq!6pS8lts4(uO?>hDd=)!}OYk z6Bq*sn45{!oE#5DD@##y2jT+lKnL#wIuFwFDS8iSX^^Y?pe-&`4DQqiUoG$Y_iuak z-*Q;%(oRzsj%LYwZFe2ekhi}*6JX0>$DP7IR)2az;G2ofJbKYxvNLfzITZ3N?``rf z%Qy)zovij4YfA60%X^3ZE={;Nl`a!O}=8g62Ya8nSNoWhI)^iq!9a-425M`x~`YW*x$)8=#^kPOS#p`y*By<59 z+rUHZJ?6hfOXM(sxiYAcOXd0v1zHpdiah!Xu`{hgu~HgecI|l+U~hepB{5SbGKOV3;%YffqOAb z+MqvZ6u#p>nC(1o3jWb#z~jY)df4}eP?n`%I@}W3QRP}fwXExKkp@+6Ah#g04u@S@%3(7 z6EViO?e?wec*WJ6rdSmeh3TIUk7?qc%AGSqm1~mgaOlF_mSM)NarYy44Zn>kh!!^vsYEo(V>N-ODw%!(bu5tun_}_FO_U0V zlUPTSV*r*iIdeh?l6kF~U7zEFZ?@(^y6ME~e{k|J224D1n=@fb zhWEM_`VQ_2YMeHeb#!!`jizjefK;x?ah&9FoKzETCM%=cpOG|uBnL@A$ySC>%PPZ< zE%EzO9Q8yBO9k3%{w2S=%u091p?lJ2y|SABqCw6HL+<8y_%n0RvvG~`?>d+DH7OCb z-=>|OsrH^cVi9<7(NqS?6>zQ=i_++2;+~4{Y6yFJ z(8F+YFnq_!g4$r7z%=gE64K(~s{xF)5%&fW--3CrQ?@OS@e)rh{5yU6eq{JHaf1`p zHxA@iMY~1&EB=bL=Fdz22-n?SafIY0ZA9~UGR1+8q?hbRi=qOMPd@jiSW2NhF&krR z$0g+9l+;Cl#Jc$H-{Wqa=DeB@7(Gb}$J21oGf06)x$sE8cSL}(5MHKzd!uMI4)|Z{ z+hylpWh6-EN3HFSJ(a7ipOVx_2NKO;zOV8)##pp+^aA$yx#6hfPXY$Io(gwh*IJNS zCg_d}GFpiMF&X%nMwXL_N2K%#dA&1!Ci_SC*_`HCHM&;(-VrtV&92`h8-V#K>v+0QK?oLNv-M|!nvY}7I4w0hm$2hf?_6}RfIkOsg&Dr zD%a#nD;Y^>zv|QV7s3}=9==v!DnYbr)Cqg!sNeKT`l^B!c)_f^AS)vMY<4Z@WC7C_y((t{aYM0qX&1c9QJEA?OsY&KLE)0p##E0jEx~i zt;*Gizh^=LiG_|qe;50Xsc29wll2~3`ZF@p^|@j~FzF&!(l`H6-&ZsFC7E;7Q<3EU z4#Af(?X=OZpt1qhN_OxG=?5$32Bm7=yf?Y}5aic)Vamv7!VT{wd3=m_ZHXi-Ae%cl zp@V#hTbp(od?fYVbHDFjeA1KG13s2xqHmGD_eYXxJUQI8JG`P=IVF&Xeu}+EP3#j6 z14bcS4+&%rod76$*2lJ#N!c_5a=j9iri!$_PD4YgdQBx3(9t0WH!*kZ8h%I_$@RCfdk_LXWZR5R zA?-m>o`Z)F=WCtWs>Puz2rIk#u34kxJgYQ21) z-nQ!dXr(m(ss&wHv|Mvh<^ce&82GjwB~+B}p!PPjOZ;|CRtWvd(u}D4WOrc-EuQU; zZrG?4)8OAvplit=JCGBiT*jxPCmc&v)XS7fL1?EP%WArRP*(SM7iiwMl69H7^D{^t zcf}t}c4-$Htz^6dPK7IQ-x9o(jNV7zA!~YNI(=u&Nl7q|kf1|ds%H{Y|5z>W&1L<8 z#Y+>GpYPRmf=w$TtMd+$p(eZWs7yH_4vGaGW0PUUJO*%(A#Jz-ik!;JfdQ{zo3A)- z=?J*-da;!lCaIyMc8F6L_pQzr%puMKc^S5J#gG^Qox$?HT6Q%q-f@Sd|&JgeX z{QO2jNpyX}`90Jf$R%O2FplZq*-X&^NJH6R-eOpt23=_2735I*>O8Vo@4f)RtLA|x zWQ2Jx60*4USkFpfweI^<2^oKMc|&+V3QRJvUO}Q-%p3GA50!%ANSJ}0Y(cHyt7l_ zP0#YXy>~76zw~bk;FMqkz;V#s{i}8JpoPjp5)qYPwu7>3_VE2WYOc;uiF%KXcpZ~q z+Ti^Vmsj~_@J$T^pe7t0pDreU;IN31S>ye+mg_IU3`AuHgQc z3-k)rg!ZBG%}F<`vaPHB8o&ZIkrJvdr*WV}yTSt3ch$#+59Ey2wmu%Yf0E@BeCF_$R|C zdV8d|LOFXrDIv~(9L1b4?g_0C?dj7s; zECXy01=Q>*RdEdju6NOVjAMExjP1DqNxUxALx;z6!6Ao^2%4Rq$mLs5@$}(fpiAV; zLdQK{66zripZnA(c&OadShK5;qk7bIb(i$0s~AAf((++J+a3h~l)&YuEx>6{JT z6#W=k1!n&g00E^W_OmQS>AMuNz5h76k%t0$4(DqcEZu2_`Y6}#qId=$sQ|t_33}wI z6_vm4h<`4V%#)X4y9l9L#`bE!O58fPyBbP^j$T%snSx>fdtEc-Iga;P0`JX$0^Wrv z-34n#@J6>$5aL49eF5Xy6#PrH07HPFDqN9f_MdU{1yxzOdQI|q)Ph1Jbea<{RRCrc zo(vzOpY=V%S4&(UWLO#o`31qDh{^cPpg*~|a}@j5aoS=nFi~&i0a6GUqmDJ>Ng_i{ zJA0LVzu!qP`GJ#-*QEhuP48Y~uO{yKQ+@qmFX5XR-tz9Q=Hw)yOAuLNQj&He!wml+ z{gd)mq6n4`TqWE&BYi8OU=$ZWS=~8s6a2;a7nuJ0bNNbE)j3P+RVYGoCcv0y1kke~ z*GC?NAgEu}l?^d+{=vLed0_K>(Fdm6pj)&3wKi`~f-UT3I#wv`^KBBa6 z(UWrp4!M|n>8i*B=+~!q*S?}nSwMWp;AF7qG9YcZ2Qp7s+^FCW z*Ax2!=|$qH>c2~m|NOW3`cfFbbG@IEBvj&qW6xKGHsRa57H3kkO0e3Qy=mFY`GpU0 zi59~5yPho3flSKlq8R0$G3xKlNqJR^#Ek>4>A2i9J+rt*)XI@lPqaeTPqwaJsO^9& z^b5CSa;5+7obMnAti&}ADHe-4z}8=y@9;D^|ESa<<%`Bp<6|SEDWH6^5^Ui%{dU{H z@)_1^n+%#G-j=@!gJ`c0?m#XCZn?nM4jAT^XR0-hB!0#}a6%1If6yf?X+VYIwKbb< zCbD>`zbA$9WK|lGUMmN7)O428O8r!qkculEr`I_c2xhyLf3)#Iztm3`8%d}>U3Z{H z$WvvFMlHna&UHk+08o4E?ke~*ld#o|KQWyA=n7c&?Hr-Vnw1J{z;S#-o=zD%6=1$_SPM7!T`rN)z}RQ_!*y(LpMFNlO0v3-LwWL(!Nxou|qKZ zXNh}SgdL|097bXFEqK{?Xfx5PO8YHiF&H?zJZtY;H@BSN-aB7=6$j3OFWmLReu=&M zYVq`TMgS1rr&W;#t>Sxv#nVm^4k=652bBcbYeRr5_MuMkvRaH!WdFq%pFeY&H`h+i zxSab`lj8r@3q8JJlFb%HVWacnfsRQquL~LRr2T^|Vw18$gFJz(>REyt9XAhd>b!uF z^F|GT`HJj^O?MC8C=A_M%Iywpkr$17hW}aVkXpSIlp)itscche^lk@B#(1S0 z%KlJ>-H*kZV@emQD<-z)f)b`+Oqdomb_ud#-pWAekJlb9`KVvuzFg*JA%n8K7U`!C z4?d7y>kM_2PWS-(AS~gKvTp-MGu}L*So^QM7t;F7uOmS4Bf9_y);<+vve6ccouP6V zr;lrLaflNS2t)b=g}oNhwmLZa>esJdz~eWbwOzFznKpj$yzEpXC0P!ICH$GE?CH5X z6!Ri|_we1)thv}ul1?5;oNMfh5?-IVSdtoAg>*96o9+embMU)ykB%~W@ z1Qmp#B&E?0AuS_azsql}@1L@k@ZP)kp0m$B`|K<0;9_Vg$LlwckiD4f#J^O%y1F`N z9ACkx1x67Zp*Q;7K|l;!?y~&qx?s@pDffwOCr6fC*B`TcNE1H#W8d-TpDK}_cFQBs zjTHu=QXeBK*Qj6E#G;F_n-_t$mBkhqdquX6ESS)Tgfjrfu`UC<{_sHB^J`zZ;+rH- zt$5|!Dc0UTBJ2Dl)O-i#$uE~NM!zd)_BJF0`A<(zRVpu<;=Es)uX6FKN{i#>g9|wc z9XUp28?6Ky<=&ZY@dF8y&|3vM3N)m|?%G^mx?V3}m1q{s;4IWP$U6{^1^qIhhqrh} zUWq!MI70d((~0bc-S~szf#LbcnMA)r$qv;pvpO{gq_@6LbcVFf2zzD=vw)-#j zG4t3Hp4eBf0&h|d&Z}Gl&6L*$8Ipaf6&%ECt$tbyTEm^O>xR>&1g~))cvnQ6s$WQZ zoZGR6(=z>9Xghqr;d`QxT2Oa%#H%whM@q|vyRixOB1J0Vf%8X0VeVY?rx>nqva}bE zB1gtT0#6JGm6=eAeVe{vYRCqdDa-Qo5G>_!#i0t3{1&y(2DD+gJ>U{bjl*vj587Qh zwy+y*25r*|lCfsJmVY%HzClVc$u4!n!fX%aYj#YguNKGY>Wsh@XWX>7y_qBbUO{h< zK5i~EZ^)Ng0-aO%i5A2S^B*&bhITi7g9h(tFPFfGD7NjF{u_uU@@Z|no0XO6b3<5A zQ}@qb9w~xJvW13z3OA)C);DFo&1W~Em-z{U;YS=dPwCP-H*=v=>xZRn)#wa;v#;6HN3u!$xJo+F=R&DsDB8^^X z=$j&3lS)?CSzzxI^z7M6OE)fWAuf#q(x4xH1HIH@B>rorV6vA%O3$ebJn#+H5j-H5gVgk(VSS1+G7XhnXU@6&%~uNT`+5i?_poi& zCwTmMHHS&R$KT@LbOMn^_gBou#EygV501`%qJ!8``i5nERNlRUr`PN#Vj7610=T|7 zGv-LWNp7Q8R(4GeRpshC}{a5*b+SY@QAofLF) zeXCMeNX$zR@^77!rE5wMU-&*#nNq3y4Gz^=>hU%-3gx%MzlGrXS1cC zOL3i`X}FafK@}xDG~>C`XZ6f0*#?r7js^L;jWr(;Z{N$UFrXAENE2&+r36G5IC~H} z)xl`IEyI+_{yONXI*a0s8u7~mufk97^REyGyi>AoOy6UChn*|mNO3057a{cL>{vgF z%$qL0vbnzC_0GqS1TwKJ8YJf;7$I7;Dtt;0mAf9Aav^Odvx<*o6pQRwuM|%c_`OIF zx1QLeN-ZcGlGtQIWg2(+tY2}JZrp#9sJ2>XSGabFJk>=rYONMHKe1c35#bNAof`d8 zFrcy3(m4NFWJsU+-`=&<0`}|d?6ZZEiEEb;T~fz<0Czwd;L^@8yfYKvHUBDHzCbrc zp1#9jZHPCV*>b-2$8W6yE&c|A)m!1rZ#|@4UeQb4jfkR>6W97>(xnupAdO>>;3#sS zGn2Hk(AEjpMLylT`7d?(OEmVRL*#;mF{1oB0%cnA$@P|ZGI-8h=^{h+;q>cc@5(m* z`io2IH0uViis5DipDTe~x&fi1oedF*QZO|FR&d-YzyQf@tV~6I(2`Y!A1^v3yTasy zi(nQ^p!LY93R>|4MBsFHW(EiqR#6Es5Oai}2o- zr!-qPQYB^7cqQjHvkJ!CQ_uBmw|11j|4!5ia$v(57fg&MBt43F@gkwk zPZB0o({r_*k$23jEq#yevGeW8>-HrB@#(`!x~rbev+D~q?kpXpqvY??geH~2Ch$Pu zf0CuDIxbV=PGbw4OC)t%>8jE|tfFb2J%5+*OcKpubmbub!GE|mrFXk>V(x4H5EE$t zYeUpRe3rCOj`v4eTW<6f)D{*zY@>kUBR}ga*&2!Z&ns2cG+rj`?pHnxB^omOzOPWgoP_$(8x{=Cgnr+Qm=H^e5X zT;im6IA=er06X_A^_h!*%VGV4kaXpHgUQHUK38S)U48Df^3yn_b7q%egR)ApR>qm# z{lh%?#i+ zUkVt7L1)=&9hrsoqEoOAPkA@co55Sc674HdUK#c**mzwDxXs= zT)_7Nz^*%eaLo)c}!ruDK>e+mJJ}WGicn5}PCtCO?iNdunGLaO=CCjmO zG#m7C?DRoWI@{)$W?;CY23eI2UWlyPdlL-Z)s!LbD4@Mp<)9Fl2Ct}rvL_8Y@QBt4PPV8d-bS@BdkLyBaL=AqsG|j(5ZR0O`MM}DhB)BYo%W( zR#~M9xXZi<6H9Kb_oeB0(-DI`xWcus#jh3JqlUbNm`?f0AMVtR(>2=Bg*@SiEVOD* zlsMi5`Og-t;E~WGS0UI8>>Y-8tsNX2)5F$|9i=Uk>4*7HZItJ&yC7d>T0DAkQI|8J zJ3b5a7eY|W7XIb%WW*T2o%pr%8my z#qiz8S_x1p#0f1O>4II5f>nxCB9VfEpQJ96>5L2*+-V^>SF_lLnWlS4ch+M>9{Cl* z{2!7Hhkz>KLZbWZffiqDG&YMj_cboqux+u(r|wueswx3nLAc|c)E8imu@9w3mlcmR z*tGGNy&i2b)OP96+;LigR#Rs750?qae z4Iq+8r!P<+P(w~*WjH$=FT)@ts@!U(javmlKj;dVF-cE4Ce#5HSKu53AqfxZmB(o~ z;#@1Vd%CPuo9?9ZpPu}6lw`sZDuYu;0oLs+u7#-M)>4Q_vE~LL`!|17CTxKPm6>Uo zs>kU(x8NLoZO3)oB#Iqs8av3GdE%$<=C&~ms6#4vv0o(*d}&LXHb21m{G;I4ohSUKr$zOzFtEEJQE`w|Vd971C6EpR( zgW30xsVY&lhC&%TrCCeS5qBreefqLss{OZum3_SX5m|dBERk@Q%H}#EtoB>1^TVT` z_Ols;3)OXWo;6pvs+#)r0FDzU?Aq|L?T@Y& zAA2Xxx~Pj7YIHx zgc-l928z89oVZJW=-)_PP{??r|^{Rm(mcV%6* z_&WsuROfq9%HJ}mHo4W3&!B2+tL$}(xq%Jx^&4g;(?@o9wk?R;zjeMLwsu<6`S&A=(#ltK zuRu{jn0ojeeLElN{oSQu&c2D@r7aEyZ4r37Mh(C#$|f^0&y2X2$r;^biP{J}%Z;9y zQw|X8VK2qa4zEe+QwIw&-oi_Mfv70)-!tbsj4@+Rp@ie|}@~H^HL# zM%?LZhiKWK0>-W8;T-qDH&lbO#JyDI)gb3m)X~a#_T0#goA4vUt@%FO;I9RN6$OLd z93WRsOBLt*-V}5lJsEYuoWNHh zf-_Kk2_iusjbFqtPRo+M@Ta_w6LS&cnfs;YkS@CaFEr-;m1tWTbh$#xdSWq zzA#FNVF!stk(x5{nt6BKzn+7rAapH+0(tcZLC0{KZz=Ik3=44$?Pq|gf5Rq26zA8I zBvp2Y4$Q(iupiE45Ltv5R_@RZRAy3=?AO!>E*ur7wE!?H5q!G2x=yo8rLpbVQy2LH zX7<$w+JfiS{&d*9(~#&0V9qm6y0ecXH}WZED8=Yn$rf@!_m;cVfPI+AhXL);?f$cF zxLQ4<*C+e^NtD_u-Icg*d@HRjgdnY0Xq5nOk_3X~gN9d6-^U;Ms9=I2UXqYA@3uv! zXRYYx)OI)Mgl^^HaPJP)+?TG~OIyB=<}(%ZJelnLwXLe7p?O4r<^!{auZ^m?$K@Un zi7FEdRC|)iPoIR_dFrL(c89pHKWPYR=>C0O8Tq+uQvu_I2SCyILxH-w*;+ya#>rXl zzea#R0i=H7y4FJJ&Ah_z@VN#2y+7_fh;|ZX-;Myo?Y${2#rn#_Ao!FGRkMchhlB~j zxBB|}BBtX-3~x@}i$)w?t`!Y1tQd)Q5`-F#gc1V3)2n5IB>KM_^dc}$s+9=d@JV@4KdryNRlwXKkG zJ{{0BNYqxguB&H98i!O|5F?uW#%wW+PIWmMw)!1c1JV&YF8zbzIrDdW5PN)H&OT`X z!#~Zi)w}b_qWE-BOL5j}KUDZ(P?+9>J18bL_?*!_i%XxHT-0^#l-b|4Qo-c!R3v}8 z)wdK&M)S;N=K1-Zw9SWVrHY3yd1N()yX?Dxf__dQ22)cW?8O8kURb(FvS0dnHNa=(mDeXR}t(N8a zrS;%`9y**naqKuB258BM{3$5dLbly!IFZIAOy+ZIXNg8 ztkuUT76=!a(V0e}&tN^=x#_&mP)rSK)0c#|vZl=S4vYYY459yf%ny_1JycbHHZxwD ze`y2?MBv?j=96zr6qbF6^V4x%F)Nc*;1tE<@rpj5-o0~HOQi0(fodb^pn@!L!6pDM zr*Q=?2S5bJYk+>K1BW5YM5bFWBZ?P1IjHLZ(#6AOZsl+M{_B6oTF7djiQbR|M@zs+~c?Y_IZ{lYi9qko9{1Z+FF)sgkF;rf!72kW3JyA8QU2LPWrVp zXLOK3AQ@jb9vS{OB;gK#3()hjRtMz>!A1C=a-p9B`y=ODkf@-FM=R!s&l&0xWrn+i z&QsgygH|LS)Mjo*PtyQJy>%C92Q2Px=%?5O>mm_p;-k)zR!3M|dKZp;k<-?S5oSO4 z5~E1EqaO0bYoIEbmz;}{5aY0XyIPB(*vKm_N$(igq7q&tM8#pZzYFW67^!A%866+3 z%D4m{DEjHlGY$kJ;v=Mevv{45A6geE}` z;)~xsAr%@1P^UorOA?25JtZ~k2grZ2h<3mUI%;UObOR9aK0o1t^y2OD)3NklB$c$v zPe3NAKTCaSr=S65@gISSFN7m1`4;laapWaGv3nG}4z&RGr$EAUbkPCDF@Vdf(PEe* z3vTyF*2a$Ixe=ik(P6Ji5%UJ-hZ7(^s6t)P2H3l6Q}?KTGeNr3!1pW)G%!2d= z*J^@c3Qz$b0PgRU2Tg-L>I%SfPG9|gkl)!$ZCG*2qI(;)%yTDA$ipaNp8{RG+_V1n zQ!h7|sv$HVN!$3J7GQ^TCSVLzlfhhm?bjl(y)-AV@lyTH27xMn9WZeqHabU+B*rg2 zL+NPoDF6-z@~nm9sdg%UDUCKo)WFc#2?D39Kp-d=?c`Ocn_&yUElX^{Q*m{eDZzqp z3~t>B6?O6Fh`tV!ZJ87`=Z_ioIdeg^UGK1g>RAS+32ms*bq2k4APv;F$sjV4WS4-e zv4&c%9L0I!#8^%OcK(`*eDhRU*!avhV*)V-=<4nGl*IUl%mq9NZyc6+!)bXdiibj} zO_~U6U!lF%<90kWxS@Bz1V}Kt{X*~J0XQqKF>QuX4TV>)N~XRrwKDj%31t$zeZs6> zKZcax0A#^+6-*tZsLRjSG*f-AwRim)#6-v^sZ+xM#i^|_0+TR5Q_!<9g35_Svl*X7 z2}sN%@a?c*3Y**L3_u)*vJS}We8QK9B1etLo(dqc3VO0BT$oq|cynn!Bvjm);Mgs` zH$M9whJ$XvaJ|oDIAgwugA95`ddVvPE*G5-lY$3kVVg@TLV0u7L8@CH{cgbiS`E69 zug%inV3JpSLwN1y5)Zs72{Yi+JX=yWp7RtGXVlPeL+N}|AF6?-TF^j5g=XW_A6T{C z7NnW&oTugFoc{1NX((O(3UvA-^aW~j5}^RxNtqgi_0AzPDDQ!!Z?nSh8ffp8}3sNX&)4z6%! z>A;aU6=0{A#9C3`sNDMR&WMD0_`461QFCATgoI`(7Kry=y?XOzi$7dC20M5&7omT` zwmggr1|BCT*T@LBkzt!@#BCL?Qrk?5h<4b~6_`~pMr zXaISUDw)OMJ1Ebte1}fKCO+V$sCsJ}pcUr~#N7i{YAyFXfwKD$LvC4RGfmn>^gDjK_Ov#bdSoeuXV~T>A zNBx&Ie={gFxxrVY(K_~)>s;SE*N|!PNGk|%(E8rIl%v6+37p2Lve!;?Ek|kxR4{K0 zdjH>Bbqe9dc3M?>L8D9$F{;Re%ML<~=Y~LH4~5I#$e-c7c5TnPj<2LS(30(ABs1W! zf#)y*A4w%38^NPdz-pPr+nZIt(&1X7u>W1bS9-7zX^5fcZ<}O1l-=(}=;9<_8(O za_F#8$yU%_HpHw3B^tjk{`4B4G%NsNV9;#LCnV=F^Y7AP>oBKOUrD;wD;IF-7#u4E zyd=asUb{@(i+QfLDn!aLBGE8mkTVZeQbAxzv&K`zutIz4mkk2CVRqz0vV{vY!DWA@w_M1SE)dkN{haB`cC072jfjy{ivseTh^H{;(nPrr!snqYgs+zl{$^ zjR9zEKzKcOne=dXKH^*zm8J1!rr}xNQc%GFe=SucFRC#;dBW$b@68t&`vp5yH|~53 z@^;&648t#tB4N#Z9`Fxj&MFw?(YoHJ=Dw0K9Gxlsa)n~}7+f$QeMZVs*;s6CZ3jqp zsL`_^-kUsPbY^DUU!7q+kJp9#uL;?dqykiS6?ygTm^K?I1!`&GoQb8)N{-8L6o(3O z1VoQ%!2S6-Bz@U-`!jeGwDGT?^AiS+Ps7m0Pp=@t%I-D4!+MBQ{?0Per6}5uK(69~ ztB)s3eK|n-LQ-9o#Cq`?36k0jy`H0 zoRLAGV6Or~#Hv?OzE@9Url9su+I(aimh5RyZOjZ2`rJ{v|Ig>L2nnN-2?gU|EH>8OCeKIk!^D@tu&?#w06qMx9n4X1v;a>2K zeU&F%IuZy=&6L&^i4@lDV|;yK2R0NUvFJm-}xNef?5}|6t6!?MZK=C znch609qxi=9tjt6ho4eLh4nD1V7$~lrs(vkCObJY25D7Vie)87D7*YygeLx^q@;L# zNYH|L-^`uvcAIM?V(h%E*Sw*hz5FbI{h6yHn^pNhd&~|kcU9c*t)}hV#2=yPhp8Z6 zQG6eu8~2K@2(`oJ4x(|v0%#7TH#NEj)6x)no#pwSXEGJk&xafdQ?7K} z>clSNT2+XYA&7q=7QN4L@AOhOI<7LBk#D2lsyfTh%So7Xr>(b z9X3d9f{y@_=e*jl5Wwq)V6cS{glNy{Y!0P!kp-L|*gScQac><-MYrSUf1erDoMsQ^y@ZB#vLS3?;yt#fbHX56A(&jxva`r!2R5}xOyTy3=SQW?* zIs~+$t?#2|AF2&+ZxkpjBVqnASSh;UvmK2$C*Rli-s}Nmz*v=n^*~3|T)wQxM7X#b zAkcPs=rX8m900em!1$le?3D$5o`BQCxz-?>xR@B$F|*#Pu0`grxVX;t=EXl^X`yWD zo#Q`U23SZzff`4cLImvLzKF&q3LS-(8f}#^DZ-lw&jS|UgLeE;*`9hKPeP^^@(4;t zdOvPkyhlNbB}7~1-93ur)**|hRKCKc*yq_K?0zp5)W6N(P-sQaIwES~FdPQWDDE*j@Yn=u_}KNpOcrY%KG*x0SzQsKluf;@9VdbvpW1qA zrs8Y@c@P{XVvfsv*R$??^D#DZvi|8-ABwEK)=>gPJ5+PJlIzMd6UcuwhZEdr%q`#( z-AVh7jIY&*PpwJM^Clog&PRS^9??1evlas(l@X;2&s~BF0$b-mVD+-IwSD7y{~&ig zu(*6(2?4yp^Krp@AY%_QH#kfLmJqvI6t$kpLL!IM#E#BOK;lZ{nmW$Z;R#O# zKu!VFPLX9h#l%j9bi>02y>{WW)X+O@*sWYn&RM30dy_?8+{V2V(U|DfA7f8ii^SX; zt7qDR?pZ9w1N{U8UF-G8fgVC=%jBR6^v@hsw13%;(H&BsM+EzHwpof3D`z%sWhR-` zcQZ0F2|Or4ARds2>S_iQman@;uLd+spK0G*21xIZ)_-+ZvOEDtE&le0QB0ub6!LJ72zeYg04n$2pmM*sf|5Fwqfm5M zegH&@-@di9buF$EED%5|2>gx1h6jPL;4iqrI3dB%vbsAGfDB;o!o?)wJHDoSCN99+9XRmvD!pv9H{MU?64p^m;a>V5s>j`l)XilT|%$ zoMLB_O9^;Q`%4Qb6Z9TEI`V+784XmaX=r5KMfwTcWu@vk1!x_6S)#B8BEZQhq#tgN z=3@voYAV=MNdb-2zJi9^tfJsBrP5wBBYgsukBACmnGpiB zisV8{L9oyHa4=%Hko@e9?2!*!)Qbmg@Gs;)d}#nh@I!IBHoM1xP)jr9EDV`DVCjA(=`iXXidCD)cL=CPeJAD27p*R5ZHh#B=2$ zUMN~~JPt4?XfH?dpv@OeMrr{B>Qi%e{$m9l!2Iux)Z(LyvJ$Fe%!Z7~7aaMQs*v6a zFA5y4E-+6M6xsJD@l2+h8;p`Xh>0Tl?gU% z11W&?L*Ak*;Cj6FNg62FHg!3JikWLQza`sR#nPKOeI>2^bib|s;XZ(7M^azg0s6ir z@Hl^KXV60q)AJqocg>5*0k}g8K&QR9C-7pu>GOKnWI5v>AN`8Q?w_J%#8$m#epy+1 zTxI}#f5t}u?f4-Au>mi6j=_eq{vF1g26un$kyF}pNMP*oivs5mY@-O>9^nwv`B(L@ z-C|iq&3HGXUq#WezrlK3#*a7_WhY^{ii3kg(2b_=R8pYOz6Z4v7x1qsFL%LO@~PXU zbZYL#SBKNy?`<=O*qCxR*`7OIV`q>nE;G3dA&if7?)vYzZ8N+f-0@1>9p7L%jS2Jx zL=nN~+g-pkXgn7Kvlwz@rDI@$at>t^;;J)Hw3TVbj6fS>OIh^?G zpP#^A>|PD_!n8Wj@Q1-pnUq_X%Qt;bd?76un^_5Ez0QD!8w*A?Ra*$vZ)Pc`QzK%HC)Lxc z`Wk0ctXtZ@f}fqV2)O)hg<)C19$l8 zmKMIgAtOMTR|5spEacx6TmGvPe^7`zY@*!1`e)$Z|K+oYP(Ujv zI(gXw$S4~Scus)P;`W@p<%%v&N`E+UrSAl`ex3$S9DE&Ovss%VD$fj;9iCQ{MCzy;% zT!7?}FW_v-j*h}=00v>AE0G4JTU_Cn$zd)28e3r)_1D$fAvigd|8Mbeah}g4OhR9g}aJ>dn`Jf+dq;K?em$E0faV zp*Cv2P{4~QU{)2N3@8@&OlH2~InHY#&W`Hvt8cln9C@d6GXc02_MaXQRD}4{4j&2F zuirP4CH1>ZHD3hc-D$u9Xr%7&Cy1usKJR;%YK`}ULcGWSbai{Q23+=Cs$eRg(4?F@5h;A`F&`wp5I9(F~ z@y0P&pK;bEWcfufhwNhTK|k^#)Lv}54Yq5LWcbfVnnwb3#62xn&t=ZPG5?Z#6#th? z;a^Czy(VgKmm=lp!I2Jpst1<=c{8e5IA8l(Pn;icafeRGXo>G|#S6nHDZ)Qo_99tc z0bumE-aFU;1vCZWnA~ci6TgEC!`pz$xh{bbiIJ(^nmT!JivB0uEcQ~&JFa_ULz$q z!^X;KA^{@~lxKdI$}^T{VSwW-Ma#}DM8DbU;&?S@Jkoesh3se;QLOe~=psiB%BRKYD#$s5|_2KVV~=uj`sf@h>R=1FMAH0sGn3G|adtK3N6h0i}Bd148Q=YCv8Zzl>*8zkb96nVN*?r;GjXe^D%f@14mw0#xI;>E0!r`W$aUuo4 zO0wvOHtAb-TVr8*6^pmY2`PyNdI?X9-bc`S01@}Xf?hM_?&xn|Cd~PSGKfE8U$S_v zF+U->fk(XIa{V`R+DUDs5n%wQdivT~*n#R-NMOrbX;eqwT?$QwtUVnLd5Ul`J4^y{ z1rfS_vRg>FK$3y3Lgmxptg0V!83EJ!2EEfM0g<~!0v{4yCJu!34Ecn7G#lMl2l_G} zD*HCJj<0Jw?U4HReC3V^{*e9nb=X_%1v$h|oTO()^zH}_<-tl}J0yrOUz^{#vJsqH zLmt77{0^YA$%)z`TmU8^q=0~KC0M8pWQYuFT0RDK(PmW7MKdH^(P%AjatX0iKW#X$ zOnzr5tmob1NSGJa?Y&g3)2ZJ4aj8*EEiU+d#W3icX&w z^~O*Y55!LA8c1_TpvI;-6`Ru-9lFarh&!MgZZAIl_qA=0A`~%;oB56{3!nzomiY z^Y=Gl|A3fR=;)RQgG%hJPabD4EREV-Cmc7Z;bx>A!*5SNQga=uoh4NnYd~J{81Sf_oJM zeZ0A6NbkR#>zPN#w3#FQI5skactA+qQ_Z>rsi35rAC-)*W#&wSrEX9^_`BC(f0FgPdsHUW7bd*3GvNjIu2Rl@YKOe-M*7T!Jz;L3^ zwA-DDvOZgS2GYs%>Q^(ay8<a$fAfpiu&**^JJ?3LYt zWZ0*0?1gmYQ~mC#AAA*}No;b`o8mmDkEt3olA^41k;z-;?F%vAn$(*W?Xuj7Ece9u z9iHh-PciOoh#UB@xfah;E?kNnyHzX4-WL-RLCxW`gi|l*(*YVayOQ2ieqg_x2?dJd z{~*2TUFN1|O?Mzrw4{}53)C7@*TU}|l zSa$~*Z{%)x8&l!%@KJf%Cco%Ua?{HFO~BWbOL$A;E9x=+vs}jI$~cF z9#}&6PFRzlPqQ=v4YVZ$qz%@g{5yju99l>Xar`huT~YR2ny6*RLw`EQYMz2?JZ`QwZ>qAABFKB|cDO0& zMbmo+@TXfov>l9sT#4R^oRH|3)d~8!xer8#a?o3Y{Zz~GCtkEU7x#Z4C0yr^iAP+W zaMti#*3kehP^1K8774jKBSMhWv+?^}f$PSOHM3P2!E1A)(q}qzv1eF3>q&1PU%{euvnE zT_-MNCLHk1tM2>`*TEcpZaRh%QUWi+ee-KQh-7VmQWT(R>prKVXc(6o0kK~x8LMRS zB^4OQajj_kSaJ^HD4<%hz&CQkLOi5<*dXvMdIXRT-OkA4GPH{S+9>{( ztX8W@vx0E5#NsrdWTLSZBs(1F;*yX9FwMn?)sSejT~_CmkvU)04Zxk6a`Vi4=?@A| zu&v#cln9eSPpKE`zB4Ev0OFU25x6Kb`zLfw5#uy+2h)-OEbxx`ES6u=(>S^p|eOfUI&y*L!40aw*E-xsRF9)N*L#Na#9iyImZJI)B#I8qrV<{n1pp4SJ{AQx$}diWo4U^ zjm!i=G1JSHzri|c8p8fY!kQ)c+f;VoJI-4)%kaIb>^Cc<_R4<7vvy$^5;@xSVAq{} zIg0q`OBoKyLIA&muc5^@c+Gh+JWhR0FqUj7IBizZ34|dWsIYy(b*_u^5eDv#ped_A zv6r7(;8Uad`toi02{I)R7f*|v^tf&eIrW6BGf7OYZ%p$ z*YLc+9l*ysIo!z2Tx-1%>+Ea5c|m4a_}h5Qw5lIfQX;AomY6Kd&@{NhN>?*{=XxU$_9ow;{pXk}olhjUr{-hD=JHHx zNGVPJ_Hmz(*79{bSS=_{UqmF)P=#Ixguzt?;mNU}0Ol6FT}nW%tOY2uX&Ra4o-|}# zscW~;yxuF(nZI^c2(WyJ-L*JIwKYH3WQ;(LKPz@rgrpK~@rO>oS#Mw--`|wuA{kVD zTr3Kbo<&@D4X|;SDR9m#>iw4n&5U^`oQUI9bVl}_Qui~#Q#_n?He_?W+{vGpQ+?&p zPDYJ>5w|V*^R+@^sZ`A#Ko~=+Ih?GK9v1<{2LV8aQmE10rd2(0FY&IG7sZd^f(=gE zey3`u`dvgusKNv(4O>5YeW~FIX<}~_boh^r&7$9mnVmi4?xROPFJ8Qt(DA}Lrd133@IrL0G4jlhb?fO*h%Aa;YfES7@h7ew-5R*SN`EFWvj zz8zQUy&W4E<+}->?-gp7qA(|B^^E-R>#CQNl~C4oris5 z>=@b)=?)nR|DXt3IBI)d6FH;Z*6Yu#z!LdYOq@ubevXG07)B&WA9CS~`M`CsT2x)1 zzKO;HusdKJb7Bm68p%wM+uWdg4bR0Q|K*miKX?@W1i)2Q&47n*O-@{y-=Dv~7snx; zWA)!;&ivtL-026G)qNm2;5t>PtaJ|{yJ*yF?JNE1uaA1t{Mh0 zmrMNab6LH)?Of*Y4em`*_El9$7Bh1YHEehc(?sV{8zhFQc3$T{!yZ{4t{j3JfWX(X zWbL)o3mV7DT)mq{VH9d&%9H0{2U13sIQ}K*`CWwvmZ`S?{hfvxHQAi6tVE!Hl7&Yz@5m@{9)I*%ccfO1&?f=2CK0A6 zlv8^%dwq1r#Z&3g|F0S-~7rpgR>Hv0o*^hiauDh&e`J5ttxPi zlXu1X~vL_B0I{A=b9^FH@ApJ1#d5W6V80cuJ#ZSZXgKj6Syu!0oJ_{ioDN%G5GuMC`JA5>W~ee;Kiu zj^}HD@?S7F6VhdrwX8zeAdJ(;gz9#n+BdQm_mgIGB;NX1{;mQc+sMc#?g+1bQB^B1 z9!ApP3=AIYRl%T4LUQu<9ZEYv1TX9`8mj~X&}j+#$$X$T!u~=P)z%n!lKMfmK_3!` zUVRNz-JE5-03i@lNOCn*i6|p!I+QF{d2)ea6*_Et{RCnZ$AjA@R(!ie%S%d2E#}|4 z0>RSrwY=c}4i5jx8lkv^O^#+H05xS>a<7(8e2~yH;W4wS+a2>2y>r*p<%Y<|7DNjM zs4brS(;RTD7*fSAaHj(3yMiIj#WNH3P~2xFmJNc+SnMD^ur&gxncNztgG?XHUmnWy z@d63duS>X_fvwPwiUF5KO-l6tEpVom)baY{ocbF8@;+QTQ^7!&-rnDNeHN->yF6J+ z=tDx1Z%`i|7YA*{J?lOyfqEH7 zyy(VPxC2f8sEzqb&o2Pp(tyfdKb6vYdUM~k)WGKQ8|kR8?vP?=pKPhv?SiZ)gCu##+HACioQPf-Ph^ zQ{sAyPN69D_%)UkV6g*7?dR`2cH4e7gnssc#4)S+7arSlzw`J870?%%KkXgwEWU#@ zU={bFb>eprxs||L&X`NdSf-g-N$$<(#wGQIM$;T3V^iZ=t)tT)-+ETn+q#Y!$JN(c z?L;cyT+FT0B&f?RyFz{w{HC7=GGQCdmEWMdcT)P#+p-=gB7)NT73JjGLmVCFq}Zs# z;#~;|Gl~WYL#zV6e}?b+1pO_4^X84;@ovPY@*r_&u)Zlsj^u<=&eBee`Wqt>6WujyM>m!SH5DtuZ1ib~uEBS8pa!avbRQi~(qk`ZAMq`C-fFJ2xVvtA zqI~AhakJZi5j4(hx7LBEU|vO50!#JbNP(ZS?NThS+gh2dv~~~hVRMxMJHj+innP8B zVDx#~KFk08H`8sDb5SBBbgYOjYuhf|qsUze$YO{mg+`CslqjIw;Z-(>sc3DiOTaN> z!ldHkpNa+@;XBzTgRU9P)-G{p*)qCFjgiR&GR+fEY<29Svz?v~g zBEI=v@!Hz#Zz@&kf`~G(qbcaoLGdLE0$XxV?Ev5z6`}M902vLG3lZ4}GKfU&wx*H@(nf6ixPhwn? z#>CT$lKe^uJBQUsi`!qkOB>Rdtg&}BuRB@QN#b^y@EoVN>>K&WPca*+!-!Ft0(T=? z_roHlCGpc+{^uB#?&m%1&^kjTcJVVqnKysGY6wR7`T1=N_s#Mfu6?u^+h56aB0(`E z+PMQSl~@8#!2a_j7ow_oi^9Rw}dusjZcCm>O(PM6YQCZSo@XRH zl-asx)fiq>RCM8VT(-8z@nL%=*^fpRx$wa7!1nF64zGAu@!$K?H~2jusE3Cne6mxz zMfq{l`M8{;f+{=kcjXq^F6P;wY_OhSd9S?9w#!5zy!A$EdM!cGE zUp@xy?&nh}-s>6i&L>tHF*W1Au8iy%V7UgPL-HLQi+i$6VO$y(+L1 zsXGpc&ULBf9b-*ucC*}&{UGauVdKKp47$M{%er7~TCHPSk`(N(%0X;vijkUGBKGLW zBU7gRzR&nbcg4%Jh#@71-O`R>l$4U@+Eu{|vdc+u3*t^<%fR}1)MoD=qB{H6sJ38+ z7x_KE{~#*kX=iP^?9XTX2tf`e=QAUTgBmyVSc2@Xe36C%Yr9-%&HE=Ku`0y=#Wk3( z>PYn?Ch^r{Sld@)ZC(fkk{xBszhU)N4qUn^bvk_1Vxnf@ZoOa3Y>hFWO*(QZonYwg z=~-8ovmXJzif*fg%$Uy_TUF!$!ZH7a)+e+i!nqmooF z;)DI2g|~9OIkiOrx=Q;qJ3BkKT2icprCR()c?{~qB#VtG=M244>Zur9?0+E>wdsAC z!7wZr-Db7AvZ7M|cH1xA=lP6ZzUCA!%6=^zxqA{mu{QLKYo7jsS38~mAI#jhI zfW7U-_Diu+Ul3%sw1}EwepM|l-jd`DgrYY9xXuDn=OS66rHRDw?AY|Sy{p4z6>x<=#%>8SkvQ}MrX4G%Moi|>GaRo#;}*loHp?hMrX-bgyZ8o}meQFWZ`8$gi;zU*$lvVH*7 zvt`2O>C!EA@8HCBY6y=_9C4`Eu+t}CB4w!8^DI6Zk#;x6&lH!6wdKTHK|B}HtB4P< zf6?OhjqFK9r;J5e^h)8Bm!hI#Ba`b6KsmwLTpEaJ48k{Va&C#XA#~_lR9haTVj)?* z^&VVs%6V^bY4W8vB$9F`$oH=1fAR?WQjC6wTSNDEPXiN0&qp17iNInDVN4ubHZ8D}vX@UCya! zs2tesVgp4$A#915_$zcsV7_^k8{w;lYejw#Jqy1!Z$+Y?^gt{W(Z)-dKqAYGoqPU%CxU^5#g+dty1t92fRYY{r0Ry#?% zcb;OW&W_VU$UYgN`lh2gJ{Iy0=Jm!##dm0v4Za+*%WGc0Y!*-nEG6})QViWtLuK=O zk=^$GUqn+7OW_0=9vgu|%jyOBK)t-8f(nSPjE{%J(jfc_h*>F-G6&W{q=hyb$R{VBI zbrD7jcMif&Du}MznjZ1YLVWTX(}xt%?qh(k=+@SzgI;vQkqH*GI~w0t`yl|Du*dCI z5ay6-n(s7m@``b*A2&t6H8lA=^FQ>r6(O_P5Yi`5+0}!iJcYO3QWIw@gA`39?dN{` zD(`V|a$wtI?N*cjC&5UV_0v*3x^ ztRRe9Q3iK1lY)(n2NcoIkr1qO?pL<27*_y0IV_L`6p$HD3ZZbafNP~ZKn0q7Qbzy$ zXtGiAMP(`>46F_KiE)9$Gq+DAv{j>5_#izyIT<2l*L#F6f>6gn|M7xR8Yp+I%14s4 zg!R;s>duyXM^M$hdr9@?083D04M-xbYR>D+?)q?l*5UQzih~WTBA=I)J$WCBdlK3t zlO8ih!7bCZkfWyst>OEqs;X*;YR_sq!u14x9Ke+zA9F4#(A_H7_#K;eM%Bn zVpN;%wqJDy<^G#vYoc(?RV;)T_vC#B8yD3U6&3i3;a#HJ&cI3?;qEN>bGWqzAdWVo zt|VHM=$sR}xE)_s27D=46Dv1t%BXa7DrqbA@*Rsq)-}7cu~UCu+`!k4Fdf+o*GIxn zogZ9r_&IBe$~qamNp#GKFXaVK?p0mFbThSYZoX)_Zlg(1=~#D7u|e+MC^!VBHsew) zr+unV3B<2{mCZ^wpUJ2og^Yh3{MDp(ZmY@sck1owO^nj5p6ua2(qaq;_gD4e5_5`B zYjXzc(krL+KB}FgCcC@4S2ENPj+daZf^x-mwio6^Qj2C)TB9U;Be&jz2@?%!8qzpN zeFf{6llX>*hvmx92aLfik;|`z(Qi#zv*PLfpAvtyIUIa_9s9k4bjtK-R(zleD~VM6 zKPkS``HkoUDqFc|zPWr;W=5r3A+)$LYpLEy6&QkkE^qKA9n74@&40IBENqwYVn+^? ze|83g!K9j^!0r2%nI~tQFtb~Q;sa%9EQsI|;u@m7#xpjJ^OwAoLvEeyQ24_QyRI;==%zpl8Hz(*wfUjvrnl$UL99l={4dw>1ZB z&L2Gg^Liza2JMh@#1q`pqT~I#lub|l<+GI$MIo>>l>%PhHexw)&zQmqB@tXm9!g&{XTfqGM{Gv_3%!vqK8a%=AYGp6eQQp6T z2c{P>IIaCc>E(MNI>WWXsX%smrqX|kC}oEDTkoStd{X-*8YA91=kYAj(}^vcME*{ zpBA{F**Psoj!t#@T&ly!ZHWi}bY^=--V!?!+2+7E_Zgkg7W_Zn+Z4`Fs&{K`}y%TTX$$xg$YHM#deePJ$BPyYo&Y9`x^Ig=%8Cp_- z2yM1TPk`D`N=i!KLr?1BaOZ&CA-q54^7Hox6rVqs^Sq#Uz)z>Q_rA{QPpo#p3@1p- zW=A0OC$)3Bfm}&vW+s;v%>Vq8jrl3ph_#@Rxmi;fUSyWI-A^t4yQ0it{3aD?B|zf7)uw?y=_RjxJ%kSElNuvL7GV^gjJKZ2+mW&P&rYdQvt9 zVCEu%9m2yaWCg&3mft7+8~4u>D&xI`(EPE_fbi;~HIqAi-NF7prrh3|0LI|gqw~Rs z@EZS94VbpyMh(%EBU>lWkiSjg81ClB^!(Tnc3)g&xkfC#|Vz?EA{ znp5hvi2S>XA|rX!N8am_(A|FwNMUUgh(x)NpDAI0IV$9ub{4}2Hn(m5pV~GW8hOZO zkT9;$PE#cHgw0<1%KhZfZlEC%7-pI4x|S4Hw)1((uA>?KkDRG!{p2VU85%4uDoB}m zXYdVncHFY)Xb$_Ir+|r^Ahh>gS8u??t+M)MB_^o4QyS{eG z@dNRX(SMxOi6JND!^z+a3q*Ur;;ed6vmhm{Ez@ib@22}we zZm07629IAGV4YxvZc_B9F7F`rvJEx?x$0OMmwTza$WTnS!FvwM;Z3=TxyS_Xi$IM%JU0= zC#*Zq53d7cfB2@n9~`jxJ$&n^6W?C@%^bw_>w%Z&HfP|DgOESUa|^dyNfcZrpEroN zx%yDZTypan$>8Fp-V?vENNq8$Z6sbBQp0u^ii+;hGhYC>T5gTFkz8`@uP82ZTuK^WCF>-L+ zvJ3gF2L`~+7tm+aSA^9l}m=Le!cCnIr%%G7}Y5RgH@Z-JTFp z=ZNjHP`<`17}S=lXm=Ti$0nH0`aC4?w;ebvYv04ano#mc^dyLm1sj~ml`*@Vo~myH zD)bY=IAUDW(npYWc{d&lec)6(3BYRzRP@HA3ooyNS|b>;cFb~f-s1zC#=0+XCuII` z-Hv6Dn%x5@ea-*UgLzX!K9=1Kkq7Z)6C>3_*T&##(795beAY#@AlL7R zS}?-jNDP8lrmtev4cY1U+jUDpx)T5S!_}7&U$MUO-`pZ`3j^wC&|Gv%k$)dv?R5@+ z?9-1WdZTFIx3UMxJF4xf4*zC4aw2r|SSx>L$ITE~m!E?;NEf1yn@k(qT~GSuu}?p7 z6jhC<+ymjlIZjJO@H0)Egf?4J&dqj2-LSo%+n5JBiL&@FkQy#u?qdCe_P7P+2{9Wx3)f5GA zi6+1Dy~*Dv(DC1YM1JO{dj;_4XFT3(f8iFp_1Nnfo+;x;g{oP0(*bJ_7O7I8iz7}a z`Hi;QULXW&LDL)(iS(VvgAN}ulC)*xb-#H>{JBcIWQg*au9@|-T?jSYOg{B=&nl}O zCn!NW%z*X{&@0@Ii>GQU;nM2YiJA59E6X3&5q22K8&f#YZd~}LWMXn_RR#YjOz6W4 z&igDx5z*#*r30FvcR4VJqX66Lab4rZyryK<_g>g9B8XMp{r(=7Kq}bzB)^6CljnGo z03w)n(ssSn+4&Dopdj{yw*X;azh7r&N|nB97p|P5c0^?$U8Ny5G85YUwip+NLG4{h zR<^S|_ogxKmkU54G+i%f2Y?f)qnhv+PZ@ftgE%q(^4XXQ=q3Y7@&p|uKCfNUoBzRc zFcC&RbmO1Nhq^)YK(QjHmD}j+9V3%lq_b;Es5~Y~Mm2d$-a+MjBP%$rtD`lU}+pj=}h>&TX>TERGmGICsu1*_qzmd>_vv9acG*pw7YpM z`3q>!#X{i+^po7dd)C*Soi8>9UIOPudWG@Qf5g__aze7B5@rvm0Yqtd#+fyCWX0uc zB4;B50M)m16gEtp$3u2{A7t-BeCfbIyz=y8W1o^iLFC5Ws#!UuIFf{Dx~cC=OrPcR zrN`B? zsd3|j4A-{dno8iSc?Xs%xlIoNTR#A-t2)G(=D?~thgY?5ySnW3FZ@qTL%kQ!(%7lW z9|m@Uy`Sf!4cDUESzul+RK}u)UHjd`g!Lj&Yci4*(`PL5;BllRk}L#$G4wLCFm+=B z2OjPS;u{TR<%;i9%CcpH3#6t+q3mcKhglPZ@S_+R@2JG?VgCwKQOqpOmI>F z^;q1bBZk)!8=glU3DmyC;!}MrXl3Pc&-QaTJ+>*-Bh$I6@f125x5j`AD)RqTLlGMy z-vYgFO(=uGRjJZP_vLYhC9u>f%N1Rp9-iX?z<~~Rf&wi1;JGm?(Ga(wpnnBm4v$iv zL)4_g4F+{dezllIb|jIY5)N8LeV~#Mh4dL*#W=JjLpH96mR-de3zg1RAk=I?*SEOL z|J7a4EHQ*Kq*?;Cuoss5F2A>c_Aa2K1II(?$10KjzJ)~*1zZUf>7>1R z?M&AVg{0*dB-fP>2^JO>iRjyTumQyXw5dmQtQk>v$oiH7|DJ`p`3O@`{X9*1(E(R~ zoE-n`x5STtmJ|svWtYKA`%KdO0MOlX0q?>s$4x5d!!)GtZESWf^*By^*88i+jXis0 zFvy6UcpNCA3-98#-~9?IfrFXJzNowsL~t+bLJ?%iuv8AKoQ!VfLOvWD+4nfjp?FCk ze%y|Byd2qvEIEDX@g&64kPl*7SGs34&X{rz3akQ4N43uf*fK6{LpELXIO2qYejcn3 zNwQ*8CuA8XaH!2xDZAK7g~fa-33M4<%KGb>7dUX2ui@B`uDO#65hFr^b1_C`ClKJeTkSfwPu(qt? zappuAY)Kq}R5(HouJw%)!8d{mPj1Nyx#S=xa9;(BX z3UuO;mG1*QNdNeRyQp=o4As|dMjc1GK9!o@_^y}O$^VMLMFv;~`!puuZ(`rWVB*Vkzuj5rPg!Z{bb z3;GD{-j#jdqrd;YBj_U9K&)(!-+T=($D$LEhF%3@^Jzym-6~~gvzO0!Me2;Of;W>C z2iIJ_2JDQ1(geB=y++97IgnsEFK=%-Z z3^g9x+rF}}LCHvGTC!%RujN-b3mPWlCSr1+m1#lfVZp^~Jfb zCtXAhWx<6y{OS!ud-a9zzB~Vn6K=N(ZkVrGXk7o4cMl7kl6q^p|U3W%^PI4{Da!W9GW2sRvr9a4xh7#uMwm&(3^m5bJ~ zjKNd<^07OCVwRI6R1g+Yo$L$nV>aux58yg~qE#mVRQ%f{x0nJ}_ zYFG?mB{!^-D=jz@QV3la3vxGgXz8g*|Cx%RiwSMAqgw2syYO()q5Z%AE~Cf@u#hX^ zJio-f@V6VRCq_0+NMu|9RaHYo?G6W-r)M?0tQ`9)v@!G8QL!r)13^4wosrG1E#jCT zXwftA+E{WWGy~$BW>hCY=_I^0Vj||P(y80T1-P+D4HHs0L5_xN%7I)SnA+8r_q4kE zF^bo5H$drDT|V-k9(IaF>^$ngZBD4O)61gW8SoLzq7KgA|H$KwsZ_)r#tC>|ftq^C zz}bw&y6KI2*!tb8k-!=L9$pS=TCM}ys1;1QhU-IkObFn|EBkz#%;a?Ef|7m@~{au1Xu$Dnepw|z$oPNPt_ zR8f)Gbq@>LMX+E0fR`0O$ziah;MocX$Zmq>+IE7@)V-e71s@CJ%RRN>iKjY_D0dJ= zI;Uo4;$vDTx$~$)5Gyt-`fHWuI}2PZU7L26;9v8gaWGX2$DKL=R@J1`R7{^+nl2PU ww}d@?P9R=lS$Pq~YNUbv|DXSt24wKNsu%-8D+%F1g}~>krarbv!}{_60UN9I^Z)<= diff --git a/vendor/github.com/fsnotify/fsnotify/.editorconfig b/vendor/github.com/fsnotify/fsnotify/.editorconfig deleted file mode 100644 index fad895851e..0000000000 --- a/vendor/github.com/fsnotify/fsnotify/.editorconfig +++ /dev/null @@ -1,12 +0,0 @@ -root = true - -[*.go] -indent_style = tab -indent_size = 4 -insert_final_newline = true - -[*.{yml,yaml}] -indent_style = space -indent_size = 2 -insert_final_newline = true -trim_trailing_whitespace = true diff --git a/vendor/github.com/fsnotify/fsnotify/.gitattributes b/vendor/github.com/fsnotify/fsnotify/.gitattributes deleted file mode 100644 index 32f1001be0..0000000000 --- a/vendor/github.com/fsnotify/fsnotify/.gitattributes +++ /dev/null @@ -1 +0,0 @@ -go.sum linguist-generated diff --git a/vendor/github.com/fsnotify/fsnotify/.gitignore b/vendor/github.com/fsnotify/fsnotify/.gitignore deleted file mode 100644 index 4cd0cbaf43..0000000000 --- a/vendor/github.com/fsnotify/fsnotify/.gitignore +++ /dev/null @@ -1,6 +0,0 @@ -# Setup a Global .gitignore for OS and editor generated files: -# https://help.github.com/articles/ignoring-files -# git config --global core.excludesfile ~/.gitignore_global - -.vagrant -*.sublime-project diff --git a/vendor/github.com/fsnotify/fsnotify/.mailmap b/vendor/github.com/fsnotify/fsnotify/.mailmap deleted file mode 100644 index a04f2907fe..0000000000 --- a/vendor/github.com/fsnotify/fsnotify/.mailmap +++ /dev/null @@ -1,2 +0,0 @@ -Chris Howey -Nathan Youngman <4566+nathany@users.noreply.github.com> diff --git a/vendor/github.com/fsnotify/fsnotify/AUTHORS b/vendor/github.com/fsnotify/fsnotify/AUTHORS deleted file mode 100644 index 6cbabe5ef5..0000000000 --- a/vendor/github.com/fsnotify/fsnotify/AUTHORS +++ /dev/null @@ -1,62 +0,0 @@ -# Names should be added to this file as -# Name or Organization -# The email address is not required for organizations. - -# You can update this list using the following command: -# -# $ (head -n10 AUTHORS && git shortlog -se | sed -E 's/^\s+[0-9]+\t//') | tee AUTHORS - -# Please keep the list sorted. - -Aaron L -Adrien Bustany -Alexey Kazakov -Amit Krishnan -Anmol Sethi -Bjørn Erik Pedersen -Brian Goff -Bruno Bigras -Caleb Spare -Case Nelson -Chris Howey -Christoffer Buchholz -Daniel Wagner-Hall -Dave Cheney -Eric Lin -Evan Phoenix -Francisco Souza -Gautam Dey -Hari haran -Ichinose Shogo -Johannes Ebke -John C Barstow -Kelvin Fo -Ken-ichirou MATSUZAWA -Matt Layher -Matthias Stone -Nathan Youngman -Nickolai Zeldovich -Oliver Bristow -Patrick -Paul Hammond -Pawel Knap -Pieter Droogendijk -Pratik Shinde -Pursuit92 -Riku Voipio -Rob Figueiredo -Rodrigo Chiossi -Slawek Ligus -Soge Zhang -Tiffany Jernigan -Tilak Sharma -Tobias Klauser -Tom Payne -Travis Cline -Tudor Golubenco -Vahe Khachikyan -Yukang -bronze1man -debrando -henrikedwards -铁哥 diff --git a/vendor/github.com/fsnotify/fsnotify/CHANGELOG.md b/vendor/github.com/fsnotify/fsnotify/CHANGELOG.md deleted file mode 100644 index a438fe4b4a..0000000000 --- a/vendor/github.com/fsnotify/fsnotify/CHANGELOG.md +++ /dev/null @@ -1,339 +0,0 @@ -# Changelog - -All notable changes to this project will be documented in this file. - -The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), -and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). - -## [Unreleased] - -## [1.5.1] - 2021-08-24 - -* Revert Add AddRaw to not follow symlinks - -## [1.5.0] - 2021-08-20 - -* Go: Increase minimum required version to Go 1.12 [#381](https://github.com/fsnotify/fsnotify/pull/381) -* Feature: Add AddRaw method which does not follow symlinks when adding a watch [#289](https://github.com/fsnotify/fsnotify/pull/298) -* Windows: Follow symlinks by default like on all other systems [#289](https://github.com/fsnotify/fsnotify/pull/289) -* CI: Use GitHub Actions for CI and cover go 1.12-1.17 - [#378](https://github.com/fsnotify/fsnotify/pull/378) - [#381](https://github.com/fsnotify/fsnotify/pull/381) - [#385](https://github.com/fsnotify/fsnotify/pull/385) -* Go 1.14+: Fix unsafe pointer conversion [#325](https://github.com/fsnotify/fsnotify/pull/325) - -## [1.4.7] - 2018-01-09 - -* BSD/macOS: Fix possible deadlock on closing the watcher on kqueue (thanks @nhooyr and @glycerine) -* Tests: Fix missing verb on format string (thanks @rchiossi) -* Linux: Fix deadlock in Remove (thanks @aarondl) -* Linux: Watch.Add improvements (avoid race, fix consistency, reduce garbage) (thanks @twpayne) -* Docs: Moved FAQ into the README (thanks @vahe) -* Linux: Properly handle inotify's IN_Q_OVERFLOW event (thanks @zeldovich) -* Docs: replace references to OS X with macOS - -## [1.4.2] - 2016-10-10 - -* Linux: use InotifyInit1 with IN_CLOEXEC to stop leaking a file descriptor to a child process when using fork/exec [#178](https://github.com/fsnotify/fsnotify/pull/178) (thanks @pattyshack) - -## [1.4.1] - 2016-10-04 - -* Fix flaky inotify stress test on Linux [#177](https://github.com/fsnotify/fsnotify/pull/177) (thanks @pattyshack) - -## [1.4.0] - 2016-10-01 - -* add a String() method to Event.Op [#165](https://github.com/fsnotify/fsnotify/pull/165) (thanks @oozie) - -## [1.3.1] - 2016-06-28 - -* Windows: fix for double backslash when watching the root of a drive [#151](https://github.com/fsnotify/fsnotify/issues/151) (thanks @brunoqc) - -## [1.3.0] - 2016-04-19 - -* Support linux/arm64 by [patching](https://go-review.googlesource.com/#/c/21971/) x/sys/unix and switching to to it from syscall (thanks @suihkulokki) [#135](https://github.com/fsnotify/fsnotify/pull/135) - -## [1.2.10] - 2016-03-02 - -* Fix golint errors in windows.go [#121](https://github.com/fsnotify/fsnotify/pull/121) (thanks @tiffanyfj) - -## [1.2.9] - 2016-01-13 - -kqueue: Fix logic for CREATE after REMOVE [#111](https://github.com/fsnotify/fsnotify/pull/111) (thanks @bep) - -## [1.2.8] - 2015-12-17 - -* kqueue: fix race condition in Close [#105](https://github.com/fsnotify/fsnotify/pull/105) (thanks @djui for reporting the issue and @ppknap for writing a failing test) -* inotify: fix race in test -* enable race detection for continuous integration (Linux, Mac, Windows) - -## [1.2.5] - 2015-10-17 - -* inotify: use epoll_create1 for arm64 support (requires Linux 2.6.27 or later) [#100](https://github.com/fsnotify/fsnotify/pull/100) (thanks @suihkulokki) -* inotify: fix path leaks [#73](https://github.com/fsnotify/fsnotify/pull/73) (thanks @chamaken) -* kqueue: watch for rename events on subdirectories [#83](https://github.com/fsnotify/fsnotify/pull/83) (thanks @guotie) -* kqueue: avoid infinite loops from symlinks cycles [#101](https://github.com/fsnotify/fsnotify/pull/101) (thanks @illicitonion) - -## [1.2.1] - 2015-10-14 - -* kqueue: don't watch named pipes [#98](https://github.com/fsnotify/fsnotify/pull/98) (thanks @evanphx) - -## [1.2.0] - 2015-02-08 - -* inotify: use epoll to wake up readEvents [#66](https://github.com/fsnotify/fsnotify/pull/66) (thanks @PieterD) -* inotify: closing watcher should now always shut down goroutine [#63](https://github.com/fsnotify/fsnotify/pull/63) (thanks @PieterD) -* kqueue: close kqueue after removing watches, fixes [#59](https://github.com/fsnotify/fsnotify/issues/59) - -## [1.1.1] - 2015-02-05 - -* inotify: Retry read on EINTR [#61](https://github.com/fsnotify/fsnotify/issues/61) (thanks @PieterD) - -## [1.1.0] - 2014-12-12 - -* kqueue: rework internals [#43](https://github.com/fsnotify/fsnotify/pull/43) - * add low-level functions - * only need to store flags on directories - * less mutexes [#13](https://github.com/fsnotify/fsnotify/issues/13) - * done can be an unbuffered channel - * remove calls to os.NewSyscallError -* More efficient string concatenation for Event.String() [#52](https://github.com/fsnotify/fsnotify/pull/52) (thanks @mdlayher) -* kqueue: fix regression in rework causing subdirectories to be watched [#48](https://github.com/fsnotify/fsnotify/issues/48) -* kqueue: cleanup internal watch before sending remove event [#51](https://github.com/fsnotify/fsnotify/issues/51) - -## [1.0.4] - 2014-09-07 - -* kqueue: add dragonfly to the build tags. -* Rename source code files, rearrange code so exported APIs are at the top. -* Add done channel to example code. [#37](https://github.com/fsnotify/fsnotify/pull/37) (thanks @chenyukang) - -## [1.0.3] - 2014-08-19 - -* [Fix] Windows MOVED_TO now translates to Create like on BSD and Linux. [#36](https://github.com/fsnotify/fsnotify/issues/36) - -## [1.0.2] - 2014-08-17 - -* [Fix] Missing create events on macOS. [#14](https://github.com/fsnotify/fsnotify/issues/14) (thanks @zhsso) -* [Fix] Make ./path and path equivalent. (thanks @zhsso) - -## [1.0.0] - 2014-08-15 - -* [API] Remove AddWatch on Windows, use Add. -* Improve documentation for exported identifiers. [#30](https://github.com/fsnotify/fsnotify/issues/30) -* Minor updates based on feedback from golint. - -## dev / 2014-07-09 - -* Moved to [github.com/fsnotify/fsnotify](https://github.com/fsnotify/fsnotify). -* Use os.NewSyscallError instead of returning errno (thanks @hariharan-uno) - -## dev / 2014-07-04 - -* kqueue: fix incorrect mutex used in Close() -* Update example to demonstrate usage of Op. - -## dev / 2014-06-28 - -* [API] Don't set the Write Op for attribute notifications [#4](https://github.com/fsnotify/fsnotify/issues/4) -* Fix for String() method on Event (thanks Alex Brainman) -* Don't build on Plan 9 or Solaris (thanks @4ad) - -## dev / 2014-06-21 - -* Events channel of type Event rather than *Event. -* [internal] use syscall constants directly for inotify and kqueue. -* [internal] kqueue: rename events to kevents and fileEvent to event. - -## dev / 2014-06-19 - -* Go 1.3+ required on Windows (uses syscall.ERROR_MORE_DATA internally). -* [internal] remove cookie from Event struct (unused). -* [internal] Event struct has the same definition across every OS. -* [internal] remove internal watch and removeWatch methods. - -## dev / 2014-06-12 - -* [API] Renamed Watch() to Add() and RemoveWatch() to Remove(). -* [API] Pluralized channel names: Events and Errors. -* [API] Renamed FileEvent struct to Event. -* [API] Op constants replace methods like IsCreate(). - -## dev / 2014-06-12 - -* Fix data race on kevent buffer (thanks @tilaks) [#98](https://github.com/howeyc/fsnotify/pull/98) - -## dev / 2014-05-23 - -* [API] Remove current implementation of WatchFlags. - * current implementation doesn't take advantage of OS for efficiency - * provides little benefit over filtering events as they are received, but has extra bookkeeping and mutexes - * no tests for the current implementation - * not fully implemented on Windows [#93](https://github.com/howeyc/fsnotify/issues/93#issuecomment-39285195) - -## [0.9.3] - 2014-12-31 - -* kqueue: cleanup internal watch before sending remove event [#51](https://github.com/fsnotify/fsnotify/issues/51) - -## [0.9.2] - 2014-08-17 - -* [Backport] Fix missing create events on macOS. [#14](https://github.com/fsnotify/fsnotify/issues/14) (thanks @zhsso) - -## [0.9.1] - 2014-06-12 - -* Fix data race on kevent buffer (thanks @tilaks) [#98](https://github.com/howeyc/fsnotify/pull/98) - -## [0.9.0] - 2014-01-17 - -* IsAttrib() for events that only concern a file's metadata [#79][] (thanks @abustany) -* [Fix] kqueue: fix deadlock [#77][] (thanks @cespare) -* [NOTICE] Development has moved to `code.google.com/p/go.exp/fsnotify` in preparation for inclusion in the Go standard library. - -## [0.8.12] - 2013-11-13 - -* [API] Remove FD_SET and friends from Linux adapter - -## [0.8.11] - 2013-11-02 - -* [Doc] Add Changelog [#72][] (thanks @nathany) -* [Doc] Spotlight and double modify events on macOS [#62][] (reported by @paulhammond) - -## [0.8.10] - 2013-10-19 - -* [Fix] kqueue: remove file watches when parent directory is removed [#71][] (reported by @mdwhatcott) -* [Fix] kqueue: race between Close and readEvents [#70][] (reported by @bernerdschaefer) -* [Doc] specify OS-specific limits in README (thanks @debrando) - -## [0.8.9] - 2013-09-08 - -* [Doc] Contributing (thanks @nathany) -* [Doc] update package path in example code [#63][] (thanks @paulhammond) -* [Doc] GoCI badge in README (Linux only) [#60][] -* [Doc] Cross-platform testing with Vagrant [#59][] (thanks @nathany) - -## [0.8.8] - 2013-06-17 - -* [Fix] Windows: handle `ERROR_MORE_DATA` on Windows [#49][] (thanks @jbowtie) - -## [0.8.7] - 2013-06-03 - -* [API] Make syscall flags internal -* [Fix] inotify: ignore event changes -* [Fix] race in symlink test [#45][] (reported by @srid) -* [Fix] tests on Windows -* lower case error messages - -## [0.8.6] - 2013-05-23 - -* kqueue: Use EVT_ONLY flag on Darwin -* [Doc] Update README with full example - -## [0.8.5] - 2013-05-09 - -* [Fix] inotify: allow monitoring of "broken" symlinks (thanks @tsg) - -## [0.8.4] - 2013-04-07 - -* [Fix] kqueue: watch all file events [#40][] (thanks @ChrisBuchholz) - -## [0.8.3] - 2013-03-13 - -* [Fix] inoitfy/kqueue memory leak [#36][] (reported by @nbkolchin) -* [Fix] kqueue: use fsnFlags for watching a directory [#33][] (reported by @nbkolchin) - -## [0.8.2] - 2013-02-07 - -* [Doc] add Authors -* [Fix] fix data races for map access [#29][] (thanks @fsouza) - -## [0.8.1] - 2013-01-09 - -* [Fix] Windows path separators -* [Doc] BSD License - -## [0.8.0] - 2012-11-09 - -* kqueue: directory watching improvements (thanks @vmirage) -* inotify: add `IN_MOVED_TO` [#25][] (requested by @cpisto) -* [Fix] kqueue: deleting watched directory [#24][] (reported by @jakerr) - -## [0.7.4] - 2012-10-09 - -* [Fix] inotify: fixes from https://codereview.appspot.com/5418045/ (ugorji) -* [Fix] kqueue: preserve watch flags when watching for delete [#21][] (reported by @robfig) -* [Fix] kqueue: watch the directory even if it isn't a new watch (thanks @robfig) -* [Fix] kqueue: modify after recreation of file - -## [0.7.3] - 2012-09-27 - -* [Fix] kqueue: watch with an existing folder inside the watched folder (thanks @vmirage) -* [Fix] kqueue: no longer get duplicate CREATE events - -## [0.7.2] - 2012-09-01 - -* kqueue: events for created directories - -## [0.7.1] - 2012-07-14 - -* [Fix] for renaming files - -## [0.7.0] - 2012-07-02 - -* [Feature] FSNotify flags -* [Fix] inotify: Added file name back to event path - -## [0.6.0] - 2012-06-06 - -* kqueue: watch files after directory created (thanks @tmc) - -## [0.5.1] - 2012-05-22 - -* [Fix] inotify: remove all watches before Close() - -## [0.5.0] - 2012-05-03 - -* [API] kqueue: return errors during watch instead of sending over channel -* kqueue: match symlink behavior on Linux -* inotify: add `DELETE_SELF` (requested by @taralx) -* [Fix] kqueue: handle EINTR (reported by @robfig) -* [Doc] Godoc example [#1][] (thanks @davecheney) - -## [0.4.0] - 2012-03-30 - -* Go 1 released: build with go tool -* [Feature] Windows support using winfsnotify -* Windows does not have attribute change notifications -* Roll attribute notifications into IsModify - -## [0.3.0] - 2012-02-19 - -* kqueue: add files when watch directory - -## [0.2.0] - 2011-12-30 - -* update to latest Go weekly code - -## [0.1.0] - 2011-10-19 - -* kqueue: add watch on file creation to match inotify -* kqueue: create file event -* inotify: ignore `IN_IGNORED` events -* event String() -* linux: common FileEvent functions -* initial commit - -[#79]: https://github.com/howeyc/fsnotify/pull/79 -[#77]: https://github.com/howeyc/fsnotify/pull/77 -[#72]: https://github.com/howeyc/fsnotify/issues/72 -[#71]: https://github.com/howeyc/fsnotify/issues/71 -[#70]: https://github.com/howeyc/fsnotify/issues/70 -[#63]: https://github.com/howeyc/fsnotify/issues/63 -[#62]: https://github.com/howeyc/fsnotify/issues/62 -[#60]: https://github.com/howeyc/fsnotify/issues/60 -[#59]: https://github.com/howeyc/fsnotify/issues/59 -[#49]: https://github.com/howeyc/fsnotify/issues/49 -[#45]: https://github.com/howeyc/fsnotify/issues/45 -[#40]: https://github.com/howeyc/fsnotify/issues/40 -[#36]: https://github.com/howeyc/fsnotify/issues/36 -[#33]: https://github.com/howeyc/fsnotify/issues/33 -[#29]: https://github.com/howeyc/fsnotify/issues/29 -[#25]: https://github.com/howeyc/fsnotify/issues/25 -[#24]: https://github.com/howeyc/fsnotify/issues/24 -[#21]: https://github.com/howeyc/fsnotify/issues/21 diff --git a/vendor/github.com/fsnotify/fsnotify/CONTRIBUTING.md b/vendor/github.com/fsnotify/fsnotify/CONTRIBUTING.md deleted file mode 100644 index 828a60b24b..0000000000 --- a/vendor/github.com/fsnotify/fsnotify/CONTRIBUTING.md +++ /dev/null @@ -1,77 +0,0 @@ -# Contributing - -## Issues - -* Request features and report bugs using the [GitHub Issue Tracker](https://github.com/fsnotify/fsnotify/issues). -* Please indicate the platform you are using fsnotify on. -* A code example to reproduce the problem is appreciated. - -## Pull Requests - -### Contributor License Agreement - -fsnotify is derived from code in the [golang.org/x/exp](https://godoc.org/golang.org/x/exp) package and it may be included [in the standard library](https://github.com/fsnotify/fsnotify/issues/1) in the future. Therefore fsnotify carries the same [LICENSE](https://github.com/fsnotify/fsnotify/blob/master/LICENSE) as Go. Contributors retain their copyright, so you need to fill out a short form before we can accept your contribution: [Google Individual Contributor License Agreement](https://developers.google.com/open-source/cla/individual). - -Please indicate that you have signed the CLA in your pull request. - -### How fsnotify is Developed - -* Development is done on feature branches. -* Tests are run on BSD, Linux, macOS and Windows. -* Pull requests are reviewed and [applied to master][am] using [hub][]. - * Maintainers may modify or squash commits rather than asking contributors to. -* To issue a new release, the maintainers will: - * Update the CHANGELOG - * Tag a version, which will become available through gopkg.in. - -### How to Fork - -For smooth sailing, always use the original import path. Installing with `go get` makes this easy. - -1. Install from GitHub (`go get -u github.com/fsnotify/fsnotify`) -2. Create your feature branch (`git checkout -b my-new-feature`) -3. Ensure everything works and the tests pass (see below) -4. Commit your changes (`git commit -am 'Add some feature'`) - -Contribute upstream: - -1. Fork fsnotify on GitHub -2. Add your remote (`git remote add fork git@github.com:mycompany/repo.git`) -3. Push to the branch (`git push fork my-new-feature`) -4. Create a new Pull Request on GitHub - -This workflow is [thoroughly explained by Katrina Owen](https://splice.com/blog/contributing-open-source-git-repositories-go/). - -### Testing - -fsnotify uses build tags to compile different code on Linux, BSD, macOS, and Windows. - -Before doing a pull request, please do your best to test your changes on multiple platforms, and list which platforms you were able/unable to test on. - -To aid in cross-platform testing there is a Vagrantfile for Linux and BSD. - -* Install [Vagrant](http://www.vagrantup.com/) and [VirtualBox](https://www.virtualbox.org/) -* Setup [Vagrant Gopher](https://github.com/nathany/vagrant-gopher) in your `src` folder. -* Run `vagrant up` from the project folder. You can also setup just one box with `vagrant up linux` or `vagrant up bsd` (note: the BSD box doesn't support Windows hosts at this time, and NFS may prompt for your host OS password) -* Once setup, you can run the test suite on a given OS with a single command `vagrant ssh linux -c 'cd fsnotify/fsnotify; go test'`. -* When you're done, you will want to halt or destroy the Vagrant boxes. - -Notice: fsnotify file system events won't trigger in shared folders. The tests get around this limitation by using the /tmp directory. - -Right now there is no equivalent solution for Windows and macOS, but there are Windows VMs [freely available from Microsoft](http://www.modern.ie/en-us/virtualization-tools#downloads). - -### Maintainers - -Help maintaining fsnotify is welcome. To be a maintainer: - -* Submit a pull request and sign the CLA as above. -* You must be able to run the test suite on Mac, Windows, Linux and BSD. - -To keep master clean, the fsnotify project uses the "apply mail" workflow outlined in Nathaniel Talbott's post ["Merge pull request" Considered Harmful][am]. This requires installing [hub][]. - -All code changes should be internal pull requests. - -Releases are tagged using [Semantic Versioning](http://semver.org/). - -[hub]: https://github.com/github/hub -[am]: http://blog.spreedly.com/2014/06/24/merge-pull-request-considered-harmful/#.VGa5yZPF_Zs diff --git a/vendor/github.com/fsnotify/fsnotify/LICENSE b/vendor/github.com/fsnotify/fsnotify/LICENSE deleted file mode 100644 index e180c8fb05..0000000000 --- a/vendor/github.com/fsnotify/fsnotify/LICENSE +++ /dev/null @@ -1,28 +0,0 @@ -Copyright (c) 2012 The Go Authors. All rights reserved. -Copyright (c) 2012-2019 fsnotify Authors. All rights reserved. - -Redistribution and use in source and binary forms, with or without -modification, are permitted provided that the following conditions are -met: - - * Redistributions of source code must retain the above copyright -notice, this list of conditions and the following disclaimer. - * Redistributions in binary form must reproduce the above -copyright notice, this list of conditions and the following disclaimer -in the documentation and/or other materials provided with the -distribution. - * Neither the name of Google Inc. nor the names of its -contributors may be used to endorse or promote products derived from -this software without specific prior written permission. - -THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. diff --git a/vendor/github.com/fsnotify/fsnotify/README.md b/vendor/github.com/fsnotify/fsnotify/README.md deleted file mode 100644 index df57b1b282..0000000000 --- a/vendor/github.com/fsnotify/fsnotify/README.md +++ /dev/null @@ -1,130 +0,0 @@ -# File system notifications for Go - -[![GoDoc](https://godoc.org/github.com/fsnotify/fsnotify?status.svg)](https://godoc.org/github.com/fsnotify/fsnotify) [![Go Report Card](https://goreportcard.com/badge/github.com/fsnotify/fsnotify)](https://goreportcard.com/report/github.com/fsnotify/fsnotify) - -fsnotify utilizes [golang.org/x/sys](https://godoc.org/golang.org/x/sys) rather than `syscall` from the standard library. Ensure you have the latest version installed by running: - -```console -go get -u golang.org/x/sys/... -``` - -Cross platform: Windows, Linux, BSD and macOS. - -| Adapter | OS | Status | -| --------------------- | -------------------------------- | ------------------------------------------------------------------------------------------------------------------------------- | -| inotify | Linux 2.6.27 or later, Android\* | Supported | -| kqueue | BSD, macOS, iOS\* | Supported | -| ReadDirectoryChangesW | Windows | Supported | -| FSEvents | macOS | [Planned](https://github.com/fsnotify/fsnotify/issues/11) | -| FEN | Solaris 11 | [In Progress](https://github.com/fsnotify/fsnotify/issues/12) | -| fanotify | Linux 2.6.37+ | [Planned](https://github.com/fsnotify/fsnotify/issues/114) | -| USN Journals | Windows | [Maybe](https://github.com/fsnotify/fsnotify/issues/53) | -| Polling | *All* | [Maybe](https://github.com/fsnotify/fsnotify/issues/9) | - -\* Android and iOS are untested. - -Please see [the documentation](https://godoc.org/github.com/fsnotify/fsnotify) and consult the [FAQ](#faq) for usage information. - -## API stability - -fsnotify is a fork of [howeyc/fsnotify](https://godoc.org/github.com/howeyc/fsnotify) with a new API as of v1.0. The API is based on [this design document](http://goo.gl/MrYxyA). - -All [releases](https://github.com/fsnotify/fsnotify/releases) are tagged based on [Semantic Versioning](http://semver.org/). Further API changes are [planned](https://github.com/fsnotify/fsnotify/milestones), and will be tagged with a new major revision number. - -Go 1.6 supports dependencies located in the `vendor/` folder. Unless you are creating a library, it is recommended that you copy fsnotify into `vendor/github.com/fsnotify/fsnotify` within your project, and likewise for `golang.org/x/sys`. - -## Usage - -```go -package main - -import ( - "log" - - "github.com/fsnotify/fsnotify" -) - -func main() { - watcher, err := fsnotify.NewWatcher() - if err != nil { - log.Fatal(err) - } - defer watcher.Close() - - done := make(chan bool) - go func() { - for { - select { - case event, ok := <-watcher.Events: - if !ok { - return - } - log.Println("event:", event) - if event.Op&fsnotify.Write == fsnotify.Write { - log.Println("modified file:", event.Name) - } - case err, ok := <-watcher.Errors: - if !ok { - return - } - log.Println("error:", err) - } - } - }() - - err = watcher.Add("/tmp/foo") - if err != nil { - log.Fatal(err) - } - <-done -} -``` - -## Contributing - -Please refer to [CONTRIBUTING][] before opening an issue or pull request. - -## Example - -See [example_test.go](https://github.com/fsnotify/fsnotify/blob/master/example_test.go). - -## FAQ - -**When a file is moved to another directory is it still being watched?** - -No (it shouldn't be, unless you are watching where it was moved to). - -**When I watch a directory, are all subdirectories watched as well?** - -No, you must add watches for any directory you want to watch (a recursive watcher is on the roadmap [#18][]). - -**Do I have to watch the Error and Event channels in a separate goroutine?** - -As of now, yes. Looking into making this single-thread friendly (see [howeyc #7][#7]) - -**Why am I receiving multiple events for the same file on OS X?** - -Spotlight indexing on OS X can result in multiple events (see [howeyc #62][#62]). A temporary workaround is to add your folder(s) to the *Spotlight Privacy settings* until we have a native FSEvents implementation (see [#11][]). - -**How many files can be watched at once?** - -There are OS-specific limits as to how many watches can be created: -* Linux: /proc/sys/fs/inotify/max_user_watches contains the limit, reaching this limit results in a "no space left on device" error. -* BSD / OSX: sysctl variables "kern.maxfiles" and "kern.maxfilesperproc", reaching these limits results in a "too many open files" error. - -**Why don't notifications work with NFS filesystems or filesystem in userspace (FUSE)?** - -fsnotify requires support from underlying OS to work. The current NFS protocol does not provide network level support for file notifications. - -[#62]: https://github.com/howeyc/fsnotify/issues/62 -[#18]: https://github.com/fsnotify/fsnotify/issues/18 -[#11]: https://github.com/fsnotify/fsnotify/issues/11 -[#7]: https://github.com/howeyc/fsnotify/issues/7 - -[contributing]: https://github.com/fsnotify/fsnotify/blob/master/CONTRIBUTING.md - -## Related Projects - -* [notify](https://github.com/rjeczalik/notify) -* [fsevents](https://github.com/fsnotify/fsevents) - diff --git a/vendor/github.com/fsnotify/fsnotify/fen.go b/vendor/github.com/fsnotify/fsnotify/fen.go deleted file mode 100644 index b3ac3d8f55..0000000000 --- a/vendor/github.com/fsnotify/fsnotify/fen.go +++ /dev/null @@ -1,38 +0,0 @@ -// Copyright 2010 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -//go:build solaris -// +build solaris - -package fsnotify - -import ( - "errors" -) - -// Watcher watches a set of files, delivering events to a channel. -type Watcher struct { - Events chan Event - Errors chan error -} - -// NewWatcher establishes a new watcher with the underlying OS and begins waiting for events. -func NewWatcher() (*Watcher, error) { - return nil, errors.New("FEN based watcher not yet supported for fsnotify\n") -} - -// Close removes all watches and closes the events channel. -func (w *Watcher) Close() error { - return nil -} - -// Add starts watching the named file or directory (non-recursively). -func (w *Watcher) Add(name string) error { - return nil -} - -// Remove stops watching the the named file or directory (non-recursively). -func (w *Watcher) Remove(name string) error { - return nil -} diff --git a/vendor/github.com/fsnotify/fsnotify/fsnotify.go b/vendor/github.com/fsnotify/fsnotify/fsnotify.go deleted file mode 100644 index 0f4ee52e8a..0000000000 --- a/vendor/github.com/fsnotify/fsnotify/fsnotify.go +++ /dev/null @@ -1,69 +0,0 @@ -// Copyright 2012 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -//go:build !plan9 -// +build !plan9 - -// Package fsnotify provides a platform-independent interface for file system notifications. -package fsnotify - -import ( - "bytes" - "errors" - "fmt" -) - -// Event represents a single file system notification. -type Event struct { - Name string // Relative path to the file or directory. - Op Op // File operation that triggered the event. -} - -// Op describes a set of file operations. -type Op uint32 - -// These are the generalized file operations that can trigger a notification. -const ( - Create Op = 1 << iota - Write - Remove - Rename - Chmod -) - -func (op Op) String() string { - // Use a buffer for efficient string concatenation - var buffer bytes.Buffer - - if op&Create == Create { - buffer.WriteString("|CREATE") - } - if op&Remove == Remove { - buffer.WriteString("|REMOVE") - } - if op&Write == Write { - buffer.WriteString("|WRITE") - } - if op&Rename == Rename { - buffer.WriteString("|RENAME") - } - if op&Chmod == Chmod { - buffer.WriteString("|CHMOD") - } - if buffer.Len() == 0 { - return "" - } - return buffer.String()[1:] // Strip leading pipe -} - -// String returns a string representation of the event in the form -// "file: REMOVE|WRITE|..." -func (e Event) String() string { - return fmt.Sprintf("%q: %s", e.Name, e.Op.String()) -} - -// Common errors that can be reported by a watcher -var ( - ErrEventOverflow = errors.New("fsnotify queue overflow") -) diff --git a/vendor/github.com/fsnotify/fsnotify/go.mod b/vendor/github.com/fsnotify/fsnotify/go.mod deleted file mode 100644 index 54089e48b7..0000000000 --- a/vendor/github.com/fsnotify/fsnotify/go.mod +++ /dev/null @@ -1,7 +0,0 @@ -module github.com/fsnotify/fsnotify - -go 1.13 - -require golang.org/x/sys v0.0.0-20210630005230-0f9fa26af87c - -retract v1.5.0 diff --git a/vendor/github.com/fsnotify/fsnotify/go.sum b/vendor/github.com/fsnotify/fsnotify/go.sum deleted file mode 100644 index 0f478630ca..0000000000 --- a/vendor/github.com/fsnotify/fsnotify/go.sum +++ /dev/null @@ -1,2 +0,0 @@ -golang.org/x/sys v0.0.0-20210630005230-0f9fa26af87c h1:F1jZWGFhYfh0Ci55sIpILtKKK8p3i2/krTr0H1rg74I= -golang.org/x/sys v0.0.0-20210630005230-0f9fa26af87c/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= diff --git a/vendor/github.com/fsnotify/fsnotify/inotify.go b/vendor/github.com/fsnotify/fsnotify/inotify.go deleted file mode 100644 index eb87699b5b..0000000000 --- a/vendor/github.com/fsnotify/fsnotify/inotify.go +++ /dev/null @@ -1,338 +0,0 @@ -// Copyright 2010 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -//go:build linux -// +build linux - -package fsnotify - -import ( - "errors" - "fmt" - "io" - "os" - "path/filepath" - "strings" - "sync" - "unsafe" - - "golang.org/x/sys/unix" -) - -// Watcher watches a set of files, delivering events to a channel. -type Watcher struct { - Events chan Event - Errors chan error - mu sync.Mutex // Map access - fd int - poller *fdPoller - watches map[string]*watch // Map of inotify watches (key: path) - paths map[int]string // Map of watched paths (key: watch descriptor) - done chan struct{} // Channel for sending a "quit message" to the reader goroutine - doneResp chan struct{} // Channel to respond to Close -} - -// NewWatcher establishes a new watcher with the underlying OS and begins waiting for events. -func NewWatcher() (*Watcher, error) { - // Create inotify fd - fd, errno := unix.InotifyInit1(unix.IN_CLOEXEC) - if fd == -1 { - return nil, errno - } - // Create epoll - poller, err := newFdPoller(fd) - if err != nil { - unix.Close(fd) - return nil, err - } - w := &Watcher{ - fd: fd, - poller: poller, - watches: make(map[string]*watch), - paths: make(map[int]string), - Events: make(chan Event), - Errors: make(chan error), - done: make(chan struct{}), - doneResp: make(chan struct{}), - } - - go w.readEvents() - return w, nil -} - -func (w *Watcher) isClosed() bool { - select { - case <-w.done: - return true - default: - return false - } -} - -// Close removes all watches and closes the events channel. -func (w *Watcher) Close() error { - if w.isClosed() { - return nil - } - - // Send 'close' signal to goroutine, and set the Watcher to closed. - close(w.done) - - // Wake up goroutine - w.poller.wake() - - // Wait for goroutine to close - <-w.doneResp - - return nil -} - -// Add starts watching the named file or directory (non-recursively). -func (w *Watcher) Add(name string) error { - name = filepath.Clean(name) - if w.isClosed() { - return errors.New("inotify instance already closed") - } - - const agnosticEvents = unix.IN_MOVED_TO | unix.IN_MOVED_FROM | - unix.IN_CREATE | unix.IN_ATTRIB | unix.IN_MODIFY | - unix.IN_MOVE_SELF | unix.IN_DELETE | unix.IN_DELETE_SELF - - var flags uint32 = agnosticEvents - - w.mu.Lock() - defer w.mu.Unlock() - watchEntry := w.watches[name] - if watchEntry != nil { - flags |= watchEntry.flags | unix.IN_MASK_ADD - } - wd, errno := unix.InotifyAddWatch(w.fd, name, flags) - if wd == -1 { - return errno - } - - if watchEntry == nil { - w.watches[name] = &watch{wd: uint32(wd), flags: flags} - w.paths[wd] = name - } else { - watchEntry.wd = uint32(wd) - watchEntry.flags = flags - } - - return nil -} - -// Remove stops watching the named file or directory (non-recursively). -func (w *Watcher) Remove(name string) error { - name = filepath.Clean(name) - - // Fetch the watch. - w.mu.Lock() - defer w.mu.Unlock() - watch, ok := w.watches[name] - - // Remove it from inotify. - if !ok { - return fmt.Errorf("can't remove non-existent inotify watch for: %s", name) - } - - // We successfully removed the watch if InotifyRmWatch doesn't return an - // error, we need to clean up our internal state to ensure it matches - // inotify's kernel state. - delete(w.paths, int(watch.wd)) - delete(w.watches, name) - - // inotify_rm_watch will return EINVAL if the file has been deleted; - // the inotify will already have been removed. - // watches and pathes are deleted in ignoreLinux() implicitly and asynchronously - // by calling inotify_rm_watch() below. e.g. readEvents() goroutine receives IN_IGNORE - // so that EINVAL means that the wd is being rm_watch()ed or its file removed - // by another thread and we have not received IN_IGNORE event. - success, errno := unix.InotifyRmWatch(w.fd, watch.wd) - if success == -1 { - // TODO: Perhaps it's not helpful to return an error here in every case. - // the only two possible errors are: - // EBADF, which happens when w.fd is not a valid file descriptor of any kind. - // EINVAL, which is when fd is not an inotify descriptor or wd is not a valid watch descriptor. - // Watch descriptors are invalidated when they are removed explicitly or implicitly; - // explicitly by inotify_rm_watch, implicitly when the file they are watching is deleted. - return errno - } - - return nil -} - -type watch struct { - wd uint32 // Watch descriptor (as returned by the inotify_add_watch() syscall) - flags uint32 // inotify flags of this watch (see inotify(7) for the list of valid flags) -} - -// readEvents reads from the inotify file descriptor, converts the -// received events into Event objects and sends them via the Events channel -func (w *Watcher) readEvents() { - var ( - buf [unix.SizeofInotifyEvent * 4096]byte // Buffer for a maximum of 4096 raw events - n int // Number of bytes read with read() - errno error // Syscall errno - ok bool // For poller.wait - ) - - defer close(w.doneResp) - defer close(w.Errors) - defer close(w.Events) - defer unix.Close(w.fd) - defer w.poller.close() - - for { - // See if we have been closed. - if w.isClosed() { - return - } - - ok, errno = w.poller.wait() - if errno != nil { - select { - case w.Errors <- errno: - case <-w.done: - return - } - continue - } - - if !ok { - continue - } - - n, errno = unix.Read(w.fd, buf[:]) - // If a signal interrupted execution, see if we've been asked to close, and try again. - // http://man7.org/linux/man-pages/man7/signal.7.html : - // "Before Linux 3.8, reads from an inotify(7) file descriptor were not restartable" - if errno == unix.EINTR { - continue - } - - // unix.Read might have been woken up by Close. If so, we're done. - if w.isClosed() { - return - } - - if n < unix.SizeofInotifyEvent { - var err error - if n == 0 { - // If EOF is received. This should really never happen. - err = io.EOF - } else if n < 0 { - // If an error occurred while reading. - err = errno - } else { - // Read was too short. - err = errors.New("notify: short read in readEvents()") - } - select { - case w.Errors <- err: - case <-w.done: - return - } - continue - } - - var offset uint32 - // We don't know how many events we just read into the buffer - // While the offset points to at least one whole event... - for offset <= uint32(n-unix.SizeofInotifyEvent) { - // Point "raw" to the event in the buffer - raw := (*unix.InotifyEvent)(unsafe.Pointer(&buf[offset])) - - mask := uint32(raw.Mask) - nameLen := uint32(raw.Len) - - if mask&unix.IN_Q_OVERFLOW != 0 { - select { - case w.Errors <- ErrEventOverflow: - case <-w.done: - return - } - } - - // If the event happened to the watched directory or the watched file, the kernel - // doesn't append the filename to the event, but we would like to always fill the - // the "Name" field with a valid filename. We retrieve the path of the watch from - // the "paths" map. - w.mu.Lock() - name, ok := w.paths[int(raw.Wd)] - // IN_DELETE_SELF occurs when the file/directory being watched is removed. - // This is a sign to clean up the maps, otherwise we are no longer in sync - // with the inotify kernel state which has already deleted the watch - // automatically. - if ok && mask&unix.IN_DELETE_SELF == unix.IN_DELETE_SELF { - delete(w.paths, int(raw.Wd)) - delete(w.watches, name) - } - w.mu.Unlock() - - if nameLen > 0 { - // Point "bytes" at the first byte of the filename - bytes := (*[unix.PathMax]byte)(unsafe.Pointer(&buf[offset+unix.SizeofInotifyEvent]))[:nameLen:nameLen] - // The filename is padded with NULL bytes. TrimRight() gets rid of those. - name += "/" + strings.TrimRight(string(bytes[0:nameLen]), "\000") - } - - event := newEvent(name, mask) - - // Send the events that are not ignored on the events channel - if !event.ignoreLinux(mask) { - select { - case w.Events <- event: - case <-w.done: - return - } - } - - // Move to the next event in the buffer - offset += unix.SizeofInotifyEvent + nameLen - } - } -} - -// Certain types of events can be "ignored" and not sent over the Events -// channel. Such as events marked ignore by the kernel, or MODIFY events -// against files that do not exist. -func (e *Event) ignoreLinux(mask uint32) bool { - // Ignore anything the inotify API says to ignore - if mask&unix.IN_IGNORED == unix.IN_IGNORED { - return true - } - - // If the event is not a DELETE or RENAME, the file must exist. - // Otherwise the event is ignored. - // *Note*: this was put in place because it was seen that a MODIFY - // event was sent after the DELETE. This ignores that MODIFY and - // assumes a DELETE will come or has come if the file doesn't exist. - if !(e.Op&Remove == Remove || e.Op&Rename == Rename) { - _, statErr := os.Lstat(e.Name) - return os.IsNotExist(statErr) - } - return false -} - -// newEvent returns an platform-independent Event based on an inotify mask. -func newEvent(name string, mask uint32) Event { - e := Event{Name: name} - if mask&unix.IN_CREATE == unix.IN_CREATE || mask&unix.IN_MOVED_TO == unix.IN_MOVED_TO { - e.Op |= Create - } - if mask&unix.IN_DELETE_SELF == unix.IN_DELETE_SELF || mask&unix.IN_DELETE == unix.IN_DELETE { - e.Op |= Remove - } - if mask&unix.IN_MODIFY == unix.IN_MODIFY { - e.Op |= Write - } - if mask&unix.IN_MOVE_SELF == unix.IN_MOVE_SELF || mask&unix.IN_MOVED_FROM == unix.IN_MOVED_FROM { - e.Op |= Rename - } - if mask&unix.IN_ATTRIB == unix.IN_ATTRIB { - e.Op |= Chmod - } - return e -} diff --git a/vendor/github.com/fsnotify/fsnotify/inotify_poller.go b/vendor/github.com/fsnotify/fsnotify/inotify_poller.go deleted file mode 100644 index e9ff9439f7..0000000000 --- a/vendor/github.com/fsnotify/fsnotify/inotify_poller.go +++ /dev/null @@ -1,188 +0,0 @@ -// Copyright 2015 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -//go:build linux -// +build linux - -package fsnotify - -import ( - "errors" - - "golang.org/x/sys/unix" -) - -type fdPoller struct { - fd int // File descriptor (as returned by the inotify_init() syscall) - epfd int // Epoll file descriptor - pipe [2]int // Pipe for waking up -} - -func emptyPoller(fd int) *fdPoller { - poller := new(fdPoller) - poller.fd = fd - poller.epfd = -1 - poller.pipe[0] = -1 - poller.pipe[1] = -1 - return poller -} - -// Create a new inotify poller. -// This creates an inotify handler, and an epoll handler. -func newFdPoller(fd int) (*fdPoller, error) { - var errno error - poller := emptyPoller(fd) - defer func() { - if errno != nil { - poller.close() - } - }() - poller.fd = fd - - // Create epoll fd - poller.epfd, errno = unix.EpollCreate1(unix.EPOLL_CLOEXEC) - if poller.epfd == -1 { - return nil, errno - } - // Create pipe; pipe[0] is the read end, pipe[1] the write end. - errno = unix.Pipe2(poller.pipe[:], unix.O_NONBLOCK|unix.O_CLOEXEC) - if errno != nil { - return nil, errno - } - - // Register inotify fd with epoll - event := unix.EpollEvent{ - Fd: int32(poller.fd), - Events: unix.EPOLLIN, - } - errno = unix.EpollCtl(poller.epfd, unix.EPOLL_CTL_ADD, poller.fd, &event) - if errno != nil { - return nil, errno - } - - // Register pipe fd with epoll - event = unix.EpollEvent{ - Fd: int32(poller.pipe[0]), - Events: unix.EPOLLIN, - } - errno = unix.EpollCtl(poller.epfd, unix.EPOLL_CTL_ADD, poller.pipe[0], &event) - if errno != nil { - return nil, errno - } - - return poller, nil -} - -// Wait using epoll. -// Returns true if something is ready to be read, -// false if there is not. -func (poller *fdPoller) wait() (bool, error) { - // 3 possible events per fd, and 2 fds, makes a maximum of 6 events. - // I don't know whether epoll_wait returns the number of events returned, - // or the total number of events ready. - // I decided to catch both by making the buffer one larger than the maximum. - events := make([]unix.EpollEvent, 7) - for { - n, errno := unix.EpollWait(poller.epfd, events, -1) - if n == -1 { - if errno == unix.EINTR { - continue - } - return false, errno - } - if n == 0 { - // If there are no events, try again. - continue - } - if n > 6 { - // This should never happen. More events were returned than should be possible. - return false, errors.New("epoll_wait returned more events than I know what to do with") - } - ready := events[:n] - epollhup := false - epollerr := false - epollin := false - for _, event := range ready { - if event.Fd == int32(poller.fd) { - if event.Events&unix.EPOLLHUP != 0 { - // This should not happen, but if it does, treat it as a wakeup. - epollhup = true - } - if event.Events&unix.EPOLLERR != 0 { - // If an error is waiting on the file descriptor, we should pretend - // something is ready to read, and let unix.Read pick up the error. - epollerr = true - } - if event.Events&unix.EPOLLIN != 0 { - // There is data to read. - epollin = true - } - } - if event.Fd == int32(poller.pipe[0]) { - if event.Events&unix.EPOLLHUP != 0 { - // Write pipe descriptor was closed, by us. This means we're closing down the - // watcher, and we should wake up. - } - if event.Events&unix.EPOLLERR != 0 { - // If an error is waiting on the pipe file descriptor. - // This is an absolute mystery, and should never ever happen. - return false, errors.New("Error on the pipe descriptor.") - } - if event.Events&unix.EPOLLIN != 0 { - // This is a regular wakeup, so we have to clear the buffer. - err := poller.clearWake() - if err != nil { - return false, err - } - } - } - } - - if epollhup || epollerr || epollin { - return true, nil - } - return false, nil - } -} - -// Close the write end of the poller. -func (poller *fdPoller) wake() error { - buf := make([]byte, 1) - n, errno := unix.Write(poller.pipe[1], buf) - if n == -1 { - if errno == unix.EAGAIN { - // Buffer is full, poller will wake. - return nil - } - return errno - } - return nil -} - -func (poller *fdPoller) clearWake() error { - // You have to be woken up a LOT in order to get to 100! - buf := make([]byte, 100) - n, errno := unix.Read(poller.pipe[0], buf) - if n == -1 { - if errno == unix.EAGAIN { - // Buffer is empty, someone else cleared our wake. - return nil - } - return errno - } - return nil -} - -// Close all poller file descriptors, but not the one passed to it. -func (poller *fdPoller) close() { - if poller.pipe[1] != -1 { - unix.Close(poller.pipe[1]) - } - if poller.pipe[0] != -1 { - unix.Close(poller.pipe[0]) - } - if poller.epfd != -1 { - unix.Close(poller.epfd) - } -} diff --git a/vendor/github.com/fsnotify/fsnotify/kqueue.go b/vendor/github.com/fsnotify/fsnotify/kqueue.go deleted file mode 100644 index 368f5b790d..0000000000 --- a/vendor/github.com/fsnotify/fsnotify/kqueue.go +++ /dev/null @@ -1,522 +0,0 @@ -// Copyright 2010 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -//go:build freebsd || openbsd || netbsd || dragonfly || darwin -// +build freebsd openbsd netbsd dragonfly darwin - -package fsnotify - -import ( - "errors" - "fmt" - "io/ioutil" - "os" - "path/filepath" - "sync" - "time" - - "golang.org/x/sys/unix" -) - -// Watcher watches a set of files, delivering events to a channel. -type Watcher struct { - Events chan Event - Errors chan error - done chan struct{} // Channel for sending a "quit message" to the reader goroutine - - kq int // File descriptor (as returned by the kqueue() syscall). - - mu sync.Mutex // Protects access to watcher data - watches map[string]int // Map of watched file descriptors (key: path). - externalWatches map[string]bool // Map of watches added by user of the library. - dirFlags map[string]uint32 // Map of watched directories to fflags used in kqueue. - paths map[int]pathInfo // Map file descriptors to path names for processing kqueue events. - fileExists map[string]bool // Keep track of if we know this file exists (to stop duplicate create events). - isClosed bool // Set to true when Close() is first called -} - -type pathInfo struct { - name string - isDir bool -} - -// NewWatcher establishes a new watcher with the underlying OS and begins waiting for events. -func NewWatcher() (*Watcher, error) { - kq, err := kqueue() - if err != nil { - return nil, err - } - - w := &Watcher{ - kq: kq, - watches: make(map[string]int), - dirFlags: make(map[string]uint32), - paths: make(map[int]pathInfo), - fileExists: make(map[string]bool), - externalWatches: make(map[string]bool), - Events: make(chan Event), - Errors: make(chan error), - done: make(chan struct{}), - } - - go w.readEvents() - return w, nil -} - -// Close removes all watches and closes the events channel. -func (w *Watcher) Close() error { - w.mu.Lock() - if w.isClosed { - w.mu.Unlock() - return nil - } - w.isClosed = true - - // copy paths to remove while locked - var pathsToRemove = make([]string, 0, len(w.watches)) - for name := range w.watches { - pathsToRemove = append(pathsToRemove, name) - } - w.mu.Unlock() - // unlock before calling Remove, which also locks - - for _, name := range pathsToRemove { - w.Remove(name) - } - - // send a "quit" message to the reader goroutine - close(w.done) - - return nil -} - -// Add starts watching the named file or directory (non-recursively). -func (w *Watcher) Add(name string) error { - w.mu.Lock() - w.externalWatches[name] = true - w.mu.Unlock() - _, err := w.addWatch(name, noteAllEvents) - return err -} - -// Remove stops watching the the named file or directory (non-recursively). -func (w *Watcher) Remove(name string) error { - name = filepath.Clean(name) - w.mu.Lock() - watchfd, ok := w.watches[name] - w.mu.Unlock() - if !ok { - return fmt.Errorf("can't remove non-existent kevent watch for: %s", name) - } - - const registerRemove = unix.EV_DELETE - if err := register(w.kq, []int{watchfd}, registerRemove, 0); err != nil { - return err - } - - unix.Close(watchfd) - - w.mu.Lock() - isDir := w.paths[watchfd].isDir - delete(w.watches, name) - delete(w.paths, watchfd) - delete(w.dirFlags, name) - w.mu.Unlock() - - // Find all watched paths that are in this directory that are not external. - if isDir { - var pathsToRemove []string - w.mu.Lock() - for _, path := range w.paths { - wdir, _ := filepath.Split(path.name) - if filepath.Clean(wdir) == name { - if !w.externalWatches[path.name] { - pathsToRemove = append(pathsToRemove, path.name) - } - } - } - w.mu.Unlock() - for _, name := range pathsToRemove { - // Since these are internal, not much sense in propagating error - // to the user, as that will just confuse them with an error about - // a path they did not explicitly watch themselves. - w.Remove(name) - } - } - - return nil -} - -// Watch all events (except NOTE_EXTEND, NOTE_LINK, NOTE_REVOKE) -const noteAllEvents = unix.NOTE_DELETE | unix.NOTE_WRITE | unix.NOTE_ATTRIB | unix.NOTE_RENAME - -// keventWaitTime to block on each read from kevent -var keventWaitTime = durationToTimespec(100 * time.Millisecond) - -// addWatch adds name to the watched file set. -// The flags are interpreted as described in kevent(2). -// Returns the real path to the file which was added, if any, which may be different from the one passed in the case of symlinks. -func (w *Watcher) addWatch(name string, flags uint32) (string, error) { - var isDir bool - // Make ./name and name equivalent - name = filepath.Clean(name) - - w.mu.Lock() - if w.isClosed { - w.mu.Unlock() - return "", errors.New("kevent instance already closed") - } - watchfd, alreadyWatching := w.watches[name] - // We already have a watch, but we can still override flags. - if alreadyWatching { - isDir = w.paths[watchfd].isDir - } - w.mu.Unlock() - - if !alreadyWatching { - fi, err := os.Lstat(name) - if err != nil { - return "", err - } - - // Don't watch sockets. - if fi.Mode()&os.ModeSocket == os.ModeSocket { - return "", nil - } - - // Don't watch named pipes. - if fi.Mode()&os.ModeNamedPipe == os.ModeNamedPipe { - return "", nil - } - - // Follow Symlinks - // Unfortunately, Linux can add bogus symlinks to watch list without - // issue, and Windows can't do symlinks period (AFAIK). To maintain - // consistency, we will act like everything is fine. There will simply - // be no file events for broken symlinks. - // Hence the returns of nil on errors. - if fi.Mode()&os.ModeSymlink == os.ModeSymlink { - name, err = filepath.EvalSymlinks(name) - if err != nil { - return "", nil - } - - w.mu.Lock() - _, alreadyWatching = w.watches[name] - w.mu.Unlock() - - if alreadyWatching { - return name, nil - } - - fi, err = os.Lstat(name) - if err != nil { - return "", nil - } - } - - watchfd, err = unix.Open(name, openMode, 0700) - if watchfd == -1 { - return "", err - } - - isDir = fi.IsDir() - } - - const registerAdd = unix.EV_ADD | unix.EV_CLEAR | unix.EV_ENABLE - if err := register(w.kq, []int{watchfd}, registerAdd, flags); err != nil { - unix.Close(watchfd) - return "", err - } - - if !alreadyWatching { - w.mu.Lock() - w.watches[name] = watchfd - w.paths[watchfd] = pathInfo{name: name, isDir: isDir} - w.mu.Unlock() - } - - if isDir { - // Watch the directory if it has not been watched before, - // or if it was watched before, but perhaps only a NOTE_DELETE (watchDirectoryFiles) - w.mu.Lock() - - watchDir := (flags&unix.NOTE_WRITE) == unix.NOTE_WRITE && - (!alreadyWatching || (w.dirFlags[name]&unix.NOTE_WRITE) != unix.NOTE_WRITE) - // Store flags so this watch can be updated later - w.dirFlags[name] = flags - w.mu.Unlock() - - if watchDir { - if err := w.watchDirectoryFiles(name); err != nil { - return "", err - } - } - } - return name, nil -} - -// readEvents reads from kqueue and converts the received kevents into -// Event values that it sends down the Events channel. -func (w *Watcher) readEvents() { - eventBuffer := make([]unix.Kevent_t, 10) - -loop: - for { - // See if there is a message on the "done" channel - select { - case <-w.done: - break loop - default: - } - - // Get new events - kevents, err := read(w.kq, eventBuffer, &keventWaitTime) - // EINTR is okay, the syscall was interrupted before timeout expired. - if err != nil && err != unix.EINTR { - select { - case w.Errors <- err: - case <-w.done: - break loop - } - continue - } - - // Flush the events we received to the Events channel - for len(kevents) > 0 { - kevent := &kevents[0] - watchfd := int(kevent.Ident) - mask := uint32(kevent.Fflags) - w.mu.Lock() - path := w.paths[watchfd] - w.mu.Unlock() - event := newEvent(path.name, mask) - - if path.isDir && !(event.Op&Remove == Remove) { - // Double check to make sure the directory exists. This can happen when - // we do a rm -fr on a recursively watched folders and we receive a - // modification event first but the folder has been deleted and later - // receive the delete event - if _, err := os.Lstat(event.Name); os.IsNotExist(err) { - // mark is as delete event - event.Op |= Remove - } - } - - if event.Op&Rename == Rename || event.Op&Remove == Remove { - w.Remove(event.Name) - w.mu.Lock() - delete(w.fileExists, event.Name) - w.mu.Unlock() - } - - if path.isDir && event.Op&Write == Write && !(event.Op&Remove == Remove) { - w.sendDirectoryChangeEvents(event.Name) - } else { - // Send the event on the Events channel. - select { - case w.Events <- event: - case <-w.done: - break loop - } - } - - if event.Op&Remove == Remove { - // Look for a file that may have overwritten this. - // For example, mv f1 f2 will delete f2, then create f2. - if path.isDir { - fileDir := filepath.Clean(event.Name) - w.mu.Lock() - _, found := w.watches[fileDir] - w.mu.Unlock() - if found { - // make sure the directory exists before we watch for changes. When we - // do a recursive watch and perform rm -fr, the parent directory might - // have gone missing, ignore the missing directory and let the - // upcoming delete event remove the watch from the parent directory. - if _, err := os.Lstat(fileDir); err == nil { - w.sendDirectoryChangeEvents(fileDir) - } - } - } else { - filePath := filepath.Clean(event.Name) - if fileInfo, err := os.Lstat(filePath); err == nil { - w.sendFileCreatedEventIfNew(filePath, fileInfo) - } - } - } - - // Move to next event - kevents = kevents[1:] - } - } - - // cleanup - err := unix.Close(w.kq) - if err != nil { - // only way the previous loop breaks is if w.done was closed so we need to async send to w.Errors. - select { - case w.Errors <- err: - default: - } - } - close(w.Events) - close(w.Errors) -} - -// newEvent returns an platform-independent Event based on kqueue Fflags. -func newEvent(name string, mask uint32) Event { - e := Event{Name: name} - if mask&unix.NOTE_DELETE == unix.NOTE_DELETE { - e.Op |= Remove - } - if mask&unix.NOTE_WRITE == unix.NOTE_WRITE { - e.Op |= Write - } - if mask&unix.NOTE_RENAME == unix.NOTE_RENAME { - e.Op |= Rename - } - if mask&unix.NOTE_ATTRIB == unix.NOTE_ATTRIB { - e.Op |= Chmod - } - return e -} - -func newCreateEvent(name string) Event { - return Event{Name: name, Op: Create} -} - -// watchDirectoryFiles to mimic inotify when adding a watch on a directory -func (w *Watcher) watchDirectoryFiles(dirPath string) error { - // Get all files - files, err := ioutil.ReadDir(dirPath) - if err != nil { - return err - } - - for _, fileInfo := range files { - filePath := filepath.Join(dirPath, fileInfo.Name()) - filePath, err = w.internalWatch(filePath, fileInfo) - if err != nil { - return err - } - - w.mu.Lock() - w.fileExists[filePath] = true - w.mu.Unlock() - } - - return nil -} - -// sendDirectoryEvents searches the directory for newly created files -// and sends them over the event channel. This functionality is to have -// the BSD version of fsnotify match Linux inotify which provides a -// create event for files created in a watched directory. -func (w *Watcher) sendDirectoryChangeEvents(dirPath string) { - // Get all files - files, err := ioutil.ReadDir(dirPath) - if err != nil { - select { - case w.Errors <- err: - case <-w.done: - return - } - } - - // Search for new files - for _, fileInfo := range files { - filePath := filepath.Join(dirPath, fileInfo.Name()) - err := w.sendFileCreatedEventIfNew(filePath, fileInfo) - - if err != nil { - return - } - } -} - -// sendFileCreatedEvent sends a create event if the file isn't already being tracked. -func (w *Watcher) sendFileCreatedEventIfNew(filePath string, fileInfo os.FileInfo) (err error) { - w.mu.Lock() - _, doesExist := w.fileExists[filePath] - w.mu.Unlock() - if !doesExist { - // Send create event - select { - case w.Events <- newCreateEvent(filePath): - case <-w.done: - return - } - } - - // like watchDirectoryFiles (but without doing another ReadDir) - filePath, err = w.internalWatch(filePath, fileInfo) - if err != nil { - return err - } - - w.mu.Lock() - w.fileExists[filePath] = true - w.mu.Unlock() - - return nil -} - -func (w *Watcher) internalWatch(name string, fileInfo os.FileInfo) (string, error) { - if fileInfo.IsDir() { - // mimic Linux providing delete events for subdirectories - // but preserve the flags used if currently watching subdirectory - w.mu.Lock() - flags := w.dirFlags[name] - w.mu.Unlock() - - flags |= unix.NOTE_DELETE | unix.NOTE_RENAME - return w.addWatch(name, flags) - } - - // watch file to mimic Linux inotify - return w.addWatch(name, noteAllEvents) -} - -// kqueue creates a new kernel event queue and returns a descriptor. -func kqueue() (kq int, err error) { - kq, err = unix.Kqueue() - if kq == -1 { - return kq, err - } - return kq, nil -} - -// register events with the queue -func register(kq int, fds []int, flags int, fflags uint32) error { - changes := make([]unix.Kevent_t, len(fds)) - - for i, fd := range fds { - // SetKevent converts int to the platform-specific types: - unix.SetKevent(&changes[i], fd, unix.EVFILT_VNODE, flags) - changes[i].Fflags = fflags - } - - // register the events - success, err := unix.Kevent(kq, changes, nil, nil) - if success == -1 { - return err - } - return nil -} - -// read retrieves pending events, or waits until an event occurs. -// A timeout of nil blocks indefinitely, while 0 polls the queue. -func read(kq int, events []unix.Kevent_t, timeout *unix.Timespec) ([]unix.Kevent_t, error) { - n, err := unix.Kevent(kq, nil, events, timeout) - if err != nil { - return nil, err - } - return events[0:n], nil -} - -// durationToTimespec prepares a timeout value -func durationToTimespec(d time.Duration) unix.Timespec { - return unix.NsecToTimespec(d.Nanoseconds()) -} diff --git a/vendor/github.com/fsnotify/fsnotify/open_mode_bsd.go b/vendor/github.com/fsnotify/fsnotify/open_mode_bsd.go deleted file mode 100644 index 36cc3845b6..0000000000 --- a/vendor/github.com/fsnotify/fsnotify/open_mode_bsd.go +++ /dev/null @@ -1,12 +0,0 @@ -// Copyright 2013 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -//go:build freebsd || openbsd || netbsd || dragonfly -// +build freebsd openbsd netbsd dragonfly - -package fsnotify - -import "golang.org/x/sys/unix" - -const openMode = unix.O_NONBLOCK | unix.O_RDONLY | unix.O_CLOEXEC diff --git a/vendor/github.com/fsnotify/fsnotify/open_mode_darwin.go b/vendor/github.com/fsnotify/fsnotify/open_mode_darwin.go deleted file mode 100644 index 98cd8476ff..0000000000 --- a/vendor/github.com/fsnotify/fsnotify/open_mode_darwin.go +++ /dev/null @@ -1,13 +0,0 @@ -// Copyright 2013 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -//go:build darwin -// +build darwin - -package fsnotify - -import "golang.org/x/sys/unix" - -// note: this constant is not defined on BSD -const openMode = unix.O_EVTONLY | unix.O_CLOEXEC diff --git a/vendor/github.com/fsnotify/fsnotify/windows.go b/vendor/github.com/fsnotify/fsnotify/windows.go deleted file mode 100644 index c02b75f7c3..0000000000 --- a/vendor/github.com/fsnotify/fsnotify/windows.go +++ /dev/null @@ -1,562 +0,0 @@ -// Copyright 2011 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -//go:build windows -// +build windows - -package fsnotify - -import ( - "errors" - "fmt" - "os" - "path/filepath" - "runtime" - "sync" - "syscall" - "unsafe" -) - -// Watcher watches a set of files, delivering events to a channel. -type Watcher struct { - Events chan Event - Errors chan error - isClosed bool // Set to true when Close() is first called - mu sync.Mutex // Map access - port syscall.Handle // Handle to completion port - watches watchMap // Map of watches (key: i-number) - input chan *input // Inputs to the reader are sent on this channel - quit chan chan<- error -} - -// NewWatcher establishes a new watcher with the underlying OS and begins waiting for events. -func NewWatcher() (*Watcher, error) { - port, e := syscall.CreateIoCompletionPort(syscall.InvalidHandle, 0, 0, 0) - if e != nil { - return nil, os.NewSyscallError("CreateIoCompletionPort", e) - } - w := &Watcher{ - port: port, - watches: make(watchMap), - input: make(chan *input, 1), - Events: make(chan Event, 50), - Errors: make(chan error), - quit: make(chan chan<- error, 1), - } - go w.readEvents() - return w, nil -} - -// Close removes all watches and closes the events channel. -func (w *Watcher) Close() error { - if w.isClosed { - return nil - } - w.isClosed = true - - // Send "quit" message to the reader goroutine - ch := make(chan error) - w.quit <- ch - if err := w.wakeupReader(); err != nil { - return err - } - return <-ch -} - -// Add starts watching the named file or directory (non-recursively). -func (w *Watcher) Add(name string) error { - if w.isClosed { - return errors.New("watcher already closed") - } - in := &input{ - op: opAddWatch, - path: filepath.Clean(name), - flags: sysFSALLEVENTS, - reply: make(chan error), - } - w.input <- in - if err := w.wakeupReader(); err != nil { - return err - } - return <-in.reply -} - -// Remove stops watching the the named file or directory (non-recursively). -func (w *Watcher) Remove(name string) error { - in := &input{ - op: opRemoveWatch, - path: filepath.Clean(name), - reply: make(chan error), - } - w.input <- in - if err := w.wakeupReader(); err != nil { - return err - } - return <-in.reply -} - -const ( - // Options for AddWatch - sysFSONESHOT = 0x80000000 - sysFSONLYDIR = 0x1000000 - - // Events - sysFSACCESS = 0x1 - sysFSALLEVENTS = 0xfff - sysFSATTRIB = 0x4 - sysFSCLOSE = 0x18 - sysFSCREATE = 0x100 - sysFSDELETE = 0x200 - sysFSDELETESELF = 0x400 - sysFSMODIFY = 0x2 - sysFSMOVE = 0xc0 - sysFSMOVEDFROM = 0x40 - sysFSMOVEDTO = 0x80 - sysFSMOVESELF = 0x800 - - // Special events - sysFSIGNORED = 0x8000 - sysFSQOVERFLOW = 0x4000 -) - -func newEvent(name string, mask uint32) Event { - e := Event{Name: name} - if mask&sysFSCREATE == sysFSCREATE || mask&sysFSMOVEDTO == sysFSMOVEDTO { - e.Op |= Create - } - if mask&sysFSDELETE == sysFSDELETE || mask&sysFSDELETESELF == sysFSDELETESELF { - e.Op |= Remove - } - if mask&sysFSMODIFY == sysFSMODIFY { - e.Op |= Write - } - if mask&sysFSMOVE == sysFSMOVE || mask&sysFSMOVESELF == sysFSMOVESELF || mask&sysFSMOVEDFROM == sysFSMOVEDFROM { - e.Op |= Rename - } - if mask&sysFSATTRIB == sysFSATTRIB { - e.Op |= Chmod - } - return e -} - -const ( - opAddWatch = iota - opRemoveWatch -) - -const ( - provisional uint64 = 1 << (32 + iota) -) - -type input struct { - op int - path string - flags uint32 - reply chan error -} - -type inode struct { - handle syscall.Handle - volume uint32 - index uint64 -} - -type watch struct { - ov syscall.Overlapped - ino *inode // i-number - path string // Directory path - mask uint64 // Directory itself is being watched with these notify flags - names map[string]uint64 // Map of names being watched and their notify flags - rename string // Remembers the old name while renaming a file - buf [4096]byte -} - -type indexMap map[uint64]*watch -type watchMap map[uint32]indexMap - -func (w *Watcher) wakeupReader() error { - e := syscall.PostQueuedCompletionStatus(w.port, 0, 0, nil) - if e != nil { - return os.NewSyscallError("PostQueuedCompletionStatus", e) - } - return nil -} - -func getDir(pathname string) (dir string, err error) { - attr, e := syscall.GetFileAttributes(syscall.StringToUTF16Ptr(pathname)) - if e != nil { - return "", os.NewSyscallError("GetFileAttributes", e) - } - if attr&syscall.FILE_ATTRIBUTE_DIRECTORY != 0 { - dir = pathname - } else { - dir, _ = filepath.Split(pathname) - dir = filepath.Clean(dir) - } - return -} - -func getIno(path string) (ino *inode, err error) { - h, e := syscall.CreateFile(syscall.StringToUTF16Ptr(path), - syscall.FILE_LIST_DIRECTORY, - syscall.FILE_SHARE_READ|syscall.FILE_SHARE_WRITE|syscall.FILE_SHARE_DELETE, - nil, syscall.OPEN_EXISTING, - syscall.FILE_FLAG_BACKUP_SEMANTICS|syscall.FILE_FLAG_OVERLAPPED, 0) - if e != nil { - return nil, os.NewSyscallError("CreateFile", e) - } - var fi syscall.ByHandleFileInformation - if e = syscall.GetFileInformationByHandle(h, &fi); e != nil { - syscall.CloseHandle(h) - return nil, os.NewSyscallError("GetFileInformationByHandle", e) - } - ino = &inode{ - handle: h, - volume: fi.VolumeSerialNumber, - index: uint64(fi.FileIndexHigh)<<32 | uint64(fi.FileIndexLow), - } - return ino, nil -} - -// Must run within the I/O thread. -func (m watchMap) get(ino *inode) *watch { - if i := m[ino.volume]; i != nil { - return i[ino.index] - } - return nil -} - -// Must run within the I/O thread. -func (m watchMap) set(ino *inode, watch *watch) { - i := m[ino.volume] - if i == nil { - i = make(indexMap) - m[ino.volume] = i - } - i[ino.index] = watch -} - -// Must run within the I/O thread. -func (w *Watcher) addWatch(pathname string, flags uint64) error { - dir, err := getDir(pathname) - if err != nil { - return err - } - if flags&sysFSONLYDIR != 0 && pathname != dir { - return nil - } - ino, err := getIno(dir) - if err != nil { - return err - } - w.mu.Lock() - watchEntry := w.watches.get(ino) - w.mu.Unlock() - if watchEntry == nil { - if _, e := syscall.CreateIoCompletionPort(ino.handle, w.port, 0, 0); e != nil { - syscall.CloseHandle(ino.handle) - return os.NewSyscallError("CreateIoCompletionPort", e) - } - watchEntry = &watch{ - ino: ino, - path: dir, - names: make(map[string]uint64), - } - w.mu.Lock() - w.watches.set(ino, watchEntry) - w.mu.Unlock() - flags |= provisional - } else { - syscall.CloseHandle(ino.handle) - } - if pathname == dir { - watchEntry.mask |= flags - } else { - watchEntry.names[filepath.Base(pathname)] |= flags - } - if err = w.startRead(watchEntry); err != nil { - return err - } - if pathname == dir { - watchEntry.mask &= ^provisional - } else { - watchEntry.names[filepath.Base(pathname)] &= ^provisional - } - return nil -} - -// Must run within the I/O thread. -func (w *Watcher) remWatch(pathname string) error { - dir, err := getDir(pathname) - if err != nil { - return err - } - ino, err := getIno(dir) - if err != nil { - return err - } - w.mu.Lock() - watch := w.watches.get(ino) - w.mu.Unlock() - if watch == nil { - return fmt.Errorf("can't remove non-existent watch for: %s", pathname) - } - if pathname == dir { - w.sendEvent(watch.path, watch.mask&sysFSIGNORED) - watch.mask = 0 - } else { - name := filepath.Base(pathname) - w.sendEvent(filepath.Join(watch.path, name), watch.names[name]&sysFSIGNORED) - delete(watch.names, name) - } - return w.startRead(watch) -} - -// Must run within the I/O thread. -func (w *Watcher) deleteWatch(watch *watch) { - for name, mask := range watch.names { - if mask&provisional == 0 { - w.sendEvent(filepath.Join(watch.path, name), mask&sysFSIGNORED) - } - delete(watch.names, name) - } - if watch.mask != 0 { - if watch.mask&provisional == 0 { - w.sendEvent(watch.path, watch.mask&sysFSIGNORED) - } - watch.mask = 0 - } -} - -// Must run within the I/O thread. -func (w *Watcher) startRead(watch *watch) error { - if e := syscall.CancelIo(watch.ino.handle); e != nil { - w.Errors <- os.NewSyscallError("CancelIo", e) - w.deleteWatch(watch) - } - mask := toWindowsFlags(watch.mask) - for _, m := range watch.names { - mask |= toWindowsFlags(m) - } - if mask == 0 { - if e := syscall.CloseHandle(watch.ino.handle); e != nil { - w.Errors <- os.NewSyscallError("CloseHandle", e) - } - w.mu.Lock() - delete(w.watches[watch.ino.volume], watch.ino.index) - w.mu.Unlock() - return nil - } - e := syscall.ReadDirectoryChanges(watch.ino.handle, &watch.buf[0], - uint32(unsafe.Sizeof(watch.buf)), false, mask, nil, &watch.ov, 0) - if e != nil { - err := os.NewSyscallError("ReadDirectoryChanges", e) - if e == syscall.ERROR_ACCESS_DENIED && watch.mask&provisional == 0 { - // Watched directory was probably removed - if w.sendEvent(watch.path, watch.mask&sysFSDELETESELF) { - if watch.mask&sysFSONESHOT != 0 { - watch.mask = 0 - } - } - err = nil - } - w.deleteWatch(watch) - w.startRead(watch) - return err - } - return nil -} - -// readEvents reads from the I/O completion port, converts the -// received events into Event objects and sends them via the Events channel. -// Entry point to the I/O thread. -func (w *Watcher) readEvents() { - var ( - n, key uint32 - ov *syscall.Overlapped - ) - runtime.LockOSThread() - - for { - e := syscall.GetQueuedCompletionStatus(w.port, &n, &key, &ov, syscall.INFINITE) - watch := (*watch)(unsafe.Pointer(ov)) - - if watch == nil { - select { - case ch := <-w.quit: - w.mu.Lock() - var indexes []indexMap - for _, index := range w.watches { - indexes = append(indexes, index) - } - w.mu.Unlock() - for _, index := range indexes { - for _, watch := range index { - w.deleteWatch(watch) - w.startRead(watch) - } - } - var err error - if e := syscall.CloseHandle(w.port); e != nil { - err = os.NewSyscallError("CloseHandle", e) - } - close(w.Events) - close(w.Errors) - ch <- err - return - case in := <-w.input: - switch in.op { - case opAddWatch: - in.reply <- w.addWatch(in.path, uint64(in.flags)) - case opRemoveWatch: - in.reply <- w.remWatch(in.path) - } - default: - } - continue - } - - switch e { - case syscall.ERROR_MORE_DATA: - if watch == nil { - w.Errors <- errors.New("ERROR_MORE_DATA has unexpectedly null lpOverlapped buffer") - } else { - // The i/o succeeded but the buffer is full. - // In theory we should be building up a full packet. - // In practice we can get away with just carrying on. - n = uint32(unsafe.Sizeof(watch.buf)) - } - case syscall.ERROR_ACCESS_DENIED: - // Watched directory was probably removed - w.sendEvent(watch.path, watch.mask&sysFSDELETESELF) - w.deleteWatch(watch) - w.startRead(watch) - continue - case syscall.ERROR_OPERATION_ABORTED: - // CancelIo was called on this handle - continue - default: - w.Errors <- os.NewSyscallError("GetQueuedCompletionPort", e) - continue - case nil: - } - - var offset uint32 - for { - if n == 0 { - w.Events <- newEvent("", sysFSQOVERFLOW) - w.Errors <- errors.New("short read in readEvents()") - break - } - - // Point "raw" to the event in the buffer - raw := (*syscall.FileNotifyInformation)(unsafe.Pointer(&watch.buf[offset])) - buf := (*[syscall.MAX_PATH]uint16)(unsafe.Pointer(&raw.FileName)) - name := syscall.UTF16ToString(buf[:raw.FileNameLength/2]) - fullname := filepath.Join(watch.path, name) - - var mask uint64 - switch raw.Action { - case syscall.FILE_ACTION_REMOVED: - mask = sysFSDELETESELF - case syscall.FILE_ACTION_MODIFIED: - mask = sysFSMODIFY - case syscall.FILE_ACTION_RENAMED_OLD_NAME: - watch.rename = name - case syscall.FILE_ACTION_RENAMED_NEW_NAME: - if watch.names[watch.rename] != 0 { - watch.names[name] |= watch.names[watch.rename] - delete(watch.names, watch.rename) - mask = sysFSMOVESELF - } - } - - sendNameEvent := func() { - if w.sendEvent(fullname, watch.names[name]&mask) { - if watch.names[name]&sysFSONESHOT != 0 { - delete(watch.names, name) - } - } - } - if raw.Action != syscall.FILE_ACTION_RENAMED_NEW_NAME { - sendNameEvent() - } - if raw.Action == syscall.FILE_ACTION_REMOVED { - w.sendEvent(fullname, watch.names[name]&sysFSIGNORED) - delete(watch.names, name) - } - if w.sendEvent(fullname, watch.mask&toFSnotifyFlags(raw.Action)) { - if watch.mask&sysFSONESHOT != 0 { - watch.mask = 0 - } - } - if raw.Action == syscall.FILE_ACTION_RENAMED_NEW_NAME { - fullname = filepath.Join(watch.path, watch.rename) - sendNameEvent() - } - - // Move to the next event in the buffer - if raw.NextEntryOffset == 0 { - break - } - offset += raw.NextEntryOffset - - // Error! - if offset >= n { - w.Errors <- errors.New("Windows system assumed buffer larger than it is, events have likely been missed.") - break - } - } - - if err := w.startRead(watch); err != nil { - w.Errors <- err - } - } -} - -func (w *Watcher) sendEvent(name string, mask uint64) bool { - if mask == 0 { - return false - } - event := newEvent(name, uint32(mask)) - select { - case ch := <-w.quit: - w.quit <- ch - case w.Events <- event: - } - return true -} - -func toWindowsFlags(mask uint64) uint32 { - var m uint32 - if mask&sysFSACCESS != 0 { - m |= syscall.FILE_NOTIFY_CHANGE_LAST_ACCESS - } - if mask&sysFSMODIFY != 0 { - m |= syscall.FILE_NOTIFY_CHANGE_LAST_WRITE - } - if mask&sysFSATTRIB != 0 { - m |= syscall.FILE_NOTIFY_CHANGE_ATTRIBUTES - } - if mask&(sysFSMOVE|sysFSCREATE|sysFSDELETE) != 0 { - m |= syscall.FILE_NOTIFY_CHANGE_FILE_NAME | syscall.FILE_NOTIFY_CHANGE_DIR_NAME - } - return m -} - -func toFSnotifyFlags(action uint32) uint64 { - switch action { - case syscall.FILE_ACTION_ADDED: - return sysFSCREATE - case syscall.FILE_ACTION_REMOVED: - return sysFSDELETE - case syscall.FILE_ACTION_MODIFIED: - return sysFSMODIFY - case syscall.FILE_ACTION_RENAMED_OLD_NAME: - return sysFSMOVEDFROM - case syscall.FILE_ACTION_RENAMED_NEW_NAME: - return sysFSMOVEDTO - } - return 0 -} diff --git a/vendor/github.com/go-task/slim-sprig/.editorconfig b/vendor/github.com/go-task/slim-sprig/.editorconfig deleted file mode 100644 index b0c95367e7..0000000000 --- a/vendor/github.com/go-task/slim-sprig/.editorconfig +++ /dev/null @@ -1,14 +0,0 @@ -# editorconfig.org - -root = true - -[*] -insert_final_newline = true -charset = utf-8 -trim_trailing_whitespace = true -indent_style = tab -indent_size = 8 - -[*.{md,yml,yaml,json}] -indent_style = space -indent_size = 2 diff --git a/vendor/github.com/go-task/slim-sprig/.gitattributes b/vendor/github.com/go-task/slim-sprig/.gitattributes deleted file mode 100644 index 176a458f94..0000000000 --- a/vendor/github.com/go-task/slim-sprig/.gitattributes +++ /dev/null @@ -1 +0,0 @@ -* text=auto diff --git a/vendor/github.com/go-task/slim-sprig/.gitignore b/vendor/github.com/go-task/slim-sprig/.gitignore deleted file mode 100644 index 5e3002f88f..0000000000 --- a/vendor/github.com/go-task/slim-sprig/.gitignore +++ /dev/null @@ -1,2 +0,0 @@ -vendor/ -/.glide diff --git a/vendor/github.com/go-task/slim-sprig/CHANGELOG.md b/vendor/github.com/go-task/slim-sprig/CHANGELOG.md deleted file mode 100644 index 61d8ebffc3..0000000000 --- a/vendor/github.com/go-task/slim-sprig/CHANGELOG.md +++ /dev/null @@ -1,364 +0,0 @@ -# Changelog - -## Release 3.2.0 (2020-12-14) - -### Added - -- #211: Added randInt function (thanks @kochurovro) -- #223: Added fromJson and mustFromJson functions (thanks @mholt) -- #242: Added a bcrypt function (thanks @robbiet480) -- #253: Added randBytes function (thanks @MikaelSmith) -- #254: Added dig function for dicts (thanks @nyarly) -- #257: Added regexQuoteMeta for quoting regex metadata (thanks @rheaton) -- #261: Added filepath functions osBase, osDir, osExt, osClean, osIsAbs (thanks @zugl) -- #268: Added and and all functions for testing conditions (thanks @phuslu) -- #181: Added float64 arithmetic addf, add1f, subf, divf, mulf, maxf, and minf - (thanks @andrewmostello) -- #265: Added chunk function to split array into smaller arrays (thanks @karelbilek) -- #270: Extend certificate functions to handle non-RSA keys + add support for - ed25519 keys (thanks @misberner) - -### Changed - -- Removed testing and support for Go 1.12. ed25519 support requires Go 1.13 or newer -- Using semver 3.1.1 and mergo 0.3.11 - -### Fixed - -- #249: Fix htmlDateInZone example (thanks @spawnia) - -NOTE: The dependency github.com/imdario/mergo reverted the breaking change in -0.3.9 via 0.3.10 release. - -## Release 3.1.0 (2020-04-16) - -NOTE: The dependency github.com/imdario/mergo made a behavior change in 0.3.9 -that impacts sprig functionality. Do not use sprig with a version newer than 0.3.8. - -### Added - -- #225: Added support for generating htpasswd hash (thanks @rustycl0ck) -- #224: Added duration filter (thanks @frebib) -- #205: Added `seq` function (thanks @thadc23) - -### Changed - -- #203: Unlambda functions with correct signature (thanks @muesli) -- #236: Updated the license formatting for GitHub display purposes -- #238: Updated package dependency versions. Note, mergo not updated to 0.3.9 - as it causes a breaking change for sprig. That issue is tracked at - https://github.com/imdario/mergo/issues/139 - -### Fixed - -- #229: Fix `seq` example in docs (thanks @kalmant) - -## Release 3.0.2 (2019-12-13) - -### Fixed - -- #220: Updating to semver v3.0.3 to fix issue with <= ranges -- #218: fix typo elyptical->elliptic in ecdsa key description (thanks @laverya) - -## Release 3.0.1 (2019-12-08) - -### Fixed - -- #212: Updated semver fixing broken constraint checking with ^0.0 - -## Release 3.0.0 (2019-10-02) - -### Added - -- #187: Added durationRound function (thanks @yjp20) -- #189: Added numerous template functions that return errors rather than panic (thanks @nrvnrvn) -- #193: Added toRawJson support (thanks @Dean-Coakley) -- #197: Added get support to dicts (thanks @Dean-Coakley) - -### Changed - -- #186: Moving dependency management to Go modules -- #186: Updated semver to v3. This has changes in the way ^ is handled -- #194: Updated documentation on merging and how it copies. Added example using deepCopy -- #196: trunc now supports negative values (thanks @Dean-Coakley) - -## Release 2.22.0 (2019-10-02) - -### Added - -- #173: Added getHostByName function to resolve dns names to ips (thanks @fcgravalos) -- #195: Added deepCopy function for use with dicts - -### Changed - -- Updated merge and mergeOverwrite documentation to explain copying and how to - use deepCopy with it - -## Release 2.21.0 (2019-09-18) - -### Added - -- #122: Added encryptAES/decryptAES functions (thanks @n0madic) -- #128: Added toDecimal support (thanks @Dean-Coakley) -- #169: Added list contcat (thanks @astorath) -- #174: Added deepEqual function (thanks @bonifaido) -- #170: Added url parse and join functions (thanks @astorath) - -### Changed - -- #171: Updated glide config for Google UUID to v1 and to add ranges to semver and testify - -### Fixed - -- #172: Fix semver wildcard example (thanks @piepmatz) -- #175: Fix dateInZone doc example (thanks @s3than) - -## Release 2.20.0 (2019-06-18) - -### Added - -- #164: Adding function to get unix epoch for a time (@mattfarina) -- #166: Adding tests for date_in_zone (@mattfarina) - -### Changed - -- #144: Fix function comments based on best practices from Effective Go (@CodeLingoTeam) -- #150: Handles pointer type for time.Time in "htmlDate" (@mapreal19) -- #161, #157, #160, #153, #158, #156, #155, #159, #152 documentation updates (@badeadan) - -### Fixed - -## Release 2.19.0 (2019-03-02) - -IMPORTANT: This release reverts a change from 2.18.0 - -In the previous release (2.18), we prematurely merged a partial change to the crypto functions that led to creating two sets of crypto functions (I blame @technosophos -- since that's me). This release rolls back that change, and does what was originally intended: It alters the existing crypto functions to use secure random. - -We debated whether this classifies as a change worthy of major revision, but given the proximity to the last release, we have decided that treating 2.18 as a faulty release is the correct course of action. We apologize for any inconvenience. - -### Changed - -- Fix substr panic 35fb796 (Alexey igrychev) -- Remove extra period 1eb7729 (Matthew Lorimor) -- Make random string functions use crypto by default 6ceff26 (Matthew Lorimor) -- README edits/fixes/suggestions 08fe136 (Lauri Apple) - - -## Release 2.18.0 (2019-02-12) - -### Added - -- Added mergeOverwrite function -- cryptographic functions that use secure random (see fe1de12) - -### Changed - -- Improve documentation of regexMatch function, resolves #139 90b89ce (Jan Tagscherer) -- Handle has for nil list 9c10885 (Daniel Cohen) -- Document behaviour of mergeOverwrite fe0dbe9 (Lukas Rieder) -- doc: adds missing documentation. 4b871e6 (Fernandez Ludovic) -- Replace outdated goutils imports 01893d2 (Matthew Lorimor) -- Surface crypto secure random strings from goutils fe1de12 (Matthew Lorimor) -- Handle untyped nil values as paramters to string functions 2b2ec8f (Morten Torkildsen) - -### Fixed - -- Fix dict merge issue and provide mergeOverwrite .dst .src1 to overwrite from src -> dst 4c59c12 (Lukas Rieder) -- Fix substr var names and comments d581f80 (Dean Coakley) -- Fix substr documentation 2737203 (Dean Coakley) - -## Release 2.17.1 (2019-01-03) - -### Fixed - -The 2.17.0 release did not have a version pinned for xstrings, which caused compilation failures when xstrings < 1.2 was used. This adds the correct version string to glide.yaml. - -## Release 2.17.0 (2019-01-03) - -### Added - -- adds alder32sum function and test 6908fc2 (marshallford) -- Added kebabcase function ca331a1 (Ilyes512) - -### Changed - -- Update goutils to 1.1.0 4e1125d (Matt Butcher) - -### Fixed - -- Fix 'has' documentation e3f2a85 (dean-coakley) -- docs(dict): fix typo in pick example dc424f9 (Dustin Specker) -- fixes spelling errors... not sure how that happened 4cf188a (marshallford) - -## Release 2.16.0 (2018-08-13) - -### Added - -- add splitn function fccb0b0 (Helgi Þorbjörnsson) -- Add slice func df28ca7 (gongdo) -- Generate serial number a3bdffd (Cody Coons) -- Extract values of dict with values function df39312 (Lawrence Jones) - -### Changed - -- Modify panic message for list.slice ae38335 (gongdo) -- Minor improvement in code quality - Removed an unreachable piece of code at defaults.go#L26:6 - Resolve formatting issues. 5834241 (Abhishek Kashyap) -- Remove duplicated documentation 1d97af1 (Matthew Fisher) -- Test on go 1.11 49df809 (Helgi Þormar Þorbjörnsson) - -### Fixed - -- Fix file permissions c5f40b5 (gongdo) -- Fix example for buildCustomCert 7779e0d (Tin Lam) - -## Release 2.15.0 (2018-04-02) - -### Added - -- #68 and #69: Add json helpers to docs (thanks @arunvelsriram) -- #66: Add ternary function (thanks @binoculars) -- #67: Allow keys function to take multiple dicts (thanks @binoculars) -- #89: Added sha1sum to crypto function (thanks @benkeil) -- #81: Allow customizing Root CA that used by genSignedCert (thanks @chenzhiwei) -- #92: Add travis testing for go 1.10 -- #93: Adding appveyor config for windows testing - -### Changed - -- #90: Updating to more recent dependencies -- #73: replace satori/go.uuid with google/uuid (thanks @petterw) - -### Fixed - -- #76: Fixed documentation typos (thanks @Thiht) -- Fixed rounding issue on the `ago` function. Note, the removes support for Go 1.8 and older - -## Release 2.14.1 (2017-12-01) - -### Fixed - -- #60: Fix typo in function name documentation (thanks @neil-ca-moore) -- #61: Removing line with {{ due to blocking github pages genertion -- #64: Update the list functions to handle int, string, and other slices for compatibility - -## Release 2.14.0 (2017-10-06) - -This new version of Sprig adds a set of functions for generating and working with SSL certificates. - -- `genCA` generates an SSL Certificate Authority -- `genSelfSignedCert` generates an SSL self-signed certificate -- `genSignedCert` generates an SSL certificate and key based on a given CA - -## Release 2.13.0 (2017-09-18) - -This release adds new functions, including: - -- `regexMatch`, `regexFindAll`, `regexFind`, `regexReplaceAll`, `regexReplaceAllLiteral`, and `regexSplit` to work with regular expressions -- `floor`, `ceil`, and `round` math functions -- `toDate` converts a string to a date -- `nindent` is just like `indent` but also prepends a new line -- `ago` returns the time from `time.Now` - -### Added - -- #40: Added basic regex functionality (thanks @alanquillin) -- #41: Added ceil floor and round functions (thanks @alanquillin) -- #48: Added toDate function (thanks @andreynering) -- #50: Added nindent function (thanks @binoculars) -- #46: Added ago function (thanks @slayer) - -### Changed - -- #51: Updated godocs to include new string functions (thanks @curtisallen) -- #49: Added ability to merge multiple dicts (thanks @binoculars) - -## Release 2.12.0 (2017-05-17) - -- `snakecase`, `camelcase`, and `shuffle` are three new string functions -- `fail` allows you to bail out of a template render when conditions are not met - -## Release 2.11.0 (2017-05-02) - -- Added `toJson` and `toPrettyJson` -- Added `merge` -- Refactored documentation - -## Release 2.10.0 (2017-03-15) - -- Added `semver` and `semverCompare` for Semantic Versions -- `list` replaces `tuple` -- Fixed issue with `join` -- Added `first`, `last`, `intial`, `rest`, `prepend`, `append`, `toString`, `toStrings`, `sortAlpha`, `reverse`, `coalesce`, `pluck`, `pick`, `compact`, `keys`, `omit`, `uniq`, `has`, `without` - -## Release 2.9.0 (2017-02-23) - -- Added `splitList` to split a list -- Added crypto functions of `genPrivateKey` and `derivePassword` - -## Release 2.8.0 (2016-12-21) - -- Added access to several path functions (`base`, `dir`, `clean`, `ext`, and `abs`) -- Added functions for _mutating_ dictionaries (`set`, `unset`, `hasKey`) - -## Release 2.7.0 (2016-12-01) - -- Added `sha256sum` to generate a hash of an input -- Added functions to convert a numeric or string to `int`, `int64`, `float64` - -## Release 2.6.0 (2016-10-03) - -- Added a `uuidv4` template function for generating UUIDs inside of a template. - -## Release 2.5.0 (2016-08-19) - -- New `trimSuffix`, `trimPrefix`, `hasSuffix`, and `hasPrefix` functions -- New aliases have been added for a few functions that didn't follow the naming conventions (`trimAll` and `abbrevBoth`) -- `trimall` and `abbrevboth` (notice the case) are deprecated and will be removed in 3.0.0 - -## Release 2.4.0 (2016-08-16) - -- Adds two functions: `until` and `untilStep` - -## Release 2.3.0 (2016-06-21) - -- cat: Concatenate strings with whitespace separators. -- replace: Replace parts of a string: `replace " " "-" "Me First"` renders "Me-First" -- plural: Format plurals: `len "foo" | plural "one foo" "many foos"` renders "many foos" -- indent: Indent blocks of text in a way that is sensitive to "\n" characters. - -## Release 2.2.0 (2016-04-21) - -- Added a `genPrivateKey` function (Thanks @bacongobbler) - -## Release 2.1.0 (2016-03-30) - -- `default` now prints the default value when it does not receive a value down the pipeline. It is much safer now to do `{{.Foo | default "bar"}}`. -- Added accessors for "hermetic" functions. These return only functions that, when given the same input, produce the same output. - -## Release 2.0.0 (2016-03-29) - -Because we switched from `int` to `int64` as the return value for all integer math functions, the library's major version number has been incremented. - -- `min` complements `max` (formerly `biggest`) -- `empty` indicates that a value is the empty value for its type -- `tuple` creates a tuple inside of a template: `{{$t := tuple "a", "b" "c"}}` -- `dict` creates a dictionary inside of a template `{{$d := dict "key1" "val1" "key2" "val2"}}` -- Date formatters have been added for HTML dates (as used in `date` input fields) -- Integer math functions can convert from a number of types, including `string` (via `strconv.ParseInt`). - -## Release 1.2.0 (2016-02-01) - -- Added quote and squote -- Added b32enc and b32dec -- add now takes varargs -- biggest now takes varargs - -## Release 1.1.0 (2015-12-29) - -- Added #4: Added contains function. strings.Contains, but with the arguments - switched to simplify common pipelines. (thanks krancour) -- Added Travis-CI testing support - -## Release 1.0.0 (2015-12-23) - -- Initial release diff --git a/vendor/github.com/go-task/slim-sprig/README.md b/vendor/github.com/go-task/slim-sprig/README.md deleted file mode 100644 index 72579471ff..0000000000 --- a/vendor/github.com/go-task/slim-sprig/README.md +++ /dev/null @@ -1,73 +0,0 @@ -# Slim-Sprig: Template functions for Go templates [![GoDoc](https://godoc.org/github.com/go-task/slim-sprig?status.svg)](https://godoc.org/github.com/go-task/slim-sprig) [![Go Report Card](https://goreportcard.com/badge/github.com/go-task/slim-sprig)](https://goreportcard.com/report/github.com/go-task/slim-sprig) - -Slim-Sprig is a fork of [Sprig](https://github.com/Masterminds/sprig), but with -all functions that depend on external (non standard library) or crypto packages -removed. -The reason for this is to make this library more lightweight. Most of these -functions (specially crypto ones) are not needed on most apps, but costs a lot -in terms of binary size and compilation time. - -## Usage - -**Template developers**: Please use Slim-Sprig's [function documentation](https://go-task.github.io/slim-sprig/) for -detailed instructions and code snippets for the >100 template functions available. - -**Go developers**: If you'd like to include Slim-Sprig as a library in your program, -our API documentation is available [at GoDoc.org](http://godoc.org/github.com/go-task/slim-sprig). - -For standard usage, read on. - -### Load the Slim-Sprig library - -To load the Slim-Sprig `FuncMap`: - -```go - -import ( - "html/template" - - "github.com/go-task/slim-sprig" -) - -// This example illustrates that the FuncMap *must* be set before the -// templates themselves are loaded. -tpl := template.Must( - template.New("base").Funcs(sprig.FuncMap()).ParseGlob("*.html") -) -``` - -### Calling the functions inside of templates - -By convention, all functions are lowercase. This seems to follow the Go -idiom for template functions (as opposed to template methods, which are -TitleCase). For example, this: - -``` -{{ "hello!" | upper | repeat 5 }} -``` - -produces this: - -``` -HELLO!HELLO!HELLO!HELLO!HELLO! -``` - -## Principles Driving Our Function Selection - -We followed these principles to decide which functions to add and how to implement them: - -- Use template functions to build layout. The following - types of operations are within the domain of template functions: - - Formatting - - Layout - - Simple type conversions - - Utilities that assist in handling common formatting and layout needs (e.g. arithmetic) -- Template functions should not return errors unless there is no way to print - a sensible value. For example, converting a string to an integer should not - produce an error if conversion fails. Instead, it should display a default - value. -- Simple math is necessary for grid layouts, pagers, and so on. Complex math - (anything other than arithmetic) should be done outside of templates. -- Template functions only deal with the data passed into them. They never retrieve - data from a source. -- Finally, do not override core Go template functions. diff --git a/vendor/github.com/go-task/slim-sprig/Taskfile.yml b/vendor/github.com/go-task/slim-sprig/Taskfile.yml deleted file mode 100644 index cdcfd223b7..0000000000 --- a/vendor/github.com/go-task/slim-sprig/Taskfile.yml +++ /dev/null @@ -1,12 +0,0 @@ -# https://taskfile.dev - -version: '2' - -tasks: - default: - cmds: - - task: test - - test: - cmds: - - go test -v . diff --git a/vendor/github.com/go-task/slim-sprig/crypto.go b/vendor/github.com/go-task/slim-sprig/crypto.go deleted file mode 100644 index d06e516d49..0000000000 --- a/vendor/github.com/go-task/slim-sprig/crypto.go +++ /dev/null @@ -1,24 +0,0 @@ -package sprig - -import ( - "crypto/sha1" - "crypto/sha256" - "encoding/hex" - "fmt" - "hash/adler32" -) - -func sha256sum(input string) string { - hash := sha256.Sum256([]byte(input)) - return hex.EncodeToString(hash[:]) -} - -func sha1sum(input string) string { - hash := sha1.Sum([]byte(input)) - return hex.EncodeToString(hash[:]) -} - -func adler32sum(input string) string { - hash := adler32.Checksum([]byte(input)) - return fmt.Sprintf("%d", hash) -} diff --git a/vendor/github.com/go-task/slim-sprig/date.go b/vendor/github.com/go-task/slim-sprig/date.go deleted file mode 100644 index ed022ddaca..0000000000 --- a/vendor/github.com/go-task/slim-sprig/date.go +++ /dev/null @@ -1,152 +0,0 @@ -package sprig - -import ( - "strconv" - "time" -) - -// Given a format and a date, format the date string. -// -// Date can be a `time.Time` or an `int, int32, int64`. -// In the later case, it is treated as seconds since UNIX -// epoch. -func date(fmt string, date interface{}) string { - return dateInZone(fmt, date, "Local") -} - -func htmlDate(date interface{}) string { - return dateInZone("2006-01-02", date, "Local") -} - -func htmlDateInZone(date interface{}, zone string) string { - return dateInZone("2006-01-02", date, zone) -} - -func dateInZone(fmt string, date interface{}, zone string) string { - var t time.Time - switch date := date.(type) { - default: - t = time.Now() - case time.Time: - t = date - case *time.Time: - t = *date - case int64: - t = time.Unix(date, 0) - case int: - t = time.Unix(int64(date), 0) - case int32: - t = time.Unix(int64(date), 0) - } - - loc, err := time.LoadLocation(zone) - if err != nil { - loc, _ = time.LoadLocation("UTC") - } - - return t.In(loc).Format(fmt) -} - -func dateModify(fmt string, date time.Time) time.Time { - d, err := time.ParseDuration(fmt) - if err != nil { - return date - } - return date.Add(d) -} - -func mustDateModify(fmt string, date time.Time) (time.Time, error) { - d, err := time.ParseDuration(fmt) - if err != nil { - return time.Time{}, err - } - return date.Add(d), nil -} - -func dateAgo(date interface{}) string { - var t time.Time - - switch date := date.(type) { - default: - t = time.Now() - case time.Time: - t = date - case int64: - t = time.Unix(date, 0) - case int: - t = time.Unix(int64(date), 0) - } - // Drop resolution to seconds - duration := time.Since(t).Round(time.Second) - return duration.String() -} - -func duration(sec interface{}) string { - var n int64 - switch value := sec.(type) { - default: - n = 0 - case string: - n, _ = strconv.ParseInt(value, 10, 64) - case int64: - n = value - } - return (time.Duration(n) * time.Second).String() -} - -func durationRound(duration interface{}) string { - var d time.Duration - switch duration := duration.(type) { - default: - d = 0 - case string: - d, _ = time.ParseDuration(duration) - case int64: - d = time.Duration(duration) - case time.Time: - d = time.Since(duration) - } - - u := uint64(d) - neg := d < 0 - if neg { - u = -u - } - - var ( - year = uint64(time.Hour) * 24 * 365 - month = uint64(time.Hour) * 24 * 30 - day = uint64(time.Hour) * 24 - hour = uint64(time.Hour) - minute = uint64(time.Minute) - second = uint64(time.Second) - ) - switch { - case u > year: - return strconv.FormatUint(u/year, 10) + "y" - case u > month: - return strconv.FormatUint(u/month, 10) + "mo" - case u > day: - return strconv.FormatUint(u/day, 10) + "d" - case u > hour: - return strconv.FormatUint(u/hour, 10) + "h" - case u > minute: - return strconv.FormatUint(u/minute, 10) + "m" - case u > second: - return strconv.FormatUint(u/second, 10) + "s" - } - return "0s" -} - -func toDate(fmt, str string) time.Time { - t, _ := time.ParseInLocation(fmt, str, time.Local) - return t -} - -func mustToDate(fmt, str string) (time.Time, error) { - return time.ParseInLocation(fmt, str, time.Local) -} - -func unixEpoch(date time.Time) string { - return strconv.FormatInt(date.Unix(), 10) -} diff --git a/vendor/github.com/go-task/slim-sprig/defaults.go b/vendor/github.com/go-task/slim-sprig/defaults.go deleted file mode 100644 index b9f979666d..0000000000 --- a/vendor/github.com/go-task/slim-sprig/defaults.go +++ /dev/null @@ -1,163 +0,0 @@ -package sprig - -import ( - "bytes" - "encoding/json" - "math/rand" - "reflect" - "strings" - "time" -) - -func init() { - rand.Seed(time.Now().UnixNano()) -} - -// dfault checks whether `given` is set, and returns default if not set. -// -// This returns `d` if `given` appears not to be set, and `given` otherwise. -// -// For numeric types 0 is unset. -// For strings, maps, arrays, and slices, len() = 0 is considered unset. -// For bool, false is unset. -// Structs are never considered unset. -// -// For everything else, including pointers, a nil value is unset. -func dfault(d interface{}, given ...interface{}) interface{} { - - if empty(given) || empty(given[0]) { - return d - } - return given[0] -} - -// empty returns true if the given value has the zero value for its type. -func empty(given interface{}) bool { - g := reflect.ValueOf(given) - if !g.IsValid() { - return true - } - - // Basically adapted from text/template.isTrue - switch g.Kind() { - default: - return g.IsNil() - case reflect.Array, reflect.Slice, reflect.Map, reflect.String: - return g.Len() == 0 - case reflect.Bool: - return !g.Bool() - case reflect.Complex64, reflect.Complex128: - return g.Complex() == 0 - case reflect.Int, reflect.Int8, reflect.Int16, reflect.Int32, reflect.Int64: - return g.Int() == 0 - case reflect.Uint, reflect.Uint8, reflect.Uint16, reflect.Uint32, reflect.Uint64, reflect.Uintptr: - return g.Uint() == 0 - case reflect.Float32, reflect.Float64: - return g.Float() == 0 - case reflect.Struct: - return false - } -} - -// coalesce returns the first non-empty value. -func coalesce(v ...interface{}) interface{} { - for _, val := range v { - if !empty(val) { - return val - } - } - return nil -} - -// all returns true if empty(x) is false for all values x in the list. -// If the list is empty, return true. -func all(v ...interface{}) bool { - for _, val := range v { - if empty(val) { - return false - } - } - return true -} - -// any returns true if empty(x) is false for any x in the list. -// If the list is empty, return false. -func any(v ...interface{}) bool { - for _, val := range v { - if !empty(val) { - return true - } - } - return false -} - -// fromJson decodes JSON into a structured value, ignoring errors. -func fromJson(v string) interface{} { - output, _ := mustFromJson(v) - return output -} - -// mustFromJson decodes JSON into a structured value, returning errors. -func mustFromJson(v string) (interface{}, error) { - var output interface{} - err := json.Unmarshal([]byte(v), &output) - return output, err -} - -// toJson encodes an item into a JSON string -func toJson(v interface{}) string { - output, _ := json.Marshal(v) - return string(output) -} - -func mustToJson(v interface{}) (string, error) { - output, err := json.Marshal(v) - if err != nil { - return "", err - } - return string(output), nil -} - -// toPrettyJson encodes an item into a pretty (indented) JSON string -func toPrettyJson(v interface{}) string { - output, _ := json.MarshalIndent(v, "", " ") - return string(output) -} - -func mustToPrettyJson(v interface{}) (string, error) { - output, err := json.MarshalIndent(v, "", " ") - if err != nil { - return "", err - } - return string(output), nil -} - -// toRawJson encodes an item into a JSON string with no escaping of HTML characters. -func toRawJson(v interface{}) string { - output, err := mustToRawJson(v) - if err != nil { - panic(err) - } - return string(output) -} - -// mustToRawJson encodes an item into a JSON string with no escaping of HTML characters. -func mustToRawJson(v interface{}) (string, error) { - buf := new(bytes.Buffer) - enc := json.NewEncoder(buf) - enc.SetEscapeHTML(false) - err := enc.Encode(&v) - if err != nil { - return "", err - } - return strings.TrimSuffix(buf.String(), "\n"), nil -} - -// ternary returns the first value if the last value is true, otherwise returns the second value. -func ternary(vt interface{}, vf interface{}, v bool) interface{} { - if v { - return vt - } - - return vf -} diff --git a/vendor/github.com/go-task/slim-sprig/dict.go b/vendor/github.com/go-task/slim-sprig/dict.go deleted file mode 100644 index 77ebc61b18..0000000000 --- a/vendor/github.com/go-task/slim-sprig/dict.go +++ /dev/null @@ -1,118 +0,0 @@ -package sprig - -func get(d map[string]interface{}, key string) interface{} { - if val, ok := d[key]; ok { - return val - } - return "" -} - -func set(d map[string]interface{}, key string, value interface{}) map[string]interface{} { - d[key] = value - return d -} - -func unset(d map[string]interface{}, key string) map[string]interface{} { - delete(d, key) - return d -} - -func hasKey(d map[string]interface{}, key string) bool { - _, ok := d[key] - return ok -} - -func pluck(key string, d ...map[string]interface{}) []interface{} { - res := []interface{}{} - for _, dict := range d { - if val, ok := dict[key]; ok { - res = append(res, val) - } - } - return res -} - -func keys(dicts ...map[string]interface{}) []string { - k := []string{} - for _, dict := range dicts { - for key := range dict { - k = append(k, key) - } - } - return k -} - -func pick(dict map[string]interface{}, keys ...string) map[string]interface{} { - res := map[string]interface{}{} - for _, k := range keys { - if v, ok := dict[k]; ok { - res[k] = v - } - } - return res -} - -func omit(dict map[string]interface{}, keys ...string) map[string]interface{} { - res := map[string]interface{}{} - - omit := make(map[string]bool, len(keys)) - for _, k := range keys { - omit[k] = true - } - - for k, v := range dict { - if _, ok := omit[k]; !ok { - res[k] = v - } - } - return res -} - -func dict(v ...interface{}) map[string]interface{} { - dict := map[string]interface{}{} - lenv := len(v) - for i := 0; i < lenv; i += 2 { - key := strval(v[i]) - if i+1 >= lenv { - dict[key] = "" - continue - } - dict[key] = v[i+1] - } - return dict -} - -func values(dict map[string]interface{}) []interface{} { - values := []interface{}{} - for _, value := range dict { - values = append(values, value) - } - - return values -} - -func dig(ps ...interface{}) (interface{}, error) { - if len(ps) < 3 { - panic("dig needs at least three arguments") - } - dict := ps[len(ps)-1].(map[string]interface{}) - def := ps[len(ps)-2] - ks := make([]string, len(ps)-2) - for i := 0; i < len(ks); i++ { - ks[i] = ps[i].(string) - } - - return digFromDict(dict, def, ks) -} - -func digFromDict(dict map[string]interface{}, d interface{}, ks []string) (interface{}, error) { - k, ns := ks[0], ks[1:len(ks)] - step, has := dict[k] - if !has { - return d, nil - } - if len(ns) == 0 { - return step, nil - } - return digFromDict(step.(map[string]interface{}), d, ns) -} diff --git a/vendor/github.com/go-task/slim-sprig/doc.go b/vendor/github.com/go-task/slim-sprig/doc.go deleted file mode 100644 index aabb9d4489..0000000000 --- a/vendor/github.com/go-task/slim-sprig/doc.go +++ /dev/null @@ -1,19 +0,0 @@ -/* -Package sprig provides template functions for Go. - -This package contains a number of utility functions for working with data -inside of Go `html/template` and `text/template` files. - -To add these functions, use the `template.Funcs()` method: - - t := templates.New("foo").Funcs(sprig.FuncMap()) - -Note that you should add the function map before you parse any template files. - - In several cases, Sprig reverses the order of arguments from the way they - appear in the standard library. This is to make it easier to pipe - arguments into functions. - -See http://masterminds.github.io/sprig/ for more detailed documentation on each of the available functions. -*/ -package sprig diff --git a/vendor/github.com/go-task/slim-sprig/functions.go b/vendor/github.com/go-task/slim-sprig/functions.go deleted file mode 100644 index 5ea74f8993..0000000000 --- a/vendor/github.com/go-task/slim-sprig/functions.go +++ /dev/null @@ -1,317 +0,0 @@ -package sprig - -import ( - "errors" - "html/template" - "math/rand" - "os" - "path" - "path/filepath" - "reflect" - "strconv" - "strings" - ttemplate "text/template" - "time" -) - -// FuncMap produces the function map. -// -// Use this to pass the functions into the template engine: -// -// tpl := template.New("foo").Funcs(sprig.FuncMap())) -// -func FuncMap() template.FuncMap { - return HtmlFuncMap() -} - -// HermeticTxtFuncMap returns a 'text/template'.FuncMap with only repeatable functions. -func HermeticTxtFuncMap() ttemplate.FuncMap { - r := TxtFuncMap() - for _, name := range nonhermeticFunctions { - delete(r, name) - } - return r -} - -// HermeticHtmlFuncMap returns an 'html/template'.Funcmap with only repeatable functions. -func HermeticHtmlFuncMap() template.FuncMap { - r := HtmlFuncMap() - for _, name := range nonhermeticFunctions { - delete(r, name) - } - return r -} - -// TxtFuncMap returns a 'text/template'.FuncMap -func TxtFuncMap() ttemplate.FuncMap { - return ttemplate.FuncMap(GenericFuncMap()) -} - -// HtmlFuncMap returns an 'html/template'.Funcmap -func HtmlFuncMap() template.FuncMap { - return template.FuncMap(GenericFuncMap()) -} - -// GenericFuncMap returns a copy of the basic function map as a map[string]interface{}. -func GenericFuncMap() map[string]interface{} { - gfm := make(map[string]interface{}, len(genericMap)) - for k, v := range genericMap { - gfm[k] = v - } - return gfm -} - -// These functions are not guaranteed to evaluate to the same result for given input, because they -// refer to the environment or global state. -var nonhermeticFunctions = []string{ - // Date functions - "date", - "date_in_zone", - "date_modify", - "now", - "htmlDate", - "htmlDateInZone", - "dateInZone", - "dateModify", - - // Strings - "randAlphaNum", - "randAlpha", - "randAscii", - "randNumeric", - "randBytes", - "uuidv4", - - // OS - "env", - "expandenv", - - // Network - "getHostByName", -} - -var genericMap = map[string]interface{}{ - "hello": func() string { return "Hello!" }, - - // Date functions - "ago": dateAgo, - "date": date, - "date_in_zone": dateInZone, - "date_modify": dateModify, - "dateInZone": dateInZone, - "dateModify": dateModify, - "duration": duration, - "durationRound": durationRound, - "htmlDate": htmlDate, - "htmlDateInZone": htmlDateInZone, - "must_date_modify": mustDateModify, - "mustDateModify": mustDateModify, - "mustToDate": mustToDate, - "now": time.Now, - "toDate": toDate, - "unixEpoch": unixEpoch, - - // Strings - "trunc": trunc, - "trim": strings.TrimSpace, - "upper": strings.ToUpper, - "lower": strings.ToLower, - "title": strings.Title, - "substr": substring, - // Switch order so that "foo" | repeat 5 - "repeat": func(count int, str string) string { return strings.Repeat(str, count) }, - // Deprecated: Use trimAll. - "trimall": func(a, b string) string { return strings.Trim(b, a) }, - // Switch order so that "$foo" | trimall "$" - "trimAll": func(a, b string) string { return strings.Trim(b, a) }, - "trimSuffix": func(a, b string) string { return strings.TrimSuffix(b, a) }, - "trimPrefix": func(a, b string) string { return strings.TrimPrefix(b, a) }, - // Switch order so that "foobar" | contains "foo" - "contains": func(substr string, str string) bool { return strings.Contains(str, substr) }, - "hasPrefix": func(substr string, str string) bool { return strings.HasPrefix(str, substr) }, - "hasSuffix": func(substr string, str string) bool { return strings.HasSuffix(str, substr) }, - "quote": quote, - "squote": squote, - "cat": cat, - "indent": indent, - "nindent": nindent, - "replace": replace, - "plural": plural, - "sha1sum": sha1sum, - "sha256sum": sha256sum, - "adler32sum": adler32sum, - "toString": strval, - - // Wrap Atoi to stop errors. - "atoi": func(a string) int { i, _ := strconv.Atoi(a); return i }, - "int64": toInt64, - "int": toInt, - "float64": toFloat64, - "seq": seq, - "toDecimal": toDecimal, - - //"gt": func(a, b int) bool {return a > b}, - //"gte": func(a, b int) bool {return a >= b}, - //"lt": func(a, b int) bool {return a < b}, - //"lte": func(a, b int) bool {return a <= b}, - - // split "/" foo/bar returns map[int]string{0: foo, 1: bar} - "split": split, - "splitList": func(sep, orig string) []string { return strings.Split(orig, sep) }, - // splitn "/" foo/bar/fuu returns map[int]string{0: foo, 1: bar/fuu} - "splitn": splitn, - "toStrings": strslice, - - "until": until, - "untilStep": untilStep, - - // VERY basic arithmetic. - "add1": func(i interface{}) int64 { return toInt64(i) + 1 }, - "add": func(i ...interface{}) int64 { - var a int64 = 0 - for _, b := range i { - a += toInt64(b) - } - return a - }, - "sub": func(a, b interface{}) int64 { return toInt64(a) - toInt64(b) }, - "div": func(a, b interface{}) int64 { return toInt64(a) / toInt64(b) }, - "mod": func(a, b interface{}) int64 { return toInt64(a) % toInt64(b) }, - "mul": func(a interface{}, v ...interface{}) int64 { - val := toInt64(a) - for _, b := range v { - val = val * toInt64(b) - } - return val - }, - "randInt": func(min, max int) int { return rand.Intn(max-min) + min }, - "biggest": max, - "max": max, - "min": min, - "maxf": maxf, - "minf": minf, - "ceil": ceil, - "floor": floor, - "round": round, - - // string slices. Note that we reverse the order b/c that's better - // for template processing. - "join": join, - "sortAlpha": sortAlpha, - - // Defaults - "default": dfault, - "empty": empty, - "coalesce": coalesce, - "all": all, - "any": any, - "compact": compact, - "mustCompact": mustCompact, - "fromJson": fromJson, - "toJson": toJson, - "toPrettyJson": toPrettyJson, - "toRawJson": toRawJson, - "mustFromJson": mustFromJson, - "mustToJson": mustToJson, - "mustToPrettyJson": mustToPrettyJson, - "mustToRawJson": mustToRawJson, - "ternary": ternary, - - // Reflection - "typeOf": typeOf, - "typeIs": typeIs, - "typeIsLike": typeIsLike, - "kindOf": kindOf, - "kindIs": kindIs, - "deepEqual": reflect.DeepEqual, - - // OS: - "env": os.Getenv, - "expandenv": os.ExpandEnv, - - // Network: - "getHostByName": getHostByName, - - // Paths: - "base": path.Base, - "dir": path.Dir, - "clean": path.Clean, - "ext": path.Ext, - "isAbs": path.IsAbs, - - // Filepaths: - "osBase": filepath.Base, - "osClean": filepath.Clean, - "osDir": filepath.Dir, - "osExt": filepath.Ext, - "osIsAbs": filepath.IsAbs, - - // Encoding: - "b64enc": base64encode, - "b64dec": base64decode, - "b32enc": base32encode, - "b32dec": base32decode, - - // Data Structures: - "tuple": list, // FIXME: with the addition of append/prepend these are no longer immutable. - "list": list, - "dict": dict, - "get": get, - "set": set, - "unset": unset, - "hasKey": hasKey, - "pluck": pluck, - "keys": keys, - "pick": pick, - "omit": omit, - "values": values, - - "append": push, "push": push, - "mustAppend": mustPush, "mustPush": mustPush, - "prepend": prepend, - "mustPrepend": mustPrepend, - "first": first, - "mustFirst": mustFirst, - "rest": rest, - "mustRest": mustRest, - "last": last, - "mustLast": mustLast, - "initial": initial, - "mustInitial": mustInitial, - "reverse": reverse, - "mustReverse": mustReverse, - "uniq": uniq, - "mustUniq": mustUniq, - "without": without, - "mustWithout": mustWithout, - "has": has, - "mustHas": mustHas, - "slice": slice, - "mustSlice": mustSlice, - "concat": concat, - "dig": dig, - "chunk": chunk, - "mustChunk": mustChunk, - - // Flow Control: - "fail": func(msg string) (string, error) { return "", errors.New(msg) }, - - // Regex - "regexMatch": regexMatch, - "mustRegexMatch": mustRegexMatch, - "regexFindAll": regexFindAll, - "mustRegexFindAll": mustRegexFindAll, - "regexFind": regexFind, - "mustRegexFind": mustRegexFind, - "regexReplaceAll": regexReplaceAll, - "mustRegexReplaceAll": mustRegexReplaceAll, - "regexReplaceAllLiteral": regexReplaceAllLiteral, - "mustRegexReplaceAllLiteral": mustRegexReplaceAllLiteral, - "regexSplit": regexSplit, - "mustRegexSplit": mustRegexSplit, - "regexQuoteMeta": regexQuoteMeta, - - // URLs: - "urlParse": urlParse, - "urlJoin": urlJoin, -} diff --git a/vendor/github.com/go-task/slim-sprig/go.mod b/vendor/github.com/go-task/slim-sprig/go.mod deleted file mode 100644 index d90a221bec..0000000000 --- a/vendor/github.com/go-task/slim-sprig/go.mod +++ /dev/null @@ -1,8 +0,0 @@ -module github.com/go-task/slim-sprig - -go 1.13 - -require ( - github.com/davecgh/go-spew v1.1.1 // indirect - github.com/stretchr/testify v1.5.1 -) diff --git a/vendor/github.com/go-task/slim-sprig/go.sum b/vendor/github.com/go-task/slim-sprig/go.sum deleted file mode 100644 index 256ef84936..0000000000 --- a/vendor/github.com/go-task/slim-sprig/go.sum +++ /dev/null @@ -1,22 +0,0 @@ -github.com/davecgh/go-spew v1.1.0 h1:ZDRjVQ15GmhC3fiQ8ni8+OwkZQO4DARzQgrnXU1Liz8= -github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= -github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= -github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= -github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= -github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= -github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= -github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= -github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= -github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= -github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= -github.com/stretchr/objx v0.1.0 h1:4G4v2dO3VZwixGIRoQ5Lfboy6nUhCyYzaqnIAPPhYs4= -github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= -github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= -github.com/stretchr/testify v1.5.1 h1:nOGnQDM7FYENwehXlg/kFVnos3rEvtKTjRvOWSzb6H4= -github.com/stretchr/testify v1.5.1 h1:nOGnQDM7FYENwehXlg/kFVnos3rEvtKTjRvOWSzb6H4= -github.com/stretchr/testify v1.5.1/go.mod h1:5W2xD1RspED5o8YsWQXVCued0rvSQ+mT+I5cxcmMvtA= -github.com/stretchr/testify v1.5.1/go.mod h1:5W2xD1RspED5o8YsWQXVCued0rvSQ+mT+I5cxcmMvtA= -gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405 h1:yhCVgyC4o1eVCa2tZl7eS0r+SDo693bJlVdllGtEeKM= -gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= -gopkg.in/yaml.v2 v2.2.2 h1:ZCJp+EgiOT7lHqUV2J862kp8Qj64Jo6az82+3Td9dZw= -gopkg.in/yaml.v2 v2.2.2/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= diff --git a/vendor/github.com/go-task/slim-sprig/list.go b/vendor/github.com/go-task/slim-sprig/list.go deleted file mode 100644 index ca0fbb7893..0000000000 --- a/vendor/github.com/go-task/slim-sprig/list.go +++ /dev/null @@ -1,464 +0,0 @@ -package sprig - -import ( - "fmt" - "math" - "reflect" - "sort" -) - -// Reflection is used in these functions so that slices and arrays of strings, -// ints, and other types not implementing []interface{} can be worked with. -// For example, this is useful if you need to work on the output of regexs. - -func list(v ...interface{}) []interface{} { - return v -} - -func push(list interface{}, v interface{}) []interface{} { - l, err := mustPush(list, v) - if err != nil { - panic(err) - } - - return l -} - -func mustPush(list interface{}, v interface{}) ([]interface{}, error) { - tp := reflect.TypeOf(list).Kind() - switch tp { - case reflect.Slice, reflect.Array: - l2 := reflect.ValueOf(list) - - l := l2.Len() - nl := make([]interface{}, l) - for i := 0; i < l; i++ { - nl[i] = l2.Index(i).Interface() - } - - return append(nl, v), nil - - default: - return nil, fmt.Errorf("Cannot push on type %s", tp) - } -} - -func prepend(list interface{}, v interface{}) []interface{} { - l, err := mustPrepend(list, v) - if err != nil { - panic(err) - } - - return l -} - -func mustPrepend(list interface{}, v interface{}) ([]interface{}, error) { - //return append([]interface{}{v}, list...) - - tp := reflect.TypeOf(list).Kind() - switch tp { - case reflect.Slice, reflect.Array: - l2 := reflect.ValueOf(list) - - l := l2.Len() - nl := make([]interface{}, l) - for i := 0; i < l; i++ { - nl[i] = l2.Index(i).Interface() - } - - return append([]interface{}{v}, nl...), nil - - default: - return nil, fmt.Errorf("Cannot prepend on type %s", tp) - } -} - -func chunk(size int, list interface{}) [][]interface{} { - l, err := mustChunk(size, list) - if err != nil { - panic(err) - } - - return l -} - -func mustChunk(size int, list interface{}) ([][]interface{}, error) { - tp := reflect.TypeOf(list).Kind() - switch tp { - case reflect.Slice, reflect.Array: - l2 := reflect.ValueOf(list) - - l := l2.Len() - - cs := int(math.Floor(float64(l-1)/float64(size)) + 1) - nl := make([][]interface{}, cs) - - for i := 0; i < cs; i++ { - clen := size - if i == cs-1 { - clen = int(math.Floor(math.Mod(float64(l), float64(size)))) - if clen == 0 { - clen = size - } - } - - nl[i] = make([]interface{}, clen) - - for j := 0; j < clen; j++ { - ix := i*size + j - nl[i][j] = l2.Index(ix).Interface() - } - } - - return nl, nil - - default: - return nil, fmt.Errorf("Cannot chunk type %s", tp) - } -} - -func last(list interface{}) interface{} { - l, err := mustLast(list) - if err != nil { - panic(err) - } - - return l -} - -func mustLast(list interface{}) (interface{}, error) { - tp := reflect.TypeOf(list).Kind() - switch tp { - case reflect.Slice, reflect.Array: - l2 := reflect.ValueOf(list) - - l := l2.Len() - if l == 0 { - return nil, nil - } - - return l2.Index(l - 1).Interface(), nil - default: - return nil, fmt.Errorf("Cannot find last on type %s", tp) - } -} - -func first(list interface{}) interface{} { - l, err := mustFirst(list) - if err != nil { - panic(err) - } - - return l -} - -func mustFirst(list interface{}) (interface{}, error) { - tp := reflect.TypeOf(list).Kind() - switch tp { - case reflect.Slice, reflect.Array: - l2 := reflect.ValueOf(list) - - l := l2.Len() - if l == 0 { - return nil, nil - } - - return l2.Index(0).Interface(), nil - default: - return nil, fmt.Errorf("Cannot find first on type %s", tp) - } -} - -func rest(list interface{}) []interface{} { - l, err := mustRest(list) - if err != nil { - panic(err) - } - - return l -} - -func mustRest(list interface{}) ([]interface{}, error) { - tp := reflect.TypeOf(list).Kind() - switch tp { - case reflect.Slice, reflect.Array: - l2 := reflect.ValueOf(list) - - l := l2.Len() - if l == 0 { - return nil, nil - } - - nl := make([]interface{}, l-1) - for i := 1; i < l; i++ { - nl[i-1] = l2.Index(i).Interface() - } - - return nl, nil - default: - return nil, fmt.Errorf("Cannot find rest on type %s", tp) - } -} - -func initial(list interface{}) []interface{} { - l, err := mustInitial(list) - if err != nil { - panic(err) - } - - return l -} - -func mustInitial(list interface{}) ([]interface{}, error) { - tp := reflect.TypeOf(list).Kind() - switch tp { - case reflect.Slice, reflect.Array: - l2 := reflect.ValueOf(list) - - l := l2.Len() - if l == 0 { - return nil, nil - } - - nl := make([]interface{}, l-1) - for i := 0; i < l-1; i++ { - nl[i] = l2.Index(i).Interface() - } - - return nl, nil - default: - return nil, fmt.Errorf("Cannot find initial on type %s", tp) - } -} - -func sortAlpha(list interface{}) []string { - k := reflect.Indirect(reflect.ValueOf(list)).Kind() - switch k { - case reflect.Slice, reflect.Array: - a := strslice(list) - s := sort.StringSlice(a) - s.Sort() - return s - } - return []string{strval(list)} -} - -func reverse(v interface{}) []interface{} { - l, err := mustReverse(v) - if err != nil { - panic(err) - } - - return l -} - -func mustReverse(v interface{}) ([]interface{}, error) { - tp := reflect.TypeOf(v).Kind() - switch tp { - case reflect.Slice, reflect.Array: - l2 := reflect.ValueOf(v) - - l := l2.Len() - // We do not sort in place because the incoming array should not be altered. - nl := make([]interface{}, l) - for i := 0; i < l; i++ { - nl[l-i-1] = l2.Index(i).Interface() - } - - return nl, nil - default: - return nil, fmt.Errorf("Cannot find reverse on type %s", tp) - } -} - -func compact(list interface{}) []interface{} { - l, err := mustCompact(list) - if err != nil { - panic(err) - } - - return l -} - -func mustCompact(list interface{}) ([]interface{}, error) { - tp := reflect.TypeOf(list).Kind() - switch tp { - case reflect.Slice, reflect.Array: - l2 := reflect.ValueOf(list) - - l := l2.Len() - nl := []interface{}{} - var item interface{} - for i := 0; i < l; i++ { - item = l2.Index(i).Interface() - if !empty(item) { - nl = append(nl, item) - } - } - - return nl, nil - default: - return nil, fmt.Errorf("Cannot compact on type %s", tp) - } -} - -func uniq(list interface{}) []interface{} { - l, err := mustUniq(list) - if err != nil { - panic(err) - } - - return l -} - -func mustUniq(list interface{}) ([]interface{}, error) { - tp := reflect.TypeOf(list).Kind() - switch tp { - case reflect.Slice, reflect.Array: - l2 := reflect.ValueOf(list) - - l := l2.Len() - dest := []interface{}{} - var item interface{} - for i := 0; i < l; i++ { - item = l2.Index(i).Interface() - if !inList(dest, item) { - dest = append(dest, item) - } - } - - return dest, nil - default: - return nil, fmt.Errorf("Cannot find uniq on type %s", tp) - } -} - -func inList(haystack []interface{}, needle interface{}) bool { - for _, h := range haystack { - if reflect.DeepEqual(needle, h) { - return true - } - } - return false -} - -func without(list interface{}, omit ...interface{}) []interface{} { - l, err := mustWithout(list, omit...) - if err != nil { - panic(err) - } - - return l -} - -func mustWithout(list interface{}, omit ...interface{}) ([]interface{}, error) { - tp := reflect.TypeOf(list).Kind() - switch tp { - case reflect.Slice, reflect.Array: - l2 := reflect.ValueOf(list) - - l := l2.Len() - res := []interface{}{} - var item interface{} - for i := 0; i < l; i++ { - item = l2.Index(i).Interface() - if !inList(omit, item) { - res = append(res, item) - } - } - - return res, nil - default: - return nil, fmt.Errorf("Cannot find without on type %s", tp) - } -} - -func has(needle interface{}, haystack interface{}) bool { - l, err := mustHas(needle, haystack) - if err != nil { - panic(err) - } - - return l -} - -func mustHas(needle interface{}, haystack interface{}) (bool, error) { - if haystack == nil { - return false, nil - } - tp := reflect.TypeOf(haystack).Kind() - switch tp { - case reflect.Slice, reflect.Array: - l2 := reflect.ValueOf(haystack) - var item interface{} - l := l2.Len() - for i := 0; i < l; i++ { - item = l2.Index(i).Interface() - if reflect.DeepEqual(needle, item) { - return true, nil - } - } - - return false, nil - default: - return false, fmt.Errorf("Cannot find has on type %s", tp) - } -} - -// $list := [1, 2, 3, 4, 5] -// slice $list -> list[0:5] = list[:] -// slice $list 0 3 -> list[0:3] = list[:3] -// slice $list 3 5 -> list[3:5] -// slice $list 3 -> list[3:5] = list[3:] -func slice(list interface{}, indices ...interface{}) interface{} { - l, err := mustSlice(list, indices...) - if err != nil { - panic(err) - } - - return l -} - -func mustSlice(list interface{}, indices ...interface{}) (interface{}, error) { - tp := reflect.TypeOf(list).Kind() - switch tp { - case reflect.Slice, reflect.Array: - l2 := reflect.ValueOf(list) - - l := l2.Len() - if l == 0 { - return nil, nil - } - - var start, end int - if len(indices) > 0 { - start = toInt(indices[0]) - } - if len(indices) < 2 { - end = l - } else { - end = toInt(indices[1]) - } - - return l2.Slice(start, end).Interface(), nil - default: - return nil, fmt.Errorf("list should be type of slice or array but %s", tp) - } -} - -func concat(lists ...interface{}) interface{} { - var res []interface{} - for _, list := range lists { - tp := reflect.TypeOf(list).Kind() - switch tp { - case reflect.Slice, reflect.Array: - l2 := reflect.ValueOf(list) - for i := 0; i < l2.Len(); i++ { - res = append(res, l2.Index(i).Interface()) - } - default: - panic(fmt.Sprintf("Cannot concat type %s as list", tp)) - } - } - return res -} diff --git a/vendor/github.com/go-task/slim-sprig/network.go b/vendor/github.com/go-task/slim-sprig/network.go deleted file mode 100644 index 108d78a946..0000000000 --- a/vendor/github.com/go-task/slim-sprig/network.go +++ /dev/null @@ -1,12 +0,0 @@ -package sprig - -import ( - "math/rand" - "net" -) - -func getHostByName(name string) string { - addrs, _ := net.LookupHost(name) - //TODO: add error handing when release v3 comes out - return addrs[rand.Intn(len(addrs))] -} diff --git a/vendor/github.com/go-task/slim-sprig/numeric.go b/vendor/github.com/go-task/slim-sprig/numeric.go deleted file mode 100644 index 98cbb37a19..0000000000 --- a/vendor/github.com/go-task/slim-sprig/numeric.go +++ /dev/null @@ -1,228 +0,0 @@ -package sprig - -import ( - "fmt" - "math" - "reflect" - "strconv" - "strings" -) - -// toFloat64 converts 64-bit floats -func toFloat64(v interface{}) float64 { - if str, ok := v.(string); ok { - iv, err := strconv.ParseFloat(str, 64) - if err != nil { - return 0 - } - return iv - } - - val := reflect.Indirect(reflect.ValueOf(v)) - switch val.Kind() { - case reflect.Int8, reflect.Int16, reflect.Int32, reflect.Int64, reflect.Int: - return float64(val.Int()) - case reflect.Uint8, reflect.Uint16, reflect.Uint32: - return float64(val.Uint()) - case reflect.Uint, reflect.Uint64: - return float64(val.Uint()) - case reflect.Float32, reflect.Float64: - return val.Float() - case reflect.Bool: - if val.Bool() { - return 1 - } - return 0 - default: - return 0 - } -} - -func toInt(v interface{}) int { - //It's not optimal. Bud I don't want duplicate toInt64 code. - return int(toInt64(v)) -} - -// toInt64 converts integer types to 64-bit integers -func toInt64(v interface{}) int64 { - if str, ok := v.(string); ok { - iv, err := strconv.ParseInt(str, 10, 64) - if err != nil { - return 0 - } - return iv - } - - val := reflect.Indirect(reflect.ValueOf(v)) - switch val.Kind() { - case reflect.Int8, reflect.Int16, reflect.Int32, reflect.Int64, reflect.Int: - return val.Int() - case reflect.Uint8, reflect.Uint16, reflect.Uint32: - return int64(val.Uint()) - case reflect.Uint, reflect.Uint64: - tv := val.Uint() - if tv <= math.MaxInt64 { - return int64(tv) - } - // TODO: What is the sensible thing to do here? - return math.MaxInt64 - case reflect.Float32, reflect.Float64: - return int64(val.Float()) - case reflect.Bool: - if val.Bool() { - return 1 - } - return 0 - default: - return 0 - } -} - -func max(a interface{}, i ...interface{}) int64 { - aa := toInt64(a) - for _, b := range i { - bb := toInt64(b) - if bb > aa { - aa = bb - } - } - return aa -} - -func maxf(a interface{}, i ...interface{}) float64 { - aa := toFloat64(a) - for _, b := range i { - bb := toFloat64(b) - aa = math.Max(aa, bb) - } - return aa -} - -func min(a interface{}, i ...interface{}) int64 { - aa := toInt64(a) - for _, b := range i { - bb := toInt64(b) - if bb < aa { - aa = bb - } - } - return aa -} - -func minf(a interface{}, i ...interface{}) float64 { - aa := toFloat64(a) - for _, b := range i { - bb := toFloat64(b) - aa = math.Min(aa, bb) - } - return aa -} - -func until(count int) []int { - step := 1 - if count < 0 { - step = -1 - } - return untilStep(0, count, step) -} - -func untilStep(start, stop, step int) []int { - v := []int{} - - if stop < start { - if step >= 0 { - return v - } - for i := start; i > stop; i += step { - v = append(v, i) - } - return v - } - - if step <= 0 { - return v - } - for i := start; i < stop; i += step { - v = append(v, i) - } - return v -} - -func floor(a interface{}) float64 { - aa := toFloat64(a) - return math.Floor(aa) -} - -func ceil(a interface{}) float64 { - aa := toFloat64(a) - return math.Ceil(aa) -} - -func round(a interface{}, p int, rOpt ...float64) float64 { - roundOn := .5 - if len(rOpt) > 0 { - roundOn = rOpt[0] - } - val := toFloat64(a) - places := toFloat64(p) - - var round float64 - pow := math.Pow(10, places) - digit := pow * val - _, div := math.Modf(digit) - if div >= roundOn { - round = math.Ceil(digit) - } else { - round = math.Floor(digit) - } - return round / pow -} - -// converts unix octal to decimal -func toDecimal(v interface{}) int64 { - result, err := strconv.ParseInt(fmt.Sprint(v), 8, 64) - if err != nil { - return 0 - } - return result -} - -func seq(params ...int) string { - increment := 1 - switch len(params) { - case 0: - return "" - case 1: - start := 1 - end := params[0] - if end < start { - increment = -1 - } - return intArrayToString(untilStep(start, end+increment, increment), " ") - case 3: - start := params[0] - end := params[2] - step := params[1] - if end < start { - increment = -1 - if step > 0 { - return "" - } - } - return intArrayToString(untilStep(start, end+increment, step), " ") - case 2: - start := params[0] - end := params[1] - step := 1 - if end < start { - step = -1 - } - return intArrayToString(untilStep(start, end+step, step), " ") - default: - return "" - } -} - -func intArrayToString(slice []int, delimeter string) string { - return strings.Trim(strings.Join(strings.Fields(fmt.Sprint(slice)), delimeter), "[]") -} diff --git a/vendor/github.com/go-task/slim-sprig/reflect.go b/vendor/github.com/go-task/slim-sprig/reflect.go deleted file mode 100644 index 8a65c132f0..0000000000 --- a/vendor/github.com/go-task/slim-sprig/reflect.go +++ /dev/null @@ -1,28 +0,0 @@ -package sprig - -import ( - "fmt" - "reflect" -) - -// typeIs returns true if the src is the type named in target. -func typeIs(target string, src interface{}) bool { - return target == typeOf(src) -} - -func typeIsLike(target string, src interface{}) bool { - t := typeOf(src) - return target == t || "*"+target == t -} - -func typeOf(src interface{}) string { - return fmt.Sprintf("%T", src) -} - -func kindIs(target string, src interface{}) bool { - return target == kindOf(src) -} - -func kindOf(src interface{}) string { - return reflect.ValueOf(src).Kind().String() -} diff --git a/vendor/github.com/go-task/slim-sprig/regex.go b/vendor/github.com/go-task/slim-sprig/regex.go deleted file mode 100644 index fab5510189..0000000000 --- a/vendor/github.com/go-task/slim-sprig/regex.go +++ /dev/null @@ -1,83 +0,0 @@ -package sprig - -import ( - "regexp" -) - -func regexMatch(regex string, s string) bool { - match, _ := regexp.MatchString(regex, s) - return match -} - -func mustRegexMatch(regex string, s string) (bool, error) { - return regexp.MatchString(regex, s) -} - -func regexFindAll(regex string, s string, n int) []string { - r := regexp.MustCompile(regex) - return r.FindAllString(s, n) -} - -func mustRegexFindAll(regex string, s string, n int) ([]string, error) { - r, err := regexp.Compile(regex) - if err != nil { - return []string{}, err - } - return r.FindAllString(s, n), nil -} - -func regexFind(regex string, s string) string { - r := regexp.MustCompile(regex) - return r.FindString(s) -} - -func mustRegexFind(regex string, s string) (string, error) { - r, err := regexp.Compile(regex) - if err != nil { - return "", err - } - return r.FindString(s), nil -} - -func regexReplaceAll(regex string, s string, repl string) string { - r := regexp.MustCompile(regex) - return r.ReplaceAllString(s, repl) -} - -func mustRegexReplaceAll(regex string, s string, repl string) (string, error) { - r, err := regexp.Compile(regex) - if err != nil { - return "", err - } - return r.ReplaceAllString(s, repl), nil -} - -func regexReplaceAllLiteral(regex string, s string, repl string) string { - r := regexp.MustCompile(regex) - return r.ReplaceAllLiteralString(s, repl) -} - -func mustRegexReplaceAllLiteral(regex string, s string, repl string) (string, error) { - r, err := regexp.Compile(regex) - if err != nil { - return "", err - } - return r.ReplaceAllLiteralString(s, repl), nil -} - -func regexSplit(regex string, s string, n int) []string { - r := regexp.MustCompile(regex) - return r.Split(s, n) -} - -func mustRegexSplit(regex string, s string, n int) ([]string, error) { - r, err := regexp.Compile(regex) - if err != nil { - return []string{}, err - } - return r.Split(s, n), nil -} - -func regexQuoteMeta(s string) string { - return regexp.QuoteMeta(s) -} diff --git a/vendor/github.com/go-task/slim-sprig/strings.go b/vendor/github.com/go-task/slim-sprig/strings.go deleted file mode 100644 index 3c62d6b6f2..0000000000 --- a/vendor/github.com/go-task/slim-sprig/strings.go +++ /dev/null @@ -1,189 +0,0 @@ -package sprig - -import ( - "encoding/base32" - "encoding/base64" - "fmt" - "reflect" - "strconv" - "strings" -) - -func base64encode(v string) string { - return base64.StdEncoding.EncodeToString([]byte(v)) -} - -func base64decode(v string) string { - data, err := base64.StdEncoding.DecodeString(v) - if err != nil { - return err.Error() - } - return string(data) -} - -func base32encode(v string) string { - return base32.StdEncoding.EncodeToString([]byte(v)) -} - -func base32decode(v string) string { - data, err := base32.StdEncoding.DecodeString(v) - if err != nil { - return err.Error() - } - return string(data) -} - -func quote(str ...interface{}) string { - out := make([]string, 0, len(str)) - for _, s := range str { - if s != nil { - out = append(out, fmt.Sprintf("%q", strval(s))) - } - } - return strings.Join(out, " ") -} - -func squote(str ...interface{}) string { - out := make([]string, 0, len(str)) - for _, s := range str { - if s != nil { - out = append(out, fmt.Sprintf("'%v'", s)) - } - } - return strings.Join(out, " ") -} - -func cat(v ...interface{}) string { - v = removeNilElements(v) - r := strings.TrimSpace(strings.Repeat("%v ", len(v))) - return fmt.Sprintf(r, v...) -} - -func indent(spaces int, v string) string { - pad := strings.Repeat(" ", spaces) - return pad + strings.Replace(v, "\n", "\n"+pad, -1) -} - -func nindent(spaces int, v string) string { - return "\n" + indent(spaces, v) -} - -func replace(old, new, src string) string { - return strings.Replace(src, old, new, -1) -} - -func plural(one, many string, count int) string { - if count == 1 { - return one - } - return many -} - -func strslice(v interface{}) []string { - switch v := v.(type) { - case []string: - return v - case []interface{}: - b := make([]string, 0, len(v)) - for _, s := range v { - if s != nil { - b = append(b, strval(s)) - } - } - return b - default: - val := reflect.ValueOf(v) - switch val.Kind() { - case reflect.Array, reflect.Slice: - l := val.Len() - b := make([]string, 0, l) - for i := 0; i < l; i++ { - value := val.Index(i).Interface() - if value != nil { - b = append(b, strval(value)) - } - } - return b - default: - if v == nil { - return []string{} - } - - return []string{strval(v)} - } - } -} - -func removeNilElements(v []interface{}) []interface{} { - newSlice := make([]interface{}, 0, len(v)) - for _, i := range v { - if i != nil { - newSlice = append(newSlice, i) - } - } - return newSlice -} - -func strval(v interface{}) string { - switch v := v.(type) { - case string: - return v - case []byte: - return string(v) - case error: - return v.Error() - case fmt.Stringer: - return v.String() - default: - return fmt.Sprintf("%v", v) - } -} - -func trunc(c int, s string) string { - if c < 0 && len(s)+c > 0 { - return s[len(s)+c:] - } - if c >= 0 && len(s) > c { - return s[:c] - } - return s -} - -func join(sep string, v interface{}) string { - return strings.Join(strslice(v), sep) -} - -func split(sep, orig string) map[string]string { - parts := strings.Split(orig, sep) - res := make(map[string]string, len(parts)) - for i, v := range parts { - res["_"+strconv.Itoa(i)] = v - } - return res -} - -func splitn(sep string, n int, orig string) map[string]string { - parts := strings.SplitN(orig, sep, n) - res := make(map[string]string, len(parts)) - for i, v := range parts { - res["_"+strconv.Itoa(i)] = v - } - return res -} - -// substring creates a substring of the given string. -// -// If start is < 0, this calls string[:end]. -// -// If start is >= 0 and end < 0 or end bigger than s length, this calls string[start:] -// -// Otherwise, this calls string[start, end]. -func substring(start, end int, s string) string { - if start < 0 { - return s[:end] - } - if end < 0 || end > len(s) { - return s[start:] - } - return s[start:end] -} diff --git a/vendor/github.com/go-task/slim-sprig/url.go b/vendor/github.com/go-task/slim-sprig/url.go deleted file mode 100644 index b8e120e19b..0000000000 --- a/vendor/github.com/go-task/slim-sprig/url.go +++ /dev/null @@ -1,66 +0,0 @@ -package sprig - -import ( - "fmt" - "net/url" - "reflect" -) - -func dictGetOrEmpty(dict map[string]interface{}, key string) string { - value, ok := dict[key] - if !ok { - return "" - } - tp := reflect.TypeOf(value).Kind() - if tp != reflect.String { - panic(fmt.Sprintf("unable to parse %s key, must be of type string, but %s found", key, tp.String())) - } - return reflect.ValueOf(value).String() -} - -// parses given URL to return dict object -func urlParse(v string) map[string]interface{} { - dict := map[string]interface{}{} - parsedURL, err := url.Parse(v) - if err != nil { - panic(fmt.Sprintf("unable to parse url: %s", err)) - } - dict["scheme"] = parsedURL.Scheme - dict["host"] = parsedURL.Host - dict["hostname"] = parsedURL.Hostname() - dict["path"] = parsedURL.Path - dict["query"] = parsedURL.RawQuery - dict["opaque"] = parsedURL.Opaque - dict["fragment"] = parsedURL.Fragment - if parsedURL.User != nil { - dict["userinfo"] = parsedURL.User.String() - } else { - dict["userinfo"] = "" - } - - return dict -} - -// join given dict to URL string -func urlJoin(d map[string]interface{}) string { - resURL := url.URL{ - Scheme: dictGetOrEmpty(d, "scheme"), - Host: dictGetOrEmpty(d, "host"), - Path: dictGetOrEmpty(d, "path"), - RawQuery: dictGetOrEmpty(d, "query"), - Opaque: dictGetOrEmpty(d, "opaque"), - Fragment: dictGetOrEmpty(d, "fragment"), - } - userinfo := dictGetOrEmpty(d, "userinfo") - var user *url.Userinfo - if userinfo != "" { - tempURL, err := url.Parse(fmt.Sprintf("proto://%s@host", userinfo)) - if err != nil { - panic(fmt.Sprintf("unable to parse userinfo in dict: %s", err)) - } - user = tempURL.User - } - - resURL.User = user - return resURL.String() -} diff --git a/vendor/github.com/godbus/dbus/v5/CONTRIBUTING.md b/vendor/github.com/godbus/dbus/v5/CONTRIBUTING.md deleted file mode 100644 index c88f9b2bdd..0000000000 --- a/vendor/github.com/godbus/dbus/v5/CONTRIBUTING.md +++ /dev/null @@ -1,50 +0,0 @@ -# How to Contribute - -## Getting Started - -- Fork the repository on GitHub -- Read the [README](README.markdown) for build and test instructions -- Play with the project, submit bugs, submit patches! - -## Contribution Flow - -This is a rough outline of what a contributor's workflow looks like: - -- Create a topic branch from where you want to base your work (usually master). -- Make commits of logical units. -- Make sure your commit messages are in the proper format (see below). -- Push your changes to a topic branch in your fork of the repository. -- Make sure the tests pass, and add any new tests as appropriate. -- Submit a pull request to the original repository. - -Thanks for your contributions! - -### Format of the Commit Message - -We follow a rough convention for commit messages that is designed to answer two -questions: what changed and why. The subject line should feature the what and -the body of the commit should describe the why. - -``` -scripts: add the test-cluster command - -this uses tmux to setup a test cluster that you can easily kill and -start for debugging. - -Fixes #38 -``` - -The format can be described more formally as follows: - -``` -: - - - -